@progress/kendo-react-conversational-ui 7.2.4-develop.3 → 7.3.0-develop.1
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/ViewItem.js +8 -0
- package/ViewItem.mjs +59 -0
- package/ai-prompt/AIPrompt.js +8 -0
- package/ai-prompt/AIPrompt.mjs +35 -0
- package/ai-prompt/AIPromptContent.js +8 -0
- package/ai-prompt/AIPromptContent.mjs +17 -0
- package/ai-prompt/AIPromptContext.js +8 -0
- package/ai-prompt/AIPromptContext.mjs +15 -0
- package/ai-prompt/AIPromptExpander.js +8 -0
- package/ai-prompt/AIPromptExpander.mjs +27 -0
- package/ai-prompt/AIPromptFooter.js +8 -0
- package/ai-prompt/AIPromptFooter.mjs +16 -0
- package/ai-prompt/AIPromptHeader.js +8 -0
- package/ai-prompt/AIPromptHeader.mjs +36 -0
- package/ai-prompt/views/AIPromptCommandsView.js +8 -0
- package/ai-prompt/views/AIPromptCommandsView.mjs +38 -0
- package/ai-prompt/views/AIPromptOutputView.js +8 -0
- package/ai-prompt/views/AIPromptOutputView.mjs +93 -0
- package/ai-prompt/views/AIPromptView.js +8 -0
- package/ai-prompt/views/AIPromptView.mjs +61 -0
- package/ai-prompt/views/AIPromptViewRender.js +8 -0
- package/ai-prompt/views/AIPromptViewRender.mjs +16 -0
- package/components/Action.js +8 -0
- package/components/Action.mjs +44 -0
- package/components/ActionGroup.js +8 -0
- package/components/ActionGroup.mjs +49 -0
- package/components/Attachment.js +8 -0
- package/components/Attachment.mjs +49 -0
- package/components/AttachmentGroup.js +8 -0
- package/components/AttachmentGroup.mjs +74 -0
- package/components/Chat.js +8 -0
- package/components/Chat.mjs +208 -0
- package/components/ChatMessage.js +8 -0
- package/components/ChatMessage.mjs +62 -0
- package/components/DateMarker.js +8 -0
- package/components/DateMarker.mjs +20 -0
- package/components/MessageGroup.js +8 -0
- package/components/MessageGroup.mjs +69 -0
- package/components/NewMessage.js +8 -0
- package/components/NewMessage.mjs +94 -0
- package/components/Toolbar.js +8 -0
- package/components/Toolbar.mjs +17 -0
- package/components/base/FocusableUponSelection.js +8 -0
- package/components/base/FocusableUponSelection.mjs +20 -0
- package/components/base/SelectableItemsContainer.js +8 -0
- package/components/base/SelectableItemsContainer.mjs +42 -0
- package/components/templates/HeroCard.js +8 -0
- package/components/templates/HeroCard.mjs +45 -0
- package/dist/cdn/js/kendo-react-conversational-ui.js +8 -5
- package/index.d.mts +811 -5
- package/index.d.ts +811 -23
- package/index.js +8 -5
- package/index.mjs +32 -876
- package/messages/index.js +8 -0
- package/messages/index.mjs +25 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +6 -6
- package/utils.js +8 -0
- package/utils.mjs +12 -0
- package/ChatPropsAndState.d.ts +0 -95
- package/Events.d.ts +0 -42
- package/ViewItem.d.ts +0 -61
- package/ai-prompt/AIPrompt.d.ts +0 -95
- package/ai-prompt/AIPromptContent.d.ts +0 -19
- package/ai-prompt/AIPromptContext.d.ts +0 -24
- package/ai-prompt/AIPromptExpander.d.ts +0 -10
- package/ai-prompt/AIPromptFooter.d.ts +0 -19
- package/ai-prompt/AIPromptHeader.d.ts +0 -36
- package/ai-prompt/views/AIPromptCommandsView.d.ts +0 -54
- package/ai-prompt/views/AIPromptOutputView.d.ts +0 -66
- package/ai-prompt/views/AIPromptView.d.ts +0 -26
- package/ai-prompt/views/AIPromptViewRender.d.ts +0 -23
- package/api/action.interface.d.ts +0 -35
- package/api/attachment.interface.d.ts +0 -36
- package/api/message.interface.d.ts +0 -60
- package/api/user.interface.d.ts +0 -27
- package/components/Action.d.ts +0 -23
- package/components/ActionGroup.d.ts +0 -27
- package/components/Attachment.d.ts +0 -28
- package/components/AttachmentGroup.d.ts +0 -27
- package/components/Chat.d.ts +0 -76
- package/components/ChatMessage.d.ts +0 -72
- package/components/DateMarker.d.ts +0 -18
- package/components/MessageGroup.d.ts +0 -29
- package/components/NewMessage.d.ts +0 -38
- package/components/Toolbar.d.ts +0 -13
- package/components/base/FocusableUponSelection.d.ts +0 -24
- package/components/base/SelectableItemsContainer.d.ts +0 -37
- package/components/templates/HeroCard.d.ts +0 -45
- package/messages/index.d.ts +0 -39
- package/package-metadata.d.ts +0 -9
- package/utils.d.ts +0 -9
package/ViewItem.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./utils.js"),o=s=>s[s.length-1],r=(s,e)=>s&&e&&(e.getDate()!==s.getDate()||e.getMonth()!==s.getMonth()||e.getFullYear()!==s.getFullYear()),u=(s,e)=>{const t=e.timestamp,a=o(s);if(t&&(!a||r(t,a.timestamp))){const n={type:"date-marker",timestamp:t,trackBy:t.getTime()};s.push(n)}},c=(s,e,t)=>{const a=o(s);let n;e.typing&&!t||(a&&a.type==="message-group"&&(n=a.messages),n&&i.isAuthor(e.author,o(n))?n.push(e):s.push({type:"message-group",messages:[e],author:e.author,timestamp:e.timestamp,trackBy:e}))},p=s=>(e,t,a)=>{const n=a===s-1;return u(e,t),c(e,t,n),t.attachments&&t.attachments.length>1&&e.push({type:"attachment-group",attachments:t.attachments,attachmentLayout:t.attachmentLayout,timestamp:t.timestamp,trackBy:t}),t.suggestedActions&&n&&e.push({type:"action-group",actions:t.suggestedActions,timestamp:t.timestamp,trackBy:t}),e};function l(s){let e=0;s.forEach(t=>{t.type==="message-group"?t.messages.forEach(a=>{a.selectionIndex=e++}):(t.type==="attachment-group"||t.type==="action-group")&&(t.selectionIndex=e++)}),s.lastSelectionIndex=e-1}const h=s=>{const t=s.slice().reduce(p(s.length),[]);return l(t),t};exports.convertMsgsToViewItems=h;
|
package/ViewItem.mjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import { isAuthor as i } from "./utils.mjs";
|
|
10
|
+
const o = (s) => s[s.length - 1], p = (s, e) => s && e && (e.getDate() !== s.getDate() || e.getMonth() !== s.getMonth() || e.getFullYear() !== s.getFullYear()), r = (s, e) => {
|
|
11
|
+
const t = e.timestamp, a = o(s);
|
|
12
|
+
if (t && (!a || p(t, a.timestamp))) {
|
|
13
|
+
const n = {
|
|
14
|
+
type: "date-marker",
|
|
15
|
+
timestamp: t,
|
|
16
|
+
trackBy: t.getTime()
|
|
17
|
+
};
|
|
18
|
+
s.push(n);
|
|
19
|
+
}
|
|
20
|
+
}, u = (s, e, t) => {
|
|
21
|
+
const a = o(s);
|
|
22
|
+
let n;
|
|
23
|
+
e.typing && !t || (a && a.type === "message-group" && (n = a.messages), n && i(e.author, o(n)) ? n.push(e) : s.push({
|
|
24
|
+
type: "message-group",
|
|
25
|
+
messages: [e],
|
|
26
|
+
author: e.author,
|
|
27
|
+
timestamp: e.timestamp,
|
|
28
|
+
trackBy: e
|
|
29
|
+
}));
|
|
30
|
+
}, c = (s) => (e, t, a) => {
|
|
31
|
+
const n = a === s - 1;
|
|
32
|
+
return r(e, t), u(e, t, n), t.attachments && t.attachments.length > 1 && e.push({
|
|
33
|
+
type: "attachment-group",
|
|
34
|
+
attachments: t.attachments,
|
|
35
|
+
attachmentLayout: t.attachmentLayout,
|
|
36
|
+
timestamp: t.timestamp,
|
|
37
|
+
trackBy: t
|
|
38
|
+
}), t.suggestedActions && n && e.push({
|
|
39
|
+
type: "action-group",
|
|
40
|
+
actions: t.suggestedActions,
|
|
41
|
+
timestamp: t.timestamp,
|
|
42
|
+
trackBy: t
|
|
43
|
+
}), e;
|
|
44
|
+
};
|
|
45
|
+
function h(s) {
|
|
46
|
+
let e = 0;
|
|
47
|
+
s.forEach((t) => {
|
|
48
|
+
t.type === "message-group" ? t.messages.forEach((a) => {
|
|
49
|
+
a.selectionIndex = e++;
|
|
50
|
+
}) : (t.type === "attachment-group" || t.type === "action-group") && (t.selectionIndex = e++);
|
|
51
|
+
}), s.lastSelectionIndex = e - 1;
|
|
52
|
+
}
|
|
53
|
+
const m = (s) => {
|
|
54
|
+
const t = s.slice().reduce(c(s.length), []);
|
|
55
|
+
return h(t), t;
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
m as convertMsgsToViewItems
|
|
59
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),v=require("./AIPromptHeader.js"),A=require("./views/AIPromptView.js"),I=require("./views/AIPromptOutputView.js"),V=require("./AIPromptContext.js"),S=c=>{const{activeView:t,toolbarItems:n,children:a,onActiveViewChange:o,onPromptRequest:i,onCommandExecute:s,style:m,dir:u}=c,l=n||[A.promptViewDefaults,I.outputViewDefaults],[p,P]=e.useState({activeView:t}),r={...p,activeView:t,onActiveViewChange:o,onPromptRequest:i,onCommandExecute:s},w=d=>{P(d)};return e.createElement(V.AIPromptContext.Provider,{value:[r,w]},e.createElement("div",{className:"k-prompt",style:m,dir:u},e.createElement(v.PromptHeader,{activeView:r.activeView,toolbarItems:l,activeViewChange:o}),a))};exports.AIPrompt=S;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import t from "react";
|
|
10
|
+
import { PromptHeader as d } from "./AIPromptHeader.mjs";
|
|
11
|
+
import { promptViewDefaults as V } from "./views/AIPromptView.mjs";
|
|
12
|
+
import { outputViewDefaults as S } from "./views/AIPromptOutputView.mjs";
|
|
13
|
+
import { AIPromptContext as P } from "./AIPromptContext.mjs";
|
|
14
|
+
const I = (a) => {
|
|
15
|
+
const { activeView: e, toolbarItems: m, children: i, onActiveViewChange: o, onPromptRequest: c, onCommandExecute: n, style: s, dir: l } = a, p = m || [V, S], [u, f] = t.useState({ activeView: e }), r = {
|
|
16
|
+
...u,
|
|
17
|
+
activeView: e,
|
|
18
|
+
onActiveViewChange: o,
|
|
19
|
+
onPromptRequest: c,
|
|
20
|
+
onCommandExecute: n
|
|
21
|
+
}, v = (w) => {
|
|
22
|
+
f(w);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ t.createElement(P.Provider, { value: [r, v] }, /* @__PURE__ */ t.createElement("div", { className: "k-prompt", style: s, dir: l }, /* @__PURE__ */ t.createElement(
|
|
25
|
+
d,
|
|
26
|
+
{
|
|
27
|
+
activeView: r.activeView,
|
|
28
|
+
toolbarItems: p,
|
|
29
|
+
activeViewChange: o
|
|
30
|
+
}
|
|
31
|
+
), i));
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
I as AIPrompt
|
|
35
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.forwardRef((n,o)=>{const{children:r}=n;return e.createElement("div",{className:"k-prompt-content",ref:o},e.createElement("div",{className:"k-prompt-view"},r))});t.displayName="KendoReactAIPromptContent";exports.AIPromptContent=t;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import e from "react";
|
|
10
|
+
const r = e.forwardRef((t, n) => {
|
|
11
|
+
const { children: o } = t;
|
|
12
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-prompt-content", ref: n }, /* @__PURE__ */ e.createElement("div", { className: "k-prompt-view" }, o));
|
|
13
|
+
});
|
|
14
|
+
r.displayName = "KendoReactAIPromptContent";
|
|
15
|
+
export {
|
|
16
|
+
r as AIPromptContent
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),e=t.createContext([{},()=>{}]),o=()=>t.useContext(e);exports.AIPromptContext=e;exports.useAIPromptContext=o;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import t from "react";
|
|
10
|
+
const e = t.createContext([{}, () => {
|
|
11
|
+
}]), n = () => t.useContext(e);
|
|
12
|
+
export {
|
|
13
|
+
e as AIPromptContext,
|
|
14
|
+
n as useAIPromptContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),s=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-svg-icons"),d=r=>{const[t,c]=e.useState(!0),{children:a,title:n}=r;return e.createElement("div",{className:"k-prompt-expander"},e.createElement(s.Button,{fillMode:"flat",svgIcon:t?o.chevronUpIcon:o.chevronDownIcon,title:n,onClick:()=>c(!t)},n),t&&e.createElement("div",{className:"k-prompt-expander-content"},a))};exports.AIPromptExpander=d;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import e from "react";
|
|
10
|
+
import { Button as a } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { chevronUpIcon as p, chevronDownIcon as m } from "@progress/kendo-svg-icons";
|
|
12
|
+
const i = (o) => {
|
|
13
|
+
const [t, r] = e.useState(!0), { children: c, title: n } = o;
|
|
14
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-prompt-expander" }, /* @__PURE__ */ e.createElement(
|
|
15
|
+
a,
|
|
16
|
+
{
|
|
17
|
+
fillMode: "flat",
|
|
18
|
+
svgIcon: t ? p : m,
|
|
19
|
+
title: n,
|
|
20
|
+
onClick: () => r(!t)
|
|
21
|
+
},
|
|
22
|
+
n
|
|
23
|
+
), t && /* @__PURE__ */ e.createElement("div", { className: "k-prompt-expander-content" }, c));
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
i as AIPromptExpander
|
|
27
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),r=e=>{const{children:o}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},o))};exports.AIPromptFooter=r;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import t from "react";
|
|
10
|
+
const a = (e) => {
|
|
11
|
+
const { children: o } = e;
|
|
12
|
+
return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-footer" }, /* @__PURE__ */ t.createElement("div", { className: "k-actions k-actions-start k-actions-horizontal k-prompt-actions" }, o));
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
a as AIPromptFooter
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),a=require("@progress/kendo-react-buttons"),s=l=>{const{activeView:r,toolbarItems:n,activeViewChange:o}=l,c=e=>{o==null||o.call(null,e)};return t.createElement("div",{className:"k-prompt-header"},t.createElement(a.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map(e=>t.isValidElement(e)?e:t.createElement(a.Button,{key:e.name,className:r===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>c(e.name)},e.buttonText))))};exports.PromptHeader=s;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import t from "react";
|
|
10
|
+
import { Toolbar as c, Button as s } from "@progress/kendo-react-buttons";
|
|
11
|
+
const u = (l) => {
|
|
12
|
+
const { activeView: o, toolbarItems: r, activeViewChange: a } = l, n = (e) => {
|
|
13
|
+
a == null || a.call(null, e);
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-header" }, /* @__PURE__ */ t.createElement(c, { keyboardNavigation: !1, role: "toolbar", className: "k-toolbar-flat" }, r.map(
|
|
16
|
+
(e) => t.isValidElement(e) ? e : /* @__PURE__ */ t.createElement(
|
|
17
|
+
s,
|
|
18
|
+
{
|
|
19
|
+
key: e.name,
|
|
20
|
+
className: o === e.name ? "k-selected" : "",
|
|
21
|
+
size: "medium",
|
|
22
|
+
themeColor: "primary",
|
|
23
|
+
fillMode: "flat",
|
|
24
|
+
rounded: "full",
|
|
25
|
+
title: e.buttonText,
|
|
26
|
+
svgIcon: e.buttonIcon,
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
onClick: () => n(e.name)
|
|
29
|
+
},
|
|
30
|
+
e.buttonText
|
|
31
|
+
)
|
|
32
|
+
)));
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
u as PromptHeader
|
|
36
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),d=require("../AIPromptContent.js"),p=require("./AIPromptViewRender.js"),P=require("@progress/kendo-svg-icons"),C=require("../AIPromptContext.js"),i=require("@progress/kendo-react-layout"),s={name:"Commands view",buttonIcon:P.moreHorizontalIcon},u=t=>t==null?void 0:t.map(e=>n.createElement(i.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&u(e.children||[]))),v=t=>{const{commands:e}=t,[r]=C.useAIPromptContext(),m=I=>{var c,l,a;const o=(l=(c=I.target)==null?void 0:c.props)==null?void 0:l.data;(a=o.children)!=null&&a.length||r.onCommandExecute&&r.onCommandExecute.call(null,o)};return n.createElement(p.AIPromptViewRender,{name:s.name},n.createElement(d.AIPromptContent,null,n.createElement("div",{className:"k-prompt-view"},n.createElement(i.PanelBar,{onSelect:m,selected:""},u(e!=null?e:[])))))};exports.AIPromptCommandsView=v;exports.commandsViewDefaults=s;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import r from "react";
|
|
10
|
+
import { AIPromptContent as s } from "../AIPromptContent.mjs";
|
|
11
|
+
import { AIPromptViewRender as u } from "./AIPromptViewRender.mjs";
|
|
12
|
+
import { moreHorizontalIcon as I } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { useAIPromptContext as f } from "../AIPromptContext.mjs";
|
|
14
|
+
import { PanelBar as d, PanelBarItem as C } from "@progress/kendo-react-layout";
|
|
15
|
+
const E = {
|
|
16
|
+
name: "Commands view",
|
|
17
|
+
buttonIcon: I
|
|
18
|
+
}, c = (t) => t == null ? void 0 : t.map((e) => /* @__PURE__ */ r.createElement(
|
|
19
|
+
C,
|
|
20
|
+
{
|
|
21
|
+
title: e.text,
|
|
22
|
+
key: e.id,
|
|
23
|
+
svgIcon: e.svgIcon,
|
|
24
|
+
data: e
|
|
25
|
+
},
|
|
26
|
+
e.children && c(e.children || [])
|
|
27
|
+
)), A = (t) => {
|
|
28
|
+
const { commands: e } = t, [n] = f(), i = (p) => {
|
|
29
|
+
var l, a, m;
|
|
30
|
+
const o = (a = (l = p.target) == null ? void 0 : l.props) == null ? void 0 : a.data;
|
|
31
|
+
(m = o.children) != null && m.length || n.onCommandExecute && n.onCommandExecute.call(null, o);
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ r.createElement(u, { name: E.name }, /* @__PURE__ */ r.createElement(s, null, /* @__PURE__ */ r.createElement("div", { className: "k-prompt-view" }, /* @__PURE__ */ r.createElement(d, { onSelect: i, selected: "" }, c(e != null ? e : [])))));
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
A as AIPromptCommandsView,
|
|
37
|
+
E as commandsViewDefaults
|
|
38
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),v=require("../AIPromptContent.js"),q=require("../AIPromptContext.js"),s=require("../../messages/index.js"),T=require("./AIPromptViewRender.js"),n=require("@progress/kendo-react-layout"),r=require("@progress/kendo-svg-icons"),a=require("@progress/kendo-react-buttons"),k=require("@progress/kendo-react-intl"),g={name:"Output view",buttonText:"Output",buttonIcon:r.commentIcon},w=y=>{const[R,m]=t.useState(""),o=t.useRef(null),[l]=q.useAIPromptContext(),{outputs:i,showOutputRating:E,outputCard:b}=y,{header:d,body:u,actions:p}=b||{},h=k.useLocalization(),P=e=>{l.onPromptRequest&&l.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),I()},f=e=>{e!=null&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),m(e.id),setTimeout(()=>{m("")},1e3)},C=(e,c)=>{l.onPromptRequest&&l.onPromptRequest.call(null,e.prompt,{...e,ratingType:c,isRetry:!1}),I()},I=()=>{o&&o.current&&o.current.scrollTo({top:0,behavior:"smooth"})};return t.createElement(T.AIPromptViewRender,{name:g.name},t.createElement(v.AIPromptContent,{ref:o},t.createElement("div",{className:"k-card-list"},i&&i.length>0?i.map((e,c)=>t.createElement(n.Card,{key:`${e.id}_${c}`},t.createElement(n.CardHeader,null,d?d(e):t.createElement(t.Fragment,null,e.title&&t.createElement(n.CardTitle,null,e.title),e.subTitle&&t.createElement(n.CardSubtitle,null,e.subTitle))),t.createElement(n.CardBody,null,u?u(e):e.responseContent),t.createElement(n.CardActions,null,p?p(e):t.createElement(t.Fragment,null,t.createElement(a.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:R===e.id?r.copyIcon:r.checkIcon,"aria-hidden":"true",onClick:()=>f(e)},"Copy"),t.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:r.rotateIcon,"aria-hidden":"true",onClick:()=>P(e)},"Retry"),E&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(a.Button,{size:"medium",themeColor:e.ratingType==="positive"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:r.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>C(e,"positive")}),t.createElement(a.Button,{size:"medium",themeColor:e.ratingType==="negative"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:r.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>C(e,"negative")})))))):t.createElement(n.Card,null,t.createElement(n.CardBody,null,h.toLanguageString(s.aIPromptNoOutputs,s.messages[s.aIPromptNoOutputs]))))))};exports.AIPromptOutputView=w;exports.outputViewDefaults=g;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import t from "react";
|
|
10
|
+
import { AIPromptContent as v } from "../AIPromptContent.mjs";
|
|
11
|
+
import { useAIPromptContext as T } from "../AIPromptContext.mjs";
|
|
12
|
+
import { aIPromptNoOutputs as u, messages as P } from "../../messages/index.mjs";
|
|
13
|
+
import { AIPromptViewRender as k } from "./AIPromptViewRender.mjs";
|
|
14
|
+
import { Card as C, CardHeader as w, CardTitle as O, CardSubtitle as z, CardBody as f, CardActions as x } from "@progress/kendo-react-layout";
|
|
15
|
+
import { commentIcon as A, copyIcon as q, checkIcon as M, rotateIcon as F, thumbUpOutlineIcon as N, thumbDownOutlineIcon as S } from "@progress/kendo-svg-icons";
|
|
16
|
+
import { Button as o } from "@progress/kendo-react-buttons";
|
|
17
|
+
import { useLocalization as V } from "@progress/kendo-react-intl";
|
|
18
|
+
const _ = {
|
|
19
|
+
name: "Output view",
|
|
20
|
+
buttonText: "Output",
|
|
21
|
+
buttonIcon: A
|
|
22
|
+
}, K = (g) => {
|
|
23
|
+
const [E, i] = t.useState(""), n = t.useRef(null), [r] = T(), { outputs: l, showOutputRating: y, outputCard: b } = g, { header: m, body: c, actions: s } = b || {}, h = V(), I = (e) => {
|
|
24
|
+
r.onPromptRequest && r.onPromptRequest.call(null, e.prompt, { ...e, isRetry: !0 }), p();
|
|
25
|
+
}, R = (e) => {
|
|
26
|
+
e != null && e.responseContent && navigator.clipboard.writeText(e.responseContent), i(e.id), setTimeout(() => {
|
|
27
|
+
i("");
|
|
28
|
+
}, 1e3);
|
|
29
|
+
}, d = (e, a) => {
|
|
30
|
+
r.onPromptRequest && r.onPromptRequest.call(
|
|
31
|
+
null,
|
|
32
|
+
e.prompt,
|
|
33
|
+
{ ...e, ratingType: a, isRetry: !1 }
|
|
34
|
+
), p();
|
|
35
|
+
}, p = () => {
|
|
36
|
+
n && n.current && n.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ t.createElement(k, { name: _.name }, /* @__PURE__ */ t.createElement(v, { ref: n }, /* @__PURE__ */ t.createElement("div", { className: "k-card-list" }, l && l.length > 0 ? l.map((e, a) => /* @__PURE__ */ t.createElement(C, { key: `${e.id}_${a}` }, /* @__PURE__ */ t.createElement(w, null, m ? m(e) : /* @__PURE__ */ t.createElement(t.Fragment, null, e.title && /* @__PURE__ */ t.createElement(O, null, e.title), e.subTitle && /* @__PURE__ */ t.createElement(z, null, e.subTitle))), /* @__PURE__ */ t.createElement(f, null, c ? c(e) : e.responseContent), /* @__PURE__ */ t.createElement(x, null, s ? s(e) : /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
39
|
+
o,
|
|
40
|
+
{
|
|
41
|
+
size: "medium",
|
|
42
|
+
themeColor: "primary",
|
|
43
|
+
fillMode: "flat",
|
|
44
|
+
rounded: "medium",
|
|
45
|
+
title: "Copy",
|
|
46
|
+
svgIcon: E === e.id ? q : M,
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
onClick: () => R(e)
|
|
49
|
+
},
|
|
50
|
+
"Copy"
|
|
51
|
+
), /* @__PURE__ */ t.createElement(
|
|
52
|
+
o,
|
|
53
|
+
{
|
|
54
|
+
size: "medium",
|
|
55
|
+
themeColor: "base",
|
|
56
|
+
fillMode: "flat",
|
|
57
|
+
rounded: "medium",
|
|
58
|
+
title: "Retry",
|
|
59
|
+
svgIcon: F,
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
onClick: () => I(e)
|
|
62
|
+
},
|
|
63
|
+
"Retry"
|
|
64
|
+
), y && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ t.createElement(
|
|
65
|
+
o,
|
|
66
|
+
{
|
|
67
|
+
size: "medium",
|
|
68
|
+
themeColor: e.ratingType === "positive" ? "primary" : "base",
|
|
69
|
+
fillMode: "flat",
|
|
70
|
+
rounded: "medium",
|
|
71
|
+
title: "Rate up",
|
|
72
|
+
svgIcon: N,
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
onClick: () => d(e, "positive")
|
|
75
|
+
}
|
|
76
|
+
), /* @__PURE__ */ t.createElement(
|
|
77
|
+
o,
|
|
78
|
+
{
|
|
79
|
+
size: "medium",
|
|
80
|
+
themeColor: e.ratingType === "negative" ? "primary" : "base",
|
|
81
|
+
fillMode: "flat",
|
|
82
|
+
rounded: "medium",
|
|
83
|
+
title: "Rate down",
|
|
84
|
+
svgIcon: S,
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
onClick: () => d(e, "negative")
|
|
87
|
+
}
|
|
88
|
+
)))))) : /* @__PURE__ */ t.createElement(C, null, /* @__PURE__ */ t.createElement(f, null, h.toLanguageString(u, P[u]))))));
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
K as AIPromptOutputView,
|
|
92
|
+
_ as outputViewDefaults
|
|
93
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),w=require("../AIPromptContent.js"),E=require("../AIPromptFooter.js"),R=require("@progress/kendo-react-buttons"),T=require("@progress/kendo-react-inputs"),l=require("@progress/kendo-svg-icons"),a=require("@progress/kendo-react-common"),V=require("./AIPromptViewRender.js"),f=require("../AIPromptExpander.js"),v=require("../AIPromptContext.js"),p={name:"prompt-view",buttonText:"Ask AI",buttonIcon:l.sparklesIcon},y=m=>{const i="Generate",{promptInput:d=T.TextArea,generateButton:P=R.Button,promptValue:A,promptSuggestions:o}=m,[r,n]=e.useState(A||""),[s]=v.useAIPromptContext(),[I,c]=a.useCustomComponent(P),[g,u]=a.useCustomComponent(d),k=()=>{s.onPromptRequest&&s.onPromptRequest.call(null,r),n("")},C=t=>{n(t)},q=t=>{n(t.target.value)},x={title:"Generate",svgIcon:l.sparklesIcon},h={placeholder:"Ask or generate content with AI ...",rows:2},S=Object.keys(c).length>0?c:x,b=Object.keys(u).length>0?u:h;return e.createElement(V.AIPromptViewRender,{name:p.name},e.createElement(w.AIPromptContent,null,e.createElement(g,{value:r,onChange:q,...b}),o&&o.length>0&&e.createElement(f.AIPromptExpander,{title:"Prompt Suggestions"},o.map(t=>e.createElement("div",{key:t,className:"k-prompt-suggestion",onClick:()=>C(t)},t)))),e.createElement(E.AIPromptFooter,null,e.createElement(I,{themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:k,...S},i)))};exports.AIPromptView=y;exports.promptViewDefaults=p;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import t from "react";
|
|
10
|
+
import { AIPromptContent as T } from "../AIPromptContent.mjs";
|
|
11
|
+
import { AIPromptFooter as b } from "../AIPromptFooter.mjs";
|
|
12
|
+
import { Button as S } from "@progress/kendo-react-buttons";
|
|
13
|
+
import { TextArea as w } from "@progress/kendo-react-inputs";
|
|
14
|
+
import { sparklesIcon as l } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { useCustomComponent as a } from "@progress/kendo-react-common";
|
|
16
|
+
import { AIPromptViewRender as v } from "./AIPromptViewRender.mjs";
|
|
17
|
+
import { AIPromptExpander as R } from "../AIPromptExpander.mjs";
|
|
18
|
+
import { useAIPromptContext as V } from "../AIPromptContext.mjs";
|
|
19
|
+
const y = {
|
|
20
|
+
name: "prompt-view",
|
|
21
|
+
buttonText: "Ask AI",
|
|
22
|
+
buttonIcon: l
|
|
23
|
+
}, M = (c) => {
|
|
24
|
+
const u = "Generate", { promptInput: i = w, generateButton: d = S, promptValue: f, promptSuggestions: o } = c, [r, n] = t.useState(f || ""), [m] = V(), [A, s] = a(d), [P, p] = a(i), g = () => {
|
|
25
|
+
m.onPromptRequest && m.onPromptRequest.call(null, r), n("");
|
|
26
|
+
}, x = (e) => {
|
|
27
|
+
n(e);
|
|
28
|
+
}, I = (e) => {
|
|
29
|
+
n(e.target.value);
|
|
30
|
+
}, h = {
|
|
31
|
+
title: "Generate",
|
|
32
|
+
svgIcon: l
|
|
33
|
+
}, k = {
|
|
34
|
+
placeholder: "Ask or generate content with AI ...",
|
|
35
|
+
rows: 2
|
|
36
|
+
}, C = Object.keys(s).length > 0 ? s : h, E = Object.keys(p).length > 0 ? p : k;
|
|
37
|
+
return /* @__PURE__ */ t.createElement(v, { name: y.name }, /* @__PURE__ */ t.createElement(T, null, /* @__PURE__ */ t.createElement(
|
|
38
|
+
P,
|
|
39
|
+
{
|
|
40
|
+
value: r,
|
|
41
|
+
onChange: I,
|
|
42
|
+
...E
|
|
43
|
+
}
|
|
44
|
+
), o && o.length > 0 && /* @__PURE__ */ t.createElement(R, { title: "Prompt Suggestions" }, o.map((e) => /* @__PURE__ */ t.createElement("div", { key: e, className: "k-prompt-suggestion", onClick: () => x(e) }, e)))), /* @__PURE__ */ t.createElement(b, null, /* @__PURE__ */ t.createElement(
|
|
45
|
+
A,
|
|
46
|
+
{
|
|
47
|
+
themeColor: "primary",
|
|
48
|
+
fillMode: "solid",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
rounded: "full",
|
|
51
|
+
size: "medium",
|
|
52
|
+
onClick: g,
|
|
53
|
+
...C
|
|
54
|
+
},
|
|
55
|
+
u
|
|
56
|
+
)));
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
M as AIPromptView,
|
|
60
|
+
y as promptViewDefaults
|
|
61
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../AIPromptContext.js"),o=e=>{const[t]=n.useAIPromptContext();return t.activeView===e.name?e.children:null};exports.AIPromptViewRender=o;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import { useAIPromptContext as n } from "../AIPromptContext.mjs";
|
|
10
|
+
const i = (e) => {
|
|
11
|
+
const [t] = n();
|
|
12
|
+
return t.activeView === e.name ? e.children : null;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
i as AIPromptViewRender
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";const n=require("react"),r=require("@progress/kendo-react-common"),i=require("./base/FocusableUponSelection.js");function c(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const p=c(n);class a extends i.FocusableUponSelection{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===r.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return r.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}}module.exports=a;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as s from "react";
|
|
10
|
+
import { Keys as t, classNames as o } from "@progress/kendo-react-common";
|
|
11
|
+
import { FocusableUponSelection as r } from "./base/FocusableUponSelection.mjs";
|
|
12
|
+
class c extends r {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.onKeyDown = (e) => {
|
|
15
|
+
e.keyCode === t.enter && this.props.onActionExecute(this.props.item, e);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return /* @__PURE__ */ s.createElement(
|
|
20
|
+
"span",
|
|
21
|
+
{
|
|
22
|
+
role: "button",
|
|
23
|
+
className: this.getClassNames(),
|
|
24
|
+
onClick: (e) => this.props.onActionExecute(this.props.item, e),
|
|
25
|
+
ref: (e) => this.elementToFocus = e,
|
|
26
|
+
onKeyDown: this.onKeyDown,
|
|
27
|
+
tabIndex: 0
|
|
28
|
+
},
|
|
29
|
+
this.props.item.title || this.props.item.value
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
getClassNames() {
|
|
33
|
+
return o(
|
|
34
|
+
"k-quick-reply",
|
|
35
|
+
{ "k-first": this.props.isFirstItemInGroup },
|
|
36
|
+
{ "k-last": this.props.isLastItemInGroup },
|
|
37
|
+
{ "k-selected": this.props.selected },
|
|
38
|
+
{ "k-focus": this.props.selected }
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
c as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";const r=require("react"),c=require("@progress/kendo-react-common"),i=require("./Action.js"),a=require("./base/SelectableItemsContainer.js");function u(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(e,n,t.get?t:{enumerable:!0,get:()=>s[n]})}}return e.default=s,Object.freeze(e)}const o=u(r);class l extends a.SelectableItemsContainer{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return o.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map((n,t)=>o.createElement(i,{item:n,onActionExecute:this.props.onActionExecute,selected:t===this.state.selectedItemIndex,isFirstItemInGroup:t===0,isLastItemInGroup:t===e,key:t})))}getClassNames(){return c.classNames("k-quick-replies")}}module.exports=l;
|