plugin-ui-for-kzt 0.0.19 → 0.0.20

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 (41) hide show
  1. package/dist/components/BaseButton/BaseButton.vue.d.ts +0 -2
  2. package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +9 -1
  3. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +0 -2
  4. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +0 -2
  5. package/dist/components/BaseField/BaseField.vue.d.ts +98 -0
  6. package/dist/components/BaseInput/BaseInput.vue.d.ts +16 -14
  7. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +13 -15
  8. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +7 -9
  9. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +7 -12
  10. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +7 -12
  11. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +0 -2
  12. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +0 -2
  13. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +0 -2
  14. package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +11 -7
  15. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +7 -12
  16. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +0 -2
  17. package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
  18. package/dist/composables/kit/state.d.ts +1 -2
  19. package/dist/index.d.ts +2 -1
  20. package/dist/index.js +1 -1
  21. package/example/App.vue +170 -128
  22. package/package.json +1 -1
  23. package/src/components/BaseField/BaseField.vue +184 -0
  24. package/src/components/BaseField/README.md +85 -0
  25. package/src/components/BaseInput/BaseInput.vue +162 -228
  26. package/src/components/BaseInputCalendar/BaseInputCalendar.vue +10 -7
  27. package/src/components/BaseInputCurrency/BaseInputCurrency.vue +39 -78
  28. package/src/components/BaseInputEmail/BaseInputEmail.vue +2 -4
  29. package/src/components/BaseInputPhone/BaseInputPhone.vue +29 -89
  30. package/src/components/BaseSelect/BaseSelect.vue +9 -52
  31. package/src/components/BaseSiteInput/BaseSiteInput.vue +11 -63
  32. package/src/components/BaseTextarea/BaseTextarea.vue +3 -30
  33. package/src/composables/kit/state.ts +1 -2
  34. package/src/index.ts +5 -2
  35. package/src/styles/index.scss +87 -2
  36. package/src/styles/root.scss +1 -0
  37. package/src/styles/variables.scss +2 -1
  38. package/src/types/calendar.d.ts +2 -0
  39. package/src/types/field.d.ts +12 -0
  40. package/src/types/input.d.ts +26 -8
  41. package/src/types/utils.d.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div :class="classList">
3
3
  <div class="base-site-input__wrapper">
4
- <div :class="{ '--is-error' : urlError }" class="base-site-input__url-wrapper">
4
+ <div class="base-site-input__url-wrapper">
5
5
  <span class="base-site-input__url">
6
6
  https://
7
7
  </span>
@@ -9,9 +9,10 @@
9
9
  <base-input
10
10
  v-bind="{...$props, ...$attrs}"
11
11
  v-model="modelValue"
12
- id="url"
12
+ :id="id"
13
13
  type="url"
14
14
  :error="urlError || props.error"
15
+ class="base-site-input__input"
15
16
  @update:modelValue="onUpdateModelValue"
16
17
  />
17
18
  </div>
@@ -22,30 +23,24 @@
22
23
  import { computed, ref, watch } from 'vue';
23
24
  import BaseInput from '../BaseInput/BaseInput.vue';
24
25
  import { useKitSize } from '../../composables/kit/size'
25
- import { useKitState } from '../../composables/kit/state';
26
26
  import type { ICorePropsBaseSiteInput } from '../../types/input'
27
27
 
28
28
  const props = withDefaults(defineProps<ICorePropsBaseSiteInput>(),{
29
29
  size: 'medium',
30
30
  modelValue: '',
31
- error: '',
31
+ focusable: true,
32
32
  })
33
33
 
34
34
  const emit = defineEmits<{
35
35
  (event: 'update:modelValue', value: string): void;
36
36
  }>();
37
37
 
38
- const urlError = ref('');
38
+ const urlError = ref<string>('');
39
39
  const { sizeClassList } = useKitSize(props);
40
- const { stateClassList } = useKitState(props);
41
40
 
42
41
  const classList = computed(() => [
43
42
  sizeClassList.value,
44
- stateClassList.value,
45
- 'base-site-input',
46
- {
47
- '--is-has-hint': !!props.hint,
48
- }
43
+ 'base-site-input'
49
44
  ]);
50
45
 
