loader.mjs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { createVNode as _createVNode } from "vue";
  2. // Components
  3. import { VProgressLinear } from "../components/VProgressLinear/index.mjs"; // Utilities
  4. import { computed } from 'vue';
  5. import { getCurrentInstanceName, propsFactory } from "../util/index.mjs"; // Types
  6. // Composables
  7. export const makeLoaderProps = propsFactory({
  8. loading: [Boolean, String]
  9. }, 'loader');
  10. export function useLoader(props) {
  11. let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
  12. const loaderClasses = computed(() => ({
  13. [`${name}--loading`]: props.loading
  14. }));
  15. return {
  16. loaderClasses
  17. };
  18. }
  19. export function LoaderSlot(props, _ref) {
  20. let {
  21. slots
  22. } = _ref;
  23. return _createVNode("div", {
  24. "class": `${props.name}__loader`
  25. }, [slots.default?.({
  26. color: props.color,
  27. isActive: props.active
  28. }) || _createVNode(VProgressLinear, {
  29. "active": props.active,
  30. "color": props.color,
  31. "height": "2",
  32. "indeterminate": true
  33. }, null)]);
  34. }
  35. //# sourceMappingURL=loader.mjs.map