diff --git a/packages/ui/src/components/va-time-input/_variables.scss b/packages/ui/src/components/va-time-input/_variables.scss
deleted file mode 100644
index 81bdbe6e80..0000000000
--- a/packages/ui/src/components/va-time-input/_variables.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-:root,
-:host {
- --va-time-input-min-width: var(--va-form-element-min-width);
-}
diff --git a/packages/ui/src/components/va-tree-view/VaTreeView.demo.vue b/packages/ui/src/components/va-tree-view/VaTreeView.demo.vue
deleted file mode 100644
index b3e5b4dce6..0000000000
--- a/packages/ui/src/components/va-tree-view/VaTreeView.demo.vue
+++ /dev/null
@@ -1,425 +0,0 @@
-
-
-
-
-
-
-
- expansion/selection should work:
-
- checked model: {{stateChecked}}
-
- expanded model: {{stateExpanded}}
-
-
-
- expansion/selection shouldn't work:
-
-
-
-
- Selection strategy
-
-
-
-
-
-
-
-
- Selection strategy
-
-
- Single selection model for two tree views:
-
- {{ selectedNodes }}
-
-
-
-
-
- {{ selectedNodesValueBy }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Expand all
-
- Expanded by
-
- Expanded v-model: {{ expandedNodes }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{props.label}}
-
-
- {{props.description}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/ui/src/components/va-tree-view/VaTreeView.stories.ts b/packages/ui/src/components/va-tree-view/VaTreeView.stories.ts
index b48ed4d210..ec322ba254 100644
--- a/packages/ui/src/components/va-tree-view/VaTreeView.stories.ts
+++ b/packages/ui/src/components/va-tree-view/VaTreeView.stories.ts
@@ -1,12 +1,558 @@
-import { defineComponent } from 'vue'
-import VaTreeView from './VaTreeView.demo.vue'
+import { VaTreeView } from '.'
+import { VaRadio } from '../va-radio'
+import { VaColorPalette } from '../va-color-palette'
+import { VaInput } from '../va-input'
+import { VaCheckbox } from '../va-checkbox'
export default {
title: 'VaTreeView',
component: VaTreeView,
+ tags: ['autodocs'],
}
-export const Default = defineComponent({
+const nodes = () => [
+ {
+ id: 1,
+ label: 'Category',
+ children: [
+ { id: 2, label: 'Item' },
+ {
+ id: 3,
+ label: 'Subcategory',
+ children: [
+ { id: 4, label: 'Item' },
+ { id: 5, label: 'Item' },
+ ],
+ },
+ { id: 6, label: 'Item' },
+ ],
+ },
+ { id: 7, label: 'Item' },
+]
+
+export const Default = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodes: nodes(),
+ }),
+ template: `
+
+ `,
+})
+
+export const Stateless = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ stateChecked: [],
+ stateExpanded: [],
+ nodes: nodes(),
+ }),
+ template: `
+
+ expansion/selection should work:
+
+ checked model: {{stateChecked}}
+
+ expanded model: {{stateExpanded}}
+
+
+
+ expansion/selection shouldn't work:
+
+
+ `,
+})
+
+export const Selectable = () => ({
+ components: { VaTreeView, VaRadio },
+ data: () => ({
+ selectionTypeOptions: ['leaf', 'independent'],
+ selectionType: 'leaf',
+ selectedNodes: [],
+ nodes: nodes(),
+ }),
+ template: `
+
Selection strategy
+
+
+ `,
+})
+
+const COLORS_PALETTE = [
+ '#4ae387',
+ '#e34a4a',
+ '#4ab2e3',
+ '#db76df',
+ '#f7cc36',
+ '#f3f3f3',
+ '#000',
+]
+
+const nodesChecked = () => [
+ {
+ id: 1,
+ label: 'Category',
+ checked: true,
+ children: [
+ {
+ id: 2,
+ label: 'Subcategory',
+ checked: true,
+ children: [
+ { id: 3, label: 'Item', checked: true },
+ ],
+ },
+ ],
+ },
+ { id: 4, label: 'Item', checked: true },
+]
+
+export const ColoredCheckboxes = () => ({
+ components: { VaTreeView, VaColorPalette },
+ data: () => ({
+ colorsPalette: COLORS_PALETTE,
+ selectedColor: COLORS_PALETTE[0],
+ nodesChecked: nodesChecked(),
+ }),
+ template: `
+
+
+ `,
+})
+
+export const SelectionModel = () => ({
+ components: { VaTreeView, VaRadio },
+ data: () => ({
+ selectionTypeOptions: ['leaf', 'independent'],
+ selectionType: 'leaf',
+ selectedNodes: [],
+ nodes: nodes(),
+ }),
+ template: `
+
Selection strategy
+
+
+ Single selection model for two tree views:
+
+ {{ selectedNodes }}
+
+
+
+ `,
+})
+
+export const ValueBy = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ selectedNodesValueBy: [],
+ nodes: nodes(),
+ }),
+ template: `
+
{{ selectedNodesValueBy }}
+
+
+ `,
+})
+
+const nodesChildrenBy = () => [
+ {
+ id: 1,
+ label: 'Category',
+ items: [
+ { id: 2, label: 'Item' },
+ {
+ id: 3,
+ label: 'Subcategory',
+ items: [
+ { id: 4, label: 'Item' },
+ { id: 5, label: 'Item' },
+ ],
+ },
+ { id: 6, label: 'Item' },
+ ],
+ },
+ { id: 7, label: 'Item' },
+]
+
+export const ChildrenBy = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodesChildrenBy: nodesChildrenBy(),
+ }),
+ template: `
+
+ `,
+})
+
+const nodesTextBy = () => [
+ {
+ id: 1,
+ title: 'Category',
+ children: [
+ {
+ id: 2,
+ title: 'Subcategory',
+ children: [
+ {
+ id: 3,
+ title: 'Item',
+ },
+ ],
+ },
+ ],
+ },
+ { id: 4, title: 'Item' },
+]
+
+export const TextBy = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodesTextBy: nodesTextBy(),
+ }),
+ template: `
+
+ `,
+})
+
+const nodesTrackBy = () => [
+ {
+ trackId: 1,
+ label: 'Category',
+ children: [
+ {
+ trackId: 2,
+ label: 'Subcategory',
+ children: [
+ {
+ trackId: 3,
+ label: 'Item',
+ },
+ ],
+ },
+ ],
+ },
+ { trackId: 4, label: 'Item' },
+]
+
+export const TrackBy = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodesTrackBy: nodesTrackBy(),
+ }),
+ template: `
+
+ `,
+})
+
+const nodesIconBy = [
+ {
+ id: 1,
+ label: 'Category',
+ image: 'mail',
+ children: [
+ {
+ id: 2,
+ label: 'Subcategory',
+ image: 'mail',
+ children: [
+ { id: 3, label: 'Item' },
+ ],
+ },
+ ],
+ },
+ { id: 4, image: 'mail', label: 'Item' },
+]
+
+export const IconBy = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodesIconBy,
+ }),
+ template: `
+
+ `,
+})
+
+const nodesDisabledBy = () => [
+ {
+ id: 1,
+ label: 'Category',
+ children: [
+ { id: 2, label: 'Item' },
+ {
+ id: 3,
+ label: 'Subcategory',
+ inactive: true,
+ children: [
+ { id: 4, label: 'Item' },
+ ],
+ },
+ { id: 5, label: 'Item' },
+ ],
+ },
+ { id: 6, label: 'Item' },
+]
+
+export const DisabledBy = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodesDisabledBy: nodesDisabledBy(),
+ }),
+ template: `
+
+ `,
+})
+
+const nodesExpandedBy = () => [
+ {
+ id: 1,
+ label: 'Category',
+ shouldExpand: true,
+ children: [
+ { id: 2, label: 'Item' },
+ {
+ id: 3,
+ label: 'Subcategory',
+ shouldExpand: false,
+ children: [
+ { id: 4, label: 'Item' },
+ ],
+ },
+ { id: 5, label: 'Item' },
+ ],
+ },
+ { id: 6, shouldExpand: true, label: 'Item' },
+]
+
+export const ExpandedBy = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodesExpandedBy: nodesExpandedBy(),
+ }),
+ template: `
+
+ `,
+})
+
+export const Expandable = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ nodes: nodes(),
+ expandedNodes: [1],
+ }),
+ template: `
+
Expand all
+
+
Expanded v-model: {{ expandedNodes }}
+
+
+ `,
+})
+
+const filterableNodes = () => [
+ {
+ id: 1,
+ label: 'One',
+ children: [
+ {
+ id: 2,
+ label: 'Two',
+ children: [
+ { id: 3, label: 'Three' },
+ { id: 4, label: 'Four' },
+ ],
+ },
+ ],
+ },
+ { id: 5, label: 'Five' },
+]
+
+export const Filter = () => ({
+ components: { VaTreeView, VaInput, VaCheckbox },
+ data: () => ({
+ filterValue: '',
+ isFilterCaseSensitive: false,
+ filterableNodes: filterableNodes(),
+ }),
+ computed: {
+ customFilterMethod () {
+ return this.isFilterCaseSensitive
+ ? (node, filter, textBy) => node[textBy].includes(filter)
+ : undefined
+ },
+ },
+ template: `
+
+
+
+
+ `,
+})
+
+const customBodyNodes = () => [
+ {
+ id: 1,
+ label: 'Category',
+ description: 'It is absolutely optional',
+ expanded: true,
+ children: [
+ {
+ id: 2,
+ label: 'Photo',
+ description: 'This item works so well with the other one.',
+ image: 'https://picsum.photos/id/450/100',
+ hasAction: true,
+ },
+ {
+ id: 3,
+ label: 'Emoji',
+ description: 'This item corresponds the first item perfectly.',
+ image: 'https://picsum.photos/id/450/100',
+ hasAction: true,
+ },
+ {
+ id: 4,
+ label: 'Password was updated',
+ description: 'This one as well.',
+ children: [
+ { id: 5, label: 'Node' },
+ { id: 6, label: 'It is node also' },
+ ],
+ },
+ ],
+ },
+ {
+ id: 7,
+ label: 'Super category',
+ children: [
+ { id: 8, label: 'Super node' },
+ { id: 9, label: 'Common node' },
+ ],
+ },
+]
+
+export const WithCustomBody = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ customBodyNodes: customBodyNodes(),
+ }),
+ template: `
+
+
+
+
+ {{props.label}}
+
+
+ {{props.description}}
+
+
+
+
+ `,
+})
+
+export const ExpandByNode = () => ({
components: { VaTreeView },
- template: '
',
+ data: () => ({
+ nodesChecked: nodesChecked(),
+ }),
+ template: `
+
Node description text is expandable on click
+
+
Node description text is not expandable on click
+
+ `,
})
diff --git a/packages/ui/src/components/va-tree-view/VaTreeViewKeyboardNavigation.demo.vue b/packages/ui/src/components/va-tree-view/VaTreeViewKeyboardNavigation.demo.vue
deleted file mode 100644
index b0de14b05b..0000000000
--- a/packages/ui/src/components/va-tree-view/VaTreeViewKeyboardNavigation.demo.vue
+++ /dev/null
@@ -1,188 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Selected node: {{selectedNode}}
-
-
-
-
- Checked nodes: {{checkedNodes}}
-
-
-
-
-
-
-
diff --git a/packages/ui/src/components/va-tree-view/VaTreeViewKeyboardNavigation.stories.ts b/packages/ui/src/components/va-tree-view/VaTreeViewKeyboardNavigation.stories.ts
index aabfe5f758..a70b0553be 100644
--- a/packages/ui/src/components/va-tree-view/VaTreeViewKeyboardNavigation.stories.ts
+++ b/packages/ui/src/components/va-tree-view/VaTreeViewKeyboardNavigation.stories.ts
@@ -1,12 +1,221 @@
-import { defineComponent } from 'vue'
-import VaTreeViewKeyboardNavigation from './VaTreeViewKeyboardNavigation.demo.vue'
+import { VaTreeView } from '.'
export default {
title: 'VaTreeViewKeyboardNavigation',
- component: VaTreeViewKeyboardNavigation,
+ component: VaTreeView,
+ tags: ['autodocs'],
}
-export const Default = defineComponent({
- components: { VaTreeViewKeyboardNavigation },
- template: '
',
+const flat = () => [
+ {
+ id: 1,
+ label: 'Item',
+ },
+ {
+ id: 2,
+ label: 'Item',
+ },
+ {
+ id: 3,
+ label: 'Item',
+ },
+]
+
+export const FlatLikeNavigation = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ flat: flat(),
+ }),
+ template: `
+
+ `,
+})
+
+const stairs = () => [
+ {
+ id: 1,
+ label: 'Item',
+ children: [
+ {
+ id: 2,
+ label: 'Item',
+ children: [
+ {
+ id: 3,
+ label: 'Item',
+ children: [
+ {
+ id: 4,
+ label: 'Item',
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ id: 5,
+ label: 'Item',
+ children: [
+ {
+ id: 6,
+ label: 'Item',
+ children: [
+ {
+ id: 7,
+ label: 'Item',
+ children: [
+ {
+ id: 8,
+ label: 'Item',
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+]
+
+export const StairLikeNavigation = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ stairs: stairs(),
+ }),
+ template: `
+
+ `,
+})
+
+const triangle = () => [
+ {
+ id: 1,
+ label: 'Item',
+ children: [
+ {
+ id: 2,
+ label: 'Item',
+ children: [
+ {
+ id: 3,
+ label: 'Item',
+ },
+ {
+ id: 4,
+ label: 'Item',
+ },
+ ],
+ },
+ {
+ id: 5,
+ label: 'Item',
+ },
+ ],
+ },
+ {
+ id: 6,
+ label: 'Item',
+ },
+]
+
+export const TriangleLikeNavigation = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ triangle: triangle(),
+ }),
+ template: `
+
+ `,
+})
+
+const waves = () => [
+ {
+ id: 1,
+ label: 'Item',
+ },
+ {
+ id: 2,
+ label: 'Item',
+ children: [
+ {
+ id: 3,
+ label: 'Item',
+ },
+ ],
+ },
+ {
+ id: 4,
+ label: 'Item',
+ children: [
+ {
+ id: 5,
+ label: 'Item',
+ },
+ ],
+ },
+ {
+ id: 6,
+ label: 'Item',
+ children: [
+ {
+ id: 6,
+ label: 'Item',
+ },
+ ],
+ },
+ {
+ id: 7,
+ label: 'Item',
+ },
+]
+
+export const WavesLikeNavigation = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ waves: waves(),
+ }),
+ template: `
+
+ `,
+})
+
+export const Selection = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ selectedNode: null,
+ triangle: triangle(),
+ }),
+ methods: {
+ onSelectNode (node) {
+ this.selectedNode = node ? `${node.id} ${node.label}` : null
+ },
+ },
+ template: `
+
Selected node: {{selectedNode}}
+
+
+ `,
+})
+
+export const CheckboxsSelection = () => ({
+ components: { VaTreeView },
+ data: () => ({
+ checkedNodes: [],
+ triangle: triangle(),
+ }),
+ template: `
+
Checked nodes: {{checkedNodes}}
+
+
+ `,
})
diff --git a/packages/ui/src/components/va-tree-view/hooks/useTreeView.ts b/packages/ui/src/components/va-tree-view/hooks/useTreeView.ts
index 8201c58b8f..6f215ea28e 100644
--- a/packages/ui/src/components/va-tree-view/hooks/useTreeView.ts
+++ b/packages/ui/src/components/va-tree-view/hooks/useTreeView.ts
@@ -162,7 +162,7 @@ const useTreeView: UseTreeViewFunc = (props, emit) => {
const getFilteredNodes = (nodes: TreeNode[]): TreeNode[] => nodes.filter((node) => {
if (node.children) { node.children = getFilteredNodes(node.children) }
-
+
if (node.children.length === 0) { node.hasChildren = false }
return node.matchesFilter
diff --git a/packages/ui/src/components/va-value/VaValue.demo.vue b/packages/ui/src/components/va-value/VaValue.demo.vue
deleted file mode 100644
index ae2e9c829b..0000000000
--- a/packages/ui/src/components/va-value/VaValue.demo.vue
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
- {{ v.value ? 'clicked' : 'unclicked' }}
-
-
-
-
-
-
-
- {{ v.value ? 'Hide' : 'Show' }}
-
-
-
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet eaque deserunt maiores voluptatibus vitae hic ullam, asperiores, veritatis voluptatem eum obcaecati saepe quibusdam libero porro dolores et nobis! Possimus, labore?
-
-
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet eaque deserunt maiores voluptatibus vitae hic ullam, asperiores, veritatis voluptatem eum obcaecati saepe quibusdam libero porro dolores et nobis! Possimus, labore?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/ui/src/components/va-value/VaValue.stories.ts b/packages/ui/src/components/va-value/VaValue.stories.ts
index ed537daa09..278d1d6360 100644
--- a/packages/ui/src/components/va-value/VaValue.stories.ts
+++ b/packages/ui/src/components/va-value/VaValue.stories.ts
@@ -1,12 +1,50 @@
-import { defineComponent } from 'vue'
-import VaValue from './VaValue.demo.vue'
+import { VaValue } from '.'
+import { VaInput } from '../va-input'
+import { VaButton } from '../va-button'
+import { within, userEvent } from '@storybook/testing-library'
+import { expect } from '@storybook/jest'
+import { sleep } from '../../utils/sleep'
export default {
title: 'VaValue',
component: VaValue,
+ tags: ['autodocs'],
}
-export const Default = defineComponent({
- components: { VaValue },
- template: '
',
+export const Default = () => ({
+ components: { VaValue, VaButton },
+ template: `
+
+ {{ v }}
+
+ Change
+
+
+ `,
+})
+
+Default.play = async ({ canvasElement, step }) => {
+ const canvas = within(canvasElement)
+ const button = canvas.getByRole('button')
+ const value = canvas.getByTestId('value')
+
+ await step('value is false by default', async () => {
+ expect(value.innerText).toEqual('false')
+ })
+
+ await step('and can be reassigned', async () => {
+ userEvent.click(button)
+ await sleep()
+ expect(value.innerText).toEqual('true')
+ })
+}
+
+export const DefaultValue = () => ({
+ components: { VaValue, VaInput },
+ template: `
+
+ {{ v.value.name }}
+
+
+ `,
})
diff --git a/packages/ui/src/composables/useBem.ts b/packages/ui/src/composables/useBem.ts
index 6d946a6c40..31590ba392 100644
--- a/packages/ui/src/composables/useBem.ts
+++ b/packages/ui/src/composables/useBem.ts
@@ -7,7 +7,7 @@ import { isDev } from '../utils/env'
type Key
= `${Prefix}--${ModifierKey}`
-type ClassesObject = Record
+type ClassesObject = Record
type ComputedClasses = ClassesObject & {
// TODO: How to remove it from spread?
@@ -32,7 +32,7 @@ type ComputedClasses = ClassesObject & {
*/
export const useBem = (
prefix: Prefix,
- modifiers: Record | Ref> | (() => Record),
+ modifiers: Record | Ref> | (() => Record),
) => {
if (isDev && !prefix) {
console.warn('You must pass the @param "prefix" to the useBem hook!')
diff --git a/packages/ui/src/services/color/types.ts b/packages/ui/src/services/color/types.ts
index c64ca7a97d..66c577d2a5 100644
--- a/packages/ui/src/services/color/types.ts
+++ b/packages/ui/src/services/color/types.ts
@@ -31,7 +31,7 @@ type Capitalize = S extends `${infer First}${infer Rest}`
type OnColors = `on${Capitalize}`
export type ColorVariables = { [colorName: string]: CssColor } & EssentialVariables & {
- [key in OnColors]: CssColor
+ [key in OnColors]?: CssColor
}
export type ColorConfig = {
diff --git a/packages/vue-cli-plugin/generator/configs/default.js b/packages/vue-cli-plugin/generator/configs/default.js
index 219c186af4..cd0859c157 100644
--- a/packages/vue-cli-plugin/generator/configs/default.js
+++ b/packages/vue-cli-plugin/generator/configs/default.js
@@ -7,7 +7,7 @@ module.exports = {
],
extendPackage: {
dependencies: {
- 'vuestic-ui': '^1.8.0',
+ 'vuestic-ui': '^1.8.3',
}
},
vueUse: [
diff --git a/yarn.lock b/yarn.lock
index ce031783f5..a296c39bf8 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -17831,9 +17831,9 @@ postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.2, postcss@^7.0.21
source-map "^0.6.1"
postcss@^8.1.10, postcss@^8.2.1, postcss@^8.2.15, postcss@^8.2.6, postcss@^8.3.5, postcss@^8.4.18, postcss@^8.4.19, postcss@^8.4.23:
- version "8.4.23"
- resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.23.tgz#df0aee9ac7c5e53e1075c24a3613496f9e6552ab"
- integrity sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==
+ version "8.4.31"
+ resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d"
+ integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==
dependencies:
nanoid "^3.3.6"
picocolors "^1.0.0"