@volverjs/ui-vue 0.0.1-beta.11 → 0.0.1-beta.12

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 (81) hide show
  1. package/dist/components/VvBadge/VvBadge.d.ts +1 -1
  2. package/dist/components/VvBadge/VvBadge.es.js +165 -12
  3. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  4. package/dist/components/VvBadge/VvBadge.vue.d.ts +4 -4
  5. package/dist/components/VvBreadcrumb/VvBreadcrumb.d.ts +1 -1
  6. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +4 -4
  7. package/dist/components/VvButton/VvButton.d.ts +2 -33
  8. package/dist/components/VvButton/VvButton.es.js +183 -198
  9. package/dist/components/VvButton/VvButton.umd.js +1 -1
  10. package/dist/components/VvButton/VvButton.vue.d.ts +9 -44
  11. package/dist/components/VvButton/useButtonGroupProps.d.ts +1 -6
  12. package/dist/components/VvButtonGroup/VvButtonGroup.d.ts +2 -26
  13. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +68 -78
  14. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  15. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +9 -69
  16. package/dist/components/VvDropdown/VvDropdown.d.ts +1 -1
  17. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +4 -4
  18. package/dist/components/VvInputText/VvInputText.d.ts +1 -1
  19. package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
  20. package/dist/components/VvProgress/VvProgress.d.ts +1 -1
  21. package/dist/components/VvProgress/VvProgress.vue.d.ts +4 -4
  22. package/dist/components/VvSelect/VvSelect.d.ts +5 -1
  23. package/dist/components/VvSelect/VvSelect.es.js +395 -207
  24. package/dist/components/VvSelect/VvSelect.umd.js +2 -2
  25. package/dist/components/VvSelect/VvSelect.vue.d.ts +12 -5
  26. package/dist/components/VvTextarea/VvTextarea.d.ts +1 -1
  27. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
  28. package/dist/components/index.es.js +579 -610
  29. package/dist/components/index.umd.js +2 -2
  30. package/dist/composables/group/types/IButtonGroupState.d.ts +4 -0
  31. package/dist/icons.es.js +3 -3
  32. package/dist/icons.umd.js +1 -1
  33. package/dist/index.es.js +553 -585
  34. package/dist/index.umd.js +2 -2
  35. package/dist/props/index.d.ts +2 -1
  36. package/dist/stories/RadioGroup/RadioOption.test.d.ts +4 -0
  37. package/dist/stories/RadioGroup/RadioProperty.test.d.ts +1 -1
  38. package/dist/stories/RadioGroup/RadioSlots.test.d.ts +6 -0
  39. package/package.json +2 -2
  40. package/src/assets/icons/detailed.json +1 -1
  41. package/src/assets/icons/normal.json +1 -1
  42. package/src/assets/icons/simple.json +1 -1
  43. package/src/components/VvBadge/VvBadge.ts +4 -2
  44. package/src/components/VvBadge/VvBadge.vue +8 -3
  45. package/src/components/VvButton/VvButton.ts +4 -34
  46. package/src/components/VvButton/VvButton.vue +3 -12
  47. package/src/components/VvButton/useButtonGroupProps.ts +3 -11
  48. package/src/components/VvButtonGroup/VvButtonGroup.ts +4 -17
  49. package/src/components/VvButtonGroup/VvButtonGroup.vue +5 -16
  50. package/src/components/VvSelect/VvSelect.ts +5 -1
  51. package/src/components/VvSelect/VvSelect.vue +7 -1
  52. package/src/composables/group/types/IButtonGroupState.ts +4 -0
  53. package/src/props/index.ts +3 -1
  54. package/src/stories/Badge/BadgeColor.stories.mdx +4 -4
  55. package/src/stories/Badge/BadgeModifiers.stories.mdx +65 -0
  56. package/src/stories/Button/ButtonActive.stories.mdx +27 -0
  57. package/src/stories/Button/ButtonDisabled.stories.mdx +28 -0
  58. package/src/stories/Button/ButtonIconPosition.stories.mdx +0 -1
  59. package/src/stories/Button/ButtonModifiers.stories.mdx +103 -46
  60. package/src/stories/Button/ButtonSelected.stories.mdx +30 -0
  61. package/src/stories/ButtonGroup/ButtonGroupAction.stories.mdx +2 -2
  62. package/src/stories/ButtonGroup/ButtonGroupActionQuiet.stories.mdx +2 -2
  63. package/src/stories/ButtonGroup/ButtonGroupBlock.stories.mdx +1 -1
  64. package/src/stories/ButtonGroup/ButtonGroupRounded.stories.mdx +1 -1
  65. package/src/stories/RadioGroup/RadioGroupHintLabel.stories.mdx +6 -6
  66. package/src/stories/RadioGroup/RadioGroupLabel.stories.mdx +7 -2
  67. package/src/stories/RadioGroup/RadioGroupOptionLabel.stories.mdx +7 -19
  68. package/src/stories/RadioGroup/RadioGroupOptionValue.stories.mdx +7 -19
  69. package/src/stories/RadioGroup/RadioGroupOptions.stories.mdx +3 -17
  70. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +10 -9
  71. package/src/stories/RadioGroup/RadioOption.test.ts +45 -0
  72. package/src/stories/RadioGroup/RadioProperty.test.ts +4 -4
  73. package/src/stories/RadioGroup/RadioSlots.test.ts +29 -0
  74. package/src/stories/Select/SelectNative.stories.mdx +45 -0
  75. package/src/stories/stories.scss +5 -27
  76. package/src/stories/Button/ButtonVariant.stories.mdx +0 -205
  77. package/src/stories/Button/test.js +0 -41
  78. package/src/stories/Radio/RadioTest.js +0 -90
  79. package/src/stories/RadioGroup/RadioOptionsTest.js +0 -78
  80. package/src/stories/RadioGroup/RadioPropertyTest.js +0 -131
  81. package/src/stories/RadioGroup/RadioSlotsTest.js +0 -20
