@central-design-system/components 3.0.0-alpha.0 → 3.0.0-alpha.1

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 (80) hide show
  1. package/dist/cds.css +1 -1
  2. package/dist/cds.d.ts +20 -3
  3. package/dist/cds.es.js +4649 -1354
  4. package/dist/cds.umd.js +1 -1
  5. package/dist/components/CdsButton/CdsButton.vue.d.ts +10 -10
  6. package/dist/components/CdsCheckbox/CdsCheckbox.vue.d.ts +222 -0
  7. package/dist/components/CdsCheckbox/CdsCheckboxGroup.vue.d.ts +205 -0
  8. package/dist/components/CdsDrawer/CdsDrawer.vue.d.ts +2 -2
  9. package/dist/components/CdsForm/CdsForm.vue.d.ts +99 -0
  10. package/dist/components/CdsIcon/CdsIcon.vue.d.ts +4 -4
  11. package/dist/components/CdsInput/CdsInput.vue.d.ts +219 -0
  12. package/dist/components/CdsInput/CdsInputCounter.vue.d.ts +39 -0
  13. package/dist/components/CdsInput/CdsInputDescription.vue.d.ts +26 -0
  14. package/dist/components/CdsInput/CdsInputLabel.vue.d.ts +32 -0
  15. package/dist/components/CdsInput/CdsInputMessages.vue.d.ts +221 -0
  16. package/dist/components/CdsInput/index.d.ts +5 -0
  17. package/dist/components/CdsList/CdsList.vue.d.ts +15 -27
  18. package/dist/components/CdsList/CdsListGroup.vue.d.ts +8 -8
  19. package/dist/components/CdsList/CdsListItem.vue.d.ts +24 -18
  20. package/dist/components/CdsList/composable/focus.d.ts +12 -0
  21. package/dist/components/CdsList/composable/index.d.ts +1 -0
  22. package/dist/components/CdsList/composable/list.d.ts +1 -1
  23. package/dist/components/CdsMenu/CdsMenu.vue.d.ts +592 -0
  24. package/dist/components/CdsMenu/shared.d.ts +10 -0
  25. package/dist/components/CdsOverlay/CdsOverlay.vue.d.ts +324 -0
  26. package/dist/components/CdsOverlay/composable/activator.d.ts +81 -0
  27. package/dist/components/CdsOverlay/composable/index.d.ts +6 -0
  28. package/dist/components/CdsOverlay/composable/locationStrategies.d.ts +75 -0
  29. package/dist/components/CdsOverlay/composable/scrim.d.ts +8 -0
  30. package/dist/components/CdsOverlay/composable/scrollStrategies.d.ts +33 -0
  31. package/dist/components/CdsOverlay/composable/stack.d.ts +9 -0
  32. package/dist/components/CdsOverlay/composable/teleport.d.ts +6 -0
  33. package/dist/components/CdsOverlay/utils/index.d.ts +2 -0
  34. package/dist/components/CdsOverlay/utils/point.d.ts +20 -0
  35. package/dist/components/CdsOverlay/utils/requestNewFrame.d.ts +5 -0
  36. package/dist/components/CdsRadioButton/CdsRadio.vue.d.ts +201 -0
  37. package/dist/components/CdsRadioButton/CdsRadioButton.vue.d.ts +200 -0
  38. package/dist/components/CdsSelect/CdsSelect.vue.d.ts +664 -0
  39. package/dist/components/CdsSidebar/CdsSidebar.vue.d.ts +61 -0
  40. package/dist/components/CdsStages/CdsStages.vue.d.ts +102 -0
  41. package/dist/components/CdsTextArea/CdsTextArea.vue.d.ts +681 -0
  42. package/dist/components/CdsTextInput/CdsTextInput.vue.d.ts +600 -0
  43. package/dist/components/index.d.ts +18 -1
  44. package/dist/composable/delay.d.ts +29 -0
  45. package/dist/composable/dimensions.d.ts +47 -0
  46. package/dist/composable/direction.d.ts +24 -0
  47. package/dist/composable/field.d.ts +138 -0
  48. package/dist/composable/focus.d.ts +19 -9
  49. package/dist/composable/form.d.ts +126 -0
  50. package/dist/composable/hidration.d.ts +1 -0
  51. package/dist/composable/icon.d.ts +29 -4
  52. package/dist/composable/index.d.ts +12 -0
  53. package/dist/composable/input.d.ts +97 -0
  54. package/dist/composable/items.d.ts +10 -9
  55. package/dist/composable/lazy.d.ts +11 -0
  56. package/dist/composable/link.d.ts +1 -2
  57. package/dist/composable/loading.d.ts +1 -0
  58. package/dist/composable/nested/nested.d.ts +2 -2
  59. package/dist/composable/overlay.d.ts +99 -0
  60. package/dist/composable/scopeId.d.ts +5 -0
  61. package/dist/composable/transition.d.ts +22 -0
  62. package/dist/composable/validation.d.ts +136 -0
  63. package/dist/directives/click-outside/index.d.ts +14 -0
  64. package/dist/directives/index.d.ts +1 -2
  65. package/dist/globals.d.ts +16 -0
  66. package/dist/transitions/createTransition.d.ts +31 -2
  67. package/dist/transitions/index.d.ts +90 -0
  68. package/dist/utils/anchor.d.ts +23 -0
  69. package/dist/utils/animation.d.ts +6 -0
  70. package/dist/utils/box.d.ts +26 -0
  71. package/dist/utils/dom.d.ts +6 -0
  72. package/dist/utils/getScrollParent.d.ts +3 -0
  73. package/dist/utils/globals.d.ts +4 -0
  74. package/dist/utils/helpers.d.ts +26 -2
  75. package/dist/utils/index.d.ts +6 -0
  76. package/package.json +3 -3
  77. package/src/scss/mixins/layout/_shadow.scss +4 -0
  78. package/src/scss/mixins/layout/index.scss +1 -0
  79. package/src/scss/modules/_transition.scss +31 -3
  80. package/src/scss/themes/index.ts +1 -1
