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,84 +1,4 @@
|
|
|
1
|
-
<
|
|
2
|
-
<UInput
|
|
3
|
-
:id="elementId"
|
|
4
|
-
ref="inputRef"
|
|
5
|
-
:model-value="localValue"
|
|
6
|
-
:size="size"
|
|
7
|
-
:disabled="disabled"
|
|
8
|
-
:readonly="readonly"
|
|
9
|
-
:label-align="labelAlign"
|
|
10
|
-
:label="label"
|
|
11
|
-
:error="error"
|
|
12
|
-
:description="description"
|
|
13
|
-
:placeholder="placeholder"
|
|
14
|
-
inputmode="search"
|
|
15
|
-
:left-icon="leftIcon"
|
|
16
|
-
v-bind="searchInputAttrs"
|
|
17
|
-
:data-test="dataTest"
|
|
18
|
-
@update:model-value="onUpdateValue"
|
|
19
|
-
@keyup.enter="onKeyupEnter"
|
|
20
|
-
>
|
|
21
|
-
<template #left>
|
|
22
|
-
<!-- @slot Use it to add something before the text. -->
|
|
23
|
-
<slot name="left" />
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<template #left-icon>
|
|
27
|
-
<!-- @slot Use it to add icon before the text. -->
|
|
28
|
-
<slot name="left-icon" />
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
|
-
<template #right-icon>
|
|
32
|
-
<UIcon
|
|
33
|
-
v-if="localValue"
|
|
34
|
-
internal
|
|
35
|
-
interactive
|
|
36
|
-
color="gray"
|
|
37
|
-
:name="config.defaults.clearIcon"
|
|
38
|
-
:size="iconSize"
|
|
39
|
-
v-bind="clearIconAttrs"
|
|
40
|
-
:data-test="`${dataTest}-clear`"
|
|
41
|
-
@click="onClickClear"
|
|
42
|
-
/>
|
|
43
|
-
|
|
44
|
-
<!-- @slot Use it to add icon after the text. -->
|
|
45
|
-
<slot
|
|
46
|
-
name="right-icon"
|
|
47
|
-
:icon-name="config.defaults.searchIcon"
|
|
48
|
-
:icon-size="iconSize"
|
|
49
|
-
:search-button-label="searchButtonLabel"
|
|
50
|
-
>
|
|
51
|
-
<UIcon
|
|
52
|
-
v-if="!searchButtonLabel"
|
|
53
|
-
internal
|
|
54
|
-
interactive
|
|
55
|
-
:size="iconSize"
|
|
56
|
-
:name="rightIcon || config.defaults.searchIcon"
|
|
57
|
-
v-bind="searchIconAttrs"
|
|
58
|
-
:data-test="`${dataTest}-search-icon`"
|
|
59
|
-
@click="onClickSearch"
|
|
60
|
-
/>
|
|
61
|
-
</slot>
|
|
62
|
-
</template>
|
|
63
|
-
|
|
64
|
-
<template #right>
|
|
65
|
-
<!-- @slot Use it to add something after the text. -->
|
|
66
|
-
<slot name="right">
|
|
67
|
-
<UButton
|
|
68
|
-
v-if="searchButtonLabel"
|
|
69
|
-
:label="searchButtonLabel"
|
|
70
|
-
:size="buttonSize"
|
|
71
|
-
no-ring
|
|
72
|
-
v-bind="searchButtonAttrs"
|
|
73
|
-
:data-test="`${dataTest}-search-button`"
|
|
74
|
-
@click="onClickSearch"
|
|
75
|
-
/>
|
|
76
|
-
</slot>
|
|
77
|
-
</template>
|
|
78
|
-
</UInput>
|
|
79
|
-
</template>
|
|
80
|
-
|
|
81
|
-
<script setup>
|
|
1
|
+
<script setup lang="ts">
|
|
82
2
|
import { computed, useId, ref, watchEffect } from "vue";
|
|
83
3
|
|
|
84
4
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
@@ -87,150 +7,23 @@ import UButton from "../ui.button/UButton.vue";
|
|
|
87
7
|
import { getDefault } from "../utils/ui.ts";
|
|
88
8
|
import { createDebounce } from "../utils/helper.ts";
|
|
89
9
|
|
|
90
|
-
import { UInputSearch } from "./constants.
|
|
91
|
-
import defaultConfig from "./config.
|
|
92
|
-
import useAttrs from "./useAttrs.
|
|
10
|
+
import { UInputSearch } from "./constants.ts";
|
|
11
|
+
import defaultConfig from "./config.ts";
|
|
12
|
+
import useAttrs from "./useAttrs.ts";
|
|
93
13
|
|
|
94
|
-
|
|
14
|
+
import type { UInputSearchProps, IconSize, ButtonSize } from "./types.ts";
|
|
95
15
|
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Search input value.
|
|
99
|
-
*/
|
|
100
|
-
modelValue: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: "",
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Input size.
|
|
107
|
-
* @values sm, md, lg
|
|
108
|
-
*/
|
|
109
|
-
size: {
|
|
110
|
-
type: String,
|
|
111
|
-
default: getDefault(defaultConfig, UInputSearch).size,
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Input placeholder.
|
|
116
|
-
*/
|
|
117
|
-
placeholder: {
|
|
118
|
-
type: String,
|
|
119
|
-
default: "",
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Label placement.
|
|
124
|
-
* @values top, topInside, topWithDesc, left, right
|
|
125
|
-
*/
|
|
126
|
-
labelAlign: {
|
|
127
|
-
type: String,
|
|
128
|
-
default: getDefault(defaultConfig, UInputSearch).labelAlign,
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Input label.
|
|
133
|
-
*/
|
|
134
|
-
label: {
|
|
135
|
-
type: String,
|
|
136
|
-
default: "",
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Input description.
|
|
141
|
-
*/
|
|
142
|
-
description: {
|
|
143
|
-
type: String,
|
|
144
|
-
default: "",
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Error message.
|
|
149
|
-
*/
|
|
150
|
-
error: {
|
|
151
|
-
type: String,
|
|
152
|
-
default: "",
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Minimum character length for search.
|
|
157
|
-
*/
|
|
158
|
-
minLength: {
|
|
159
|
-
type: [Number, String],
|
|
160
|
-
default: getDefault(defaultConfig, UInputSearch).minLength,
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Search button label.
|
|
165
|
-
*/
|
|
166
|
-
searchButtonLabel: {
|
|
167
|
-
type: String,
|
|
168
|
-
default: "",
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Time in milliseconds before value emit.
|
|
173
|
-
*/
|
|
174
|
-
debounce: {
|
|
175
|
-
type: [Number, String],
|
|
176
|
-
default: getDefault(defaultConfig, UInputSearch).debounce,
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Left icon name.
|
|
181
|
-
*/
|
|
182
|
-
leftIcon: {
|
|
183
|
-
type: String,
|
|
184
|
-
default: "",
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Right icon name.
|
|
189
|
-
*/
|
|
190
|
-
rightIcon: {
|
|
191
|
-
type: String,
|
|
192
|
-
default: "",
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Make input read-only.
|
|
197
|
-
*/
|
|
198
|
-
readonly: {
|
|
199
|
-
type: Boolean,
|
|
200
|
-
default: getDefault(defaultConfig, UInputSearch).readonly,
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Make input disabled.
|
|
205
|
-
*/
|
|
206
|
-
disabled: {
|
|
207
|
-
type: Boolean,
|
|
208
|
-
default: getDefault(defaultConfig, UInputSearch).disabled,
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Unique element id.
|
|
213
|
-
*/
|
|
214
|
-
id: {
|
|
215
|
-
type: String,
|
|
216
|
-
default: "",
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Component config object.
|
|
221
|
-
*/
|
|
222
|
-
config: {
|
|
223
|
-
type: Object,
|
|
224
|
-
default: () => ({}),
|
|
225
|
-
},
|
|
16
|
+
defineOptions({ inheritAttrs: false });
|
|
226
17
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
18
|
+
const props = withDefaults(defineProps<UInputSearchProps>(), {
|
|
19
|
+
size: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).size,
|
|
20
|
+
labelAlign: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).labelAlign,
|
|
21
|
+
minLength: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).minLength,
|
|
22
|
+
debounce: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).debounce,
|
|
23
|
+
readonly: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).readonly,
|
|
24
|
+
disabled: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).disabled,
|
|
25
|
+
dataTest: "",
|
|
26
|
+
config: () => ({}),
|
|
234
27
|
});
|
|
235
28
|
|
|
236
29
|
const emit = defineEmits([
|
|
@@ -271,7 +64,7 @@ const iconSize = computed(() => {
|
|
|
271
64
|
lg: "md",
|
|
272
65
|
};
|
|
273
66
|
|
|
274
|
-
return sizes[props.size];
|
|
67
|
+
return sizes[props.size] as IconSize;
|
|
275
68
|
});
|
|
276
69
|
|
|
277
70
|
const buttonSize = computed(() => {
|
|
@@ -281,7 +74,7 @@ const buttonSize = computed(() => {
|
|
|
281
74
|
lg: "lg",
|
|
282
75
|
};
|
|
283
76
|
|
|
284
|
-
return sizes[props.size];
|
|
77
|
+
return sizes[props.size] as ButtonSize;
|
|
285
78
|
});
|
|
286
79
|
|
|
287
80
|
watchEffect(() => {
|
|
@@ -333,3 +126,83 @@ defineExpose({
|
|
|
333
126
|
inputRef,
|
|
334
127
|
});
|
|
335
128
|
</script>
|
|
129
|
+
|
|
130
|
+
<template>
|
|
131
|
+
<UInput
|
|
132
|
+
:id="elementId"
|
|
133
|
+
ref="inputRef"
|
|
134
|
+
:model-value="localValue"
|
|
135
|
+
:size="size"
|
|
136
|
+
:disabled="disabled"
|
|
137
|
+
:readonly="readonly"
|
|
138
|
+
:label-align="labelAlign"
|
|
139
|
+
:label="label"
|
|
140
|
+
:error="error"
|
|
141
|
+
:description="description"
|
|
142
|
+
:placeholder="placeholder"
|
|
143
|
+
inputmode="search"
|
|
144
|
+
:left-icon="leftIcon"
|
|
145
|
+
v-bind="searchInputAttrs"
|
|
146
|
+
:data-test="dataTest"
|
|
147
|
+
@update:model-value="onUpdateValue"
|
|
148
|
+
@keyup.enter="onKeyupEnter"
|
|
149
|
+
>
|
|
150
|
+
<template #left>
|
|
151
|
+
<!-- @slot Use it to add something before the text. -->
|
|
152
|
+
<slot name="left" />
|
|
153
|
+
</template>
|
|
154
|
+
|
|
155
|
+
<template #left-icon>
|
|
156
|
+
<!-- @slot Use it to add icon before the text. -->
|
|
157
|
+
<slot name="left-icon" />
|
|
158
|
+
</template>
|
|
159
|
+
|
|
160
|
+
<template #right-icon>
|
|
161
|
+
<UIcon
|
|
162
|
+
v-if="localValue"
|
|
163
|
+
internal
|
|
164
|
+
interactive
|
|
165
|
+
color="gray"
|
|
166
|
+
:name="config.defaults?.clearIcon"
|
|
167
|
+
:size="iconSize"
|
|
168
|
+
v-bind="clearIconAttrs"
|
|
169
|
+
:data-test="`${dataTest}-clear`"
|
|
170
|
+
@click="onClickClear"
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
<!-- @slot Use it to add icon after the text. -->
|
|
174
|
+
<slot
|
|
175
|
+
name="right-icon"
|
|
176
|
+
:icon-name="config.defaults?.searchIcon"
|
|
177
|
+
:icon-size="iconSize"
|
|
178
|
+
:search-button-label="searchButtonLabel"
|
|
179
|
+
>
|
|
180
|
+
<UIcon
|
|
181
|
+
v-if="!searchButtonLabel"
|
|
182
|
+
internal
|
|
183
|
+
interactive
|
|
184
|
+
:size="iconSize"
|
|
185
|
+
:name="rightIcon || config.defaults?.searchIcon"
|
|
186
|
+
v-bind="searchIconAttrs"
|
|
187
|
+
:data-test="`${dataTest}-search-icon`"
|
|
188
|
+
@click="onClickSearch"
|
|
189
|
+
/>
|
|
190
|
+
</slot>
|
|
191
|
+
</template>
|
|
192
|
+
|
|
193
|
+
<template #right>
|
|
194
|
+
<!-- @slot Use it to add something after the text. -->
|
|
195
|
+
<slot name="right">
|
|
196
|
+
<UButton
|
|
197
|
+
v-if="searchButtonLabel"
|
|
198
|
+
:label="searchButtonLabel"
|
|
199
|
+
:size="buttonSize"
|
|
200
|
+
no-ring
|
|
201
|
+
v-bind="searchButtonAttrs"
|
|
202
|
+
:data-test="`${dataTest}-search-button`"
|
|
203
|
+
@click="onClickSearch"
|
|
204
|
+
/>
|
|
205
|
+
</slot>
|
|
206
|
+
</template>
|
|
207
|
+
</UInput>
|
|
208
|
+
</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.
|
|
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} />
|
|
@@ -10,6 +10,14 @@ import UButton from "../../ui.button/UButton.vue";
|
|
|
10
10
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
11
11
|
import URow from "../../ui.container-row/URow.vue";
|
|
12
12
|
|
|
13
|
+
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
14
|
+
import type { UInputSearchProps } from "../types.ts";
|
|
15
|
+
|
|
16
|
+
interface UInputSearchArgs extends UInputSearchProps {
|
|
17
|
+
slotTemplate?: string;
|
|
18
|
+
enum: "size";
|
|
19
|
+
}
|
|
20
|
+
|
|
13
21
|
export default {
|
|
14
22
|
id: "3040",
|
|
15
23
|
title: "Form Inputs & Controls / Input Search",
|
|
@@ -20,9 +28,9 @@ export default {
|
|
|
20
28
|
parameters: {
|
|
21
29
|
...getDocsDescription(UInputSearch.__name),
|
|
22
30
|
},
|
|
23
|
-
};
|
|
31
|
+
} as Meta;
|
|
24
32
|
|
|
25
|
-
const DefaultTemplate = (args) => ({
|
|
33
|
+
const DefaultTemplate: StoryFn<UInputSearchArgs> = (args: UInputSearchArgs) => ({
|
|
26
34
|
components: { UInputSearch, UButton, UIcon },
|
|
27
35
|
setup() {
|
|
28
36
|
const slots = getSlotNames(UInputSearch.__name);
|
|
@@ -31,17 +39,17 @@ const DefaultTemplate = (args) => ({
|
|
|
31
39
|
},
|
|
32
40
|
template: `
|
|
33
41
|
<UInputSearch v-bind="args" v-model="args.modelValue">
|
|
34
|
-
${args.slotTemplate || getSlotsFragment()}
|
|
42
|
+
${args.slotTemplate || getSlotsFragment("")}
|
|
35
43
|
</UInputSearch>
|
|
36
44
|
`,
|
|
37
45
|
});
|
|
38
46
|
|
|
39
|
-
const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
47
|
+
const EnumVariantTemplate: StoryFn<UInputSearchArgs> = (args: UInputSearchArgs, { argTypes }) => ({
|
|
40
48
|
components: { UInputSearch, URow },
|
|
41
49
|
setup() {
|
|
42
50
|
return {
|
|
43
51
|
args,
|
|
44
|
-
options: argTypes[args.enum]
|
|
52
|
+
options: argTypes?.[args.enum]?.options,
|
|
45
53
|
};
|
|
46
54
|
},
|
|
47
55
|
template: `
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import defaultConfig from "./config.ts";
|
|
2
|
+
|
|
3
|
+
export type Config = Partial<typeof defaultConfig>;
|
|
4
|
+
|
|
5
|
+
export type IconSize = "xs" | "sm" | "md";
|
|
6
|
+
export type ButtonSize = "xs" | "md" | "lg";
|
|
7
|
+
|
|
8
|
+
export interface UInputSearchProps {
|
|
9
|
+
/**
|
|
10
|
+
* Search input value.
|
|
11
|
+
*/
|
|
12
|
+
modelValue?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Input size.
|
|
16
|
+
*/
|
|
17
|
+
size?: "sm" | "md" | "lg";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Input placeholder.
|
|
21
|
+
*/
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Label placement.
|
|
26
|
+
*/
|
|
27
|
+
labelAlign?: "top" | "topInside" | "topWithDesc" | "left" | "right";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Input label.
|
|
31
|
+
*/
|
|
32
|
+
label?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Input description.
|
|
36
|
+
*/
|
|
37
|
+
description?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Error message.
|
|
41
|
+
*/
|
|
42
|
+
error?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Minimum character length for search.
|
|
46
|
+
*/
|
|
47
|
+
minLength?: number | string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Search button label.
|
|
51
|
+
*/
|
|
52
|
+
searchButtonLabel?: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Time in milliseconds before value emit.
|
|
56
|
+
*/
|
|
57
|
+
debounce?: number | string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Left icon name.
|
|
61
|
+
*/
|
|
62
|
+
leftIcon?: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Right icon name.
|
|
66
|
+
*/
|
|
67
|
+
rightIcon?: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Make input read-only.
|
|
71
|
+
*/
|
|
72
|
+
readonly?: boolean;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Make input disabled.
|
|
76
|
+
*/
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Unique element id.
|
|
81
|
+
*/
|
|
82
|
+
id?: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Component config object.
|
|
86
|
+
*/
|
|
87
|
+
config?: Config;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Data-test attribute for automated testing.
|
|
91
|
+
*/
|
|
92
|
+
dataTest?: string;
|
|
93
|
+
}
|
|
@@ -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 { UInputSearchProps, Config } from "./types.ts";
|
|
7
|
+
|
|
8
|
+
export default function useAttrs(props: UInputSearchProps): UseAttrs<Config> {
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
config,
|
|
13
|
+
...getKeysAttrs(),
|
|
14
|
+
};
|
|
15
|
+
}
|
package/ui.form-radio/URadio.vue
CHANGED
|
@@ -10,7 +10,7 @@ import defaultConfig from "./config.ts";
|
|
|
10
10
|
import { UPagination } from "./constants.ts";
|
|
11
11
|
import useAttrs from "./useAttrs.ts";
|
|
12
12
|
|
|
13
|
-
import type { UPaginationProps } from "./types.ts";
|
|
13
|
+
import type { UPaginationProps, ButtonSize, IconSize } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
defineOptions({ inheritAttrs: false });
|
|
16
16
|
|
|
@@ -24,6 +24,7 @@ const props = withDefaults(defineProps<UPaginationProps>(), {
|
|
|
24
24
|
showFirst: getDefault<UPaginationProps>(defaultConfig, UPagination).showFirst,
|
|
25
25
|
showLast: getDefault<UPaginationProps>(defaultConfig, UPagination).showLast,
|
|
26
26
|
dataTest: "",
|
|
27
|
+
config: () => ({}),
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
const emit = defineEmits([
|
|
@@ -70,7 +71,7 @@ const buttonSize = computed(() => {
|
|
|
70
71
|
lg: "md",
|
|
71
72
|
};
|
|
72
73
|
|
|
73
|
-
return sizes[props.size];
|
|
74
|
+
return sizes[props.size] as ButtonSize;
|
|
74
75
|
});
|
|
75
76
|
|
|
76
77
|
const iconSize = computed(() => {
|
|
@@ -80,11 +81,11 @@ const iconSize = computed(() => {
|
|
|
80
81
|
lg: "md",
|
|
81
82
|
};
|
|
82
83
|
|
|
83
|
-
return sizes[props.size];
|
|
84
|
+
return sizes[props.size] as IconSize;
|
|
84
85
|
});
|
|
85
86
|
|
|
86
87
|
const totalPages = computed(() => {
|
|
87
|
-
return props.perPage > 0 ? Math.ceil(props.total / props.perPage) : 0;
|
|
88
|
+
return props.perPage > 0 && props.total ? Math.ceil(props.total / props.perPage) : 0;
|
|
88
89
|
});
|
|
89
90
|
|
|
90
91
|
const pageButtons = computed(() => {
|
|
@@ -108,11 +109,11 @@ const pageButtons = computed(() => {
|
|
|
108
109
|
});
|
|
109
110
|
|
|
110
111
|
const prevIsDisabled = computed(() => {
|
|
111
|
-
return props.disabled || currentPage.value
|
|
112
|
+
return props.disabled || !currentPage.value || currentPage.value <= 1;
|
|
112
113
|
});
|
|
113
114
|
|
|
114
115
|
const nextIsDisabled = computed(() => {
|
|
115
|
-
return props.disabled || currentPage.value
|
|
116
|
+
return props.disabled || !currentPage.value || currentPage.value >= totalPages.value;
|
|
116
117
|
});
|
|
117
118
|
|
|
118
119
|
function selectPage(page: number) {
|
|
@@ -120,14 +121,13 @@ function selectPage(page: number) {
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
function goToPrevPage() {
|
|
123
|
-
currentPage.value = currentPage.value
|
|
124
|
+
currentPage.value = !currentPage.value ? 1 : Math.max(currentPage.value - 1, 1);
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
function goToNextPage() {
|
|
127
|
-
currentPage.value =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
: Math.min(currentPage.value + 1, totalPages.value);
|
|
128
|
+
currentPage.value = !currentPage.value
|
|
129
|
+
? totalPages.value
|
|
130
|
+
: Math.min(currentPage.value + 1, totalPages.value);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
function goToFirstPage() {
|
|
@@ -159,7 +159,7 @@ function goToLastPage() {
|
|
|
159
159
|
v-if="!firstLabel"
|
|
160
160
|
internal
|
|
161
161
|
:size="iconSize"
|
|
162
|
-
:name="config.defaults
|
|
162
|
+
:name="config.defaults?.firstIcon"
|
|
163
163
|
v-bind="firstIconAttrs"
|
|
164
164
|
/>
|
|
165
165
|
</slot>
|
|
@@ -182,7 +182,7 @@ function goToLastPage() {
|
|
|
182
182
|
v-if="!prevLabel"
|
|
183
183
|
internal
|
|
184
184
|
:size="iconSize"
|
|
185
|
-
:name="config.defaults
|
|
185
|
+
:name="config.defaults?.prevIcon"
|
|
186
186
|
v-bind="prevIconAttrs"
|
|
187
187
|
/>
|
|
188
188
|
</slot>
|
|
@@ -244,7 +244,7 @@ function goToLastPage() {
|
|
|
244
244
|
v-if="!nextLabel"
|
|
245
245
|
internal
|
|
246
246
|
:size="iconSize"
|
|
247
|
-
:name="config.defaults
|
|
247
|
+
:name="config.defaults?.nextIcon"
|
|
248
248
|
v-bind="nextIconAttrs"
|
|
249
249
|
/>
|
|
250
250
|
</slot>
|
|
@@ -268,7 +268,7 @@ function goToLastPage() {
|
|
|
268
268
|
v-if="!lastLabel"
|
|
269
269
|
internal
|
|
270
270
|
:size="iconSize"
|
|
271
|
-
:name="config.defaults
|
|
271
|
+
:name="config.defaults?.lastIcon"
|
|
272
272
|
v-bind="lastIconAttrs"
|
|
273
273
|
/>
|
|
274
274
|
</slot>
|
|
@@ -10,7 +10,7 @@ import { UProgress, VARIANT } from "./constants.ts";
|
|
|
10
10
|
import StepperProgress from "./StepperProgress.vue";
|
|
11
11
|
import UHeader from "../ui.text-header/UHeader.vue";
|
|
12
12
|
|
|
13
|
-
import type { UProgressProps } from "./types.ts";
|
|
13
|
+
import type { UProgressProps, HeaderSize } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
defineOptions({ inheritAttrs: false });
|
|
16
16
|
|
|
@@ -26,6 +26,20 @@ const props = withDefaults(defineProps<UProgressProps>(), {
|
|
|
26
26
|
|
|
27
27
|
const { progressAttrs, wrapperAttrs, indicatorAttrs, stepAttrs, stepperAttrs } = useAttrs(props);
|
|
28
28
|
|
|
29
|
+
const headerSize = computed(() => {
|
|
30
|
+
const sizes = {
|
|
31
|
+
"2xs": "xs",
|
|
32
|
+
xs: "xs",
|
|
33
|
+
sm: "sm",
|
|
34
|
+
md: "sm",
|
|
35
|
+
lg: "lg",
|
|
36
|
+
xl: "xl",
|
|
37
|
+
"2xl": "2xl",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return sizes[props.size] as HeaderSize;
|
|
41
|
+
});
|
|
42
|
+
|
|
29
43
|
const isSteps = computed(() => Array.isArray(props.max));
|
|
30
44
|
|
|
31
45
|
const realMax = computed(() => {
|
|
@@ -91,7 +105,7 @@ function isActiveStep(index: number) {
|
|
|
91
105
|
:value="value"
|
|
92
106
|
:max="max"
|
|
93
107
|
>
|
|
94
|
-
<UHeader v-if="isVariant.stepper" :label="String(step)" :size="
|
|
108
|
+
<UHeader v-if="isVariant.stepper" :label="String(step)" :size="headerSize" />
|
|
95
109
|
<template v-else>{{ step }}</template>
|
|
96
110
|
</slot>
|
|
97
111
|
</template>
|