@mailstep/design-system 0.7.28 → 0.7.30-beta.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.
Files changed (34) hide show
  1. package/package.json +1 -1
  2. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.d.ts +3 -1
  3. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.js +19 -36
  4. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/getCleanValues.d.ts +1 -0
  5. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/getCleanValues.js +11 -0
  6. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.d.ts +2 -0
  7. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.js +23 -0
  8. package/ui/Blocks/SideMenu/MenuItem.js +1 -1
  9. package/ui/Blocks/Tabs/Tabs.d.ts +1 -1
  10. package/ui/Blocks/Tabs/Tabs.js +2 -2
  11. package/ui/Blocks/Tabs/stories/Tabs.stories.d.ts +1 -1
  12. package/ui/Blocks/Tabs/styles.d.ts +1 -0
  13. package/ui/Blocks/Tabs/styles.js +13 -4
  14. package/ui/Blocks/Tabs/types.d.ts +1 -0
  15. package/ui/Elements/DatePicker/DatePicker.d.ts +4 -2
  16. package/ui/Elements/DatePicker/DatePicker.js +3 -2
  17. package/ui/Elements/DatePicker/Datetime/DateTime.d.ts +3 -2
  18. package/ui/Elements/DatePicker/Datetime/DateTime.js +13 -7
  19. package/ui/Elements/DatePicker/Datetime/components/DateRepeater.d.ts +9 -0
  20. package/ui/Elements/DatePicker/Datetime/components/DateRepeater.js +30 -0
  21. package/ui/Elements/DatePicker/Datetime/components/Timepicker.d.ts +5 -1
  22. package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +27 -7
  23. package/ui/Elements/DatePicker/Datetime/types.d.ts +12 -2
  24. package/ui/Elements/DatePicker/Datetime/types.js +0 -6
  25. package/ui/Elements/DatePicker/Datetime/views/DaysView.js +10 -4
  26. package/ui/Elements/DatePicker/utils/constants.d.ts +12 -0
  27. package/ui/Elements/DatePicker/utils/constants.js +24 -0
  28. package/ui/Forms/Input/stories/Input.stories.d.ts +1 -0
  29. package/ui/Forms/Input/stories/Input.stories.js +6 -0
  30. package/ui/Forms/Input/styles.js +2 -2
  31. package/ui/index.es.js +14594 -14554
  32. package/ui/index.umd.js +638 -637
  33. package/ui/Elements/DatePicker/Datetime/components/ShortDatePick.d.ts +0 -7
  34. package/ui/Elements/DatePicker/Datetime/components/ShortDatePick.js +0 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.7.28",
3
+ "version": "0.7.30-beta.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -1,8 +1,10 @@
1
- import { FilterComponentProps } from '../../../types';
1
+ import type { DateTimeOthers } from '../../../../../Elements/DatePicker/Datetime/types';
2
+ import type { FilterComponentProps } from '../../../types';
2
3
  type InitialView = 'past' | 'future';
3
4
  type DatePickerRangeProps = FilterComponentProps<Date[]> & {
4
5
  filterTime?: number;
5
6
  initialView?: InitialView;
7
+ onChange: (value: Date[], others?: DateTimeOthers) => void;
6
8
  };
