82 lines
2.4 KiB
JavaScript
82 lines
2.4 KiB
JavaScript
|
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
||
|
// Styles
|
||
|
import "./VChipGroup.css";
|
||
|
|
||
|
// Components
|
||
|
import { makeVSlideGroupProps, VSlideGroup } from "../VSlideGroup/VSlideGroup.mjs"; // Composables
|
||
|
import { makeComponentProps } from "../../composables/component.mjs";
|
||
|
import { provideDefaults } from "../../composables/defaults.mjs";
|
||
|
import { makeGroupProps, useGroup } from "../../composables/group.mjs";
|
||
|
import { makeTagProps } from "../../composables/tag.mjs";
|
||
|
import { makeThemeProps, provideTheme } from "../../composables/theme.mjs";
|
||
|
import { makeVariantProps } from "../../composables/variant.mjs"; // Utilities
|
||
|
import { toRef } from 'vue';
|
||
|
import { deepEqual, genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
|
||
|
export const VChipGroupSymbol = Symbol.for('vuetify:v-chip-group');
|
||
|
export const makeVChipGroupProps = propsFactory({
|
||
|
column: Boolean,
|
||
|
filter: Boolean,
|
||
|
valueComparator: {
|
||
|
type: Function,
|
||
|
default: deepEqual
|
||
|
},
|
||
|
...makeVSlideGroupProps(),
|
||
|
...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, _ref) {
|
||
|
let {
|
||
|
slots
|
||
|
} = _ref;
|
||
|
const {
|
||
|
themeClasses
|
||
|
} = provideTheme(props);
|
||
|
const {
|
||
|
isSelected,
|
||
|
select,
|
||
|
next,
|
||
|
prev,
|
||
|
selected
|
||
|
} = useGroup(props, VChipGroupSymbol);
|
||
|
provideDefaults({
|
||
|
VChip: {
|
||
|
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.mjs.map
|