@ulu/frontend-vue 0.5.16 → 0.6.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.
Files changed (64) hide show
  1. package/dist/components/elements/UluButton.vue.d.ts +4 -0
  2. package/dist/components/elements/UluButton.vue.d.ts.map +1 -1
  3. package/dist/components/elements/UluButton.vue.js +31 -16
  4. package/dist/components/elements/UluIcon.vue.js +21 -36
  5. package/dist/components/forms/UluFormCheckbox.vue.d.ts +3 -19
  6. package/dist/components/forms/UluFormCheckbox.vue.d.ts.map +1 -1
  7. package/dist/components/forms/UluFormCheckbox.vue.js +10 -31
  8. package/dist/components/forms/UluFormFile.vue.d.ts +3 -25
  9. package/dist/components/forms/UluFormFile.vue.d.ts.map +1 -1
  10. package/dist/components/forms/UluFormFile.vue.js +11 -49
  11. package/dist/components/forms/UluFormItem.vue.d.ts +23 -8
  12. package/dist/components/forms/UluFormItem.vue.d.ts.map +1 -1
  13. package/dist/components/forms/UluFormItem.vue.js +126 -29
  14. package/dist/components/forms/UluFormLabel.vue.d.ts +24 -0
  15. package/dist/components/forms/UluFormLabel.vue.d.ts.map +1 -0
  16. package/dist/components/forms/UluFormLabel.vue.js +34 -0
  17. package/dist/components/forms/UluFormRadio.vue.d.ts +7 -25
  18. package/dist/components/forms/UluFormRadio.vue.d.ts.map +1 -1
  19. package/dist/components/forms/UluFormRadio.vue.js +11 -37
  20. package/dist/components/forms/UluFormSelect.vue.d.ts +7 -23
  21. package/dist/components/forms/UluFormSelect.vue.d.ts.map +1 -1
  22. package/dist/components/forms/UluFormSelect.vue.js +24 -43
  23. package/dist/components/forms/UluFormText.vue.d.ts +5 -23
  24. package/dist/components/forms/UluFormText.vue.d.ts.map +1 -1
  25. package/dist/components/forms/UluFormText.vue.js +10 -38
  26. package/dist/components/forms/UluFormTextarea.vue.d.ts +5 -23
  27. package/dist/components/forms/UluFormTextarea.vue.d.ts.map +1 -1
  28. package/dist/components/forms/UluFormTextarea.vue.js +10 -37
  29. package/dist/components/forms/UluSearchForm.vue.d.ts +24 -3
  30. package/dist/components/forms/UluSearchForm.vue.d.ts.map +1 -1
  31. package/dist/components/forms/UluSearchForm.vue.js +67 -22
  32. package/dist/components/index.d.ts +1 -0
  33. package/dist/components/systems/facets/UluFacetsFilterSelects.vue.d.ts.map +1 -1
  34. package/dist/components/systems/facets/UluFacetsFilterSelects.vue.js +21 -22
  35. package/dist/components/utils/UluAction.vue.d.ts +2 -0
  36. package/dist/components/utils/UluAction.vue.d.ts.map +1 -1
  37. package/dist/components/utils/UluAction.vue.js +9 -5
  38. package/dist/components/visualizations/UluProgressBar.vue.d.ts +2 -2
  39. package/dist/index.js +130 -128
  40. package/dist/plugins/core/index.d.ts.map +1 -1
  41. package/dist/plugins/core/index.js +17 -16
  42. package/dist/utils/props.d.ts +7 -0
  43. package/dist/utils/props.d.ts.map +1 -1
  44. package/dist/utils/props.js +8 -2
  45. package/lib/components/elements/UluButton.vue +18 -3
  46. package/lib/components/elements/UluIcon.vue +8 -26
  47. package/lib/components/forms/UluForm.vue +25 -25
  48. package/lib/components/forms/UluFormCheckbox.vue +11 -25
  49. package/lib/components/forms/UluFormFieldset.vue +6 -6
  50. package/lib/components/forms/UluFormFile.vue +10 -40
  51. package/lib/components/forms/UluFormItem.vue +150 -39
  52. package/lib/components/forms/UluFormLabel.vue +30 -0
  53. package/lib/components/forms/UluFormRadio.vue +15 -34
  54. package/lib/components/forms/UluFormSelect.vue +19 -24
  55. package/lib/components/forms/UluFormText.vue +7 -25
  56. package/lib/components/forms/UluFormTextarea.vue +7 -25
  57. package/lib/components/forms/UluSearchForm.vue +67 -19
  58. package/lib/components/forms/UluSelectableMenu.vue +62 -62
  59. package/lib/components/index.js +1 -0
  60. package/lib/components/systems/facets/UluFacetsFilterSelects.vue +11 -14
  61. package/lib/components/utils/UluAction.vue +6 -2
  62. package/lib/plugins/core/index.js +2 -1
  63. package/lib/utils/props.js +14 -0
  64. package/package.json +3 -3