7
9
  type DateRangeProps = DatePickerRangeProps & {
8
10
  error?: string;
@@ -27,33 +27,14 @@ var __rest = (this && this.__rest) || function (s, e) {
27
27
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
28
28
  import React, { useState, useCallback, useMemo } from 'react';
29
29
  import { DateTime } from 'luxon';
30
- import styled from '@xstyled/styled-components';
31
- import { sameDate } from './utils/sameDate';
32
- import { useClickOutside } from '../../../../Modal/hooks/useClickOutside';
33
30
  import DatePicker from '../../../../../Elements/DatePicker';
34
31
  import Input from '../../../../../Forms/Input';
32
+ import { useClickOutside } from '../../../../Modal/hooks/useClickOutside';
33
+ import { getCleanValues } from './utils/getCleanValues';
34
+ import { pickerRangeToString } from './utils/pickerRangeToString';
35
35
  import { i18n } from '@lingui/core';
36
- var RangeWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n margin-right: 20px;\n"], ["\n display: inline-flex;\n margin-right: 20px;\n"
37
- // User readable date range.
38
- ])));
39
- // User readable date range.
40
- var pickerRangeToString = function (values) {
41
- if (values === void 0) { values = []; }
42
- // If no date is specified
43
- if (!values[0] && !values[1]) {
44
- return '';
45
- }
46
- // If only From date is specified
47
- if (values[0] && !values[1]) {
48
- return DateTime.fromJSDate(values[0]).toFormat('dd.LL.yyyy');
49
- }
50
- // If both of date are same, show only one date
51
- if (sameDate(values[0], values[1])) {
52
- return DateTime.fromJSDate(values[0]).toFormat('dd.LL.yyyy');
53
- }
54
- // Format each date separately and join together
55
- return values.map(function (v) { return v && DateTime.fromJSDate(v).toFormat('dd.LL.yyyy'); }).join(' - ');
56
- };
36
+ import styled from '@xstyled/styled-components';
37
+ var RangeWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n margin-right: 20px;\n"], ["\n display: inline-flex;\n margin-right: 20px;\n"])));
57
38
  var OverlayComponentDefault = function (_a) {
58
39
  var children = _a.children;
59
40
  return _jsx("div", { children: children });
@@ -63,12 +44,10 @@ var DatePickerRange = function (props) {
63
44
  var onChange = props.onChange, error = props.error, label = props.label, value = props.value, filterTime = props.filterTime, initialView = props.initialView, _d = props.OverlayComponent, OverlayComponent = _d === void 0 ? OverlayComponentDefault : _d, rest = __rest(props, ["onChange", "error", "label", "value", "filterTime", "initialView", "OverlayComponent"]);
64
45
  var _e = useState((_a = value === null || value === void 0 ? void 0 : value[0]) !== null && _a !== void 0 ? _a : undefined), startRangeValue = _e[0], setStartRangeValue = _e[1];
65
46
  var _f = useState((_b = value === null || value === void 0 ? void 0 : value[1]) !== null && _b !== void 0 ? _b : undefined), endRangeValue = _f[0], setEndRangeValue = _f[1];
47
+ var _g = useState(undefined), others = _g[0], setOthersValues = _g[1];
66
48
  var timeFormat = filterTime ? 'HH:mm' : false;
67
49
  var placeholder = i18n._({ id: 'dataGrid.filterCell', message: 'Type to filter' });
68
- var cleanValue = React.useMemo(function () { return [
69
- typeof (value === null || value === void 0 ? void 0 : value[0]) === 'string' ? new Date(value[0]) : (value === null || value === void 0 ? void 0 : value[0]) || undefined,
70
- typeof (value === null || value === void 0 ? void 0 : value[1]) === 'string' ? new Date(value[1]) : (value === null || value === void 0 ? void 0 : value[1]) || undefined,
71
- ]; }, [value]);
50
+ var cleanValue = React.useMemo(function () { return getCleanValues(value); }, [value]);
72
51
  var initialViewDate = useMemo(function () {
73
52
  if (cleanValue[0] && cleanValue[1]) {
74
53
  return cleanValue;
@@ -82,22 +61,25 @@ var DatePickerRange = function (props) {
82
61
  else {
83
62
  firstDate.setMonth(firstDate.getMonth());
84
63
  }
85
- return [firstDate, secondDate];
64
+ return [cleanValue[0] || firstDate, cleanValue[1] || secondDate];
86
65
  }, [cleanValue, initialView]);
87
- var _g = useState(false), isOpen = _g[0], setOpen = _g[1];
66
+ var _h = useState(false), isOpen = _h[0], setOpen = _h[1];
88
67
  var setDateFrom = useCallback(function (v) {
89
68
  setStartRangeValue(v);
90
- onChange([v, cleanValue[1]]);
91
- }, [onChange, cleanValue]);
69
+ onChange([v, cleanValue[1]], others);
70
+ }, [onChange, others, cleanValue]);
92
71
  var setDateTo = useCallback(function (v) {
93
72
  setEndRangeValue(v);
94
- onChange([cleanValue[0], v]);
95
- }, [onChange, cleanValue]);
96
- var openPicker = useCallback(function () { return setOpen(true); }, [setOpen]);
73
+ onChange([cleanValue[0], v], others);
74
+ }, [onChange, others, cleanValue]);
75
+ var openPicker = useCallback(function () {
76
+ setOpen(true);
77
+ }, [setOpen]);
97
78
  var clear = useCallback(function () {
98
79
  onChange([]);
99
80
  setStartRangeValue(undefined);
100
81
  setEndRangeValue(undefined);
82
+ setOthersValues(undefined);
101
83
  }, [onChange]);
102
84
  var isValidDateFrom = useCallback(function (current) { return !cleanValue[1] || DateTime.fromJSDate(cleanValue[1]) >= DateTime.fromJSDate(current); }, [cleanValue]);
103
85
  var isValidDateTo = useCallback(function (current) { return !cleanValue[0] || DateTime.fromJSDate(current) >= DateTime.fromJSDate(cleanValue[0]); }, [cleanValue]);
@@ -107,7 +89,8 @@ var DatePickerRange = function (props) {
107
89
  // Check if the second value is not selected and the first value is the same as the initial value
108
90
  var secondDatePickerValue = cleanValue[1] === null ? cleanValue[0] : cleanValue[1];
109
91
  var ref = useClickOutside({ onClose: onClose });
110
- return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue), label: props.label, onFocus: openPicker, iconOnClick: openPicker, onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, { className: "ignore-element-for-closing-hook", children: [_jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: (_c = cleanValue[0]) !== null && _c !== void 0 ? _c : '', initialViewDate: initialViewDate[0], secondValue: endRangeValue, onChange: setDateFrom, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true, disabled: cleanValue[0] === null })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, disabled: secondDatePickerValue === null, isSecondDatePicker: true }))] })) }) })] }));
92
+ console.log('others', others);
93
+ return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue, others), label: props.label, onFocus: openPicker, iconOnClick: openPicker, onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, { className: "ignore-element-for-closing-hook", children: [_jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: (_c = cleanValue[0]) !== null && _c !== void 0 ? _c : '', initialViewDate: initialViewDate[0], secondValue: endRangeValue, onChange: setDateFrom, others: others, onChangeOthers: setOthersValues, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true, disabled: cleanValue[0] === null })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, disabled: secondDatePickerValue === null || !!(others === null || others === void 0 ? void 0 : others.dateTypeRepeater), isSecondDatePicker: true }))] })) }) })] }));
111
94
  };
112
95
  export default DatePickerRange;
113
96
  var templateObject_1;
