@epam/ai-dial-prompts 1.1.0-dev.444 → 1.1.0-dev.445

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.
@@ -1 +1 @@
1
- {"version":3,"file":"PromptParametersPopup.d.ts","sourceRoot":"","sources":["../../../src/components/PromptParametersPopup/PromptParametersPopup.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAA4B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAG7F;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAoIhE,CAAC"}
1
+ {"version":3,"file":"PromptParametersPopup.d.ts","sourceRoot":"","sources":["../../../src/components/PromptParametersPopup/PromptParametersPopup.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAmB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAG7F;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAmJhE,CAAC"}
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { CatalogEntityType as e, DeploymentIcon as t, SELECT_LIST_MAX_HEIGHT_CLASS_NAME as n, SELECT_LIST_MAX_HEIGHT_PX as r, buildCssVars as i, mergeClasses as a } from "@epam/ai-dial-chat-shared";
2
- import { DIAL_ICON_SIZE as o, DIAL_KIT_ICON_STROKE as s, GhostButton as c, GhostIconButton as l, InteractiveTooltip as u, MenuItem as d, NeutralButton as f, Popup as p, PopupSize as m, PrimaryButton as h, Textarea as g, ToggleIconButton as _ } from "@epam/ai-dial-ui-kit";
3
- import { IconChevronLeft as v, IconStarFilled as y } from "@tabler/icons-react";
4
- import { useEffect as b, useId as x, useLayoutEffect as S, useMemo as C, useRef as w, useState as T } from "react";
1
+ import { CatalogEntityType as e, DeploymentIcon as t, SELECT_LIST_MAX_HEIGHT_CLASS_NAME as n, SELECT_LIST_MAX_HEIGHT_PX as r, buildCssVars as i, buildPromptParamDefaults as a, mergeClasses as o } from "@epam/ai-dial-chat-shared";
2
+ import { DIAL_ICON_SIZE as s, DIAL_KIT_ICON_STROKE as c, GhostButton as l, GhostIconButton as u, InteractiveTooltip as d, MenuItem as f, NeutralButton as p, Popup as m, PopupSize as h, PrimaryButton as g, Textarea as _, ToggleIconButton as v } from "@epam/ai-dial-ui-kit";
3
+ import { IconChevronLeft as y, IconStarFilled as b } from "@tabler/icons-react";
4
+ import { useEffect as x, useId as S, useLayoutEffect as C, useRef as w, useState as T } from "react";
5
5
  import { jsx as E, jsxs as D } from "react/jsx-runtime";
6
6
  import { AppIdentity as O, ContentTab as k, DeploymentSize as A } from "@epam/ai-dial-catalog";
7
7
  var j = {
@@ -14,27 +14,27 @@ var j = {
14
14
  rowLeaving: "_rowLeaving_1pyx6_27",
15
15
  rowFadeOut: "_rowFadeOut_1pyx6_1",
16
16
  listContent: "_listContent_1pyx6_55"
17
- }, M = "px-3 pb-0.5 pt-2", N = 180, P = ({ favorites: e, onSelect: s, onToggleFavorite: l, onBrowse: f, labels: p = {}, colors: m, nameClassName: h = "dial-small-text", headerClassName: g = "dial-tiny-lead-semi-text", emptyHintClassName: v = "dial-small-text" }) => {
18
- let { myCollectionLabel: x = "My Collection", emptyHintLabel: C = "Star a prompt to pin it here", browseLabel: O = "Browse", removeFromFavoritesLabel: k = "Remove from favorites" } = p, A = i({
17
+ }, M = "px-3 pb-0.5 pt-2", N = 180, P = ({ favorites: e, onSelect: a, onToggleFavorite: c, onBrowse: u, labels: p = {}, colors: m, nameClassName: h = "dial-small-text", headerClassName: g = "dial-tiny-lead-semi-text", emptyHintClassName: _ = "dial-small-text" }) => {
18
+ let { myCollectionLabel: y = "My Collection", emptyHintLabel: S = "Star a prompt to pin it here", browseLabel: O = "Browse", removeFromFavoritesLabel: k = "Remove from favorites" } = p, A = i({
19
19
  "--fp-header-text": m?.headerText,
20
20
  "--fp-empty-hint-text": m?.emptyHintText,
21
21
  "--fp-star-color": m?.starColor,
22
22
  "--fp-footer-border": m?.footerBorder
23
23
  }), [P, F] = T(/* @__PURE__ */ new Set()), I = w(/* @__PURE__ */ new Map());
24
- b(() => {
24
+ x(() => {
25
25
  let e = I.current;
26
26
  return () => {
27
27
  e.forEach((e) => clearTimeout(e)), e.clear();
28
28
  };
29
29
  }, []);
30
30
  let L = w(null), [R, z] = T();
31
- S(() => {
31
+ C(() => {
32
32
  L.current && z(Math.min(L.current.scrollHeight, r));
33
33
  }, [e]);
34
34
  let B = (e) => {
35
35
  F((t) => new Set(t).add(e));
36
36
  let t = setTimeout(() => {
37
- l(e), F((t) => {
37
+ c(e), F((t) => {
38
38
  let n = new Set(t);
39
39
  return n.delete(e), n;
40
40
  }), I.current.delete(e);
@@ -46,29 +46,29 @@ var j = {
46
46
  style: A,
47
47
  children: [
48
48
  /* @__PURE__ */ E("p", {
49
- className: a(g, M, j.header),
50
- children: x
49
+ className: o(g, M, j.header),
50
+ children: y
51
51
  }),
52
52
  /* @__PURE__ */ E("div", {
53
- className: a(n, "min-h-0 flex-1 overflow-y-auto", j.listContent),
53
+ className: o(n, "min-h-0 flex-1 overflow-y-auto", j.listContent),
54
54
  style: { maxHeight: R },
55
55
  children: /* @__PURE__ */ E("div", {
56
56
  ref: L,
57
57
  children: e.length > 0 ? /* @__PURE__ */ E("ul", {
58
58
  className: "flex flex-col gap-1 px-1 pb-1",
59
59
  children: e.map((e) => {
60
- let n = /* @__PURE__ */ E(d, {
60
+ let n = /* @__PURE__ */ E(f, {
61
61
  className: "h-auto py-1.5",
62
62
  icon: /* @__PURE__ */ E(t, {
63
- size: o.MD,
63
+ size: s.MD,
64
64
  initialsName: e.name
65
65
  }),
66
66
  label: e.name,
67
67
  labelClassName: h,
68
- onClick: () => s(e),
69
- rightControl: /* @__PURE__ */ E(_, {
70
- icon: /* @__PURE__ */ E(y, {
71
- size: o.SM,
68
+ onClick: () => a(e),
69
+ rightControl: /* @__PURE__ */ E(v, {
70
+ icon: /* @__PURE__ */ E(b, {
71
+ size: s.SM,
72
72
  className: j.star,
73
73
  "aria-hidden": !0
74
74
  }),
@@ -79,7 +79,7 @@ var j = {
79
79
  }), r = e.description != null && e.description !== "";
80
80
  return /* @__PURE__ */ E("li", {
81
81
  className: P.has(e.id) ? j.rowLeaving : j.rowEnter,
82
- children: r ? /* @__PURE__ */ E(u, {
82
+ children: r ? /* @__PURE__ */ E(d, {
83
83
  asChild: !0,
84
84
  contentClassName: "max-w-[550px]",
85
85
  content: /* @__PURE__ */ E("p", {
@@ -91,65 +91,67 @@ var j = {
91
91
  }, e.id);
92
92
  })
93
93
  }) : /* @__PURE__ */ E("p", {
94
- className: a(v, "px-4 py-4 text-start", j.emptyHint),
95
- children: C
94
+ className: o(_, "px-4 py-4 text-start", j.emptyHint),
95
+ children: S
96
96
  })
97
97
  })
98
98
  }),
99
99
  /* @__PURE__ */ E("div", {
100
- className: a("border-t px-2 py-3", j.footer),
101
- children: /* @__PURE__ */ E(c, {
100
+ className: o("border-t px-2 py-3", j.footer),
101
+ children: /* @__PURE__ */ E(l, {
102
102
  label: O,
103
103
  className: "w-full justify-center",
104
- onClick: f
104
+ onClick: u
105
105
  })
106
106
  })
107
107
  ]
108
108
  });
109
- }, F = { card: "_card_p8vwa_1" }, I = ({ open: t, promptName: n, content: r, description: o, parameters: c, onBack: u, onClose: d, onSubmit: _, onCancel: y, labels: b = {}, colors: S, titleClassName: w = "dial-h2-text", parametersLabelClassName: j = "dial-h2-text", detailsLabelClassName: M = "dial-h2-text" }) => {
110
- let { title: N = "Prompt parameters", closeLabel: P = "Close", backLabel: I = "Back", parametersLabel: L = "Parameters", detailsLabel: R = "Details", enterValuePlaceholder: z = "Enter value", cancelLabel: B = "Cancel", submitLabel: V = "Confirm" } = b, [H, U] = T({}), W = x(), G = i({
111
- "--pp-card-bg": S?.cardBackground,
112
- "--pp-card-border": S?.cardBorder
113
- }), K = C(() => c.some((e) => !H[e]?.trim()), [c, H]);
114
- return /* @__PURE__ */ E(p, {
109
+ }, F = { card: "_card_p8vwa_1" }, I = ({ open: t, promptName: n, content: r, description: s, parameters: l, onBack: d, onClose: f, onSubmit: v, onCancel: b, labels: x = {}, colors: C, titleClassName: w = "dial-h2-text", parametersLabelClassName: j = "dial-h2-text", detailsLabelClassName: M = "dial-h2-text" }) => {
110
+ let { title: N = "Prompt parameters", closeLabel: P = "Close", backLabel: I = "Back", parametersLabel: L = "Parameters", detailsLabel: R = "Details", enterValuePlaceholder: z = "Enter value", cancelLabel: B = "Cancel", submitLabel: V = "Confirm" } = x, H = l.map(({ name: e, defaultValue: t }) => `${e}\u0000${t ?? ""}`).join(""), [U, W] = T(() => a(l)), [G, K] = T(H);
111
+ G !== H && (K(H), W(a(l)));
112
+ let q = S(), J = i({
113
+ "--pp-card-bg": C?.cardBackground,
114
+ "--pp-card-border": C?.cardBorder
115
+ }), Y = l.some(({ name: e }) => !U[e]?.trim());
116
+ return /* @__PURE__ */ E(m, {
115
117
  open: t,
116
118
  header: /* @__PURE__ */ D("div", {
117
119
  className: "flex items-center gap-2",
118
- children: [u != null && /* @__PURE__ */ E(l, {
119
- icon: /* @__PURE__ */ E(v, {
120
+ children: [d != null && /* @__PURE__ */ E(u, {
121
+ icon: /* @__PURE__ */ E(y, {
120
122
  className: "rtl:scale-x-[-1]",
121
123
  "aria-hidden": !0,
122
- stroke: s
124
+ stroke: c
123
125
  }),
124
126
  "aria-label": I,
125
- onClick: u
127
+ onClick: d
126
128
  }), /* @__PURE__ */ E("span", {
127
129
  className: w,
128
130
  children: N
129
131
  })]
130
132
  }),
131
133
  ariaLabel: N,
132
- size: m.Lg,
134
+ size: h.Lg,
133
135
  closeAriaLabel: P,
134
- onClose: d,
136
+ onClose: f,
135
137
  footer: /* @__PURE__ */ D("div", {
136
138
  className: "flex justify-end gap-2 px-6 py-4",
137
- children: [/* @__PURE__ */ E(f, {
139
+ children: [/* @__PURE__ */ E(p, {
138
140
  label: B,
139
- onClick: y
140
- }), /* @__PURE__ */ E(h, {
141
+ onClick: b
142
+ }), /* @__PURE__ */ E(g, {
141
143
  label: V,
142
- disabled: K,
144
+ disabled: Y,
143
145
  onClick: () => {
144
- K || _(H);
146
+ Y || v(U);
145
147
  }
146
148
  })]
147
149
  }),
148
150
  children: /* @__PURE__ */ D("div", {
149
151
  className: "flex flex-col gap-4 px-6 pb-4 pt-2",
150
152
  children: [/* @__PURE__ */ E("div", {
151
- className: a("flex h-[72px] w-full items-center rounded-lg border px-3", F.card),
152
- style: G,
153
+ className: o("flex h-[72px] w-full items-center rounded-lg border px-3", F.card),
154
+ style: J,
153
155
  children: /* @__PURE__ */ E(O, {
154
156
  type: e.Prompt,
155
157
  name: n,
@@ -161,21 +163,21 @@ var j = {
161
163
  children: [/* @__PURE__ */ D("div", {
162
164
  className: "flex flex-col gap-3",
163
165
  children: [/* @__PURE__ */ E("h2", {
164
- className: a(j, "m-0"),
166
+ className: o(j, "m-0"),
165
167
  children: L
166
- }), c.map((e) => {
167
- let t = `${W}-${e}`;
168
- return /* @__PURE__ */ E(g, {
168
+ }), l.map(({ name: e }) => {
169
+ let t = `${q}-${e}`;
170
+ return /* @__PURE__ */ E(_, {
169
171
  id: t,
170
172
  "aria-label": e,
171
- value: H[e] ?? "",
173
+ value: U[e] ?? "",
172
174
  labelProps: {
173
175
  htmlFor: t,
174
176
  label: e,
175
177
  required: !0
176
178
  },
177
179
  placeholder: z,
178
- onChange: (t) => U((n) => ({
180
+ onChange: (t) => W((n) => ({
179
181
  ...n,
180
182
  [e]: t
181
183
  }))
@@ -184,11 +186,11 @@ var j = {
184
186
  }), /* @__PURE__ */ D("div", {
185
187
  className: "flex min-h-0 flex-col gap-3",
186
188
  children: [/* @__PURE__ */ E("h2", {
187
- className: a(M, "m-0"),
189
+ className: o(M, "m-0"),
188
190
  children: R
189
191
  }), /* @__PURE__ */ E(k, {
190
192
  content: r,
191
- description: o
193
+ description: s
192
194
  })]
193
195
  })]
194
196
  })]
@@ -1,3 +1,4 @@
1
+ import { PromptParameter } from '../../../chat-shared/src/index.ts';
1
2
  /** Localizable string labels for the prompt-parameters popup component. */
2
3
  export interface PromptParametersPopupLabels {
3
4
  /** Dialog title. Defaults to `'Prompt parameters'`. */
@@ -35,10 +36,12 @@ export interface PromptParametersPopupProps {
35
36
  /** Short summary shown above the divider in the Details column. Omitted when empty. */
36
37
  description?: string;
37
38
  /**
38
- * Distinct `{{param}}` names found in `content`, in first-occurrence order.
39
- * One required field is rendered per entry.
39
+ * Distinct parameters found in `content`, in first-occurrence order — as
40
+ * returned by `extractPromptParams`. One required field is rendered per
41
+ * entry, labelled with the parameter's name and starting out holding its
42
+ * `defaultValue` when it has one.
40
43
  */
41
- parameters: string[];
44
+ parameters: PromptParameter[];
42
45
  /**
43
46
  * Called to return to the previous screen (the browse modal). When omitted,
44
47
  * no back chevron is rendered — the popup was opened directly from a favorite.
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-parameters-popup-props.d.ts","sourceRoot":"","sources":["../../src/models/prompt-parameters-popup-props.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,WAAW,2BAA2B;IAC1C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yGAAyG;IACzG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,+EAA+E;AAC/E,MAAM,WAAW,2BAA2B;IAC1C,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,uDAAuD;AACvD,MAAM,WAAW,0BAA0B;IACzC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,mHAAmH;IACnH,OAAO,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,uFAAuF;IACvF,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACnD,gDAAgD;IAChD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,MAAM,CAAC,EAAE,2BAA2B,CAAC;IACrC,wDAAwD;IACxD,MAAM,CAAC,EAAE,2BAA2B,CAAC;IACrC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0FAA0F;IAC1F,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC"}
1
+ {"version":3,"file":"prompt-parameters-popup-props.d.ts","sourceRoot":"","sources":["../../src/models/prompt-parameters-popup-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,2EAA2E;AAC3E,MAAM,WAAW,2BAA2B;IAC1C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yGAAyG;IACzG,SAAS,CAAC,EAAE,MAA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}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-prompts",
3
3
  "description": "Host-agnostic UI for picking a favorite prompt and resolving its {{parameter}} placeholders before it is inserted into a chat message",
4
- "version": "1.1.0-dev.444",
4
+ "version": "1.1.0-dev.445",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -16,8 +16,8 @@
16
16
  }
17
17
  },
18
18
  "peerDependencies": {
19
- "@epam/ai-dial-catalog": "1.1.0-dev.444",
20
- "@epam/ai-dial-chat-shared": "1.1.0-dev.444",
19
+ "@epam/ai-dial-catalog": "1.1.0-dev.445",
20
+ "@epam/ai-dial-chat-shared": "1.1.0-dev.445",
21
21
  "@epam/ai-dial-ui-kit": "*",
22
22
  "@tabler/icons-react": "^3.0.0",
23
23
  "react": "^19.0.0"