@soroka282/migrant.ui-kit 0.0.5

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 (140) hide show
  1. package/.editorconfig +18 -0
  2. package/.eslintignore +5 -0
  3. package/.eslintrc.cjs +51 -0
  4. package/.nvmrc +1 -0
  5. package/.prettierrc +10 -0
  6. package/.storybook/common.scss +4 -0
  7. package/.storybook/main.ts +23 -0
  8. package/.storybook/preview.ts +25 -0
  9. package/.stylelintignore +6 -0
  10. package/.stylelintrc.cjs +54 -0
  11. package/README.md +5 -0
  12. package/dist/App.vue.d.ts +2 -0
  13. package/dist/components/UI/button/UIButton.stories.d.ts +86 -0
  14. package/dist/components/UI/button/UIButton.vue.d.ts +33 -0
  15. package/dist/components/UI/card/UICard.stories.d.ts +63 -0
  16. package/dist/components/UI/card/UICard.vue.d.ts +25 -0
  17. package/dist/components/UI/inputs/BaseMaskedInput.vue.d.ts +24 -0
  18. package/dist/components/UI/inputs/UIInput.stories.d.ts +36 -0
  19. package/dist/components/UI/inputs/UIInput.vue.d.ts +33 -0
  20. package/dist/components/UI/loader/UILoader.stories.d.ts +18 -0
  21. package/dist/components/UI/loader/UILoader.vue.d.ts +12 -0
  22. package/dist/components/UI/modal/UIModal.stories.d.ts +5 -0
  23. package/dist/components/UI/modal/UIModal.vue.d.ts +19 -0
  24. package/dist/components/UI/modal/UIModalContainer.vue.d.ts +2 -0
  25. package/dist/components/UI/swiper/UISwiper.stories.d.ts +35 -0
  26. package/dist/components/UI/swiper/UISwiper.vue.d.ts +16 -0
  27. package/dist/components/index.d.ts +8 -0
  28. package/dist/composables/index.d.ts +2 -0
  29. package/dist/composables/useIframeHandlers.d.ts +16 -0
  30. package/dist/composables/useRequestHandler.d.ts +15 -0
  31. package/dist/constants/index.d.ts +1 -0
  32. package/dist/constants/ui-color.constant.d.ts +15 -0
  33. package/dist/main.d.ts +0 -0
  34. package/dist/migrant.ui-kit.es.d.ts +1 -0
  35. package/dist/migrant.ui-kit.es.ts +4172 -0
  36. package/dist/migrant.ui-kit.umd.ts +13 -0
  37. package/dist/plugins/formatter.d.ts +5 -0
  38. package/dist/plugins/plural-endings.d.ts +5 -0
  39. package/dist/store/index.d.ts +1 -0
  40. package/dist/store/modal.store.d.ts +831 -0
  41. package/dist/style.css +1 -0
  42. package/dist/types/UI/ui-color.type.d.ts +18 -0
  43. package/dist/types/UI/ui-input.type.d.ts +59 -0
  44. package/dist/types/UI/ui-modal.type.d.ts +7 -0
  45. package/dist/types/UI/ui-size.type.d.ts +7 -0
  46. package/dist/types/common.type.d.ts +2 -0
  47. package/dist/types/index.d.ts +6 -0
  48. package/dist/types/plugin.type.d.ts +6 -0
  49. package/dist/utils/debounce.util.d.ts +2 -0
  50. package/dist/utils/index.d.ts +1 -0
  51. package/dist/vite.svg +1 -0
  52. package/index.html +13 -0
  53. package/package.json +65 -0
  54. package/postcss-sorting.config.cjs +32 -0
  55. package/postcss-sorting.config.cts +30 -0
  56. package/public/vite.svg +1 -0
  57. package/src/App.vue +5 -0
  58. package/src/App.vue.d.ts +23 -0
  59. package/src/assets/scss/common/swiper.scss +20 -0
  60. package/src/assets/scss/common/variables.scss +15 -0
  61. package/src/assets/scss/index.scss +10 -0
  62. package/src/assets/scss/mixins/flex.minix.scss +7 -0
  63. package/src/assets/scss/mixins/identation.mixin.scss +17 -0
  64. package/src/assets/scss/mixins/index.mixin.scss +3 -0
  65. package/src/assets/scss/mixins/typograph.mixin.scss +5 -0
  66. package/src/components/UI/button/UIButton.stories.js +57 -0
  67. package/src/components/UI/button/UIButton.stories.ts +60 -0
  68. package/src/components/UI/button/UIButton.vue +118 -0
  69. package/src/components/UI/button/UIButton.vue.js +94 -0
  70. package/src/components/UI/card/UICard.stories.js +54 -0
  71. package/src/components/UI/card/UICard.stories.ts +57 -0
  72. package/src/components/UI/card/UICard.vue +52 -0
  73. package/src/components/UI/card/UICard.vue.js +59 -0
  74. package/src/components/UI/inputs/BaseMaskedInput.vue +101 -0
  75. package/src/components/UI/inputs/BaseMaskedInput.vue.js +100 -0
  76. package/src/components/UI/inputs/UIInput.stories.js +89 -0
  77. package/src/components/UI/inputs/UIInput.stories.ts +92 -0
  78. package/src/components/UI/inputs/UIInput.vue +184 -0
  79. package/src/components/UI/inputs/UIInput.vue.js +206 -0
  80. package/src/components/UI/loader/UILoader.stories.js +28 -0
  81. package/src/components/UI/loader/UILoader.stories.ts +31 -0
  82. package/src/components/UI/loader/UILoader.vue +76 -0
  83. package/src/components/UI/loader/UILoader.vue.js +47 -0
  84. package/src/components/UI/modal/UIModal.stories.js +34 -0
  85. package/src/components/UI/modal/UIModal.stories.ts +39 -0
  86. package/src/components/UI/modal/UIModal.vue +254 -0
  87. package/src/components/UI/modal/UIModal.vue.js +141 -0
  88. package/src/components/UI/modal/UIModalContainer.vue +20 -0
  89. package/src/components/UI/modal/UIModalContainer.vue.js +44 -0
  90. package/src/components/UI/swiper/UISwiper.stories.js +30 -0
  91. package/src/components/UI/swiper/UISwiper.stories.ts +33 -0
  92. package/src/components/UI/swiper/UISwiper.vue +47 -0
  93. package/src/components/UI/swiper/UISwiper.vue.js +82 -0
  94. package/src/components/index.js +8 -0
  95. package/src/components/index.ts +9 -0
  96. package/src/composables/index.js +2 -0
  97. package/src/composables/index.ts +2 -0
  98. package/src/composables/useIframeHandlers.js +43 -0
  99. package/src/composables/useIframeHandlers.ts +52 -0
  100. package/src/composables/useRequestHandler.js +24 -0
  101. package/src/composables/useRequestHandler.ts +49 -0
  102. package/src/constants/index.js +1 -0
  103. package/src/constants/index.ts +1 -0
  104. package/src/constants/ui-color.constant.js +16 -0
  105. package/src/constants/ui-color.constant.ts +19 -0
  106. package/src/main.js +9 -0
  107. package/src/main.ts +12 -0
  108. package/src/plugins/formatter.js +118 -0
  109. package/src/plugins/formatter.ts +136 -0
  110. package/src/plugins/plural-endings.js +15 -0
  111. package/src/plugins/plural-endings.ts +19 -0
  112. package/src/store/index.js +1 -0
  113. package/src/store/index.ts +1 -0
  114. package/src/store/modal.store.js +36 -0
  115. package/src/store/modal.store.ts +76 -0
  116. package/src/style.css +79 -0
  117. package/src/types/UI/ui-color.type.js +16 -0
  118. package/src/types/UI/ui-color.type.ts +22 -0
  119. package/src/types/UI/ui-input.type.js +41 -0
  120. package/src/types/UI/ui-input.type.ts +63 -0
  121. package/src/types/UI/ui-modal.type.js +8 -0
  122. package/src/types/UI/ui-modal.type.ts +7 -0
  123. package/src/types/UI/ui-size.type.js +8 -0
  124. package/src/types/UI/ui-size.type.ts +7 -0
  125. package/src/types/common.type.js +1 -0
  126. package/src/types/common.type.ts +2 -0
  127. package/src/types/index.js +6 -0
  128. package/src/types/index.ts +6 -0
  129. package/src/types/plugin.type.js +1 -0
  130. package/src/types/plugin.type.ts +6 -0
  131. package/src/utils/debounce.util.js +7 -0
  132. package/src/utils/debounce.util.ts +7 -0
  133. package/src/utils/index.js +1 -0
  134. package/src/utils/index.ts +1 -0
  135. package/tsconfig.json +18 -0
  136. package/tsconfig.tsbuildinfo +1 -0
  137. package/vite-env.d.ts +7 -0
  138. package/vite.config.js +33 -0
  139. package/vite.config.js.timestamp-1753347662244-f753ce7e4747b.mjs +38 -0
  140. package/vite.config.ts +41 -0
