@turquoisehealth/pit-viper 2.255.1 → 2.256.0

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.
@@ -266,6 +266,7 @@ var N = [
266
266
  default: "200px",
267
267
  type: String
268
268
  },
269
+ maxLength: { type: Number },
269
270
  placeholder: {
270
271
  default: "Ask anything...",
271
272
  type: String
@@ -291,53 +292,58 @@ var N = [
291
292
  modelModifiers: {}
292
293
  }),
293
294
  emits: /* @__PURE__ */ d(["submit", "stop"], ["update:modelValue"]),
294
- setup(n, { emit: c }) {
295
- let l = n, u = c, d = C(n, "modelValue"), f = b(), p = t(() => l.status === "submitted" || l.status === "streaming"), m = t(() => !l.disabled && !p.value && d.value.trim().length > 0);
296
- function g() {
297
- m.value && u("submit", d.value.trim());
295
+ setup(n, { expose: c, emit: l }) {
296
+ let u = n, d = l, f = C(n, "modelValue"), p = b(), m = t(() => u.status === "submitted" || u.status === "streaming"), g = t(() => !u.disabled && !m.value && f.value.trim().length > 0);
297
+ function v() {
298
+ g.value && d("submit", f.value.trim());
298
299
  }
299
- function v(e) {
300
- l.disabled || e.target?.closest("button, a, input, textarea, select, [tabindex]") || f.value?.querySelector("textarea")?.focus();
300
+ function y() {
301
+ p.value?.querySelector("textarea")?.focus();
301
302
  }
302
- function y(e) {
303
- e.key !== "Enter" || e.shiftKey || e.isComposing || (e.preventDefault(), e.stopPropagation(), g());
303
+ function S(e) {
304
+ u.disabled || e.target?.closest("button, a, input, textarea, select, [tabindex]") || y();
304
305
  }
305
- return (t, c) => (_(), i("form", {
306
+ function w(e) {
307
+ e.key !== "Enter" || e.shiftKey || e.isComposing || (e.preventDefault(), e.stopPropagation(), v());
308
+ }
309
+ return c({ focus: y }), (t, c) => (_(), i("form", {
306
310
  ref_key: "formRef",
307
- ref: f,
311
+ ref: p,
308
312
  class: "pv-prompt-input pv-bordered pv-radius pv-inset-square-8 pv-flex-vertical",
309
313
  "data-testid": "pv-prompt-input",
310
- "aria-busy": p.value,
311
- onSubmit: D(g, ["prevent"]),
312
- onClick: v
314
+ "aria-busy": m.value,
315
+ onSubmit: D(v, ["prevent"]),
316
+ onClick: S
313
317
  }, [
314
318
  t.$slots.header ? (_(), i("div", de, [x(t.$slots, "header")])) : r("v-if", !0),
315
319
  s(le, {
316
- modelValue: d.value,
317
- "onUpdate:modelValue": c[0] ||= (e) => d.value = e,
320
+ modelValue: f.value,
321
+ "onUpdate:modelValue": c[0] ||= (e) => f.value = e,
318
322
  class: "pv-prompt-input-textarea",
319
323
  style: h({ "--prompt-input-max-height": n.maxHeight }),
320
324
  rows: n.rows,
325
+ maxlength: n.maxLength,
321
326
  placeholder: n.placeholder,
322
327
  disabled: n.disabled,
323
328
  "aria-label": n.ariaLabel,
324
- onKeydown: y
329
+ onKeydown: w
325
330
  }, null, 8, [
326
331
  "modelValue",
327
332
  "style",
328
333
  "rows",
334
+ "maxlength",
329
335
  "placeholder",
330
336
  "disabled",
331
337
  "aria-label"
332
338
  ]),
333
339
  a("div", fe, [a("div", pe, [x(t.$slots, "actions")]), s(ae, {
334
- type: p.value ? "button" : "submit",
335
- variant: p.value ? "secondary" : "primary",
340
+ type: m.value ? "button" : "submit",
341
+ variant: m.value ? "secondary" : "primary",
336
342
  size: "md",
337
- "left-icon": p.value ? "stop" : "send",
338
- "aria-label": p.value ? n.stopLabel : n.submitLabel,
339
- disabled: n.disabled || !p.value && !m.value,
340
- onClick: c[1] ||= (e) => p.value && u("stop")
343
+ "left-icon": m.value ? "stop" : "send",
344
+ "aria-label": m.value ? n.stopLabel : n.submitLabel,
345
+ disabled: n.disabled || !m.value && !g.value,
346
+ onClick: c[1] ||= (e) => m.value && d("stop")
341
347
  }, null, 8, [
342
348
  "type",
343
349
  "variant",