@@ -1,18 +1,35 @@
1
1
  /**
2
2
  * Automatically generated by CDS CLI
3
- * Generated on 2/17/2023, 8:45:21 PM
3
+ * Generated on 4/24/2023, 2:59:08 PM
4
4
  **/
5
5
  export { default as CdsBadge } from './CdsBadge/CdsBadge.vue';
6
6
  export { default as CdsButton } from './CdsButton/CdsButton.vue';
7
+ export { default as CdsCheckbox } from './CdsCheckbox/CdsCheckbox.vue';
8
+ export { default as CdsCheckboxGroup } from './CdsCheckbox/CdsCheckboxGroup.vue';
7
9
  export { default as CdsDrawer } from './CdsDrawer/CdsDrawer.vue';
10
+ export { default as CdsForm } from './CdsForm/CdsForm.vue';
8
11
  export { default as CdsCol } from './CdsGrid/CdsCol.vue';
9
12
  export { default as CdsGrid } from './CdsGrid/CdsGrid.vue';
10
13
  export { default as CdsRow } from './CdsGrid/CdsRow.vue';
11
14
  export { default as CdsIcon } from './CdsIcon/CdsIcon.vue';
15
+ export { default as CdsInput } from './CdsInput/CdsInput.vue';
16
+ export { default as CdsInputCounter } from './CdsInput/CdsInputCounter.vue';
17
+ export { default as CdsInputDescription } from './CdsInput/CdsInputDescription.vue';
18
+ export { default as CdsInputLabel } from './CdsInput/CdsInputLabel.vue';
19
+ export { default as CdsInputMessages } from './CdsInput/CdsInputMessages.vue';
12
20
  export { default as CdsLink } from './CdsLink/CdsLink.vue';
13
21
  export { default as CdsList } from './CdsList/CdsList.vue';
14
22
  export { default as CdsListGroup } from './CdsList/CdsListGroup.vue';
15
23
  export { default as CdsListItem } from './CdsList/CdsListItem.vue';
16
24
  export { default as CdsLoader } from './CdsLoader/CdsLoader.vue';
25
+ export { default as CdsMenu } from './CdsMenu/CdsMenu.vue';
26
+ export { default as CdsOverlay } from './CdsOverlay/CdsOverlay.vue';
27
+ export { default as CdsRadio } from './CdsRadioButton/CdsRadio.vue';
28
+ export { default as CdsRadioButton } from './CdsRadioButton/CdsRadioButton.vue';
29
+ export { default as CdsSelect } from './CdsSelect/CdsSelect.vue';
30
+ export { default as CdsSidebar } from './CdsSidebar/CdsSidebar.vue';
31
+ export { default as CdsStages } from './CdsStages/CdsStages.vue';
17
32
  export { default as CdsStatus } from './CdsStatus/CdsStatus.vue';
