index.mjs 627 B

12345678910111213141516171819202122
  1. import { computed, unref, inject } from 'vue';
  2. import { buildProp } from '../../utils/vue/props/runtime.mjs';
  3. import { componentSizes } from '../../constants/size.mjs';
  4. const useSizeProp = buildProp({
  5. type: String,
  6. values: componentSizes,
  7. required: false
  8. });
  9. const useSizeProps = {
  10. size: useSizeProp
  11. };
  12. const SIZE_INJECTION_KEY = Symbol("size");
  13. const useGlobalSize = () => {
  14. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  15. return computed(() => {
  16. return unref(injectedSize.size) || "";
  17. });
  18. };
  19. export { SIZE_INJECTION_KEY, useGlobalSize, useSizeProp, useSizeProps };
  20. //# sourceMappingURL=index.mjs.map