plugin-ui-for-kzt 0.0.21 → 0.0.23

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 (57) hide show
  1. package/dist/components/BaseBadge/BaseBadge.vue.d.ts +1 -1
  2. package/dist/components/BaseButton/BaseButton.vue.d.ts +1 -3
  3. package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +9 -1
  4. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +1 -3
  5. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +1 -3
  6. package/dist/components/BaseField/BaseField.vue.d.ts +98 -0
  7. package/dist/components/BaseInput/BaseInput.vue.d.ts +19 -17
  8. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +15 -17
  9. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +10 -12
  10. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +9 -14
  11. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +9 -14
  12. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +1 -3
  13. package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
  14. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +1 -3
  15. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +1 -3
  16. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +1 -1
  17. package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +11 -7
  18. package/dist/components/BaseTabs/BaseTabs.vue.d.ts +25 -0
  19. package/dist/components/BaseTag/BaseTag.vue.d.ts +1 -1
  20. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +9 -14
  21. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +1 -3
  22. package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
  23. package/dist/components/BaseUpload/BaseUpload.vue.d.ts +11 -0
  24. package/dist/components/BaseUpload/CropModal.vue.d.ts +9 -0
  25. package/dist/composables/kit/state.d.ts +1 -2
  26. package/dist/index.d.ts +3 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.LICENSE.txt +15 -0
  29. package/example/App.vue +37 -31
  30. package/example/TestImage.vue +6 -0
  31. package/package.json +2 -1
  32. package/src/components/BaseCheckbox/BaseCheckbox.vue +76 -46
  33. package/src/components/BaseField/BaseField.vue +184 -0
  34. package/src/components/BaseField/README.md +85 -0
  35. package/src/components/BaseInput/BaseInput.vue +162 -228
  36. package/src/components/BaseInputCalendar/BaseInputCalendar.vue +10 -7
  37. package/src/components/BaseInputCurrency/BaseInputCurrency.vue +39 -78
  38. package/src/components/BaseInputEmail/BaseInputEmail.vue +2 -4
  39. package/src/components/BaseInputPhone/BaseInputPhone.vue +29 -89
  40. package/src/components/BaseRadio/BaseRadio.vue +266 -233
  41. package/src/components/BaseSelect/BaseSelect.vue +9 -52
  42. package/src/components/BaseSiteInput/BaseSiteInput.vue +11 -63
  43. package/src/components/BaseTabs/BaseTabs.vue +193 -0
  44. package/src/components/BaseTextarea/BaseTextarea.vue +3 -30
  45. package/src/components/BaseUpload/BaseUpload.vue +35 -1
  46. package/src/components/BaseUpload/CropModal.vue +210 -0
  47. package/src/composables/kit/state.ts +1 -2
  48. package/src/index.ts +8 -2
  49. package/src/styles/index.scss +87 -2
  50. package/src/styles/root.scss +1 -0
  51. package/src/styles/variables.scss +2 -1
  52. package/src/types/calendar.d.ts +2 -0
  53. package/src/types/field.d.ts +12 -0
  54. package/src/types/input.d.ts +26 -8
  55. package/src/types/tab.d.ts +17 -0
  56. package/src/types/uploadedFile.d.ts +7 -0
  57. package/src/types/utils.d.ts +0 -1
