@volverjs/ui-vue 0.0.1 → 0.0.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 (82) hide show
  1. package/README.md +17 -0
  2. package/dist/components/VvButton/VvButton.es.js +159 -147
  3. package/dist/components/VvButton/VvButton.umd.js +1 -1
  4. package/dist/components/VvButton/VvButton.vue.d.ts +0 -8
  5. package/dist/components/VvButton/index.d.ts +4 -4
  6. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +36 -37
  7. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  8. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +10 -10
  9. package/dist/components/VvButtonGroup/index.d.ts +5 -5
  10. package/dist/components/VvCombobox/VvCombobox.es.js +526 -345
  11. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  12. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +22 -0
  13. package/dist/components/VvCombobox/index.d.ts +13 -1
  14. package/dist/components/VvDropdown/VvDropdown.es.js +118 -109
  15. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  16. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +19 -0
  17. package/dist/components/VvDropdown/index.d.ts +12 -0
  18. package/dist/components/VvInputText/VvInputText.es.js +221 -213
  19. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  20. package/dist/components/VvInputText/VvInputText.vue.d.ts +13 -13
  21. package/dist/components/VvInputText/index.d.ts +5 -5
  22. package/dist/components/VvSelect/VvSelect.es.js +186 -167
  23. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  24. package/dist/components/VvSelect/VvSelect.vue.d.ts +23 -11
  25. package/dist/components/VvSelect/index.d.ts +10 -17
  26. package/dist/components/VvTextarea/VvTextarea.es.js +112 -104
  27. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  28. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +12 -12
  29. package/dist/components/VvTextarea/index.d.ts +5 -5
  30. package/dist/components/index.es.js +1045 -975
  31. package/dist/components/index.umd.js +1 -1
  32. package/dist/composables/group/types/IButtonGroupState.d.ts +1 -1
  33. package/dist/composables/group/types/IGroupState.d.ts +1 -1
  34. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  35. package/dist/icons.es.js +3 -3
  36. package/dist/icons.umd.js +1 -1
  37. package/dist/index.es.js +1065 -995
  38. package/dist/index.umd.js +1 -1
  39. package/dist/props/index.d.ts +35 -4
  40. package/dist/resolvers/unplugin.es.js +26 -24
  41. package/dist/resolvers/unplugin.umd.js +1 -1
  42. package/dist/stories/Button/Button.settings.d.ts +9 -11
  43. package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +9 -0
  44. package/dist/stories/Combobox/Combobox.settings.d.ts +19 -0
  45. package/dist/stories/Dropdown/Dropdown.settings.d.ts +10 -0
  46. package/dist/stories/InputText/InputText.settings.d.ts +23 -23
  47. package/dist/stories/Select/Select.settings.d.ts +42 -23
  48. package/dist/stories/Textarea/Textarea.settings.d.ts +23 -23
  49. package/dist/stories/argTypes.d.ts +50 -1
  50. package/package.json +5 -4
  51. package/src/assets/icons/detailed.json +1 -1
  52. package/src/assets/icons/normal.json +1 -1
  53. package/src/assets/icons/simple.json +1 -1
  54. package/src/components/VvButton/index.ts +28 -10
  55. package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -1
  56. package/src/components/VvButtonGroup/index.ts +3 -6
  57. package/src/components/VvCombobox/VvCombobox.vue +45 -11
  58. package/src/components/VvCombobox/index.ts +6 -0
  59. package/src/components/VvDropdown/VvDropdown.vue +9 -6
  60. package/src/components/VvDropdown/index.ts +11 -1
  61. package/src/components/VvInputText/VvInputText.vue +10 -8
  62. package/src/components/VvSelect/VvSelect.vue +23 -1
  63. package/src/components/VvSelect/index.ts +8 -11
  64. package/src/components/VvTextarea/VvTextarea.vue +10 -8
  65. package/src/composables/group/types/IButtonGroupState.ts +1 -1
  66. package/src/composables/group/types/IGroupState.ts +1 -1
  67. package/src/composables/group/useInjectedGroupState.ts +3 -3
  68. package/src/composables/useTextCount.ts +1 -1
  69. package/src/props/index.ts +33 -15
  70. package/src/resolvers/unplugin.ts +22 -13
  71. package/src/stories/Button/Button.settings.ts +2 -7
  72. package/src/stories/ButtonGroup/ButtonGroup.settings.ts +6 -1
  73. package/src/stories/ButtonGroup/ButtonGroupSlots.stories.mdx +37 -0
  74. package/src/stories/ButtonGroup/ButtonGroupToggle.stories.mdx +12 -1
  75. package/src/stories/Combobox/Combobox.settings.ts +5 -0
  76. package/src/stories/Combobox/Combobox.stories.mdx +51 -0
  77. package/src/stories/Combobox/Combobox.test.ts +7 -0
  78. package/src/stories/Dropdown/Dropdown.settings.ts +10 -1
  79. package/src/stories/Dropdown/Dropdown.stories.mdx +17 -0
  80. package/src/stories/Select/Select.settings.ts +9 -23
  81. package/src/stories/Select/Select.stories.mdx +60 -0
  82. package/src/stories/argTypes.ts +46 -22
