vueless 0.0.554 → 0.0.556
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/composables/useUI.ts +28 -64
- package/constants.js +21 -2
- package/index.d.ts +8 -1
- package/index.ts +1 -1
- package/package.json +1 -1
- package/types.ts +4 -10
- package/ui.button/UButton.vue +21 -7
- package/ui.button-link/ULink.vue +14 -2
- package/ui.button-link/config.ts +6 -1
- package/ui.button-link/useAttrs.ts +8 -39
- package/ui.button-toggle/useAttrs.ts +2 -8
- package/ui.button-toggle-item/config.ts +9 -11
- package/ui.button-toggle-item/useAttrs.ts +4 -18
- package/ui.container-accordion/config.ts +3 -1
- package/ui.container-accordion/useAttrs.ts +6 -17
- package/ui.container-card/UCard.vue +2 -1
- package/ui.container-card/useAttrs.ts +2 -8
- package/ui.container-col/useAttrs.ts +2 -8
- package/ui.container-divider/useAttrs.ts +2 -8
- package/ui.container-group/useAttrs.ts +2 -8
- package/ui.container-groups/useAttrs.ts +2 -8
- package/ui.container-modal/UModal.vue +1 -1
- package/ui.container-modal/useAttrs.ts +2 -12
- package/ui.container-modal-confirm/UModalConfirm.vue +3 -7
- package/ui.container-modal-confirm/useAttrs.ts +2 -8
- package/ui.container-page/UPage.vue +4 -5
- package/ui.container-page/useAttrs.ts +3 -32
- package/ui.container-row/useAttrs.ts +2 -8
- package/ui.data-list/UDataList.vue +3 -2
- package/ui.data-list/config.js +1 -1
- package/ui.data-list/useAttrs.js +2 -18
- package/ui.data-table/UTable.vue +6 -6
- package/ui.data-table/UTableRow.vue +1 -5
- package/ui.data-table/config.ts +28 -13
- package/ui.data-table/useAttrs.ts +10 -75
- package/ui.dropdown-badge/config.ts +10 -2
- package/ui.dropdown-badge/useAttrs.ts +8 -21
- package/ui.dropdown-button/config.ts +6 -6
- package/ui.dropdown-button/useAttrs.ts +6 -19
- package/ui.dropdown-link/config.ts +8 -2
- package/ui.dropdown-link/useAttrs.ts +10 -20
- package/ui.dropdown-list/config.ts +3 -2
- package/ui.dropdown-list/useAttrs.ts +2 -25
- package/ui.form-calendar/config.ts +36 -36
- package/ui.form-calendar/useAttrs.ts +2 -264
- package/ui.form-checkbox/useAttrs.ts +2 -8
- package/ui.form-checkbox-group/useAttrs.ts +2 -8
- package/ui.form-checkbox-multi-state/useAttrs.ts +2 -6
- package/ui.form-color-picker/useAttrs.js +2 -8
- package/ui.form-date-picker/useAttrs.ts +2 -6
- package/ui.form-date-picker-range/UDatePickerRange.vue +28 -28
- package/ui.form-date-picker-range/config.ts +30 -16
- package/ui.form-date-picker-range/useAttrs.ts +9 -70
- package/ui.form-input/UInput.vue +1 -1
- package/ui.form-input/useAttrs.js +2 -8
- package/ui.form-input-file/UInputFile.vue +3 -4
- package/ui.form-input-file/useAttrs.js +2 -8
- package/ui.form-input-money/useAttrs.js +2 -8
- package/ui.form-input-number/useAttrs.js +2 -8
- package/ui.form-input-rating/UInputRating.vue +5 -11
- package/ui.form-input-rating/useAttrs.js +2 -8
- package/ui.form-input-search/useAttrs.js +2 -8
- package/ui.form-label/useAttrs.js +2 -8
- package/ui.form-radio/useAttrs.ts +2 -8
- package/ui.form-radio-group/useAttrs.ts +2 -8
- package/ui.form-select/USelect.vue +37 -38
- package/ui.form-select/config.js +30 -11
- package/ui.form-select/useAttrs.js +6 -50
- package/ui.form-switch/useAttrs.js +2 -8
- package/ui.form-textarea/UTextarea.vue +5 -9
- package/ui.form-textarea/useAttrs.js +2 -8
- package/ui.image-avatar/useAttrs.ts +2 -8
- package/ui.image-icon/useAttrs.ts +2 -8
- package/ui.loader/config.ts +4 -1
- package/ui.loader/useAttrs.ts +2 -17
- package/ui.loader-overlay/useAttrs.ts +2 -12
- package/ui.loader-progress/ULoaderProgress.vue +2 -2
- package/ui.loader-progress/config.ts +8 -2
- package/ui.loader-progress/types.ts +5 -0
- package/ui.loader-progress/useAttrs.ts +3 -27
- package/ui.navigation-pagination/config.ts +6 -6
- package/ui.navigation-pagination/useAttrs.ts +2 -34
- package/ui.navigation-progress/config.ts +3 -1
- package/ui.navigation-progress/useAttrs.ts +5 -17
- package/ui.navigation-tab/config.ts +3 -1
- package/ui.navigation-tab/useAttrs.ts +4 -18
- package/ui.navigation-tabs/useAttrs.ts +2 -8
- package/ui.other-dot/useAttrs.ts +2 -8
- package/ui.text-alert/UAlert.vue +2 -1
- package/ui.text-alert/useAttrs.ts +2 -8
- package/ui.text-badge/useAttrs.ts +3 -8
- package/ui.text-block/UText.vue +2 -1
- package/ui.text-block/useAttrs.ts +2 -8
- package/ui.text-empty/useAttrs.ts +2 -8
- package/ui.text-file/useAttrs.ts +2 -8
- package/ui.text-files/useAttrs.ts +2 -8
- package/ui.text-header/useAttrs.ts +2 -8
- package/ui.text-money/UMoney.vue +1 -1
- package/ui.text-money/useAttrs.ts +2 -8
- package/ui.text-notify/useAttrs.ts +2 -8
- package/utils/helper.ts +29 -0
- package/utils/node/tailwindSafelist.js +2 -2
- package/utils/ui.ts +3 -4
- package/web-types.json +17 -1
- package/ui.button/useAttrs.ts +0 -26
|
@@ -12,13 +12,21 @@ export default /*tw*/ {
|
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
|
-
buttonWrapper:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
buttonWrapper: {
|
|
16
|
+
base: `
|
|
17
|
+
flex rounded-dynamic max-md:justify-between
|
|
18
|
+
focus-within:ring-dynamic focus-within:ring-offset-dynamic focus-within:ring-brand-700/15
|
|
19
|
+
`,
|
|
20
|
+
variants: {
|
|
21
|
+
opened: {
|
|
22
|
+
true: "ring-dynamic ring-offset-dynamic ring-brand-700/15",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
button: {
|
|
27
|
+
component: "{UButton}",
|
|
28
|
+
base: "shrink-0 grow rounded-none",
|
|
29
|
+
},
|
|
22
30
|
shiftRangeButton: `
|
|
23
31
|
first:rounded-dynamic first:rounded-r-none
|
|
24
32
|
last:rounded-dynamic last:rounded-l-none
|
|
@@ -57,19 +65,25 @@ export default /*tw*/ {
|
|
|
57
65
|
},
|
|
58
66
|
periodRow: "mb-1 flex min-w-64 gap-1",
|
|
59
67
|
periodButton: "{UButton} h-[3.125rem] w-full",
|
|
60
|
-
periodButtonActive: "!bg-gray-800/20",
|
|
68
|
+
periodButtonActive: "{>periodButton} !bg-gray-800/20",
|
|
61
69
|
rangeSwitchWrapper: "flex items-center justify-between py-2",
|
|
62
70
|
rangeSwitchButton: "{UButton}",
|
|
63
71
|
rangeSwitchTitle: "font-medium text-sm",
|
|
64
|
-
periodDateList:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
periodDateList: {
|
|
73
|
+
base: "grid grid-rows-1 gap-0.5",
|
|
74
|
+
variants: {
|
|
75
|
+
month: {
|
|
76
|
+
true: "grid-cols-3",
|
|
77
|
+
},
|
|
78
|
+
year: {
|
|
79
|
+
true: "grid-cols-3",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
69
83
|
periodDate: "w-full",
|
|
70
|
-
periodDateSelected: "",
|
|
71
|
-
periodDateCurrent: "border-2 border-brand-600",
|
|
72
|
-
periodDateCurrentSelected: "",
|
|
84
|
+
periodDateSelected: "{>periodDate}",
|
|
85
|
+
periodDateCurrent: "{>periodDate} border-2 border-brand-600",
|
|
86
|
+
periodDateCurrentSelected: "{>periodDate} {>periodDateSelected} {>periodDateCurrent}",
|
|
73
87
|
customRangeDescription: "",
|
|
74
88
|
rangeInputWrapper: "flex mt-4 -space-x-px group/range-input-wrapper",
|
|
75
89
|
rangeInputFirst: {
|
|
@@ -22,79 +22,22 @@ export default function useAttrs(
|
|
|
22
22
|
props: UDatePickerRangeProps<unknown>,
|
|
23
23
|
{ isShownMenu, isTop, isRight, isPeriod }: DatePickerRangeState,
|
|
24
24
|
): UseAttrs<Config> {
|
|
25
|
-
const { config, getKeysAttrs
|
|
26
|
-
defaultConfig,
|
|
27
|
-
() => props.config,
|
|
28
|
-
);
|
|
25
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
29
26
|
|
|
30
27
|
const mutatedProps = computed(() => ({
|
|
31
28
|
openDirectionY: isTop.value ? Direction.Top : Direction.Bottom,
|
|
32
29
|
openDirectionX: isRight.value ? Direction.Right : Direction.Left,
|
|
33
30
|
error: Boolean(props.error),
|
|
34
31
|
description: Boolean(props.description),
|
|
32
|
+
/* component state, not a props */
|
|
33
|
+
opened: isShownMenu.value,
|
|
34
|
+
week: isPeriod.value.week,
|
|
35
|
+
month: isPeriod.value.month,
|
|
36
|
+
quarter: isPeriod.value.quarter,
|
|
37
|
+
year: isPeriod.value.year,
|
|
35
38
|
}));
|
|
36
39
|
|
|
37
|
-
const
|
|
38
|
-
const extendingKeysClasses = getExtendingKeysClasses(
|
|
39
|
-
[
|
|
40
|
-
...extendingKeys,
|
|
41
|
-
"periodButton",
|
|
42
|
-
"periodDateList",
|
|
43
|
-
"periodDate",
|
|
44
|
-
"periodDateWeekList",
|
|
45
|
-
"periodDateQuarterList",
|
|
46
|
-
"periodDateYearList",
|
|
47
|
-
"periodDateSelected",
|
|
48
|
-
"periodDateCurrent",
|
|
49
|
-
],
|
|
50
|
-
mutatedProps,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
// TODO: Declare types for getKeysAttrs return value, this could be implemented using generic;
|
|
54
|
-
const keysAttrs = getKeysAttrs(mutatedProps, extendingKeys, {
|
|
55
|
-
buttonWrapper: {
|
|
56
|
-
extend: computed(() => [isShownMenu.value && extendingKeysClasses.buttonWrapperActive.value]),
|
|
57
|
-
},
|
|
58
|
-
button: {
|
|
59
|
-
extend: computed(() => [isShownMenu.value && extendingKeysClasses.buttonActive.value]),
|
|
60
|
-
},
|
|
61
|
-
periodDateList: {
|
|
62
|
-
extend: computed(() => [
|
|
63
|
-
isPeriod.value.week && extendingKeysClasses.periodDateWeekList.value,
|
|
64
|
-
isPeriod.value.month && extendingKeysClasses.periodDateMonthList.value,
|
|
65
|
-
isPeriod.value.quarter && extendingKeysClasses.periodDateQuarterList.value,
|
|
66
|
-
isPeriod.value.year && extendingKeysClasses.periodDateYearList.value,
|
|
67
|
-
]),
|
|
68
|
-
},
|
|
69
|
-
periodButtonActive: {
|
|
70
|
-
base: computed(() => [extendingKeysClasses.periodButton.value]),
|
|
71
|
-
},
|
|
72
|
-
periodDateWeekList: {
|
|
73
|
-
base: computed(() => [extendingKeysClasses.periodDateList.value]),
|
|
74
|
-
},
|
|
75
|
-
periodDateQuarterList: {
|
|
76
|
-
base: computed(() => [extendingKeysClasses.periodDateList.value]),
|
|
77
|
-
},
|
|
78
|
-
periodDateYearList: {
|
|
79
|
-
base: computed(() => [extendingKeysClasses.periodDateList.value]),
|
|
80
|
-
},
|
|
81
|
-
periodDateSelected: {
|
|
82
|
-
base: computed(() => [extendingKeysClasses.periodDate.value]),
|
|
83
|
-
},
|
|
84
|
-
periodDateCurrent: {
|
|
85
|
-
base: computed(() => [
|
|
86
|
-
extendingKeysClasses.periodDate.value,
|
|
87
|
-
extendingKeysClasses.periodDateCurrent.value,
|
|
88
|
-
]),
|
|
89
|
-
},
|
|
90
|
-
periodDateCurrentSelected: {
|
|
91
|
-
base: computed(() => [
|
|
92
|
-
extendingKeysClasses.periodDate.value,
|
|
93
|
-
extendingKeysClasses.periodDateSelected.value,
|
|
94
|
-
extendingKeysClasses.periodDateCurrent.value,
|
|
95
|
-
]),
|
|
96
|
-
},
|
|
97
|
-
});
|
|
40
|
+
const keysAttrs = getKeysAttrs(mutatedProps);
|
|
98
41
|
|
|
99
42
|
/* Merging DatePickerRange's i18n translations into Calendar's i18n translations. */
|
|
100
43
|
watchEffect(() => {
|
|
@@ -106,9 +49,5 @@ export default function useAttrs(
|
|
|
106
49
|
}
|
|
107
50
|
});
|
|
108
51
|
|
|
109
|
-
return {
|
|
110
|
-
config,
|
|
111
|
-
...keysAttrs,
|
|
112
|
-
hasSlotContent,
|
|
113
|
-
};
|
|
52
|
+
return { config, ...keysAttrs };
|
|
114
53
|
}
|
package/ui.form-input/UInput.vue
CHANGED
|
@@ -113,6 +113,7 @@ const VALIDATION_RULES_REG_EX = {
|
|
|
113
113
|
<script setup>
|
|
114
114
|
import { ref, computed, onMounted, useSlots, useId } from "vue";
|
|
115
115
|
|
|
116
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
116
117
|
import { useMutationObserver } from "../composables/useMutationObserver.ts";
|
|
117
118
|
|
|
118
119
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
@@ -358,7 +359,6 @@ const {
|
|
|
358
359
|
leftIconAttrs,
|
|
359
360
|
rightIconAttrs,
|
|
360
361
|
rightIconWrapperAttrs,
|
|
361
|
-
hasSlotContent,
|
|
362
362
|
} = useAttrs(props, { isTypePassword, inputPasswordClasses });
|
|
363
363
|
|
|
364
364
|
const iconSize = computed(() => {
|
|
@@ -4,18 +4,12 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
8
|
|
|
9
9
|
const mutatedProps = computed(() => ({
|
|
10
10
|
error: Boolean(props.error),
|
|
11
11
|
label: Boolean(props.label),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
config,
|
|
18
|
-
...keysAttrs,
|
|
19
|
-
hasSlotContent,
|
|
20
|
-
};
|
|
14
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
21
15
|
}
|
|
@@ -96,11 +96,11 @@ import UButton from "../ui.button/UButton.vue";
|
|
|
96
96
|
import UFiles from "../ui.text-files/UFiles.vue";
|
|
97
97
|
|
|
98
98
|
import { getDefault } from "../utils/ui.ts";
|
|
99
|
-
import {
|
|
100
|
-
|
|
101
|
-
import useAttrs from "./useAttrs.js";
|
|
99
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
102
100
|
import { useLocale } from "../composables/useLocale.ts";
|
|
103
101
|
|
|
102
|
+
import useAttrs from "./useAttrs.js";
|
|
103
|
+
import { getFileMbSize } from "./utilFileForm.js";
|
|
104
104
|
import { UInputFile } from "./constants.js";
|
|
105
105
|
import defaultConfig from "./config.js";
|
|
106
106
|
|
|
@@ -247,7 +247,6 @@ const {
|
|
|
247
247
|
inputAttrs,
|
|
248
248
|
fileListAttrs,
|
|
249
249
|
buttonsAttrs,
|
|
250
|
-
hasSlotContent,
|
|
251
250
|
} = useAttrs(props);
|
|
252
251
|
|
|
253
252
|
const i18nGlobal = tm(UInputFile);
|
|
@@ -4,18 +4,12 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
8
|
|
|
9
9
|
const mutatedProps = computed(() => ({
|
|
10
10
|
error: Boolean(props.error),
|
|
11
11
|
label: Boolean(props.label),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
config,
|
|
18
|
-
...keysAttrs,
|
|
19
|
-
hasSlotContent,
|
|
20
|
-
};
|
|
14
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
21
15
|
}
|
|
@@ -3,13 +3,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
4
|
|
|
5
5
|
export default function useAttrs(props) {
|
|
6
|
-
const { config, getKeysAttrs
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
config,
|
|
12
|
-
...keysAttrs,
|
|
13
|
-
hasSlotContent,
|
|
14
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
15
9
|
}
|
|
@@ -3,13 +3,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
4
|
|
|
5
5
|
export default function useAttrs(props) {
|
|
6
|
-
const { config, getKeysAttrs
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
config,
|
|
12
|
-
...keysAttrs,
|
|
13
|
-
hasSlotContent,
|
|
14
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
15
9
|
}
|
|
@@ -54,9 +54,11 @@
|
|
|
54
54
|
<script setup>
|
|
55
55
|
import { computed, ref } from "vue";
|
|
56
56
|
|
|
57
|
+
import { getDefault } from "../utils/ui.ts";
|
|
58
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
59
|
+
|
|
57
60
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
58
61
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
59
|
-
import { getDefault } from "../utils/ui.ts";
|
|
60
62
|
|
|
61
63
|
import { UInputRating } from "./constants.js";
|
|
62
64
|
import defaultConfig from "./config.js";
|
|
@@ -174,16 +176,8 @@ const emit = defineEmits([
|
|
|
174
176
|
|
|
175
177
|
const hovered = ref(null);
|
|
176
178
|
|
|
177
|
-
const {
|
|
178
|
-
|
|
179
|
-
inputLabelAttrs,
|
|
180
|
-
containerAttrs,
|
|
181
|
-
counterAttrs,
|
|
182
|
-
totalAttrs,
|
|
183
|
-
starsAttrs,
|
|
184
|
-
starAttrs,
|
|
185
|
-
hasSlotContent,
|
|
186
|
-
} = useAttrs(props);
|
|
179
|
+
const { config, inputLabelAttrs, containerAttrs, counterAttrs, totalAttrs, starsAttrs, starAttrs } =
|
|
180
|
+
useAttrs(props);
|
|
187
181
|
|
|
188
182
|
const iconSize = computed(() => {
|
|
189
183
|
const sizes = {
|
|
@@ -2,13 +2,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
2
2
|
import defaultConfig from "./config.js";
|
|
3
3
|
|
|
4
4
|
export default function useAttrs(props) {
|
|
5
|
-
const { config, getKeysAttrs
|
|
5
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
config,
|
|
11
|
-
...keysAttrs,
|
|
12
|
-
hasSlotContent,
|
|
13
|
-
};
|
|
7
|
+
return { config, ...getKeysAttrs() };
|
|
14
8
|
}
|
|
@@ -3,13 +3,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
4
|
|
|
5
5
|
export default function useAttrs(props) {
|
|
6
|
-
const { config, getKeysAttrs
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
config,
|
|
12
|
-
...keysAttrs,
|
|
13
|
-
hasSlotContent,
|
|
14
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
15
9
|
}
|
|
@@ -4,17 +4,11 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
8
|
|
|
9
9
|
const mutatedProps = computed(() => ({
|
|
10
10
|
error: Boolean(props.error),
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
config,
|
|
17
|
-
...keysAttrs,
|
|
18
|
-
hasSlotContent,
|
|
19
|
-
};
|
|
13
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
20
14
|
}
|
|
@@ -16,7 +16,7 @@ export default function useAttrs(
|
|
|
16
16
|
props: URadioProps,
|
|
17
17
|
{ radioColor, radioSize }: ComponentState,
|
|
18
18
|
): UseAttrs<Config> {
|
|
19
|
-
const { config, getKeysAttrs
|
|
19
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
20
20
|
|
|
21
21
|
const mutatedProps = computed(() => ({
|
|
22
22
|
color: radioColor.value,
|
|
@@ -25,11 +25,5 @@ export default function useAttrs(
|
|
|
25
25
|
error: Boolean(props.error),
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
config,
|
|
32
|
-
...keysAttrs,
|
|
33
|
-
hasSlotContent,
|
|
34
|
-
};
|
|
28
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
35
29
|
}
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { URadioGroupProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: URadioGroupProps): UseAttrs<Config> {
|
|
9
|
-
const { config, getKeysAttrs
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
config,
|
|
15
|
-
...keysAttrs,
|
|
16
|
-
hasSlotContent,
|
|
17
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
18
12
|
}
|
|
@@ -318,7 +318,7 @@ import UIcon from "../ui.image-icon/UIcon.vue";
|
|
|
318
318
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
319
319
|
import UDropdownList from "../ui.dropdown-list/UDropdownList.vue";
|
|
320
320
|
|
|
321
|
-
import { createDebounce } from "../utils/helper.ts";
|
|
321
|
+
import { createDebounce, hasSlotContent } from "../utils/helper.ts";
|
|
322
322
|
import { getDefault } from "../utils/ui.ts";
|
|
323
323
|
import { isMac } from "../utils/platform.ts";
|
|
324
324
|
|
|
@@ -599,38 +599,8 @@ const isTop = computed(() => {
|
|
|
599
599
|
return preferredOpenDirection.value === DIRECTION.top;
|
|
600
600
|
});
|
|
601
601
|
|
|
602
|
-
const selectedLabel = computed(() => {
|
|
603
|
-
return isLocalValue.value ? getOptionLabel(localValue.value) : "";
|
|
604
|
-
});
|
|
605
|
-
|
|
606
602
|
const elementId = props.id || useId();
|
|
607
603
|
|
|
608
|
-
const {
|
|
609
|
-
config,
|
|
610
|
-
hasSlotContent,
|
|
611
|
-
selectLabelAttrs,
|
|
612
|
-
wrapperAttrs,
|
|
613
|
-
innerWrapperAttrs,
|
|
614
|
-
leftIconWrapperAttrs,
|
|
615
|
-
rightIconWrapperAttrs,
|
|
616
|
-
leftIconAttrs,
|
|
617
|
-
rightIconAttrs,
|
|
618
|
-
beforeCaretAttrs,
|
|
619
|
-
afterCaretAttrs,
|
|
620
|
-
toggleAttrs,
|
|
621
|
-
clearAttrs,
|
|
622
|
-
clearMultipleTextAttrs,
|
|
623
|
-
clearMultipleAttrs,
|
|
624
|
-
searchAttrs,
|
|
625
|
-
searchInputAttrs,
|
|
626
|
-
selectedLabelsAttrs,
|
|
627
|
-
selectedLabelAttrs,
|
|
628
|
-
dropdownListAttrs,
|
|
629
|
-
toggleIconAttrs,
|
|
630
|
-
clearIconAttrs,
|
|
631
|
-
clearMultipleIconAttrs,
|
|
632
|
-
} = useAttrs(props, { isTop, isOpen, selectedLabel });
|
|
633
|
-
|
|
634
604
|
const i18nGlobal = tm(USelect);
|
|
635
605
|
const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
|
|
636
606
|
|
|
@@ -705,13 +675,6 @@ const localValue = computed(() => {
|
|
|
705
675
|
: [];
|
|
706
676
|
});
|
|
707
677
|
|
|
708
|
-
const isEmpty = computed(() => {
|
|
709
|
-
return (
|
|
710
|
-
(filteredOptions.value.length === 0 && search) ||
|
|
711
|
-
(props.multiple && localValue.value.length === props.options.length)
|
|
712
|
-
);
|
|
713
|
-
});
|
|
714
|
-
|
|
715
678
|
const isLocalValue = computed(() => {
|
|
716
679
|
if (props.multiple) return Boolean(localValue.value.length);
|
|
717
680
|
|
|
@@ -720,6 +683,42 @@ const isLocalValue = computed(() => {
|
|
|
720
683
|
: Boolean(String(localValue.value));
|
|
721
684
|
});
|
|
722
685
|
|
|
686
|
+
const selectedLabel = computed(() => {
|
|
687
|
+
return isLocalValue.value ? getOptionLabel(localValue.value) : "";
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
const isEmpty = computed(() => {
|
|
691
|
+
return (
|
|
692
|
+
(filteredOptions.value.length === 0 && search) ||
|
|
693
|
+
(props.multiple && localValue.value.length === props.options.length)
|
|
694
|
+
);
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
const {
|
|
698
|
+
config,
|
|
699
|
+
selectLabelAttrs,
|
|
700
|
+
wrapperAttrs,
|
|
701
|
+
innerWrapperAttrs,
|
|
702
|
+
leftIconWrapperAttrs,
|
|
703
|
+
rightIconWrapperAttrs,
|
|
704
|
+
leftIconAttrs,
|
|
705
|
+
rightIconAttrs,
|
|
706
|
+
beforeCaretAttrs,
|
|
707
|
+
afterCaretAttrs,
|
|
708
|
+
toggleAttrs,
|
|
709
|
+
clearAttrs,
|
|
710
|
+
clearMultipleTextAttrs,
|
|
711
|
+
clearMultipleAttrs,
|
|
712
|
+
searchAttrs,
|
|
713
|
+
searchInputAttrs,
|
|
714
|
+
selectedLabelsAttrs,
|
|
715
|
+
selectedLabelAttrs,
|
|
716
|
+
dropdownListAttrs,
|
|
717
|
+
toggleIconAttrs,
|
|
718
|
+
clearIconAttrs,
|
|
719
|
+
clearMultipleIconAttrs,
|
|
720
|
+
} = useAttrs(props, { isTop, isOpen, selectedLabel });
|
|
721
|
+
|
|
723
722
|
const onSearchChange = createDebounce(function (query) {
|
|
724
723
|
emit("searchChange", query);
|
|
725
724
|
}, 300);
|
package/ui.form-select/config.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
selectLabel:
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
selectLabel: {
|
|
3
|
+
component: "{ULabel}",
|
|
4
|
+
variants: {
|
|
5
|
+
opened: {
|
|
6
|
+
true: "group/active",
|
|
7
|
+
},
|
|
8
|
+
openedTop: {
|
|
9
|
+
true: "group/top",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
wrapper: {
|
|
6
14
|
base: `
|
|
7
15
|
py-2 flex flex-row-reverse justify-between w-full min-h-full box-border relative
|
|
@@ -20,6 +28,9 @@ export default /*tw*/ {
|
|
|
20
28
|
disabled: {
|
|
21
29
|
true: "bg-gray-100 pointer-events-none",
|
|
22
30
|
},
|
|
31
|
+
opened: {
|
|
32
|
+
true: "z-[inherit]",
|
|
33
|
+
},
|
|
23
34
|
},
|
|
24
35
|
compoundVariants: [
|
|
25
36
|
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-5" },
|
|
@@ -27,7 +38,6 @@ export default /*tw*/ {
|
|
|
27
38
|
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-7" },
|
|
28
39
|
],
|
|
29
40
|
},
|
|
30
|
-
wrapperActive: "z-[inherit]",
|
|
31
41
|
innerWrapper: {
|
|
32
42
|
base: "px-3 flex min-h-full w-full overflow-hidden justify-between",
|
|
33
43
|
variants: {
|
|
@@ -62,11 +72,11 @@ export default /*tw*/ {
|
|
|
62
72
|
],
|
|
63
73
|
},
|
|
64
74
|
leftIconWrapper: "pr-1.5",
|
|
65
|
-
rightIconWrapper: "pr-3",
|
|
75
|
+
rightIconWrapper: "{>caret} pr-3",
|
|
66
76
|
leftIcon: "{UIcon}",
|
|
67
77
|
rightIcon: "{UIcon}",
|
|
68
|
-
beforeCaret: "",
|
|
69
|
-
afterCaret: "mr-3",
|
|
78
|
+
beforeCaret: "{>caret}",
|
|
79
|
+
afterCaret: "{>caret} mr-3",
|
|
70
80
|
caret: {
|
|
71
81
|
base: "flex items-center mt-0",
|
|
72
82
|
compoundVariants: [
|
|
@@ -75,9 +85,9 @@ export default /*tw*/ {
|
|
|
75
85
|
{ labelAlign: "topInside", size: "lg", label: true, class: "-mt-[1.125rem]" },
|
|
76
86
|
],
|
|
77
87
|
},
|
|
78
|
-
toggle: "mr-3",
|
|
88
|
+
toggle: "{>caret} mr-3",
|
|
79
89
|
toggleIcon: "{UIcon} transition duration-300 group-[]/active:rotate-180",
|
|
80
|
-
clear: "",
|
|
90
|
+
clear: "{>caret}",
|
|
81
91
|
clearIcon: "{UIcon}",
|
|
82
92
|
clearMultiple: "flex items-center",
|
|
83
93
|
clearMultipleIcon: "{UIcon}",
|
|
@@ -89,8 +99,17 @@ export default /*tw*/ {
|
|
|
89
99
|
{ size: "lg", class: "text-base" },
|
|
90
100
|
],
|
|
91
101
|
},
|
|
92
|
-
search:
|
|
93
|
-
|
|
102
|
+
search: {
|
|
103
|
+
base: "flex w-0",
|
|
104
|
+
variants: {
|
|
105
|
+
selected: {
|
|
106
|
+
false: "w-full",
|
|
107
|
+
},
|
|
108
|
+
opened: {
|
|
109
|
+
true: "w-full",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
94
113
|
searchInput: {
|
|
95
114
|
base: `
|
|
96
115
|
p-0 font-normal !leading-none text-gray-900 relative w-full border-none bg-transparent
|
|
@@ -4,60 +4,16 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props, { isTop, isOpen, selectedLabel: selectedLabelValue }) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
8
|
-
defaultConfig,
|
|
9
|
-
() => props.config,
|
|
10
|
-
);
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
11
8
|
|
|
12
9
|
const mutatedProps = computed(() => ({
|
|
13
10
|
error: Boolean(props.error),
|
|
14
11
|
label: Boolean(props.label),
|
|
12
|
+
/* component state, not a props */
|
|
13
|
+
selected: Boolean(selectedLabelValue.value),
|
|
14
|
+
opened: isOpen.value,
|
|
15
|
+
openedTop: isTop.value,
|
|
15
16
|
}));
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
"caret",
|
|
19
|
-
"searchActive",
|
|
20
|
-
"wrapperActive",
|
|
21
|
-
"selectLabelActive",
|
|
22
|
-
"selectLabelOpenDirectionTop",
|
|
23
|
-
];
|
|
24
|
-
const extendingKeysClasses = getExtendingKeysClasses(extendingKeys, mutatedProps);
|
|
25
|
-
|
|
26
|
-
const keysAttrs = getKeysAttrs(mutatedProps, extendingKeys, {
|
|
27
|
-
selectLabel: {
|
|
28
|
-
extend: computed(() => [
|
|
29
|
-
isOpen.value && extendingKeysClasses.selectLabelActive.value,
|
|
30
|
-
isTop.value && extendingKeysClasses.selectLabelOpenDirectionTop.value,
|
|
31
|
-
]),
|
|
32
|
-
},
|
|
33
|
-
wrapper: {
|
|
34
|
-
extend: computed(() => [isOpen.value && extendingKeysClasses.wrapperActive.value]),
|
|
35
|
-
},
|
|
36
|
-
toggle: {
|
|
37
|
-
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
38
|
-
},
|
|
39
|
-
clear: {
|
|
40
|
-
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
41
|
-
},
|
|
42
|
-
beforeCaret: {
|
|
43
|
-
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
44
|
-
},
|
|
45
|
-
afterCaret: {
|
|
46
|
-
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
47
|
-
},
|
|
48
|
-
rightIconWrapper: {
|
|
49
|
-
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
50
|
-
},
|
|
51
|
-
search: {
|
|
52
|
-
extend: computed(() => [
|
|
53
|
-
(!selectedLabelValue.value || isOpen.value) && extendingKeysClasses.searchActive.value,
|
|
54
|
-
]),
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
config,
|
|
60
|
-
...keysAttrs,
|
|
61
|
-
hasSlotContent,
|
|
62
|
-
};
|
|
18
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
63
19
|
}
|
|
@@ -4,17 +4,11 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props, { checked }) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
8
|
|
|
9
9
|
const mutatedProps = computed(() => ({
|
|
10
10
|
checked: Boolean(checked.value),
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
config,
|
|
17
|
-
...keysAttrs,
|
|
18
|
-
hasSlotContent,
|
|
19
|
-
};
|
|
13
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
20
14
|
}
|