@inkeep/cxkit-primitives 0.5.113 → 0.5.115

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,152 +1,155 @@
1
1
  "use client";
2
- import { jsx as o } from "react/jsx-runtime";
2
+ import { jsx as r } from "react/jsx-runtime";
3
3
  import { ikp as t } from "./factory.js";
4
- import { forwardRef as v, useRef as f, useEffect as h } from "react";
5
- import y from "react-textarea-autosize";
6
- import { Trigger as A, Icon as L, Content as V, Viewport as H, Item as E, ItemText as D, ItemIndicator as N, Root as q, Value as M } from "../atoms/select.js";
7
- import * as w from "@radix-ui/react-checkbox";
8
- import { useIntelligentForm as s } from "./intelligent-form/intelligent-form-provider.js";
9
- import { IntelligentFormProvider as ji } from "./intelligent-form/intelligent-form-provider.js";
10
- import * as p from "@radix-ui/react-scroll-area";
11
- import { BuiltInIconRenderer as g } from "../atoms/icons/built-in-icon-renderer.js";
12
- import { maybeRender as C, dataAttr as a } from "../utils/misc.js";
13
- import { Controller as z } from "react-hook-form";
14
- import { IntelligentFormFieldProvider as O, useIntelligentFormField as u } from "../providers/intelligent-form-field-provider.js";
15
- import { CheckboxIcon as U } from "../atoms/icons/checkbox-icon.js";
16
- import { useInkeepConfig as R } from "../providers/config-provider.js";
17
- import { SourceItemProvider as j, useSourceItem as x } from "../providers/source-item-provider.js";
18
- import { LinkWithQueryParams as Q } from "../atoms/link.js";
19
- import { Markdown as W } from "../atoms/markdown/index.js";
20
- import { useComposedRefs as I } from "../utils/compose-refs.js";
21
- import { composeEventHandlers as F } from "../utils/compose-event-handlers.js";
22
- import { transformInkeepSource as $ } from "../utils/transform-source/index.js";
23
- const G = t("form", {
4
+ import { forwardRef as p, useRef as v, useEffect as P } from "react";
5
+ import x from "react-textarea-autosize";
6
+ import { Trigger as A, Icon as V, Content as L, Viewport as H, Item as E, ItemText as D, ItemIndicator as N, Root as q, Value as M } from "../atoms/select.js";
7
+ import { ComboboxRoot as z, ComboboxControl as O, ComboboxInput as U, ComboboxTrigger as j, ComboboxPositioner as Q, ComboboxContent as W, ComboboxItem as $, ComboboxItemText as G, ComboboxSelectedTags as J, ComboboxItemIndicator as K } from "../atoms/combobox.js";
8
+ import { useComboboxItems as ut } from "../atoms/combobox.js";
9
+ import * as y from "@radix-ui/react-checkbox";
10
+ import { useIntelligentForm as m } from "./intelligent-form/intelligent-form-provider.js";
11
+ import { IntelligentFormProvider as gt } from "./intelligent-form/intelligent-form-provider.js";
12
+ import * as b from "@radix-ui/react-scroll-area";
13
+ import { BuiltInIconRenderer as _ } from "../atoms/icons/built-in-icon-renderer.js";
14
+ import { maybeRender as h, dataAttr as F } from "../utils/misc.js";
15
+ import { Controller as X } from "react-hook-form";
16
+ import { IntelligentFormFieldProvider as Y, useIntelligentFormField as g } from "../providers/intelligent-form-field-provider.js";
17
+ import { CheckboxIcon as Z } from "../atoms/icons/checkbox-icon.js";
18
+ import { useInkeepConfig as w } from "../providers/config-provider.js";
19
+ import { SourceItemProvider as ee, useSourceItem as T } from "../providers/source-item-provider.js";
20
+ import { LinkWithQueryParams as ie } from "../atoms/link.js";
21
+ import { Markdown as te } from "../atoms/markdown/index.js";
22
+ import { useComposedRefs as C } from "../utils/compose-refs.js";
23
+ import { composeEventHandlers as a } from "../utils/compose-event-handlers.js";
24
+ import { transformInkeepSource as oe } from "../utils/transform-source/index.js";
25
+ import { useShadow as ne } from "../atoms/shadow/context.js";
26
+ const re = t("form", {
24
27
  _id: "intelligentForm__Root"
25
- }), Ue = (i) => {
26
- const { onSubmit: e, ...n } = i, { handleSubmit: r } = s();
27
- return /* @__PURE__ */ o(G, { onSubmit: F(e, r), ...n });
28
- }, je = t("h2", {
28
+ }), ti = (i) => {
29
+ const { onSubmit: e, ...o } = i, { handleSubmit: n } = m();
30
+ return /* @__PURE__ */ r(re, { onSubmit: a(e, n), ...o });
31
+ }, oi = t("h2", {
29
32
  _id: "intelligentForm__Heading",
30
33
  children: "Contact Support"
31
- }), Qe = t("div", {
34
+ }), ni = t("div", {
32
35
  _id: "intelligentForm__Content"
33
- }), We = t(p.Root, {
36
+ }), ri = t(b.Root, {
34
37
  _id: "intelligentForm__Content__ScrollArea"
35
- }), J = t(p.Viewport, {
38
+ }), le = t(b.Viewport, {
36
39
  _id: "intelligentForm__Content__ScrollAreaViewport"
37
- }), $e = (i) => {
38
- const { children: e, ...n } = i;
39
- return /* @__PURE__ */ o(
40
- J,
40
+ }), li = (i) => {
41
+ const { children: e, ...o } = i;
42
+ return /* @__PURE__ */ r(
43
+ le,
41
44
  {
42
45
  children: (
43
46
  /* added this to fix an overflow issue see https://github.com/radix-ui/primitives/issues/926 */
44
- /* @__PURE__ */ o("div", { "data-part": "grid", style: { display: "grid" }, children: e })
47
+ /* @__PURE__ */ r("div", { "data-part": "grid", style: { display: "grid" }, children: e })
45
48
  ),
46
- ...n
49
+ ...o
47
50
  }
48
51
  );
49
- }, Ge = t(
50
- p.ScrollAreaScrollbar,
52
+ }, mi = t(
53
+ b.ScrollAreaScrollbar,
51
54
  {
52
55
  _id: "intelligentForm__Content__ScrollAreaScrollbar"
53
56
  }
54
- ), Je = t(
55
- p.ScrollAreaThumb,
57
+ ), si = t(
58
+ b.ScrollAreaThumb,
56
59
  {
57
60
  _id: "intelligentForm__Content__ScrollAreaThumb"
58
61
  }
59
- ), Ke = t(p.Corner, {
62
+ ), ci = t(b.Corner, {
60
63
  _id: "intelligentForm__Content__ScrollAreaCorner"
61
- }), K = t("div", {
64
+ }), me = t("div", {
62
65
  _id: "intelligentForm__Success"
63
- }), Xe = (i) => {
64
- const { children: e, ...n } = i, { isSubmitSuccessful: r } = s();
65
- return r ? /* @__PURE__ */ o(K, { ...n, children: e }) : null;
66
- }, X = t(g, {
66
+ }), di = (i) => {
67
+ const { children: e, ...o } = i, { isSubmitSuccessful: n } = m();
68
+ return n ? /* @__PURE__ */ r(me, { ...o, children: e }) : null;
69
+ }, se = t(_, {
67
70
  _id: "intelligentForm__SuccessIcon"
68
- }), Ye = (i) => {
71
+ }), ai = (i) => {
69
72
  const {
70
73
  formSettings: { successView: e }
71
- } = s();
72
- return /* @__PURE__ */ o(
73
- X,
74
+ } = m();
75
+ return /* @__PURE__ */ r(
76
+ se,
74
77
  {
75
78
  iconSettings: e.icon ?? { builtIn: "LuCircleCheck" },
76
79
  ...i
77
80
  }
78
81
  );
79
- }, Y = t("h2", {
82
+ }, ce = t("h2", {
80
83
  _id: "intelligentForm__SuccessHeading"
81
- }), Ze = (i) => {
84
+ }), Fi = (i) => {
82
85
  const {
83
86
  formSettings: { successView: e }
84
- } = s();
85
- return /* @__PURE__ */ o(Y, { children: e.heading, ...i });
86
- }, Z = t("p", {
87
+ } = m();
88
+ return /* @__PURE__ */ r(ce, { children: e.heading, ...i });
89
+ }, de = t("p", {
87
90
  _id: "intelligentForm__SuccessMessage"
88
- }), ei = (i) => {
91
+ }), ui = (i) => {
89
92
  const {
90
93
  formSettings: { successView: e }
91
- } = s();
92
- return /* @__PURE__ */ o(Z, { children: e.message, ...i });
93
- }, ii = t("div", {
94
+ } = m();
95
+ return /* @__PURE__ */ r(de, { children: e.message, ...i });
96
+ }, _i = t("div", {
94
97
  _id: "intelligentForm__PrimaryForm"
95
- }), ee = t("div", {
98
+ }), ae = t("div", {
96
99
  _id: "intelligentForm__PrimaryFormFields"
97
- }), ie = t("p", {
100
+ }), Fe = t("p", {
98
101
  _id: "intelligentForm__PrimaryForm__Description"
99
- }), ti = (i) => {
102
+ }), gi = (i) => {
100
103
  const {
101
104
  formSettings: { primary: e }
102
- } = s();
103
- return e.description ? /* @__PURE__ */ o(ie, { children: e.description, ...i }) : null;
104
- }, ni = (i) => {
105
- const { children: e, ...n } = i, {
106
- formSettings: { primary: r }
107
- } = s();
108
- return /* @__PURE__ */ o(ee, { children: C(e, r.fields), ...n });
109
- }, te = t("button", {
105
+ } = m();
106
+ return e.description ? /* @__PURE__ */ r(Fe, { children: e.description, ...i }) : null;
107
+ }, Si = (i) => {
108
+ const { children: e, ...o } = i, {
109
+ formSettings: { primary: n }
110
+ } = m();
111
+ return /* @__PURE__ */ r(ae, { children: h(e, n.fields), ...o });
112
+ }, ue = t("button", {
110
113
  _id: "intelligentForm__PrimaryFormSubmit",
111
114
  type: "button",
112
115
  children: "Next"
113
- }), ri = (i) => {
114
- const { onClick: e, ...n } = i, { submittedPrimaryForm: r, handleSubmitPrimaryForm: l } = s();
115
- return /* @__PURE__ */ o(
116
- te,
116
+ }), bi = (i) => {
117
+ const { onClick: e, ...o } = i, { submittedPrimaryForm: n, handleSubmitPrimaryForm: l } = m();
118
+ return /* @__PURE__ */ r(
119
+ ue,
117
120
  {
118
- "data-submitted": a(r),
119
- onClick: F(e, l),
120
- ...n
121
+ "data-submitted": F(n),
122
+ onClick: a(e, l),
123
+ ...o
121
124
  }
122
125
  );
123
- }, ne = t("div", {
126
+ }, _e = t("div", {
124
127
  _id: "intelligentForm__Field"
125
- }), oi = (i) => {
126
- const { field: e, autoFocus: n, ...r } = i, { control: l, errors: c } = s();
127
- return /* @__PURE__ */ o(
128
- z,
128
+ }), pi = (i) => {
129
+ const { field: e, autoFocus: o, ...n } = i, { control: l, errors: s } = m();
130
+ return /* @__PURE__ */ r(
131
+ X,
129
132
  {
130
133
  name: e.name,
131
134
  control: l,
132
135
  rules: {
133
136
  required: e.isRequired ? `${e.label} is required.` : void 0
134
137
  },
135
- render: ({ field: m }) => {
136
- const d = m.value !== void 0 || e.inputType === "file";
137
- return /* @__PURE__ */ o(
138
- O,
138
+ render: ({ field: c }) => {
139
+ const d = c.value !== void 0 || e.inputType === "file";
140
+ return /* @__PURE__ */ r(
141
+ Y,
139
142
  {
140
- "data-invalid": a(!!c[e.name]),
143
+ "data-invalid": F(!!s[e.name]),
141
144
  field: e,
142
- fieldProps: m,
143
- autoFocus: n,
144
- children: d && /* @__PURE__ */ o(
145
- ne,
145
+ fieldProps: c,
146
+ autoFocus: o,
147
+ children: d && /* @__PURE__ */ r(
148
+ _e,
146
149
  {
147
150
  "data-input-type": e.inputType,
148
- "data-hidden": a(e.isHidden),
149
- ...r
151
+ "data-hidden": F(e.isHidden),
152
+ ...n
150
153
  }
151
154
  )
152
155
  }
@@ -154,420 +157,482 @@ const G = t("form", {
154
157
  }
155
158
  }
156
159
  );
157
- }, re = t("label", {
160
+ }, ge = t("label", {
158
161
  _id: "intelligentForm__FieldLabel"
159
- }), li = (i) => {
160
- const { field: e } = u();
161
- return /* @__PURE__ */ o(
162
- re,
162
+ }), Ci = (i) => {
163
+ const { field: e } = g();
164
+ return /* @__PURE__ */ r(
165
+ ge,
163
166
  {
164
- "data-required": a(e.isRequired),
167
+ "data-required": F(e.isRequired),
165
168
  htmlFor: e.name,
166
169
  children: e.label,
167
170
  ...i
168
171
  }
169
172
  );
170
- }, oe = t("input", {
173
+ }, Se = t("input", {
171
174
  _id: "intelligentForm__FieldText",
172
175
  type: "text"
173
- }), T = v((i, e) => {
176
+ }), R = p((i, e) => {
174
177
  const {
175
- field: n,
176
- error: r,
178
+ field: o,
179
+ error: n,
177
180
  fieldProps: {
178
181
  onChange: l,
179
- onBlur: c,
180
- ref: m,
182
+ onBlur: s,
183
+ ref: c,
181
184
  ...d
182
185
  },
183
186
  autoFocus: S
184
- } = u(), _ = I(
187
+ } = g(), u = C(
185
188
  e,
186
- m
189
+ c
187
190
  );
188
- return /* @__PURE__ */ o(
189
- oe,
191
+ return /* @__PURE__ */ r(
192
+ Se,
190
193
  {
191
- asChild: n.inputType === "textarea",
192
- ref: _,
193
- id: n.name,
194
+ asChild: o.inputType === "textarea",
195
+ ref: u,
196
+ id: o.name,
194
197
  autoFocus: S,
195
- placeholder: "placeholder" in n ? n.placeholder : void 0,
196
- "data-invalid": a(!!r),
197
- onChange: F(i.onChange, l),
198
- onBlur: F(i.onBlur, c),
198
+ placeholder: "placeholder" in o ? o.placeholder : void 0,
199
+ "data-invalid": F(!!n),
200
+ onChange: a(i.onChange, l),
201
+ onBlur: a(i.onBlur, s),
199
202
  ...d,
200
203
  ...i,
201
- children: n.inputType === "textarea" ? /* @__PURE__ */ o(y, { minRows: 3, maxRows: 10 }) : null
204
+ children: o.inputType === "textarea" ? /* @__PURE__ */ r(x, { minRows: 3, maxRows: 10 }) : null
202
205
  }
203
206
  );
204
- }), si = t(T, {
207
+ }), Ii = t(R, {
205
208
  _id: "intelligentForm__FieldEmail",
206
209
  type: "email"
207
- }), le = t("input", {
210
+ }), be = t("input", {
208
211
  _id: "intelligentForm__FieldFile",
209
212
  type: "file",
210
213
  multiple: !0
211
- }), ci = (i) => {
214
+ }), vi = (i) => {
212
215
  const {
213
216
  field: e,
214
- error: n,
215
- fieldProps: { value: r, onChange: l, onBlur: c, ...m },
217
+ error: o,
218
+ fieldProps: { value: n, onChange: l, onBlur: s, ...c },
216
219
  autoFocus: d
217
- } = u(), { onChange: S, onBlur: _, ...b } = i, P = (k) => {
220
+ } = g(), { onChange: S, onBlur: u, ...f } = i, I = (k) => {
218
221
  const B = k.target.files;
219
222
  l(B);
220
223
  };
221
- return /* @__PURE__ */ o(
222
- le,
224
+ return /* @__PURE__ */ r(
225
+ be,
223
226
  {
224
227
  id: e.name,
225
228
  autoFocus: d,
226
- "data-value": r,
227
- "data-invalid": a(!!n),
228
- ...b,
229
- ...m,
230
- onChange: F(S, P),
231
- onBlur: F(_, c)
229
+ "data-value": n,
230
+ "data-invalid": F(!!o),
231
+ ...f,
232
+ ...c,
233
+ onChange: a(S, I),
234
+ onBlur: a(u, s)
232
235
  }
233
236
  );
234
- }, mi = t(
235
- T,
237
+ }, Pi = t(
238
+ R,
236
239
  {
237
240
  _id: "intelligentForm__FieldTextArea",
238
241
  type: "textarea",
239
242
  asChild: !0,
240
- children: /* @__PURE__ */ o(y, { rows: 1, maxRows: 8 })
243
+ children: /* @__PURE__ */ r(x, { rows: 1, maxRows: 8 })
241
244
  }
242
- ), se = t(w.Root, {
245
+ ), pe = t(y.Root, {
243
246
  _id: "intelligentForm__FieldCheckbox"
244
- }), di = (i) => {
245
- const { field: e, error: n, fieldProps: r, autoFocus: l } = u(), { onCheckedChange: c, ...m } = i;
246
- return /* @__PURE__ */ o(
247
- se,
247
+ }), hi = (i) => {
248
+ const { field: e, error: o, fieldProps: n, autoFocus: l } = g(), { onCheckedChange: s, ...c } = i;
249
+ return /* @__PURE__ */ r(
250
+ pe,
248
251
  {
249
252
  id: e.name,
250
253
  name: e.name,
251
254
  autoFocus: l,
252
- "data-invalid": a(!!n),
253
- checked: r.value,
254
- onCheckedChange: F(c, r.onChange),
255
- ...m
255
+ "data-invalid": F(!!o),
256
+ checked: n.value,
257
+ onCheckedChange: a(s, n.onChange),
258
+ ...c
256
259
  }
257
260
  );
258
- }, ai = t(w.Indicator, {
261
+ }, fi = t(y.Indicator, {
259
262
  _id: "intelligentForm__FieldCheckboxIndicator",
260
- children: /* @__PURE__ */ o(U, {})
261
- }), ce = t(q, {
263
+ children: /* @__PURE__ */ r(Z, {})
264
+ }), Ce = t(q, {
262
265
  _id: "intelligentForm__FieldSelect"
263
- }), Fi = (i) => {
264
- const { field: e, error: n, fieldProps: r } = u(), { onValueChange: l, ...c } = i;
265
- return /* @__PURE__ */ o(
266
- ce,
266
+ }), xi = (i) => {
267
+ const { field: e, error: o, fieldProps: n } = g(), { onValueChange: l, ...s } = i;
268
+ return /* @__PURE__ */ r(
269
+ Ce,
267
270
  {
268
271
  name: e.name,
269
- "data-invalid": a(!!n),
270
- value: r.value,
271
- onValueChange: F(l, r.onChange),
272
- ...c
272
+ "data-invalid": F(!!o),
273
+ value: n.value,
274
+ onValueChange: a(l, n.onChange),
275
+ ...s
273
276
  }
274
277
  );
275
- }, ui = t(A, {
278
+ }, yi = t(A, {
276
279
  _id: "intelligentForm__FieldSelect__Trigger"
277
- }), me = t(M, {
280
+ }), Ie = t(M, {
278
281
  _id: "intelligentForm__FieldSelect__Value"
279
- }), _i = (i) => {
280
- const { field: e } = u();
281
- return /* @__PURE__ */ o(
282
- me,
282
+ }), wi = (i) => {
283
+ const { field: e } = g();
284
+ return /* @__PURE__ */ r(
285
+ Ie,
283
286
  {
284
287
  placeholder: "placeholder" in e ? e.placeholder : void 0,
285
288
  ...i
286
289
  }
287
290
  );
288
- }, gi = t(L, {
291
+ }, Ti = t(V, {
289
292
  _id: "intelligentForm__FieldSelect__Icon",
290
293
  asChild: !0,
291
- children: /* @__PURE__ */ o(g, { iconSettings: { builtIn: "LuChevronDown" } })
292
- }), Si = t(V, {
294
+ children: /* @__PURE__ */ r(_, { iconSettings: { builtIn: "LuChevronDown" } })
295
+ }), Ri = t(L, {
293
296
  _id: "intelligentForm__FieldSelect__Content",
294
297
  position: "popper"
295
- }), pi = t(H, {
298
+ }), ki = t(H, {
296
299
  _id: "intelligentForm__FieldSelect__Viewport"
297
- }), vi = t(E, {
300
+ }), Bi = t(E, {
298
301
  _id: "intelligentForm__FieldSelect__Item"
299
- }), Ii = t(D, {
302
+ }), Ai = t(D, {
300
303
  _id: "intelligentForm__FieldSelect__ItemText"
301
- }), Pi = t(
304
+ }), Vi = t(
302
305
  N,
303
306
  {
304
307
  _id: "intelligentForm__FieldSelect__ItemIndicator",
305
308
  asChild: !0,
306
- children: /* @__PURE__ */ o(g, { iconSettings: { builtIn: "LuCheck" } })
309
+ children: /* @__PURE__ */ r(_, { iconSettings: { builtIn: "LuCheck" } })
307
310
  }
308
- ), de = t("span", {
311
+ ), Li = (i) => {
312
+ const { field: e, error: o, fieldProps: n, autoFocus: l } = g(), s = ne();
313
+ if (e.inputType !== "combobox") return null;
314
+ const { onValueChange: c, children: d, ...S } = i, u = s?.shadowHost ? () => s.shadowHost.shadowRoot ?? document : void 0;
315
+ return /* @__PURE__ */ r(
316
+ z,
317
+ {
318
+ ...S,
319
+ id: e.name,
320
+ name: e.name,
321
+ items: e.items ?? [],
322
+ defaultValue: e.defaultValue,
323
+ onValueChange: a(c, n.onChange),
324
+ multiple: e.multiple,
325
+ placeholder: "placeholder" in e ? e.placeholder : void 0,
326
+ invalid: !!o,
327
+ autoFocus: l,
328
+ getRootNode: u,
329
+ children: d
330
+ }
331
+ );
332
+ }, Hi = t(O, {
333
+ _id: "intelligentForm__FieldCombobox__Control"
334
+ }), Ei = t(U, {
335
+ _id: "intelligentForm__FieldCombobox__Input"
336
+ }), Di = t(j, {
337
+ _id: "intelligentForm__FieldCombobox__Trigger",
338
+ children: /* @__PURE__ */ r(_, { iconSettings: { builtIn: "LuChevronDown" } })
339
+ }), Ni = t(Q, {
340
+ _id: "intelligentForm__FieldCombobox__Positioner"
341
+ }), qi = t(W, {
342
+ _id: "intelligentForm__FieldCombobox__Content"
343
+ }), Mi = t($, {
344
+ _id: "intelligentForm__FieldCombobox__Item"
345
+ }), zi = t(G, {
346
+ _id: "intelligentForm__FieldCombobox__ItemText"
347
+ }), Oi = t(J, {
348
+ _id: "intelligentForm__FieldCombobox__SelectedTags"
349
+ }), Ui = t(K, {
350
+ _id: "intelligentForm__FieldCombobox__ItemIndicator",
351
+ children: /* @__PURE__ */ r(_, { iconSettings: { builtIn: "LuCheck" } })
352
+ }), ve = t("span", {
309
353
  _id: "intelligentForm__FieldError"
310
- }), fi = (i) => {
311
- const { error: e } = u();
312
- return e ? /* @__PURE__ */ o(de, { children: e.message?.toString(), ...i }) : null;
313
- }, hi = t("div", {
354
+ }), ji = (i) => {
355
+ const { error: e } = g();
356
+ return e ? /* @__PURE__ */ r(ve, { children: e.message?.toString(), ...i }) : null;
357
+ }, Qi = t("div", {
314
358
  _id: "intelligentForm__BotHeading"
315
- }), Ci = t(g, {
359
+ }), Wi = t(_, {
316
360
  _id: "intelligentForm__BotHeading__Icon",
317
361
  iconSettings: { builtIn: "LuSparkles" }
318
- }), ae = t("div", {
362
+ }), Pe = t("div", {
319
363
  _id: "intelligentForm__BotHeading__Name"
320
- }), bi = (i) => {
321
- const { baseSettings: e } = R(), { organizationDisplayName: n } = e ?? {}, {
322
- formSettings: { aiAssistantName: r }
323
- } = s();
324
- return /* @__PURE__ */ o(ae, { children: r ?? n, ...i });
325
- }, Fe = t("div", {
364
+ }), $i = (i) => {
365
+ const { baseSettings: e } = w(), { organizationDisplayName: o } = e ?? {}, {
366
+ formSettings: { aiAssistantName: n }
367
+ } = m();
368
+ return /* @__PURE__ */ r(Pe, { children: n ?? o, ...i });
369
+ }, he = t("div", {
326
370
  _id: "intelligentForm__Loading"
327
- }), yi = v(({ ...i }, e) => {
328
- const { loading: n } = s(), r = f(null), l = I(e, r);
329
- return h(() => {
330
- n && r.current && r.current.scrollIntoView({
371
+ }), Gi = p(({ ...i }, e) => {
372
+ const { loading: o } = m(), n = v(null), l = C(e, n);
373
+ return P(() => {
374
+ o && n.current && n.current.scrollIntoView({
331
375
  behavior: "smooth",
332
376
  block: "nearest",
333
377
  inline: "nearest"
334
378
  });
335
- }, [n]), n ? /* @__PURE__ */ o(Fe, { ref: l, ...i }) : null;
336
- }), ue = t("div", {
379
+ }, [o]), o ? /* @__PURE__ */ r(he, { ref: l, ...i }) : null;
380
+ }), fe = t("div", {
337
381
  _id: "intelligentForm__ConfidentResponse"
338
- }), wi = v(({ ...i }, e) => {
339
- const { aiResponse: n, loading: r } = s(), l = f(null), c = I(e, l);
340
- return h(() => {
341
- !r && n.answerConfidence && l.current && l.current.scrollIntoView({
382
+ }), Ji = p(({ ...i }, e) => {
383
+ const { aiResponse: o, loading: n } = m(), l = v(null), s = C(e, l);
384
+ return P(() => {
385
+ !n && o.answerConfidence && l.current && l.current.scrollIntoView({
342
386
  behavior: "smooth",
343
387
  block: "nearest",
344
388
  inline: "nearest"
345
389
  });
346
- }, [r, n.answerConfidence]), n.answerConfidence ? /* @__PURE__ */ o(ue, { ref: c, ...i }) : null;
347
- }), _e = t(W, {
390
+ }, [n, o.answerConfidence]), o.answerConfidence ? /* @__PURE__ */ r(fe, { ref: s, ...i }) : null;
391
+ }), xe = t(te, {
348
392
  _id: "intelligentForm__ConfidentAnswer"
349
- }), Ri = (i) => {
350
- const { aiResponse: e } = s();
351
- return /* @__PURE__ */ o(_e, { shouldOpenLinksInNewTab: !0, children: e.answer, ...i });
352
- }, ge = t("button", {
393
+ }), Ki = (i) => {
394
+ const { aiResponse: e } = m();
395
+ return /* @__PURE__ */ r(xe, { shouldOpenLinksInNewTab: !0, children: e.answer, ...i });
396
+ }, ye = t("button", {
353
397
  _id: "intelligentForm__ConfidentResponseButton",
354
398
  type: "button"
355
- }), xi = (i) => {
356
- const { onClick: e, ...n } = i, { showSecondaryFields: r, setShowSecondaryFields: l } = s(), c = () => {
399
+ }), Xi = (i) => {
400
+ const { onClick: e, ...o } = i, { showSecondaryFields: n, setShowSecondaryFields: l } = m(), s = () => {
357
401
  l(!0);
358
402
  };
359
- return /* @__PURE__ */ o(
360
- ge,
403
+ return /* @__PURE__ */ r(
404
+ ye,
361
405
  {
362
- "data-escalated": a(r),
363
- onClick: F(e, c),
364
- ...n
406
+ "data-escalated": F(n),
407
+ onClick: a(e, s),
408
+ ...o
365
409
  }
366
410
  );
367
- }, Ti = t(g, {
411
+ }, Yi = t(_, {
368
412
  _id: "intelligentForm__ConfidentResponseButton__Icon",
369
413
  iconSettings: { builtIn: "LuUser" }
370
- }), ki = t("span", {
414
+ }), Zi = t("span", {
371
415
  _id: "intelligentForm__ConfidentResponseButton__Label",
372
416
  children: "Escalate to human"
373
- }), Se = t("div", {
417
+ }), we = t("div", {
374
418
  _id: "intelligentForm__SecondaryForm"
375
- }), Bi = v(({ ...i }, e) => {
376
- const { showSecondaryFields: n } = s(), r = f(null), l = I(e, r);
377
- return h(() => {
378
- n && r.current && r.current.scrollIntoView({
419
+ }), et = p(({ ...i }, e) => {
420
+ const { showSecondaryFields: o } = m(), n = v(null), l = C(e, n);
421
+ return P(() => {
422
+ o && n.current && n.current.scrollIntoView({
379
423
  behavior: "smooth",
380
424
  block: "nearest",
381
425
  inline: "nearest"
382
426
  });
383
- }, [n]), n ? /* @__PURE__ */ o(Se, { ref: l, ...i }) : null;
384
- }), pe = t("p", {
427
+ }, [o]), o ? /* @__PURE__ */ r(we, { ref: l, ...i }) : null;
428
+ }), Te = t("p", {
385
429
  _id: "intelligentForm__SecondaryForm__Description"
386
- }), Ai = (i) => {
430
+ }), it = (i) => {
387
431
  const {
388
432
  formSettings: { secondary: e },
389
- aiResponse: { answerConfidence: n }
390
- } = s();
433
+ aiResponse: { answerConfidence: o }
434
+ } = m();
391
435
  if (!e.description) return null;
392
- const r = typeof e.description == "string" ? e.description : (
436
+ const n = typeof e.description == "string" ? e.description : (
393
437
  // If description is an object, use the confident description if the answer is confident
394
- n ? e.description.confident : e.description.default
438
+ o ? e.description.confident : e.description.default
395
439
  );
396
- return /* @__PURE__ */ o(pe, { children: r, ...i });
397
- }, ve = t("div", {
440
+ return /* @__PURE__ */ r(Te, { children: n, ...i });
441
+ }, Re = t("div", {
398
442
  _id: "intelligentForm__SecondaryFormFields"
399
- }), Li = (i) => {
400
- const { children: e, ...n } = i, {
401
- formSettings: { secondary: r }
402
- } = s();
403
- return /* @__PURE__ */ o(ve, { children: C(e, r.fields), ...n });
404
- }, Ie = t("button", {
443
+ }), tt = (i) => {
444
+ const { children: e, ...o } = i, {
445
+ formSettings: { secondary: n }
446
+ } = m();
447
+ return /* @__PURE__ */ r(Re, { children: h(e, n.fields), ...o });
448
+ }, ke = t("button", {
405
449
  _id: "intelligentForm__SecondaryFormSubmit",
406
450
  type: "submit",
407
451
  children: "Submit"
408
- }), Vi = (i) => {
409
- const { formSettings: e, isSubmitting: n } = s(), { label: r } = e.buttons.submit;
410
- return /* @__PURE__ */ o(Ie, { disabled: n, children: r ?? "Submit", ...i });
411
- }, Pe = t("span", {
452
+ }), ot = (i) => {
453
+ const { formSettings: e, isSubmitting: o } = m(), { label: n } = e.buttons.submit;
454
+ return /* @__PURE__ */ r(ke, { disabled: o, children: n ?? "Submit", ...i });
455
+ }, Be = t("span", {
412
456
  _id: "intelligentForm__Error"
413
- }), Hi = (i) => {
414
- const { formError: e } = s();
415
- return e ? /* @__PURE__ */ o(Pe, { children: e.message, ...i }) : null;
416
- }, Ei = t("div", {
457
+ }), nt = (i) => {
458
+ const { formError: e } = m();
459
+ return e ? /* @__PURE__ */ r(Be, { children: e.message, ...i }) : null;
460
+ }, rt = t("div", {
417
461
  _id: "intelligentForm__Sources"
418
- }), Di = t("p", {
462
+ }), lt = t("p", {
419
463
  _id: "intelligentForm__SourcesCaption",
420
464
  children: "Here are the sources I considered:"
421
- }), fe = t("div", {
465
+ }), Ae = t("div", {
422
466
  _id: "intelligentForm__SourcesList"
423
- }), Ni = (i) => {
424
- const { children: e, ...n } = i, {
425
- baseSettings: { transformSource: r, organizationDisplayName: l }
426
- } = R(), {
427
- aiResponse: { recordsConsidered: c }
428
- } = s();
429
- if (!c) return null;
430
- const m = c.reduce((d, S) => {
431
- const _ = $(S, "intelligentFormSource", {
467
+ }), mt = (i) => {
468
+ const { children: e, ...o } = i, {
469
+ baseSettings: { transformSource: n, organizationDisplayName: l }
470
+ } = w(), {
471
+ aiResponse: { recordsConsidered: s }
472
+ } = m();
473
+ if (!s) return null;
474
+ const c = s.reduce((d, S) => {
475
+ const u = oe(S, "intelligentFormSource", {
432
476
  organizationDisplayName: l,
433
- transformSource: r
477
+ transformSource: n
434
478
  });
435
- return d.some((P) => P.url === _.url) || d.push(_), d;
479
+ return d.some((I) => I.url === u.url) || d.push(u), d;
436
480
  }, []);
437
- return /* @__PURE__ */ o(fe, { children: C(e, m), ...n });
438
- }, he = t(Q, {
481
+ return /* @__PURE__ */ r(Ae, { children: h(e, c), ...o });
482
+ }, Ve = t(ie, {
439
483
  _id: "intelligentForm__Source"
440
- }), qi = (i) => {
441
- const { source: e, ...n } = i;
442
- return /* @__PURE__ */ o(j, { source: { ...e, isExternal: !!e.shouldOpenInNewTab }, children: /* @__PURE__ */ o(
443
- he,
484
+ }), st = (i) => {
485
+ const { source: e, ...o } = i;
486
+ return /* @__PURE__ */ r(ee, { source: { ...e, isExternal: !!e.shouldOpenInNewTab }, children: /* @__PURE__ */ r(
487
+ Ve,
444
488
  {
445
489
  "data-type": e.type,
446
490
  appendToUrl: e.appendToUrl,
447
491
  href: e.url,
448
492
  isExternal: e.shouldOpenInNewTab !== !1,
449
- ...n
493
+ ...o
450
494
  }
451
495
  ) });
452
- }, Ce = t(g, {
496
+ }, Le = t(_, {
453
497
  _id: "intelligentForm__SourceIcon"
454
- }), Mi = (i) => {
455
- const { source: e } = x();
456
- return /* @__PURE__ */ o(Ce, { iconSettings: e.icon, "data-type": e.type, ...i });
457
- }, be = t("span", {
498
+ }), ct = (i) => {
499
+ const { source: e } = T();
500
+ return /* @__PURE__ */ r(Le, { iconSettings: e.icon, "data-type": e.type, ...i });
501
+ }, He = t("span", {
458
502
  _id: "intelligentForm__SourceTitle"
459
- }), zi = (i) => {
460
- const { source: e } = x();
461
- return /* @__PURE__ */ o(be, { "data-type": e.type, children: e.title, ...i });
503
+ }), dt = (i) => {
504
+ const { source: e } = T();
505
+ return /* @__PURE__ */ r(He, { "data-type": e.type, children: e.title, ...i });
462
506
  };
463
507
  export {
464
- hi as BotHeading,
465
- Ci as BotHeadingIcon,
466
- bi as BotHeadingName,
467
- Ri as ConfidentAnswer,
468
- wi as ConfidentResponse,
469
- xi as ConfidentResponseButton,
470
- Ti as ConfidentResponseButtonIcon,
471
- ki as ConfidentResponseButtonLabel,
472
- Qe as Content,
473
- We as ContentScrollArea,
474
- Ke as ContentScrollAreaCorner,
475
- Ge as ContentScrollAreaScrollbar,
476
- Je as ContentScrollAreaThumb,
477
- $e as ContentScrollAreaViewport,
478
- Hi as Error,
479
- oi as FormField,
480
- di as FormFieldCheckbox,
481
- ai as FormFieldCheckboxIndicator,
482
- si as FormFieldEmail,
483
- fi as FormFieldError,
484
- ci as FormFieldFile,
485
- li as FormFieldLabel,
486
- Fi as FormFieldSelect,
487
- Si as FormFieldSelectContent,
488
- gi as FormFieldSelectIcon,
489
- vi as FormFieldSelectItem,
490
- Pi as FormFieldSelectItemIndicator,
491
- Ii as FormFieldSelectItemText,
492
- ui as FormFieldSelectTrigger,
493
- _i as FormFieldSelectValue,
494
- pi as FormFieldSelectViewport,
495
- T as FormFieldText,
496
- mi as FormFieldTextArea,
497
- je as Heading,
498
- hi as IntelligentFormPrimitiveBotHeading,
499
- Ci as IntelligentFormPrimitiveBotHeadingIcon,
500
- bi as IntelligentFormPrimitiveBotHeadingName,
501
- Ri as IntelligentFormPrimitiveConfidentAnswer,
502
- wi as IntelligentFormPrimitiveConfidentResponse,
503
- xi as IntelligentFormPrimitiveConfidentResponseButton,
504
- Ti as IntelligentFormPrimitiveConfidentResponseButtonIcon,
505
- ki as IntelligentFormPrimitiveConfidentResponseButtonLabel,
506
- Qe as IntelligentFormPrimitiveContent,
507
- We as IntelligentFormPrimitiveContentScrollArea,
508
- Ke as IntelligentFormPrimitiveContentScrollAreaCorner,
509
- Ge as IntelligentFormPrimitiveContentScrollAreaScrollbar,
510
- Je as IntelligentFormPrimitiveContentScrollAreaThumb,
511
- $e as IntelligentFormPrimitiveContentScrollAreaViewport,
512
- Hi as IntelligentFormPrimitiveFormError,
513
- oi as IntelligentFormPrimitiveFormField,
514
- di as IntelligentFormPrimitiveFormFieldCheckbox,
515
- ai as IntelligentFormPrimitiveFormFieldCheckboxIndicator,
516
- si as IntelligentFormPrimitiveFormFieldEmail,
517
- fi as IntelligentFormPrimitiveFormFieldError,
518
- ci as IntelligentFormPrimitiveFormFieldFile,
519
- li as IntelligentFormPrimitiveFormFieldLabel,
520
- Fi as IntelligentFormPrimitiveFormFieldSelect,
521
- Si as IntelligentFormPrimitiveFormFieldSelectContent,
522
- gi as IntelligentFormPrimitiveFormFieldSelectIcon,
523
- vi as IntelligentFormPrimitiveFormFieldSelectItem,
524
- Pi as IntelligentFormPrimitiveFormFieldSelectItemIndicator,
525
- Ii as IntelligentFormPrimitiveFormFieldSelectItemText,
526
- ui as IntelligentFormPrimitiveFormFieldSelectTrigger,
527
- _i as IntelligentFormPrimitiveFormFieldSelectValue,
528
- pi as IntelligentFormPrimitiveFormFieldSelectViewport,
529
- T as IntelligentFormPrimitiveFormFieldText,
530
- mi as IntelligentFormPrimitiveFormFieldTextArea,
531
- je as IntelligentFormPrimitiveHeading,
532
- yi as IntelligentFormPrimitiveLoading,
533
- ii as IntelligentFormPrimitivePrimaryForm,
534
- ti as IntelligentFormPrimitivePrimaryFormDescription,
535
- ni as IntelligentFormPrimitivePrimaryFormFields,
536
- ri as IntelligentFormPrimitivePrimaryFormSubmit,
537
- Ue as IntelligentFormPrimitiveRoot,
538
- Bi as IntelligentFormPrimitiveSecondaryForm,
539
- Ai as IntelligentFormPrimitiveSecondaryFormDescription,
540
- Li as IntelligentFormPrimitiveSecondaryFormFields,
541
- Vi as IntelligentFormPrimitiveSecondaryFormSubmit,
542
- qi as IntelligentFormPrimitiveSource,
543
- Mi as IntelligentFormPrimitiveSourceIcon,
544
- zi as IntelligentFormPrimitiveSourceTitle,
545
- Ei as IntelligentFormPrimitiveSources,
546
- Di as IntelligentFormPrimitiveSourcesCaption,
547
- Ni as IntelligentFormPrimitiveSourcesList,
548
- Xe as IntelligentFormPrimitiveSuccess,
549
- Ze as IntelligentFormPrimitiveSuccessHeading,
550
- Ye as IntelligentFormPrimitiveSuccessIcon,
551
- ei as IntelligentFormPrimitiveSuccessMessage,
552
- yi as Loading,
553
- ii as PrimaryForm,
554
- ti as PrimaryFormDescription,
555
- ni as PrimaryFormFields,
556
- ri as PrimaryFormSubmit,
557
- ji as Provider,
558
- Ue as Root,
559
- Bi as SecondaryForm,
560
- Ai as SecondaryFormDescription,
561
- Li as SecondaryFormFields,
562
- Vi as SecondaryFormSubmit,
563
- qi as Source,
564
- Mi as SourceIcon,
565
- zi as SourceTitle,
566
- Ei as Sources,
567
- Di as SourcesCaption,
568
- Ni as SourcesList,
569
- Xe as Success,
570
- Ze as SuccessHeading,
571
- Ye as SuccessIcon,
572
- ei as SuccessMessage
508
+ Qi as BotHeading,
509
+ Wi as BotHeadingIcon,
510
+ $i as BotHeadingName,
511
+ Ki as ConfidentAnswer,
512
+ Ji as ConfidentResponse,
513
+ Xi as ConfidentResponseButton,
514
+ Yi as ConfidentResponseButtonIcon,
515
+ Zi as ConfidentResponseButtonLabel,
516
+ ni as Content,
517
+ ri as ContentScrollArea,
518
+ ci as ContentScrollAreaCorner,
519
+ mi as ContentScrollAreaScrollbar,
520
+ si as ContentScrollAreaThumb,
521
+ li as ContentScrollAreaViewport,
522
+ nt as Error,
523
+ pi as FormField,
524
+ hi as FormFieldCheckbox,
525
+ fi as FormFieldCheckboxIndicator,
526
+ Li as FormFieldCombobox,
527
+ qi as FormFieldComboboxContent,
528
+ Hi as FormFieldComboboxControl,
529
+ Ei as FormFieldComboboxInput,
530
+ Mi as FormFieldComboboxItem,
531
+ Ui as FormFieldComboboxItemIndicator,
532
+ zi as FormFieldComboboxItemText,
533
+ Ni as FormFieldComboboxPositioner,
534
+ Oi as FormFieldComboboxSelectedTags,
535
+ Di as FormFieldComboboxTrigger,
536
+ Ii as FormFieldEmail,
537
+ ji as FormFieldError,
538
+ vi as FormFieldFile,
539
+ Ci as FormFieldLabel,
540
+ xi as FormFieldSelect,
541
+ Ri as FormFieldSelectContent,
542
+ Ti as FormFieldSelectIcon,
543
+ Bi as FormFieldSelectItem,
544
+ Vi as FormFieldSelectItemIndicator,
545
+ Ai as FormFieldSelectItemText,
546
+ yi as FormFieldSelectTrigger,
547
+ wi as FormFieldSelectValue,
548
+ ki as FormFieldSelectViewport,
549
+ R as FormFieldText,
550
+ Pi as FormFieldTextArea,
551
+ oi as Heading,
552
+ Qi as IntelligentFormPrimitiveBotHeading,
553
+ Wi as IntelligentFormPrimitiveBotHeadingIcon,
554
+ $i as IntelligentFormPrimitiveBotHeadingName,
555
+ Ki as IntelligentFormPrimitiveConfidentAnswer,
556
+ Ji as IntelligentFormPrimitiveConfidentResponse,
557
+ Xi as IntelligentFormPrimitiveConfidentResponseButton,
558
+ Yi as IntelligentFormPrimitiveConfidentResponseButtonIcon,
559
+ Zi as IntelligentFormPrimitiveConfidentResponseButtonLabel,
560
+ ni as IntelligentFormPrimitiveContent,
561
+ ri as IntelligentFormPrimitiveContentScrollArea,
562
+ ci as IntelligentFormPrimitiveContentScrollAreaCorner,
563
+ mi as IntelligentFormPrimitiveContentScrollAreaScrollbar,
564
+ si as IntelligentFormPrimitiveContentScrollAreaThumb,
565
+ li as IntelligentFormPrimitiveContentScrollAreaViewport,
566
+ nt as IntelligentFormPrimitiveFormError,
567
+ pi as IntelligentFormPrimitiveFormField,
568
+ hi as IntelligentFormPrimitiveFormFieldCheckbox,
569
+ fi as IntelligentFormPrimitiveFormFieldCheckboxIndicator,
570
+ Li as IntelligentFormPrimitiveFormFieldCombobox,
571
+ qi as IntelligentFormPrimitiveFormFieldComboboxContent,
572
+ Hi as IntelligentFormPrimitiveFormFieldComboboxControl,
573
+ Ei as IntelligentFormPrimitiveFormFieldComboboxInput,
574
+ Mi as IntelligentFormPrimitiveFormFieldComboboxItem,
575
+ Ui as IntelligentFormPrimitiveFormFieldComboboxItemIndicator,
576
+ zi as IntelligentFormPrimitiveFormFieldComboboxItemText,
577
+ Ni as IntelligentFormPrimitiveFormFieldComboboxPositioner,
578
+ Oi as IntelligentFormPrimitiveFormFieldComboboxSelectedTags,
579
+ Di as IntelligentFormPrimitiveFormFieldComboboxTrigger,
580
+ Ii as IntelligentFormPrimitiveFormFieldEmail,
581
+ ji as IntelligentFormPrimitiveFormFieldError,
582
+ vi as IntelligentFormPrimitiveFormFieldFile,
583
+ Ci as IntelligentFormPrimitiveFormFieldLabel,
584
+ xi as IntelligentFormPrimitiveFormFieldSelect,
585
+ Ri as IntelligentFormPrimitiveFormFieldSelectContent,
586
+ Ti as IntelligentFormPrimitiveFormFieldSelectIcon,
587
+ Bi as IntelligentFormPrimitiveFormFieldSelectItem,
588
+ Vi as IntelligentFormPrimitiveFormFieldSelectItemIndicator,
589
+ Ai as IntelligentFormPrimitiveFormFieldSelectItemText,
590
+ yi as IntelligentFormPrimitiveFormFieldSelectTrigger,
591
+ wi as IntelligentFormPrimitiveFormFieldSelectValue,
592
+ ki as IntelligentFormPrimitiveFormFieldSelectViewport,
593
+ R as IntelligentFormPrimitiveFormFieldText,
594
+ Pi as IntelligentFormPrimitiveFormFieldTextArea,
595
+ oi as IntelligentFormPrimitiveHeading,
596
+ Gi as IntelligentFormPrimitiveLoading,
597
+ _i as IntelligentFormPrimitivePrimaryForm,
598
+ gi as IntelligentFormPrimitivePrimaryFormDescription,
599
+ Si as IntelligentFormPrimitivePrimaryFormFields,
600
+ bi as IntelligentFormPrimitivePrimaryFormSubmit,
601
+ ti as IntelligentFormPrimitiveRoot,
602
+ et as IntelligentFormPrimitiveSecondaryForm,
603
+ it as IntelligentFormPrimitiveSecondaryFormDescription,
604
+ tt as IntelligentFormPrimitiveSecondaryFormFields,
605
+ ot as IntelligentFormPrimitiveSecondaryFormSubmit,
606
+ st as IntelligentFormPrimitiveSource,
607
+ ct as IntelligentFormPrimitiveSourceIcon,
608
+ dt as IntelligentFormPrimitiveSourceTitle,
609
+ rt as IntelligentFormPrimitiveSources,
610
+ lt as IntelligentFormPrimitiveSourcesCaption,
611
+ mt as IntelligentFormPrimitiveSourcesList,
612
+ di as IntelligentFormPrimitiveSuccess,
613
+ Fi as IntelligentFormPrimitiveSuccessHeading,
614
+ ai as IntelligentFormPrimitiveSuccessIcon,
615
+ ui as IntelligentFormPrimitiveSuccessMessage,
616
+ Gi as Loading,
617
+ _i as PrimaryForm,
618
+ gi as PrimaryFormDescription,
619
+ Si as PrimaryFormFields,
620
+ bi as PrimaryFormSubmit,
621
+ gt as Provider,
622
+ ti as Root,
623
+ et as SecondaryForm,
624
+ it as SecondaryFormDescription,
625
+ tt as SecondaryFormFields,
626
+ ot as SecondaryFormSubmit,
627
+ st as Source,
628
+ ct as SourceIcon,
629
+ dt as SourceTitle,
630
+ rt as Sources,
631
+ lt as SourcesCaption,
632
+ mt as SourcesList,
633
+ di as Success,
634
+ Fi as SuccessHeading,
635
+ ai as SuccessIcon,
636
+ ui as SuccessMessage,
637
+ ut as useComboboxItems
573
638
  };