@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.
@@ -580,6 +580,7 @@ var ne = [
580
580
  default: !1
581
581
  },
582
582
  maxHeight: { default: "200px" },
583
+ maxLength: {},
583
584
  placeholder: { default: "Ask anything..." },
584
585
  rows: { default: 1 },
585
586
  status: { default: "ready" },
@@ -590,53 +591,58 @@ var ne = [
590
591
  modelModifiers: {}
591
592
  }),
592
593
  emits: /* @__PURE__ */ p(["submit", "stop"], ["update:modelValue"]),
593
- setup(e, { emit: n }) {
594
- let r = e, a = n, d = A(e, "modelValue"), f = C(), p = i(() => r.status === "submitted" || r.status === "streaming"), m = i(() => !r.disabled && !p.value && d.value.trim().length > 0);
595
- function h() {
596
- m.value && a("submit", d.value.trim());
594
+ setup(e, { expose: n, emit: r }) {
595
+ let a = e, d = r, f = A(e, "modelValue"), p = C(), m = i(() => a.status === "submitted" || a.status === "streaming"), h = i(() => !a.disabled && !m.value && f.value.trim().length > 0);
596
+ function g() {
597
+ h.value && d("submit", f.value.trim());
598
+ }
599
+ function v() {
600
+ p.value?.querySelector("textarea")?.focus();
597
601
  }
598
- function g(e) {
599
- r.disabled || e.target?.closest("button, a, input, textarea, select, [tabindex]") || f.value?.querySelector("textarea")?.focus();
602
+ function y(e) {
603
+ a.disabled || e.target?.closest("button, a, input, textarea, select, [tabindex]") || v();
600
604
  }
601
- function v(e) {
602
- e.key !== "Enter" || e.shiftKey || e.isComposing || (e.preventDefault(), e.stopPropagation(), h());
605
+ function b(e) {
606
+ e.key !== "Enter" || e.shiftKey || e.isComposing || (e.preventDefault(), e.stopPropagation(), g());
603
607
  }
604
- return (n, r) => (S(), s("form", {
608
+ return n({ focus: v }), (n, r) => (S(), s("form", {
605
609
  ref_key: "formRef",
606
- ref: f,
610
+ ref: p,
607
611
  class: "pv-prompt-input pv-bordered pv-radius pv-inset-square-8 pv-flex-vertical",
608
612
  "data-testid": "pv-prompt-input",
609
- "aria-busy": p.value,
610
- onSubmit: R(h, ["prevent"]),
611
- onClick: g
613
+ "aria-busy": m.value,
614
+ onSubmit: R(g, ["prevent"]),
615
+ onClick: y
612
616
  }, [
613
617
  n.$slots.header ? (S(), s("div", ze, [T(n.$slots, "header")])) : o("", !0),
614
618
  u(Le, {
615
- modelValue: d.value,
616
- "onUpdate:modelValue": r[0] ||= (e) => d.value = e,
619
+ modelValue: f.value,
620
+ "onUpdate:modelValue": r[0] ||= (e) => f.value = e,
617
621
  class: "pv-prompt-input-textarea",
618
622
  style: _({ "--prompt-input-max-height": e.maxHeight }),
619
623
  rows: e.rows,
624
+ maxlength: e.maxLength,
620
625
  placeholder: e.placeholder,
621
626
  disabled: e.disabled,
622
627
  "aria-label": e.ariaLabel,
623
- onKeydown: v
628
+ onKeydown: b
624
629
  }, null, 8, [
625
630
  "modelValue",
626
631
  "style",
627
632
  "rows",
633
+ "maxlength",
628
634
  "placeholder",
629
635
  "disabled",
630
636
  "aria-label"
631
637
  ]),
632
638
  c("div", Be, [c("div", Ve, [T(n.$slots, "actions")]), u(q, {
633
- type: p.value ? "button" : "submit",
634
- variant: p.value ? "secondary" : "primary",
639
+ type: m.value ? "button" : "submit",
640
+ variant: m.value ? "secondary" : "primary",
635
641
  size: "md",
636
- "left-icon": p.value ? "stop" : "send",
637
- "aria-label": p.value ? e.stopLabel : e.submitLabel,
638
- disabled: e.disabled || !p.value && !m.value,
639
- onClick: r[1] ||= (e) => p.value && a("stop")
642
+ "left-icon": m.value ? "stop" : "send",
643
+ "aria-label": m.value ? e.stopLabel : e.submitLabel,
644
+ disabled: e.disabled || !m.value && !h.value,
645
+ onClick: r[1] ||= (e) => m.value && d("stop")
640
646
  }, null, 8, [
641
647
  "type",
642
648
  "variant",