@via-profit/ui-kit 0.1.8 → 0.2.1-alpha.3
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 +34 -7
- package/Autocomplete/AutocompleteContainer.js +28 -24
- package/Autocomplete/AutocompleteItem.d.ts +1 -1
- package/Autocomplete/AutocompleteTextField.d.ts +3 -0
- package/Autocomplete/AutocompleteTextField.js +63 -1
- package/Autocomplete/OverrideMenuList.d.ts +4 -0
- package/Autocomplete/OverrideMenuList.js +39 -0
- package/Autocomplete/context.d.ts +9 -1
- package/Autocomplete/context.js +15 -1
- package/Autocomplete/index.js +9 -10
- package/Autocomplete2/Autocomplete2.d.ts +12 -0
- package/Autocomplete2/Autocomplete2.js +83 -0
- package/Autocomplete2/Autocomplete2TextField.d.ts +7 -0
- package/Autocomplete2/Autocomplete2TextField.js +39 -0
- package/Autocomplete2/index.d.ts +2 -0
- package/Autocomplete2/index.js +7 -0
- package/Avatar/AvatarBase.d.ts +4 -4
- package/Avatar/index.js +1 -1
- package/Badge/BadgeBase.d.ts +4 -4
- package/Badge/BadgeDeleteButton.js +6 -6
- package/Badge/BadgeOutlined.js +2 -2
- package/Badge/BadgeStandard.js +1 -1
- package/Button/ButtonBase.d.ts +3 -3
- package/Button/ButtonOutlined.js +1 -1
- package/Button/ButtonPlain.js +1 -1
- package/Button/ButtonStandard.js +4 -11
- package/Calendar/CalendarCell.js +22 -4
- package/Calendar/CalendarComponent.d.ts +226 -0
- package/Calendar/CalendarComponent.js +572 -0
- package/Calendar/CalendarControlButton.js +16 -9
- package/Calendar/CalendarDayBadge.js +1 -1
- package/Calendar/CalendarEmptyCell.d.ts +2 -2
- package/Calendar/CalendarEmptyCell.js +8 -3
- package/Calendar/CalendarHeading.js +2 -1
- package/Calendar/CalendarMonthCell.js +0 -5
- package/Calendar/CalendarSubheading.js +3 -2
- package/Calendar/CalendarWeekDayCell.d.ts +10 -0
- package/Calendar/CalendarWeekDayCell.js +32 -0
- package/Calendar/CalendarWeekDayWeekNumber.d.ts +7 -0
- package/Calendar/CalendarWeekDayWeekNumber.js +38 -0
- package/Calendar/CalendarWeekRow.d.ts +2 -2
- package/Calendar/CalendarWeekRow.js +2 -1
- package/Calendar/CalendarWeekRowButton.d.ts +13 -0
- package/Calendar/CalendarWeekRowButton.js +31 -0
- package/Calendar/CalendarYearCell.js +5 -5
- package/Calendar/CalendarYearsSelector.d.ts +39 -1
- package/Calendar/CalendarYearsSelector.js +52 -16
- package/Calendar/IconChevronDown.d.ts +3 -0
- package/Calendar/IconChevronDown.js +31 -0
- package/Calendar/index.d.ts +7 -220
- package/Calendar/index.js +19 -274
- package/Calendar/use-calendar.d.ts +1 -1
- package/Calendar/use-calendar.js +102 -155
- package/Color/Color.d.ts +138 -0
- package/Color/Color.js +324 -0
- package/Color/ColorGenerator.d.ts +29 -0
- package/Color/ColorGenerator.js +141 -0
- package/Color/ColorParser.d.ts +20 -0
- package/Color/ColorParser.js +284 -0
- package/Color/index.d.ts +4 -122
- package/Color/index.js +18 -473
- package/DatePicker/index.d.ts +2 -17
- package/DatePicker/index.js +47 -61
- package/DatePicker/useDatePickerFormat.js +5 -5
- package/ErrorBoundary/Fallback.d.ts +3 -0
- package/ErrorBoundary/Fallback.js +51 -0
- package/ErrorBoundary/RenderError.d.ts +6 -0
- package/ErrorBoundary/RenderError.js +80 -0
- package/ErrorBoundary/index.d.ts +7 -11
- package/ErrorBoundary/index.js +4 -51
- package/Highlighted/index.d.ts +3 -3
- package/LoadingIndicator/Spinner.d.ts +5 -3
- package/LoadingIndicator/Spinner.js +61 -32
- package/LoadingIndicator/index.d.ts +3 -3
- package/LoadingIndicator/index.js +15 -2
- package/MaskedField/index.d.ts +1 -1
- package/MaskedField/index.js +11 -10
- package/Menu/AutoHeightWrapper.d.ts +6 -0
- package/Menu/AutoHeightWrapper.js +43 -0
- package/Menu/MeasuredItem.d.ts +10 -0
- package/Menu/MeasuredItem.js +51 -0
- package/Menu/MenuContainer.d.ts +53 -20
- package/Menu/MenuContainer.js +18 -11
- package/Menu/MenuItem.d.ts +24 -7
- package/Menu/MenuItem.js +13 -6
- package/Menu/MenuList.d.ts +4 -2
- package/Menu/MenuList.js +26 -6
- package/Menu/VirtualizedItem.d.ts +22 -0
- package/Menu/VirtualizedItem.js +69 -0
- package/Menu/VirtualizedList.d.ts +18 -0
- package/Menu/VirtualizedList.js +28 -0
- package/Menu/VirtualizedListComponent.d.ts +20 -0
- package/Menu/VirtualizedListComponent.js +305 -0
- package/Menu/index.d.ts +3 -1
- package/Menu/index.js +4 -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 +148 -0
- package/Popper/Popper.js +113 -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 +110 -0
- package/Popper/usePopprer.js +505 -0
- package/Selectbox/SelectboxButton.d.ts +5 -0
- package/Selectbox/SelectboxButton.js +48 -8
- package/Selectbox/SelectboxButtonWrapper.d.ts +2 -0
- package/Selectbox/SelectboxButtonWrapper.js +1 -17
- package/Selectbox/SelectboxMenu.d.ts +12 -0
- package/Selectbox/SelectboxMenu.js +50 -0
- package/Selectbox/index.d.ts +13 -13
- package/Selectbox/index.js +115 -97
- package/Surface/index.d.ts +5 -5
- package/Surface/index.js +1 -1
- package/Swiper/Swiper.d.ts +44 -0
- package/Swiper/Swiper.js +139 -0
- package/Swiper/SwiperContainer.d.ts +7 -0
- package/Swiper/SwiperContainer.js +14 -0
- package/Swiper/SwiperSlide.d.ts +7 -0
- package/Swiper/SwiperSlide.js +55 -0
- package/Swiper/SwiperTrack.d.ts +14 -0
- package/Swiper/SwiperTrack.js +58 -0
- package/Swiper/SwiperWrapper.d.ts +14 -0
- package/Swiper/SwiperWrapper.js +60 -0
- package/Swiper/index.d.ts +7 -0
- package/Swiper/index.js +26 -0
- package/Switch/SwitchDot.js +1 -1
- package/Switch/SwitchTrack.js +1 -1
- package/Switch/index.d.ts +8 -8
- package/TextArea/index.d.ts +7 -7
- package/TextField/TextFieldContainer.d.ts +2 -2
- package/TextField/TextFieldContainer.js +5 -3
- package/TextField/TextFieldErrorText.d.ts +2 -2
- package/TextField/TextFieldErrorText.js +5 -4
- package/TextField/TextFieldIconWrapper.d.ts +3 -3
- package/TextField/TextFieldIconWrapper.js +5 -3
- package/TextField/TextFieldInput.d.ts +2 -2
- package/TextField/TextFieldInput.js +6 -4
- package/TextField/TextFieldInputWrapper.d.ts +2 -2
- package/TextField/TextFieldInputWrapper.js +5 -3
- package/TextField/TextFieldLabel.d.ts +2 -2
- package/TextField/TextFieldLabel.js +5 -3
- package/TextField/TextFieldLabelAsterisk.d.ts +2 -2
- package/TextField/TextFieldLabelAsterisk.js +5 -3
- package/TextField/index.d.ts +15 -8
- package/TextField/index.js +49 -22
- package/ThemeProvider/createTheme.js +2 -2
- package/package.json +1 -1
- package/Calendar/reducer.d.ts +0 -14
- package/Calendar/reducer.js +0 -26
- /package/Calendar/{IconChevronRight.d.ts → CalendarIconNext.d.ts} +0 -0
- /package/Calendar/{IconChevronRight.js → CalendarIconNext.js} +0 -0
|
@@ -30,11 +30,6 @@ const Btn = (0, styled_1.default)(Button_1.default) `
|
|
|
30
30
|
const CalendarMonthCell = (props, ref) => {
|
|
31
31
|
const { children, isSelected, accentColor } = props, restProps = __rest(props, ["children", "isSelected", "accentColor"]);
|
|
32
32
|
const myRef = react_1.default.useRef(null);
|
|
33
|
-
react_1.default.useEffect(() => {
|
|
34
|
-
if (isSelected && myRef.current) {
|
|
35
|
-
myRef.current.scrollIntoView({ behavior: 'instant' });
|
|
36
|
-
}
|
|
37
|
-
}, [isSelected]);
|
|
38
33
|
return (react_1.default.createElement(Btn, Object.assign({}, restProps, { type: "button", variant: isSelected ? 'standard' : 'plain', color: isSelected ? accentColor : 'default', ref: el => {
|
|
39
34
|
if (typeof ref === 'function') {
|
|
40
35
|
ref(el);
|
|
@@ -17,10 +17,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
19
|
const StyledCalendarSubheading = styled_1.default.div `
|
|
20
|
-
font-weight:
|
|
20
|
+
font-weight: 400;
|
|
21
21
|
font-size: 1em;
|
|
22
|
-
opacity: 0.
|
|
22
|
+
opacity: 0.8;
|
|
23
23
|
margin-bottom: 1em;
|
|
24
|
+
text-align: center;
|
|
24
25
|
`;
|
|
25
26
|
const CalendarSubheading = (props, ref) => {
|
|
26
27
|
const { children } = props, restProps = __rest(props, ["children"]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CalendarWeekCellProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
/**
|
|
4
|
+
* if cell day is today, then property will be true
|
|
5
|
+
*/
|
|
6
|
+
readonly isToday?: boolean;
|
|
7
|
+
readonly inCurrentMonth?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<CalendarWeekCellProps & React.RefAttributes<HTMLSpanElement>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const react_2 = require("@emotion/react");
|
|
20
|
+
const CalendarEmptyCell_1 = __importDefault(require("./CalendarEmptyCell"));
|
|
21
|
+
const Cell = (0, styled_1.default)(CalendarEmptyCell_1.default) `
|
|
22
|
+
color: currentColor;
|
|
23
|
+
${({ $inCurrentMonth }) => !$inCurrentMonth &&
|
|
24
|
+
(0, react_2.css) `
|
|
25
|
+
opacity: 0.5;
|
|
26
|
+
`}
|
|
27
|
+
`;
|
|
28
|
+
const CalendarWeekDayCell = (props, ref) => {
|
|
29
|
+
const { isToday, children, inCurrentMonth } = props, restProps = __rest(props, ["isToday", "children", "inCurrentMonth"]);
|
|
30
|
+
return (react_1.default.createElement(Cell, Object.assign({}, restProps, { "$isToday": isToday, "$inCurrentMonth": inCurrentMonth, ref: ref }), children));
|
|
31
|
+
};
|
|
32
|
+
exports.default = react_1.default.forwardRef(CalendarWeekDayCell);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Week } from './use-calendar';
|
|
3
|
+
export interface CalendarWeekDayWeekNumberProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
readonly week: Week;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<CalendarWeekDayWeekNumberProps & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const CalendarEmptyCell_1 = __importDefault(require("./CalendarEmptyCell"));
|
|
20
|
+
const Cell = (0, styled_1.default)(CalendarEmptyCell_1.default) `
|
|
21
|
+
font-weight: 800;
|
|
22
|
+
position: relative;
|
|
23
|
+
color: ${({ theme }) => theme.color.textPrimary.toString()};
|
|
24
|
+
&:before {
|
|
25
|
+
position: absolute;
|
|
26
|
+
content: '';
|
|
27
|
+
width: 1px;
|
|
28
|
+
right: 0;
|
|
29
|
+
top: 30%;
|
|
30
|
+
bottom: 30%;
|
|
31
|
+
background-color: currentColor;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
const CalendarWeekDayWeekNumber = (props, ref) => {
|
|
35
|
+
const { week, children } = props, restProps = __rest(props, ["week", "children"]);
|
|
36
|
+
return (react_1.default.createElement(Cell, Object.assign({}, restProps, { ref: ref }), children));
|
|
37
|
+
};
|
|
38
|
+
exports.default = react_1.default.forwardRef(CalendarWeekDayWeekNumber);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export type CalendarWeekRowProps = React.HTMLAttributes<
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<CalendarWeekRowProps & React.RefAttributes<
|
|
2
|
+
export type CalendarWeekRowProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<CalendarWeekRowProps & React.RefAttributes<HTMLSpanElement>>;
|
|
4
4
|
export default _default;
|
|
@@ -16,11 +16,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
-
const StyledCalendarWeekRow = styled_1.default.
|
|
19
|
+
const StyledCalendarWeekRow = styled_1.default.span `
|
|
20
20
|
display: flex;
|
|
21
21
|
flex-direction: row;
|
|
22
22
|
justify-content: center;
|
|
23
23
|
align-items: stretch;
|
|
24
|
+
color: inherit;
|
|
24
25
|
`;
|
|
25
26
|
const CalendarWeekRow = (props, ref) => {
|
|
26
27
|
const { children } = props, restProps = __rest(props, ["children"]);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Week } from './use-calendar';
|
|
3
|
+
export type CalendarWeekRowButtonProps = React.HTMLAttributes<HTMLButtonElement> & {
|
|
4
|
+
readonly isSelected?: boolean;
|
|
5
|
+
readonly accentColor: string;
|
|
6
|
+
readonly week: Week;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLButtonElement> & {
|
|
9
|
+
readonly isSelected?: boolean | undefined;
|
|
10
|
+
readonly accentColor: string;
|
|
11
|
+
readonly week: Week;
|
|
12
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Button_1 = __importDefault(require("../Button"));
|
|
20
|
+
const CalendarWeekRow_1 = __importDefault(require("./CalendarWeekRow"));
|
|
21
|
+
const StyleButton = (0, styled_1.default)(Button_1.default) `
|
|
22
|
+
padding: 0.2em 0.5em !important;
|
|
23
|
+
font-size: 1em;
|
|
24
|
+
border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
|
|
25
|
+
`;
|
|
26
|
+
const CalendarWeekRowButton = (props, ref) => {
|
|
27
|
+
const { children, isSelected, accentColor } = props, restProps = __rest(props, ["children", "isSelected", "accentColor"]);
|
|
28
|
+
return (react_1.default.createElement(StyleButton, Object.assign({ type: "button", variant: isSelected ? 'standard' : 'plain', color: isSelected ? accentColor : 'default' }, restProps, { ref: ref }),
|
|
29
|
+
react_1.default.createElement(CalendarWeekRow_1.default, null, children)));
|
|
30
|
+
};
|
|
31
|
+
exports.default = react_1.default.forwardRef(CalendarWeekRowButton);
|
|
@@ -30,11 +30,11 @@ const Btn = (0, styled_1.default)(Button_1.default) `
|
|
|
30
30
|
const CalendarYearCell = (props, ref) => {
|
|
31
31
|
const { children, isSelected, accentColor } = props, restProps = __rest(props, ["children", "isSelected", "accentColor"]);
|
|
32
32
|
const myRef = react_1.default.useRef(null);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, [isSelected]);
|
|
33
|
+
// React.useEffect(() => {
|
|
34
|
+
// if (isSelected && myRef.current) {
|
|
35
|
+
// myRef.current.scrollIntoView({ behavior: 'instant' });
|
|
36
|
+
// }
|
|
37
|
+
// }, [isSelected]);
|
|
38
38
|
return (react_1.default.createElement(Btn, Object.assign({}, restProps, { type: "button", variant: isSelected ? 'standard' : 'plain', color: isSelected ? accentColor : 'default', ref: el => {
|
|
39
39
|
if (typeof ref === 'function') {
|
|
40
40
|
ref(el);
|
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { CalendarYearCellProps } from './CalendarYearCell';
|
|
3
|
+
export type CalendarYearsSelectorProps = {
|
|
4
|
+
readonly years: readonly number[];
|
|
5
|
+
/**
|
|
6
|
+
* Cell accent color
|
|
7
|
+
*/
|
|
8
|
+
readonly accentColor: 'primary' | 'secondary' | string;
|
|
9
|
+
/**
|
|
10
|
+
* calendar locale
|
|
11
|
+
*/
|
|
12
|
+
readonly locale: string;
|
|
13
|
+
/**
|
|
14
|
+
* Calendar date
|
|
15
|
+
*/
|
|
16
|
+
readonly date: Date;
|
|
17
|
+
/**
|
|
18
|
+
* Minimum date limit
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
readonly minDate: Date;
|
|
22
|
+
/**
|
|
23
|
+
* Maximum date limit
|
|
24
|
+
*/
|
|
25
|
+
readonly maxDate: Date;
|
|
26
|
+
/**
|
|
27
|
+
* Selected year callback
|
|
28
|
+
*/
|
|
29
|
+
readonly onChange: (year: number) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Overridable components map
|
|
32
|
+
*/
|
|
33
|
+
readonly overrides?: CalendarYearsSelectorOverrides;
|
|
34
|
+
};
|
|
35
|
+
export type CalendarYearsSelectorOverrides = {
|
|
36
|
+
/**
|
|
37
|
+
* Year cell element in years list
|
|
38
|
+
*/
|
|
39
|
+
readonly YearCell?: React.ComponentType<CalendarYearCellProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
};
|
|
3
41
|
declare const _default: React.ForwardRefExoticComponent<CalendarYearsSelectorProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
42
|
export default _default;
|
|
@@ -1,30 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
const react_1 = __importDefault(require("react"));
|
|
18
7
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const CalendarYearCell_1 = __importDefault(require("./CalendarYearCell"));
|
|
9
|
+
const use_calendar_1 = __importDefault(require("./use-calendar"));
|
|
10
|
+
const VirtualizedList_1 = __importDefault(require("../Menu/VirtualizedList"));
|
|
19
11
|
const SelectorContainer = styled_1.default.div `
|
|
20
|
-
flex: 1;
|
|
21
12
|
display: flex;
|
|
22
|
-
flex
|
|
23
|
-
overflow-y: auto;
|
|
13
|
+
flex: 1;
|
|
24
14
|
padding: 0.8em;
|
|
15
|
+
height: 100%;
|
|
16
|
+
width: 100%;
|
|
17
|
+
`;
|
|
18
|
+
const SelectorContainerInner = styled_1.default.div `
|
|
19
|
+
flex: 1;
|
|
20
|
+
position: relative;
|
|
21
|
+
`;
|
|
22
|
+
const Chunk = styled_1.default.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: space-between;
|
|
25
26
|
`;
|
|
26
27
|
const CalendarYearsSelector = (props, ref) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const containerRef = react_1.default.useRef(null);
|
|
29
|
+
const { years, date, overrides, accentColor = 'primary', locale = 'ru-RU', minDate, maxDate, onChange, } = props;
|
|
30
|
+
const [maxHeight, setMaxHeight] = react_1.default.useState(undefined);
|
|
31
|
+
const overridesMap = react_1.default.useMemo(() => ({
|
|
32
|
+
YearCell: (overrides === null || overrides === void 0 ? void 0 : overrides.YearCell) || CalendarYearCell_1.default,
|
|
33
|
+
}), [overrides]);
|
|
34
|
+
const { getYearLabel } = (0, use_calendar_1.default)({
|
|
35
|
+
locale,
|
|
36
|
+
minDate,
|
|
37
|
+
maxDate,
|
|
38
|
+
weekStartDay: 'monday',
|
|
39
|
+
displayLeadingZero: false,
|
|
40
|
+
});
|
|
41
|
+
const items2 = react_1.default.useMemo(() => {
|
|
42
|
+
const list = [];
|
|
43
|
+
for (let i = 0; i < years.length; i += 3) {
|
|
44
|
+
list.push(years.slice(i, i + 3).map(year => {
|
|
45
|
+
const item = {
|
|
46
|
+
value: year,
|
|
47
|
+
label: getYearLabel(new Date(year, date.getMonth(), date.getDate(), 0, 0, 0, 0)),
|
|
48
|
+
};
|
|
49
|
+
return item;
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
return list;
|
|
53
|
+
}, [date, getYearLabel, years]);
|
|
54
|
+
react_1.default.useLayoutEffect(() => {
|
|
55
|
+
if (containerRef.current) {
|
|
56
|
+
setMaxHeight(containerRef.current.getBoundingClientRect().height);
|
|
57
|
+
}
|
|
58
|
+
}, []);
|
|
59
|
+
const renderItem = react_1.default.useCallback((item) => (react_1.default.createElement(Chunk, null, item.map(item => {
|
|
60
|
+
const isSelected = date.getFullYear() === item.value;
|
|
61
|
+
return (react_1.default.createElement(overridesMap.YearCell, { key: item.value, accentColor: accentColor, isSelected: isSelected, onClick: () => onChange(item.value) }, item.label));
|
|
62
|
+
}))), [accentColor, date, onChange, overridesMap]);
|
|
63
|
+
return (react_1.default.createElement(SelectorContainer, { ref: ref },
|
|
64
|
+
react_1.default.createElement(SelectorContainerInner, { ref: containerRef }, maxHeight && react_1.default.createElement(VirtualizedList_1.default, { items: items2, renderItem: renderItem }))));
|
|
29
65
|
};
|
|
30
66
|
exports.default = react_1.default.forwardRef(CalendarYearsSelector);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const React = __importStar(require("react"));
|
|
27
|
+
const react_1 = require("react");
|
|
28
|
+
const IconChevronDown = (props, ref) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 512 512", ref: ref }, props),
|
|
29
|
+
React.createElement("path", { d: "m105.79 160.82a24 24 0 0 0-10.76 6.2109 24 24 0 0 0 0 33.941l144 144a24.002 24.002 0 0 0 33.941 0l144-144a24 24 0 0 0 0-33.941 24 24 0 0 0-33.941 0l-127.03 127.03-127.03-127.03a24 24 0 0 0-23.182-6.2109z", fill: "currentColor" })));
|
|
30
|
+
const ForwardRef = (0, react_1.forwardRef)(IconChevronDown);
|
|
31
|
+
exports.default = ForwardRef;
|
package/Calendar/index.d.ts
CHANGED
|
@@ -1,220 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { CalendarDateContainerProps } from './CalendarDateContainer';
|
|
9
|
-
import { CalendarToolbarProps } from './CalendarToolbar';
|
|
10
|
-
import { CalendarYearsSelectorProps } from './CalendarYearsSelector';
|
|
11
|
-
import { CalendarMonthsSelectorProps } from './CalendarMonthsSelector';
|
|
12
|
-
import { CalendarMonthCellProps } from './CalendarMonthCell';
|
|
13
|
-
import { CalendarYearCellProps } from './CalendarYearCell';
|
|
14
|
-
import { CalendarDayBadgeProps } from './CalendarDayBadge';
|
|
15
|
-
import { CalendarFooterProps } from './CalendarFooter';
|
|
16
|
-
import { CalendarControlButtonProps } from './CalendarControlButton';
|
|
17
|
-
import { CalendarHeadingProps } from './CalendarHeading';
|
|
18
|
-
import { CalendarSubheadingProps } from './CalendarSubheading';
|
|
19
|
-
import { CalendarIconPrevProps } from './CalendarIconPrev';
|
|
20
|
-
import { CalendarIconNextProps } from './IconChevronRight';
|
|
21
|
-
import { CalendarWeekDaysBarProps, WeekNameLabelFormat } from './CalendarWeekDaysBar';
|
|
22
|
-
import { CalendarValue, WeekDayName } from './use-calendar';
|
|
23
|
-
import { CalendarView as CalendarViewName } from './reducer';
|
|
24
|
-
export * from './use-calendar';
|
|
25
|
-
export * from './CalendarWeekDaysBar';
|
|
26
|
-
export type CalendarView = CalendarViewName;
|
|
27
|
-
export type CalendarProps<Range extends boolean | undefined = undefined> = {
|
|
28
|
-
readonly range?: Range;
|
|
29
|
-
/**
|
|
30
|
-
* Selected date
|
|
31
|
-
*/
|
|
32
|
-
readonly value?: CalendarValue<Range>;
|
|
33
|
-
/**
|
|
34
|
-
* selected value if your component should not be controlled
|
|
35
|
-
*/
|
|
36
|
-
readonly defaultValue?: CalendarValue<Range>;
|
|
37
|
-
/**
|
|
38
|
-
* It will be called at the moment of selecting the given
|
|
39
|
-
*/
|
|
40
|
-
readonly onChange: (dates: CalendarValue<Range>) => void;
|
|
41
|
-
/**
|
|
42
|
-
* calendar locale\
|
|
43
|
-
* **Default:** `ru-RU`
|
|
44
|
-
*/
|
|
45
|
-
readonly locale?: string;
|
|
46
|
-
/**
|
|
47
|
-
* array of badges
|
|
48
|
-
*/
|
|
49
|
-
readonly badges?: readonly CalendarBadge[];
|
|
50
|
-
/**
|
|
51
|
-
* Minimum date limit\
|
|
52
|
-
* **Default:** -100 year
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
readonly minDate?: Date;
|
|
56
|
-
/**
|
|
57
|
-
* Maximum date limit\
|
|
58
|
-
* **Default:** +100 year
|
|
59
|
-
*/
|
|
60
|
-
readonly maxDate?: Date;
|
|
61
|
-
/**
|
|
62
|
-
* The day the week starts from\
|
|
63
|
-
* **Default:** `monday`
|
|
64
|
-
*/
|
|
65
|
-
readonly weekStartDay?: WeekDayName;
|
|
66
|
-
/**
|
|
67
|
-
* Int weekday format\
|
|
68
|
-
* **Default:** `short`
|
|
69
|
-
*/
|
|
70
|
-
readonly weekDayLabelFormat?: WeekNameLabelFormat;
|
|
71
|
-
/**
|
|
72
|
-
* Display days with leading zero
|
|
73
|
-
* **Default:** `false`
|
|
74
|
-
*/
|
|
75
|
-
readonly displayLeadingZero?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Mark current day cell\
|
|
78
|
-
* **Default:** `true`
|
|
79
|
-
*/
|
|
80
|
-
readonly markToday?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Cell accent color\
|
|
83
|
-
* **Default:** `primary`
|
|
84
|
-
*/
|
|
85
|
-
readonly accentColor?: 'primary' | 'secondary' | string;
|
|
86
|
-
/**
|
|
87
|
-
* Tooltip for the Prev month button
|
|
88
|
-
*/
|
|
89
|
-
readonly prevMonthButtonTooltip?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Tooltip for the Next month button
|
|
92
|
-
*/
|
|
93
|
-
readonly nextMonthButtonTooltip?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Tooltip for tne month selector button
|
|
96
|
-
*/
|
|
97
|
-
readonly changeMonthButtonTooltip?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Tooltip for the year selector button
|
|
100
|
-
*/
|
|
101
|
-
readonly changeYearButtonTooltip?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Label for the Reset button. If label passed, then button will be rendered
|
|
104
|
-
*/
|
|
105
|
-
readonly resetButtonLabel?: string;
|
|
106
|
-
/**
|
|
107
|
-
* Label for the Today button. If label passed, then button will be rendered
|
|
108
|
-
*/
|
|
109
|
-
readonly toodayButtonLabel?: string;
|
|
110
|
-
/**
|
|
111
|
-
* Heading
|
|
112
|
-
*/
|
|
113
|
-
readonly heading?: React.ReactNode;
|
|
114
|
-
/**
|
|
115
|
-
* Subheading
|
|
116
|
-
*/
|
|
117
|
-
readonly subheading?: React.ReactNode;
|
|
118
|
-
/**
|
|
119
|
-
* Initial name of the view\
|
|
120
|
-
* **Default:** `days`
|
|
121
|
-
*/
|
|
122
|
-
readonly initialView?: CalendarView;
|
|
123
|
-
/**
|
|
124
|
-
* Custom footer elements
|
|
125
|
-
*/
|
|
126
|
-
readonly footer?: JSX.Element;
|
|
127
|
-
/**
|
|
128
|
-
* Overridable components map
|
|
129
|
-
*/
|
|
130
|
-
readonly overrides?: CalendarOverrides;
|
|
131
|
-
};
|
|
132
|
-
export interface CalendarOverrides {
|
|
133
|
-
/**
|
|
134
|
-
* Element container
|
|
135
|
-
*/
|
|
136
|
-
readonly Body?: React.ForwardRefExoticComponent<CalendarBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
137
|
-
/**
|
|
138
|
-
* Day element
|
|
139
|
-
*/
|
|
140
|
-
readonly Cell?: React.ForwardRefExoticComponent<CalendarCellProps & React.RefAttributes<HTMLButtonElement>>;
|
|
141
|
-
/**
|
|
142
|
-
* Empty cell element
|
|
143
|
-
*/
|
|
144
|
-
readonly EmptyCell?: React.ForwardRefExoticComponent<CalendarEmptyCellProps & React.RefAttributes<HTMLButtonElement>>;
|
|
145
|
-
/**
|
|
146
|
-
* Common container element
|
|
147
|
-
*/
|
|
148
|
-
readonly Paper?: React.ForwardRefExoticComponent<CalendarPaperProps & React.RefAttributes<HTMLDivElement>>;
|
|
149
|
-
/**
|
|
150
|
-
* Header wrapper element
|
|
151
|
-
*/
|
|
152
|
-
readonly Header?: React.ForwardRefExoticComponent<CalendarHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
153
|
-
/**
|
|
154
|
-
* Week row container element
|
|
155
|
-
*/
|
|
156
|
-
readonly WeekRow?: React.ForwardRefExoticComponent<CalendarWeekRowProps & React.RefAttributes<HTMLDivElement>>;
|
|
157
|
-
/**
|
|
158
|
-
* Days wrapper element
|
|
159
|
-
*/
|
|
160
|
-
readonly DateContainer?: React.ForwardRefExoticComponent<CalendarDateContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
161
|
-
/**
|
|
162
|
-
* Toolbar wrapper element
|
|
163
|
-
*/
|
|
164
|
-
readonly Toolbar?: React.ForwardRefExoticComponent<CalendarToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
165
|
-
/**
|
|
166
|
-
* Years list element (year view)
|
|
167
|
-
*/
|
|
168
|
-
readonly YearsSelector?: React.ForwardRefExoticComponent<CalendarYearsSelectorProps & React.RefAttributes<HTMLDivElement>>;
|
|
169
|
-
/**
|
|
170
|
-
* Monthes list element (month view)
|
|
171
|
-
*/
|
|
172
|
-
readonly MonthsSelector?: React.ForwardRefExoticComponent<CalendarMonthsSelectorProps & React.RefAttributes<HTMLDivElement>>;
|
|
173
|
-
/**
|
|
174
|
-
* Month cell element in monthes list
|
|
175
|
-
*/
|
|
176
|
-
readonly MonthCell?: React.ForwardRefExoticComponent<CalendarMonthCellProps & React.RefAttributes<HTMLButtonElement>>;
|
|
177
|
-
/**
|
|
178
|
-
* Year cell element in years list
|
|
179
|
-
*/
|
|
180
|
-
readonly YearCell?: React.ForwardRefExoticComponent<CalendarYearCellProps & React.RefAttributes<HTMLButtonElement>>;
|
|
181
|
-
/**
|
|
182
|
-
* Badge of the day cell element
|
|
183
|
-
*/
|
|
184
|
-
readonly DayBadge?: React.ForwardRefExoticComponent<CalendarDayBadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
185
|
-
/**
|
|
186
|
-
* Footer container element
|
|
187
|
-
*/
|
|
188
|
-
readonly Footer?: React.ForwardRefExoticComponent<CalendarFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
189
|
-
/**
|
|
190
|
-
* Common button element
|
|
191
|
-
*/
|
|
192
|
-
readonly ControlButton?: React.ForwardRefExoticComponent<CalendarControlButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
193
|
-
/**
|
|
194
|
-
* Heading element
|
|
195
|
-
*/
|
|
196
|
-
readonly Heading?: React.ForwardRefExoticComponent<CalendarHeadingProps & React.RefAttributes<HTMLDivElement>>;
|
|
197
|
-
/**
|
|
198
|
-
* Subheading element
|
|
199
|
-
*/
|
|
200
|
-
readonly Subheading?: React.ForwardRefExoticComponent<CalendarSubheadingProps & React.RefAttributes<HTMLDivElement>>;
|
|
201
|
-
/**
|
|
202
|
-
* Prev icon element in prev month button
|
|
203
|
-
*/
|
|
204
|
-
readonly IconPrev?: React.ForwardRefExoticComponent<CalendarIconPrevProps & React.RefAttributes<SVGElement>>;
|
|
205
|
-
/**
|
|
206
|
-
* Next icon element in next month button
|
|
207
|
-
*/
|
|
208
|
-
readonly IconNext?: React.ForwardRefExoticComponent<CalendarIconNextProps & React.RefAttributes<SVGElement>>;
|
|
209
|
-
/**
|
|
210
|
-
* Weeks bar element
|
|
211
|
-
*/
|
|
212
|
-
readonly WeekDaysBar?: React.ForwardRefExoticComponent<CalendarWeekDaysBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
213
|
-
}
|
|
214
|
-
export type CalendarBadge = {
|
|
215
|
-
readonly date: Date;
|
|
216
|
-
readonly badgeContent: React.ReactNode;
|
|
217
|
-
readonly accentColor?: 'primary' | 'secondary' | string;
|
|
218
|
-
};
|
|
219
|
-
declare const Calendar: <Range_1 extends boolean | undefined = undefined>(props: CalendarProps<Range_1>) => React.ReactNode;
|
|
220
|
-
export default Calendar;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CalendarProps, CalendarRef } from './CalendarComponent';
|
|
3
|
+
export * from './CalendarComponent';
|
|
4
|
+
declare const _default: <IsRangeValue extends boolean | undefined = undefined>(props: CalendarProps<IsRangeValue> & {
|
|
5
|
+
ref?: React.Ref<CalendarRef<IsRangeValue>> | undefined;
|
|
6
|
+
}) => React.ReactElement;
|
|
7
|
+
export default _default;
|