@vuetify/nightly 3.1.7-dev-20230224.0 → 3.1.7
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/CHANGELOG.md +6 -4
- package/dist/json/attributes.json +561 -33
- package/dist/json/importMap.json +52 -52
- package/dist/json/tags.json +136 -2
- package/dist/json/web-types.json +2160 -86
- package/dist/vuetify-labs.css +235 -231
- package/dist/vuetify-labs.d.ts +3453 -145
- package/dist/vuetify-labs.esm.js +56 -16
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +56 -16
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +5 -1
- package/dist/vuetify.d.ts +1931 -81
- package/dist/vuetify.esm.js +38 -9
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +38 -9
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +12 -9
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VAlert/index.d.ts +22 -0
- package/lib/components/VApp/index.d.ts +6 -0
- package/lib/components/VAppBar/index.d.ts +36 -0
- package/lib/components/VAutocomplete/index.d.ts +117 -6
- package/lib/components/VAvatar/index.d.ts +6 -0
- package/lib/components/VBadge/index.d.ts +8 -0
- package/lib/components/VBanner/index.d.ts +24 -0
- package/lib/components/VBottomNavigation/index.d.ts +6 -0
- package/lib/components/VBreadcrumbs/index.d.ts +28 -4
- package/lib/components/VBtn/index.d.ts +12 -0
- package/lib/components/VBtnGroup/index.d.ts +6 -0
- package/lib/components/VBtnToggle/index.d.ts +6 -0
- package/lib/components/VCard/index.d.ts +60 -0
- package/lib/components/VCarousel/index.d.ts +60 -0
- package/lib/components/VCheckbox/index.d.ts +38 -0
- package/lib/components/VChip/index.d.ts +12 -0
- package/lib/components/VChipGroup/index.d.ts +6 -0
- package/lib/components/VCode/index.d.ts +6 -0
- package/lib/components/VCombobox/index.d.ts +117 -6
- package/lib/components/VCounter/index.d.ts +24 -0
- package/lib/components/VDefaultsProvider/index.d.ts +6 -0
- package/lib/components/VDialog/index.d.ts +64 -1
- package/lib/components/VDivider/index.d.ts +6 -0
- package/lib/components/VExpansionPanel/VExpansionPanelTitle.mjs.map +1 -1
- package/lib/components/VExpansionPanel/index.d.ts +49 -12
- package/lib/components/VField/index.d.ts +20 -6
- package/lib/components/VFileInput/index.d.ts +43 -1
- package/lib/components/VFooter/index.d.ts +6 -0
- package/lib/components/VForm/index.d.ts +6 -0
- package/lib/components/VGrid/index.d.ts +24 -0
- package/lib/components/VHover/index.d.ts +12 -0
- package/lib/components/VIcon/index.d.ts +12 -0
- package/lib/components/VImg/index.d.ts +12 -0
- package/lib/components/VInput/index.d.ts +12 -0
- package/lib/components/VItemGroup/index.d.ts +12 -0
- package/lib/components/VKbd/index.d.ts +6 -0
- package/lib/components/VLabel/index.d.ts +6 -0
- package/lib/components/VLayout/index.d.ts +12 -0
- package/lib/components/VLazy/index.d.ts +6 -0
- package/lib/components/VList/index.d.ts +77 -6
- package/lib/components/VLocaleProvider/index.d.ts +6 -0
- package/lib/components/VMain/index.d.ts +6 -0
- package/lib/components/VMenu/index.d.ts +64 -1
- package/lib/components/VMessages/index.d.ts +24 -0
- package/lib/components/VNavigationDrawer/index.d.ts +12 -0
- package/lib/components/VNoSsr/index.d.ts +6 -0
- package/lib/components/VOverlay/index.d.ts +18 -0
- package/lib/components/VPagination/index.d.ts +14 -0
- package/lib/components/VParallax/index.d.ts +12 -0
- package/lib/components/VProgressCircular/index.d.ts +6 -0
- package/lib/components/VProgressLinear/index.d.ts +12 -0
- package/lib/components/VRadio/index.d.ts +16 -0
- package/lib/components/VRadioGroup/index.d.ts +22 -0
- package/lib/components/VRangeSlider/index.d.ts +16 -0
- package/lib/components/VRating/VRating.css +4 -0
- package/lib/components/VRating/VRating.mjs +35 -6
- package/lib/components/VRating/VRating.mjs.map +1 -1
- package/lib/components/VRating/VRating.sass +5 -0
- package/lib/components/VRating/index.d.ts +8 -1
- package/lib/components/VResponsive/index.d.ts +8 -0
- package/lib/components/VSelect/index.d.ts +183 -6
- package/lib/components/VSelectionControl/index.d.ts +14 -6
- package/lib/components/VSelectionControlGroup/index.d.ts +6 -0
- package/lib/components/VSheet/index.d.ts +6 -0
- package/lib/components/VSlideGroup/index.d.ts +26 -0
- package/lib/components/VSlider/index.d.ts +16 -0
- package/lib/components/VSnackbar/index.d.ts +44 -1
- package/lib/components/VSwitch/index.d.ts +22 -0
- package/lib/components/VSystemBar/index.d.ts +6 -0
- package/lib/components/VTable/index.d.ts +12 -0
- package/lib/components/VTabs/index.d.ts +12 -0
- package/lib/components/VTextField/index.d.ts +54 -6
- package/lib/components/VTextarea/index.d.ts +39 -1
- package/lib/components/VThemeProvider/index.d.ts +6 -0
- package/lib/components/VTimeline/index.d.ts +16 -0
- package/lib/components/VToolbar/index.d.ts +30 -0
- package/lib/components/VTooltip/index.d.ts +46 -1
- package/lib/components/VValidation/index.d.ts +6 -0
- package/lib/components/VWindow/index.d.ts +34 -0
- package/lib/components/index.d.ts +1916 -66
- package/lib/components/transitions/index.d.ts +96 -0
- package/lib/entry-bundler.mjs +1 -1
- package/lib/entry-bundler.mjs.map +1 -1
- package/lib/framework.mjs +1 -1
- package/lib/framework.mjs.map +1 -1
- package/lib/index.d.ts +15 -15
- package/lib/labs/VDataTable/VDataTableRows.mjs +4 -6
- package/lib/labs/VDataTable/VDataTableRows.mjs.map +1 -1
- package/lib/labs/VDataTable/index.d.ts +1503 -48
- package/lib/labs/VVirtualScroll/VVirtualScroll.mjs +15 -2
- package/lib/labs/VVirtualScroll/VVirtualScroll.mjs.map +1 -1
- package/lib/labs/VVirtualScroll/index.d.ts +9 -6
- package/lib/labs/components.d.ts +1512 -54
- package/lib/util/defineComponent.mjs.map +1 -1
- package/package.json +2 -1
|
@@ -15,6 +15,9 @@ declare const VProgressCircular: vue.DefineComponent<{
|
|
|
15
15
|
$children?: vue.VNodeChild | (() => vue.VNodeChild) | {
|
|
16
16
|
default?: (() => vue.VNodeChild) | undefined;
|
|
17
17
|
};
|
|
18
|
+
$slots?: {
|
|
19
|
+
default?: (() => vue.VNodeChild) | undefined;
|
|
20
|
+
} | undefined;
|
|
18
21
|
'v-slots'?: {
|
|
19
22
|
default?: false | (() => vue.VNodeChild) | undefined;
|
|
20
23
|
} | undefined;
|
|
@@ -35,6 +38,9 @@ declare const VProgressCircular: vue.DefineComponent<{
|
|
|
35
38
|
$children?: vue.VNodeChild | (() => vue.VNodeChild) | {
|
|
36
39
|
default?: (() => vue.VNodeChild) | undefined;
|
|
37
40
|
};
|
|
41
|
+
$slots?: {
|
|
42
|
+
default?: (() => vue.VNodeChild) | undefined;
|
|
43
|
+
} | undefined;
|
|
38
44
|
'v-slots'?: {
|
|
39
45
|
default?: false | (() => vue.VNodeChild) | undefined;
|
|
40
46
|
} | undefined;
|
|
@@ -37,6 +37,12 @@ declare const VProgressLinear: vue.DefineComponent<{
|
|
|
37
37
|
buffer: number;
|
|
38
38
|
}) => vue.VNodeChild) | undefined;
|
|
39
39
|
};
|
|
40
|
+
$slots?: {
|
|
41
|
+
default?: ((args_0: {
|
|
42
|
+
value: number;
|
|
43
|
+
buffer: number;
|
|
44
|
+
}) => vue.VNodeChild) | undefined;
|
|
45
|
+
} | undefined;
|
|
40
46
|
'v-slots'?: {
|
|
41
47
|
default?: false | ((args_0: {
|
|
42
48
|
value: number;
|
|
@@ -81,6 +87,12 @@ declare const VProgressLinear: vue.DefineComponent<{
|
|
|
81
87
|
buffer: number;
|
|
82
88
|
}) => vue.VNodeChild) | undefined;
|
|
83
89
|
};
|
|
90
|
+
$slots?: {
|
|
91
|
+
default?: ((args_0: {
|
|
92
|
+
value: number;
|
|
93
|
+
buffer: number;
|
|
94
|
+
}) => vue.VNodeChild) | undefined;
|
|
95
|
+
} | undefined;
|
|
84
96
|
'v-slots'?: {
|
|
85
97
|
default?: false | ((args_0: {
|
|
86
98
|
value: number;
|
|
@@ -50,6 +50,14 @@ declare const VRadio: vue.DefineComponent<{
|
|
|
50
50
|
}) => vue.VNodeChild) | undefined;
|
|
51
51
|
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
52
52
|
};
|
|
53
|
+
$slots?: {
|
|
54
|
+
default?: (() => vue.VNodeChild) | undefined;
|
|
55
|
+
label?: ((args_0: {
|
|
56
|
+
label: string | undefined;
|
|
57
|
+
props: Record<string, unknown>;
|
|
58
|
+
}) => vue.VNodeChild) | undefined;
|
|
59
|
+
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
60
|
+
} | undefined;
|
|
53
61
|
'v-slots'?: {
|
|
54
62
|
default?: false | (() => vue.VNodeChild) | undefined;
|
|
55
63
|
label?: false | ((args_0: {
|
|
@@ -96,6 +104,14 @@ declare const VRadio: vue.DefineComponent<{
|
|
|
96
104
|
}) => vue.VNodeChild) | undefined;
|
|
97
105
|
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
98
106
|
};
|
|
107
|
+
$slots?: {
|
|
108
|
+
default?: (() => vue.VNodeChild) | undefined;
|
|
109
|
+
label?: ((args_0: {
|
|
110
|
+
label: string | undefined;
|
|
111
|
+
props: Record<string, unknown>;
|
|
112
|
+
}) => vue.VNodeChild) | undefined;
|
|
113
|
+
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
114
|
+
} | undefined;
|
|
99
115
|
'v-slots'?: {
|
|
100
116
|
default?: false | (() => vue.VNodeChild) | undefined;
|
|
101
117
|
label?: false | ((args_0: {
|
|
@@ -82,6 +82,17 @@ declare const VRadioGroup: vue.DefineComponent<{
|
|
|
82
82
|
}) => vue.VNodeChild) | undefined;
|
|
83
83
|
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
84
84
|
};
|
|
85
|
+
$slots?: {
|
|
86
|
+
default?: (((args_0: VInputSlot) => vue.VNodeChild) & (() => vue.VNodeChild)) | undefined;
|
|
87
|
+
prepend?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
88
|
+
append?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
89
|
+
details?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
90
|
+
label?: ((args_0: {
|
|
91
|
+
label: string | undefined;
|
|
92
|
+
props: Record<string, unknown>;
|
|
93
|
+
}) => vue.VNodeChild) | undefined;
|
|
94
|
+
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
95
|
+
} | undefined;
|
|
85
96
|
'v-slots'?: {
|
|
86
97
|
default?: false | (((args_0: VInputSlot) => vue.VNodeChild) & (() => vue.VNodeChild)) | undefined;
|
|
87
98
|
prepend?: false | ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
@@ -149,6 +160,17 @@ declare const VRadioGroup: vue.DefineComponent<{
|
|
|
149
160
|
}) => vue.VNodeChild) | undefined;
|
|
150
161
|
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
151
162
|
};
|
|
163
|
+
$slots?: {
|
|
164
|
+
default?: (((args_0: VInputSlot) => vue.VNodeChild) & (() => vue.VNodeChild)) | undefined;
|
|
165
|
+
prepend?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
166
|
+
append?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
167
|
+
details?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
168
|
+
label?: ((args_0: {
|
|
169
|
+
label: string | undefined;
|
|
170
|
+
props: Record<string, unknown>;
|
|
171
|
+
}) => vue.VNodeChild) | undefined;
|
|
172
|
+
input?: ((args_0: SelectionControlSlot) => vue.VNodeChild) | undefined;
|
|
173
|
+
} | undefined;
|
|
152
174
|
'v-slots'?: {
|
|
153
175
|
default?: false | (((args_0: VInputSlot) => vue.VNodeChild) & (() => vue.VNodeChild)) | undefined;
|
|
154
176
|
prepend?: false | ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
@@ -75,6 +75,14 @@ declare const VRangeSlider: vue.DefineComponent<{
|
|
|
75
75
|
'tick-label'?: (() => vue.VNodeChild) | undefined;
|
|
76
76
|
'thumb-label'?: (() => vue.VNodeChild) | undefined;
|
|
77
77
|
};
|
|
78
|
+
$slots?: {
|
|
79
|
+
default?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
80
|
+
prepend?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
81
|
+
append?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
82
|
+
details?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
83
|
+
'tick-label'?: (() => vue.VNodeChild) | undefined;
|
|
84
|
+
'thumb-label'?: (() => vue.VNodeChild) | undefined;
|
|
85
|
+
} | undefined;
|
|
78
86
|
'v-slots'?: {
|
|
79
87
|
default?: false | ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
80
88
|
prepend?: false | ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
@@ -142,6 +150,14 @@ declare const VRangeSlider: vue.DefineComponent<{
|
|
|
142
150
|
'tick-label'?: (() => vue.VNodeChild) | undefined;
|
|
143
151
|
'thumb-label'?: (() => vue.VNodeChild) | undefined;
|
|
144
152
|
};
|
|
153
|
+
$slots?: {
|
|
154
|
+
default?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
155
|
+
prepend?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
156
|
+
append?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
157
|
+
details?: ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
158
|
+
'tick-label'?: (() => vue.VNodeChild) | undefined;
|
|
159
|
+
'thumb-label'?: (() => vue.VNodeChild) | undefined;
|
|
160
|
+
} | undefined;
|
|
145
161
|
'v-slots'?: {
|
|
146
162
|
default?: false | ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
147
163
|
prepend?: false | ((args_0: VInputSlot) => vue.VNodeChild) | undefined;
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
.v-rating--hover .v-rating__item:hover:not(.v-rating__item--focused) .v-btn {
|
|
37
37
|
transform: scale(1.25);
|
|
38
38
|
}
|
|
39
|
+
.v-rating__item--focused .v-btn__overlay {
|
|
40
|
+
display: block;
|
|
41
|
+
opacity: var(--v-hover-opacity);
|
|
42
|
+
}
|
|
39
43
|
.v-rating__item--half {
|
|
40
44
|
overflow: hidden;
|
|
41
45
|
position: absolute;
|
|
@@ -74,6 +74,9 @@ export const VRating = genericComponent()({
|
|
|
74
74
|
const range = computed(() => createRange(Number(props.length), 1));
|
|
75
75
|
const increments = computed(() => range.value.flatMap(v => props.halfIncrements ? [v - 0.5, v] : [v]));
|
|
76
76
|
const hoverIndex = ref(-1);
|
|
77
|
+
const focusIndex = ref(-1);
|
|
78
|
+
const firstRef = ref();
|
|
79
|
+
let isClicking = false;
|
|
77
80
|
const itemState = computed(() => increments.value.map(value => {
|
|
78
81
|
const isHovering = props.hover && hoverIndex.value > -1;
|
|
79
82
|
const isFilled = normalizedValue.value >= value;
|
|
@@ -96,6 +99,16 @@ export const VRating = genericComponent()({
|
|
|
96
99
|
function onMouseleave() {
|
|
97
100
|
hoverIndex.value = -1;
|
|
98
101
|
}
|
|
102
|
+
function onFocus() {
|
|
103
|
+
if (value === 0 && normalizedValue.value === 0) {
|
|
104
|
+
firstRef.value?.focus();
|
|
105
|
+
} else {
|
|
106
|
+
focusIndex.value = value;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function onBlur() {
|
|
110
|
+
if (!isClicking) focusIndex.value = -1;
|
|
111
|
+
}
|
|
99
112
|
function onClick() {
|
|
100
113
|
if (props.disabled || props.readonly) return;
|
|
101
114
|
rating.value = normalizedValue.value === value && props.clearable ? 0 : value;
|
|
@@ -103,9 +116,17 @@ export const VRating = genericComponent()({
|
|
|
103
116
|
return {
|
|
104
117
|
onMouseenter: props.hover ? onMouseenter : undefined,
|
|
105
118
|
onMouseleave: props.hover ? onMouseleave : undefined,
|
|
119
|
+
onFocus,
|
|
120
|
+
onBlur,
|
|
106
121
|
onClick
|
|
107
122
|
};
|
|
108
123
|
}));
|
|
124
|
+
function onMousedown() {
|
|
125
|
+
isClicking = true;
|
|
126
|
+
}
|
|
127
|
+
function onMouseup() {
|
|
128
|
+
isClicking = false;
|
|
129
|
+
}
|
|
109
130
|
const name = computed(() => props.name ?? `v-rating-${getUid()}`);
|
|
110
131
|
function VRatingItem(_ref2) {
|
|
111
132
|
let {
|
|
@@ -116,6 +137,8 @@ export const VRating = genericComponent()({
|
|
|
116
137
|
const {
|
|
117
138
|
onMouseenter,
|
|
118
139
|
onMouseleave,
|
|
140
|
+
onFocus,
|
|
141
|
+
onBlur,
|
|
119
142
|
onClick
|
|
120
143
|
} = eventState.value[index + 1];
|
|
121
144
|
const id = `${name.value}-${String(value).replace('.', '-')}`;
|
|
@@ -126,6 +149,7 @@ export const VRating = genericComponent()({
|
|
|
126
149
|
icon: itemState.value[index]?.icon,
|
|
127
150
|
ripple: props.ripple,
|
|
128
151
|
size: props.size,
|
|
152
|
+
tag: 'span',
|
|
129
153
|
variant: 'plain'
|
|
130
154
|
};
|
|
131
155
|
return _createVNode(_Fragment, null, [_createVNode("label", {
|
|
@@ -134,17 +158,17 @@ export const VRating = genericComponent()({
|
|
|
134
158
|
'v-rating__item--half': props.halfIncrements && value % 1 > 0,
|
|
135
159
|
'v-rating__item--full': props.halfIncrements && value % 1 === 0
|
|
136
160
|
},
|
|
161
|
+
"onMousedown": onMousedown,
|
|
162
|
+
"onMouseup": onMouseup,
|
|
137
163
|
"onMouseenter": onMouseenter,
|
|
138
|
-
"onMouseleave": onMouseleave
|
|
139
|
-
"onClick": onClick
|
|
164
|
+
"onMouseleave": onMouseleave
|
|
140
165
|
}, [_createVNode("span", {
|
|
141
166
|
"class": "v-rating__hidden"
|
|
142
167
|
}, [t(props.itemAriaLabel, value, props.length)]), !showStar ? undefined : slots.item ? slots.item({
|
|
143
168
|
...itemState.value[index],
|
|
144
169
|
props: btnProps,
|
|
145
170
|
value,
|
|
146
|
-
index
|
|
147
|
-
rating: normalizedValue.value
|
|
171
|
+
index
|
|
148
172
|
}) : _createVNode(VBtn, btnProps, null)]), _createVNode("input", {
|
|
149
173
|
"class": "v-rating__hidden",
|
|
150
174
|
"name": name.value,
|
|
@@ -152,7 +176,10 @@ export const VRating = genericComponent()({
|
|
|
152
176
|
"type": "radio",
|
|
153
177
|
"value": value,
|
|
154
178
|
"checked": normalizedValue.value === value,
|
|
155
|
-
"
|
|
179
|
+
"onClick": onClick,
|
|
180
|
+
"onFocus": onFocus,
|
|
181
|
+
"onBlur": onBlur,
|
|
182
|
+
"ref": index === 0 ? firstRef : undefined,
|
|
156
183
|
"readonly": props.readonly,
|
|
157
184
|
"disabled": props.disabled
|
|
158
185
|
}, null)]);
|
|
@@ -181,7 +208,9 @@ export const VRating = genericComponent()({
|
|
|
181
208
|
index: i,
|
|
182
209
|
label: props.itemLabels?.[i]
|
|
183
210
|
}) : undefined, _createVNode("div", {
|
|
184
|
-
"class":
|
|
211
|
+
"class": ['v-rating__item', {
|
|
212
|
+
'v-rating__item--focused': Math.ceil(focusIndex.value) === value
|
|
213
|
+
}]
|
|
185
214
|
}, [props.halfIncrements ? _createVNode(_Fragment, null, [_createVNode(VRatingItem, {
|
|
186
215
|
"value": value - 0.5,
|
|
187
216
|
"index": i * 2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VRating.mjs","names":["VBtn","IconValue","makeDensityProps","makeSizeProps","makeTagProps","makeThemeProps","provideTheme","useLocale","useProxiedModel","computed","ref","clamp","createRange","genericComponent","getUid","useRender","VRating","name","props","String","itemAriaLabel","type","default","activeColor","color","clearable","Boolean","disabled","emptyIcon","fullIcon","halfIncrements","hover","length","Number","readonly","modelValue","itemLabels","Array","itemLabelPosition","validator","v","includes","ripple","emits","value","setup","slots","t","themeClasses","rating","normalizedValue","parseFloat","range","increments","flatMap","hoverIndex","itemState","map","isHovering","isFilled","isHovered","isFullIcon","icon","eventState","onMouseenter","onMouseleave","onClick","undefined","VRatingItem","index","showStar","id","replace","btnProps","density","size","variant","item","createLabel","labelProps","label","hasLabels","i"],"sources":["../../../src/components/VRating/VRating.tsx"],"sourcesContent":["// Styles\nimport './VRating.sass'\n\n// Components\nimport { VBtn } from '@/components/VBtn'\n\n// Composables\nimport { IconValue } from '@/composables/icons'\nimport { makeDensityProps } from '@/composables/density'\nimport { makeSizeProps } from '@/composables/size'\nimport { makeTagProps } from '@/composables/tag'\nimport { makeThemeProps, provideTheme } from '@/composables/theme'\nimport { useLocale } from '@/composables/locale'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, ref } from 'vue'\nimport { clamp, createRange, genericComponent, getUid, useRender } from '@/util'\n\n// Types\nimport type { Prop } from 'vue'\nimport type { Variant } from '@/composables/variant'\n\ntype VRatingItemSlot = {\n value: number\n index: number\n isFilled: boolean\n isHovered: boolean\n icon: IconValue\n color?: string\n props: Record<string, unknown>\n rating: number\n}\n\ntype VRatingItemLabelSlot = {\n value: number\n index: number\n label?: string\n}\n\ntype VRatingSlots = {\n item: [VRatingItemSlot]\n 'item-label': [VRatingItemLabelSlot]\n}\n\nexport const VRating = genericComponent<VRatingSlots>()({\n name: 'VRating',\n\n props: {\n name: String,\n itemAriaLabel: {\n type: String,\n default: '$vuetify.rating.ariaLabel.item',\n },\n activeColor: String,\n color: String,\n clearable: Boolean,\n disabled: Boolean,\n emptyIcon: {\n type: IconValue,\n default: '$ratingEmpty',\n },\n fullIcon: {\n type: IconValue,\n default: '$ratingFull',\n },\n halfIncrements: Boolean,\n hover: Boolean,\n length: {\n type: [Number, String],\n default: 5,\n },\n readonly: Boolean,\n modelValue: {\n type: [Number, String],\n default: 0,\n },\n itemLabels: Array as Prop<string[]>,\n itemLabelPosition: {\n type: String,\n default: 'top',\n validator: (v: any) => ['top', 'bottom'].includes(v),\n },\n ripple: Boolean,\n\n ...makeDensityProps(),\n ...makeSizeProps(),\n ...makeTagProps(),\n ...makeThemeProps(),\n },\n\n emits: {\n 'update:modelValue': (value: number | string) => true,\n },\n\n setup (props, { slots }) {\n const { t } = useLocale()\n const { themeClasses } = provideTheme(props)\n const rating = useProxiedModel(props, 'modelValue')\n const normalizedValue = computed(() => clamp(parseFloat(rating.value), 0, +props.length))\n\n const range = computed(() => createRange(Number(props.length), 1))\n const increments = computed(() => range.value.flatMap(v => props.halfIncrements ? [v - 0.5, v] : [v]))\n const hoverIndex = ref(-1)\n\n const itemState = computed(() => increments.value.map(value => {\n const isHovering = props.hover && hoverIndex.value > -1\n const isFilled = normalizedValue.value >= value\n const isHovered = hoverIndex.value >= value\n const isFullIcon = isHovering ? isHovered : isFilled\n const icon = isFullIcon ? props.fullIcon : props.emptyIcon\n const activeColor = props.activeColor ?? props.color\n const color = (isFilled || isHovered) ? activeColor : props.color\n\n return { isFilled, isHovered, icon, color }\n }))\n\n const eventState = computed(() => [0, ...increments.value].map(value => {\n function onMouseenter () {\n hoverIndex.value = value\n }\n\n function onMouseleave () {\n hoverIndex.value = -1\n }\n\n function onClick () {\n if (props.disabled || props.readonly) return\n rating.value = normalizedValue.value === value && props.clearable ? 0 : value\n }\n\n return {\n onMouseenter: props.hover ? onMouseenter : undefined,\n onMouseleave: props.hover ? onMouseleave : undefined,\n onClick,\n }\n }))\n\n const name = computed(() => props.name ?? `v-rating-${getUid()}`)\n\n function VRatingItem ({ value, index, showStar = true }: { value: number, index: number, showStar?: boolean }) {\n const { onMouseenter, onMouseleave, onClick } = eventState.value[index + 1]\n const id = `${name.value}-${String(value).replace('.', '-')}`\n const btnProps = {\n color: itemState.value[index]?.color,\n density: props.density,\n disabled: props.disabled,\n icon: itemState.value[index]?.icon,\n ripple: props.ripple,\n size: props.size,\n variant: 'plain' as Variant,\n }\n\n return (\n <>\n <label\n for={ id }\n class={{\n 'v-rating__item--half': props.halfIncrements && value % 1 > 0,\n 'v-rating__item--full': props.halfIncrements && value % 1 === 0,\n }}\n onMouseenter={ onMouseenter }\n onMouseleave={ onMouseleave }\n onClick={ onClick }\n >\n <span class=\"v-rating__hidden\">{ t(props.itemAriaLabel, value, props.length) }</span>\n {\n !showStar ? undefined\n : slots.item ? slots.item({\n ...itemState.value[index],\n props: btnProps,\n value,\n index,\n rating: normalizedValue.value,\n })\n : (\n <VBtn { ...btnProps } />\n )\n }\n </label>\n\n <input\n class=\"v-rating__hidden\"\n name={ name.value }\n id={ id }\n type=\"radio\"\n value={ value }\n checked={ normalizedValue.value === value }\n tabindex={-1}\n readonly={ props.readonly }\n disabled={ props.disabled }\n />\n </>\n )\n }\n\n function createLabel (labelProps: { value: number, index: number, label?: string }) {\n if (slots['item-label']) return slots['item-label'](labelProps)\n\n if (labelProps.label) return <span>{ labelProps.label }</span>\n\n return <span> </span>\n }\n\n useRender(() => {\n const hasLabels = !!props.itemLabels?.length || slots['item-label']\n\n return (\n <props.tag\n class={[\n 'v-rating',\n {\n 'v-rating--hover': props.hover,\n 'v-rating--readonly': props.readonly,\n },\n themeClasses.value,\n ]}\n >\n <VRatingItem value={ 0 } index={ -1 } showStar={ false } />\n\n { range.value.map((value, i) => (\n <div class=\"v-rating__wrapper\">\n {\n hasLabels && props.itemLabelPosition === 'top'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n <div class=\"v-rating__item\">\n { props.halfIncrements ? (\n <>\n <VRatingItem value={ value - 0.5 } index={ i * 2 } />\n <VRatingItem value={ value } index={ (i * 2) + 1 } />\n </>\n ) : (\n <VRatingItem value={ value } index={ i } />\n ) }\n </div>\n {\n hasLabels && props.itemLabelPosition === 'bottom'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n </div>\n )) }\n </props.tag>\n )\n })\n\n return {}\n },\n})\n\nexport type VRating = InstanceType<typeof VRating>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,IAAI,6BAEb;AAAA,SACSC,SAAS;AAAA,SACTC,gB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AAA,SAEJ;QAAgB,IACvBjD,KAAK,CAACY,cAAc;UAAA,SAEGc,KAAK,GAAG,GAAG;UAAA,SAAWsC,CAAC,GAAG;QAAC;UAAA,SAC3BtC,KAAK;UAAA,SAAYsC,CAAC,GAAG,CAAC,GAAI;QAAC;UAAA,SAG7BtC,KAAK;UAAA,SAAWsC;QAAC,QACvC,IAGDD,SAAS,IAAI/D,KAAK,CAACoB,iBAAiB,KAAK,QAAQ,GAC7CwC,WAAW,CAAC;UAAElC,KAAK;UAAEyB,KAAK,EAAEa,CAAC;UAAEF,KAAK,EAAE9D,KAAK,CAACkB,UAAU,GAAG8C,CAAC;QAAE,CAAC,CAAC,GAC9Df,SAAS,EAGlB,CAAC;MAAA;IAGR,CAAC,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"VRating.mjs","names":["VBtn","IconValue","makeDensityProps","makeSizeProps","makeTagProps","makeThemeProps","provideTheme","useLocale","useProxiedModel","computed","ref","clamp","createRange","genericComponent","getUid","useRender","VRating","name","props","String","itemAriaLabel","type","default","activeColor","color","clearable","Boolean","disabled","emptyIcon","fullIcon","halfIncrements","hover","length","Number","readonly","modelValue","itemLabels","Array","itemLabelPosition","validator","v","includes","ripple","emits","value","setup","slots","t","themeClasses","rating","normalizedValue","parseFloat","range","increments","flatMap","hoverIndex","focusIndex","firstRef","isClicking","itemState","map","isHovering","isFilled","isHovered","isFullIcon","icon","eventState","onMouseenter","onMouseleave","onFocus","focus","onBlur","onClick","undefined","onMousedown","onMouseup","VRatingItem","index","showStar","id","replace","btnProps","density","size","tag","variant","item","createLabel","labelProps","label","hasLabels","i","Math","ceil"],"sources":["../../../src/components/VRating/VRating.tsx"],"sourcesContent":["// Styles\nimport './VRating.sass'\n\n// Components\nimport { VBtn } from '@/components/VBtn'\n\n// Composables\nimport { IconValue } from '@/composables/icons'\nimport { makeDensityProps } from '@/composables/density'\nimport { makeSizeProps } from '@/composables/size'\nimport { makeTagProps } from '@/composables/tag'\nimport { makeThemeProps, provideTheme } from '@/composables/theme'\nimport { useLocale } from '@/composables/locale'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, ref } from 'vue'\nimport { clamp, createRange, genericComponent, getUid, useRender } from '@/util'\n\n// Types\nimport type { Prop } from 'vue'\nimport type { Variant } from '@/composables/variant'\n\ntype VRatingItemSlot = {\n value: number\n index: number\n isFilled: boolean\n isHovered: boolean\n icon: IconValue\n color?: string\n props: Record<string, unknown>\n}\n\ntype VRatingItemLabelSlot = {\n value: number\n index: number\n label?: string\n}\n\ntype VRatingSlots = {\n item: [VRatingItemSlot]\n 'item-label': [VRatingItemLabelSlot]\n}\n\nexport const VRating = genericComponent<VRatingSlots>()({\n name: 'VRating',\n\n props: {\n name: String,\n itemAriaLabel: {\n type: String,\n default: '$vuetify.rating.ariaLabel.item',\n },\n activeColor: String,\n color: String,\n clearable: Boolean,\n disabled: Boolean,\n emptyIcon: {\n type: IconValue,\n default: '$ratingEmpty',\n },\n fullIcon: {\n type: IconValue,\n default: '$ratingFull',\n },\n halfIncrements: Boolean,\n hover: Boolean,\n length: {\n type: [Number, String],\n default: 5,\n },\n readonly: Boolean,\n modelValue: {\n type: [Number, String],\n default: 0,\n },\n itemLabels: Array as Prop<string[]>,\n itemLabelPosition: {\n type: String,\n default: 'top',\n validator: (v: any) => ['top', 'bottom'].includes(v),\n },\n ripple: Boolean,\n\n ...makeDensityProps(),\n ...makeSizeProps(),\n ...makeTagProps(),\n ...makeThemeProps(),\n },\n\n emits: {\n 'update:modelValue': (value: number | string) => true,\n },\n\n setup (props, { slots }) {\n const { t } = useLocale()\n const { themeClasses } = provideTheme(props)\n const rating = useProxiedModel(props, 'modelValue')\n const normalizedValue = computed(() => clamp(parseFloat(rating.value), 0, +props.length))\n\n const range = computed(() => createRange(Number(props.length), 1))\n const increments = computed(() => range.value.flatMap(v => props.halfIncrements ? [v - 0.5, v] : [v]))\n const hoverIndex = ref(-1)\n const focusIndex = ref(-1)\n const firstRef = ref<HTMLElement>()\n let isClicking = false\n\n const itemState = computed(() => increments.value.map(value => {\n const isHovering = props.hover && hoverIndex.value > -1\n const isFilled = normalizedValue.value >= value\n const isHovered = hoverIndex.value >= value\n const isFullIcon = isHovering ? isHovered : isFilled\n const icon = isFullIcon ? props.fullIcon : props.emptyIcon\n const activeColor = props.activeColor ?? props.color\n const color = (isFilled || isHovered) ? activeColor : props.color\n\n return { isFilled, isHovered, icon, color }\n }))\n\n const eventState = computed(() => [0, ...increments.value].map(value => {\n function onMouseenter () {\n hoverIndex.value = value\n }\n\n function onMouseleave () {\n hoverIndex.value = -1\n }\n\n function onFocus () {\n if (value === 0 && normalizedValue.value === 0) {\n firstRef.value?.focus()\n } else {\n focusIndex.value = value\n }\n }\n\n function onBlur () {\n if (!isClicking) focusIndex.value = -1\n }\n\n function onClick () {\n if (props.disabled || props.readonly) return\n rating.value = normalizedValue.value === value && props.clearable ? 0 : value\n }\n\n return {\n onMouseenter: props.hover ? onMouseenter : undefined,\n onMouseleave: props.hover ? onMouseleave : undefined,\n onFocus,\n onBlur,\n onClick,\n }\n }))\n\n function onMousedown () {\n isClicking = true\n }\n\n function onMouseup () {\n isClicking = false\n }\n\n const name = computed(() => props.name ?? `v-rating-${getUid()}`)\n\n function VRatingItem ({ value, index, showStar = true }: { value: number, index: number, showStar?: boolean }) {\n const { onMouseenter, onMouseleave, onFocus, onBlur, onClick } = eventState.value[index + 1]\n const id = `${name.value}-${String(value).replace('.', '-')}`\n const btnProps = {\n color: itemState.value[index]?.color,\n density: props.density,\n disabled: props.disabled,\n icon: itemState.value[index]?.icon,\n ripple: props.ripple,\n size: props.size,\n tag: 'span',\n variant: 'plain' as Variant,\n }\n\n return (\n <>\n <label\n for={ id }\n class={{\n 'v-rating__item--half': props.halfIncrements && value % 1 > 0,\n 'v-rating__item--full': props.halfIncrements && value % 1 === 0,\n }}\n onMousedown={ onMousedown }\n onMouseup={ onMouseup }\n onMouseenter={ onMouseenter }\n onMouseleave={ onMouseleave }\n >\n <span class=\"v-rating__hidden\">{ t(props.itemAriaLabel, value, props.length) }</span>\n {\n !showStar ? undefined\n : slots.item ? slots.item({\n ...itemState.value[index],\n props: btnProps,\n value,\n index,\n })\n : (\n <VBtn { ...btnProps } />\n )\n }\n </label>\n\n <input\n class=\"v-rating__hidden\"\n name={ name.value }\n id={ id }\n type=\"radio\"\n value={ value }\n checked={ normalizedValue.value === value }\n onClick={ onClick }\n onFocus={ onFocus }\n onBlur={ onBlur }\n ref={ index === 0 ? firstRef : undefined }\n readonly={ props.readonly }\n disabled={ props.disabled }\n />\n </>\n )\n }\n\n function createLabel (labelProps: { value: number, index: number, label?: string }) {\n if (slots['item-label']) return slots['item-label'](labelProps)\n\n if (labelProps.label) return <span>{ labelProps.label }</span>\n\n return <span> </span>\n }\n\n useRender(() => {\n const hasLabels = !!props.itemLabels?.length || slots['item-label']\n\n return (\n <props.tag\n class={[\n 'v-rating',\n {\n 'v-rating--hover': props.hover,\n 'v-rating--readonly': props.readonly,\n },\n themeClasses.value,\n ]}\n >\n <VRatingItem value={ 0 } index={ -1 } showStar={ false } />\n\n { range.value.map((value, i) => (\n <div class=\"v-rating__wrapper\">\n {\n hasLabels && props.itemLabelPosition === 'top'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n <div\n class={[\n 'v-rating__item',\n {\n 'v-rating__item--focused': Math.ceil(focusIndex.value) === value,\n },\n ]}\n >\n { props.halfIncrements ? (\n <>\n <VRatingItem value={ value - 0.5 } index={ i * 2 } />\n <VRatingItem value={ value } index={ (i * 2) + 1 } />\n </>\n ) : (\n <VRatingItem value={ value } index={ i } />\n ) }\n </div>\n {\n hasLabels && props.itemLabelPosition === 'bottom'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n </div>\n )) }\n </props.tag>\n )\n })\n\n return {}\n },\n})\n\nexport type VRating = InstanceType<typeof VRating>\n"],"mappings":";AAAA;AACA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AAEc,CAAC;UAAEF,KAAK,EAAEvE,KAAK,CAACkB,UAAU,GAAGuD,CAAC;QAAE,CAAC,CAAC,GAC9DlB,SAAS,EAGlB,CAAC;MAAA;IAGR,CAAC,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC"}
|
|
@@ -14,7 +14,6 @@ type VRatingItemSlot = {
|
|
|
14
14
|
icon: IconValue;
|
|
15
15
|
color?: string;
|
|
16
16
|
props: Record<string, unknown>;
|
|
17
|
-
rating: number;
|
|
18
17
|
};
|
|
19
18
|
type VRatingItemLabelSlot = {
|
|
20
19
|
value: number;
|
|
@@ -48,6 +47,10 @@ declare const VRating: vue.DefineComponent<{
|
|
|
48
47
|
item?: ((args_0: VRatingItemSlot) => vue.VNodeChild) | undefined;
|
|
49
48
|
'item-label'?: ((args_0: VRatingItemLabelSlot) => vue.VNodeChild) | undefined;
|
|
50
49
|
};
|
|
50
|
+
$slots?: {
|
|
51
|
+
item?: ((args_0: VRatingItemSlot) => vue.VNodeChild) | undefined;
|
|
52
|
+
'item-label'?: ((args_0: VRatingItemLabelSlot) => vue.VNodeChild) | undefined;
|
|
53
|
+
} | undefined;
|
|
51
54
|
'v-slots'?: {
|
|
52
55
|
item?: false | ((args_0: VRatingItemSlot) => vue.VNodeChild) | undefined;
|
|
53
56
|
'item-label'?: false | ((args_0: VRatingItemLabelSlot) => vue.VNodeChild) | undefined;
|
|
@@ -84,6 +87,10 @@ declare const VRating: vue.DefineComponent<{
|
|
|
84
87
|
item?: ((args_0: VRatingItemSlot) => vue.VNodeChild) | undefined;
|
|
85
88
|
'item-label'?: ((args_0: VRatingItemLabelSlot) => vue.VNodeChild) | undefined;
|
|
86
89
|
};
|
|
90
|
+
$slots?: {
|
|
91
|
+
item?: ((args_0: VRatingItemSlot) => vue.VNodeChild) | undefined;
|
|
92
|
+
'item-label'?: ((args_0: VRatingItemLabelSlot) => vue.VNodeChild) | undefined;
|
|
93
|
+
} | undefined;
|
|
87
94
|
'v-slots'?: {
|
|
88
95
|
item?: false | ((args_0: VRatingItemSlot) => vue.VNodeChild) | undefined;
|
|
89
96
|
'item-label'?: false | ((args_0: VRatingItemLabelSlot) => vue.VNodeChild) | undefined;
|
|
@@ -14,6 +14,10 @@ declare const VResponsive: vue.DefineComponent<{} & {
|
|
|
14
14
|
default?: (() => vue.VNodeChild) | undefined;
|
|
15
15
|
additional?: (() => vue.VNodeChild) | undefined;
|
|
16
16
|
};
|
|
17
|
+
$slots?: {
|
|
18
|
+
default?: (() => vue.VNodeChild) | undefined;
|
|
19
|
+
additional?: (() => vue.VNodeChild) | undefined;
|
|
20
|
+
} | undefined;
|
|
17
21
|
'v-slots'?: {
|
|
18
22
|
default?: false | (() => vue.VNodeChild) | undefined;
|
|
19
23
|
additional?: false | (() => vue.VNodeChild) | undefined;
|
|
@@ -35,6 +39,10 @@ declare const VResponsive: vue.DefineComponent<{} & {
|
|
|
35
39
|
default?: (() => vue.VNodeChild) | undefined;
|
|
36
40
|
additional?: (() => vue.VNodeChild) | undefined;
|
|
37
41
|
};
|
|
42
|
+
$slots?: {
|
|
43
|
+
default?: (() => vue.VNodeChild) | undefined;
|
|
44
|
+
additional?: (() => vue.VNodeChild) | undefined;
|
|
45
|
+
} | undefined;
|
|
38
46
|
'v-slots'?: {
|
|
39
47
|
default?: false | (() => vue.VNodeChild) | undefined;
|
|
40
48
|
additional?: false | (() => vue.VNodeChild) | undefined;
|