85 lines
2.4 KiB
JavaScript
85 lines
2.4 KiB
JavaScript
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
// Styles
|
|
import "./VChipGroup.css";
|
|
|
|
// Components
|
|
import { makeVSlideGroupProps, VSlideGroup } from "../VSlideGroup/VSlideGroup.js"; // Composables
|
|
import { makeComponentProps } from "../../composables/component.js";
|
|
import { provideDefaults } from "../../composables/defaults.js";
|
|
import { makeGroupProps, useGroup } from "../../composables/group.js";
|
|
import { makeTagProps } from "../../composables/tag.js";
|
|
import { makeThemeProps, provideTheme } from "../../composables/theme.js";
|
|
import { makeVariantProps } from "../../composables/variant.js"; // Utilities
|
|
import { toRef } from 'vue';
|
|
import { deepEqual, genericComponent, propsFactory, useRender } from "../../util/index.js"; // Types
|
|
export const VChipGroupSymbol = Symbol.for('vuetify:v-chip-group');
|
|
export const makeVChipGroupProps = propsFactory({
|
|
baseColor: String,
|
|
column: Boolean,
|
|
filter: Boolean,
|
|
valueComparator: {
|
|
type: Function,
|
|
default: deepEqual
|
|
},
|
|
...makeVSlideGroupProps({
|
|
scrollToActive: false
|
|
}),
|
|
...makeComponentProps(),
|
|
...makeGroupProps({
|
|
selectedClass: 'v-chip--selected'
|
|
}),
|
|
...makeTagProps(),
|
|
...makeThemeProps(),
|
|
...makeVariantProps({
|
|
variant: 'tonal'
|
|
})
|
|
}, 'VChipGroup');
|
|
export const VChipGroup = genericComponent()({
|
|
name: 'VChipGroup',
|
|
props: makeVChipGroupProps(),
|
|
emits: {
|
|
'update:modelValue': value => true
|
|
},
|
|
setup(props, {
|
|
slots
|
|
}) {
|
|
const {
|
|
themeClasses
|
|
} = provideTheme(props);
|
|
const {
|
|
isSelected,
|
|
select,
|
|
next,
|
|
prev,
|
|
selected
|
|
} = useGroup(props, VChipGroupSymbol);
|
|
provideDefaults({
|
|
VChip: {
|
|
baseColor: toRef(() => props.baseColor),
|
|
color: toRef(() => props.color),
|
|
disabled: toRef(() => props.disabled),
|
|
filter: toRef(() => props.filter),
|
|
variant: toRef(() => props.variant)
|
|
}
|
|
});
|
|
useRender(() => {
|
|
const slideGroupProps = VSlideGroup.filterProps(props);
|
|
return _createVNode(VSlideGroup, _mergeProps(slideGroupProps, {
|
|
"class": ['v-chip-group', {
|
|
'v-chip-group--column': props.column
|
|
}, themeClasses.value, props.class],
|
|
"style": props.style
|
|
}), {
|
|
default: () => [slots.default?.({
|
|
isSelected,
|
|
select,
|
|
next,
|
|
prev,
|
|
selected: selected.value
|
|
})]
|
|
});
|
|
});
|
|
return {};
|
|
}
|
|
});
|
|
//# sourceMappingURL=VChipGroup.js.map
|