@@ -0,0 +1 @@
1
+ export declare const getCleanValues: (value: Date[]) => Array<Date | undefined>;
@@ -0,0 +1,11 @@
1
+ var getCleanValue = function (value) {
2
+ if (typeof value === 'string') {
3
+ return new Date(value);
4
+ }
5
+ return value || undefined;
6
+ };
7
+ export var getCleanValues = function (value) {
8
+ var from = getCleanValue(value === null || value === void 0 ? void 0 : value[0]);
9
+ var to = getCleanValue(value === null || value === void 0 ? void 0 : value[1]);
10
+ return [from, to];
11
+ };
@@ -0,0 +1,2 @@
1
+ import type { DateTimeOthers } from '../../../../../../Elements/DatePicker/Datetime/types';
2
+ export declare const pickerRangeToString: (values?: Date[], others?: DateTimeOthers) => string;
@@ -0,0 +1,23 @@
1
+ import { DateTime } from 'luxon';
2
+ import { DatePickerRepeatTrans, TimePickerRepeatTrans } from '../../../../../../Elements/DatePicker/utils/constants';
3
+ import { sameDate } from './sameDate';
4
+ // User readable date range.
5
+ export var pickerRangeToString = function (values, others) {
6
+ if (values === void 0) { values = []; }
7
+ if (others === null || others === void 0 ? void 0 : others.dateTypeRepeater) {
8
+ var repeaterDate = DatePickerRepeatTrans[others === null || others === void 0 ? void 0 : others.dateTypeRepeater];
9
+ var repeaterTime = (others === null || others === void 0 ? void 0 : others.timeTypeRepeater) ? TimePickerRepeatTrans[others === null || others === void 0 ? void 0 : others.timeTypeRepeater] : '';
10
+ var time = (others === null || others === void 0 ? void 0 : others.time) ? " ".concat(String(others === null || others === void 0 ? void 0 : others.time.h).padStart(2, '0'), ":").concat(String(others === null || others === void 0 ? void 0 : others.time.m).padStart(2, '0')) : '';
11
+ return "".concat(repeaterDate, " ").concat(repeaterTime).concat(time);
12
+ }
13
+ // If no date is specified
14
+ if (!values[0] && !values[1]) {
15
+ return '';
16
+ }
17
+ // If only From date is specified or if both of date are same, show only one date
18
+ if ((values[0] && !values[1]) || sameDate(values[0], values[1])) {
19
+ return DateTime.fromJSDate(values[0]).toFormat('dd.LL.yyyy');
20
+ }
21
+ // Format each date separately and join together
22
+ return values.map(function (v) { return v && DateTime.fromJSDate(v).toFormat('dd.LL.yyyy'); }).join(' - ');
23
+ };
@@ -49,6 +49,6 @@ var MenuItem = function (_a) {
49
49
  }, [items, link]);
50
50
  return (_jsxs(_Fragment, { children: [separator && _jsx(ItemsSeparator, {}), _jsxs(MenuItemContainer, { ref: parentRef, "$isCompact": isCompact, "$lightMode": lightMode, hasChildren: hasChildren, isHovering: isHovering, children: [_jsxs(ItemLinkWrap, __assign({}, linkProps, { onMouseOver: handleMouseOver, exact: true, activeClassName: hasChildren ? 'selected' : undefined, onClick: toggleChildren, "$isCompact": isCompact, className: itemLinkWrapClassName,
51
51
  // @ts-ignore
52
- isActive: isActive, "$lightMode": lightMode, children: [_jsxs(ItemLabel, { "$isCompact": isCompact, isSubitem: isSubitem, children: [!isSubitem && icon && (_jsx(ItemIcon, { className: "mainIcon", "$isCompact": isCompact, children: typeof icon === 'string' ? _jsx(Icon, { icon: icon, fill: "none" }) : icon })), _jsx(Title, { variant: "semiBold", mt: 0, mb: 0, children: _jsx(OverflowWithEllipsis, { children: title }) })] }), !isCompact && hasChildren && _jsx(ItemDropdownArrow, { icon: "goDown", "$lightMode": lightMode })] })), isHovering && isCompact && hasChildren && !listExpandedItems && (_jsx(SubitemTooltip, { items: items, childRef: childRef, parentRef: parentRef, isLeftMenuOpen: isLeftMenuOpen, onCloseLeftMenu: onCloseLeftMenu, lightMode: lightMode }))] }), hasChildren && listExpandedItems && (_jsx(SubItemsWrap, { children: items === null || items === void 0 ? void 0 : items.map(function (item, index) { return (_jsx(MenuItem, __assign({ isCompact: isCompact, lightMode: lightMode }, item, { onCloseLeftMenu: onCloseLeftMenu, isSubitem: true }), "".concat(index))); }) }))] }));
52
+ isActive: isActive, "$lightMode": lightMode, children: [_jsxs(ItemLabel, { "$isCompact": isCompact, isSubitem: isSubitem, children: [!isSubitem && icon && (_jsx(ItemIcon, { className: "mainIcon", "$isCompact": isCompact, children: typeof icon === 'string' ? _jsx(Icon, { icon: icon, fill: "none" }) : icon })), _jsx(Title, { variant: "semiBold", mt: 0, mb: 0, textAlign: "left", children: _jsx(OverflowWithEllipsis, { children: title }) })] }), !isCompact && hasChildren && _jsx(ItemDropdownArrow, { icon: "goDown", "$lightMode": lightMode })] })), isHovering && isCompact && hasChildren && !listExpandedItems && (_jsx(SubitemTooltip, { items: items, childRef: childRef, parentRef: parentRef, isLeftMenuOpen: isLeftMenuOpen, onCloseLeftMenu: onCloseLeftMenu, lightMode: lightMode }))] }), hasChildren && listExpandedItems && (_jsx(SubItemsWrap, { children: items === null || items === void 0 ? void 0 : items.map(function (item, index) { return (_jsx(MenuItem, __assign({ isCompact: isCompact, lightMode: lightMode }, item, { onCloseLeftMenu: onCloseLeftMenu, isSubitem: true }), "".concat(index))); }) }))] }));
53
53
  };
54
54
  export default memo(MenuItem);
@@ -1,2 +1,2 @@
1
1
  import { TabsProps } from './types';
