@ulu/frontend-vue 0.5.15 → 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 (75) 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/systems/scroll-anchors/UluScrollAnchors.vue.d.ts.map +1 -1
  36. package/dist/components/systems/scroll-anchors/UluScrollAnchors.vue.js +18 -10
  37. package/dist/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue.d.ts +8 -2
  38. package/dist/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue.d.ts.map +1 -1
  39. package/dist/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue.js +92 -47
  40. package/dist/components/systems/scroll-anchors/useScrollAnchors.d.ts.map +1 -1
  41. package/dist/components/systems/scroll-anchors/useScrollAnchors.js +113 -70
  42. package/dist/components/utils/UluAction.vue.d.ts +2 -0
  43. package/dist/components/utils/UluAction.vue.d.ts.map +1 -1
  44. package/dist/components/utils/UluAction.vue.js +9 -5
  45. package/dist/components/visualizations/UluProgressBar.vue.d.ts +2 -2
  46. package/dist/index.js +130 -128
  47. package/dist/plugins/core/index.d.ts.map +1 -1
  48. package/dist/plugins/core/index.js +17 -16
  49. package/dist/utils/props.d.ts +7 -0
  50. package/dist/utils/props.d.ts.map +1 -1
  51. package/dist/utils/props.js +8 -2
  52. package/lib/components/elements/UluButton.vue +18 -3
  53. package/lib/components/elements/UluIcon.vue +8 -26
  54. package/lib/components/forms/UluForm.vue +25 -25
  55. package/lib/components/forms/UluFormCheckbox.vue +11 -25
  56. package/lib/components/forms/UluFormFieldset.vue +6 -6
  57. package/lib/components/forms/UluFormFile.vue +10 -40
  58. package/lib/components/forms/UluFormItem.vue +150 -39
  59. package/lib/components/forms/UluFormLabel.vue +30 -0
  60. package/lib/components/forms/UluFormRadio.vue +15 -34
  61. package/lib/components/forms/UluFormSelect.vue +19 -24
  62. package/lib/components/forms/UluFormText.vue +7 -25
  63. package/lib/components/forms/UluFormTextarea.vue +7 -25
  64. package/lib/components/forms/UluSearchForm.vue +67 -19
  65. package/lib/components/forms/UluSelectableMenu.vue +62 -62
  66. package/lib/components/index.js +1 -0
  67. package/lib/components/systems/facets/UluFacetsFilterSelects.vue +11 -14
  68. package/lib/components/systems/scroll-anchors/UluScrollAnchors.vue +9 -1
  69. package/lib/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue +95 -16
  70. package/lib/components/systems/scroll-anchors/_scroll-anchors-nav-animated.scss +12 -1
  71. package/lib/components/systems/scroll-anchors/useScrollAnchors.js +195 -54
  72. package/lib/components/utils/UluAction.vue +6 -2
  73. package/lib/plugins/core/index.js +2 -1
  74. package/lib/utils/props.js +14 -0
  75. package/package.json +3 -3
@@ -14,29 +14,29 @@
14
14
  </template>
15
15
 
16
16
  <script setup>
17
- defineProps({
18
- /**
19
- * The HTML element to use for the form.
20
- */
21
- element: {
22
- type: String,
23
- default: 'form'
24
- },
25
- /**
26
- * If true, applies the full-width styles to text inputs.
27
- */
28
- fullWidth: Boolean,
29
- /**
30
- * If true, applies the full-width styles to select inputs.
31
- */
32
- fullWidthSelect: Boolean,
33
- /**
34
- * If true, hides all labels in the form.
35
- */
36
- hideLabels: Boolean,
37
- /**
38
- * If true, right-aligns the form actions.
39
- */
40
- actionsRight: Boolean
41
- });
17
+ defineProps({
18
+ /**
19
+ * The HTML element to use for the form.
20
+ */
21
+ element: {
22
+ type: String,
23
+ default: 'form'
24
+ },
25
+ /**
26
+ * If true, applies the full-width styles to text inputs.
27
+ */
28
+ fullWidth: Boolean,
29
+ /**
30
+ * If true, applies the full-width styles to select inputs.
31
+ */
32
+ fullWidthSelect: Boolean,
33
+ /**
34
+ * If true, hides all labels in the form.
35
+ */
36
+ hideLabels: Boolean,
37
+ /**
38
+ * If true, right-aligns the form actions.
39
+ */
40
+ actionsRight: Boolean
41
+ });
42
42
  </script>
