plugin-ui-for-kzt 0.0.20 → 0.0.21

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 (42) hide show
  1. package/dist/components/BaseButton/BaseButton.vue.d.ts +2 -0
  2. package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +0 -8
  3. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +2 -0
  4. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +2 -0
  5. package/dist/components/BaseInput/BaseInput.vue.d.ts +15 -17
  6. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +14 -12
  7. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +9 -7
  8. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +12 -7
  9. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +12 -7
  10. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +2 -0
  11. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +2 -0
  12. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +2 -0
  13. package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +7 -11
  14. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +12 -7
  15. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +2 -0
  16. package/dist/composables/kit/state.d.ts +2 -1
  17. package/dist/index.d.ts +1 -2
  18. package/dist/index.js +1 -1
  19. package/example/App.vue +30 -185
  20. package/package.json +1 -1
  21. package/src/components/BaseInput/BaseInput.vue +228 -162
  22. package/src/components/BaseInputCalendar/BaseInputCalendar.vue +7 -10
  23. package/src/components/BaseInputCurrency/BaseInputCurrency.vue +78 -39
  24. package/src/components/BaseInputEmail/BaseInputEmail.vue +4 -2
  25. package/src/components/BaseInputPhone/BaseInputPhone.vue +89 -29
  26. package/src/components/BaseSegmentedButtons/BaseSegmentedButtons.vue +1 -0
  27. package/src/components/BaseSelect/BaseSelect.vue +52 -9
  28. package/src/components/BaseSiteInput/BaseSiteInput.vue +63 -11
  29. package/src/components/BaseTextarea/BaseTextarea.vue +30 -3
  30. package/src/composables/kit/state.ts +2 -1
  31. package/src/index.ts +2 -5
  32. package/src/styles/index.scss +2 -87
  33. package/src/styles/root.scss +0 -1
  34. package/src/styles/variables.scss +1 -2
  35. package/src/types/button.d.ts +1 -0
  36. package/src/types/calendar.d.ts +0 -2
  37. package/src/types/input.d.ts +8 -26
  38. package/src/types/utils.d.ts +1 -0
  39. package/dist/components/BaseField/BaseField.vue.d.ts +0 -98
  40. package/src/components/BaseField/BaseField.vue +0 -184
  41. package/src/components/BaseField/README.md +0 -85
  42. package/src/types/field.d.ts +0 -12
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div :class="classList">
3
3
  <div class="base-site-input__wrapper">
4
- <div class="base-site-input__url-wrapper">
4
+ <div :class="{ '--is-error' : urlError }" class="base-site-input__url-wrapper">
5
5
  <span class="base-site-input__url">
6
6
  https://
7
7
  </span>
@@ -9,10 +9,9 @@
9
9
  <base-input
10
10
  v-bind="{...$props, ...$attrs}"
11
11
  v-model="modelValue"
12
- :id="id"
12
+ id="url"
13
13
  type="url"
14
14
  :error="urlError || props.error"
15
- class="base-site-input__input"
16
15
  @update:modelValue="onUpdateModelValue"
17
16
  />
18
17
  </div>
@@ -23,24 +22,30 @@
23
22
  import { computed, ref, watch } from 'vue';
24
23
  import BaseInput from '../BaseInput/BaseInput.vue';
25
24
  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
- focusable: true,
31
+ error: '',
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<string>('');
38
+ const urlError = ref('');
39
39
  const { sizeClassList } = useKitSize(props);
40
+ const { stateClassList } = useKitState(props);
40
41
 
41
42
  const classList = computed(() => [
42
43
  sizeClassList.value,
43
- 'base-site-input'
44
+ stateClassList.value,
45
+ 'base-site-input',
46
+ {
47
+ '--is-has-hint': !!props.hint,
48
+ }
44
49
  ]);
45
50
 