@@ -38,17 +38,23 @@ export interface VolverResolverOptions {
38
38
  const STYLE_EXCLUDE = ['vv-icon']
39
39
  const VOLVER_PREFIX = 'vv'
40
40
 
41
- const getStyleName = function (kebabName: string) {
41
+ const getStyleNames = function (kebabName: string) {
42
42
  if (STYLE_EXCLUDE.includes(kebabName)) {
43
43
  return undefined
44
44
  }
45
- if (kebabName === 'vv-native-select') {
46
- return 'vv-select'
45
+ if (kebabName === 'vv-combobox') {
46
+ return ['vv-select', 'vv-dropdown']
47
47
  }
48
48
  if (kebabName === 'vv-accordion-group') {
49
- return 'vv-accordion'
49
+ return ['vv-accordion-group', 'vv-accordion']
50
50
  }
51
- return kebabName
51
+ if (kebabName === 'vv-checkbox-group') {
52
+ return ['vv-checkbox-group', 'vv-checkbox']
53
+ }
54
+ if (kebabName === 'vv-radio-group') {
55
+ return ['vv-radio-group', 'vv-radio']
56
+ }
57
+ return [kebabName]
52
58
  }
53
59
 
54
60
  /**
@@ -83,17 +89,20 @@ export function VolverResolver({
83
89
  sideEffects.push(customStylePath)
84
90
  }
85
91
 
86
- const styleName = getStyleName(kebabName)
87
- if (styleName) {
88
- // import component
89
- sideEffects.push(
90
- `@volverjs/style/${
91
- importStyle === 'scss' ? 'scss/' : ''
92
- }components/${styleName}`,
93
- )
92
+ // import component style
93
+ const styleNames = getStyleNames(kebabName)
94
+ if (styleNames) {
95
+ styleNames.forEach((name) => {
96
+ sideEffects.push(
97
+ `@volverjs/style/${
98
+ importStyle === 'scss' ? 'scss/' : ''
99
+ }components/${name}`,
100
+ )
101
+ })
94
102
  }
95
103
  }
96
104
 
105
+ // import component
97
106
  return {
98
107
  from: `@volverjs/ui-vue/${kebabName}`,
99
108
  sideEffects,
@@ -3,6 +3,7 @@ import {
3
3
  ModifiersArgTypes,
4
4
  DisabledArgTypes,
5
5
  LoadingArgTypes,
6
+ UnselectableArgTypes,
6
7
  } from '@/stories/argTypes'
7
8
  import normal from '@/assets/icons/normal.json'
8
9
 
@@ -68,13 +69,7 @@ export const argTypes = {
68
69
  defaultValue: { summary: false },
69
70
  },
70
71
  },
71
- unselectable: {
72
- description: 'Whether the button is unselectable',
73
- control: { type: 'boolean' },
74
- table: {
75
- defaultValue: { summary: true },
76
- },
77
- },
72
+ ...UnselectableArgTypes,
78
73
  ...LoadingArgTypes,
79
74
  ...DisabledArgTypes,
80
75
  pressed: {
@@ -1,4 +1,8 @@
1
- import { DefaultSlotArgTypes, ModifiersArgTypes } from '@/stories/argTypes'
1
+ import {
2
+ DefaultSlotArgTypes,
3
+ ModifiersArgTypes,
4
+ UnselectableArgTypes,
5
+ } from '@/stories/argTypes'
2
6
  import { propsToObject } from '@/utils/ObjectUtilities'
3
7
  import { VvButtonGroupProps } from '@/components/VvButtonGroup'
4
8
  import { argTypes as buttonArgTypes } from '../Button/Button.settings'
@@ -24,5 +28,6 @@ export const argTypes = {
24
28
  type: 'check',
25
29
  },
26
30
  },
31
+ ...UnselectableArgTypes,
27
32
  ...DefaultSlotArgTypes,
28
33
  }
@@ -0,0 +1,37 @@
1
+ import { Canvas, Meta, Story } from '@storybook/addon-docs'
2
+ import VvButton from '@/components/VvButton/VvButton.vue'
3
+ import VvButtonGroup from '@/components/VvButtonGroup/VvButtonGroup.vue'
4
+ import { defaultArgs, argTypes } from './ButtonGroup.settings'
5
+ import { defaultTest } from './ButtonGroup.test'
6
+
7
+ <Meta
8
+ title="Components/ButtonGroup/Slots"
9
+ component={VvButtonGroup}
10
+ args={defaultArgs}
11
+ argTypes={argTypes}
12
+ />
13
+
14
+ export const Template = (args, { argTypes }) => ({
15
+ props: Object.keys(argTypes),
16
+ components: { VvButton, VvButtonGroup },
17
+ data() {
18
+ return { value: undefined }
19
+ },
20
+ setup() {
21
+ return { args }
22
+ },
23
+ template: `
24
+ <vv-button-group v-bind="args" v-model="value" data-testId="button-group">
25
+ <vv-button modifiers="primary" name="1a" data-testId="first-button">Button 1</vv-button>
26
+ <vv-button modifiers="secondary" name="2b">Button 2</vv-button>
27
+ <vv-button modifiers="danger" name="3c">Button 3</vv-button>
28
+ </vv-button-group>
29
+ <div v-if="args.toggle" class="mt-md">Value: {{ value }}</div>
30
+ `,
31
+ })
32
+
33
+ <Canvas>
34
+ <Story name="Default" play={defaultTest}>
35
+ {Template.bind()}
36
+ </Story>
37
+ </Canvas>
@@ -12,7 +12,18 @@ import { defaultTest } from './ButtonGroup.test'
12
12
  />
13
13
 
14
14
  <Canvas>
15
- <Story name="Default" play={defaultTest}>
15
+ <Story
16
+ name="Default"
17
+ args={{ toggle: true }}
18
+ argTypes={{
19
+ toggle: {
20
+ control: {
21
+ disable: true,
22
+ },
23
+ },
24
+ }}
25
+ play={defaultTest}
26
+ >
16
27
  {Template.bind()}
17
28
  </Story>
18
29
  </Canvas>
@@ -9,12 +9,15 @@ import {
9
9
  OptionsArgTypes,
10
10
  IconArgTypes,
11
11
  TabindexArgTypes,
12
+ FloatingArgTypes,
13
+ UnselectableArgTypes,
12
14
  } from '@/stories/argTypes'
13
15
  import { VvComboboxProps } from '@/components/VvCombobox'
14
16
  import { propsToObject } from '@/utils/ObjectUtilities'
15
17
 
16
18
  export const defaultArgs = {
17
19
  ...propsToObject(VvComboboxProps),
20
+ name: 'vv-combobox',
18
21
  maxValues: undefined,
19
22
  options: ['Option 1', 'Option 2', 'Option 3'],
20
23
  placeholder: 'Select an option',
@@ -31,6 +34,8 @@ export const argTypes = {
31
34
  ...ModifiersArgTypes,
32
35
  ...OptionsArgTypes,
33
36
  ...IconArgTypes,
37
+ ...FloatingArgTypes,
38
+ ...UnselectableArgTypes,
34
39
  multiple: {
35
40
  type: 'boolean',
36
41
  description:
@@ -71,6 +71,23 @@ export const Template = (args) => ({
71
71
  </Story>
72
72
  </Canvas>
73
73
 
74
+ <Canvas>
75
+ <Story
76
+ name="Unselectable"
77
+ play={defaultTest}
78
+ args={{ unselectable: false }}
79
+ argTypes={{
80
+ unselectable: {
81
+ control: {
82
+ disable: true,
83
+ },
84
+ },
85
+ }}
86
+ >
87
+ {Template.bind()}
88
+ </Story>
89
+ </Canvas>
90
+
74
91
  <Canvas>
75
92
  <Story
76
93
  name="Valid"
@@ -151,3 +168,37 @@ export const Template = (args) => ({
151
168
  {Template.bind()}
152
169
  </Story>
153
170
  </Canvas>
171
+
172
+ <Canvas>
173
+ <Story
174
+ name="Floating"
175
+ play={defaultTest}
176
+ args={{ floating: true }}
177
+ argTypes={{
178
+ floating: {
179
+ control: {
180
+ disable: true,
181
+ },
182
+ },
183
+ }}
184
+ >
185
+ {Template.bind()}
186
+ </Story>
187
+ </Canvas>
188
+
189
+ <Canvas>
190
+ <Story
191
+ name="Native"
192
+ play={defaultTest}
193
+ args={{ native: true }}
194
+ argTypes={{
195
+ native: {
196
+ control: {
197
+ disable: true,
198
+ },
199
+ },
200
+ }}
201
+ >
202
+ {Template.bind()}
203
+ </Story>
204
+ </Canvas>
@@ -3,8 +3,15 @@ import { expect } from '@/test/expect'
3
3
  import { within } from '@storybook/testing-library'
4
4
  import { sleep } from '@/test/sleep'
5
5
  import { getOptionValue } from '@/test/options'
6
+ import { defaultTest as selectDefaultTest } from '@/stories/Select/Select.test'
6
7
 
7
8
  export async function defaultTest({ canvasElement, args }: PlayAttributes) {
9
+ // native
10
+ if (args.native) {
11
+ await selectDefaultTest({ canvasElement, args })
12
+ return
13
+ }
14
+
8
15
  const element = (await within(canvasElement).findByTestId(
9
16
  'element',
10
17
  )) as HTMLElement
@@ -1,6 +1,14 @@
1
- import { ModifiersArgTypes, OptionsArgTypes } from '@/stories/argTypes'
1
+ import { VvDropdownProps } from '@/components/VvDropdown'
2
+ import { propsToObject } from '@/utils/ObjectUtilities'
3
+ import {
4
+ ModifiersArgTypes,
5
+ OptionsArgTypes,
6
+ UnselectableArgTypes,
7
+ } from '@/stories/argTypes'
2
8
 
3
9
  export const defaultArgs = {
10
+ ...propsToObject(VvDropdownProps),
11
+ name: 'vv-dropdown',
4
12
  disabled: false,
5
13
  valueObject: false,
6
14
  multiple: false,
@@ -39,4 +47,5 @@ export const argTypes = {
39
47
  maxValues: {
40
48
  control: { type: 'number' },
41
49
  },
50
+ ...UnselectableArgTypes,
42
51
  }
@@ -66,6 +66,23 @@ export const Template = (args) => ({
66
66
  </Story>
67
67
  </Canvas>
68
68
 
69
+ <Canvas>
70
+ <Story
71
+ name="Unselectable"
72
+ play={defaultTest}
73
+ args={{ unselectable: false }}
74
+ argTypes={{
75
+ unselectable: {
76
+ control: {
77
+ disable: true,
78
+ },
79
+ },
80
+ }}
81
+ >
82
+ {Template.bind()}
83
+ </Story>
84
+ </Canvas>
85
+
69
86
  <Canvas>
70
87
  <Story
71
88
  name="Max values"
@@ -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:
@@ -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()}
@@ -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 = {