@via-profit/ui-kit 0.1.0-rc.61 → 0.1.0-rc.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/Button/ButtonBase.js +2 -2
  2. package/Button/ButtonStandard.js +0 -1
  3. package/Calendar/CalendarBody.d.ts +6 -0
  4. package/Calendar/CalendarBody.js +14 -0
  5. package/Calendar/CalendarCell.d.ts +1 -0
  6. package/Calendar/CalendarCell.js +5 -27
  7. package/Calendar/CalendarControlButton.d.ts +7 -0
  8. package/Calendar/CalendarControlButton.js +25 -0
  9. package/Calendar/CalendarDateContainer.js +1 -0
  10. package/Calendar/CalendarDayBadge.d.ts +8 -0
  11. package/Calendar/CalendarDayBadge.js +75 -0
  12. package/Calendar/CalendarFooter.d.ts +6 -0
  13. package/Calendar/CalendarFooter.js +42 -0
  14. package/Calendar/{CalendarTopBar.d.ts → CalendarHeader.d.ts} +2 -2
  15. package/Calendar/CalendarHeader.js +34 -0
  16. package/Calendar/CalendarHeading.d.ts +4 -0
  17. package/Calendar/CalendarHeading.js +32 -0
  18. package/Calendar/CalendarMonthCell.d.ts +7 -0
  19. package/Calendar/CalendarMonthCell.js +48 -0
  20. package/Calendar/CalendarMonthControl.js +13 -21
  21. package/Calendar/CalendarMonthesSelector.d.ts +4 -0
  22. package/{Menu/MenuListPopper.js → Calendar/CalendarMonthesSelector.js} +9 -10
  23. package/Calendar/CalendarPaper.js +2 -4
  24. package/Calendar/CalendarSubheading.d.ts +4 -0
  25. package/Calendar/CalendarSubheading.js +29 -0
  26. package/Calendar/CalendarToolbar.d.ts +4 -0
  27. package/Calendar/{CalendarTopBar.js → CalendarToolbar.js} +7 -6
  28. package/Calendar/CalendarYearCell.d.ts +7 -0
  29. package/Calendar/CalendarYearCell.js +48 -0
  30. package/Calendar/CalendarYearsSelector.d.ts +4 -0
  31. package/Calendar/CalendarYearsSelector.js +30 -0
  32. package/Calendar/index.d.ts +30 -10
  33. package/Calendar/index.js +185 -132
  34. package/Calendar/use-calendar.d.ts +9 -31
  35. package/Calendar/use-calendar.js +58 -42
  36. package/MaskedField/useMasked.js +6 -5
  37. package/TextField/TextFieldErrorText.js +1 -1
  38. package/ThemeProvider/createTheme.js +11 -9
  39. package/package.json +1 -1
  40. package/Menu/MenuListPopper.d.ts +0 -7
@@ -19,7 +19,7 @@ const ButtonIconWrapper_1 = __importDefault(require("./ButtonIconWrapper"));
19
19
  const ButtonTextWrapper_1 = __importDefault(require("./ButtonTextWrapper"));
20
20
  const ButtonContainer_1 = __importDefault(require("./ButtonContainer"));
21
21
  const ButtonBase = (props, ref) => {
22
- const { children, startIcon, endIcon, color, overrides, iconOnly } = props, nativeProps = __rest(props, ["children", "startIcon", "endIcon", "color", "overrides", "iconOnly"]);
22
+ const { children, startIcon, endIcon, color, overrides, iconOnly, type } = props, nativeProps = __rest(props, ["children", "startIcon", "endIcon", "color", "overrides", "iconOnly", "type"]);
23
23
  const overridesMap = react_1.default.useMemo(() => (Object.assign({ TextWrapper: ButtonTextWrapper_1.default,
24
24
  IconWrapper: ButtonIconWrapper_1.default,
25
25
  Container: ButtonContainer_1.default }, overrides)), [overrides]);
@@ -28,7 +28,7 @@ const ButtonBase = (props, ref) => {
28
28
  (typeof endIcon !== 'undefined' && endIcon !== null))) {
29
29
  console.warn('The «iconOnly» property should not be used simultaneously with «startIcon» and/or «endIcon»');
30
30
  }
