@mailstep/design-system 0.13.1 → 0.13.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/package.json +1 -1
- package/ui/Blocks/Scheduler/components/DateChanger/index.d.ts +1 -1
- package/ui/Blocks/Scheduler/components/DateChanger/index.js +1 -1
- package/ui/Blocks/Scheduler/hooks/useChangeDate.d.ts +1 -1
- package/ui/{Elements → Forms}/DatePicker/DatePicker.d.ts +1 -1
- package/ui/{Elements → Forms}/DatePicker/DatePicker.js +2 -2
- package/ui/{Elements → Forms}/DatePicker/Datetime/DateTime.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/DateRepeater.js +14 -8
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/FooterRow.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/FooterRowLabel.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/TimeInput.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/Timepicker.js +3 -3
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/constants.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/styles.js +8 -2
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/isTimeFieldComplete.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/padTime.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/parseTimeField.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/sanitizeTimeField.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/components/ViewNavigation.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/types.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/views/DaysView.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/views/MonthsView.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/Datetime/views/YearsView.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/DatePickerInput.js +2 -2
- package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/constants.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/applyDateMask.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/countDigits.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/getMaskedCaretPosition.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/isMaskableFormat.js +1 -1
- package/ui/{Elements → Forms}/DatePicker/index.js +1 -1
- package/ui/Forms/DatePicker/stories/hooks/useOnChange.d.ts +5 -0
- package/ui/Forms/DatePicker/stories/hooks/useOnChange.js +13 -0
- package/ui/{Elements → Forms}/DatePicker/styles.js +15 -6
- package/ui/Forms/DatePicker/utils/constants.d.ts +3 -0
- package/ui/{Elements → Forms}/DatePicker/utils/constants.js +5 -5
- package/ui/{Elements → Forms}/DatePicker/utils/getInputFormat.js +1 -1
- package/ui/Forms/Input/styles.js +3 -9
- package/ui/Modules/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.d.ts +1 -1
- package/ui/Modules/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.js +1 -1
- package/ui/Modules/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.d.ts +1 -1
- package/ui/Modules/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.js +3 -3
- package/ui/index.d.ts +2 -2
- package/ui/index.js +2 -2
- package/ui/Elements/DatePicker/utils/constants.d.ts +0 -3
- /package/ui/{Elements → Forms}/DatePicker/Datetime/DateTime.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/DateRepeater.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/FooterRow.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/FooterRowLabel.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/TimeInput.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/Timepicker.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/constants.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/index.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/index.js +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/styles.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/index.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/index.js +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/isTimeFieldComplete.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/padTime.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/parseTimeField.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/sanitizeTimeField.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/components/ViewNavigation.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/types.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/views/DaysView.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/views/MonthsView.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/Datetime/views/YearsView.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/DatePickerInput.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/constants.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/index.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/index.js +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/applyDateMask.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/countDigits.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/getMaskedCaretPosition.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/index.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/index.js +0 -0
- /package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/isMaskableFormat.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/index.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/styles.d.ts +0 -0
- /package/ui/{Elements → Forms}/DatePicker/utils/getInputFormat.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import { type DatePickerType } from '../../../../
|
|
2
|
+
import { type DatePickerType } from '../../../../Forms/DatePicker/DatePicker';
|
|
3
3
|
type DateChangerProps = {
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
isDatepickerOpen: boolean;
|
|
@@ -2,7 +2,7 @@ import { ArrowDown } from "../../../../Elements/Icon/icons/ArrowDown.js";
|
|
|
2
2
|
import "../../../../Elements/Icon/index.js";
|
|
3
3
|
import { Spinner } from "../../../../Elements/Spinner/Spinner.js";
|
|
4
4
|
import { LanguageContext } from "../../../../ThemeProvider/ThemeProvider.js";
|
|
5
|
-
import DatePicker_default from "../../../../
|
|
5
|
+
import DatePicker_default from "../../../../Forms/DatePicker/index.js";
|
|
6
6
|
import Popover from "../../../Popover/index.js";
|
|
7
7
|
import { formatDate } from "../../utils/formatDate.js";
|
|
8
8
|
import { ArrowContainer, DateChangerContainer } from "./styles.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { SpaceAround } from '
|
|
2
|
+
import type { SpaceAround } from '../../Elements/SpaceAround';
|
|
3
3
|
import type { DateTimeOthers, DatetimepickerProps } from './Datetime/types';
|
|
4
4
|
import 'moment/dist/locale/cs';
|
|
5
5
|
import 'moment/dist/locale/el';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LanguageContext } from "../../ThemeProvider/ThemeProvider.js";
|
|
2
|
-
import SpaceAround_default from "
|
|
2
|
+
import SpaceAround_default from "../../Elements/SpaceAround/index.js";
|
|
3
3
|
import Datetime from "./Datetime/DateTime.js";
|
|
4
4
|
import { DatePickerInput } from "./components/DatePickerInput/DatePickerInput.js";
|
|
5
5
|
import "./components/DatePickerInput/index.js";
|
|
@@ -13,7 +13,7 @@ import "moment/dist/locale/el";
|
|
|
13
13
|
import "moment/dist/locale/it";
|
|
14
14
|
import "moment/dist/locale/ru";
|
|
15
15
|
import "moment/dist/locale/sk";
|
|
16
|
-
//#region packages/ui/
|
|
16
|
+
//#region packages/ui/Forms/DatePicker/DatePicker.tsx
|
|
17
17
|
const defaultDateFormat = "DD.MM.YYYY";
|
|
18
18
|
const DatePicker = ({ name, value, initialViewDate, error, label, disabled, isValidDate, onChange, dateFormat = defaultDateFormat, timeFormat = false, open, secondValue = null, input, icon = true, showInputLabel = false, showCalendarLabel = true, spaceAround = false, className, onClear, onInputChange, ...passProps }) => {
|
|
19
19
|
const locale = useContext(LanguageContext);
|
|
@@ -5,7 +5,7 @@ import React from "react";
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import moment from "moment";
|
|
7
7
|
import onClickOutside from "react-onclickoutside";
|
|
8
|
-
//#region packages/ui/
|
|
8
|
+
//#region packages/ui/Forms/DatePicker/Datetime/DateTime.tsx
|
|
9
9
|
const viewModes = {
|
|
10
10
|
YEARS: "years",
|
|
11
11
|
MONTHS: "months",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Icon_default from "
|
|
1
|
+
import Icon_default from "../../../../Elements/Icon/index.js";
|
|
2
2
|
import "../types.js";
|
|
3
3
|
import { DatePickerRepeatTrans } from "../../utils/constants.js";
|
|
4
4
|
import { FooterRow } from "./FooterRow.js";
|
|
@@ -7,7 +7,7 @@ import { useCallback } from "react";
|
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { x } from "@xstyled/styled-components";
|
|
9
9
|
import { i18n } from "@lingui/core";
|
|
10
|
-
//#region packages/ui/
|
|
10
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/DateRepeater.tsx
|
|
11
11
|
const DateRepeater = ({ onChangeOthers, others, reset }) => {
|
|
12
12
|
const handleChange = useCallback((e) => {
|
|
13
13
|
const dateTypeRepeater = e.target.value;
|
|
@@ -40,24 +40,30 @@ const DateRepeater = ({ onChangeOthers, others, reset }) => {
|
|
|
40
40
|
onChange: handleChange,
|
|
41
41
|
value: others?.dateTypeRepeater,
|
|
42
42
|
backgroundColor: "transparent",
|
|
43
|
-
color: "
|
|
43
|
+
color: "typoPrimary",
|
|
44
44
|
cursor: "pointer",
|
|
45
45
|
border: "none",
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
47
|
+
/* @__PURE__ */ jsx(x.option, {
|
|
48
|
+
color: "#333",
|
|
49
|
+
backgroundColor: "#fff",
|
|
48
50
|
value: "",
|
|
49
51
|
children: i18n._({
|
|
50
52
|
id: "dataGrid.noRepeat",
|
|
51
53
|
message: "No repeat"
|
|
52
54
|
})
|
|
53
55
|
}),
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
56
|
+
/* @__PURE__ */ jsx(x.option, {
|
|
57
|
+
color: "#333",
|
|
58
|
+
backgroundColor: "#fff",
|
|
55
59
|
value: "every-today",
|
|
56
|
-
children: DatePickerRepeatTrans["every-today"]
|
|
60
|
+
children: DatePickerRepeatTrans()["every-today"]
|
|
57
61
|
}),
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
62
|
+
/* @__PURE__ */ jsx(x.option, {
|
|
63
|
+
color: "#333",
|
|
64
|
+
backgroundColor: "#fff",
|
|
59
65
|
value: "every-yesterday",
|
|
60
|
-
children: DatePickerRepeatTrans["every-yesterday"]
|
|
66
|
+
children: DatePickerRepeatTrans()["every-yesterday"]
|
|
61
67
|
})
|
|
62
68
|
]
|
|
63
69
|
})] })
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled } from "@xstyled/styled-components";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/FooterRow.tsx
|
|
3
3
|
const FooterRow = styled.div`
|
|
4
4
|
display: flex;
|
|
5
5
|
justify-content: space-between;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled$1 from "@xstyled/styled-components";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/FooterRowLabel.tsx
|
|
3
3
|
const FooterRowLabel = styled$1.span`
|
|
4
4
|
margin-left: 8px;
|
|
5
5
|
text-align: left;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled$1 from "@xstyled/styled-components";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/TimeInput.tsx
|
|
3
3
|
const TimeInput = styled$1.input`
|
|
4
4
|
margin: 0;
|
|
5
5
|
margin-right: -1px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Icon_default from "../../../../../Elements/Icon/index.js";
|
|
2
2
|
import { FooterRow } from "../FooterRow.js";
|
|
3
3
|
import { FooterRowLabel } from "../FooterRowLabel.js";
|
|
4
4
|
import "./constants.js";
|
|
@@ -12,7 +12,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { x } from "@xstyled/styled-components";
|
|
14
14
|
import { i18n } from "@lingui/core";
|
|
15
|
-
//#region packages/ui/
|
|
15
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/Timepicker/Timepicker.tsx
|
|
16
16
|
const Timepicker = ({ setTime, value, disabled }) => {
|
|
17
17
|
const hours = value?.getHours?.() ?? 0;
|
|
18
18
|
const minutes = value?.getMinutes?.() ?? 0;
|
|
@@ -112,7 +112,7 @@ const Timepicker = ({ setTime, value, disabled }) => {
|
|
|
112
112
|
}, [minutes]);
|
|
113
113
|
return /* @__PURE__ */ jsxs(FooterRow, {
|
|
114
114
|
disabled,
|
|
115
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(
|
|
115
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Icon_default, { icon: "clock" }), /* @__PURE__ */ jsx(FooterRowLabel, { children: i18n._({
|
|
116
116
|
id: "dataGrid.filterCell.time",
|
|
117
117
|
message: "Time"
|
|
118
118
|
}) })] }), /* @__PURE__ */ jsx(x.div, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled$1 from "@xstyled/styled-components";
|
|
2
2
|
import { th as th$1 } from "@xstyled/system";
|
|
3
|
-
//#region packages/ui/
|
|
3
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/Timepicker/styles.ts
|
|
4
4
|
const TimeButton = styled$1.button`
|
|
5
5
|
transform: rotate(90deg);
|
|
6
6
|
font-size: 20px;
|
|
@@ -10,14 +10,20 @@ const TimeButton = styled$1.button`
|
|
|
10
10
|
background-color: transparent !important;
|
|
11
11
|
border: none;
|
|
12
12
|
color: ${th$1("colors.lightGray4")};
|
|
13
|
+
|
|
13
14
|
&:disabled:hover {
|
|
14
15
|
color: ${th$1("colors.lightGray4")};
|
|
15
16
|
cursor: default;
|
|
16
17
|
}
|
|
18
|
+
|
|
17
19
|
&:hover {
|
|
18
20
|
color: ${th$1("colors.red2")};
|
|
19
21
|
background-color: transparent !important;
|
|
20
22
|
}
|
|
23
|
+
|
|
24
|
+
&:focus {
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
21
27
|
`;
|
|
22
28
|
const TimeWrapper = styled$1.div`
|
|
23
29
|
display: flex;
|
|
@@ -39,7 +45,7 @@ const TimeField = styled$1.input`
|
|
|
39
45
|
border: none;
|
|
40
46
|
outline: none;
|
|
41
47
|
background-color: transparent;
|
|
42
|
-
color:
|
|
48
|
+
color: typoPrimary;
|
|
43
49
|
&:disabled {
|
|
44
50
|
opacity: 0.5;
|
|
45
51
|
}
|
package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/isTimeFieldComplete.js
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../constants.js";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/Timepicker/utils/isTimeFieldComplete.ts
|
|
3
3
|
const isTimeFieldComplete = (text, value, max) => text.length >= 2 || value * 10 > max;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { isTimeFieldComplete };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region packages/ui/
|
|
1
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/Timepicker/utils/padTime.ts
|
|
2
2
|
const padTime = (value) => String(value).padStart(2, "0");
|
|
3
3
|
//#endregion
|
|
4
4
|
export { padTime };
|
package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/parseTimeField.js
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region packages/ui/
|
|
1
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/Timepicker/utils/parseTimeField.ts
|
|
2
2
|
const parseTimeField = (text, fallback) => {
|
|
3
3
|
if (text === "") return fallback;
|
|
4
4
|
const parsed = Number(text);
|
package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/sanitizeTimeField.js
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../constants.js";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/Timepicker/utils/sanitizeTimeField.ts
|
|
3
3
|
const sanitizeTimeField = (text) => text.replace(/\D/g, "").slice(0, 2);
|
|
4
4
|
//#endregion
|
|
5
5
|
export { sanitizeTimeField };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
//#region packages/ui/
|
|
3
|
+
//#region packages/ui/Forms/DatePicker/Datetime/components/ViewNavigation.tsx
|
|
4
4
|
function ViewNavigation({ onClickPrev, onClickSwitch, onClickNext, switchContent, switchColSpan, switchProps, label }) {
|
|
5
5
|
return /* @__PURE__ */ jsxs("tr", { children: [
|
|
6
6
|
/* @__PURE__ */ jsx("th", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region packages/ui/
|
|
1
|
+
//#region packages/ui/Forms/DatePicker/Datetime/types.ts
|
|
2
2
|
let DatePickerRepeat = /* @__PURE__ */ function(DatePickerRepeat) {
|
|
3
3
|
DatePickerRepeat["EVERY_TODAY"] = "every-today";
|
|
4
4
|
DatePickerRepeat["EVERY_YESTERDAY"] = "every-yesterday";
|
|
@@ -4,7 +4,7 @@ import "../components/Timepicker/index.js";
|
|
|
4
4
|
import ViewNavigation from "../components/ViewNavigation.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
//#region packages/ui/
|
|
7
|
+
//#region packages/ui/Forms/DatePicker/Datetime/views/DaysView.tsx
|
|
8
8
|
var DaysView = class extends React.Component {
|
|
9
9
|
constructor(..._args) {
|
|
10
10
|
super(..._args);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ViewNavigation from "../components/ViewNavigation.js";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
//#region packages/ui/
|
|
4
|
+
//#region packages/ui/Forms/DatePicker/Datetime/views/MonthsView.tsx
|
|
5
5
|
var MonthsView = class extends React.Component {
|
|
6
6
|
constructor(..._args) {
|
|
7
7
|
super(..._args);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ViewNavigation from "../components/ViewNavigation.js";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
//#region packages/ui/
|
|
4
|
+
//#region packages/ui/Forms/DatePicker/Datetime/views/YearsView.tsx
|
|
5
5
|
var YearsView = class extends React.Component {
|
|
6
6
|
constructor(..._args) {
|
|
7
7
|
super(..._args);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Input_default from "
|
|
1
|
+
import Input_default from "../../../Input/index.js";
|
|
2
2
|
import { applyDateMask } from "./utils/applyDateMask.js";
|
|
3
3
|
import { countDigits } from "./utils/countDigits.js";
|
|
4
4
|
import { getMaskedCaretPosition } from "./utils/getMaskedCaretPosition.js";
|
|
5
5
|
import { isMaskableFormat } from "./utils/isMaskableFormat.js";
|
|
6
6
|
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
//#region packages/ui/
|
|
8
|
+
//#region packages/ui/Forms/DatePicker/components/DatePickerInput/DatePickerInput.tsx
|
|
9
9
|
const DatePickerInput = ({ inputProps, openCalendar, format, name, label, error, disabled, icon, showInputLabel, onClear, onInputChange }) => {
|
|
10
10
|
const [typedValue, setTypedValue] = useState(null);
|
|
11
11
|
const inputRef = useRef(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FORMAT_SLOT_PATTERN, NON_DIGIT_PATTERN } from "../constants.js";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/components/DatePickerInput/utils/applyDateMask.ts
|
|
3
3
|
const applyDateMask = (value, format) => {
|
|
4
4
|
const digits = value.replace(NON_DIGIT_PATTERN, "");
|
|
5
5
|
let masked = "";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NON_DIGIT_PATTERN } from "../constants.js";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/components/DatePickerInput/utils/countDigits.ts
|
|
3
3
|
const countDigits = (text) => text.replace(NON_DIGIT_PATTERN, "").length;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { countDigits };
|
package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/getMaskedCaretPosition.js
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DIGIT_PATTERN } from "../constants.js";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/components/DatePickerInput/utils/getMaskedCaretPosition.ts
|
|
3
3
|
const getMaskedCaretPosition = (maskedValue, digitsBeforeCaret) => {
|
|
4
4
|
if (digitsBeforeCaret <= 0) return 0;
|
|
5
5
|
let digits = 0;
|
package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/isMaskableFormat.js
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FORMAT_TOKEN_PATTERN, MASKABLE_TOKENS } from "../constants.js";
|
|
2
|
-
//#region packages/ui/
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/components/DatePickerInput/utils/isMaskableFormat.ts
|
|
3
3
|
const isMaskableFormat = (format) => {
|
|
4
4
|
const tokens = format.match(FORMAT_TOKEN_PATTERN);
|
|
5
5
|
if (!tokens?.length) return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DatePickerRepeat, TimePickerRepeat } from "./Datetime/types.js";
|
|
2
2
|
import DatePicker_default$1 from "./DatePicker.js";
|
|
3
|
-
//#region packages/ui/
|
|
3
|
+
//#region packages/ui/Forms/DatePicker/index.ts
|
|
4
4
|
var DatePicker_default = DatePicker_default$1;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { DatePickerRepeat, TimePickerRepeat, DatePicker_default as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
//#region packages/ui/Forms/DatePicker/stories/hooks/useOnChange.ts
|
|
3
|
+
const useOnChange = () => {
|
|
4
|
+
const [value, setValue] = useState("");
|
|
5
|
+
return {
|
|
6
|
+
value,
|
|
7
|
+
handleChange: useCallback((next) => {
|
|
8
|
+
setValue(next);
|
|
9
|
+
}, [])
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useOnChange };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled$1, { x } from "@xstyled/styled-components";
|
|
2
2
|
import { th as th$1 } from "@xstyled/system";
|
|
3
|
-
//#region packages/ui/
|
|
3
|
+
//#region packages/ui/Forms/DatePicker/styles.ts
|
|
4
4
|
const DatePickerBase = styled$1(x.div)`
|
|
5
5
|
.rdt {
|
|
6
6
|
position: relative;
|
|
@@ -10,11 +10,11 @@ const DatePickerBase = styled$1(x.div)`
|
|
|
10
10
|
position: absolute;
|
|
11
11
|
z-index: 1;
|
|
12
12
|
min-width: 250px;
|
|
13
|
-
color:
|
|
14
|
-
background:
|
|
13
|
+
color: typoPrimary;
|
|
14
|
+
background-color: white;
|
|
15
15
|
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
16
16
|
border-radius: 10px;
|
|
17
|
-
box-shadow:
|
|
17
|
+
box-shadow: 0px 4px 16px 0px rgba(255, 255, 255, 0.3);
|
|
18
18
|
padding: 0.5rem 1.2rem;
|
|
19
19
|
margin: 0.125rem 0rem;
|
|
20
20
|
}
|
|
@@ -44,6 +44,10 @@ const DatePickerBase = styled$1(x.div)`
|
|
|
44
44
|
.rdtPicker td {
|
|
45
45
|
padding: 0 0.8rem;
|
|
46
46
|
}
|
|
47
|
+
.rdtDay:not(.rdtActiveRange):hover {
|
|
48
|
+
border-radius: 0.5rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
.rdtPicker .rdtCounter .rdtBtn:hover,
|
|
48
52
|
.rdtPicker .rdtYear:hover,
|
|
49
53
|
.rdtPicker .rdtMonth:hover,
|
|
@@ -54,11 +58,12 @@ const DatePickerBase = styled$1(x.div)`
|
|
|
54
58
|
.rdtPicker .rdtTimeToggle:hover,
|
|
55
59
|
.rdtPicker .rdtSwitch:hover {
|
|
56
60
|
background: #f8f9fa;
|
|
61
|
+
color: gray4;
|
|
57
62
|
cursor: pointer;
|
|
58
63
|
}
|
|
59
64
|
.rdtPicker .rdtOld,
|
|
60
65
|
.rdtPicker .rdtNew {
|
|
61
|
-
color:
|
|
66
|
+
color: lightGray4;
|
|
62
67
|
}
|
|
63
68
|
.rdtPicker .rdtToday {
|
|
64
69
|
position: relative;
|
|
@@ -191,7 +196,11 @@ const DatePickerBase = styled$1(x.div)`
|
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
.rdtPicker .rdtActiveRange {
|
|
194
|
-
background:
|
|
199
|
+
background-color: blue10;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.rdtPicker .rdtActiveRange:hover {
|
|
203
|
+
border-radius: 0.5rem;
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
.rdtPicker .rdtCounters > div :first-child {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../Datetime/types.js";
|
|
2
2
|
import { i18n } from "@lingui/core";
|
|
3
|
-
//#region packages/ui/
|
|
4
|
-
const DatePickerRepeatTrans = {
|
|
3
|
+
//#region packages/ui/Forms/DatePicker/utils/constants.ts
|
|
4
|
+
const DatePickerRepeatTrans = () => ({
|
|
5
5
|
["every-today"]: i18n._({
|
|
6
6
|
id: "dataGrid.everyToday",
|
|
7
7
|
message: "Every today"
|
|
@@ -10,8 +10,8 @@ const DatePickerRepeatTrans = {
|
|
|
10
10
|
id: "dataGrid.everyYesterday",
|
|
11
11
|
message: "Every yesterday"
|
|
12
12
|
})
|
|
13
|
-
};
|
|
14
|
-
const TimePickerRepeatTrans = {
|
|
13
|
+
});
|
|
14
|
+
const TimePickerRepeatTrans = () => ({
|
|
15
15
|
["from"]: i18n._({
|
|
16
16
|
id: "dataGrid.timepicker.from",
|
|
17
17
|
message: "from"
|
|
@@ -24,6 +24,6 @@ const TimePickerRepeatTrans = {
|
|
|
24
24
|
id: "dataGrid.timepicker.at",
|
|
25
25
|
message: "at"
|
|
26
26
|
})
|
|
27
|
-
};
|
|
27
|
+
});
|
|
28
28
|
//#endregion
|
|
29
29
|
export { DatePickerRepeatTrans, TimePickerRepeatTrans };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region packages/ui/
|
|
1
|
+
//#region packages/ui/Forms/DatePicker/utils/getInputFormat.ts
|
|
2
2
|
const getInputFormat = (dateFormat, timeFormat) => {
|
|
3
3
|
const date = typeof dateFormat === "string" ? dateFormat : "";
|
|
4
4
|
const time = typeof timeFormat === "string" ? timeFormat : "";
|
package/ui/Forms/Input/styles.js
CHANGED
|
@@ -19,7 +19,7 @@ const InputIcon = styled$1.div`
|
|
|
19
19
|
svg {
|
|
20
20
|
stroke: lightGray3;
|
|
21
21
|
cursor: pointer;
|
|
22
|
-
color: ${({ $isInvalid, hasValue, disabled }) => $isInvalid ? th.color("inputErrorColor") : disabled || !hasValue ? th.color("lightGray6") : th.color("
|
|
22
|
+
color: ${({ $isInvalid, hasValue, disabled }) => $isInvalid ? th.color("inputErrorColor") : disabled || !hasValue ? th.color("lightGray6") : th.color("typoPrimary")};
|
|
23
23
|
}
|
|
24
24
|
`;
|
|
25
25
|
const ClearableInputIcon = styled$1(InputIcon)`
|
|
@@ -60,12 +60,6 @@ const StyledInput = styled$1.input.attrs((props) => ({ as: props.$asTextArea ? "
|
|
|
60
60
|
resize: none;
|
|
61
61
|
overflow: hidden;
|
|
62
62
|
|
|
63
|
-
~ ${InputIcon} {
|
|
64
|
-
svg {
|
|
65
|
-
stroke: lightGray3;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
63
|
::placeholder {
|
|
70
64
|
color: gray1;
|
|
71
65
|
opacity: 1;
|
|
@@ -79,8 +73,8 @@ const StyledInput = styled$1.input.attrs((props) => ({ as: props.$asTextArea ? "
|
|
|
79
73
|
|
|
80
74
|
~ ${InputIcon} {
|
|
81
75
|
svg {
|
|
82
|
-
stroke:
|
|
83
|
-
color:
|
|
76
|
+
stroke: typoPrimary;
|
|
77
|
+
color: typoPrimary;
|
|
84
78
|
}
|
|
85
79
|
}
|
|
86
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import type { DateTimeOthers } from '../../../../../
|
|
2
|
+
import type { DateTimeOthers } from '../../../../../Forms/DatePicker/Datetime/types';
|
|
3
3
|
import type { FilterComponentProps } from '../../../types';
|
|
4
4
|
type InitialView = 'past' | 'future';
|
|
5
5
|
type DatePickerRangeProps = FilterComponentProps<Date[]> & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useClickOutside } from "../../../../../Blocks/Modal/hooks/useClickOutside.js";
|
|
2
2
|
import Input_default from "../../../../../Forms/Input/index.js";
|
|
3
|
-
import DatePicker_default from "../../../../../
|
|
3
|
+
import DatePicker_default from "../../../../../Forms/DatePicker/index.js";
|
|
4
4
|
import { getCleanValues } from "./utils/getCleanValues.js";
|
|
5
5
|
import { pickerRangeToString } from "./utils/pickerRangeToString.js";
|
|
6
6
|
import React, { useCallback, useMemo, useState } from "react";
|
package/ui/Modules/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DateTimeOthers } from '../../../../../../
|
|
1
|
+
import type { DateTimeOthers } from '../../../../../../Forms/DatePicker/Datetime/types';
|
|
2
2
|
export declare const pickerRangeToString: (values?: Date[], others?: DateTimeOthers[]) => string;
|
package/ui/Modules/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DatePickerRepeatTrans, TimePickerRepeatTrans } from "../../../../../../
|
|
1
|
+
import { DatePickerRepeatTrans, TimePickerRepeatTrans } from "../../../../../../Forms/DatePicker/utils/constants.js";
|
|
2
2
|
import { sameDate } from "./sameDate.js";
|
|
3
3
|
import { DateTime } from "luxon";
|
|
4
4
|
//#region packages/ui/Modules/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.ts
|
|
5
5
|
const pickerRangeToString = (values = [], others) => {
|
|
6
6
|
if (others?.[0]?.dateTypeRepeater || others?.[1]?.dateTypeRepeater) return others.map((other, i) => {
|
|
7
7
|
if (!other?.dateTypeRepeater) return values[i] && DateTime.fromJSDate(values[i]).toFormat("dd.LL.yyyy HH:mm");
|
|
8
|
-
const repeaterDate = DatePickerRepeatTrans[other?.dateTypeRepeater];
|
|
9
|
-
return `${i === 0 ? TimePickerRepeatTrans.from : TimePickerRepeatTrans.to} ${repeaterDate} ${other?.time ? `${String(other?.time.h).padStart(2, "0")}:${String(other?.time.m).padStart(2, "0")}` : ""}`.trim();
|
|
8
|
+
const repeaterDate = DatePickerRepeatTrans()[other?.dateTypeRepeater];
|
|
9
|
+
return `${i === 0 ? TimePickerRepeatTrans().from : TimePickerRepeatTrans().to} ${repeaterDate} ${other?.time ? `${String(other?.time.h).padStart(2, "0")}:${String(other?.time.m).padStart(2, "0")}` : ""}`.trim();
|
|
10
10
|
}).filter(Boolean).join(" - ");
|
|
11
11
|
if (!values[0] && !values[1]) return "";
|
|
12
12
|
if (values[0] && !values[1] || sameDate(values[0], values[1])) return DateTime.fromJSDate(values[0]).toFormat("dd.LL.yyyy");
|
package/ui/index.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ import Badge from './Elements/Badge';
|
|
|
17
17
|
import BorderedBox from './Elements/BorderedBox';
|
|
18
18
|
import Button from './Elements/Button';
|
|
19
19
|
import Card from './Elements/Card';
|
|
20
|
-
import DatePicker from './Elements/DatePicker';
|
|
21
20
|
import Dropdown from './Elements/Dropdown';
|
|
22
21
|
import DropdownSelect from './Elements/DropdownSelect';
|
|
23
22
|
import ErrorMessage from './Elements/ErrorMessage';
|
|
@@ -39,6 +38,7 @@ import Tag from './Elements/Tag';
|
|
|
39
38
|
import Toast from './Elements/Toast';
|
|
40
39
|
import Toggle from './Elements/Toggle';
|
|
41
40
|
import Typography from './Elements/Typography';
|
|
41
|
+
import DatePicker from './Forms/DatePicker';
|
|
42
42
|
import Checkbox from './Forms/Checkbox';
|
|
43
43
|
import Input from './Forms/Input';
|
|
44
44
|
import RadioButton from './Forms/RadioButton';
|
|
@@ -81,7 +81,7 @@ export * from './Forms/Input';
|
|
|
81
81
|
export * from './Forms/RadioButton';
|
|
82
82
|
export * from './ThemeProvider';
|
|
83
83
|
export * from './utils';
|
|
84
|
-
export * from './
|
|
84
|
+
export * from './Forms/DatePicker';
|
|
85
85
|
export * from './Modules/CommonGrid';
|
|
86
86
|
export * from './Blocks/Popover';
|
|
87
87
|
export * from './Elements/SingleSelect';
|
package/ui/index.js
CHANGED
|
@@ -133,9 +133,9 @@ import SpaceAroundWrap from "./Elements/SpaceAround/SpaceAround.js";
|
|
|
133
133
|
import SpaceAround_default from "./Elements/SpaceAround/index.js";
|
|
134
134
|
import Select_default from "./Elements/Select/index.js";
|
|
135
135
|
import SingleSelect_default from "./Elements/SingleSelect/index.js";
|
|
136
|
-
import { DatePickerRepeat, TimePickerRepeat } from "./
|
|
136
|
+
import { DatePickerRepeat, TimePickerRepeat } from "./Forms/DatePicker/Datetime/types.js";
|
|
137
137
|
import Input_default from "./Forms/Input/index.js";
|
|
138
|
-
import DatePicker_default from "./
|
|
138
|
+
import DatePicker_default from "./Forms/DatePicker/index.js";
|
|
139
139
|
import { useEvent } from "./Modules/CommonGrid/hooks/useEvent.js";
|
|
140
140
|
import { useAddFilter } from "./Modules/CommonGrid/hooks/useAddFilter.js";
|
|
141
141
|
import { types_exports } from "./Modules/CommonGrid/types.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ui/{Elements → Forms}/DatePicker/Datetime/components/Timepicker/utils/parseTimeField.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/applyDateMask.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ui/{Elements → Forms}/DatePicker/components/DatePickerInput/utils/isMaskableFormat.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|