@@ -1,38 +1,24 @@
1
1
  <template>
2
2
  <input
3
3
  type="checkbox"
4
- :id="id"
4
+ v-bind="fieldAttrs"
5
5
  :checked="modelValue"
6
6
  @change="$emit('update:modelValue', $event.target.checked)"
7
- :required="required"
8
7
  >
9
- <label :for="id">
10
- <slot>
11
- {{ label }}<UluFormRequiredChar v-if="required" />
12
- </slot>
13
- </label>
14
8
  </template>
15
9
 
16
10
  <script setup>
17
- import { newId } from "../../utils/dom.js";
18
- import UluFormRequiredChar from "./UluFormRequiredChar.vue";
11
+ import { inject, computed } from "vue";
19
12
 
20
- defineProps({
21
- /**
22
- * The label for the checkbox.
23
- */
24
- label: String,
25
- /**
26
- * The value of the checkbox (for v-model).
27
- */
28
- modelValue: Boolean,
29
- /**
30
- * If true, the field will be required.
31
- */
32
- required: Boolean
33
- });
13
+ const props = defineProps({
14
+ /**
15
+ * The value of the checkbox (for v-model).
16
+ */
17
+ modelValue: Boolean
18
+ });
34
19
 
35
- defineEmits(['update:modelValue']);
20
+ defineEmits(["update:modelValue"]);
36
21
 
37
- const id = newId();
22
+ const injectedAttrs = inject("uluFormFieldAttrs", null);
23
+ const fieldAttrs = computed(() => injectedAttrs ? injectedAttrs.value : {});
38
24
  </script>
@@ -6,10 +6,10 @@
6
6
  </template>
7
7
 
8
8
  <script setup>
9
- defineProps({
10
- /**
11
- * The legend for the fieldset.
12
- */
13
- legend: String
14
- });
9
+ defineProps({
10
+ /**
11
+ * The legend for the fieldset.
12
+ */
13
+ legend: String
14
+ });
15
15
  </script>
@@ -1,59 +1,29 @@
1
1
  <template>
2
- <label
3
- :class="{ 'hidden-visually' : labelHidden }"
4
- :for="id"
5
- >
6
- <slot name="label">
7
- {{ label }}<UluFormRequiredChar v-if="required" />
8
- </slot>
9
- </label>
10
2
  <input
11
3
  type="file"
12
- @change="onChangeFile"
4
+ v-bind="fieldAttrs"
13
5
  :multiple="multiple"
14
- :id="id"
15
- v-bind="inputAttrs"
16
- :required="required"
6
+ @change="onChangeFile"
17
7
  />
18
8
  </template>
19
9
 
20
10
  <script setup>
21
- import { newId } from "../../utils/dom.js";
22
- import UluFormRequiredChar from "./UluFormRequiredChar.vue";
11
+ import { inject, computed } from "vue";
23
12
 
