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.
- package/package.json +1 -1
- package/types.ts +24 -3
- package/ui.button/types.ts +2 -2
- package/ui.container-accordion/UAccordion.vue +2 -2
- package/ui.container-accordion/types.ts +1 -0
- package/ui.container-modal/UModal.vue +15 -8
- package/ui.container-page/UPage.vue +10 -6
- package/ui.form-checkbox/types.ts +7 -0
- package/ui.form-checkbox-group/UCheckboxGroup.vue +1 -1
- package/ui.form-checkbox-multi-state/UCheckboxMultiState.vue +4 -1
- package/ui.form-color-picker/UColorPicker.vue +67 -147
- package/ui.form-color-picker/storybook/Docs.mdx +2 -2
- package/ui.form-color-picker/storybook/{stories.js → stories.ts} +13 -5
- package/ui.form-color-picker/types.ts +64 -0
- package/ui.form-color-picker/useAttrs.ts +15 -0
- package/ui.form-input/UInput.vue +162 -321
- package/ui.form-input/{config.js → config.ts} +3 -0
- package/ui.form-input/storybook/Docs.mdx +2 -2
- package/ui.form-input/storybook/{stories.js → stories.ts} +14 -6
- package/ui.form-input/types.ts +103 -0
- package/ui.form-input/useAttrs.ts +31 -0
- package/ui.form-input-file/UInputFile.vue +188 -245
- package/ui.form-input-file/storybook/Docs.mdx +2 -2
- package/ui.form-input-file/storybook/{stories.js → stories.ts} +13 -5
- package/ui.form-input-file/types.ts +72 -0
- package/ui.form-input-file/useAttrs.ts +21 -0
- package/ui.form-input-file/{utilFileForm.js → utilFileForm.ts} +1 -1
- package/ui.form-input-money/UInputMoney.vue +76 -223
- package/ui.form-input-money/storybook/Docs.mdx +2 -2
- package/ui.form-input-money/storybook/{stories.js → stories.ts} +14 -6
- package/ui.form-input-money/types.ts +118 -0
- package/ui.form-input-money/useAttrs.ts +15 -0
- package/ui.form-input-money/{useFormatCurrency.js → useFormatCurrency.ts} +28 -17
- package/ui.form-input-money/utilFormat.ts +83 -0
- package/ui.form-input-number/UInputNumber.vue +69 -156
- package/ui.form-input-number/storybook/Docs.mdx +2 -2
- package/ui.form-input-number/storybook/{stories.js → stories.ts} +17 -9
- package/ui.form-input-number/types.ts +65 -0
- package/ui.form-input-number/useAttrs.ts +15 -0
- package/ui.form-input-rating/UInputRating.vue +70 -158
- package/ui.form-input-rating/storybook/Docs.mdx +2 -2
- package/ui.form-input-rating/storybook/{stories.js → stories.ts} +14 -6
- package/ui.form-input-rating/types.ts +67 -0
- package/ui.form-input-rating/useAttrs.ts +14 -0
- package/ui.form-input-search/UInputSearch.vue +97 -224
- package/ui.form-input-search/storybook/Docs.mdx +2 -2
- package/ui.form-input-search/storybook/{stories.js → stories.ts} +13 -5
- package/ui.form-input-search/types.ts +93 -0
- package/ui.form-input-search/useAttrs.ts +15 -0
- package/ui.form-radio/URadio.vue +1 -1
- package/ui.form-radio-group/URadioGroup.vue +1 -1
- package/ui.navigation-pagination/UPagination.vue +15 -15
- package/ui.navigation-pagination/types.ts +3 -0
- package/ui.navigation-progress/UProgress.vue +16 -2
- package/ui.navigation-progress/types.ts +2 -0
- package/ui.text-files/UFiles.vue +20 -16
- package/ui.text-files/types.ts +1 -1
- package/ui.text-notify/UNotify.vue +38 -48
- package/ui.text-notify/types.ts +24 -0
- package/web-types.json +227 -138
- package/ui.form-color-picker/useAttrs.js +0 -9
- package/ui.form-input/useAttrs.js +0 -15
- package/ui.form-input-file/useAttrs.js +0 -15
- package/ui.form-input-money/useAttrs.js +0 -9
- package/ui.form-input-money/utilFormat.js +0 -75
- package/ui.form-input-number/useAttrs.js +0 -9
- package/ui.form-input-rating/useAttrs.js +0 -8
- package/ui.form-input-search/useAttrs.js +0 -9
- /package/ui.form-color-picker/{config.js → config.ts} +0 -0
- /package/ui.form-color-picker/{constants.js → constants.ts} +0 -0
- /package/ui.form-input/{constants.js → constants.ts} +0 -0
- /package/ui.form-input-file/{config.js → config.ts} +0 -0
- /package/ui.form-input-file/{constants.js → constants.ts} +0 -0
- /package/ui.form-input-money/{config.js → config.ts} +0 -0
- /package/ui.form-input-money/{constants.js → constants.ts} +0 -0
- /package/ui.form-input-number/{config.js → config.ts} +0 -0
- /package/ui.form-input-number/{constants.js → constants.ts} +0 -0
- /package/ui.form-input-rating/{config.js → config.ts} +0 -0
- /package/ui.form-input-rating/{constants.js → constants.ts} +0 -0
- /package/ui.form-input-search/{config.js → config.ts} +0 -0
- /package/ui.form-input-search/{constants.js → constants.ts} +0 -0
|
@@ -1,3 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
|
|
4
|
+
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
5
|
+
import ULabel from "../ui.form-label/ULabel.vue";
|
|
6
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
7
|
+
import { getDefault } from "../utils/ui.ts";
|
|
8
|
+
|
|
9
|
+
import { UInputRating } from "./constants.ts";
|
|
10
|
+
import defaultConfig from "./config.ts";
|
|
11
|
+
import useAttrs from "./useAttrs.ts";
|
|
12
|
+
|
|
13
|
+
import type { UInputRatingProps, IconSize } from "./types.ts";
|
|
14
|
+
|
|
15
|
+
defineOptions({ inheritAttrs: false });
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(defineProps<UInputRatingProps>(), {
|
|
18
|
+
stars: getDefault<UInputRatingProps>(defaultConfig, UInputRating).stars,
|
|
19
|
+
size: getDefault<UInputRatingProps>(defaultConfig, UInputRating).size,
|
|
20
|
+
labelAlign: getDefault<UInputRatingProps>(defaultConfig, UInputRating).labelAlign,
|
|
21
|
+
counter: getDefault<UInputRatingProps>(defaultConfig, UInputRating).counter,
|
|
22
|
+
selectable: getDefault<UInputRatingProps>(defaultConfig, UInputRating).selectable,
|
|
23
|
+
modelValue: 0,
|
|
24
|
+
dataTest: "",
|
|
25
|
+
config: () => ({}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits([
|
|
29
|
+
/**
|
|
30
|
+
* Triggers when the rating value changes.
|
|
31
|
+
* @property {number} modelValue
|
|
32
|
+
*/
|
|
33
|
+
"update:modelValue",
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const hovered = ref<number | null>(null);
|
|
37
|
+
|
|
38
|
+
const { config, inputLabelAttrs, containerAttrs, counterAttrs, totalAttrs, starsAttrs, starAttrs } =
|
|
39
|
+
useAttrs(props);
|
|
40
|
+
|
|
41
|
+
const iconSize = computed(() => {
|
|
42
|
+
const sizes = {
|
|
43
|
+
sm: "xs",
|
|
44
|
+
md: "sm",
|
|
45
|
+
lg: "md",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return sizes[props.size] as IconSize;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const counterValue = computed(() => {
|
|
52
|
+
return hovered.value || props.modelValue;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
function onClickStar(newValue: number) {
|
|
56
|
+
if (props.selectable) {
|
|
57
|
+
const selected = newValue !== props.modelValue ? newValue : 0;
|
|
58
|
+
|
|
59
|
+
hovered.value = null;
|
|
60
|
+
|
|
61
|
+
emit("update:modelValue", selected);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function onMouseHover(overStar: number | null = null) {
|
|
66
|
+
if (props.selectable) hovered.value = overStar;
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
1
70
|
<template>
|
|
2
71
|
<ULabel
|
|
3
72
|
:label="label"
|
|
@@ -29,7 +98,7 @@
|
|
|
29
98
|
:size="iconSize"
|
|
30
99
|
:interactive="selectable"
|
|
31
100
|
:name="
|
|
32
|
-
star <= counterValue ? config.defaults
|
|
101
|
+
star <= counterValue ? config.defaults?.selectedIcon : config.defaults?.unselectedIcon
|
|
33
102
|
"
|
|
34
103
|
v-bind="starAttrs"
|
|
35
104
|
:data-test="`${dataTest}-rating-star-${star}`"
|
|
@@ -50,160 +119,3 @@
|
|
|
50
119
|
</div>
|
|
51
120
|
</ULabel>
|
|
52
121
|
</template>
|
|
53
|
-
|
|
54
|
-
<script setup>
|
|
55
|
-
import { computed, ref } from "vue";
|
|
56
|
-
|
|
57
|
-
import { getDefault } from "../utils/ui.ts";
|
|
58
|
-
import { hasSlotContent } from "../utils/helper.ts";
|
|
59
|
-
|
|
60
|
-
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
61
|
-
import ULabel from "../ui.form-label/ULabel.vue";
|
|
62
|
-
|
|
63
|
-
import { UInputRating } from "./constants.js";
|
|
64
|
-
import defaultConfig from "./config.js";
|
|
65
|
-
import useAttrs from "./useAttrs.js";
|
|
66
|
-
|
|
67
|
-
defineOptions({ inheritAttrs: false });
|
|
68
|
-
|
|
69
|
-
const props = defineProps({
|
|
70
|
-
/**
|
|
71
|
-
* Rating value.
|
|
72
|
-
*/
|
|
73
|
-
modelValue: {
|
|
74
|
-
type: Number,
|
|
75
|
-
default: 0,
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Rating number of stars.
|
|
80
|
-
*/
|
|
81
|
-
stars: {
|
|
82
|
-
type: Number,
|
|
83
|
-
default: getDefault(defaultConfig, UInputRating).stars,
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Rating size.
|
|
88
|
-
* @values sm, md, lg
|
|
89
|
-
*/
|
|
90
|
-
size: {
|
|
91
|
-
type: String,
|
|
92
|
-
default: getDefault(defaultConfig, UInputRating).size,
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Rating label.
|
|
97
|
-
*/
|
|
98
|
-
label: {
|
|
99
|
-
type: String,
|
|
100
|
-
default: "",
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Rating label placement.
|
|
105
|
-
* @values top, topWithDesc, left, right
|
|
106
|
-
*/
|
|
107
|
-
labelAlign: {
|
|
108
|
-
type: String,
|
|
109
|
-
default: getDefault(defaultConfig, UInputRating).labelAlign,
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Rating error message.
|
|
114
|
-
*/
|
|
115
|
-
error: {
|
|
116
|
-
type: String,
|
|
117
|
-
default: "",
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Rating description.
|
|
122
|
-
*/
|
|
123
|
-
description: {
|
|
124
|
-
type: String,
|
|
125
|
-
default: "",
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Rating total.
|
|
130
|
-
*/
|
|
131
|
-
total: {
|
|
132
|
-
type: Number,
|
|
133
|
-
default: 0,
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Show rating counter.
|
|
138
|
-
*/
|
|
139
|
-
counter: {
|
|
140
|
-
type: Boolean,
|
|
141
|
-
default: getDefault(defaultConfig, UInputRating).counter,
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Make rating selectable.
|
|
146
|
-
*/
|
|
147
|
-
selectable: {
|
|
148
|
-
type: Boolean,
|
|
149
|
-
default: getDefault(defaultConfig, UInputRating).selectable,
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Component config object.
|
|
154
|
-
*/
|
|
155
|
-
config: {
|
|
156
|
-
type: Object,
|
|
157
|
-
default: () => ({}),
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Data-test attribute for automated testing.
|
|
162
|
-
*/
|
|
163
|
-
dataTest: {
|
|
164
|
-
type: String,
|
|
165
|
-
default: "",
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
const emit = defineEmits([
|
|
170
|
-
/**
|
|
171
|
-
* Triggers when the rating value changes.
|
|
172
|
-
* @property {number} modelValue
|
|
173
|
-
*/
|
|
174
|
-
"update:modelValue",
|
|
175
|
-
]);
|
|
176
|
-
|
|
177
|
-
const hovered = ref(null);
|
|
178
|
-
|
|
179
|
-
const { config, inputLabelAttrs, containerAttrs, counterAttrs, totalAttrs, starsAttrs, starAttrs } =
|
|
180
|
-
useAttrs(props);
|
|
181
|
-
|
|
182
|
-
const iconSize = computed(() => {
|
|
183
|
-
const sizes = {
|
|
184
|
-
sm: "xs",
|
|
185
|
-
md: "sm",
|
|
186
|
-
lg: "md",
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
return sizes[props.size];
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
const counterValue = computed(() => {
|
|
193
|
-
return hovered.value || props.modelValue;
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
function onClickStar(newValue) {
|
|
197
|
-
if (props.selectable) {
|
|
198
|
-
const selected = newValue !== props.modelValue ? newValue : 0;
|
|
199
|
-
|
|
200
|
-
hovered.value = null;
|
|
201
|
-
|
|
202
|
-
emit("update:modelValue", selected);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function onMouseHover(overStar) {
|
|
207
|
-
if (props.selectable) hovered.value = overStar;
|
|
208
|
-
}
|
|
209
|
-
</script>
|
|
@@ -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.
|
|
5
|
-
import defaultConfig from "../config.
|
|
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} />
|
|
@@ -8,6 +8,14 @@ import {
|
|
|
8
8
|
import UInputRating from "../../ui.form-input-rating/UInputRating.vue";
|
|
9
9
|
import URow from "../../ui.container-row/URow.vue";
|
|
10
10
|
|
|
11
|
+
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
12
|
+
import type { UInputRatingProps } from "../types.ts";
|
|
13
|
+
|
|
14
|
+
interface UInputRatingArgs extends UInputRatingProps {
|
|
15
|
+
slotTemplate?: string;
|
|
16
|
+
enum: "size";
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
export default {
|
|
12
20
|
id: "3060",
|
|
13
21
|
title: "Form Inputs & Controls / Input Rating",
|
|
@@ -22,9 +30,9 @@ export default {
|
|
|
22
30
|
parameters: {
|
|
23
31
|
...getDocsDescription(UInputRating.__name),
|
|
24
32
|
},
|
|
25
|
-
};
|
|
33
|
+
} as Meta;
|
|
26
34
|
|
|
27
|
-
const DefaultTemplate = (args) => ({
|
|
35
|
+
const DefaultTemplate: StoryFn<UInputRatingArgs> = (args: UInputRatingArgs) => ({
|
|
28
36
|
components: { UInputRating },
|
|
29
37
|
setup() {
|
|
30
38
|
const slots = getSlotNames(UInputRating.__name);
|
|
@@ -36,17 +44,17 @@ const DefaultTemplate = (args) => ({
|
|
|
36
44
|
v-bind="args"
|
|
37
45
|
v-model="args.modelValue"
|
|
38
46
|
>
|
|
39
|
-
${args.slotTemplate || getSlotsFragment()}
|
|
47
|
+
${args.slotTemplate || getSlotsFragment("")}
|
|
40
48
|
</UInputRating>
|
|
41
49
|
`,
|
|
42
50
|
});
|
|
43
51
|
|
|
44
|
-
const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
52
|
+
const EnumVariantTemplate: StoryFn<UInputRatingArgs> = (args: UInputRatingArgs, { argTypes }) => ({
|
|
45
53
|
components: { UInputRating, URow },
|
|
46
54
|
setup() {
|
|
47
55
|
return {
|
|
48
56
|
args,
|
|
49
|
-
options: argTypes[args.enum]
|
|
57
|
+
options: argTypes?.[args.enum]?.options,
|
|
50
58
|
};
|
|
51
59
|
},
|
|
52
60
|
template: `
|
|
@@ -69,7 +77,7 @@ export const Sizes = EnumVariantTemplate.bind({});
|
|
|
69
77
|
Sizes.args = { enum: "size" };
|
|
70
78
|
|
|
71
79
|
export const StarAmount = DefaultTemplate.bind({});
|
|
72
|
-
StarAmount.args = {
|
|
80
|
+
StarAmount.args = { modelValue: 4, stars: 7 };
|
|
73
81
|
|
|
74
82
|
export const Selectable = DefaultTemplate.bind({});
|
|
75
83
|
Selectable.args = { selectable: true };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import defaultConfig from "./config.ts";
|
|
2
|
+
|
|
3
|
+
export type Config = Partial<typeof defaultConfig>;
|
|
4
|
+
|
|
5
|
+
export type IconSize = "xs" | "sm" | "md";
|
|
6
|
+
|
|
7
|
+
export interface UInputRatingProps {
|
|
8
|
+
/**
|
|
9
|
+
* Rating value.
|
|
10
|
+
*/
|
|
11
|
+
modelValue: number;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Rating number of stars.
|
|
15
|
+
*/
|
|
16
|
+
stars?: number;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Rating size.
|
|
20
|
+
*/
|
|
21
|
+
size?: "sm" | "md" | "lg";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Rating label.
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Rating label placement.
|
|
30
|
+
*/
|
|
31
|
+
labelAlign?: "top" | "topWithDesc" | "left" | "right";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Rating error message.
|
|
35
|
+
*/
|
|
36
|
+
error?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Rating description.
|
|
40
|
+
*/
|
|
41
|
+
description?: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Rating total.
|
|
45
|
+
*/
|
|
46
|
+
total?: number;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Show rating counter.
|
|
50
|
+
*/
|
|
51
|
+
counter?: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Make rating selectable.
|
|
55
|
+
*/
|
|
56
|
+
selectable?: boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Component config object.
|
|
60
|
+
*/
|
|
61
|
+
config?: Config;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Data-test attribute for automated testing.
|
|
65
|
+
*/
|
|
66
|
+
dataTest?: string;
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import useUI from "../composables/useUI.ts";
|
|
2
|
+
import defaultConfig from "./config.ts";
|
|
3
|
+
|
|
4
|
+
import type { UseAttrs } from "../types.ts";
|
|
5
|
+
import type { UInputRatingProps, Config } from "./types.ts";
|
|
6
|
+
|
|
7
|
+
export default function useAttrs(props: UInputRatingProps): UseAttrs<Config> {
|
|
8
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
config,
|
|
12
|
+
...getKeysAttrs(),
|
|
13
|
+
};
|
|
14
|
+
}
|