@@ -1,4 +1,6 @@
1
+ import { ModifiersProps } from '@/props'
2
+
1
3
  export const VvBadgeProps = {
2
- value: [String, Number],
3
- color: String
4
+ ...ModifiersProps,
5
+ value: [String, Number]
4
6
  }
@@ -1,12 +1,17 @@
1
1
  <template>
2
- <span class="vv-badge" :class="hasClass" role="status">{{ value }}</span>
2
+ <span :class="badgeClass" role="status">{{ value }}</span>
3
3
  </template>
4
4
 
5
5
  <script setup lang="ts">
6
- import { computed } from 'vue'
6
+ import { useBemModifiers } from '@/composables/useModifiers'
7
+ import { toRefs } from 'vue'
7
8
  import { VvBadgeProps } from './VvBadge'
8
9
 
9
10
  const props = defineProps(VvBadgeProps)
11
+ const { modifiers } = toRefs(props)
10
12
 
11
- const hasClass = computed(() => (props.color ? `vv-badge--${props.color}` : ''))
13
+ //Styles & bindings
14
+ const { bemCssClasses: badgeClass } = useBemModifiers('vv-badge', {
15
+ modifiers
16
+ })
12
17
  </script>
@@ -1,3 +1,4 @@
1
+ import { DisabledProps, ModifiersProps } from '@/props'
1
2
  import type { PropType, ExtractPropTypes } from 'vue'
2
3
 