24
- defineProps({
25
- /**
26
- * The label for the file input.
27
- */
28
- label: {
29
- type: String,
30
- default: "Select File"
31
- },
32
- /**
33
- * If true, the label will be visually hidden.
34
- */
35
- labelHidden: Boolean,
36
- /**
37
- * If true, default classes will not be applied.
38
- */
39
- noClasses: Boolean,
13
+ const props = defineProps({
40
14
  /**
41
15
  * If true, allows multiple file selection.
42
16
  */
43
- multiple: Boolean,
44
- /**
45
- * Additional attributes to bind to the input element.
46
- */
47
- inputAttrs: Object,
48
- /**
49
- * If true, the field will be required.
50
- */
51
- required: Boolean
17
+ multiple: Boolean
52
18
  });
53
19
 
54
20
  const emit = defineEmits(["file-change"]);
55
21
 
56
- const id = newId();
22
+ const injectedAttrs = inject("uluFormFieldAttrs", null);
23
+ const fieldAttrs = computed(() => {
24
+ const attrs = injectedAttrs ? { ...injectedAttrs.value } : {};
25
+ return attrs;
26
+ });
57
27
 
58
28
  const onChangeFile = (event) => {
59
29
  emit("file-change", event.target.files);
@@ -1,49 +1,160 @@
1
1
  <template>
2
2
  <div
3
3
  class="form-theme__item"
4
- :class="[{
5
- 'is-danger': error,
6
- 'is-warning': warning,
7
- 'form-theme__item--align-top': alignTop,
8
- 'form-theme__item--text': text,
9
- 'form-theme__item--file': file,
10
- 'form-theme__item--select': select,
11
- 'form-theme__item--textarea': textarea
12
- }]"
4
+ :class="[
5
+ resolvedModifiers,
6
+ {
7
+ 'is-danger': hasError,
8
+ 'is-warning': hasWarning
9
+ }
10
+ ]"
13
11
  >
12
+ <UluFormLabel
13
+ v-if="!isLabelAfter && hasLabel"
14
+ :id="internalId"
15
+ :labelHidden="labelHidden"
16
+ :required="required"
17
+ >
18
+ <slot name="label">{{ label }}</slot>
19
+ </UluFormLabel>
20
+
14
21
  <slot />
22
+
23
+ <UluFormLabel
24
+ v-if="isLabelAfter && hasLabel"
25
+ :id="internalId"
26
+ :labelHidden="labelHidden"
27
+ :required="required"
28
+ >
29
+ <slot name="label">{{ label }}</slot>
30
+ </UluFormLabel>
31
+
32
+ <UluFormMessage
33
+ v-if="description || $slots.description"
34
+ :id="descriptionId"
35
+ >
36
+ <slot name="description">{{ description }}</slot>
37
+ </UluFormMessage>
38
+
39
+ <UluFormMessage
40
+ v-if="errorMessage || $slots.errorMessage"
41
+ :id="errorId"
42
+ error
43
+ >
44
+ <slot name="errorMessage">{{ errorMessage }}</slot>
45
+ </UluFormMessage>
46
+
47
+ <UluFormMessage
48
+ v-if="warningMessage || $slots.warningMessage"
49
+ :id="warningId"
50
+ warning
51
+ >
52
+ <slot name="warningMessage">{{ warningMessage }}</slot>
53
+ </UluFormMessage>
15
54
  </div>
16
55
  </template>
17
56
 
18
57
  <script setup>
