@nilloq/ouds-web 0.1.4 → 0.1.5

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,2 +1,2 @@
1
- import { n as e, t } from "./text-input-t-iE4dFj.js";
1
+ import { n as e, t } from "./text-input-CtTr5yfe.js";
2
2
  export { t as OudsTextInput, e as defineOudsTextInput };
package/dist/elements.js CHANGED
@@ -2,7 +2,7 @@ import { a as e, i as t, n, o as r, r as i, t as a } from "./button-BPOKh6G4.js"
2
2
  import { i as o, n as s, r as c, t as l } from "./tag-BY32Hj5n.js";
3
3
  import { n as u, t as d } from "./select-CA6TVlpX.js";
4
4
  import { n as f, t as p } from "./checkbox-D-A_bSBK.js";
5
- import { n as m, t as h } from "./text-input-t-iE4dFj.js";
5
+ import { n as m, t as h } from "./text-input-CtTr5yfe.js";
6
6
  n(), s(), u(), f(), m();
7
7
  //#endregion
8
8
  export { a as OudsButton, p as OudsCheckbox, d as OudsSelect, l as OudsTag, h as OudsTextInput, i as buttonNavigations, t as buttonSizes, e as buttonTypes, r as buttonVariants, n as defineOudsButton, f as defineOudsCheckbox, u as defineOudsSelect, s as defineOudsTag, m as defineOudsTextInput, c as tagSizes, o as tagVariants };
package/dist/index.js CHANGED
@@ -2,6 +2,6 @@ import { a as e, i as t, n, o as r, r as i, t as a } from "./button-BPOKh6G4.js"
2
2
  import { i as o, n as s, r as c, t as l } from "./tag-BY32Hj5n.js";
3
3
  import { n as u, t as d } from "./select-CA6TVlpX.js";
4
4
  import { n as f, t as p } from "./checkbox-D-A_bSBK.js";
5
- import { n as m, t as h } from "./text-input-t-iE4dFj.js";
5
+ import { n as m, t as h } from "./text-input-CtTr5yfe.js";
6
6
  import "./elements.js";
7
7
  export { a as OudsButton, p as OudsCheckbox, d as OudsSelect, l as OudsTag, h as OudsTextInput, i as buttonNavigations, t as buttonSizes, e as buttonTypes, r as buttonVariants, n as defineOudsButton, f as defineOudsCheckbox, u as defineOudsSelect, s as defineOudsTag, m as defineOudsTextInput, c as tagSizes, o as tagVariants };
@@ -1,6 +1,6 @@
1
- import { a as e, b as t, c as n, f as r, h as i, i as a, l as o, m as s, o as c, p as l, r as u, s as d, t as f, u as p, v as m, y as h } from "./runtime-dom.esm-bundler-BzNNnH8h.js";
1
+ import { a as e, b as t, c as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as h, y as g } from "./runtime-dom.esm-bundler-BzNNnH8h.js";
2
2
  //#region src/components/text-input/TextInput.vue?vue&type=script&setup=true&lang.ts
