@volverjs/ui-vue 0.0.6-beta.3 → 0.0.6-beta.5

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 (73) hide show
  1. package/README.md +1 -0
  2. package/dist/components/VvAccordion/VvAccordion.es.js +18 -1
  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 +22 -2
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +6 -58
  9. package/dist/components/VvAccordionGroup/index.d.ts +3 -29
  10. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +2 -28
  11. package/dist/components/VvAvatarGroup/index.d.ts +1 -14
  12. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +2 -28
  13. package/dist/components/VvBreadcrumb/index.d.ts +1 -14
  14. package/dist/components/VvButton/VvButton.es.js +51 -20
  15. package/dist/components/VvButton/VvButton.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.vue.d.ts +27 -2
  17. package/dist/components/VvButton/index.d.ts +25 -2
  18. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +10 -4
  19. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  20. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +7 -59
  21. package/dist/components/VvButtonGroup/index.d.ts +3 -29
  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/VvCombobox/VvCombobox.es.js +1 -1
  25. package/dist/components/VvDialog/VvDialog.es.js +1 -1
  26. package/dist/components/VvIcon/VvIcon.es.js +1 -1
  27. package/dist/components/VvIcon/index.d.ts +1 -1
  28. package/dist/components/VvInputText/VvInputText.es.js +1 -1
  29. package/dist/components/VvNav/VvNav.es.js +15 -7
  30. package/dist/components/VvNav/VvNav.umd.js +1 -1
  31. package/dist/components/VvNav/VvNav.vue.d.ts +2 -28
  32. package/dist/components/VvNav/index.d.ts +2 -14
  33. package/dist/components/VvSelect/VvSelect.es.js +1 -1
  34. package/dist/components/VvTab/VvTab.es.js +505 -0
  35. package/dist/components/VvTab/VvTab.umd.js +1 -0
  36. package/dist/components/VvTab/VvTab.vue.d.ts +26 -0
  37. package/dist/components/VvTab/index.d.ts +10 -0
  38. package/dist/components/VvTextarea/VvTextarea.es.js +1 -1
  39. package/dist/components/index.es.js +83 -26
  40. package/dist/components/index.umd.js +1 -1
  41. package/dist/icons.es.js +3 -3
  42. package/dist/icons.umd.js +1 -1
  43. package/dist/stories/Button/Button.settings.d.ts +25 -0
  44. package/dist/stories/Tab/Tab.settings.d.ts +37 -0
  45. package/dist/stories/Tab/Tab.test.d.ts +2 -0
  46. package/package.json +12 -4
  47. package/src/assets/icons/detailed.json +1 -1
  48. package/src/assets/icons/normal.json +1 -1
  49. package/src/assets/icons/simple.json +1 -1
  50. package/src/components/VvAccordion/index.ts +21 -4
  51. package/src/components/VvAccordionGroup/index.ts +6 -3
  52. package/src/components/VvAvatarGroup/index.ts +2 -2
  53. package/src/components/VvBreadcrumb/index.ts +1 -1
  54. package/src/components/VvButton/VvButton.vue +9 -6
  55. package/src/components/VvButton/index.ts +44 -21
  56. package/src/components/VvButtonGroup/VvButtonGroup.vue +2 -2
  57. package/src/components/VvButtonGroup/index.ts +14 -2
  58. package/src/components/VvCard/index.ts +1 -1
  59. package/src/components/VvCombobox/index.ts +2 -2
  60. package/src/components/VvIcon/index.ts +1 -1
  61. package/src/components/VvNav/VvNav.vue +18 -8
  62. package/src/components/VvNav/index.ts +2 -1
  63. package/src/components/VvTab/VvTab.vue +53 -0
  64. package/src/components/VvTab/index.ts +13 -0
  65. package/src/components/common/HintSlot.ts +3 -3
  66. package/src/props/index.ts +2 -2
  67. package/src/stories/Button/Button.settings.ts +21 -0
  68. package/src/stories/Button/Button.stories.mdx +3 -3
  69. package/src/stories/Button/ButtonToggle.stories.mdx +62 -0
  70. package/src/stories/Tab/Tab.settings.ts +41 -0
  71. package/src/stories/Tab/Tab.stories.mdx +65 -0
  72. package/src/stories/Tab/Tab.test.ts +37 -0
  73. package/src/types/group.d.ts +5 -3