46
51
  const normalizedValue = computed(() => {
@@ -77,7 +82,7 @@ watch(modelValue, (value) => {
77
82
  .base-site-input {
78
83
  $input: &;
79
84
 
80
- width: 100%;
85
+ width: fit-content;
81
86
 
82
87
  &__wrapper {
83
88
  display: flex;
@@ -92,10 +97,6 @@ watch(modelValue, (value) => {
92
97
  }
93
98
  }
94
99
 
95
- &__input {
96
- flex-grow: 1;
97
- }
98
-
99
100
  &__url {
100
101
  color: var(--primary-text-tertiary);
101
102
  }
@@ -113,48 +114,99 @@ watch(modelValue, (value) => {
113
114
  }
114
115
 
115
116
  &.--small-size {
117
+ &.--is-has-hint, &.--is-error {
118
+ #{$input} {
119
+ &__url-wrapper {
120
+ margin-bottom: 26px;
121
+ }
122
+ }
123
+ }
124
+
116
125
  #{$input} {
117
126
  &__url-wrapper{
118
127
  height: 40px;
119
128
  font: var(--typography-text-m-regular);
120
129
  border-top-left-radius: var(--corner-radius-s);
121
130
  border-bottom-left-radius: var(--corner-radius-s);
131
+
132
+ &.--is-error {
133
+ margin-bottom: 26px;
134
+ }
122
135
  }
123
136
 
124
137
  &__url {
125
138
  padding: var(--spacing-s) var(--spacing-m) var(--spacing-s) var(--spacing-2l);
126
139
  }
127
140
  }
141
+
142
+ :deep(.base-input__label-text),
143
+ :deep(.base-input__hint) {
144
+ transform: translateX(-75px);
145
+ }
128
146
  }
129
147
 
130
148
  &.--medium-size {
149
+ &.--is-has-hint, &.--is-error {
150
+ #{$input} {
151
+ &__url-wrapper {
152
+ margin-bottom: 26px;
153
+ }
154
+ }
155
+ }
156
+
131
157
  #{$input} {
132
158
  &__url-wrapper{
133
159
  height: 48px;
134
160
  font: var(--typography-text-m-regular);
135
161
  border-top-left-radius: var(--corner-radius-m);
136
162
  border-bottom-left-radius: var(--corner-radius-m);
163
+
164
+ &.--is-error {
165
+ margin-bottom: 26px;
166
+ }
137
167
  }
138
168
 
139
169
  &__url {
140
170
  padding: var(--spacing-m) var(--spacing-m) var(--spacing-m) var(--spacing-2l);
141
171
  }
142
172
  }
173
+
174
+ :deep(.base-input__label-text),
175
+ :deep(.base-input__hint) {
176
+ transform: translateX(-75px);
177
+ }
143
178
  }
144
179
 
145
180
  &.--large-size {
181
+ &.--is-has-hint, &.--is-error {
182
+ #{$input} {
183
+ &__url-wrapper {
184
+ margin-bottom: 30px;
185
+ }
186
+ }
187
+ }
188
+
146
189
  #{$input} {
147
190
  &__url-wrapper{
148
191
  height: 56px;
149
192
  font: var(--typography-text-l-regular);
150
193
  border-top-left-radius: var(--corner-radius-m);
151
194
  border-bottom-left-radius: var(--corner-radius-m);
195
+
196
+ &.--is-error {
197
+ margin-bottom: 30px;
198
+ }
152
199
  }
153
200
 
154
201
  &__url {
155
202
  padding: var(--spacing-2l) var(--spacing-m) var(--spacing-2l) var(--spacing-l);
156
203
  }
157
204
  }
205
+
206
+ :deep(.base-input__label-text),
207
+ :deep(.base-input__hint) {
208
+ transform: translateX(-83px);
209
+ }
158
210
  }
159
211
  }
160
212
  </style>
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <div class="base-textarea" :class="classList">
3
- <div class="base-textarea__wrapper">
3
+ <label class="base-textarea__label" :for="id">
4
+ <span v-if="label" class="base-textarea__label-text">{{ label }}</span>
5
+
4
6
  <div class="base-textarea__wrapper">
5
7
  <textarea
6
8
  :id="id"
@@ -15,7 +17,11 @@
15
17
  {{ modelValue.length }}/{{ maxLength }}
16
18
  </span>
17
19
  </div>
18
- </div>
20
+
21
+ <div v-if="(error && typeof error === 'string') || hint" class="base-textarea__hint">
22
+ {{ error || hint }}
23
+ </div>
24
+ </label>
19
25
  </div>
20
26
  </template>
21
27
 
@@ -28,6 +34,8 @@ import { useKitSize } from '../../composables/kit/size';
28
34
  const props = withDefaults(defineProps<ICoreTextareaProps & { maxLength?: number }>(), {
29
35
  modelValue: '',
30
36
  placeholder: '' as string,
37
+ error: '',
38
+ hint: '',
31
39
  size: 'medium',
32
40
  });
