@logosphere-ui/core 0.0.0-alpha.2 → 0.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chatbot-Da_itUdJ.cjs +160 -0
- package/dist/{chatbot-Ces7Xveb.js → chatbot-zkxngMRH.js} +63 -78
- package/dist/chatbot.cjs +1 -1
- package/dist/chatbot.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/{input-DsIOQPGV.cjs → input-BcnI1w3_.cjs} +2 -2
- package/dist/{input-ByllRq9M.js → input-Bj_7u8Iv.js} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/popover-B7tCqk3R.js +140 -0
- package/dist/popover-C2p5Pmts.cjs +30 -0
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/text-area-BkHdLnZj.cjs +44 -0
- package/dist/{text-area-CtZY3yLA.js → text-area-CC24lj8v.js} +4 -4
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/package.json +1 -1
- package/dist/chatbot-oRwt64d8.cjs +0 -160
- package/dist/directive-Z_rhNYWK.js +0 -240
- package/dist/directive-ekjitgzi.cjs +0 -3
- package/dist/live-BX-yBGvT.cjs +0 -1
- package/dist/live-WTVSYE2F.js +0 -24
- package/dist/popover-C_Ob86CJ.cjs +0 -30
- package/dist/popover-D-FXdEdS.js +0 -1040
- package/dist/text-area-DFDF5oos.cjs +0 -44
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";const n=require("lit"),o=require("lit/decorators.js"),b=require("lit/directives/unsafe-html.js"),m=":host{display:block;z-index:9999}.chatbot{font-family:var(--font-family-base)}.chatbot__overlay{position:fixed;inset:0;background-color:#0003;z-index:var(--z-index-modal-backdrop)}.chatbot__launcher{position:fixed;z-index:var(--z-index-modal);display:flex;align-items:center;gap:var(--spacing-4);padding-left:var(--spacing-4);padding-right:var(--spacing-4);height:66px;color:#fff;border-radius:var(--radius-xl);cursor:pointer;box-shadow:var(--shadow-base);background-color:var(--color-body-bg);overflow:hidden;transition:box-shadow var(--transition-speed-fast) var(--transition-timing)}.chatbot__launcher:hover{box-shadow:var(--shadow-md)}.chatbot__launcher--draggable{cursor:move}.chatbot__launcher--hidden{visibility:hidden;width:72px;height:66px;justify-content:center;padding:0}.chatbot__launcher-icon{width:40px;height:34px;flex-shrink:0}.chatbot__launcher-text{display:flex;flex-direction:column}.chatbot__launcher-title{font-weight:var(--font-weight-semibold);font-size:var(--font-size-xl);margin:0;line-height:24px;white-space:nowrap;color:var(--color-body-text)}.chatbot__launcher-subtitle{font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);margin:0;line-height:20px;white-space:nowrap;color:var(--color-tertiary)}.chatbot__window{position:fixed;z-index:var(--z-index-modal);display:flex;flex-direction:column;box-shadow:var(--shadow-xl);border-radius:var(--radius-md);overflow:hidden;background-color:var(--color-body-bg)}.chatbot__window--hidden{display:none}.chatbot__window--fullscreen{inset:80px 50px;width:auto;height:auto}.chatbot__resize-top{position:absolute;top:0;left:0;right:0;height:8px;cursor:ns-resize;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-top:hover{background-color:#0000000d}.chatbot__resize-side{position:absolute;top:0;bottom:0;width:8px;cursor:ew-resize;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-side:hover{background-color:#0000000d}.chatbot__resize-side--left{left:0}.chatbot__resize-side--right{right:0}.chatbot__resize-corner{position:absolute;top:0;width:16px;height:16px;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-corner:hover{background-color:#0000001a}.chatbot__resize-corner--nwse{left:0;cursor:nwse-resize}.chatbot__resize-corner--nesw{right:0;cursor:nesw-resize}.chatbot__header{height:74px;display:flex;align-items:center;justify-content:space-between;padding-left:var(--spacing-5);padding-right:var(--spacing-4);gap:var(--spacing-4);flex-shrink:0;background-color:var(--color-body-bg);border-bottom:1px solid var(--color-border)}.chatbot__header-info{display:flex;align-items:center;gap:var(--spacing-4)}.chatbot__header-logo{width:50px;height:41px}.chatbot__header-title{font-weight:var(--font-weight-semibold);font-size:var(--font-size-xl);margin:0;line-height:24px;color:var(--color-body-text)}.chatbot__header-subtitle{font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);margin:0;line-height:20px;color:var(--color-tertiary)}.chatbot__header-actions{display:flex;align-items:center;gap:var(--spacing-2)}.chatbot__body{flex:1;display:flex;flex-direction:column;background-color:var(--color-body-bg);position:relative;overflow:hidden}.chatbot__product{padding:var(--spacing-3);padding-bottom:0;flex-shrink:0;margin:0 var(--spacing-3)}.chatbot__messages{flex:1;display:flex;flex-direction:column;gap:var(--spacing-3);margin-top:var(--spacing-4);padding:var(--spacing-4);overflow-y:auto;scrollbar-width:none;-ms-overflow-style:none}.chatbot__messages::-webkit-scrollbar{display:none}.chatbot__message{display:flex}.chatbot__message--user{justify-content:flex-end}.chatbot__message--assistant,.chatbot__message--system{justify-content:flex-start}.chatbot__bubble{position:relative;color:var(--color-body-text);max-width:85%;border-radius:var(--radius-md);padding:var(--spacing-4);font-size:var(--font-size-sm);line-height:20px;font-weight:var(--font-weight-medium)}.chatbot__bubble--user{background-color:var(--color-primary);color:#fff;border-bottom-right-radius:0;border-top-right-radius:var(--radius-xl);border-top-left-radius:var(--radius-xl);border-bottom-left-radius:var(--radius-xl)}.chatbot__bubble--user a{color:#ffffffe6}.chatbot__bubble--assistant,.chatbot__bubble--system{background-color:var(--color-tertiary-bg);border-bottom-left-radius:0;border-top-right-radius:var(--radius-xl);border-top-left-radius:var(--radius-xl);border-bottom-right-radius:var(--radius-xl)}.chatbot__message-content p{margin:0}.chatbot__message-content ol{list-style-type:decimal;margin:0;padding-left:var(--spacing-5)}.chatbot__message-content ul{list-style-type:disc;margin:0;padding-left:var(--spacing-5)}.chatbot__message-content li{padding-left:var(--spacing-1)}.chatbot__message-content a{color:var(--color-primary);text-decoration:underline;transition:color var(--transition-speed-fast) var(--transition-timing)}.chatbot__message-content a:hover{color:var(--color-primary-hover)}.chatbot__feedback{display:flex;align-items:center;gap:var(--spacing-2);padding-top:var(--spacing-2)}.chatbot__typing-wrapper{display:flex;justify-content:flex-start}.chatbot__typing{background-color:var(--color-tertiary-bg);padding:var(--spacing-3);border-radius:var(--radius-xl);border-bottom-left-radius:0;display:inline-flex;align-items:center;gap:2px}.chatbot__typing-dot{display:inline-block;width:6px;height:6px;background-color:var(--color-gray-300);border-radius:var(--radius-full);animation:chatbot-typing 1.4s infinite ease-in-out both;margin:0 2px}.chatbot__typing-dot:nth-child(1){animation-delay:-.32s}.chatbot__typing-dot:nth-child(2){animation-delay:-.16s}@keyframes chatbot-typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.chatbot__input-area{padding:var(--spacing-4);padding-top:var(--spacing-2);padding-bottom:var(--spacing-1);background-color:var(--color-body-bg)}.chatbot__input-wrapper{position:relative;display:flex;align-items:center;gap:var(--spacing-2);background-color:var(--color-tertiary-bg);border-radius:var(--radius-md);padding:var(--spacing-2);border:1px solid transparent;transition:background-color var(--transition-speed-fast) var(--transition-timing),border-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__input-wrapper:focus-within{background-color:var(--color-body-bg);border-color:var(--color-border)}.chatbot__input{flex:1;background:transparent;border:none;outline:none;font-family:var(--font-family-base);font-size:var(--font-size-sm);color:var(--color-body-text)}.chatbot__input::placeholder{color:var(--color-tertiary)}.chatbot__input:disabled{opacity:.5;cursor:not-allowed}.chatbot__footer{display:flex;align-items:center;justify-content:center;padding-bottom:var(--spacing-2)}.chatbot__footer-text{margin:0;padding:0;color:var(--color-secondary);font-size:var(--font-size-xs);font-family:var(--font-family-base)}";var f=Object.defineProperty,v=Object.getOwnPropertyDescriptor,s=(l,t,e,a)=>{for(var i=a>1?void 0:a?v(t,e):t,r=l.length-1,h;r>=0;r--)(h=l[r])&&(i=(a?h(t,e,i):h(i))||i);return a&&i&&f(t,e,i),i};exports.LedsUiChatbot=class extends n.LitElement{constructor(){super(...arguments),this.returnUri="",this.questionPrompt="",this.minimizedIconOnly=!1,this.draggable=!1,this.resizable=!1,this.products=[],this.openInitially=!1,this.showFeedbackButtons=!1,this.open=!1,this.fullscreen=!1,this.messages=[],this.isLoading=!1,this.inputText="",this.selectedProductId="",this.windowWidth=440,this.windowHeight=Math.min(700,window.innerHeight-40),this.position={right:20,bottom:20},this.isDragging=!1,this.screenWidth=window.innerWidth,this.dragStartPos={x:0,y:0},this.initialPosition={right:0,bottom:0},this.isResizing=!1,this.resizeDirection="horizontal",this.resizeStartWidth=0,this.resizeStartHeight=0,this.onWindowResize=()=>{this.screenWidth=window.innerWidth;const t=window.innerHeight-40;this.windowHeight>t&&(this.windowHeight=t)},this.onToggle=()=>{this.open=!this.open,this.scrollToBottom()},this.onClose=()=>{this.open=!1,this.fullscreen=!1},this.onToggleFullscreen=()=>{this.fullscreen=!this.fullscreen},this.onMouseMove=t=>{if(this.isDragging){const e=this.dragStartPos.x-t.clientX,a=this.dragStartPos.y-t.clientY,r=this.shadowRoot?.querySelector(".chatbot__launcher")?.getBoundingClientRect(),h=r?.width||72,d=r?.height||66;this.position={right:Math.max(0,Math.min(window.innerWidth-h,this.initialPosition.right+e)),bottom:Math.max(0,Math.min(window.innerHeight-d,this.initialPosition.bottom+a))}}else if(this.isResizing){const e=this.dragStartPos.x-t.clientX,a=this.dragStartPos.y-t.clientY;if(this.resizeDirection==="horizontal"||this.resizeDirection==="both"){const i=this.position.right<this.screenWidth/2;this.windowWidth=Math.max(300,this.resizeStartWidth+(i?e:-e))}(this.resizeDirection==="vertical"||this.resizeDirection==="both")&&(this.windowHeight=Math.max(400,this.resizeStartHeight+a))}},this.onMouseUp=t=>{this.isDragging?(this.isDragging=!1,window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),Math.hypot(t.clientX-this.dragStartPos.x,t.clientY-this.dragStartPos.y)<5&&this.onToggle()):this.isResizing&&(this.isResizing=!1,window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp))},this.handleKeyDown=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),this.sendMessage())},this.onInput=t=>{const e=t.target;this.inputText=e?e.value:t.detail},this.onCopyMessage=t=>{navigator.clipboard.writeText(t)}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.onWindowResize)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp)}async firstUpdated(){this.products.length===1&&(this.selectedProductId=this.products[0].id),this.open=this.openInitially,this.open&&await this.initConversation()}updated(t){t.has("products")&&this.handleProductUpdate(),t.has("messages")&&this.scrollToBottom(),t.has("open")&&this.open&&!this.conversationId&&this.initConversation()}handleProductUpdate(){if(!this.products.length)return;const t=this.products.some(e=>e.id===this.selectedProductId);this.products.length===1&&(this.selectedProductId=this.products[0].id),t||(this.messages=[],this.conversationId=void 0,this.open&&this.initConversation()),requestAnimationFrame(()=>this.updateComboboxItems())}updateComboboxItems(){const t=this.productEl;if(!t||this.products?.length<=1)return;const e=this.products.map(i=>({value:i.id,label:i.name}));t.items=e;const a=t.selectedItems?.()||[];if(a.length>0){const i=a[0]?.value;!this.products.some(h=>h.id===i)&&t.setSelected&&t.setSelected([])}}async onProductChange(t){const e=t.detail?.selected?.[0]?.value;e&&e!==this.selectedProductId&&(this.selectedProductId=e)}onMouseDown(t){this.draggable&&(t.preventDefault(),this.isDragging=!0,this.dragStartPos={x:t.clientX,y:t.clientY},this.initialPosition={...this.position},window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp))}startResize(t,e){this.resizable&&(t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.resizeDirection=e,this.dragStartPos={x:t.clientX,y:t.clientY},this.resizeStartWidth=this.windowWidth,this.resizeStartHeight=this.windowHeight,window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp))}async ensureToken(t=!1){const e="logosphere_chatbot_token";if(t&&(this.assertionToken=void 0,localStorage.removeItem(e)),!t){const r=localStorage.getItem(e);if(r){this.assertionToken=r;return}}const i=await(await fetch(`${this.returnUri}/api/chat/start`)).json();if(!i.Success||!i.Data?.Token)throw new Error("Token alınamadı");this.assertionToken=i.Data.Token,localStorage.setItem(e,this.assertionToken)}async postChat(t){await this.ensureToken();const e=`${this.returnUri}/api/chat/completions`,a=()=>fetch(e,{method:"POST",headers:{"Content-Type":"application/json",client_assertion:this.assertionToken,client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"},body:JSON.stringify(t)});let i=await a();if(i.status===401&&(await this.ensureToken(!0),i=await a()),!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}async initConversation(){if(!this.isLoading){this.isLoading=!0;try{await this.ensureToken();const t=await this.postChat({ChatCompletionType:"NewConversation",Context:this.selectedProductId,QuestionPrompt:this.questionPrompt});this.conversationId=t.Data.ConversationId;const e=t.Data.Choices?.[0]?.Message?.Content;e&&this.addMessage(e,"assistant")}catch{this.addMessage("Bir hata oluştu, lütfen tekrar deneyiniz.","system")}finally{this.isLoading=!1}}}async sendMessage(){const t=this.inputText.trim();if(!(!t||!this.conversationId||this.isLoading)){if(!this.selectedProductId){this.addMessage("Lütfen önce bir ürün seçiniz.","system");return}this.addMessage(t,"user"),this.inputText="",this.isLoading=!0;try{const a=(await this.postChat({ChatCompletionType:"ConversationUpdate",Content:t,Context:this.selectedProductId,ConversationId:this.conversationId,QuestionPrompt:this.questionPrompt})).Data?.Choices?.[0]?.Message?.Content;this.addMessage(a||"Cevap alınamadı.","assistant")}catch{this.addMessage("Bağlantı hatası.","system")}finally{this.isLoading=!1}}}addMessage(t,e){this.messages=[...this.messages,{content:t,role:e,timestamp:Date.now()}]}scrollToBottom(){setTimeout(()=>{this.chatContainer&&(this.chatContainer.scrollTop=this.chatContainer.scrollHeight)},0)}formatContent(t){if(!t)return"";const a=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").split(`
|
|
2
|
+
`);let i="",r=!1,h="";for(const d of a){const g=d.trim()==="",c=d.match(/^\s*\d+\.\s+(.*)/),u=d.match(/^\s*[-*]\s+(.*)/);if(c||u){const p=c?"ol":"ul";(!r||h!==p)&&(r&&(i+=`</${h}>`),i+=`<${p}>`,r=!0,h=p),i+=`<li>${c?c[1]:u[1]}</li>`}else g?r||(i+="<br>"):(r&&(i+=`</${h}>`,r=!1,h=""),i+=`<p>${d}</p>`)}return r&&(i+=`</${h}>`),i.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>')}render(){const t=this.position.right<this.screenWidth/2;return n.html`
|
|
3
|
+
<div class="chatbot">
|
|
4
|
+
${this.renderOverlay()}
|
|
5
|
+
${this.renderLauncher()}
|
|
6
|
+
${this.renderWindow(t)}
|
|
7
|
+
</div>
|
|
8
|
+
`}renderOverlay(){return this.open||this.fullscreen?n.html`<div class="chatbot__overlay" @click=${this.onToggle}></div>`:""}renderLauncher(){const t=["chatbot__launcher",this.draggable?"chatbot__launcher--draggable":"",this.open?"chatbot__launcher--hidden":""].filter(Boolean).join(" ");return n.html`
|
|
9
|
+
<div
|
|
10
|
+
class="${t}"
|
|
11
|
+
style="right: ${this.position.right}px; bottom: ${this.position.bottom}px;"
|
|
12
|
+
@mousedown=${this.onMouseDown}
|
|
13
|
+
@click=${this.draggable?null:this.onToggle}
|
|
14
|
+
aria-expanded=${this.open?"true":"false"}
|
|
15
|
+
>
|
|
16
|
+
<img class="chatbot__launcher-icon" src="${exports.LedsUiChatbot.ICONS.launcher}" alt="chatbot" />
|
|
17
|
+
${!this.open&&!this.minimizedIconOnly?n.html`
|
|
18
|
+
<div class="chatbot__launcher-text">
|
|
19
|
+
<p class="chatbot__launcher-title">Logo</p>
|
|
20
|
+
<p class="chatbot__launcher-subtitle">Dijital Danışman</p>
|
|
21
|
+
</div>
|
|
22
|
+
`:""}
|
|
23
|
+
</div>
|
|
24
|
+
`}renderWindow(t){const e=["chatbot__window",this.open?"":"chatbot__window--hidden",this.fullscreen?"chatbot__window--fullscreen":""].filter(Boolean).join(" "),a=this.fullscreen?"":`bottom: 20px; height: ${this.windowHeight}px; width: ${this.windowWidth}px; ${t?"right: 20px;":"left: 20px;"}`;return n.html`
|
|
25
|
+
<div class="${e}" style="${a}">
|
|
26
|
+
${this.renderResizeHandles(t)}
|
|
27
|
+
${this.renderHeader()}
|
|
28
|
+
<div class="chatbot__body">
|
|
29
|
+
${this.renderProductSelector()}
|
|
30
|
+
${this.renderChatArea()}
|
|
31
|
+
${this.renderInputArea()}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
`}renderResizeHandles(t){return this.fullscreen||!this.resizable?"":n.html`
|
|
35
|
+
<div class="chatbot__resize-top"
|
|
36
|
+
@mousedown=${e=>this.startResize(e,"vertical")}></div>
|
|
37
|
+
<div class="chatbot__resize-side ${t?"chatbot__resize-side--left":"chatbot__resize-side--right"}"
|
|
38
|
+
@mousedown=${e=>this.startResize(e,"horizontal")}></div>
|
|
39
|
+
<div class="chatbot__resize-corner ${t?"chatbot__resize-corner--nwse":"chatbot__resize-corner--nesw"}"
|
|
40
|
+
@mousedown=${e=>this.startResize(e,"both")}></div>
|
|
41
|
+
`}renderHeader(){return n.html`
|
|
42
|
+
<div class="chatbot__header">
|
|
43
|
+
<div class="chatbot__header-info">
|
|
44
|
+
<img class="chatbot__header-logo" alt="logo" src="${exports.LedsUiChatbot.ICONS.launcher}" />
|
|
45
|
+
<div>
|
|
46
|
+
<p class="chatbot__header-title">Logo</p>
|
|
47
|
+
<p class="chatbot__header-subtitle">Dijital Danışman</p>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="chatbot__header-actions">
|
|
51
|
+
<logosphere-button
|
|
52
|
+
iconOnly="true"
|
|
53
|
+
size="sm"
|
|
54
|
+
variant="text"
|
|
55
|
+
theme="--color-light-rgb"
|
|
56
|
+
title=${this.fullscreen?"Küçült":"Tam Ekran"}
|
|
57
|
+
@click=${this.onToggleFullscreen}
|
|
58
|
+
>
|
|
59
|
+
<ui-icon name="${this.fullscreen?"uil-compress-alt":"uil-expand-alt"}" size="16"></ui-icon>
|
|
60
|
+
</logosphere-button>
|
|
61
|
+
<logosphere-button
|
|
62
|
+
iconOnly="true"
|
|
63
|
+
size="sm"
|
|
64
|
+
variant="text"
|
|
65
|
+
theme="--color-light"
|
|
66
|
+
title="Kapat"
|
|
67
|
+
@click=${this.onClose}
|
|
68
|
+
>
|
|
69
|
+
<ui-icon name="uil-times" size="16"></ui-icon>
|
|
70
|
+
</logosphere-button>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
`}renderProductSelector(){return n.html`
|
|
74
|
+
<div class="chatbot__product">
|
|
75
|
+
${this.products.length>1?n.html`
|
|
76
|
+
<logosphere-combobox
|
|
77
|
+
id="product"
|
|
78
|
+
.items=${this.products.map(t=>({value:t.id,label:t.name}))}
|
|
79
|
+
optionValue="value"
|
|
80
|
+
optionLabel="label"
|
|
81
|
+
placeholder="Ürün seçiniz"
|
|
82
|
+
@selected=${this.onProductChange}
|
|
83
|
+
></logosphere-combobox>
|
|
84
|
+
`:n.html`
|
|
85
|
+
<logosphere-input
|
|
86
|
+
id="product"
|
|
87
|
+
placeholder="Ürün seçiniz"
|
|
88
|
+
.value=${this.products.length===1?this.products[0].name:""}
|
|
89
|
+
readOnly="true"
|
|
90
|
+
></logosphere-input>
|
|
91
|
+
`}
|
|
92
|
+
</div>
|
|
93
|
+
`}renderChatArea(){return n.html`
|
|
94
|
+
<div id="chat-container" class="chatbot__messages">
|
|
95
|
+
${this.messages.map(t=>this.renderMessage(t))}
|
|
96
|
+
${this.isLoading?this.renderTypingIndicator():""}
|
|
97
|
+
</div>
|
|
98
|
+
`}renderMessage(t){const e=["chatbot__bubble",`chatbot__bubble--${t.role}`].join(" ");return n.html`
|
|
99
|
+
<div class="chatbot__message chatbot__message--${t.role}">
|
|
100
|
+
<div class="${e}">
|
|
101
|
+
<div class="chatbot__message-content">
|
|
102
|
+
${b.unsafeHTML(this.formatContent(t.content))}
|
|
103
|
+
</div>
|
|
104
|
+
${this.showFeedbackButtons&&t.role==="assistant"?this.renderFeedbackButtons(t):""}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
`}renderFeedbackButtons(t){return n.html`
|
|
108
|
+
<div class="chatbot__feedback">
|
|
109
|
+
<logosphere-button
|
|
110
|
+
@click=${()=>this.onCopyMessage(t.content)}
|
|
111
|
+
title="Kopyala"
|
|
112
|
+
iconOnly="true"
|
|
113
|
+
size="sm"
|
|
114
|
+
theme="--color-light-rgb"
|
|
115
|
+
>
|
|
116
|
+
<ui-icon name="uil-copy" size="14"></ui-icon>
|
|
117
|
+
</logosphere-button>
|
|
118
|
+
<logosphere-button title="Like" iconOnly="true" size="sm" theme="--color-light-rgb">
|
|
119
|
+
<ui-icon name="uil-thumbs-up" size="14"></ui-icon>
|
|
120
|
+
</logosphere-button>
|
|
121
|
+
<logosphere-button title="Dislike" iconOnly="true" size="sm" theme="--color-light-rgb">
|
|
122
|
+
<ui-icon name="uil-thumbs-down" size="14"></ui-icon>
|
|
123
|
+
</logosphere-button>
|
|
124
|
+
</div>
|
|
125
|
+
`}renderTypingIndicator(){return n.html`
|
|
126
|
+
<div class="chatbot__typing-wrapper">
|
|
127
|
+
<div class="chatbot__typing">
|
|
128
|
+
<span class="chatbot__typing-dot"></span>
|
|
129
|
+
<span class="chatbot__typing-dot"></span>
|
|
130
|
+
<span class="chatbot__typing-dot"></span>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
`}renderInputArea(){return n.html`
|
|
134
|
+
<div class="chatbot__input-area">
|
|
135
|
+
<div class="chatbot__input-wrapper">
|
|
136
|
+
<input
|
|
137
|
+
class="chatbot__input"
|
|
138
|
+
placeholder=${this.selectedProductId?"Bir şeyler yazın...":"Lütfen ürün seçiniz..."}
|
|
139
|
+
.value=${this.inputText}
|
|
140
|
+
@input=${this.onInput}
|
|
141
|
+
@keydown=${this.handleKeyDown}
|
|
142
|
+
?disabled=${!this.selectedProductId}
|
|
143
|
+
/>
|
|
144
|
+
<logosphere-button
|
|
145
|
+
iconOnly="true"
|
|
146
|
+
size="lg"
|
|
147
|
+
variant="text"
|
|
148
|
+
theme="--color-light"
|
|
149
|
+
title="Gönder"
|
|
150
|
+
@click=${this.sendMessage}
|
|
151
|
+
?disabled=${!this.selectedProductId||!this.inputText.trim()}
|
|
152
|
+
>
|
|
153
|
+
<ui-icon name="uil-arrow-circle-right" size="20"></ui-icon>
|
|
154
|
+
</logosphere-button>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
<div class="chatbot__footer">
|
|
158
|
+
<p class="chatbot__footer-text">İçerik Yapay Zeka ile Üretilmiştir</p>
|
|
159
|
+
</div>
|
|
160
|
+
`}};exports.LedsUiChatbot.styles=[n.css`${n.unsafeCSS(m)}`];exports.LedsUiChatbot.ICONS={launcher:"data:image/svg+xml,%3Csvg%20width%3D%2251%22%20height%3D%2242%22%20viewBox%3D%220%200%2051%2042%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M38.457%200C40.0338%200%2041.542%200.293293%2042.9302%200.8283L49.15%206.07675C50.2611%207.93912%2050.8994%2010.1162%2050.8994%2012.4424V23.084C50.8994%2024.4858%2050.6676%2025.8334%2050.2402%2027.0907L43.1534%2034.6096C41.7043%2035.2006%2040.1187%2035.5264%2038.457%2035.5264H30.7605L38.5805%2027.2296C40.814%2027.1643%2042.6045%2025.3332%2042.6045%2023.084V12.4424C42.6045%2010.1518%2040.7476%208.29492%2038.457%208.29492H12.4424C10.1518%208.29492%208.29492%2010.1518%208.29492%2012.4424V23.084C8.29492%2025.3746%2010.1518%2027.2314%2012.4424%2027.2314H33.5078L20.4487%2041.0866C17.7992%2042.5379%2014.3381%2040.2741%2014.7842%2036.7803C14.8402%2036.3421%2014.9629%2035.9194%2015.1416%2035.5264H12.4424C10.9217%2035.5264%209.46472%2035.2536%208.11774%2034.7542L0.610679%2026.945C0.214298%2025.7295%200%2024.4318%200%2023.084V12.4424C0%2010.8011%200.317794%209.23402%200.895207%207.79935L7.12424%201.19058C8.73679%200.427072%2010.5397%200%2012.4424%200H38.457ZM23.1357%2017.7881C23.1357%2015.4815%2021.2656%2013.6113%2018.959%2013.6113C16.6525%2013.6114%2014.7822%2015.4815%2014.7822%2017.7881C14.7824%2020.0945%2016.6526%2021.9638%2018.959%2021.9639C21.2655%2021.9639%2023.1356%2020.0945%2023.1357%2017.7881ZM36.2344%2017.7881C36.2344%2015.4815%2034.3642%2013.6113%2032.0576%2013.6113C29.7511%2013.6114%2027.8809%2015.4815%2027.8809%2017.7881C27.881%2020.0945%2029.7512%2021.9638%2032.0576%2021.9639C34.3641%2021.9639%2036.2342%2020.0945%2036.2344%2017.7881Z%22%20fill%3D%22url(%23paint0_linear_97_4585)%22%2F%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear_97_4585%22%20x1%3D%2231.662%22%20y1%3D%224.88016%22%20x2%3D%2214.4119%22%20y2%3D%2237.9167%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23F22727%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23CA0D0D%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"};s([o.property({type:String,attribute:"return-uri"})],exports.LedsUiChatbot.prototype,"returnUri",2);s([o.property({type:String,attribute:"question-prompt"})],exports.LedsUiChatbot.prototype,"questionPrompt",2);s([o.property({type:Boolean,attribute:"minimized-icon-only"})],exports.LedsUiChatbot.prototype,"minimizedIconOnly",2);s([o.property({type:Boolean,attribute:"draggable"})],exports.LedsUiChatbot.prototype,"draggable",2);s([o.property({type:Boolean,attribute:"resizable"})],exports.LedsUiChatbot.prototype,"resizable",2);s([o.property({type:Array,hasChanged:(l,t)=>l===t?!1:!t||!l||l.length!==t.length?!0:JSON.stringify(l)!==JSON.stringify(t)}),o.property({type:Array})],exports.LedsUiChatbot.prototype,"products",2);s([o.property({type:Boolean,attribute:"open-initially"})],exports.LedsUiChatbot.prototype,"openInitially",2);s([o.property({type:Boolean,attribute:"show-feedback-buttons"})],exports.LedsUiChatbot.prototype,"showFeedbackButtons",2);s([o.state()],exports.LedsUiChatbot.prototype,"open",2);s([o.state()],exports.LedsUiChatbot.prototype,"fullscreen",2);s([o.state()],exports.LedsUiChatbot.prototype,"messages",2);s([o.state()],exports.LedsUiChatbot.prototype,"conversationId",2);s([o.state()],exports.LedsUiChatbot.prototype,"assertionToken",2);s([o.state()],exports.LedsUiChatbot.prototype,"isLoading",2);s([o.state()],exports.LedsUiChatbot.prototype,"inputText",2);s([o.state()],exports.LedsUiChatbot.prototype,"selectedProductId",2);s([o.state()],exports.LedsUiChatbot.prototype,"windowWidth",2);s([o.state()],exports.LedsUiChatbot.prototype,"windowHeight",2);s([o.state()],exports.LedsUiChatbot.prototype,"position",2);s([o.state()],exports.LedsUiChatbot.prototype,"isDragging",2);s([o.state()],exports.LedsUiChatbot.prototype,"screenWidth",2);s([o.query("#chat-container")],exports.LedsUiChatbot.prototype,"chatContainer",2);s([o.query("#product")],exports.LedsUiChatbot.prototype,"productEl",2);exports.LedsUiChatbot=s([o.customElement("logosphere-chatbot")],exports.LedsUiChatbot);
|
|
@@ -1,28 +1,13 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as d, state as c, query as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (e === f || e == null) return this._t = void 0, this.it = e;
|
|
10
|
-
if (e === k) return e;
|
|
11
|
-
if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
12
|
-
if (e === this.it) return this._t;
|
|
13
|
-
this.it = e;
|
|
14
|
-
const s = [e];
|
|
15
|
-
return s.raw = s, this._t = { _$litType$: this.constructor.resultType, strings: s, values: [] };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
g.directiveName = "unsafeHTML", g.resultType = 1;
|
|
19
|
-
const D = z(g), M = ":host{display:block;z-index:9999}.chatbot{font-family:var(--font-family-base)}.chatbot__overlay{position:fixed;inset:0;background-color:#0003;z-index:var(--z-index-modal-backdrop)}.chatbot__launcher{position:fixed;z-index:var(--z-index-modal);display:flex;align-items:center;gap:var(--spacing-4);padding-left:var(--spacing-4);padding-right:var(--spacing-4);height:66px;color:#fff;border-radius:var(--radius-xl);cursor:pointer;box-shadow:var(--shadow-base);background-color:var(--color-body-bg);overflow:hidden;transition:box-shadow var(--transition-speed-fast) var(--transition-timing)}.chatbot__launcher:hover{box-shadow:var(--shadow-md)}.chatbot__launcher--draggable{cursor:move}.chatbot__launcher--hidden{visibility:hidden;width:72px;height:66px;justify-content:center;padding:0}.chatbot__launcher-icon{width:40px;height:34px;flex-shrink:0}.chatbot__launcher-text{display:flex;flex-direction:column}.chatbot__launcher-title{font-weight:var(--font-weight-semibold);font-size:var(--font-size-xl);margin:0;line-height:24px;white-space:nowrap;color:var(--color-body-text)}.chatbot__launcher-subtitle{font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);margin:0;line-height:20px;white-space:nowrap;color:var(--color-tertiary)}.chatbot__window{position:fixed;z-index:var(--z-index-modal);display:flex;flex-direction:column;box-shadow:var(--shadow-xl);border-radius:var(--radius-md);overflow:hidden;background-color:var(--color-body-bg)}.chatbot__window--hidden{display:none}.chatbot__window--fullscreen{inset:80px 50px;width:auto;height:auto}.chatbot__resize-top{position:absolute;top:0;left:0;right:0;height:8px;cursor:ns-resize;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-top:hover{background-color:#0000000d}.chatbot__resize-side{position:absolute;top:0;bottom:0;width:8px;cursor:ew-resize;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-side:hover{background-color:#0000000d}.chatbot__resize-side--left{left:0}.chatbot__resize-side--right{right:0}.chatbot__resize-corner{position:absolute;top:0;width:16px;height:16px;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-corner:hover{background-color:#0000001a}.chatbot__resize-corner--nwse{left:0;cursor:nwse-resize}.chatbot__resize-corner--nesw{right:0;cursor:nesw-resize}.chatbot__header{height:74px;display:flex;align-items:center;justify-content:space-between;padding-left:var(--spacing-5);padding-right:var(--spacing-4);gap:var(--spacing-4);flex-shrink:0;background-color:var(--color-body-bg);border-bottom:1px solid var(--color-border)}.chatbot__header-info{display:flex;align-items:center;gap:var(--spacing-4)}.chatbot__header-logo{width:50px;height:41px}.chatbot__header-title{font-weight:var(--font-weight-semibold);font-size:var(--font-size-xl);margin:0;line-height:24px;color:var(--color-body-text)}.chatbot__header-subtitle{font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);margin:0;line-height:20px;color:var(--color-tertiary)}.chatbot__header-actions{display:flex;align-items:center;gap:var(--spacing-2)}.chatbot__body{flex:1;display:flex;flex-direction:column;background-color:var(--color-body-bg);position:relative;overflow:hidden}.chatbot__product{padding:var(--spacing-3);padding-bottom:0;flex-shrink:0;margin:0 var(--spacing-3)}.chatbot__messages{flex:1;display:flex;flex-direction:column;gap:var(--spacing-3);margin-top:var(--spacing-4);padding:var(--spacing-4);overflow-y:auto;scrollbar-width:none;-ms-overflow-style:none}.chatbot__messages::-webkit-scrollbar{display:none}.chatbot__message{display:flex}.chatbot__message--user{justify-content:flex-end}.chatbot__message--assistant,.chatbot__message--system{justify-content:flex-start}.chatbot__bubble{position:relative;color:var(--color-body-text);max-width:85%;border-radius:var(--radius-md);padding:var(--spacing-4);font-size:var(--font-size-sm);line-height:20px;font-weight:var(--font-weight-medium)}.chatbot__bubble--user{background-color:var(--color-primary);color:#fff;border-bottom-right-radius:0;border-top-right-radius:var(--radius-xl);border-top-left-radius:var(--radius-xl);border-bottom-left-radius:var(--radius-xl)}.chatbot__bubble--user a{color:#ffffffe6}.chatbot__bubble--assistant,.chatbot__bubble--system{background-color:var(--color-tertiary-bg);border-bottom-left-radius:0;border-top-right-radius:var(--radius-xl);border-top-left-radius:var(--radius-xl);border-bottom-right-radius:var(--radius-xl)}.chatbot__message-content p{margin:0}.chatbot__message-content ol{list-style-type:decimal;margin:0;padding-left:var(--spacing-5)}.chatbot__message-content ul{list-style-type:disc;margin:0;padding-left:var(--spacing-5)}.chatbot__message-content li{padding-left:var(--spacing-1)}.chatbot__message-content a{color:var(--color-primary);text-decoration:underline;transition:color var(--transition-speed-fast) var(--transition-timing)}.chatbot__message-content a:hover{color:var(--color-primary-hover)}.chatbot__feedback{display:flex;align-items:center;gap:var(--spacing-2);padding-top:var(--spacing-2)}.chatbot__typing-wrapper{display:flex;justify-content:flex-start}.chatbot__typing{background-color:var(--color-tertiary-bg);padding:var(--spacing-3);border-radius:var(--radius-xl);border-bottom-left-radius:0;display:inline-flex;align-items:center;gap:2px}.chatbot__typing-dot{display:inline-block;width:6px;height:6px;background-color:var(--color-gray-300);border-radius:var(--radius-full);animation:chatbot-typing 1.4s infinite ease-in-out both;margin:0 2px}.chatbot__typing-dot:nth-child(1){animation-delay:-.32s}.chatbot__typing-dot:nth-child(2){animation-delay:-.16s}@keyframes chatbot-typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.chatbot__input-area{padding:var(--spacing-4);padding-top:var(--spacing-2);padding-bottom:var(--spacing-1);background-color:var(--color-body-bg)}.chatbot__input-wrapper{position:relative;display:flex;align-items:center;gap:var(--spacing-2);background-color:var(--color-tertiary-bg);border-radius:var(--radius-md);padding:var(--spacing-2);border:1px solid transparent;transition:background-color var(--transition-speed-fast) var(--transition-timing),border-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__input-wrapper:focus-within{background-color:var(--color-body-bg);border-color:var(--color-border)}.chatbot__input{flex:1;background:transparent;border:none;outline:none;font-family:var(--font-family-base);font-size:var(--font-size-sm);color:var(--color-body-text)}.chatbot__input::placeholder{color:var(--color-tertiary)}.chatbot__input:disabled{opacity:.5;cursor:not-allowed}.chatbot__footer{display:flex;align-items:center;justify-content:center;padding-bottom:var(--spacing-2)}.chatbot__footer-text{margin:0;padding:0;color:var(--color-secondary);font-size:var(--font-size-xs);font-family:var(--font-family-base)}";
|
|
20
|
-
var T = Object.defineProperty, I = Object.getOwnPropertyDescriptor, r = (t, e, s, i) => {
|
|
21
|
-
for (var n = i > 1 ? void 0 : i ? I(e, s) : e, l = t.length - 1, h; l >= 0; l--)
|
|
22
|
-
(h = t[l]) && (n = (i ? h(e, s, n) : h(n)) || n);
|
|
23
|
-
return i && n && T(e, s, n), n;
|
|
1
|
+
import { LitElement as m, html as a, unsafeCSS as v, css as _ } from "lit";
|
|
2
|
+
import { property as d, state as c, query as b, customElement as y } from "lit/decorators.js";
|
|
3
|
+
import { unsafeHTML as w } from "lit/directives/unsafe-html.js";
|
|
4
|
+
const x = ":host{display:block;z-index:9999}.chatbot{font-family:var(--font-family-base)}.chatbot__overlay{position:fixed;inset:0;background-color:#0003;z-index:var(--z-index-modal-backdrop)}.chatbot__launcher{position:fixed;z-index:var(--z-index-modal);display:flex;align-items:center;gap:var(--spacing-4);padding-left:var(--spacing-4);padding-right:var(--spacing-4);height:66px;color:#fff;border-radius:var(--radius-xl);cursor:pointer;box-shadow:var(--shadow-base);background-color:var(--color-body-bg);overflow:hidden;transition:box-shadow var(--transition-speed-fast) var(--transition-timing)}.chatbot__launcher:hover{box-shadow:var(--shadow-md)}.chatbot__launcher--draggable{cursor:move}.chatbot__launcher--hidden{visibility:hidden;width:72px;height:66px;justify-content:center;padding:0}.chatbot__launcher-icon{width:40px;height:34px;flex-shrink:0}.chatbot__launcher-text{display:flex;flex-direction:column}.chatbot__launcher-title{font-weight:var(--font-weight-semibold);font-size:var(--font-size-xl);margin:0;line-height:24px;white-space:nowrap;color:var(--color-body-text)}.chatbot__launcher-subtitle{font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);margin:0;line-height:20px;white-space:nowrap;color:var(--color-tertiary)}.chatbot__window{position:fixed;z-index:var(--z-index-modal);display:flex;flex-direction:column;box-shadow:var(--shadow-xl);border-radius:var(--radius-md);overflow:hidden;background-color:var(--color-body-bg)}.chatbot__window--hidden{display:none}.chatbot__window--fullscreen{inset:80px 50px;width:auto;height:auto}.chatbot__resize-top{position:absolute;top:0;left:0;right:0;height:8px;cursor:ns-resize;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-top:hover{background-color:#0000000d}.chatbot__resize-side{position:absolute;top:0;bottom:0;width:8px;cursor:ew-resize;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-side:hover{background-color:#0000000d}.chatbot__resize-side--left{left:0}.chatbot__resize-side--right{right:0}.chatbot__resize-corner{position:absolute;top:0;width:16px;height:16px;z-index:50;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__resize-corner:hover{background-color:#0000001a}.chatbot__resize-corner--nwse{left:0;cursor:nwse-resize}.chatbot__resize-corner--nesw{right:0;cursor:nesw-resize}.chatbot__header{height:74px;display:flex;align-items:center;justify-content:space-between;padding-left:var(--spacing-5);padding-right:var(--spacing-4);gap:var(--spacing-4);flex-shrink:0;background-color:var(--color-body-bg);border-bottom:1px solid var(--color-border)}.chatbot__header-info{display:flex;align-items:center;gap:var(--spacing-4)}.chatbot__header-logo{width:50px;height:41px}.chatbot__header-title{font-weight:var(--font-weight-semibold);font-size:var(--font-size-xl);margin:0;line-height:24px;color:var(--color-body-text)}.chatbot__header-subtitle{font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);margin:0;line-height:20px;color:var(--color-tertiary)}.chatbot__header-actions{display:flex;align-items:center;gap:var(--spacing-2)}.chatbot__body{flex:1;display:flex;flex-direction:column;background-color:var(--color-body-bg);position:relative;overflow:hidden}.chatbot__product{padding:var(--spacing-3);padding-bottom:0;flex-shrink:0;margin:0 var(--spacing-3)}.chatbot__messages{flex:1;display:flex;flex-direction:column;gap:var(--spacing-3);margin-top:var(--spacing-4);padding:var(--spacing-4);overflow-y:auto;scrollbar-width:none;-ms-overflow-style:none}.chatbot__messages::-webkit-scrollbar{display:none}.chatbot__message{display:flex}.chatbot__message--user{justify-content:flex-end}.chatbot__message--assistant,.chatbot__message--system{justify-content:flex-start}.chatbot__bubble{position:relative;color:var(--color-body-text);max-width:85%;border-radius:var(--radius-md);padding:var(--spacing-4);font-size:var(--font-size-sm);line-height:20px;font-weight:var(--font-weight-medium)}.chatbot__bubble--user{background-color:var(--color-primary);color:#fff;border-bottom-right-radius:0;border-top-right-radius:var(--radius-xl);border-top-left-radius:var(--radius-xl);border-bottom-left-radius:var(--radius-xl)}.chatbot__bubble--user a{color:#ffffffe6}.chatbot__bubble--assistant,.chatbot__bubble--system{background-color:var(--color-tertiary-bg);border-bottom-left-radius:0;border-top-right-radius:var(--radius-xl);border-top-left-radius:var(--radius-xl);border-bottom-right-radius:var(--radius-xl)}.chatbot__message-content p{margin:0}.chatbot__message-content ol{list-style-type:decimal;margin:0;padding-left:var(--spacing-5)}.chatbot__message-content ul{list-style-type:disc;margin:0;padding-left:var(--spacing-5)}.chatbot__message-content li{padding-left:var(--spacing-1)}.chatbot__message-content a{color:var(--color-primary);text-decoration:underline;transition:color var(--transition-speed-fast) var(--transition-timing)}.chatbot__message-content a:hover{color:var(--color-primary-hover)}.chatbot__feedback{display:flex;align-items:center;gap:var(--spacing-2);padding-top:var(--spacing-2)}.chatbot__typing-wrapper{display:flex;justify-content:flex-start}.chatbot__typing{background-color:var(--color-tertiary-bg);padding:var(--spacing-3);border-radius:var(--radius-xl);border-bottom-left-radius:0;display:inline-flex;align-items:center;gap:2px}.chatbot__typing-dot{display:inline-block;width:6px;height:6px;background-color:var(--color-gray-300);border-radius:var(--radius-full);animation:chatbot-typing 1.4s infinite ease-in-out both;margin:0 2px}.chatbot__typing-dot:nth-child(1){animation-delay:-.32s}.chatbot__typing-dot:nth-child(2){animation-delay:-.16s}@keyframes chatbot-typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.chatbot__input-area{padding:var(--spacing-4);padding-top:var(--spacing-2);padding-bottom:var(--spacing-1);background-color:var(--color-body-bg)}.chatbot__input-wrapper{position:relative;display:flex;align-items:center;gap:var(--spacing-2);background-color:var(--color-tertiary-bg);border-radius:var(--radius-md);padding:var(--spacing-2);border:1px solid transparent;transition:background-color var(--transition-speed-fast) var(--transition-timing),border-color var(--transition-speed-fast) var(--transition-timing)}.chatbot__input-wrapper:focus-within{background-color:var(--color-body-bg);border-color:var(--color-border)}.chatbot__input{flex:1;background:transparent;border:none;outline:none;font-family:var(--font-family-base);font-size:var(--font-size-sm);color:var(--color-body-text)}.chatbot__input::placeholder{color:var(--color-tertiary)}.chatbot__input:disabled{opacity:.5;cursor:not-allowed}.chatbot__footer{display:flex;align-items:center;justify-content:center;padding-bottom:var(--spacing-2)}.chatbot__footer-text{margin:0;padding:0;color:var(--color-secondary);font-size:var(--font-size-xs);font-family:var(--font-family-base)}";
|
|
5
|
+
var z = Object.defineProperty, C = Object.getOwnPropertyDescriptor, s = (t, e, n, i) => {
|
|
6
|
+
for (var r = i > 1 ? void 0 : i ? C(e, n) : e, l = t.length - 1, h; l >= 0; l--)
|
|
7
|
+
(h = t[l]) && (r = (i ? h(e, n, r) : h(r)) || r);
|
|
8
|
+
return i && r && z(e, n, r), r;
|
|
24
9
|
};
|
|
25
|
-
let o = class extends
|
|
10
|
+
let o = class extends m {
|
|
26
11
|
constructor() {
|
|
27
12
|
super(...arguments), this.returnUri = "", this.questionPrompt = "", this.minimizedIconOnly = !1, this.draggable = !1, this.resizable = !1, this.products = [], this.openInitially = !1, this.showFeedbackButtons = !1, this.open = !1, this.fullscreen = !1, this.messages = [], this.isLoading = !1, this.inputText = "", this.selectedProductId = "", this.windowWidth = 440, this.windowHeight = Math.min(700, window.innerHeight - 40), this.position = { right: 20, bottom: 20 }, this.isDragging = !1, this.screenWidth = window.innerWidth, this.dragStartPos = { x: 0, y: 0 }, this.initialPosition = { right: 0, bottom: 0 }, this.isResizing = !1, this.resizeDirection = "horizontal", this.resizeStartWidth = 0, this.resizeStartHeight = 0, this.onWindowResize = () => {
|
|
28
13
|
this.screenWidth = window.innerWidth;
|
|
@@ -36,18 +21,18 @@ let o = class extends _ {
|
|
|
36
21
|
this.fullscreen = !this.fullscreen;
|
|
37
22
|
}, this.onMouseMove = (t) => {
|
|
38
23
|
if (this.isDragging) {
|
|
39
|
-
const e = this.dragStartPos.x - t.clientX,
|
|
24
|
+
const e = this.dragStartPos.x - t.clientX, n = this.dragStartPos.y - t.clientY, r = this.shadowRoot?.querySelector(".chatbot__launcher")?.getBoundingClientRect(), l = r?.width || 72, h = r?.height || 66;
|
|
40
25
|
this.position = {
|
|
41
26
|
right: Math.max(0, Math.min(window.innerWidth - l, this.initialPosition.right + e)),
|
|
42
|
-
bottom: Math.max(0, Math.min(window.innerHeight - h, this.initialPosition.bottom +
|
|
27
|
+
bottom: Math.max(0, Math.min(window.innerHeight - h, this.initialPosition.bottom + n))
|
|
43
28
|
};
|
|
44
29
|
} else if (this.isResizing) {
|
|
45
|
-
const e = this.dragStartPos.x - t.clientX,
|
|
30
|
+
const e = this.dragStartPos.x - t.clientX, n = this.dragStartPos.y - t.clientY;
|
|
46
31
|
if (this.resizeDirection === "horizontal" || this.resizeDirection === "both") {
|
|
47
32
|
const i = this.position.right < this.screenWidth / 2;
|
|
48
33
|
this.windowWidth = Math.max(300, this.resizeStartWidth + (i ? e : -e));
|
|
49
34
|
}
|
|
50
|
-
(this.resizeDirection === "vertical" || this.resizeDirection === "both") && (this.windowHeight = Math.max(400, this.resizeStartHeight +
|
|
35
|
+
(this.resizeDirection === "vertical" || this.resizeDirection === "both") && (this.windowHeight = Math.max(400, this.resizeStartHeight + n));
|
|
51
36
|
}
|
|
52
37
|
}, this.onMouseUp = (t) => {
|
|
53
38
|
this.isDragging ? (this.isDragging = !1, window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), Math.hypot(t.clientX - this.dragStartPos.x, t.clientY - this.dragStartPos.y) < 5 && this.onToggle()) : this.isResizing && (this.isResizing = !1, window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp));
|
|
@@ -83,9 +68,9 @@ let o = class extends _ {
|
|
|
83
68
|
if (!t || this.products?.length <= 1) return;
|
|
84
69
|
const e = this.products.map((i) => ({ value: i.id, label: i.name }));
|
|
85
70
|
t.items = e;
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const i =
|
|
71
|
+
const n = t.selectedItems?.() || [];
|
|
72
|
+
if (n.length > 0) {
|
|
73
|
+
const i = n[0]?.value;
|
|
89
74
|
!this.products.some((l) => l.id === i) && t.setSelected && t.setSelected([]);
|
|
90
75
|
}
|
|
91
76
|
}
|
|
@@ -104,9 +89,9 @@ let o = class extends _ {
|
|
|
104
89
|
async ensureToken(t = !1) {
|
|
105
90
|
const e = "logosphere_chatbot_token";
|
|
106
91
|
if (t && (this.assertionToken = void 0, localStorage.removeItem(e)), !t) {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
this.assertionToken =
|
|
92
|
+
const r = localStorage.getItem(e);
|
|
93
|
+
if (r) {
|
|
94
|
+
this.assertionToken = r;
|
|
110
95
|
return;
|
|
111
96
|
}
|
|
112
97
|
}
|
|
@@ -116,7 +101,7 @@ let o = class extends _ {
|
|
|
116
101
|
}
|
|
117
102
|
async postChat(t) {
|
|
118
103
|
await this.ensureToken();
|
|
119
|
-
const e = `${this.returnUri}/api/chat/completions`,
|
|
104
|
+
const e = `${this.returnUri}/api/chat/completions`, n = () => fetch(e, {
|
|
120
105
|
method: "POST",
|
|
121
106
|
headers: {
|
|
122
107
|
"Content-Type": "application/json",
|
|
@@ -125,8 +110,8 @@ let o = class extends _ {
|
|
|
125
110
|
},
|
|
126
111
|
body: JSON.stringify(t)
|
|
127
112
|
});
|
|
128
|
-
let i = await
|
|
129
|
-
if (i.status === 401 && (await this.ensureToken(!0), i = await
|
|
113
|
+
let i = await n();
|
|
114
|
+
if (i.status === 401 && (await this.ensureToken(!0), i = await n()), !i.ok) throw new Error(`HTTP ${i.status}`);
|
|
130
115
|
return i.json();
|
|
131
116
|
}
|
|
132
117
|
async initConversation() {
|
|
@@ -158,14 +143,14 @@ let o = class extends _ {
|
|
|
158
143
|
}
|
|
159
144
|
this.addMessage(t, "user"), this.inputText = "", this.isLoading = !0;
|
|
160
145
|
try {
|
|
161
|
-
const
|
|
146
|
+
const n = (await this.postChat({
|
|
162
147
|
ChatCompletionType: "ConversationUpdate",
|
|
163
148
|
Content: t,
|
|
164
149
|
Context: this.selectedProductId,
|
|
165
150
|
ConversationId: this.conversationId,
|
|
166
151
|
QuestionPrompt: this.questionPrompt
|
|
167
152
|
})).Data?.Choices?.[0]?.Message?.Content;
|
|
168
|
-
this.addMessage(
|
|
153
|
+
this.addMessage(n || "Cevap alınamadı.", "assistant");
|
|
169
154
|
} catch {
|
|
170
155
|
this.addMessage("Bağlantı hatası.", "system");
|
|
171
156
|
} finally {
|
|
@@ -184,18 +169,18 @@ let o = class extends _ {
|
|
|
184
169
|
// ==================== CONTENT FORMATTER ====================
|
|
185
170
|
formatContent(t) {
|
|
186
171
|
if (!t) return "";
|
|
187
|
-
const
|
|
172
|
+
const n = t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").split(`
|
|
188
173
|
`);
|
|
189
|
-
let i = "",
|
|
190
|
-
for (const h of
|
|
191
|
-
const
|
|
192
|
-
if (p ||
|
|
174
|
+
let i = "", r = !1, l = "";
|
|
175
|
+
for (const h of n) {
|
|
176
|
+
const f = h.trim() === "", p = h.match(/^\s*\d+\.\s+(.*)/), g = h.match(/^\s*[-*]\s+(.*)/);
|
|
177
|
+
if (p || g) {
|
|
193
178
|
const u = p ? "ol" : "ul";
|
|
194
|
-
(!
|
|
179
|
+
(!r || l !== u) && (r && (i += `</${l}>`), i += `<${u}>`, r = !0, l = u), i += `<li>${p ? p[1] : g[1]}</li>`;
|
|
195
180
|
} else
|
|
196
|
-
|
|
181
|
+
f ? r || (i += "<br>") : (r && (i += `</${l}>`, r = !1, l = ""), i += `<p>${h}</p>`);
|
|
197
182
|
}
|
|
198
|
-
return
|
|
183
|
+
return r && (i += `</${l}>`), i.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(
|
|
199
184
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
200
185
|
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
|
|
201
186
|
);
|
|
@@ -243,9 +228,9 @@ let o = class extends _ {
|
|
|
243
228
|
"chatbot__window",
|
|
244
229
|
this.open ? "" : "chatbot__window--hidden",
|
|
245
230
|
this.fullscreen ? "chatbot__window--fullscreen" : ""
|
|
246
|
-
].filter(Boolean).join(" "),
|
|
231
|
+
].filter(Boolean).join(" "), n = this.fullscreen ? "" : `bottom: 20px; height: ${this.windowHeight}px; width: ${this.windowWidth}px; ${t ? "right: 20px;" : "left: 20px;"}`;
|
|
247
232
|
return a`
|
|
248
|
-
<div class="${e}" style="${
|
|
233
|
+
<div class="${e}" style="${n}">
|
|
249
234
|
${this.renderResizeHandles(t)}
|
|
250
235
|
${this.renderHeader()}
|
|
251
236
|
<div class="chatbot__body">
|
|
@@ -341,7 +326,7 @@ let o = class extends _ {
|
|
|
341
326
|
<div class="chatbot__message chatbot__message--${t.role}">
|
|
342
327
|
<div class="${e}">
|
|
343
328
|
<div class="chatbot__message-content">
|
|
344
|
-
${
|
|
329
|
+
${w(this.formatContent(t.content))}
|
|
345
330
|
</div>
|
|
346
331
|
${this.showFeedbackButtons && t.role === "assistant" ? this.renderFeedbackButtons(t) : ""}
|
|
347
332
|
</div>
|
|
@@ -411,85 +396,85 @@ let o = class extends _ {
|
|
|
411
396
|
`;
|
|
412
397
|
}
|
|
413
398
|
};
|
|
414
|
-
o.styles = [
|
|
399
|
+
o.styles = [_`${v(x)}`];
|
|
415
400
|
o.ICONS = {
|
|
416
401
|
launcher: "data:image/svg+xml,%3Csvg%20width%3D%2251%22%20height%3D%2242%22%20viewBox%3D%220%200%2051%2042%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M38.457%200C40.0338%200%2041.542%200.293293%2042.9302%200.8283L49.15%206.07675C50.2611%207.93912%2050.8994%2010.1162%2050.8994%2012.4424V23.084C50.8994%2024.4858%2050.6676%2025.8334%2050.2402%2027.0907L43.1534%2034.6096C41.7043%2035.2006%2040.1187%2035.5264%2038.457%2035.5264H30.7605L38.5805%2027.2296C40.814%2027.1643%2042.6045%2025.3332%2042.6045%2023.084V12.4424C42.6045%2010.1518%2040.7476%208.29492%2038.457%208.29492H12.4424C10.1518%208.29492%208.29492%2010.1518%208.29492%2012.4424V23.084C8.29492%2025.3746%2010.1518%2027.2314%2012.4424%2027.2314H33.5078L20.4487%2041.0866C17.7992%2042.5379%2014.3381%2040.2741%2014.7842%2036.7803C14.8402%2036.3421%2014.9629%2035.9194%2015.1416%2035.5264H12.4424C10.9217%2035.5264%209.46472%2035.2536%208.11774%2034.7542L0.610679%2026.945C0.214298%2025.7295%200%2024.4318%200%2023.084V12.4424C0%2010.8011%200.317794%209.23402%200.895207%207.79935L7.12424%201.19058C8.73679%200.427072%2010.5397%200%2012.4424%200H38.457ZM23.1357%2017.7881C23.1357%2015.4815%2021.2656%2013.6113%2018.959%2013.6113C16.6525%2013.6114%2014.7822%2015.4815%2014.7822%2017.7881C14.7824%2020.0945%2016.6526%2021.9638%2018.959%2021.9639C21.2655%2021.9639%2023.1356%2020.0945%2023.1357%2017.7881ZM36.2344%2017.7881C36.2344%2015.4815%2034.3642%2013.6113%2032.0576%2013.6113C29.7511%2013.6114%2027.8809%2015.4815%2027.8809%2017.7881C27.881%2020.0945%2029.7512%2021.9638%2032.0576%2021.9639C34.3641%2021.9639%2036.2342%2020.0945%2036.2344%2017.7881Z%22%20fill%3D%22url(%23paint0_linear_97_4585)%22%2F%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear_97_4585%22%20x1%3D%2231.662%22%20y1%3D%224.88016%22%20x2%3D%2214.4119%22%20y2%3D%2237.9167%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23F22727%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23CA0D0D%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"
|
|
417
402
|
};
|
|
418
|
-
|
|
403
|
+
s([
|
|
419
404
|
d({ type: String, attribute: "return-uri" })
|
|
420
405
|
], o.prototype, "returnUri", 2);
|
|
421
|
-
|
|
406
|
+
s([
|
|
422
407
|
d({ type: String, attribute: "question-prompt" })
|
|
423
408
|
], o.prototype, "questionPrompt", 2);
|
|
424
|
-
|
|
409
|
+
s([
|
|
425
410
|
d({ type: Boolean, attribute: "minimized-icon-only" })
|
|
426
411
|
], o.prototype, "minimizedIconOnly", 2);
|
|
427
|
-
|
|
412
|
+
s([
|
|
428
413
|
d({ type: Boolean, attribute: "draggable" })
|
|
429
414
|
], o.prototype, "draggable", 2);
|
|
430
|
-
|
|
415
|
+
s([
|
|
431
416
|
d({ type: Boolean, attribute: "resizable" })
|
|
432
417
|
], o.prototype, "resizable", 2);
|
|
433
|
-
|
|
418
|
+
s([
|
|
434
419
|
d({
|
|
435
420
|
type: Array,
|
|
436
421
|
hasChanged: (t, e) => t === e ? !1 : !e || !t || t.length !== e.length ? !0 : JSON.stringify(t) !== JSON.stringify(e)
|
|
437
422
|
}),
|
|
438
423
|
d({ type: Array })
|
|
439
424
|
], o.prototype, "products", 2);
|
|
440
|
-
|
|
425
|
+
s([
|
|
441
426
|
d({ type: Boolean, attribute: "open-initially" })
|
|
442
427
|
], o.prototype, "openInitially", 2);
|
|
443
|
-
|
|
428
|
+
s([
|
|
444
429
|
d({ type: Boolean, attribute: "show-feedback-buttons" })
|
|
445
430
|
], o.prototype, "showFeedbackButtons", 2);
|
|
446
|
-
|
|
431
|
+
s([
|
|
447
432
|
c()
|
|
448
433
|
], o.prototype, "open", 2);
|
|
449
|
-
|
|
434
|
+
s([
|
|
450
435
|
c()
|
|
451
436
|
], o.prototype, "fullscreen", 2);
|
|
452
|
-
|
|
437
|
+
s([
|
|
453
438
|
c()
|
|
454
439
|
], o.prototype, "messages", 2);
|
|
455
|
-
|
|
440
|
+
s([
|
|
456
441
|
c()
|
|
457
442
|
], o.prototype, "conversationId", 2);
|
|
458
|
-
|
|
443
|
+
s([
|
|
459
444
|
c()
|
|
460
445
|
], o.prototype, "assertionToken", 2);
|
|
461
|
-
|
|
446
|
+
s([
|
|
462
447
|
c()
|
|
463
448
|
], o.prototype, "isLoading", 2);
|
|
464
|
-
|
|
449
|
+
s([
|
|
465
450
|
c()
|
|
466
451
|
], o.prototype, "inputText", 2);
|
|
467
|
-
|
|
452
|
+
s([
|
|
468
453
|
c()
|
|
469
454
|
], o.prototype, "selectedProductId", 2);
|
|
470
|
-
|
|
455
|
+
s([
|
|
471
456
|
c()
|
|
472
457
|
], o.prototype, "windowWidth", 2);
|
|
473
|
-
|
|
458
|
+
s([
|
|
474
459
|
c()
|
|
475
460
|
], o.prototype, "windowHeight", 2);
|
|
476
|
-
|
|
461
|
+
s([
|
|
477
462
|
c()
|
|
478
463
|
], o.prototype, "position", 2);
|
|
479
|
-
|
|
464
|
+
s([
|
|
480
465
|
c()
|
|
481
466
|
], o.prototype, "isDragging", 2);
|
|
482
|
-
|
|
467
|
+
s([
|
|
483
468
|
c()
|
|
484
469
|
], o.prototype, "screenWidth", 2);
|
|
485
|
-
|
|
486
|
-
|
|
470
|
+
s([
|
|
471
|
+
b("#chat-container")
|
|
487
472
|
], o.prototype, "chatContainer", 2);
|
|
488
|
-
|
|
489
|
-
|
|
473
|
+
s([
|
|
474
|
+
b("#product")
|
|
490
475
|
], o.prototype, "productEl", 2);
|
|
491
|
-
o =
|
|
492
|
-
|
|
476
|
+
o = s([
|
|
477
|
+
y("logosphere-chatbot")
|
|
493
478
|
], o);
|
|
494
479
|
export {
|
|
495
480
|
o as L
|
package/dist/chatbot.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chatbot-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chatbot-Da_itUdJ.cjs");Object.defineProperty(exports,"LedsUiChatbot",{enumerable:!0,get:()=>e.LedsUiChatbot});
|
package/dist/chatbot.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./button-CDRccsk9.cjs"),r=require("./badge-BbhaO73N.cjs"),t=require("./checkbox-CdDTRdKV.cjs"),o=require("./formfield-D_7NFFoe.cjs"),n=require("./switch-Rnnn10bn.cjs"),u=require("./breadcrumb-Cop-B1J7.cjs"),b=require("./card-n8ka8Zk-.cjs"),a=require("./input-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./button-CDRccsk9.cjs"),r=require("./badge-BbhaO73N.cjs"),t=require("./checkbox-CdDTRdKV.cjs"),o=require("./formfield-D_7NFFoe.cjs"),n=require("./switch-Rnnn10bn.cjs"),u=require("./breadcrumb-Cop-B1J7.cjs"),b=require("./card-n8ka8Zk-.cjs"),a=require("./input-BcnI1w3_.cjs"),c=require("./popover-C2p5Pmts.cjs"),i=require("./text-area-BkHdLnZj.cjs"),d=require("./chatbot-Da_itUdJ.cjs"),p=require("./combobox-pmE7bgEL.cjs"),g=require("./datepicker-b9JGTTMx.cjs"),s=require("./download-manager-BSIMTGaK.cjs"),l=require("./modal-DQ8VFL-P.cjs"),m=require("./tab-DcjAlXzU.cjs");Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>e.Button});Object.defineProperty(exports,"LogosphereBadge",{enumerable:!0,get:()=>r.LogosphereBadge});Object.defineProperty(exports,"Checkbox",{enumerable:!0,get:()=>t.Checkbox});Object.defineProperty(exports,"FormField",{enumerable:!0,get:()=>o.FormField});Object.defineProperty(exports,"Switch",{enumerable:!0,get:()=>n.Switch});Object.defineProperty(exports,"Breadcrumb",{enumerable:!0,get:()=>u.Breadcrumb});Object.defineProperty(exports,"Card",{enumerable:!0,get:()=>b.Card});Object.defineProperty(exports,"LogosphereInput",{enumerable:!0,get:()=>a.LogosphereInput});Object.defineProperty(exports,"Popover",{enumerable:!0,get:()=>c.Popover});Object.defineProperty(exports,"TextArea",{enumerable:!0,get:()=>i.TextArea});Object.defineProperty(exports,"LedsUiChatbot",{enumerable:!0,get:()=>d.LedsUiChatbot});Object.defineProperty(exports,"Combobox",{enumerable:!0,get:()=>p.Combobox});Object.defineProperty(exports,"LedsDatePicker",{enumerable:!0,get:()=>g.LedsDatePicker});Object.defineProperty(exports,"DownloadManager",{enumerable:!0,get:()=>s.DownloadManager});Object.defineProperty(exports,"Modal",{enumerable:!0,get:()=>l.Modal});Object.defineProperty(exports,"LogosphereTab",{enumerable:!0,get:()=>m.LogosphereTab});
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,10 @@ import { F as x } from "./formfield-d8fp9FTV.js";
|
|
|
5
5
|
import { S as L } from "./switch-Cpl53nRW.js";
|
|
6
6
|
import { B as C } from "./breadcrumb-B-4yqoJZ.js";
|
|
7
7
|
import { C as h } from "./card-CUhlTJyJ.js";
|
|
8
|
-
import { L as B } from "./input-
|
|
9
|
-
import { P as i } from "./popover-
|
|
10
|
-
import { T as l } from "./text-area-
|
|
11
|
-
import { L as D } from "./chatbot-
|
|
8
|
+
import { L as B } from "./input-Bj_7u8Iv.js";
|
|
9
|
+
import { P as i } from "./popover-B7tCqk3R.js";
|
|
10
|
+
import { T as l } from "./text-area-CC24lj8v.js";
|
|
11
|
+
import { L as D } from "./chatbot-zkxngMRH.js";
|
|
12
12
|
import { C as M } from "./combobox-BJbI-Tgi.js";
|
|
13
13
|
import { L as T } from "./datepicker-DFJx45C-.js";
|
|
14
14
|
import { D as w } from "./download-manager-A4fOxGWJ.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("lit"),t=require("lit/decorators.js"),h=require("
|
|
1
|
+
"use strict";const o=require("lit"),t=require("lit/decorators.js"),h=require("lit/directives/live.js"),u=".input__field{width:100%;background:transparent;border:none;outline:none;font-size:var(--font-size-sm);font-family:var(--font-family-base);color:var(--color-body-text);box-sizing:border-box;line-height:1.5}.input__field::placeholder{color:var(--color-tertiary)}.input__field:disabled{cursor:not-allowed}.input__field--default{height:16px}.input__field--large{height:24px}.input__clear-btn{border:none;background:transparent;color:var(--color-gray-400);cursor:pointer;padding:0;display:inline-flex;align-items:center;outline:none;flex-shrink:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.input__clear-btn:hover{color:var(--color-gray-600)}";var y=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(s,e,n,i)=>{for(var p=i>1?void 0:i?d(e,n):e,l=s.length-1,a;l>=0;l--)(a=s[l])&&(p=(i?a(e,n,p):a(p))||p);return i&&p&&y(e,n,p),p};exports.LogosphereInput=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.type="text",this.placeholder="",this.name="",this.autocomplete="",this.pattern="",this.size="default",this.variant="default",this.showClear=!1,this.label="",this.helper="",this.error="",this.required=!1,this.disabled=!1,this.readonly=!1,this._internalError="",this.handleInput=e=>{const n=e.target;this.value=n.value,this._internalError&&(this._internalError="",this._inputElement.setCustomValidity("")),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleChange=e=>{const n=e.target;this.value=n.value,n.checkValidity()||(this._internalError=n.validationMessage),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleKeyDown=e=>{this.dispatchEvent(new CustomEvent("keydown",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleKeyUp=e=>{this.dispatchEvent(new CustomEvent("keyup",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleClear=()=>{this.value="",this._inputElement&&(this._inputElement.value=""),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:"",originalEvent:null}}))}}get inputElement(){return this._inputElement}focus(){this._inputElement?.focus()}blur(){this._inputElement?.blur()}select(){this._inputElement?.select()}setSelectionRange(e,n,i){this._inputElement?.setSelectionRange(e,n,i)}checkValidity(){return this._inputElement?.checkValidity()??!0}reportValidity(){return this._inputElement?.reportValidity()??!0}setCustomValidity(e){this._inputElement?.setCustomValidity(e),this._internalError=e,this.requestUpdate()}render(){const e=this.error||this._internalError,n=this.showClear&&this.value&&!this.disabled&&!this.readonly,i=`input__field input__field--${this.size}`;return o.html`
|
|
2
2
|
<logosphere-formfield
|
|
3
3
|
.label=${this.label}
|
|
4
4
|
.helper=${this.helper}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<input
|
|
14
14
|
class="${i}"
|
|
15
15
|
type=${this.type}
|
|
16
|
-
.value=${h.
|
|
16
|
+
.value=${h.live(this.value)}
|
|
17
17
|
placeholder=${this.placeholder||o.nothing}
|
|
18
18
|
name=${this.name||o.nothing}
|
|
19
19
|
autocomplete=${this.autocomplete||o.nothing}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement as d, nothing as o, html as u, unsafeCSS as y, css as c } from "lit";
|
|
2
2
|
import { query as m, property as r, state as b, customElement as v } from "lit/decorators.js";
|
|
3
|
-
import {
|
|
3
|
+
import { live as g } from "lit/directives/live.js";
|
|
4
4
|
const _ = ".input__field{width:100%;background:transparent;border:none;outline:none;font-size:var(--font-size-sm);font-family:var(--font-family-base);color:var(--color-body-text);box-sizing:border-box;line-height:1.5}.input__field::placeholder{color:var(--color-tertiary)}.input__field:disabled{cursor:not-allowed}.input__field--default{height:16px}.input__field--large{height:24px}.input__clear-btn{border:none;background:transparent;color:var(--color-gray-400);cursor:pointer;padding:0;display:inline-flex;align-items:center;outline:none;flex-shrink:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.input__clear-btn:hover{color:var(--color-gray-600)}";
|
|
5
5
|
var f = Object.defineProperty, E = Object.getOwnPropertyDescriptor, e = (i, n, l, a) => {
|
|
6
6
|
for (var s = a > 1 ? void 0 : a ? E(n, l) : n, p = i.length - 1, h; p >= 0; p--)
|
package/dist/input.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./input-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./input-BcnI1w3_.cjs");Object.defineProperty(exports,"LogosphereInput",{enumerable:!0,get:()=>e.LogosphereInput});
|
package/dist/input.js
CHANGED