2
- export declare const Tabs: ({ tabsDefinition, activeTab, onTabSwitch, mb }: TabsProps) => JSX.Element;
2
+ export declare const Tabs: ({ tabsDefinition, activeTab, onTabSwitch, mb, mt }: TabsProps) => JSX.Element;
@@ -12,8 +12,8 @@ var Tab = function (_a) {
12
12
  return (_jsx(StyledTabWrapper, { children: _jsxs(StyledTab, { onClick: !disabled ? handleOnClick : undefined, active: isActive, disabled: disabled, children: [icon && (_jsx(StyledImageBox, { children: _jsx(Icon, { icon: icon }) })), _jsx(Text, { children: label }), badgeCount === 0 || (badgeCount && badgeCount > 0) && (_jsx(RoundedWrap, { children: _jsx(Text, { variant: "medium", children: badgeCount }) }))] }) }));
13
13
  };
14
14
  export var Tabs = function (_a) {
15
- var tabsDefinition = _a.tabsDefinition, activeTab = _a.activeTab, onTabSwitch = _a.onTabSwitch, mb = _a.mb;
16
- return (_jsx(TabPanel, { "$mb": mb, children: tabsDefinition.map(function (item, index) {
15
+ var tabsDefinition = _a.tabsDefinition, activeTab = _a.activeTab, onTabSwitch = _a.onTabSwitch, mb = _a.mb, mt = _a.mt;
16
+ return (_jsx(TabPanel, { "$mb": mb, "$mt": mt, children: tabsDefinition.map(function (item, index) {
17
17
  return _jsx(Tab, { value: index, tabDefinition: item, isActive: index === activeTab, onTabSwitch: onTabSwitch }, index);
18
18
  }) }));
19
19
  };
@@ -2,7 +2,7 @@
2
2
  import { StoryObj } from '@storybook/react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ tabsDefinition, activeTab, onTabSwitch, mb }: import("../types").TabsProps) => JSX.Element;
5
+ component: ({ tabsDefinition, activeTab, onTabSwitch, mb, mt }: import("../types").TabsProps) => JSX.Element;
6
6
  tags: string[];
7
7
  argTypes: {};
8
8
  };
@@ -8,4 +8,5 @@ export declare const Tab: import("styled-components").StyledComponent<"div", imp
8
8
  }, never>;
9
9
  export declare const TabPanel: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
10
10
  $mb?: string | undefined;
11
+ $mt?: string | undefined;
11
12
  }, never>;
@@ -4,18 +4,27 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  };
5
5
  import styled, { css, th, x } from '@xstyled/styled-components';
6
6
  export var StyledImageBox = styled(x.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: 1em;\n"], ["\n margin-right: 1em;\n"])));
7
- export var StyledTabWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: baseline;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: baseline;\n"])));
7
+ export var StyledTabWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n position: relative;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n position: relative;\n"])));
8
8
  export var RoundedWrap = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex !important;\n justify-content: center;\n align-items: center;\n height: 23px;\n background-color: ", ";\n border-radius: 29px;\n padding: 3px 10px;\n margin-left: 8px;\n"], ["\n display: flex !important;\n justify-content: center;\n align-items: center;\n height: 23px;\n background-color: ", ";\n border-radius: 29px;\n padding: 3px 10px;\n margin-left: 8px;\n"])), th.color('lightGray7'));
9
- var activeTab = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n position: relative;\n &:after {\n content: '';\n position: absolute;\n bottom: 2;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 4px;\n border-radius: 6px 6px 0px 0px;\n }\n & > div {\n display: inline;\n color: ", ";\n }\n"], ["\n color: ", ";\n position: relative;\n &:after {\n content: '';\n position: absolute;\n bottom: 2;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 4px;\n border-radius: 6px 6px 0px 0px;\n }\n & > div {\n display: inline;\n color: ", ";\n }\n"])), th.color('red1'), th.color('red1'), th.color('typoPrimary'));
10
- export var Tab = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n padding: 0.6rem;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n height: 46px;\n letter-spacing: 0.03em;\n margin-top: 10px;\n min-width: 100px;\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: 120px;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n padding: 0.6rem;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n height: 46px;\n letter-spacing: 0.03em;\n margin-top: 10px;\n min-width: 100px;\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: 120px;\n }\n"])), th.color('gray'), th.color('typoPrimary'), function (_a) {
9
+ var activeTab = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n\n &:after {\n content: '';\n position: absolute;\n bottom: 2;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 4px;\n border-radius: 6px 6px 0px 0px;\n }\n & > div {\n display: inline;\n color: ", ";\n }\n"], ["\n color: ", ";\n\n &:after {\n content: '';\n position: absolute;\n bottom: 2;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 4px;\n border-radius: 6px 6px 0px 0px;\n }\n & > div {\n display: inline;\n color: ", ";\n }\n"])), th.color('red1'), th.color('red1'), th.color('typoPrimary'));
10
+ export var Tab = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n padding: 0 8px 12px;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n letter-spacing: 0.03em;\n min-width: 100px;\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: 120px;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n padding: 0 8px 12px;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n letter-spacing: 0.03em;\n min-width: 100px;\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: 120px;\n }\n"])), function (_a) {
11
+ var disabled = _a.disabled;
12
+ return (disabled ? 'auto' : 'pointer');
13
+ }, th.color('gray'), function (_a) {
14
+ var disabled = _a.disabled;
15
+ return th.color(disabled ? 'gray' : 'typoPrimary');
16
+ }, function (_a) {
11
17
  var disabled = _a.disabled;
12
18
  return !disabled && activeTab;
13
19
  }, function (_a) {
14
20
  var active = _a.active;
15
21
  return (active ? activeTab : '');
16
22
  });