31
- return (react_1.default.createElement(overridesMap.Container, Object.assign({}, nativeProps, { color: color, iconOnly: iconOnly, ref: ref }),
31
+ return (react_1.default.createElement(overridesMap.Container, Object.assign({ type: typeof type === 'undefined' ? 'button' : type }, nativeProps, { color: color, iconOnly: iconOnly, ref: ref }),
32
32
  typeof startIcon !== 'undefined' && startIcon !== null && (react_1.default.createElement(overridesMap.IconWrapper, { position: "start" }, startIcon)),
33
33
  react_1.default.createElement(overridesMap.TextWrapper, { iconOnly: iconOnly }, children),
34
34
  typeof endIcon !== 'undefined' && endIcon !== null && (react_1.default.createElement(overridesMap.IconWrapper, { position: "end" }, endIcon))));
@@ -36,7 +36,6 @@ const StyledStandardButton = (0, styled_1.default)(ButtonBase_1.default) `
36
36
  return $background.toString();
37
37
  }
38
38
  }};
39
- box-shadow: 0 0.125em 0.25em ${({ $background }) => $background.darken(100).alpha(0.5).toString()};
40
39
  ${({ $background }) => {
41
40
  switch (true) {
42
41
  case $background.luminance() > 0.49:
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const CalendarBody: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export default CalendarBody;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const styled_1 = __importDefault(require("@emotion/styled"));
7
+ const CalendarBody = styled_1.default.div `
8
+ position: relative;
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: stretch;
12
+ height: 15em;
13
+ `;
14
+ exports.default = CalendarBody;
@@ -3,6 +3,7 @@ export interface CalendarCellProps extends React.ButtonHTMLAttributes<HTMLButton
3
3
  readonly isToday?: boolean;
4
4
  readonly isSelected?: boolean;
5
5
  readonly isDisabled?: boolean;
6
+ readonly accentColor?: 'primary' | 'secondary' | string;
6
7
  }
7
8
  declare const _default: React.ForwardRefExoticComponent<CalendarCellProps & React.RefAttributes<HTMLButtonElement>>;
8
9
  export default _default;
@@ -16,7 +16,8 @@ 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 Btn = styled_1.default.button `
19
+ const Button_1 = __importDefault(require("../Button"));
20
+ const Btn = (0, styled_1.default)(Button_1.default) `
20
21
  display: flex;
21
22
  align-items: center;
22
23
  justify-content: center;
@@ -26,34 +27,11 @@ const Btn = styled_1.default.button `
26
27
  margin: 0;
27
28
  min-width: 0;
28
29
  outline: none;
29
- cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};
30
- border: 1px solid transparent;
31
- background-color: ${({ theme, $isSelected }) => $isSelected ? theme.color.accentPrimary.toString() : theme.color.surface.toString()};
30
+ position: relative;
32
31
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
33
- color: ${({ $isToday, theme, $isSelected, $isDisabled }) => {
34
- if ($isDisabled) {
35
- return theme.color.textSecondary.toString();
36
- }
37
- if ($isSelected) {
38
- return theme.color.accentPrimaryContrast.toString();
39
- }
40
- if ($isToday) {
41
- return theme.color.accentPrimary.toString();
42
- }
43
- return theme.color.textPrimary.toString();
44
- }};
45
- &:hover {
46
- background-color: ${({ theme, $isSelected }) => $isSelected
47
- ? theme.color.accentPrimary.darken(10).toString()
48
- : theme.color.surface.darken(10).toString()};
49
- }
50
- &:focus-visible {
51
- border-color: ${({ theme, $isDisabled }) => $isDisabled ? 'transparent' : theme.color.accentPrimary.toString()};
52
- }
53
- opacity: ${({ $isDisabled }) => ($isDisabled ? 0.4 : 1)};
54
32
  `;
55
33
  const CalendarCell = (props, ref) => {
56
- const { isToday, children, isSelected, isDisabled } = props, restProps = __rest(props, ["isToday", "children", "isSelected", "isDisabled"]);
57
- return (react_1.default.createElement(Btn, Object.assign({ type: "button" }, restProps, { ref: ref, tabIndex: isDisabled ? -1 : restProps.tabIndex, "$isToday": Boolean(isToday), "$isSelected": Boolean(isSelected), "$isDisabled": Boolean(isDisabled) }), children));
34
+ const { isToday, children, isSelected, isDisabled, accentColor } = props, restProps = __rest(props, ["isToday", "children", "isSelected", "isDisabled", "accentColor"]);
35
+ return (react_1.default.createElement(Btn, Object.assign({}, restProps, { iconOnly: true, type: "button", variant: isSelected ? 'standard' : isToday ? 'outlined' : 'plain', ref: ref, color: isSelected || isToday ? accentColor : 'default', tabIndex: isDisabled ? -1 : restProps.tabIndex, disabled: isDisabled }), children));
58
36
  };
59
37
  exports.default = react_1.default.forwardRef(CalendarCell);
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '../Button';
3
+ export type CalendarControlButtonProps = ButtonProps;
4
+ declare const _default: React.ForwardRefExoticComponent<import("../Button/ButtonBase").ButtonBaseProps & {
5
+ readonly variant?: "standard" | "outlined" | "plain" | undefined;
6
+ } & React.RefAttributes<HTMLButtonElement>>;
7
+ export default _default;
@@ -0,0 +1,25 @@
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 react_2 = require("@emotion/react");
19
+ const Button_1 = __importDefault(require("../Button"));
20
+ const CalendarControlButton = (props, ref) => {
21
+ const { children } = props, restProps = __rest(props, ["children"]);
22
+ const { color } = (0, react_2.useTheme)();
23
+ return (react_1.default.createElement(Button_1.default, Object.assign({ type: "button", variant: "plain", color: color.accentSecondaryContrast.toString() }, restProps, { ref: ref }), children));
24
+ };
25
+ exports.default = react_1.default.forwardRef(CalendarControlButton);
@@ -9,5 +9,6 @@ const CalendarDateContainer = styled_1.default.div `
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  justify-content: stretch;
12
+ padding: 0.4em;
12
13
  `;
13
14
  exports.default = react_1.default.memo(CalendarDateContainer);
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface CalendarDayBadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
3
+ readonly accentColor?: 'primary' | 'secondary' | string;
4
+ readonly isToday: boolean;
5
+ readonly badgeContent: React.ReactNode;
6
+ }
7
+ declare const _default: React.ForwardRefExoticComponent<CalendarDayBadgeProps & React.RefAttributes<HTMLButtonElement>>;
8
+ export default _default;
@@ -0,0 +1,75 @@
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 Color_1 = __importDefault(require("../Color"));
21
+ const StyledBadge = styled_1.default.span `
22
+ background-color: ${({ $backgroundColor }) => $backgroundColor};
23
+ color: ${({ $color }) => $color};
24
+ position: absolute;
25
+ top: -0.5em;
26
+ left: 55%;
27
+ border-radius: 20px;
28
+ padding: 4px;
29
+ box-sizing: border-box;
30
+ white-space: nowrap;
31
+ text-overflow: ellipsis;
32
+ font-size: 0.8em;
33
+ min-width: 1.8em;
34
+ min-height: 0.8em;
35
+ max-width: 4em;
36
+ overflow: hidden;
37
+ pointer-events: none;
38
+ z-index: 1;
39
+ `;
40
+ const CalendarDayBadge = (props, ref) => {
41
+ const { isToday, children, accentColor = 'secondary', badgeContent } = props, restProps = __rest(props, ["isToday", "children", "accentColor", "badgeContent"]);
42
+ const theme = (0, react_2.useTheme)();
43
+ const { $color, $backgroundColor } = react_1.default.useMemo(() => {
44
+ if (!badgeContent) {
45
+ return {
46
+ $color: 'transparent',
47
+ $backgroundColor: 'transparent',
48
+ };
49
+ }
50
+ if (accentColor === 'primary') {
51
+ return {
52
+ $color: theme.color.accentPrimaryContrast.toString(),
53
+ $backgroundColor: theme.color.accentPrimary.toString(),
54
+ };
55
+ }
56
+ if (accentColor === 'secondary') {
57
+ return {
58
+ $color: theme.color.accentSecondaryContrast.toString(),
59
+ $backgroundColor: theme.color.accentSecondary.toString(),
60
+ };
61
+ }
62
+ const clr = new Color_1.default(accentColor);
63
+ return {
64
+ $backgroundColor: accentColor,
65
+ $color: clr.contrast(accentColor) > 5
66
+ ? theme.color.textPrimary.toString()
67
+ : theme.color.surface.toString(),
68
+ };
69
+ }, [accentColor, theme, badgeContent]);
70
+ if (!badgeContent) {
71
+ return children;
72
+ }
73
+ return (react_1.default.createElement(StyledBadge, Object.assign({ "$color": $color, "$backgroundColor": $backgroundColor }, restProps, { ref: ref }), badgeContent));
74
+ };
75
+ exports.default = react_1.default.forwardRef(CalendarDayBadge);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface CalendarFooterProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ readonly children: React.ReactNode | readonly React.ReactNode[];
4
+ }
5
+ declare const _default: React.ForwardRefExoticComponent<CalendarFooterProps & React.RefAttributes<HTMLDivElement>>;
6
+ export default _default;
@@ -0,0 +1,42 @@
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 StyledCalendarFooter = styled_1.default.div `
20
+ display: flex;
21
+ padding: 0.8em;
22
+ border-bottom-left-radius: inherit;
23
+ border-bottom-right-radius: inherit;
24
+ background-color: ${({ theme }) => theme.color.accentSecondary.toString()};
25
+ color: ${({ theme }) => theme.color.accentSecondaryContrast.toString()};
26
+ `;
27
+ const CalendarFooterInner = styled_1.default.div `
28
+ flex: 1;
29
+ display: flex;
30
+ justify-content: flex-end;
31
+ align-items: center;
32
+ margin: 0 -0.8em;
33
+ & > * {
34
+ margin: 0 0.4em;
35
+ }
36
+ `;
37
+ const CalendarFooter = (props, ref) => {
38
+ const { children } = props, restProps = __rest(props, ["children"]);
39
+ return (react_1.default.createElement(StyledCalendarFooter, Object.assign({}, restProps, { ref: ref }),
40
+ react_1.default.createElement(CalendarFooterInner, null, children)));
41
+ };
42
+ exports.default = react_1.default.forwardRef(CalendarFooter);
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- export type CalendarTopBarProps = React.HTMLAttributes<HTMLDivElement>;
3
- declare const _default: React.ForwardRefExoticComponent<CalendarTopBarProps & React.RefAttributes<HTMLDivElement>>;
2
+ export type CalendarHeaderProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<CalendarHeaderProps & React.RefAttributes<HTMLDivElement>>;
4
4
  export default _default;
@@ -0,0 +1,34 @@
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 StyledCalendarHeader = styled_1.default.div `
20
+ display: flex;
21
+ flex-flow: column;
22
+ justify-content: space-between;
23
+ margin-bottom: 0.5em;
24
+ padding: 0.8em 0.8em 0.4em 0.8em;
25
+ border-top-left-radius: inherit;
26
+ border-top-right-radius: inherit;
27
+ background-color: ${({ theme }) => theme.color.accentSecondary.toString()};
28
+ color: ${({ theme }) => theme.color.accentSecondaryContrast.toString()};
29
+ `;
30
+ const CalendarHeader = (props, ref) => {
31
+ const { children } = props, restProps = __rest(props, ["children"]);
32
+ return (react_1.default.createElement(StyledCalendarHeader, Object.assign({}, restProps, { ref: ref }), children));
33
+ };
34
+ exports.default = react_1.default.forwardRef(CalendarHeader);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export type CalendarHeadingProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<CalendarHeadingProps & React.RefAttributes<HTMLDivElement>>;
4
+ 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 StyledCalendarHeading = styled_1.default.div `
20
+ font-weight: 600;
21
+ font-size: 1.6em;
22
+ margin: 0 0 0.2em 0;
23
+ white-space: nowrap;
24
+ text-overflow: ellipsis;
25
+ width: 100%;
26
+ overflow: hidden;
27
+ `;
28
+ const CalendarHeading = (props, ref) => {
29
+ const { children } = props, restProps = __rest(props, ["children"]);
30
+ return (react_1.default.createElement(StyledCalendarHeading, Object.assign({}, restProps, { ref: ref }), children));
31
+ };
32
+ exports.default = react_1.default.forwardRef(CalendarHeading);
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface CalendarMonthCellProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ readonly isSelected?: boolean;
4
+ readonly accentColor?: 'primary' | 'secondary' | string;
5
+ }
6
+ declare const _default: React.ForwardRefExoticComponent<CalendarMonthCellProps & React.RefAttributes<HTMLButtonElement>>;
7
+ export default _default;
@@ -0,0 +1,48 @@
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 Btn = (0, styled_1.default)(Button_1.default) `
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ font-size: 0.8em;
25
+ margin: 0;
26
+ min-width: 0;
27
+ outline: none;
28
+ flex-basis: 50%;
29
+ `;
30
+ const CalendarMonthCell = (props, ref) => {
31
+ const { children, isSelected, accentColor } = props, restProps = __rest(props, ["children", "isSelected", "accentColor"]);
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
+ return (react_1.default.createElement(Btn, Object.assign({}, restProps, { type: "button", variant: isSelected ? 'standard' : 'plain', color: isSelected ? accentColor : 'default', ref: el => {
39
+ if (typeof ref === 'function') {
40
+ ref(el);
41
+ }
42
+ if (ref && typeof ref === 'object') {
43
+ ref.current = el;
44
+ }
45
+ myRef.current = el;
46
+ } }), children));
47
+ };
48
+ exports.default = react_1.default.forwardRef(CalendarMonthCell);
@@ -16,34 +16,26 @@ 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 react_2 = require("@emotion/react");
20
+ const Button_1 = __importDefault(require("../Button"));
19
21
  const IconChevronLeft_1 = __importDefault(require("./IconChevronLeft"));
20
22
  const IconChevronRight_1 = __importDefault(require("./IconChevronRight"));
21
- const Btn = styled_1.default.button `
22
- display: flex;
23
- align-items: center;
24
- justify-content: center;
25
- font-size: 1em;
26
- width: 2.25em;
27
- height: 2.25em;
28
- padding: 0;
29
- margin: 0;
30
- min-width: 0;
31
- outline: none;
32
- cursor: pointer;
33
- border: 1px solid transparent;
34
- background-color: ${({ theme }) => theme.color.surface.toString()};
35
- border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
36
- color: ${({ theme }) => theme.color.textPrimary.toString()};
23
+ const StyledButton = (0, styled_1.default)(Button_1.default) `
24
+ color: ${({ theme }) => theme.color.accentSecondaryContrast.toString()};
37
25
  &:hover {
38
- background-color: ${({ theme }) => theme.color.surface.darken(0.1).toString()};
26
+ color: ${({ theme }) => theme.color.accentSecondaryContrast.alpha(0.5).toString()};
27
+ background-color: ${({ theme }) => theme.color.accentSecondary.lighten(10).toString()};
39
28
  }
40
- &:focus-visible {
41
- border-color: ${({ theme }) => theme.color.accentPrimary.toString()};
29
+ &:active {
30
+ color: ${({ theme }) => theme.color.accentSecondaryContrast.alpha(0.9).toString()};
42
31
  }
43
- opacity: ${({ disabled }) => (disabled ? 0.4 : 1)};
32
+ ${({ disabled }) => disabled &&
33
+ (0, react_2.css) `
34
+ opacity: 0.5;
35
+ `};
44
36
  `;
45
37
  const CalendarMonthControl = (props, ref) => {
46
38
  const { displayIcon } = props, restProps = __rest(props, ["displayIcon"]);
47
- return (react_1.default.createElement(Btn, Object.assign({ type: "button" }, restProps, { ref: ref }), displayIcon === 'next' ? react_1.default.createElement(IconChevronRight_1.default, null) : react_1.default.createElement(IconChevronLeft_1.default, null)));
39
+ return (react_1.default.createElement(StyledButton, Object.assign({ variant: "plain", iconOnly: true, type: "button" }, restProps, { ref: ref }), displayIcon === 'next' ? react_1.default.createElement(IconChevronRight_1.default, null) : react_1.default.createElement(IconChevronLeft_1.default, null)));
48
40
  };
49
41
  exports.default = react_1.default.forwardRef(CalendarMonthControl);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export type CalendarMonthesSelectorProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<CalendarMonthesSelectorProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default _default;
@@ -16,16 +16,15 @@ 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 StyledMenuListPopper = styled_1.default.div `
20
- visibility: ${props => (props.$isOpen ? 'visible' : 'hidden')};
21
- z-index: ${({ theme }) => theme.zIndex.modal};
22
- max-height: 18em;
23
- max-width: 18em;
19
+ const SelectorContainer = styled_1.default.div `
20
+ flex: 1;
24
21
  display: flex;
25
- position: static;
22
+ flex-wrap: wrap;
23
+ overflow-y: auto;
24
+ padding: 0.8em;
26
25
  `;
27
- const MenuListPopper = (props, ref) => {
28
- const { isOpen, children } = props, nativeProps = __rest(props, ["isOpen", "children"]);
29
- return (react_1.default.createElement(StyledMenuListPopper, Object.assign({}, nativeProps, { ref: ref, "$isOpen": isOpen }), children));
26
+ const CalendarMonthesSelector = (props, ref) => {
27
+ const { children } = props, restProps = __rest(props, ["children"]);
28
+ return (react_1.default.createElement(SelectorContainer, Object.assign({}, restProps, { ref: ref }), children));
30
29
  };
31
- exports.default = react_1.default.forwardRef(MenuListPopper);
30
+ exports.default = react_1.default.forwardRef(CalendarMonthesSelector);
@@ -5,15 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const CalendarPaper = styled_1.default.div `
8
+ width: 18em;
8
9
  position: relative;
9
- display: flex;
10
+ display: inline-flex;
10
11
  flex-direction: column;
11
12
  justify-content: stretch;
12
13
  background-color: ${({ theme }) => theme.color.surface.toString()};
13
14
  border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
14
- padding: 0.4em;
15
- max-width: 17.6em;
16
- max-height: 20.4em;
17
15
  box-shadow: 0 4px 24px ${({ theme }) => theme.color.surface.darken(50).alpha(0.6).toString()};
18
16
  `;
19
17
  exports.default = CalendarPaper;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export type CalendarSubheadingProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<CalendarSubheadingProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default _default;
@@ -0,0 +1,29 @@
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 StyledCalendarSubheading = styled_1.default.div `
20
+ font-weight: 200;
21
+ font-size: 1em;
22
+ opacity: 0.6;
23
+ margin-bottom: 1em;
24
+ `;
25
+ const CalendarSubheading = (props, ref) => {
26
+ const { children } = props, restProps = __rest(props, ["children"]);
27
+ return (react_1.default.createElement(StyledCalendarSubheading, Object.assign({}, restProps, { ref: ref }), children));
28
+ };
29
+ exports.default = react_1.default.forwardRef(CalendarSubheading);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export type CalendarToolbarProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<CalendarToolbarProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default _default;
@@ -16,15 +16,16 @@ 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 Container = styled_1.default.div `
19
+ const StyledCalendarToolbar = styled_1.default.div `
20
20
  display: flex;
21
21
  justify-content: space-between;
22
22
  align-items: center;
23
- margin-bottom: 0.5em;
23
+ min-width: 100%;
24
+ margin-left: -0.8em;
25
+ margin-right: -0.8em;
24
26
  `;
25
- const CalendarTopBar = (props, ref) => {
27
+ const CalendarToolbar = (props, ref) => {
26
28
  const { children } = props, restProps = __rest(props, ["children"]);
27
- return (react_1.default.createElement(Container, Object.assign({}, restProps, { ref: ref }),
28
- react_1.default.createElement(react_1.default.Fragment, null, children)));
29
+ return (react_1.default.createElement(StyledCalendarToolbar, Object.assign({}, restProps, { ref: ref }), children));
29
30
  };
30
- exports.default = react_1.default.forwardRef(CalendarTopBar);
31
+ exports.default = react_1.default.forwardRef(CalendarToolbar);
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface CalendarYearCellProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ readonly isSelected?: boolean;
4
+ readonly accentColor?: 'primary' | 'secondary' | string;
5
+ }
6
+ declare const _default: React.ForwardRefExoticComponent<CalendarYearCellProps & React.RefAttributes<HTMLButtonElement>>;
7
+ export default _default;