@fastkit/vui 0.6.39 → 0.6.40

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 (188) hide show
  1. package/dist/tool/index.js +3 -0
  2. package/dist/tool/vite-plugin.d.ts.map +1 -1
  3. package/dist/vui.cjs.js +180 -5
  4. package/dist/vui.cjs.prod.js +180 -5
  5. package/dist/vui.css +24 -14
  6. package/dist/vui.d.ts +2430 -12
  7. package/dist/vui.esm-bundler.js +180 -7
  8. package/dist/vui.min.css +1 -1
  9. package/dist/vui.min.css.map +1 -1
  10. package/package.json +8 -7
  11. package/src/.DS_Store +0 -0
  12. package/src/assets/.DS_Store +0 -0
  13. package/src/assets/builtins/color-scheme.ts +9 -0
  14. package/src/assets/builtins/media-match.ts +3 -0
  15. package/src/components/.DS_Store +0 -0
  16. package/src/components/VAccordion/VAccordion.scss +2 -0
  17. package/src/components/VAccordion/VAccordion.tsx +5 -0
  18. package/src/components/VAccordion/index.ts +1 -0
  19. package/src/components/VApp/VApp.tsx +17 -0
  20. package/src/components/VApp/index.ts +1 -0
  21. package/src/components/VBreadcrumbs/VBreadcrumbs.scss +61 -0
  22. package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +137 -0
  23. package/src/components/VBreadcrumbs/index.ts +1 -0
  24. package/src/components/VButton/.DS_Store +0 -0
  25. package/src/components/VButton/VButton.scss +137 -0
  26. package/src/components/VButton/VButton.tsx +148 -0
  27. package/src/components/VButton/VButtonGroup.scss +23 -0
  28. package/src/components/VButton/VButtonGroup.tsx +81 -0
  29. package/src/components/VButton/index.ts +2 -0
  30. package/src/components/VCard/VCard.scss +3 -0
  31. package/src/components/VCard/VCard.tsx +20 -0
  32. package/src/components/VCard/VCardActions.scss +10 -0
  33. package/src/components/VCard/VCardActions.tsx +16 -0
  34. package/src/components/VCard/VCardContent.scss +3 -0
  35. package/src/components/VCard/VCardContent.tsx +16 -0
  36. package/src/components/VCard/index.ts +3 -0
  37. package/src/components/VCheckable/VCheckable.scss +103 -0
  38. package/src/components/VCheckable/VCheckable.tsx +60 -0
  39. package/src/components/VCheckable/index.ts +1 -0
  40. package/src/components/VCheckbox/VCheckbox.scss +56 -0
  41. package/src/components/VCheckbox/VCheckbox.tsx +63 -0
  42. package/src/components/VCheckbox/index.ts +1 -0
  43. package/src/components/VCheckboxGroup/.DS_Store +0 -0
  44. package/src/components/VCheckboxGroup/VCheckboxGroup.tsx +11 -0
  45. package/src/components/VCheckboxGroup/index.ts +1 -0
  46. package/src/components/VContentSwitcher/VContentSwitcher.scss +73 -0
  47. package/src/components/VContentSwitcher/VContentSwitcher.tsx +156 -0
  48. package/src/components/VContentSwitcher/index.ts +1 -0
  49. package/src/components/VControlField/VControlField.scss +183 -0
  50. package/src/components/VControlField/VControlField.tsx +152 -0
  51. package/src/components/VControlField/index.ts +1 -0
  52. package/src/components/VDataTable/VDataTable.scss +230 -0
  53. package/src/components/VDataTable/VDataTable.tsx +761 -0
  54. package/src/components/VDataTable/index.ts +1 -0
  55. package/src/components/VDrawerLayout/VDrawerLayout.scss +26 -0
  56. package/src/components/VDrawerLayout/VDrawerLayout.tsx +35 -0
  57. package/src/components/VDrawerLayout/index.ts +1 -0
  58. package/src/components/VForm/VForm.tsx +77 -0
  59. package/src/components/VForm/index.ts +1 -0
  60. package/src/components/VFormControl/VFormControl.scss +59 -0
  61. package/src/components/VFormControl/VFormControl.tsx +85 -0
  62. package/src/components/VFormControl/index.ts +1 -0
  63. package/src/components/VGrid/VGridContainer.scss +4 -0
  64. package/src/components/VGrid/VGridContainer.tsx +191 -0
  65. package/src/components/VGrid/VGridItem.scss +3 -0
  66. package/src/components/VGrid/VGridItem.tsx +110 -0
  67. package/src/components/VGrid/index.ts +2 -0
  68. package/src/components/VGrid/schemes.ts +28 -0
  69. package/src/components/VHero/.DS_Store +0 -0
  70. package/src/components/VHero/VHero.scss +26 -0
  71. package/src/components/VHero/VHero.tsx +52 -0
  72. package/src/components/VHero/index.ts +1 -0
  73. package/src/components/VIcon/VIcon.scss +22 -0
  74. package/src/components/VIcon/VIcon.tsx +110 -0
  75. package/src/components/VIcon/index.ts +1 -0
  76. package/src/components/VListTile/VListTile.scss +71 -0
  77. package/src/components/VListTile/VListTile.tsx +121 -0
  78. package/src/components/VListTile/index.ts +1 -0
  79. package/src/components/VNavigation/VNavigation.scss +12 -0
  80. package/src/components/VNavigation/VNavigation.tsx +79 -0
  81. package/src/components/VNavigation/VNavigationItem.scss +14 -0
  82. package/src/components/VNavigation/VNavigationItem.tsx +252 -0
  83. package/src/components/VNavigation/index.ts +2 -0
  84. package/src/components/VOption/VOption.scss +61 -0
  85. package/src/components/VOption/VOption.tsx +52 -0
  86. package/src/components/VOption/index.ts +1 -0
  87. package/src/components/VOptionGroup/VOptionGroup.scss +3 -0
  88. package/src/components/VOptionGroup/VOptionGroup.tsx +55 -0
  89. package/src/components/VOptionGroup/index.ts +1 -0
  90. package/src/components/VPagination/VPagination.scss +100 -0
  91. package/src/components/VPagination/VPagination.tsx +346 -0
  92. package/src/components/VPagination/index.ts +1 -0
  93. package/src/components/VPaper/VPaper.scss +37 -0
  94. package/src/components/VPaper/VPaper.tsx +78 -0
  95. package/src/components/VPaper/index.ts +1 -0
  96. package/src/components/VRadio/.DS_Store +0 -0
  97. package/src/components/VRadio/VRadio.scss +66 -0
  98. package/src/components/VRadio/VRadio.tsx +56 -0
  99. package/src/components/VRadio/index.ts +1 -0
  100. package/src/components/VRadioGroup/.DS_Store +0 -0
  101. package/src/components/VRadioGroup/VRadioGroup.tsx +10 -0
  102. package/src/components/VRadioGroup/index.ts +1 -0
  103. package/src/components/VSelect/VSelect.scss +78 -0
  104. package/src/components/VSelect/VSelect.tsx +204 -0
  105. package/src/components/VSelect/index.ts +1 -0
  106. package/src/components/VSwitch/VSwitch.scss +125 -0
  107. package/src/components/VSwitch/VSwitch.tsx +66 -0
  108. package/src/components/VSwitch/index.ts +1 -0
  109. package/src/components/VSwitchGroup/.DS_Store +0 -0
  110. package/src/components/VSwitchGroup/VSwitchGroup.tsx +11 -0
  111. package/src/components/VSwitchGroup/index.ts +1 -0
  112. package/src/components/VTabs/.DS_Store +0 -0
  113. package/src/components/VTabs/VTab.scss +73 -0
  114. package/src/components/VTabs/VTab.tsx +88 -0
  115. package/src/components/VTabs/VTabs.scss +49 -0
  116. package/src/components/VTabs/VTabs.tsx +315 -0
  117. package/src/components/VTabs/index.ts +1 -0
  118. package/src/components/VTextCounter/VTextCounter.scss +3 -0
  119. package/src/components/VTextCounter/VTextCounter.tsx +21 -0
  120. package/src/components/VTextCounter/index.ts +1 -0
  121. package/src/components/VTextField/VTextField.scss +45 -0
  122. package/src/components/VTextField/VTextField.tsx +96 -0
  123. package/src/components/VTextField/index.ts +1 -0
  124. package/src/components/VTextarea/VTextarea.scss +41 -0
  125. package/src/components/VTextarea/VTextarea.tsx +93 -0
  126. package/src/components/VTextarea/index.ts +1 -0
  127. package/src/components/VToolbar/.DS_Store +0 -0
  128. package/src/components/VToolbar/VToolbar.scss +26 -0
  129. package/src/components/VToolbar/VToolbar.tsx +44 -0
  130. package/src/components/VToolbar/VToolbarEdge.scss +27 -0
  131. package/src/components/VToolbar/VToolbarEdge.tsx +35 -0
  132. package/src/components/VToolbar/VToolbarMenu.scss +7 -0
  133. package/src/components/VToolbar/VToolbarMenu.tsx +26 -0
  134. package/src/components/VToolbar/VToolbarTitle.scss +22 -0
  135. package/src/components/VToolbar/VToolbarTitle.tsx +25 -0
  136. package/src/components/VToolbar/index.ts +4 -0
  137. package/src/components/VWysiwygEditor/.DS_Store +0 -0
  138. package/src/components/VWysiwygEditor/VWysiwygEditor.scss +60 -0
  139. package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +293 -0
  140. package/src/components/VWysiwygEditor/index.ts +2 -0
  141. package/src/components/VWysiwygEditor/schemes.ts +65 -0
  142. package/src/components/VWysiwygEditor/tools/bullet-list.ts +18 -0
  143. package/src/components/VWysiwygEditor/tools/format-bold.ts +19 -0
  144. package/src/components/VWysiwygEditor/tools/format-italic.ts +18 -0
  145. package/src/components/VWysiwygEditor/tools/format-underline.ts +18 -0
  146. package/src/components/VWysiwygEditor/tools/history.ts +26 -0
  147. package/src/components/VWysiwygEditor/tools/index.ts +8 -0
  148. package/src/components/VWysiwygEditor/tools/link.ts +57 -0
  149. package/src/components/VWysiwygEditor/tools/ordered-list.ts +21 -0
  150. package/src/components/VWysiwygEditor/tools/text-color.ts +14 -0
  151. package/src/components/index.ts +32 -0
  152. package/src/components/kits.ts +1 -0
  153. package/src/components/loading.ts +1 -0
  154. package/src/composables/.DS_Store +0 -0
  155. package/src/composables/control.ts +118 -0
  156. package/src/composables/elevation.ts +34 -0
  157. package/src/composables/form-selector.scss +11 -0
  158. package/src/composables/form-selector.tsx +101 -0
  159. package/src/composables/index.ts +4 -0
  160. package/src/composables/vui.ts +9 -0
  161. package/src/index.ts +10 -0
  162. package/src/injections.ts +61 -0
  163. package/src/logger.ts +7 -0
  164. package/src/plugin.tsx +76 -0
  165. package/src/schemes/control.ts +7 -0
  166. package/src/schemes/elevation.ts +26 -0
  167. package/src/schemes/index.ts +2 -0
  168. package/src/service.tsx +242 -0
  169. package/src/styles/.DS_Store +0 -0
  170. package/src/styles/after-effects/display-flow.scss +346 -0
  171. package/src/styles/after-effects/spacing.scss +155 -0
  172. package/src/styles/after-effects/text.scss +90 -0
  173. package/src/styles/after-effects.scss +3 -0
  174. package/src/styles/base.scss +14 -0
  175. package/src/styles/control.scss +11 -0
  176. package/src/styles/core/functions.scss +62 -0
  177. package/src/styles/core/typo.scss +56 -0
  178. package/src/styles/core.scss +2 -0
  179. package/src/styles/elevation.scss +9 -0
  180. package/src/styles/group.scss +57 -0
  181. package/src/styles/index.scss +9 -0
  182. package/src/styles/transition.scss +11 -0
  183. package/src/styles/typo.scss +11 -0
  184. package/src/styles/variables.scss +320 -0
  185. package/src/styles/wysiwyg.scss +24 -0
  186. package/src/tool/.DS_Store +0 -0
  187. package/src/tool/index.ts +2 -0
  188. package/src/tool/vite-plugin.ts +281 -0
