mediacube-ui 0.1.347 → 0.1.349

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 (107) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/mediacube-ui.common.js +384 -0
  3. package/package.json +11 -4
  4. package/src/elements/McAvatar/McAvatar.vue +276 -0
  5. package/src/elements/McBadge/McBadge.vue +153 -0
  6. package/src/elements/McButton/McButton.vue +850 -0
  7. package/src/elements/McChip/McChip.vue +305 -0
  8. package/src/elements/McCropper/McCropper.vue +135 -0
  9. package/src/elements/McDate/McDate.vue +107 -0
  10. package/src/elements/McDatePicker/McDatePicker.vue +910 -0
  11. package/src/elements/McField/McFieldCheckbox/McFieldCheckbox.vue +339 -0
  12. package/src/elements/McField/McFieldRadio/McFieldRadioButton/McFieldRadioButton.vue +207 -0
  13. package/src/elements/McField/McFieldRadio/McFieldRadioGroup/McFieldRadioGroup.vue +198 -0
  14. package/src/elements/McField/McFieldSelect/McFieldSelect.vue +1088 -0
  15. package/src/elements/McField/McFieldText/McFieldText.vue +977 -0
  16. package/src/elements/McField/McFieldToggle/McFieldToggle.vue +273 -0
  17. package/src/elements/McInfinityLoadingIndicator/McInfinityLoadingIndicator.vue +97 -0
  18. package/src/elements/McNotification/McNotification.vue +215 -0
  19. package/src/elements/McProgress/McProgress.vue +223 -0
  20. package/src/elements/McRangeSlider/McRangeSlider.vue +199 -0
  21. package/src/elements/McSeparator/McSeparator.vue +143 -0
  22. package/src/elements/McSlideUpDown/McSlideUpDown.vue +157 -0
  23. package/src/elements/McSvgIcon/McSvgIcon.vue +128 -0
  24. package/src/elements/McTabs/McTab/McTab.vue +189 -0
  25. package/src/elements/McTabs/McTabs/McTabs.vue +538 -0
  26. package/src/elements/McTitle/McTitle.vue +370 -0
  27. package/src/elements/McTooltip/McTooltip.vue +339 -0
  28. package/src/helpers/consts.js +3 -0
  29. package/src/helpers/delayedAction.js +26 -0
  30. package/src/helpers/storybookFunctions.js +19 -0
  31. package/src/helpers/storybookVariables.js +24 -0
  32. package/src/mixins/equalFieldHeight.js +59 -0
  33. package/src/mixins/fieldErrors.js +28 -0
  34. package/src/patterns/McAccordion/McAccordion.vue +53 -0
  35. package/src/patterns/McCells/McCell/McCell.vue +102 -0
  36. package/src/patterns/McChat/McChat.vue +306 -0
  37. package/src/patterns/McChat/McChatComment/McChatComment.vue +268 -0
  38. package/src/patterns/McChat/McChatForm/McChatForm.vue +150 -0
  39. package/src/patterns/McCollapse/McCollapse.vue +282 -0
  40. package/src/patterns/McDrawer/McDrawer.vue +150 -0
  41. package/src/patterns/McDropdown/McDropdown.vue +249 -0
  42. package/src/patterns/McDropdown/McDropdownPanel/McDropdownPanel.vue +44 -0
  43. package/src/patterns/McFakeScroll/McFakeScroll.vue +279 -0
  44. package/src/patterns/McFilter/McFilter.vue +847 -0
  45. package/src/patterns/McFilter/McFilterChip/McFilterChip.vue +85 -0
  46. package/src/patterns/McFilter/McFilterTags/McFilterTags.vue +376 -0
  47. package/src/patterns/McFilter/McFilterTypeDate/McFilterTypeDate.vue +70 -0
  48. package/src/patterns/McFilter/McFilterTypeRange/McFilterTypeRange.vue +133 -0
  49. package/src/patterns/McFilter/McFilterTypeRelation/McFilterTypeRelation.vue +224 -0
  50. package/src/patterns/McFilter/McFilterTypeSimple/McFilterTypeSimple.vue +164 -0
  51. package/src/patterns/McFilter/McFilterTypeText/McFilterTypeText.vue +62 -0
  52. package/src/patterns/McGrid/McGridCol/McGridCol.vue +166 -0
  53. package/src/patterns/McGrid/McGridRow/McGridRow.vue +158 -0
  54. package/src/patterns/McModal/McModal.vue +686 -0
  55. package/src/patterns/McOverlay/McOverlay.vue +79 -0
  56. package/src/patterns/McPreview/McPreview.vue +119 -0
  57. package/src/patterns/McSideBar/McSideBar/McSideBar.vue +389 -0
  58. package/src/patterns/McSideBar/McSideBarBottom/McSideBarBottom.vue +126 -0
  59. package/src/patterns/McSideBar/McSideBarButton/McSideBarButton.vue +257 -0
  60. package/src/patterns/McSideBar/McSideBarCenter/McSideBarCenter.vue +369 -0
  61. package/src/patterns/McSideBar/McSideBarTop/McSideBarTop.vue +243 -0
  62. package/src/patterns/McStack/McStack.vue +163 -0
  63. package/src/patterns/McTable/McTable/McTable.vue +860 -0
  64. package/src/patterns/McTable/McTableCol/McTableCol.vue +299 -0
  65. package/src/patterns/McTableCard/McTableCard.vue +138 -0
  66. package/src/patterns/McTableCard/McTableCardHeader/McTableCardHeader.vue +76 -0
  67. package/src/patterns/McTopBar/McTopBar.vue +155 -0
  68. package/src/patterns/McWrapScroll/McWrapScroll.vue +293 -0
  69. package/src/styles/_functions.scss +189 -0
  70. package/src/styles/_mixins.scss +619 -0
  71. package/src/styles/_spacing.scss +33 -0
  72. package/src/styles/_variables.scss +23 -0
  73. package/src/styles/global.scss +311 -0
  74. package/src/styles/main.scss +4 -0
  75. package/src/styles/table.scss +12 -0
  76. package/src/styles/toast.scss +59 -0
  77. package/src/templates/layouts/McContentFixed/McContentFixed.vue +60 -0
  78. package/src/templates/layouts/McMain/McMain.vue +115 -0
  79. package/src/templates/layouts/McRoot/McRoot.vue +45 -0
  80. package/src/tokens/animations.scss +9 -0
  81. package/src/tokens/border-radius.scss +26 -0
  82. package/src/tokens/box-shadows.scss +28 -0
  83. package/src/tokens/colors.scss +82 -0
  84. package/src/tokens/durations.scss +7 -0
  85. package/src/tokens/easings.scss +6 -0
  86. package/src/tokens/font-families.scss +8 -0
  87. package/src/tokens/font-sizes.scss +23 -0
  88. package/src/tokens/font-weights.scss +9 -0
  89. package/src/tokens/gradients.scss +19 -0
  90. package/src/tokens/letter-spacings.scss +6 -0
  91. package/src/tokens/line-heights.scss +22 -0
  92. package/src/tokens/media-queries.scss +32 -0
  93. package/src/tokens/opacities.scss +8 -0
  94. package/src/tokens/sizes.scss +47 -0
  95. package/src/tokens/spacings.scss +38 -0
  96. package/src/tokens/z-indexes.scss +14 -0
  97. package/src/utils/dayjs.js +19 -0
  98. package/src/utils/filters.js +11 -0
  99. package/src/utils/getTokens.js +41 -0
  100. package/src/utils/load-icons.js +3 -0
  101. package/src/utils/treeSearch.js +30 -0
  102. package/src/utils/webFontLoader.js +12 -0
  103. package/dist/0.mediacube-ui.umd.js +0 -50
  104. package/dist/assets/img/icons.3b7d59b2f49c67a2a3a4566b8ab233fd.svg +0 -1
  105. package/dist/assets/img/no_table_data.236cd56f46cfb71fc363b008d4ca70d5.png +0 -0
  106. package/dist/assets/img/no_user.e0030d6e54e2400e1181fd22b83cf8ae.png +0 -0
  107. package/dist/mediacube-ui.umd.js +0 -1
