@salutejs/plasma-new-hope 0.135.0-canary.1361.10634067686.0 → 0.135.0-canary.1404.10630068652.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js.map +1 -1
- package/cjs/components/DatePicker/RangeDate/RangeDate.js +19 -9
- package/cjs/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- package/cjs/components/DatePicker/SingleDate/SingleDate.js +12 -5
- package/cjs/components/DatePicker/SingleDate/SingleDate.js.map +1 -1
- package/cjs/components/DatePicker/hooks/useDatePicker.js +9 -7
- package/cjs/components/DatePicker/hooks/useDatePicker.js.map +1 -1
- package/cjs/components/DatePicker/utils/dateHelper.js +13 -13
- package/cjs/components/DatePicker/utils/dateHelper.js.map +1 -1
- package/cjs/utils/datejs.js +2 -0
- package/cjs/utils/datejs.js.map +1 -1
- package/emotion/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/emotion/cjs/components/DatePicker/DatePicker.template-doc.mdx +32 -0
- package/emotion/cjs/components/DatePicker/RangeDate/RangeDate.js +19 -9
- package/emotion/cjs/components/DatePicker/SingleDate/SingleDate.js +12 -5
- package/emotion/cjs/components/DatePicker/hooks/useDatePicker.js +9 -7
- package/emotion/cjs/components/DatePicker/utils/dateHelper.js +13 -13
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/DatePicker/DatePicker.stories.tsx +33 -0
- package/emotion/cjs/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/Toolbar/Toolbar.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/Tooltip/Tooltip.config.js +3 -3
- package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/DatePicker/DatePicker.stories.tsx +34 -0
- package/emotion/cjs/examples/plasma_web/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Toast/Toast.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Toolbar/Toolbar.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Tooltip/Tooltip.config.js +3 -3
- package/emotion/cjs/utils/datejs.js +2 -0
- package/emotion/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/emotion/es/components/DatePicker/DatePicker.template-doc.mdx +32 -0
- package/emotion/es/components/DatePicker/RangeDate/RangeDate.js +19 -9
- package/emotion/es/components/DatePicker/SingleDate/SingleDate.js +12 -5
- package/emotion/es/components/DatePicker/hooks/useDatePicker.js +9 -7
- package/emotion/es/components/DatePicker/utils/dateHelper.js +13 -13
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/DatePicker/DatePicker.stories.tsx +33 -0
- package/emotion/es/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/Toast/Toast.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/Toolbar/Toolbar.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/Tooltip/Tooltip.config.js +3 -3
- package/emotion/es/examples/plasma_web/components/Combobox/Combobox.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/DatePicker/DatePicker.stories.tsx +34 -0
- package/emotion/es/examples/plasma_web/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Toast/Toast.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Toolbar/Toolbar.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Tooltip/Tooltip.config.js +3 -3
- package/emotion/es/utils/datejs.js +2 -0
- package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js.map +1 -1
- package/es/components/DatePicker/RangeDate/RangeDate.js +19 -9
- package/es/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- package/es/components/DatePicker/SingleDate/SingleDate.js +12 -5
- package/es/components/DatePicker/SingleDate/SingleDate.js.map +1 -1
- package/es/components/DatePicker/hooks/useDatePicker.js +9 -7
- package/es/components/DatePicker/hooks/useDatePicker.js.map +1 -1
- package/es/components/DatePicker/utils/dateHelper.js +13 -13
- package/es/components/DatePicker/utils/dateHelper.js.map +1 -1
- package/es/utils/datejs.js +2 -0
- package/es/utils/datejs.js.map +1 -1
- package/package.json +4 -4
- package/styled-components/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/styled-components/cjs/components/DatePicker/DatePicker.template-doc.mdx +32 -0
- package/styled-components/cjs/components/DatePicker/RangeDate/RangeDate.js +19 -9
- package/styled-components/cjs/components/DatePicker/SingleDate/SingleDate.js +12 -5
- package/styled-components/cjs/components/DatePicker/hooks/useDatePicker.js +9 -7
- package/styled-components/cjs/components/DatePicker/utils/dateHelper.js +13 -13
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/DatePicker/DatePicker.stories.tsx +33 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +3 -3
- package/styled-components/cjs/examples/plasma_b2c/components/Toolbar/Toolbar.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Tooltip/Tooltip.config.js +3 -3
- package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/DatePicker/DatePicker.stories.tsx +34 -0
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.config.js +3 -3
- package/styled-components/cjs/examples/plasma_web/components/Toolbar/Toolbar.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Tooltip/Tooltip.config.js +3 -3
- package/styled-components/cjs/utils/datejs.js +2 -0
- package/styled-components/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/styled-components/es/components/DatePicker/DatePicker.template-doc.mdx +32 -0
- package/styled-components/es/components/DatePicker/RangeDate/RangeDate.js +19 -9
- package/styled-components/es/components/DatePicker/SingleDate/SingleDate.js +12 -5
- package/styled-components/es/components/DatePicker/hooks/useDatePicker.js +9 -7
- package/styled-components/es/components/DatePicker/utils/dateHelper.js +13 -13
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/DatePicker/DatePicker.stories.tsx +33 -0
- package/styled-components/es/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.config.js +3 -3
- package/styled-components/es/examples/plasma_b2c/components/Toolbar/Toolbar.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Tooltip/Tooltip.config.js +3 -3
- package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/DatePicker/DatePicker.stories.tsx +34 -0
- package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Toast/Toast.config.js +3 -3
- package/styled-components/es/examples/plasma_web/components/Toolbar/Toolbar.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Tooltip/Tooltip.config.js +3 -3
- package/styled-components/es/utils/datejs.js +2 -0
- package/types/components/DatePicker/DatePickerBase.types.d.ts +6 -0
- package/types/components/DatePicker/DatePickerBase.types.d.ts.map +1 -1
- package/types/components/DatePicker/RangeDate/RangeDate.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.d.ts.map +1 -1
- package/types/components/DatePicker/hooks/useDatePicker.d.ts +1 -1
- package/types/components/DatePicker/hooks/useDatePicker.d.ts.map +1 -1
- package/types/components/DatePicker/utils/dateHelper.d.ts +4 -3
- package/types/components/DatePicker/utils/dateHelper.d.ts.map +1 -1
- package/types/utils/datejs.d.ts +2 -0
- package/types/utils/datejs.d.ts.map +1 -1
@@ -8,6 +8,8 @@ var useDatePicker = function useDatePicker(_ref) {
|
|
8
8
|
setIsInnerOpen = _ref.setIsInnerOpen,
|
9
9
|
dateFormatDelimiter = _ref.dateFormatDelimiter,
|
10
10
|
format = _ref.format,
|
11
|
+
_ref$lang = _ref.lang,
|
12
|
+
lang = _ref$lang === void 0 ? 'ru' : _ref$lang,
|
11
13
|
disabled = _ref.disabled,
|
12
14
|
readOnly = _ref.readOnly,
|
13
15
|
maskWithFormat = _ref.maskWithFormat,
|
@@ -38,9 +40,9 @@ var useDatePicker = function useDatePicker(_ref) {
|
|
38
40
|
if (!format) {
|
39
41
|
setCalendarValue(formatCalendarValue(newValue));
|
40
42
|
} else if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === format.length) {
|
41
|
-
setCalendarValue(formatCalendarValue(newValue, format));
|
43
|
+
setCalendarValue(formatCalendarValue(newValue, format, lang));
|
42
44
|
}
|
43
|
-
setInputValue(formatInputValue(newValue, format));
|
45
|
+
setInputValue(formatInputValue(newValue, format, lang));
|
44
46
|
onChangeValue === null || onChangeValue === void 0 || onChangeValue(event, newValue);
|
45
47
|
};
|
46
48
|
var handleCommitDate = function handleCommitDate(date, applyFormat, isCalendarValue, dateInfo) {
|
@@ -53,17 +55,17 @@ var useDatePicker = function useDatePicker(_ref) {
|
|
53
55
|
return onCommitDate === null || onCommitDate === void 0 ? void 0 : onCommitDate('', false, true);
|
54
56
|
}
|
55
57
|
if (isCalendarValue) {
|
56
|
-
setCalendarValue(formatCalendarValue(date, format));
|
57
|
-
setInputValue(formatInputValue(date, format));
|
58
|
+
setCalendarValue(formatCalendarValue(date, format, lang));
|
59
|
+
setInputValue(formatInputValue(date, format, lang));
|
58
60
|
return onCommitDate === null || onCommitDate === void 0 ? void 0 : onCommitDate(date, false, true, dateInfo);
|
59
61
|
}
|
60
62
|
var formatString = applyFormat ? format : undefined;
|
61
|
-
var _getDateFromFormat = getDateFromFormat(date, formatString),
|
63
|
+
var _getDateFromFormat = getDateFromFormat(date, formatString, lang),
|
62
64
|
newDate = _getDateFromFormat.value,
|
63
65
|
isError = _getDateFromFormat.isError,
|
64
66
|
isSuccess = _getDateFromFormat.isSuccess;
|
65
|
-
setCalendarValue(formatCalendarValue(newDate, format));
|
66
|
-
setInputValue(formatInputValue(newDate, format));
|
67
|
+
setCalendarValue(formatCalendarValue(newDate, format, lang));
|
68
|
+
setInputValue(formatInputValue(newDate, format, lang));
|
67
69
|
onCommitDate === null || onCommitDate === void 0 || onCommitDate(newDate, isError, isSuccess);
|
68
70
|
};
|
69
71
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDatePicker.js","sources":["../../../../src/components/DatePicker/hooks/useDatePicker.ts"],"sourcesContent":["import { ChangeEvent, SyntheticEvent } from 'react';\n\nimport { classes } from '../DatePicker.tokens';\nimport type { UseDatePickerProps } from '../DatePickerBase.types';\nimport { formatCalendarValue, formatInputValue, getDateFromFormat, getMaskedDateOnInput } from '../utils/dateHelper';\nimport type { DateInfo } from '../../Calendar/Calendar.types';\n\nexport const useDatePicker = ({\n currentValue,\n setInputValue,\n setCalendarValue,\n setIsInnerOpen,\n dateFormatDelimiter,\n format,\n disabled,\n readOnly,\n maskWithFormat,\n valueError,\n valueSuccess,\n inputRef,\n onToggle,\n onChangeValue,\n onCommitDate,\n}: UseDatePickerProps) => {\n const datePickerErrorClass = valueError ? classes.datePickerError : undefined;\n const datePickerSuccessClass = valueSuccess ? classes.datePickerSuccess : undefined;\n\n const handleToggle = (opened: boolean, event: SyntheticEvent | Event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const isCalendarOpen = event.target === inputRef?.current ? true : opened;\n\n if (onToggle) {\n return onToggle(isCalendarOpen, event);\n }\n\n setIsInnerOpen(isCalendarOpen);\n };\n\n const handleChangeValue = (event: ChangeEvent<HTMLInputElement>) => {\n if (disabled || readOnly) {\n return;\n }\n const { value } = event.target;\n\n const newValue = maskWithFormat\n ? getMaskedDateOnInput(value, format, dateFormatDelimiter(), currentValue)\n : value;\n\n if (!format) {\n setCalendarValue(formatCalendarValue(newValue));\n } else if (newValue?.length === format.length) {\n setCalendarValue(formatCalendarValue(newValue, format));\n }\n\n setInputValue(formatInputValue(newValue, format));\n\n onChangeValue?.(event, newValue);\n };\n\n const handleCommitDate = (\n date?: Date | string,\n applyFormat?: boolean,\n isCalendarValue?: boolean,\n dateInfo?: DateInfo,\n ) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (!date) {\n setCalendarValue(undefined);\n setInputValue('');\n\n return onCommitDate?.('', false, true);\n }\n\n if (isCalendarValue) {\n setCalendarValue(formatCalendarValue(date, format));\n setInputValue(formatInputValue(date, format));\n\n return onCommitDate?.(date, false, true, dateInfo);\n }\n\n const formatString = applyFormat ? format : undefined;\n\n const { value: newDate, isError, isSuccess } = getDateFromFormat(date, formatString);\n\n setCalendarValue(formatCalendarValue(newDate, format));\n setInputValue(formatInputValue(newDate, format));\n\n onCommitDate?.(newDate, isError, isSuccess);\n };\n\n return {\n datePickerErrorClass,\n datePickerSuccessClass,\n handleToggle,\n handleChangeValue,\n handleCommitDate,\n };\n};\n"],"names":["useDatePicker","_ref","currentValue","setInputValue","setCalendarValue","setIsInnerOpen","dateFormatDelimiter","format","disabled","readOnly","maskWithFormat","valueError","valueSuccess","inputRef","onToggle","onChangeValue","onCommitDate","datePickerErrorClass","classes","datePickerError","undefined","datePickerSuccessClass","datePickerSuccess","handleToggle","opened","event","isCalendarOpen","target","current","handleChangeValue","value","newValue","getMaskedDateOnInput","formatCalendarValue","length","formatInputValue","handleCommitDate","date","applyFormat","isCalendarValue","dateInfo","formatString","_getDateFromFormat","getDateFromFormat","newDate","isError","isSuccess"],"mappings":";;;IAOaA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,
|
1
|
+
{"version":3,"file":"useDatePicker.js","sources":["../../../../src/components/DatePicker/hooks/useDatePicker.ts"],"sourcesContent":["import { ChangeEvent, SyntheticEvent } from 'react';\n\nimport { classes } from '../DatePicker.tokens';\nimport type { UseDatePickerProps } from '../DatePickerBase.types';\nimport { formatCalendarValue, formatInputValue, getDateFromFormat, getMaskedDateOnInput } from '../utils/dateHelper';\nimport type { DateInfo } from '../../Calendar/Calendar.types';\n\nexport const useDatePicker = ({\n currentValue,\n setInputValue,\n setCalendarValue,\n setIsInnerOpen,\n dateFormatDelimiter,\n format,\n lang = 'ru',\n disabled,\n readOnly,\n maskWithFormat,\n valueError,\n valueSuccess,\n inputRef,\n onToggle,\n onChangeValue,\n onCommitDate,\n}: UseDatePickerProps) => {\n const datePickerErrorClass = valueError ? classes.datePickerError : undefined;\n const datePickerSuccessClass = valueSuccess ? classes.datePickerSuccess : undefined;\n\n const handleToggle = (opened: boolean, event: SyntheticEvent | Event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const isCalendarOpen = event.target === inputRef?.current ? true : opened;\n\n if (onToggle) {\n return onToggle(isCalendarOpen, event);\n }\n\n setIsInnerOpen(isCalendarOpen);\n };\n\n const handleChangeValue = (event: ChangeEvent<HTMLInputElement>) => {\n if (disabled || readOnly) {\n return;\n }\n const { value } = event.target;\n\n const newValue = maskWithFormat\n ? getMaskedDateOnInput(value, format, dateFormatDelimiter(), currentValue)\n : value;\n\n if (!format) {\n setCalendarValue(formatCalendarValue(newValue));\n } else if (newValue?.length === format.length) {\n setCalendarValue(formatCalendarValue(newValue, format, lang));\n }\n\n setInputValue(formatInputValue(newValue, format, lang));\n\n onChangeValue?.(event, newValue);\n };\n\n const handleCommitDate = (\n date?: Date | string,\n applyFormat?: boolean,\n isCalendarValue?: boolean,\n dateInfo?: DateInfo,\n ) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (!date) {\n setCalendarValue(undefined);\n setInputValue('');\n\n return onCommitDate?.('', false, true);\n }\n\n if (isCalendarValue) {\n setCalendarValue(formatCalendarValue(date, format, lang));\n setInputValue(formatInputValue(date, format, lang));\n\n return onCommitDate?.(date, false, true, dateInfo);\n }\n\n const formatString = applyFormat ? format : undefined;\n\n const { value: newDate, isError, isSuccess } = getDateFromFormat(date, formatString, lang);\n\n setCalendarValue(formatCalendarValue(newDate, format, lang));\n setInputValue(formatInputValue(newDate, format, lang));\n\n onCommitDate?.(newDate, isError, isSuccess);\n };\n\n return {\n datePickerErrorClass,\n datePickerSuccessClass,\n handleToggle,\n handleChangeValue,\n handleCommitDate,\n };\n};\n"],"names":["useDatePicker","_ref","currentValue","setInputValue","setCalendarValue","setIsInnerOpen","dateFormatDelimiter","format","_ref$lang","lang","disabled","readOnly","maskWithFormat","valueError","valueSuccess","inputRef","onToggle","onChangeValue","onCommitDate","datePickerErrorClass","classes","datePickerError","undefined","datePickerSuccessClass","datePickerSuccess","handleToggle","opened","event","isCalendarOpen","target","current","handleChangeValue","value","newValue","getMaskedDateOnInput","formatCalendarValue","length","formatInputValue","handleCommitDate","date","applyFormat","isCalendarValue","dateInfo","formatString","_getDateFromFormat","getDateFromFormat","newDate","isError","isSuccess"],"mappings":";;;IAOaA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAiBA;AAAA,EAAA,IAhBtBC,YAAY,GAAAD,IAAA,CAAZC,YAAY;IACZC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IACbC,gBAAgB,GAAAH,IAAA,CAAhBG,gBAAgB;IAChBC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACdC,mBAAmB,GAAAL,IAAA,CAAnBK,mBAAmB;IACnBC,MAAM,GAAAN,IAAA,CAANM,MAAM;IAAAC,SAAA,GAAAP,IAAA,CACNQ,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,SAAA;IACXE,QAAQ,GA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|
3
|
-
var formatInputValue = function formatInputValue(value, format) {
|
4
|
-
if (!value) {
|
3
|
+
var formatInputValue = function formatInputValue(value, format, lang) {
|
4
|
+
if (!value || !lang) {
|
5
5
|
return '';
|
6
6
|
}
|
7
7
|
if (format && customDayjs(value, format, true).isValid()) {
|
8
|
-
return customDayjs(value, format).format(format);
|
8
|
+
return customDayjs(value, format).locale(lang).format(format);
|
9
9
|
}
|
10
10
|
if (format && String(value).length >= 10 && String(new Date(value)) !== 'Invalid Date') {
|
11
|
-
return customDayjs(value).format(format);
|
11
|
+
return customDayjs(value).locale(lang).format(format);
|
12
12
|
}
|
13
13
|
return String(value);
|
14
14
|
};
|
15
|
-
var formatCalendarValue = function formatCalendarValue(value, format) {
|
16
|
-
if (!value) {
|
15
|
+
var formatCalendarValue = function formatCalendarValue(value, format, lang) {
|
16
|
+
if (!value || !lang) {
|
17
17
|
return undefined;
|
18
18
|
}
|
19
19
|
if (format && customDayjs(value, format, true).isValid()) {
|
20
|
-
return customDayjs(value, format, true).toDate();
|
20
|
+
return customDayjs(value, format, true).locale(lang).toDate();
|
21
21
|
}
|
22
22
|
if (String(new Date(value)) !== 'Invalid Date') {
|
23
|
-
return customDayjs(value).toDate();
|
23
|
+
return customDayjs(value).locale(lang).toDate();
|
24
24
|
}
|
25
25
|
return undefined;
|
26
26
|
};
|
27
|
-
var getDateFromFormat = function getDateFromFormat(value, format) {
|
28
|
-
if (format && customDayjs(value, format, true).isValid()) {
|
27
|
+
var getDateFromFormat = function getDateFromFormat(value, format, lang) {
|
28
|
+
if (format && customDayjs(value, format, true).isValid() && lang) {
|
29
29
|
return {
|
30
|
-
value: customDayjs(value, format, true).toDate(),
|
30
|
+
value: customDayjs(value, format, true).locale(lang).toDate(),
|
31
31
|
isError: false,
|
32
32
|
isSuccess: true
|
33
33
|
};
|
34
34
|
}
|
35
|
-
if (!format && String(new Date(value)) !== 'Invalid Date') {
|
35
|
+
if (!format && String(new Date(value)) !== 'Invalid Date' && lang) {
|
36
36
|
return {
|
37
|
-
value: customDayjs(value).toDate(),
|
37
|
+
value: customDayjs(value).locale(lang).toDate(),
|
38
38
|
isError: false,
|
39
39
|
isSuccess: true
|
40
40
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dateHelper.js","sources":["../../../../src/components/DatePicker/utils/dateHelper.ts"],"sourcesContent":["import { customDayjs } from '../../../utils/datejs';\n\nexport const formatInputValue = (value?: Date | string, format?: string) => {\n if (!value) {\n return '';\n }\n\n if (format && customDayjs(value, format, true).isValid()) {\n return customDayjs(value, format).format(format);\n }\n\n if (format && String(value).length >= 10 && String(new Date(value)) !== 'Invalid Date') {\n return customDayjs(value).format(format);\n }\n\n return String(value);\n};\n\nexport const formatCalendarValue = (value?: Date | string, format?: string) => {\n if (!value) {\n return undefined;\n }\n\n if (format && customDayjs(value, format, true).isValid()) {\n return customDayjs(value, format, true).toDate();\n }\n\n if (String(new Date(value)) !== 'Invalid Date') {\n return customDayjs(value).toDate();\n }\n\n return undefined;\n};\n\nexport const getDateFromFormat = (value: Date | string, format?: string) => {\n if (format && customDayjs(value, format, true).isValid()) {\n return { value: customDayjs(value, format, true).toDate(), isError: false, isSuccess: true };\n }\n\n if (!format && String(new Date(value)) !== 'Invalid Date') {\n return { value: customDayjs(value).toDate(), isError: false, isSuccess: true };\n }\n\n return { value, isError: true, isSuccess: false };\n};\n\nexport const getDateFormatDelimiter = (format?: string) => {\n if (!format) {\n return '';\n }\n\n const delimiter = format.match(/[^a-zA-Z0-9]/)?.[0];\n\n return delimiter ?? '';\n};\n\nexport const getMaskedDateOnInput = (value?: string, format?: string, delimiter?: string, prevValue?: string) => {\n if (!value) {\n return '';\n }\n\n if (!format || !delimiter) {\n return value;\n }\n\n if (value.length >= format.length) {\n return value.slice(0, format.length);\n }\n\n if (prevValue && value.length < prevValue.length && prevValue?.[value.length] === delimiter) {\n return value.slice(0, -1);\n }\n\n if (format?.[value.length] === delimiter) {\n return value + delimiter;\n }\n\n return value;\n};\n"],"names":["formatInputValue","value","format","customDayjs","isValid","String","length","Date","formatCalendarValue","undefined","toDate","getDateFromFormat","isError","isSuccess","getDateFormatDelimiter","_format$match","delimiter","match","getMaskedDateOnInput","prevValue","slice"],"mappings":";;
|
1
|
+
{"version":3,"file":"dateHelper.js","sources":["../../../../src/components/DatePicker/utils/dateHelper.ts"],"sourcesContent":["import { customDayjs } from '../../../utils/datejs';\n\nexport type Langs = 'ru' | 'en';\n\nexport const formatInputValue = (value?: Date | string, format?: string, lang?: Langs) => {\n if (!value || !lang) {\n return '';\n }\n\n if (format && customDayjs(value, format, true).isValid()) {\n return customDayjs(value, format).locale(lang).format(format);\n }\n\n if (format && String(value).length >= 10 && String(new Date(value)) !== 'Invalid Date') {\n return customDayjs(value).locale(lang).format(format);\n }\n\n return String(value);\n};\n\nexport const formatCalendarValue = (value?: Date | string, format?: string, lang?: Langs) => {\n if (!value || !lang) {\n return undefined;\n }\n\n if (format && customDayjs(value, format, true).isValid()) {\n return customDayjs(value, format, true).locale(lang).toDate();\n }\n\n if (String(new Date(value)) !== 'Invalid Date') {\n return customDayjs(value).locale(lang).toDate();\n }\n\n return undefined;\n};\n\nexport const getDateFromFormat = (value: Date | string, format?: string, lang?: Langs) => {\n if (format && customDayjs(value, format, true).isValid() && lang) {\n return { value: customDayjs(value, format, true).locale(lang).toDate(), isError: false, isSuccess: true };\n }\n\n if (!format && String(new Date(value)) !== 'Invalid Date' && lang) {\n return { value: customDayjs(value).locale(lang).toDate(), isError: false, isSuccess: true };\n }\n\n return { value, isError: true, isSuccess: false };\n};\n\nexport const getDateFormatDelimiter = (format?: string) => {\n if (!format) {\n return '';\n }\n\n const delimiter = format.match(/[^a-zA-Z0-9]/)?.[0];\n\n return delimiter ?? '';\n};\n\nexport const getMaskedDateOnInput = (value?: string, format?: string, delimiter?: string, prevValue?: string) => {\n if (!value) {\n return '';\n }\n\n if (!format || !delimiter) {\n return value;\n }\n\n if (value.length >= format.length) {\n return value.slice(0, format.length);\n }\n\n if (prevValue && value.length < prevValue.length && prevValue?.[value.length] === delimiter) {\n return value.slice(0, -1);\n }\n\n if (format?.[value.length] === delimiter) {\n return value + delimiter;\n }\n\n return value;\n};\n"],"names":["formatInputValue","value","format","lang","customDayjs","isValid","locale","String","length","Date","formatCalendarValue","undefined","toDate","getDateFromFormat","isError","isSuccess","getDateFormatDelimiter","_format$match","delimiter","match","getMaskedDateOnInput","prevValue","slice"],"mappings":";;AAIO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,KAAqB,EAAEC,MAAe,EAAEC,IAAY,EAAK;AACtF,EAAA,IAAI,CAACF,KAAK,IAAI,CAACE,IAAI,EAAE;AACjB,IAAA,OAAO,EAAE,CAAA;AACb,GAAA;AAEA,EAAA,IAAID,MAAM,IAAIE,WAAW,CAACH,KAAK,EAAEC,MAAM,EAAE,IAAI,CAAC,CAACG,OAAO,EAAE,EAAE;AACtD,IAAA,OAAOD,WAAW,CAACH,KAAK,EAAEC,MAAM,CAAC,CAACI,MAAM,CAACH,IAAI,CAAC,CAACD,MAAM,CAACA,MAAM,CAAC,CAAA;AACjE,GAAA;EAEA,IAAIA,MAAM,IAAIK,MAAM,CAACN,KAAK,CAAC,CAACO,MAAM,IAAI,EAAE,IAAID,MAAM,CAAC,IAAIE,IAAI,CAACR,KAAK,CAAC,CAAC,KAAK,cAAc,EAAE;AACpF,IAAA,OAAOG,WAAW,CAACH,KAAK,CAAC,CAACK,MAAM,CAACH,IAAI,CAAC,CAACD,MAAM,CAACA,MAAM,CAAC,CAAA;AACzD,GAAA;EAEA,OAAOK,MAAM,CAACN,KAAK,CAAC,CAAA;AACxB,EAAC;AAEM,IAAMS,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIT,KAAqB,EAAEC,MAAe,EAAEC,IAAY,EAAK;AACzF,EAAA,IAAI,CAACF,KAAK,IAAI,CAACE,IAAI,EAAE;AACjB,IAAA,OAAOQ,SAAS,CAAA;AACpB,GAAA;AAEA,EAAA,IAAIT,MA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AS,EAAE;IACzF,OAAOjB,KAAK,CAACqB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC7B,GAAA;AAEA,EAAA,IAAI,CAAApB,MAAM,KAANA,IAAAA,IAAAA,MAAM,KAANA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,MAAM,CAAGD,KAAK,CAACO,MAAM,CAAC,MAAKU,SAAS,EAAE;IACtC,OAAOjB,KAAK,GAAGiB,SAAS,CAAA;AAC5B,GAAA;AAEA,EAAA,OAAOjB,KAAK,CAAA;AAChB;;;;"}
|
package/es/utils/datejs.js
CHANGED
@@ -2,6 +2,8 @@ import dayjs from 'dayjs';
|
|
2
2
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
3
3
|
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
|
4
4
|
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
5
|
+
import 'dayjs/locale/ru';
|
6
|
+
import 'dayjs/locale/en';
|
5
7
|
|
6
8
|
dayjs.extend(customParseFormat);
|
7
9
|
dayjs.extend(quarterOfYear);
|
package/es/utils/datejs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"datejs.js","sources":["../../src/utils/datejs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport quarterOfYear from 'dayjs/plugin/quarterOfYear';\nimport advancedFormat from 'dayjs/plugin/advancedFormat';\n\ndayjs.extend(customParseFormat);\ndayjs.extend(quarterOfYear);\ndayjs.extend(advancedFormat);\n\nexport const customDayjs = dayjs;\n"],"names":["dayjs","extend","customParseFormat","quarterOfYear","advancedFormat","customDayjs"],"mappings":"
|
1
|
+
{"version":3,"file":"datejs.js","sources":["../../src/utils/datejs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport quarterOfYear from 'dayjs/plugin/quarterOfYear';\nimport advancedFormat from 'dayjs/plugin/advancedFormat';\n\nimport 'dayjs/locale/ru';\nimport 'dayjs/locale/en';\n\ndayjs.extend(customParseFormat);\ndayjs.extend(quarterOfYear);\ndayjs.extend(advancedFormat);\n\nexport const customDayjs = dayjs;\n"],"names":["dayjs","extend","customParseFormat","quarterOfYear","advancedFormat","customDayjs"],"mappings":";;;;;;;AAQAA,KAAK,CAACC,MAAM,CAACC,iBAAiB,CAAC,CAAA;AAC/BF,KAAK,CAACC,MAAM,CAACE,aAAa,CAAC,CAAA;AAC3BH,KAAK,CAACC,MAAM,CAACG,cAAc,CAAC,CAAA;AAErB,IAAMC,WAAW,GAAGL;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.135.0-canary.
|
3
|
+
"version": "0.135.0-canary.1404.10630068652.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -80,7 +80,7 @@
|
|
80
80
|
"@rollup/plugin-babel": "^6.0.4",
|
81
81
|
"@rollup/plugin-commonjs": "^25.0.4",
|
82
82
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
83
|
-
"@salutejs/plasma-sb-utils": "0.
|
83
|
+
"@salutejs/plasma-sb-utils": "0.174.0",
|
84
84
|
"@storybook/addon-docs": "^7.6.17",
|
85
85
|
"@storybook/addon-essentials": "^7.6.17",
|
86
86
|
"@storybook/addons": "^7.6.17",
|
@@ -110,7 +110,7 @@
|
|
110
110
|
"@linaria/core": "5.0.2",
|
111
111
|
"@linaria/react": "5.0.3",
|
112
112
|
"@popperjs/core": "2.11.8",
|
113
|
-
"@salutejs/plasma-core": "1.
|
113
|
+
"@salutejs/plasma-core": "1.176.0",
|
114
114
|
"dayjs": "1.11.11",
|
115
115
|
"focus-visible": "5.2.0",
|
116
116
|
"lodash.throttle": "4.1.1",
|
@@ -118,5 +118,5 @@
|
|
118
118
|
"react-popper": "2.3.0",
|
119
119
|
"storeon": "3.1.5"
|
120
120
|
},
|
121
|
-
"gitHead": "
|
121
|
+
"gitHead": "5a20998289879eee12dabd270bd3198c7e4df344"
|
122
122
|
}
|
@@ -47,7 +47,7 @@ var comboboxItemRoot = exports.comboboxItemRoot = function comboboxItemRoot(Root
|
|
47
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
48
48
|
var uniqId = (0, _plasmaCore.safeUseId)();
|
49
49
|
var innerId = id || uniqId;
|
50
|
-
var withComboboxItemIsSelected = checked || isSelected ? _Combobox.classes.
|
50
|
+
var withComboboxItemIsSelected = checked || isSelected ? _Combobox.classes.comboboxItemIsDisabled : undefined;
|
51
51
|
var withComboboxItemIsDisabled = disabled ? _Combobox.classes.comboboxItemIsDisabled : undefined;
|
52
52
|
var handleOnClick = (0, _react.useCallback)(function (event) {
|
53
53
|
if (disabled) {
|
@@ -70,6 +70,38 @@ export function App() {
|
|
70
70
|
}
|
71
71
|
```
|
72
72
|
|
73
|
+
### Язык даты
|
74
|
+
Язык даты задается с помощью свойства `lang`.
|
75
|
+
|
76
|
+
| Обозначение | Отображение | Описание |
|
77
|
+
|-------------|-------------|---------------------|
|
78
|
+
| ru | June | Английский Язык |
|
79
|
+
| en | июнь | Русский язык |
|
80
|
+
|
81
|
+
По умолчанию используется `ru`
|
82
|
+
|
83
|
+
```tsx live
|
84
|
+
import React from 'react';
|
85
|
+
import { DatePicker } from '@salutejs/plasma-b2c';
|
86
|
+
import { IconDone } from '@salutejs/plasma-icons';
|
87
|
+
|
88
|
+
export function App() {
|
89
|
+
return (
|
90
|
+
<div style={{ height: "450px" }}>
|
91
|
+
<DatePicker
|
92
|
+
label="Лейбл"
|
93
|
+
leftHelper="Подсказка к полю"
|
94
|
+
placeholder="Введите дату"
|
95
|
+
format="DD MMMM YYYY"
|
96
|
+
lang="en"
|
97
|
+
maskWithFormat
|
98
|
+
contentRight={<IconDone size="s" />}
|
99
|
+
/>
|
100
|
+
</div>
|
101
|
+
);
|
102
|
+
}
|
103
|
+
```
|
104
|
+
|
73
105
|
### Валидация и индикация успешного ввода даты.
|
74
106
|
За индикацию ошибки или успешного ввода отвечают `valueError`, `valueSuccess`.
|
75
107
|
В данном примере валидация происходит при нажатии клавиши `Enter` после ввода значений:
|
@@ -17,7 +17,7 @@ var _base3 = /*#__PURE__*/require("./variations/_disabled/base");
|
|
17
17
|
var _base4 = /*#__PURE__*/require("./variations/_readonly/base");
|
18
18
|
var _RangeDate = /*#__PURE__*/require("./RangeDate.styles");
|
19
19
|
var _RangeDatePopover = /*#__PURE__*/require("./RangeDatePopover/RangeDatePopover");
|
20
|
-
var _excluded = ["className", "isDoubleCalendar", "opened", "label", "leftHelper", "contentLeft", "contentRight", "view", "size", "readOnly", "disabled", "dividerVariant", "dividerIcon", "defaultFirstDate", "defaultSecondDate", "firstValueError", "secondValueError", "firstValueSuccess", "secondValueSuccess", "firstPlaceholder", "secondPlaceholder", "firstTextfieldContentLeft", "firstTextfieldContentRight", "secondTextfieldContentLeft", "secondTextfieldContentRight", "firstTextfieldTextBefore", "secondTextfieldTextBefore", "firstTextfieldTextAfter", "secondTextfieldTextAfter", "format", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "placement", "closeOnOverlayClick", "closeOnEsc", "offset", "onToggle", "onChangeFirstValue", "onChangeSecondValue", "onCommitFirstDate", "onCommitSecondDate", "onFocusFirstTextfield", "onFocusSecondTextfield", "onBlurFirstTextfield", "onBlurSecondTextfield"];
|
20
|
+
var _excluded = ["className", "isDoubleCalendar", "opened", "label", "leftHelper", "contentLeft", "contentRight", "view", "size", "readOnly", "disabled", "dividerVariant", "dividerIcon", "defaultFirstDate", "defaultSecondDate", "firstValueError", "secondValueError", "firstValueSuccess", "secondValueSuccess", "firstPlaceholder", "secondPlaceholder", "firstTextfieldContentLeft", "firstTextfieldContentRight", "secondTextfieldContentLeft", "secondTextfieldContentRight", "firstTextfieldTextBefore", "secondTextfieldTextBefore", "firstTextfieldTextAfter", "secondTextfieldTextAfter", "format", "lang", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "placement", "closeOnOverlayClick", "closeOnEsc", "offset", "onToggle", "onChangeFirstValue", "onChangeSecondValue", "onCommitFirstDate", "onCommitSecondDate", "onFocusFirstTextfield", "onFocusSecondTextfield", "onBlurFirstTextfield", "onBlurSecondTextfield"];
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
23
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
@@ -70,6 +70,8 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
70
70
|
secondTextfieldTextAfter = _ref.secondTextfieldTextAfter,
|
71
71
|
_ref$format = _ref.format,
|
72
72
|
format = _ref$format === void 0 ? 'DD.MM.YYYY' : _ref$format,
|
73
|
+
_ref$lang = _ref.lang,
|
74
|
+
lang = _ref$lang === void 0 ? 'ru' : _ref$lang,
|
73
75
|
maskWithFormat = _ref.maskWithFormat,
|
74
76
|
min = _ref.min,
|
75
77
|
max = _ref.max,
|
@@ -116,19 +118,19 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
116
118
|
_useState6 = _slicedToArray(_useState5, 2),
|
117
119
|
isInnerOpen = _useState6[0],
|
118
120
|
setIsInnerOpen = _useState6[1];
|
119
|
-
var _useState7 = (0, _react.useState)((0, _dateHelper.formatCalendarValue)(defaultFirstDate, format)),
|
121
|
+
var _useState7 = (0, _react.useState)((0, _dateHelper.formatCalendarValue)(defaultFirstDate, format, lang)),
|
120
122
|
_useState8 = _slicedToArray(_useState7, 2),
|
121
123
|
calendarFirstValue = _useState8[0],
|
122
124
|
setCalendarFirstValue = _useState8[1];
|
123
|
-
var _useState9 = (0, _react.useState)((0, _dateHelper.formatInputValue)(defaultFirstDate, format)),
|
125
|
+
var _useState9 = (0, _react.useState)((0, _dateHelper.formatInputValue)(defaultFirstDate, format, lang)),
|
124
126
|
_useState10 = _slicedToArray(_useState9, 2),
|
125
127
|
inputFirstValue = _useState10[0],
|
126
128
|
setInputFirstValue = _useState10[1];
|
127
|
-
var _useState11 = (0, _react.useState)((0, _dateHelper.formatCalendarValue)(defaultSecondDate, format)),
|
129
|
+
var _useState11 = (0, _react.useState)((0, _dateHelper.formatCalendarValue)(defaultSecondDate, format, lang)),
|
128
130
|
_useState12 = _slicedToArray(_useState11, 2),
|
129
131
|
calendarSecondValue = _useState12[0],
|
130
132
|
setCalendarSecondValue = _useState12[1];
|
131
|
-
var _useState13 = (0, _react.useState)((0, _dateHelper.formatInputValue)(defaultSecondDate, format)),
|
133
|
+
var _useState13 = (0, _react.useState)((0, _dateHelper.formatInputValue)(defaultSecondDate, format, lang)),
|
132
134
|
_useState14 = _slicedToArray(_useState13, 2),
|
133
135
|
inputSecondValue = _useState14[0],
|
134
136
|
setInputSecondValue = _useState14[1];
|
@@ -142,6 +144,7 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
142
144
|
setIsInnerOpen: setIsInnerOpen,
|
143
145
|
dateFormatDelimiter: dateFormatDelimiter,
|
144
146
|
format: format,
|
147
|
+
lang: lang,
|
145
148
|
disabled: disabled,
|
146
149
|
readOnly: readOnly,
|
147
150
|
maskWithFormat: maskWithFormat,
|
@@ -160,6 +163,7 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
160
163
|
setIsInnerOpen: setIsInnerOpen,
|
161
164
|
dateFormatDelimiter: dateFormatDelimiter,
|
162
165
|
format: format,
|
166
|
+
lang: lang,
|
163
167
|
disabled: disabled,
|
164
168
|
readOnly: readOnly,
|
165
169
|
maskWithFormat: maskWithFormat,
|
@@ -244,13 +248,19 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
244
248
|
});
|
245
249
|
}, [opened]);
|
246
250
|
(0, _react.useEffect)(function () {
|
247
|
-
setCalendarFirstValue((0, _dateHelper.formatCalendarValue)(defaultFirstDate, format));
|
248
|
-
setInputFirstValue((0, _dateHelper.formatInputValue)(defaultFirstDate, format));
|
251
|
+
setCalendarFirstValue((0, _dateHelper.formatCalendarValue)(defaultFirstDate, format, lang));
|
252
|
+
setInputFirstValue((0, _dateHelper.formatInputValue)(defaultFirstDate, format, lang));
|
249
253
|
}, [defaultFirstDate]);
|
250
254
|
(0, _react.useEffect)(function () {
|
251
|
-
setCalendarSecondValue((0, _dateHelper.formatCalendarValue)(defaultSecondDate, format));
|
252
|
-
setInputSecondValue((0, _dateHelper.formatInputValue)(defaultSecondDate, format));
|
255
|
+
setCalendarSecondValue((0, _dateHelper.formatCalendarValue)(defaultSecondDate, format, lang));
|
256
|
+
setInputSecondValue((0, _dateHelper.formatInputValue)(defaultSecondDate, format, lang));
|
253
257
|
}, [defaultSecondDate]);
|
258
|
+
(0, _react.useEffect)(function () {
|
259
|
+
setCalendarFirstValue((0, _dateHelper.formatCalendarValue)(defaultFirstDate, format, lang));
|
260
|
+
setInputFirstValue((0, _dateHelper.formatInputValue)(defaultFirstDate, format, lang));
|
261
|
+
setCalendarSecondValue((0, _dateHelper.formatCalendarValue)(defaultSecondDate, format, lang));
|
262
|
+
setInputSecondValue((0, _dateHelper.formatInputValue)(defaultSecondDate, format, lang));
|
263
|
+
}, [format, lang]);
|
254
264
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
255
265
|
ref: rootRef,
|
256
266
|
view: view,
|
@@ -17,7 +17,7 @@ var _base2 = /*#__PURE__*/require("./variations/_view/base");
|
|
17
17
|
var _base3 = /*#__PURE__*/require("./variations/_disabled/base");
|
18
18
|
var _base4 = /*#__PURE__*/require("./variations/_readonly/base");
|
19
19
|
var _SingleDate = /*#__PURE__*/require("./SingleDate.styles");
|
20
|
-
var _excluded = ["className", "opened", "label", "labelPlacement", "placeholder", "leftHelper", "contentLeft", "contentRight", "textBefore", "textAfter", "view", "size", "readOnly", "disabled", "defaultDate", "valueError", "valueSuccess", "format", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "placement", "closeOnOverlayClick", "offset", "onChangeValue", "onCommitDate", "onToggle", "onFocus", "onBlur"];
|
20
|
+
var _excluded = ["className", "opened", "label", "labelPlacement", "placeholder", "leftHelper", "contentLeft", "contentRight", "textBefore", "textAfter", "view", "size", "readOnly", "disabled", "defaultDate", "valueError", "valueSuccess", "format", "lang", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "placement", "closeOnOverlayClick", "offset", "onChangeValue", "onCommitDate", "onToggle", "onFocus", "onBlur"];
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
23
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
@@ -55,6 +55,8 @@ var datePickerRoot = exports.datePickerRoot = function datePickerRoot(Root) {
|
|
55
55
|
valueSuccess = _ref.valueSuccess,
|
56
56
|
_ref$format = _ref.format,
|
57
57
|
format = _ref$format === void 0 ? 'DD.MM.YYYY' : _ref$format,
|
58
|
+
_ref$lang = _ref.lang,
|
59
|
+
lang = _ref$lang === void 0 ? 'ru' : _ref$lang,
|
58
60
|
maskWithFormat = _ref.maskWithFormat,
|
59
61
|
min = _ref.min,
|
60
62
|
max = _ref.max,
|
@@ -86,11 +88,11 @@ var datePickerRoot = exports.datePickerRoot = function datePickerRoot(Root) {
|
|
86
88
|
_useState2 = _slicedToArray(_useState, 2),
|
87
89
|
isInnerOpen = _useState2[0],
|
88
90
|
setIsInnerOpen = _useState2[1];
|
89
|
-
var _useState3 = (0, _react.useState)((0, _dateHelper.formatCalendarValue)(defaultDate, format)),
|
91
|
+
var _useState3 = (0, _react.useState)((0, _dateHelper.formatCalendarValue)(defaultDate, format, lang)),
|
90
92
|
_useState4 = _slicedToArray(_useState3, 2),
|
91
93
|
calendarValue = _useState4[0],
|
92
94
|
setCalendarValue = _useState4[1];
|
93
|
-
var _useState5 = (0, _react.useState)((0, _dateHelper.formatInputValue)(defaultDate, format)),
|
95
|
+
var _useState5 = (0, _react.useState)((0, _dateHelper.formatInputValue)(defaultDate, format, lang)),
|
94
96
|
_useState6 = _slicedToArray(_useState5, 2),
|
95
97
|
inputValue = _useState6[0],
|
96
98
|
setInputValue = _useState6[1];
|
@@ -105,6 +107,7 @@ var datePickerRoot = exports.datePickerRoot = function datePickerRoot(Root) {
|
|
105
107
|
setIsInnerOpen: setIsInnerOpen,
|
106
108
|
dateFormatDelimiter: dateFormatDelimiter,
|
107
109
|
format: format,
|
110
|
+
lang: lang,
|
108
111
|
disabled: disabled,
|
109
112
|
readOnly: readOnly,
|
110
113
|
maskWithFormat: maskWithFormat,
|
@@ -154,9 +157,13 @@ var datePickerRoot = exports.datePickerRoot = function datePickerRoot(Root) {
|
|
154
157
|
});
|
155
158
|
}, [opened]);
|
156
159
|
(0, _react.useEffect)(function () {
|
157
|
-
setCalendarValue((0, _dateHelper.formatCalendarValue)(defaultDate, format));
|
158
|
-
setInputValue((0, _dateHelper.formatInputValue)(defaultDate, format));
|
160
|
+
setCalendarValue((0, _dateHelper.formatCalendarValue)(defaultDate, format, lang));
|
161
|
+
setInputValue((0, _dateHelper.formatInputValue)(defaultDate, format, lang));
|
159
162
|
}, [defaultDate]);
|
163
|
+
(0, _react.useEffect)(function () {
|
164
|
+
setCalendarValue((0, _dateHelper.formatCalendarValue)(defaultDate, format, lang));
|
165
|
+
setInputValue((0, _dateHelper.formatInputValue)(defaultDate, format, lang));
|
166
|
+
}, [format, lang]);
|
160
167
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
161
168
|
view: view,
|
162
169
|
size: size,
|
@@ -13,6 +13,8 @@ var useDatePicker = exports.useDatePicker = function useDatePicker(_ref) {
|
|
13
13
|
setIsInnerOpen = _ref.setIsInnerOpen,
|
14
14
|
dateFormatDelimiter = _ref.dateFormatDelimiter,
|
15
15
|
format = _ref.format,
|
16
|
+
_ref$lang = _ref.lang,
|
17
|
+
lang = _ref$lang === void 0 ? 'ru' : _ref$lang,
|
16
18
|
disabled = _ref.disabled,
|
17
19
|
readOnly = _ref.readOnly,
|
18
20
|
maskWithFormat = _ref.maskWithFormat,
|
@@ -43,9 +45,9 @@ var useDatePicker = exports.useDatePicker = function useDatePicker(_ref) {
|
|
43
45
|
if (!format) {
|
44
46
|
setCalendarValue((0, _dateHelper.formatCalendarValue)(newValue));
|
45
47
|
} else if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === format.length) {
|
46
|
-
setCalendarValue((0, _dateHelper.formatCalendarValue)(newValue, format));
|
48
|
+
setCalendarValue((0, _dateHelper.formatCalendarValue)(newValue, format, lang));
|
47
49
|
}
|
48
|
-
setInputValue((0, _dateHelper.formatInputValue)(newValue, format));
|
50
|
+
setInputValue((0, _dateHelper.formatInputValue)(newValue, format, lang));
|
49
51
|
onChangeValue === null || onChangeValue === void 0 || onChangeValue(event, newValue);
|
50
52
|
};
|
51
53
|
var handleCommitDate = function handleCommitDate(date, applyFormat, isCalendarValue, dateInfo) {
|
@@ -58,17 +60,17 @@ var useDatePicker = exports.useDatePicker = function useDatePicker(_ref) {
|
|
58
60
|
return onCommitDate === null || onCommitDate === void 0 ? void 0 : onCommitDate('', false, true);
|
59
61
|
}
|
60
62
|
if (isCalendarValue) {
|
61
|
-
setCalendarValue((0, _dateHelper.formatCalendarValue)(date, format));
|
62
|
-
setInputValue((0, _dateHelper.formatInputValue)(date, format));
|
63
|
+
setCalendarValue((0, _dateHelper.formatCalendarValue)(date, format, lang));
|
64
|
+
setInputValue((0, _dateHelper.formatInputValue)(date, format, lang));
|
63
65
|
return onCommitDate === null || onCommitDate === void 0 ? void 0 : onCommitDate(date, false, true, dateInfo);
|
64
66
|
}
|
65
67
|
var formatString = applyFormat ? format : undefined;
|
66
|
-
var _getDateFromFormat = (0, _dateHelper.getDateFromFormat)(date, formatString),
|
68
|
+
var _getDateFromFormat = (0, _dateHelper.getDateFromFormat)(date, formatString, lang),
|
67
69
|
newDate = _getDateFromFormat.value,
|
68
70
|
isError = _getDateFromFormat.isError,
|
69
71
|
isSuccess = _getDateFromFormat.isSuccess;
|
70
|
-
setCalendarValue((0, _dateHelper.formatCalendarValue)(newDate, format));
|
71
|
-
setInputValue((0, _dateHelper.formatInputValue)(newDate, format));
|
72
|
+
setCalendarValue((0, _dateHelper.formatCalendarValue)(newDate, format, lang));
|
73
|
+
setInputValue((0, _dateHelper.formatInputValue)(newDate, format, lang));
|
72
74
|
onCommitDate === null || onCommitDate === void 0 || onCommitDate(newDate, isError, isSuccess);
|
73
75
|
};
|
74
76
|
return {
|
@@ -5,41 +5,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getMaskedDateOnInput = exports.getDateFromFormat = exports.getDateFormatDelimiter = exports.formatInputValue = exports.formatCalendarValue = void 0;
|
7
7
|
var _datejs = /*#__PURE__*/require("../../../utils/datejs");
|
8
|
-
var formatInputValue = exports.formatInputValue = function formatInputValue(value, format) {
|
9
|
-
if (!value) {
|
8
|
+
var formatInputValue = exports.formatInputValue = function formatInputValue(value, format, lang) {
|
9
|
+
if (!value || !lang) {
|
10
10
|
return '';
|
11
11
|
}
|
12
12
|
if (format && (0, _datejs.customDayjs)(value, format, true).isValid()) {
|
13
|
-
return (0, _datejs.customDayjs)(value, format).format(format);
|
13
|
+
return (0, _datejs.customDayjs)(value, format).locale(lang).format(format);
|
14
14
|
}
|
15
15
|
if (format && String(value).length >= 10 && String(new Date(value)) !== 'Invalid Date') {
|
16
|
-
return (0, _datejs.customDayjs)(value).format(format);
|
16
|
+
return (0, _datejs.customDayjs)(value).locale(lang).format(format);
|
17
17
|
}
|
18
18
|
return String(value);
|
19
19
|
};
|
20
|
-
var formatCalendarValue = exports.formatCalendarValue = function formatCalendarValue(value, format) {
|
21
|
-
if (!value) {
|
20
|
+
var formatCalendarValue = exports.formatCalendarValue = function formatCalendarValue(value, format, lang) {
|
21
|
+
if (!value || !lang) {
|
22
22
|
return undefined;
|
23
23
|
}
|
24
24
|
if (format && (0, _datejs.customDayjs)(value, format, true).isValid()) {
|
25
|
-
return (0, _datejs.customDayjs)(value, format, true).toDate();
|
25
|
+
return (0, _datejs.customDayjs)(value, format, true).locale(lang).toDate();
|
26
26
|
}
|
27
27
|
if (String(new Date(value)) !== 'Invalid Date') {
|
28
|
-
return (0, _datejs.customDayjs)(value).toDate();
|
28
|
+
return (0, _datejs.customDayjs)(value).locale(lang).toDate();
|
29
29
|
}
|
30
30
|
return undefined;
|
31
31
|
};
|
32
|
-
var getDateFromFormat = exports.getDateFromFormat = function getDateFromFormat(value, format) {
|
33
|
-
if (format && (0, _datejs.customDayjs)(value, format, true).isValid()) {
|
32
|
+
var getDateFromFormat = exports.getDateFromFormat = function getDateFromFormat(value, format, lang) {
|
33
|
+
if (format && (0, _datejs.customDayjs)(value, format, true).isValid() && lang) {
|
34
34
|
return {
|
35
|
-
value: (0, _datejs.customDayjs)(value, format, true).toDate(),
|
35
|
+
value: (0, _datejs.customDayjs)(value, format, true).locale(lang).toDate(),
|
36
36
|
isError: false,
|
37
37
|
isSuccess: true
|
38
38
|
};
|
39
39
|
}
|
40
|
-
if (!format && String(new Date(value)) !== 'Invalid Date') {
|
40
|
+
if (!format && String(new Date(value)) !== 'Invalid Date' && lang) {
|
41
41
|
return {
|
42
|
-
value: (0, _datejs.customDayjs)(value).toDate(),
|
42
|
+
value: (0, _datejs.customDayjs)(value).locale(lang).toDate(),
|
43
43
|
isError: false,
|
44
44
|
isSuccess: true
|
45
45
|
};
|
@@ -19,7 +19,7 @@ var config = exports.config = {
|
|
19
19
|
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":100%;", ":auto;", ":0.875rem;", ":0.125rem;", ":0.125rem;", ":0.125rem;", ":0.125rem;", ":var(--surface-transparent-tertiary);", ":0.063rem;", ":0;", ":1rem;", ":0;", ":1rem;", ":auto;", ":1.5rem;", ":1rem;", ":1rem;", ":1rem;", ":1rem;", ":0.75rem;", ":1.875rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":0.25rem;", ":0.5rem;", ":auto;", ":2.75rem;", ":0.75rem;", ":1rem;", ":0.625rem;", ":0rem;", ":1rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":1rem;", ":3.5rem;", ":100%;", ":0.875rem;", ":0 3.5rem 0 1.5rem;", ":0 3.625rem 0 0.375rem;", ":0 3.625rem 0 0.625rem;", ":0.5rem;", ":0.375rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], _Combobox.comboboxTokens.width, _Combobox.comboboxTokens.height, _Combobox.comboboxTokens.borderRadius, _Combobox.comboboxTokens.paddingTop, _Combobox.comboboxTokens.paddingRight, _Combobox.comboboxTokens.paddingBottom, _Combobox.comboboxTokens.paddingLeft, _Combobox.comboboxTokens.dividerColor, _Combobox.comboboxTokens.dividerHeight, _Combobox.comboboxTokens.dividerMarginTop, _Combobox.comboboxTokens.dividerMarginRight, _Combobox.comboboxTokens.dividerMarginBottom, _Combobox.comboboxTokens.dividerMarginLeft, _Combobox.comboboxTokens.itemWidth, _Combobox.comboboxTokens.itemHeight, _Combobox.comboboxTokens.itemPaddingTop, _Combobox.comboboxTokens.itemPaddingRight, _Combobox.comboboxTokens.itemPaddingBottom, _Combobox.comboboxTokens.itemPaddingLeft, _Combobox.comboboxTokens.itemBorderRadius, _Combobox.comboboxTokens.itemContentLeftWidth, _Combobox.comboboxTokens.itemFontFamily, _Combobox.comboboxTokens.itemFontSize, _Combobox.comboboxTokens.itemFontStyle, _Combobox.comboboxTokens.itemFontWeightBold, _Combobox.comboboxTokens.itemFontLetterSpacing, _Combobox.comboboxTokens.itemFontLineHeight, _Combobox.comboboxTokens.chipGap, _Combobox.comboboxTokens.chipBorderRadius, _Combobox.comboboxTokens.chipWidth, _Combobox.comboboxTokens.chipHeight, _Combobox.comboboxTokens.chipPaddingRight, _Combobox.comboboxTokens.chipPaddingLeft, _Combobox.comboboxTokens.chipClearContentMarginLeft, _Combobox.comboboxTokens.chipClearContentMarginRight, _Combobox.comboboxTokens.chipCloseIconSize, _Combobox.comboboxTokens.chipFontFamily, _Combobox.comboboxTokens.chipFontSize, _Combobox.comboboxTokens.chipFontStyle, _Combobox.comboboxTokens.chipFontWeight, _Combobox.comboboxTokens.chipLetterSpacing, _Combobox.comboboxTokens.chipLineHeight, _Combobox.comboboxTokens.targetArrowRight, _Combobox.comboboxTokens.targetHeight, _Combobox.comboboxTokens.targetWidth, _Combobox.comboboxTokens.targetRadius, _Combobox.comboboxTokens.targetPadding, _Combobox.comboboxTokens.targetPaddingHasChips, _Combobox.comboboxTokens.targetPaddingWithInput, _Combobox.comboboxTokens.targetInnerTop, _Combobox.comboboxTokens.targetLabelInnerTop, _Combobox.comboboxTokens.targetFontFamily, _Combobox.comboboxTokens.targetFontSize, _Combobox.comboboxTokens.targetFontStyle, _Combobox.comboboxTokens.targetFontWeight, _Combobox.comboboxTokens.targetLetterSpacing, _Combobox.comboboxTokens.targetLineHeight, _Combobox.comboboxTokens.targetLabelInnerFontFamily, _Combobox.comboboxTokens.targetLabelInnerFontSize, _Combobox.comboboxTokens.targetLabelInnerFontStyle, _Combobox.comboboxTokens.targetLabelInnerFontWeight, _Combobox.comboboxTokens.targetLabelInnerLetterSpacing, _Combobox.comboboxTokens.targetLabelInnerLineHeight)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--surface-transparent-primary);", ":var(--surface-transparent-primary-hover);", ":var(--surface-transparent-primary-active);", ":var(--surface-transparent-secondary);", ":var(--surface-solid-card
|
22
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--surface-transparent-primary);", ":var(--surface-transparent-primary-hover);", ":var(--surface-transparent-primary-active);", ":var(--surface-transparent-secondary);", ":var(--surface-solid-card);", ":var(--shadow-down-soft-s);", ":var(--plasma-colors-transparent);", ":var(--surface-transparent-secondary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-primary);", ":var(--surface-transparent-secondary-active);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":0.72;", ":0.4;", ":var(--surface-accent);"], _Combobox.comboboxTokens.targetColor, _Combobox.comboboxTokens.targetLabelColor, _Combobox.comboboxTokens.targetArrowColor, _Combobox.comboboxTokens.targetBackgroundColor, _Combobox.comboboxTokens.targetBackgroundColorHover, _Combobox.comboboxTokens.targetBackgroundColorActive, _Combobox.comboboxTokens.targetBackgroundColorOpen, _Combobox.comboboxTokens.background, _Combobox.comboboxTokens.boxShadow, _Combobox.comboboxTokens.itemBackground, _Combobox.comboboxTokens.itemBackgroundHover, _Combobox.comboboxTokens.itemBackgroundSelectedHover, _Combobox.comboboxTokens.itemColor, _Combobox.comboboxTokens.itemContentLeftColor, _Combobox.comboboxTokens.chipCloseIconColor, _Combobox.comboboxTokens.chipColor, _Combobox.comboboxTokens.chipBackground, _Combobox.comboboxTokens.chipColorHover, _Combobox.comboboxTokens.chipBackgroundHover, _Combobox.comboboxTokens.chipColorActive, _Combobox.comboboxTokens.chipBackgroundActive, _Combobox.comboboxTokens.chipBackgroundReadOnly, _Combobox.comboboxTokens.chipColorReadOnly, _Combobox.comboboxTokens.chipBackgroundReadOnlyHover, _Combobox.comboboxTokens.chipColorReadOnlyHover, _Combobox.comboboxTokens.chipOpacityReadonly, _Combobox.comboboxTokens.disabledOpacity, _Combobox.comboboxTokens.focusColor)
|
23
23
|
}
|
24
24
|
}
|
25
25
|
};
|