@@ -25,7 +25,7 @@ export const VvAccordionProps = {
25
25
  /**
26
26
  * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-accordion--'
27
27
  */
28
- modifiers: [String, Array],
28
+ modifiers: [String, Array] as PropType<string | string[]>,
29
29
  /**
30
30
  * If true, the accordion will be disabled
31
31
  */
@@ -58,12 +58,29 @@ export function useGroupProps(
58
58
  const modelValue = getGroupOrLocalRef('modelValue', props, emit)
59
59
  const not = getGroupOrLocalRef('not', props) as Ref<boolean>
60
60
  const collapse = getGroupOrLocalRef('collapse', props) as Ref<boolean>
61
- const modifiers = getGroupOrLocalRef('modifiers', props) as Ref<
62
- Array<string> | string
63
- >
64
61
  const disabled = computed(() =>
65
62
  Boolean(props.disabled || group?.value?.disabled.value),
66
63
  )
64
+ // merge local and group modifiers
65
+ const modifiers = computed(() => {
66
+ let localModifiers = props.modifiers
67
+ let groupModifiers = group?.value.modifiers.value
68
+
69
+ const toReturn = new Set<string>()
70
+ if (localModifiers) {
71
+ if (!Array.isArray(localModifiers)) {
72
+ localModifiers = localModifiers.split(' ')
73
+ }
74
+ localModifiers.forEach((modifier) => toReturn.add(modifier))
75
+ }
76
+ if (groupModifiers) {
77
+ if (!Array.isArray(groupModifiers)) {
78
+ groupModifiers = groupModifiers.split(' ')
79
+ }
80
+ groupModifiers.forEach((modifier) => toReturn.add(modifier))
81
+ }
82
+ return Array.from(toReturn)
83
+ })
67
84
 
68
85
  return {
69
86
  // group props
@@ -15,7 +15,10 @@ export const VvAccordionGroupProps = {
15
15
  * Accordion items
16
16
  * @type VvAccordionGroupItem
17
17
  */
18
- items: { type: Array<VvAccordionGroupItem>, default: () => [] },
18
+ items: {
19
+ type: Array as PropType<VvAccordionGroupItem[]>,
20
+ default: () => [],
21
+ },
19
22
  /**
20
23
  * If true, accordion items stay open when another item is opened
21
24
  */
@@ -23,12 +26,12 @@ export const VvAccordionGroupProps = {
23
26
  /**
24
27
  * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-accordion-group--'
25
28
  */
26
- modifiers: [String, Array],
29
+ modifiers: [String, Array] as PropType<string | string[]>,
27
30
  /**
28
31
  * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-accordion--'
29
32
  */
30
33
  itemModifiers: {
31
- type: [String, Array<string>],
34
+ type: [String, Array] as PropType<string | string[]>,
32
35
  default: '',
33
36
  },
34
37
  /**
@@ -13,7 +13,7 @@ export const VvAvatarGroupProps = {
13
13
  * avatar items
14
14
  */
15
15
  items: {
16
- type: Array<AvatarItem>,
16
+ type: Array as PropType<AvatarItem[]>,
17
17
  default: () => [],
18
18
  required: true,
19
19
  },
@@ -24,5 +24,5 @@ export const VvAvatarGroupProps = {
24
24
  totalItems: {
25
25
  type: Number,
26
26
  },
27
- avatarModifiers: [String, Array] as PropType<string | Array<string>>,
27
+ avatarModifiers: [String, Array] as PropType<string | string[]>,
28
28
  }
@@ -9,5 +9,5 @@ export interface Route {
9
9
 
10
10
  export const VvBreadcrumbProps = {
11
11
  ...ModifiersProps,
12
- routes: Array<Route>,
12
+ routes: Array as PropType<Route[]>,
13
13
  }
@@ -81,25 +81,28 @@
81
81
  /**
82
82
  * @description Catch click event
83
83
  */
84
+ const toggleValue = computed(() => {
85
+ return props.value !== undefined ? props.value : name.value
86
+ })
84
87
  const onClick = () => {
85
88
  if (toggle.value) {
86
89
  if (Array.isArray(modelValue.value)) {
87
- if (contains(name.value, modelValue.value)) {
90
+ if (contains(toggleValue.value, modelValue.value)) {
88
91
  if (unselectable.value) {
89
92
  modelValue.value = modelValue.value.filter(
90
- (n) => n !== name.value,
93
+ (n) => n !== toggleValue.value,
91
94
  )
92
95
  }
93
96
  return
94
97
  }
95
- modelValue.value.push(name.value)
98
+ modelValue.value.push(toggleValue.value)
96
99
  return
97
100
  }
98
- if (equals(name.value, modelValue.value) && unselectable.value) {
99
- modelValue.value = undefined
101
+ if (toggleValue.value === modelValue.value && unselectable.value) {
102
+ modelValue.value = props.uncheckedValue
100
103
  return
101
104
  }
102
- modelValue.value = name.value
105
+ modelValue.value = toggleValue.value
103
106
  }
104
107
  }
105
108
  </script>
@@ -33,11 +33,34 @@ export const VvButtonProps = {
33
33
  * Loading icon
34
34
  */
35
35
  loadingIcon: { type: String, default: 'eos-icons:bubble-loading' },
36
+ /**
37
+ * Enable button toggle
38
+ */
36
39
  toggle: {
37
40
  type: Boolean,
38
41
  default: false,
39
42
  },
40
- modelValue: String,
43
+ /**
44
+ * Button toggle value
45
+ */
46
+ value: {
47
+ type: [String, Number, Boolean],
48
+ default: undefined,
49
+ },
50
+ /**
51
+ * Value associated with the unchecked state
52
+ */
53
+ uncheckedValue: {
54
+ type: [String, Number, Boolean],
55
+ default: undefined,
56
+ },
57
+ /**
58
+ * Button toggle model value
59
+ */
60
+ modelValue: {
61
+ type: [String, Number, Boolean],
62
+ default: undefined,
63
+ },
41
64
  }
42
65
 
43
66
  export type VvButtonPropsTypes = ExtractPropTypes<typeof VvButtonProps>
@@ -53,18 +76,11 @@ export function useGroupProps(
53
76
  useInjectedGroupState<ButtonGroupState>(INJECTION_KEY_BUTTON_GROUP)
54
77
 
55
78
  // local props
56
- const {
57
- id,
58
- iconPosition,
59
- icon,
60
- label,
61
- pressed,
62
- modifiers: localModifiers,
63
- } = toRefs(props)
79
+ const { id, iconPosition, icon, label, pressed } = toRefs(props)
64
80
 
65
81
  // group props
66
82
  const modelValue = getGroupOrLocalRef('modelValue', props, emit) as Ref<
67
- string | Array<string> | undefined
83
+ string | number | boolean | (string | number | boolean)[] | undefined
68
84
  >
69
85
  const toggle = getGroupOrLocalRef('toggle', props) as Ref<boolean>
70
86
  const unselectable = getGroupOrLocalRef(
@@ -72,18 +88,25 @@ export function useGroupProps(
72
88
  props,
73
89
  ) as Ref<boolean>
74
90
  const multiple = computed(() => group?.value.multiple.value ?? false)
91
+ // merge local and group modifiers
75
92
  const modifiers = computed(() => {
76
- const localValue = localModifiers?.value
77
- ? Array.isArray(localModifiers.value)
78
- ? localModifiers.value
79
- : localModifiers.value.split(' ')
80
- : []
81
- const groupValue = group?.value.itemModifiers?.value
82
- ? Array.isArray(group.value.itemModifiers.value)
83
- ? group.value.itemModifiers.value
84
- : group.value.itemModifiers.value.split(' ')
85
- : []
86
- return [...localValue, ...groupValue]
93
+ let localModifiers = props.modifiers
94
+ let groupModifiers = group?.value.modifiers.value
95
+
96
+ const toReturn = new Set<string>()
97
+ if (localModifiers) {
98
+ if (!Array.isArray(localModifiers)) {
99
+ localModifiers = localModifiers.split(' ')
100
+ }
101
+ localModifiers.forEach((modifier) => toReturn.add(modifier))
102
+ }
103
+ if (groupModifiers) {
104
+ if (!Array.isArray(groupModifiers)) {
105
+ groupModifiers = groupModifiers.split(' ')
106
+ }
107
+ groupModifiers.forEach((modifier) => toReturn.add(modifier))
108
+ }
109
+ return Array.from(toReturn)
87
110
  })
88
111
  const disabled = computed(() =>
89
112
  Boolean(props.disabled || group?.value?.disabled.value),
@@ -45,7 +45,7 @@
45
45
  (Array.isArray(props.modelValue) || multiple.value) &&
46
46
  !Array.isArray(newValue)
47
47
  ) {
48
- newValue = [newValue]
48
+ return emit('update:modelValue', [newValue])
49
49
  }
50
50
  return emit('update:modelValue', newValue)
51
51
  },
@@ -59,7 +59,7 @@
59
59
  toggle,
60
60
  multiple,
61
61
  unselectable,
62
- itemModifiers,
62
+ modifiers: itemModifiers,
63
63
  })
64
64
 
65
65
  // style
@@ -7,10 +7,22 @@ export const VvButtonGroupProps = {
7
7
  /**
8
8
  * String or String[] of css classes (modifiers) that will be provided to each button'
9
9
  */
10
- itemModifiers: { type: [String, Array<string>], default: undefined },
10
+ itemModifiers: {
11
+ type: [String, Array] as PropType<string | string[]>,
12
+ default: '',
13
+ },
11
14
  toggle: { type: Boolean, default: false },
12
15
  multiple: { type: Boolean, default: false },
13
- modelValue: { type: [String, Array<string>], default: undefined },
16
+ modelValue: {
17
+ type: [String, Number, Boolean, Array] as PropType<
18
+ | string
19
+ | number
20
+ | boolean
21
+ | (string | number | boolean)[]
22
+ | undefined
23
+ >,
24
+ default: undefined,
25
+ },
14
26
  }
15
27
 
16
28
  export const VvButtonGroupEvents = ['update:modelValue']
@@ -1,4 +1,4 @@
1
1
  export const VvCardProps = {
2
2
  title: String,
3
- modifiers: [String, Array],
3
+ modifiers: [String, Array] as PropType<string | string[]>,
4
4
  }
@@ -117,7 +117,7 @@ export const VvComboboxProps = {
117
117
  * Badge modifiers
118
118
  */
119
119
  badgeModifiers: {
120
- type: [String, Array] as PropType<string | Array<string>>,
120
+ type: [String, Array] as PropType<string | string[]>,
121
121
  default: 'action sm',
122
122
  },
123
123
  /**
@@ -131,7 +131,7 @@ export const VvComboboxProps = {
131
131
  * Dropdown modifiers
132
132
  */
133
133
  dropdownModifiers: {
134
- type: [String, Array] as PropType<string | Array<string>>,
134
+ type: [String, Array] as PropType<string | string[]>,
135
135
  },
136
136
  /**
137
137
  * Open dropdown on focus
@@ -95,7 +95,7 @@ export const VvIconProps = {
95
95
  svg: String,
96
96
  /**
97
97
  * Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
98
- * @values string | Array<string>
98
+ * @values string | string[]
99
99
  */
100
100
  modifiers: {
101
101
  type: [String, Array] as PropType<string | string[]>,
@@ -4,22 +4,32 @@
4
4
 
5
5
  const props = defineProps(VvNavProps)
6
6
  const emit = defineEmits(VvNavEvents)
7
- const { modifiers } = toRefs(props)
7
+ const { modifiers, items } = toRefs(props)
8
8
  const activeItem: Ref<string | null> = ref(null)
9
9
 
10
10
  // bem css classes
11
11
  const bemCssClasses = useModifiers('vv-nav', modifiers)
12
12
 
13
+ const localItems = computed(() => {
14
+ return items.value.map((item, index) => {
15
+ return {
16
+ ...item,
17
+ id: item.id || `nav-item_${index}`,
18
+ }
19
+ })
20
+ })
21
+
13
22
  /**
14
23
  * Triggers when the item is clicked.
15
24
  * @private
16
25
  * @event click
17
- * @param [NavItem, number] item, id - the clicked item
26
+ * @param [NavItem, string] item - the clicked item
18
27
  */
19
- function onClick(item: NavItem, id: string) {
28
+ function onClick(item: NavItem) {
20
29
  if (!item.disabled) {
21
30
  emit('click', item)
22
- activeItem.value = id
31
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32
+ activeItem.value = item.id!
23
33
  }
24
34
  }
25
35
  </script>
@@ -28,8 +38,8 @@
28
38
  <nav :class="bemCssClasses">
29
39
  <ul class="vv-nav__menu" role="menu" aria-busy="true">
30
40
  <li
31
- v-for="(navItem, index) in items"
32
- :key="`nav-item_${index}`"
41
+ v-for="navItem in localItems"
42
+ :key="navItem.id"
33
43
  class="vv-nav__item"
34
44
  role="presentation"
35
45
  >
@@ -41,12 +51,12 @@
41
51
  tabindex: 0,
42
52
  }"
43
53
  :class="{
44
- current: activeItem == `nav-item_${index}`,
54
+ current: activeItem == navItem.id,
45
55
  disabled: navItem.disabled,
46
56
  }"
47
57
  class="vv-nav__item-label"
48
58
  v-on="navItem.on || {}"
49
- @click="onClick(navItem, `nav-item_${index}`)"
59
+ @click="onClick(navItem)"
50
60
  >
51
61
  {{ navItem.title }}
52
62
  </VvAction>
@@ -1,6 +1,7 @@
1
1
  import { ModifiersProps } from '@/props'
2
2
 
3
3
  export type NavItem = {
4
+ id?: string
4
5
  title: string
5
6
  to?: string | { [key: string]: unknown }
6
7
  href?: string
@@ -11,7 +12,7 @@ export type NavItem = {
11
12
  export const VvNavProps = {
12
13
  ...ModifiersProps,
13
14
  items: {
14
- type: Array<NavItem>,
15
+ type: Array as PropType<NavItem[]>,
15
16
  required: true,
16
17
  default: () => [],
17
18
  },
@@ -0,0 +1,53 @@
1
+ <script setup lang="ts">
2
+ import { VvTabProps, VvTabEvents } from '@/components/VvTab'
3
+ import type { NavItem } from '@/components/VvNav'
4
+ import VvNav from '@/components/VvNav/VvNav.vue'
5
+
6
+ const props = defineProps(VvTabProps)
7
+ const emit = defineEmits(VvTabEvents)
8
+ const { modifiers, items } = toRefs(props)
9
+ const activeTab: Ref<string | null> = ref(null)
10
+
11
+ // bem css classes
12
+ const bemCssClasses = useModifiers('vv-tab', modifiers)
13
+
14
+ const localItems = computed(() => {
15
+ return items.value.map((item, index) => {
16
+ return {
17
+ ...item,
18
+ id: item.id || `tab-item_${index}`,
19
+ }
20
+ })
21
+ })
22
+
23
+ /**
24
+ * Triggers when the item is clicked.
25
+ * @private
26
+ * @event click
27
+ * @param [NavItem, string] item - the clicked item
28
+ */
29
+ function onClick(item: NavItem) {
30
+ if (!item.disabled) {
31
+ emit('click', item)
32
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
33
+ activeTab.value = item.id!
34
+ }
35
+ }
36
+ </script>
37
+
38
+ <template>
39
+ <div :class="bemCssClasses">
40
+ <VvNav :items="localItems" modifiers="tabs full" @click="onClick" />
41
+ <!-- #region tab content -->
42
+ <article
43
+ v-for="item in localItems"
44
+ :id="item.id"
45
+ :key="item.id"
46
+ :class="{ target: activeTab === item.id }"
47
+ class="vv-tab__panel"
48
+ >
49
+ <slot :name="`${item.id}`" />
50
+ </article>
51
+ <!-- #endregion tab content -->
52
+ </div>
53
+ </template>
@@ -0,0 +1,13 @@
1
+ import { ModifiersProps } from '@/props'
2
+ import type { NavItem } from '../VvNav'
3
+
4
+ export const VvTabProps = {
5
+ ...ModifiersProps,
6
+ items: {
7
+ type: Array as PropType<NavItem[]>,
8
+ required: true,
9
+ default: () => [],
10
+ },
11
+ }
12
+
13
+ export const VvTabEvents = ['click']
@@ -1,11 +1,11 @@
1
1
  import type { Component, ExtractPropTypes, Slots, Ref } from 'vue'
2
2
 
3
3
  /**
4
- * Merge errors from Array<string> to string errors separated from new line (\n)
5
- * @param {Array<string> | string} errors
4
+ * Merge errors from string[] to string errors separated from new line (\n)
5
+ * @param {string[] | string} errors
6
6
  * @returns {string}
7
7
  */
8
- function joinLines(errors: Array<string> | string | unknown[] | undefined) {
8
+ function joinLines(errors: string[] | string | unknown[] | undefined) {
9
9
  if (Array.isArray(errors)) {
10
10
  return errors.filter((e) => isString(e)).join(' ')
11
11
  }
@@ -126,7 +126,7 @@ export const ModifiersProps = {
126
126
  /**
127
127
  * Component BEM modifiers
128
128
  */
129
- modifiers: [String, Array] as PropType<string | Array<string>>,
129
+ modifiers: [String, Array] as PropType<string | string[]>,
130
130
  }
131
131
 
132
132
  export const HintProps = {
@@ -138,7 +138,7 @@ export const OptionsProps = {
138
138
  * List of options, can be string[] or object[]
139
139
  */
140
140
  options: {
141
- type: Array as PropType<Array<Option | string>>,
141
+ type: Array as PropType<(Option | string)[]>,
142
142
  default: () => [],
143
143
  },
144
144
  /**
@@ -69,6 +69,24 @@ export const argTypes = {
69
69
  defaultValue: { summary: false },
70
70
  },
71
71
  },
72
+ value: {
73
+ description: 'The button value',
74
+ type: {
75
+ summary: ['string', 'boolean', 'number'],
76
+ },
77
+ table: {
78
+ defaultValue: { summary: 'undefined' },
79
+ },
80
+ },
81
+ uncheckedValue: {
82
+ description: 'The button unchecked value',
83
+ type: {
84
+ summary: ['string', 'boolean', 'number'],
85
+ },
86
+ table: {
87
+ defaultValue: { summary: 'undefined' },
88
+ },
89
+ },
72
90
  ...UnselectableArgTypes,
73
91
  ...LoadingArgTypes,
74
92
  ...DisabledArgTypes,
@@ -89,6 +107,9 @@ export const argTypes = {
89
107
  rel: {
90
108
  description: 'The rel attribute of the button',
91
109
  control: { type: 'text' },
110
+ type: {
111
+ summary: 'boolean',
112
+ },
92
113
  table: {
93
114
  defaultValue: { summary: 'noopener noreferrer' },
94
115
  },
@@ -13,19 +13,19 @@ import { argTypes, defaultArgs } from './Button.settings'
13
13
  export const Template = (args, { argTypes }) => ({
14
14
  props: Object.keys(argTypes),
15
15
  data() {
16
- return { value: undefined }
16
+ return { currentValue: undefined }
17
17
  },
18
18
  setup() {
19
19
  return { args }
20
20
  },
21
21
  components: { VvButton },
22
22
  template: /*html*/ `
23
- <vv-button v-bind="args" v-model="value" name="my-button" data-testId="element">
23
+ <vv-button v-bind="args" v-model="currentValue" name="my-button" data-testId="element">
24
24
  <template #before v-if="args.before"><div v-html="args.before"></div></template>
25
25
  <template #default v-if="args.default"><div v-html="args.default"></div></template>
26
26
  <template #after v-if="args.after"><div v-html="args.after"></div></template>
27
27
  </vv-button>
28
- <div v-if="args.toggle" class="mt-md">Value: {{ value }}</div>`,
28
+ <div v-if="args.toggle" class="mt-md">Value: {{ currentValue }}</div>`,
29
29
  })
30
30
 
31
31
  <Canvas>
@@ -24,6 +24,68 @@ import { argTypes, defaultArgs } from './Button.settings'
24
24
  </Story>
25
25
  </Canvas>
26
26
 
27
+ <Canvas>
28
+ <Story
29
+ name="True / False"
30
+ args={{
31
+ toggle: true,
32
+ value: true,
33
+ uncheckedValue: false,
34
+ }}
35
+ argTypes={{
36
+ toggle: {
37
+ control: {
38
+ disable: true,
39
+ },
40
+ },
41
+ value: {
42
+ control: {
43
+ disable: true,
44
+ },
45
+ },
46
+ uncheckedValue: {
47
+ control: {
48
+ disable: true,
49
+ },
50
+ },
51
+ }}
52
+ play={defaultTest}
53
+ >
54
+ {Template.bind()}
55
+ </Story>
56
+ </Canvas>
57
+
58
+ <Canvas>
59
+ <Story
60
+ name="Yes / No"
61
+ args={{
62
+ toggle: true,
63
+ value: 'yes',
64
+ uncheckedValue: 'no',
65
+ }}
66
+ argTypes={{
67
+ toggle: {
68
+ control: {
69
+ disable: true,
70
+ },
71
+ },
72
+ value: {
73
+ control: {
74
+ disable: true,
75
+ },
76
+ },
77
+ uncheckedValue: {
78
+ control: {
79
+ disable: true,
80
+ },
81
+ },
82
+ }}
83
+ play={defaultTest}
84
+ >
85
+ {Template.bind()}
86
+ </Story>
87
+ </Canvas>
88
+
27
89
  <Canvas>
28
90
  <Story
29
91
  name="Unselectable"
@@ -0,0 +1,41 @@
1
+ import { VvTabProps } from '@/components/VvTab'
2
+
3
+ export const defaultArgs = {
4
+ ...propsToObject(VvTabProps),
5
+ items: [
6
+ {
7
+ title: 'Item 1',
8
+ href: 'javascript:void(0)',
9
+ },
10
+ {
11
+ title: 'Item 2',
12
+ to: 'about',
13
+ },
14
+ {
15
+ id: 'tab-3',
16
+ title: 'Item 3',
17
+ to: 'contacts',
18
+ on: {
19
+ click: () => {
20
+ // eslint-disable-next-line no-console
21
+ console.log('clicked Item 3')
22
+ },
23
+ },
24
+ },
25
+ ],
26
+ }
27
+
28
+ export const defaultArgTypes = {
29
+ tabId: {
30
+ description: 'Slot by tab-id',
31
+ control: {
32
+ type: 'text',
33
+ },
34
+ table: {
35
+ category: 'Slots',
36
+ type: {
37
+ summary: 'html',
38
+ },
39
+ },
40
+ },
41
+ }