@@ -13,6 +13,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
13
13
  outline: boolean;
14
14
  transparent: boolean;
15
15
  noMargin: boolean;
16
+ type?: string | undefined;
16
17
  size?: string | undefined;
17
18
  icon?: string | unknown[] | undefined;
18
19
  modifiers?: string | unknown[] | undefined;
@@ -22,6 +23,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
22
23
  download?: string | boolean | undefined;
23
24
  text?: string | undefined;
24
25
  alt?: string | undefined;
26
+ ariaLabel?: string | undefined;
25
27
  $props: {
26
28
  readonly iconOnly?: boolean | undefined;
27
29
  readonly iconBefore?: boolean | undefined;
@@ -32,6 +34,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
32
34
  readonly outline?: boolean | undefined;
33
35
  readonly transparent?: boolean | undefined;
34
36
  readonly noMargin?: boolean | undefined;
37
+ readonly type?: string | undefined;
35
38
  readonly size?: string | undefined;
36
39
  readonly icon?: string | unknown[] | undefined;
37
40
  readonly modifiers?: string | unknown[] | undefined;
@@ -41,6 +44,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
41
44
  readonly download?: string | boolean | undefined;
42
45
  readonly text?: string | undefined;
43
46
  readonly alt?: string | undefined;
47
+ readonly ariaLabel?: string | undefined;
44
48
  };
45
49
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
46
50
  type __VLS_TemplateResult = {
@@ -1 +1 @@
1
- {"version":3,"file":"UluButton.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluButton.vue"],"names":[],"mappings":"AAkCA;wBA0WqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2OAQG"}
1
+ {"version":3,"file":"UluButton.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluButton.vue"],"names":[],"mappings":"AAmCA;wBAyYqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2OAQG"}
@@ -1,8 +1,9 @@
1
- import { computed as i, createBlock as a, openBlock as t, normalizeClass as d, unref as m, withCtx as f, renderSlot as l, createCommentVNode as r, createElementBlock as g, createTextVNode as y, toDisplayString as B } from "vue";
1
+ import { computed as i, createBlock as a, openBlock as o, normalizeClass as d, unref as m, withCtx as f, renderSlot as l, createCommentVNode as r, createElementBlock as g, createTextVNode as y, toDisplayString as B } from "vue";
2
2
  import b from "../utils/UluAction.vue.js";
3
3
  import c from "./UluIcon.vue.js";
4
4
  import { useModifiers as S } from "../../composables/useModifiers.js";
