@vc-shell/framework 1.0.38 → 1.0.39

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 (142) hide show
  1. package/components/atoms/vc-badge/vc-badge.stories.ts +27 -0
  2. package/components/atoms/vc-badge/vc-badge.vue +63 -0
  3. package/components/atoms/vc-button/vc-button.stories.ts +34 -0
  4. package/components/atoms/vc-button/vc-button.vue +219 -0
  5. package/components/atoms/vc-card/vc-card.vue +137 -0
  6. package/components/atoms/vc-checkbox/vc-checkbox.stories.ts +25 -0
  7. package/components/atoms/vc-checkbox/vc-checkbox.vue +130 -0
  8. package/components/atoms/vc-col/vc-col.vue +22 -0
  9. package/components/atoms/vc-container/vc-container.stories.ts +31 -0
  10. package/components/atoms/vc-container/vc-container.vue +220 -0
  11. package/components/atoms/vc-hint/vc-hint.stories.ts +23 -0
  12. package/components/atoms/vc-hint/vc-hint.vue +11 -0
  13. package/components/atoms/vc-icon/vc-icon.stories.ts +32 -0
  14. package/components/atoms/vc-icon/vc-icon.vue +36 -0
  15. package/components/atoms/vc-image/vc-image.stories.ts +40 -0
  16. package/components/atoms/vc-image/vc-image.vue +122 -0
  17. package/components/atoms/vc-info-row/vc-info-row.vue +42 -0
  18. package/components/atoms/vc-label/vc-label.stories.ts +23 -0
  19. package/components/atoms/vc-label/vc-label.vue +49 -0
  20. package/components/atoms/vc-link/vc-link.stories.ts +30 -0
  21. package/components/atoms/vc-link/vc-link.vue +46 -0
  22. package/components/atoms/vc-loading/vc-loading.vue +30 -0
  23. package/components/atoms/vc-progress/vc-progress.stories.ts +25 -0
  24. package/components/atoms/vc-progress/vc-progress.vue +65 -0
  25. package/components/atoms/vc-row/vc-row.vue +13 -0
  26. package/components/atoms/vc-status/vc-status.stories.ts +26 -0
  27. package/components/atoms/vc-status/vc-status.vue +78 -0
  28. package/components/atoms/vc-status-icon/vc-status-icon.vue +21 -0
  29. package/components/atoms/vc-switch/vc-switch.stories.ts +27 -0
  30. package/components/atoms/vc-switch/vc-switch.vue +100 -0
  31. package/components/atoms/vc-widget/vc-widget.vue +85 -0
  32. package/components/index.ts +43 -0
  33. package/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +103 -0
  34. package/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +39 -0
  35. package/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +21 -0
  36. package/components/molecules/vc-editor/vc-editor.vue +117 -0
  37. package/components/molecules/vc-file-upload/vc-file-upload.vue +134 -0
  38. package/components/molecules/vc-form/vc-form.stories.ts +23 -0
  39. package/components/molecules/vc-form/vc-form.vue +5 -0
  40. package/components/molecules/vc-input/vc-input.stories.ts +26 -0
  41. package/components/molecules/vc-input/vc-input.vue +443 -0
  42. package/components/molecules/vc-multivalue/vc-multivalue.vue +447 -0
  43. package/components/molecules/vc-notification/vc-notification.vue +101 -0
  44. package/components/molecules/vc-pagination/vc-pagination.stories.ts +23 -0
  45. package/components/molecules/vc-pagination/vc-pagination.vue +169 -0
  46. package/components/molecules/vc-rating/vc-rating.stories.ts +23 -0
  47. package/components/molecules/vc-rating/vc-rating.vue +77 -0
  48. package/components/molecules/vc-select/vc-select.stories.ts +25 -0
  49. package/components/molecules/vc-select/vc-select.vue +402 -0
  50. package/components/molecules/vc-slider/vc-slider.vue +106 -0
  51. package/components/molecules/vc-textarea/vc-textarea.stories.ts +23 -0
  52. package/components/molecules/vc-textarea/vc-textarea.vue +155 -0
  53. package/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +146 -0
  54. package/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +148 -0
  55. package/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +157 -0
  56. package/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +110 -0
  57. package/components/organisms/vc-app/vc-app.stories.ts +75 -0
  58. package/components/organisms/vc-app/vc-app.vue +171 -0
  59. package/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +126 -0
  60. package/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +223 -0
  61. package/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +67 -0
  62. package/components/organisms/vc-blade/vc-blade.stories.ts +46 -0
  63. package/components/organisms/vc-blade/vc-blade.vue +87 -0
  64. package/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +292 -0
  65. package/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +123 -0
  66. package/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +93 -0
  67. package/components/organisms/vc-gallery/vc-gallery.vue +186 -0
  68. package/components/organisms/vc-login-form/vc-login-form.stories.ts +55 -0
  69. package/components/organisms/vc-login-form/vc-login-form.vue +48 -0
  70. package/components/organisms/vc-popup/vc-popup.stories.ts +23 -0
  71. package/components/organisms/vc-popup/vc-popup.vue +97 -0
  72. package/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +113 -0
  73. package/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue +29 -0
  74. package/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +152 -0
  75. package/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +272 -0
  76. package/components/organisms/vc-table/vc-table.stories.ts +99 -0
  77. package/components/organisms/vc-table/vc-table.vue +638 -0
  78. package/core/api/index.ts +1 -0
  79. package/core/api/platform.ts +8332 -0
  80. package/core/composables/index.ts +8 -0
  81. package/core/composables/useAutosave/index.ts +57 -0
  82. package/core/composables/useFunctions/debounce.ts +18 -0
  83. package/core/composables/useFunctions/delay.ts +7 -0
  84. package/core/composables/useFunctions/index.ts +21 -0
  85. package/core/composables/useFunctions/once.ts +14 -0
  86. package/core/composables/useFunctions/sleep.ts +4 -0
  87. package/core/composables/useFunctions/throttle.ts +17 -0
  88. package/core/composables/useI18n/index.ts +28 -0
  89. package/core/composables/useLogger/index.ts +24 -0
  90. package/core/composables/useNotifications/index.ts +116 -0
  91. package/core/composables/usePermissions/index.ts +32 -0
  92. package/core/composables/useSettings/index.ts +36 -0
  93. package/core/composables/useUser/index.ts +266 -0
  94. package/core/directives/autofocus/index.ts +9 -0
  95. package/core/directives/click-outside/index.ts +21 -0
  96. package/core/directives/index.ts +4 -0
  97. package/core/directives/loading/index.ts +28 -0
  98. package/core/directives/permissions/index.ts +20 -0
  99. package/core/plugins/index.ts +1 -0
  100. package/core/plugins/validation/index.ts +2 -0
  101. package/core/plugins/validation/rules.ts +196 -0
  102. package/core/types/index.ts +92 -0
  103. package/core/utilities/camelToSnake.ts +7 -0
  104. package/core/utilities/index.ts +1 -0
  105. package/dist/core/composables/useNotifications/index.d.ts +1 -1
  106. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  107. package/dist/core/composables/useUser/index.d.ts +2 -2
  108. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  109. package/dist/core/plugins/validation/index.d.ts.map +1 -1
  110. package/dist/core/types/index.d.ts +1 -1
  111. package/dist/core/types/index.d.ts.map +1 -1
  112. package/dist/framework.js +70 -97
  113. package/dist/framework.js.map +1 -1
  114. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts +1 -1
  115. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
  116. package/dist/shared/app-switcher/index.d.ts +2 -2
  117. package/dist/shared/app-switcher/index.d.ts.map +1 -1
  118. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts +1 -1
  119. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  120. package/dist/shared/blade-navigation/types/index.d.ts +1 -1
  121. package/dist/shared/blade-navigation/types/index.d.ts.map +1 -1
  122. package/dist/style.css +1 -1
  123. package/dist/tsconfig.tsbuildinfo +1 -0
  124. package/dist/vite.config.d.ts.map +1 -1
  125. package/package.json +11 -8
  126. package/shared/app-switcher/components/index.ts +1 -0
  127. package/shared/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +90 -0
  128. package/shared/app-switcher/composables/index.ts +1 -0
  129. package/shared/app-switcher/composables/useAppSwitcher/index.ts +54 -0
  130. package/shared/app-switcher/index.ts +14 -0
  131. package/shared/assets/components/assets-details/assets-details.vue +138 -0
  132. package/shared/assets/components/index.ts +1 -0
  133. package/shared/assets/index.ts +19 -0
  134. package/shared/assets/locales/en.json +29 -0
  135. package/shared/assets/locales/index.ts +2 -0
  136. package/shared/blade-navigation/components/index.ts +1 -0
  137. package/shared/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +84 -0
  138. package/shared/blade-navigation/composables/index.ts +1 -0
  139. package/shared/blade-navigation/composables/useBladeNavigation/index.ts +216 -0
  140. package/shared/blade-navigation/index.ts +15 -0
  141. package/shared/blade-navigation/types/index.ts +52 -0
  142. package/shared/index.ts +16 -0
