@consta/uikit 5.27.0 → 5.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ModalDeprecated/index.d.ts +1 -0
- package/ModalDeprecated/index.js +1 -0
- package/Notification/index.d.ts +1 -0
- package/Notification/index.js +1 -0
- package/SidebarDeprecated/index.d.ts +1 -0
- package/SidebarDeprecated/index.js +1 -0
- package/__internal__/src/components/Chips/ChipsChoice/ChipsChoice.js +1 -1
- package/__internal__/src/components/Chips/ChipsChoice/ChipsChoice.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePicker.js +1 -1
- package/__internal__/src/components/DatePicker/DatePicker.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.d.ts +2 -4
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.d.ts +2 -4
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/helpers.d.ts +3 -6
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.d.ts +1 -0
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTimeRange/helpers.d.ts +2 -0
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTimeRange/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.d.ts +2 -4
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/helpers.d.ts +3 -6
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/DatePickerFieldTypeYear.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/DatePickerFieldTypeYear.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/helpers.d.ts +27 -8
- package/__internal__/src/components/DatePicker/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/types.d.ts +26 -5
- package/__internal__/src/components/DatePicker/types.js +1 -1
- package/__internal__/src/components/DatePicker/types.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTime.js +1 -1
- package/__internal__/src/components/DateTime/DateTime.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDateTime/DateTimeTypeDateTime.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDateTime/DateTimeTypeDateTime.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDateTime/useOnChange.d.ts +2 -2
- package/__internal__/src/components/DateTime/DateTimeTypeDateTime/useOnChange.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDateTime/useOnChange.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/DateTimeTypeTime.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/DateTimeTypeTime.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/helpers.d.ts +5 -2
- package/__internal__/src/components/DateTime/DateTimeTypeTime/helpers.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/helpers.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js.map +1 -1
- package/__internal__/src/components/DateTime/helpers/getDisableDatesKey.d.ts +2 -0
- package/__internal__/src/components/DateTime/helpers/getDisableDatesKey.js +2 -0
- package/__internal__/src/components/DateTime/helpers/getDisableDatesKey.js.map +1 -0
- package/__internal__/src/components/DateTime/helpers/getTimeNumbers.d.ts +2 -0
- package/__internal__/src/components/DateTime/helpers/getTimeNumbers.js +2 -0
- package/__internal__/src/components/DateTime/helpers/getTimeNumbers.js.map +1 -0
- package/__internal__/src/components/DateTime/helpers/getTimeOptionsKey.d.ts +2 -0
- package/__internal__/src/components/DateTime/helpers/getTimeOptionsKey.js +2 -0
- package/__internal__/src/components/DateTime/helpers/getTimeOptionsKey.js.map +1 -0
- package/__internal__/src/components/DateTime/helpers/index.d.ts +3 -0
- package/__internal__/src/components/DateTime/helpers/index.js +1 -1
- package/__internal__/src/components/DateTime/helpers/index.js.map +1 -1
- package/__internal__/src/components/DateTime/helpers/types.d.ts +30 -3
- package/__internal__/src/components/DateTime/helpers/types.js.map +1 -1
- package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.d.ts +11 -2
- package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.js.map +1 -1
- package/__internal__/src/components/DragNDropFieldCanary/types.d.ts +2 -2
- package/__internal__/src/components/DragNDropFieldCanary/types.js.map +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelect.js.map +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js.map +1 -1
- package/__internal__/src/components/FlatSelect/defaultProps.js.map +1 -1
- package/__internal__/src/components/Modal/Modal.js +1 -1
- package/__internal__/src/components/Modal/Modal.js.map +1 -1
- package/__internal__/src/components/ModalDeprecated/ModalDeprecated.css +1 -0
- package/__internal__/src/components/ModalDeprecated/ModalDeprecated.d.ts +27 -0
- package/__internal__/src/components/ModalDeprecated/ModalDeprecated.js +2 -0
- package/__internal__/src/components/ModalDeprecated/ModalDeprecated.js.map +1 -0
- package/__internal__/src/components/ModalDeprecated/index.d.ts +1 -0
- package/__internal__/src/components/ModalDeprecated/index.js +2 -0
- package/__internal__/src/components/ModalDeprecated/index.js.map +1 -0
- package/__internal__/src/components/Notification/Notification/Notification.css +1 -0
- package/__internal__/src/components/Notification/Notification/Notification.d.ts +4 -0
- package/__internal__/src/components/Notification/Notification/Notification.js +2 -0
- package/__internal__/src/components/Notification/Notification/Notification.js.map +1 -0
- package/__internal__/src/components/Notification/Notification/helpers.d.ts +70 -0
- package/__internal__/src/components/Notification/Notification/helpers.js +2 -0
- package/__internal__/src/components/Notification/Notification/helpers.js.map +1 -0
- package/__internal__/src/components/Notification/Notification/index.d.ts +2 -0
- package/__internal__/src/components/Notification/Notification/index.js +2 -0
- package/__internal__/src/components/Notification/Notification/index.js.map +1 -0
- package/__internal__/src/components/Notification/Notification/types.d.ts +66 -0
- package/__internal__/src/components/Notification/Notification/types.js +2 -0
- package/__internal__/src/components/Notification/Notification/types.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationActions/NotificationActions.d.ts +2 -0
- package/__internal__/src/components/Notification/NotificationActions/NotificationActions.js +2 -0
- package/__internal__/src/components/Notification/NotificationActions/NotificationActions.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationActions/helpers.d.ts +21 -0
- package/__internal__/src/components/Notification/NotificationActions/helpers.js +2 -0
- package/__internal__/src/components/Notification/NotificationActions/helpers.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationActions/index.d.ts +2 -0
- package/__internal__/src/components/Notification/NotificationActions/index.js +2 -0
- package/__internal__/src/components/Notification/NotificationActions/index.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationActions/types.d.ts +30 -0
- package/__internal__/src/components/Notification/NotificationActions/types.js +2 -0
- package/__internal__/src/components/Notification/NotificationActions/types.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationCaption/NotificationCaption.css +1 -0
- package/__internal__/src/components/Notification/NotificationCaption/NotificationCaption.d.ts +7 -0
- package/__internal__/src/components/Notification/NotificationCaption/NotificationCaption.js +2 -0
- package/__internal__/src/components/Notification/NotificationCaption/NotificationCaption.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationCaption/index.d.ts +1 -0
- package/__internal__/src/components/Notification/NotificationCaption/index.js +2 -0
- package/__internal__/src/components/Notification/NotificationCaption/index.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationGroup/NotificationGroup.css +1 -0
- package/__internal__/src/components/Notification/NotificationGroup/NotificationGroup.d.ts +4 -0
- package/__internal__/src/components/Notification/NotificationGroup/NotificationGroup.js +2 -0
- package/__internal__/src/components/Notification/NotificationGroup/NotificationGroup.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationGroup/index.d.ts +2 -0
- package/__internal__/src/components/Notification/NotificationGroup/index.js +2 -0
- package/__internal__/src/components/Notification/NotificationGroup/index.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationGroup/types.d.ts +12 -0
- package/__internal__/src/components/Notification/NotificationGroup/types.js +2 -0
- package/__internal__/src/components/Notification/NotificationGroup/types.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationHeader/NotificationHeader.css +1 -0
- package/__internal__/src/components/Notification/NotificationHeader/NotificationHeader.d.ts +5 -0
- package/__internal__/src/components/Notification/NotificationHeader/NotificationHeader.js +2 -0
- package/__internal__/src/components/Notification/NotificationHeader/NotificationHeader.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationHeader/index.d.ts +2 -0
- package/__internal__/src/components/Notification/NotificationHeader/index.js +2 -0
- package/__internal__/src/components/Notification/NotificationHeader/index.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationHeader/types.d.ts +14 -0
- package/__internal__/src/components/Notification/NotificationHeader/types.js +2 -0
- package/__internal__/src/components/Notification/NotificationHeader/types.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationItem/NotificationItem.css +1 -0
- package/__internal__/src/components/Notification/NotificationItem/NotificationItem.d.ts +6 -0
- package/__internal__/src/components/Notification/NotificationItem/NotificationItem.js +2 -0
- package/__internal__/src/components/Notification/NotificationItem/NotificationItem.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationItem/index.d.ts +2 -0
- package/__internal__/src/components/Notification/NotificationItem/index.js +2 -0
- package/__internal__/src/components/Notification/NotificationItem/index.js.map +1 -0
- package/__internal__/src/components/Notification/NotificationItem/types.d.ts +19 -0
- package/__internal__/src/components/Notification/NotificationItem/types.js +2 -0
- package/__internal__/src/components/Notification/NotificationItem/types.js.map +1 -0
- package/__internal__/src/components/Notification/helpers/defaultDateFormat.d.ts +1 -0
- package/__internal__/src/components/Notification/helpers/defaultDateFormat.js +2 -0
- package/__internal__/src/components/Notification/helpers/defaultDateFormat.js.map +1 -0
- package/__internal__/src/components/Notification/helpers/groupLabelByDay.d.ts +1 -0
- package/__internal__/src/components/Notification/helpers/groupLabelByDay.js +2 -0
- package/__internal__/src/components/Notification/helpers/groupLabelByDay.js.map +1 -0
- package/__internal__/src/components/Notification/helpers/groupsByDay.d.ts +1 -0
- package/__internal__/src/components/Notification/helpers/groupsByDay.js +2 -0
- package/__internal__/src/components/Notification/helpers/groupsByDay.js.map +1 -0
- package/__internal__/src/components/Notification/helpers/index.d.ts +4 -0
- package/__internal__/src/components/Notification/helpers/index.js +2 -0
- package/__internal__/src/components/Notification/helpers/index.js.map +1 -0
- package/__internal__/src/components/Notification/helpers/sortGroupByDay.d.ts +5 -0
- package/__internal__/src/components/Notification/helpers/sortGroupByDay.js +2 -0
- package/__internal__/src/components/Notification/helpers/sortGroupByDay.js.map +1 -0
- package/__internal__/src/components/Notification/index.d.ts +7 -0
- package/__internal__/src/components/Notification/index.js +2 -0
- package/__internal__/src/components/Notification/index.js.map +1 -0
- package/__internal__/src/components/Sidebar/Sidebar.js +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.js.map +1 -1
- package/__internal__/src/components/Sidebar/types.d.ts +1 -0
- package/__internal__/src/components/Sidebar/types.js.map +1 -1
- package/__internal__/src/components/SidebarDeprecated/SidebarDeprecated.css +1 -0
- package/__internal__/src/components/SidebarDeprecated/SidebarDeprecated.d.ts +39 -0
- package/__internal__/src/components/SidebarDeprecated/SidebarDeprecated.js +2 -0
- package/__internal__/src/components/SidebarDeprecated/SidebarDeprecated.js.map +1 -0
- package/__internal__/src/components/SidebarDeprecated/index.d.ts +1 -0
- package/__internal__/src/components/SidebarDeprecated/index.js +2 -0
- package/__internal__/src/components/SidebarDeprecated/index.js.map +1 -0
- package/__internal__/src/components/Slider/Slider.js +1 -1
- package/__internal__/src/components/Slider/Slider.js.map +1 -1
- package/__internal__/src/components/Slider/useSlider/useSlider.js +1 -1
- package/__internal__/src/components/Slider/useSlider/useSlider.js.map +1 -1
- package/__internal__/src/utils/getItemClick.d.ts +5 -0
- package/__internal__/src/utils/getItemClick.js +2 -0
- package/__internal__/src/utils/getItemClick.js.map +1 -0
- package/__internal__/src/utils/object/keys.d.ts +1 -0
- package/__internal__/src/utils/object/keys.js +2 -0
- package/__internal__/src/utils/object/keys.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeTypeTime.js","names":["React","forwardRef","useEffect","useMemo","cn","DateTimeLabel","DateTimeTimeColumn","getTimeTitle","moveTypes","dateTimeTimePropLocaleDefault","useTimeItems","cnDateTimeTypeTime","DateTimeTypeTime","props","ref","localeProp","locale","value","className","onChange","maxDate","minDate","disableDates","
|
|
1
|
+
{"version":3,"file":"DateTimeTypeTime.js","names":["React","forwardRef","useEffect","useMemo","cn","DateTimeLabel","DateTimeTimeColumn","getTimeTitle","moveTypes","dateTimeTimePropLocaleDefault","useTimeItems","cnDateTimeTypeTime","DateTimeTypeTime","props","ref","localeProp","locale","value","className","onChange","maxDate","minDate","disableDates","timeOptions","onMove","otherProps","words","hours","minutes","seconds","time","effectiveHours","length","effectiveMinutes","effectiveSeconds","label","labelLength","filter","item"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeTime/DateTimeTypeTime.tsx"],"sourcesContent":["import './DateTimeTypeTime.css';\n\nimport React, { forwardRef, useEffect, useMemo } from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeTimeColumn } from '../DateTimeTimeColumn/DateTimeTimeColumn';\nimport { DateTimeTypeComponent, getTimeTitle, moveTypes } from '../helpers';\nimport { dateTimeTimePropLocaleDefault, useTimeItems } from './helpers';\n\nconst cnDateTimeTypeTime = cn('DateTimeTypeTime');\n\nexport const DateTimeTypeTime: DateTimeTypeComponent<'time'> = forwardRef(\n (props, ref) => {\n const {\n locale: localeProp,\n value,\n className,\n onChange,\n maxDate,\n minDate,\n disableDates,\n timeOptions,\n onMove,\n ...otherProps\n } = props;\n\n useEffect(() => {\n onMove?.(moveTypes[3]);\n }, []);\n\n const locale = useMemo(\n () => ({ ...dateTimeTimePropLocaleDefault, ...localeProp?.words }),\n [\n localeProp?.words?.hours,\n localeProp?.words?.minutes,\n localeProp?.words?.seconds,\n ],\n );\n\n const time = useTimeItems(\n value,\n timeOptions,\n onChange,\n minDate,\n maxDate,\n disableDates,\n );\n\n const [hours, minutes, seconds] = time;\n const effectiveHours = hours.length > 0 ? 1 : 0;\n const effectiveMinutes = minutes.length > 0 ? 1 : 0;\n const effectiveSeconds = seconds.length > 0 ? 1 : 0;\n\n const label = getTimeTitle(\n value,\n effectiveHours,\n effectiveMinutes,\n effectiveSeconds,\n );\n\n const labelLength = time.filter((item) => item.length).length;\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeTypeTime(null, [className])}\n ref={ref}\n >\n <DateTimeLabel\n align=\"center\"\n className={cnDateTimeTypeTime('Label')}\n style={{ ['--label-length' as string]: labelLength }}\n label={label}\n />\n <div className={cnDateTimeTypeTime('Grid')}>\n <DateTimeTimeColumn label={locale.hours} items={hours} />\n <DateTimeTimeColumn label={locale.minutes} items={minutes} />\n <DateTimeTimeColumn label={locale.seconds} items={seconds} />\n </div>\n </div>\n );\n },\n);\n"],"mappings":"66BAAA,+BAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,OAAvC,KAAsD,OAAtD,CAEA,OAASC,EAAT,0BACA,OA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
|
+
import { DateTimePropDisableDates, TimeOptions } from '../helpers';
|
|
2
2
|
export declare const dateTimeTimePropLocaleDefault: {
|
|
3
3
|
readonly hours: "Час";
|
|
4
4
|
readonly minutes: "Мин";
|
|
@@ -9,9 +9,12 @@ type DateTimeTimePropOnChange = (value: Date, props: {
|
|
|
9
9
|
}) => void;
|
|
10
10
|
type ResultItem = {
|
|
11
11
|
label: string;
|
|
12
|
+
date: Date;
|
|
12
13
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
selected?: boolean;
|
|
15
16
|
};
|
|
16
|
-
export declare const
|
|
17
|
+
export declare const getValidDate: (date: Date, timeOptions?: TimeOptions, minDate?: Date, maxDate?: Date, disableDates?: DateTimePropDisableDates) => Date;
|
|
18
|
+
export declare const getFirstValidDateTime: (date: Date, timeOptions?: TimeOptions, minDate?: Date, maxDate?: Date, disableDates?: DateTimePropDisableDates) => Date;
|
|
19
|
+
export declare const useTimeItems: (value?: Date, timeOptions?: TimeOptions, onChange?: DateTimeTimePropOnChange, minDate?: Date, maxDate?: Date, disableDates?: DateTimePropDisableDates) => Omit<ResultItem, "date">[][];
|
|
17
20
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{addHours,addMinutes,addSeconds,endOfHour,endOfMinute,endOfSecond,startOfDay,startOfHour,startOfMinute,startOfSecond,startOfToday}from"date-fns";import{useMemo}from"react";import{useMutableRef}from"../../../hooks/useMutableRef/useMutableRef";import{
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(a){throw a}),f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(a){h=!0,f=a}),f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}import{addHours,addMinutes,addSeconds,endOfHour,endOfMinute,endOfSecond,set,startOfDay,startOfHour,startOfMinute,startOfSecond,startOfToday}from"date-fns";import{useMemo}from"react";import{useMutableRef}from"../../../hooks/useMutableRef/useMutableRef";import{isDisableDate,isInMinMaxDate}from"../../../utils/date";import{getLabelHours,getLabelMinutes,getLabelSeconds,getTimeNumbers}from"../helpers";import{getTimeOptionsKey}from"../helpers/getTimeOptionsKey";export var dateTimeTimePropLocaleDefault={hours:"\u0427\u0430\u0441",minutes:"\u041C\u0438\u043D",seconds:"\u0421\u0435\u043A"};var getItemData=function(a,b,c,d,e,f,g,h,i,j,k){var l=getTimeNumbers(a,g);if(0===l.length)return[];var m=b(h||startOfToday());return l.map(function(b){var g=e(m,b),l=f(g),n=!!h&&f(g)===f(h),o=!isInMinMaxDate(g,i,j,c,d)||isDisableDate({date:g,disableDates:k,mode:"time",timeType:a});return{label:l,date:g,selected:n,disabled:o}})},buildUnitItems=function(a,b,c,d,e,f){return"hours"===a?getItemData("hours",startOfDay,startOfHour,endOfHour,addHours,getLabelHours,c,b,d,e,f):"minutes"===a?getItemData("minutes",startOfHour,startOfMinute,endOfMinute,addMinutes,getLabelMinutes,c,b,d,e,f):"seconds"===a?getItemData("seconds",startOfMinute,startOfSecond,endOfSecond,addSeconds,getLabelSeconds,c,b,d,e,f):void 0},validateUnit=function(a,b,c,d,e,f){var g,h=buildUnitItems(b,a,f,c,d,e);"hours"===b?g=a.getHours():"minutes"===b?g=a.getMinutes():"seconds"===b?g=a.getSeconds():void 0;var i=h.find(function(a){return parseInt(a.label,10)===g&&!a.disabled});if(i)return i;var j=h.find(function(a){return!a.disabled});return j||null};export var getValidDate=function(a,b,c,d,e){var f=new Date(a),g=validateUnit(f,"hours",c,d,e,null===b||void 0===b?void 0:b.hours);g&&f.setHours(parseInt(g.label,10));var h=validateUnit(f,"minutes",c,d,e,null===b||void 0===b?void 0:b.minutes);h&&f.setMinutes(parseInt(h.label,10));var i=validateUnit(f,"seconds",c,d,e,null===b||void 0===b?void 0:b.seconds);return i&&f.setSeconds(parseInt(i.label,10)),f};export var getFirstValidDateTime=function(a,b,c,d,e){var f=startOfDay(a),g=function(a){return void 0!==a&&(Array.isArray(a)?0===a.length:0===(null===a||void 0===a?void 0:a.step))},h=g(null===b||void 0===b?void 0:b.hours),i=h?[0]:buildUnitItems("hours",f,null===b||void 0===b?void 0:b.hours,c,d,e).filter(function(a){return!a.disabled}).map(function(a){return parseInt(a.label,10)});if(!h&&0===i.length)return f;var j,k=_createForOfIteratorHelper(i);try{for(k.s();!(j=k.n()).done;){var l=j.value,m=set(f,{hours:l}),n=g(null===b||void 0===b?void 0:b.minutes),o=n?[0]:buildUnitItems("minutes",m,null===b||void 0===b?void 0:b.minutes,c,d,e).filter(function(a){return!a.disabled}).map(function(a){return parseInt(a.label,10)});if(n||0!==o.length){var p,q=_createForOfIteratorHelper(o);try{for(q.s();!(p=q.n()).done;){var r=p.value,s=set(m,{minutes:r}),t=g(null===b||void 0===b?void 0:b.seconds),u=t?[0]:buildUnitItems("seconds",s,null===b||void 0===b?void 0:b.seconds,c,d,e).filter(function(a){return!a.disabled}).map(function(a){return parseInt(a.label,10)});if(t||0!==u.length)return set(s,{seconds:u[0]})}}catch(a){q.e(a)}finally{q.f()}}}}catch(a){k.e(a)}finally{k.f()}return f};export var useTimeItems=function(a,b,c,d,f,g){var h=useMutableRef(c),i=useMemo(function(){var c=buildUnitItems("hours",a,null===b||void 0===b?void 0:b.hours,d,f,g),e=buildUnitItems("minutes",a,null===b||void 0===b?void 0:b.minutes,d,f,g),i=buildUnitItems("seconds",a,null===b||void 0===b?void 0:b.seconds,d,f,g),j=function(a){a.disabled||(a.onClick=function(c){var e,i=getValidDate(a.date,b,d,f,g);null===(e=h.current)||void 0===e?void 0:e.call(h,i,{e:c})})};return c.forEach(j),e.forEach(j),i.forEach(j),[c,e,i]},[null===a||void 0===a?void 0:a.getTime(),null===d||void 0===d?void 0:d.getTime(),null===f||void 0===f?void 0:f.getTime(),getTimeOptionsKey(b),g]),j=_slicedToArray(i,3),k=j[0],l=j[1],m=j[2];return[k,l,m]};
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["addHours","addMinutes","addSeconds","endOfHour","endOfMinute","endOfSecond","startOfDay","startOfHour","startOfMinute","startOfSecond","startOfToday","useMemo","useMutableRef","range","isDisableDate","isInMinMaxDate","getLabelHours","getLabelMinutes","getLabelSeconds","dateTimeTimePropLocaleDefault","hours","minutes","seconds","getItemData","timeType","multiplicity","startOfUnits","startOfUnit","endOfUnit","addUnits","getItemLabel","value","minDate","maxDate","disableDates","onChangeRef","length","numbers","Math","ceil","startDate","map","number","date","label","selected","disabled","mode","onClick","e","current","useTimeItems","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onChange","getTime"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeTime/helpers.ts"],"sourcesContent":["import {\n addHours,\n addMinutes,\n addSeconds,\n endOfHour,\n endOfMinute,\n endOfSecond,\n startOfDay,\n startOfHour,\n startOfMinute,\n startOfSecond,\n startOfToday,\n} from 'date-fns';\nimport { useMemo } from 'react';\n\nimport { useMutableRef } from '../../../hooks/useMutableRef/useMutableRef';\nimport { range } from '../../../utils/array';\nimport { isDisableDate, isInMinMaxDate } from '../../../utils/date';\nimport {\n DateTimePropDisableDates,\n getLabelHours,\n getLabelMinutes,\n getLabelSeconds,\n} from '../helpers';\n\nexport const dateTimeTimePropLocaleDefault = {\n hours: 'Час',\n minutes: 'Мин',\n seconds: 'Сек',\n} as const;\n\ntype DateTimeTimePropOnChange = (\n value: Date,\n props: {\n e: React.MouseEvent<HTMLButtonElement>;\n },\n) => void;\n\ntype ResultItem = {\n label: string;\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n selected?: boolean;\n};\n\nconst getItemData = (\n timeType: 'hours' | 'minutes' | 'seconds',\n multiplicity = 1,\n startOfUnits: (date: Date) => Date,\n startOfUnit: (date: Date) => Date,\n endOfUnit: (date: Date) => Date,\n addUnits: typeof addHours,\n getItemLabel: (date: Date) => string,\n value?: Date,\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n onChangeRef?: React.MutableRefObject<DateTimeTimePropOnChange | undefined>,\n): ResultItem[] => {\n const length = timeType === 'hours' ? 24 : 60;\n const numbers = range(multiplicity ? Math.ceil(length / multiplicity) : 0);\n\n if (numbers.length === 0) {\n return [];\n }\n\n const startDate = startOfUnits(value || startOfToday());\n\n return numbers.map((number) => {\n const date = addUnits(startDate, number * multiplicity);\n const label = getItemLabel(date);\n const selected = value ? getItemLabel(date) === getItemLabel(value) : false;\n const disabled =\n !isInMinMaxDate(date, minDate, maxDate, startOfUnit, endOfUnit) ||\n isDisableDate({ date, disableDates, mode: 'time', timeType });\n const onClick = (e: React.MouseEvent<HTMLButtonElement>) =>\n !disabled && onChangeRef?.current?.(date, { e });\n\n return {\n label,\n selected,\n disabled,\n onClick,\n };\n });\n};\n\nexport const useTimeItems = (\n value?: Date,\n multiplicityHours?: number,\n multiplicityMinutes?: number,\n multiplicitySeconds?: number,\n onChange?: DateTimeTimePropOnChange,\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n): ResultItem[][] => {\n const onChangeRef = useMutableRef(onChange);\n\n return useMemo(\n () => [\n getItemData(\n 'hours',\n multiplicityHours,\n startOfDay,\n startOfHour,\n endOfHour,\n addHours,\n getLabelHours,\n value,\n minDate,\n maxDate,\n disableDates,\n onChangeRef,\n ),\n getItemData(\n 'minutes',\n multiplicityMinutes,\n startOfHour,\n startOfMinute,\n endOfMinute,\n addMinutes,\n getLabelMinutes,\n value,\n minDate,\n maxDate,\n disableDates,\n onChangeRef,\n ),\n getItemData(\n 'seconds',\n multiplicitySeconds,\n startOfMinute,\n startOfSecond,\n endOfSecond,\n addSeconds,\n getLabelSeconds,\n value,\n minDate,\n maxDate,\n disableDates,\n onChangeRef,\n ),\n ],\n [\n value?.getTime(),\n minDate?.getTime(),\n maxDate?.getTime(),\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n disableDates,\n ],\n );\n};\n"],"mappings":"AAAA,OACEA,QADF,CAEEC,UAFF,CAGEC,UAHF,CAIEC,SAJF,CAKEC,WALF,CAMEC,WANF,CAOEC,UAPF,CAQEC,WARF,CASEC,aATF,CAUEC,aAVF,CAWEC,YAXF,KAYO,UAZP,CAaA,OAASC,OAAT,KAAwB,OAAxB,CAEA,OAASC,aAAT,kDACA,OAASC,KAAT,4BACA,OAASC,aAAT,CAAwBC,cAAxB,2BACA,OAEEC,aAFF,CAGEC,eAHF,CAIEC,eAJF,kBAOA,MAAO,IAAMC,8BAA6B,CAAG,CAC3CC,KAAK,CAAE,oBADoC,CAE3CC,OAAO,CAAE,oBAFkC,CAG3CC,OAAO,CAAE,oBAHkC,CAAtC,CAoBP,GAAMC,YAAW,CAAG,SAClBC,CADkB,CAaD,IAXjBC,EAWiB,wDAXF,CAWE,CAV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W,CAAYQ,CAAZ,CAAkB,CAAEM,CAAC,CAADA,CAAF,CAAlB,CAAxB,CADc,CAGT,CAMR,CAhBM,CAiBR,CAxCD,CA0CA,MAAO,IAAME,aAAY,CAAG,SAC1BpB,CAD0B,CAE1BqB,CAF0B,CAG1BC,CAH0B,CAI1BC,CAJ0B,CAK1BC,CAL0B,CAM1BvB,CAN0B,CAO1BC,CAP0B,CAQ1BC,CAR0B,CASP,CACnB,GAAMC,EAAW,CAAGvB,aAAa,CAAC2C,CAAD,CAAjC,CAEA,MAAO5C,QAAO,CACZ,iBAAM,CACJY,WAAW,CACT,OADS,CAET6B,CAFS,CAGT9C,UAHS,CAITC,WAJS,CAKTJ,SALS,CAMTH,QANS,CAOTgB,aAPS,CAQTe,CARS,CASTC,CATS,CAUTC,CAVS,CAWTC,CAXS,CAYTC,CAZS,CADP,CAeJZ,WAAW,CACT,SADS,CAET8B,CAFS,CAGT9C,WAHS,CAITC,aAJS,CAKTJ,WALS,CAMTH,UANS,CAOTgB,eAPS,CAQTc,CARS,CASTC,CATS,CAUTC,CAVS,CAWTC,CAXS,CAYTC,CAZS,CAfP,CA6BJZ,WAAW,CACT,SADS,CAET+B,CAFS,CAGT9C,aAHS,CAITC,aAJS,CAKTJ,WALS,CAMTH,UANS,CAOTgB,eAPS,CAQTa,CARS,CASTC,CATS,CAUTC,CAVS,CAWTC,CAXS,CAYTC,CAZS,CA7BP,CAAN,CADY,CA6CZ,QACEJ,CADF,WACEA,CADF,QACEA,CAAK,CAAEyB,OAAP,EADF,QAEExB,CAFF,WAEEA,CAFF,QAEEA,CAAO,CAAEwB,OAAT,EAFF,QAGEvB,CAHF,WAGEA,CAHF,QAGEA,CAAO,CAAEuB,OAAT,EAHF,CAIEJ,CAJF,CAKEC,CALF,CAMEC,CANF,CAOEpB,CAPF,CA7CY,CAuDf,CAnEM"}
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["addHours","addMinutes","addSeconds","endOfHour","endOfMinute","endOfSecond","set","startOfDay","startOfHour","startOfMinute","startOfSecond","startOfToday","useMemo","useMutableRef","isDisableDate","isInMinMaxDate","getLabelHours","getLabelMinutes","getLabelSeconds","getTimeNumbers","getTimeOptionsKey","dateTimeTimePropLocaleDefault","hours","minutes","seconds","getItemData","timeType","startOfUnits","startOfUnit","endOfUnit","addUnits","getItemLabel","options","value","minDate","maxDate","disableDates","numbers","length","startDate","map","number","date","label","selected","disabled","mode","buildUnitItems","unit","validateUnit","newDate","target","items","getHours","getMinutes","getSeconds","exact","find","item","parseInt","first","i","getValidDate","timeOptions","Date","h","setHours","m","setMinutes","s","setSeconds","getFirstValidDateTime","start","isUnitSkipped","timeUnitOptions","Array","isArray","step","isHoursSkipped","validHours","filter","hour","hourDate","isMinutesSkipped","validMinutes","minute","minuteDate","isSecondsSkipped","validSeconds","useTimeItems","onChange","onChangeRef","wrap","onClick","e","valid","current","forEach","getTime","hoursItems","minutesItems","secondsItems"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeTime/helpers.ts"],"sourcesContent":["import {\n addHours,\n addMinutes,\n addSeconds,\n endOfHour,\n endOfMinute,\n endOfSecond,\n set,\n startOfDay,\n startOfHour,\n startOfMinute,\n startOfSecond,\n startOfToday,\n} from 'date-fns';\nimport { useMemo } from 'react';\n\nimport { useMutableRef } from '../../../hooks/useMutableRef/useMutableRef';\nimport { isDisableDate, isInMinMaxDate } from '../../../utils/date';\nimport {\n DateTimePropDisableDates,\n getLabelHours,\n getLabelMinutes,\n getLabelSeconds,\n getTimeNumbers,\n TimeOptions,\n TimeUnitOptions,\n} from '../helpers';\nimport { getTimeOptionsKey } from '../helpers/getTimeOptionsKey';\n\nexport const dateTimeTimePropLocaleDefault = {\n hours: 'Час',\n minutes: 'Мин',\n seconds: 'Сек',\n} as const;\n\ntype DateTimeTimePropOnChange = (\n value: Date,\n props: {\n e: React.MouseEvent<HTMLButtonElement>;\n },\n) => void;\n\ntype ResultItem = {\n label: string;\n date: Date;\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n selected?: boolean;\n};\n\nconst getItemData = (\n timeType: 'hours' | 'minutes' | 'seconds',\n startOfUnits: (date: Date) => Date,\n startOfUnit: (date: Date) => Date,\n endOfUnit: (date: Date) => Date,\n addUnits: typeof addHours | typeof addMinutes | typeof addSeconds,\n getItemLabel: (date: Date) => string,\n options?: TimeUnitOptions,\n value?: Date,\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n): ResultItem[] => {\n const numbers = getTimeNumbers(timeType, options);\n\n if (numbers.length === 0) {\n return [];\n }\n\n const startDate = startOfUnits(value || startOfToday());\n\n return numbers.map((number) => {\n const date = addUnits(startDate, number);\n const label = getItemLabel(date);\n const selected = value ? getItemLabel(date) === getItemLabel(value) : false;\n const disabled =\n !isInMinMaxDate(date, minDate, maxDate, startOfUnit, endOfUnit) ||\n isDisableDate({ date, disableDates, mode: 'time', timeType });\n\n return {\n label,\n date,\n selected,\n disabled,\n };\n });\n};\n\nconst buildUnitItems = (\n unit: 'hours' | 'minutes' | 'seconds',\n value?: Date,\n options?: TimeUnitOptions,\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n) => {\n switch (unit) {\n case 'hours':\n return getItemData(\n 'hours',\n startOfDay,\n startOfHour,\n endOfHour,\n addHours,\n getLabelHours,\n options,\n value,\n minDate,\n maxDate,\n disableDates,\n );\n case 'minutes':\n return getItemData(\n 'minutes',\n startOfHour,\n startOfMinute,\n endOfMinute,\n addMinutes,\n getLabelMinutes,\n options,\n value,\n minDate,\n maxDate,\n disableDates,\n );\n case 'seconds':\n return getItemData(\n 'seconds',\n startOfMinute,\n startOfSecond,\n endOfSecond,\n addSeconds,\n getLabelSeconds,\n options,\n value,\n minDate,\n maxDate,\n disableDates,\n );\n }\n};\n\nconst validateUnit = (\n newDate: Date,\n unit: 'hours' | 'minutes' | 'seconds',\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n options?: TimeUnitOptions,\n) => {\n const items = buildUnitItems(\n unit,\n newDate,\n options,\n minDate,\n maxDate,\n disableDates,\n );\n\n let target: number;\n switch (unit) {\n case 'hours':\n target = newDate.getHours();\n break;\n case 'minutes':\n target = newDate.getMinutes();\n break;\n case 'seconds':\n target = newDate.getSeconds();\n break;\n }\n\n const exact = items.find(\n (item) => parseInt(item.label, 10) === target && !item.disabled,\n );\n if (exact) return exact;\n\n const first = items.find((i) => !i.disabled);\n return first || null;\n};\n\nexport const getValidDate = (\n date: Date,\n timeOptions?: TimeOptions,\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n): Date => {\n const newDate = new Date(date);\n\n const h = validateUnit(\n newDate,\n 'hours',\n minDate,\n maxDate,\n disableDates,\n timeOptions?.hours,\n );\n if (h) newDate.setHours(parseInt(h.label, 10));\n\n const m = validateUnit(\n newDate,\n 'minutes',\n minDate,\n maxDate,\n disableDates,\n timeOptions?.minutes,\n );\n if (m) newDate.setMinutes(parseInt(m.label, 10));\n\n const s = validateUnit(\n newDate,\n 'seconds',\n minDate,\n maxDate,\n disableDates,\n timeOptions?.seconds,\n );\n if (s) newDate.setSeconds(parseInt(s.label, 10));\n\n return newDate;\n};\n\nexport const getFirstValidDateTime = (\n date: Date,\n timeOptions?: TimeOptions,\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n): Date => {\n const start = startOfDay(date);\n\n const isUnitSkipped = (timeUnitOptions: TimeUnitOptions | undefined) => {\n if (timeUnitOptions === undefined) {\n return false;\n }\n if (Array.isArray(timeUnitOptions)) {\n return timeUnitOptions.length === 0;\n }\n return timeUnitOptions?.step === 0;\n };\n\n const isHoursSkipped = isUnitSkipped(timeOptions?.hours);\n const validHours = isHoursSkipped\n ? [0]\n : buildUnitItems(\n 'hours',\n start,\n timeOptions?.hours,\n minDate,\n maxDate,\n disableDates,\n )\n .filter((h) => !h.disabled)\n .map((h) => parseInt(h.label, 10));\n\n if (!isHoursSkipped && validHours.length === 0) return start;\n\n for (const hour of validHours) {\n const hourDate = set(start, { hours: hour });\n const isMinutesSkipped = isUnitSkipped(timeOptions?.minutes);\n const validMinutes = isMinutesSkipped\n ? [0]\n : buildUnitItems(\n 'minutes',\n hourDate,\n timeOptions?.minutes,\n minDate,\n maxDate,\n disableDates,\n )\n .filter((m) => !m.disabled)\n .map((m) => parseInt(m.label, 10));\n if (!isMinutesSkipped && validMinutes.length === 0) continue;\n\n for (const minute of validMinutes) {\n const minuteDate = set(hourDate, { minutes: minute });\n const isSecondsSkipped = isUnitSkipped(timeOptions?.seconds);\n const validSeconds = isSecondsSkipped\n ? [0]\n : buildUnitItems(\n 'seconds',\n minuteDate,\n timeOptions?.seconds,\n minDate,\n maxDate,\n disableDates,\n )\n .filter((s) => !s.disabled)\n .map((s) => parseInt(s.label, 10));\n\n if (!isSecondsSkipped && validSeconds.length === 0) continue;\n\n return set(minuteDate, { seconds: validSeconds[0] });\n }\n }\n return start;\n};\n\nexport const useTimeItems = (\n value?: Date,\n timeOptions?: TimeOptions,\n onChange?: DateTimeTimePropOnChange,\n minDate?: Date,\n maxDate?: Date,\n disableDates?: DateTimePropDisableDates,\n): Omit<ResultItem, 'date'>[][] => {\n const onChangeRef = useMutableRef(onChange);\n\n const [hoursItems, minutesItems, secondsItems] = useMemo(() => {\n const hours = buildUnitItems(\n 'hours',\n value,\n timeOptions?.hours,\n minDate,\n maxDate,\n disableDates,\n );\n const minutes = buildUnitItems(\n 'minutes',\n value,\n timeOptions?.minutes,\n minDate,\n maxDate,\n disableDates,\n );\n const seconds = buildUnitItems(\n 'seconds',\n value,\n timeOptions?.seconds,\n minDate,\n maxDate,\n disableDates,\n );\n\n const wrap = (item: ResultItem) => {\n if (item.disabled) return;\n\n item.onClick = (e) => {\n const valid = getValidDate(\n item.date,\n timeOptions,\n minDate,\n maxDate,\n disableDates,\n );\n onChangeRef.current?.(valid, { e });\n };\n };\n\n hours.forEach(wrap);\n minutes.forEach(wrap);\n seconds.forEach(wrap);\n\n return [hours, minutes, seconds];\n }, [\n value?.getTime(),\n minDate?.getTime(),\n maxDate?.getTime(),\n getTimeOptionsKey(timeOptions),\n disableDates,\n ]);\n\n return [hoursItems, minutesItems, secondsItems];\n};\n"],"mappings":"86CAAA,OACEA,QADF,CAEEC,UAFF,CAGEC,UAHF,CAIEC,SAJF,CAKEC,WALF,CAMEC,WANF,CAOEC,GAPF,CAQEC,UARF,CASEC,WATF,CAUEC,aAVF,CAWEC,aAXF,CAYEC,YAZF,KAaO,UAbP,CAcA,OAASC,OAAT,KAAwB,OAAxB,CAEA,OAASC,aAAT,kDACA,OAASC,aAAT,CAAwBC,cAAxB,2BACA,OAEEC,aAFF,CAGEC,eAHF,CAIEC,eAJF,CAKEC,cALF,kBASA,OAASC,iBAAT,oCAEA,MAAO,IAAMC,8BAA6B,CAAG,CAC3CC,KAAK,CAAE,oBADoC,CAE3CC,OAAO,CAAE,oBAFkC,CAG3CC,OAAO,CAAE,oBAHkC,CAAtC,C,GAqBDC,YAAW,CAAG,SAClBC,CADkB,CAElBC,CAFkB,CAGlBC,CAHkB,CAIlBC,CAJkB,CAKlBC,CALkB,CAMlBC,CANkB,CAOlBC,CAPkB,CAQlBC,CARkB,CASlBC,CATkB,CAUlBC,CAVkB,CAWlBC,CAXkB,CAYD,CACjB,GAAMC,EAAO,CAAGlB,cAAc,CAACO,CAAD,CAAWM,CAAX,CAA9B,CAEA,GAAuB,CAAnB,GAAAK,CAAO,CAACC,MAAZ,CACE,MAAO,EAAP,CAGF,GAAMC,EAAS,CAAGZ,CAAY,CAACM,CAAK,EAAItB,YAAY,EAAtB,CAA9B,CAEA,MAAO0B,EAAO,CAACG,GAAR,CAAY,SAACC,CAAD,CAAY,IACvBC,EAAI,CAAGZ,CAAQ,CAACS,CAAD,CAAYE,CAAZ,CADQ,CAEvBE,CAAK,CAAGZ,CAAY,CAACW,CAAD,CAFG,CAGvBE,CAAQ,GAAGX,CAAH,EAAWF,CAAY,CAACW,CAAD,CAAZ,GA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B,CAK5BC,CAL4B,CAM5BC,CAN4B,CAjB+B,CA0BvDwD,CAAI,CAAG,SAAClC,CAAD,CAAsB,CAC7BA,CAAI,CAACb,QADwB,GAGjCa,CAAI,CAACmC,OAAL,CAAe,SAACC,CAAD,CAAO,OACdC,CAAK,CAAGjC,YAAY,CACxBJ,CAAI,CAAChB,IADmB,CAExBqB,CAFwB,CAGxB7B,CAHwB,CAIxBC,CAJwB,CAKxBC,CALwB,CADN,WAQpBuD,CAAW,CAACK,OARQ,qBAQpB,OAAAL,CAAW,CAAWI,CAAX,CAAkB,CAAED,CAAC,CAADA,CAAF,CAAlB,CACZ,CAZgC,CAalC,CAvC4D,CA6C7D,MAJAxE,EAAK,CAAC2E,OAAN,CAAcL,CAAd,CAIA,CAHArE,CAAO,CAAC0E,OAAR,CAAgBL,CAAhB,CAGA,CAFApE,CAAO,CAACyE,OAAR,CAAgBL,CAAhB,CAEA,CAAO,CAACtE,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CACR,CA9CuD,CA8CrD,QACDS,CADC,WACDA,CADC,QACDA,CAAK,CAAEiE,OAAP,EADC,QAEDhE,CAFC,WAEDA,CAFC,QAEDA,CAAO,CAAEgE,OAAT,EAFC,QAGD/D,CAHC,WAGDA,CAHC,QAGDA,CAAO,CAAE+D,OAAT,EAHC,CAID9E,iBAAiB,CAAC2C,CAAD,CAJhB,CAKD3B,CALC,CA9CqD,CAHvB,uBAG1B+D,CAH0B,MAGdC,CAHc,MAGAC,CAHA,MAyDjC,MAAO,CAACF,CAAD,CAAaC,CAAb,CAA2BC,CAA3B,CACR,CAjEM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate"
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate"];import{addYears,startOfDecade}from"date-fns";import ruLocale from"date-fns/locale/ru";import React,{forwardRef,useEffect}from"react";import{DateTime10Years}from"../DateTime10Years/DateTime10Years";import{DateTime100YearSlider}from"../DateTime100YearSlider/DateTime100YearSlider";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";import{DateTimeToggler}from"../DateTimeToggler/DateTimeToggler";import{getDecadeTitle,getHandleSelectDate,getYearsOfDecade,isEqualYear,moveTypes,useCurrentVisibleDate}from"../helpers";import{dateTimePropView,dateTimePropViewDefault}from"../helpers/types";import{cnDateTimeMixLayout}from"../mixs";export var DateTimeTypeYear=forwardRef(function(a,b){var c=a.minDate,d=a.maxDate,e=a.value,f=a.onChange,g=a.onChangeRange,h=a.disableDates,i=a.currentVisibleDate,j=a.events,k=a.locale,l=void 0===k?ruLocale:k,m=a.className,n=a.view,o=void 0===n?dateTimePropViewDefault:n,p=a.onMove,q=a.onChangeCurrentVisibleDate,r=_objectWithoutProperties(a,_excluded);useEffect(function(){null===p||void 0===p?void 0:p(moveTypes[0])},[]);var s=useCurrentVisibleDate({currentVisibleDate:i,maxDate:d,minDate:c,value:e,startOfUnit:startOfDecade,onChangeCurrentVisibleDate:q}),t=_slicedToArray(s,2),u=t[0],v=t[1],w=getHandleSelectDate({minDate:c,maxDate:d,value:e,onChange:f,onChangeRange:g,isEqualUnit:isEqualYear}),x=getYearsOfDecade({date:u,onChange:w,value:e,disableDates:h,events:j,minDate:c,maxDate:d,locale:l}),y=getDecadeTitle(u),z=function(){return v(addYears(u,10))},A=function(){return v(addYears(u,-10))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:A,nextOnClick:z,label:y}),React.createElement(DateTime10Years,{years:x}));var B=addYears(u,10),C=getYearsOfDecade({date:B,onChange:w,value:e,events:j,disableDates:h,minDate:c,maxDate:d,locale:l}),D=getDecadeTitle(B);return o===dateTimePropView[1]?React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:A,label:y}),React.createElement(DateTime10Years,{years:x})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:z,label:D}),React.createElement(DateTime10Years,{years:C}))):React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTime100YearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:u,onChange:v,value:e,locale:l}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:y}),React.createElement(DateTime10Years,{years:x})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:D}),React.createElement(DateTime10Years,{years:C}))))});
|
|
2
2
|
//# sourceMappingURL=DateTimeTypeYear.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeTypeYear.js","names":["addYears","startOfDecade","ruLocale","React","forwardRef","useEffect","DateTime10Years","DateTime100YearSlider","DateTimeLabel","DateTimeToggler","getDecadeTitle","getHandleSelectDate","getYearsOfDecade","isEqualYear","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeYear","props","ref","minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDateProp","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate","multiplicityHours","multiplicityMinutes","multiplicitySeconds","otherProps","startOfUnit","setCurrentVisibleDate","handleSelectDate","isEqualUnit","pageOneYearsOfDecade","date","pageOneLabel","handleNext","handlePrev","pageTwoCurrentVisibleDate","pageTwoYearsOfDecade","pageTwoLabel"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { DateTime10Years } from '../DateTime10Years/DateTime10Years';\nimport { DateTime100YearSlider } from '../DateTime100YearSlider/DateTime100YearSlider';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport {\n DateTimeTypeComponent,\n getDecadeTitle,\n getHandleSelectDate,\n getYearsOfDecade,\n isEqualYear,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeYear: DateTimeTypeComponent<'year'> = forwardRef(\n (props, ref) => {\n const {\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n disableDates,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n className,\n view = dateTimePropViewDefault,\n onMove,\n onChangeCurrentVisibleDate,\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n ...otherProps\n } = props;\n\n useEffect(() => {\n onMove?.(moveTypes[0]);\n }, []);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n });\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualYear,\n });\n\n const pageOneYearsOfDecade = getYearsOfDecade({\n date: currentVisibleDate,\n onChange: handleSelectDate,\n value,\n disableDates,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getDecadeTitle(currentVisibleDate);\n\n const handleNext = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, 10));\n const handlePrev = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, -10));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n nextOnClick={handleNext}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addYears(currentVisibleDate, 10);\n\n const pageTwoYearsOfDecade = getYearsOfDecade({\n date: pageTwoCurrentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n disableDates,\n minDate,\n maxDate,\n locale,\n });\n\n const pageTwoLabel = getDecadeTitle(pageTwoCurrentVisibleDate);\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={handleNext}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTime100YearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n </div>\n );\n },\n);\n"],"mappings":"4YAAA,OAASA,QAAT,CAAmBC,aAAnB,KAAwC,UAAxC,CACA,MAAOC,SAAP,KAAqB,oBAArB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OAASC,eAAT,0CACA,OAASC,qBAAT,sDACA,OAASC,aAAT,sCACA,OAASC,eAAT,0CACA,OAEEC,cAFF,CAGEC,mBAHF,CAIEC,gBAJF,CAKEC,WALF,CAMEC,SANF,CAOEC,qBAPF,kBASA,OAASC,gBAAT,CAA2BC,uBAA3B,wBACA,OAASC,mBAAT,eAEA,MAAO,IAAMC,iBAA+C,CAAGf,UAAU,CACvE,SAACgB,CAAD,CAAQC,CAAR,CAAgB,CACd,GACEC,EADF,CAkBIF,CAlBJ,CACEE,OADF,CAEEC,CAFF,CAkBIH,CAlBJ,CAEEG,OAFF,CAGEC,CAHF,CAkBIJ,CAlBJ,CAGEI,KAHF,CAIEC,CAJF,CAkBIL,CAlBJ,CAIEK,QAJF,CAKEC,CALF,CAkBIN,CAlBJ,CAKEM,aALF,CAMEC,CANF,CAkBIP,CAlBJ,CAMEO,YANF,CAOsBC,CAPtB,CAkBIR,CAlBJ,CAOES,kBAPF,CAQEC,CARF,CAkBIV,CAlBJ,CAQEU,MARF,GAkBIV,CAlBJ,CASEW,MATF,CASEA,CATF,YASW7B,QATX,GAUE8B,CAVF,CAkBIZ,CAlBJ,CAUEY,SAVF,GAkBIZ,CAlBJ,CAWEa,IAXF,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F,CARF,CAZF,CA8BH,CAzJsE,CAAlE"}
|
|
1
|
+
{"version":3,"file":"DateTimeTypeYear.js","names":["addYears","startOfDecade","ruLocale","React","forwardRef","useEffect","DateTime10Years","DateTime100YearSlider","DateTimeLabel","DateTimeToggler","getDecadeTitle","getHandleSelectDate","getYearsOfDecade","isEqualYear","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeYear","props","ref","minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDateProp","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate","otherProps","startOfUnit","setCurrentVisibleDate","handleSelectDate","isEqualUnit","pageOneYearsOfDecade","date","pageOneLabel","handleNext","handlePrev","pageTwoCurrentVisibleDate","pageTwoYearsOfDecade","pageTwoLabel"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { DateTime10Years } from '../DateTime10Years/DateTime10Years';\nimport { DateTime100YearSlider } from '../DateTime100YearSlider/DateTime100YearSlider';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport {\n DateTimeTypeComponent,\n getDecadeTitle,\n getHandleSelectDate,\n getYearsOfDecade,\n isEqualYear,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeYear: DateTimeTypeComponent<'year'> = forwardRef(\n (props, ref) => {\n const {\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n disableDates,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n className,\n view = dateTimePropViewDefault,\n onMove,\n onChangeCurrentVisibleDate,\n ...otherProps\n } = props;\n\n useEffect(() => {\n onMove?.(moveTypes[0]);\n }, []);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n });\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualYear,\n });\n\n const pageOneYearsOfDecade = getYearsOfDecade({\n date: currentVisibleDate,\n onChange: handleSelectDate,\n value,\n disableDates,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getDecadeTitle(currentVisibleDate);\n\n const handleNext = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, 10));\n const handlePrev = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, -10));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n nextOnClick={handleNext}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addYears(currentVisibleDate, 10);\n\n const pageTwoYearsOfDecade = getYearsOfDecade({\n date: pageTwoCurrentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n disableDates,\n minDate,\n maxDate,\n locale,\n });\n\n const pageTwoLabel = getDecadeTitle(pageTwoCurrentVisibleDate);\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={handleNext}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTime100YearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n </div>\n );\n },\n);\n"],"mappings":"4UAAA,OAASA,QAAT,CAAmBC,aAAnB,KAAwC,UAAxC,CACA,MAAOC,SAAP,KAAqB,oBAArB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OAASC,eAAT,0CACA,OAASC,qBAAT,sDACA,OAASC,aAAT,sCACA,OAASC,eAAT,0CACA,OAEEC,cAFF,CAGEC,mBAHF,CAIEC,gBAJF,CAKEC,WALF,CAMEC,SANF,CAOEC,qBAPF,kBASA,OAASC,gBAAT,CAA2BC,uBAA3B,wBACA,OAASC,mBAAT,eAEA,MAAO,IAAMC,iBAA+C,CAAGf,UAAU,CACvE,SAACgB,CAAD,CAAQC,CAAR,CAAgB,CACd,GACEC,EADF,CAeIF,CAfJ,CACEE,OADF,CAEEC,CAFF,CAeIH,CAfJ,CAEEG,OAFF,CAGEC,CAHF,CAeIJ,CAfJ,CAGEI,KAHF,CAIEC,CAJF,CAeIL,CAfJ,CAIEK,QAJF,CAKEC,CALF,C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AmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAE8B,CAFT,EADF,CAKE,oBAAC,eAAD,EAAiB,KAAK,CAAED,CAAxB,EALF,CARF,CAZF,CA8BH,CAtJsE,CAAlE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var serializeDisableDatesItem=function(a){if(a instanceof Date)return"D:".concat(a.getTime());var b=_slicedToArray(a,2),c=b[0],d=b[1];return"R:".concat(c.getTime(),"-").concat(d.getTime())};export var getDisableDatesKey=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"none",c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:"|";if(!a||0===a.length)return b;var d=a.map(serializeDisableDatesItem),e=Array.from(d).sort();return e.join(c)};
|
|
2
|
+
//# sourceMappingURL=getDisableDatesKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDisableDatesKey.js","names":["serializeDisableDatesItem","item","Date","getTime","d1","d2","getDisableDatesKey","disableDates","defaultValue","separator","length","items","map","uniqueSorted","Array","from","sort","join"],"sources":["../../../../../../src/components/DateTime/helpers/getDisableDatesKey.ts"],"sourcesContent":["import { DateTimePropDisableDates } from './types';\n\nconst serializeDisableDatesItem = (item: Date | [Date, Date]): string => {\n if (item instanceof Date) {\n return `D:${item.getTime()}`;\n }\n\n const [d1, d2] = item;\n return `R:${d1.getTime()}-${d2.getTime()}`;\n};\n\nexport const getDisableDatesKey = (\n disableDates?: DateTimePropDisableDates,\n defaultValue: string = 'none',\n separator: string = '|',\n): string => {\n if (!disableDates || disableDates.length === 0) {\n return defaultValue;\n }\n\n const items = disableDates.map(serializeDisableDatesItem);\n\n const uniqueSorted = Array.from(items).sort();\n\n return uniqueSorted.join(separator);\n};\n"],"mappings":"iEAEA,GAAMA,0BAAyB,CAAG,SAACC,CAAD,CAAuC,CACvE,GAAIA,CAAI,WAAYC,KAApB,CACE,kBAAYD,CAAI,CAACE,OAAL,EAAZ,EAGF,qBAAiBF,CAAjB,IAAOG,CAAP,MAAWC,CAAX,MACA,kBAAYD,CAAE,CAACD,OAAH,EAAZ,aAA4BE,CAAE,CAACF,OAAH,EAA5B,CACD,CAPD,CASA,MAAO,IAAMG,mBAAkB,CAAG,SAChCC,CADgC,CAIrB,IAFXC,EAEW,wDAFY,MAEZ,CADXC,CACW,wDADS,GACT,CACX,GAAI,CAACF,CAAD,EAAyC,CAAxB,GAAAA,CAAY,CAACG,MAAlC,CACE,MAAOF,EAAP,CAFS,GAKLG,EAAK,CAAGJ,CAAY,CAACK,GAAb,CAAiBZ,yBAAjB,CALH,CAOLa,CAAY,CAAGC,KAAK,CAACC,IAAN,CAAWJ,CAAX,EAAkBK,IAAlB,EAPV,CASX,MAAOH,EAAY,CAACI,IAAb,CAAkBR,CAAlB,CACR,CAdM"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{range}from"../../../utils/array";export var getTimeNumbers=function(a,b){var c="hours"===a?23:59;if(b===void 0||!Array.isArray(b)&&"object"==typeof b&&0===Object.keys(b).length)return range(c+1);if(Array.isArray(b)){var j=b.filter(function(a){return"number"==typeof a&&Number.isInteger(a)&&0<=a&&a<=c});return Array.from(new Set(j)).sort(function(c,a){return c-a})}var d=function(a,b,c,d){return void 0!==a&&Number.isFinite(a)?Math.max(b,Math.min(c,a)):d},e=d(b.step,0,c+1,1),f=d(b.start,0,c,0),g=d(b.stop,0,c,c);if(0===e)return[];if(f>g){var h=[g,f];f=h[0],g=h[1]}var i=Math.floor((g-f)/e)+1;return Array.from({length:i},function(a,b){return f+b*e})};
|
|
2
|
+
//# sourceMappingURL=getTimeNumbers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTimeNumbers.js","names":["range","getTimeNumbers","timeType","options","maxValue","Array","isArray","Object","keys","length","filtered","filter","n","Number","isInteger","from","Set","sort","a","b","getClampedValue","val","minVal","maxVal","defaultVal","isFinite","Math","max","min","step","start","stop","numSteps","floor","_","i"],"sources":["../../../../../../src/components/DateTime/helpers/getTimeNumbers.ts"],"sourcesContent":["import { range } from '##/utils/array';\n\nimport { TimeUnitOptions } from './types';\n\nexport const getTimeNumbers = (\n timeType: 'hours' | 'minutes' | 'seconds',\n options?: TimeUnitOptions,\n): number[] => {\n const minValue = 0;\n const maxValue = timeType === 'hours' ? 23 : 59;\n\n if (\n options === undefined ||\n (!Array.isArray(options) &&\n typeof options === 'object' &&\n Object.keys(options).length === 0)\n ) {\n return range(maxValue + 1);\n }\n\n if (Array.isArray(options)) {\n const filtered = options.filter(\n (n): n is number =>\n typeof n === 'number' &&\n Number.isInteger(n) &&\n n >= minValue &&\n n <= maxValue,\n );\n return Array.from(new Set(filtered)).sort((a, b) => a - b);\n }\n\n const getClampedValue = (\n val: number | undefined,\n minVal: number,\n maxVal: number,\n defaultVal: number,\n ): number => {\n if (val === undefined || !Number.isFinite(val)) {\n return defaultVal;\n }\n return Math.max(minVal, Math.min(maxVal, val));\n };\n\n const step = getClampedValue(options.step, minValue, maxValue + 1, 1);\n let start = getClampedValue(options.start, minValue, maxValue, 0);\n let stop = getClampedValue(options.stop, minValue, maxValue, maxValue);\n\n if (step === 0) {\n return [];\n }\n\n if (start > stop) {\n [start, stop] = [stop, start];\n }\n\n const numSteps = Math.floor((stop - start) / step) + 1;\n return Array.from({ length: numSteps }, (_, i) => start + i * step);\n};\n"],"mappings":"AAAA,OAASA,KAAT,4BAIA,MAAO,IAAMC,eAAc,CAAG,SAC5BC,CAD4B,CAE5BC,CAF4B,CAGf,IAEPC,EAAQ,CAAgB,OAAb,GAAAF,CAAQ,CAAe,EAAf,CAAoB,EAFhC,CAIb,GACEC,CAAO,SAAP,EACC,CAACE,KAAK,CAACC,OAAN,CAAcH,CAAd,CAAD,EACoB,QAAnB,QAAOA,EADR,EAEiC,CAAhC,GAAAI,MAAM,CAACC,IAAP,CAAYL,CAAZ,EAAqBM,MAJzB,CAME,MAAOT,MAAK,CAACI,CAAQ,C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,CAAR,EAAiBD,CAA5B,EAAoC,CAArD,CACA,MAAOxB,MAAK,CAACU,IAAN,CAAW,CAAEN,MAAM,CAAEuB,CAAV,CAAX,CAAiC,SAACE,CAAD,CAAIC,CAAJ,QAAUL,EAAK,CAAGK,CAAC,CAAGN,CAAtB,CAAjC,CACR,CArDM"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var getTimeUnitOptionsKey=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"default",c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:",";if(!a)return b;if(Array.isArray(a))return"[".concat(_toConsumableArray(a).sort(function(c,a){return c-a}).join(","),"]");var d=a.start,e=a.stop,f=a.step;return"{".concat([null!==d&&void 0!==d?d:b,null!==e&&void 0!==e?e:b,null!==f&&void 0!==f?f:b].join(c),"}")};export var getTimeOptionsKey=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"default",c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:"|",d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:",";return a?[getTimeUnitOptionsKey(a.hours,b,d),getTimeUnitOptionsKey(a.minutes,b,d),getTimeUnitOptionsKey(a.seconds,b,d)].join(c):b};
|
|
2
|
+
//# sourceMappingURL=getTimeOptionsKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTimeOptionsKey.js","names":["getTimeUnitOptionsKey","unitOption","defaultValue","separator","Array","isArray","sort","a","b","join","start","stop","step","getTimeOptionsKey","timeOptions","unitSeparator","paramSeparator","hours","minutes","seconds"],"sources":["../../../../../../src/components/DateTime/helpers/getTimeOptionsKey.ts"],"sourcesContent":["import { TimeOptions, TimeUnitOptions } from './types';\n\nconst getTimeUnitOptionsKey = (\n unitOption?: TimeUnitOptions,\n defaultValue: string = 'default',\n separator: string = ',',\n): string => {\n if (!unitOption) return defaultValue;\n\n if (Array.isArray(unitOption)) {\n return `[${[...unitOption].sort((a, b) => a - b).join(',')}]`;\n }\n\n const { start, stop, step } = unitOption;\n return `{${[\n start ?? defaultValue,\n stop ?? defaultValue,\n step ?? defaultValue,\n ].join(separator)}}`;\n};\n\nexport const getTimeOptionsKey = (\n timeOptions?: TimeOptions,\n defaultValue: string = 'default',\n unitSeparator: string = '|',\n paramSeparator: string = ',',\n): string => {\n if (!timeOptions) return defaultValue;\n\n return [\n getTimeUnitOptionsKey(timeOptions.hours, defaultValue, paramSeparator),\n getTimeUnitOptionsKey(timeOptions.minutes, defaultValue, paramSeparator),\n getTimeUnitOptionsKey(timeOptions.seconds, defaultValue, paramSeparator),\n ].join(unitSeparator);\n};\n"],"mappings":"yEAEA,GAAMA,sBAAqB,CAAG,SAC5BC,CAD4B,CAIjB,IAFXC,EAEW,wDAFY,SAEZ,CADXC,CACW,wDADS,GACT,CACX,GAAI,CAACF,CAAL,CAAiB,MAAOC,EAAP,CAEjB,GAAIE,KAAK,CAACC,OAAN,CAAcJ,CAAd,CAAJ,CACE,iBAAW,mBAAIA,CAAJ,EAAgBK,IAAhB,CAAqB,SAACC,CAAD,CAAIC,CAAJ,QAAUD,EAAC,CAAGC,CAAd,CAArB,EAAsCC,IAAtC,CAA2C,GAA3C,CAAX,MAGF,GAAQC,EAAR,CAA8BT,CAA9B,CAAQS,KAAR,CAAeC,CAAf,CAA8BV,CAA9B,CAAeU,IAAf,CAAqBC,CAArB,CAA8BX,CAA9B,CAAqBW,IAArB,CACA,iBAAW,QACTF,CADS,WACTA,CADS,CACTA,CADS,CACAR,CADA,QAETS,CAFS,WAETA,CAFS,CAETA,CAFS,CAEDT,CAFC,QAGTU,CAHS,WAGTA,CAHS,CAGTA,CAHS,CAGDV,CAHC,EAITO,IAJS,CAIJN,CAJI,CAAX,KAKD,CAjBD,CAmBA,MAAO,IAAMU,kBAAiB,CAAG,SAC/BC,CAD+B,CAKpB,IAHXZ,EAGW,wDAHY,SAGZ,CAFXa,CAEW,wDAFa,GAEb,CADXC,CACW,wDADc,GACd,OACNF,EADM,CAGJ,CACLd,qBAAqB,CAACc,CAAW,CAACG,KAAb,CAAoBf,CAApB,CAAkCc,CAAlC,CADhB,CAELhB,qBAAqB,CAACc,CAAW,CAACI,OAAb,CAAsBhB,CAAtB,CAAoCc,CAApC,CAFhB,CAGLhB,qBAAqB,CAACc,CAAW,CAACK,OAAb,CAAsBjB,CAAtB,CAAoCc,CAApC,CAHhB,EAILP,IAJK,CAIAM,CAJA,CAHI,CACcb,CAO1B,CAbM"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Locale } from 'date-fns';
|
|
2
2
|
import { DateRange } from '../../../utils/types/Date';
|
|
3
|
+
import { DateTimePropType } from './types';
|
|
3
4
|
export declare const dateComparer: (a?: Date, b?: Date) => number;
|
|
4
5
|
export declare const getStartAndEndDate: (date1: Date, date2: Date) => Date[];
|
|
5
6
|
export declare const isDateSelected: ({ date, value, }: {
|
|
@@ -24,6 +25,7 @@ export declare const getLabelMinutes: (date: Date) => string;
|
|
|
24
25
|
export declare const getLabelSeconds: (date: Date) => string;
|
|
25
26
|
export declare const getDaysOfWeek: (locale: Locale) => string[];
|
|
26
27
|
export declare const getTimeTitle: (value: Date | undefined, multiplicityHours: number | undefined, multiplicityMinutes: number | undefined, multiplicitySeconds: number | undefined) => string;
|
|
28
|
+
export declare const isTypeWithTime: (type: DateTimePropType) => boolean;
|
|
27
29
|
export * from './useCurrentVisibleDate';
|
|
28
30
|
export * from './types';
|
|
29
31
|
export * from './getDaysOfMonth';
|
|
@@ -33,3 +35,4 @@ export * from './isEqualDay';
|
|
|
33
35
|
export * from './isEqualYear';
|
|
34
36
|
export * from './isEqualMount';
|
|
35
37
|
export * from './getMonthsOfYear';
|
|
38
|
+
export * from './getTimeNumbers';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{addYears,endOfWeek,format,isBefore,isSameDay,isWithinInterval,startOfWeek}from"date-fns";import eachDayOfInterval from"date-fns/eachDayOfInterval";import{isDateRange,isOnlyOneDateInRange}from"../../../utils/date";import{isDefined}from"../../../utils/type-guards";export var dateComparer=function(c,a){var b,d;return(null!==(b=null===c||void 0===c?void 0:c.getTime())&&void 0!==b?b:0)-(null!==(d=null===a||void 0===a?void 0:a.getTime())&&void 0!==d?d:0)};export var getStartAndEndDate=function(a,b){return[a,b].sort(dateComparer)};export var isDateSelected=function(a){var b=a.date,c=a.value;return!!c&&isSameDay(c,b)};export var isValueSelected=function(a){var b=a.date,c=a.value;if(isDateRange(c)){if(c[0]&&c[1]){var d=getStartAndEndDate(c[0],c[1]),e=_slicedToArray(d,2),f=e[0],g=e[1];return isWithinInterval(b,{start:f,end:g})}return isDateSelected({date:b,value:c[0]||c[1]})}return isDateSelected({date:b,value:c})};export var isValueSelectedBackwards=function(a){var b=a.value,c=a.hoveredDate;return c&&isDateRange(b)&&isOnlyOneDateInRange(b)&&(isDefined(b[0])&&isBefore(c,b[0])||isDefined(b[1])&&isBefore(c,b[1]))};export var getMonthTitle=function(a,b){return format(a,"LLLL",{locale:b})};export var getMonthTitleAbbreviated=function(a,b){var c=format(a,"LLL",{locale:b});return"."===c[c.length-1]?c.substr(0,c.length-1):c};export var getYearTitle=function(a){return format(a,"yyyy")};export var getMouthLabelWithYear=function(a,b){return"".concat(getMonthTitle(a,b)," ").concat(a.getFullYear())};export var getDecadeTitle=function(a){return"".concat(getYearTitle(a)," - ").concat(getYearTitle(addYears(a,9)))};export var getLabelHours=function(a){return format(a,"HH")};export var getLabelMinutes=function(a){return format(a,"mm")};export var getLabelSeconds=function(a){return format(a,"ss")};export var getDaysOfWeek=function(a){var b=new Date;return eachDayOfInterval({start:startOfWeek(b,{locale:a}),end:endOfWeek(b,{locale:a})}).map(function(b){return format(b,"EEEEEE",{locale:a})})};var getUnitLabelMap=[getLabelHours,getLabelMinutes,getLabelSeconds];export var getTimeTitle=function(a,b,c,d){return[b,c,d].map(function(b,c){return a?b?"".concat(getUnitLabelMap[c](a),":"):"":b?"--:":""}).join("").slice(0,-1)};export*from"./useCurrentVisibleDate";export*from"./types";export*from"./getDaysOfMonth";export*from"./getYearsOfDecade";export*from"./getHandleSelectDate";export*from"./isEqualDay";export*from"./isEqualYear";export*from"./isEqualMount";export*from"./getMonthsOfYear";
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{addYears,endOfWeek,format,isBefore,isSameDay,isWithinInterval,startOfWeek}from"date-fns";import eachDayOfInterval from"date-fns/eachDayOfInterval";import{isDateRange,isOnlyOneDateInRange}from"../../../utils/date";import{isDefined}from"../../../utils/type-guards";export var dateComparer=function(c,a){var b,d;return(null!==(b=null===c||void 0===c?void 0:c.getTime())&&void 0!==b?b:0)-(null!==(d=null===a||void 0===a?void 0:a.getTime())&&void 0!==d?d:0)};export var getStartAndEndDate=function(a,b){return[a,b].sort(dateComparer)};export var isDateSelected=function(a){var b=a.date,c=a.value;return!!c&&isSameDay(c,b)};export var isValueSelected=function(a){var b=a.date,c=a.value;if(isDateRange(c)){if(c[0]&&c[1]){var d=getStartAndEndDate(c[0],c[1]),e=_slicedToArray(d,2),f=e[0],g=e[1];return isWithinInterval(b,{start:f,end:g})}return isDateSelected({date:b,value:c[0]||c[1]})}return isDateSelected({date:b,value:c})};export var isValueSelectedBackwards=function(a){var b=a.value,c=a.hoveredDate;return c&&isDateRange(b)&&isOnlyOneDateInRange(b)&&(isDefined(b[0])&&isBefore(c,b[0])||isDefined(b[1])&&isBefore(c,b[1]))};export var getMonthTitle=function(a,b){return format(a,"LLLL",{locale:b})};export var getMonthTitleAbbreviated=function(a,b){var c=format(a,"LLL",{locale:b});return"."===c[c.length-1]?c.substr(0,c.length-1):c};export var getYearTitle=function(a){return format(a,"yyyy")};export var getMouthLabelWithYear=function(a,b){return"".concat(getMonthTitle(a,b)," ").concat(a.getFullYear())};export var getDecadeTitle=function(a){return"".concat(getYearTitle(a)," - ").concat(getYearTitle(addYears(a,9)))};export var getLabelHours=function(a){return format(a,"HH")};export var getLabelMinutes=function(a){return format(a,"mm")};export var getLabelSeconds=function(a){return format(a,"ss")};export var getDaysOfWeek=function(a){var b=new Date;return eachDayOfInterval({start:startOfWeek(b,{locale:a}),end:endOfWeek(b,{locale:a})}).map(function(b){return format(b,"EEEEEE",{locale:a})})};var getUnitLabelMap=[getLabelHours,getLabelMinutes,getLabelSeconds];export var getTimeTitle=function(a,b,c,d){return[b,c,d].map(function(b,c){return a?b?"".concat(getUnitLabelMap[c](a),":"):"":b?"--:":""}).join("").slice(0,-1)};export var isTypeWithTime=function(a){return-1!==a.indexOf("time")};export*from"./useCurrentVisibleDate";export*from"./types";export*from"./getDaysOfMonth";export*from"./getYearsOfDecade";export*from"./getHandleSelectDate";export*from"./isEqualDay";export*from"./isEqualYear";export*from"./isEqualMount";export*from"./getMonthsOfYear";export*from"./getTimeNumbers";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["addYears","endOfWeek","format","isBefore","isSameDay","isWithinInterval","startOfWeek","eachDayOfInterval","isDateRange","isOnlyOneDateInRange","isDefined","dateComparer","a","b","getTime","getStartAndEndDate","date1","date2","sort","isDateSelected","date","value","isValueSelected","start","end","isValueSelectedBackwards","hoveredDate","getMonthTitle","locale","getMonthTitleAbbreviated","title","length","substr","getYearTitle","getMouthLabelWithYear","getFullYear","getDecadeTitle","getLabelHours","getLabelMinutes","getLabelSeconds","getDaysOfWeek","now","Date","map","getUnitLabelMap","getTimeTitle","multiplicityHours","multiplicityMinutes","multiplicitySeconds","item","i","join","slice"],"sources":["../../../../../../src/components/DateTime/helpers/index.ts"],"sourcesContent":["import {\n addYears,\n endOfWeek,\n format,\n isBefore,\n isSameDay,\n isWithinInterval,\n Locale,\n startOfWeek,\n} from 'date-fns';\nimport eachDayOfInterval from 'date-fns/eachDayOfInterval';\n\nimport { isDateRange, isOnlyOneDateInRange } from '../../../utils/date';\nimport { isDefined } from '../../../utils/type-guards';\nimport { DateRange } from '../../../utils/types/Date';\n\nexport const dateComparer = (a?: Date, b?: Date): number =>\n (a?.getTime() ?? 0) - (b?.getTime() ?? 0);\n\nexport const getStartAndEndDate = (date1: Date, date2: Date): Date[] =>\n [date1, date2].sort(dateComparer);\n\nexport const isDateSelected = ({\n date,\n value,\n}: {\n date: Date;\n value?: Date;\n}): boolean => {\n return value ? isSameDay(value, date) : false;\n};\n\nexport const isValueSelected = ({\n date,\n value,\n}: {\n date: Date;\n value?: Date | DateRange;\n}): boolean => {\n if (isDateRange(value)) {\n if (value[0] && value[1]) {\n const [start, end] = getStartAndEndDate(value[0], value[1]);\n return isWithinInterval(date, { start, end });\n }\n\n return isDateSelected({ date, value: value[0] || value[1] });\n }\n return isDateSelected({ date, value });\n};\n\nexport const isValueSelectedBackwards = ({\n value,\n hoveredDate,\n}: {\n value?: Date | DateRange;\n hoveredDate?: Date;\n}): boolean | undefined => {\n return (\n hoveredDate &&\n isDateRange(value) &&\n isOnlyOneDateInRange(value) &&\n ((isDefined(value[0]) && isBefore(hoveredDate, value[0])) ||\n (isDefined(value[1]) && isBefore(hoveredDate, value[1])))\n );\n};\n\nexport const getMonthTitle = (date: Date, locale: Locale): string => {\n return format(date, 'LLLL', { locale });\n};\n\nexport const getMonthTitleAbbreviated = (\n date: Date,\n locale: Locale,\n): string => {\n const title = format(date, 'LLL', { locale });\n\n if (title[title.length - 1] === '.') {\n return title.substr(0, title.length - 1);\n }\n\n return title;\n};\n\nexport const getYearTitle = (date: Date): string => {\n return format(date, 'yyyy');\n};\n\nexport const getMouthLabelWithYear = (date: Date, locale: Locale): string => {\n return `${getMonthTitle(date, locale)} ${date.getFullYear()}`;\n};\n\nexport const getDecadeTitle = (date: Date): string => {\n return `${getYearTitle(date)} - ${getYearTitle(addYears(date, 9))}`;\n};\n\nexport const getLabelHours = (date: Date) => format(date, 'HH');\nexport const getLabelMinutes = (date: Date) => format(date, 'mm');\nexport const getLabelSeconds = (date: Date) => format(date, 'ss');\n\nexport const getDaysOfWeek = (locale: Locale): string[] => {\n const now = new Date();\n\n return eachDayOfInterval({\n start: startOfWeek(now, { locale }),\n end: endOfWeek(now, { locale }),\n }).map((date) => format(date, 'EEEEEE', { locale }));\n};\n\nconst getUnitLabelMap = [getLabelHours, getLabelMinutes, getLabelSeconds];\n\nexport const getTimeTitle = (\n value: Date | undefined,\n multiplicityHours: number | undefined,\n multiplicityMinutes: number | undefined,\n multiplicitySeconds: number | undefined,\n): string =>\n [multiplicityHours, multiplicityMinutes, multiplicitySeconds]\n .map((item, i) => {\n if (!value) {\n return item ? '--:' : '';\n }\n return item ? `${getUnitLabelMap[i](value)}:` : '';\n })\n .join('')\n .slice(0, -1);\n\nexport * from './useCurrentVisibleDate';\nexport * from './types';\nexport * from './getDaysOfMonth';\nexport * from './getYearsOfDecade';\nexport * from './getHandleSelectDate';\nexport * from './isEqualDay';\nexport * from './isEqualYear';\nexport * from './isEqualMount';\nexport * from './getMonthsOfYear';\n"],"mappings":"iEAAA,OACEA,QADF,CAEEC,SAFF,CAGEC,MAHF,CAIEC,QAJF,CAKEC,SALF,CAMEC,gBANF,CAQEC,WARF,KASO,UATP,CAUA,MAAOC,kBAAP,KAA8B,4BAA9B,CAEA,OAASC,WAAT,CAAsBC,oBAAtB,2BACA,OAASC,SAAT,
|
|
1
|
+
{"version":3,"file":"index.js","names":["addYears","endOfWeek","format","isBefore","isSameDay","isWithinInterval","startOfWeek","eachDayOfInterval","isDateRange","isOnlyOneDateInRange","isDefined","dateComparer","a","b","getTime","getStartAndEndDate","date1","date2","sort","isDateSelected","date","value","isValueSelected","start","end","isValueSelectedBackwards","hoveredDate","getMonthTitle","locale","getMonthTitleAbbreviated","title","length","substr","getYearTitle","getMouthLabelWithYear","getFullYear","getDecadeTitle","getLabelHours","getLabelMinutes","getLabelSeconds","getDaysOfWeek","now","Date","map","getUnitLabelMap","getTimeTitle","multiplicityHours","multiplicityMinutes","multiplicitySeconds","item","i","join","slice","isTypeWithTime","type","indexOf"],"sources":["../../../../../../src/components/DateTime/helpers/index.ts"],"sourcesContent":["import {\n addYears,\n endOfWeek,\n format,\n isBefore,\n isSameDay,\n isWithinInterval,\n Locale,\n startOfWeek,\n} from 'date-fns';\nimport eachDayOfInterval from 'date-fns/eachDayOfInterval';\n\nimport { isDateRange, isOnlyOneDateInRange } from '../../../utils/date';\nimport { isDefined } from '../../../utils/type-guards';\nimport { DateRange } from '../../../utils/types/Date';\nimport { DateTimePropType } from './types';\n\nexport const dateComparer = (a?: Date, b?: Date): number =>\n (a?.getTime() ?? 0) - (b?.getTime() ?? 0);\n\nexport const getStartAndEndDate = (date1: Date, date2: Date): Date[] =>\n [date1, date2].sort(dateComparer);\n\nexport const isDateSelected = ({\n date,\n value,\n}: {\n date: Date;\n value?: Date;\n}): boolean => {\n return value ? isSameDay(value, date) : false;\n};\n\nexport const isValueSelected = ({\n date,\n value,\n}: {\n date: Date;\n value?: Date | DateRange;\n}): boolean => {\n if (isDateRange(value)) {\n if (value[0] && value[1]) {\n const [start, end] = getStartAndEndDate(value[0], value[1]);\n return isWithinInterval(date, { start, end });\n }\n\n return isDateSelected({ date, value: value[0] || value[1] });\n }\n return isDateSelected({ date, value });\n};\n\nexport const isValueSelectedBackwards = ({\n value,\n hoveredDate,\n}: {\n value?: Date | DateRange;\n hoveredDate?: Date;\n}): boolean | undefined => {\n return (\n hoveredDate &&\n isDateRange(value) &&\n isOnlyOneDateInRange(value) &&\n ((isDefined(value[0]) && isBefore(hoveredDate, value[0])) ||\n (isDefined(value[1]) && isBefore(hoveredDate, value[1])))\n );\n};\n\nexport const getMonthTitle = (date: Date, locale: Locale): string => {\n return format(date, 'LLLL', { locale });\n};\n\nexport const getMonthTitleAbbreviated = (\n date: Date,\n locale: Locale,\n): string => {\n const title = format(date, 'LLL', { locale });\n\n if (title[title.length - 1] === '.') {\n return title.substr(0, title.length - 1);\n }\n\n return title;\n};\n\nexport const getYearTitle = (date: Date): string => {\n return format(date, 'yyyy');\n};\n\nexport const getMouthLabelWithYear = (date: Date, locale: Locale): string => {\n return `${getMonthTitle(date, locale)} ${date.getFullYear()}`;\n};\n\nexport const getDecadeTitle = (date: Date): string => {\n return `${getYearTitle(date)} - ${getYearTitle(addYears(date, 9))}`;\n};\n\nexport const getLabelHours = (date: Date) => format(date, 'HH');\nexport const getLabelMinutes = (date: Date) => format(date, 'mm');\nexport const getLabelSeconds = (date: Date) => format(date, 'ss');\n\nexport const getDaysOfWeek = (locale: Locale): string[] => {\n const now = new Date();\n\n return eachDayOfInterval({\n start: startOfWeek(now, { locale }),\n end: endOfWeek(now, { locale }),\n }).map((date) => format(date, 'EEEEEE', { locale }));\n};\n\nconst getUnitLabelMap = [getLabelHours, getLabelMinutes, getLabelSeconds];\n\nexport const getTimeTitle = (\n value: Date | undefined,\n multiplicityHours: number | undefined,\n multiplicityMinutes: number | undefined,\n multiplicitySeconds: number | undefined,\n): string =>\n [multiplicityHours, multiplicityMinutes, multiplicitySeconds]\n .map((item, i) => {\n if (!value) {\n return item ? '--:' : '';\n }\n return item ? `${getUnitLabelMap[i](value)}:` : '';\n })\n .join('')\n .slice(0, -1);\n\nexport const isTypeWithTime = (type: DateTimePropType) =>\n type.indexOf('time') !== -1;\n\nexport * from './useCurrentVisibleDate';\nexport * from './types';\nexport * from './getDaysOfMonth';\nexport * from './getYearsOfDecade';\nexport * from './getHandleSelectDate';\nexport * from './isEqualDay';\nexport * from './isEqualYear';\nexport * from './isEqualMount';\nexport * from './getMonthsOfYear';\nexport * from './getTimeNumbers';\n"],"mappings":"iEAAA,OACEA,QADF,CAEEC,SAFF,CAGEC,MAHF,CAIEC,QAJF,CAKEC,SALF,CAMEC,gBANF,CAQEC,WARF,KASO,UATP,CAUA,MAAOC,kBAAP,KAA8B,4BAA9B,CAEA,OAASC,WAAT,CAAsBC,oBAAtB,2BACA,OAASC,SAAT,kCAIA,MAAO,IAAMC,aAAY,CAAG,SAACC,CAAD,CAAWC,CAAX,gBAC1B,kBAACD,CAAD,WAAC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CART,CAQY,CAAC,CARb,CAN0B,CAArB,CAgBP,MAAO,IAAMC,eAAc,CAAG,SAACC,CAAD,QACH,CAAC,CAA1B,GAAAA,CAAI,CAACC,OAAL,CAAa,MAAb,CAD4B,CAAvB,CAGP,qCACA,qBACA,8BACA,gCACA,mCACA,0BACA,2BACA,4BACA,+BACA"}
|
|
@@ -8,6 +8,7 @@ export type DateTimePropType = typeof dateTimePropType[number];
|
|
|
8
8
|
export declare const dateTimePropTypeDefault: "date";
|
|
9
9
|
export type DateTimePropDisableDates = Array<Date | [Date, Date]>;
|
|
10
10
|
export type CapableRangeType = 'date' | 'month' | 'year' | 'date-time';
|
|
11
|
+
export type TypeWithTime = 'time' | 'date-time';
|
|
11
12
|
export type DateTimePropValue<TYPE> = TYPE extends CapableRangeType ? Date | DateRange : Date;
|
|
12
13
|
export type DateTimePropOnChange = (value: Date, props: {
|
|
13
14
|
e: React.MouseEvent<HTMLButtonElement>;
|
|
@@ -26,6 +27,16 @@ export type DateTimePropLocale = Locale & LocaleWords;
|
|
|
26
27
|
export declare const moveTypes: readonly ["year", "month", "day", "time"];
|
|
27
28
|
export type MoveType = typeof moveTypes[number];
|
|
28
29
|
type DateTimePropTimeFor<TYPE> = TYPE extends 'date-time' ? 'start' | 'end' : never;
|
|
30
|
+
export type TimeUnitOptions = {
|
|
31
|
+
step?: number;
|
|
32
|
+
start?: number;
|
|
33
|
+
stop?: number;
|
|
34
|
+
} | number[];
|
|
35
|
+
export type TimeOptions = {
|
|
36
|
+
hours?: TimeUnitOptions;
|
|
37
|
+
minutes?: TimeUnitOptions;
|
|
38
|
+
seconds?: TimeUnitOptions;
|
|
39
|
+
};
|
|
29
40
|
export type DateTimeProps<TYPE extends DateTimePropType = 'date'> = PropsWithHTMLAttributesAndRef<{
|
|
30
41
|
currentVisibleDate?: Date;
|
|
31
42
|
type?: TYPE;
|
|
@@ -40,9 +51,25 @@ export type DateTimeProps<TYPE extends DateTimePropType = 'date'> = PropsWithHTM
|
|
|
40
51
|
children?: never;
|
|
41
52
|
disableDates?: DateTimePropDisableDates;
|
|
42
53
|
onChangeCurrentVisibleDate?: (date: Date) => void;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
timeOptions?: TYPE extends TypeWithTime ? TimeOptions : never;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use timeOptions instead.
|
|
57
|
+
* TODO: major - удалить при мажорном релизе все свойства multiplicity* и логику формирования
|
|
58
|
+
* объектов с шагом ({ step: multiplicity }) во всех местах, оставив только работу с timeOptions.
|
|
59
|
+
*/
|
|
60
|
+
multiplicitySeconds?: TYPE extends TypeWithTime ? number : never;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use timeOptions instead.
|
|
63
|
+
* TODO: major - удалить при мажорном релизе все свойства multiplicity* и логику формирования
|
|
64
|
+
* объектов с шагом ({ step: multiplicity }) во всех местах, оставив только работу с timeOptions.
|
|
65
|
+
*/
|
|
66
|
+
multiplicityMinutes?: TYPE extends TypeWithTime ? number : never;
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated Use timeOptions instead.
|
|
69
|
+
* TODO: major - удалить при мажорном релизе все свойства multiplicity* и логику формирования
|
|
70
|
+
* объектов с шагом ({ step: multiplicity }) во всех местах, оставив только работу с timeOptions.
|
|
71
|
+
*/
|
|
72
|
+
multiplicityHours?: TYPE extends TypeWithTime ? number : never;
|
|
46
73
|
onMove?: (type: MoveType) => void;
|
|
47
74
|
timeFor?: DateTimePropTimeFor<TYPE>;
|
|
48
75
|
}, HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["dateTimePropView","dateTimePropViewDefault","dateTimePropType","dateTimePropTypeDefault","moveTypes"],"sources":["../../../../../../src/components/DateTime/helpers/types.ts"],"sourcesContent":["import { DateRange } from '../../../utils/types/Date';\nimport { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';\n\nexport const dateTimePropView = ['classic', 'book', 'slider'] as const;\nexport type DateTimePropView = typeof dateTimePropView[number];\nexport const dateTimePropViewDefault = dateTimePropView[0];\n\nexport const dateTimePropType = [\n 'date',\n 'month',\n 'year',\n 'time',\n 'date-time',\n] as const;\nexport type DateTimePropType = typeof dateTimePropType[number];\nexport const dateTimePropTypeDefault = dateTimePropType[0];\n\nexport type DateTimePropDisableDates = Array<Date | [Date, Date]>;\n\nexport type CapableRangeType = 'date' | 'month' | 'year' | 'date-time';\n\nexport type DateTimePropValue<TYPE> = TYPE extends CapableRangeType\n ? Date | DateRange\n : Date;\n\nexport type DateTimePropOnChange = (\n value: Date,\n props: {\n e: React.MouseEvent<HTMLButtonElement>;\n },\n) => void;\n\nexport type DateTimePropOnChangeRange<TYPE> = TYPE extends CapableRangeType\n ? (\n value: DateRange,\n props: {\n e: React.MouseEvent<HTMLButtonElement>;\n },\n ) => void\n : never;\n\ntype LocaleWords = {\n words?: {\n hours?: string;\n minutes?: string;\n seconds?: string;\n };\n};\n\nexport type DateTimePropLocale = Locale & LocaleWords;\n\nexport const moveTypes = ['year', 'month', 'day', 'time'] as const;\nexport type MoveType = typeof moveTypes[number];\n\ntype DateTimePropTimeFor<TYPE> = TYPE extends 'date-time'\n ? 'start' | 'end'\n : never;\n\nexport type DateTimeProps<TYPE extends DateTimePropType = 'date'> =\n PropsWithHTMLAttributesAndRef<\n {\n currentVisibleDate?: Date;\n type?: TYPE;\n value?: DateTimePropValue<TYPE>;\n onChange?: DateTimePropOnChange;\n onChangeRange?: DateTimePropOnChangeRange<TYPE>;\n minDate?: Date;\n maxDate?: Date;\n events?: Date[];\n view?: TYPE extends CapableRangeType ? DateTimePropView : 'classic';\n locale?: DateTimePropLocale;\n children?: never;\n disableDates?: DateTimePropDisableDates;\n onChangeCurrentVisibleDate?: (date: Date) => void;\n multiplicitySeconds?: number;\n multiplicityMinutes?: number;\n multiplicityHours?: number;\n onMove?: (type: MoveType) => void;\n timeFor?: DateTimePropTimeFor<TYPE>;\n },\n HTMLDivElement\n >;\n\nexport type DateTimeComponent = <TYPE extends DateTimePropType = 'date'>(\n props: DateTimeProps<TYPE>,\n) => React.ReactNode | null;\n\nexport type DateTimeTypeComponent<TYPE extends DateTimePropType> = (\n props: Omit<DateTimeProps<TYPE>, 'type'>,\n) => React.ReactNode | null;\n\nexport type HandleSelectDate = (\n value: Date,\n props: {\n value: Date;\n e: React.MouseEvent<HTMLButtonElement>;\n },\n) => void;\n"],"mappings":"AAGA,MAAO,IAAMA,iBAAgB,CAAG,CAAC,SAAD,CAAY,MAAZ,CAAoB,QAApB,CAAzB,CAEP,MAAO,IAAMC,wBAAuB,CAAGD,gBAAgB,CAAC,CAAD,CAAhD,CAEP,MAAO,IAAME,iBAAgB,CAAG,CAC9B,MAD8B,CAE9B,OAF8B,CAG9B,MAH8B,CAI9B,MAJ8B,CAK9B,WAL8B,CAAzB,CAQP,MAAO,IAAMC,wBAAuB,CAAGD,gBAAgB,CAAC,CAAD,CAAhD,
|
|
1
|
+
{"version":3,"file":"types.js","names":["dateTimePropView","dateTimePropViewDefault","dateTimePropType","dateTimePropTypeDefault","moveTypes"],"sources":["../../../../../../src/components/DateTime/helpers/types.ts"],"sourcesContent":["import { DateRange } from '../../../utils/types/Date';\nimport { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';\n\nexport const dateTimePropView = ['classic', 'book', 'slider'] as const;\nexport type DateTimePropView = typeof dateTimePropView[number];\nexport const dateTimePropViewDefault = dateTimePropView[0];\n\nexport const dateTimePropType = [\n 'date',\n 'month',\n 'year',\n 'time',\n 'date-time',\n] as const;\nexport type DateTimePropType = typeof dateTimePropType[number];\nexport const dateTimePropTypeDefault = dateTimePropType[0];\n\nexport type DateTimePropDisableDates = Array<Date | [Date, Date]>;\n\nexport type CapableRangeType = 'date' | 'month' | 'year' | 'date-time';\n\nexport type TypeWithTime = 'time' | 'date-time';\n\nexport type DateTimePropValue<TYPE> = TYPE extends CapableRangeType\n ? Date | DateRange\n : Date;\n\nexport type DateTimePropOnChange = (\n value: Date,\n props: {\n e: React.MouseEvent<HTMLButtonElement>;\n },\n) => void;\n\nexport type DateTimePropOnChangeRange<TYPE> = TYPE extends CapableRangeType\n ? (\n value: DateRange,\n props: {\n e: React.MouseEvent<HTMLButtonElement>;\n },\n ) => void\n : never;\n\ntype LocaleWords = {\n words?: {\n hours?: string;\n minutes?: string;\n seconds?: string;\n };\n};\n\nexport type DateTimePropLocale = Locale & LocaleWords;\n\nexport const moveTypes = ['year', 'month', 'day', 'time'] as const;\nexport type MoveType = typeof moveTypes[number];\n\ntype DateTimePropTimeFor<TYPE> = TYPE extends 'date-time'\n ? 'start' | 'end'\n : never;\n\nexport type TimeUnitOptions =\n | {\n step?: number;\n start?: number;\n stop?: number;\n }\n | number[];\n\nexport type TimeOptions = {\n hours?: TimeUnitOptions;\n minutes?: TimeUnitOptions;\n seconds?: TimeUnitOptions;\n};\n\nexport type DateTimeProps<TYPE extends DateTimePropType = 'date'> =\n PropsWithHTMLAttributesAndRef<\n {\n currentVisibleDate?: Date;\n type?: TYPE;\n value?: DateTimePropValue<TYPE>;\n onChange?: DateTimePropOnChange;\n onChangeRange?: DateTimePropOnChangeRange<TYPE>;\n minDate?: Date;\n maxDate?: Date;\n events?: Date[];\n view?: TYPE extends CapableRangeType ? DateTimePropView : 'classic';\n locale?: DateTimePropLocale;\n children?: never;\n disableDates?: DateTimePropDisableDates;\n onChangeCurrentVisibleDate?: (date: Date) => void;\n timeOptions?: TYPE extends TypeWithTime ? TimeOptions : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity* и логику формирования\n * объектов с шагом ({ step: multiplicity }) во всех местах, оставив только работу с timeOptions.\n */\n multiplicitySeconds?: TYPE extends TypeWithTime ? number : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity* и логику формирования\n * объектов с шагом ({ step: multiplicity }) во всех местах, оставив только работу с timeOptions.\n */\n multiplicityMinutes?: TYPE extends TypeWithTime ? number : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity* и логику формирования\n * объектов с шагом ({ step: multiplicity }) во всех местах, оставив только работу с timeOptions.\n */\n multiplicityHours?: TYPE extends TypeWithTime ? number : never;\n onMove?: (type: MoveType) => void;\n timeFor?: DateTimePropTimeFor<TYPE>;\n },\n HTMLDivElement\n >;\n\nexport type DateTimeComponent = <TYPE extends DateTimePropType = 'date'>(\n props: DateTimeProps<TYPE>,\n) => React.ReactNode | null;\n\nexport type DateTimeTypeComponent<TYPE extends DateTimePropType> = (\n props: Omit<DateTimeProps<TYPE>, 'type'>,\n) => React.ReactNode | null;\n\nexport type HandleSelectDate = (\n value: Date,\n props: {\n value: Date;\n e: React.MouseEvent<HTMLButtonElement>;\n },\n) => void;\n"],"mappings":"AAGA,MAAO,IAAMA,iBAAgB,CAAG,CAAC,SAAD,CAAY,MAAZ,CAAoB,QAApB,CAAzB,CAEP,MAAO,IAAMC,wBAAuB,CAAGD,gBAAgB,CAAC,CAAD,CAAhD,CAEP,MAAO,IAAME,iBAAgB,CAAG,CAC9B,MAD8B,CAE9B,OAF8B,CAG9B,MAH8B,CAI9B,MAJ8B,CAK9B,WAL8B,CAAzB,CAQP,MAAO,IAAMC,wBAAuB,CAAGD,gBAAgB,CAAC,CAAD,CAAhD,CAsCP,MAAO,IAAME,UAAS,CAAG,CAAC,MAAD,CAAS,OAAT,CAAkB,KAAlB,CAAyB,MAAzB,CAAlB"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import './DragNDropFieldInformer.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export declare const DragNDropFieldInformer: React.ForwardRefExoticComponent<
|
|
3
|
+
import { DragNDropFieldInformerPropStatus } from '../types';
|
|
4
|
+
export declare const DragNDropFieldInformer: React.ForwardRefExoticComponent<{
|
|
5
|
+
status?: DragNDropFieldInformerPropStatus;
|
|
6
|
+
icon?: import("@consta/icons/Icon").IconComponent;
|
|
7
|
+
loading?: boolean | number;
|
|
8
|
+
text?: string;
|
|
9
|
+
withButton?: boolean;
|
|
10
|
+
buttonIcon?: import("@consta/icons/Icon").IconComponent;
|
|
11
|
+
buttonLabel?: string;
|
|
12
|
+
onButtonClick?: () => void;
|
|
13
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "status" | "text" | "loading" | "icon" | "onButtonClick" | "buttonIcon" | "withButton" | "buttonLabel"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragNDropFieldInformer.js","names":["React","Button","ProgressSpin","Text","cnCanary","dragNDropFieldInformerPropStatus","textViewMap","alert","warning","iconStatusMap","cnDragNDropFieldInformer","propStatusDefault","DragNDropFieldInformer","forwardRef","props","ref","status","loading","icon","text","withButton","buttonIcon","buttonLabel","onButtonClick","className","otherProps","Icon"],"sources":["../../../../../../src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.tsx"],"sourcesContent":["import './DragNDropFieldInformer.css';\n\nimport { IconPropView } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { Button } from '##/components/Button';\nimport { ProgressSpin } from '##/components/ProgressSpin';\nimport { Text, TextPropView } from '##/components/Text';\nimport { cnCanary } from '##/utils/bem';\
|
|
1
|
+
{"version":3,"file":"DragNDropFieldInformer.js","names":["React","Button","ProgressSpin","Text","cnCanary","dragNDropFieldInformerPropStatus","textViewMap","alert","warning","iconStatusMap","cnDragNDropFieldInformer","propStatusDefault","DragNDropFieldInformer","forwardRef","props","ref","status","loading","icon","text","withButton","buttonIcon","buttonLabel","onButtonClick","className","otherProps","Icon"],"sources":["../../../../../../src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.tsx"],"sourcesContent":["import './DragNDropFieldInformer.css';\n\nimport { IconPropView } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { Button } from '##/components/Button';\nimport { ProgressSpin } from '##/components/ProgressSpin';\nimport { Text, TextPropView } from '##/components/Text';\nimport { cnCanary } from '##/utils/bem';\n\nimport {\n DragNDropFieldInformerProps,\n DragNDropFieldInformerPropStatus,\n dragNDropFieldInformerPropStatus,\n} from '../types';\n\nconst textViewMap: Record<DragNDropFieldInformerPropStatus, TextPropView> = {\n default: 'ghost',\n alert: 'alert',\n warning: 'warning',\n};\n\nconst iconStatusMap: Record<DragNDropFieldInformerPropStatus, IconPropView> = {\n default: 'ghost',\n alert: 'alert',\n warning: 'warning',\n};\n\nconst cnDragNDropFieldInformer = cnCanary('DragNDropFieldInformer');\n\nconst propStatusDefault: DragNDropFieldInformerPropStatus =\n dragNDropFieldInformerPropStatus[0];\n\nexport const DragNDropFieldInformer = React.forwardRef<\n HTMLDivElement,\n DragNDropFieldInformerProps\n>((props, ref) => {\n const {\n status = propStatusDefault,\n loading = false,\n icon,\n text = '',\n withButton = false,\n buttonIcon,\n buttonLabel,\n onButtonClick,\n className,\n ...otherProps\n } = props;\n const Icon = icon;\n return (\n <div\n {...otherProps}\n className={cnDragNDropFieldInformer(\n {\n status,\n },\n [className],\n )}\n ref={ref}\n >\n {loading && (\n <ProgressSpin\n value={typeof loading === 'number' ? loading : undefined}\n animation\n size=\"m\"\n className={cnDragNDropFieldInformer('Progress')}\n />\n )}\n {!loading && Icon && (\n <Icon\n view={iconStatusMap[status]}\n size=\"s\"\n className={cnDragNDropFieldInformer('Icon')}\n />\n )}\n {text ? (\n <Text\n align=\"left\"\n lineHeight=\"xs\"\n size=\"xs\"\n className={cnDragNDropFieldInformer('Text')}\n view={textViewMap[status]}\n >\n {text}\n </Text>\n ) : (\n ' '\n )}\n {withButton && (\n <Button\n onlyIcon\n iconLeft={buttonIcon}\n onClick={onButtonClick}\n view=\"ghost\"\n size=\"xs\"\n title={buttonLabel}\n className={cnDragNDropFieldInformer('Button')}\n />\n )}\n </div>\n );\n});\n"],"mappings":"0MAAA,qCAGA,MAAOA,MAAP,KAAkB,OAAlB,C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CAACO,CAAD,EAAYS,CAAZ,EACC,oBAAC,CAAD,EACE,IAAI,CAAEjB,aAAa,CAACO,CAAD,CADrB,CAEE,IAAI,CAAC,GAFP,CAGE,SAAS,CAAEN,wBAAwB,CAAC,MAAD,CAHrC,EAnBJ,CAyBGS,CAAI,CACH,oBAAC,IAAD,EACE,KAAK,CAAC,MADR,CAEE,UAAU,CAAC,IAFb,CAGE,IAAI,CAAC,IAHP,CAIE,SAAS,CAAET,wBAAwB,CAAC,MAAD,CAJrC,CAKE,IAAI,CAAEJ,WAAW,CAACU,CAAD,CALnB,EAOGG,CAPH,CADG,CAWH,GApCJ,CAsCG,eACC,oBAAC,MAAD,EACE,QAAQ,GADV,CAEE,QAAQ,CAAEE,CAFZ,CAGE,OAAO,CAAEE,CAHX,CAIE,IAAI,CAAC,OAJP,CAKE,IAAI,CAAC,IALP,CAME,KAAK,CAAED,CANT,CAOE,SAAS,CAAEZ,wBAAwB,CAAC,QAAD,CAPrC,EAvCJ,CAmDH,CArEqC,CAA/B"}
|
|
@@ -68,7 +68,7 @@ export type DragNDropFieldPropLocale = {
|
|
|
68
68
|
};
|
|
69
69
|
export declare const dragNDropFieldInformerPropStatus: readonly ["default", "alert", "warning"];
|
|
70
70
|
export type DragNDropFieldInformerPropStatus = typeof dragNDropFieldInformerPropStatus[number];
|
|
71
|
-
export type DragNDropFieldInformerProps = {
|
|
71
|
+
export type DragNDropFieldInformerProps = PropsWithHTMLAttributes<{
|
|
72
72
|
status?: DragNDropFieldInformerPropStatus;
|
|
73
73
|
icon?: IconComponent;
|
|
74
74
|
loading?: boolean | number;
|
|
@@ -77,4 +77,4 @@ export type DragNDropFieldInformerProps = {
|
|
|
77
77
|
buttonIcon?: IconComponent;
|
|
78
78
|
buttonLabel?: string;
|
|
79
79
|
onButtonClick?: () => void;
|
|
80
|
-
}
|
|
80
|
+
}, HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["dragNDropFieldInformerPropStatus"],"sources":["../../../../../src/components/DragNDropFieldCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport { Accept, DropEvent, FileRejection, FileWithPath } from 'react-dropzone';\n\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type DragNDropFieldChildrenRenderFn = (props: {\n openFileDialog: () => void;\n isFocused: boolean;\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFileDialogActive: boolean;\n acceptedFiles: readonly FileWithPath[];\n fileRejections: readonly FileRejection[];\n}) => React.ReactNode;\n\nexport type DragNDropFieldContentProps = {\n openFileDialog: () => void;\n locale: Required<DragNDropFieldPropLocale>;\n isFocused: boolean;\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFileDialogActive: boolean;\n acceptedFiles: readonly FileWithPath[];\n fileRejections: readonly FileRejection[];\n} & Pick<\n DragNDropFieldProps,\n 'accept' | 'maxSize' | 'multiple' | 'disabled' | 'minSize'\n>;\n\nexport type FileSizes = {\n minSize?: number;\n maxSize?: number;\n};\n\nexport type DragNDropFieldProps = PropsWithHTMLAttributes<\n {\n accept?: Accept;\n maxSize?: number;\n minSize?: number;\n maxFiles?: number;\n multiple?: boolean;\n disabled?: boolean;\n children?: React.ReactNode | DragNDropFieldChildrenRenderFn;\n locale?: DragNDropFieldPropLocale;\n onDrop?: <T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) => void;\n onDropAccepted?: <T extends File>(files: T[]) => void;\n onDropRejected?: (\n fileRejections: FileRejection[],\n event: DropEvent,\n ) => void;\n onError?: (err: Error) => void;\n },\n HTMLDivElement\n>;\n\nexport type LocaleError =\n | string\n | ((props: { file: File; sizes?: FileSizes }) => string);\n\nexport type LocaleLabel = string | ((props: { fileText: string }) => string);\n\nexport type DragNDropFieldPropLocale = {\n 'file-invalid-type'?: LocaleError;\n 'file-too-large'?: LocaleError;\n 'file-too-small'?: LocaleError;\n 'too-many-files'?: string;\n 'general-error'?: string;\n 'fit-files'?: string;\n 'file'?: string;\n 'files'?: string;\n 'before'?: string;\n 'from'?: string;\n 'gigabyte'?: string;\n 'megabyte'?: string;\n 'kilobyte'?: string;\n 'byte'?: string;\n 'call-to-action'?: LocaleLabel;\n 'action-button'?: LocaleLabel;\n 'drag-active-message'?: string;\n};\n\nexport const dragNDropFieldInformerPropStatus = [\n 'default',\n 'alert',\n 'warning',\n] as const;\n\nexport type DragNDropFieldInformerPropStatus =\n typeof dragNDropFieldInformerPropStatus[number];\n\nexport type DragNDropFieldInformerProps = {\n
|
|
1
|
+
{"version":3,"file":"types.js","names":["dragNDropFieldInformerPropStatus"],"sources":["../../../../../src/components/DragNDropFieldCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport { Accept, DropEvent, FileRejection, FileWithPath } from 'react-dropzone';\n\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type DragNDropFieldChildrenRenderFn = (props: {\n openFileDialog: () => void;\n isFocused: boolean;\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFileDialogActive: boolean;\n acceptedFiles: readonly FileWithPath[];\n fileRejections: readonly FileRejection[];\n}) => React.ReactNode;\n\nexport type DragNDropFieldContentProps = {\n openFileDialog: () => void;\n locale: Required<DragNDropFieldPropLocale>;\n isFocused: boolean;\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFileDialogActive: boolean;\n acceptedFiles: readonly FileWithPath[];\n fileRejections: readonly FileRejection[];\n} & Pick<\n DragNDropFieldProps,\n 'accept' | 'maxSize' | 'multiple' | 'disabled' | 'minSize'\n>;\n\nexport type FileSizes = {\n minSize?: number;\n maxSize?: number;\n};\n\nexport type DragNDropFieldProps = PropsWithHTMLAttributes<\n {\n accept?: Accept;\n maxSize?: number;\n minSize?: number;\n maxFiles?: number;\n multiple?: boolean;\n disabled?: boolean;\n children?: React.ReactNode | DragNDropFieldChildrenRenderFn;\n locale?: DragNDropFieldPropLocale;\n onDrop?: <T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) => void;\n onDropAccepted?: <T extends File>(files: T[]) => void;\n onDropRejected?: (\n fileRejections: FileRejection[],\n event: DropEvent,\n ) => void;\n onError?: (err: Error) => void;\n },\n HTMLDivElement\n>;\n\nexport type LocaleError =\n | string\n | ((props: { file: File; sizes?: FileSizes }) => string);\n\nexport type LocaleLabel = string | ((props: { fileText: string }) => string);\n\nexport type DragNDropFieldPropLocale = {\n 'file-invalid-type'?: LocaleError;\n 'file-too-large'?: LocaleError;\n 'file-too-small'?: LocaleError;\n 'too-many-files'?: string;\n 'general-error'?: string;\n 'fit-files'?: string;\n 'file'?: string;\n 'files'?: string;\n 'before'?: string;\n 'from'?: string;\n 'gigabyte'?: string;\n 'megabyte'?: string;\n 'kilobyte'?: string;\n 'byte'?: string;\n 'call-to-action'?: LocaleLabel;\n 'action-button'?: LocaleLabel;\n 'drag-active-message'?: string;\n};\n\nexport const dragNDropFieldInformerPropStatus = [\n 'default',\n 'alert',\n 'warning',\n] as const;\n\nexport type DragNDropFieldInformerPropStatus =\n typeof dragNDropFieldInformerPropStatus[number];\n\nexport type DragNDropFieldInformerProps = PropsWithHTMLAttributes<\n {\n status?: DragNDropFieldInformerPropStatus;\n icon?: IconComponent;\n loading?: boolean | number;\n text?: string;\n withButton?: boolean;\n buttonIcon?: IconComponent;\n buttonLabel?: string;\n onButtonClick?: () => void;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAuFA,MAAO,IAAMA,iCAAgC,CAAG,CAC9C,SAD8C,CAE9C,OAF8C,CAG9C,SAH8C,CAAzC"}
|