vueless 0.0.569 → 0.0.571

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 (81) hide show
  1. package/package.json +1 -1
  2. package/types.ts +24 -3
  3. package/ui.button/types.ts +2 -2
  4. package/ui.container-accordion/UAccordion.vue +2 -2
  5. package/ui.container-accordion/types.ts +1 -0
  6. package/ui.container-modal/UModal.vue +15 -8
  7. package/ui.container-page/UPage.vue +10 -6
  8. package/ui.form-checkbox/types.ts +7 -0
  9. package/ui.form-checkbox-group/UCheckboxGroup.vue +1 -1
  10. package/ui.form-checkbox-multi-state/UCheckboxMultiState.vue +4 -1
  11. package/ui.form-color-picker/UColorPicker.vue +67 -147
  12. package/ui.form-color-picker/storybook/Docs.mdx +2 -2
  13. package/ui.form-color-picker/storybook/{stories.js → stories.ts} +13 -5
  14. package/ui.form-color-picker/types.ts +64 -0
  15. package/ui.form-color-picker/useAttrs.ts +15 -0
  16. package/ui.form-input/UInput.vue +162 -321
  17. package/ui.form-input/{config.js → config.ts} +3 -0
  18. package/ui.form-input/storybook/Docs.mdx +2 -2
  19. package/ui.form-input/storybook/{stories.js → stories.ts} +14 -6
  20. package/ui.form-input/types.ts +103 -0
  21. package/ui.form-input/useAttrs.ts +31 -0
  22. package/ui.form-input-file/UInputFile.vue +188 -245
  23. package/ui.form-input-file/storybook/Docs.mdx +2 -2
  24. package/ui.form-input-file/storybook/{stories.js → stories.ts} +13 -5
  25. package/ui.form-input-file/types.ts +72 -0
  26. package/ui.form-input-file/useAttrs.ts +21 -0
  27. package/ui.form-input-file/{utilFileForm.js → utilFileForm.ts} +1 -1
  28. package/ui.form-input-money/UInputMoney.vue +76 -223
  29. package/ui.form-input-money/storybook/Docs.mdx +2 -2
  30. package/ui.form-input-money/storybook/{stories.js → stories.ts} +14 -6
  31. package/ui.form-input-money/types.ts +118 -0
  32. package/ui.form-input-money/useAttrs.ts +15 -0
  33. package/ui.form-input-money/{useFormatCurrency.js → useFormatCurrency.ts} +28 -17
  34. package/ui.form-input-money/utilFormat.ts +83 -0
  35. package/ui.form-input-number/UInputNumber.vue +69 -156
  36. package/ui.form-input-number/storybook/Docs.mdx +2 -2
  37. package/ui.form-input-number/storybook/{stories.js → stories.ts} +17 -9
  38. package/ui.form-input-number/types.ts +65 -0
  39. package/ui.form-input-number/useAttrs.ts +15 -0
  40. package/ui.form-input-rating/UInputRating.vue +70 -158
  41. package/ui.form-input-rating/storybook/Docs.mdx +2 -2
  42. package/ui.form-input-rating/storybook/{stories.js → stories.ts} +14 -6
  43. package/ui.form-input-rating/types.ts +67 -0
  44. package/ui.form-input-rating/useAttrs.ts +14 -0
  45. package/ui.form-input-search/UInputSearch.vue +97 -224
  46. package/ui.form-input-search/storybook/Docs.mdx +2 -2
  47. package/ui.form-input-search/storybook/{stories.js → stories.ts} +13 -5
  48. package/ui.form-input-search/types.ts +93 -0
  49. package/ui.form-input-search/useAttrs.ts +15 -0
  50. package/ui.form-radio/URadio.vue +1 -1
  51. package/ui.form-radio-group/URadioGroup.vue +1 -1
  52. package/ui.navigation-pagination/UPagination.vue +15 -15
  53. package/ui.navigation-pagination/types.ts +3 -0
  54. package/ui.navigation-progress/UProgress.vue +16 -2
  55. package/ui.navigation-progress/types.ts +2 -0
  56. package/ui.text-files/UFiles.vue +20 -16
  57. package/ui.text-files/types.ts +1 -1
  58. package/ui.text-notify/UNotify.vue +38 -48
  59. package/ui.text-notify/types.ts +24 -0
  60. package/web-types.json +227 -138
  61. package/ui.form-color-picker/useAttrs.js +0 -9
  62. package/ui.form-input/useAttrs.js +0 -15
  63. package/ui.form-input-file/useAttrs.js +0 -15
  64. package/ui.form-input-money/useAttrs.js +0 -9
  65. package/ui.form-input-money/utilFormat.js +0 -75
  66. package/ui.form-input-number/useAttrs.js +0 -9
  67. package/ui.form-input-rating/useAttrs.js +0 -8
  68. package/ui.form-input-search/useAttrs.js +0 -9
  69. /package/ui.form-color-picker/{config.js → config.ts} +0 -0
  70. /package/ui.form-color-picker/{constants.js → constants.ts} +0 -0
  71. /package/ui.form-input/{constants.js → constants.ts} +0 -0
  72. /package/ui.form-input-file/{config.js → config.ts} +0 -0
  73. /package/ui.form-input-file/{constants.js → constants.ts} +0 -0
  74. /package/ui.form-input-money/{config.js → config.ts} +0 -0
  75. /package/ui.form-input-money/{constants.js → constants.ts} +0 -0
  76. /package/ui.form-input-number/{config.js → config.ts} +0 -0
  77. /package/ui.form-input-number/{constants.js → constants.ts} +0 -0
  78. /package/ui.form-input-rating/{config.js → config.ts} +0 -0
  79. /package/ui.form-input-rating/{constants.js → constants.ts} +0 -0
  80. /package/ui.form-input-search/{config.js → config.ts} +0 -0
  81. /package/ui.form-input-search/{constants.js → constants.ts} +0 -0
