@volverjs/ui-vue 0.0.1 → 0.0.3-beta.2

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 (118) hide show
  1. package/README.md +17 -0
  2. package/auto-imports.d.ts +289 -0
  3. package/dist/components/VvButton/VvButton.es.js +159 -147
  4. package/dist/components/VvButton/VvButton.umd.js +1 -1
  5. package/dist/components/VvButton/VvButton.vue.d.ts +0 -8
  6. package/dist/components/VvButton/index.d.ts +4 -4
  7. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +36 -37
  8. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  9. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +10 -10
  10. package/dist/components/VvButtonGroup/index.d.ts +5 -5
  11. package/dist/components/VvCombobox/VvCombobox.es.js +526 -345
  12. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  13. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +22 -0
  14. package/dist/components/VvCombobox/index.d.ts +13 -1
  15. package/dist/components/VvDropdown/VvDropdown.es.js +118 -109
  16. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  17. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +19 -0
  18. package/dist/components/VvDropdown/index.d.ts +12 -0
  19. package/dist/components/VvInputText/VvInputText.es.js +221 -213
  20. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  21. package/dist/components/VvInputText/VvInputText.vue.d.ts +13 -13
  22. package/dist/components/VvInputText/index.d.ts +5 -5
  23. package/dist/components/VvSelect/VvSelect.es.js +186 -167
  24. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  25. package/dist/components/VvSelect/VvSelect.vue.d.ts +23 -11
  26. package/dist/components/VvSelect/index.d.ts +10 -17
  27. package/dist/components/VvTextarea/VvTextarea.es.js +241 -277
  28. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  29. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +12 -12
  30. package/dist/components/VvTextarea/index.d.ts +5 -5
  31. package/dist/components/VvTooltip/VvTooltip.es.js +28 -0
  32. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -0
  33. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +23 -0
  34. package/dist/components/VvTooltip/index.d.ts +18 -0
  35. package/dist/components/index.es.js +1046 -976
  36. package/dist/components/index.umd.js +1 -1
  37. package/dist/composables/group/types/IButtonGroupState.d.ts +1 -1
  38. package/dist/composables/group/types/IGroupState.d.ts +1 -1
  39. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  40. package/dist/icons.es.js +3 -3
  41. package/dist/icons.umd.js +1 -1
  42. package/dist/index.es.js +1127 -1057
  43. package/dist/index.umd.js +1 -1
  44. package/dist/props/index.d.ts +35 -4
  45. package/dist/resolvers/unplugin.es.js +26 -24
  46. package/dist/resolvers/unplugin.umd.js +1 -1
  47. package/dist/stories/Button/Button.settings.d.ts +9 -11
  48. package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +9 -0
  49. package/dist/stories/Combobox/Combobox.settings.d.ts +19 -0
  50. package/dist/stories/Dropdown/Dropdown.settings.d.ts +10 -0
  51. package/dist/stories/InputText/InputText.settings.d.ts +23 -23
  52. package/dist/stories/Select/Select.settings.d.ts +42 -23
  53. package/dist/stories/Textarea/Textarea.settings.d.ts +23 -23
  54. package/dist/stories/Tooltip/Tooltip.settings.d.ts +42 -0
  55. package/dist/stories/Tooltip/Tooltip.test.d.ts +2 -0
  56. package/dist/stories/argTypes.d.ts +50 -1
  57. package/package.json +31 -23
  58. package/src/assets/icons/detailed.json +1 -1
  59. package/src/assets/icons/normal.json +1 -1
  60. package/src/assets/icons/simple.json +1 -1
  61. package/src/components/VvButton/index.ts +28 -10
  62. package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -1
  63. package/src/components/VvButtonGroup/index.ts +3 -6
  64. package/src/components/VvCombobox/VvCombobox.vue +45 -11
  65. package/src/components/VvCombobox/index.ts +6 -0
  66. package/src/components/VvDropdown/VvDropdown.vue +9 -6
  67. package/src/components/VvDropdown/index.ts +11 -1
  68. package/src/components/VvInputText/VvInputText.vue +10 -8
  69. package/src/components/VvSelect/VvSelect.vue +23 -1
  70. package/src/components/VvSelect/index.ts +8 -11
  71. package/src/components/VvTextarea/VvTextarea.vue +9 -21
  72. package/src/components/VvTooltip/VvTooltip.vue +17 -0
  73. package/src/components/VvTooltip/index.ts +21 -0
  74. package/src/composables/group/types/IButtonGroupState.ts +1 -1
  75. package/src/composables/group/types/IGroupState.ts +1 -1
  76. package/src/composables/group/useInjectedGroupState.ts +3 -3
  77. package/src/composables/useTextCount.ts +1 -1
  78. package/src/props/index.ts +33 -15
  79. package/src/resolvers/unplugin.ts +22 -13
  80. package/src/stories/Accordion/Accordion.stories.mdx +1 -1
  81. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +1 -1
  82. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  83. package/src/stories/Badge/Badge.stories.mdx +1 -1
  84. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +1 -1
  85. package/src/stories/Breadcrumb/BreadcrumbSlots.stories.mdx +1 -1
  86. package/src/stories/Button/Button.settings.ts +2 -7
  87. package/src/stories/Button/Button.stories.mdx +1 -1
  88. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  89. package/src/stories/Button/ButtonSlots.stories.mdx +3 -3
  90. package/src/stories/ButtonGroup/ButtonGroup.settings.ts +6 -1
  91. package/src/stories/ButtonGroup/ButtonGroup.stories.mdx +1 -1
  92. package/src/stories/ButtonGroup/ButtonGroupSlots.stories.mdx +37 -0
  93. package/src/stories/ButtonGroup/ButtonGroupToggle.stories.mdx +12 -1
  94. package/src/stories/Card/Card.stories.mdx +1 -1
  95. package/src/stories/Card/CardSlots.stories.mdx +1 -1
  96. package/src/stories/Checkbox/Checkbox.stories.mdx +1 -1
  97. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
  98. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +1 -1
  99. package/src/stories/Combobox/Combobox.settings.ts +5 -0
  100. package/src/stories/Combobox/Combobox.stories.mdx +52 -1
  101. package/src/stories/Combobox/Combobox.test.ts +7 -0
  102. package/src/stories/Dialog/Dialog.stories.mdx +1 -1
  103. package/src/stories/Dropdown/Dropdown.settings.ts +10 -1
  104. package/src/stories/Dropdown/Dropdown.stories.mdx +18 -1
  105. package/src/stories/Icon/Icon.stories.mdx +1 -1
  106. package/src/stories/Icon/IconsCollection.stories.mdx +1 -1
  107. package/src/stories/InputText/InputText.stories.mdx +1 -1
  108. package/src/stories/Progress/Progress.stories.mdx +1 -1
  109. package/src/stories/Radio/Radio.stories.mdx +1 -1
  110. package/src/stories/RadioGroup/RadioGroup.stories.mdx +1 -1
  111. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +1 -1
  112. package/src/stories/Select/Select.settings.ts +9 -23
  113. package/src/stories/Select/Select.stories.mdx +61 -1
  114. package/src/stories/Textarea/Textarea.stories.mdx +1 -1
  115. package/src/stories/Tooltip/Tooltip.settings.ts +26 -0
  116. package/src/stories/Tooltip/Tooltip.stories.mdx +98 -0
  117. package/src/stories/Tooltip/Tooltip.test.ts +49 -0
  118. package/src/stories/argTypes.ts +46 -22
