@volverjs/ui-vue 0.0.2 → 0.0.3-beta.3

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.
Files changed (171) hide show
  1. package/auto-imports.d.ts +289 -0
  2. package/dist/components/VvAccordion/VvAccordion.es.js +63 -131
  3. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  4. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +2 -2
  5. package/dist/components/VvAccordion/index.d.ts +2 -2
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +97 -176
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +4 -4
  9. package/dist/components/VvAccordionGroup/index.d.ts +2 -2
  10. package/dist/components/VvBadge/VvBadge.es.js +16 -50
  11. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  12. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +38 -45
  13. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  14. package/dist/components/VvButton/VvButton.es.js +170 -306
  15. package/dist/components/VvButton/VvButton.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.vue.d.ts +4 -4
  17. package/dist/components/VvButton/index.d.ts +3 -3
  18. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +39 -84
  19. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  20. package/dist/components/VvCard/VvCard.es.js +26 -60
  21. package/dist/components/VvCard/VvCard.umd.js +1 -1
  22. package/dist/components/VvCard/VvCard.vue.d.ts +2 -2
  23. package/dist/components/VvCard/index.d.ts +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +144 -282
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
  27. package/dist/components/VvCheckbox/index.d.ts +10 -4
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +190 -346
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  31. package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
  32. package/dist/components/VvCombobox/VvCombobox.es.js +330 -487
  33. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  34. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +8 -8
  35. package/dist/components/VvCombobox/index.d.ts +4 -4
  36. package/dist/components/VvDialog/VvDialog.es.js +66 -102
  37. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +61 -185
  39. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  40. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -2
  41. package/dist/components/VvDropdown/index.d.ts +1 -1
  42. package/dist/components/VvIcon/VvIcon.es.js +30 -65
  43. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  44. package/dist/components/VvInputText/VvInputText.es.js +304 -407
  45. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  46. package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
  47. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  48. package/dist/components/VvInputText/index.d.ts +5 -5
  49. package/dist/components/VvProgress/VvProgress.es.js +17 -51
  50. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  51. package/dist/components/VvRadio/VvRadio.es.js +110 -249
  52. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  53. package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
  54. package/dist/components/VvRadio/index.d.ts +3 -3
  55. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +161 -318
  56. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  57. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  58. package/dist/components/VvRadioGroup/index.d.ts +3 -3
  59. package/dist/components/VvSelect/VvSelect.es.js +200 -292
  60. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  61. package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
  62. package/dist/components/VvSelect/index.d.ts +4 -4
  63. package/dist/components/VvTextarea/VvTextarea.es.js +196 -299
  64. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  65. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +6 -6
  66. package/dist/components/VvTextarea/index.d.ts +3 -3
  67. package/dist/components/VvTooltip/VvTooltip.es.js +28 -0
  68. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -0
  69. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +23 -0
  70. package/dist/components/VvTooltip/index.d.ts +18 -0
  71. package/dist/components/common/HintSlot.d.ts +1 -1
  72. package/dist/components/index.es.js +1179 -1371
  73. package/dist/components/index.umd.js +1 -1
  74. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  75. package/dist/composables/useComponentFocus.d.ts +1 -1
  76. package/dist/composables/useComponentIcons.d.ts +1 -1
  77. package/dist/composables/useDebouncedInput.d.ts +1 -1
  78. package/dist/composables/useModifiers.d.ts +1 -1
  79. package/dist/composables/useTextCount.d.ts +1 -1
  80. package/dist/icons.es.js +3 -3
  81. package/dist/icons.umd.js +1 -1
  82. package/dist/index.es.js +1211 -1404
  83. package/dist/index.umd.js +1 -1
  84. package/dist/props/index.d.ts +12 -12
  85. package/dist/stories/Tooltip/Tooltip.settings.d.ts +42 -0
  86. package/dist/stories/Tooltip/Tooltip.test.d.ts +2 -0
  87. package/dist/utils/ObjectUtilities.d.ts +1 -1
  88. package/package.json +27 -20
  89. package/src/assets/icons/detailed.json +1 -1
  90. package/src/assets/icons/normal.json +1 -1
  91. package/src/assets/icons/simple.json +1 -1
  92. package/src/components/VvAccordion/VvAccordion.vue +0 -3
  93. package/src/components/VvAccordion/index.ts +1 -2
  94. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +1 -3
  95. package/src/components/VvBadge/VvBadge.vue +0 -1
  96. package/src/components/VvButton/VvButton.vue +0 -3
  97. package/src/components/VvButton/index.ts +2 -10
  98. package/src/components/VvButtonGroup/VvButtonGroup.vue +0 -3
  99. package/src/components/VvCard/VvCard.vue +0 -1
  100. package/src/components/VvCheckbox/VvCheckbox.vue +0 -3
  101. package/src/components/VvCheckbox/index.ts +1 -2
  102. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +0 -5
  103. package/src/components/VvCombobox/VvCombobox.vue +0 -7
  104. package/src/components/VvDialog/VvDialog.vue +1 -2
  105. package/src/components/VvDropdown/VvDropdown.vue +0 -4
  106. package/src/components/VvIcon/VvIcon.vue +0 -2
  107. package/src/components/VvInputText/VvInputClearAction.ts +0 -1
  108. package/src/components/VvInputText/VvInputPasswordAction.ts +0 -1
  109. package/src/components/VvInputText/VvInputStepAction.ts +0 -1
  110. package/src/components/VvInputText/VvInputText.vue +1 -16
  111. package/src/components/VvInputText/VvInputTextActions.ts +1 -1
  112. package/src/components/VvProgress/VvProgress.vue +0 -2
  113. package/src/components/VvRadio/VvRadio.vue +0 -3
  114. package/src/components/VvRadio/index.ts +0 -1
  115. package/src/components/VvRadioGroup/VvRadioGroup.vue +0 -5
  116. package/src/components/VvSelect/VvSelect.vue +1 -14
  117. package/src/components/VvTextarea/VvTextarea.vue +1 -15
  118. package/src/components/VvTooltip/VvTooltip.vue +17 -0
  119. package/src/components/VvTooltip/index.ts +21 -0
  120. package/src/components/common/HintSlot.ts +1 -11
  121. package/src/composables/group/types/IAccordionGroupState.ts +0 -1
  122. package/src/composables/group/types/IButtonGroupState.ts +0 -1
  123. package/src/composables/group/types/IInputGroup.ts +0 -1
  124. package/src/composables/group/useInjectedGroupState.ts +1 -2
  125. package/src/composables/group/useProvideGroupState.ts +0 -1
  126. package/src/composables/useComponentFocus.ts +1 -2
  127. package/src/composables/useComponentIcons.ts +1 -1
  128. package/src/composables/useDebouncedInput.ts +1 -1
  129. package/src/composables/useModifiers.ts +1 -2
  130. package/src/composables/useOptions.ts +0 -1
  131. package/src/composables/useTextCount.ts +1 -1
  132. package/src/stories/Accordion/Accordion.stories.mdx +1 -1
  133. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +1 -1
  134. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  135. package/src/stories/Badge/Badge.stories.mdx +1 -1
  136. package/src/stories/Breadcrumb/Breadcrumb.settings.ts +0 -1
  137. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +1 -1
  138. package/src/stories/Breadcrumb/BreadcrumbSlots.stories.mdx +1 -1
  139. package/src/stories/Button/Button.stories.mdx +1 -1
  140. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  141. package/src/stories/Button/ButtonSlots.stories.mdx +3 -3
  142. package/src/stories/ButtonGroup/ButtonGroup.settings.ts +0 -1
  143. package/src/stories/ButtonGroup/ButtonGroup.stories.mdx +1 -1
  144. package/src/stories/ButtonGroup/ButtonGroupSlots.stories.mdx +1 -1
  145. package/src/stories/Card/Card.stories.mdx +1 -1
  146. package/src/stories/Card/CardSlots.stories.mdx +1 -1
  147. package/src/stories/Checkbox/Checkbox.stories.mdx +1 -1
  148. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
  149. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +1 -1
  150. package/src/stories/Combobox/Combobox.settings.ts +0 -1
  151. package/src/stories/Combobox/Combobox.stories.mdx +1 -1
  152. package/src/stories/Dialog/Dialog.stories.mdx +1 -1
  153. package/src/stories/Dropdown/Dropdown.settings.ts +0 -1
  154. package/src/stories/Dropdown/Dropdown.stories.mdx +1 -1
  155. package/src/stories/Icon/Icon.settings.ts +0 -1
  156. package/src/stories/Icon/Icon.stories.mdx +1 -1
  157. package/src/stories/Icon/IconsCollection.stories.mdx +1 -1
  158. package/src/stories/InputText/InputText.settings.ts +0 -1
  159. package/src/stories/InputText/InputText.stories.mdx +1 -1
  160. package/src/stories/Progress/Progress.stories.mdx +1 -1
  161. package/src/stories/Radio/Radio.stories.mdx +1 -1
  162. package/src/stories/RadioGroup/RadioGroup.stories.mdx +1 -1
  163. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +1 -1
  164. package/src/stories/Select/Select.settings.ts +0 -1
  165. package/src/stories/Select/Select.stories.mdx +1 -1
  166. package/src/stories/Textarea/Textarea.settings.ts +0 -1
  167. package/src/stories/Textarea/Textarea.stories.mdx +1 -1
  168. package/src/stories/Tooltip/Tooltip.settings.ts +25 -0
  169. package/src/stories/Tooltip/Tooltip.stories.mdx +98 -0
  170. package/src/stories/Tooltip/Tooltip.test.ts +49 -0
  171. package/src/utils/ObjectUtilities.ts +1 -1