19
- defineProps({
20
- /**
21
- * If true, applies the error state styles.
22
- */
23
- error: Boolean,
24
- /**
25
- * If true, applies the warning state styles.
26
- */
27
- warning: Boolean,
28
- /**
29
- * If true, aligns the item to the top.
30
- */
31
- alignTop: Boolean,
32
- /**
33
- * If true, applies the text item styles.
34
- */
35
- text: Boolean,
36
- /**
37
- * If true, applies the file item styles.
38
- */
39
- file: Boolean,
40
- /**
41
- * If true, applies the select item styles.
42
- */
43
- select: Boolean,
44
- /**
45
- * If true, applies the textarea item styles.
46
- */
47
- textarea: Boolean
48
- });
58
+ import { provide, computed, useSlots } from "vue";
59
+ import { newId } from "../../utils/dom.js";
60
+ import { useModifiers } from "../../composables/useModifiers.js";
61
+ import UluFormMessage from "./UluFormMessage.vue";
62
+ import UluFormLabel from "./UluFormLabel.vue";
63
+
64
+ const props = defineProps({
65
+ /**
66
+ * The layout variant for this form item (e.g., 'text', 'select', 'textarea', 'checkbox', 'radio', 'file').
67
+ * This determines the layout and BEM styling of the item container.
68
+ */
69
+ layout: String,
70
+ /**
71
+ * The ID to use for the form field. If not provided, a unique ID is generated.
72
+ */
73
+ fieldId: String,
74
+ /**
75
+ * The label for the form field.
76
+ */
77
+ label: String,
78
+ /**
79
+ * If true, the label will be visually hidden.
80
+ */
81
+ labelHidden: Boolean,
82
+ /**
83
+ * The description text for the form field.
84
+ */
85
+ description: String,
86
+ /**
87
+ * The error message text.
88
+ */
89
+ errorMessage: String,
90
+ /**
91
+ * The warning message text.
92
+ */
93
+ warningMessage: String,
94
+ /**
95
+ * If true, the field will be marked as required.
96
+ */
97
+ required: Boolean,
98
+ /**
99
+ * If true, applies the error state styles.
100
+ */
101
+ error: Boolean,
102
+ /**
103
+ * If true, applies the warning state styles.
104
+ */
105
+ warning: Boolean,
106
+ /**
107
+ * If true, aligns the item to the top.
108
+ */
109
+ alignTop: Boolean,
110
+ /**
111
+ * Additional BEM modifiers for the form item.
112
+ */
113
+ modifiers: [String, Array]
114
+ });
115
+
116
+ const slots = useSlots();
117
+
118
+ const { resolvedModifiers } = useModifiers({
119
+ props,
120
+ baseClass: "form-theme__item",
121
+ internal: computed(() => ({
122
+ [props.layout]: props.layout,
123
+ "align-top": props.alignTop
124
+ }))
125
+ });
126
+
127
+ const internalId = computed(() => props.fieldId || newId());
128
+ const descriptionId = computed(() => `${ internalId.value }-desc`);
129
+ const errorId = computed(() => `${ internalId.value }-error`);
130
+ const warningId = computed(() => `${ internalId.value }-warn`);
131
+
132
+ const hasLabel = computed(() => !!props.label || !!slots.label);
133
+ const hasError = computed(() => props.error || !!props.errorMessage || !!slots.errorMessage);
134
+ const hasWarning = computed(() => props.warning || !!props.warningMessage || !!slots.warningMessage);
135
+
136
+ const isLabelAfter = computed(() => ["checkbox", "radio"].includes(props.layout));
137
+
138
+ const fieldAttrs = computed(() => {
139
+ const attrs = {
140
+ id: internalId.value
141
+ };
142
+
143
+ const describedBy = [];
144
+ if (props.description || slots.description) describedBy.push(descriptionId.value);
145
+ if (props.errorMessage || slots.errorMessage) describedBy.push(errorId.value);
146
+ if (props.warningMessage || slots.warningMessage) describedBy.push(warningId.value);
147
+
148
+ if (describedBy.length > 0) {
149
+ attrs["aria-describedby"] = describedBy.join(" ");
150
+ }
151
+
152
+ if (hasError.value) {
153
+ attrs["aria-invalid"] = "true";
154
+ }
155
+
156
+ return attrs;
157
+ });
158
+
159
+ provide("uluFormFieldAttrs", fieldAttrs);
49
160
  </script>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <label
3
+ :for="id"
4
+ :class="{ 'hidden-visually': labelHidden }"
5
+ >
6
+ <slot></slot><UluFormRequiredChar v-if="required" />
7
+ </label>
8
+ </template>
9
+
10
+ <script setup>
11
+ import UluFormRequiredChar from "./UluFormRequiredChar.vue";
12
+
13
+ defineProps({
14
+ /**
15
+ * The ID of the input this label is associated with.
16
+ */
17
+ id: {
18
+ type: String,
19
+ required: true
20
+ },
21
+ /**
22
+ * If true, the label will be visually hidden.
23
+ */
24
+ labelHidden: Boolean,
25
+ /**
26
+ * If true, appends the required character.
27
+ */
28
+ required: Boolean
29
+ });
30
+ </script>
@@ -1,48 +1,29 @@
1
1
  <template>