33
41
 
@@ -65,6 +73,11 @@ function handleInput(event: Event) {
65
73
  resize: none;
66
74
  }
67
75
 
76
+ &__hint {
77
+ align-self: flex-start;
78
+ font: var(--typography-text-s-regular);
79
+ }
80
+
68
81
  &__wrapper {
69
82
  display: flex;
70
83
  position: relative;
@@ -100,6 +113,10 @@ function handleInput(event: Event) {
100
113
  color: var(--primary-text-tertiary);
101
114
  background: var(--primary-black-100);
102
115
  }
116
+
117
+ #{$textarea}__hint {
118
+ color: var(--primary-text-secondary);
119
+ }
103
120
  }
104
121
  }
105
122
 
@@ -109,7 +126,7 @@ function handleInput(event: Event) {
109
126
  color: var(--primary-text-quaternary);
110
127
  }
111
128
 
112
- &__wrapper {
129
+ &__label {
113
130
  display: flex;
114
131
  flex-direction: column;
115
132
  gap: 6px;
@@ -118,7 +135,17 @@ function handleInput(event: Event) {
118
135
  height: 100%;
119
136
  }
120
137
 
138
+ &__label-text {
139
+ align-self: flex-start;
140
+ font: var(--typography-text-s-medium);
141
+ color: var(--primary-text-primary);
142
+ }
143
+
121
144
  &.--is-error {
145
+ #{$textarea}__hint {
146
+ color: var(--error-red);
147
+ }
148
+
122
149
  #{$textarea}__field {
123
150
  border-color: var(--error-red-light-01);
124
151
 
@@ -8,9 +8,10 @@ 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': Boolean(props.error || (typeof props.error === 'string' ? props.error.length > 0 : false)),
11
+ '--is-error': props.error,
12
12
  '--is-loading': props.loading,
13
13
  '--is-disabled': props.disabled,
14
+ '--is-has-hint': props.hint,
14
15
  },
15
16
  ]);
16
17
 
package/src/index.ts CHANGED
@@ -35,7 +35,6 @@ 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
38
 
40
39
  const components = {
41
40
  BaseModal,
@@ -68,8 +67,7 @@ const components = {
68
67
  BaseSegmentedButtons,
69
68
  BaseChips,
70
69
  BaseSwiper,
71
- BaseUpload,
72
- BaseField
70
+ BaseUpload
73
71
  };
74
72
 
75
73
  // Функция для загрузки sprite.svg
@@ -155,6 +153,5 @@ export {
155
153
  BaseSegmentedButtons,
156
154
  BaseChips,
157
155
  BaseSwiper,
158
- BaseUpload,
159
- BaseField
156
+ BaseUpload
160
157
  };
@@ -1,89 +1,4 @@
1
- *,
2
- *::before,
3
- *::after {
4
- margin: 0;
5
- padding: 0;
6
- box-sizing: border-box;
7
- }
8
-
9
- html {
10
- font-size: 100%;
11
- line-height: 1.15;
12
- -webkit-text-size-adjust: 100%;
13
- }
14
-
15
1
  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;
2
+ font-family: 'Roboto Condensed', 'Helvetica Neue', sans-serif;
3
+ font-size: 100%;
89
4
  }
