@pushwoosh/dumb-components 2.12.1 → 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/Calendar/CalendarMonthSlider/CalendarMonthSlider.js +11 -5
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -1
- package/DateTimePicker/components/AutosizeInput/AutosizeInput.d.ts +0 -3
- package/DateTimePicker/components/AutosizeInput/AutosizeInput.js +0 -39
- package/DateTimePicker/components/AutosizeInput/index.d.ts +0 -1
- package/DateTimePicker/components/AutosizeInput/index.js +0 -1
- package/DateTimePicker/components/AutosizeInput/styles.d.ts +0 -3
- package/DateTimePicker/components/AutosizeInput/styles.js +0 -5
- package/DateTimePicker/components/AutosizeInput/types.d.ts +0 -10
- package/DateTimePicker/components/AutosizeInput/types.js +0 -1
- package/DateTimePicker/components/DatePicker/DatePicker.d.ts +0 -8
- package/DateTimePicker/components/DatePicker/DatePicker.js +0 -65
- package/DateTimePicker/components/DatePicker/index.d.ts +0 -1
- package/DateTimePicker/components/DatePicker/index.js +0 -1
- package/DateTimePicker/components/DatePicker/types.d.ts +0 -20
- package/DateTimePicker/components/DatePicker/types.js +0 -1
- package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +0 -8
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +0 -86
- package/DateTimePicker/components/DatePickerField/index.d.ts +0 -1
- package/DateTimePicker/components/DatePickerField/index.js +0 -1
- package/DateTimePicker/components/DatePickerField/types.d.ts +0 -20
- package/DateTimePicker/components/DatePickerField/types.js +0 -1
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.d.ts +0 -8
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +0 -64
- package/DateTimePicker/components/DateTimePicker/index.d.ts +0 -1
- package/DateTimePicker/components/DateTimePicker/index.js +0 -1
- package/DateTimePicker/components/DateTimePicker/types.d.ts +0 -13
- package/DateTimePicker/components/DateTimePicker/types.js +0 -1
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +0 -8
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +0 -91
- package/DateTimePicker/components/DateTimePickerField/helpers.d.ts +0 -8
- package/DateTimePicker/components/DateTimePickerField/helpers.js +0 -13
- package/DateTimePicker/components/DateTimePickerField/index.d.ts +0 -1
- package/DateTimePicker/components/DateTimePickerField/index.js +0 -1
- package/DateTimePicker/components/DateTimePickerField/types.d.ts +0 -20
- package/DateTimePicker/components/DateTimePickerField/types.js +0 -1
- package/DateTimePicker/components/DecadeView/DecadeView.d.ts +0 -3
- package/DateTimePicker/components/DecadeView/DecadeView.js +0 -35
- package/DateTimePicker/components/DecadeView/index.d.ts +0 -1
- package/DateTimePicker/components/DecadeView/index.js +0 -1
- package/DateTimePicker/components/DecadeView/types.d.ts +0 -6
- package/DateTimePicker/components/DecadeView/types.js +0 -1
- package/DateTimePicker/components/Input/Input.d.ts +0 -3
- package/DateTimePicker/components/Input/Input.js +0 -17
- package/DateTimePicker/components/Input/index.d.ts +0 -1
- package/DateTimePicker/components/Input/index.js +0 -1
- package/DateTimePicker/components/Input/styles.d.ts +0 -3
- package/DateTimePicker/components/Input/styles.js +0 -6
- package/DateTimePicker/components/Input/types.d.ts +0 -11
- package/DateTimePicker/components/Input/types.js +0 -1
- package/DateTimePicker/components/Month/Month.d.ts +0 -3
- package/DateTimePicker/components/Month/Month.js +0 -78
- package/DateTimePicker/components/Month/index.d.ts +0 -1
- package/DateTimePicker/components/Month/index.js +0 -1
- package/DateTimePicker/components/Month/types.d.ts +0 -8
- package/DateTimePicker/components/Month/types.js +0 -1
- package/DateTimePicker/components/MonthView/MonthView.d.ts +0 -3
- package/DateTimePicker/components/MonthView/MonthView.js +0 -41
- package/DateTimePicker/components/MonthView/index.d.ts +0 -1
- package/DateTimePicker/components/MonthView/index.js +0 -1
- package/DateTimePicker/components/MonthView/types.d.ts +0 -11
- package/DateTimePicker/components/MonthView/types.js +0 -1
- package/DateTimePicker/components/NumberPicker/NumberPicker.d.ts +0 -3
- package/DateTimePicker/components/NumberPicker/NumberPicker.js +0 -133
- package/DateTimePicker/components/NumberPicker/helpers.d.ts +0 -2
- package/DateTimePicker/components/NumberPicker/helpers.js +0 -5
- package/DateTimePicker/components/NumberPicker/index.d.ts +0 -1
- package/DateTimePicker/components/NumberPicker/index.js +0 -1
- package/DateTimePicker/components/NumberPicker/styles.d.ts +0 -3
- package/DateTimePicker/components/NumberPicker/styles.js +0 -6
- package/DateTimePicker/components/NumberPicker/types.d.ts +0 -13
- package/DateTimePicker/components/NumberPicker/types.js +0 -1
- package/DateTimePicker/components/PickerPlate/PickerPlate.d.ts +0 -3
- package/DateTimePicker/components/PickerPlate/PickerPlate.js +0 -27
- package/DateTimePicker/components/PickerPlate/index.d.ts +0 -1
- package/DateTimePicker/components/PickerPlate/index.js +0 -1
- package/DateTimePicker/components/PickerPlate/styles.d.ts +0 -17
- package/DateTimePicker/components/PickerPlate/styles.js +0 -9
- package/DateTimePicker/components/PickerPlate/types.d.ts +0 -7
- package/DateTimePicker/components/PickerPlate/types.js +0 -1
- package/DateTimePicker/components/YearView/YearView.d.ts +0 -3
- package/DateTimePicker/components/YearView/YearView.js +0 -36
- package/DateTimePicker/components/YearView/index.d.ts +0 -1
- package/DateTimePicker/components/YearView/index.js +0 -1
- package/DateTimePicker/components/YearView/types.d.ts +0 -6
- package/DateTimePicker/components/YearView/types.js +0 -1
- package/DateTimePicker/constants.d.ts +0 -5
- package/DateTimePicker/constants.js +0 -9
- package/DateTimePicker/helpers.d.ts +0 -13
- package/DateTimePicker/helpers.js +0 -81
- package/DateTimePicker/index.d.ts +0 -8
- package/DateTimePicker/index.js +0 -8
- package/DateTimePicker/polyglot/index.d.ts +0 -2
- package/DateTimePicker/polyglot/index.js +0 -33
- package/DateTimePicker/polyglot/messages_ar.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_ar.js +0 -11
- package/DateTimePicker/polyglot/messages_bn.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_bn.js +0 -11
- package/DateTimePicker/polyglot/messages_de.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_de.js +0 -11
- package/DateTimePicker/polyglot/messages_en.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_en.js +0 -11
- package/DateTimePicker/polyglot/messages_es.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_es.js +0 -11
- package/DateTimePicker/polyglot/messages_fr.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_fr.js +0 -11
- package/DateTimePicker/polyglot/messages_he.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_he.js +0 -11
- package/DateTimePicker/polyglot/messages_hi.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_hi.js +0 -11
- package/DateTimePicker/polyglot/messages_ja.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_ja.js +0 -11
- package/DateTimePicker/polyglot/messages_ko.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_ko.js +0 -11
- package/DateTimePicker/polyglot/messages_pt.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_pt.js +0 -11
- package/DateTimePicker/polyglot/messages_ru.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_ru.js +0 -11
- package/DateTimePicker/polyglot/messages_th.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_th.js +0 -11
- package/DateTimePicker/polyglot/messages_zh.d.ts +0 -3
- package/DateTimePicker/polyglot/messages_zh.js +0 -11
- package/DateTimePicker/polyglot/types.d.ts +0 -12
- package/DateTimePicker/polyglot/types.js +0 -1
- package/DateTimePicker/styles.d.ts +0 -371
- package/DateTimePicker/styles.js +0 -66
- package/DateTimePicker/types.d.ts +0 -11
- package/DateTimePicker/types.js +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Columns } from '@pushwoosh/kit-helpers';
|
|
3
|
-
import { format, parseStringToArray, addPeriod, setPeriod } from '../../helpers';
|
|
4
|
-
import { CellBox } from '../../styles';
|
|
5
|
-
import { PickerPlate } from '../PickerPlate';
|
|
6
|
-
export function DecadeView(props) {
|
|
7
|
-
const {
|
|
8
|
-
activeDay,
|
|
9
|
-
value,
|
|
10
|
-
onChange,
|
|
11
|
-
onSelect
|
|
12
|
-
} = props;
|
|
13
|
-
const [activeDayYear] = parseStringToArray(activeDay || '');
|
|
14
|
-
const valueYear = +value;
|
|
15
|
-
const firstYear = valueYear - valueYear % 12;
|
|
16
|
-
return _jsx(PickerPlate, {
|
|
17
|
-
onPrev: () => onChange(format(addPeriod(value, 'year', -12), 'year')),
|
|
18
|
-
onNext: () => onChange(format(addPeriod(value, 'year', 12), 'year')),
|
|
19
|
-
children: _jsx(Columns, {
|
|
20
|
-
"$sizes": 4,
|
|
21
|
-
"$gap": 4,
|
|
22
|
-
children: Array.from({
|
|
23
|
-
length: 12
|
|
24
|
-
}).map((_, i) => {
|
|
25
|
-
const year = firstYear + i;
|
|
26
|
-
return _jsx(CellBox, {
|
|
27
|
-
"$height": "59px",
|
|
28
|
-
"$isActive": year === activeDayYear,
|
|
29
|
-
onClick: () => onSelect(format(setPeriod(value, 'year', year), 'year')),
|
|
30
|
-
children: year
|
|
31
|
-
}, year);
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './DecadeView';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './DecadeView';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { InputStyled } from './styles';
|
|
3
|
-
export function Input(props) {
|
|
4
|
-
const {
|
|
5
|
-
width,
|
|
6
|
-
isDisabled,
|
|
7
|
-
...rest
|
|
8
|
-
} = props;
|
|
9
|
-
return _jsx(InputStyled, {
|
|
10
|
-
type: "text",
|
|
11
|
-
disabled: isDisabled,
|
|
12
|
-
style: {
|
|
13
|
-
width: width || '100%'
|
|
14
|
-
},
|
|
15
|
-
...rest
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Input';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Input';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const InputStyled: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "style"> & {
|
|
2
|
-
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
3
|
-
}> & string;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
-
export const InputStyled = styled.input.withConfig({
|
|
4
|
-
displayName: "InputStyled",
|
|
5
|
-
componentId: "sc-17gtn04-0"
|
|
6
|
-
})(["color:", ";-webkit-text-fill-color:", ";background-color:transparent;&::placeholder{color:", ";-webkit-text-fill-color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}"], Color.MAIN, Color.MAIN, Color.PHANTOM, Color.PHANTOM, Color.FROZEN, Color.LOCKED);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ChangeEvent, KeyboardEvent, FocusEvent } from 'react';
|
|
2
|
-
export interface InputProps {
|
|
3
|
-
value: string;
|
|
4
|
-
width?: number;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
isDisabled?: boolean;
|
|
7
|
-
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
-
onKeyUp: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
9
|
-
onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
10
|
-
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { Columns } from '@pushwoosh/kit-helpers';
|
|
4
|
-
import { format, firstDayOfWeek, parseStringToDate, differenceInDays, isSamePeriod, isInRange } from '../../helpers';
|
|
5
|
-
import { Lang } from '../../polyglot';
|
|
6
|
-
import { CellBox, DayHeader } from '../../styles';
|
|
7
|
-
export function Month(props) {
|
|
8
|
-
const {
|
|
9
|
-
month,
|
|
10
|
-
activeDay,
|
|
11
|
-
userInputDay,
|
|
12
|
-
minDate,
|
|
13
|
-
maxDate,
|
|
14
|
-
onDaySelect
|
|
15
|
-
} = props;
|
|
16
|
-
const [firstDayDate, days] = useMemo(() => {
|
|
17
|
-
const monthDate = parseStringToDate(month);
|
|
18
|
-
const firstDayOfMonth = new Date(monthDate);
|
|
19
|
-
firstDayOfMonth.setUTCDate(1);
|
|
20
|
-
const lastDayOfMonth = new Date(month);
|
|
21
|
-
lastDayOfMonth.setUTCMonth(lastDayOfMonth.getUTCMonth() + 1);
|
|
22
|
-
lastDayOfMonth.setUTCDate(0);
|
|
23
|
-
const firstDayOfFirstWeek = firstDayOfWeek(firstDayOfMonth);
|
|
24
|
-
const firstDayOfLastWeek = firstDayOfWeek(lastDayOfMonth);
|
|
25
|
-
const daysInCalendar = differenceInDays(firstDayOfLastWeek, firstDayOfFirstWeek) + 7;
|
|
26
|
-
return [firstDayOfFirstWeek, daysInCalendar];
|
|
27
|
-
}, [month]);
|
|
28
|
-
return _jsxs(Columns, {
|
|
29
|
-
"$sizes": 7,
|
|
30
|
-
"$gap": 4,
|
|
31
|
-
children: [_jsx(DayHeader, {
|
|
32
|
-
children: _jsx(Lang, {
|
|
33
|
-
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SUN"
|
|
34
|
-
})
|
|
35
|
-
}), _jsx(DayHeader, {
|
|
36
|
-
children: _jsx(Lang, {
|
|
37
|
-
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_MON"
|
|
38
|
-
})
|
|
39
|
-
}), _jsx(DayHeader, {
|
|
40
|
-
children: _jsx(Lang, {
|
|
41
|
-
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_TUE"
|
|
42
|
-
})
|
|
43
|
-
}), _jsx(DayHeader, {
|
|
44
|
-
children: _jsx(Lang, {
|
|
45
|
-
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_WED"
|
|
46
|
-
})
|
|
47
|
-
}), _jsx(DayHeader, {
|
|
48
|
-
children: _jsx(Lang, {
|
|
49
|
-
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_THU"
|
|
50
|
-
})
|
|
51
|
-
}), _jsx(DayHeader, {
|
|
52
|
-
children: _jsx(Lang, {
|
|
53
|
-
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_FRI"
|
|
54
|
-
})
|
|
55
|
-
}), _jsx(DayHeader, {
|
|
56
|
-
children: _jsx(Lang, {
|
|
57
|
-
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SAT"
|
|
58
|
-
})
|
|
59
|
-
}), Array.from({
|
|
60
|
-
length: days
|
|
61
|
-
}).map((_, i) => {
|
|
62
|
-
const curDay = new Date(Date.UTC(firstDayDate.getUTCFullYear(), firstDayDate.getUTCMonth(), firstDayDate.getUTCDate() + i));
|
|
63
|
-
const isDisabled = isInRange({
|
|
64
|
-
value: curDay,
|
|
65
|
-
minDate: minDate,
|
|
66
|
-
maxDate: maxDate
|
|
67
|
-
});
|
|
68
|
-
return _jsx(CellBox, {
|
|
69
|
-
"$isActive": !!activeDay && isSamePeriod(curDay, activeDay, 'day'),
|
|
70
|
-
"$isDisabled": isDisabled,
|
|
71
|
-
"$secondary": !isSamePeriod(month, curDay, 'month'),
|
|
72
|
-
"$secondActive": !!userInputDay && isSamePeriod(curDay, userInputDay, 'day'),
|
|
73
|
-
onClick: () => onDaySelect(format(curDay, 'year-month-day')),
|
|
74
|
-
children: curDay.getUTCDate()
|
|
75
|
-
}, `${curDay}`);
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Month';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Month';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
|
-
import { addPeriod, format, monthName } from '../../helpers';
|
|
4
|
-
import { DateInfo } from '../../styles';
|
|
5
|
-
import { Month } from '../Month';
|
|
6
|
-
import { PickerPlate } from '../PickerPlate';
|
|
7
|
-
export function MonthView(props) {
|
|
8
|
-
const {
|
|
9
|
-
month,
|
|
10
|
-
activeDay,
|
|
11
|
-
userInputDay,
|
|
12
|
-
minDate,
|
|
13
|
-
maxDate,
|
|
14
|
-
onDaySelect,
|
|
15
|
-
onShowYear,
|
|
16
|
-
onShowDecade,
|
|
17
|
-
onChange
|
|
18
|
-
} = props;
|
|
19
|
-
return _jsx(PickerPlate, {
|
|
20
|
-
onPrev: () => onChange(format(addPeriod(month, 'month', -1), 'year-month')),
|
|
21
|
-
onNext: () => onChange(format(addPeriod(month, 'month', 1), 'year-month')),
|
|
22
|
-
slot: _jsxs(Horizontal, {
|
|
23
|
-
"$gap": 4,
|
|
24
|
-
children: [_jsx(DateInfo, {
|
|
25
|
-
onClick: onShowYear,
|
|
26
|
-
children: monthName(+format(month, 'month'))
|
|
27
|
-
}), _jsx(DateInfo, {
|
|
28
|
-
onClick: onShowDecade,
|
|
29
|
-
children: format(month, 'year')
|
|
30
|
-
})]
|
|
31
|
-
}),
|
|
32
|
-
children: _jsx(Month, {
|
|
33
|
-
month: month,
|
|
34
|
-
activeDay: activeDay,
|
|
35
|
-
userInputDay: userInputDay,
|
|
36
|
-
minDate: minDate,
|
|
37
|
-
maxDate: maxDate,
|
|
38
|
-
onDaySelect: onDaySelect
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MonthView';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MonthView';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface MonthViewProps {
|
|
2
|
-
month: string;
|
|
3
|
-
activeDay?: string;
|
|
4
|
-
userInputDay?: string;
|
|
5
|
-
minDate?: Date | string;
|
|
6
|
-
maxDate?: Date | string;
|
|
7
|
-
onDaySelect: (day: string) => void;
|
|
8
|
-
onShowYear: () => void;
|
|
9
|
-
onShowDecade: () => void;
|
|
10
|
-
onChange: (day: string) => void;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type ReactElement } from 'react';
|
|
2
|
-
import type { NumberPickerProps } from './types';
|
|
3
|
-
export declare function NumberPicker({ value, hint, step, placeholder, focusOnMount, minValue, maxValue, autoSize, isDisabled, onChange, onSubmit, }: NumberPickerProps): ReactElement;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useState, useEffect } from 'react';
|
|
3
|
-
import { Vertical, useMount, usePersistentFunction } from '@pushwoosh/kit-helpers';
|
|
4
|
-
import { ChevronIcon } from '@pushwoosh/kit-icons';
|
|
5
|
-
import { intVal, isStringInteger } from './helpers';
|
|
6
|
-
import { SingleInputFrame } from '../../styles';
|
|
7
|
-
import { AutosizeInput } from '../AutosizeInput';
|
|
8
|
-
import { Input } from '../Input';
|
|
9
|
-
import { Hint } from './styles';
|
|
10
|
-
export function NumberPicker({
|
|
11
|
-
value,
|
|
12
|
-
hint,
|
|
13
|
-
step = 1,
|
|
14
|
-
placeholder,
|
|
15
|
-
focusOnMount,
|
|
16
|
-
minValue,
|
|
17
|
-
maxValue,
|
|
18
|
-
autoSize,
|
|
19
|
-
isDisabled,
|
|
20
|
-
onChange,
|
|
21
|
-
onSubmit
|
|
22
|
-
}) {
|
|
23
|
-
const ref = useRef(null);
|
|
24
|
-
const [autoDiff, setAutoDiff] = useState(0);
|
|
25
|
-
const [localValue, setLocalValue] = useState(value.toString() || '');
|
|
26
|
-
const onChangeDiff = usePersistentFunction(diff => {
|
|
27
|
-
const newValue = intVal(value) + diff;
|
|
28
|
-
const minValueValid = minValue === undefined || newValue >= minValue;
|
|
29
|
-
const maxValueValid = maxValue === undefined || newValue <= maxValue;
|
|
30
|
-
if (minValueValid && maxValueValid) {
|
|
31
|
-
onChange(newValue);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
setLocalValue(value.toString() || '');
|
|
36
|
-
}, [value]);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (!autoDiff) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const interval = setInterval(() => {
|
|
42
|
-
onChangeDiff(autoDiff);
|
|
43
|
-
}, 250);
|
|
44
|
-
return () => clearInterval(interval);
|
|
45
|
-
}, [autoDiff, onChangeDiff]);
|
|
46
|
-
useMount(() => {
|
|
47
|
-
if (focusOnMount && ref.current) {
|
|
48
|
-
ref.current.children[0].focus();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const handleChange = event => {
|
|
52
|
-
const val = event.target.value;
|
|
53
|
-
if (val === '' || val === '-') {
|
|
54
|
-
setLocalValue(val);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const parsedValue = intVal(val);
|
|
58
|
-
if (parsedValue === 0 && val !== '0') {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
setLocalValue(val);
|
|
62
|
-
const minValueValid = minValue === undefined || parsedValue >= minValue;
|
|
63
|
-
const maxValueValid = maxValue === undefined || parsedValue <= maxValue;
|
|
64
|
-
if (isStringInteger(val) && minValueValid && maxValueValid) {
|
|
65
|
-
onChange(parsedValue);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const handleKeyDown = event => {
|
|
69
|
-
if (onSubmit && event.key === 'Enter' && isStringInteger(localValue)) {
|
|
70
|
-
onSubmit();
|
|
71
|
-
}
|
|
72
|
-
if (event.key === 'ArrowUp') {
|
|
73
|
-
onChangeDiff(1);
|
|
74
|
-
setAutoDiff(1);
|
|
75
|
-
}
|
|
76
|
-
if (event.key === 'ArrowDown') {
|
|
77
|
-
onChangeDiff(-1);
|
|
78
|
-
setAutoDiff(-1);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const resetAutoDiff = () => setAutoDiff(0);
|
|
82
|
-
const InputComponent = autoSize ? AutosizeInput : Input;
|
|
83
|
-
return _jsxs(SingleInputFrame, {
|
|
84
|
-
ref: ref,
|
|
85
|
-
"$hasHint": !!hint,
|
|
86
|
-
"$isDisabled": isDisabled,
|
|
87
|
-
children: [_jsx(InputComponent, {
|
|
88
|
-
value: localValue,
|
|
89
|
-
placeholder: placeholder,
|
|
90
|
-
isDisabled: isDisabled,
|
|
91
|
-
onChange: handleChange,
|
|
92
|
-
onKeyDown: handleKeyDown,
|
|
93
|
-
onKeyUp: resetAutoDiff,
|
|
94
|
-
onBlur: event => {
|
|
95
|
-
let blurValue = intVal(event.target.value);
|
|
96
|
-
const minValueValid = minValue === undefined || blurValue >= minValue;
|
|
97
|
-
const maxValueValid = maxValue === undefined || blurValue <= maxValue;
|
|
98
|
-
if (!maxValueValid) {
|
|
99
|
-
blurValue = maxValue;
|
|
100
|
-
} else if (!minValueValid) {
|
|
101
|
-
blurValue = minValue;
|
|
102
|
-
}
|
|
103
|
-
onChange(blurValue);
|
|
104
|
-
setLocalValue(blurValue.toString());
|
|
105
|
-
}
|
|
106
|
-
}), hint && _jsx(Hint, {
|
|
107
|
-
children: hint
|
|
108
|
-
}), _jsxs(Vertical, {
|
|
109
|
-
"$gap": 1,
|
|
110
|
-
children: [_jsx("div", {
|
|
111
|
-
children: _jsx(ChevronIcon, {
|
|
112
|
-
direction: "up",
|
|
113
|
-
size: "small",
|
|
114
|
-
"aria-disabled": "true",
|
|
115
|
-
onClick: () => onChangeDiff(step),
|
|
116
|
-
onMouseDown: () => setAutoDiff(step),
|
|
117
|
-
onMouseUp: resetAutoDiff,
|
|
118
|
-
onMouseLeave: resetAutoDiff
|
|
119
|
-
})
|
|
120
|
-
}), _jsx("div", {
|
|
121
|
-
children: _jsx(ChevronIcon, {
|
|
122
|
-
size: "small",
|
|
123
|
-
direction: "down",
|
|
124
|
-
"aria-disabled": isDisabled,
|
|
125
|
-
onClick: () => onChangeDiff(-1 * step),
|
|
126
|
-
onMouseDown: () => setAutoDiff(-1 * step),
|
|
127
|
-
onMouseUp: resetAutoDiff,
|
|
128
|
-
onMouseLeave: resetAutoDiff
|
|
129
|
-
})
|
|
130
|
-
})]
|
|
131
|
-
})]
|
|
132
|
-
});
|
|
133
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NumberPicker';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NumberPicker';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const Hint: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
2
|
-
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
3
|
-
}> & string;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
-
export const Hint = styled.div.withConfig({
|
|
4
|
-
displayName: "Hint",
|
|
5
|
-
componentId: "sc-170ev2t-0"
|
|
6
|
-
})(["display:flex;align-items:center;font-size:100%;line-height:initial;padding-right:8px;color:", ";pointer-events:none;"], Color.PHANTOM);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface NumberPickerProps {
|
|
2
|
-
value: number;
|
|
3
|
-
hint?: string;
|
|
4
|
-
step?: number;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
focusOnMount?: boolean;
|
|
7
|
-
minValue?: number;
|
|
8
|
-
maxValue?: number;
|
|
9
|
-
autoSize?: boolean;
|
|
10
|
-
isDisabled?: boolean;
|
|
11
|
-
onChange: (value: number) => void;
|
|
12
|
-
onSubmit?: () => void;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Vertical, Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
|
-
import { Arrow } from './styles';
|
|
4
|
-
export function PickerPlate(props) {
|
|
5
|
-
const {
|
|
6
|
-
slot,
|
|
7
|
-
children,
|
|
8
|
-
onPrev,
|
|
9
|
-
onNext
|
|
10
|
-
} = props;
|
|
11
|
-
return _jsxs(Vertical, {
|
|
12
|
-
"$gap": 16,
|
|
13
|
-
children: [_jsxs(Horizontal, {
|
|
14
|
-
"$justifyContent": "space-between",
|
|
15
|
-
children: [slot, _jsxs(Horizontal, {
|
|
16
|
-
"$gap": 4,
|
|
17
|
-
children: [_jsx(Arrow, {
|
|
18
|
-
direction: "left",
|
|
19
|
-
onClick: onPrev
|
|
20
|
-
}), _jsx(Arrow, {
|
|
21
|
-
direction: "right",
|
|
22
|
-
onClick: onNext
|
|
23
|
-
})]
|
|
24
|
-
})]
|
|
25
|
-
}), children]
|
|
26
|
-
});
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './PickerPlate';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './PickerPlate';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const Arrow: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
|
-
readonly boxRef?: import("react").Ref<HTMLDivElement>;
|
|
3
|
-
readonly as?: string;
|
|
4
|
-
} & {
|
|
5
|
-
readonly direction: "down-left\uFE0E" | "down-right\uFE0E" | "down" | "left" | "right" | "up-left\uFE0E" | "up-right\uFE0E" | "up";
|
|
6
|
-
readonly size: "medium" | "small";
|
|
7
|
-
}, "style"> & {
|
|
8
|
-
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
9
|
-
}, "children" | "key" | "slot" | "style" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "as" | "boxRef" | "direction"> & Partial<Pick<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
|
-
readonly boxRef?: import("react").Ref<HTMLDivElement>;
|
|
11
|
-
readonly as?: string;
|
|
12
|
-
} & {
|
|
13
|
-
readonly direction: "down-left\uFE0E" | "down-right\uFE0E" | "down" | "left" | "right" | "up-left\uFE0E" | "up-right\uFE0E" | "up";
|
|
14
|
-
readonly size: "medium" | "small";
|
|
15
|
-
}, "style"> & {
|
|
16
|
-
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
17
|
-
}, "children" | "key" | "slot" | "style" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "as" | "boxRef" | "direction">>> & string & Omit<import("react").FC<import("@pushwoosh/kit-icons").ArrowIconProps>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
-
import { ArrowIcon } from '@pushwoosh/kit-icons';
|
|
4
|
-
export const Arrow = styled(ArrowIcon).attrs({
|
|
5
|
-
size: 'medium'
|
|
6
|
-
}).withConfig({
|
|
7
|
-
displayName: "Arrow",
|
|
8
|
-
componentId: "sc-1icudiw-0"
|
|
9
|
-
})(["color:", ";cursor:pointer;&:hover{color:", ";}"], Color.BRIGHT, Color.BRIGHT_HOVER);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Columns } from '@pushwoosh/kit-helpers';
|
|
3
|
-
import { format, addPeriod, setPeriod, monthName, isSamePeriod } from '../../helpers';
|
|
4
|
-
import { CellBox, DateInfo } from '../../styles';
|
|
5
|
-
import { PickerPlate } from '../PickerPlate';
|
|
6
|
-
export function YearView(props) {
|
|
7
|
-
const {
|
|
8
|
-
activeDay,
|
|
9
|
-
year,
|
|
10
|
-
onChange,
|
|
11
|
-
onSelect
|
|
12
|
-
} = props;
|
|
13
|
-
return _jsx(PickerPlate, {
|
|
14
|
-
onPrev: () => onChange(format(addPeriod(year, 'year', -1), 'year')),
|
|
15
|
-
onNext: () => onChange(format(addPeriod(year, 'year', 1), 'year')),
|
|
16
|
-
slot: _jsx(DateInfo, {
|
|
17
|
-
children: year
|
|
18
|
-
}),
|
|
19
|
-
children: _jsx(Columns, {
|
|
20
|
-
"$sizes": 4,
|
|
21
|
-
"$gap": 4,
|
|
22
|
-
"$justifyContent": "space-between",
|
|
23
|
-
children: Array.from({
|
|
24
|
-
length: 12
|
|
25
|
-
}).map((_, i) => {
|
|
26
|
-
const month = format(setPeriod(year, 'month', i + 1), 'year-month');
|
|
27
|
-
return _jsx(CellBox, {
|
|
28
|
-
"$height": "59px",
|
|
29
|
-
"$isActive": !!activeDay && isSamePeriod(month, activeDay, 'month'),
|
|
30
|
-
onClick: () => onSelect(month),
|
|
31
|
-
children: monthName(i + 1, 'short')
|
|
32
|
-
}, `${year}-${month}`);
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './YearView';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './YearView';
|