@@ -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>
@@ -10,18 +10,25 @@ import {
10
10
  IconArgTypes,
11
11
  TabindexArgTypes,
12
12
  IdNameArgTypes,
13
+ FloatingArgTypes,
14
+ UnselectableArgTypes,
15
+ AutofocusArgTypes,
16
+ AutocompleteArgTypes,
13
17
  } from '@/stories/argTypes'
14
18
  import { propsToObject } from '@/utils/ObjectUtilities'
15
19
  import { VvSelectProps } from '@/components/VvSelect'
16
20
 
17
21
  export const defaultArgs = {
18
22
  ...propsToObject(VvSelectProps),
23
+ name: 'vv-select',
19
24
  options: ['Option 1', 'Option 2', 'Option 3'],
20
25
  placeholder: 'Select an option',
21
26
  label: 'Select label',
22
27
  }
23
28
  export const argTypes = {
24
29
  ...IdNameArgTypes,
30
+ ...AutofocusArgTypes,
31
+ ...AutocompleteArgTypes,
25
32
  ...TabindexArgTypes,
26
33
  ...ValidArgTypes,
27
34
  ...InvalidArgTypes,
@@ -32,29 +39,8 @@ export const argTypes = {
32
39
  ...ModifiersArgTypes,
33
40
  ...OptionsArgTypes,
34
41
  ...IconArgTypes,
35
- autocomplete: {
36
- type: {
37
- summary: 'string',
38
- },
39
- description: 'Hint for for autofill feature.',
40
- control: {
41
- type: 'text',
42
- },
43
- table: {
44
- defaultValue: {
45
- summary: 'off',
46
- },
47
- },
48
- },
49
- autofocus: {
50
- type: 'boolean',
51
- description: 'Global attribute autofocus.',
52
- table: {
53
- defaultValue: {
54
- summary: false,
55
- },
56
- },
57
- },
42
+ ...FloatingArgTypes,
43
+ ...UnselectableArgTypes,
58
44
  multiple: {
59
45
  type: 'boolean',
60
46
  description:
@@ -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>
@@ -70,6 +70,40 @@ export const Template = (args) => ({
70
70
  </Story>
71
71
  </Canvas>
72
72
 
73
+ <Canvas>
74
+ <Story
75
+ name="Multiple"
76
+ play={defaultTest}
77
+ args={{ multiple: true }}
78
+ argTypes={{
79
+ multiple: {
80
+ control: {
81
+ disable: true,
82
+ },
83
+ },
84
+ }}
85
+ >
86
+ {Template.bind()}
87
+ </Story>
88
+ </Canvas>
89
+
90
+ <Canvas>
91
+ <Story
92
+ name="Unselectable"
93
+ play={defaultTest}
94
+ args={{ unselectable: false }}
95
+ argTypes={{
96
+ unselectable: {
97
+ control: {
98
+ disable: true,
99
+ },
100
+ },
101
+ }}
102
+ >
103
+ {Template.bind()}
104
+ </Story>
105
+ </Canvas>
106
+
73
107
  <Canvas>
74
108
  <Story
75
109
  name="Valid"
@@ -128,6 +162,32 @@ export const Template = (args) => ({
128
162
  loading: true,
129
163
  loadingLabel: 'Loading...',
130
164
  }}
165
+ argTypes={{
166
+ loading: {
167
+ control: {
168
+ disable: true,
169
+ },
170
+ },
171
+ }}
172
+ play={defaultTest}
173
+ >
174
+ {Template.bind()}
175
+ </Story>
176
+ </Canvas>
177
+
178
+ <Canvas>
179
+ <Story
180
+ name="Floating"
181
+ args={{
182
+ floating: true,
183
+ }}
184
+ argTypes={{
185
+ floating: {
186
+ control: {
187
+ disable: true,
188
+ },
189
+ },
190
+ }}
131
191
  play={defaultTest}
132
192
  >
133
193
  {Template.bind()}
@@ -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,26 @@
1
+ import { propsToObject } from '@/utils/ObjectUtilities'
2
+ import { VvTooltipProps } from '@/components/VvTooltip'
3
+ import { DefaultSlotArgTypes, ModifiersArgTypes } from '@/stories/argTypes'
4
+
5
+ export const defaultArgs = {
6
+ ...propsToObject(VvTooltipProps),
7
+ default: "I'm a tooltip"
8
+ }
9
+
10
+ export const argTypes = {
11
+ ...ModifiersArgTypes,
12
+ ...DefaultSlotArgTypes,
13
+ position: {
14
+ type: {
15
+ summary: 'string',
16
+ },
17
+ control: {
18
+ type: 'select',
19
+ },
20
+ table: {
21
+ defaultValue: { summary: 'bottom' },
22
+ },
23
+ description: 'Indicates where to place the tooltip',
24
+ options: [undefined, 'left', 'right', 'bottom', 'top']
25
+ }
26
+ }
@@ -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
+ }
@@ -272,19 +272,31 @@ export const IdNameArgTypes = {
272
272
  },
273
273
  }
274
274
 
275
- export const InputTextareaArgTypes = {
276
- ...IdNameArgTypes,
277
- ...TabindexArgTypes,
278
- ...DisabledArgTypes,
279
- ...ReadonlyArgTypes,
280
- ...ValidArgTypes,
281
- ...InvalidArgTypes,
282
- ...HintArgTypes,
283
- ...LoadingArgTypes,
284
- ...ModifiersArgTypes,
285
- ...CountArgTypes,
286
- ...DebounceArgTypes,
287
- ...IconArgTypes,
275
+ export const UnselectableArgTypes = {
276
+ unselectable: {
277
+ type: 'boolean',
278
+ description: 'If true the field will be unselectable',
279
+ table: {
280
+ defaultValue: {
281
+ summary: true,
282
+ },
283
+ },
284
+ },
285
+ }
286
+
287
+ export const FloatingArgTypes = {
288
+ floating: {
289
+ type: 'boolean',
290
+ description: 'If true the label will be floating',
291
+ table: {
292
+ defaultValue: {
293
+ summary: false,
294
+ },
295
+ },
296
+ },
297
+ }
298
+
299
+ export const AutofocusArgTypes = {
288
300
  autofocus: {
289
301
  type: 'boolean',
290
302
  description: 'Global attribute autofocus.',
@@ -294,6 +306,9 @@ export const InputTextareaArgTypes = {
294
306
  },
295
307
  },
296
308
  },
309
+ }
310
+
311
+ export const AutocompleteArgTypes = {
297
312
  autocomplete: {
298
313
  type: {
299
314
  summary: 'string',
@@ -308,6 +323,24 @@ export const InputTextareaArgTypes = {
308
323
  },
309
324
  },
310
325
  },
326
+ }
327
+
328
+ export const InputTextareaArgTypes = {
329
+ ...IdNameArgTypes,
330
+ ...AutofocusArgTypes,
331
+ ...AutocompleteArgTypes,
332
+ ...TabindexArgTypes,
333
+ ...DisabledArgTypes,
334
+ ...ReadonlyArgTypes,
335
+ ...ValidArgTypes,
336
+ ...InvalidArgTypes,
337
+ ...HintArgTypes,
338
+ ...LoadingArgTypes,
339
+ ...ModifiersArgTypes,
340
+ ...CountArgTypes,
341
+ ...DebounceArgTypes,
342
+ ...IconArgTypes,
343
+ ...FloatingArgTypes,
311
344
  minlength: {
312
345
  type: 'number',
313
346
  description:
@@ -349,15 +382,6 @@ export const InputTextareaArgTypes = {
349
382
  type: 'text',
350
383
  },
351
384
  },
352
- floating: {
353
- type: 'boolean',
354
- description: 'If true the label will be floating',
355
- table: {
356
- defaultValue: {
357
- summary: false,
358
- },
359
- },
360
- },
361
385
  }
362
386
 
363
387
  export const CheckboxRadioArgTypes = {