@@ -8,6 +8,14 @@ import {
8
8
  import UInputFile from "../../ui.form-input-file/UInputFile.vue";
9
9
  import UCol from "../../ui.container-col/UCol.vue";
10
10
 
11
+ import type { Meta, StoryFn } from "@storybook/vue3";
12
+ import type { UInputFileProps } from "../types.ts";
13
+
14
+ interface UInputFileArgs extends UInputFileProps {
15
+ slotTemplate?: string;
16
+ enum: "labelAlign" | "size";
17
+ }
18
+
11
19
  export default {
12
20
  id: "30232",
13
21
  title: "Form Inputs & Controls / Input File",
@@ -21,9 +29,9 @@ export default {
21
29
  parameters: {
22
30
  ...getDocsDescription(UInputFile.__name),
23
31
  },
24
- };
32
+ } as Meta;
25
33
 
26
- const DefaultTemplate = (args) => ({
34
+ const DefaultTemplate: StoryFn<UInputFileArgs> = (args: UInputFileArgs) => ({
27
35
  components: { UInputFile },
28
36
  setup() {
29
37
  const slots = getSlotNames(UInputFile.__name);
@@ -42,17 +50,17 @@ const DefaultTemplate = (args) => ({
42
50
  v-model="files"
43
51
  v-model:error="error"
44
52
  >
45
- ${args.slotTemplate || getSlotsFragment()}
53
+ ${args.slotTemplate || getSlotsFragment("")}
46
54
  </UInputFile>
47
55
  `,
48
56
  });
49
57
 
50
- const EnumVariantTemplate = (args, { argTypes }) => ({
58
+ const EnumVariantTemplate: StoryFn<UInputFileArgs> = (args: UInputFileArgs, { argTypes }) => ({
51
59
  components: { UInputFile, UCol },
52
60
  setup() {
53
61
  return {
54
62
  args,
55
- options: argTypes[args.enum].options,
63
+ options: argTypes?.[args.enum]?.options,
56
64
  };
57
65
  },
58
66
  template: `
@@ -0,0 +1,72 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export type ButtonSize = "xs" | "sm" | "md";
6
+
7
+ export interface UInputFileProps {
8
+ /**
9
+ * Input value.
10
+ */
11
+ modelValue?: File | File[];
12
+
13
+ /**
14
+ * Input label.
15
+ */
16
+ label?: string;
17
+
18
+ /**
19
+ * Input description.
20
+ */
21
+ description?: string;
22
+
23
+ /**
24
+ * Error message.
25
+ */
26
+ error?: string;
27
+
28
+ /**
29
+ * Label placement.
30
+ */
31
+ labelAlign?: "top" | "topInside" | "topWithDesc";
32
+
33
+ /**
34
+ * Input size.
35
+ */
36
+ size?: "sm" | "md" | "lg";
37
+
38
+ /**
39
+ * Max file size in megabytes.
40
+ */
41
+ maxFileSize?: number;
42
+
43
+ /**
44
+ * Allowed file types.
45
+ */
46
+ allowedFileTypes?: string[];
47
+
48
+ /**
49
+ * Allow selecting multiple files.
50
+ */
51
+ multiple?: boolean;
52
+
53
+ /**
54
+ * Disable the input.
55
+ */
56
+ disabled?: boolean;
57
+
58
+ /**
59
+ * Unique element id.
60
+ */
61
+ id?: string;
62
+
63
+ /**
64
+ * Component config object.
65
+ */
66
+ config?: Config;
67
+
68
+ /**
69
+ * Data-test attribute for automated testing.
70
+ */
71
+ dataTest?: string;
72
+ }
@@ -0,0 +1,21 @@
1
+ import { computed } from "vue";
2
+ import useUI from "../composables/useUI.ts";
3
+
4
+ import defaultConfig from "./config.ts";
5
+
6
+ import type { UseAttrs } from "../types.ts";
7
+ import type { UInputFileProps, Config } from "./types.ts";
8
+
9
+ export default function useAttrs(props: UInputFileProps): UseAttrs<Config> {
10
+ const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
11
+
12
+ const mutatedProps = computed(() => ({
13
+ error: Boolean(props.error),
14
+ label: Boolean(props.label),
15
+ }));
16
+
17
+ return {
18
+ config,
19
+ ...getKeysAttrs(mutatedProps),
20
+ };
21
+ }
@@ -1,5 +1,5 @@
1
1
  const bytesInMegabyte = 1024 * 1024;
2
2
 
3
- export function getFileMbSize(file) {
3
+ export function getFileMbSize(file: File) {
4
4
  return (file.size / bytesInMegabyte).toFixed(2);
5
5
  }
@@ -1,234 +1,38 @@
1
- <template>
2
- <UInput
3
- :id="elementId"
4
- ref="moneyInputRef"
5
- v-model="formattedValue"
6
- :size="size"
7
- :label="localLabel"
8
- :label-align="labelAlign"
9
- :placeholder="placeholder"
10
- :description="description"
11
- :error="error"
12
- :disabled="disabled"
13
- inputmode="decimal"
14
- :left-icon="leftIcon"
15
- :right-icon="rightIcon"
16
- v-bind="moneyInputAttrs"
17
- :data-test="`${dataTest}-base-currency`"
18
- @keyup="onKeyup"
19
- @blur="onBlur"
20
- @input="onInput"
21
- >
22
- <template #left>
23
- <!-- @slot Use it to add something left. -->
24
- <slot name="left" />
25
- </template>
26
-
27
- <template #left-icon>
28
- <!-- @slot Use it to add icon before the text. -->
29
- <slot name="left-icon" />
30
- </template>
31
-
32
- <template #right-icon>
33
- <!-- @slot Use it to add icon after the text. -->
34
- <slot name="right-icon" />
35
- </template>
36
-
37
- <template #right>
38
- <!-- @slot Use it to add something right. -->
39
- <slot name="right" />
40
- </template>
41
- </UInput>
42
- </template>
43
-
44
- <script setup>
1
+ <script setup lang="ts">
45
2
  import { computed, ref, watch, onMounted, nextTick, useId } from "vue";
46
3
 
47
4
  import { getDefault } from "../utils/ui.ts";
48
5
 
49
6
  import UInput from "../ui.form-input/UInput.vue";
50
7
 
51
- import defaultConfig from "./config.js";
52
- import useAttrs from "./useAttrs.js";
53
- import useFormatCurrency from "./useFormatCurrency.js";
54
- import { UInputMoney } from "./constants.js";
55
-
56
- defineOptions({ inheritAttrs: false });
57
-
58
- const props = defineProps({
59
- /**
60
- * Input value.
61
- */
62
- modelValue: {
63
- type: [String, Number],
64
- default: "",
65
- },
66
- /**
67
- * Input label.
68
- */
69
- label: {
70
- type: String,
71
- default: "",
72
- },
73
-
74
- /**
75
- * Label placement.
76
- * @values top, topInside, topWithDesc, left, right
77
- */
78
- labelAlign: {
79
- type: String,
80
- default: getDefault(defaultConfig, UInputMoney).labelAlign,
81
- },
82
-
83
- /**
84
- * Currency symbol.
85
- */
86
- symbol: {
87
- type: String,
88
- default: getDefault(defaultConfig, UInputMoney).symbol,
89
- },
90
-
91
- /**
92
- * Input placeholder.
93
- */
94
- placeholder: {
95
- type: String,
96
- default: "",
97
- },
98
-
99
- /**
100
- * Input description.
101
- */
102
- description: {
103
- type: String,
104
- default: "",
105
- },
106
-
107
- /**
108
- * Error message.
109
- */
110
- error: {
111
- type: String,
112
- default: "",
113
- },
114
-
115
- /**
116
- * Input size.
117
- * @values sm, md, lg
118
- */
119
- size: {
120
- type: String,
121
- default: getDefault(defaultConfig, UInputMoney).size,
122
- },
123
-
124
- /**
125
- * Left icon name.
126
- */
127
- leftIcon: {
128
- type: String,
129
- default: "",
130
- },
131
-
132
- /**
133
- * Right icon name.
134
- */
135
- rightIcon: {
136
- type: String,
137
- default: "",
138
- },
139
-
140
- /**
141
- * Minimal number of signs after the decimal separator (fractional part of a number).
142
- */
143
- minFractionDigits: {
144
- type: Number,
145
- default: getDefault(defaultConfig, UInputMoney).minFractionDigits,
146
- },
147
-
148
- /**
149
- * Maximal number of signs after the decimal separator (fractional part of a number).
150
- */
151
- maxFractionDigits: {
152
- type: Number,
153
- default: getDefault(defaultConfig, UInputMoney).maxFractionDigits,
154
- },
155
-
156
- /**
157
- * A symbol used to separate the integer part from the fractional part of a number.
158
- */
159
- decimalSeparator: {
160
- type: String,
161
- default: getDefault(defaultConfig, UInputMoney).decimalSeparator,
162
- },
8
+ import defaultConfig from "./config.ts";
9
+ import useAttrs from "./useAttrs.ts";
10
+ import useFormatCurrency from "./useFormatCurrency.ts";
11
+ import { UInputMoney } from "./constants.ts";
163
12
 
164
- /**
165
- * A symbol used to separate the thousand parts of a number.
166
- */
167
- thousandsSeparator: {
168
- type: String,
169
- default: getDefault(defaultConfig, UInputMoney).thousandsSeparator,
170
- },
171
-
172
- /**
173
- * Allow only positive values.
174
- */
175
- positiveOnly: {
176
- type: Boolean,
177
- default: getDefault(defaultConfig, UInputMoney).positiveOnly,
178
- },
179
-
180
- /**
181
- * Prefix to display before input value.
182
- */
183
- prefix: {
184
- type: String,
185
- default: getDefault(defaultConfig, UInputMoney).prefix,
186
- },
13
+ import type { UInputMoneyProps } from "./types.ts";
187
14
 
188
- /**
189
- * Set input read-only.
190
- */
191
- readonly: {
192
- type: Boolean,
193
- default: getDefault(defaultConfig, UInputMoney).readonly,
194
- },
195
-
196
- /**
197
- * Disable the input.
198
- */
199
- disabled: {
200
- type: Boolean,
201
- default: getDefault(defaultConfig, UInputMoney).disabled,
202
- },
203
-
204
- /**
205
- * Unique element id.
206
- */
207
- id: {
208
- type: String,
209
- default: "",
210
- },
211
-
212
- /**
213
- * Component config object.
214
- */
215
- config: {
216
- type: Object,
217
- default: () => ({}),
218
- },
15
+ defineOptions({ inheritAttrs: false });
219
16
 
220
- /**
221
- * Data-test attribute for automated testing.
222
- */
223
- dataTest: {
224
- type: String,
225
- default: "",
226
- },
17
+ const props = withDefaults(defineProps<UInputMoneyProps>(), {
18
+ labelAlign: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).labelAlign,
19
+ symbol: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).symbol,
20
+ size: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).size,
21
+ minFractionDigits: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).minFractionDigits,
22
+ maxFractionDigits: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).maxFractionDigits,
23
+ decimalSeparator: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).decimalSeparator,
24
+ thousandsSeparator: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).thousandsSeparator,
25
+ positiveOnly: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).positiveOnly,
26
+ prefix: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).prefix,
27
+ readonly: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).readonly,
28
+ disabled: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).disabled,
29
+ modelValue: "",
30
+ dataTest: "",
227
31
  });
