@arcgis/ai-components 5.2.0-next.118 → 5.2.0-next.119
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/cdn/DYZEQYTP.js +2 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -2
- package/dist/components/arcgis-assistant-interrupt/customElement.js +49 -15
- package/dist/components/arcgis-assistant-interrupt/index.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/NAPAY6NI.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{b as d}from"./5QXGQW2N.js";import"./NWJQ7KTC.js";import{g as n,h as e,n as l,t as r,u as i,v as h,w as u,z as p}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var _=n`:host{padding:var(--calcite-spacing-md);background:var(--calcite-panel-background-color, var(--calcite-color-background))}calcite-panel{border-radius:var(--calcite-dialog-corner-radius, var(--calcite-corner-radius-sm));border:0 solid var(--calcite-color-brand);border-block-start-width:4px;box-shadow:var(--calcite-shadow-md);width:100%;--calcite-panel-border-color: none}.interrupt-content{padding:0 var(--calcite-spacing-md);background:var(--calcite-color-foreground-1)}.other-input calcite-input[disabled]{pointer-events:none}.last-option{--calcite-list-border-color: transparent}`,o=class extends h{constructor(){super(...arguments),this.#e=r(),this.#t=r(),this._messages=d({blocking:!0}),this._selectedOptions=[],this._otherValue="",this._otherSelected=!1,this.arcgisCancel=l(),this.arcgisSubmit=l()}static{this.properties={_selectedOptions:16,_otherValue:16,_otherSelected:16,type:1,message:1,options:[1,{type:Array}]}}static{this.styles=_}#e;#t;_isSubmitDisabled(){return this._otherSelected?!this._otherValue.trim():!this._selectedOptions.length}_getSubmitValue(){return typeof this._selectedOptions=="string"?this._otherSelected?this._otherValue.trim():this._selectedOptions:this._selectedOptions.concat(this._otherSelected?this._otherValue.trim():[])}_getSkipValue(){return this.type==="multi-select"?[]:""}_selectOtherOption(){this._otherSelected||(this._otherSelected=!0,this.type!=="multi-select"&&(this._selectedOptions=""),this._focusOtherInput())}_handleSingleSelectChange(t){let s=this._otherSelected;this._otherSelected=t.target.selectedItems[0]===this.#t.value,this._selectedOptions=this._otherSelected?"":t.target.selectedItems[0]?.value,this._otherSelected&&!s&&this._focusOtherInput()}_handleMultiSelectChange(t){let s=this._otherSelected,a=this.#t.value;this._otherSelected=a?t.target.selectedItems.includes(a):!1,this._selectedOptions=t.target.selectedItems.filter(c=>c!==a).map(c=>c.value),this._otherSelected&&!s&&this._focusOtherInput()}async _focusOtherInput(){await this.updateComplete,await this.#e.value?.setFocus()}_renderOptions(){return this.options?.map((t,s)=>e`<calcite-list-item class=${u({"last-option":s===this.options.length-1})} .label=${t} .value=${t}></calcite-list-item>`)}_renderOtherInput(){return e`<div slot=content class="other-input" @click=${t=>{t.stopPropagation(),this._selectOtherOption()}}><calcite-input .label=${this._messages.otherLabel} .placeholder=${this._messages.otherLabel} .disabled=${!this._otherSelected} @calciteInputInput=${t=>this._otherValue=t.target.value} ${i(this.#e)}></calcite-input></div>`}_renderInterruptOptions(){switch(this.type){case"single-select":return e`<calcite-list selection-mode=single-persist .label=${this._messages.optionsLabel} @calciteListChange=${t=>this._handleSingleSelectChange(t)}>${this._renderOptions()}<calcite-list-item .selected=${this._otherSelected} ${i(this.#t)}>${this._renderOtherInput()}</calcite-list-item></calcite-list>`;case"multi-select":return e`<calcite-list selection-mode=multiple .label=${this._messages.optionsLabel} @calciteListChange=${t=>this._handleMultiSelectChange(t)}>${this._renderOptions()}<calcite-list-item .selected=${this._otherSelected} ${i(this.#t)}>${this._renderOtherInput()}</calcite-list-item></calcite-list>`;case"boolean-choice":return null;case"text-input":return e`<calcite-input .label=${this._messages.enterTextLabel} @calciteInputInput=${t=>this._selectedOptions=t.target.value}></calcite-input>`}}render(){return e`<calcite-panel .description=${this.message}><div class="interrupt-content">${this._renderInterruptOptions()}</div>${this.type==="boolean-choice"?e`<calcite-button slot=footer-end appearance=outline @click=${()=>this.arcgisSubmit.emit(!1)}>${this._messages.declineButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid @click=${()=>this.arcgisSubmit.emit(!0)}>${this._messages.approveButtonLabel}</calcite-button>`:e`<calcite-button slot=footer-end appearance=outline @click=${()=>this.arcgisSubmit.emit(this._getSkipValue())}>${this._messages.skipButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid .disabled=${this._isSubmitDisabled()} @click=${()=>this.arcgisSubmit.emit(this._getSubmitValue())}>${this._messages.submitButtonLabel}</calcite-button>`}</calcite-panel>`}};p("arcgis-assistant-interrupt",o);export{o as ArcgisAssistantInterrupt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"optionsLabel":"Options","enterTextLabel":"Enter text","submitButtonLabel":"Submit","
|
|
1
|
+
{"optionsLabel":"Options","enterTextLabel":"Enter text","otherLabel":"Other","submitButtonLabel":"Submit","skipButtonLabel":"Skip","approveButtonLabel":"Approve","declineButtonLabel":"Decline"}
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{p as s,y as e}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./4PZ5RHFL.js"),"_messages:,allowedAgentIds,alwaysUseAgentId,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,commandProvider:,copyEnabled,description,entityProviders:,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,runtimeEventsEnabled,streamingDisabled,suggestedPrompts,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./OU4HN5HN.js"),"agent:,context:,itemId,workflow:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./LEV5ORDL.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./NE4NTGQN.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./X5AOLYY5.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./WB6PGHFS.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./IZ56DC4L.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./6ECRQVHY.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./NR2O3AP2.js"),"_messages:,awaitingResponse,commandProvider:,disabled,entityProviders:,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./
|
|
2
|
+
import{p as s,y as e}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./4PZ5RHFL.js"),"_messages:,allowedAgentIds,alwaysUseAgentId,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,commandProvider:,copyEnabled,description,entityProviders:,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,runtimeEventsEnabled,streamingDisabled,suggestedPrompts,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./OU4HN5HN.js"),"agent:,context:,itemId,workflow:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./LEV5ORDL.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./NE4NTGQN.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./X5AOLYY5.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./WB6PGHFS.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./IZ56DC4L.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./6ECRQVHY.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./NR2O3AP2.js"),"_messages:,awaitingResponse,commandProvider:,disabled,entityProviders:,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./DYZEQYTP.js"),"_messages:,message,options,type"],"arcgis-assistant-interrupt-preview":[()=>import("./VYOIFJVE.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./KPJHQ424.js"),"_messages:,assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./5HBAJ57P.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./KQGC2FCP.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./4WYNWR6R.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./K5FWDMTV.js"),"_messages:,assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./OTOQL3QM.js"),"log,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./7ELUGB4X.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./RGVC76RW.js"),"content,parts"],"arcgis-assistant-speech-input":[()=>import("./5MK44FNO.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./PQRE67OM.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./XV3DHHYJ.js"),"content,message:,user,userAvatarEnabled"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-knowledge-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r,p,j,i=(a.importMap??={}).imports??={})=>{"agent-utils/index,agent-utils/middlewares/middleware,agent-utils/middlewares/humanInTheLoop,agent-utils/middlewares/trace".split(",").map(e=>i[p+e+j]=i[p+e]=import.meta.resolve("./"+e+j));a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,e,"@arcgis/ai-components/",".js")
|
|
@@ -11,15 +11,17 @@ export abstract class ArcgisAssistantInterrupt extends LitElement {
|
|
|
11
11
|
protected _messages: {
|
|
12
12
|
optionsLabel: string;
|
|
13
13
|
enterTextLabel: string;
|
|
14
|
+
otherLabel: string;
|
|
14
15
|
submitButtonLabel: string;
|
|
15
|
-
|
|
16
|
+
skipButtonLabel: string;
|
|
16
17
|
approveButtonLabel: string;
|
|
17
18
|
declineButtonLabel: string;
|
|
18
19
|
} & T9nMeta<{
|
|
19
20
|
optionsLabel: string;
|
|
20
21
|
enterTextLabel: string;
|
|
22
|
+
otherLabel: string;
|
|
21
23
|
submitButtonLabel: string;
|
|
22
|
-
|
|
24
|
+
skipButtonLabel: string;
|
|
23
25
|
approveButtonLabel: string;
|
|
24
26
|
declineButtonLabel: string;
|
|
25
27
|
}>;
|
|
@@ -1,36 +1,70 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c } from "../../chunks/runtime.js";
|
|
3
|
-
import { css as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { c as o } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as n, html as t } from "lit";
|
|
4
|
+
import { LitElement as h, createEvent as a, safeClassMap as u } from "@arcgis/lumina";
|
|
5
|
+
import { createRef as r, ref as c } from "lit/directives/ref.js";
|
|
6
|
+
import { u as d } from "../../chunks/useT9n.js";
|
|
7
|
+
const p = n`:host{padding:var(--calcite-spacing-md);background:var(--calcite-panel-background-color, var(--calcite-color-background))}calcite-panel{border-radius:var(--calcite-dialog-corner-radius, var(--calcite-corner-radius-sm));border:0 solid var(--calcite-color-brand);border-block-start-width:4px;box-shadow:var(--calcite-shadow-md);width:100%;--calcite-panel-border-color: none}.interrupt-content{padding:0 var(--calcite-spacing-md);background:var(--calcite-color-foreground-1)}.other-input calcite-input[disabled]{pointer-events:none}.last-option{--calcite-list-border-color: transparent}`;
|
|
8
|
+
class m extends h {
|
|
8
9
|
constructor() {
|
|
9
|
-
super(...arguments), this._messages =
|
|
10
|
+
super(...arguments), this.#t = r(), this.#e = r(), this._messages = d({ blocking: !0 }), this._selectedOptions = [], this._otherValue = "", this._otherSelected = !1, this.arcgisCancel = a(), this.arcgisSubmit = a();
|
|
10
11
|
}
|
|
11
12
|
static {
|
|
12
|
-
this.properties = { _selectedOptions: 16, type: 1, message: 1, options: [1, { type: Array }] };
|
|
13
|
+
this.properties = { _selectedOptions: 16, _otherValue: 16, _otherSelected: 16, type: 1, message: 1, options: [1, { type: Array }] };
|
|
13
14
|
}
|
|
14
15
|
static {
|
|
15
|
-
this.styles =
|
|
16
|
+
this.styles = p;
|
|
17
|
+
}
|
|
18
|
+
#t;
|
|
19
|
+
#e;
|
|
20
|
+
_isSubmitDisabled() {
|
|
21
|
+
return this._otherSelected ? !this._otherValue.trim() : !this._selectedOptions.length;
|
|
22
|
+
}
|
|
23
|
+
_getSubmitValue() {
|
|
24
|
+
return typeof this._selectedOptions == "string" ? this._otherSelected ? this._otherValue.trim() : this._selectedOptions : this._selectedOptions.concat(this._otherSelected ? this._otherValue.trim() : []);
|
|
25
|
+
}
|
|
26
|
+
_getSkipValue() {
|
|
27
|
+
return this.type === "multi-select" ? [] : "";
|
|
28
|
+
}
|
|
29
|
+
_selectOtherOption() {
|
|
30
|
+
this._otherSelected || (this._otherSelected = !0, this.type !== "multi-select" && (this._selectedOptions = ""), this._focusOtherInput());
|
|
31
|
+
}
|
|
32
|
+
_handleSingleSelectChange(e) {
|
|
33
|
+
const i = this._otherSelected;
|
|
34
|
+
this._otherSelected = e.target.selectedItems[0] === this.#e.value, this._selectedOptions = this._otherSelected ? "" : e.target.selectedItems[0]?.value, this._otherSelected && !i && this._focusOtherInput();
|
|
35
|
+
}
|
|
36
|
+
_handleMultiSelectChange(e) {
|
|
37
|
+
const i = this._otherSelected, s = this.#e.value;
|
|
38
|
+
this._otherSelected = s ? e.target.selectedItems.includes(s) : !1, this._selectedOptions = e.target.selectedItems.filter((l) => l !== s).map((l) => l.value), this._otherSelected && !i && this._focusOtherInput();
|
|
39
|
+
}
|
|
40
|
+
async _focusOtherInput() {
|
|
41
|
+
await this.updateComplete, await this.#t.value?.setFocus();
|
|
42
|
+
}
|
|
43
|
+
_renderOptions() {
|
|
44
|
+
return this.options?.map((e, i) => t`<calcite-list-item class=${u({ "last-option": i === this.options.length - 1 })} .label=${e} .value=${e}></calcite-list-item>`);
|
|
45
|
+
}
|
|
46
|
+
_renderOtherInput() {
|
|
47
|
+
return t`<div slot=content class="other-input" @click=${(e) => {
|
|
48
|
+
e.stopPropagation(), this._selectOtherOption();
|
|
49
|
+
}}><calcite-input .label=${this._messages.otherLabel} .placeholder=${this._messages.otherLabel} .disabled=${!this._otherSelected} @calciteInputInput=${(e) => this._otherValue = e.target.value} ${c(this.#t)}></calcite-input></div>`;
|
|
16
50
|
}
|
|
17
51
|
_renderInterruptOptions() {
|
|
18
52
|
switch (this.type) {
|
|
19
53
|
case "single-select":
|
|
20
|
-
return
|
|
54
|
+
return t`<calcite-list selection-mode=single-persist .label=${this._messages.optionsLabel} @calciteListChange=${(e) => this._handleSingleSelectChange(e)}>${this._renderOptions()}<calcite-list-item .selected=${this._otherSelected} ${c(this.#e)}>${this._renderOtherInput()}</calcite-list-item></calcite-list>`;
|
|
21
55
|
case "multi-select":
|
|
22
|
-
return
|
|
56
|
+
return t`<calcite-list selection-mode=multiple .label=${this._messages.optionsLabel} @calciteListChange=${(e) => this._handleMultiSelectChange(e)}>${this._renderOptions()}<calcite-list-item .selected=${this._otherSelected} ${c(this.#e)}>${this._renderOtherInput()}</calcite-list-item></calcite-list>`;
|
|
23
57
|
case "boolean-choice":
|
|
24
58
|
return null;
|
|
25
59
|
case "text-input":
|
|
26
|
-
return
|
|
60
|
+
return t`<calcite-input .label=${this._messages.enterTextLabel} @calciteInputInput=${(e) => this._selectedOptions = e.target.value}></calcite-input>`;
|
|
27
61
|
}
|
|
28
62
|
}
|
|
29
63
|
render() {
|
|
30
|
-
return
|
|
64
|
+
return t`<calcite-panel .description=${this.message}><div class="interrupt-content">${this._renderInterruptOptions()}</div>${this.type === "boolean-choice" ? t`<calcite-button slot=footer-end appearance=outline @click=${() => this.arcgisSubmit.emit(!1)}>${this._messages.declineButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid @click=${() => this.arcgisSubmit.emit(!0)}>${this._messages.approveButtonLabel}</calcite-button>` : t`<calcite-button slot=footer-end appearance=outline @click=${() => this.arcgisSubmit.emit(this._getSkipValue())}>${this._messages.skipButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid .disabled=${this._isSubmitDisabled()} @click=${() => this.arcgisSubmit.emit(this._getSubmitValue())}>${this._messages.submitButtonLabel}</calcite-button>`}</calcite-panel>`;
|
|
31
65
|
}
|
|
32
66
|
}
|
|
33
|
-
|
|
67
|
+
o("arcgis-assistant-interrupt", m);
|
|
34
68
|
export {
|
|
35
|
-
|
|
69
|
+
m as ArcgisAssistantInterrupt
|
|
36
70
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "@esri/calcite-components/components/calcite-list";
|
|
2
1
|
import "@esri/calcite-components/components/calcite-list-item";
|
|
3
2
|
import "@esri/calcite-components/components/calcite-input";
|
|
3
|
+
import "@esri/calcite-components/components/calcite-list";
|
|
4
4
|
import "@esri/calcite-components/components/calcite-panel";
|
|
5
5
|
import "@esri/calcite-components/components/calcite-button";
|
|
6
6
|
export * from "./customElement.js";
|