VListSubheader.mjs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { createVNode as _createVNode } from "vue";
  2. // Composables
  3. import { useTextColor } from "../../composables/color.mjs";
  4. import { makeComponentProps } from "../../composables/component.mjs";
  5. import { makeTagProps } from "../../composables/tag.mjs"; // Utilities
  6. import { toRef } from 'vue';
  7. import { genericComponent, propsFactory, useRender } from "../../util/index.mjs";
  8. export const makeVListSubheaderProps = propsFactory({
  9. color: String,
  10. inset: Boolean,
  11. sticky: Boolean,
  12. title: String,
  13. ...makeComponentProps(),
  14. ...makeTagProps()
  15. }, 'VListSubheader');
  16. export const VListSubheader = genericComponent()({
  17. name: 'VListSubheader',
  18. props: makeVListSubheaderProps(),
  19. setup(props, _ref) {
  20. let {
  21. slots
  22. } = _ref;
  23. const {
  24. textColorClasses,
  25. textColorStyles
  26. } = useTextColor(toRef(props, 'color'));
  27. useRender(() => {
  28. const hasText = !!(slots.default || props.title);
  29. return _createVNode(props.tag, {
  30. "class": ['v-list-subheader', {
  31. 'v-list-subheader--inset': props.inset,
  32. 'v-list-subheader--sticky': props.sticky
  33. }, textColorClasses.value, props.class],
  34. "style": [{
  35. textColorStyles
  36. }, props.style]
  37. }, {
  38. default: () => [hasText && _createVNode("div", {
  39. "class": "v-list-subheader__text"
  40. }, [slots.default?.() ?? props.title])]
  41. });
  42. });
  43. return {};
  44. }
  45. });
  46. //# sourceMappingURL=VListSubheader.mjs.map