@@ -0,0 +1,220 @@
1
+ <template>
2
+ <div
3
+ :class="[
4
+ 'vc-container',
5
+ {
6
+ 'vc-container_shadow': shadow && scroll,
7
+ 'vc-container_nopadding': noPadding,
8
+ },
9
+ ]"
10
+ @touchstart="touchStart"
11
+ @touchmove="touchMove"
12
+ @touchend="touchEnd"
13
+ >
14
+ <div
15
+ ref="component"
16
+ class="vc-container__inner"
17
+ :style="{
18
+ transform: dist ? `translate3d(0, ${dist}px, 0)` : '',
19
+ }"
20
+ >
21
+ <div
22
+ class="vc-container__overscroll"
23
+ :class="{ 'vc-container__overscroll_passed': status === 'loosing' }"
24
+ :style="{ height: dist ? `${dist}px` : '0px' }"
25
+ >
26
+ <VcIcon
27
+ icon="fas fa-spinner"
28
+ :style="{ 'font-size': `${dist / 2}px` }"
29
+ class="vc-container__overscroll-icon"
30
+ ></VcIcon>
31
+ </div>
32
+ <slot></slot>
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <script lang="ts" setup>
38
+ import { ref, onMounted, computed, nextTick } from "vue";
39
+ const props = defineProps({
40
+ shadow: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+
45
+ noPadding: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+
50
+ usePtr: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ });
55
+ const emit = defineEmits(["scroll:ptr", "scroll:infinite"]);
56
+ const component = ref<HTMLElement>();
57
+ const scroll = ref(false);
58
+ const startY = ref(0);
59
+ const ceiling = ref();
60
+ const pullDist = ref(60);
61
+ const dist = ref(0);
62
+ const status = ref("normal");
63
+ const delta = ref(0);
64
+
65
+ onMounted(() => {
66
+ const observer = new ResizeObserver(() => {
67
+ scroll.value = (component.value &&
68
+ component.value.clientHeight < component.value.scrollHeight) as boolean;
69
+ });
70
+
71
+ if (component.value) {
72
+ observer.observe(component.value);
73
+ }
74
+ });
75
+
76
+ const touchable = computed(
77
+ () => status.value !== "refresh" && status.value !== "success"
78
+ );
79
+
80
+ const scrollTop = () => {
81
+ if (component.value) {
82
+ component.value.scroll(0, 0);
83
+ }
84
+ };
85
+ defineExpose({
86
+ scrollTop,
87
+ });
88
+
89
+ function touchStart(e: TouchEvent): void {
90
+ if (!touchable.value) {
91
+ return;
92
+ }
93
+ checkPullStart(e);
94
+ }
95
+
96
+ function touchMove(e: TouchEvent): void {
97
+ if (props.usePtr) {
98
+ const touch = e.touches[0];
99
+ if (!touchable.value) {
100
+ return;
101
+ }
102
+
103
+ if (!ceiling.value) {
104
+ checkPullStart(e);
105
+ }
106
+
107
+ delta.value = touch.clientY - startY.value;
108
+
109
+ if (ceiling.value && delta.value >= 0 && delta.value < 80) {
110
+ e.preventDefault();
111
+
112
+ setStatus(ease(delta.value));
113
+ }
114
+ }
115
+ }
116
+
117
+ function touchEnd(): void {
118
+ if (delta.value && touchable.value) {
119
+ if (status.value === "loosing") {
120
+ nextTick(() => emit("scroll:ptr"));
121
+ }
122
+ setStatus(0);
123
+ }
124
+ }
125
+
126
+ function getScrollTop(el: HTMLElement) {
127
+ const top = el.scrollTop;
128
+
129
+ return Math.max(top, 0);
130
+ }
131
+
132
+ function checkPullStart(e: TouchEvent) {
133
+ ceiling.value = getScrollTop(component.value as HTMLElement) === 0;
134
+
135
+ if (ceiling.value) {
136
+ startY.value = e.touches[0].clientY;
137
+ }
138
+ }
139
+
140
+ function setStatus(distance: number) {
141
+ let stat;
142
+ if (distance === 0) {
143
+ stat = "normal";
144
+ } else {
145
+ stat = distance < pullDist.value ? "pulling" : "loosing";
146
+ }
147
+ dist.value = distance;
148
+ if (stat !== status.value) {
149
+ status.value = stat;
150
+ }
151
+ }
152
+
153
+ function ease(distance: number) {
154
+ const pullDistance = +pullDist.value;
155
+ if (distance > pullDistance) {
156
+ if (distance < pullDistance * 2) {
157
+ distance = pullDistance + (distance - pullDistance) / 2;
158
+ } else {
159
+ distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
160
+ }
161
+ }
162
+ return Math.round(distance);
163
+ }
164
+ </script>
165
+
166
+ <style lang="scss">
167
+ :root {
168
+ --container-scroll-color: #e1eff9;
169
+ --container-scroll-color-hover: #cce4f5;
170
+ --container-scroll-width: 8px;
171
+ --container-scroll-padding: 8px;
172
+ --container-scroll-shadow: 0 3px 2px rgba(0, 0, 0, 0.1) inset,
173
+ 0 -3px 2px rgba(0, 0, 0, 0.1) inset;
174
+ }
175
+
176
+ .vc-container {
177
+ @apply w-full h-full overflow-hidden box-border flex flex-col relative;
178
+
179
+ &_shadow {
180
+ @apply shadow-[0_3px_2px_rgba(0,0,0,0.1)_inset];
181
+ }
182
+
183
+ &__overscroll {
184
+ @apply relative w-full flex items-start justify-center overflow-hidden;
185
+
186
+ &-icon {
187
+ @apply text-[color:#a1c0d4] animate-spin;
188
+ }
189
+
190
+ &_passed &-icon {
191
+ @apply text-[#43b0e6];
192
+ }
193
+ }
194
+
195
+ &__inner {
196
+ @apply relative overflow-y-auto overflow-x-hidden
197
+ flex-1 p-[var(--container-scroll-padding)]
198
+ transition-transform [scrollbar-color:var(--container-scroll-color)] [scrollbar-width:thin];
199
+
200
+ &::-webkit-scrollbar {
201
+ @apply w-[var(--container-scroll-width)] bg-transparent;
202
+ }
203
+
204
+ &::-webkit-scrollbar-track {
205
+ @apply bg-transparent;
206
+ }
207
+
208
+ &::-webkit-scrollbar-thumb {
209
+ @apply bg-[color:var(--container-scroll-color)]
210
+ rounded-[calc(var(--container-scroll-width)/2)]
211
+ overflow-x-hidden
212
+ hover:bg-[color:var(--container-scroll-color-hover)];
213
+ }
214
+ }
215
+
216
+ &_nopadding &__inner {
217
+ @apply p-0;
218
+ }
219
+ }
220
+ </style>
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Hint component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcHint from "./vc-hint.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-hint",
10
+ component: VcHint,
11
+ };
12
+
13
+ const Template: Story = (args) => ({
14
+ components: { VcHint },
15
+ setup() {
16
+ return { args };
17
+ },
18
+ template: '<vc-hint v-bind="args">This is a hint</vc-hint>',
19
+ });
20
+
21
+ export const Hint = Template.bind({});
22
+ Hint.storyName = "vc-hint";
23
+ Hint.args = {};
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div class="text-[color:var(--hint-color)] text-xs">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <style lang="scss">
8
+ :root {
9
+ --hint-color: #a5a5a5;
10
+ }
11
+ </style>
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Icon component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcIcon from "./vc-icon.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-icon",
10
+ component: VcIcon,
11
+ argTypes: {
12
+ size: {
13
+ options: ["xs", "s", "m", "l", "xl"],
14
+ control: { type: "radio" },
15
+ },
16
+ },
17
+ };
18
+
19
+ const Template: Story = (args) => ({
20
+ components: { VcIcon },
21
+ setup() {
22
+ return { args };
23
+ },
24
+ template: '<vc-icon v-bind="args"></vc-icon>',
25
+ });
26
+
27
+ export const Icon = Template.bind({});
28
+ Icon.storyName = "vc-icon";
29
+ Icon.args = {
30
+ icon: "fas fa-star",
31
+ size: "m",
32
+ };
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <i :class="`vc-icon vc-icon_${size} ${icon.toLowerCase()}`" />
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ export interface Props {
7
+ icon?: string;
8
+ size?: "xs" | "s" | "m" | "l" | "xl" | "xxl";
9
+ }
10
+
11
+ withDefaults(defineProps<Props>(), {
12
+ icon: "fas fa-square-full",
13
+ size: "m",
14
+ });
15
+ </script>
16
+
17
+ <style lang="scss">
18
+ :root {
19
+ --icon-size-xs: 12px;
20
+ --icon-size-s: 14px;
21
+ --icon-size-m: 18px;
22
+ --icon-size-l: 20px;
23
+ --icon-size-xl: 22px;
24
+ --icon-size-xxl: 30px;
25
+ }
26
+
27
+ $sizes: xs, s, m, l, xl, xxl;
28
+
29
+ .vc-icon {
30
+ @each $size in $sizes {
31
+ &_#{$size} {
32
+ @apply text-[length:var(--icon-size-#{$size})];
33
+ }
34
+ }
35
+ }
36
+ </style>
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Image component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcImage from "./vc-image.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-image",
10
+ component: VcImage,
11
+ argTypes: {
12
+ aspect: {
13
+ options: ["1x1", "3x2", "4x3", "16x9"],
14
+ control: { type: "radio" },
15
+ },
16
+ size: {
17
+ options: ["auto", "xs", "s", "m", "l", "xl"],
18
+ control: { type: "radio" },
19
+ },
20
+ },
21
+ };
22
+
23
+ const Template: Story = (args) => ({
24
+ components: { VcImage },
25
+ setup() {
26
+ return { args };
27
+ },
28
+ template:
29
+ '<div style="width: 400px"><vc-image v-bind="args"></vc-image></div>',
30
+ });
31
+
32
+ export const Image = Template.bind({});
33
+ Image.storyName = "vc-image";
34
+ Image.args = {
35
+ aspect: "1x1",
36
+ rounded: false,
37
+ clickable: false,
38
+ src: "https://placekitten.com/800/600",
39
+ size: "auto",
40
+ };
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <div class="vc-image" :class="[`vc-image_${size}`]">
3
+ <div
4
+ :class="[
5
+ `vc-image_${aspect}`,
6
+ {
7
+ 'rounded-full pb-[var(--image-padding-bottom-1x1)]': rounded,
8
+ 'rounded-[3px] border border-solid border-[color:#efefef]': bordered,
9
+ 'cursor-pointer': clickable,
10
+ },
11
+ 'relative',
12
+ ]"
13
+ :style="imageHandler"
14
+ @click="onClick"
15
+ >
16
+ <div
17
+ v-if="!src"
18
+ class="absolute w-full h-full flex items-center justify-center text-[#83a3be]"
19
+ >
20
+ <VcIcon icon="fas fa-image" size="xl"></VcIcon>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <script lang="ts" setup>
27
+ import { computed } from "vue";
28
+
29
+ const props = defineProps({
30
+ aspect: {
31
+ type: String,
32
+ default: "1x1",
33
+ },
34
+
35
+ rounded: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+
40
+ bordered: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+
45
+ clickable: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+
50
+ src: {
51
+ type: String,
52
+ default: undefined,
53
+ },
54
+
55
+ size: {
56
+ type: String,
57
+ default: "auto",
58
+ },
59
+
60
+ background: {
61
+ type: String,
62
+ default: "cover",
63
+ },
64
+ });
65
+
66
+ const emit = defineEmits(["click"]);
67
+
68
+ const imageHandler = computed(() => {
69
+ if (props.src) {
70
+ return `background: url(${encodeURI(props.src)}) center / ${
71
+ props.background
72
+ } no-repeat`;
73
+ }
74
+ return undefined;
75
+ });
76
+
77
+ function onClick(): void {
78
+ if (props.clickable) {
79
+ emit("click");
80
+ }
81
+ }
82
+ </script>
83
+
84
+ <style lang="scss">
85
+ :root {
86
+ --image-size-xs: 32px;
87
+ --image-size-s: 48px;
88
+ --image-size-m: 64px;
89
+ --image-size-l: 96px;
90
+ --image-size-xl: 128px;
91
+ --image-size-xxl: 145px;
92
+ }
93
+
94
+ $aspects: (
95
+ 1x1: 100%,
96
+ 16x9: 56.25%,
97
+ 4x3: 75%,
98
+ 3x2: 66.66%,
99
+ );
100
+
101
+ $paddings: xs, s, m, l, xl, xxl;
102
+
103
+ .vc-image {
104
+ @apply inline-block relative;
105
+
106
+ @each $name, $aspect in $aspects {
107
+ &_#{$name} {
108
+ @apply pb-[#{$aspect}];
109
+ }
110
+ }
111
+
112
+ @each $padding in $paddings {
113
+ &_#{$padding} {
114
+ @apply w-[var(--image-size-#{$padding})];
115
+ }
116
+ }
117
+
118
+ &_auto {
119
+ @apply w-full;
120
+ }
121
+ }
122
+ </style>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div class="mb-[11px] last-of-type:mb-0">
3
+ <VcRow>
4
+ <VcCol>
5
+ <VcLabel>
6
+ <span>{{ label }}</span>
7
+ <template v-if="tooltip" v-slot:tooltip>{{ tooltip }}</template>
8
+ </VcLabel>
9
+ </VcCol>
10
+ <VcCol size="2">
11
+ <p class="m-0" v-if="type === 'default'">{{ value }}</p>
12
+ <VcLink v-else-if="type === 'email'">{{ value }}</VcLink>
13
+ </VcCol>
14
+ </VcRow>
15
+ </div>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import { VcLabel, VcRow, VcCol } from "@/components";
20
+
21
+ defineProps({
22
+ label: {
23
+ type: String,
24
+ default: "",
25
+ },
26
+
27
+ value: {
28
+ type: String,
29
+ default: "",
30
+ },
31
+
32
+ tooltip: {
33
+ type: String,
34
+ default: "",
35
+ },
36
+
37
+ type: {
38
+ type: String,
39
+ default: "default",
40
+ },
41
+ });
42
+ </script>
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Label component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcLabel from "./vc-label.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-label",
10
+ component: VcLabel,
11
+ };
12
+
13
+ const Template: Story = (args) => ({
14
+ components: { VcLabel },
15
+ setup() {
16
+ return { args };
17
+ },
18
+ template: '<vc-label v-bind="args">This is a label</vc-label>',
19
+ });
20
+
21
+ export const Label = Template.bind({});
22
+ Label.storyName = "vc-label";
23
+ Label.args = {};
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div class="flex flex-nowrap font-bold">
3
+ <span><slot></slot></span>
4
+ <span v-if="required" class="text-[color:var(--label-required-color)] ml-1"
5
+ >*</span
6
+ >
7
+ <span v-if="$slots['tooltip']" class="grow basis-0 ml-1">
8
+ <VcIcon
9
+ class="text-[color:var(--label-tooltip-color)]"
10
+ :icon="tooltipIcon"
11
+ size="s"
12
+ @mouseenter="tooltipVisible = true"
13
+ @mouseleave="tooltipVisible = false"
14
+ ></VcIcon>
15
+ <span
16
+ class="absolute z-10 bg-white border border-solid border-[color:#eef0f2] shadow-[1px_1px_8px_rgba(126,142,157,0.25)] rounded-[3px] text-[color:#8e9daa] font-normal py-1 px-2 ml-4"
17
+ v-if="tooltipVisible"
18
+ >
19
+ <slot name="tooltip"></slot>
20
+ </span>
21
+ </span>
22
+ </div>
23
+ </template>
24
+
25
+ <script lang="ts" setup>
26
+ import { VcIcon } from "@/components";
27
+ import { ref } from "vue";
28
+
29
+ defineProps({
30
+ required: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+
35
+ tooltipIcon: {
36
+ type: String,
37
+ default: "fas fa-info-circle",
38
+ },
39
+ });
40
+
41
+ const tooltipVisible = ref(false);
42
+ </script>
43
+
44
+ <style lang="scss">
45
+ :root {
46
+ --label-required-color: #f14e4e;
47
+ --label-tooltip-color: #d3e0ee;
48
+ }
49
+ </style>
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Link component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcLink from "./vc-link.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-link",
10
+ component: VcLink,
11
+ argTypes: {
12
+ click: { action: "click", name: "click" },
13
+ },
14
+ };
15
+
16
+ const Template: Story = (args) => ({
17
+ components: { VcLink },
18
+ setup() {
19
+ return { args };
20
+ },
21
+ template: '<vc-link v-bind="args">This is a link</vc-link>',
22
+ });
23
+
24
+ export const Link = Template.bind({});
25
+ Link.storyName = "vc-link";
26
+ Link.args = {
27
+ to: undefined,
28
+ active: false,
29
+ disabled: false,
30
+ };
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div
3
+ class="vc-link"
4
+ :class="{
5
+ 'vc-text-[color:var(--link-text-color-active)] no-underline': active,
6
+ 'cursor-not-allowed text-[color:var(--link-text-color-disabled)] hover:text-[color:var(--link-text-color-disabled)] no-underline':
7
+ disabled,
8
+ }"
9
+ @click="onClick"
10
+ >
11
+ <slot></slot>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ const props = defineProps({
17
+ active: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+
22
+ disabled: {
23
+ type: Boolean,
24
+ default: false,
25
+ },
26
+ });
27
+ const emit = defineEmits(["click"]);
28
+ function onClick(): void {
29
+ if (!props.disabled) {
30
+ emit("click");
31
+ }
32
+ }
33
+ </script>
34
+
35
+ <style lang="scss">
36
+ :root {
37
+ --link-text-color: hsl(200, 77%, 58%);
38
+ --link-text-color-hover: hsl(200, 77%, 48%);
39
+ --link-text-color-active: hsl(200, 77%, 48%);
40
+ --link-text-color-disabled: hsl(200, 77%, 73%);
41
+ }
42
+
43
+ .vc-link {
44
+ @apply text-[color:var(--link-text-color)] no-underline cursor-pointer transition duration-200 inline-block hover:text-[color:var(--link-text-color-hover)] hover:underline;
45
+ }
46
+ </style>