228
32
 
229
33
  const emit = defineEmits(["update:modelValue", "keyup", "blur", "input"]);
230
34
 
231
- const moneyInputRef = ref(null);
35
+ const moneyInputRef = ref<{ inputRef: HTMLInputElement } | null>(null);
232
36
 
233
37
  const elementId = props.id || useId();
234
38
 
@@ -256,19 +60,25 @@ const localLabel = computed(() => {
256
60
  });
257
61
 
258
62
  const input = computed(() => {
259
- return moneyInputRef.value.inputRef;
63
+ return moneyInputRef.value?.inputRef || null;
260
64
  });
261
65
 
262
66
  watch(
263
67
  () => props.modelValue,
264
- () => String(localValue.value) !== String(rawValue.value) && setValue(localValue.value),
68
+ () => {
69
+ if (String(localValue.value) !== String(rawValue.value)) {
70
+ setValue(localValue.value);
71
+ }
72
+ },
265
73
  );
266
74
 
267
75
  onMounted(() => {
268
- setValue(localValue.value);
76
+ if (localValue.value) {
77
+ setValue(localValue.value);
78
+ }
269
79
  });
270
80
 
271
- function onKeyup(event) {
81
+ function onKeyup(event: KeyboardEvent) {
272
82
  localValue.value = rawValue.value || "";
273
83
 
274
84
  nextTick(() => emit("keyup", event));
@@ -278,7 +88,7 @@ function onBlur() {
278
88
  nextTick(() => emit("blur"));
279
89
  }
280
90
 
281
- function onInput(value) {
91
+ function onInput(value: InputEvent) {
282
92
  nextTick(() => emit("input", value));
283
93
  }
284
94
 
@@ -302,3 +112,46 @@ defineExpose({
302
112
  formattedValue,
303
113
  });
304
114
  </script>
115
+
116
+ <template>
117
+ <UInput
118
+ :id="elementId"
119
+ ref="moneyInputRef"
120
+ v-model="formattedValue"
121
+ :size="size"
122
+ :label="localLabel"
123
+ :label-align="labelAlign"
124
+ :placeholder="placeholder"
125
+ :description="description"
126
+ :error="error"
127
+ :disabled="disabled"
128
+ inputmode="decimal"
129
+ :left-icon="leftIcon"
130
+ :right-icon="rightIcon"
131
+ v-bind="moneyInputAttrs"
132
+ :data-test="`${dataTest}-base-currency`"
133
+ @keyup="onKeyup"
134
+ @blur="onBlur"
135
+ @input="onInput"
136
+ >
137
+ <template #left>
138
+ <!-- @slot Use it to add something left. -->
139
+ <slot name="left" />
140
+ </template>
141
+
142
+ <template #left-icon>
143
+ <!-- @slot Use it to add icon before the text. -->
144
+ <slot name="left-icon" />
145
+ </template>
146
+
147
+ <template #right-icon>
148
+ <!-- @slot Use it to add icon after the text. -->
149
+ <slot name="right-icon" />
150
+ </template>
151
+
152
+ <template #right>
153
+ <!-- @slot Use it to add something right. -->
154
+ <slot name="right" />
155
+ </template>
156
+ </UInput>
157
+ </template>
@@ -1,8 +1,8 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../../utils/storybook.ts";
3
3
 
4
- import * as stories from "./stories.js";
5
- import defaultConfig from "../config.js?raw"
4
+ import * as stories from "./stories.ts";
5
+ import defaultConfig from "../config.ts?raw"
6
6
 
7
7
  <Meta of={stories} />
8
8
  <Title of={stories} />
@@ -10,6 +10,14 @@ import UCol from "../../ui.container-col/UCol.vue";
10
10
  import UIcon from "../../ui.image-icon/UIcon.vue";
11
11
  import UButton from "../../ui.button/UButton.vue";
12
12
 
13
+ import type { Meta, StoryFn } from "@storybook/vue3";
14
+ import type { UInputMoneyProps } from "../types.ts";
15
+
16
+ interface UInputMoneyArgs extends UInputMoneyProps {
17
+ slotTemplate?: string;
18
+ enum: "labelAlign" | "size";
19
+ }
20
+
13
21
  export default {
14
22
  id: "3030",
15
23
  title: "Form Inputs & Controls / Input Money",
@@ -24,9 +32,9 @@ export default {
24
32
  parameters: {
25
33
  ...getDocsDescription(UInputMoney.__name),
26
34
  },
27
- };
35
+ } as Meta;
28
36
 
29
- const DefaultTemplate = (args) => ({
37
+ const DefaultTemplate: StoryFn<UInputMoneyArgs> = (args: UInputMoneyArgs) => ({
30
38
  components: { UInputMoney, UIcon, UButton },
31
39
  setup() {
32
40
  const slots = getSlotNames(UInputMoney.__name);
@@ -38,17 +46,17 @@ const DefaultTemplate = (args) => ({
38
46
  v-bind="args"
39
47
  v-model="args.modelValue"
40
48
  >
41
- ${args.slotTemplate || getSlotsFragment()}
49
+ ${args.slotTemplate || getSlotsFragment("")}
42
50
  </UInputMoney>
43
51
  `,
44
52
  });
45
53
 
46
- const EnumVariantTemplate = (args, { argTypes }) => ({
54
+ const EnumVariantTemplate: StoryFn<UInputMoneyArgs> = (args: UInputMoneyArgs, { argTypes }) => ({
47
55
  components: { UInputMoney, UCol },
48
56
  setup() {
49
57
  return {
50
58
  args,
51
- options: argTypes[args.enum].options,
59
+ options: argTypes?.[args.enum]?.options,
52
60
  };
53
61
  },
54
62
  template: `
@@ -104,7 +112,7 @@ export const Prefix = DefaultTemplate.bind({});
104
112
  Prefix.args = { prefix: "+" };
105
113
 
106
114
  export const ReadOnly = DefaultTemplate.bind({});
107
- ReadOnly.args = { readOnly: true };
115
+ ReadOnly.args = { readonly: true };
108
116
 
109
117
  export const Disabled = DefaultTemplate.bind({});
110
118
  Disabled.args = { disabled: true };
@@ -0,0 +1,118 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface FormatOptions {
6
+ minFractionDigits: number;
7
+ maxFractionDigits: number;
8
+ decimalSeparator: string;
9
+ thousandsSeparator: string;
10
+ positiveOnly: boolean;
11
+ prefix: string;
12
+ }
13
+
14
+ export interface UInputMoneyProps {
15
+ /**
16
+ * Input value.
17
+ */
18
+ modelValue?: string | number;
19
+ /**
20
+ * Input label.
21
+ */
22
+ label?: string;
23
+
24
+ /**
25
+ * Label placement.
26
+ */
27
+ labelAlign?: "top" | "topInside" | "topWithDesc" | "left" | "right";
28
+
29
+ /**
30
+ * Currency symbol.
31
+ */
32
+ symbol?: string;
33
+
34
+ /**
35
+ * Input placeholder.
36
+ */
37
+ placeholder?: string;
38
+
39
+ /**
40
+ * Input description.
41
+ */
42
+ description?: string;
43
+
44
+ /**
45
+ * Error message.
46
+ */
47
+ error?: string;
48
+
49
+ /**
50
+ * Input size.
51
+ */
52
+ size?: "sm" | "md" | "lg";
53
+
54
+ /**
55
+ * Left icon name.
56
+ */
57
+ leftIcon?: string;
58
+
59
+ /**
60
+ * Right icon name.
61
+ */
62
+ rightIcon?: string;
63
+
64
+ /**
65
+ * Minimal number of signs after the decimal separator (fractional part of a number).
66
+ */
67
+ minFractionDigits?: number;
68
+
69
+ /**
70
+ * Maximal number of signs after the decimal separator (fractional part of a number).
71
+ */
72
+ maxFractionDigits?: number;
73
+
74
+ /**
75
+ * A symbol used to separate the integer part from the fractional part of a number.
76
+ */
77
+ decimalSeparator?: string;
78
+
79
+ /**
80
+ * A symbol used to separate the thousand parts of a number.
81
+ */
82
+ thousandsSeparator?: string;
83
+
84
+ /**
85
+ * Allow only positive values.
86
+ */
87
+ positiveOnly?: boolean;
88
+
89
+ /**
90
+ * Prefix to display before input value.
91
+ */
92
+ prefix?: string;
93
+
94
+ /**
95
+ * Set input read-only.
96
+ */
97
+ readonly?: boolean;
98
+
99
+ /**
100
+ * Disable the input.
101
+ */
102
+ disabled?: boolean;
103
+
104
+ /**
105
+ * Unique element id.
106
+ */
107
+ id?: string;
108
+
109
+ /**
110
+ * Component config object.
111
+ */
112
+ config?: Config;
113
+
114
+ /**
115
+ * Data-test attribute for automated testing.
116
+ */
117
+ dataTest?: string;
118
+ }
@@ -0,0 +1,15 @@
1
+ import useUI from "../composables/useUI.ts";
2
+
3
+ import defaultConfig from "./config.ts";
4
+
5
+ import type { UseAttrs } from "../types.ts";
6
+ import type { UInputMoneyProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: UInputMoneyProps): UseAttrs<Config> {
9
+ const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
10
+
11
+ return {
12
+ config,
13
+ ...getKeysAttrs(),
14
+ };
15
+ }