@soroka282/migrant.ui-kit 0.0.17 → 0.0.18

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 (46) hide show
  1. package/package.json +8 -2
  2. package/src/App.vue +5 -0
  3. package/src/App.vue.d.ts +23 -0
  4. package/src/assets/scss/common/swiper.scss +20 -0
  5. package/src/assets/scss/common/variables.scss +15 -0
  6. package/src/assets/scss/index.scss +10 -0
  7. package/src/assets/scss/mixins/flex.minix.scss +7 -0
  8. package/src/assets/scss/mixins/identation.mixin.scss +17 -0
  9. package/src/assets/scss/mixins/index.mixin.scss +3 -0
  10. package/src/assets/scss/mixins/typograph.mixin.scss +5 -0
  11. package/src/components/UI/button/UIButton.stories.ts +60 -0
  12. package/src/components/UI/button/UIButton.vue +118 -0
  13. package/src/components/UI/card/UICard.stories.ts +57 -0
  14. package/src/components/UI/card/UICard.vue +52 -0
  15. package/src/components/UI/inputs/BaseMaskedInput.vue +101 -0
  16. package/src/components/UI/inputs/UIInput.stories.ts +92 -0
  17. package/src/components/UI/inputs/UIInput.vue +184 -0
  18. package/src/components/UI/loader/UILoader.stories.ts +31 -0
  19. package/src/components/UI/loader/UILoader.vue +76 -0
  20. package/src/components/UI/modal/UIModal.stories.ts +39 -0
  21. package/src/components/UI/modal/UIModal.vue +254 -0
  22. package/src/components/UI/modal/UIModalContainer.vue +20 -0
  23. package/src/components/UI/swiper/UISwiper.stories.ts +33 -0
  24. package/src/components/UI/swiper/UISwiper.vue +47 -0
  25. package/src/composables/index.ts +2 -0
  26. package/src/composables/useIframeHandlers.ts +52 -0
  27. package/src/composables/useRequestHandler.ts +49 -0
  28. package/src/constants/index.ts +1 -0
  29. package/src/constants/ui-color.constant.ts +19 -0
  30. package/src/index.ts +14 -0
  31. package/src/main.ts +12 -0
  32. package/src/plugins/formatter.ts +136 -0
  33. package/src/plugins/index.ts +2 -0
  34. package/src/plugins/plural-endings.ts +19 -0
  35. package/src/store/index.ts +1 -0
  36. package/src/store/modal.store.ts +76 -0
  37. package/src/style.css +79 -0
  38. package/src/types/UI/ui-color.type.ts +22 -0
  39. package/src/types/UI/ui-input.type.ts +63 -0
  40. package/src/types/UI/ui-modal.type.ts +7 -0
  41. package/src/types/UI/ui-size.type.ts +7 -0
  42. package/src/types/common.type.ts +2 -0
  43. package/src/types/index.ts +6 -0
  44. package/src/types/plugin.type.ts +6 -0
  45. package/src/utils/debounce.util.ts +7 -0
  46. package/src/utils/index.ts +1 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soroka282/migrant.ui-kit",
3
3
  "private": false,
4
- "version": "0.0.17",
4
+ "version": "0.0.18",
5
5
  "type": "module",
6
6
  "main": "dist/migrant.ui-kit.umd.js",
7
7
  "module": "dist/migrant.ui-kit.es.js",
@@ -15,8 +15,14 @@
15
15
  "build-storybook": "storybook build",
16
16
  "publish:npm": "npm run build && npm publish --access public"
17
17
  },
18
+ "typesVersions": {
19
+ "*": {
20
+ "*": ["src/*"]
21
+ }
22
+ },
18
23
  "files": [
19
- "dist"
24
+ "dist",
25
+ "src"
20
26
  ],
