@zealsolutions/zeal-ui 1.0.0-alpha.358 → 1.0.0-alpha.360

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.
@@ -0,0 +1,68 @@
1
+ import { openBlock as a, createElementBlock as l, createElementVNode as t, normalizeClass as n, createTextVNode as r, toDisplayString as s, createCommentVNode as o, createVNode as d, withCtx as c, renderSlot as f } from "vue";
2
+ import { _ as m } from "./TruncateText-BOyOYUV6.js";
3
+ const u = { class: "flex justify-between text-style-label select-none" }, h = { class: "flex items-baseline gap-x-2 min-w-0 pr-5" }, x = ["for"], y = {
4
+ key: 0,
5
+ class: "text-app-950"
6
+ }, p = { class: "flex mt-2.5" }, _ = {
7
+ __name: "FormField",
8
+ props: {
9
+ label: {
10
+ type: String,
11
+ default: ""
12
+ },
13
+ errorMessage: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ required: {
18
+ type: Boolean,
19
+ default: !1
20
+ },
21
+ disabled: {
22
+ type: Boolean,
23
+ default: !1
24
+ },
25
+ // SOP-Admin #435: optional grey helper text shown beside the label.
26
+ hint: {
27
+ type: String,
28
+ default: ""
29
+ },
30
+ // #435: when true the hint renders in the error colour (limit hit).
31
+ hintError: {
32
+ type: Boolean,
33
+ default: !1
34
+ }
35
+ },
36
+ setup(e) {
37
+ return (i, b) => (a(), l("div", null, [
38
+ t("div", u, [
39
+ t("div", h, [
40
+ t("label", {
41
+ for: e.label,
42
+ class: n(["whitespace-nowrap font-medium", e.disabled ? "text-steel-800" : ""])
43
+ }, [
44
+ r(s(e.label), 1),
45
+ e.required ? (a(), l("span", y, " *")) : o("", !0)
46
+ ], 10, x),
47
+ e.hint ? (a(), l("span", {
48
+ key: 0,
49
+ "data-testid": "field-hint",
50
+ class: n(["whitespace-nowrap font-medium", e.hintError ? "text-error-950" : "text-steel-800 dark:text-content-muted"])
51
+ }, s(e.hint), 3)) : o("", !0)
52
+ ]),
53
+ d(m, { class: "text-error-950 select-none" }, {
54
+ default: c(() => [
55
+ r(s(e.errorMessage), 1)
56
+ ]),
57
+ _: 1
58
+ })
59
+ ]),
60
+ t("div", p, [
61
+ f(i.$slots, "default")
62
+ ])
63
+ ]));
64
+ }
65
+ };
66
+ export {
67
+ _
68
+ };
@@ -0,0 +1,71 @@
1
+ import { mergeModels as a, useModel as m, computed as g, openBlock as i, createElementBlock as h, normalizeClass as s, renderSlot as x, withDirectives as b, createElementVNode as y, vModelDynamic as k, createBlock as v, createCommentVNode as w } from "vue";
2
+ import B from "./CircleExclamationIcon-vvAjN3c9.js";
3
+ const E = ["name", "type", "placeholder", "disabled", "maxlength"], I = {
4
+ __name: "InputField",
5
+ props: /* @__PURE__ */ a({
6
+ hasError: {
7
+ type: Boolean,
8
+ default: !1
9
+ },
10
+ label: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ placeholder: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ fieldType: {
19
+ type: String,
20
+ default: "text"
21
+ },
22
+ disabled: {
23
+ type: Boolean,
24
+ default: !1
25
+ },
26
+ // SOP-Admin #435: native character cap. `maxlength` blocks typing past the limit; combined with
27
+ // the `overflow` event below it lets a wrapper warn the user when they try to exceed it.
28
+ maxlength: {
29
+ type: Number,
30
+ default: null
31
+ }
32
+ }, {
33
+ modelValue: {},
34
+ modelModifiers: {}
35
+ }),
36
+ emits: /* @__PURE__ */ a(["blur", "overflow"], ["update:modelValue"]),
37
+ setup(e, { emit: d }) {
38
+ const t = e, o = d, l = m(e, "modelValue"), u = () => {
39
+ o("blur");
40
+ }, c = (r) => {
41
+ if (t.maxlength == null)
42
+ return;
43
+ String(r.inputType || "").startsWith("insert") && String(l.value ?? "").length >= t.maxlength && o("overflow");
44
+ }, p = g(() => t.hasError && !t.disabled ? "ring-error-950 focus-within:bg-error-100 focus-within:ring-error-950 text-error-950" : t.disabled ? "ring-steel-500 dark:ring-line-strong bg-steel-100 dark:bg-surface cursor-not-allowed" : "ring-steel-500 dark:ring-line-strong focus-within:bg-app-100 focus-within:ring-app-950 dark:focus-within:text-black-950 text-black-950 dark:text-content");
45
+ return (r, n) => (i(), h("div", {
46
+ class: s(["relative flex flex-1 gap-x-2 px-4 text-style-input items-center h-10 rounded-[20px] ring-1 ring-inset focus-within:ring-2 focus-within:outline-none", p.value])
47
+ }, [
48
+ x(r.$slots, "icon"),
49
+ b(y("input", {
50
+ "onUpdate:modelValue": n[0] || (n[0] = (f) => l.value = f),
51
+ name: e.label,
52
+ onBlur: u,
53
+ onBeforeinput: c,
54
+ type: e.fieldType,
55
+ class: s(["flex-1 border-0 bg-[transparent] pl-0 ring-0 focus:ring-0 outline-none focus:outline-none disabled:placeholder:text-steel-800 dark:disabled:placeholder:text-content-muted disabled:pointer-events-none", e.hasError ? " focus:placeholder:text-error-950 pr-6" : "placeholder:text-steel-950 dark:placeholder:text-content-muted pr-0"]),
56
+ placeholder: e.placeholder,
57
+ disabled: e.disabled,
58
+ maxlength: e.maxlength
59
+ }, null, 42, E), [
60
+ [k, l.value]
61
+ ]),
62
+ e.hasError ? (i(), v(B, {
63
+ key: 0,
64
+ class: "absolute top-1/2 -translate-y-1/2 right-3 scale-[0.8182] pointer-events-none text-error-950"
65
+ })) : w("", !0)
66
+ ], 2));
67
+ }
68
+ };
69
+ export {
70
+ I as _
71
+ };
@@ -1,19 +1,19 @@
1
- import { openBlock as n, createElementBlock as b, createElementVNode as p, renderSlot as o, mergeModels as d, useModel as y, computed as s, createBlock as h, withCtx as g, createVNode as x } from "vue";
2
- import { _ as B } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
3
- import { _ as V } from "../../FormField-XR9nvyQr.js";
4
- import { _ as v } from "../../InputField-BrSFZ5Eu.js";
5
- const _ = {}, F = { class: "flex flex-col space-y-12" }, $ = { class: "flex flex-col space-y-6" };
6
- function q(e, l) {
7
- return n(), b("div", F, [
8
- p("form", $, [
9
- o(e.$slots, "default")
1
+ import { openBlock as f, createElementBlock as g, createElementVNode as p, renderSlot as u, mergeModels as i, useModel as x, computed as m, ref as y, watch as v, createBlock as B, withCtx as V, createVNode as S } from "vue";
2
+ import { _ as $ } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
3
+ import { _ as F } from "../../FormField-CrpT1GTF.js";
4
+ import { _ as q } from "../../InputField-D6bS7qJm.js";
5
+ const M = {}, k = { class: "flex flex-col space-y-12" }, w = { class: "flex flex-col space-y-6" };
6
+ function E(e, o) {
7
+ return f(), g("div", k, [
8
+ p("form", w, [
9
+ u(e.$slots, "default")
10
10
  ]),
11
- o(e.$slots, "footer")
11
+ u(e.$slots, "footer")
12
12
  ]);
13
13
  }
14
- const I = /* @__PURE__ */ B(_, [["render", q]]), N = {
14
+ const T = /* @__PURE__ */ $(M, [["render", E]]), A = {
15
15
  __name: "FormInput",
16
- props: /* @__PURE__ */ d({
16
+ props: /* @__PURE__ */ i({
17
17
  required: {
18
18
  type: Boolean,
19
19
  default: !1
@@ -37,40 +37,58 @@ const I = /* @__PURE__ */ B(_, [["render", q]]), N = {
37
37
  disabled: {
38
38
  type: Boolean,
39
39
  default: !1
40
+ },
41
+ // SOP-Admin #435: native character cap passed to the input.
42
+ maxlength: {
43
+ type: Number,
44
+ default: null
45
+ },
46
+ // #435: grey helper text beside the label that turns red when the user tries to exceed maxlength.
47
+ hint: {
48
+ type: String,
49
+ default: ""
40
50
  }
41
51
  }, {
42
52
  modelValue: {},
43
53
  modelModifiers: {}
44
54
  }),
45
- emits: /* @__PURE__ */ d(["blur"], ["update:modelValue"]),
46
- setup(e, { emit: l }) {
47
- const u = e, i = l, r = y(e, "modelValue"), c = s(() => a.value.length > 0), m = () => {
48
- i("blur");
49
- }, a = s(() => Array.from(u.errors).join(", "));
50
- return (M, t) => (n(), h(V, {
55
+ emits: /* @__PURE__ */ i(["blur"], ["update:modelValue"]),
56
+ setup(e, { emit: o }) {
57
+ const t = e, c = o, r = x(e, "modelValue"), h = m(() => d.value.length > 0), a = y(!1);
58
+ v(r, (n) => {
59
+ (t.maxlength == null || String(n ?? "").length < t.maxlength) && (a.value = !1);
60
+ });
61
+ const b = () => {
62
+ c("blur");
63
+ }, d = m(() => Array.from(t.errors).join(", "));
64
+ return (n, l) => (f(), B(F, {
51
65
  label: e.label,
52
- "error-message": a.value,
66
+ "error-message": d.value,
53
67
  required: e.required,
54
- disabled: e.disabled
68
+ disabled: e.disabled,
69
+ hint: e.hint,
70
+ "hint-error": a.value
55
71
  }, {
56
- default: g(() => [
57
- x(v, {
72
+ default: V(() => [
73
+ S(q, {
58
74
  modelValue: r.value,
59
- "onUpdate:modelValue": t[0] || (t[0] = (f) => r.value = f),
60
- "has-error": c.value,
75
+ "onUpdate:modelValue": l[0] || (l[0] = (s) => r.value = s),
76
+ "has-error": h.value,
61
77
  placeholder: e.placeholder,
62
78
  "field-type": e.fieldType,
63
79
  label: e.label,
64
80
  disabled: e.disabled,
65
- onBlur: m
66
- }, null, 8, ["modelValue", "has-error", "placeholder", "field-type", "label", "disabled"])
81
+ maxlength: e.maxlength,
82
+ onBlur: b,
83
+ onOverflow: l[1] || (l[1] = (s) => a.value = !0)
84
+ }, null, 8, ["modelValue", "has-error", "placeholder", "field-type", "label", "disabled", "maxlength"])
67
85
  ]),
68
86
  _: 1
69
- }, 8, ["label", "error-message", "required", "disabled"]));
87
+ }, 8, ["label", "error-message", "required", "disabled", "hint", "hint-error"]));
70
88
  }
71
89
  };
72
90
  export {
73
- I as BaseForm,
74
- V as FormField,
75
- N as FormInput
91
+ T as BaseForm,
92
+ F as FormField,
93
+ A as FormInput
76
94
  };
@@ -4,7 +4,7 @@ import $ from "../../CalendarIcon-DjSv5Y23.js";
4
4
  import k from "../../CircleExclamationIcon-vvAjN3c9.js";
5
5
  import E from "../../UploadIcon-DJeF8sKk.js";
6
6
  import M from "../../FilesIcon-NLAyR0HT.js";
7
- import { _ as se } from "../../InputField-BrSFZ5Eu.js";
7
+ import { _ as se } from "../../InputField-D6bS7qJm.js";
8
8
  const I = ["onClick"], le = {
9
9
  __name: "DateInput",
10
10
  props: {