@@ -0,0 +1,210 @@
1
+ <template>
2
+ <div class="crop-modal">
3
+ <div class="crop-modal__container">
4
+ <div class="crop-modal__body">
5
+ <div class="crop-modal__cropper-container">
6
+ <Cropper
7
+ ref="cropperRef"
8
+ class="crop-modal__cropper"
9
+ :src="modalProps.imageUrl"
10
+ :stencil-props="{
11
+ aspectRatio: NaN,
12
+ movable: true,
13
+ resizable: true,
14
+ }"
15
+ :resize-image="{
16
+ adjustStencil: false
17
+ }"
18
+ />
19
+ </div>
20
+ </div>
21
+
22
+ <div class="crop-modal__footer">
23
+ <base-button
24
+ color="secondary"
25
+ size="small"
26
+ @click="handleCancel"
27
+ class="crop-modal__button"
28
+ >
29
+ {{ modalProps.cancelText || 'Отменить' }}
30
+ </base-button>
31
+
32
+ <base-button
33
+ color="primary"
34
+ size="small"
35
+ @click="handleConfirm"
36
+ class="crop-modal__button"
37
+ >
38
+ {{ modalProps.confirmText || 'Применить' }}
39
+ </base-button>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script setup lang="ts">
46
+ import {ref} from 'vue';
47
+ import {Cropper} from 'vue-advanced-cropper';
48
+ import 'vue-advanced-cropper/dist/style.css';
49
+ import BaseButton from '../BaseButton/BaseButton.vue';
50
+ import {useModal} from '../../composables/useModal';
51
+
52
+ interface CropModalProps {
53
+ modalProps: {
54
+ imageUrl: string;
55
+ fileName: string;
56
+ onConfirm: (croppedFile: File) => void;
57
+ onCancel: () => void;
58
+ cancelText?: string;
59
+ confirmText?: string;
60
+ };
61
+ }
62
+
63
+ const props = defineProps<CropModalProps>();
64
+ const modal = useModal();
65
+
66
+ const cropperRef = ref();
67
+
68
+ const handleCancel = () => {
69
+ props.modalProps.onCancel();
70
+ modal.close('crop-modal');
71
+ };
72
+
73
+ const handleConfirm = () => {
74
+ if (!cropperRef.value) return;
75
+
76
+ const {canvas} = cropperRef.value.getResult();
77
+
78
+ if (canvas) {
79
+ canvas.toBlob((blob: Blob | null) => {
80
+ if (blob) {
81
+ const croppedFile = new File([blob], props.modalProps.fileName, {
82
+ type: 'image/jpeg',
83
+ lastModified: Date.now(),
84
+ });
85
+
86
+ props.modalProps.onConfirm(croppedFile);
87
+ modal.close('crop-modal');
88
+ }
89
+ }, 'image/jpeg', 0.9);
90
+ }
91
+ };
92
+ </script>
93
+
94
+ <style lang="scss" scoped>
95
+ @import '../../styles/variables';
96
+ @import '../../styles/root';
97
+
98
+ .crop-modal {
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+ max-width: 588px;
103
+ max-height: 776px;
104
+
105
+ @media #{$mobile-max-576} {
106
+ max-width: 100%;
107
+ width: 100%;
108
+ }
109
+
110
+ &__container {
111
+ width: 100%;
112
+ background: rgba(0, 0, 0, 0.3);
113
+ }
114
+
115
+ &__body {
116
+ flex: 1;
117
+ overflow: hidden;
118
+ }
119
+
120
+ &__cropper-container {
121
+ height: 500px;
122
+ width: 100%;
123
+ overflow: hidden;
124
+ display: flex;
125
+ align-items: center;
126
+
127
+ @media #{$mobile-max-375} {
128
+ overflow: unset;
129
+ }
130
+ }
131
+
132
+ &__footer {
133
+ display: flex;
134
+ gap: var(--spacing-xl);
135
+ justify-content: space-between;
136
+ padding: var(--spacing-xl);
137
+ background-color: var(--primary-black-white);
138
+
139
+ @media #{$mobile-max-576} {
140
+ flex-direction: column;
141
+ justify-content: center;
142
+ gap: var(--spacing-l);
143
+ }
144
+ }
145
+
146
+ &__button {
147
+ min-width: 258px;
148
+
149
+ @media #{$mobile-landscape} {
150
+ min-width: unset;
151
+ width: 100%;
152
+ }
153
+ }
154
+ }
155
+
156
+ ::v-deep(.vue-advanced-cropper__background) {
157
+ background: rgba(0, 0, 0, 0.3);
158
+ width: 100%;
159
+ }
160
+
161
+ ::v-deep(.vue-advanced-cropper__foreground) {
162
+ border-color: var(--primary-blue);
163
+ background: rgba(0, 0, 0, 0.3);
164
+ }
165
+
166
+ ::v-deep(.vue-simple-handler) {
167
+ background: var(--primary-blue);
168
+ border-color: white;
169
+ }
170
+
171
+ ::v-deep(.vue-simple-handler:hover) {
172
+ background: var(--primary-blue-deep);
173
+ }
174
+
175
+ ::v-deep(.vue-simple-line) {
176
+ border-color: var(--primary-blue);
177
+ }
178
+ </style>
179
+
180
+ <style lang="scss">
181
+ @import '../../styles/variables';
182
+ @import '../../styles/root';
183
+
184
+ .base-modal:has(.crop-modal) {
185
+ @media screen and (max-width: 375px) {
186
+ max-height: unset !important;
187
+ height: 100vh !important;
188
+ }
189
+ }
190
+
191
+ .base-modal__content:has(.crop-modal) {
192
+ width: 100% !important;
193
+
194
+ @media screen and (max-width: 375px) {
195
+ overflow-y: unset !important;
196
+ }
197
+ }
198
+
199
+ .base-modal__wrapper:has(.crop-modal) {
200
+ padding: 0 !important;
201
+
202
+ @media #{$mobile-max-767} {
203
+ padding: 0 !important;
204
+ }
205
+
206
+ @media screen and (max-width: 375px) {
207
+ justify-content: start !important;
208
+ }
209
+ }
210
+ </style>
@@ -8,10 +8,9 @@ export function useKitState(props: ICoreState) {
8
8
  '--is-selected': props.selected,
9
9
  '--is-active': props.active,
10
10
  '--is-required': props.required,
11
- '--is-error': props.error,
11
+ '--is-error': Boolean(props.error || (typeof props.error === 'string' ? props.error.length > 0 : false)),
12
12
  '--is-loading': props.loading,
13
13
  '--is-disabled': props.disabled,
14
- '--is-has-hint': props.hint,
15
14
  },