21
27
  "peerDependencies": {
22
28
  "vue": "^3.5.17"
package/src/App.vue ADDED
@@ -0,0 +1,5 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <div>UI-kit</div>
5
+ </template>
@@ -0,0 +1,23 @@
1
+ declare const _default: import('vue').DefineComponent<
2
+ {},
3
+ {},
4
+ {},
5
+ {},
6
+ {},
7
+ import('vue').ComponentOptionsMixin,
8
+ import('vue').ComponentOptionsMixin,
9
+ {},
10
+ string,
11
+ import('vue').PublicProps,
12
+ Readonly<{}> & Readonly<{}>,
13
+ {},
14
+ {},
15
+ {},
16
+ {},
17
+ string,
18
+ import('vue').ComponentProvideOptions,
19
+ true,
20
+ {},
21
+ any
22
+ >;
23
+ export default _default;
@@ -0,0 +1,20 @@
1
+ .swiper {
2
+ width: 95vw;
3
+ height: 100%;
4
+ overflow: visible;
5
+ }
6
+
7
+ .swiper-slide {
8
+ display: flex;
9
+ justify-content: start;
10
+ align-items: center;
11
+ flex-shrink: 0;
12
+ max-width: 100%;
13
+ text-align: center;
14
+ font-size: 18px;
15
+ padding-right: 10px;
16
+
17
+ @media (min-width: 368px) {
18
+ max-width: 84%;
19
+ }
20
+ }
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --transparent: transparent;
3
+ --white: #fff;
4
+ --black: #000;
5
+ --purple-main: #666EE4;
6
+ --purple-66: #DDDEF5A8;
7
+ --gray-text: #3A3A3A;
8
+ --gray-border: #d8d8d8;
9
+ --gray: #323232;
10
+ --danger-1: #FD324E;
11
+ --danger-2: #EA4242;
12
+ --danger-3: #FFE9E9;
13
+ --danger-4: #FFDCDC;
14
+ --danger-5: #DA363C;
15
+ }
@@ -0,0 +1,10 @@
1
+ @use 'mixins/index.mixin';
2
+ @forward 'mixins/index.mixin';
3
+ @forward 'common/variables';
4
+
5
+ @include index.indentation-creator-list(margin);
6
+ @include index.indentation-creator-list(padding);
7
+
8
+ * {
9
+ font-family: inherit, sans-serif;
10
+ }
@@ -0,0 +1,7 @@
1
+ @mixin flex ($direction: column, $gap: 12px, $alignItems: flex-start, $justifyContent: flex-start) {
2
+ display: flex;
3
+ align-items: $alignItems;
4
+ justify-content: $justifyContent;
5
+ flex-direction: $direction;
6
+ gap: $gap;
7
+ }
@@ -0,0 +1,17 @@
1
+ @use "sass:string";
2
+
3
+ @mixin indentation-creator ($className, $indentationName, $direction, $maxCount: 200) {
4
+ @for $i from 1 through $maxCount {
5
+ .#{$className}-#{$i} {
6
+ #{$indentationName}-#{$direction}: #{$i}px;
7
+ }
8
+ }
9
+ }
10
+
11
+ @mixin indentation-creator-list ($indentationName) {
12
+ $directionNameList: (top, left, bottom, right);
13
+
14
+ @each $direction in $directionNameList {
15
+ @include indentation-creator(#{string.slice($indentationName, 0, 1)}#{string.slice($direction, 0, 1)}, $indentationName, $direction);
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ @forward "typograph.mixin";
2
+ @forward "flex.minix";
3
+ @forward "identation.mixin";
@@ -0,0 +1,5 @@
1
+ @mixin text ($size: 14px, $weight: 400, $lheight: 22px) {
2
+ font-size: $size;
3
+ font-weight: $weight;
4
+ line-height: $lheight;
5
+ }
@@ -0,0 +1,60 @@
1
+ import type { Meta, StoryFn } from '@storybook/vue3-vite';
2
+ import { UIColorName, UISize } from '@/types';
3
+ import { UIButton } from '@/index';
4
+ import { UIColor } from '@/constants';
5
+
6
+ export default {
7
+ title: 'UIButton',
8
+ component: UIButton,
9
+ argTypes: {
10
+ isLoading: {
11
+ control: { type: 'boolean' },
12
+ },
13
+ disabled: {
14
+ control: { type: 'boolean' },
15
+ },
16
+ isBoxShadow: {
17
+ control: { type: 'boolean' },
18
+ },
19
+ size: {
20
+ control: { type: 'select' },
21
+ options: Object.values(UISize),
22
+ },
23
+ color: {
24
+ control: { type: 'select' },
25
+ options: Object.keys(UIColorName),
26
+ },
27
+ bgColor: {
28
+ control: { type: 'select' },
29
+ options: Object.keys(UIColorName),
30
+ },
31
+ loaderBorderColor: {
32
+ control: { type: 'select' },
33
+ options: Object.keys(UIColorName),
34
+ },
35
+ },
36
+ args: {
37
+ size: UISize.M,
38
+ color: UIColorName.White,
39
+ bgColor: UIColorName.PurpleMain,
40
+ loaderBorderColor: 'transparent',
41
+ disabled: false,
42
+ isLoading: false,
43
+ isBoxShadow: true,
44
+ },
45
+ } as Meta<typeof UIButton>;
46
+
47
+ export const DefaultButton: StoryFn<typeof UIButton> = (args) => ({
48
+ components: { UIButton },
49
+ setup() {
50
+ return { args, UIColor };
51
+ },
52
+ template: `<UIButton
53
+ v-bind="args"
54
+ :color="UIColor[args.color]"
55
+ :bg-color="UIColor[args.bgColor]"
56
+ :loader-border-color="UIColor[args.loaderBorderColor]"
57
+ >
58
+ Кнопка
59
+ </UIButton>`,
60
+ });
@@ -0,0 +1,118 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import { Nullable, UIColorName, UIColorValues, UISize } from '@/types';
4
+ import { UILoader } from '@/index';
5
+ import { UIColor } from '@/constants';
6
+
7
+ const props = withDefaults(
8
+ defineProps<{
9
+ text?: string;
10
+ isLoading?: boolean;
11
+ isBoxShadow?: boolean;
12
+ disabled?: boolean;
13
+ size?: UISize;
14
+ color?: UIColorValues;
15
+ bgColor?: UIColorValues;
16
+ loaderBorderColor: UIColorValues;
17
+ }>(),
18
+ {
19
+ text: '',
20
+ isLoading: false,
21
+ isBoxShadow: true,
22
+ disabled: false,
23
+ size: UISize.M,
24
+ color: UIColor[UIColorName.PurpleMain],
25
+ bgColor: UIColor[UIColorName.White],
26
+ loaderBorderColor: UIColor[UIColorName.Transparent],
27
+ },
28
+ );
29
+
30
+ const emit = defineEmits<{
31
+ click: [void];
32
+ }>();
33
+
34
+ const classList = computed(() => ({
35
+ [`--${props.size}-size`]: props.size,
36
+ 'is-box-shadow': props.isBoxShadow,
37
+ }));
38
+
39
+ const borderColor = computed<Nullable<UIColorValues>>(
40
+ () => (props.color as UIColorValues) || null,
41
+ );
42
+ </script>
43
+
44
+ <template>
45
+ <button
46
+ :class="classList"
47
+ :disabled="disabled || isLoading"
48
+ class="ui-button"
49
+ @click="emit('click')"
50
+ >
51
+ <UILoader
52
+ v-if="isLoading"
53
+ :border-color="borderColor"
54
+ :loader-border-color="loaderBorderColor"
55
+ class="ui-button__loader"
56
+ />
57
+ <slot v-else>
58
+ <span v-html="text" />
59
+ </slot>
60
+ </button>
61
+ </template>
62
+
63
+ <style scoped lang="scss">
64
+ @use '@/assets/scss/mixins/index.mixin';
65
+
66
+ .ui-button {
67
+ @include index.text(14px, 700, 100%);
68
+
69
+ width: 100%;
70
+ background: v-bind(bgColor);
71
+ color: v-bind(color);
72
+ border: none;
73
+ transition: filter 0.25s;
74
+ border-radius: 8px;
75
+ outline: none;
76
+ cursor: pointer;
77
+
78
+ &.is-box-shadow {
79
+ box-shadow: 0 4px 29px rgb(0 0 0 / 10%);
80
+ }
81
+
82
+ // button state
83
+ &:hover {
84
+ filter: brightness(90%);
85
+ }
86
+
87
+ &:disabled {
88
+ filter: opacity(70%);
89
+ }
90
+
91
+ &__loader {
92
+ margin: 0 auto;
93
+ }
94
+
95
+ // button size
96
+ &.--xs-size {
97
+ min-height: 33px;
98
+ }
99
+
100
+ &.--s-size {
101
+ min-height: 44px;
102
+ }
103
+
104
+ &.--m-size {
105
+ @include index.text(15px, 700, 100%);
106
+
107
+ min-height: 54px;
108
+ }
109
+
110
+ &.--l-size {
111
+ min-height: 64px;
112
+ }
113
+
114
+ &.--custom-size {
115
+ min-height: inherit;
116
+ }
117
+ }
118
+ </style>
@@ -0,0 +1,57 @@
1
+ import type { Meta, StoryFn } from '@storybook/vue3-vite';
2
+ import { UIColorName, UISize } from '@/types';
3
+ import { UICard } from '@/index';
4
+ import { UIColor } from '@/constants';
5
+
6
+ export default {
7
+ title: 'UICard',
8
+ component: UICard,
9
+ argTypes: {
10
+ isBoxShadow: {
11
+ control: { type: 'boolean' },
12
+ },
13
+ isBorder: {
14
+ control: { type: 'boolean' },
15
+ },
16
+ size: {
17
+ control: { type: 'select' },
18
+ options: Object.values(UISize),
19
+ },
20
+ bgColor: {
21
+ control: { type: 'select' },
22
+ options: Object.keys(UIColorName),
23
+ },
24
+ color: {
25
+ control: { type: 'select' },
26
+ options: Object.keys(UIColorName),
27
+ },
28
+ borderRadius: {
29
+ control: { type: 'text' },
30
+ },
31
+ border: {
32
+ control: { type: 'text' },
33
+ },
34
+ },
35
+ args: {
36
+ size: UISize.M,
37
+ bgColor: UIColorName.PurpleMain,
38
+ color: UIColorName.White,
39
+ isBoxShadow: true,
40
+ isBorder: true,
41
+ borderRadius: '12px',
42
+ padding: '12px',
43
+ },
44
+ } as Meta<typeof UICard>;
45
+
46
+ export const DefaultCard: StoryFn<typeof UICard> = (args) => ({
47
+ components: { UICard },
48
+ setup() {
49
+ return { args, UIColor };
50
+ },
51
+ template: `<UICard
52
+ v-bind="args"
53
+ :bg-color="UIColor[args.bgColor]"
54
+ >
55
+ UICard
56
+ </UICard>`,
57
+ });
@@ -0,0 +1,52 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import { UIColorName, UIColorValues } from '@/types';
4
+ import { UIColor } from '@/constants';
5
+
6
+ const props = withDefaults(
7
+ defineProps<{
8
+ isBoxShadow?: boolean;
9
+ isBorder?: boolean;
10
+ bgColor?: UIColorValues;
11
+ color?: UIColorValues;
12
+ borderRadius?: string;
13
+ padding?: string;
14
+ }>(),
15
+ {
16
+ isBoxShadow: true,
17
+ isBorder: true,
18
+ bgColor: UIColor[UIColorName.White],
19
+ color: UIColor[UIColorName.GrayText],
20
+ borderRadius: '12px',
21
+ padding: '12px',
22
+ },
23
+ );
24
+
25
+ const classList = computed(() => ({
26
+ '--box-shadow': props.isBoxShadow,
27
+ '--border': props.isBorder,
28
+ }));
29
+ </script>
30
+
31
+ <template>
32
+ <div class="ui-card" :class="classList">
33
+ <slot />
34
+ </div>
35
+ </template>
36
+
37
+ <style scoped lang="scss">
38
+ .ui-card {
39
+ padding: v-bind(padding);
40
+ border-radius: v-bind(borderRadius);
41
+ background-color: v-bind(bgColor);
42
+ border: 1px solid transparent;
43
+
44
+ &.--border {
45
+ border: 1px solid rgb(255 255 255 / 50%);
46
+ }
47
+
48
+ &.--box-shadow {
49
+ box-shadow: 0 0 13.5px 0 rgb(180 180 180 / 15%);
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1,101 @@
1
+ <script lang="ts" setup>
2
+ import { computed, ref, watch } from 'vue';
3
+ import { mask } from 'maska';
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ value?: string | number;
8
+ maska: string | any[];
9
+ masked?: boolean;
10
+ tokens: any;
11
+ id: string;
12
+ }>(),
13
+ {
14
+ value: '',
15
+ masked: false,
16
+ tokens: () => ({}),
17
+ id: '',
18
+ },
19
+ );
20
+
21
+ const emit = defineEmits<{
22
+ input: [any];
23
+ 'update:modelValue': [any];
24
+ blur: [any];
25
+ focus: [any];
26
+ }>();
27
+
28
+ const lastValue = ref<string | null>(null);
29
+ const display = ref(props.value);
30
+
31
+ const config = computed(() => ({
32
+ mask: props.maska,
33
+ tokens: Object.assign(
34
+ props.tokens,
35
+ {
36
+ '#': { pattern: /\d/ },
37
+ p: { pattern: /\d|\// },
38
+ F: {
39
+ pattern: /[0-9АВЕКМНОРСТУХавекмнорстухABEKMHOPCTYXabekmhopctyx]/,
40
+ transform: (v: string) => v.toUpperCase(),
41
+ },
42
+ f: {
43
+ pattern: /[АВЕКМНОРСТУХавекмнорстухABEKMHOPCTYXabekmhopctyx]/,
44
+ transform: (v: string) => v.toUpperCase(),
45
+ },
46
+ A: {
47
+ pattern: /[0-9ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz]/,
48
+ transform: (v: string) => v.toUpperCase(),
49
+ },
50
+ 0: { pattern: /\d/ },
51
+ },
52
+ props.tokens,
53
+ ),
54
+
55
+ masked: props.masked,
56
+ }));
57
+
58
+ const refresh = (val: any) => {
59
+ display.value = val;
60
+ const value = mask(val, config.value.mask, config.value.tokens, config.value.masked);
61
+ if (value !== lastValue.value) {
62
+ lastValue.value = value;
63
+ emit('input', value);
64
+ emit('update:modelValue', value);
65
+ }
66
+ };
67
+
68
+ watch(
69
+ () => props.value,
70
+ (newValue) => {
71
+ if (newValue !== lastValue.value) {
72
+ display.value = newValue;
73
+ }
74
+ },
75
+ );
76
+
77
+ watch(
78
+ () => props.masked,
79
+ () => {
80
+ refresh(display.value);
81
+ },
82
+ );
83
+
84
+ const onInput = (evt: any) => {
85
+ if (evt.isTrusted || !evt.inputType) {
86
+ return;
87
+ }
88
+ refresh(evt.target.value);
89
+ };
90
+ </script>
91
+
92
+ <template>
93
+ <input
94
+ :id="id"
95
+ v-maska="config"
96
+ :value="display"
97
+ @maska="onInput"
98
+ @blur="emit('blur', $event)"
99
+ @focus="emit('focus', $event)"
100
+ />
101
+ </template>
@@ -0,0 +1,92 @@
1
+ import type { Meta, StoryFn } from '@storybook/vue3-vite';
2
+ import { EInputComponentType, EInputInputmode, EInputType } from '@/types';
3
+ import { UIInput } from '@/index';
4
+ import { UIColor } from '@/constants';
5
+
6
+ export default {
7
+ title: 'UIInput',
8
+ component: UIInput,
9
+ argTypes: {
10
+ isError: {
11
+ control: { type: 'boolean' },
12
+ },
13
+ disabled: {
14
+ control: { type: 'boolean' },
15
+ },
16
+ readonly: {
17
+ control: { type: 'boolean' },
18
+ },
19
+ masked: {
20
+ control: { type: 'boolean' },
21
+ },
22
+ isCapitalize: {
23
+ control: { type: 'boolean' },
24
+ },
25
+ isSetInputFocus: {
26
+ control: { type: 'boolean' },
27
+ },
28
+ component: {
29
+ control: { type: 'select' },
30
+ options: Object.values(EInputComponentType),
31
+ },
32
+ id: {
33
+ control: { type: 'text' },
34
+ },
35
+ label: {
36
+ control: { type: 'text' },
37
+ },
38
+ mask: {
39
+ control: { type: 'text' },
40
+ },
41
+ placeholder: {
42
+ control: { type: 'text' },
43
+ },
44
+ modelValue: {
45
+ control: { type: 'text' },
46
+ },
47
+ errorMessage: {
48
+ control: { type: 'text' },
49
+ },
50
+ delay: {
51
+ control: { type: 'text' },
52
+ },
53
+ type: {
54
+ control: { type: 'select' },
55
+ options: Object.values(EInputType),
56
+ },
57
+ inputmode: {
58
+ control: { type: 'select' },
59
+ options: Object.values(EInputInputmode),
60
+ },
61
+ },
62
+ args: {
63
+ component: EInputComponentType.input,
64
+ id: 'input',
65
+ label: 'label',
66
+ mask: '',
67
+ placeholder: '',
68
+ type: EInputType.text,
69
+ inputmode: EInputInputmode.text,
70
+ modelValue: '',
71
+ errorMessage: '',
72
+ isError: false,
73
+ disabled: false,
74
+ readonly: false,
75
+ masked: false,
76
+ isCapitalize: false,
77
+ isSetInputFocus: false,
78
+ delay: 0,
79
+ },
80
+ } as Meta<typeof UIInput>;
81
+
82
+ export const DefaultButton: StoryFn<typeof UIInput> = (args) => ({
83
+ components: { UIInput },
84
+ setup() {
85
+ return { args, UIColor };
86
+ },
87
+ template: `<UIInput
88
+ v-bind="args"
89
+ >
90
+ Кнопка
91
+ </UIInput>`,
92
+ });