2
2
  <input
3
3
  type="radio"
4
- :id="id"
5
- :name="name"
4
+ v-bind="fieldAttrs"
6
5
  :value="value"
7
6
  :checked="modelValue === value"
8
7
  @change="$emit('update:modelValue', value)"
9
- :required="required"
10
8
  >
11
- <label :for="id">
12
- <slot>
13
- {{ label }}<UluFormRequiredChar v-if="required" />
14
- </slot>
15
- </label>
16
9
  </template>
17
10
 
18
11
  <script setup>
19
- import { newId } from "../../utils/dom.js";
20
- import UluFormRequiredChar from "./UluFormRequiredChar.vue";
12
+ import { inject, computed } from "vue";
21
13
 
22
- defineProps({
23
- /**
24
- * The label for the radio button.
25
- */
26
- label: String,
27
- /**
28
- * The value of the selected radio button in the group (for v-model).
29
- */
30
- modelValue: [String, Number],
31
- /**
32
- * The value of this radio button.
33
- */
34
- value: [String, Number],
35
- /**
36
- * The name of the radio button group.
37
- */
38
- name: String,
39
- /**
40
- * If true, the field will be required.
41
- */
42
- required: Boolean
43
- });
14
+ const props = defineProps({
15
+ /**
16
+ * The value of the selected radio button in the group (for v-model).
17
+ */
18
+ modelValue: [String, Number, Boolean],
19
+ /**
20
+ * The value of this radio button.
21
+ */
22
+ value: [String, Number, Boolean]
23
+ });
44
24
 
45
- defineEmits(['update:modelValue']);
25
+ defineEmits(["update:modelValue"]);
46
26
 
47
- const id = newId();
27
+ const injectedAttrs = inject("uluFormFieldAttrs", null);
28
+ const fieldAttrs = computed(() => injectedAttrs ? injectedAttrs.value : {});
48
29
  </script>
@@ -1,16 +1,16 @@
1
1
  <template>
2
- <label :class="{ 'hidden-visually' : labelHidden }" :for="id">
3
- <slot name="label">
4
- {{ label }}<UluFormRequiredChar v-if="required" />
5
- </slot>
6
- </label>
7
2
  <select
8
- :id="id"
3
+ v-bind="fieldAttrs"
9
4
  :value="modelValue"
10
5
  @input="$emit('update:modelValue', $event.target.value)"
11
- :required="required"
12
6
  >
13
- <option disabled value="">Please select one</option>
7
+ <option
8
+ v-if="placeholder !== false"
9
+ disabled
10
+ value=""
11
+ >
12
+ {{ placeholder || "Please select one" }}
13
+ </option>
14
14
  <option v-for="(option, index) in options" :key="index" :value="option.value">
15
15
  {{ option.text }}
16
16
  </option>
@@ -18,33 +18,28 @@
18
18
  </template>
19
19
 
20
20
  <script setup>
21
- import { newId } from "../../utils/dom.js";
22
- import UluFormRequiredChar from "./UluFormRequiredChar.vue";
21
+ import { inject, computed } from "vue";
23
22
 
