design-system-next 2.7.12 → 2.7.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { computed, ref, ComputedRef, toRefs } from 'vue';
1
+ import { computed, ref, ComputedRef, toRefs, useSlots } from 'vue';
2
2
  import { useElementHover, useMousePressed } from '@vueuse/core';
3
3
 
4
4
  import classNames from 'classnames';
@@ -12,6 +12,10 @@ export const useSwitch = (props: SwitchPropTypes) => {
12
12
  const isHovered = useElementHover(switchWrapperRef);
13
13
  const { pressed } = useMousePressed({ target: switchRef });
14
14
  const { disabled, state, modelValue } = toRefs(props);
15
+ const slots = useSlots();
16
+
17
+ // if the slot label is empty, we will not show the label
18
+ const isSlotEmpty = (!slots.default || slots.default().length === 0) && !slots.leftText && !slots.rightText;
15
19
 
16
20
  const switchProps: ComputedRef<Record<string, unknown>> = computed(() => {
17
21
  return {
@@ -96,5 +100,6 @@ export const useSwitch = (props: SwitchPropTypes) => {
96
100
  switchMarkClass,
97
101
  switchTextClass,
98
102
  switchInputClass,
103
+ isSlotEmpty
99
104
  };
100
105
  };
@@ -0,0 +1,6 @@
1
+ interface ImportMeta { readonly glob: ImportMetaGlob }
2
+
3
+ interface ImportMetaGlob {
4
+ (pattern: string, options?: { eager?: boolean }): Record<string, () => Promise<unknown>>
5
+ (pattern: string, options?: { eager: true }): Record<string, unknown>
6
+ }