18
33
  export { default as CdsTag } from './CdsTag/CdsTag.vue';
34
+ export { default as CdsTextArea } from './CdsTextArea/CdsTextArea.vue';
35
+ export { default as CdsTextInput } from './CdsTextInput/CdsTextInput.vue';
@@ -0,0 +1,29 @@
1
+ import { PropType } from 'vue';
2
+ export interface IDelayProps {
3
+ closeDelay: number | string;
4
+ openDelay: number | string;
5
+ }
6
+ export interface IUseDelay {
7
+ runCloseDelay: () => void;
8
+ runOpenDelay: () => void;
9
+ }
10
+ export declare const makeDelayProps: <Defaults extends {
11
+ closeDelay?: unknown;
12
+ openDelay?: unknown;
13
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
14
+ /**
15
+ * Задержка в миллисекундах перед закрытием оверлея. Только для события hover и focus.
16
+ */
17
+ closeDelay: {
18
+ type: PropType<string | number>;
19
+ default: null;
20
+ };
21
+ /**
22
+ * Задержка в миллисекундах перед открытием оверлея. Только для события hover и focus.
23
+ */
24
+ openDelay: {
25
+ type: PropType<string | number>;
26
+ default: null;
27
+ };
28
+ }, Defaults>;
29
+ export declare function useDelay(props: IDelayProps, cb?: (value: boolean) => void): IUseDelay;
@@ -0,0 +1,47 @@
1
+ import { ComputedRef } from 'vue';
2
+ import type { PropType } from 'vue';
3
+ export interface IDimensionsProps {
4
+ height: number | string;
5
+ maxHeight: number | string;
6
+ maxWidth: number | string;
7
+ minHeight: number | string;
8
+ minWidth: number | string;
9
+ width: number | string;
10
+ }
11
+ export interface IUseDimensions {
12
+ dimensionsStyles: ComputedRef<Record<string, any>>;
13
+ }
14
+ export declare const makeDimensionProps: <Defaults extends {
15
+ height?: unknown;
16
+ maxHeight?: unknown;
17
+ maxWidth?: unknown;
18
+ minHeight?: unknown;
19
+ minWidth?: unknown;
20
+ width?: unknown;
21
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
22
+ height: {
23
+ type: PropType<string | number>;
24
+ default: string;
25
+ };
26
+ maxHeight: {
27
+ type: PropType<string | number>;
28
+ default: string;
29
+ };
30
+ maxWidth: {
31
+ type: PropType<string | number>;
32
+ default: string;
33
+ };
34
+ minHeight: {
35
+ type: PropType<string | number>;
36
+ default: string;
37
+ };
38
+ minWidth: {
39
+ type: PropType<string | number>;
40
+ default: string;
41
+ };
42
+ width: {
43
+ type: PropType<string | number>;
44
+ default: string;
45
+ };
46
+ }, Defaults>;
47
+ export declare function useDimensions(props: IDimensionsProps): IUseDimensions;
@@ -0,0 +1,24 @@
1
+ import type { ComputedRef, PropType } from 'vue';
2
+ import type { MaybeRef } from '../utils';
3
+ export declare type TDirection = typeof allowedDirection[number];
4
+ export interface IDirectionProps {
5
+ direction: TDirection;
6
+ }
7
+ export interface IUseDirection {
8
+ directionClasses: ComputedRef<string>;
9
+ }
10
+ export declare const allowedDirection: readonly ["horizontal", "vertical"];
11
+ export declare const makeDirectionProps: <Defaults extends {
12
+ direction?: unknown;
13
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
14
+ /**
15
+ * Расположение горизонтальное или вертикальное
16
+ */
17
+ direction: {
18
+ type: PropType<"horizontal" | "vertical">;
19
+ default: string;
20
+ available: readonly ["horizontal", "vertical"];
21
+ validator: (value: TDirection) => boolean;
22
+ };
23
+ }, Defaults>;
24
+ export declare function useDirection(props: MaybeRef<IDirectionProps>, name: string): IUseDirection;
@@ -0,0 +1,138 @@
1
+ import type { ComputedRef, PropType } from 'vue';
2
+ import type { EventProp } from '../utils';
3
+ import type { TCdsIconsName } from '@central-design-system/icons';
4
+ export declare type TFieldTypes = typeof allowedFieldType[number];
5
+ export interface IFieldProps {
6
+ active: boolean;
7
+ autofocus: boolean;
8
+ prefix: string | undefined;
9
+ suffix: string | undefined;
10
+ prependInnerIcon: TCdsIconsName | undefined;
11
+ appendInnerIcon: TCdsIconsName | undefined;
12
+ type: TFieldTypes | undefined;
13
+ placeholder: string | undefined;
14
+ counter: boolean;
15
+ clearable: boolean;
16
+ 'onClick:appendInner': EventProp | undefined;
17
+ 'onClick:prependInner': EventProp | undefined;
18
+ }
19
+ export interface IUseField {
20
+ hasPrependInnerIcon: ComputedRef<boolean>;
21
+ hasAppendInnerIcon: ComputedRef<boolean>;
22
+ fieldClasses: ComputedRef<Record<string, boolean>>;
23
+ fieldProps: string[];
24
+ handleClickPrependInner: (event: MouseEvent) => void;
25
+ handleClickAppendInner: (event: MouseEvent) => void;
26
+ }
27
+ export declare const allowedFieldType: readonly ["text", "password", "email", "number", "tel", "url"];
28
+ export declare const makeFieldProps: <Defaults extends {
29
+ active?: unknown;
30
+ autofocus?: unknown;
31
+ prefix?: unknown;
32
+ suffix?: unknown;
33
+ prependInnerIcon?: unknown;
34
+ appendInnerIcon?: unknown;
35
+ type?: unknown;
36
+ placeholder?: unknown;
37
+ counter?: unknown;
38
+ limit?: unknown;
39
+ clearable?: unknown;
40
+ 'onClick:prependInner'?: unknown;
41
+ 'onClick:appendInner'?: unknown;
42
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
43
+ /**
44
+ * Активный элемент
45
+ */
46
+ active: {
47
+ type: PropType<boolean>;
48
+ default: boolean;
49
+ };
50
+ /**
51
+ * Автофокус
52
+ */
53
+ autofocus: {
54
+ type: PropType<boolean>;
55
+ default: boolean;
56
+ };
57
+ /**
58
+ * Добавить строку внутрь поля перед значением
59
+ */
60
+ prefix: {
61
+ type: PropType<string>;
62
+ default: undefined;
63
+ };
64
+ /**
65
+ * Добавить строку внутрь поля после значения
66
+ */
67
+ suffix: {
68
+ type: PropType<string>;
69
+ default: undefined;
70
+ };
71
+ /**
72
+ * Иконка внутри элемента перед значением поля
73
+ */
74
+ prependInnerIcon: {
75
+ type: PropType<"add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "filters" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "link" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "save" | "search" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
76
+ default: undefined;
77
+ validator: (value: TCdsIconsName) => boolean;
78
+ };
79
+ /**
80
+ * Иконка внутри элемента после значения поля
81
+ */
82
+ appendInnerIcon: {
83
+ type: PropType<"add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "filters" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "link" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "save" | "search" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
84
+ default: undefined;
85
+ validator: (value: TCdsIconsName) => boolean;
86
+ };
87
+ /**
88
+ * Тип поля
89
+ */
90
+ type: {
91
+ type: PropType<"number" | "password" | "text" | "email" | "tel" | "url">;
92
+ default: string;
93
+ validator: (value: TFieldTypes) => boolean;
94
+ };
95
+ /**
96
+ * Плейсхолдер поля
97
+ */
98
+ placeholder: {
99
+ type: PropType<string>;
100
+ default: undefined;
101
+ };
102
+ /**
103
+ * Счетчик введенных символов
104
+ */
105
+ counter: {
106
+ type: PropType<boolean>;
107
+ default: boolean;
108
+ };
109
+ /**
110
+ * Ограничение ввода по количеству символов
111
+ */
112
+ limit: {
113
+ type: PropType<number>;
114
+ default: undefined;
115
+ };
116
+ /**
117
+ * Очищаемое поле
118
+ */
119
+ clearable: {
120
+ type: PropType<boolean>;
121
+ default: boolean;
122
+ };
123
+ /**
124
+ * Событие клика по иконке внутри элемента перед значением поля
125
+ */
126
+ 'onClick:prependInner': {
127
+ type: PropType<(...args: any[]) => any>;
128
+ default: undefined;
129
+ };
130
+ /**
131
+ * Событие клика по иконке внутри элемента после значения поля
132
+ */
133
+ 'onClick:appendInner': {
134
+ type: PropType<(...args: any[]) => any>;
135
+ default: undefined;
136
+ };
137
+ }, Defaults>;
138
+ export declare function useField(props: IFieldProps, slots: Record<string, unknown>, name: string): IUseField;
@@ -1,12 +1,22 @@
1
- import type { Ref } from 'vue';
2
- export declare type TFocusLocation = 'next' | 'previous' | 'first' | 'last';
1
+ import type { ComputedRef, PropType, Ref } from 'vue';
2
+ export interface IFocusProps {
3
+ focused: boolean;
4
+ }
3
5
  export interface IUseFocus {
4
- contentRef: Ref<HTMLElement | null>;
5
6
  isFocused: Ref<boolean>;
6
- onFocusin: (event: FocusEvent) => void;
7
- onFocusout: (event: FocusEvent) => void;
8
- onFocus: (event: FocusEvent) => void;
9
- onKeydown: (event: KeyboardEvent) => void;
10
- focus: (location?: TFocusLocation) => void;
7
+ focusClasses: ComputedRef<Record<string, boolean>>;
8
+ focus: () => void;
9
+ blur: () => void;
11
10
  }
