VBtnGroup.mjs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { createVNode as _createVNode, resolveDirective as _resolveDirective } from "vue";
  2. // Styles
  3. import "./VBtnGroup.css";
  4. // Composables
  5. import { makeBorderProps, useBorder } from "../../composables/border.mjs";
  6. import { makeComponentProps } from "../../composables/component.mjs";
  7. import { provideDefaults } from "../../composables/defaults.mjs";
  8. import { makeDensityProps, useDensity } from "../../composables/density.mjs";
  9. import { makeElevationProps, useElevation } from "../../composables/elevation.mjs";
  10. import { makeRoundedProps, useRounded } from "../../composables/rounded.mjs";
  11. import { makeTagProps } from "../../composables/tag.mjs";
  12. import { makeThemeProps, provideTheme } from "../../composables/theme.mjs";
  13. import { makeVariantProps } from "../../composables/variant.mjs"; // Utilities
  14. import { toRef } from 'vue';
  15. import { genericComponent, propsFactory, useRender } from "../../util/index.mjs";
  16. export const makeVBtnGroupProps = propsFactory({
  17. divided: Boolean,
  18. ...makeBorderProps(),
  19. ...makeComponentProps(),
  20. ...makeDensityProps(),
  21. ...makeElevationProps(),
  22. ...makeRoundedProps(),
  23. ...makeTagProps(),
  24. ...makeThemeProps(),
  25. ...makeVariantProps()
  26. }, 'VBtnGroup');
  27. export const VBtnGroup = genericComponent()({
  28. name: 'VBtnGroup',
  29. props: makeVBtnGroupProps(),
  30. setup(props, _ref) {
  31. let {
  32. slots
  33. } = _ref;
  34. const {
  35. themeClasses
  36. } = provideTheme(props);
  37. const {
  38. densityClasses
  39. } = useDensity(props);
  40. const {
  41. borderClasses
  42. } = useBorder(props);
  43. const {
  44. elevationClasses
  45. } = useElevation(props);
  46. const {
  47. roundedClasses
  48. } = useRounded(props);
  49. provideDefaults({
  50. VBtn: {
  51. height: 'auto',
  52. color: toRef(props, 'color'),
  53. density: toRef(props, 'density'),
  54. flat: true,
  55. variant: toRef(props, 'variant')
  56. }
  57. });
  58. useRender(() => {
  59. return _createVNode(props.tag, {
  60. "class": ['v-btn-group', {
  61. 'v-btn-group--divided': props.divided
  62. }, themeClasses.value, borderClasses.value, densityClasses.value, elevationClasses.value, roundedClasses.value, props.class],
  63. "style": props.style
  64. }, slots);
  65. });
  66. }
  67. });
  68. //# sourceMappingURL=VBtnGroup.mjs.map