17
- export var TabPanel = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n min-height: 3rem;\n display: flex;\n align-items: flex-end;\n overflow: auto;\n width: fit-content;\n position: relative;\n margin-bottom: ", ";\n &:after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 2px;\n }\n"], ["\n min-height: 3rem;\n display: flex;\n align-items: flex-end;\n overflow: auto;\n width: fit-content;\n position: relative;\n margin-bottom: ", ";\n &:after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 2px;\n }\n"])), function (_a) {
23
+ export var TabPanel = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n overflow: auto;\n width: fit-content;\n position: relative;\n margin-bottom: ", ";\n margin-top: ", ";\n align-items: stretch;\n\n &:after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 2px;\n }\n"], ["\n display: flex;\n align-items: center;\n overflow: auto;\n width: fit-content;\n position: relative;\n margin-bottom: ", ";\n margin-top: ", ";\n align-items: stretch;\n\n &:after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 2px;\n }\n"])), function (_a) {
18
24
  var _b = _a.$mb, $mb = _b === void 0 ? 0 : _b;
19
25
  return $mb;
26
+ }, function (_a) {
27
+ var _b = _a.$mt, $mt = _b === void 0 ? 0 : _b;
28
+ return $mt;
20
29
  }, th.color('bgLightGray1'));
21
30
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -11,6 +11,7 @@ export type TabsProps = {
11
11
  activeTab: number;
12
12
  onTabSwitch: (tab: number) => void;
13
13
  mb?: string;
14
+ mt?: string;
14
15
  };