12
- export declare function useFocus(): IUseFocus;
11
+ export declare const makeFocusProps: <Defaults extends {
12
+ focused?: unknown;
13
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
14
+ /**
15
+ * Элемент в фокусе
16
+ */
17
+ focused: {
18
+ type: PropType<boolean>;
19
+ default: boolean;
20
+ };
21
+ }, Defaults>;
22
+ export declare function useFocus(props: IFocusProps, name: string): IUseFocus;
@@ -0,0 +1,126 @@
1
+ import { InjectionKey } from 'vue';
2
+ import type { Ref, ComputedRef, PropType } from 'vue';
3
+ import type { IValidationProps } from './validation';
4
+ export interface IFormProvide {
5
+ register: (item: {
6
+ id: number | string;
7
+ validate: () => Promise<string[]>;
8
+ reset: () => void;
9
+ resetValidation: () => void;
10
+ }) => void;
11
+ unregister: (id: number | string) => void;
12
+ update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void;
13
+ items: Ref<IFormField[]>;
14
+ isDisabled: ComputedRef<boolean>;
15
+ isReadonly: ComputedRef<boolean>;
16
+ isValidating: Ref<boolean>;
17
+ validateOn: Ref<IFormProps['validateOn']>;
18
+ }
19
+ export interface IFormProps {
20
+ disabled: boolean;
21
+ readonly: boolean;
22
+ firstFail: boolean;
23
+ modelValue: boolean | null;
24
+ validateOn?: IValidationProps['validateOn'];
25
+ }
26
+ interface IFormField {
27
+ id: number | string;
28
+ validate: () => Promise<string[]>;
29
+ reset: () => void;
30
+ resetValidation: () => void;
31
+ isValid: boolean | null;
32
+ errorMessages: string[];
33
+ }
34
+ interface IFieldValidationResult {
35
+ id: number | string;
36
+ errorMessages: string[];
37
+ }
38
+ interface IFormValidationResult {
39
+ valid: boolean;
40
+ errors: IFieldValidationResult[];
41
+ }
42
+ export interface SubmitEventPromise extends SubmitEvent, Promise<IFormValidationResult> {
43
+ }
44
+ export declare const makeFormProps: <Defaults extends {
45
+ label?: unknown;
46
+ description?: unknown;
47
+ disabled?: unknown;
48
+ readonly?: unknown;
49
+ firstFail?: unknown;
50
+ modelValue?: unknown;
51
+ validateOn?: unknown;
52
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
53
+ /**
54
+ * Заголовок формы
55
+ */
56
+ label: {
57
+ type: PropType<string>;
58
+ default: string;
59
+ };
60
+ /**
61
+ * Описание формы
62
+ */
63
+ description: {
64
+ type: PropType<string>;
65
+ default: string;
66
+ };
67
+ /**
68
+ * Заблокировать форму
69
+ */
70
+ disabled: {
71
+ type: PropType<boolean>;
72
+ default: boolean;
73
+ };
74
+ /**
75
+ * Сделать форму только для чтения
76
+ */
77
+ readonly: {
78
+ type: PropType<boolean>;
79
+ default: boolean;
80
+ };
81
+ /**
82
+ * Остановить валидацию при первой ошибке
83
+ */
84
+ firstFail: {
85
+ type: PropType<boolean>;
86
+ default: boolean;
87
+ };
88
+ /**
89
+ * Значение модели
90
+ */
91
+ modelValue: {
92
+ type: PropType<boolean | null>;
93
+ default: null;
94
+ };
95
+ /**
96
+ * Событие для валидации
97
+ */
98
+ validateOn: {
99
+ type: PropType<"input" | "blur" | "submit" | undefined>;
100
+ default: string;
101
+ };
102
+ }, Defaults>;
103
+ export declare const FormKey: InjectionKey<IFormProvide>;
104
+ export declare function createForm(props: IFormProps): {
105
+ errors: Ref<{
106
+ id: string | number;
107
+ errorMessages: string[];
108
+ }[]>;
109
+ isDisabled: ComputedRef<boolean>;
110
+ isReadonly: ComputedRef<boolean>;
111
+ isValidating: Ref<boolean>;
112
+ model: Ref<boolean | null> & {
113
+ readonly externalValue: boolean | null;
114
+ };
115
+ validate: () => Promise<{
116
+ valid: boolean;
117
+ errors: {
118
+ id: string | number;
119
+ errorMessages: string[];
120
+ }[];
121
+ }>;
122
+ reset: () => void;
123
+ resetValidation: () => void;
124
+ };
125
+ export declare function useForm(): IFormProvide | null;
126
+ export {};
@@ -0,0 +1 @@
1
+ export declare function useHydration(): import("vue").Ref<boolean>;
@@ -1,12 +1,18 @@
1
- import type { PropType, ComputedRef, SetupContext } from 'vue';
1
+ import { EventProp } from '../utils';
2
+ import type { PropType, ComputedRef } from 'vue';
2
3
  import type { TCdsIconsName } from '@central-design-system/icons';