@@ -0,0 +1,305 @@
1
+ <template>
2
+ <section class="mc-chip" tabindex="0" :class="classes" :style="styles">
3
+ <div v-if="$slots.icon" class="mc-chip__icon">
4
+ <!-- @slot Слот для иконки -->
5
+ <slot name="icon" />
6
+ </div>
7
+ <div v-if="title || $slots.default" class="mc-chip__title">
8
+ <!-- @slot контента -->
9
+ <slot>
10
+ {{ title }}
11
+ </slot>
12
+ </div>
13
+ <div v-if="counter || counter === 0" class="mc-chip__counter">
14
+ {{ counter }}
15
+ </div>
16
+ <button v-if="closable" class="mc-chip__button" type="button" v-on="$listeners">
17
+ <!-- @slot Слот для пользовательской кнопки -->
18
+ <slot name="button">
19
+ <mc-svg-icon size="200" name="cancel" />
20
+ </slot>
21
+ </button>
22
+ </section>
23
+ </template>
24
+
25
+ <script>
26
+ import McSvgIcon from '../McSvgIcon/McSvgIcon'
27
+ export default {
28
+ name: 'McChip',
29
+ components: { McSvgIcon },
30
+ props: {
31
+ /**
32
+ * Text content
33
+ *
34
+ */
35
+ title: {
36
+ type: String,
37
+ default: '',
38
+ },
39
+ /**
40
+ * Кнопка закрытия
41
+ *
42
+ */
43
+ closable: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ /**
48
+ * Дизайн:
49
+ * `purple, purple-invert т.д.`
50
+ */
51
+ variation: {
52
+ type: String,
53
+ default: 'transparent',
54
+ },
55
+ /**
56
+ * Счетчик
57
+ *
58
+ */
59
+ counter: {
60
+ type: [Number, String],
61
+ default: null,
62
+ },
63
+ /**
64
+ * Размер
65
+ * m, m-compact, s, s-compact, xs, xs-compact
66
+ */
67
+ size: {
68
+ type: String,
69
+ default: 'm',
70
+ },
71
+ /**
72
+ * Если нужен
73
+ * иной цвет текста
74
+ */
75
+ textColor: {
76
+ type: String,
77
+ default: '',
78
+ },
79
+ },
80
+
81
+ computed: {
82
+ classes() {
83
+ return {
84
+ [`mc-chip--variation-${this.chipOptions.variation}`]: this.variation,
85
+ [`mc-chip--size-${this.size}`]: this.size,
86
+ }
87
+ },
88
+ chipOptions() {
89
+ const variationProps = this.variation?.split('-')
90
+ const currentVariation = variationProps[variationProps.length - 1]
91
+ let color
92
+ let variation
93
+ switch (currentVariation) {
94
+ case 'outline':
95
+ case 'invert': {
96
+ variation = currentVariation
97
+ color = this.variation.replace(`-${currentVariation}`, '')
98
+ break
99
+ }
100
+ default: {
101
+ variation = 'default'
102
+ color = this.variation
103
+ break
104
+ }
105
+ }
106
+ return {
107
+ color,
108
+ variation,
109
+ }
110
+ },
111
+ styles() {
112
+ const textColor = this.textColor || 'white'
113
+ return {
114
+ ['--mc-chip-color']: `var(--color-${this.chipOptions.color})`,
115
+ ['--mc-chip-text-color']: `var(--color-${textColor})`,
116
+ }
117
+ },
118
+ },
119
+ }
120
+ </script>
121
+
122
+ <style lang="scss">
123
+ @import '../../styles/mixins';
124
+ @import '../../tokens/durations';
125
+ @import '../../tokens/font-families';
126
+ @import '../../tokens/colors';
127
+ @import '../../tokens/font-sizes';
128
+ @import '../../tokens/line-heights';
129
+ @import '../../tokens/spacings';
130
+ @import '../../tokens/sizes';
131
+ .mc-chip {
132
+ $block-name: &;
133
+ --mc-chip-text-color: #{$color-black};
134
+ --mc-chip-color: #{$color-white};
135
+ overflow: hidden;
136
+ display: inline-flex;
137
+ position: relative;
138
+ align-items: center;
139
+ color: var(--mc-chip-color);
140
+ font-family: $font-family-main;
141
+ font-size: $font-size-200;
142
+ line-height: $line-height-200;
143
+ max-width: 100%;
144
+ border-radius: 100px;
145
+ vertical-align: middle;
146
+ outline: none;
147
+ z-index: 0;
148
+ flex-shrink: 0;
149
+ overflow: visible;
150
+ &:before {
151
+ content: '';
152
+ position: absolute;
153
+ left: 0;
154
+ right: 0;
155
+ z-index: 0;
156
+ @include size(100%);
157
+ border-radius: inherit;
158
+ background-color: var(--mc-chip-color);
159
+ }
160
+ > * {
161
+ margin-right: $space-50;
162
+ z-index: 1;
163
+ }
164
+ > *:first-child {
165
+ margin-left: $space-50;
166
+ }
167
+
168
+ &--size {
169
+ @mixin padding-x($space, $space-compact) {
170
+ padding-right: $space;
171
+ padding-left: $space;
172
+ &-compact {
173
+ padding-right: $space-compact;
174
+ padding-left: $space-compact;
175
+ }
176
+ }
177
+
178
+ &-m {
179
+ &,
180
+ &-compact {
181
+ height: $size-400;
182
+ }
183
+ @include padding-x($space-100, $space-50);
184
+ }
185
+ &-s {
186
+ &,
187
+ &-compact {
188
+ height: $size-300;
189
+ }
190
+ @include padding-x($space-100, $space-50);
191
+ }
192
+ &-xs {
193
+ &,
194
+ &-compact {
195
+ height: $space-200;
196
+ font-size: $font-size-100;
197
+ line-height: $line-height-150;
198
+ }
199
+
200
+ @include padding-x($space-50, 0);
201
+ }
202
+ }
203
+
204
+ &__icon {
205
+ display: flex;
206
+ justify-content: center;
207
+ align-items: center;
208
+ margin-left: 0;
209
+ }
210
+
211
+ &__title {
212
+ @include ellipsis();
213
+ @include layout-flex-fix();
214
+ color: var(--mc-chip-text-color);
215
+ &:empty {
216
+ display: none;
217
+ }
218
+ }
219
+
220
+ &__counter {
221
+ flex: 0 0 auto;
222
+ font-family: $font-family-main;
223
+ font-size: $font-size-200;
224
+ line-height: $line-height-200;
225
+ color: $color-dark-gray;
226
+
227
+ &:empty {
228
+ display: none;
229
+ }
230
+ }
231
+
232
+ &__button {
233
+ @include size($size-200);
234
+ position: relative;
235
+ display: flex;
236
+ flex: 0 0 auto;
237
+ justify-content: center;
238
+ align-items: center;
239
+ padding: 0;
240
+ margin-right: 0;
241
+ border-radius: 0;
242
+ user-select: none;
243
+ text-decoration: none;
244
+ text-transform: none;
245
+ background-color: transparent;
246
+ background-image: none;
247
+ cursor: pointer;
248
+ outline: 0;
249
+ border: none;
250
+ transition: all $duration-s;
251
+ flex-wrap: nowrap;
252
+ -webkit-appearance: none;
253
+ -webkit-text-fill-color: currentColor;
254
+ color: $color-dark-gray;
255
+ opacity: 0.2;
256
+
257
+ &:hover {
258
+ opacity: 1;
259
+ color: $color-red;
260
+ }
261
+
262
+ &:active {
263
+ color: darken($color-red, 15%);
264
+ }
265
+ }
266
+
267
+ &--variation {
268
+ &-default {
269
+ #{$block-name} {
270
+ &__button {
271
+ color: var(--mc-chip-color);
272
+ &:hover {
273
+ opacity: 1;
274
+ color: $color-white;
275
+ }
276
+ &:active {
277
+ color: darken($color-white, 15%);
278
+ }
279
+ }
280
+ &__title {
281
+ color: var(--mc-chip-text-color);
282
+ }
283
+ &__counter {
284
+ color: var(--mc-chip-text-color);
285
+ opacity: 0.5;
286
+ }
287
+ }
288
+ }
289
+ &-outline {
290
+ color: var(--mc-chip-color);
291
+ border: 1px solid var(--mc-chip-color);
292
+ &:before {
293
+ display: none;
294
+ }
295
+ }
296
+ &-invert {
297
+ color: $color-black;
298
+ &:before {
299
+ background-color: var(--mc-chip-color);
300
+ opacity: 0.1;
301
+ }
302
+ }
303
+ }
304
+ }
305
+ </style>
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <section class="mc-cropper">
3
+ <vue-cropper
4
+ ref="cropper"
5
+ drag-mode="crop"
6
+ background
7
+ alt="Avatar"
8
+ :aspect-ratio="1 / 1"
9
+ :initial-aspect-ratio="1 / 1"
10
+ :highlight="false"
11
+ :guides="false"
12
+ :zoomable="zoomable"
13
+ :view-mode="2"
14
+ :src="imgSrc"
15
+ @ready="$emit('ready')"
16
+ />
17
+ </section>
18
+ </template>
19
+
20
+ <script>
21
+ const VueCropper = () => import('vue-cropperjs')
22
+ import 'cropperjs/dist/cropper.css'
23
+
24
+ export default {
25
+ name: 'McCropper',
26
+ status: 'ready',
27
+ release: '1.0.0',
28
+ components: {
29
+ VueCropper,
30
+ },
31
+ props: {
32
+ /**
33
+ * Путь к изображению
34
+ *
35
+ */
36
+ imgSrc: {
37
+ type: [String, Object],
38
+ default: null,
39
+ },
40
+ zoomable: {
41
+ type: Boolean,
42
+ default: true,
43
+ },
44
+ },
45
+ data() {
46
+ return {
47
+ cropImg: '',
48
+ }
49
+ },
50
+ watch: {
51
+ imgSrc(val) {
52
+ this.setImage(val)
53
+ },
54
+ },
55
+ methods: {
56
+ setImage() {
57
+ this.$refs.cropper.replace(this.imgSrc)
58
+ },
59
+ cropImage() {
60
+ this.$refs.cropper
61
+ .getCroppedCanvas({
62
+ maxWidth: 650,
63
+ maxHeight: 650,
64
+ })
65
+ .toBlob(blob => {
66
+ /**
67
+ * Событие по обрезке
68
+ * @property {blob}
69
+ */
70
+ this.$emit('crop', blob)
71
+ })
72
+ },
73
+ },
74
+ }
75
+ </script>
76
+
77
+ <style lang="scss">
78
+ @import '../../tokens/border-radius';
79
+ @import '../../tokens/opacities';
80
+ @import '../../tokens/colors';
81
+ @import '../../tokens/media-queries';
82
+ .mc-cropper {
83
+ $block-name: &;
84
+
85
+ $color-main: $color-purple;
86
+
87
+ .cropper {
88
+ &-modal {
89
+ opacity: $opacity-active;
90
+ background-color: $color-white;
91
+ }
92
+
93
+ &-face,
94
+ &-line,
95
+ &-point {
96
+ opacity: 0;
97
+ }
98
+
99
+ &-view-box {
100
+ border-radius: $radius-circle;
101
+ outline: 1px dashed $color-main;
102
+ }
103
+
104
+ &-line {
105
+ background-color: $color-main;
106
+ }
107
+
108
+ &-point {
109
+ background: $color-main;
110
+
111
+ &.point-se {
112
+ @media #{$media-query-xl} {
113
+ opacity: 1;
114
+ }
115
+
116
+ &:before {
117
+ background-color: $color-main;
118
+ }
119
+ }
120
+ }
121
+
122
+ &-center {
123
+ display: none;
124
+ }
125
+
126
+ &-canvas {
127
+ height: 100% !important;
128
+ }
129
+
130
+ &-hide {
131
+ height: 100% !important;
132
+ }
133
+ }
134
+ }
135
+ </style>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <section class="mc-date">
3
+ <!-- @slot Слот для вставки в начало -->
4
+ <slot name="prepend" />
5
+ <time class="mc-date__time" :datetime="dayjsDate">
6
+ <mc-title :variation="size" :ellipsis="ellipsis" :uppercase="uppercase" :color="color">
7
+ {{ formattedDate }}
8
+ </mc-title>
9
+ </time>
10
+ <!-- @slot Слот для вставки в конец -->
11
+ <slot name="append" />
12
+ </section>
13
+ </template>
14
+
15
+ <script>
16
+ import { dayjs } from '../../utils/dayjs'
17
+ import McTitle from '../McTitle/McTitle'
18
+
19
+ export default {
20
+ name: 'McDate',
21
+
22
+ components: {
23
+ McTitle,
24
+ },
25
+
26
+ props: {
27
+ /**
28
+ * Значение
29
+ */
30
+ value: {
31
+ type: String,
32
+ default: null,
33
+ },
34
+
35
+ /**
36
+ * Формат даты
37
+ */
38
+ // eslint-disable-next-line vue/require-prop-types
39
+ format: {
40
+ default: 'DD.MM.YYYY',
41
+ },
42
+
43
+ /**
44
+ * Размер даты
45
+ * `h1`, `h2`, `h3`, `h4`, `subtitle`, `body`, `overline`.
46
+ */
47
+ size: {
48
+ type: String,
49
+ default: 'body',
50
+ },
51
+
52
+ /**
53
+ * Перенос строк
54
+ */
55
+ ellipsis: {
56
+ type: Boolean,
57
+ default: true,
58
+ },
59
+
60
+ /**
61
+ * Заглавные буквы
62
+ */
63
+ uppercase: {
64
+ type: Boolean,
65
+ default: true,
66
+ },
67
+ /**
68
+ * Цвет текста:
69
+ * `purple, red, gray и т.д.`
70
+ */
71
+ color: {
72
+ type: String,
73
+ default: 'black',
74
+ },
75
+ },
76
+
77
+ computed: {
78
+ dayjsDate() {
79
+ if (dayjs === null) return null
80
+ const locale = this.$i18n?.locale || 'ru' // TODO: maybe `en`?
81
+ return dayjs(this.value).locale(locale)
82
+ },
83
+ formattedDate() {
84
+ if (this.dayjsDate === null) return this.value
85
+ return this.dayjsDate.format(this.format)
86
+ },
87
+ },
88
+ }
89
+ </script>
90
+
91
+ <style lang="scss">
92
+ @import '../../styles/mixins';
93
+ @import '../../tokens/font-families';
94
+ @import '../../tokens/spacings';
95
+ .mc-date {
96
+ $block-name: &;
97
+
98
+ display: inline-flex;
99
+ align-items: center;
100
+ @include reset-text-indents();
101
+ @include child-indent-right($space-50);
102
+
103
+ &__time {
104
+ font-family: $font-family-main;
105
+ }
106
+ }
107
+ </style>