@@ -15,7 +15,7 @@ export const Template = (args) => ({
15
15
  setup() {
16
16
  return { args }
17
17
  },
18
- template: `
18
+ template: /*html*/`
19
19
  <vv-card v-bind="args" data-testId="card">
20
20
  <template #default v-if="args.default"><div v-html="args.default"></div></template>
21
21
  <template #header v-if="args.header"><div v-html="args.header"></div></template>
@@ -31,7 +31,7 @@ import { Template } from './Card.stories.mdx'
31
31
  args,
32
32
  }
33
33
  },
34
- template: `
34
+ template: /*html*/`
35
35
  <vv-card v-bind="args" class="max-w-max" data-testId="card">
36
36
  <picture>
37
37
  <img class="aspect-photo h-300" src="https://unsplash.it/300" alt="Card picture"/>
@@ -16,7 +16,7 @@ export const Template = (args) => ({
16
16
  return { args }
17
17
  },
18
18
  data: () => ({ inputValue: args.uncheckedValue }),
19
- template: `
19
+ template: /*html*/`
20
20
  <vv-checkbox v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
21
21
  <template #default v-if="args.default"><span v-html="args.default"></span></template>
22
22
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -16,7 +16,7 @@ export const Template = (args) => ({
16
16
  return { args }
17
17
  },
18
18
  data: () => ({ inputValue: undefined }),
19
- template: `
19
+ template: /*html*/`
20
20
  <vv-checkbox-group v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
21
21
  <template #default v-if="args.default"><span v-html="args.default"></span></template>
22
22
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -17,7 +17,7 @@ export const Template = (args) => ({
17
17
  return { args }
18
18
  },
19
19
  data: () => ({ inputValue: undefined }),
20
- template: `
20
+ template: /*html*/`
21
21
  <vv-checkbox-group v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
22
22
  <vv-checkbox id="o1" name="opts" value="1">Option 1</vv-checkbox>
23
23
  <vv-checkbox id="o2" name="opts" value="2">Option 2</vv-checkbox>
@@ -13,7 +13,6 @@ import {
13
13
  UnselectableArgTypes,
14
14
  } from '@/stories/argTypes'
15
15
  import { VvComboboxProps } from '@/components/VvCombobox'
16
- import { propsToObject } from '@/utils/ObjectUtilities'
17
16
 
18
17
  export const defaultArgs = {
19
18
  ...propsToObject(VvComboboxProps),
@@ -21,7 +21,7 @@ export const Template = (args) => ({
21
21
  inputValue: undefined,
22
22
  }
23
23
  },
24
- template: `
24
+ template: /*html*/`
25
25
  <vv-combobox v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
26
26
  <template #before v-if="args.before"><div class="pr-sm flex" v-html="args.before"></div></template>
27
27
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -21,7 +21,7 @@ export const Template = (args) => ({
21
21
  this.open = !this.open
22
22
  },
23
23
  },
24
- template: `
24
+ template: /*html*/`
25
25
  <vv-dialog v-bind="args" v-model="open" data-testId="element">
26
26
  <template #header v-if="args.header"><div v-html="args.header"></div></template>
27
27
  <template #default v-if="args.default"><div v-html="args.default"></div></template>
@@ -1,5 +1,4 @@
1
1
  import { VvDropdownProps } from '@/components/VvDropdown'
2
- import { propsToObject } from '@/utils/ObjectUtilities'
3
2
  import {
4
3
  ModifiersArgTypes,
5
4
  OptionsArgTypes,
@@ -20,7 +20,7 @@ export const Template = (args) => ({
20
20
  value: undefined,
21
21
  }
22
22
  },
23
- template: `
23
+ template: /*html*/`
24
24
  <vv-dropdown v-bind="args" v-model="value" class="max-w-224 relative" data-testId="element" />
25
25
  <div class="mt-24">Value: <span data-testId="value">{{ value }}</span></div>
26
26
  `,
@@ -1,4 +1,3 @@
1
- import { propsToObject } from '@/utils/ObjectUtilities'
2
1
  import { VvIconProps } from '@/components/VvIcon'
3
2
  import normal from '@/assets/icons/normal.json'
4
3
  import { ModifiersArgTypes } from '@/stories/argTypes'
@@ -15,7 +15,7 @@ export const Template = (args) => ({
15
15
  setup() {
16
16
  return { args }
17
17
  },
18
- template: `<vv-icon v-bind="args" />`,
18
+ template: /*html*/`<vv-icon v-bind="args" />`,
19
19
  })
20
20
 
21
21
  <Canvas>
@@ -22,7 +22,7 @@ export const Template = (args) => ({
22
22
  })
23
23
  return { args, search, icons }
24
24
  },
25
- template: `
25
+ template: /*html*/`
26
26
  <div class="absolute inset-0 overflow-y-auto p-16">
27
27
  <div class="vv-input-text">
28
28
  <div class="vv-input-text__wrapper">
@@ -1,7 +1,6 @@
1
1
  import { InputTextareaArgTypes } from '@/stories/argTypes'
2
2
  import { VvInputTextProps } from '@/components/VvInputText'
3
3
  import normal from '@/assets/icons/normal.json'
4
- import { propsToObject } from '@/utils/ObjectUtilities'
5
4
 
6
5
  export const defaultArgs = {
7
6
  ...propsToObject(VvInputTextProps),
@@ -16,7 +16,7 @@ export const Template = (args) => ({
16
16
  return { args }
17
17
  },
18
18
  data: () => ({ inputValue: undefined }),
19
- template: `
19
+ template: /*html*/`
20
20
  <vv-input-text v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
21
21
  <template #before v-if="args.before"><div class="pl-sm flex" v-html="args.before"></div></template>
22
22
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -15,7 +15,7 @@ export const Template = (args) => ({
15
15
  setup() {
16
16
  return { args }
17
17
  },
18
- template: `<vv-progress v-bind="args" />`,
18
+ template: /*html*/`<vv-progress v-bind="args" />`,
19
19
  })
20
20
 
21
21
  <Story name="Default" play={defaultTest}>
@@ -16,7 +16,7 @@ export const Template = (args) => ({
16
16
  return { args }
17
17
  },
18
18
  data: () => ({ inputValue: undefined }),
19
- template: `
19
+ template: /*html*/`
20
20
  <vv-radio v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
21
21
  <template #default v-if="args.default"><span v-html="args.default"></span></template>
22
22
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -16,7 +16,7 @@ export const Template = (args) => ({
16
16
  return { args }
17
17
  },
18
18
  data: () => ({ inputValue: undefined }),
19
- template: `
19
+ template: /*html*/`
20
20
  <vv-radio-group v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
21
21
  <template #default v-if="args.default"><span v-html="args.default"></span></template>
22
22
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -17,7 +17,7 @@ export const Template = (args) => ({
17
17
  return { args }
18
18
  },
19
19
  data: () => ({ inputValue: undefined }),
20
- template: `
20
+ template: /*html*/`
21
21
  <vv-radio-group v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
22
22
  <vv-radio id="o1" name="opts" value="1">Option 1</vv-radio>
23
23
  <vv-radio id="o2" name="opts" value="2">Option 2</vv-radio>
@@ -15,7 +15,6 @@ import {
15
15
  AutofocusArgTypes,
16
16
  AutocompleteArgTypes,
17
17
  } from '@/stories/argTypes'
18
- import { propsToObject } from '@/utils/ObjectUtilities'
19
18
  import { VvSelectProps } from '@/components/VvSelect'
20
19
 
21
20
  export const defaultArgs = {
@@ -20,7 +20,7 @@ export const Template = (args) => ({
20
20
  inputValue: undefined,
21
21
  }
22
22
  },
23
- template: `
23
+ template: /*html*/`
24
24
  <vv-select v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
25
25
  <template #before v-if="args.before"><div class="pl-sm flex" v-html="args.before"></div></template>
26
26
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -1,6 +1,5 @@
1
1
  import { InputTextareaArgTypes } from '@/stories/argTypes'
2
2
  import { VvTextareaProps } from '@/components/VvTextarea'
3
- import { propsToObject } from '@/utils/ObjectUtilities'
4
3
 
5
4
  export const defaultArgs = {
6
5
  ...propsToObject(VvTextareaProps),
@@ -16,7 +16,7 @@ export const Template = (args) => ({
16
16
  return { args }
17
17
  },
18
18
  data: () => ({ inputValue: undefined }),
19
- template: `
19
+ template: /*html*/`
20
20
  <vv-textarea v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
21
21
  <template #before v-if="args.before"><div class="pt-sm pl-sm flex" v-html="args.before"></div></template>
22
22
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
@@ -0,0 +1,25 @@
1
+ import { VvTooltipProps } from '@/components/VvTooltip'
2
+ import { DefaultSlotArgTypes, ModifiersArgTypes } from '@/stories/argTypes'
3
+
4
+ export const defaultArgs = {
5
+ ...propsToObject(VvTooltipProps),
6
+ default: "I'm a tooltip"
7
+ }
8
+
9
+ export const argTypes = {
10
+ ...ModifiersArgTypes,
11
+ ...DefaultSlotArgTypes,
12
+ position: {
13
+ type: {
14
+ summary: 'string',
15
+ },
16
+ control: {
17
+ type: 'select',
18
+ },
19
+ table: {
20
+ defaultValue: { summary: 'bottom' },
21
+ },
22
+ description: 'Indicates where to place the tooltip',
23
+ options: [undefined, 'left', 'right', 'bottom', 'top']
24
+ }
25
+ }
@@ -0,0 +1,98 @@
1
+ import { Meta, Story, Canvas } from '@storybook/addon-docs'
2
+ import VvTooltip from '@/components/VvTooltip/VvTooltip.vue'
3
+ import VvButton from '@/components/VvButton/VvButton.vue'
4
+ import { defaultArgs, argTypes } from './Tooltip.settings'
5
+ import { defaultTest } from './Tooltip.test'
6
+
7
+ <Meta
8
+ title="Components/Tooltip"
9
+ component={ VvTooltip }
10
+ args={ defaultArgs }
11
+ argTypes={ argTypes }
12
+ />
13
+
14
+ export const Template = (args) => ({
15
+ components: { VvTooltip, VvButton },
16
+ setup() {
17
+ return { args }
18
+ },
19
+ template:
20
+ /* html */`
21
+ <div class="max-w-full flex justify-center m-xl">
22
+ <vv-button >Hover me
23
+ <vv-tooltip v-bind="args" data-testId="element">
24
+ <template #default v-if="args.default"><div v-html="args.default"></div></template>
25
+ </vv-tooltip>
26
+ </vv-button>
27
+ </div>`
28
+ })
29
+
30
+ <Canvas>
31
+ <Story name="Default" play={defaultTest}>
32
+ {Template.bind()}
33
+ </Story>
34
+ </Canvas>
35
+
36
+ <Canvas>
37
+ <Story
38
+ name="Top"
39
+ play={defaultTest}
40
+ args={{ position: 'top' }}
41
+ argTypes={{
42
+ position: {
43
+ control: {
44
+ disable: true,
45
+ }
46
+ },
47
+ }}>
48
+ {Template.bind({})}
49
+ </Story>
50
+ </Canvas>
51
+
52
+ <Canvas>
53
+ <Story
54
+ name="Bottom"
55
+ play={defaultTest}
56
+ args={{ position: 'bottom' }}
57
+ argTypes={{
58
+ position: {
59
+ control: {
60
+ disable: true,
61
+ }
62
+ },
63
+ }}>
64
+ {Template.bind({})}
65
+ </Story>
66
+ </Canvas>
67
+
68
+ <Canvas>
69
+ <Story
70
+ name="Right"
71
+ play={defaultTest}
72
+ args={{ position: 'right' }}
73
+ argTypes={{
74
+ position: {
75
+ control: {
76
+ disable: true,
77
+ }
78
+ },
79
+ }}>
80
+ {Template.bind({})}
81
+ </Story>
82
+ </Canvas>
83
+
84
+ <Canvas>
85
+ <Story
86
+ name="Left"
87
+ play={defaultTest}
88
+ args={{ position: 'left' }}
89
+ argTypes={{
90
+ position: {
91
+ control: {
92
+ disable: true,
93
+ }
94
+ },
95
+ }}>
96
+ {Template.bind({})}
97
+ </Story>
98
+ </Canvas>
@@ -0,0 +1,49 @@
1
+ import type { PlayAttributes } from '@/test/types'
2
+ import { expect } from '@/test/expect'
3
+ import { sleep } from '@/test/sleep'
4
+ import { within } from '@storybook/testing-library'
5
+
6
+ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
7
+ const element = (await within(canvasElement).findByTestId(
8
+ 'element',
9
+ )) as HTMLElement
10
+ const parentElement = element.parentElement as HTMLElement
11
+
12
+ // slot default
13
+ if (!args.default) {
14
+ throw new Error('Default slot is required!')
15
+ }
16
+
17
+ // check if tooltip is visible after focus
18
+ await parentElement.focus()
19
+ await sleep(800)
20
+ await expect(window.getComputedStyle(element)).toHaveProperty('opacity', "1")
21
+
22
+ // check accessibility
23
+ await expect(element).toHaveNoViolations()
24
+
25
+ // check if tooltip is not visible after blur
26
+ await parentElement.blur()
27
+ await sleep(800)
28
+ await expect(window.getComputedStyle(element)).toHaveProperty('opacity', "0")
29
+
30
+ // position right
31
+ if (args.position === 'right') {
32
+ await expect(element).toHaveClass('vv-tooltip--right')
33
+ }
34
+
35
+ // position left
36
+ if (args.position === 'left') {
37
+ await expect(element).toHaveClass('vv-tooltip--left')
38
+ }
39
+
40
+ // position top
41
+ if (args.position === 'top') {
42
+ await expect(element).toHaveClass('vv-tooltip--top')
43
+ }
44
+
45
+ // position bottom
46
+ if (args.position === 'bottom') {
47
+ await expect(element).toHaveClass('vv-tooltip--bottom')
48
+ }
49
+ }
@@ -1,4 +1,4 @@
1
- import { unref, type Ref } from 'vue'
1
+ import type { Ref } from 'vue'
2
2
 
3
3
  /**
4
4
  * Compare objects, primitives, array, dates, regexp