51
46
  const normalizedValue = computed(() => {
@@ -82,7 +77,7 @@ watch(modelValue, (value) => {
82
77
  .base-site-input {
83
78
  $input: &;
84
79
 
85
- width: fit-content;
80
+ width: 100%;
86
81
 
87
82
  &__wrapper {
88
83
  display: flex;
@@ -97,6 +92,10 @@ watch(modelValue, (value) => {
97
92
  }
98
93
  }
99
94
 
95
+ &__input {
96
+ flex-grow: 1;
97
+ }
98
+
100
99
  &__url {
101
100
  color: var(--primary-text-tertiary);
102
101
  }
@@ -114,99 +113,48 @@ watch(modelValue, (value) => {
114
113
  }
115
114
 
116
115
  &.--small-size {
117
- &.--is-has-hint, &.--is-error {
118
- #{$input} {
119
- &__url-wrapper {
120
- margin-bottom: 26px;
121
- }
122
- }
123
- }
124
-
125
116
  #{$input} {
126
117
  &__url-wrapper{
127
118
  height: 40px;
128
119
  font: var(--typography-text-m-regular);
129
120
  border-top-left-radius: var(--corner-radius-s);
130
121
  border-bottom-left-radius: var(--corner-radius-s);
131
-
132
- &.--is-error {
133
- margin-bottom: 26px;
134
- }
135
122
  }
136
123
 
137
124
  &__url {
138
125
  padding: var(--spacing-s) var(--spacing-m) var(--spacing-s) var(--spacing-2l);
139
126
  }
140
127
  }
141
-
142
- :deep(.base-input__label-text),
143
- :deep(.base-input__hint) {
144
- transform: translateX(-75px);
145
- }
146
128
  }
147
129
 
148
130
  &.--medium-size {
149
- &.--is-has-hint, &.--is-error {
150
- #{$input} {
151
- &__url-wrapper {
152
- margin-bottom: 26px;
153
- }
154
- }
155
- }
156
-
157
131
  #{$input} {
158
132
  &__url-wrapper{
159
133
  height: 48px;
160
134
  font: var(--typography-text-m-regular);
161
135
  border-top-left-radius: var(--corner-radius-m);
162
136
  border-bottom-left-radius: var(--corner-radius-m);
163
-
164
- &.--is-error {
165
- margin-bottom: 26px;
166
- }
167
137
  }
168
138
 
169
139
  &__url {
170
140
  padding: var(--spacing-m) var(--spacing-m) var(--spacing-m) var(--spacing-2l);
171
141
  }
172
142
  }
173
-
174
- :deep(.base-input__label-text),
175
- :deep(.base-input__hint) {
176
- transform: translateX(-75px);
177
- }
178
143
  }
179
144
 
180
145
  &.--large-size {
181
- &.--is-has-hint, &.--is-error {
182
- #{$input} {
183
- &__url-wrapper {
184
- margin-bottom: 30px;
185
- }
186
- }
187
- }
188
-
189
146
  #{$input} {
190
147
  &__url-wrapper{
191
148
  height: 56px;
192
149
  font: var(--typography-text-l-regular);
193
150
  border-top-left-radius: var(--corner-radius-m);
194
151
  border-bottom-left-radius: var(--corner-radius-m);
195
-
196
- &.--is-error {
197
- margin-bottom: 30px;
198
- }
199
152
  }
200
153
 
201
154
  &__url {
202
155
  padding: var(--spacing-2l) var(--spacing-m) var(--spacing-2l) var(--spacing-l);
203
156
  }
204
157
  }
205
-
206
- :deep(.base-input__label-text),
207
- :deep(.base-input__hint) {
208
- transform: translateX(-83px);
209
- }
210
158
  }
211
159
  }
212
160
  </style>
@@ -1,8 +1,6 @@
1
1
  <template>
2
2
  <div class="base-textarea" :class="classList">
3
- <label class="base-textarea__label" :for="id">
4
- <span v-if="label" class="base-textarea__label-text">{{ label }}</span>
5
-
3
+ <div class="base-textarea__wrapper">
6
4
  <div class="base-textarea__wrapper">
7
5
  <textarea
8
6
  :id="id"
@@ -17,11 +15,7 @@
17
15
  {{ modelValue.length }}/{{ maxLength }}
18
16
  </span>
19
17
  </div>
20
-
21
- <div v-if="(error && typeof error === 'string') || hint" class="base-textarea__hint">
22
- {{ error || hint }}
23
- </div>
24
- </label>
18
+ </div>
25
19
  </div>
26
20
  </template>
27
21
 
@@ -34,8 +28,6 @@ import { useKitSize } from '../../composables/kit/size';
34
28
  const props = withDefaults(defineProps<ICoreTextareaProps & { maxLength?: number }>(), {
35
29
  modelValue: '',
36
30
  placeholder: '' as string,
37
- error: '',
38
- hint: '',
39
31
  size: 'medium',
40
32
  });
41
33
 
@@ -73,11 +65,6 @@ function handleInput(event: Event) {
73
65
  resize: none;
74
66
  }
75
67
 
76
- &__hint {
77
- align-self: flex-start;
78
- font: var(--typography-text-s-regular);
79
- }
80
-
81
68
  &__wrapper {
82
69
  display: flex;
83
70
  position: relative;
@@ -113,10 +100,6 @@ function handleInput(event: Event) {
113
100
  color: var(--primary-text-tertiary);
114
101
  background: var(--primary-black-100);
115
102
  }
116
-
117
- #{$textarea}__hint {
118
- color: var(--primary-text-secondary);
119
- }
120
103
  }
121
104
  }
122
105
 
@@ -126,7 +109,7 @@ function handleInput(event: Event) {
126
109
  color: var(--primary-text-quaternary);
127
110
  }
128
111
 
129
- &__label {
112
+ &__wrapper {
130
113
  display: flex;
131
114
  flex-direction: column;
132
115
  gap: 6px;
@@ -135,17 +118,7 @@ function handleInput(event: Event) {
135
118
  height: 100%;
136
119
  }
137
120
 
138
- &__label-text {
139
- align-self: flex-start;
140
- font: var(--typography-text-s-medium);
141
- color: var(--primary-text-primary);
142
- }
143
-
144
121
  &.--is-error {
145
- #{$textarea}__hint {
146
- color: var(--error-red);
147
- }
148
-
149
122
  #{$textarea}__field {
150
123
  border-color: var(--error-red-light-01);
151
124
 
@@ -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,7 @@ 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";
38
39
 
39
40
  const components = {
40
41
  BaseModal,
@@ -67,7 +68,8 @@ const components = {
67
68
  BaseSegmentedButtons,
68
69
  BaseChips,
69
70
  BaseSwiper,
70
- BaseUpload
71
+ BaseUpload,
72
+ BaseField
71
73
  };
72
74
 
73
75
  // Функция для загрузки sprite.svg
@@ -153,5 +155,6 @@ export {
153
155
  BaseSegmentedButtons,
154
156
  BaseChips,
155
157
  BaseSwiper,
156
- BaseUpload
158
+ BaseUpload,
159
+ BaseField
157
160
  };
@@ -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;
@@ -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 {