24
- defineProps({
25
- /**
26
- * The label for the select input.
27
- */
28
- label: String,
23
+ const props = defineProps({
29
24
  /**
30
25
  * The value of the select input (for v-model).
31
26
  */
32
- modelValue: String,
27
+ modelValue: [String, Number, Array],
33
28
  /**
34
29
  * An array of options for the select input. Each option should be an object with `value` and `text` properties.
35
30
  */
36
31
  options: Array,
37
32
  /**
38
- * If true, the label will be visually hidden.
39
- */
40
- labelHidden: Boolean,
41
- /**
42
- * If true, the field will be required.
33
+ * The text for the default disabled option. Pass false to hide it.
43
34
  */
44
- required: Boolean
35
+ placeholder: {
36
+ type: [String, Boolean],
37
+ default: "Please select one"
38
+ }
45
39
  });
46
40
 
47
- defineEmits(['update:modelValue']);
41
+ defineEmits(["update:modelValue"]);
48
42
 
49
- const id = newId();
43
+ const injectedAttrs = inject("uluFormFieldAttrs", null);
44
+ const fieldAttrs = computed(() => injectedAttrs ? injectedAttrs.value : {});
50
45
  </script>
@@ -1,42 +1,24 @@
1
1
  <template>
2
- <label :class="{ 'hidden-visually' : labelHidden }" :for="id">
3
- <slot name="label">
4
- {{ label }}<UluFormRequiredChar v-if="required" />
5
- </slot>
6
- </label>
7
2
  <input
8
3
  type="text"
4
+ v-bind="fieldAttrs"
9
5
  :value="modelValue"
10
6
  @input="$emit('update:modelValue', $event.target.value)"
11
- :id="id"
12
- :required="required"
13
7
  >
14
8
  </template>
15
9
 
16
10
  <script setup>
17
- import { newId } from "../../utils/dom.js";
18
- import UluFormRequiredChar from "./UluFormRequiredChar.vue";
11
+ import { inject, computed } from "vue";
19
12
 
20
- defineProps({
21
- /**
22
- * The label for the text input.
23
- */
24
- label: String,
13
+ const props = defineProps({
25
14
  /**
26
15
  * The value of the text input (for v-model).
27
16
  */
28
- modelValue: String,
29
- /**
30
- * If true, the label will be visually hidden.
31
- */
32
- labelHidden: Boolean,
33
- /**
34
- * If true, the field will be required.
35
- */
36
- required: Boolean
17
+ modelValue: [String, Number]
37
18
  });
38
19
 
39
- defineEmits(['update:modelValue']);
20
+ defineEmits(["update:modelValue"]);
40
21
 
41
- const id = newId();
22
+ const injectedAttrs = inject("uluFormFieldAttrs", null);
23
+ const fieldAttrs = computed(() => injectedAttrs ? injectedAttrs.value : {});
42
24
  </script>
@@ -1,41 +1,23 @@
1
1
  <template>
2
- <label :class="{ 'hidden-visually' : labelHidden }" :for="id">
3
- <slot name="label">
4
- {{ label }}<UluFormRequiredChar v-if="required" />
5
- </slot>
6
- </label>
7
2
  <textarea
3
+ v-bind="fieldAttrs"
8
4
  :value="modelValue"
9
5
  @input="$emit('update:modelValue', $event.target.value)"
10
- :id="id"
11
- :required="required"
12
6
  ></textarea>
13
7
  </template>
14
8
 
15
9
  <script setup>
16
- import { newId } from "../../utils/dom.js";
17
- import UluFormRequiredChar from "./UluFormRequiredChar.vue";
10
+ import { inject, computed } from "vue";
18
11
 
19
- defineProps({
20
- /**
21
- * The label for the textarea.
22
- */
23
- label: String,
12
+ const props = defineProps({
24
13
  /**
25
14
  * The value of the textarea (for v-model).
26
15
  */
27
- modelValue: String,
28
- /**
29
- * If true, the label will be visually hidden.
30
- */
31
- labelHidden: Boolean,
32
- /**
33
- * If true, the field will be required.
34
- */
35
- required: Boolean
16
+ modelValue: [String, Number]
36
17
  });
37
18
 
38
- defineEmits(['update:modelValue']);
19
+ defineEmits(["update:modelValue"]);
39
20
 
40
- const id = newId();
21
+ const injectedAttrs = inject("uluFormFieldAttrs", null);
22
+ const fieldAttrs = computed(() => injectedAttrs ? injectedAttrs.value : {});
41
23
  </script>