@@ -0,0 +1,94 @@
1
+ import { computed } from 'vue';
2
+ import { UIColorName, UISize } from '@/types';
3
+ import { UILoader } from '@/components';
4
+ import { UIColor } from '@/constants';
5
+ const props = withDefaults(defineProps(), {
6
+ text: '',
7
+ isLoading: false,
8
+ isBoxShadow: true,
9
+ disabled: false,
10
+ size: UISize.M,
11
+ color: UIColor[UIColorName.PurpleMain],
12
+ bgColor: UIColor[UIColorName.White],
13
+ loaderBorderColor: UIColor[UIColorName.Transparent],
14
+ });
15
+ const emit = defineEmits();
16
+ const classList = computed(() => ({
17
+ [`--${props.size}-size`]: props.size,
18
+ 'is-box-shadow': props.isBoxShadow,
19
+ }));
20
+ const borderColor = computed(() => props.color || null);
21
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
22
+ const __VLS_withDefaultsArg = (function (t) { return t; })({
23
+ text: '',
24
+ isLoading: false,
25
+ isBoxShadow: true,
26
+ disabled: false,
27
+ size: UISize.M,
28
+ color: UIColor[UIColorName.PurpleMain],
29
+ bgColor: UIColor[UIColorName.White],
30
+ loaderBorderColor: UIColor[UIColorName.Transparent],
31
+ });
32
+ const __VLS_ctx = {};
33
+ let __VLS_components;
34
+ let __VLS_directives;
35
+ // CSS variable injection
36
+ __VLS_ctx.bgColor;
37
+ __VLS_ctx.color;
38
+ // CSS variable injection end
39
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
40
+ ...{ onClick: (...[$event]) => {
41
+ __VLS_ctx.emit('click');
42
+ } },
43
+ ...{ class: (__VLS_ctx.classList) },
44
+ disabled: (__VLS_ctx.disabled || __VLS_ctx.isLoading),
45
+ ...{ class: "ui-button" },
46
+ });
47
+ if (__VLS_ctx.isLoading) {
48
+ const __VLS_0 = {}.UILoader;
49
+ /** @type {[typeof __VLS_components.UILoader, ]} */ ;
50
+ // @ts-ignore
51
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
52
+ borderColor: (__VLS_ctx.borderColor),
53
+ loaderBorderColor: (__VLS_ctx.loaderBorderColor),
54
+ ...{ class: "ui-button__loader" },
55
+ }));
56
+ const __VLS_2 = __VLS_1({
57
+ borderColor: (__VLS_ctx.borderColor),
58
+ loaderBorderColor: (__VLS_ctx.loaderBorderColor),
59
+ ...{ class: "ui-button__loader" },
60
+ }, ...__VLS_functionalComponentArgsRest(__VLS_1));
61
+ }
62
+ else {
63
+ var __VLS_4 = {};
64
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.span)({});
65
+ __VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.text) }, null, null);
66
+ }
67
+ /** @type {__VLS_StyleScopedClasses['ui-button']} */ ;
68
+ /** @type {__VLS_StyleScopedClasses['ui-button__loader']} */ ;
69
+ // @ts-ignore
70
+ var __VLS_5 = __VLS_4;
71
+ var __VLS_dollars;
72
+ const __VLS_self = (await import('vue')).defineComponent({
73
+ setup() {
74
+ return {
75
+ UILoader: UILoader,
76
+ emit: emit,
77
+ classList: classList,
78
+ borderColor: borderColor,
79
+ };
80
+ },
81
+ __typeEmits: {},
82
+ __typeProps: {},
83
+ props: {},
84
+ });
85
+ const __VLS_component = (await import('vue')).defineComponent({
86
+ setup() {
87
+ return {};
88
+ },
89
+ __typeEmits: {},
90
+ __typeProps: {},
91
+ props: {},
92
+ });
93
+ export default {};
94
+ ; /* PartiallyEnd: #4569/main.vue */
@@ -0,0 +1,54 @@
1
+ import { UIColorName, UISize } from '@/types';
2
+ import { UICard } from '@/components';
3
+ import { UIColor } from '@/constants';
4
+ export default {
5
+ title: 'UICard',
6
+ component: UICard,
7
+ argTypes: {
8
+ isBoxShadow: {
9
+ control: { type: 'boolean' },
10
+ },
11
+ isBorder: {
12
+ control: { type: 'boolean' },
13
+ },
14
+ size: {
15
+ control: { type: 'select' },
16
+ options: Object.values(UISize),
17
+ },
18
+ bgColor: {
19
+ control: { type: 'select' },
20
+ options: Object.keys(UIColorName),
21
+ },
22
+ color: {
23
+ control: { type: 'select' },
24
+ options: Object.keys(UIColorName),
25
+ },
26
+ borderRadius: {
27
+ control: { type: 'text' },
28
+ },
29
+ border: {
30
+ control: { type: 'text' },
31
+ },
32
+ },
33
+ args: {
34
+ size: UISize.M,
35
+ bgColor: UIColorName.PurpleMain,
36
+ color: UIColorName.White,
37
+ isBoxShadow: true,
38
+ isBorder: true,
39
+ borderRadius: '12px',
40
+ padding: '12px',
41
+ },
42
+ };
43
+ export const DefaultCard = (args) => ({
44
+ components: { UICard },
45
+ setup() {
46
+ return { args, UIColor };
47
+ },
48
+ template: `<UICard
49
+ v-bind="args"
50
+ :bg-color="UIColor[args.bgColor]"
51
+ >
52
+ UICard
53
+ </UICard>`,
54
+ });
@@ -0,0 +1,57 @@
1
+ import type { Meta, StoryFn } from '@storybook/vue3-vite';
2
+ import { UIColorName, UISize } from '@/types';
3
+ import { UICard } from '@/components';
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,59 @@
1
+ import { computed } from 'vue';
2
+ import { UIColorName } from '@/types';
3
+ import { UIColor } from '@/constants';
4
+ const props = withDefaults(defineProps(), {
5
+ isBoxShadow: true,
6
+ isBorder: true,
7
+ bgColor: UIColor[UIColorName.White],
8
+ color: UIColor[UIColorName.GrayText],
9
+ borderRadius: '12px',
10
+ padding: '12px',
11
+ });
12
+ const classList = computed(() => ({
13
+ '--box-shadow': props.isBoxShadow,
14
+ '--border': props.isBorder,
15
+ }));
16
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
17
+ const __VLS_withDefaultsArg = (function (t) { return t; })({
18
+ isBoxShadow: true,
19
+ isBorder: true,
20
+ bgColor: UIColor[UIColorName.White],
21
+ color: UIColor[UIColorName.GrayText],
22
+ borderRadius: '12px',
23
+ padding: '12px',
24
+ });
25
+ const __VLS_ctx = {};
26
+ let __VLS_components;
27
+ let __VLS_directives;
28
+ // CSS variable injection
29
+ __VLS_ctx.padding;
30
+ __VLS_ctx.borderRadius;
31
+ __VLS_ctx.bgColor;
32
+ // CSS variable injection end
33
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
34
+ ...{ class: "ui-card" },
35
+ ...{ class: (__VLS_ctx.classList) },
36
+ });
37
+ var __VLS_0 = {};
38
+ /** @type {__VLS_StyleScopedClasses['ui-card']} */ ;
39
+ // @ts-ignore
40
+ var __VLS_1 = __VLS_0;
41
+ var __VLS_dollars;
42
+ const __VLS_self = (await import('vue')).defineComponent({
43
+ setup() {
44
+ return {
45
+ classList: classList,
46
+ };
47
+ },
48
+ __typeProps: {},
49
+ props: {},
50
+ });
51
+ const __VLS_component = (await import('vue')).defineComponent({
52
+ setup() {
53
+ return {};
54
+ },
55
+ __typeProps: {},
56
+ props: {},
57
+ });
58
+ export default {};
59
+ ; /* PartiallyEnd: #4569/main.vue */
@@ -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,100 @@
1
+ import { computed, ref, watch } from 'vue';
2
+ import { mask } from 'maska';
3
+ const props = withDefaults(defineProps(), {
4
+ value: '',
5
+ masked: false,
6
+ tokens: () => ({}),
7
+ id: '',
8
+ });
9
+ const emit = defineEmits();
10
+ const lastValue = ref(null);
11
+ const display = ref(props.value);
12
+ const config = computed(() => ({
13
+ mask: props.maska,
14
+ tokens: Object.assign(props.tokens, {
15
+ '#': { pattern: /\d/ },
16
+ p: { pattern: /\d|\// },
17
+ F: {
18
+ pattern: /[0-9АВЕКМНОРСТУХавекмнорстухABEKMHOPCTYXabekmhopctyx]/,
19
+ transform: (v) => v.toUpperCase(),
20
+ },
21
+ f: {
22
+ pattern: /[АВЕКМНОРСТУХавекмнорстухABEKMHOPCTYXabekmhopctyx]/,
23
+ transform: (v) => v.toUpperCase(),
24
+ },
25
+ A: {
26
+ pattern: /[0-9ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz]/,
27
+ transform: (v) => v.toUpperCase(),
28
+ },
29
+ 0: { pattern: /\d/ },
30
+ }, props.tokens),
31
+ masked: props.masked,
32
+ }));
33
+ const refresh = (val) => {
34
+ display.value = val;
35
+ const value = mask(val, config.value.mask, config.value.tokens, config.value.masked);
36
+ if (value !== lastValue.value) {
37
+ lastValue.value = value;
38
+ emit('input', value);
39
+ emit('update:modelValue', value);
40
+ }
41
+ };
42
+ watch(() => props.value, (newValue) => {
43
+ if (newValue !== lastValue.value) {
44
+ display.value = newValue;
45
+ }
46
+ });
47
+ watch(() => props.masked, () => {
48
+ refresh(display.value);
49
+ });
50
+ const onInput = (evt) => {
51
+ if (evt.isTrusted || !evt.inputType) {
52
+ return;
53
+ }
54
+ refresh(evt.target.value);
55
+ };
56
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
57
+ const __VLS_withDefaultsArg = (function (t) { return t; })({
58
+ value: '',
59
+ masked: false,
60
+ tokens: () => ({}),
61
+ id: '',
62
+ });
63
+ const __VLS_ctx = {};
64
+ let __VLS_components;
65
+ let __VLS_directives;
66
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.input)({
67
+ ...{ onMaska: (__VLS_ctx.onInput) },
68
+ ...{ onBlur: (...[$event]) => {
69
+ __VLS_ctx.emit('blur', $event);
70
+ } },
71
+ ...{ onFocus: (...[$event]) => {
72
+ __VLS_ctx.emit('focus', $event);
73
+ } },
74
+ id: (__VLS_ctx.id),
75
+ value: (__VLS_ctx.display),
76
+ });
77
+ __VLS_asFunctionalDirective(__VLS_directives.vMaska)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.config) }, null, null);
78
+ var __VLS_dollars;
79
+ const __VLS_self = (await import('vue')).defineComponent({
80
+ setup() {
81
+ return {
82
+ emit: emit,
83
+ display: display,
84
+ config: config,
85
+ onInput: onInput,
86
+ };
87
+ },
88
+ __typeEmits: {},
89
+ __typeProps: {},
90
+ props: {},
91
+ });
92
+ export default (await import('vue')).defineComponent({
93
+ setup() {
94
+ return {};
95
+ },
96
+ __typeEmits: {},
97
+ __typeProps: {},
98
+ props: {},
99
+ });
100
+ ; /* PartiallyEnd: #4569/main.vue */
@@ -0,0 +1,89 @@
1
+ import { EInputComponentType, EInputInputmode, EInputType } from '@/types';
2
+ import { UIInput } from '@/components';
3
+ import { UIColor } from '@/constants';
4
+ export default {
5
+ title: 'UIInput',
6
+ component: UIInput,
7
+ argTypes: {
8
+ isError: {
9
+ control: { type: 'boolean' },
10
+ },
11
+ disabled: {
12
+ control: { type: 'boolean' },
13
+ },
14
+ readonly: {
15
+ control: { type: 'boolean' },
16
+ },
17
+ masked: {
18
+ control: { type: 'boolean' },
19
+ },
20
+ isCapitalize: {
21
+ control: { type: 'boolean' },
22
+ },
23
+ isSetInputFocus: {
24
+ control: { type: 'boolean' },
25
+ },
26
+ component: {
27
+ control: { type: 'select' },
28
+ options: Object.values(EInputComponentType),
29
+ },
30
+ id: {
31
+ control: { type: 'text' },
32
+ },
33
+ label: {
34
+ control: { type: 'text' },
35
+ },
36
+ mask: {
37
+ control: { type: 'text' },
38
+ },
39
+ placeholder: {
40
+ control: { type: 'text' },
41
+ },
42
+ modelValue: {
43
+ control: { type: 'text' },
44
+ },
45
+ errorMessage: {
46
+ control: { type: 'text' },
47
+ },
48
+ delay: {
49
+ control: { type: 'text' },
50
+ },
51
+ type: {
52
+ control: { type: 'select' },
53
+ options: Object.values(EInputType),
54
+ },
55
+ inputmode: {
56
+ control: { type: 'select' },
57
+ options: Object.values(EInputInputmode),
58
+ },
59
+ },
60
+ args: {
61
+ component: EInputComponentType.input,
62
+ id: 'input',
63
+ label: 'label',
64
+ mask: '',
65
+ placeholder: '',
66
+ type: EInputType.text,
67
+ inputmode: EInputInputmode.text,
68
+ modelValue: '',
69
+ errorMessage: '',
70
+ isError: false,
71
+ disabled: false,
72
+ readonly: false,
73
+ masked: false,
74
+ isCapitalize: false,
75
+ isSetInputFocus: false,
76
+ delay: 0,
77
+ },
78
+ };
79
+ export const DefaultButton = (args) => ({
80
+ components: { UIInput },
81
+ setup() {
82
+ return { args, UIColor };
83
+ },
84
+ template: `<UIInput
85
+ v-bind="args"
86
+ >
87
+ Кнопка
88
+ </UIInput>`,
89
+ });
@@ -0,0 +1,92 @@
1
+ import type { Meta, StoryFn } from '@storybook/vue3-vite';
2
+ import { EInputComponentType, EInputInputmode, EInputType } from '@/types';
3
+ import { UIInput } from '@/components';
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
+ });