@via-profit/ui-kit 0.1.8 → 0.2.1-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.
- package/Accordion/index.d.ts +4 -4
- package/Autocomplete/AutocompleteContainer.d.ts +1 -1
- package/Autocomplete/AutocompleteContainer.js +1 -1
- package/Avatar/AvatarBase.d.ts +4 -4
- package/Badge/BadgeBase.d.ts +4 -4
- package/Button/ButtonBase.d.ts +3 -3
- package/Calendar/CalendarCell.js +18 -4
- package/Calendar/CalendarMonthCell.js +0 -5
- package/Calendar/CalendarYearCell.js +5 -5
- package/Calendar/index.d.ts +25 -21
- package/Calendar/index.js +89 -82
- package/Calendar/reducer.d.ts +4 -1
- package/Calendar/reducer.js +27 -3
- package/Calendar/use-calendar.js +102 -155
- package/DatePicker/index.js +1 -1
- package/Highlighted/index.d.ts +3 -3
- package/Menu/MenuContainer.d.ts +2 -2
- package/Menu/MenuContainer.js +2 -2
- package/Menu/index.js +2 -7
- package/Modal/BaseModal/RenderModal.d.ts +3 -3
- package/Modal/BaseModal/index.d.ts +3 -3
- package/Modal/ConfirmBox/index.d.ts +5 -5
- package/Modal/Drawer/index.d.ts +5 -5
- package/Modal/MessageBox/index.d.ts +5 -5
- package/Popper/Popper.d.ts +221 -0
- package/Popper/Popper.js +99 -0
- package/Popper/PopperContainer.d.ts +2 -0
- package/Popper/PopperContainer.js +3 -6
- package/Popper/index.d.ts +5 -22
- package/Popper/index.js +18 -264
- package/Popper/usePopprer.d.ts +25 -0
- package/Popper/usePopprer.js +330 -0
- package/Selectbox/index.d.ts +8 -8
- package/Selectbox/index.js +2 -2
- package/Surface/index.d.ts +5 -5
- package/Switch/index.d.ts +8 -8
- package/TextArea/index.d.ts +7 -7
- package/TextField/index.d.ts +7 -7
- package/package.json +1 -1
package/Calendar/use-calendar.js
CHANGED
|
@@ -6,65 +6,78 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useCalendar = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const WHITESPACE = '\u{0020}';
|
|
9
|
+
const WEEK_IN_MS = 604800000; // 7 * 24 * 60 * 60 * 1000
|
|
10
|
+
// Константа для маппинга дней недели
|
|
11
|
+
const WEEK_DAYS_MAP = {
|
|
12
|
+
sunday: 0,
|
|
13
|
+
monday: 1,
|
|
14
|
+
tuesday: 2,
|
|
15
|
+
wednesday: 3,
|
|
16
|
+
thursday: 4,
|
|
17
|
+
friday: 5,
|
|
18
|
+
saturday: 6,
|
|
19
|
+
};
|
|
9
20
|
const useCalendar = (props) => {
|
|
10
21
|
const { minDate, maxDate, weekStartDay, displayLeadingZero, locale } = props;
|
|
22
|
+
// Мемоизируем timestamp граничных дат для оптимизации проверок isDisabled
|
|
23
|
+
const minTime = react_1.default.useMemo(() => minDate.getTime(), [minDate]);
|
|
24
|
+
const maxTime = react_1.default.useMemo(() => maxDate.getTime(), [maxDate]);
|
|
25
|
+
// Мемоизируем номер дня начала недели
|
|
26
|
+
const weekStartDayNumber = react_1.default.useMemo(() => WEEK_DAYS_MAP[weekStartDay], [weekStartDay]);
|
|
27
|
+
// Оптимизированная функция isSameDay
|
|
11
28
|
const isSameDay = react_1.default.useCallback((a, b) => a.getFullYear() === b.getFullYear() &&
|
|
12
29
|
a.getMonth() === b.getMonth() &&
|
|
13
30
|
a.getDate() === b.getDate(), []);
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const current = dateValue.getTime();
|
|
19
|
-
return current > max || current < min;
|
|
20
|
-
}, [maxDate, minDate]);
|
|
21
|
-
const calculateWeekNumber = react_1.default.useCallback((dt) => {
|
|
22
|
-
const tdt = new Date(dt.valueOf());
|
|
23
|
-
const dayn = (dt.getDay() + 6) % 7;
|
|
24
|
-
tdt.setDate(tdt.getDate() - dayn + 3);
|
|
25
|
-
const firstThursday = tdt.valueOf();
|
|
26
|
-
tdt.setMonth(0, 1);
|
|
27
|
-
if (tdt.getDay() !== 4) {
|
|
28
|
-
tdt.setMonth(0, 1 + ((4 - tdt.getDay() + 7) % 7));
|
|
29
|
-
}
|
|
30
|
-
return 1 + Math.ceil((firstThursday - tdt.getTime()) / 604800000);
|
|
31
|
+
// Мемоизируем сегодняшнюю дату для isToday
|
|
32
|
+
const today = react_1.default.useMemo(() => {
|
|
33
|
+
const now = new Date();
|
|
34
|
+
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
31
35
|
}, []);
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const isToday = react_1.default.useCallback((dateValue) => isSameDay(dateValue, today), [isSameDay, today]);
|
|
37
|
+
const isDisabled = react_1.default.useCallback((dateValue) => {
|
|
38
|
+
const currentTime = dateValue.getTime();
|
|
39
|
+
return currentTime > maxTime || currentTime < minTime;
|
|
40
|
+
}, [maxTime, minTime]);
|
|
41
|
+
const calculateWeekNumber = react_1.default.useCallback((date) => {
|
|
42
|
+
// Используем UTC методы для избежания проблем с часовыми поясами
|
|
43
|
+
const year = date.getFullYear();
|
|
44
|
+
const month = date.getMonth();
|
|
45
|
+
const day = date.getDate();
|
|
46
|
+
// Создаем дату без времени
|
|
47
|
+
const d = new Date(Date.UTC(year, month, day));
|
|
48
|
+
// День недели (0-6)
|
|
49
|
+
const dayOfWeek = d.getUTCDay();
|
|
50
|
+
// Смещение от начала недели
|
|
51
|
+
const diff = (dayOfWeek - weekStartDayNumber + 7) % 7;
|
|
52
|
+
// Первый день недели
|
|
53
|
+
const weekStart = new Date(Date.UTC(year, month, day - diff));
|
|
54
|
+
// Первый день года
|
|
55
|
+
const yearStart = new Date(Date.UTC(year, 0, 1));
|
|
56
|
+
// Вычисляем номер недели
|
|
57
|
+
return Math.floor((weekStart.getTime() - yearStart.getTime()) / WEEK_IN_MS) + 1;
|
|
58
|
+
}, [weekStartDayNumber]);
|
|
41
59
|
const getDayLabel = react_1.default.useCallback((day) => {
|
|
42
60
|
const dateNum = day.getDate();
|
|
43
|
-
|
|
44
|
-
return dateNum.toString();
|
|
45
|
-
}
|
|
46
|
-
const numStr = `0${dateNum}`;
|
|
47
|
-
return numStr.substring(numStr.length - 2);
|
|
61
|
+
return displayLeadingZero ? dateNum.toString().padStart(2, '0') : dateNum.toString();
|
|
48
62
|
}, [displayLeadingZero]);
|
|
63
|
+
// Мемоизируем Intl форматеры для производительности
|
|
64
|
+
const monthFormatter = react_1.default.useMemo(() => (typeof Intl !== 'undefined' ? new Intl.DateTimeFormat(locale, { month: 'long' }) : null), [locale]);
|
|
65
|
+
const yearFormatter = react_1.default.useMemo(() => typeof Intl !== 'undefined' ? new Intl.DateTimeFormat(locale, { year: 'numeric' }) : null, [locale]);
|
|
49
66
|
const getMonthLabel = react_1.default.useCallback((dateValue) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}).format(dateValue)
|
|
54
|
-
: WHITESPACE;
|
|
67
|
+
if (!monthFormatter)
|
|
68
|
+
return WHITESPACE;
|
|
69
|
+
const title = monthFormatter.format(dateValue);
|
|
55
70
|
return title.charAt(0).toUpperCase() + title.slice(1);
|
|
56
|
-
}, [
|
|
57
|
-
const getYearLabel = react_1.default.useCallback((dateValue) =>
|
|
58
|
-
? new Intl.DateTimeFormat(locale, {
|
|
59
|
-
year: 'numeric',
|
|
60
|
-
}).format(dateValue)
|
|
61
|
-
: WHITESPACE, [locale]);
|
|
71
|
+
}, [monthFormatter]);
|
|
72
|
+
const getYearLabel = react_1.default.useCallback((dateValue) => { var _a; return (_a = yearFormatter === null || yearFormatter === void 0 ? void 0 : yearFormatter.format(dateValue)) !== null && _a !== void 0 ? _a : WHITESPACE; }, [yearFormatter]);
|
|
62
73
|
const getYearsRange = react_1.default.useCallback((minDate, maxDate) => {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
const years = [];
|
|
75
|
+
const startYear = minDate.getFullYear();
|
|
76
|
+
const endYear = maxDate.getFullYear();
|
|
77
|
+
for (let year = startYear; year <= endYear; year++) {
|
|
78
|
+
years.push(year);
|
|
66
79
|
}
|
|
67
|
-
return
|
|
80
|
+
return years;
|
|
68
81
|
}, []);
|
|
69
82
|
const getMonthsRange = react_1.default.useCallback((minDate, maxDate) => {
|
|
70
83
|
const m = [];
|
|
@@ -77,122 +90,56 @@ const useCalendar = (props) => {
|
|
|
77
90
|
}
|
|
78
91
|
return m;
|
|
79
92
|
}, []);
|
|
93
|
+
const weeksCache = react_1.default.useRef(new Map());
|
|
80
94
|
const getWeeks = react_1.default.useCallback((needleDate) => {
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
for (let dateNum = 1; dateNum < lastOfDate.getDate() + 1; dateNum++) {
|
|
88
|
-
d.setDate(dateNum);
|
|
89
|
-
// if is start of the week then set a new week
|
|
90
|
-
if (d.getDay() === startDayNum) {
|
|
91
|
-
const days = [...week].map(day => ({
|
|
92
|
-
date: day,
|
|
93
|
-
isToday: isToday(day),
|
|
94
|
-
isDisabled: isDisabled(day),
|
|
95
|
-
}));
|
|
96
|
-
if (days.length) {
|
|
97
|
-
list.push({
|
|
98
|
-
weekNumber: calculateWeekNumber(days[0].date),
|
|
99
|
-
days,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
week.clear();
|
|
103
|
-
}
|
|
104
|
-
week.add(new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0));
|
|
105
|
-
// if is last of iteration
|
|
106
|
-
if (dateNum === lastOfDate.getDate()) {
|
|
107
|
-
const days = [...week].map(day => ({
|
|
108
|
-
date: day,
|
|
109
|
-
isToday: isToday(day),
|
|
110
|
-
isDisabled: isDisabled(day),
|
|
111
|
-
}));
|
|
112
|
-
if (days.length) {
|
|
113
|
-
list.push({
|
|
114
|
-
weekNumber: calculateWeekNumber(days[0].date),
|
|
115
|
-
days,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
week.clear();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
// Fill the prev days
|
|
122
|
-
if (list[0].days.length < 7) {
|
|
123
|
-
const fillDays = 7 - list[0].days.length;
|
|
124
|
-
const days = list[0].days;
|
|
125
|
-
for (let fillIndex = 0; fillIndex < fillDays; fillIndex++) {
|
|
126
|
-
const day = new Date(startOfDate.getFullYear(), startOfDate.getMonth(), -fillIndex, 0, 0, 0, 0);
|
|
127
|
-
days.unshift({
|
|
128
|
-
date: day,
|
|
129
|
-
isDisabled: isDisabled(day),
|
|
130
|
-
isToday: isToday(day),
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
list[0] = {
|
|
134
|
-
days,
|
|
135
|
-
weekNumber: calculateWeekNumber(days[0].date),
|
|
136
|
-
};
|
|
95
|
+
const year = needleDate.getFullYear();
|
|
96
|
+
const month = needleDate.getMonth();
|
|
97
|
+
const cacheKey = `${year}-${month}-${weekStartDay}-${minTime}-${maxTime}`;
|
|
98
|
+
const cached = weeksCache.current.get(cacheKey);
|
|
99
|
+
if (cached) {
|
|
100
|
+
return cached;
|
|
137
101
|
}
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
102
|
+
// Первый и последний день месяца
|
|
103
|
+
const firstDay = new Date(year, month, 1);
|
|
104
|
+
const lastDay = new Date(year, month + 1, 0);
|
|
105
|
+
// Вычисляем начало календарной сетки
|
|
106
|
+
const startOffset = (firstDay.getDay() - weekStartDayNumber + 7) % 7;
|
|
107
|
+
const startDate = new Date(year, month, 1 - startOffset);
|
|
108
|
+
// Вычисляем конец календарной сетки
|
|
109
|
+
const endOffset = (weekStartDayNumber + 6 - lastDay.getDay() + 7) % 7;
|
|
110
|
+
const endDate = new Date(year, month, lastDay.getDate() + endOffset);
|
|
111
|
+
const weeks = [];
|
|
112
|
+
const currentDate = new Date(startDate);
|
|
113
|
+
// Предаллоцируем массив для дней недели
|
|
114
|
+
const weekDays = new Array(7);
|
|
115
|
+
while (currentDate <= endDate) {
|
|
116
|
+
// Заполняем дни недели
|
|
117
|
+
for (let i = 0; i < 7; i++) {
|
|
118
|
+
const date = new Date(currentDate);
|
|
119
|
+
weekDays[i] = {
|
|
120
|
+
date,
|
|
121
|
+
isToday: isToday(date),
|
|
122
|
+
isDisabled: isDisabled(date),
|
|
123
|
+
};
|
|
124
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
149
125
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
weekNumber: calculateWeekNumber(
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
// if weeks length is 4 only
|
|
156
|
-
// then prepend week
|
|
157
|
-
if (list.length === 4) {
|
|
158
|
-
const fillDays = 7;
|
|
159
|
-
const days = [];
|
|
160
|
-
const firstWeek = list[0];
|
|
161
|
-
const firstDate = firstWeek.days[0].date;
|
|
162
|
-
for (let fillIndex = 0; fillIndex < fillDays; fillIndex++) {
|
|
163
|
-
const day = new Date(firstDate.getFullYear(), firstDate.getMonth(), firstDate.getDate() - fillIndex, 0, 0, 0, 0);
|
|
164
|
-
days.unshift({
|
|
165
|
-
date: day,
|
|
166
|
-
isDisabled: isDisabled(day),
|
|
167
|
-
isToday: isToday(day),
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
list.unshift({
|
|
171
|
-
days,
|
|
172
|
-
weekNumber: calculateWeekNumber(days[0].date),
|
|
126
|
+
// Создаем копию массива дней для недели
|
|
127
|
+
weeks.push({
|
|
128
|
+
weekNumber: calculateWeekNumber(weekDays[0].date),
|
|
129
|
+
days: [...weekDays],
|
|
173
130
|
});
|
|
174
131
|
}
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const day = new Date(lastDate.getFullYear(), lastDate.getMonth(), lastDate.getDate() + fillIndex + 1, 0, 0, 0, 0);
|
|
183
|
-
days.push({
|
|
184
|
-
date: day,
|
|
185
|
-
isDisabled: isDisabled(day),
|
|
186
|
-
isToday: isToday(day),
|
|
187
|
-
});
|
|
132
|
+
// Сохраняем в кэш
|
|
133
|
+
weeksCache.current.set(cacheKey, weeks);
|
|
134
|
+
// Очищаем старые записи кэша (если больше 10)
|
|
135
|
+
if (weeksCache.current.size > 10) {
|
|
136
|
+
const keys = Array.from(weeksCache.current.keys());
|
|
137
|
+
for (let i = 0; i < keys.length - 10; i++) {
|
|
138
|
+
weeksCache.current.delete(keys[i]);
|
|
188
139
|
}
|
|
189
|
-
list.push({
|
|
190
|
-
days,
|
|
191
|
-
weekNumber: calculateWeekNumber(days[0].date),
|
|
192
|
-
});
|
|
193
140
|
}
|
|
194
|
-
return
|
|
195
|
-
}, [
|
|
141
|
+
return weeks;
|
|
142
|
+
}, [weekStartDay, minTime, maxTime, weekStartDayNumber, calculateWeekNumber, isToday, isDisabled]);
|
|
196
143
|
return {
|
|
197
144
|
isSameDay,
|
|
198
145
|
isToday,
|
package/DatePicker/index.js
CHANGED
|
@@ -119,7 +119,7 @@ const DatePicker = props => {
|
|
|
119
119
|
} })),
|
|
120
120
|
react_1.default.createElement(ClickOutside_1.default, { onOutsideClick: () => setOpenSate(false), mouseEvent: "onMouseDown" },
|
|
121
121
|
react_1.default.createElement(Popper_1.default, { isOpen: isOpen, anchorElement: textFieldRef },
|
|
122
|
-
react_1.default.createElement(Calendar_1.default, { minDate: minDate, maxDate: maxDate, weekStartDay: weekStartDay, locale: locale, badges: badges, displayLeadingZero: displayLeadingZero, prevMonthButtonTooltip: prevMonthButtonTooltip, nextMonthButtonTooltip: nextMonthButtonTooltip, changeMonthButtonTooltip: changeMonthButtonTooltip, changeYearButtonTooltip: changeYearButtonTooltip, resetButtonLabel: resetButtonLabel,
|
|
122
|
+
react_1.default.createElement(Calendar_1.default, { minDate: minDate, maxDate: maxDate, weekStartDay: weekStartDay, locale: locale, badges: badges, displayLeadingZero: displayLeadingZero, prevMonthButtonTooltip: prevMonthButtonTooltip, nextMonthButtonTooltip: nextMonthButtonTooltip, changeMonthButtonTooltip: changeMonthButtonTooltip, changeYearButtonTooltip: changeYearButtonTooltip, resetButtonLabel: resetButtonLabel, todayButtonLabel: toodayButtonLabel, heading: heading, subheading: subheading, initialView: initialView, footer: footer, value: currentValue || new Date(), onChange: date => {
|
|
123
123
|
onChange(date);
|
|
124
124
|
setOpenSate(false);
|
|
125
125
|
}, overrides: {
|
package/Highlighted/index.d.ts
CHANGED
|
@@ -42,15 +42,15 @@ export interface HighlightedOverrides {
|
|
|
42
42
|
/**
|
|
43
43
|
* Container element
|
|
44
44
|
*/
|
|
45
|
-
readonly Container?: React.
|
|
45
|
+
readonly Container?: React.ComponentType<HighlightedContainerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
46
46
|
/**
|
|
47
47
|
* Mark element (HTML <mark>)
|
|
48
48
|
*/
|
|
49
|
-
readonly Mark?: React.
|
|
49
|
+
readonly Mark?: React.ComponentType<HighlightedMarkProps & React.RefAttributes<HTMLElement>>;
|
|
50
50
|
/**
|
|
51
51
|
* Text element (HTML <span>)regex
|
|
52
52
|
*/
|
|
53
|
-
readonly Text?: React.
|
|
53
|
+
readonly Text?: React.ComponentType<HighlightedTextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
54
54
|
}
|
|
55
55
|
export declare const escapeRegex: (pattern: string) => string;
|
|
56
56
|
declare const _default: React.ForwardRefExoticComponent<HighlightedProps & React.RefAttributes<HTMLSpanElement>>;
|
package/Menu/MenuContainer.d.ts
CHANGED
|
@@ -137,11 +137,11 @@ export interface MenuOverrides {
|
|
|
137
137
|
/**
|
|
138
138
|
* Element wrapper
|
|
139
139
|
*/
|
|
140
|
-
readonly List?: React.
|
|
140
|
+
readonly List?: React.ComponentType<MenuListProps & React.RefAttributes<HTMLDivElement>>;
|
|
141
141
|
/**
|
|
142
142
|
* Popper wrapper
|
|
143
143
|
*/
|
|
144
|
-
readonly Popper?: React.
|
|
144
|
+
readonly Popper?: React.ComponentType<PopperProps & React.RefAttributes<HTMLDivElement>>;
|
|
145
145
|
}
|
|
146
146
|
export type MenuRef = {
|
|
147
147
|
/**
|
package/Menu/MenuContainer.js
CHANGED
|
@@ -33,7 +33,7 @@ const Popper_1 = __importDefault(require("../Popper"));
|
|
|
33
33
|
const ClickOutside_1 = __importDefault(require("../ClickOutside"));
|
|
34
34
|
const onRequestCloseDefault = () => undefined;
|
|
35
35
|
const MenuContainer = react_1.default.forwardRef((props, ref) => {
|
|
36
|
-
const { items, value, anchorElement, overrides, children, closeOutsideClick = true, isOpen =
|
|
36
|
+
const { items, value, anchorElement, overrides, children, closeOutsideClick = true, isOpen = false, anchorPos = 'bottom', multiple = false, autofocus = true, closeOnSelect = !multiple, onRequestClose = onRequestCloseDefault, zIndex, onSelectItem, getOptionSelected, } = props;
|
|
37
37
|
const overridesMap = react_1.default.useMemo(() => ({
|
|
38
38
|
List: (overrides === null || overrides === void 0 ? void 0 : overrides.List) || MenuList_1.default,
|
|
39
39
|
Popper: (overrides === null || overrides === void 0 ? void 0 : overrides.Popper) || Popper_1.default,
|
|
@@ -356,7 +356,7 @@ const MenuContainer = react_1.default.forwardRef((props, ref) => {
|
|
|
356
356
|
}
|
|
357
357
|
}, [dispatch]);
|
|
358
358
|
return (react_1.default.createElement(ClickOutside_1.default, { onOutsideClick: onRequestClose, mouseEvent: closeOutsideClick ? 'onMouseDown' : false },
|
|
359
|
-
react_1.default.createElement(overridesMap.Popper, { isOpen: Boolean(isOpen), ref: menuPopperRef,
|
|
359
|
+
react_1.default.createElement(overridesMap.Popper, { isOpen: Boolean(isOpen), ref: menuPopperRef, zIndex: zIndex, anchorPos: anchorPos, anchorElement: anchorElement },
|
|
360
360
|
react_1.default.createElement(overridesMap.List, { isOpen: Boolean(isOpen), ref: menuListRef, onKeyDown: listKeydownEvent }, items.map((item, index) => children({
|
|
361
361
|
item,
|
|
362
362
|
index,
|
package/Menu/index.js
CHANGED
|
@@ -21,12 +21,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
21
21
|
const context_1 = require("./context");
|
|
22
22
|
const MenuContainer_1 = __importDefault(require("./MenuContainer"));
|
|
23
23
|
__exportStar(require("./MenuContainer"), exports);
|
|
24
|
-
const Menu = react_1.default.forwardRef((props, ref) =>
|
|
25
|
-
|
|
26
|
-
throw new Error(`[@via-profit/ui-kit] You set «anchorPos» property as «static». In this case you should use «anchorElement» property`);
|
|
27
|
-
}
|
|
28
|
-
return (react_1.default.createElement(context_1.MenuContextProvider, null,
|
|
29
|
-
react_1.default.createElement(MenuContainer_1.default, Object.assign({}, props, { ref: ref }))));
|
|
30
|
-
});
|
|
24
|
+
const Menu = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(context_1.MenuContextProvider, null,
|
|
25
|
+
react_1.default.createElement(MenuContainer_1.default, Object.assign({}, props, { ref: ref })))));
|
|
31
26
|
Menu.displayName = 'Menu';
|
|
32
27
|
exports.default = Menu;
|
|
@@ -5,9 +5,9 @@ import { ModalInnerContainerProps } from './ModalInnerContainer';
|
|
|
5
5
|
interface RenderModalProps {
|
|
6
6
|
readonly children: React.ReactNode | readonly React.ReactNode[];
|
|
7
7
|
readonly overrides: {
|
|
8
|
-
readonly Overlay?: React.
|
|
9
|
-
readonly Inner?: React.
|
|
10
|
-
readonly InnerContainer?: React.
|
|
8
|
+
readonly Overlay?: React.ComponentType<ModalOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
readonly Inner?: React.ComponentType<ModalInnerProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
readonly InnerContainer?: React.ComponentType<ModalInnerContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
declare const RenderModal: React.FC<RenderModalProps>;
|
|
@@ -45,9 +45,9 @@ export interface BaseModalProps {
|
|
|
45
45
|
readonly overrides?: BaseModalOverrides;
|
|
46
46
|
}
|
|
47
47
|
export interface BaseModalOverrides {
|
|
48
|
-
readonly Overlay?: React.
|
|
49
|
-
readonly Inner?: React.
|
|
50
|
-
readonly InnerContainer?: React.
|
|
48
|
+
readonly Overlay?: React.ComponentType<ModalOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
readonly Inner?: React.ComponentType<ModalInnerProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
readonly InnerContainer?: React.ComponentType<ModalInnerContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
51
51
|
}
|
|
52
52
|
declare const BaseModal: React.FC<BaseModalProps>;
|
|
53
53
|
export default BaseModal;
|
|
@@ -37,23 +37,23 @@ export interface ConfirmBoxOverrides {
|
|
|
37
37
|
/**
|
|
38
38
|
* Element container
|
|
39
39
|
*/
|
|
40
|
-
readonly Container?: React.
|
|
40
|
+
readonly Container?: React.ComponentType<ConfirmBoxContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
41
41
|
/**
|
|
42
42
|
* Element ontent
|
|
43
43
|
*/
|
|
44
|
-
readonly Content?: React.
|
|
44
|
+
readonly Content?: React.ComponentType<ConfirmBoxContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
45
|
/**
|
|
46
46
|
* Element footer
|
|
47
47
|
*/
|
|
48
|
-
readonly Footer?: React.
|
|
48
|
+
readonly Footer?: React.ComponentType<ConfirmBoxFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
49
49
|
/**
|
|
50
50
|
* Element header
|
|
51
51
|
*/
|
|
52
|
-
readonly Header?: React.
|
|
52
|
+
readonly Header?: React.ComponentType<ConfirmBoxHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
53
|
/**
|
|
54
54
|
* Overlay element
|
|
55
55
|
*/
|
|
56
|
-
readonly Overlay?: React.
|
|
56
|
+
readonly Overlay?: React.ComponentType<ModalOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
57
57
|
}
|
|
58
58
|
declare const ConfirmBox: React.FC<ConfirmBoxProps>;
|
|
59
59
|
export default ConfirmBox;
|
package/Modal/Drawer/index.d.ts
CHANGED
|
@@ -43,23 +43,23 @@ export interface DrawerOverrides {
|
|
|
43
43
|
/**
|
|
44
44
|
* Element container
|
|
45
45
|
*/
|
|
46
|
-
readonly Container?: React.
|
|
46
|
+
readonly Container?: React.ComponentType<DrawerContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
47
|
/**
|
|
48
48
|
* Element ontent
|
|
49
49
|
*/
|
|
50
|
-
readonly Content?: React.
|
|
50
|
+
readonly Content?: React.ComponentType<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
51
51
|
/**
|
|
52
52
|
* Element footer
|
|
53
53
|
*/
|
|
54
|
-
readonly Footer?: React.
|
|
54
|
+
readonly Footer?: React.ComponentType<DrawerFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
55
55
|
/**
|
|
56
56
|
* Element header
|
|
57
57
|
*/
|
|
58
|
-
readonly Header?: React.
|
|
58
|
+
readonly Header?: React.ComponentType<DrawerHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
59
59
|
/**
|
|
60
60
|
* Overlay element
|
|
61
61
|
*/
|
|
62
|
-
readonly Overlay?: React.
|
|
62
|
+
readonly Overlay?: React.ComponentType<ModalOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
63
63
|
}
|
|
64
64
|
declare const Drawer: React.FC<DrawerProps>;
|
|
65
65
|
export default Drawer;
|
|
@@ -28,23 +28,23 @@ export interface MessageBoxOverrides {
|
|
|
28
28
|
/**
|
|
29
29
|
* Element container
|
|
30
30
|
*/
|
|
31
|
-
readonly Container?: React.
|
|
31
|
+
readonly Container?: React.ComponentType<MessageBoxContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
32
|
/**
|
|
33
33
|
* Element ontent
|
|
34
34
|
*/
|
|
35
|
-
readonly Content?: React.
|
|
35
|
+
readonly Content?: React.ComponentType<MessageBoxContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
36
|
/**
|
|
37
37
|
* Element footer
|
|
38
38
|
*/
|
|
39
|
-
readonly Footer?: React.
|
|
39
|
+
readonly Footer?: React.ComponentType<MessageBoxFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
40
|
/**
|
|
41
41
|
* Element header
|
|
42
42
|
*/
|
|
43
|
-
readonly Header?: React.
|
|
43
|
+
readonly Header?: React.ComponentType<MessageBoxHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
44
|
/**
|
|
45
45
|
* Overlay header
|
|
46
46
|
*/
|
|
47
|
-
readonly Overlay?: React.
|
|
47
|
+
readonly Overlay?: React.ComponentType<ModalOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
48
48
|
}
|
|
49
49
|
declare const MessageBox: React.FC<MessageBoxProps>;
|
|
50
50
|
export default MessageBox;
|