@@ -1,4 +1,3 @@
1
- @import "./index.scss";
2
1
  :root {
3
2
  /* Primary colors */
4
3
  --primary-blue-deep: #0085BE;
@@ -33,8 +33,7 @@ $retina: '(min-resolution: 1.5dppx), (min-resolution: 144dpi)';
33
33
 
34
34
  @mixin focused {
35
35
  &:focus,
36
- &:focus-visible,
37
- &:focus-within {
36
+ &:focus-visible {
38
37
  @content;
39
38
  }
40
39
  }
@@ -5,6 +5,7 @@ export type ICoreButtonProps = ICoreSize & ICoreColor & ICoreInteractive & ICore
5
5
  interface IOptionButtonSegment {
6
6
  label: string;
7
7
  value: string;
8
+ disabled?: boolean;
8
9
  }
9
10
 
10
11
  export type TSegmentedButtonsProps = ICoreButtonProps & {
@@ -5,12 +5,10 @@ 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
9
8
  modelValue?: DateRange
10
9
  range?: boolean | RangeConfig | undefined
11
10
  minDate?: Date | null
12
11
  readonly?: boolean
13
- error?: string | boolean
14
12
  }
15
13
 
16
14
  export type TCoreCalendarProps = IBaseCalendarProps & ICoreSize;
@@ -8,16 +8,19 @@ 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
13
15
  tooltipOptions?: ITooltipProps
14
16
  validationText?: string
15
- focusable?: boolean
16
17
  }
17
18
 
19
+ interface IPropsBaseSiteInput extends InputProps {}
20
+
18
21
  type TTextareaProps = Omit<InputProps, 'type'>;
19
22
 
20
- export type ICorePropsBaseSiteInput = InputProps & ICoreSize;
23
+ export type ICorePropsBaseSiteInput = Omit<IPropsBaseSiteInput, 'id'> & ICoreSize;
21
24
 
22
25
  export type ICoreInputProps = InputProps & ICoreSize & ICoreState;
23
26
 
@@ -25,29 +28,14 @@ export type ICoreTextareaProps = ICoreState & TTextareaProps & ICoreSize;
25
28
 
26
29
  export type TSelectValue = Nullable<string | number | boolean>;
27
30
 
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
-
45
31
  export interface ICoreSelectOption {
46
32
  id: TSelectValue
47
33
  name: string
48
34
  disabled?: boolean
49
35
  icon?: string
50
36
  style?: Record<string, string>
37
+
38
+
51
39
  }
52
40
 
53
41
  export interface ICoreSelectBaseProps {
@@ -65,10 +53,4 @@ export interface ICoreSelectBaseProps {
65
53
  hint?: string
66
54
  }
67
55
 
68
- export interface ISelectSlotProps {
69
- item: ICoreSelectBaseProps;
70
- index: number;
71
- active: boolean;
72
- }
73
-
74
56
  export type ICoreSelectProps = ICoreSelectBaseProps & ICoreSize & ICoreState & ICoreStyle & ICorePlaceholder;
@@ -28,6 +28,7 @@ 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
31
32
  }
32
33
 
33
34
  export interface ICoreStyle {
@@ -1,98 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
- id: {
3
- default: string;
4
- };
5
- label: {
6
- default: string;
7
- };
8
- hint: {
9
- default: string;
10
- };
11
- error: {
12
- type: (BooleanConstructor | StringConstructor)[];
13
- default: string;
14
- };
15
- focusable: {
16
- type: BooleanConstructor;
17
- default: boolean;
18
- };
19
- tabIndex: {
20
- default: number;
21
- };
22
- size: {
23
- default: string;
24
- };
25
- selected: {
26
- type: BooleanConstructor;
27
- };
28
- active: {
29
- type: BooleanConstructor;
30
- };
31
- disabled: {
32
- type: BooleanConstructor;
33
- };
34
- required: {
35
- type: BooleanConstructor;
36
- };
37
- loading: {
38
- type: BooleanConstructor;
39
- };
40
- }>, (_ctx: any, _cache: any) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
41
- [key: string]: any;
42
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("error" | "update:modelValue")[], "error" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
43
- id: {
44
- default: string;
45
- };
46
- label: {
47
- default: string;
48
- };
49
- hint: {
50
- default: string;
51
- };
52
- error: {
53
- type: (BooleanConstructor | StringConstructor)[];
54
- default: string;
55
- };
56
- focusable: {
57
- type: BooleanConstructor;
58
- default: boolean;
59
- };
60
- tabIndex: {
61
- default: number;
62
- };
63
- size: {
64
- default: string;
65
- };
66
- selected: {
67
- type: BooleanConstructor;
68
- };
69
- active: {
70
- type: BooleanConstructor;
71
- };
72
- disabled: {
73
- type: BooleanConstructor;
74
- };
75
- required: {
76
- type: BooleanConstructor;
77
- };
78
- loading: {
79
- type: BooleanConstructor;
80
- };
81
- }>> & Readonly<{
82
- onError?: ((...args: any[]) => any) | undefined;
83
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
84
- }>, {
85
- size: string;
86
- label: string;
87
- error: string | boolean;
88
- id: string;
89
- disabled: boolean;
90
- selected: boolean;
91
- active: boolean;
92
- required: boolean;
93
- loading: boolean;
94
- focusable: boolean;
95
- hint: string;
96
- tabIndex: number;
97
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
98
- export default _default;