3
- var g = { class: "text-input" }, _ = ["id", "for"], v = ["data-bs-prefix", "data-bs-suffix"], y = [
3
+ var _ = ["id", "for"], v = ["data-bs-prefix", "data-bs-suffix"], y = [
4
4
  "id",
5
5
  "type",
6
6
  "placeholder",
@@ -24,7 +24,7 @@ var g = { class: "text-input" }, _ = ["id", "for"], v = ["data-bs-prefix", "data
24
24
  "id",
25
25
  "href",
26
26
  "aria-labelledby"
27
- ], w = f(/* @__PURE__ */ n({
27
+ ], w = p(/* @__PURE__ */ n({
28
28
  inheritAttrs: !1,
29
29
  __name: "TextInput",
30
30
  props: {
@@ -58,30 +58,38 @@ var g = { class: "text-input" }, _ = ["id", "for"], v = ["data-bs-prefix", "data
58
58
  invalid: {
59
59
  type: Boolean,
60
60
  default: !1
61
+ },
62
+ maxWidth: {
63
+ type: Boolean,
64
+ default: !1
65
+ },
66
+ loading: {
67
+ type: Boolean,
68
+ default: !1
61
69
  }
62
70
  },
63
71
  setup(n) {
64
- let f = l(), w = i(), T = s(), E = u(() => n.id || `ouds-text-input-${T}`), D = u(() => `${E.value}-helper`), O = u(() => `${E.value}-error`), k = u(() => `${E.value}-label`), A = u(() => `${E.value}-helper-link`), j = u(() => {
65
- let e = [f["aria-describedby"]];
66
- return n.helperText && !n.invalid && e.push(D.value), n.invalid && (n.errorText || w.error) && e.push(O.value), n.helperLinkHref && (n.helperLink || w["helper-link"]) && e.push(A.value), e.filter(Boolean).join(" ") || void 0;
67
- }), M = u(() => ["text-input-container", { "text-input-container-outlined": n.outlined }]);
68
- return (i, s) => (p(), c("div", g, [
69
- a("div", { class: h(M.value) }, [
70
- r(i.$slots, "leading"),
72
+ let p = u(), w = i(), T = s(), E = d(() => n.id || `ouds-text-input-${T}`), D = d(() => `${E.value}-helper`), O = d(() => `${E.value}-error`), k = d(() => `${E.value}-label`), A = d(() => `${E.value}-helper-link`), j = d(() => {
73
+ let e = [p["aria-describedby"]];
74
+ return n.helperText && !n.invalid && e.push(D.value), n.invalid && (n.errorText || w["error-text"]) && e.push(O.value), n.helperLinkHref && (n.helperLink || w["helper-link"]) && e.push(A.value), e.filter(Boolean).join(" ") || void 0;
75
+ }), M = d(() => ["text-input", { "component-max-width": n.maxWidth }]), N = d(() => ["text-input-container", { "text-input-container-outlined": n.outlined }]), P = d(() => ["text-input-field", { "loading-indeterminate": n.loading }]);
76
+ return (i, s) => (m(), l("div", { class: g(M.value) }, [
77
+ a("div", { class: g(N.value) }, [
78
+ r(i.$slots, "leading-icon"),
71
79
  a("label", {
72
80
  id: k.value,
73
81
  for: E.value,
74
- class: h({ "is-required": n.required })
75
- }, [r(i.$slots, "label", {}, () => [d(t(n.label), 1)])], 10, _),
76
- n.prefix || n.suffix ? (p(), c("div", {
82
+ class: g({ "is-required": n.required })
83
+ }, [r(i.$slots, "label", {}, () => [f(t(n.label), 1)])], 10, _),
84
+ n.prefix || n.suffix ? (m(), l("div", {
77
85
  key: 0,
78
86
  class: "input-container",
79
87
  "data-bs-prefix": n.prefix || void 0,
80
88
  "data-bs-suffix": n.suffix || void 0
81
- }, [a("input", o(m(f), {
89
+ }, [a("input", o(h(p), {
82
90
  id: E.value,
83
91
  type: n.type,
84
- class: "text-input-field",
92
+ class: P.value,
85
93
  placeholder: n.placeholder,
86
94
  value: n.value,
87
95
  disabled: n.disabled,
@@ -89,10 +97,10 @@ var g = { class: "text-input" }, _ = ["id", "for"], v = ["data-bs-prefix", "data
89
97
  required: n.required,
90
98
  "aria-describedby": j.value,
91
99
  "aria-invalid": n.invalid
92
- }), null, 16, y)], 8, v)) : (p(), c("input", o({ key: 1 }, m(f), {
100
+ }), null, 16, y)], 8, v)) : (m(), l("input", o({ key: 1 }, h(p), {
93
101
  id: E.value,
94
102
  type: n.type,
95
- class: "text-input-field",
103
+ class: P.value,
96
104
  placeholder: n.placeholder,
97
105
  value: n.value,
98
106
  disabled: n.disabled,
@@ -101,26 +109,39 @@ var g = { class: "text-input" }, _ = ["id", "for"], v = ["data-bs-prefix", "data
101
109
  "aria-describedby": j.value,
102
110
  "aria-invalid": n.invalid
103
111
  }), null, 16, b)),
104
- r(i.$slots, "trailing")
112
+ n.loading ? (m(), l(c, { key: 2 }, [s[0] ||= a("svg", {
113
+ viewBox: "0 0 40 40",
114
+ xmlns: "http://www.w3.org/2000/svg",
115
+ class: "loader",
116
+ "aria-hidden": "true"
117
+ }, [a("circle", {
118
+ class: "loader-inner",
119
+ cx: "20",
120
+ cy: "20",
121
+ r: "17"
122
+ })], -1), s[1] ||= a("span", {
123
+ role: "status",
124
+ class: "visually-hidden"
125
+ }, "Loading", -1)], 64)) : r(i.$slots, "trailing-action", {}, void 0, void 0, 3)
105
126
  ], 2),
106
- n.helperText && !n.invalid ? (p(), c("p", {
127
+ (n.helperText || i.$slots["helper-text"]) && !n.invalid ? (m(), l("p", {
107
128
  key: 0,
108
129
  id: D.value,
109
130
  class: "helper-text"
110
- }, [r(i.$slots, "helper", {}, () => [d(t(n.helperText), 1)])], 8, x)) : e("", !0),
111
- n.invalid && (n.errorText || i.$slots.error) ? (p(), c("p", {
131
+ }, [r(i.$slots, "helper-text", {}, () => [f(t(n.helperText), 1)])], 8, x)) : e("", !0),
132
+ n.invalid && (n.errorText || i.$slots["error-text"]) ? (m(), l("p", {
112
133
  key: 1,
113
134
  id: O.value,
114
135
  class: "error-text"
115
- }, [r(i.$slots, "error", {}, () => [d(t(n.errorText), 1)])], 8, S)) : e("", !0),
116
- n.helperLinkHref && (n.helperLink || i.$slots["helper-link"]) ? (p(), c("a", {
136
+ }, [r(i.$slots, "error-text", {}, () => [f(t(n.errorText), 1)])], 8, S)) : e("", !0),
137
+ n.helperLinkHref && (n.helperLink || i.$slots["helper-link"]) ? (m(), l("a", {
117
138
  key: 2,
118
139
  id: A.value,
119
140
  href: n.helperLinkHref,
120
141
  "aria-labelledby": `${A.value} ${k.value}`,
121
142
  class: "link link-small"
122
- }, [r(i.$slots, "helper-link", {}, () => [d(t(n.helperLink), 1)]), s[0] ||= a("span", { class: "visually-hidden" }, "on", -1)], 8, C)) : e("", !0)
123
- ]));
143
+ }, [r(i.$slots, "helper-link", {}, () => [f(t(n.helperLink), 1)]), s[2] ||= a("span", { class: "visually-hidden" }, "on", -1)], 8, C)) : e("", !0)
144
+ ], 2));
124
145
  }
125
146
  }), { shadowRoot: !1 });
126
147
  function T() {
@@ -0,0 +1,201 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createSlots as o, createTextVNode as s, defineComponent as c, mergeModels as l, mergeProps as u, normalizeClass as d, openBlock as f, renderSlot as p, toDisplayString as m, unref as h, useAttrs as g, useId as _, useModel as v, useSlots as y, withCtx as b } from "vue";
2
+ //#region src/components/text-input/TextInput.vue?vue&type=script&setup=true&lang.ts
3
+ var x = ["id", "for"], S = ["data-bs-prefix", "data-bs-suffix"], C = [
4
+ "id",
5
+ "type",
6
+ "placeholder",
7
+ "value",
8
+ "disabled",
9
+ "readonly",
10
+ "required",
11
+ "aria-describedby",
12
+ "aria-invalid"
13
+ ], w = [
14
+ "id",
15
+ "type",
16
+ "placeholder",
17
+ "value",
18
+ "disabled",
19
+ "readonly",
20
+ "required",
21
+ "aria-describedby",
22
+ "aria-invalid"
23
+ ], T = ["id"], E = ["id"], D = [
24
+ "id",
25
+ "href",
26
+ "aria-labelledby"
27
+ ], O = /* @__PURE__ */ c({
28
+ inheritAttrs: !1,
29
+ __name: "TextInput",
30
+ props: {
31
+ id: {},
32
+ label: { default: "Text input" },
33
+ placeholder: { default: " " },
34
+ helperText: { default: "" },
35
+ errorText: { default: "" },
36
+ helperLink: { default: "" },
37
+ helperLinkHref: { default: "" },
38
+ prefix: { default: "" },
39
+ suffix: { default: "" },
40
+ value: { default: "" },
41
+ type: { default: "text" },
42
+ outlined: {
43
+ type: Boolean,
44
+ default: !1
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ readonly: {
51
+ type: Boolean,
52
+ default: !1
53
+ },
54
+ required: {
55
+ type: Boolean,
56
+ default: !1
57
+ },
58
+ invalid: {
59
+ type: Boolean,
60
+ default: !1
61
+ },
62
+ maxWidth: {
63
+ type: Boolean,
64
+ default: !1
65
+ },
66
+ loading: {
67
+ type: Boolean,
68
+ default: !1
69
+ }
70
+ },
71
+ setup(n) {
72
+ let o = g(), c = y(), l = _(), v = t(() => n.id || `ouds-text-input-${l}`), b = t(() => `${v.value}-helper`), O = t(() => `${v.value}-error`), k = t(() => `${v.value}-label`), A = t(() => `${v.value}-helper-link`), j = t(() => {
73
+ let e = [o["aria-describedby"]];
74
+ return n.helperText && !n.invalid && e.push(b.value), n.invalid && (n.errorText || c["error-text"]) && e.push(O.value), n.helperLinkHref && (n.helperLink || c["helper-link"]) && e.push(A.value), e.filter(Boolean).join(" ") || void 0;
75
+ }), M = t(() => ["text-input", { "component-max-width": n.maxWidth }]), N = t(() => ["text-input-container", { "text-input-container-outlined": n.outlined }]), P = t(() => ["text-input-field", { "loading-indeterminate": n.loading }]);
76
+ return (t, c) => (f(), i("div", { class: d(M.value) }, [
77
+ a("div", { class: d(N.value) }, [
78
+ p(t.$slots, "leading-icon"),
79
+ a("label", {
80
+ id: k.value,
81
+ for: v.value,
82
+ class: d({ "is-required": n.required })
83
+ }, [p(t.$slots, "label", {}, () => [s(m(n.label), 1)])], 10, x),
84
+ n.prefix || n.suffix ? (f(), i("div", {
85
+ key: 0,
86
+ class: "input-container",
87
+ "data-bs-prefix": n.prefix || void 0,
88
+ "data-bs-suffix": n.suffix || void 0
89
+ }, [a("input", u(h(o), {
90
+ id: v.value,
91
+ type: n.type,
92
+ class: P.value,
93
+ placeholder: n.placeholder,
94
+ value: n.value,
95
+ disabled: n.disabled,
96
+ readonly: n.readonly,
97
+ required: n.required,
98
+ "aria-describedby": j.value,
99
+ "aria-invalid": n.invalid
100
+ }), null, 16, C)], 8, S)) : (f(), i("input", u({ key: 1 }, h(o), {
101
+ id: v.value,
102
+ type: n.type,
103
+ class: P.value,
104
+ placeholder: n.placeholder,
105
+ value: n.value,
106
+ disabled: n.disabled,
107
+ readonly: n.readonly,
108
+ required: n.required,
109
+ "aria-describedby": j.value,
110
+ "aria-invalid": n.invalid
111
+ }), null, 16, w)),
112
+ n.loading ? (f(), i(e, { key: 2 }, [c[0] ||= a("svg", {
113
+ viewBox: "0 0 40 40",
114
+ xmlns: "http://www.w3.org/2000/svg",
115
+ class: "loader",
116
+ "aria-hidden": "true"
117
+ }, [a("circle", {
118
+ class: "loader-inner",
119
+ cx: "20",
120
+ cy: "20",
121
+ r: "17"
122
+ })], -1), c[1] ||= a("span", {
123
+ role: "status",
124
+ class: "visually-hidden"
125
+ }, "Loading", -1)], 64)) : p(t.$slots, "trailing-action", {}, void 0, void 0, 3)
126
+ ], 2),
127
+ (n.helperText || t.$slots["helper-text"]) && !n.invalid ? (f(), i("p", {
128
+ key: 0,
129
+ id: b.value,
130
+ class: "helper-text"
131
+ }, [p(t.$slots, "helper-text", {}, () => [s(m(n.helperText), 1)])], 8, T)) : r("", !0),
132
+ n.invalid && (n.errorText || t.$slots["error-text"]) ? (f(), i("p", {
133
+ key: 1,
134
+ id: O.value,
135
+ class: "error-text"
136
+ }, [p(t.$slots, "error-text", {}, () => [s(m(n.errorText), 1)])], 8, E)) : r("", !0),
137
+ n.helperLinkHref && (n.helperLink || t.$slots["helper-link"]) ? (f(), i("a", {
138
+ key: 2,
139
+ id: A.value,
140
+ href: n.helperLinkHref,
141
+ "aria-labelledby": `${A.value} ${k.value}`,
142
+ class: "link link-small"
143
+ }, [p(t.$slots, "helper-link", {}, () => [s(m(n.helperLink), 1)]), c[2] ||= a("span", { class: "visually-hidden" }, "on", -1)], 8, D)) : r("", !0)
144
+ ], 2));
145
+ }
146
+ }), k = /* @__PURE__ */ c({
147
+ inheritAttrs: !1,
148
+ __name: "VueTextInput",
149
+ props: {
150
+ modelValue: { default: "" },
151
+ modelModifiers: {}
152
+ },
153
+ emits: /*@__PURE__*/ l(["input", "change"], ["update:modelValue"]),
154
+ setup(e, { emit: t }) {
155
+ let r = v(e, "modelValue"), i = t;
156
+ function a(e) {
157
+ r.value = e.target.value, i("input", e);
158
+ }
159
+ function s(e) {
160
+ r.value = e.target.value, i("change", e);
161
+ }
162
+ return (e, t) => (f(), n(O, u(e.$attrs, {
163
+ value: r.value,
164
+ onInput: a,
165
+ onChange: s
166
+ }), o({ _: 2 }, [
167
+ e.$slots.label ? {
168
+ name: "label",
169
+ fn: b(() => [p(e.$slots, "label")]),
170
+ key: "0"
171
+ } : void 0,
172
+ e.$slots["leading-icon"] ? {
173
+ name: "leading-icon",
174
+ fn: b(() => [p(e.$slots, "leading-icon")]),
175
+ key: "1"
176
+ } : void 0,
177
+ e.$slots["trailing-action"] ? {
178
+ name: "trailing-action",
179
+ fn: b(() => [p(e.$slots, "trailing-action")]),
180
+ key: "2"
181
+ } : void 0,
182
+ e.$slots["helper-text"] ? {
183
+ name: "helper-text",
184
+ fn: b(() => [p(e.$slots, "helper-text")]),
185
+ key: "3"
186
+ } : void 0,
187
+ e.$slots["error-text"] ? {
188
+ name: "error-text",
189
+ fn: b(() => [p(e.$slots, "error-text")]),
190
+ key: "4"
191
+ } : void 0,
192
+ e.$slots["helper-link"] ? {
193
+ name: "helper-link",
194
+ fn: b(() => [p(e.$slots, "helper-link")]),
195
+ key: "5"
196
+ } : void 0
197
+ ]), 1040, ["value"]));
198
+ }
199
+ });
200
+ //#endregion
201
+ export { k as t };
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./text-input-t-iE4dFj.js";
1
+ import { n as e, t } from "./text-input-CtTr5yfe.js";
2
2
  //#region src/text-input.ts
3
3
  e();
4
4
  //#endregion
@@ -15,18 +15,20 @@ type __VLS_Props = {
15
15
  readonly?: boolean;
16
16
  required?: boolean;
17
17
  invalid?: boolean;
18
+ maxWidth?: boolean;
19
+ loading?: boolean;
18
20
  };
19
21
  declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_11: {};
20
22
  type __VLS_Slots = {} & {
21
- leading?: (props: typeof __VLS_1) => any;
23
+ 'leading-icon'?: (props: typeof __VLS_1) => any;
22
24
  } & {
23
25
  label?: (props: typeof __VLS_3) => any;
24
26
  } & {
25
- trailing?: (props: typeof __VLS_5) => any;
27
+ 'trailing-action'?: (props: typeof __VLS_5) => any;
26
28
  } & {
27
- helper?: (props: typeof __VLS_7) => any;
29
+ 'helper-text'?: (props: typeof __VLS_7) => any;
28
30
  } & {
29
- error?: (props: typeof __VLS_9) => any;
31
+ 'error-text'?: (props: typeof __VLS_9) => any;
30
32
  } & {
31
33
  'helper-link'?: (props: typeof __VLS_11) => any;
32
34
  };
@@ -5,13 +5,13 @@ declare var __VLS_11: {}, __VLS_14: {}, __VLS_17: {}, __VLS_20: {}, __VLS_23: {}
5
5
  type __VLS_Slots = {} & {
6
6
  label?: (props: typeof __VLS_11) => any;
7
7
  } & {
8
- leading?: (props: typeof __VLS_14) => any;
8
+ 'leading-icon'?: (props: typeof __VLS_14) => any;
9
9
  } & {
10
- trailing?: (props: typeof __VLS_17) => any;
10
+ 'trailing-action'?: (props: typeof __VLS_17) => any;
11
11
  } & {
12
- helper?: (props: typeof __VLS_20) => any;
12
+ 'helper-text'?: (props: typeof __VLS_20) => any;
13
13
  } & {
14
- error?: (props: typeof __VLS_23) => any;
14
+ 'error-text'?: (props: typeof __VLS_23) => any;
15
15
  } & {
16
16
  'helper-link'?: (props: typeof __VLS_26) => any;
17
17
  };
@@ -14,6 +14,8 @@ export type TextInputElement = HTMLElement & {
14
14
  readonly: boolean;
15
15
  required: boolean;
16
16
  invalid: boolean;
17
+ maxWidth: boolean;
18
+ loading: boolean;
17
19
  };
18
20
  export type TextInputConstructor = CustomElementConstructor & {
19
21
  new (initialProps?: Partial<TextInputElement>): TextInputElement;
@@ -1,2 +1,2 @@
1
- import { t as e } from "./text-input-DOUGu0A2.js";
1
+ import { t as e } from "./text-input-l1F2arKl.js";
2
2
  export { e as OudsTextInput };
package/dist/vue.js CHANGED
@@ -2,5 +2,5 @@ import { a as e, i as t, n, r, t as i } from "./button-LlRiSiGS.js";
2
2
  import { n as a, r as o, t as s } from "./tag-B2qhuHjk.js";
3
3
  import { t as c } from "./select-CKHEHpJL.js";
4
4
  import { t as l } from "./checkbox-BYrgMhwO.js";
5
- import { t as u } from "./text-input-DOUGu0A2.js";
5
+ import { t as u } from "./text-input-l1F2arKl.js";
6
6
  export { e as OudsButton, l as OudsCheckbox, c as OudsSelect, o as OudsTag, u as OudsTextInput, i as buttonNavigations, n as buttonSizes, r as buttonTypes, t as buttonVariants, s as tagSizes, a as tagVariants };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nilloq/ouds-web",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Vue components and framework-independent custom elements styled with OUDS Web.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -1,180 +0,0 @@
1
- import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createSlots as a, createTextVNode as o, defineComponent as s, mergeModels as c, mergeProps as l, normalizeClass as u, openBlock as d, renderSlot as f, toDisplayString as p, unref as m, useAttrs as h, useId as g, useModel as _, useSlots as v, withCtx as y } from "vue";
2
- //#region src/components/text-input/TextInput.vue?vue&type=script&setup=true&lang.ts
3
- var b = { class: "text-input" }, x = ["id", "for"], S = ["data-bs-prefix", "data-bs-suffix"], C = [
4
- "id",
5
- "type",
6
- "placeholder",
7
- "value",
8
- "disabled",
9
- "readonly",
10
- "required",
11
- "aria-describedby",
12
- "aria-invalid"
13
- ], w = [
14
- "id",
15
- "type",
16
- "placeholder",
17
- "value",
18
- "disabled",
19
- "readonly",
20
- "required",
21
- "aria-describedby",
22
- "aria-invalid"
23
- ], T = ["id"], E = ["id"], D = [
24
- "id",
25
- "href",
26
- "aria-labelledby"
27
- ], O = /* @__PURE__ */ s({
28
- inheritAttrs: !1,
29
- __name: "TextInput",
30
- props: {
31
- id: {},
32
- label: { default: "Text input" },
33
- placeholder: { default: " " },
34
- helperText: { default: "" },
35
- errorText: { default: "" },
36
- helperLink: { default: "" },
37
- helperLinkHref: { default: "" },
38
- prefix: { default: "" },
39
- suffix: { default: "" },
40
- value: { default: "" },
41
- type: { default: "text" },
42
- outlined: {
43
- type: Boolean,
44
- default: !1
45
- },
46
- disabled: {
47
- type: Boolean,
48
- default: !1
49
- },
50
- readonly: {
51
- type: Boolean,
52
- default: !1
53
- },
54
- required: {
55
- type: Boolean,
56
- default: !1
57
- },
58
- invalid: {
59
- type: Boolean,
60
- default: !1
61
- }
62
- },
63
- setup(t) {
64
- let a = h(), s = v(), c = g(), _ = e(() => t.id || `ouds-text-input-${c}`), y = e(() => `${_.value}-helper`), O = e(() => `${_.value}-error`), k = e(() => `${_.value}-label`), A = e(() => `${_.value}-helper-link`), j = e(() => {
65
- let e = [a["aria-describedby"]];
66
- return t.helperText && !t.invalid && e.push(y.value), t.invalid && (t.errorText || s.error) && e.push(O.value), t.helperLinkHref && (t.helperLink || s["helper-link"]) && e.push(A.value), e.filter(Boolean).join(" ") || void 0;
67
- }), M = e(() => ["text-input-container", { "text-input-container-outlined": t.outlined }]);
68
- return (e, s) => (d(), r("div", b, [
69
- i("div", { class: u(M.value) }, [
70
- f(e.$slots, "leading"),
71
- i("label", {
72
- id: k.value,
73
- for: _.value,
74
- class: u({ "is-required": t.required })
75
- }, [f(e.$slots, "label", {}, () => [o(p(t.label), 1)])], 10, x),
76
- t.prefix || t.suffix ? (d(), r("div", {
77
- key: 0,
78
- class: "input-container",
79
- "data-bs-prefix": t.prefix || void 0,
80
- "data-bs-suffix": t.suffix || void 0
81
- }, [i("input", l(m(a), {
82
- id: _.value,
83
- type: t.type,
84
- class: "text-input-field",
85
- placeholder: t.placeholder,
86
- value: t.value,
87
- disabled: t.disabled,
88
- readonly: t.readonly,
89
- required: t.required,
90
- "aria-describedby": j.value,
91
- "aria-invalid": t.invalid
92
- }), null, 16, C)], 8, S)) : (d(), r("input", l({ key: 1 }, m(a), {
93
- id: _.value,
94
- type: t.type,
95
- class: "text-input-field",
96
- placeholder: t.placeholder,
97
- value: t.value,
98
- disabled: t.disabled,
99
- readonly: t.readonly,
100
- required: t.required,
101
- "aria-describedby": j.value,
102
- "aria-invalid": t.invalid
103
- }), null, 16, w)),
104
- f(e.$slots, "trailing")
105
- ], 2),
106
- t.helperText && !t.invalid ? (d(), r("p", {
107
- key: 0,
108
- id: y.value,
109
- class: "helper-text"
110
- }, [f(e.$slots, "helper", {}, () => [o(p(t.helperText), 1)])], 8, T)) : n("", !0),
111
- t.invalid && (t.errorText || e.$slots.error) ? (d(), r("p", {
112
- key: 1,
113
- id: O.value,
114
- class: "error-text"
115
- }, [f(e.$slots, "error", {}, () => [o(p(t.errorText), 1)])], 8, E)) : n("", !0),
116
- t.helperLinkHref && (t.helperLink || e.$slots["helper-link"]) ? (d(), r("a", {
117
- key: 2,
118
- id: A.value,
119
- href: t.helperLinkHref,
120
- "aria-labelledby": `${A.value} ${k.value}`,
121
- class: "link link-small"
122
- }, [f(e.$slots, "helper-link", {}, () => [o(p(t.helperLink), 1)]), s[0] ||= i("span", { class: "visually-hidden" }, "on", -1)], 8, D)) : n("", !0)
123
- ]));
124
- }
125
- }), k = /* @__PURE__ */ s({
126
- inheritAttrs: !1,
127
- __name: "VueTextInput",
128
- props: {
129
- modelValue: { default: "" },
130
- modelModifiers: {}
131
- },
132
- emits: /*@__PURE__*/ c(["input", "change"], ["update:modelValue"]),
133
- setup(e, { emit: n }) {
134
- let r = _(e, "modelValue"), i = n;
135
- function o(e) {
136
- r.value = e.target.value, i("input", e);
137
- }
138
- function s(e) {
139
- r.value = e.target.value, i("change", e);
140
- }
141
- return (e, n) => (d(), t(O, l(e.$attrs, {
142
- value: r.value,
143
- onInput: o,
144
- onChange: s
145
- }), a({ _: 2 }, [
146
- e.$slots.label ? {
147
- name: "label",
148
- fn: y(() => [f(e.$slots, "label")]),
149
- key: "0"
150
- } : void 0,
151
- e.$slots.leading ? {
152
- name: "leading",
153
- fn: y(() => [f(e.$slots, "leading")]),
154
- key: "1"
155
- } : void 0,
156
- e.$slots.trailing ? {
157
- name: "trailing",
158
- fn: y(() => [f(e.$slots, "trailing")]),
159
- key: "2"
160
- } : void 0,
161
- e.$slots.helper ? {
162
- name: "helper",
163
- fn: y(() => [f(e.$slots, "helper")]),
164
- key: "3"
165
- } : void 0,
166
- e.$slots.error ? {
167
- name: "error",
168
- fn: y(() => [f(e.$slots, "error")]),
169
- key: "4"
170
- } : void 0,
171
- e.$slots["helper-link"] ? {
172
- name: "helper-link",
173
- fn: y(() => [f(e.$slots, "helper-link")]),
174
- key: "5"
175
- } : void 0
176
- ]), 1040, ["value"]));
177
- }
178
- });
179
- //#endregion
180
- export { k as t };