@@ -0,0 +1,52 @@
1
+ import './VHero.scss';
2
+ import { defineComponent, PropType } from 'vue';
3
+ import {
4
+ renderSlotOrEmpty,
5
+ htmlAttributesPropOptions,
6
+ defineSlotsProps,
7
+ } from '@fastkit/vue-utils';
8
+ import { toScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
9
+ import { VAppContainer } from '@fastkit/vue-app-layout';
10
+
11
+ // Adornment
12
+
13
+ export const VHero = defineComponent({
14
+ name: 'VHero',
15
+ props: {
16
+ ...htmlAttributesPropOptions,
17
+ color: {
18
+ type: String as PropType<ScopeName>,
19
+ default: 'primary',
20
+ },
21
+ tag: {
22
+ type: String,
23
+ default: 'header',
24
+ },
25
+ hTag: {
26
+ type: String,
27
+ default: 'h1',
28
+ },
29
+ ...defineSlotsProps<{
30
+ default: void;
31
+ adornment: void;
32
+ }>(),
33
+ },
34
+ setup(props, ctx) {
35
+ return () => {
36
+ const TagName = props.tag as 'header';
37
+ const HTagName = props.hTag as 'h1';
38
+ const adornment = renderSlotOrEmpty(ctx.slots, 'adornment');
39
+
40
+ return (
41
+ <VAppContainer pulled>
42
+ <TagName class={['v-hero', toScopeColorClass(props.color)]}>
43
+ <HTagName class="v-hero__title">
44
+ {renderSlotOrEmpty(ctx.slots, 'default')}
45
+ </HTagName>
46
+ {adornment && <div class="v-hero__adornment">{adornment}</div>}
47
+ </TagName>
48
+ </VAppContainer>
49
+ );
50
+ };
51
+ },
52
+ });
@@ -0,0 +1 @@
1
+ export * from './VHero';
@@ -0,0 +1,22 @@
1
+ .v-icon {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ width: 1.25em;
6
+ // -webkit-user-drag: none;
7
+ // pointer-events: none;
8
+ user-select: none;
9
+ aspect-ratio: 1 / 1;
10
+
11
+ &--clickable {
12
+ // pointer-events: auto;
13
+ cursor: pointer;
14
+ }
15
+
16
+ &__body {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ transition: transform 150ms linear;
21
+ }
22
+ }
@@ -0,0 +1,110 @@
1
+ import './VIcon.scss';
2
+ import {
3
+ defineComponent,
4
+ PropType,
5
+ computed,
6
+ CSSProperties,
7
+ VNodeChild,
8
+ VNodeProps,
9
+ } from 'vue';
10
+ import { createPropsOptions, ExtractPropInput } from '@fastkit/vue-utils';
11
+ import type { IconName } from '@fastkit/icon-font';
12
+
13
+ export type { IconName } from '@fastkit/icon-font';
14
+ export { ICON_NAMES } from '@fastkit/icon-font';
15
+
16
+ type IconPropInout = ExtractPropInput<typeof iconProps>;
17
+
18
+ type IconGenerator = (input: IconPropInout) => VNodeChild;
19
+
20
+ type EmptyIconSymbol = '$empty';
21
+
22
+ type ToggleableIconHook = (gen: IconGenerator, ctx: boolean) => VNodeChild;
23
+
24
+ export type RawIconProp = IconName | EmptyIconSymbol | ToggleableIconHook;
25
+
26
+ // export function toRawIconProp<T = void>(
27
+ // prop: RawIconProp<T>,
28
+ // payload: () => T,
29
+ // ): RawIconProp {
30
+ // if (!prop || typeof prop !== 'function') {
31
+ // return prop;
32
+ // }
33
+ // const fn = (gen: IconGenerator): VNodeChild => {
34
+ // const t = payload();
35
+ // return prop(gen, t);
36
+ // };
37
+ // return fn;
38
+ // }
39
+
40
+ // export const rawRawIconProp = [String, Function] as PropType<RawIconProp>;
41
+ const _rawIconProp = [String, Function];
42
+
43
+ export function rawIconProp() {
44
+ return _rawIconProp as PropType<RawIconProp>;
45
+ }
46
+
47
+ export function resolveRawIconProp(
48
+ payload: boolean,
49
+ prop?: RawIconProp,
50
+ extraProps?: Record<string, unknown> & VNodeProps,
51
+ ): VNodeChild {
52
+ if (!prop) return;
53
+
54
+ return typeof prop === 'function' ? (
55
+ prop(
56
+ (input: IconPropInout) => <VIcon {...input} {...(extraProps as any)} />,
57
+ payload,
58
+ )
59
+ ) : (
60
+ <VIcon {...(extraProps as any)} name={prop} />
61
+ );
62
+ }
63
+
64
+ export const iconProps = createPropsOptions({
65
+ name: {
66
+ type: String as PropType<IconName | EmptyIconSymbol>,
67
+ required: true,
68
+ },
69
+ rotate: {
70
+ type: Number,
71
+ },
72
+ });
73
+
74
+ export const VIcon = defineComponent({
75
+ name: 'VIcon',
76
+ props: {
77
+ ...iconProps,
78
+ },
79
+ emits: {} as {
80
+ click: (ev: MouseEvent) => true;
81
+ },
82
+ setup(props, ctx) {
83
+ const iconName = computed(() => props.name);
84
+ const clickable = computed(
85
+ () => typeof (ctx.attrs as any).onClick !== 'undefined',
86
+ );
87
+ const classes = computed(() => [
88
+ {
89
+ 'v-icon--clickable': clickable.value,
90
+ },
91
+ ]);
92
+ const bodyClasses = computed(() => `icon-${iconName.value}`);
93
+ const bodyStyles = computed<CSSProperties | undefined>(() => {
94
+ const { rotate } = props;
95
+ if (!rotate) return;
96
+ return {
97
+ transform: `rotate(${rotate}deg)`,
98
+ };
99
+ });
100
+
101
+ return () => (
102
+ <span class={[`v-icon notranslate`, classes.value]}>
103
+ <i
104
+ class={['v-icon__body icon', bodyClasses.value]}
105
+ style={bodyStyles.value}
106
+ />
107
+ </span>
108
+ );
109
+ },
110
+ });
@@ -0,0 +1 @@
1
+ export * from './VIcon';
@@ -0,0 +1,71 @@
1
+ .v-list-tile {
2
+ --tile-background: var(--main-color, transparent);
3
+ --tile-active-background: var(--deep-color, transparent);
4
+ --tile-text-color: var(--text-color);
5
+ --tile-text-active-color: var(--text-color);
6
+ --tile-pin-color: transparent;
7
+ --paper-link-color: var(--tile-text-color);
8
+
9
+ // &--has-color {
10
+ // --tile-text-color: var(--nav-color);
11
+ // --tile-text-active-color: var(--navActive-color, var(--nav-color));
12
+ // }
13
+
14
+ display: flex;
15
+ align-items: center;
16
+ width: 100%;
17
+ padding: 10px;
18
+ color: var(--tile-text-color);
19
+ text-align: left;
20
+ text-decoration: none;
21
+ user-select: none;
22
+ background: var(--tile-background);
23
+ border: 0;
24
+ border-left: 3px solid var(--tile-pin-color);
25
+ border-radius: 0;
26
+ outline: 0;
27
+ transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
28
+ background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
29
+ appearance: none;
30
+
31
+ &--clickable {
32
+ cursor: pointer;
33
+
34
+ --tile-text-color: var(--nav-color);
35
+ --tile-text-active-color: var(--navActive-color, var(--nav-color));
36
+
37
+ // --tile-text-active-color: var(--navActive-color, var(--tile-text-color));
38
+
39
+ &:hover,
40
+ &:focus {
41
+ --tile-background: var(--tile-active-background);
42
+ --tile-text-color: var(--tile-text-active-color);
43
+ }
44
+ }
45
+
46
+ &--active {
47
+ --tile-pin-color: var(--pin-color);
48
+ --tile-text-color: var(--tile-text-active-color);
49
+ --tile-background: var(--tile-active-background);
50
+ }
51
+
52
+ // .v-list-tile--opened & {
53
+ // --tile-pin-color: var(--pin-color);
54
+ // }
55
+
56
+ &__body {
57
+ font-size: 0.8125rem;
58
+ // font-size: 0.75rem;
59
+ font-weight: 500;
60
+ line-height: 1.5;
61
+ }
62
+
63
+ &__icon {
64
+ min-width: 2em;
65
+
66
+ &--end {
67
+ margin-left: auto;
68
+ text-align: right;
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,121 @@
1
+ import './VListTile.scss';
2
+ import {
3
+ defineComponent,
4
+ computed,
5
+ PropType,
6
+ VNodeChild,
7
+ ComputedRef,
8
+ watch,
9
+ } from 'vue';
10
+ import { rawIconProp, resolveRawIconProp } from '../VIcon';
11
+ import {
12
+ renderSlotOrEmpty,
13
+ navigationableInheritProps,
14
+ createPropsOptions,
15
+ } from '@fastkit/vue-utils';
16
+ import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
17
+ import { useLink } from 'vue-router';
18
+ import { VLink } from '@fastkit/vue-utils';
19
+
20
+ export function createListTileProps() {
21
+ const icon = rawIconProp();
22
+ return {
23
+ ...navigationableInheritProps,
24
+ ...createPropsOptions({
25
+ startIcon: icon,
26
+ endIcon: icon,
27
+ linkFallbackTag: {
28
+ type: String,
29
+ default: 'div',
30
+ },
31
+ startIconEmptySpace: Boolean,
32
+ color: String as PropType<ScopeName>,
33
+ exactMatch: Boolean,
34
+ }),
35
+ };
36
+ }
37
+
38
+ export const listTileEmits = {
39
+ changeActive: (isActive: boolean) => true,
40
+ };
41
+
42
+ export const VListTile = defineComponent({
43
+ name: 'VListTile',
44
+ inheritAttrs: false,
45
+ props: createListTileProps(),
46
+ emits: {
47
+ ...listTileEmits,
48
+ },
49
+ setup(props, ctx) {
50
+ const startIcon: ComputedRef<VNodeChild> = computed(() => {
51
+ let icon = resolveRawIconProp(false, props.startIcon);
52
+ if (!icon && props.startIconEmptySpace) {
53
+ icon = resolveRawIconProp(false, '$empty');
54
+ }
55
+ return icon;
56
+ });
57
+ const endIcon: ComputedRef<VNodeChild> = computed(() =>
58
+ resolveRawIconProp(false, props.endIcon),
59
+ );
60
+
61
+ const hasTo = computed(() => !!ctx.attrs.to);
62
+
63
+ const link = useLink({ to: (ctx.attrs.to as any) || '' });
64
+
65
+ const isActive = computed(() => {
66
+ if (!hasTo.value) return false;
67
+ return props.exactMatch ? link.isExactActive.value : link.isActive.value;
68
+ });
69
+
70
+ const color = useScopeColorClass(props);
71
+ const classes: ComputedRef<any[]> = computed(() => {
72
+ const _color = color.value;
73
+ const hasColor = !!_color.value;
74
+
75
+ return [
76
+ color.value.className,
77
+ {
78
+ 'v-list-tile--plain': !hasColor,
79
+ 'v-list-tile--has-color': hasColor,
80
+ 'v-list-tile--active': isActive.value,
81
+ },
82
+ ];
83
+ });
84
+
85
+ watch(
86
+ () => isActive.value,
87
+ (isActive) => {
88
+ ctx.emit('changeActive', isActive);
89
+ },
90
+ {
91
+ immediate: true,
92
+ },
93
+ );
94
+
95
+ return () => {
96
+ const _startIcon = startIcon.value;
97
+ const _endIcon = endIcon.value;
98
+
99
+ return (
100
+ <VLink
101
+ {...ctx.attrs}
102
+ class={['v-list-tile', classes.value]}
103
+ clickableClassName="v-list-tile--clickable">
104
+ {_startIcon && (
105
+ <span class="v-list-tile__icon v-list-tile__icon--start">
106
+ {_startIcon}
107
+ </span>
108
+ )}
109
+ <span class="v-list-tile__body">
110
+ {renderSlotOrEmpty(ctx.slots, 'default')}
111
+ </span>
112
+ {_endIcon && (
113
+ <span class="v-list-tile__icon v-list-tile__icon--end">
114
+ {_endIcon}
115
+ </span>
116
+ )}
117
+ </VLink>
118
+ );
119
+ };
120
+ },
121
+ });
@@ -0,0 +1 @@
1
+ export * from './VListTile';
@@ -0,0 +1,12 @@
1
+ .v-navigation {
2
+ // noop
3
+ &__caption {
4
+ display: block;
5
+ padding: calc(var(--root-em) * 0.625) calc(var(--root-em) * 1.5625);
6
+ margin: 1em 0 0;
7
+ // font-size: 0.6875rem;
8
+ font-size: 0.75rem;
9
+ color: var(--caption-color);
10
+ text-transform: uppercase;
11
+ }
12
+ }
@@ -0,0 +1,79 @@
1
+ import './VNavigation.scss';
2
+ import {
3
+ defineComponent,
4
+ computed,
5
+ PropType,
6
+ VNodeChild,
7
+ onBeforeUpdate,
8
+ ref,
9
+ } from 'vue';
10
+ import {
11
+ NavigationItemInput,
12
+ renderNavigationItemInput,
13
+ } from './VNavigationItem';
14
+ import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
15
+
16
+ export const VNavigation = defineComponent({
17
+ name: 'VNavigation',
18
+ props: {
19
+ items: {
20
+ type: Array as PropType<NavigationItemInput[]>,
21
+ required: true,
22
+ },
23
+ color: String as PropType<ScopeName>,
24
+ startIconEmptySpace: {
25
+ type: Boolean,
26
+ default: true,
27
+ },
28
+ caption: [String, Function] as PropType<VNodeChild | (() => VNodeChild)>,
29
+ },
30
+ setup(props, ctx) {
31
+ const items = computed(() => props.items);
32
+ const color = useScopeColorClass(props);
33
+ const classes = computed(() => [color.value.className]);
34
+ const startIconEmptySpace = computed(() => props.startIconEmptySpace);
35
+ const caption = computed(() => {
36
+ const c = props.caption;
37
+ return typeof c === 'function' ? c() : c;
38
+ });
39
+ const itemsRef = ref<{ key: string | number; ref: any }[]>([]);
40
+
41
+ onBeforeUpdate(() => {
42
+ itemsRef.value = [];
43
+ });
44
+
45
+ function setItemRef(item: NavigationItemInput, itemRef: any) {
46
+ itemsRef.value.push({ key: item.key, ref: itemRef });
47
+ }
48
+
49
+ function onItemActivated(item: NavigationItemInput) {
50
+ itemsRef.value.forEach(({ key, ref }) => {
51
+ if (key === item.key) return;
52
+ ref.close();
53
+ });
54
+ }
55
+
56
+ return () => {
57
+ const $caption = caption.value;
58
+ return (
59
+ <nav class={['v-navigation', classes.value]}>
60
+ {!!$caption && <div class="v-navigation__caption">{$caption}</div>}
61
+ {items.value.map((item) =>
62
+ renderNavigationItemInput(item, {
63
+ class: 'v-navigation__item',
64
+ startIconEmptySpace: startIconEmptySpace.value,
65
+ ref: (ref: any) => {
66
+ setItemRef(item, ref);
67
+ },
68
+ onChangeActive: (isActive: boolean) => {
69
+ if (isActive /* && item.children && item.children.length*/) {
70
+ onItemActivated(item);
71
+ }
72
+ },
73
+ }),
74
+ )}
75
+ </nav>
76
+ );
77
+ };
78
+ },
79
+ });
@@ -0,0 +1,14 @@
1
+ .v-navigation-item {
2
+ &--opened {
3
+ --tile-background: var(--tile-active-background);
4
+ --tile-text-color: var(--tile-text-active-color);
5
+ }
6
+
7
+ &__expand {
8
+ transition: height 0.2s;
9
+
10
+ .v-navigation-item {
11
+ --tile-background: var(--tile-active-background);
12
+ }
13
+ }
14
+ }