16
15
  ]);
17
16
 
package/src/index.ts CHANGED
@@ -35,6 +35,8 @@ import BaseUpload from "./components/BaseUpload/BaseUpload.vue";
35
35
  import BaseBadge from "./components/BaseBadge/BaseBadge.vue";
36
36
  import BaseTag from "./components/BaseTag/BaseTag.vue";
37
37
  import BaseBadgeGroup from "./components/BaseBadge/BaseBadgeGroup.vue";
38
+ import BaseField from "./components/BaseField/BaseField.vue";
39
+ import BaseTabs from "./components/BaseTabs/BaseTabs.vue";
38
40
 
39
41
  const components = {
40
42
  BaseModal,
@@ -67,7 +69,9 @@ const components = {
67
69
  BaseSegmentedButtons,
68
70
  BaseChips,
69
71
  BaseSwiper,
70
- BaseUpload
72
+ BaseUpload,
73
+ BaseField,
74
+ BaseTabs
71
75
  };
72
76
 
73
77
  // Функция для загрузки sprite.svg
@@ -153,5 +157,7 @@ export {
153
157
  BaseSegmentedButtons,
154
158
  BaseChips,
155
159
  BaseSwiper,
156
- BaseUpload
160
+ BaseUpload,
161
+ BaseField,
162
+ BaseTabs
157
163
  };
@@ -1,4 +1,89 @@
1
- body {
2
- font-family: 'Roboto Condensed', 'Helvetica Neue', sans-serif;
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ margin: 0;
5
+ padding: 0;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ html {
3
10
  font-size: 100%;
11
+ line-height: 1.15;
12
+ -webkit-text-size-adjust: 100%;
13
+ }
14
+
15
+ body {
16
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
17
+ line-height: 1.5;
18
+ }
19
+
20
+ ul,
21
+ ol {
22
+ list-style: none;
23
+ }
24
+
25
+ a {
26
+ color: inherit;
27
+ text-decoration: none;
28
+ }
29
+
30
+ img,
31
+ svg {
32
+ display: block;
33
+ max-width: 100%;
34
+ height: auto;
35
+ }
36
+
37
+ button,
38
+ input,
39
+ select,
40
+ textarea {
41
+ font-family: inherit;
42
+ font-size: inherit;
43
+ line-height: inherit;
44
+ color: inherit;
45
+ background: none;
46
+ border: none;
47
+ outline: none;
48
+ appearance: none;
49
+ }
50
+
51
+ form {
52
+ margin: 0;
53
+ }
54
+
55
+ table {
56
+ border-collapse: collapse;
57
+ border-spacing: 0;
58
+ }
59
+
60
+ h1,
61
+ h2,
62
+ h3,
63
+ h4,
64
+ h5,
65
+ h6 {
66
+ font-size: inherit;
67
+ font-weight: inherit;
68
+ }
69
+
70
+ blockquote,
71
+ q {
72
+ quotes: none;
73
+ }
74
+
75
+ hr {
76
+ border: 0;
77
+ height: 1px;
78
+ background: var(--primary-black-300, #ccc);
79
+ }
80
+
81
+ fieldset {
82
+ border: 0;
83
+ margin: 0;
84
+ padding: 0;
85
+ }
86
+
87
+ legend {
88
+ padding: 0;
4
89
  }
@@ -1,3 +1,4 @@
1
+ @import "./index.scss";
1
2
  :root {
2
3
  /* Primary colors */
3
4
  --primary-blue-deep: #0085BE;
@@ -33,7 +33,8 @@ $retina: '(min-resolution: 1.5dppx), (min-resolution: 144dpi)';
33
33
 
34
34
  @mixin focused {
35
35
  &:focus,
36
- &:focus-visible {
36
+ &:focus-visible,
37
+ &:focus-within {
37
38
  @content;
38
39
  }
39
40
  }
@@ -5,10 +5,12 @@ import type { InputProps } from './input';
5
5
  export type DateRange = [Date, Date] | Date | string | null;
6
6
 
7
7
  export interface IBaseCalendarProps {
8
+ id: string
8
9
  modelValue?: DateRange
9
10
  range?: boolean | RangeConfig | undefined
10
11
  minDate?: Date | null
11
12
  readonly?: boolean
13
+ error?: string | boolean
12
14
  }
13
15
 
14
16
  export type TCoreCalendarProps = IBaseCalendarProps & ICoreSize;
@@ -0,0 +1,12 @@
1
+ import type { ICoreSize, ICoreState } from './utils';
2
+
3
+ interface IFieldProps {
4
+ id: string
5
+ label: string
6
+ hint?: string
7
+ error?: string | boolean
8
+ focusable?: boolean
9
+ tabIndex?: number
10
+ }
11
+
12
+ export type TFieldProps = IFieldProps & ICoreSize & ICoreState;
@@ -8,19 +8,16 @@ export interface InputProps {
8
8
  mask?: string
9
9
  type?: string
10
10
  placeholder?: string
11
- error?: string | boolean
11
+ error?: string | boolean;
12
12
  readonly?: boolean
13
- hint?: string
14
- label?: string
15
13
  tooltipOptions?: ITooltipProps
16
14
  validationText?: string
15
+ focusable?: boolean
17
16
  }
18
17
 
19
- interface IPropsBaseSiteInput extends InputProps {}
20
-
21
18
  type TTextareaProps = Omit<InputProps, 'type'>;
22
19
 
23
- export type ICorePropsBaseSiteInput = Omit<IPropsBaseSiteInput, 'id'> & ICoreSize;
20
+ export type ICorePropsBaseSiteInput = InputProps & ICoreSize;
24
21
 
25
22
  export type ICoreInputProps = InputProps & ICoreSize & ICoreState;
26
23
 
@@ -28,14 +25,29 @@ export type ICoreTextareaProps = ICoreState & TTextareaProps & ICoreSize;
28
25
 
29
26
  export type TSelectValue = Nullable<string | number | boolean>;
30
27
 
28
+ type TOptionPhoneCountry = 'KZ' | 'RU' | 'KG' | 'UZ';
29
+ type TOptionCurrency = 'KZT' | 'RUB' | 'KGS' | 'UZS';
30
+ export interface IOptionsSelect<T extends string> {
31
+ id: string;
32
+ name: string;
33
+ value: T;
34
+ mask: string;
35
+ }
36
+
37
+ export interface IOptionsPhone extends IOptionsSelect<TOptionPhoneCountry> {
38
+ icon: TOptionPhoneCountry;
39
+ }
40
+
41
+ export interface IOptionsCurrency extends IOptionsSelect<TOptionCurrency> {
42
+ symbol: string;
43
+ }
44
+
31
45
  export interface ICoreSelectOption {
32
46
  id: TSelectValue
33
47
  name: string
34
48
  disabled?: boolean
35
49
  icon?: string
36
50
  style?: Record<string, string>
37
-
38
-
39
51
  }
40
52
 
41
53
  export interface ICoreSelectBaseProps {
@@ -53,4 +65,10 @@ export interface ICoreSelectBaseProps {
53
65
  hint?: string
54
66
  }
55
67
 
68
+ export interface ISelectSlotProps {
69
+ item: ICoreSelectBaseProps;
70
+ index: number;
71
+ active: boolean;
72
+ }
73
+
56
74
  export type ICoreSelectProps = ICoreSelectBaseProps & ICoreSize & ICoreState & ICoreStyle & ICorePlaceholder;
@@ -0,0 +1,17 @@
1
+ import type { ICoreSize } from './utils';
2
+
3
+ type IconComponent = Component | (new () => Component) | (() => Promise<{ default: Component }>);
4
+
5
+ interface ITab {
6
+ title: string;
7
+ id: number;
8
+ icon?: IconComponent;
9
+ disabled?: boolean
10
+ }
11
+
12
+ interface ITabs {
13
+ tabs: ITab[];
14
+ modelValue: number,
15
+ }
16
+
17
+ export type TTabProps = ICoreSize & ITabs
@@ -4,10 +4,17 @@ export interface UploadedFile {
4
4
  file: File;
5
5
  }
6
6
 
7
+ export interface CropTexts {
8
+ cancel?: string;
9
+ confirm?: string;
10
+ }
11
+
7
12
  export interface IpropsUpload {
8
13
  acceptedFormats: string[]; // Фильтр по типу файлов (например, "image/*" для изображений)
9
14
  multiple?: boolean; // Разрешить множественный выбор файлов
10
15
  maxFileSize?: number; // Максимальный размер файла в байтах
16
+ enableCrop?: boolean; // Включить функциональность кропа для изображений
17
+ cropTexts?: CropTexts; // Тексты для кнопок в модальном окне кропа
11
18
  onUpload?: (files: UploadedFile[]) => void; // Callback при загрузке файлов
12
19
  onError?: (error: string) => void; // Callback при ошибке загрузки
13
20
  }
@@ -28,7 +28,6 @@ export interface ICoreState {
28
28
  required?: boolean
29
29
  error?: Nullable<string | number | boolean> | undefined
30
30
  loading?: boolean
31
- hint?: Nullable<string | number | boolean> | undefined
32
31
  }
33
32
 
34
33
  export interface ICoreStyle {