@alfalab/core-components-date-range-input 2.4.0 → 3.0.0
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.
- package/Component-63dec22f.d.ts +167 -0
- package/Component-89a3cf4c.d.ts +6 -0
- package/Component-8b5756fe.d.ts +380 -0
- package/Component.desktop-2e2b2125.d.ts +6 -0
- package/Component.desktop-8b5756fe.d.ts +197 -0
- package/Component.desktop.d.ts +1 -1
- package/Component.desktop.js +4 -3
- package/Component.mobile-755fbaa3.d.ts +6 -0
- package/Component.mobile-ebda875c.d.ts +6 -0
- package/Component.mobile.d.ts +1 -1
- package/Component.mobile.js +4 -3
- package/Component.responsive-2e2b2125.d.ts +66 -0
- package/Component.responsive.d.ts +1 -1
- package/Component.responsive.js +5 -2
- package/components/date-range-input/Component.d.ts +7 -2
- package/components/date-range-input/Component.js +10 -11
- package/components/date-range-input/index.css +7 -7
- package/components/date-range-input/index.js +1 -2
- package/cssm/Component-63dec22f.d.ts +167 -0
- package/cssm/Component-89a3cf4c.d.ts +6 -0
- package/cssm/Component-8b5756fe.d.ts +380 -0
- package/cssm/Component.desktop-2e2b2125.d.ts +6 -0
- package/cssm/Component.desktop-8b5756fe.d.ts +197 -0
- package/cssm/Component.desktop.d.ts +1 -1
- package/cssm/Component.desktop.js +4 -3
- package/cssm/Component.mobile-755fbaa3.d.ts +6 -0
- package/cssm/Component.mobile-ebda875c.d.ts +6 -0
- package/cssm/Component.mobile.d.ts +1 -1
- package/cssm/Component.mobile.js +4 -3
- package/cssm/Component.responsive-2e2b2125.d.ts +66 -0
- package/cssm/Component.responsive.d.ts +1 -1
- package/cssm/Component.responsive.js +5 -2
- package/cssm/components/date-range-input/Component.d.ts +7 -2
- package/cssm/components/date-range-input/Component.js +9 -10
- package/cssm/components/date-range-input/index.js +1 -2
- package/cssm/desktop-63dec22f.d.ts +2 -0
- package/cssm/desktop.js +3 -2
- package/cssm/index-89a3cf4c.d.ts +3 -0
- package/cssm/index-9211a437.d.ts +2 -0
- package/cssm/index-ebda875c.d.ts +35 -0
- package/cssm/index-f034f741.d.ts +80 -0
- package/cssm/index.d.ts +3 -2
- package/cssm/index.js +5 -2
- package/cssm/mobile-c219f8ca.d.ts +1 -0
- package/cssm/mobile.js +3 -2
- package/cssm/types-ebda875c.d.ts +113 -0
- package/cssm/typings-5684a67d.d.ts +23 -0
- package/cssm/typings-9211a437.d.ts +95 -0
- package/cssm/useCalendar-5684a67d.d.ts +97 -0
- package/cssm/utils-5684a67d.d.ts +88 -0
- package/desktop-63dec22f.d.ts +2 -0
- package/desktop.js +3 -2
- package/esm/Component-63dec22f.d.ts +167 -0
- package/esm/Component-89a3cf4c.d.ts +6 -0
- package/esm/Component-8b5756fe.d.ts +380 -0
- package/esm/Component.desktop-2e2b2125.d.ts +6 -0
- package/esm/Component.desktop-8b5756fe.d.ts +197 -0
- package/esm/Component.desktop.d.ts +1 -1
- package/esm/Component.desktop.js +4 -3
- package/esm/Component.mobile-755fbaa3.d.ts +6 -0
- package/esm/Component.mobile-ebda875c.d.ts +6 -0
- package/esm/Component.mobile.d.ts +1 -1
- package/esm/Component.mobile.js +4 -3
- package/esm/Component.responsive-2e2b2125.d.ts +66 -0
- package/esm/Component.responsive.d.ts +1 -1
- package/esm/Component.responsive.js +5 -2
- package/esm/components/date-range-input/Component.d.ts +7 -2
- package/esm/components/date-range-input/Component.js +10 -11
- package/esm/components/date-range-input/index.css +7 -7
- package/esm/components/date-range-input/index.js +1 -2
- package/esm/desktop-63dec22f.d.ts +2 -0
- package/esm/desktop.js +3 -2
- package/esm/index-89a3cf4c.d.ts +3 -0
- package/esm/index-9211a437.d.ts +2 -0
- package/esm/index-ebda875c.d.ts +35 -0
- package/esm/index-f034f741.d.ts +80 -0
- package/esm/index.d.ts +3 -2
- package/esm/index.js +5 -2
- package/esm/mobile-c219f8ca.d.ts +1 -0
- package/esm/mobile.js +3 -2
- package/esm/types-ebda875c.d.ts +113 -0
- package/esm/typings-5684a67d.d.ts +23 -0
- package/esm/typings-9211a437.d.ts +95 -0
- package/esm/useCalendar-5684a67d.d.ts +97 -0
- package/esm/utils-5684a67d.d.ts +88 -0
- package/index-89a3cf4c.d.ts +3 -0
- package/index-9211a437.d.ts +2 -0
- package/index-ebda875c.d.ts +35 -0
- package/index-f034f741.d.ts +80 -0
- package/index.d.ts +3 -2
- package/index.js +5 -2
- package/mobile-c219f8ca.d.ts +1 -0
- package/mobile.js +3 -2
- package/modern/Component-63dec22f.d.ts +167 -0
- package/modern/Component-89a3cf4c.d.ts +6 -0
- package/modern/Component-8b5756fe.d.ts +380 -0
- package/modern/Component.desktop-2e2b2125.d.ts +6 -0
- package/modern/Component.desktop-8b5756fe.d.ts +197 -0
- package/modern/Component.desktop.d.ts +1 -1
- package/modern/Component.desktop.js +4 -3
- package/modern/Component.mobile-755fbaa3.d.ts +6 -0
- package/modern/Component.mobile-ebda875c.d.ts +6 -0
- package/modern/Component.mobile.d.ts +1 -1
- package/modern/Component.mobile.js +4 -3
- package/modern/Component.responsive-2e2b2125.d.ts +66 -0
- package/modern/Component.responsive.d.ts +1 -1
- package/modern/Component.responsive.js +5 -2
- package/modern/components/date-range-input/Component.d.ts +7 -2
- package/modern/components/date-range-input/Component.js +7 -8
- package/modern/components/date-range-input/index.css +7 -7
- package/modern/components/date-range-input/index.js +1 -2
- package/modern/desktop-63dec22f.d.ts +2 -0
- package/modern/desktop.js +3 -2
- package/modern/index-89a3cf4c.d.ts +3 -0
- package/modern/index-9211a437.d.ts +2 -0
- package/modern/index-ebda875c.d.ts +35 -0
- package/modern/index-f034f741.d.ts +80 -0
- package/modern/index.d.ts +3 -2
- package/modern/index.js +5 -2
- package/modern/mobile-c219f8ca.d.ts +1 -0
- package/modern/mobile.js +3 -2
- package/modern/types-ebda875c.d.ts +113 -0
- package/modern/typings-5684a67d.d.ts +23 -0
- package/modern/typings-9211a437.d.ts +95 -0
- package/modern/useCalendar-5684a67d.d.ts +97 -0
- package/modern/utils-5684a67d.d.ts +88 -0
- package/package.json +25 -5
- package/src/Component.desktop.tsx +29 -0
- package/src/Component.mobile.tsx +30 -0
- package/src/Component.responsive.tsx +41 -0
- package/src/components/date-range-input/Component.tsx +519 -0
- package/src/components/date-range-input/index.module.css +37 -0
- package/src/components/date-range-input/index.ts +1 -0
- package/src/desktop.ts +1 -0
- package/src/index.ts +2 -0
- package/src/mobile.ts +1 -0
- package/src/utils/format.ts +91 -0
- package/src/utils/index.ts +1 -0
- package/types-ebda875c.d.ts +113 -0
- package/typings-5684a67d.d.ts +23 -0
- package/typings-9211a437.d.ts +95 -0
- package/useCalendar-5684a67d.d.ts +97 -0
- package/utils-5684a67d.d.ts +88 -0
- package/cssm/responsive.d.ts +0 -2
- package/cssm/responsive.js +0 -27
- package/esm/responsive.d.ts +0 -2
- package/esm/responsive.js +0 -18
- package/modern/responsive.d.ts +0 -2
- package/modern/responsive.js +0 -17
- package/responsive.d.ts +0 -2
- package/responsive.js +0 -26
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, ReactNode } from 'react';
|
|
2
|
+
type StyleColors = {
|
|
3
|
+
default: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
6
|
+
inverted: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
type ComponentProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Тип кнопки
|
|
13
|
+
* @default secondary
|
|
14
|
+
*/
|
|
15
|
+
view?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'outlined' | 'filled' | 'transparent' | 'link' | 'ghost';
|
|
16
|
+
/**
|
|
17
|
+
* Слот слева
|
|
18
|
+
*/
|
|
19
|
+
leftAddons?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Слот справа
|
|
22
|
+
*/
|
|
23
|
+
rightAddons?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Размер компонента
|
|
26
|
+
* @default m
|
|
27
|
+
*/
|
|
28
|
+
size?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
29
|
+
/**
|
|
30
|
+
* Растягивает компонент на ширину контейнера
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
block?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Дополнительный класс
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Дополнительный класс для спиннера
|
|
40
|
+
*/
|
|
41
|
+
spinnerClassName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Выводит ссылку в виде кнопки
|
|
44
|
+
*/
|
|
45
|
+
href?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
|
|
48
|
+
*/
|
|
49
|
+
Component?: ElementType;
|
|
50
|
+
/**
|
|
51
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
52
|
+
*/
|
|
53
|
+
dataTestId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Показать лоадер
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
loading?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Не переносить текст кнопки на новую строку
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
nowrap?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Набор цветов для компонента
|
|
66
|
+
*/
|
|
67
|
+
colors?: 'default' | 'inverted';
|
|
68
|
+
/**
|
|
69
|
+
* Дочерние элементы.
|
|
70
|
+
*/
|
|
71
|
+
children?: ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Основные стили компонента.
|
|
74
|
+
*/
|
|
75
|
+
styles: {
|
|
76
|
+
[key: string]: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Стили компонента для default и inverted режима.
|
|
80
|
+
*/
|
|
81
|
+
colorStylesMap: StyleColors;
|
|
82
|
+
};
|
|
83
|
+
type AnchorBaseButtonProps = ComponentProps & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
84
|
+
type NativeBaseButtonProps = ComponentProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
85
|
+
type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
|
|
86
|
+
type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
87
|
+
type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
88
|
+
type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
|
|
89
|
+
/**
|
|
90
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
91
|
+
* @default 1024
|
|
92
|
+
*/
|
|
93
|
+
breakpoint?: number;
|
|
94
|
+
};
|
|
95
|
+
export { StyleColors, ComponentProps, AnchorBaseButtonProps, NativeBaseButtonProps, BaseButtonProps, AnchorButtonProps, NativeButtonProps, ButtonProps };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { KeyboardEvent, MouseEvent, Ref } from 'react';
|
|
3
|
+
import { Day, DayAddons, Month, View } from "./typings-5684a67d";
|
|
4
|
+
type UseCalendarProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Активный вид (выбор дней, месяцев, лет)
|
|
7
|
+
*/
|
|
8
|
+
view?: View;
|
|
9
|
+
/**
|
|
10
|
+
* Выбранный месяц (controlled)
|
|
11
|
+
*/
|
|
12
|
+
month?: Date;
|
|
13
|
+
/**
|
|
14
|
+
* Начальный месяц
|
|
15
|
+
*/
|
|
16
|
+
defaultMonth: Date;
|
|
17
|
+
/**
|
|
18
|
+
* Минимальная дата, доступная для выбора
|
|
19
|
+
*/
|
|
20
|
+
minDate?: Date;
|
|
21
|
+
/**
|
|
22
|
+
* Максимальная дата, доступная для выбора
|
|
23
|
+
*/
|
|
24
|
+
maxDate?: Date;
|
|
25
|
+
/**
|
|
26
|
+
* Выбранная дата
|
|
27
|
+
*/
|
|
28
|
+
selected?: Date;
|
|
29
|
+
/**
|
|
30
|
+
* Список событий
|
|
31
|
+
*/
|
|
32
|
+
events?: Array<Date | number>;
|
|
33
|
+
/**
|
|
34
|
+
* Список отключенных для выбора дней
|
|
35
|
+
*/
|
|
36
|
+
offDays?: Array<Date | number>;
|
|
37
|
+
/**
|
|
38
|
+
* Список выходных дней
|
|
39
|
+
*/
|
|
40
|
+
holidays?: Array<Date | number>;
|
|
41
|
+
/**
|
|
42
|
+
* Обработчик изменения месяца (или года)
|
|
43
|
+
*/
|
|
44
|
+
onMonthChange?: (month: number) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Обработчик выбора даты
|
|
47
|
+
*/
|
|
48
|
+
onChange?: (date: number) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Дополнительный контент под числом
|
|
51
|
+
*/
|
|
52
|
+
dayAddons?: DayAddons[];
|
|
53
|
+
};
|
|
54
|
+
declare function useCalendar({ defaultMonth, month, minDate, view, maxDate, selected, events, offDays, holidays, dayAddons, onMonthChange, onChange, }: UseCalendarProps): {
|
|
55
|
+
activeMonth: Date;
|
|
56
|
+
weeks: Day[][];
|
|
57
|
+
months: Month[];
|
|
58
|
+
years: Date[];
|
|
59
|
+
canSetPrevMonth: boolean;
|
|
60
|
+
canSetNextMonth: boolean;
|
|
61
|
+
highlighted: number | Date | undefined;
|
|
62
|
+
setPrevMonth: () => void;
|
|
63
|
+
setNextMonth: () => void;
|
|
64
|
+
setMonthByDate: (newMonth: Date) => void;
|
|
65
|
+
getDayProps: (day: Day) => {
|
|
66
|
+
'data-date': number;
|
|
67
|
+
'aria-selected': boolean | undefined;
|
|
68
|
+
ref: (node: HTMLTableDataCellElement) => void;
|
|
69
|
+
tabIndex: number;
|
|
70
|
+
onMouseEnter: (event: MouseEvent<HTMLTableDataCellElement>) => void;
|
|
71
|
+
onMouseLeave: () => void;
|
|
72
|
+
onClick: (event: MouseEvent<HTMLTableDataCellElement>) => void;
|
|
73
|
+
};
|
|
74
|
+
getMonthProps: (currMonth: Month) => {
|
|
75
|
+
'data-date': number;
|
|
76
|
+
'aria-selected': boolean;
|
|
77
|
+
ref: (node: HTMLButtonElement) => void;
|
|
78
|
+
tabIndex: number;
|
|
79
|
+
disabled: boolean | undefined;
|
|
80
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
81
|
+
};
|
|
82
|
+
getYearProps: (year: Date) => {
|
|
83
|
+
'data-date': number;
|
|
84
|
+
'aria-selected': boolean;
|
|
85
|
+
ref: (node: HTMLButtonElement) => void;
|
|
86
|
+
tabIndex: number;
|
|
87
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
88
|
+
};
|
|
89
|
+
getRootProps: ({ ref }: {
|
|
90
|
+
ref?: Ref<HTMLDivElement> | undefined;
|
|
91
|
+
}) => {
|
|
92
|
+
onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
93
|
+
ref: (instance: HTMLDivElement | null) => void;
|
|
94
|
+
tabIndex: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export { UseCalendarProps, useCalendar };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DateShift, Day, DayAddons, Month, SpecialDays, SpecialDaysAddon } from "./typings-5684a67d";
|
|
3
|
+
declare const DAYS_IN_WEEK = 7;
|
|
4
|
+
declare const MONTHS_IN_YEAR = 12;
|
|
5
|
+
declare const SUNDAY_INDEX = 6;
|
|
6
|
+
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
7
|
+
declare const NATIVE_DATE_FORMAT = "yyyy-MM-dd";
|
|
8
|
+
declare const WEEKDAYS: string[];
|
|
9
|
+
declare const MONTHS: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Возвращает «правильный» индекс дня недели, 0 - пн, 1 - вт и так далее.
|
|
12
|
+
*/
|
|
13
|
+
declare function russianWeekDay(date: Date): number;
|
|
14
|
+
/**
|
|
15
|
+
* Возвращает таблицу-календарь с заполненными датами для переданного месяца
|
|
16
|
+
*/
|
|
17
|
+
declare function generateWeeks(month: Date, options: {
|
|
18
|
+
minDate?: Date;
|
|
19
|
+
maxDate?: Date;
|
|
20
|
+
selected?: Date;
|
|
21
|
+
eventsMap?: SpecialDays;
|
|
22
|
+
offDaysMap?: SpecialDays;
|
|
23
|
+
holidaysMap?: SpecialDays;
|
|
24
|
+
dayAddonsMap?: SpecialDaysAddon;
|
|
25
|
+
}): Day[][];
|
|
26
|
+
/**
|
|
27
|
+
* Возвращает массив с месяцами для переданного года
|
|
28
|
+
*/
|
|
29
|
+
declare function generateMonths(year: Date, options: {
|
|
30
|
+
minMonth?: Date;
|
|
31
|
+
maxMonth?: Date;
|
|
32
|
+
}): Month[];
|
|
33
|
+
/**
|
|
34
|
+
* Возвращает массив лет от minYear до maxYear
|
|
35
|
+
*/
|
|
36
|
+
declare function generateYears(minYear: Date, maxYear: Date): Date[];
|
|
37
|
+
/**
|
|
38
|
+
* Добавляет метаданные для переданного дня
|
|
39
|
+
*/
|
|
40
|
+
declare function buildDay(day: Date, options: {
|
|
41
|
+
minDate?: Date;
|
|
42
|
+
maxDate?: Date;
|
|
43
|
+
selected?: Date;
|
|
44
|
+
eventsMap?: SpecialDays;
|
|
45
|
+
offDaysMap?: SpecialDays;
|
|
46
|
+
holidaysMap?: SpecialDays;
|
|
47
|
+
dayAddonsMap?: SpecialDaysAddon;
|
|
48
|
+
}): Day;
|
|
49
|
+
/**
|
|
50
|
+
* Добавляет метаданные для переданного месяца
|
|
51
|
+
*/
|
|
52
|
+
declare function buildMonth(month: Date, options: {
|
|
53
|
+
minMonth?: Date;
|
|
54
|
+
maxMonth?: Date;
|
|
55
|
+
}): Month;
|
|
56
|
+
/**
|
|
57
|
+
* Ограничивает дату на отрезке [minDate, maxDate]
|
|
58
|
+
*/
|
|
59
|
+
declare function limitDate(date: Date | number, minDate?: Date | number, maxDate?: Date | number): Date;
|
|
60
|
+
/**
|
|
61
|
+
* Проверяет, находится ли переданная дата в указанных границах
|
|
62
|
+
*/
|
|
63
|
+
declare function dateInLimits(date?: Date | number | null, minDate?: Date | number, maxDate?: Date | number): boolean | 0 | null | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Возвращает русское название месяца с большой буквы
|
|
66
|
+
*/
|
|
67
|
+
declare function monthName(month: Date): string;
|
|
68
|
+
/**
|
|
69
|
+
* Превращает массив в объект, у которого ключи составляются из элементов массива
|
|
70
|
+
*/
|
|
71
|
+
declare function dateArrayToHashTable(arr: Array<Date | number>): Record<number, boolean>;
|
|
72
|
+
declare function addonArrayToHashTable(arr: DayAddons[]): Record<number, ReactNode>;
|
|
73
|
+
/**
|
|
74
|
+
* Возвращает корректный отрезок дат для выделения
|
|
75
|
+
*/
|
|
76
|
+
declare function getSelectionRange(from?: Date | number, to?: Date | number, highlighted?: Date | number): {
|
|
77
|
+
start: Date;
|
|
78
|
+
end: Date;
|
|
79
|
+
} | null;
|
|
80
|
+
declare function modifyDateByShift(shift: DateShift, date: Date, minDate?: Date, maxDate?: Date, offDaysMap?: Record<number, boolean>): Date;
|
|
81
|
+
/**
|
|
82
|
+
* Если дата была выбрана мышкой — фокусную обводку не видно
|
|
83
|
+
* TODO: добавить в useFocus возможность переключать метод ввода программно
|
|
84
|
+
*/
|
|
85
|
+
declare function simulateTab(node: HTMLElement): void;
|
|
86
|
+
declare const formatDate: (date: Date | number, dateFormat?: string) => string;
|
|
87
|
+
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
88
|
+
export { DAYS_IN_WEEK, MONTHS_IN_YEAR, SUNDAY_INDEX, DATE_FORMAT, NATIVE_DATE_FORMAT, WEEKDAYS, MONTHS, russianWeekDay, generateWeeks, generateMonths, generateYears, buildDay, buildMonth, limitDate, dateInLimits, monthName, dateArrayToHashTable, addonArrayToHashTable, getSelectionRange, modifyDateByShift, simulateTab, formatDate, parseDateString };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ButtonHTMLAttributes, ElementType, FC } from "react";
|
|
4
|
+
interface CloserProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Вид компонента
|
|
7
|
+
*/
|
|
8
|
+
view: "desktop" | "mobile";
|
|
9
|
+
/**
|
|
10
|
+
* Дополнительный класс
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Позиция крестика
|
|
15
|
+
*/
|
|
16
|
+
align?: "left" | "right";
|
|
17
|
+
/**
|
|
18
|
+
* Фиксирует крестик
|
|
19
|
+
*/
|
|
20
|
+
sticky?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Иконка
|
|
23
|
+
*/
|
|
24
|
+
icon?: ElementType;
|
|
25
|
+
/**
|
|
26
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
27
|
+
*/
|
|
28
|
+
dataTestId?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Коллбэк закрытия.
|
|
31
|
+
*/
|
|
32
|
+
onClose?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, reason?: "backdropClick" | "escapeKeyDown" | "closerClick") => void;
|
|
33
|
+
}
|
|
34
|
+
declare const Closer: FC<CloserProps>;
|
|
35
|
+
export { CloserProps, Closer };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { FC, MouseEvent } from "react";
|
|
2
|
+
type PeriodType = "range" | "day" | "week" | "month" | "quarter" | "year";
|
|
3
|
+
type PeriodSliderProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Активная дата или период
|
|
6
|
+
*/
|
|
7
|
+
value?: Date | [
|
|
8
|
+
Date,
|
|
9
|
+
Date
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Тип периода
|
|
13
|
+
*/
|
|
14
|
+
periodType?: PeriodType;
|
|
15
|
+
/**
|
|
16
|
+
* Дополнительный класс
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Отключает кнопку назад
|
|
21
|
+
*/
|
|
22
|
+
prevArrowDisabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Отключает кнопку вперед
|
|
25
|
+
*/
|
|
26
|
+
nextArrowDisabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Скрывает заблокированные кнопки
|
|
29
|
+
*/
|
|
30
|
+
hideDisabledArrows?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Возможность выбора месяца и года, если periodType 'month'
|
|
33
|
+
*/
|
|
34
|
+
isMonthAndYearSelectable?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Отображать ли текущий год, если isMonthAndYearSelectable true
|
|
37
|
+
*/
|
|
38
|
+
showCurrentYearSelector?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Функция для форматирование выбранного периода
|
|
41
|
+
*/
|
|
42
|
+
periodFormatter?: (valueFrom: Date, valueTo: Date, periodType: PeriodType) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Обработчик нажатия кнопки переключения на назад
|
|
45
|
+
*/
|
|
46
|
+
onPrevArrowClick?: (event: MouseEvent<HTMLButtonElement>, payload: {
|
|
47
|
+
value: Date;
|
|
48
|
+
valueFrom: Date;
|
|
49
|
+
valueTo: Date;
|
|
50
|
+
periodType: PeriodType;
|
|
51
|
+
}) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Обработчик нажатия кнопки переключения на вперед
|
|
54
|
+
*/
|
|
55
|
+
onNextArrowClick?: (event: MouseEvent<HTMLButtonElement>, payload: {
|
|
56
|
+
value: Date;
|
|
57
|
+
valueFrom: Date;
|
|
58
|
+
valueTo: Date;
|
|
59
|
+
periodType: PeriodType;
|
|
60
|
+
}) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Обработчик нажатия на селектор месяца
|
|
63
|
+
*/
|
|
64
|
+
onMonthClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Обработчик нажатия на селектор года
|
|
67
|
+
*/
|
|
68
|
+
onYearClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Обработчик нажатия на период
|
|
71
|
+
*/
|
|
72
|
+
onPeriodClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
75
|
+
*/
|
|
76
|
+
dataTestId?: string;
|
|
77
|
+
};
|
|
78
|
+
declare const PeriodSlider: FC<PeriodSliderProps>;
|
|
79
|
+
export { PeriodType, PeriodSliderProps, PeriodSlider };
|
|
80
|
+
export { shiftValues } from "./Component.desktop-8b5756fe";
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { DateRangeInputResponsive as DateRangeInput } from "./responsive";
|
|
2
|
-
export type { DateRangeInputResponsiveProps as DateRangeInputProps } from "./responsive";
|
|
1
|
+
export { DateRangeInputResponsive as DateRangeInput } from "./Component.responsive";
|
|
2
|
+
export type { DateRangeInputResponsiveProps as DateRangeInputProps } from "./Component.responsive";
|
|
3
|
+
export {};
|
package/index.js
CHANGED
|
@@ -7,19 +7,22 @@ require('tslib');
|
|
|
7
7
|
require('react');
|
|
8
8
|
require('@alfalab/hooks');
|
|
9
9
|
require('./Component.desktop.js');
|
|
10
|
+
require('@alfalab/core-components-calendar/desktop');
|
|
11
|
+
require('@alfalab/core-components-input/desktop');
|
|
10
12
|
require('./components/date-range-input/Component.js');
|
|
11
13
|
require('react-merge-refs');
|
|
12
14
|
require('classnames');
|
|
13
15
|
require('date-fns');
|
|
14
16
|
require('date-fns/isValid');
|
|
15
|
-
require('@alfalab/core-components-calendar');
|
|
17
|
+
require('@alfalab/core-components-calendar/shared');
|
|
16
18
|
require('@alfalab/core-components-icon-button');
|
|
17
|
-
require('@alfalab/core-components-input');
|
|
18
19
|
require('@alfalab/core-components-popover');
|
|
19
20
|
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
20
21
|
require('./utils/format.js');
|
|
21
22
|
require('date-fns/parse');
|
|
22
23
|
require('./Component.mobile.js');
|
|
24
|
+
require('@alfalab/core-components-calendar/mobile');
|
|
25
|
+
require('@alfalab/core-components-input/mobile');
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component-8b5756fe";
|
package/mobile.js
CHANGED
|
@@ -5,14 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var Component_mobile = require('./Component.mobile.js');
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
|
-
require('@alfalab/core-components-calendar');
|
|
8
|
+
require('@alfalab/core-components-calendar/mobile');
|
|
9
|
+
require('@alfalab/core-components-input/mobile');
|
|
9
10
|
require('./components/date-range-input/Component.js');
|
|
10
11
|
require('react-merge-refs');
|
|
11
12
|
require('classnames');
|
|
12
13
|
require('date-fns');
|
|
13
14
|
require('date-fns/isValid');
|
|
15
|
+
require('@alfalab/core-components-calendar/shared');
|
|
14
16
|
require('@alfalab/core-components-icon-button');
|
|
15
|
-
require('@alfalab/core-components-input');
|
|
16
17
|
require('@alfalab/core-components-popover');
|
|
17
18
|
require('@alfalab/hooks');
|
|
18
19
|
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FC, ForwardRefExoticComponent, RefAttributes, HTMLAttributes } from "react";
|
|
4
|
+
declare const colors: readonly [
|
|
5
|
+
"tertiary",
|
|
6
|
+
"disabled",
|
|
7
|
+
"accent",
|
|
8
|
+
"primary",
|
|
9
|
+
"attention",
|
|
10
|
+
"positive",
|
|
11
|
+
"secondary",
|
|
12
|
+
"tertiary-inverted",
|
|
13
|
+
"primary-inverted",
|
|
14
|
+
"secondary-inverted",
|
|
15
|
+
"link",
|
|
16
|
+
"negative",
|
|
17
|
+
"static-primary-light",
|
|
18
|
+
"static-secondary-light",
|
|
19
|
+
"static-tertiary-light",
|
|
20
|
+
"static-primary-dark",
|
|
21
|
+
"static-secondary-dark",
|
|
22
|
+
"static-tertiary-dark",
|
|
23
|
+
"static-accent"
|
|
24
|
+
];
|
|
25
|
+
type Color = (typeof colors)[number];
|
|
26
|
+
type TextElementType = HTMLParagraphElement | HTMLSpanElement | HTMLDivElement;
|
|
27
|
+
type NativeProps = HTMLAttributes<HTMLSpanElement>;
|
|
28
|
+
type TextBaseProps = {
|
|
29
|
+
/**
|
|
30
|
+
* [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/tokens-assets-типографика--docs)
|
|
31
|
+
*/
|
|
32
|
+
view?: "primary-large" | "primary-medium" | "primary-small" | "secondary-large" | "secondary-medium" | "secondary-small" | "component" | "caps";
|
|
33
|
+
/**
|
|
34
|
+
* Цвет текста
|
|
35
|
+
*/
|
|
36
|
+
color?: Color;
|
|
37
|
+
/**
|
|
38
|
+
* Толщина шрифта
|
|
39
|
+
*/
|
|
40
|
+
weight?: "regular" | "medium" | "bold";
|
|
41
|
+
/**
|
|
42
|
+
* Делает цифры моноширинными
|
|
43
|
+
*/
|
|
44
|
+
monospaceNumbers?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* HTML тег
|
|
47
|
+
*/
|
|
48
|
+
tag?: "span" | "div";
|
|
49
|
+
/**
|
|
50
|
+
* Css-класс для стилизации (native prop)
|
|
51
|
+
*/
|
|
52
|
+
className?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Id компонента для тестов
|
|
55
|
+
*/
|
|
56
|
+
dataTestId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Контент (native prop)
|
|
59
|
+
*/
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Добавляет отступы к тэгу 'p'
|
|
63
|
+
*/
|
|
64
|
+
defaultMargins?: never;
|
|
65
|
+
/**
|
|
66
|
+
* Количество строк (не поддерживает IE)
|
|
67
|
+
*/
|
|
68
|
+
rowLimit?: 1 | 2 | 3;
|
|
69
|
+
};
|
|
70
|
+
type TextPTagProps = Omit<TextBaseProps, "tag" | "defaultMargins"> & {
|
|
71
|
+
tag?: "p";
|
|
72
|
+
defaultMargins?: boolean;
|
|
73
|
+
};
|
|
74
|
+
type TextProps = Omit<NativeProps, "color"> & (TextBaseProps | TextPTagProps);
|
|
75
|
+
type NativeProps$0 = HTMLAttributes<HTMLHeadingElement>;
|
|
76
|
+
type TitleProps = Omit<NativeProps$0, "color"> & {
|
|
77
|
+
/**
|
|
78
|
+
* HTML тег
|
|
79
|
+
*/
|
|
80
|
+
tag: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div";
|
|
81
|
+
/**
|
|
82
|
+
* [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/guidelines-typography--page)
|
|
83
|
+
*/
|
|
84
|
+
view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
85
|
+
/**
|
|
86
|
+
* Цвет текста
|
|
87
|
+
*/
|
|
88
|
+
color?: Color;
|
|
89
|
+
/**
|
|
90
|
+
* Толщина шрифта
|
|
91
|
+
*/
|
|
92
|
+
weight?: "regular" | "medium" | "bold";
|
|
93
|
+
/**
|
|
94
|
+
* Шрифт текста
|
|
95
|
+
*/
|
|
96
|
+
font?: "styrene" | "system";
|
|
97
|
+
/**
|
|
98
|
+
* Добавляет отступы
|
|
99
|
+
*/
|
|
100
|
+
defaultMargins?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Css-класс для стилизации (native prop)
|
|
103
|
+
*/
|
|
104
|
+
className?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Id компонента для тестов
|
|
107
|
+
*/
|
|
108
|
+
dataTestId?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Контент (native prop)
|
|
111
|
+
*/
|
|
112
|
+
children?: React.ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Количество строк (не поддерживает IE)
|
|
115
|
+
*/
|
|
116
|
+
rowLimit?: 1 | 2 | 3;
|
|
117
|
+
};
|
|
118
|
+
type TitleMobileProps = Omit<TitleProps, "defaultMargins">;
|
|
119
|
+
declare const Typography: {
|
|
120
|
+
Title: FC<TitleProps>;
|
|
121
|
+
Text: ForwardRefExoticComponent<TextProps & RefAttributes<TextElementType>>;
|
|
122
|
+
TitleResponsive: FC<TitleProps>;
|
|
123
|
+
TitleMobile: FC<TitleMobileProps>;
|
|
124
|
+
};
|
|
125
|
+
declare const typographyPresets: {
|
|
126
|
+
mobile: {
|
|
127
|
+
list: {
|
|
128
|
+
text: {
|
|
129
|
+
primary: {
|
|
130
|
+
tag: string;
|
|
131
|
+
view: string;
|
|
132
|
+
};
|
|
133
|
+
secondary: {
|
|
134
|
+
tag: string;
|
|
135
|
+
color: string;
|
|
136
|
+
view: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
declare const TitleResponsive: FC<TitleProps>;
|
|
143
|
+
interface BackArrowAddonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
144
|
+
/**
|
|
145
|
+
* Текст после иконки
|
|
146
|
+
*/
|
|
147
|
+
text?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Дополнительный класс
|
|
150
|
+
*/
|
|
151
|
+
className?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Вид компонента
|
|
154
|
+
*/
|
|
155
|
+
view: 'mobile' | 'desktop';
|
|
156
|
+
/**
|
|
157
|
+
* Прозрачность текста
|
|
158
|
+
*/
|
|
159
|
+
textOpacity?: number;
|
|
160
|
+
/**
|
|
161
|
+
* Обработчик клика
|
|
162
|
+
*/
|
|
163
|
+
onClick?: () => void;
|
|
164
|
+
}
|
|
165
|
+
declare const BackArrowAddon: React.FC<BackArrowAddonProps>;
|
|
166
|
+
export { Typography, typographyPresets, TitleResponsive, BackArrowAddonProps, BackArrowAddon };
|
|
167
|
+
export type { TitleProps, TextProps, Color };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { NavigationBarProps } from "./types-ebda875c";
|
|
4
|
+
declare const NavigationBar: React.ForwardRefExoticComponent<NavigationBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export * from "./Component-63dec22f";
|
|
6
|
+
export { NavigationBar };
|