3
4
  export interface IIconProps {
4
5
  prependIcon: TCdsIconsName | undefined;
5
6
  appendIcon: TCdsIconsName | undefined;
7
+ 'onClick:prepend'?: EventProp | undefined;
8
+ 'onClick:append'?: EventProp | undefined;
6
9
  }
7
10
  export interface IUseIcon {
8
11
  hasPrepend: ComputedRef<boolean>;
9
12
  hasAppend: ComputedRef<boolean>;
13
+ iconClasses: ComputedRef<Record<string, boolean>>;
14
+ handleClickPrepend: (event: MouseEvent) => void;
15
+ handleClickAppend: (event: MouseEvent) => void;
10
16
  }
11
17
  export declare const makeIconProps: <Defaults extends {
12
18
  prependIcon?: unknown;
@@ -16,7 +22,7 @@ export declare const makeIconProps: <Defaults extends {
16
22
  * Иконка в начале элемента
17
23
  */
18
24
  prependIcon: {
19
- type: PropType<"add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "filters" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "link" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "search" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
25
+ type: PropType<"add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "filters" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "link" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "save" | "search" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
20
26
  default: undefined;
21
27
  validator: (value: TCdsIconsName) => boolean;
22
28
  };
@@ -24,9 +30,28 @@ export declare const makeIconProps: <Defaults extends {
24
30
  * Иконка в конце элемента
25
31
  */
26
32
  appendIcon: {
27
- type: PropType<"add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "filters" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "link" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "search" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
33
+ type: PropType<"add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "filters" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "link" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "save" | "search" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
28
34
  default: undefined;
29
35
  validator: (value: TCdsIconsName) => boolean;
30
36
  };
31
37
  }, Defaults>;
32
- export declare function useIcon(props: IIconProps, context: SetupContext<any>): IUseIcon;
38
+ export declare const makeIconEvents: <Defaults extends {
39
+ 'onClick:prepend'?: unknown;
40
+ 'onClick:append'?: unknown;
41
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
42
+ /**
43
+ * Событие клика по иконке перед значением поля
44
+ */
45
+ 'onClick:prepend': {
46
+ type: PropType<(...args: any[]) => any>;
47
+ default: undefined;
48
+ };
49
+ /**
50
+ * Событие клика по иконке после значения поля
51
+ */
52
+ 'onClick:append': {
53
+ type: PropType<(...args: any[]) => any>;
54
+ default: undefined;
55
+ };
56
+ }, Defaults>;
57
+ export declare function useIcon(props: IIconProps, slots: Record<string, unknown>, name: string): IUseIcon;
@@ -15,3 +15,15 @@ export * from './proxyModel';
15
15
  export * from './toggleScope';
16
16
  export * from './nested/nested';
17
17
  export * from './render';
18
+ export * from './input';
19
+ export * from './form';
20
+ export * from './validation';
21
+ export * from './direction';
22
+ export * from './field';
23
+ export * from './transition';
24
+ export * from './overlay';
25
+ export * from './lazy';
26
+ export * from './delay';
27
+ export * from './dimensions';
28
+ export * from './hidration';
29
+ export * from './scopeId';
@@ -0,0 +1,97 @@
1
+ import type { ComputedRef, PropType, Ref } from 'vue';
2
+ export interface IInputSlot {
3
+ id: ComputedRef<string>;
4
+ isDirty: ComputedRef<boolean>;
5
+ isDisabled: ComputedRef<boolean>;
6
+ isReadonly: ComputedRef<boolean>;
7
+ isPure: Ref<boolean>;
8
+ isValid: ComputedRef<boolean | null>;
9
+ isValidating: Ref<boolean>;
10
+ reset: () => void;
11
+ resetValidation: () => void;
12
+ validate: () => Promise<string[]>;
13
+ }
14
+ export interface IInputProps {
15
+ id: string | undefined;
16
+ label: string | undefined;
17
+ description: string | undefined;
18
+ value: any;
19
+ }
20
+ export interface IUseInput {
21
+ id: ComputedRef<string>;
22
+ hasLabel: ComputedRef<boolean>;
23
+ hasDescription: ComputedRef<boolean>;
24
+ }
25
+ export declare const makeInputProps: <Defaults extends {
26
+ id?: unknown;
27
+ label?: unknown;
28
+ description?: unknown;
29
+ value?: unknown;
30
+ messages?: unknown;
31
+ persistentMessages?: unknown;
32
+ } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
33
+ /**
34
+ * Идентификатор
35
+ */
36
+ id: {
37
+ type: PropType<string>;
38
+ default: undefined;
39
+ };
40
+ /**
41
+ * Лейбл
42
+ */
43
+ label: {
44
+ type: PropType<string>;
45
+ default: undefined;
46
+ };
47
+ /**
48
+ * Описание
49
+ */
50
+ description: {
51
+ type: PropType<string>;
52
+ default: undefined;
53
+ };
54
+ /**
55
+ * Значение
56
+ */
57
+ value: {
58
+ type: PropType<any>;
59
+ default: null;
60
+ };
61
+ /**
62
+ * Сообщения подсказки
63
+ */
64
+ messages: {
65
+ type: PropType<string | string[]>;
66
+ default: () => never[];
67
+ };
68
+ /**
69
+ * Всегда показывать сообщения и подсказки
70
+ */
71
+ persistentMessages: {
72
+ type: PropType<boolean>;
73
+ default: boolean;
74
+ };
75
+ }, Defaults>;
76
+ export declare function useInput(props: IInputProps, slots: Record<string, unknown>, name?: string): IUseInput;
77
+ export declare function useFilteredInputProps(props: Record<string, unknown>, exclude: string[]): {
78
+ inputProps: Ref<{}>;
79
+ excludedProps: Ref<{}>;
80
+ };
81
+ export declare function useFilteredInputAttrs(attrs: Record<string, unknown>): {
82
+ rootAttrs: Ref<{}>;
83
+ inputAttrs: Ref<{}>;
84
+ };
85
+ /**
86
+ * Filter attributes that should be applied to
87
+ * the root element of a an input component. Remaining
88
+ * attributes should be passed to the <input> element inside.
89
+ */
90
+ export declare function filterInputAttrs(attrs: Record<string, unknown>): [yes: Partial<Pick<Record<string, unknown>, any>>, no: Omit<Record<string, unknown>, any>];
91
+ /**
92
+ * Filter props for input controls
93
+ * @param props
94
+ * @param exclude
95
+ */
96
+ export declare function filterInputProps(props: Record<string, unknown>, exclude: string[]): (Partial<Pick<Record<string, unknown>, string>> | Omit<Record<string, unknown>, string>)[];
97
+ export declare const excludeControls: RegExp;