5
- const h = { key: 1 }, z = {
5
+ import { checkDeprecatedProps as h } from "../../utils/props.js";
6
+ const k = { key: 1 }, C = {
6
7
  __name: "UluButton",
7
8
  props: {
8
9
  /**
@@ -35,9 +36,14 @@ const h = { key: 1 }, z = {
35
36
  */
36
37
  download: [Boolean, String],
37
38
  /**
38
- * For icon only buttons or buttons that need an explicit label
39
+ * **Deprecated!** Use `ariaLabel` instead.
40
+ * @deprecated Use `ariaLabel` instead.
39
41
  */
40
42
  alt: String,
43
+ /**
44
+ * For icon only buttons or buttons that need an explicit aria-label
45
+ */
46
+ ariaLabel: String,
41
47
  /**
42
48
  * If not using slot this sets the buttons text via prop
43
49
  */
@@ -77,10 +83,18 @@ const h = { key: 1 }, z = {
77
83
  /**
78
84
  * Modifiers (to add any modifier classes based on base class [ie. 'tertiary'])
79
85
  */
80
- modifiers: [String, Array]
86
+ modifiers: [String, Array],
87
+ /**
88
+ * Button type (e.g. 'submit', 'reset', 'button').
89
+ */
90
+ type: String
81
91
  },
82
92
  setup(e) {
83
- const n = e, { resolvedModifiers: s } = S({
93
+ const n = e;
94
+ h(n, ["alt"], (t) => {
95
+ console.warn(`[@ulu/frontend-vue] UluButton: The "${t}" prop is deprecated. Please use "ariaLabel" instead.`);
96
+ });
97
+ const { resolvedModifiers: s } = S({
84
98
  props: n,
85
99
  baseClass: "button",
86
100
  internal: i(() => ({
@@ -94,14 +108,15 @@ const h = { key: 1 }, z = {
94
108
  [n.size]: n.size
95
109
  }))
96
110
  }), u = i(() => {
97
- const o = n.alt || n.iconOnly && n.text;
98
- return o || null;
111
+ const t = n.ariaLabel || n.alt || n.iconOnly && n.text;
112
+ return t || null;
99
113
  });
100
- return (o, O) => (t(), a(b, {
114
+ return (t, O) => (o(), a(b, {
101
115
  to: e.to,
102
116
  href: e.href,
103
117
  target: e.target,
104
118
  download: e.download,
119
+ type: e.type,
105
120
  class: d(["button", [
106
121
  {
107
122
  "no-margin": e.noMargin
@@ -111,28 +126,28 @@ const h = { key: 1 }, z = {
111
126
  "aria-label": u.value
112
127
  }, {
113
128
  default: f(() => [
114
- l(o.$slots, "before"),
115
- e.icon && (e.iconBefore || e.iconOnly) ? (t(), a(c, {
129
+ l(t.$slots, "before"),
130
+ e.icon && (e.iconBefore || e.iconOnly) ? (o(), a(c, {
116
131
  key: 0,
117
132
  icon: e.icon,
118
133
  class: "button__icon"
119
134
  }, null, 8, ["icon"])) : r("", !0),
120
- (o.$slots.default || e.text) && !e.iconOnly ? (t(), g("span", h, [
121
- l(o.$slots, "default", {}, () => [
135
+ (t.$slots.default || e.text) && !e.iconOnly ? (o(), g("span", k, [
136
+ l(t.$slots, "default", {}, () => [
122
137
  y(B(e.text), 1)
123
138
  ])
124
139
  ])) : r("", !0),
125
- e.icon && !e.iconBefore && !e.iconOnly ? (t(), a(c, {
140
+ e.icon && !e.iconBefore && !e.iconOnly ? (o(), a(c, {
126
141
  key: 2,
127
142
  icon: e.icon,
128
143
  class: "button__icon"
129
144
  }, null, 8, ["icon"])) : r("", !0),
130
- l(o.$slots, "after")
145
+ l(t.$slots, "after")
131
146
  ]),
132
147
  _: 3
133
- }, 8, ["to", "href", "target", "download", "class", "aria-label"]));
148
+ }, 8, ["to", "href", "target", "download", "type", "class", "aria-label"]));
134
149
  }
135
150
  };
136
151
  export {
137
- z as default
152
+ C as default
138
153
  };
@@ -1,11 +1,10 @@
1
- import { inject as S, ref as _, computed as e, watchEffect as h, defineAsyncComponent as A, markRaw as v, createBlock as p, createElementBlock as B, createCommentVNode as F, openBlock as i, resolveDynamicComponent as f, mergeProps as g, normalizeClass as D } from "vue";
2
- import { useIcon as R } from "../../composables/useIcon.js";
3
- const x = {
1
+ import { inject as P, defineAsyncComponent as S, computed as e, createBlock as p, createElementBlock as _, createCommentVNode as h, openBlock as a, resolveDynamicComponent as m, mergeProps as v, normalizeClass as w } from "vue";
2
+ import { useIcon as B } from "../../composables/useIcon.js";
3
+ const b = {
4
4
  __name: "UluIcon",
5
5
  props: {
6
6
  /**
7
7
  * Icon definition can be string (fa classes), or array or object (any prop format FaIcon accepts)
8
- * - This will override the 'type' prop if both are provided
9
8
  */
10
9
  icon: [String, Array, Object, Boolean],
11
10
  /**
@@ -13,43 +12,29 @@ const x = {
13
12
  */
14
13
  spaced: Boolean
15
14
  },
16
- setup(y) {
17
- const s = S("uluCore"), l = _(null), { getIconProps: C, getClassesFromDefinition: d } = R();
18
- let a;
19
- const m = y, c = e(() => s.getSetting("fontAwesomeStatic")), r = e(() => s.getSetting("iconComponent")), I = e(() => s.getSetting("iconPropResolver")), n = e(() => {
20
- const { icon: o } = m;
21
- if (typeof o == "string" && o.startsWith("type:"))
15
+ setup(f) {
16
+ const t = P("uluCore"), { getIconProps: g, getClassesFromDefinition: C } = B(), y = S(
17
+ () => import("@fortawesome/vue-fontawesome").then((n) => n.FontAwesomeIcon)
18
+ ), u = f, r = e(() => t.getSetting("fontAwesomeStatic")), c = e(() => t.getSetting("iconComponent")), I = e(() => t.getSetting("iconPropResolver")), o = e(() => {
19
+ const { icon: n } = u;
20
+ if (typeof n == "string" && n.startsWith("type:"))
22
21
  try {
23
- const t = o.substring(5);
24
- return s.getIcon(t);
25
- } catch (t) {
26
- return console.warn(t), null;
22
+ const s = n.substring(5);
23
+ return t.getIcon(s);
24
+ } catch (s) {
25
+ return console.warn(s), null;
27
26
  }
28
- return o;
29
- }), w = e(() => !r.value || !n.value ? null : I.value(n.value)), k = e(() => C(n.value)), P = e(() => d(n.value)), u = e(() => ({
30
- "flow-inline": m.spaced
31
- }));
32
- return h(async () => {
33
- if (!c.value && n.value) {
34
- if (l.value === null)
35
- if (a)
36
- l.value = v(a.FontAwesomeIcon);
37
- else {
38
- const o = A(async () => {
39
- const t = await import("@fortawesome/vue-fontawesome");
40
- return a = t, t.FontAwesomeIcon;
41
- });
42
- l.value = v(o);
43
- }
44
- } else
45
- l.value = null;
46
- }), (o, t) => r.value ? (i(), p(f(r.value), g({ key: 0 }, w.value, { class: u.value }), null, 16, ["class"])) : !c.value && l.value && n.value ? (i(), p(f(l.value), g({ key: 1 }, k.value, { class: u.value }), null, 16, ["class"])) : c.value && n.value ? (i(), B("span", {
27
+ return n;
28
+ }), d = e(() => !c.value || !o.value ? null : I.value(o.value)), k = e(() => g(o.value)), A = e(() => C(o.value)), l = e(() => ({
29
+ "flow-inline": u.spaced
30
+ })), i = e(() => !r.value && o.value ? y : null);
31
+ return (n, s) => c.value ? (a(), p(m(c.value), v({ key: 0 }, d.value, { class: l.value }), null, 16, ["class"])) : !r.value && i.value ? (a(), p(m(i.value), v({ key: 1 }, k.value, { class: l.value }), null, 16, ["class"])) : r.value && o.value ? (a(), _("span", {
47
32
  key: 2,
48
- class: D([P.value, u.value]),
33
+ class: w([A.value, l.value]),
49
34
  "aria-hidden": "true"
50
- }, null, 2)) : F("", !0);
35
+ }, null, 2)) : h("", !0);
51
36
  }
52
37
  };
53
38
  export {
54
- x as default
39
+ b as default
55
40
  };
@@ -1,25 +1,9 @@
1
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
2
- export default _default;
3
- type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
- $slots: S;
5
- });
6
- declare const __VLS_component: import('vue').DefineComponent<{}, {
1
+ declare const _default: import('vue').DefineComponent<{}, {
7
2
  $emit: (event: "update:modelValue", ...args: any[]) => void;
8
3
  modelValue: boolean;
9
- required: boolean;
10
- label?: string | undefined;
11
4
  $props: {
12
5
  readonly modelValue?: boolean | undefined;
13
- readonly required?: boolean | undefined;
14
- readonly label?: string | undefined;
15
- };
16
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
17
- type __VLS_TemplateResult = {
18
- attrs: Partial<{}>;
19
- slots: {
20
- default?(_: {}): any;
21
6
  };
22
- refs: {};
23
- rootEl: any;
24
- };
7
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLInputElement>;
8
+ export default _default;
25
9
  //# sourceMappingURL=UluFormCheckbox.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UluFormCheckbox.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/forms/UluFormCheckbox.vue"],"names":[],"mappings":"AAcA;wBAoIqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;2OAQG"}
1
+ {"version":3,"file":"UluFormCheckbox.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/forms/UluFormCheckbox.vue"],"names":[],"mappings":"AAQA;"}
@@ -1,42 +1,21 @@
1
- import { createElementBlock as u, openBlock as l, Fragment as i, createElementVNode as d, unref as n, renderSlot as m, createTextVNode as c, createBlock as s, createCommentVNode as f, toDisplayString as k } from "vue";
2
- import { newId as h } from "../../utils/dom.js";
3
- import p from "./UluFormRequiredChar.vue.js";
4
- const V = ["id", "checked", "required"], b = ["for"], x = {
1
+ import { inject as n, computed as r, createElementBlock as a, openBlock as d, mergeProps as m } from "vue";
2
+ const s = ["checked"], i = {
5
3
  __name: "UluFormCheckbox",
6
4
  props: {
7
- /**
8
- * The label for the checkbox.
9
- */
10
- label: String,
11
5
  /**
12
6
  * The value of the checkbox (for v-model).
13
7
  */
14
- modelValue: Boolean,
15
- /**
16
- * If true, the field will be required.
17
- */
18
- required: Boolean
8
+ modelValue: Boolean
19
9
  },
20
10
  emits: ["update:modelValue"],
21
- setup(e) {
22
- const t = h();
23
- return (o, r) => (l(), u(i, null, [
24
- d("input", {
25
- type: "checkbox",
26
- id: n(t),
27
- checked: e.modelValue,
28
- onChange: r[0] || (r[0] = (a) => o.$emit("update:modelValue", a.target.checked)),
29
- required: e.required
30
- }, null, 40, V),
31
- d("label", { for: n(t) }, [
32
- m(o.$slots, "default", {}, () => [
33
- c(k(e.label), 1),
34
- e.required ? (l(), s(p, { key: 0 })) : f("", !0)
35
- ])
36
- ], 8, b)
37
- ], 64));
11
+ setup(o) {
12
+ const e = n("uluFormFieldAttrs", null), l = r(() => e ? e.value : {});
13
+ return (u, t) => (d(), a("input", m({ type: "checkbox" }, l.value, {
14
+ checked: o.modelValue,
15
+ onChange: t[0] || (t[0] = (c) => u.$emit("update:modelValue", c.target.checked))
16
+ }), null, 16, s));
38
17
  }
39
18
  };
40
19
  export {
41
- x as default
20
+ i as default
42
21
  };
@@ -1,31 +1,9 @@
1
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
2
- export default _default;
3
- type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
- $slots: S;
5
- });
6
- declare const __VLS_component: import('vue').DefineComponent<{}, {
1
+ declare const _default: import('vue').DefineComponent<{}, {
7
2
  $emit: (event: "file-change", ...args: any[]) => void;
8
- required: boolean;
9
- label: string;
10
- labelHidden: boolean;
11
- noClasses: boolean;
12
3
  multiple: boolean;
13
- inputAttrs?: Record<string, any> | undefined;
14
4
  $props: {
15
- readonly required?: boolean | undefined;
16
- readonly label?: string | undefined;
17
- readonly labelHidden?: boolean | undefined;
18
- readonly noClasses?: boolean | undefined;
19
5
  readonly multiple?: boolean | undefined;
20
- readonly inputAttrs?: Record<string, any> | undefined;
21
- };
22
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
23
- type __VLS_TemplateResult = {
24
- attrs: Partial<{}>;
25
- slots: {
26
- label?(_: {}): any;
27
6
  };
28
- refs: {};
29
- rootEl: any;
30
- };
7
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLInputElement>;
8
+ export default _default;
31
9
  //# sourceMappingURL=UluFormFile.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UluFormFile.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/forms/UluFormFile.vue"],"names":[],"mappings":"AAkBA;wBAgLqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;2OAQG"}
1
+ {"version":3,"file":"UluFormFile.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/forms/UluFormFile.vue"],"names":[],"mappings":"AAQA;"}
@@ -1,61 +1,23 @@
1
- import { createElementBlock as s, openBlock as n, Fragment as c, createElementVNode as i, unref as o, normalizeClass as d, renderSlot as u, createTextVNode as f, createBlock as g, createCommentVNode as p, toDisplayString as h, mergeProps as b } from "vue";
2
- import { newId as B } from "../../utils/dom.js";
3
- import q from "./UluFormRequiredChar.vue.js";
4
- const y = ["for"], C = ["multiple", "id", "required"], V = {
1
+ import { inject as s, computed as c, createElementBlock as u, openBlock as a, mergeProps as m } from "vue";
2
+ const p = ["multiple"], d = {
5
3
  __name: "UluFormFile",
6
4
  props: {
7
- /**
8
- * The label for the file input.
9
- */
10
- label: {
11
- type: String,
12
- default: "Select File"
13
- },
14
- /**
15
- * If true, the label will be visually hidden.
16
- */
17
- labelHidden: Boolean,
18
- /**
19
- * If true, default classes will not be applied.
20
- */
21
- noClasses: Boolean,
22
5
  /**
23
6
  * If true, allows multiple file selection.
24
7
  */
25
- multiple: Boolean,
26
- /**
27
- * Additional attributes to bind to the input element.
28
- */
29
- inputAttrs: Object,
30
- /**
31
- * If true, the field will be required.
32
- */
33
- required: Boolean
8
+ multiple: Boolean
34
9
  },
35
10
  emits: ["file-change"],
36
- setup(e, { emit: r }) {
37
- const a = r, t = B(), m = (l) => {
38
- a("file-change", l.target.files);
11
+ setup(l, { emit: n }) {
12
+ const o = n, t = s("uluFormFieldAttrs", null), i = c(() => t ? { ...t.value } : {}), r = (e) => {
13
+ o("file-change", e.target.files);
39
14
  };
40
- return (l, F) => (n(), s(c, null, [
41
- i("label", {
42
- class: d({ "hidden-visually": e.labelHidden }),
43
- for: o(t)
44
- }, [
45
- u(l.$slots, "label", {}, () => [
46
- f(h(e.label), 1),
47
- e.required ? (n(), g(q, { key: 0 })) : p("", !0)
48
- ])
49
- ], 10, y),
50
- i("input", b({
51
- type: "file",
52
- onChange: m,
53
- multiple: e.multiple,
54
- id: o(t)
55
- }, e.inputAttrs, { required: e.required }), null, 16, C)
56
- ], 64));
15
+ return (e, f) => (a(), u("input", m({ type: "file" }, i.value, {
16
+ multiple: l.multiple,
17
+ onChange: r
18
+ }), null, 16, p));
57
19
  }
58
20
  };
59
21
  export {
60
- V as default
22
+ d as default
61
23
  };
@@ -4,27 +4,42 @@ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
4
  $slots: S;
5
5
  });
6
6
  declare const __VLS_component: import('vue').DefineComponent<{}, {
7
- text: boolean;
8
- select: boolean;
9
- textarea: boolean;
10
- file: boolean;
7
+ required: boolean;
11
8
  warning: boolean;
12
9
  error: boolean;
10
+ labelHidden: boolean;
13
11
  alignTop: boolean;
12
+ modifiers?: string | unknown[] | undefined;
13
+ description?: string | undefined;
14
+ label?: string | undefined;
15
+ layout?: string | undefined;
16
+ fieldId?: string | undefined;
17
+ errorMessage?: string | undefined;
18
+ warningMessage?: string | undefined;
14
19
  $props: {
15
- readonly text?: boolean | undefined;
16
- readonly select?: boolean | undefined;
17
- readonly textarea?: boolean | undefined;
18
- readonly file?: boolean | undefined;
20
+ readonly required?: boolean | undefined;
19
21
  readonly warning?: boolean | undefined;
20
22
  readonly error?: boolean | undefined;
23
+ readonly labelHidden?: boolean | undefined;
21
24
  readonly alignTop?: boolean | undefined;
25
+ readonly modifiers?: string | unknown[] | undefined;
26
+ readonly description?: string | undefined;
27
+ readonly label?: string | undefined;
28
+ readonly layout?: string | undefined;
29
+ readonly fieldId?: string | undefined;
30
+ readonly errorMessage?: string | undefined;
31
+ readonly warningMessage?: string | undefined;
22
32
  };
23
33
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
24
34
  type __VLS_TemplateResult = {
25
35
  attrs: Partial<{}>;
26
36
  slots: {
37
+ label?(_: {}): any;
38
+ label?(_: {}): any;
27
39
  default?(_: {}): any;
40
+ description?(_: {}): any;
41
+ errorMessage?(_: {}): any;
42
+ warningMessage?(_: {}): any;
28
43
  };
29
44
  refs: {};
30
45
  rootEl: HTMLDivElement;
@@ -1 +1 @@
1
- {"version":3,"file":"UluFormItem.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/forms/UluFormItem.vue"],"names":[],"mappings":"AAgBA;wBA4IqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;sPAQG"}
1
+ {"version":3,"file":"UluFormItem.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/forms/UluFormItem.vue"],"names":[],"mappings":"AAuDA;wBAkbqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;;;;;sPAQG"}
@@ -1,52 +1,149 @@
1
- import { createElementBlock as o, openBlock as a, normalizeClass as l, renderSlot as m } from "vue";
2
- const i = {
1
+ import { useSlots as I, computed as i, provide as q, createElementBlock as H, openBlock as o, normalizeClass as p, unref as A, createBlock as d, createCommentVNode as u, renderSlot as t, withCtx as g, createTextVNode as c, toDisplayString as f } from "vue";
2
+ import { newId as C } from "../../utils/dom.js";
3
+ import { useModifiers as F } from "../../composables/useModifiers.js";
4
+ import m from "./UluFormMessage.vue.js";
5
+ import h from "./UluFormLabel.vue.js";
6
+ const j = {
3
7
  __name: "UluFormItem",
4
8
  props: {
5
9
  /**
6
- * If true, applies the error state styles.
10
+ * The layout variant for this form item (e.g., 'text', 'select', 'textarea', 'checkbox', 'radio', 'file').
11
+ * This determines the layout and BEM styling of the item container.
7
12
  */
8
- error: Boolean,
13
+ layout: String,
9
14
  /**
10
- * If true, applies the warning state styles.
15
+ * The ID to use for the form field. If not provided, a unique ID is generated.
11
16
  */
12
- warning: Boolean,
17
+ fieldId: String,
13
18
  /**
14
- * If true, aligns the item to the top.
19
+ * The label for the form field.
15
20
  */
16
- alignTop: Boolean,
21
+ label: String,
22
+ /**
23
+ * If true, the label will be visually hidden.
24
+ */
25
+ labelHidden: Boolean,
26
+ /**
27
+ * The description text for the form field.
28
+ */
29
+ description: String,
30
+ /**
31
+ * The error message text.
32
+ */
33
+ errorMessage: String,
34
+ /**
35
+ * The warning message text.
36
+ */
37
+ warningMessage: String,
17
38
  /**
18
- * If true, applies the text item styles.
39
+ * If true, the field will be marked as required.
19
40
  */
20
- text: Boolean,
41
+ required: Boolean,
21
42
  /**
22
- * If true, applies the file item styles.
43
+ * If true, applies the error state styles.
23
44
  */
24
- file: Boolean,
45
+ error: Boolean,
25
46
  /**
26
- * If true, applies the select item styles.
47
+ * If true, applies the warning state styles.
27
48
  */
28
- select: Boolean,
49
+ warning: Boolean,
50
+ /**
51
+ * If true, aligns the item to the top.
52
+ */
53
+ alignTop: Boolean,
29
54
  /**
30
- * If true, applies the textarea item styles.
55
+ * Additional BEM modifiers for the form item.
31
56
  */
32
- textarea: Boolean
57
+ modifiers: [String, Array]
33
58
  },
34
- setup(e) {
35
- return (t, n) => (a(), o("div", {
36
- class: l(["form-theme__item", [{
37
- "is-danger": e.error,
38
- "is-warning": e.warning,
39
- "form-theme__item--align-top": e.alignTop,
40
- "form-theme__item--text": e.text,
41
- "form-theme__item--file": e.file,
42
- "form-theme__item--select": e.select,
43
- "form-theme__item--textarea": e.textarea
44
- }]])
59
+ setup(r) {
60
+ const e = r, s = I(), { resolvedModifiers: S } = F({
61
+ props: e,
62
+ baseClass: "form-theme__item",
63
+ internal: i(() => ({
64
+ [e.layout]: e.layout,
65
+ "align-top": e.alignTop
66
+ }))
67
+ }), l = i(() => e.fieldId || C()), v = i(() => `${l.value}-desc`), b = i(() => `${l.value}-error`), M = i(() => `${l.value}-warn`), w = i(() => !!e.label || !!s.label), $ = i(() => e.error || !!e.errorMessage || !!s.errorMessage), k = i(() => e.warning || !!e.warningMessage || !!s.warningMessage), y = i(() => ["checkbox", "radio"].includes(e.layout)), B = i(() => {
68
+ const a = {
69
+ id: l.value
70
+ }, n = [];
71
+ return (e.description || s.description) && n.push(v.value), (e.errorMessage || s.errorMessage) && n.push(b.value), (e.warningMessage || s.warningMessage) && n.push(M.value), n.length > 0 && (a["aria-describedby"] = n.join(" ")), $.value && (a["aria-invalid"] = "true"), a;
72
+ });
73
+ return q("uluFormFieldAttrs", B), (a, n) => (o(), H("div", {
74
+ class: p(["form-theme__item", [
75
+ A(S),
76
+ {
77
+ "is-danger": $.value,
78
+ "is-warning": k.value
79
+ }
80
+ ]])
45
81
  }, [
46
- m(t.$slots, "default")
82
+ !y.value && w.value ? (o(), d(h, {
83
+ key: 0,
84
+ id: l.value,
85
+ labelHidden: r.labelHidden,
86
+ required: r.required
87
+ }, {
88
+ default: g(() => [
89
+ t(a.$slots, "label", {}, () => [
90
+ c(f(r.label), 1)
91
+ ])
92
+ ]),
93
+ _: 3
94
+ }, 8, ["id", "labelHidden", "required"])) : u("", !0),
95
+ t(a.$slots, "default"),
96
+ y.value && w.value ? (o(), d(h, {
97
+ key: 1,
98
+ id: l.value,
99
+ labelHidden: r.labelHidden,
100
+ required: r.required
101
+ }, {
102
+ default: g(() => [
103
+ t(a.$slots, "label", {}, () => [
104
+ c(f(r.label), 1)
105
+ ])
106
+ ]),
107
+ _: 3
108
+ }, 8, ["id", "labelHidden", "required"])) : u("", !0),
109
+ r.description || a.$slots.description ? (o(), d(m, {
110
+ key: 2,
111
+ id: v.value
112
+ }, {
113
+ default: g(() => [
114
+ t(a.$slots, "description", {}, () => [
115
+ c(f(r.description), 1)
116
+ ])
117
+ ]),
118
+ _: 3
119
+ }, 8, ["id"])) : u("", !0),
120
+ r.errorMessage || a.$slots.errorMessage ? (o(), d(m, {
121
+ key: 3,
122
+ id: b.value,
123
+ error: ""
124
+ }, {
125
+ default: g(() => [
126
+ t(a.$slots, "errorMessage", {}, () => [
127
+ c(f(r.errorMessage), 1)
128
+ ])
129
+ ]),
130
+ _: 3
131
+ }, 8, ["id"])) : u("", !0),
132
+ r.warningMessage || a.$slots.warningMessage ? (o(), d(m, {
133
+ key: 4,
134
+ id: M.value,
135
+ warning: ""
136
+ }, {
137
+ default: g(() => [
138
+ t(a.$slots, "warningMessage", {}, () => [
139
+ c(f(r.warningMessage), 1)
140
+ ])
141
+ ]),
142
+ _: 3
143
+ }, 8, ["id"])) : u("", !0)
47
144
  ], 2));
48
145
  }
49
146
  };
50
147
  export {
51
- i as default
148
+ j as default
52
149
  };