3
4
  export enum ButtonIconPosition {
@@ -24,6 +25,8 @@ export enum ButtonTarget {
24
25
  export const VvButtonEvents = ['update:modelValue']
25
26
 
26
27
  export const VvButtonProps = {
28
+ ...ModifiersProps,
29
+ ...DisabledProps,
27
30
  /**
28
31
  * Button icon
29
32
  */
@@ -73,44 +76,11 @@ export const VvButtonProps = {
73
76
  type: String as PropType<ButtonTarget>,
74
77
  validator: (value: string) => value in ButtonTarget
75
78
  },
76
- /**
77
- * Create block level button that span the full width of a parent.
78
- */
79
- block: Boolean,
80
- /**
81
- * Button active state.
82
- */
83
79
  active: Boolean,
84
- /**
85
- * Button rounded.
86
- */
87
- rounded: Boolean,
88
- /**
89
- * Button disabled
90
- */
91
- disabled: Boolean,
92
- /**
93
- * Button with min-width
94
- */
95
- fullBleed: Boolean,
96
- /**
97
- * Button action mode
98
- */
99
- action: Boolean,
100
- /**
101
- * Button action mode
102
- */
103
- actionQuiet: Boolean,
104
80
  /**
105
81
  * Button selected mode
106
82
  */
107
- selected: Boolean,
108
- /**
109
- * The variant of the button
110
- * @values
111
- * @defaultvalue default
112
- */
113
- modifiers: [Array, String]
83
+ selected: Boolean
114
84
  }
115
85
 
116
86
  type _VvButtonPropsType = typeof VvButtonProps
@@ -46,7 +46,7 @@
46
46
  </template>
47
47
 
48
48
  <script setup lang="ts">
49
- import { useAttrs } from 'vue'
49
+ import { useAttrs, useSlots } from 'vue'
50
50
 
51
51
  import { computed } from 'vue'
52
52
  import { v4 as uuidv4 } from 'uuid'
@@ -64,16 +64,12 @@ import { toButtonRefs } from './useButtonGroupProps'
64
64
  //Props, emits, attrs, slots
65
65
  const props = defineProps(VvButtonProps)
66
66
  const attrs = useAttrs()
67
+ const slots = useSlots()
67
68
 
68
69
  //Data
69
70
  const btnName = attrs?.name || uuidv4()
70
71
  const {
71
72
  modifiers,
72
- action,
73
- actionQuiet,
74
- block,
75
- rounded,
76
- fullBleed,
77
73
  iconPosition,
78
74
  icon,
79
75
  label,
@@ -128,12 +124,7 @@ const selected = computed(() => {
128
124
  const { bemCssClasses: btnClass } = useBemModifiers('vv-button', {
129
125
  modifiers,
130
126
  active,
131
- action,
132
- actionQuiet,
133
127
  selected,
134
- block,
135
- rounded,
136
- fullBleed,
137
128
  disabled,
138
129
  reverse: computed(() =>
139
130
  [ButtonIconPosition.right, ButtonIconPosition.bottom].includes(
@@ -145,7 +136,7 @@ const { bemCssClasses: btnClass } = useBemModifiers('vv-button', {
145
136
  iconPosition.value
146
137
  )
147
138
  ),
148
- iconOnly: computed(() => icon?.value && !label?.value)
139
+ iconOnly: computed(() => icon?.value && !label?.value && !slots['default'])
149
140
  })
150
141
  /**
151
142
  * Compute component properties
@@ -18,16 +18,13 @@ export function toButtonRefs(props: VvButtonPropsTypes) {
18
18
  useInjectedGroupState<IButtonGroupState>(VV_BUTTON_GROUP)
19
19
 
20
20
  //Local props
21
- const { modifiers, fullBleed, iconPosition, icon, label, block, selected } =
22
- toRefs(props)
21
+ const { iconPosition, icon, label, selected } = toRefs(props)
23
22
 
24
23
  //Group based props
25
24
  const modelValue = getGroupOrLocalRef('modelValue', props)
26
25
  const disabled = getGroupOrLocalRef('disabled', props)
27
26
  const toggle = getGroupOrLocalRef('toggle', props)
28
- const rounded = getGroupOrLocalRef('rounded', props)
29
- const action = getGroupOrLocalRef('action', props)
30
- const actionQuiet = getGroupOrLocalRef('actionQuiet', props)
27
+ const modifiers = getGroupOrLocalRef('modifiers', props)
31
28
 
32
29
  return {
33
30
  //Group based props
@@ -36,14 +33,9 @@ export function toButtonRefs(props: VvButtonPropsTypes) {
36
33
  toggle,
37
34
  isInGroup,
38
35
  group,
39
- //Local props
40
36
  modifiers,
41
- action,
42
- actionQuiet,
37
+ //Local props
43
38
  selected,
44
- block,
45
- rounded,
46
- fullBleed,
47
39
  iconPosition,
48
40
  icon,
49
41
  label
@@ -1,5 +1,8 @@
1
+ import { DisabledProps, ModifiersProps } from '@/props'
2
+
1
3
  export const VvButtonGroupProps = {
2
- disabled: { type: Boolean, default: false },
4
+ ...ModifiersProps,
5
+ ...DisabledProps,
3
6
  /**
4
7
  * True = show buttons vertically
5
8
  */
@@ -12,22 +15,6 @@ export const VvButtonGroupProps = {
12
15
  * True = il button group si comporterà come un toggle, materrà attivo l'ultimo pulsante cliccato.
13
16
  */
14
17
  toggle: { type: Boolean, default: false },
15
- /**
16
- * True = display as block
17
- */
18
- block: { type: Boolean, default: false },
19
- /**
20
- * True = display btn-broup as rounded (first and last child .vv-button)
21
- */
22
- rounded: { type: Boolean, default: false },
23
- /**
24
- * Button action mode
25
- */
26
- action: Boolean,
27
- /**
28
- * Button action mode
29
- */
30
- actionQuiet: Boolean,
31
18
  /**
32
19
  * Active button (name)
33
20
  */
@@ -7,7 +7,7 @@
7
7
  <script setup lang="ts">
8
8
  import type IButtonGroupState from '@/composables/group/types/IButtonGroupState'
9
9
 
10
- import { toRefs } from 'vue'
10
+ import { ref, toRefs } from 'vue'
11
11
  import { VvButtonGroupProps, VvButtonGroupEvents } from './VvButtonGroup'
12
12
  import { VV_BUTTON_GROUP } from '../../constants'
13
13
 
@@ -22,22 +22,13 @@ const props = defineProps(VvButtonGroupProps)
22
22
 
23
23
  //Data
24
24
  const modelValue = useVModel(props, 'modelValue', emit)
25
- const {
26
- disabled,
27
- vertical,
28
- compact,
29
- block,
30
- rounded,
31
- toggle,
32
- action,
33
- actionQuiet
34
- } = toRefs(props)
25
+ const { disabled, vertical, compact, toggle, modifiers } = toRefs(props)
35
26
 
36
27
  //Computed
37
28
  const { bemCssClasses: btnGroupClass } = useBemModifiers('vv-button-group', {
29
+ modifiers,
38
30
  vertical,
39
- compact,
40
- block
31
+ compact
41
32
  })
42
33
 
43
34
  // #region group
@@ -46,9 +37,7 @@ const groupState: IButtonGroupState = {
46
37
  modelValue,
47
38
  disabled,
48
39
  toggle,
49
- rounded,
50
- action,
51
- actionQuiet
40
+ modifiers: modifiers?.value ? modifiers : ref([])
52
41
  }
53
42
  useProvideGroupState(groupState)
54
43
  // #endregion group
@@ -87,5 +87,9 @@ export const VvSelectProps = {
87
87
  /**
88
88
  * Icon name of icon in right position
89
89
  */
90
- iconRight: String
90
+ iconRight: String,
91
+ /**
92
+ * Icon name of icon in right position
93
+ */
94
+ native: Boolean
91
95
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :id="id" :class="selectClasses">
2
+ <div v-if="!native" :id="id" :class="selectClasses">
3
3
  <label v-if="label" for="select">{{ label }}</label>
4
4
  <details
5
5
  ref="dropdown"
@@ -35,6 +35,10 @@
35
35
  </details>
36
36
  <HintSlot class="vv-select__hint" />
37
37
  </div>
38
+ <VvNativeSelect
39
+ v-else
40
+ v-bind="props"
41
+ @update:model-value="emit('update:modelValue', $event)" />
38
42
  </template>
39
43
 
40
44
  <script setup lang="ts">
@@ -47,9 +51,11 @@ import { VvSelectProps } from './VvSelect'
47
51
  import HintSlotFactory from '../common/HintSlot'
48
52
  import VvDropdown from '../VvDropdown/VvDropdown.vue'
49
53
  import { useBemModifiers } from '../../composables/useModifiers'
54
+ import VvNativeSelect from '../VvNativeSelect/VvNativeSelect.vue'
50
55
 
51
56
  const props = defineProps(VvSelectProps)
52
57
  const slots = useSlots()
58
+
53
59
  const emit = defineEmits(['update:modelValue', 'change:search'])
54
60
 
55
61
  //Hint component
@@ -18,4 +18,8 @@ export default interface IButtonGroupState extends IGroupState {
18
18
  * True = gruppo di pulsanti è in modalità TOGGLE (come i radio buttons)
19
19
  */
20
20
  toggle: Ref<boolean>
21
+ /**
22
+ * add modifiers to buttons
23
+ */
24
+ modifiers: Ref<Array<string> | string | undefined>
21
25
  }
@@ -1,3 +1,5 @@
1
+ import type { PropType } from 'vue'
2
+
1
3
  export const ValidProps = {
2
4
  valid: Boolean,
3
5
  validLabel: [String, Array]
@@ -22,7 +24,7 @@ export const ReadonlyProps = {
22
24
  }
23
25
 
24
26
  export const ModifiersProps = {
25
- modifiers: [String, Array]
27
+ modifiers: [String, Array] as PropType<string | Array<string>>
26
28
  }
27
29
 
28
30
  export const HintProps = {
@@ -14,7 +14,7 @@ By default color is `primary` and default options are: `black`, `danger`, `succe
14
14
  {() => {
15
15
  return {
16
16
  components: { VvBadge },
17
- template: `<vv-badge color="black" role="status" value="12" />`
17
+ template: `<vv-badge modifiers="black" role="status" value="12" />`
18
18
  }
19
19
  }}
20
20
  </Story>
@@ -25,7 +25,7 @@ By default color is `primary` and default options are: `black`, `danger`, `succe
25
25
  {() => {
26
26
  return {
27
27
  components: { VvBadge },
28
- template: `<vv-badge color="danger" role="status" value="16" />`
28
+ template: `<vv-badge modifiers="danger" role="status" value="16" />`
29
29
  }
30
30
  }}
31
31
  </Story>
@@ -36,7 +36,7 @@ By default color is `primary` and default options are: `black`, `danger`, `succe
36
36
  {() => {
37
37
  return {
38
38
  components: { VvBadge },
39
- template: `<vv-badge color="success" role="status" value="10" />`
39
+ template: `<vv-badge modifiers="success" role="status" value="10" />`
40
40
  }
41
41
  }}
42
42
  </Story>
@@ -47,7 +47,7 @@ By default color is `primary` and default options are: `black`, `danger`, `succe
47
47
  {() => {
48
48
  return {
49
49
  components: { VvBadge },
50
- template: `<vv-badge color="warning" role="status" value="8" />`
50
+ template: `<vv-badge modifiers="warning" role="status" value="8" />`
51
51
  }
52
52
  }}
53
53
  </Story>
@@ -0,0 +1,65 @@
1
+ import { Canvas, Meta, Story } from '@storybook/addon-docs'
2
+ import VvBadge from '../../components/VvBadge/VvBadge.vue'
3
+ import VvButton from '../../components/VvButton/VvButton.vue'
4
+
5
+ <Meta title="Components/Badge/Props/modifiers" />
6
+
7
+ # VvBadge rounded
8
+
9
+ Let's define a story for our `rounded` badge.
10
+
11
+ <Canvas>
12
+ <Story name="rounded">
13
+ {() => {
14
+ return {
15
+ components: { VvBadge, VvButton },
16
+ template: `<vv-badge modifiers="rounded" value="99+" />`
17
+ }
18
+ }}
19
+ </Story>
20
+ </Canvas>
21
+
22
+ # VvBadge outline
23
+
24
+ Let's define a story for our `outline` badge.
25
+
26
+ <Canvas>
27
+ <Story name="outline">
28
+ {() => {
29
+ return {
30
+ components: { VvBadge, VvButton },
31
+ template: `<vv-badge modifiers="outline" value="99+" />`
32
+ }
33
+ }}
34
+ </Story>
35
+ </Canvas>
36
+
37
+ # VvBadge ghost
38
+
39
+ Let's define a story for our `ghost` badge.
40
+
41
+ <Canvas>
42
+ <Story name="ghost">
43
+ {() => {
44
+ return {
45
+ components: { VvBadge, VvButton },
46
+ template: `<vv-badge modifiers="ghost" value="99+" />`
47
+ }
48
+ }}
49
+ </Story>
50
+ </Canvas>
51
+
52
+ # VvBadge small
53
+
54
+ Let's define a story for our `sm` badge.
55
+
56
+ <Canvas>
57
+ <Story name="sm">
58
+ {() => {
59
+ return {
60
+ components: { VvBadge, VvButton },
61
+ template: `<vv-badge modifiers="sm" value="99+" />`
62
+ }
63
+ }}
64
+ </Story>
65
+ </Canvas>
@@ -0,0 +1,27 @@
1
+ import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
2
+ import VvButton from '../../components/VvButton/VvButton.vue'
3
+
4
+ <Meta title="Components/Button/Props/active" />
5
+
6
+ ## Active
7
+
8
+ Let's define a story for our `active` button.
9
+
10
+ <Canvas>
11
+ <Story
12
+ name="active"
13
+ play={async (ctx) => {
14
+ testButton(ctx, {
15
+ className: 'vv-button--active'
16
+ })
17
+ }}>
18
+ {() => {
19
+ return {
20
+ components: { VvButton },
21
+ template: `<vv-button label="Active" active />`
22
+ }
23
+ }}
24
+ </Story>
25
+ </Canvas>
26
+
27
+ <Source language="jsx" code={'<vv-button label="Active" active />'} />
@@ -0,0 +1,28 @@
1
+ import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
2
+ import VvButton from '../../components/VvButton/VvButton.vue'
3
+ import { testButton } from './Button.test'
4
+
5
+ <Meta title="Components/Button/Props/disabled" />
6
+
7
+ ## Disabled
8
+
9
+ Let's define a story for our `disabled` button.
10
+
11
+ <Canvas>
12
+ <Story
13
+ name="disabled"
14
+ play={async (ctx) => {
15
+ testButton(ctx, {
16
+ isClickDisabled: true
17
+ })
18
+ }}>
19
+ {() => {
20
+ return {
21
+ components: { VvButton },
22
+ template: `<vv-button label="Disabled" disabled />`
23
+ }
24
+ }}
25
+ </Story>
26
+ </Canvas>
27
+
28
+ <Source language="jsx" code={'<vv-button label="Disabled" disabled />'} />
@@ -1,7 +1,6 @@
1
1
  import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
2
2
  import VvButton from '../../components/VvButton/VvButton.vue'
3
3
  import { within, userEvent } from '@storybook/testing-library'
4
- import { buttonTest, classTest } from './test.js'
5
4
  import { testButton } from './Button.test'
6
5
 
7
6
  <Meta title="Components/Button/Props/icon-position" />