@a.nemreen/dga-ui 0.3.13 → 0.3.14
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/README.md +4 -0
- package/fesm2022/a.nemreen-dga-ui-chart.mjs +445 -0
- package/fesm2022/a.nemreen-dga-ui-chatbot.mjs +295 -0
- package/fesm2022/a.nemreen-dga-ui-dga-icon-registry-sBZfCS6q.mjs +1 -0
- package/fesm2022/a.nemreen-dga-ui-page-transition.mjs +1 -0
- package/fesm2022/a.nemreen-dga-ui-saudi-cities.mjs +1 -0
- package/fesm2022/a.nemreen-dga-ui.mjs +303 -949
- package/package.json +17 -1
- package/types/a.nemreen-dga-ui-chart.d.ts +157 -0
- package/types/a.nemreen-dga-ui-chatbot.d.ts +102 -0
- package/types/a.nemreen-dga-ui-cookies.d.ts +1 -2
- package/types/a.nemreen-dga-ui-page-transition.d.ts +51 -0
- package/types/a.nemreen-dga-ui-saudi-cities.d.ts +19 -0
- package/types/a.nemreen-dga-ui.d.ts +32 -336
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import*as e from"@angular/core";import{inject as d,DestroyRef as f,Injector as h,viewChild as c,input as t,booleanAttribute as s,numberAttribute as y,output as r,signal as l,computed as n,afterNextRender as g,ChangeDetectionStrategy as v,Component as x}from"@angular/core";import{dgaIsArabic as N,dgaCx as b,DgaButton as m,DgaIcon as u}from"@a.nemreen/dga-ui";class i{destroyRef=d(f);injector=d(h);composerRef=c("composer",...ngDevMode?[{debugName:"composerRef"}]:[]);logRef=c("log",...ngDevMode?[{debugName:"logRef"}]:[]);position=t("end",...ngDevMode?[{debugName:"position"}]:[]);animation=t("slide",...ngDevMode?[{debugName:"animation"}]:[]);size=t("md",...ngDevMode?[{debugName:"size"}]:[]);title=t("",...ngDevMode?[{debugName:"title"}]:[]);subtitle=t("",...ngDevMode?[{debugName:"subtitle"}]:[]);fabLabel=t("",...ngDevMode?[{debugName:"fabLabel"}]:[]);placeholder=t("",...ngDevMode?[{debugName:"placeholder"}]:[]);fabIcon=t("message",...ngDevMode?[{debugName:"fabIcon"}]:[]);sendIcon=t("arrowNext",...ngDevMode?[{debugName:"sendIcon"}]:[]);agentIcon=t("message",...ngDevMode?[{debugName:"agentIcon"}]:[]);fabTone=t("primary",...ngDevMode?[{debugName:"fabTone"}]:[]);overlay=t(!0,{...ngDevMode?{debugName:"overlay"}:{},transform:s});overlayClose=t(!0,{...ngDevMode?{debugName:"overlayClose"}:{},transform:s});online=t(!0,{...ngDevMode?{debugName:"online"}:{},transform:s});hideFabWhenOpen=t(!0,{...ngDevMode?{debugName:"hideFabWhenOpen"}:{},transform:s});stack=t(1,{...ngDevMode?{debugName:"stack"}:{},transform:y});clearFab=t(!0,{...ngDevMode?{debugName:"clearFab"}:{},transform:s});embedded=t(!1,{...ngDevMode?{debugName:"embedded"}:{},transform:s});initialMessages=t([],...ngDevMode?[{debugName:"initialMessages"}]:[]);sent=r();opened=r();closed=r();open=l(!1,...ngDevMode?[{debugName:"open"}]:[]);draft=l("",...ngDevMode?[{debugName:"draft"}]:[]);messages=l([],...ngDevMode?[{debugName:"messages"}]:[]);seq=Math.random().toString(36).slice(2,8);panelId=`dga-chatbot-panel-${this.seq}`;msgSeq=0;seeded=!1;prevOverflow="";copy=n(()=>{const a=N();return{title:a?"المساعد الذكي":"Help assistant",subtitle:a?"عادةً نرد خلال دقائق":"We typically reply within minutes",open:a?"فتح المحادثة":"Open chat",close:a?"إغلاق":"Close",send:a?"إرسال":"Send",input:a?"رسالتك":"Your message",placeholder:a?"اكتب رسالتك…":"Type your message…",panelLabel:a?"نافذة المحادثة":"Chat panel",welcome:a?"مرحبًا! كيف يمكننا مساعدتك اليوم؟":"Hello! How can we help you today?"}},...ngDevMode?[{debugName:"copy"}]:[]);fabBottom=n(()=>this.embedded()?"var(--dga-fab-edge, 0.75rem)":`calc(var(--dga-fab-edge, 2rem) + ${Math.max(0,this.stack())} * var(--dga-fab-stack-step, 4.25rem))`,...ngDevMode?[{debugName:"fabBottom"}]:[]);fabClasses=n(()=>b("dga-chatbot-fab",this.embedded()?"absolute":"fixed","z-toast inline-flex size-[var(--dga-fab-size,3.5rem)] items-center justify-center","cursor-pointer rounded-full border border-transparent text-on-color","shadow-lg transition-[box-shadow,background-color,transform] duration-200","hover:opacity-90 hover:shadow-xl active:scale-95","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-focus",this.fabTone()==="primary"?"bg-primary":"bg-secondary"),...ngDevMode?[{debugName:"fabClasses"}]:[]);panelClasses=n(()=>{const a=this.size(),o=this.embedded();return b("dga-chatbot-panel absolute z-10",o?"bottom-[calc(var(--spacing-lg,0.75rem)+3.5rem+var(--spacing-sm))]":"bottom-[var(--dga-fab-edge,2rem)]","flex flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-xl",a==="sm"&&(o?"h-[min(18rem,100%)] w-[min(18rem,calc(100%-1rem))]":"h-[min(22rem,65dvh)] w-[min(20rem,calc(100vw-1.5rem))]"),a==="md"&&(o?"h-[min(22rem,100%)] w-[min(20rem,calc(100%-1rem))]":"h-[min(28rem,70dvh)] w-[min(24rem,calc(100vw-1.5rem))]"),a==="lg"&&(o?"h-[min(26rem,100%)] w-[min(22rem,calc(100%-1rem))]":"h-[min(34rem,78dvh)] w-[min(28rem,calc(100vw-1.5rem))]"))},...ngDevMode?[{debugName:"panelClasses"}]:[]);constructor(){this.destroyRef.onDestroy(()=>this.unlockScroll())}ensureSeed(){if(this.seeded)return;this.seeded=!0;const a=this.initialMessages();a.length?this.messages.set([...a]):this.messages.set([{id:"welcome",role:"bot",text:this.copy().welcome}])}toggle(){this.open()?this.close():this.show()}show(){this.ensureSeed(),this.open.set(!0),this.lockScroll(),this.opened.emit(),g(()=>{this.composerRef()?.nativeElement.focus(),this.scrollLogToEnd()},{injector:this.injector})}close(){this.open()&&(this.open.set(!1),this.unlockScroll(),this.closed.emit())}onBackdrop(){this.overlayClose()&&this.close()}onSubmit(a){a.preventDefault();const o=this.draft().trim();o&&(this.ensureSeed(),this.msgSeq+=1,this.messages.update(p=>[...p,{id:`u-${this.msgSeq}`,role:"user",text:o}]),this.draft.set(""),this.sent.emit(o),g(()=>{this.scrollLogToEnd(),this.composerRef()?.nativeElement.focus()},{injector:this.injector}))}scrollLogToEnd(){const a=this.logRef()?.nativeElement;a&&(a.scrollTop=a.scrollHeight)}lockScroll(){typeof document>"u"||this.embedded()||!this.overlay()||(this.prevOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}unlockScroll(){typeof document>"u"||(document.body.style.overflow=this.prevOverflow)}static ɵfac=e.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.1.5",ngImport:e,type:i,deps:[],target:e.ɵɵFactoryTarget.Component});static ɵcmp=e.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.1.5",type:i,isStandalone:!0,selector:"dga-chatbot",inputs:{position:{classPropertyName:"position",publicName:"position",isSignal:!0,isRequired:!1,transformFunction:null},animation:{classPropertyName:"animation",publicName:"animation",isSignal:!0,isRequired:!1,transformFunction:null},size:{classPropertyName:"size",publicName:"size",isSignal:!0,isRequired:!1,transformFunction:null},title:{classPropertyName:"title",publicName:"title",isSignal:!0,isRequired:!1,transformFunction:null},subtitle:{classPropertyName:"subtitle",publicName:"subtitle",isSignal:!0,isRequired:!1,transformFunction:null},fabLabel:{classPropertyName:"fabLabel",publicName:"fabLabel",isSignal:!0,isRequired:!1,transformFunction:null},placeholder:{classPropertyName:"placeholder",publicName:"placeholder",isSignal:!0,isRequired:!1,transformFunction:null},fabIcon:{classPropertyName:"fabIcon",publicName:"fabIcon",isSignal:!0,isRequired:!1,transformFunction:null},sendIcon:{classPropertyName:"sendIcon",publicName:"sendIcon",isSignal:!0,isRequired:!1,transformFunction:null},agentIcon:{classPropertyName:"agentIcon",publicName:"agentIcon",isSignal:!0,isRequired:!1,transformFunction:null},fabTone:{classPropertyName:"fabTone",publicName:"fabTone",isSignal:!0,isRequired:!1,transformFunction:null},overlay:{classPropertyName:"overlay",publicName:"overlay",isSignal:!0,isRequired:!1,transformFunction:null},overlayClose:{classPropertyName:"overlayClose",publicName:"overlayClose",isSignal:!0,isRequired:!1,transformFunction:null},online:{classPropertyName:"online",publicName:"online",isSignal:!0,isRequired:!1,transformFunction:null},hideFabWhenOpen:{classPropertyName:"hideFabWhenOpen",publicName:"hideFabWhenOpen",isSignal:!0,isRequired:!1,transformFunction:null},stack:{classPropertyName:"stack",publicName:"stack",isSignal:!0,isRequired:!1,transformFunction:null},clearFab:{classPropertyName:"clearFab",publicName:"clearFab",isSignal:!0,isRequired:!1,transformFunction:null},embedded:{classPropertyName:"embedded",publicName:"embedded",isSignal:!0,isRequired:!1,transformFunction:null},initialMessages:{classPropertyName:"initialMessages",publicName:"initialMessages",isSignal:!0,isRequired:!1,transformFunction:null}},outputs:{sent:"sent",opened:"opened",closed:"closed"},host:{properties:{"class.contents":"!embedded()","attr.data-position":"position()","attr.data-animation":"animation()","attr.data-embedded":"embedded() || null"}},viewQueries:[{propertyName:"composerRef",first:!0,predicate:["composer"],descendants:!0,isSignal:!0},{propertyName:"logRef",first:!0,predicate:["log"],descendants:!0,isSignal:!0}],ngImport:e,template:`
|
|
2
|
+
@if (open()) {
|
|
3
|
+
<div
|
|
4
|
+
class="dga-chatbot-layer inset-0 z-urgent"
|
|
5
|
+
[class.fixed]="!embedded()"
|
|
6
|
+
[class.absolute]="embedded()"
|
|
7
|
+
role="presentation"
|
|
8
|
+
[attr.data-animation]="animation()"
|
|
9
|
+
[attr.data-edge]="position()"
|
|
10
|
+
>
|
|
11
|
+
@if (overlay()) {
|
|
12
|
+
<div
|
|
13
|
+
class="dga-chatbot-backdrop absolute inset-0 bg-overlay/25"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
(click)="onBackdrop()"
|
|
16
|
+
></div>
|
|
17
|
+
}
|
|
18
|
+
<aside
|
|
19
|
+
#panel
|
|
20
|
+
[id]="panelId"
|
|
21
|
+
role="dialog"
|
|
22
|
+
aria-modal="true"
|
|
23
|
+
[attr.aria-label]="copy().panelLabel"
|
|
24
|
+
[class]="panelClasses()"
|
|
25
|
+
[attr.data-animation]="animation()"
|
|
26
|
+
[attr.data-edge]="position()"
|
|
27
|
+
[attr.data-size]="size()"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class="flex shrink-0 items-center gap-md border-b border-border bg-surface/80
|
|
31
|
+
px-lg py-md backdrop-blur-sm sm:px-xl sm:py-lg"
|
|
32
|
+
>
|
|
33
|
+
<span
|
|
34
|
+
class="relative inline-flex size-5xl shrink-0 items-center justify-center
|
|
35
|
+
rounded-full bg-primary-faint text-fg-primary"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
>
|
|
38
|
+
<dga-icon [name]="agentIcon()" size="lg" tone="primary" />
|
|
39
|
+
@if (online()) {
|
|
40
|
+
<span
|
|
41
|
+
class="absolute end-0 bottom-0 size-md rounded-full border-2 border-card
|
|
42
|
+
bg-success"
|
|
43
|
+
></span>
|
|
44
|
+
}
|
|
45
|
+
</span>
|
|
46
|
+
<div class="min-w-0 flex-1">
|
|
47
|
+
<h2 class="m-0 truncate text-body-md font-bold text-display sm:text-body-lg">
|
|
48
|
+
{{ title() || copy().title }}
|
|
49
|
+
</h2>
|
|
50
|
+
@if (subtitle() || copy().subtitle) {
|
|
51
|
+
<p class="m-0 mt-xxs truncate text-body-xs text-muted">
|
|
52
|
+
{{ subtitle() || copy().subtitle }}
|
|
53
|
+
</p>
|
|
54
|
+
}
|
|
55
|
+
</div>
|
|
56
|
+
<button
|
|
57
|
+
type="button"
|
|
58
|
+
class="inline-flex size-4xl shrink-0 cursor-pointer items-center justify-center
|
|
59
|
+
rounded-sm text-muted transition-colors
|
|
60
|
+
hover:bg-neutral-light hover:text-fg
|
|
61
|
+
focus-visible:outline focus-visible:outline-2
|
|
62
|
+
focus-visible:outline-offset-2 focus-visible:outline-focus"
|
|
63
|
+
[attr.aria-label]="copy().close"
|
|
64
|
+
(click)="close()"
|
|
65
|
+
>
|
|
66
|
+
<dga-icon name="close" size="md" tone="current" />
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div
|
|
71
|
+
#log
|
|
72
|
+
class="flex min-h-0 flex-1 flex-col gap-md overflow-y-auto px-lg py-lg sm:px-xl"
|
|
73
|
+
role="log"
|
|
74
|
+
aria-live="polite"
|
|
75
|
+
>
|
|
76
|
+
@for (msg of messages(); track msg.id) {
|
|
77
|
+
<div
|
|
78
|
+
class="dga-chatbot-bubble max-w-[85%] rounded-2xl px-lg py-md text-body-sm
|
|
79
|
+
leading-relaxed"
|
|
80
|
+
[class.ms-auto]="msg.role === 'user'"
|
|
81
|
+
[class.bg-primary]="msg.role === 'user'"
|
|
82
|
+
[class.text-on-color]="msg.role === 'user'"
|
|
83
|
+
[class.bg-sunken]="msg.role === 'bot'"
|
|
84
|
+
[class.text-paragraph]="msg.role === 'bot'"
|
|
85
|
+
[attr.data-role]="msg.role"
|
|
86
|
+
>
|
|
87
|
+
{{ msg.text }}
|
|
88
|
+
</div>
|
|
89
|
+
}
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<form
|
|
93
|
+
class="flex shrink-0 items-end gap-sm border-t border-border bg-surface/60
|
|
94
|
+
px-lg py-md sm:gap-md sm:px-xl sm:py-lg"
|
|
95
|
+
(submit)="onSubmit($event)"
|
|
96
|
+
>
|
|
97
|
+
<input
|
|
98
|
+
#composer
|
|
99
|
+
type="text"
|
|
100
|
+
class="min-w-0 flex-1 rounded-full border border-border bg-card px-xl py-md
|
|
101
|
+
text-body-md text-fg shadow-xs placeholder:text-muted
|
|
102
|
+
focus-visible:outline focus-visible:outline-2
|
|
103
|
+
focus-visible:outline-offset-0 focus-visible:outline-focus"
|
|
104
|
+
[attr.aria-label]="copy().input"
|
|
105
|
+
[placeholder]="placeholder() || copy().placeholder"
|
|
106
|
+
[value]="draft()"
|
|
107
|
+
(input)="draft.set($any($event.target).value)"
|
|
108
|
+
name="chat-draft"
|
|
109
|
+
autocomplete="off"
|
|
110
|
+
/>
|
|
111
|
+
<button
|
|
112
|
+
dgaButton
|
|
113
|
+
type="submit"
|
|
114
|
+
variant="primary"
|
|
115
|
+
iconOnly
|
|
116
|
+
class="dga-chatbot-send shrink-0"
|
|
117
|
+
[disabled]="!draft().trim()"
|
|
118
|
+
[attr.aria-label]="copy().send"
|
|
119
|
+
>
|
|
120
|
+
<dga-icon [name]="sendIcon()" size="md" />
|
|
121
|
+
</button>
|
|
122
|
+
</form>
|
|
123
|
+
</aside>
|
|
124
|
+
</div>
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@if (!open() || !hideFabWhenOpen()) {
|
|
128
|
+
<button
|
|
129
|
+
type="button"
|
|
130
|
+
[class]="fabClasses()"
|
|
131
|
+
[style.bottom]="fabBottom()"
|
|
132
|
+
[attr.data-edge]="position()"
|
|
133
|
+
[attr.data-tone]="fabTone()"
|
|
134
|
+
[attr.data-stack]="stack()"
|
|
135
|
+
[attr.aria-expanded]="open()"
|
|
136
|
+
[attr.aria-controls]="panelId"
|
|
137
|
+
[attr.aria-label]="open() ? copy().close : fabLabel() || copy().open"
|
|
138
|
+
(click)="toggle()"
|
|
139
|
+
>
|
|
140
|
+
<dga-icon
|
|
141
|
+
[name]="open() ? 'close' : fabIcon()"
|
|
142
|
+
size="xl"
|
|
143
|
+
tone="current"
|
|
144
|
+
aria-hidden="true"
|
|
145
|
+
/>
|
|
146
|
+
</button>
|
|
147
|
+
}
|
|
148
|
+
`,isInline:!0,styles:[":host[data-embedded]{display:block;position:absolute;inset:0;pointer-events:none}:host[data-embedded] .dga-chatbot-fab,:host[data-embedded] .dga-chatbot-layer{pointer-events:auto}:host[data-embedded] .dga-chatbot-fab{--dga-local-fab-edge: var(--spacing-lg, .75rem)}:host .dga-chatbot-fab[data-edge=end]{inset-inline-end:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));inset-inline-start:auto}:host .dga-chatbot-fab[data-edge=start]{inset-inline-start:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));inset-inline-end:auto}:host .dga-chatbot-fab[data-edge=left]{left:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));right:auto}:host .dga-chatbot-fab[data-edge=right]{right:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));left:auto}:host .dga-chatbot-panel[data-edge=end]{inset-inline-end:var(--dga-fab-edge, var(--spacing-4xl, 2rem));inset-inline-start:auto}:host .dga-chatbot-panel[data-edge=start]{inset-inline-start:var(--dga-fab-edge, var(--spacing-4xl, 2rem));inset-inline-end:auto}:host .dga-chatbot-panel[data-edge=left]{left:var(--dga-fab-edge, var(--spacing-4xl, 2rem));right:auto}:host .dga-chatbot-panel[data-edge=right]{right:var(--dga-fab-edge, var(--spacing-4xl, 2rem));left:auto}:host[data-embedded] .dga-chatbot-panel[data-edge=end],:host[data-embedded] .dga-chatbot-panel[data-edge=start],:host[data-embedded] .dga-chatbot-panel[data-edge=left],:host[data-embedded] .dga-chatbot-panel[data-edge=right]{inset-inline-end:var(--spacing-lg, .75rem);inset-inline-start:auto}@keyframes dga-chatbot-fade-in{0%{opacity:0}to{opacity:1}}@keyframes dga-chatbot-slide-in{0%{opacity:0;transform:translateY(.75rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chatbot-scale-in{0%{opacity:0;transform:scale(.92)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chatbot-bubble-in{0%{opacity:0;transform:translateY(.35rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-chatbot-backdrop-in{0%{opacity:0}to{opacity:1}}:host .dga-chatbot-backdrop{animation:dga-chatbot-backdrop-in .18s ease-out both}:host .dga-chatbot-panel[data-animation=fade]{animation:dga-chatbot-fade-in .2s ease-out both}:host .dga-chatbot-panel[data-animation=slide]{animation:dga-chatbot-slide-in .24s cubic-bezier(.16,1,.3,1) both}:host .dga-chatbot-panel[data-animation=scale]{animation:dga-chatbot-scale-in .22s cubic-bezier(.16,1,.3,1) both;transform-origin:bottom var(--dga-chatbot-origin, end)}:host .dga-chatbot-panel[data-animation=scale][data-edge=start],:host .dga-chatbot-panel[data-animation=scale][data-edge=left]{transform-origin:bottom start}:host .dga-chatbot-panel[data-animation=scale][data-edge=end],:host .dga-chatbot-panel[data-animation=scale][data-edge=right]{transform-origin:bottom end}:host .dga-chatbot-bubble{animation:dga-chatbot-bubble-in .18s ease-out both}:host .dga-chatbot-send{border-radius:9999px}@media(prefers-reduced-motion:reduce){:host .dga-chatbot-backdrop,:host .dga-chatbot-panel,:host .dga-chatbot-bubble{animation:none!important}}\n"],dependencies:[{kind:"directive",type:m,selector:"button[dgaButton], a[dgaButton]",inputs:["variant","size","iconOnly","cooldownMs","loading","dgaButtonClass"]},{kind:"component",type:u,selector:"dga-icon",inputs:["name","glyph","size","tone","label"]}],changeDetection:e.ChangeDetectionStrategy.OnPush})}e.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.1.5",ngImport:e,type:i,decorators:[{type:x,args:[{selector:"dga-chatbot",standalone:!0,imports:[m,u],template:`
|
|
149
|
+
@if (open()) {
|
|
150
|
+
<div
|
|
151
|
+
class="dga-chatbot-layer inset-0 z-urgent"
|
|
152
|
+
[class.fixed]="!embedded()"
|
|
153
|
+
[class.absolute]="embedded()"
|
|
154
|
+
role="presentation"
|
|
155
|
+
[attr.data-animation]="animation()"
|
|
156
|
+
[attr.data-edge]="position()"
|
|
157
|
+
>
|
|
158
|
+
@if (overlay()) {
|
|
159
|
+
<div
|
|
160
|
+
class="dga-chatbot-backdrop absolute inset-0 bg-overlay/25"
|
|
161
|
+
aria-hidden="true"
|
|
162
|
+
(click)="onBackdrop()"
|
|
163
|
+
></div>
|
|
164
|
+
}
|
|
165
|
+
<aside
|
|
166
|
+
#panel
|
|
167
|
+
[id]="panelId"
|
|
168
|
+
role="dialog"
|
|
169
|
+
aria-modal="true"
|
|
170
|
+
[attr.aria-label]="copy().panelLabel"
|
|
171
|
+
[class]="panelClasses()"
|
|
172
|
+
[attr.data-animation]="animation()"
|
|
173
|
+
[attr.data-edge]="position()"
|
|
174
|
+
[attr.data-size]="size()"
|
|
175
|
+
>
|
|
176
|
+
<div
|
|
177
|
+
class="flex shrink-0 items-center gap-md border-b border-border bg-surface/80
|
|
178
|
+
px-lg py-md backdrop-blur-sm sm:px-xl sm:py-lg"
|
|
179
|
+
>
|
|
180
|
+
<span
|
|
181
|
+
class="relative inline-flex size-5xl shrink-0 items-center justify-center
|
|
182
|
+
rounded-full bg-primary-faint text-fg-primary"
|
|
183
|
+
aria-hidden="true"
|
|
184
|
+
>
|
|
185
|
+
<dga-icon [name]="agentIcon()" size="lg" tone="primary" />
|
|
186
|
+
@if (online()) {
|
|
187
|
+
<span
|
|
188
|
+
class="absolute end-0 bottom-0 size-md rounded-full border-2 border-card
|
|
189
|
+
bg-success"
|
|
190
|
+
></span>
|
|
191
|
+
}
|
|
192
|
+
</span>
|
|
193
|
+
<div class="min-w-0 flex-1">
|
|
194
|
+
<h2 class="m-0 truncate text-body-md font-bold text-display sm:text-body-lg">
|
|
195
|
+
{{ title() || copy().title }}
|
|
196
|
+
</h2>
|
|
197
|
+
@if (subtitle() || copy().subtitle) {
|
|
198
|
+
<p class="m-0 mt-xxs truncate text-body-xs text-muted">
|
|
199
|
+
{{ subtitle() || copy().subtitle }}
|
|
200
|
+
</p>
|
|
201
|
+
}
|
|
202
|
+
</div>
|
|
203
|
+
<button
|
|
204
|
+
type="button"
|
|
205
|
+
class="inline-flex size-4xl shrink-0 cursor-pointer items-center justify-center
|
|
206
|
+
rounded-sm text-muted transition-colors
|
|
207
|
+
hover:bg-neutral-light hover:text-fg
|
|
208
|
+
focus-visible:outline focus-visible:outline-2
|
|
209
|
+
focus-visible:outline-offset-2 focus-visible:outline-focus"
|
|
210
|
+
[attr.aria-label]="copy().close"
|
|
211
|
+
(click)="close()"
|
|
212
|
+
>
|
|
213
|
+
<dga-icon name="close" size="md" tone="current" />
|
|
214
|
+
</button>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<div
|
|
218
|
+
#log
|
|
219
|
+
class="flex min-h-0 flex-1 flex-col gap-md overflow-y-auto px-lg py-lg sm:px-xl"
|
|
220
|
+
role="log"
|
|
221
|
+
aria-live="polite"
|
|
222
|
+
>
|
|
223
|
+
@for (msg of messages(); track msg.id) {
|
|
224
|
+
<div
|
|
225
|
+
class="dga-chatbot-bubble max-w-[85%] rounded-2xl px-lg py-md text-body-sm
|
|
226
|
+
leading-relaxed"
|
|
227
|
+
[class.ms-auto]="msg.role === 'user'"
|
|
228
|
+
[class.bg-primary]="msg.role === 'user'"
|
|
229
|
+
[class.text-on-color]="msg.role === 'user'"
|
|
230
|
+
[class.bg-sunken]="msg.role === 'bot'"
|
|
231
|
+
[class.text-paragraph]="msg.role === 'bot'"
|
|
232
|
+
[attr.data-role]="msg.role"
|
|
233
|
+
>
|
|
234
|
+
{{ msg.text }}
|
|
235
|
+
</div>
|
|
236
|
+
}
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<form
|
|
240
|
+
class="flex shrink-0 items-end gap-sm border-t border-border bg-surface/60
|
|
241
|
+
px-lg py-md sm:gap-md sm:px-xl sm:py-lg"
|
|
242
|
+
(submit)="onSubmit($event)"
|
|
243
|
+
>
|
|
244
|
+
<input
|
|
245
|
+
#composer
|
|
246
|
+
type="text"
|
|
247
|
+
class="min-w-0 flex-1 rounded-full border border-border bg-card px-xl py-md
|
|
248
|
+
text-body-md text-fg shadow-xs placeholder:text-muted
|
|
249
|
+
focus-visible:outline focus-visible:outline-2
|
|
250
|
+
focus-visible:outline-offset-0 focus-visible:outline-focus"
|
|
251
|
+
[attr.aria-label]="copy().input"
|
|
252
|
+
[placeholder]="placeholder() || copy().placeholder"
|
|
253
|
+
[value]="draft()"
|
|
254
|
+
(input)="draft.set($any($event.target).value)"
|
|
255
|
+
name="chat-draft"
|
|
256
|
+
autocomplete="off"
|
|
257
|
+
/>
|
|
258
|
+
<button
|
|
259
|
+
dgaButton
|
|
260
|
+
type="submit"
|
|
261
|
+
variant="primary"
|
|
262
|
+
iconOnly
|
|
263
|
+
class="dga-chatbot-send shrink-0"
|
|
264
|
+
[disabled]="!draft().trim()"
|
|
265
|
+
[attr.aria-label]="copy().send"
|
|
266
|
+
>
|
|
267
|
+
<dga-icon [name]="sendIcon()" size="md" />
|
|
268
|
+
</button>
|
|
269
|
+
</form>
|
|
270
|
+
</aside>
|
|
271
|
+
</div>
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@if (!open() || !hideFabWhenOpen()) {
|
|
275
|
+
<button
|
|
276
|
+
type="button"
|
|
277
|
+
[class]="fabClasses()"
|
|
278
|
+
[style.bottom]="fabBottom()"
|
|
279
|
+
[attr.data-edge]="position()"
|
|
280
|
+
[attr.data-tone]="fabTone()"
|
|
281
|
+
[attr.data-stack]="stack()"
|
|
282
|
+
[attr.aria-expanded]="open()"
|
|
283
|
+
[attr.aria-controls]="panelId"
|
|
284
|
+
[attr.aria-label]="open() ? copy().close : fabLabel() || copy().open"
|
|
285
|
+
(click)="toggle()"
|
|
286
|
+
>
|
|
287
|
+
<dga-icon
|
|
288
|
+
[name]="open() ? 'close' : fabIcon()"
|
|
289
|
+
size="xl"
|
|
290
|
+
tone="current"
|
|
291
|
+
aria-hidden="true"
|
|
292
|
+
/>
|
|
293
|
+
</button>
|
|
294
|
+
}
|
|
295
|
+
`,changeDetection:v.OnPush,host:{"[class.contents]":"!embedded()","[attr.data-position]":"position()","[attr.data-animation]":"animation()","[attr.data-embedded]":"embedded() || null"},styles:[":host[data-embedded]{display:block;position:absolute;inset:0;pointer-events:none}:host[data-embedded] .dga-chatbot-fab,:host[data-embedded] .dga-chatbot-layer{pointer-events:auto}:host[data-embedded] .dga-chatbot-fab{--dga-local-fab-edge: var(--spacing-lg, .75rem)}:host .dga-chatbot-fab[data-edge=end]{inset-inline-end:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));inset-inline-start:auto}:host .dga-chatbot-fab[data-edge=start]{inset-inline-start:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));inset-inline-end:auto}:host .dga-chatbot-fab[data-edge=left]{left:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));right:auto}:host .dga-chatbot-fab[data-edge=right]{right:var(--dga-local-fab-edge, var(--dga-fab-edge, 2rem));left:auto}:host .dga-chatbot-panel[data-edge=end]{inset-inline-end:var(--dga-fab-edge, var(--spacing-4xl, 2rem));inset-inline-start:auto}:host .dga-chatbot-panel[data-edge=start]{inset-inline-start:var(--dga-fab-edge, var(--spacing-4xl, 2rem));inset-inline-end:auto}:host .dga-chatbot-panel[data-edge=left]{left:var(--dga-fab-edge, var(--spacing-4xl, 2rem));right:auto}:host .dga-chatbot-panel[data-edge=right]{right:var(--dga-fab-edge, var(--spacing-4xl, 2rem));left:auto}:host[data-embedded] .dga-chatbot-panel[data-edge=end],:host[data-embedded] .dga-chatbot-panel[data-edge=start],:host[data-embedded] .dga-chatbot-panel[data-edge=left],:host[data-embedded] .dga-chatbot-panel[data-edge=right]{inset-inline-end:var(--spacing-lg, .75rem);inset-inline-start:auto}@keyframes dga-chatbot-fade-in{0%{opacity:0}to{opacity:1}}@keyframes dga-chatbot-slide-in{0%{opacity:0;transform:translateY(.75rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chatbot-scale-in{0%{opacity:0;transform:scale(.92)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chatbot-bubble-in{0%{opacity:0;transform:translateY(.35rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-chatbot-backdrop-in{0%{opacity:0}to{opacity:1}}:host .dga-chatbot-backdrop{animation:dga-chatbot-backdrop-in .18s ease-out both}:host .dga-chatbot-panel[data-animation=fade]{animation:dga-chatbot-fade-in .2s ease-out both}:host .dga-chatbot-panel[data-animation=slide]{animation:dga-chatbot-slide-in .24s cubic-bezier(.16,1,.3,1) both}:host .dga-chatbot-panel[data-animation=scale]{animation:dga-chatbot-scale-in .22s cubic-bezier(.16,1,.3,1) both;transform-origin:bottom var(--dga-chatbot-origin, end)}:host .dga-chatbot-panel[data-animation=scale][data-edge=start],:host .dga-chatbot-panel[data-animation=scale][data-edge=left]{transform-origin:bottom start}:host .dga-chatbot-panel[data-animation=scale][data-edge=end],:host .dga-chatbot-panel[data-animation=scale][data-edge=right]{transform-origin:bottom end}:host .dga-chatbot-bubble{animation:dga-chatbot-bubble-in .18s ease-out both}:host .dga-chatbot-send{border-radius:9999px}@media(prefers-reduced-motion:reduce){:host .dga-chatbot-backdrop,:host .dga-chatbot-panel,:host .dga-chatbot-bubble{animation:none!important}}\n"]}]}],ctorParameters:()=>[],propDecorators:{composerRef:[{type:e.ViewChild,args:["composer",{isSignal:!0}]}],logRef:[{type:e.ViewChild,args:["log",{isSignal:!0}]}],position:[{type:e.Input,args:[{isSignal:!0,alias:"position",required:!1}]}],animation:[{type:e.Input,args:[{isSignal:!0,alias:"animation",required:!1}]}],size:[{type:e.Input,args:[{isSignal:!0,alias:"size",required:!1}]}],title:[{type:e.Input,args:[{isSignal:!0,alias:"title",required:!1}]}],subtitle:[{type:e.Input,args:[{isSignal:!0,alias:"subtitle",required:!1}]}],fabLabel:[{type:e.Input,args:[{isSignal:!0,alias:"fabLabel",required:!1}]}],placeholder:[{type:e.Input,args:[{isSignal:!0,alias:"placeholder",required:!1}]}],fabIcon:[{type:e.Input,args:[{isSignal:!0,alias:"fabIcon",required:!1}]}],sendIcon:[{type:e.Input,args:[{isSignal:!0,alias:"sendIcon",required:!1}]}],agentIcon:[{type:e.Input,args:[{isSignal:!0,alias:"agentIcon",required:!1}]}],fabTone:[{type:e.Input,args:[{isSignal:!0,alias:"fabTone",required:!1}]}],overlay:[{type:e.Input,args:[{isSignal:!0,alias:"overlay",required:!1}]}],overlayClose:[{type:e.Input,args:[{isSignal:!0,alias:"overlayClose",required:!1}]}],online:[{type:e.Input,args:[{isSignal:!0,alias:"online",required:!1}]}],hideFabWhenOpen:[{type:e.Input,args:[{isSignal:!0,alias:"hideFabWhenOpen",required:!1}]}],stack:[{type:e.Input,args:[{isSignal:!0,alias:"stack",required:!1}]}],clearFab:[{type:e.Input,args:[{isSignal:!0,alias:"clearFab",required:!1}]}],embedded:[{type:e.Input,args:[{isSignal:!0,alias:"embedded",required:!1}]}],initialMessages:[{type:e.Input,args:[{isSignal:!0,alias:"initialMessages",required:!1}]}],sent:[{type:e.Output,args:["sent"]}],opened:[{type:e.Output,args:["opened"]}],closed:[{type:e.Output,args:["closed"]}]}});export{i as DgaChatbot};
|