15
16
  export type TabElementProps = {
16
17
  tabDefinition: TabDefinition;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { SpaceAround } from '../SpaceAround';
3
- import { DatetimepickerProps } from './Datetime/types';
2
+ import type { SpaceAround } from '../SpaceAround';
3
+ import type { DateTimeOthers, DatetimepickerProps } from './Datetime/types';
4
4
  export type DatePickerType = DatetimepickerProps & {
5
5
  onChange: (value: string | Date) => void;
6
6
  disabled?: boolean;
@@ -15,8 +15,10 @@ export type DatePickerType = DatetimepickerProps & {
15
15
  error?: string;
16
16
  icon?: boolean;
17
17
  isSecondDatePicker?: boolean;
18
+ others?: DateTimeOthers;
18
19
  onClear?: () => void;
19
20
  onInputChange?: () => void;
21
+ onChangeOthers?: (others: DateTimeOthers) => void;
20
22
  };
21
23
  declare const _default: React.MemoExoticComponent<({ name, value, initialViewDate, error, label, disabled, isValidDate, onChange, dateFormat, timeFormat, open, secondValue, input, icon, showInputLabel, showCalendarLabel, spaceAround, className, onClear, onInputChange, ...passProps }: DatePickerType) => JSX.Element>;
22
24
  export default _default;
@@ -52,7 +52,8 @@ var DatePicker = function (_a) {
52
52
  return renderCalendar();
53
53
  }, [label, showInputLabel]);
54
54
  var handleChange = useCallback(function (value) {
55
- var parsed = typeof value === 'string' ? value : value.toDate();
55
+ var _a;
56
+ var parsed = typeof value === 'string' ? value : (_a = value === null || value === void 0 ? void 0 : value.toDate) === null || _a === void 0 ? void 0 : _a.call(value);
56
57
  onChange === null || onChange === void 0 ? void 0 : onChange(parsed);
57
58
  }, [onChange]);
58
59
  var handleIsValid = useCallback(function (current, selected) {
@@ -60,6 +61,6 @@ var DatePicker = function (_a) {
60
61
  var parsed = [(_a = current === null || current === void 0 ? void 0 : current.toDate) === null || _a === void 0 ? void 0 : _a.call(current), (_b = selected === null || selected === void 0 ? void 0 : selected.toDate) === null || _b === void 0 ? void 0 : _b.call(selected)];
61
62
  return isValidDate ? isValidDate.apply(void 0, parsed) : true;
62
63
  }, [isValidDate]);
63
- return (_jsx(SpaceAroundWrap, { spaceAround: spaceAround, children: _jsx(DatePickerBase, { className: className, children: _jsx(DatetimePicker, __assign({ value: value, dateFormat: dateFormat, timeFormat: timeFormat, secondValue: secondValue, open: open, input: input, label: showCalendarLabel ? label : undefined, onChange: handleChange, isValidDate: handleIsValid, renderView: handleRenderView, renderInput: handleRenderInput, initialViewDate: initialViewDate, locale: locale }, passProps)) }) }));
64
+ return (_jsx(SpaceAroundWrap, { spaceAround: spaceAround, children: _jsx(DatePickerBase, { className: className, children: _jsx(DatetimePicker, __assign({ value: value, dateFormat: dateFormat, timeFormat: timeFormat, secondValue: secondValue, open: open, input: input, label: showCalendarLabel ? label : undefined, onChange: handleChange, isValidDate: handleIsValid, renderView: handleRenderView, renderInput: handleRenderInput, initialViewDate: initialViewDate, locale: locale, disabled: disabled }, passProps)) }) }));
64
65
  };
65
66
  export default React.memo(DatePicker);
@@ -1,6 +1,6 @@
1
- import moment from 'moment';
2
1
  import React from 'react';
3
- import { DatetimepickerProps } from './types';
2
+ import moment from 'moment';
3
+ import type { DatetimepickerProps } from './types';
4
4
  export default class Datetime extends React.Component<DatetimepickerProps> {
5
5
  static defaultProps: {
6
6
  onOpen: () => void;
@@ -65,6 +65,7 @@ export default class Datetime extends React.Component<DatetimepickerProps> {
65
65
  _updateDate: (e: any) => void;
66
66
  _viewNavigate: (modifier: any, unit: any) => void;
67
67
  _setTime: (type: any, value: any) => void;
68
+ _reset: () => void;
68
69
  _openCalendar: () => void;
69
70
  _closeCalendar: () => void;
70
71
  _handleClickOutside: () => void;
@@ -26,17 +26,17 @@ var __assign = (this && this.__assign) || function () {
26
26
  };
27
27
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
28
  // @ts-nocheck
29
- import moment from 'moment';
30
29
  import React from 'react';
30
+ import moment from 'moment';
31
+ import onClickOutside from 'react-onclickoutside';
31
32
  import DaysView from './views/DaysView';
32
33
  import MonthsView from './views/MonthsView';
33
34
  import YearsView from './views/YearsView';
34
- import onClickOutside from 'react-onclickoutside';
35
35
  var viewModes = {
36
36
  YEARS: 'years',
37
37
  MONTHS: 'months',
38
38
  DAYS: 'days',
39
- TIME: 'time',
39
+ TIME: 'time'
40
40
  };
41
41
  var nofn = function () { };
42
42
  var Datetime = /** @class */ (function (_super) {
@@ -54,9 +54,12 @@ var Datetime = /** @class */ (function (_super) {
54
54
  selectedDate: _this.getSelectedDate(),
55
55
  isValidDate: props.isValidDate,
56
56
  updateDate: _this._updateDate,
57
+ others: props.others,
58
+ onChangeOthers: props.onChangeOthers,
59
+ reset: _this._reset,
57
60
  navigate: _this._viewNavigate,
58
61
  moment: moment,
59
- showView: _this._showView,
62
+ showView: _this._showView
60
63
  };
61
64
  // Probably updateOn, updateSelectedDate and setDate can be merged in the same method
62
65
  // that would update viewDate or selectedDate depending on the view and the dateFormat
@@ -141,11 +144,14 @@ var Datetime = /** @class */ (function (_super) {
141
144
  _this.setState({
142
145
  selectedDate: date,
143
146
  viewDate: date.clone(),
144
- inputValue: date.format(_this.getFormat('datetime')),
147
+ inputValue: date.format(_this.getFormat('datetime'))
145
148
  });
146
149
  }
147
150
  _this.props.onChange(date);
148
151
  };
152
+ _this._reset = function () {
153
+ _this.props.onChange(undefined);
154
+ };
149
155
  _this._openCalendar = function () {
150
156
  if (_this.isOpen())
151
157
  return;
@@ -229,7 +235,7 @@ var Datetime = /** @class */ (function (_super) {
229
235
  currentView: props.initialViewMode || this.getInitialView(),
230
236
  viewDate: this.getInitialViewDate(selectedDate),
231
237
  selectedDate: selectedDate && selectedDate.isValid() ? selectedDate : undefined,
232
- inputValue: this.getInitialInputValue(selectedDate),
238
+ inputValue: this.getInitialInputValue(selectedDate)
233
239
  };
234
240
  };
235
241
  Datetime.prototype.getInitialViewDate = function (selectedDate) {
@@ -489,7 +495,7 @@ var Datetime = /** @class */ (function (_super) {
489
495
  closeOnSelect: false,
490
496
  closeOnTab: true,
491
497
  closeOnClickOutside: true,
492
- renderView: function (_, renderFunc) { return renderFunc(); },
498
+ renderView: function (_, renderFunc) { return renderFunc(); }
493
499
  };
494
500
  // Make moment accessible through the Datetime class
495
501
  Datetime.moment = moment;
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import type { DateTimeOthers } from '../types';
3
+ type DateRepeaterProps = {
4
+ onChangeOthers?: ({ dateTypeRepeater }: DateTimeOthers) => void;
5
+ others: DateTimeOthers;
6
+ reset: () => void;
7
+ };
8
+ export declare const DateRepeater: FC<DateRepeaterProps>;
9
+ export {};
@@ -0,0 +1,30 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useCallback } from 'react';
14
+ import Icon from '../../../Icon';
15
+ import { DatePickerRepeat, DatePickerRepeatTrans } from '../../utils/constants';
16
+ import { i18n } from '@lingui/core';
17
+ import { x } from '@xstyled/styled-components';
18
+ import { FooterRow } from './FooterRow';
19
+ import { FooterRowLabel } from './FooterRowLabel';
20
+ export var DateRepeater = function (_a) {
21
+ var onChangeOthers = _a.onChangeOthers, others = _a.others, reset = _a.reset;
22
+ var handleChange = useCallback(function (e) {
23
+ var dateTypeRepeater = e.target.value;
24
+ onChangeOthers === null || onChangeOthers === void 0 ? void 0 : onChangeOthers(__assign(__assign({}, others), { dateTypeRepeater: dateTypeRepeater }));
25
+ if (dateTypeRepeater) {
26
+ reset();
27
+ }
28
+ }, [onChangeOthers, reset, others]);
29
+ return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", mt: "8px", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { children: [_jsxs(x.div, { display: "flex", alignItems: "center", flex: "1", children: [_jsx(Icon, { icon: "calendar" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.repeat', message: 'Repeat' }) })] }), _jsxs(x.select, { textAlign: "right", onChange: handleChange, value: others === null || others === void 0 ? void 0 : others.dateTypeRepeater, children: [_jsx("option", { value: "", children: i18n._({ id: 'dataGrid.noRepeat', message: 'No repeat' }) }), _jsx("option", { value: DatePickerRepeat.EVERY_TODAY, children: DatePickerRepeatTrans[DatePickerRepeat.EVERY_TODAY] }), _jsx("option", { value: DatePickerRepeat.EVERY_YESTERDAY, children: DatePickerRepeatTrans[DatePickerRepeat.EVERY_YESTERDAY] }), _jsx("option", { value: DatePickerRepeat.EVERY_LAST_WEEK, children: DatePickerRepeatTrans[DatePickerRepeat.EVERY_LAST_WEEK] })] })] }) }));
30
+ };
@@ -1,8 +1,12 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
+ import type { DateTimeOthers } from '../types';
2
3
  interface TimepickerProps {
3
4
  setTime: (type: string, value: number) => void;
4
5
  value: Date | null;
5
6
  disabled?: boolean;
7
+ others: DateTimeOthers;
8
+ onChangeOthers: (others: DateTimeOthers) => void;
9
+ isSecondDatePicker?: boolean;
6
10
  }
7
11
  export declare const Timepicker: FC<TimepickerProps>;
8
12
  export {};
@@ -1,6 +1,18 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { useCallback, useEffect, useState } from 'react';
3
14
  import Icon from '../../../Icon';
15
+ import { TimePickerRepeat, TimePickerRepeatTrans } from '../../utils/constants';
4
16
  import { i18n } from '@lingui/core';
5
17
  import { x } from '@xstyled/styled-components';
6
18
  import { FooterRow } from './FooterRow';
@@ -8,22 +20,30 @@ import { FooterRowLabel } from './FooterRowLabel';
8
20
  import { TimeInput } from './TimeInput';
9
21
  export var Timepicker = function (_a) {
10
22
  var _b, _c, _d, _e;
11
- var setTime = _a.setTime, value = _a.value, disabled = _a.disabled;
12
- var initialHours = (_c = (_b = value === null || value === void 0 ? void 0 : value.getHours) === null || _b === void 0 ? void 0 : _b.call(value)) !== null && _c !== void 0 ? _c : 0;
13
- var initialMinutes = (_e = (_d = value === null || value === void 0 ? void 0 : value.getMinutes) === null || _d === void 0 ? void 0 : _d.call(value)) !== null && _e !== void 0 ? _e : 0;
23
+ var setTime = _a.setTime, others = _a.others, onChangeOthers = _a.onChangeOthers, value = _a.value, disabled = _a.disabled, isSecondDatePicker = _a.isSecondDatePicker;
24
+ var initialHours = ((_b = value === null || value === void 0 ? void 0 : value.getHours) === null || _b === void 0 ? void 0 : _b.call(value)) || ((_c = others === null || others === void 0 ? void 0 : others.time) === null || _c === void 0 ? void 0 : _c.h) || 0;
25
+ var initialMinutes = ((_d = value === null || value === void 0 ? void 0 : value.getMinutes) === null || _d === void 0 ? void 0 : _d.call(value)) || ((_e = others === null || others === void 0 ? void 0 : others.time) === null || _e === void 0 ? void 0 : _e.m) || 0;
14
26
  var _f = useState(initialHours), hours = _f[0], setHours = _f[1];
15
27
  var _g = useState(initialMinutes), minutes = _g[0], setMinutes = _g[1];
16
28
  var onChange = useCallback(function (e) {
17
- var _a = e.target.value.split(':'), hours = _a[0], minutes = _a[1];
29
+ var value = e.target.value;
30
+ var _a = value.split(':'), hours = _a[0], minutes = _a[1];
31
+ var timeTypeRepeater = (others === null || others === void 0 ? void 0 : others.dateTypeRepeater) ? (others === null || others === void 0 ? void 0 : others.timeTypeRepeater) || TimePickerRepeat.FROM : undefined;
18
32
  setHours(Number(hours));
19
33
  setMinutes(Number(minutes));
20
- }, []);
34
+ onChangeOthers === null || onChangeOthers === void 0 ? void 0 : onChangeOthers(__assign(__assign({}, others), { timeTypeRepeater: timeTypeRepeater, time: { h: Number(hours), m: Number(minutes) } }));
35
+ }, [onChangeOthers, others]);
36
+ var handleChangeTimer = useCallback(function (e) {
37
+ onChangeOthers === null || onChangeOthers === void 0 ? void 0 : onChangeOthers(__assign(__assign({}, others), { timeTypeRepeater: e.target.value }));
38
+ }, [onChangeOthers, others]);
21
39
  useEffect(function () {
22
40
  !!value && setTime('hours', hours);
23
41
  }, [hours]);
24
42
  useEffect(function () {
25
43
  !!value && setTime('minutes', minutes);
26
44
  }, [minutes]);
27
- var timeValue = "".concat((hours).toString().padStart(2, '0'), ":").concat((minutes).toString().padStart(2, '0'));
28
- return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { disabled: disabled || !value, children: [_jsxs(x.div, { children: [_jsx(Icon, { icon: "clock" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.filterCell.time', message: 'Time' }) })] }), _jsx(x.div, { display: "flex", alignItems: "center", children: _jsx(TimeInput, { type: "time", onChange: onChange, disabled: disabled || !value, value: timeValue }) })] }) }));
45
+ var timeValue = "".concat(hours.toString().padStart(2, '0'), ":").concat(minutes.toString().padStart(2, '0'));
46
+ var staticTimerValue = isSecondDatePicker ? TimePickerRepeat.TO : TimePickerRepeat.FROM;
47
+ var timeTypeRepeaterValue = (others === null || others === void 0 ? void 0 : others.dateTypeRepeater) ? others === null || others === void 0 ? void 0 : others.timeTypeRepeater : staticTimerValue;
48
+ return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { disabled: disabled, children: [_jsxs(x.div, { children: [_jsx(Icon, { icon: "clock" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.filterCell.time', message: 'Time' }) })] }), _jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsxs(x.select, { onChange: handleChangeTimer, value: timeTypeRepeaterValue, textAlign: "right", disabled: disabled || !(others === null || others === void 0 ? void 0 : others.dateTypeRepeater), children: [_jsx("option", { value: TimePickerRepeat.AT, children: TimePickerRepeatTrans[TimePickerRepeat.AT] }), _jsx("option", { value: TimePickerRepeat.FROM, children: TimePickerRepeatTrans[TimePickerRepeat.FROM] }), _jsx("option", { value: TimePickerRepeat.TO, children: TimePickerRepeatTrans[TimePickerRepeat.TO] })] }), _jsx(TimeInput, { type: "time", onChange: onChange, disabled: disabled, value: timeValue })] })] }) }));
29
49
  };
@@ -1,5 +1,6 @@
1
- import { FocusEvent, FocusEventHandler } from 'react';
2
- import { Moment } from 'moment';
1
+ import type { FocusEvent, FocusEventHandler } from 'react';
2
+ import type { Moment } from 'moment';
3
+ import type { DatePickerRepeat, TimePickerRepeat } from '../utils/constants';
3
4
  export type ViewMode = 'years' | 'months' | 'days' | 'time';
4
5
  export interface TimeConstraint {
5
6
  min: number;
@@ -47,6 +48,7 @@ export interface DatetimepickerProps {
47
48
  closeOnClickOutside?: boolean;
48
49
  secondValue?: Date | null;
49
50
  label?: string;
51
+ disabled?: boolean;
50
52
  }
51
53
  export interface DatetimepickerState {
52
54
  updateOn: string;
@@ -58,4 +60,12 @@ export interface DatetimepickerState {
58
60
  secondValue?: Date | null;
59
61
  label?: string;
60
62
  }
63
+ export type DateTimeOthers = {
64
+ dateTypeRepeater: DatePickerRepeat;
65
+ timeTypeRepeater?: TimePickerRepeat;
66
+ time?: {
67
+ h: number;
68
+ m: number;
69
+ };
70
+ };
61
71
  export {};
@@ -1,7 +1 @@
1
- // Type definitions for react-datetime
2
- // Project: https://github.com/arqex/react-datetime
3
- // Definitions by: Ivan Verevkin <vereva@x-root.org>
4
- // Updates by: Aaron Spaulding <aaron@sachimp.com>,
5
- // Karol Janyst <http://github.com/LKay>,
6
- // Javier Marquez <javi@arqex.com>
7
1
  export {};
@@ -27,9 +27,9 @@ var __assign = (this && this.__assign) || function () {
27
27
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
28
  // @ts-nocheck
29
29
  import React from 'react';
30
+ import { DateRepeater } from '../components/DateRepeater';
30
31
  import { Timepicker } from '../components/Timepicker';
31
32
  import ViewNavigation from '../components/ViewNavigation';
32
- import { ShortDatePick } from '../components/ShortDatePick';
33
33
  var DaysView = /** @class */ (function (_super) {
34
34
  __extends(DaysView, _super);
35
35
  function DaysView() {
@@ -73,6 +73,7 @@ var DaysView = /** @class */ (function (_super) {
73
73
  return rows.map(function (r, i) { return _jsx("tr", { children: r }, "".concat(endDate.month(), "_").concat(i)); });
74
74
  };
75
75
  DaysView.prototype.renderDay = function (date, startOfMonth, endOfMonth) {
76
+ var _a, _b;
76
77
  var selectedDate = this.props.selectedDate;
77
78
  var secondValue = this.props.secondValue;
78
79
  var dayProps = {
@@ -103,21 +104,26 @@ var DaysView = /** @class */ (function (_super) {
103
104
  if (date.isSame(this.props.moment(), 'day')) {
104
105
  className += ' rdtToday';
105
106
  }
106
- if (this.props.isValidDate(date)) {
107
+ if (this.props.isValidDate(date) && !((_a = this.props.others) === null || _a === void 0 ? void 0 : _a.dateTypeRepeater) && !this.props.disabled) {
107
108
  dayProps.onClick = this._setDate;
108
109
  }
109
110
  else {
110
111
  className += ' rdtDisabled';
111
112
  }
113
+ if (((_b = this.props.others) === null || _b === void 0 ? void 0 : _b.dateTypeRepeater) || this.props.disabled) {
114
+ className += ' rdtDisabled';
115
+ }
112
116
  dayProps.className = className;
113
117
  return this.props.renderDay(dayProps, date.clone(), selectedDate && selectedDate.clone());
114
118
  };
115
119
  DaysView.prototype.renderFooter = function () {
116
120
  var setTime = this.props.setTime;
117
- var setDate = this._setDate;
121
+ var onChangeOthers = this.props.onChangeOthers;
122
+ var reset = this.props.reset;
118
123
  var value = this.props.value;
124
+ var others = this.props.others;
119
125
  var disabled = this.props.disabled;
120
- return (_jsx("tfoot", { children: _jsx("tr", { children: _jsxs("td", { colSpan: 7, children: [_jsx(ShortDatePick, { setDate: setDate, isSecondDatePicker: this.props.isSecondDatePicker }), this.props.timeFormat && _jsx(Timepicker, { setTime: setTime, value: value, disabled: disabled })] }) }) }));
126
+ return (_jsx("tfoot", { children: _jsx("tr", { children: _jsxs("td", { colSpan: 7, children: [onChangeOthers && _jsx(DateRepeater, { onChangeOthers: onChangeOthers, others: others, reset: reset }), this.props.timeFormat && (_jsx(Timepicker, { setTime: setTime, value: value, disabled: disabled || (!value && !(others === null || others === void 0 ? void 0 : others.dateTypeRepeater)), others: others, onChangeOthers: onChangeOthers, isSecondDatePicker: this.props.isSecondDatePicker }))] }) }) }));
121
127
  };
122
128
  DaysView.defaultProps = {
123
129
  isValidDate: function () { return true; },
@@ -0,0 +1,12 @@
1
+ export declare enum DatePickerRepeat {
2
+ EVERY_TODAY = "every-today",
3
+ EVERY_YESTERDAY = "every-yesterday",
4
+ EVERY_LAST_WEEK = "every-last-week"
5
+ }
6
+ export declare const DatePickerRepeatTrans: Record<DatePickerRepeat, string>;
7
+ export declare enum TimePickerRepeat {
8
+ FROM = "from",
9
+ TO = "to",
10
+ AT = "at"
11
+ }
12
+ export declare const TimePickerRepeatTrans: Record<TimePickerRepeat, string>;