@consta/uikit 4.13.0 → 4.14.1
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/__internal__/src/components/Breadcrumbs/BreadcrumbsItem/BreadcrumbsItem.js +1 -1
- package/__internal__/src/components/Breadcrumbs/BreadcrumbsItem/BreadcrumbsItem.js.map +1 -1
- package/__internal__/src/components/Breadcrumbs/BreadcrumbsMore/BreadcrumbsMore.js +1 -1
- package/__internal__/src/components/Breadcrumbs/BreadcrumbsMore/BreadcrumbsMore.js.map +1 -1
- package/__internal__/src/components/BreadcrumbsDeprecated/BreadcrumbsDeprecated.js +1 -1
- package/__internal__/src/components/BreadcrumbsDeprecated/BreadcrumbsDeprecated.js.map +1 -1
- package/__internal__/src/components/CalendarDeprecated/CalendarMonthToggler/CalendarMonthToggler.js +1 -1
- package/__internal__/src/components/CalendarDeprecated/CalendarMonthToggler/CalendarMonthToggler.js.map +1 -1
- package/__internal__/src/components/CalendarDeprecated/CalendarSlider/CalendarSlider.js +1 -1
- package/__internal__/src/components/CalendarDeprecated/CalendarSlider/CalendarSlider.js.map +1 -1
- package/__internal__/src/components/ChoiceGroup/ChoiceGroup.css +1 -1
- package/__internal__/src/components/ChoiceGroupDeprecated/ChoiceGroup.css +1 -1
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.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/DatePickerTypeMonth/DatePickerTypeMonth.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonth/DatePickerTypeMonth.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.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/DatePickerTypeYear/DatePickerTypeYear.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYear/DatePickerTypeYear.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.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/DateTimeCell/DateTimeCell.css +1 -1
- package/__internal__/src/components/DateTime/DateTimeSlider/DateTimeSlider.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeSlider/DateTimeSlider.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeToggler/DateTimeToggler.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeToggler/DateTimeToggler.js.map +1 -1
- package/__internal__/src/components/DragNDropField/DragNDropField.css +1 -1
- package/__internal__/src/components/Header/Menu/HeaderMenu.css +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.css +1 -1
- package/__internal__/src/components/Loader/Loader.css +1 -1
- package/__internal__/src/components/Pagination/Pagination.css +1 -1
- package/__internal__/src/components/Pagination/Pagination.js +1 -1
- package/__internal__/src/components/Pagination/Pagination.js.map +1 -1
- package/__internal__/src/components/ProgressLine/ProgressLine.css +1 -1
- package/__internal__/src/components/ProgressSpin/ProgressSpin.css +1 -1
- package/__internal__/src/components/ProgressStepBar/ProgressStepBar.js +1 -1
- package/__internal__/src/components/ProgressStepBar/ProgressStepBar.js.map +1 -1
- package/__internal__/src/components/Radio/Radio.css +1 -1
- package/__internal__/src/components/Responses403/Responses403.js +1 -1
- package/__internal__/src/components/Responses403/Responses403.js.map +1 -1
- package/__internal__/src/components/Responses404/Responses404.js +1 -1
- package/__internal__/src/components/Responses404/Responses404.js.map +1 -1
- package/__internal__/src/components/ResponsesDeleted/ResponsesDeleted.js +1 -1
- package/__internal__/src/components/ResponsesDeleted/ResponsesDeleted.js.map +1 -1
- package/__internal__/src/components/ResponsesEmptyBox/ResponsesEmptyBox.js +1 -1
- package/__internal__/src/components/ResponsesEmptyBox/ResponsesEmptyBox.js.map +1 -1
- package/__internal__/src/components/ResponsesEmptyPockets/ResponsesEmptyPockets.js +1 -1
- package/__internal__/src/components/ResponsesEmptyPockets/ResponsesEmptyPockets.js.map +1 -1
- package/__internal__/src/components/ResponsesExit/ResponsesExit.js +1 -1
- package/__internal__/src/components/ResponsesExit/ResponsesExit.js.map +1 -1
- package/__internal__/src/components/ResponsesNothingFound/ResponsesNothingFound.js +1 -1
- package/__internal__/src/components/ResponsesNothingFound/ResponsesNothingFound.js.map +1 -1
- package/__internal__/src/components/Skeleton/Skeleton.css +1 -1
- package/__internal__/src/components/SnackBar/SnackBarActionButton/SnackBarActionButton.js +1 -1
- package/__internal__/src/components/SnackBar/SnackBarActionButton/SnackBarActionButton.js.map +1 -1
- package/__internal__/src/components/SnackBar/SnackBarItem/SnackBarItem.js +1 -1
- package/__internal__/src/components/SnackBar/SnackBarItem/SnackBarItem.js.map +1 -1
- package/__internal__/src/components/Steps/Steps.css +1 -1
- package/__internal__/src/components/Steps/Steps.js +1 -1
- package/__internal__/src/components/Steps/Steps.js.map +1 -1
- package/__internal__/src/components/Steps/StepsStep/StepsStep.css +1 -1
- package/__internal__/src/components/StepsDeprecated/Steps.css +1 -1
- package/__internal__/src/components/StepsDeprecated/StepsStep/StepsStep.css +1 -1
- package/__internal__/src/components/Table/Cell/TableCell.css +1 -1
- package/__internal__/src/components/Table/FilterContainer/TableFilterContainer.js +1 -1
- package/__internal__/src/components/Table/FilterContainer/TableFilterContainer.js.map +1 -1
- package/__internal__/src/components/Table/FilterTooltip/TableFilterTooltip.css +1 -1
- package/__internal__/src/components/Table/FilterTooltip/TableFilterTooltip.js +1 -1
- package/__internal__/src/components/Table/FilterTooltip/TableFilterTooltip.js.map +1 -1
- package/__internal__/src/components/Table/Header/TableHeader.css +1 -1
- package/__internal__/src/components/Table/Header/TableHeader.js +1 -1
- package/__internal__/src/components/Table/Header/TableHeader.js.map +1 -1
- package/__internal__/src/components/Table/RowsCollapse/TableRowsCollapse.js +1 -1
- package/__internal__/src/components/Table/RowsCollapse/TableRowsCollapse.js.map +1 -1
- package/__internal__/src/components/Table/Table.css +1 -1
- package/__internal__/src/components/Table/TextFilter/TableTextFilter.js +1 -1
- package/__internal__/src/components/Table/TextFilter/TableTextFilter.js.map +1 -1
- package/__internal__/src/components/Tabs/FitModeScrollWrapper/TabsFitModeScrollWrapper.js +1 -1
- package/__internal__/src/components/Tabs/FitModeScrollWrapper/TabsFitModeScrollWrapper.js.map +1 -1
- package/__internal__/src/components/Tabs/MoreItems/TabsMoreItems.js +1 -1
- package/__internal__/src/components/Tabs/MoreItems/TabsMoreItems.js.map +1 -1
- package/__internal__/src/components/TabsDeprecated/FitModeScrollWrapper/TabsFitModeScrollWrapper.js +1 -1
- package/__internal__/src/components/TabsDeprecated/FitModeScrollWrapper/TabsFitModeScrollWrapper.js.map +1 -1
- package/__internal__/src/components/TabsDeprecated/MoreItems/TabsMoreItems.js +1 -1
- package/__internal__/src/components/TabsDeprecated/MoreItems/TabsMoreItems.js.map +1 -1
- package/__internal__/src/components/TextField/TextField.css +1 -1
- package/__internal__/src/components/TextField/useIMask.js +1 -1
- package/__internal__/src/components/TextField/useIMask.js.map +1 -1
- package/__internal__/src/components/ThemeToggler/ThemeToggler.js +1 -1
- package/__internal__/src/components/ThemeToggler/ThemeToggler.js.map +1 -1
- package/__internal__/src/components/ThemeToggler/helpers.d.ts +1 -0
- package/__internal__/src/components/ThemeToggler/types.d.ts +4 -2
- package/__internal__/src/components/ThemeToggler/types.js.map +1 -1
- package/__internal__/src/components/User/User.js +1 -1
- package/__internal__/src/components/User/User.js.map +1 -1
- package/__internal__/src/mixs/MixFocus/MixFocus.css +1 -1
- package/__internal__/src/uiKit/components/ColorPreview/ColorPreview.css +1 -1
- package/package.json +2 -2
- package/__internal__/src/components/DatePicker/useDropdownVisible.d.ts +0 -24
- package/__internal__/src/components/DatePicker/useDropdownVisible.js +0 -2
- package/__internal__/src/components/DatePicker/useDropdownVisible.js.map +0 -1
package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["events","dateTimeView","locale","dropdownForm","onFocus","onBlur","dropdownClassName","leftSide","rightSide","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","name"];import{addYears,startOfDecade}from"date-fns";import React,{forwardRef,useEffect,useRef}from"react";import{useClickOutside}from"../../../hooks/useClickOutside/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef/useForkRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeYearRange}from"../DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange";import{getDropdownZIndex,normalizeRangeValue}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["events","dateTimeView","locale","dropdownForm","onFocus","onBlur","dropdownClassName","leftSide","rightSide","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","name"];import{addYears,startOfDecade}from"date-fns";import React,{forwardRef,useEffect,useRef,useState}from"react";import{useClickOutside}from"../../../hooks/useClickOutside/useClickOutside";import{useFlag}from"../../../hooks/useFlag/useFlag";import{useForkRef}from"../../../hooks/useForkRef/useForkRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeYearRange}from"../DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange";import{getDropdownZIndex,normalizeRangeValue}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeYearRange=forwardRef(function(a,b){var c,d,e,f,g=a.events,h=a.dateTimeView,i=void 0===h?datePickerPropDateTimeViewDefault:h,j=a.locale,k=a.dropdownForm,l=a.onFocus,m=a.onBlur,n=a.dropdownClassName,o=a.leftSide,p=a.rightSide,q=a.currentVisibleDate,r=a.onChangeCurrentVisibleDate,s=a.renderAdditionalControls,t=a.inputRef,u=a.name,v=_objectWithoutProperties(a,_excluded),w=useRef(null),x=useRef(null),y=useRef(null),z=useRef(null),A=useRef(null),B=useState(!1),C=_slicedToArray(B,2),D=C[0],E=C[1],F="start"===D,G="end"===D,H=useFlag(!1),I=_slicedToArray(H,2),J=I[0],K=I[1],L=useCurrentVisibleDate({currentVisibleDate:q,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfDecade,onChangeCurrentVisibleDate:r,calendarVisible:J}),M=_slicedToArray(L,2),N=M[0],O=M[1];return useEffect(function(){var b,c;if(null!==(b=a.value)&&void 0!==b&&b[0]&&"classic"===i&&F){var d=startOfDecade(a.value[0]);return void(d.getTime()!==(null===N||void 0===N?void 0:N.getTime())&&O(d))}if(null!==(c=a.value)&&void 0!==c&&c[0]&&"classic"!==i&&F){var e=startOfDecade(a.value[0]);e.getTime()!==(null===N||void 0===N?void 0:N.getTime())&&e.getTime()!==(N&&addYears(N,10).getTime())&&O(e)}},[null===(c=a.value)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.getTime(),J,F]),useEffect(function(){var b,c;if(null!==(b=a.value)&&void 0!==b&&b[1]&&"classic"===i&&G){var d=startOfDecade(a.value[1]);return void(d.getTime()!==(null===N||void 0===N?void 0:N.getTime())&&O(d))}if(null!==(c=a.value)&&void 0!==c&&c[1]&&"classic"!==i&&G){var e=startOfDecade(a.value[1]);e.getTime()!==(null===N||void 0===N?void 0:N.getTime())&&e.getTime()!==(N&&addYears(N,10).getTime())&&O(addYears(e,-10))}},[null===(e=a.value)||void 0===e||null===(f=e[1])||void 0===f?void 0:f.getTime(),J,G]),useClickOutside({isActive:J,ignoreClicksInsideRefs:[w,x,A],handler:function handler(){E(!1),K.off()}}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeYearRange,Object.assign({},v,{ref:b,startFieldRef:w,endFieldRef:x,startFieldInputRef:useForkRef([y,null===t||void 0===t?void 0:t[0]]),endFieldInputRef:useForkRef([z,null===t||void 0===t?void 0:t[1]]),startFieldOnFocus:function startFieldOnFocusHandler(a){var b;E("start"),K.on(),Array.isArray(l)?null===(b=l[0])||void 0===b?void 0:b.call(l,a):null===l||void 0===l?void 0:l(a)},endFieldOnFocus:function endFieldOnFocusHandler(a){var b;E("end"),K.on(),Array.isArray(l)?null===(b=l[1])||void 0===b?void 0:b.call(l,a):null===l||void 0===l?void 0:l(a)},startFieldLeftSide:Array.isArray(o)?null===o||void 0===o?void 0:o[0]:o,startFieldRightSide:Array.isArray(p)?null===p||void 0===p?void 0:p[0]:void 0,endFieldLeftSide:Array.isArray(o)?null===o||void 0===o?void 0:o[1]:void 0,endFieldRightSide:Array.isArray(p)?null===p||void 0===p?void 0:p[1]:p,startFieldOnBlur:function startFieldOnBlurHandler(a){var b;return Array.isArray(m)?null===(b=m[0])||void 0===b?void 0:b.call(m,a):null===m||void 0===m?void 0:m(a)},endFieldOnBlur:function endFieldOnBlurHandler(a){var b;return Array.isArray(m)?null===(b=m[1])||void 0===b?void 0:b.call(m,a):null===m||void 0===m?void 0:m(a)},startFocused:F,endFocused:G,startFieldName:Array.isArray(u)?u[0]:"".concat(u,"_start"),endFieldName:Array.isArray(u)?u[1]:"".concat(u,"_end")})),React.createElement(DatePickerDropdown,{type:"year",ref:A,anchorRef:w,isOpen:J,onChangeCurrentVisibleDate:O,currentVisibleDate:N,value:a.value||void 0,view:i,events:g,locale:j,className:n,minDate:a.minDate,maxDate:a.maxDate,form:k,onChange:function hadleChange(b){var c=b.e,d=b.value;if(F){var e,f;null===(e=a.onChange)||void 0===e?void 0:e.call(a,{e:c,value:normalizeRangeValue([d,null===a||void 0===a||null===(f=a.value)||void 0===f?void 0:f[1]])})}if(G){var g,h;null===(g=a.onChange)||void 0===g?void 0:g.call(a,{e:c,value:normalizeRangeValue([null===a||void 0===a||null===(h=a.value)||void 0===h?void 0:h[0],d])})}},renderAdditionalControls:s,zIndex:getDropdownZIndex(a.style)}))});
|
|
2
2
|
//# sourceMappingURL=DatePickerTypeYearRange.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerTypeYearRange.js","names":["addYears","startOfDecade","React","forwardRef","useEffect","useRef","useClickOutside","useForkRef","DatePickerDropdown","DatePickerFieldTypeYearRange","getDropdownZIndex","normalizeRangeValue","datePickerPropDateTimeViewDefault","useCurrentVisibleDate","useDropdownVisible","DatePickerTypeYearRange","props","ref","events","dateTimeView","locale","dropdownForm","onFocus","onBlur","dropdownClassName","leftSide","rightSide","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","name","fieldProps","startFieldRef","endFieldRef","startFieldInputRef","endFieldInputRef","calendarRef","calendarVisible","blocks","start","onStartFocus","onStartBlur","dropdown","onDropdownBlur","onDropdownFocus","end","onEndFocus","onEndBlur","close","fieldType","startFocused","endFocused","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","Array","isArray","hadleChange","e","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport React, { forwardRef, useEffect, useRef } from 'react';\n\nimport { useClickOutside } from '../../../hooks/useClickOutside/useClickOutside';\nimport { useForkRef } from '../../../hooks/useForkRef/useForkRef';\nimport {\n DatePickerDropdown,\n DatePickerDropdownPropOnChange,\n} from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeYearRange } from '../DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange';\nimport { getDropdownZIndex, normalizeRangeValue } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\nimport { useDropdownVisible } from '../useDropdownVisible';\n\nexport const DatePickerTypeYearRange: DatePickerTypeComponent<'date-range'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownForm,\n onFocus,\n onBlur,\n dropdownClassName,\n leftSide,\n rightSide,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n inputRef,\n name,\n ...fieldProps\n } = props;\n\n const startFieldRef = useRef<HTMLDivElement>(null);\n const endFieldRef = useRef<HTMLDivElement>(null);\n const startFieldInputRef = useRef<HTMLInputElement>(null);\n const endFieldInputRef = useRef<HTMLInputElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n\n const {\n calendarVisible,\n blocks: {\n start: { onFocus: onStartFocus, onBlur: onStartBlur },\n dropdown: { onBlur: onDropdownBlur, onFocus: onDropdownFocus },\n end: { onFocus: onEndFocus, onBlur: onEndBlur },\n },\n close,\n fieldType,\n } = useDropdownVisible(onFocus, onBlur);\n\n const startFocused = fieldType === 'start';\n const endFocused = fieldType === 'end';\n\n const hadleChange: DatePickerDropdownPropOnChange = ({ e, value }) => {\n if (startFocused) {\n props.onChange?.({\n e,\n value: normalizeRangeValue([value, props?.value?.[1]]),\n });\n }\n if (endFocused) {\n props.onChange?.({\n e,\n value: normalizeRangeValue([props?.value?.[0], value]),\n });\n }\n };\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n calendarVisible,\n });\n\n // эфект для того чтобы календарь переключался при вводе с клавиатуры\n useEffect(() => {\n if (props.value?.[0] && dateTimeView === 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[0] && dateTimeView !== 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value?.[0]?.getTime(), calendarVisible, startFocused]);\n\n useEffect(() => {\n if (props.value?.[1] && dateTimeView === 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[1] && dateTimeView !== 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(addYears(newVisibleDate, -10));\n }\n }\n }, [props.value?.[1]?.getTime(), calendarVisible, endFocused]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [startFieldRef, endFieldRef, calendarRef],\n handler: close,\n });\n\n return (\n <>\n <DatePickerFieldTypeYearRange\n {...fieldProps}\n ref={ref}\n startFieldRef={startFieldRef}\n endFieldRef={endFieldRef}\n startFieldInputRef={useForkRef([startFieldInputRef, inputRef?.[0]])}\n endFieldInputRef={useForkRef([endFieldInputRef, inputRef?.[1]])}\n startFieldOnFocus={onStartFocus}\n endFieldOnFocus={onEndFocus}\n startFieldLeftSide={\n Array.isArray(leftSide) ? leftSide?.[0] : leftSide\n }\n startFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[0] : undefined\n }\n endFieldLeftSide={Array.isArray(leftSide) ? leftSide?.[1] : undefined}\n endFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[1] : rightSide\n }\n startFieldOnBlur={onStartBlur}\n endFieldOnBlur={onEndBlur}\n startFocused={startFocused}\n endFocused={endFocused}\n startFieldName={Array.isArray(name) ? name[0] : `${name}_start`}\n endFieldName={Array.isArray(name) ? name[1] : `${name}_end`}\n />\n <DatePickerDropdown\n type=\"year\"\n ref={calendarRef}\n anchorRef={startFieldRef}\n isOpen={calendarVisible}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n currentVisibleDate={currentVisibleDate}\n value={props.value || undefined}\n view={dateTimeView}\n events={events}\n locale={locale}\n className={dropdownClassName}\n onFocus={onDropdownFocus}\n onBlur={onDropdownBlur}\n minDate={props.minDate}\n maxDate={props.maxDate}\n form={dropdownForm}\n onChange={hadleChange}\n renderAdditionalControls={renderAdditionalControls}\n zIndex={getDropdownZIndex(props.style)}\n />\n </>\n );\n });\n"],"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AfC,EAAe,GAAfA,CAAe,CAAZX,CAAY,GAAZA,KAAY,CACpE,GAAIJ,CAAJ,CAAkB,mBAChBpC,CAAK,CAACoD,QADU,qBAChB,OAAApD,CAAK,CAAY,CACfmD,CAAC,CAADA,CADe,CAEfX,KAAK,CAAE7C,mBAAmB,CAAC,CAAC6C,CAAD,QAAQxC,CAAR,WAAQA,CAAR,YAAQA,CAAK,CAAEwC,KAAf,qBAAQ,EAAe,CAAf,CAAR,CAAD,CAFX,CAAZ,CAIN,CACD,GAAIH,CAAJ,CAAgB,mBACdrC,CAAK,CAACoD,QADQ,qBACd,OAAApD,CAAK,CAAY,CACfmD,CAAC,CAADA,CADe,CAEfX,KAAK,CAAE7C,mBAAmB,CAAC,QAACK,CAAD,WAACA,CAAD,YAACA,CAAK,CAAEwC,KAAR,qBAAC,EAAe,CAAf,CAAD,CAAoBA,CAApB,CAAD,CAFX,CAAZ,CAIN,CACF,CAuFG,CAkBE,wBAAwB,CAAE1B,CAlB5B,CAmBE,MAAM,CAAEpB,iBAAiB,CAACM,CAAK,CAACqD,KAAP,CAnB3B,EA3BF,CAkDH,CAlKS,CADL"}
|
|
1
|
+
{"version":3,"file":"DatePickerTypeYearRange.js","names":["addYears","startOfDecade","React","forwardRef","useEffect","useRef","useState","useClickOutside","useFlag","useForkRef","DatePickerDropdown","DatePickerFieldTypeYearRange","getDropdownZIndex","normalizeRangeValue","datePickerPropDateTimeViewDefault","useCurrentVisibleDate","DatePickerTypeYearRange","props","ref","events","dateTimeView","locale","dropdownForm","onFocus","onBlur","dropdownClassName","leftSide","rightSide","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","name","fieldProps","startFieldRef","endFieldRef","startFieldInputRef","endFieldInputRef","calendarRef","fieldFocused","setFieldFocused","startFocused","endFocused","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","startFieldOnFocusHandler","e","on","Array","isArray","endFieldOnFocusHandler","startFieldOnBlurHandler","endFieldOnBlurHandler","hadleChange","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport React, { forwardRef, useEffect, useRef, useState } from 'react';\n\nimport { useClickOutside } from '../../../hooks/useClickOutside/useClickOutside';\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { useForkRef } from '../../../hooks/useForkRef/useForkRef';\nimport {\n DatePickerDropdown,\n DatePickerDropdownPropOnChange,\n} from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeYearRange } from '../DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange';\nimport { getDropdownZIndex, normalizeRangeValue } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeYearRange: DatePickerTypeComponent<'date-range'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownForm,\n onFocus,\n onBlur,\n dropdownClassName,\n leftSide,\n rightSide,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n inputRef,\n name,\n ...fieldProps\n } = props;\n\n const startFieldRef = useRef<HTMLDivElement>(null);\n const endFieldRef = useRef<HTMLDivElement>(null);\n const startFieldInputRef = useRef<HTMLInputElement>(null);\n const endFieldInputRef = useRef<HTMLInputElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n\n const [fieldFocused, setFieldFocused] = useState<'start' | 'end' | false>(\n false,\n );\n\n const startFocused = fieldFocused === 'start';\n const endFocused = fieldFocused === 'end';\n\n const hadleChange: DatePickerDropdownPropOnChange = ({ e, value }) => {\n if (startFocused) {\n props.onChange?.({\n e,\n value: normalizeRangeValue([value, props?.value?.[1]]),\n });\n }\n if (endFocused) {\n props.onChange?.({\n e,\n value: normalizeRangeValue([props?.value?.[0], value]),\n });\n }\n };\n\n const [calendarVisible, setCalendarVisible] = useFlag(false);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n calendarVisible,\n });\n\n const startFieldOnBlurHandler = (e: React.FocusEvent<HTMLElement>) =>\n Array.isArray(onBlur) ? onBlur[0]?.(e) : onBlur?.(e);\n\n const endFieldOnBlurHandler = (e: React.FocusEvent<HTMLElement>) =>\n Array.isArray(onBlur) ? onBlur[1]?.(e) : onBlur?.(e);\n\n const startFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused('start');\n setCalendarVisible.on();\n Array.isArray(onFocus) ? onFocus[0]?.(e) : onFocus?.(e);\n };\n\n const endFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused('end');\n setCalendarVisible.on();\n Array.isArray(onFocus) ? onFocus[1]?.(e) : onFocus?.(e);\n };\n\n // эфект для того чтобы календарь переключался при вводе с клавиатуры\n useEffect(() => {\n if (props.value?.[0] && dateTimeView === 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[0] && dateTimeView !== 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value?.[0]?.getTime(), calendarVisible, startFocused]);\n\n useEffect(() => {\n if (props.value?.[1] && dateTimeView === 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[1] && dateTimeView !== 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(addYears(newVisibleDate, -10));\n }\n }\n }, [props.value?.[1]?.getTime(), calendarVisible, endFocused]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [startFieldRef, endFieldRef, calendarRef],\n handler: () => {\n setFieldFocused(false);\n setCalendarVisible.off();\n },\n });\n\n return (\n <>\n <DatePickerFieldTypeYearRange\n {...fieldProps}\n ref={ref}\n startFieldRef={startFieldRef}\n endFieldRef={endFieldRef}\n startFieldInputRef={useForkRef([startFieldInputRef, inputRef?.[0]])}\n endFieldInputRef={useForkRef([endFieldInputRef, inputRef?.[1]])}\n startFieldOnFocus={startFieldOnFocusHandler}\n endFieldOnFocus={endFieldOnFocusHandler}\n startFieldLeftSide={\n Array.isArray(leftSide) ? leftSide?.[0] : leftSide\n }\n startFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[0] : undefined\n }\n endFieldLeftSide={Array.isArray(leftSide) ? leftSide?.[1] : undefined}\n endFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[1] : rightSide\n }\n startFieldOnBlur={startFieldOnBlurHandler}\n endFieldOnBlur={endFieldOnBlurHandler}\n startFocused={startFocused}\n endFocused={endFocused}\n startFieldName={Array.isArray(name) ? name[0] : `${name}_start`}\n endFieldName={Array.isArray(name) ? name[1] : `${name}_end`}\n />\n <DatePickerDropdown\n type=\"year\"\n ref={calendarRef}\n anchorRef={startFieldRef}\n isOpen={calendarVisible}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n currentVisibleDate={currentVisibleDate}\n value={props.value || undefined}\n view={dateTimeView}\n events={events}\n locale={locale}\n className={dropdownClassName}\n minDate={props.minDate}\n maxDate={props.maxDate}\n form={dropdownForm}\n onChange={hadleChange}\n renderAdditionalControls={renderAdditionalControls}\n zIndex={getDropdownZIndex(props.style)}\n />\n </>\n );\n });\n"],"mappings":"mXAAA,OAASA,QAAT,CAAmBC,aAAnB,KAAwC,UAAxC,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,MAAvC,CAA+CC,QAA/C,KAA+D,OAA/D,CAEA,OAASC,eAAT,sDACA,OAASC,OAAT,sCACA,OAASC,UAAT,4CACA,OACEC,kBADF,gDAIA,OAASC,4BAAT,oEACA,OAASC,iBAAT,CAA4BC,mBAA5B,kBACA,OACEC,iCADF,gBAIA,OAASC,qBAAT,gCAEA,MAAO,IAAMC,wBAA8D,CACzEb,UAAU,CAAC,SAACc,CAAD,CAAQC,CAAR,CAAgB,aAEvBC,CAFuB,CAiBrBF,CAjBqB,CAEvBE,MAFuB,GAiBrBF,CAjBqB,CAGvBG,YAHuB,CAGvBA,CAHuB,YAGRN,iCAHQ,GAIvBO,CAJuB,CAiBrBJ,CAjBqB,CAIvBI,MAJuB,CAKvBC,CALuB,CAiBrBL,CAjBqB,CAKvBK,YALuB,CAMvBC,CANuB,CAiBrBN,CAjBqB,CAMvBM,OANuB,CAOvBC,CAPuB,CAiBrBP,CAjBqB,CAOvBO,MAPuB,CAQvBC,CARuB,CAiBrBR,CAjBqB,CAQvBQ,iBARuB,CASvBC,CATuB,CAiBrBT,CAjBqB,CASvBS,QATuB,CAUvBC,CAVuB,CAiBrBV,CAjBqB,CAUvBU,SAVuB,CAWHC,CAXG,CAiBrBX,CAjBqB,CAWvBY,kBAXuB,CAYvBC,CAZuB,CAiBrBb,CAjBqB,CAYvBa,0BAZuB,CAavBC,CAbuB,CAiBrBd,CAjBqB,CAavBc,wBAbuB,CAcvBC,CAduB,CAiBrBf,CAjBqB,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N,CACD,GAAIL,CAAJ,CAAgB,mBACd1B,CAAK,CAACiD,QADQ,qBACd,OAAAjD,CAAK,CAAY,CACfyC,CAAC,CAADA,CADe,CAEfV,KAAK,CAAEnC,mBAAmB,CAAC,QAACI,CAAD,WAACA,CAAD,YAACA,CAAK,CAAE+B,KAAR,qBAAC,EAAe,CAAf,CAAD,CAAoBA,CAApB,CAAD,CAFX,CAAZ,CAIN,CACF,CA8GG,CAgBE,wBAAwB,CAAEjB,CAhB5B,CAiBE,MAAM,CAAEnB,iBAAiB,CAACK,CAAK,CAACkD,KAAP,CAjB3B,EA3BF,CAgDH,CAhLS,CADL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["type"];import React,{forwardRef,useRef}from"react";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{getByMap}from"../../utils/getByMap";import{
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["type"];import React,{forwardRef,useRef}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{getByMap}from"../../utils/getByMap";import{DateTimeTypeDate}from"./DateTimeTypeDate/DateTimeTypeDate";import{DateTimeTypeDateTime}from"./DateTimeTypeDateTime/DateTimeTypeDateTime";import{DateTimeTypeMonth}from"./DateTimeTypeMonth/DateTimeTypeMonth";import{DateTimeTypeTime}from"./DateTimeTypeTime/DateTimeTypeTime";import{DateTimeTypeYear}from"./DateTimeTypeYear/DateTimeTypeYear";import{dateTimePropTypeDefault}from"./helpers/types";var typeMap={date:DateTimeTypeDate,month:DateTimeTypeMonth,year:DateTimeTypeYear,time:DateTimeTypeTime,"date-time":DateTimeTypeDateTime};export var COMPONENT_NAME="DateTime";export var DateTime=forwardRef(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.type,f=void 0===e?dateTimePropTypeDefault:e,g=_objectWithoutProperties(d,_excluded),h=getByMap(typeMap,f);return React.createElement(h,Object.assign({},g,{ref:useForkRef([b,c])}))});export*from"./helpers/types";
|
|
2
2
|
//# sourceMappingURL=DateTime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","names":["React","forwardRef","useRef","
|
|
1
|
+
{"version":3,"file":"DateTime.js","names":["React","forwardRef","useRef","usePropsHandler","useForkRef","getByMap","DateTimeTypeDate","DateTimeTypeDateTime","DateTimeTypeMonth","DateTimeTypeTime","DateTimeTypeYear","dateTimePropTypeDefault","typeMap","COMPONENT_NAME","DateTime","props","ref","dateTimeRef","type","otherProps","Component"],"sources":["../../../../../src/components/DateTime/DateTime.tsx"],"sourcesContent":["import React, { forwardRef, useRef } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { useForkRef } from '##/hooks/useForkRef/useForkRef';\nimport { getByMap } from '##/utils/getByMap';\n\nimport { DateTimeTypeDate } from './DateTimeTypeDate/DateTimeTypeDate';\nimport { DateTimeTypeDateTime } from './DateTimeTypeDateTime/DateTimeTypeDateTime';\nimport { DateTimeTypeMonth } from './DateTimeTypeMonth/DateTimeTypeMonth';\nimport { DateTimeTypeTime } from './DateTimeTypeTime/DateTimeTypeTime';\nimport { DateTimeTypeYear } from './DateTimeTypeYear/DateTimeTypeYear';\nimport {\n DateTimeComponent,\n DateTimePropType,\n dateTimePropTypeDefault,\n DateTimeTypeComponent,\n} from './helpers/types';\n\nconst typeMap: Record<\n DateTimePropType,\n DateTimeTypeComponent<DateTimePropType>\n> = {\n 'date': DateTimeTypeDate,\n 'month': DateTimeTypeMonth,\n 'year': DateTimeTypeYear,\n 'time': DateTimeTypeTime,\n 'date-time': DateTimeTypeDateTime,\n} as const;\n\nexport const COMPONENT_NAME = 'DateTime' as const;\n\nexport const DateTime: DateTimeComponent = forwardRef((props, ref) => {\n const dateTimeRef = useRef<HTMLDivElement>(null);\n const { type = dateTimePropTypeDefault, ...otherProps } = usePropsHandler(\n COMPONENT_NAME,\n props,\n dateTimeRef,\n );\n\n const Component = getByMap(typeMap, type);\n\n return <Component {...otherProps} ref={useForkRef([ref, dateTimeRef])} />;\n});\n\nexport * from './helpers/types';\n"],"mappings":"4GAAA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,eAAT,2CACA,OAASC,UAAT,yCACA,OAASC,QAAT,4BAEA,OAASC,gBAAT,2CACA,OAASC,oBAAT,mDACA,OAASC,iBAAT,6CACA,OAASC,gBAAT,2CACA,OAASC,gBAAT,2CACA,OAGEC,uBAHF,uBAOA,GAAMC,QAGL,CAAG,CACF,KAAQN,gBADN,CAEF,MAASE,iBAFP,CAGF,KAAQE,gBAHN,CAIF,KAAQD,gBAJN,CAKF,YAAaF,oBALX,CAHJ,CAWA,MAAO,IAAMM,eAAc,CAAG,UAAvB,CAEP,MAAO,IAAMC,SAA2B,CAAGb,UAAU,CAAC,SAACc,CAAD,CAAQC,CAAR,CAAgB,IAC9DC,EAAW,CAAGf,MAAM,CAAiB,IAAjB,CAD0C,GAEVC,eAAe,CACvEU,cADuE,CAEvEE,CAFuE,CAGvEE,CAHuE,CAFL,KAE5DC,IAF4D,CAE5DA,CAF4D,YAErDP,uBAFqD,GAEzBQ,CAFyB,uCAQ9DC,CAAS,CAAGf,QAAQ,CAACO,OAAD,CAAUM,CAAV,CAR0C,CAUpE,MAAO,qBAAC,CAAD,kBAAeC,CAAf,EAA2B,GAAG,CAAEf,UAAU,CAAC,CAACY,CAAD,CAAMC,CAAN,CAAD,CAA1C,GACR,CAXoD,CAA9C,CAaP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.DateTimeCell{--bg-color:var(--color-control-bg-ghost);--visible-height:calc(var(--date-time-cell-height) - var(--date-time-cell-horisontal-gap)*2);align-items:center;display:flex;height:var(--date-time-cell-height);justify-content:center;position:relative;width:var(--date-time-cell-width)}.DateTimeCell_range:before{left:0;right:0}.
|
|
1
|
+
.DateTimeCell{--bg-color:var(--color-control-bg-ghost);--visible-height:calc(var(--date-time-cell-height) - var(--date-time-cell-horisontal-gap)*2);align-items:center;display:flex;height:var(--date-time-cell-height);justify-content:center;position:relative;width:var(--date-time-cell-width)}.DateTimeCell_range:before{background:var(--bg-color);bottom:var(--date-time-cell-vertical-gap);content:"";left:0;position:absolute;right:0;top:var(--date-time-cell-vertical-gap)}.DateTimeCell_range_first:before,.DateTimeCell_range_last:before{background:var(--bg-color);bottom:var(--date-time-cell-vertical-gap);content:"";position:absolute;top:var(--date-time-cell-vertical-gap)}.DateTimeCell_range_first:before{border-radius:var(--visible-height) 0 0 var(--visible-height);left:var(--date-time-cell-horisontal-gap);right:0}.DateTimeCell_range_last:before{border-radius:0 var(--visible-height) var(--visible-height) 0;left:0;right:var(--date-time-cell-horisontal-gap)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","onChange","data","onPrev","onNext"];import"./DateTimeSlider.css";import{IconForward}from"@consta/icons/IconForward";import React from"react";import{cn}from"../../../utils/bem";import{Button}from"../../Button/Button";import{Text}from"../../Text/Text";export var cnDateTimeSlider=cn("DateTimeSlider");var getCurrentItem=function(a){var b,c=(null===(b=a.find(function(a){return a.current}))||void 0===b?void 0:b.items.findIndex(function(a){return a.current}))||0;return 0>c?0:c};export var DateTimeSlider=function(a){var b=a.className,c=a.onChange,d=a.data,e=a.onPrev,f=a.onNext,g=_objectWithoutProperties(a,_excluded),h=getCurrentItem(d);return React.createElement("div",Object.assign({},g,{className:cnDateTimeSlider(null,[b])}),React.createElement(Button,{className:cnDateTimeSlider("Button",{direction:"prev"}),view:"ghost",iconLeft:IconForward,onClick:e}),React.createElement("div",{className:cnDateTimeSlider("Slider"),style:_defineProperty({},"--current-item",h)},React.createElement("div",{className:cnDateTimeSlider("SliderBody")},React.createElement("div",{className:cnDateTimeSlider("Selector")}),d.map(function(a,b){return React.createElement(Text,{className:cnDateTimeSlider("ParentLabel",{position:b.toString()}),weight:"bold",size:"s",key:a.label,view:a.current?void 0:"ghost"},a.label)}),d.map(function(a,b){var d;return React.createElement("div",{key:a.label,className:cnDateTimeSlider("Parent",{position:b.toString(),selected:!!a.valueRange}),style:a.valueRange&&(d={},_defineProperty(d,"--value-offset","".concat(a.valueRange[0],"%")),_defineProperty(d,"--value-width","".concat(a.valueRange[1],"%")),d)},a.items.map(function(a,b){return React.createElement("button",{className:cnDateTimeSlider("Item"),key:b,onFocus:function onFocus(){return null===c||void 0===c?void 0:c(a.date)},type:"button"},React.createElement(Text,{className:cnDateTimeSlider("ItemLabel"),size:"2xs",view:"ghost",align:"center"},a.label))}))}))),React.createElement(Button,{className:cnDateTimeSlider("Button",{direction:"next"}),view:"ghost",iconLeft:IconForward,onClick:f}))};
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","onChange","data","onPrev","onNext"];import"./DateTimeSlider.css";import{IconForward}from"@consta/icons/IconForward";import React from"react";import{cn}from"../../../utils/bem";import{Button}from"../../Button/Button";import{Text}from"../../Text/Text";export var cnDateTimeSlider=cn("DateTimeSlider");var getCurrentItem=function(a){var b,c=(null===(b=a.find(function(a){return a.current}))||void 0===b?void 0:b.items.findIndex(function(a){return a.current}))||0;return 0>c?0:c};export var DateTimeSlider=function(a){var b=a.className,c=a.onChange,d=a.data,e=a.onPrev,f=a.onNext,g=_objectWithoutProperties(a,_excluded),h=getCurrentItem(d);return React.createElement("div",Object.assign({},g,{className:cnDateTimeSlider(null,[b])}),React.createElement(Button,{className:cnDateTimeSlider("Button",{direction:"prev"}),view:"ghost",iconLeft:IconForward,type:"button",onClick:e}),React.createElement("div",{className:cnDateTimeSlider("Slider"),style:_defineProperty({},"--current-item",h)},React.createElement("div",{className:cnDateTimeSlider("SliderBody")},React.createElement("div",{className:cnDateTimeSlider("Selector")}),d.map(function(a,b){return React.createElement(Text,{className:cnDateTimeSlider("ParentLabel",{position:b.toString()}),weight:"bold",size:"s",key:a.label,view:a.current?void 0:"ghost"},a.label)}),d.map(function(a,b){var d;return React.createElement("div",{key:a.label,className:cnDateTimeSlider("Parent",{position:b.toString(),selected:!!a.valueRange}),style:a.valueRange&&(d={},_defineProperty(d,"--value-offset","".concat(a.valueRange[0],"%")),_defineProperty(d,"--value-width","".concat(a.valueRange[1],"%")),d)},a.items.map(function(a,b){return React.createElement("button",{className:cnDateTimeSlider("Item"),key:b,onFocus:function onFocus(){return null===c||void 0===c?void 0:c(a.date)},type:"button"},React.createElement(Text,{className:cnDateTimeSlider("ItemLabel"),size:"2xs",view:"ghost",align:"center"},a.label))}))}))),React.createElement(Button,{className:cnDateTimeSlider("Button",{direction:"next"}),view:"ghost",type:"button",iconLeft:IconForward,onClick:f}))};
|
|
2
2
|
//# sourceMappingURL=DateTimeSlider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeSlider.js","names":["IconForward","React","cn","Button","Text","cnDateTimeSlider","getCurrentItem","data","index","find","item","current","items","findIndex","DateTimeSlider","props","className","onChange","onPrev","onNext","otherProps","currentItemIndex","direction","map","year","position","toString","label","selected","valueRange","date"],"sources":["../../../../../../src/components/DateTime/DateTimeSlider/DateTimeSlider.tsx"],"sourcesContent":["import './DateTimeSlider.css';\n\nimport { IconForward } from '@consta/icons/IconForward';\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';\nimport { Button } from '../../Button/Button';\nimport { Text } from '../../Text/Text';\n\ntype Data = {\n label: string | number;\n current?: boolean;\n valueRange?: number[];\n date: Date;\n items: {\n label: string;\n date: Date;\n current?: boolean;\n }[];\n};\n\nexport type DateTimeSliderProps = PropsWithHTMLAttributes<\n {\n onChange?: (date: Date) => void;\n onPrev?: () => void;\n onNext?: () => void;\n children?: never;\n data: Data[];\n },\n HTMLDivElement\n>;\n\nexport const cnDateTimeSlider = cn('DateTimeSlider');\n\nconst getCurrentItem = (data: Data[]) => {\n const index =\n data\n .find((item) => item.current)\n ?.items.findIndex((item) => item.current) || 0;\n\n return index < 0 ? 0 : index;\n};\n\nexport const DateTimeSlider: React.FC<DateTimeSliderProps> = (props) => {\n const { className, onChange, data, onPrev, onNext, ...otherProps } = props;\n\n const currentItemIndex = getCurrentItem(data);\n\n return (\n <div {...otherProps} className={cnDateTimeSlider(null, [className])}>\n <Button\n className={cnDateTimeSlider('Button', { direction: 'prev' })}\n view=\"ghost\"\n iconLeft={IconForward}\n onClick={onPrev}\n />\n <div\n className={cnDateTimeSlider('Slider')}\n style={{ ['--current-item' as string]: currentItemIndex }}\n >\n <div className={cnDateTimeSlider('SliderBody')}>\n <div className={cnDateTimeSlider('Selector')} />\n {data.map((year, index) => (\n <Text\n className={cnDateTimeSlider('ParentLabel', {\n position: index.toString(),\n })}\n weight=\"bold\"\n size=\"s\"\n key={year.label}\n view={year.current ? undefined : 'ghost'}\n >\n {year.label}\n </Text>\n ))}\n {data.map((year, index) => (\n <div\n key={year.label}\n className={cnDateTimeSlider('Parent', {\n position: index.toString(),\n selected: !!year.valueRange,\n })}\n style={\n year.valueRange && {\n ['--value-offset' as string]: `${year.valueRange[0]}%`,\n ['--value-width' as string]: `${year.valueRange[1]}%`,\n }\n }\n >\n {year.items.map((item, index) => (\n <button\n className={cnDateTimeSlider('Item')}\n key={index}\n onFocus={() => onChange?.(item.date)}\n type=\"button\"\n >\n <Text\n className={cnDateTimeSlider('ItemLabel')}\n size=\"2xs\"\n view=\"ghost\"\n align=\"center\"\n >\n {item.label}\n </Text>\n </button>\n ))}\n </div>\n ))}\n </div>\n </div>\n <Button\n className={cnDateTimeSlider('Button', { direction: 'next' })}\n view=\"ghost\"\n iconLeft={IconForward}\n onClick={onNext}\n />\n </div>\n );\n};\n"],"mappings":"wNAAA,6BAEA,OAASA,WAAT,KAA4B,2BAA5B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BAEA,OAASC,MAAT,2BACA,OAASC,IAAT,uBAyBA,MAAO,IAAMC,iBAAgB,CAAGH,EAAE,CAAC,gBAAD,CAA3B,CAEP,GAAMI,eAAc,CAAG,SAACC,CAAD,CAAkB,OACjCC,CAAK,CACT,WAAAD,CAAI,CACDE,IADH,CACQ,SAACC,CAAD,QAAUA,EAAI,CAACC,OAAf,CADR,wBAEIC,KAFJ,CAEUC,SAFV,CAEoB,SAACH,CAAD,QAAUA,EAAI,CAACC,OAAf,CAFpB,IAE+C,CAJV,CAMvC,MAAe,EAAR,CAAAH,CAAK,CAAO,CAAP,CAAWA,CACxB,CAPD,CASA,MAAO,IAAMM,eAA6C,CAAG,SAACC,CAAD,CAAW,IAC9DC,EAD8D,CACDD,CADC,CAC9DC,SAD8D,CACnDC,CADmD,CACDF,CADC,CACnDE,QADmD,CACzCV,CADyC,CACDQ,CADC,CACzCR,IADyC,CACnCW,CADmC,CACDH,CADC,CACnCG,MADmC,CAC3BC,CAD2B,CACDJ,CADC,CAC3BI,MAD2B,CAChBC,CADgB,0BACDL,CADC,YAGhEM,CAAgB,CAAGf,cAAc,CAACC,CAAD,CAH+B,CAKtE,MACE,4CAASa,CAAT,EAAqB,SAAS,CAAEf,gBAAgB,CAAC,IAAD,CAAO,CAACW,CAAD,CAAP,CAAhD,GACE,oBAAC,MAAD,EACE,SAAS,CAAEX,gBAAgB,CAAC,QAAD,CAAW,CAAEiB,SAAS,CAAE,MAAb,CAAX,CAD7B,CAEE,IAAI,CAAC,OAFP,CAGE,QAAQ,CAAEtB,WAHZ,CAIE,OAAO,CAAEkB,
|
|
1
|
+
{"version":3,"file":"DateTimeSlider.js","names":["IconForward","React","cn","Button","Text","cnDateTimeSlider","getCurrentItem","data","index","find","item","current","items","findIndex","DateTimeSlider","props","className","onChange","onPrev","onNext","otherProps","currentItemIndex","direction","map","year","position","toString","label","selected","valueRange","date"],"sources":["../../../../../../src/components/DateTime/DateTimeSlider/DateTimeSlider.tsx"],"sourcesContent":["import './DateTimeSlider.css';\n\nimport { IconForward } from '@consta/icons/IconForward';\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';\nimport { Button } from '../../Button/Button';\nimport { Text } from '../../Text/Text';\n\ntype Data = {\n label: string | number;\n current?: boolean;\n valueRange?: number[];\n date: Date;\n items: {\n label: string;\n date: Date;\n current?: boolean;\n }[];\n};\n\nexport type DateTimeSliderProps = PropsWithHTMLAttributes<\n {\n onChange?: (date: Date) => void;\n onPrev?: () => void;\n onNext?: () => void;\n children?: never;\n data: Data[];\n },\n HTMLDivElement\n>;\n\nexport const cnDateTimeSlider = cn('DateTimeSlider');\n\nconst getCurrentItem = (data: Data[]) => {\n const index =\n data\n .find((item) => item.current)\n ?.items.findIndex((item) => item.current) || 0;\n\n return index < 0 ? 0 : index;\n};\n\nexport const DateTimeSlider: React.FC<DateTimeSliderProps> = (props) => {\n const { className, onChange, data, onPrev, onNext, ...otherProps } = props;\n\n const currentItemIndex = getCurrentItem(data);\n\n return (\n <div {...otherProps} className={cnDateTimeSlider(null, [className])}>\n <Button\n className={cnDateTimeSlider('Button', { direction: 'prev' })}\n view=\"ghost\"\n iconLeft={IconForward}\n type=\"button\"\n onClick={onPrev}\n />\n <div\n className={cnDateTimeSlider('Slider')}\n style={{ ['--current-item' as string]: currentItemIndex }}\n >\n <div className={cnDateTimeSlider('SliderBody')}>\n <div className={cnDateTimeSlider('Selector')} />\n {data.map((year, index) => (\n <Text\n className={cnDateTimeSlider('ParentLabel', {\n position: index.toString(),\n })}\n weight=\"bold\"\n size=\"s\"\n key={year.label}\n view={year.current ? undefined : 'ghost'}\n >\n {year.label}\n </Text>\n ))}\n {data.map((year, index) => (\n <div\n key={year.label}\n className={cnDateTimeSlider('Parent', {\n position: index.toString(),\n selected: !!year.valueRange,\n })}\n style={\n year.valueRange && {\n ['--value-offset' as string]: `${year.valueRange[0]}%`,\n ['--value-width' as string]: `${year.valueRange[1]}%`,\n }\n }\n >\n {year.items.map((item, index) => (\n <button\n className={cnDateTimeSlider('Item')}\n key={index}\n onFocus={() => onChange?.(item.date)}\n type=\"button\"\n >\n <Text\n className={cnDateTimeSlider('ItemLabel')}\n size=\"2xs\"\n view=\"ghost\"\n align=\"center\"\n >\n {item.label}\n </Text>\n </button>\n ))}\n </div>\n ))}\n </div>\n </div>\n <Button\n className={cnDateTimeSlider('Button', { direction: 'next' })}\n view=\"ghost\"\n type=\"button\"\n iconLeft={IconForward}\n onClick={onNext}\n />\n </div>\n );\n};\n"],"mappings":"wNAAA,6BAEA,OAASA,WAAT,KAA4B,2BAA5B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BAEA,OAASC,MAAT,2BACA,OAASC,IAAT,uBAyBA,MAAO,IAAMC,iBAAgB,CAAGH,EAAE,CAAC,gBAAD,CAA3B,CAEP,GAAMI,eAAc,CAAG,SAACC,CAAD,CAAkB,OACjCC,CAAK,CACT,WAAAD,CAAI,CACDE,IADH,CACQ,SAACC,CAAD,QAAUA,EAAI,CAACC,OAAf,CADR,wBAEIC,KAFJ,CAEUC,SAFV,CAEoB,SAACH,CAAD,QAAUA,EAAI,CAACC,OAAf,CAFpB,IAE+C,CAJV,CAMvC,MAAe,EAAR,CAAAH,CAAK,CAAO,CAAP,CAAWA,CACxB,CAPD,CASA,MAAO,IAAMM,eAA6C,CAAG,SAACC,CAAD,CAAW,IAC9DC,EAD8D,CACDD,CADC,CAC9DC,SAD8D,CACnDC,CADmD,CACDF,CADC,CACnDE,QADmD,CACzCV,CADyC,CACDQ,CADC,CACzCR,IADyC,CACnCW,CADmC,CACDH,CADC,CACnCG,MADmC,CAC3BC,CAD2B,CACDJ,CADC,CAC3BI,MAD2B,CAChBC,CADgB,0BACDL,CADC,YAGhEM,CAAgB,CAAGf,cAAc,CAACC,CA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AAL,CAAgB,CAAhB,CADnC,yBAEG,eAFH,WAEkCL,CAAI,CAACK,UAAL,CAAgB,CAAhB,CAFlC,SAPJ,EAaGL,CAAI,CAACZ,KAAL,CAAWW,GAAX,CAAe,SAACb,CAAD,CAAOF,CAAP,QACd,+BACE,SAAS,CAAEH,gBAAgB,CAAC,MAAD,CAD7B,CAEE,GAAG,CAAEG,CAFP,CAGE,OAAO,CAAE,iCAAMS,CAAN,WAAMA,CAAN,QAAMA,CAAQ,CAAGP,CAAI,CAACoB,IAAR,CAAd,CAHX,CAIE,IAAI,CAAC,QAJP,EAME,oBAAC,IAAD,EACE,SAAS,CAAEzB,gBAAgB,CAAC,WAAD,CAD7B,CAEE,IAAI,CAAC,KAFP,CAGE,IAAI,CAAC,OAHP,CAIE,KAAK,CAAC,QAJR,EAMGK,CAAI,CAACiB,KANR,CANF,CADc,CAAf,CAbH,CADQ,CAAT,CAfH,CAJF,CARF,CA8DE,oBAAC,MAAD,EACE,SAAS,CAAEtB,gBAAgB,CAAC,QAAD,CAAW,CAAEiB,SAAS,CAAE,MAAb,CAAX,CAD7B,CAEE,IAAI,CAAC,OAFP,CAGE,IAAI,CAAC,QAHP,CAIE,QAAQ,CAAEtB,WAJZ,CAKE,OAAO,CAAEmB,CALX,EA9DF,CAuEH,CA7EM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["label","className","prevOnClick","nextOnClick","onLabelClick"];import"./DateTimeToggler.css";import{IconForward}from"@consta/icons/IconForward";import React from"react";import{cn}from"../../../utils/bem";import{Button}from"../../Button/Button";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";export var cnDateTimeToggler=cn("DateTimeToggler");export var DateTimeToggler=function(a){var b=a.label,c=a.className,d=a.prevOnClick,e=a.nextOnClick,f=a.onLabelClick,g=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},g,{className:cnDateTimeToggler({withPrevButton:!!d,withNextButton:!!e},[c])}),d&&React.createElement(Button,{className:cnDateTimeToggler("Button",{direction:"prev"}),onClick:d,iconLeft:IconForward,size:"s",view:"clear",iconSize:"s"}),React.createElement(DateTimeLabel,{onClick:f,cursor:f&&"pointer",className:cnDateTimeToggler("Label"),label:b,align:"center"}),e&&React.createElement(Button,{className:cnDateTimeToggler("Button",{direction:"next"}),onClick:e,iconLeft:IconForward,size:"s",view:"clear",iconSize:"s"}))};
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["label","className","prevOnClick","nextOnClick","onLabelClick"];import"./DateTimeToggler.css";import{IconForward}from"@consta/icons/IconForward";import React from"react";import{cn}from"../../../utils/bem";import{Button}from"../../Button/Button";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";export var cnDateTimeToggler=cn("DateTimeToggler");export var DateTimeToggler=function(a){var b=a.label,c=a.className,d=a.prevOnClick,e=a.nextOnClick,f=a.onLabelClick,g=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},g,{className:cnDateTimeToggler({withPrevButton:!!d,withNextButton:!!e},[c])}),d&&React.createElement(Button,{type:"button",className:cnDateTimeToggler("Button",{direction:"prev"}),onClick:d,iconLeft:IconForward,size:"s",view:"clear",iconSize:"s"}),React.createElement(DateTimeLabel,{onClick:f,cursor:f&&"pointer",className:cnDateTimeToggler("Label"),label:b,align:"center"}),e&&React.createElement(Button,{type:"button",className:cnDateTimeToggler("Button",{direction:"next"}),onClick:e,iconLeft:IconForward,size:"s",view:"clear",iconSize:"s"}))};
|
|
2
2
|
//# sourceMappingURL=DateTimeToggler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeToggler.js","names":["IconForward","React","cn","Button","DateTimeLabel","cnDateTimeToggler","DateTimeToggler","props","label","className","prevOnClick","nextOnClick","onLabelClick","otherProps","withPrevButton","withNextButton","direction"],"sources":["../../../../../../src/components/DateTime/DateTimeToggler/DateTimeToggler.tsx"],"sourcesContent":["import './DateTimeToggler.css';\n\nimport { IconForward } from '@consta/icons/IconForward';\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithJsxAttributes } from '../../../utils/types/PropsWithJsxAttributes';\nimport { Button } from '../../Button/Button';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\n\nexport type DateTimeTogglerProps = PropsWithJsxAttributes<\n {\n prevOnClick?: React.EventHandler<React.MouseEvent<HTMLDivElement>>;\n nextOnClick?: React.EventHandler<React.MouseEvent<HTMLDivElement>>;\n onLabelClick?: React.EventHandler<React.MouseEvent<HTMLDivElement>>;\n label: string | number;\n children?: never;\n },\n 'div'\n>;\n\nexport const cnDateTimeToggler = cn('DateTimeToggler');\n\nexport const DateTimeToggler: React.FC<DateTimeTogglerProps> = (props) => {\n const {\n label,\n className,\n prevOnClick,\n nextOnClick,\n onLabelClick,\n ...otherProps\n } = props;\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeToggler(\n {\n withPrevButton: Boolean(prevOnClick),\n withNextButton: Boolean(nextOnClick),\n },\n [className],\n )}\n >\n {prevOnClick && (\n <Button\n className={cnDateTimeToggler('Button', { direction: 'prev' })}\n onClick={prevOnClick}\n iconLeft={IconForward}\n size=\"s\"\n view=\"clear\"\n iconSize=\"s\"\n />\n )}\n <DateTimeLabel\n onClick={onLabelClick}\n cursor={onLabelClick && 'pointer'}\n className={cnDateTimeToggler('Label')}\n label={label}\n align=\"center\"\n />\n {nextOnClick && (\n <Button\n className={cnDateTimeToggler('Button', { direction: 'next' })}\n onClick={nextOnClick}\n iconLeft={IconForward}\n size=\"s\"\n view=\"clear\"\n iconSize=\"s\"\n />\n )}\n </div>\n );\n};\n"],"mappings":"oKAAA,8BAEA,OAASA,WAAT,KAA4B,2BAA5B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BAEA,OAASC,MAAT,2BACA,OAASC,aAAT,sCAaA,MAAO,IAAMC,kBAAiB,CAAGH,EAAE,CAAC,iBAAD,CAA5B,CAEP,MAAO,IAAMI,gBAA+C,CAAG,SAACC,CAAD,CAAW,CACxE,GACEC,EADF,CAOID,CAPJ,CACEC,KADF,CAEEC,CAFF,CAOIF,CAPJ,CAEEE,SAFF,CAGEC,CAHF,CAOIH,CAPJ,CAGEG,WAHF,CAIEC,CAJF,CAOIJ,CAPJ,CAIEI,WAJF,CAKEC,CALF,CAOIL,CAPJ,CAKEK,YALF,CAMKC,CANL,0BAOIN,CAPJ,YASA,MACE,4CACMM,CADN,EAEE,SAAS,CAAER,iBAAiB,CAC1B,CACES,cAAc,GAAUJ,CAD1B,CAEEK,cAAc,GAAUJ,CAF1B,CAD0B,CAK1B,CAACF,CAAD,CAL0B,CAF9B,GAUGC,CAAW,EACV,oBAAC,MAAD,EACE,SAAS,CAAEL,iBAAiB,CAAC,QAAD,CAAW,CAAEW,SAAS,CAAE,MAAb,CAAX,
|
|
1
|
+
{"version":3,"file":"DateTimeToggler.js","names":["IconForward","React","cn","Button","DateTimeLabel","cnDateTimeToggler","DateTimeToggler","props","label","className","prevOnClick","nextOnClick","onLabelClick","otherProps","withPrevButton","withNextButton","direction"],"sources":["../../../../../../src/components/DateTime/DateTimeToggler/DateTimeToggler.tsx"],"sourcesContent":["import './DateTimeToggler.css';\n\nimport { IconForward } from '@consta/icons/IconForward';\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithJsxAttributes } from '../../../utils/types/PropsWithJsxAttributes';\nimport { Button } from '../../Button/Button';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\n\nexport type DateTimeTogglerProps = PropsWithJsxAttributes<\n {\n prevOnClick?: React.EventHandler<React.MouseEvent<HTMLDivElement>>;\n nextOnClick?: React.EventHandler<React.MouseEvent<HTMLDivElement>>;\n onLabelClick?: React.EventHandler<React.MouseEvent<HTMLDivElement>>;\n label: string | number;\n children?: never;\n },\n 'div'\n>;\n\nexport const cnDateTimeToggler = cn('DateTimeToggler');\n\nexport const DateTimeToggler: React.FC<DateTimeTogglerProps> = (props) => {\n const {\n label,\n className,\n prevOnClick,\n nextOnClick,\n onLabelClick,\n ...otherProps\n } = props;\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeToggler(\n {\n withPrevButton: Boolean(prevOnClick),\n withNextButton: Boolean(nextOnClick),\n },\n [className],\n )}\n >\n {prevOnClick && (\n <Button\n type=\"button\"\n className={cnDateTimeToggler('Button', { direction: 'prev' })}\n onClick={prevOnClick}\n iconLeft={IconForward}\n size=\"s\"\n view=\"clear\"\n iconSize=\"s\"\n />\n )}\n <DateTimeLabel\n onClick={onLabelClick}\n cursor={onLabelClick && 'pointer'}\n className={cnDateTimeToggler('Label')}\n label={label}\n align=\"center\"\n />\n {nextOnClick && (\n <Button\n type=\"button\"\n className={cnDateTimeToggler('Button', { direction: 'next' })}\n onClick={nextOnClick}\n iconLeft={IconForward}\n size=\"s\"\n view=\"clear\"\n iconSize=\"s\"\n />\n )}\n </div>\n );\n};\n"],"mappings":"oKAAA,8BAEA,OAASA,WAAT,KAA4B,2BAA5B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BAEA,OAASC,MAAT,2BACA,OAASC,aAAT,sCAaA,MAAO,IAAMC,kBAAiB,CAAGH,EAAE,CAAC,iBAAD,CAA5B,CAEP,MAAO,IAAMI,gBAA+C,CAAG,SAACC,CAAD,CAAW,CACxE,GACEC,EADF,CAOID,CAPJ,CACEC,KADF,CAEEC,CAFF,CAOIF,CAPJ,CAEEE,SAFF,CAGEC,CAHF,CAOIH,CAPJ,CAGEG,WAHF,CAIEC,CAJF,CAOIJ,CAPJ,CAIEI,WAJF,CAKEC,CALF,CAOIL,CAPJ,CAKEK,YALF,CAMKC,CANL,0BAOIN,CAPJ,YASA,MACE,4CACMM,CADN,EAEE,SAAS,CAAER,iBAAiB,CAC1B,CACES,cAAc,GAAUJ,CAD1B,CAEEK,cAAc,GAAUJ,CAF1B,CAD0B,CAK1B,CAACF,CAAD,CAL0B,CAF9B,GAUGC,CAAW,EACV,oBAAC,MAAD,EACE,IAAI,CAAC,QADP,CAEE,SAAS,CAAEL,iBAAiB,CAAC,QAAD,CAAW,CAAEW,SAAS,CAAE,MAAb,CAAX,CAF9B,CAGE,OAAO,CAAEN,CAHX,CAIE,QAAQ,CAAEV,WAJZ,CAKE,IAAI,CAAC,GALP,CAME,IAAI,CAAC,OANP,CAOE,QAAQ,CAAC,GAPX,EAXJ,CAqBE,oBAAC,aAAD,EACE,OAAO,CAAEY,CADX,CAEE,MAAM,CAAEA,CAAY,EAAI,SAF1B,CAGE,SAAS,CAAEP,iBAAiB,CAAC,OAAD,CAH9B,CAIE,KAAK,CAAEG,CAJT,CAKE,KAAK,CAAC,QALR,EArBF,CA4BGG,CAAW,EACV,oBAAC,MAAD,EACE,IAAI,CAAC,QADP,CAEE,SAAS,CAAEN,iBAAiB,CAAC,QAAD,CAAW,CAAEW,SAAS,CAAE,MAAb,CAAX,CAF9B,CAGE,OAAO,CAAEL,CAHX,CAIE,QAAQ,CAAEX,WAJZ,CAKE,IAAI,CAAC,GALP,CAME,IAAI,CAAC,OANP,CAOE,QAAQ,CAAC,GAPX,EA7BJ,CAyCH,CApDM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.DragNDropField{align-items:center;background:var(--color-control-bg-clear);border:2px dashed var(--color-control-bg-border-default);border-radius:var(--control-radius);box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;min-height:160px;padding:var(--space-l);position:relative}.DragNDropField:not(.DragNDropField_disabled){cursor:pointer}.DragNDropField:hover{border-color:var(--color-control-bg-border-default-hover)}.
|
|
1
|
+
.DragNDropField{align-items:center;background:var(--color-control-bg-clear);border:2px dashed var(--color-control-bg-border-default);border-radius:var(--control-radius);box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;min-height:160px;padding:var(--space-l);position:relative}.DragNDropField:not(.DragNDropField_disabled){cursor:pointer}.DragNDropField:hover{background:var(--color-control-bg-clear-hover);border-color:var(--color-control-bg-border-default-hover)}.DragNDropField_active{background:var(--color-control-bg-clear-hover);border-color:var(--color-control-bg-border-focus)}.DragNDropField_disabled,.DragNDropField_disabled:hover{background:var(--color-control-bg-disable);border-color:transparent}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.HeaderMenu-List{display:flex;list-style-type:none;margin:0;padding:0}.HeaderMenu-Item{margin-right:var(--space-m)}.HeaderMenu-Item:last-child{margin-right:0}.HeaderMenu-Link{color:var(--color-typo-secondary);cursor:pointer;display:inline-block;line-height:var(--header-height);position:relative;text-decoration:none;transition:color .2s}.HeaderMenu-Link:hover
|
|
1
|
+
.HeaderMenu-List{display:flex;list-style-type:none;margin:0;padding:0}.HeaderMenu-Item{margin-right:var(--space-m)}.HeaderMenu-Item:last-child{margin-right:0}.HeaderMenu-Link{color:var(--color-typo-secondary);cursor:pointer;display:inline-block;line-height:var(--header-height);position:relative;text-decoration:none;transition:color .2s}.HeaderMenu-Link:hover{color:var(--color-typo-primary)}.HeaderMenu-Link_active{color:var(--color-typo-primary);pointer-events:none}.HeaderMenu-Link_active:before{background-color:var(--color-typo-link);border-radius:4px 4px 0 0;bottom:0;content:"";height:4px;left:50%;max-width:40px;position:absolute;transform:translateX(-50%);width:100%}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ListItemGrid{word-wrap:break-word;box-sizing:border-box;gap:var(--space-xs);justify-content:space-between}.ListItemGrid,.ListItemGrid-Slot{align-items:center;display:flex}.ListItemGrid-Slot_position_left,.ListItemGrid-Slot_position_right{width:-
|
|
1
|
+
.ListItemGrid{word-wrap:break-word;box-sizing:border-box;gap:var(--space-xs);justify-content:space-between}.ListItemGrid,.ListItemGrid-Slot{align-items:center;display:flex}.ListItemGrid-Slot_position_left,.ListItemGrid-Slot_position_right{width:-moz-max-content;width:max-content}.ListItemGrid-Slot_position_center{flex:1}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
.Loader{--backgroundColor:var(
|
|
2
2
|
--loaderBackgroundColor,var(--color-control-bg-primary)
|
|
3
|
-
);height:calc(100% - var(--loader-size));left:50%;position:relative;top:50%;transform:translate(-50%,-50%);width:100%}.Loader:before{
|
|
3
|
+
);height:calc(100% - var(--loader-size));left:50%;position:relative;top:50%;transform:translate(-50%,-50%);width:100%}.Loader:before{animation:loader 1s ease infinite;background:var(--backgroundColor);border-radius:50%;content:"";height:var(--loader-size);left:calc(50% - var(--loader-size)*2.5);position:absolute;top:calc(50% - var(--loader-size)*.5);width:var(--loader-size)}.Loader:after{animation:loader 1s ease -.36s infinite;background:var(--backgroundColor);border-radius:50%;content:"";height:var(--loader-size);left:calc(50% + var(--loader-size)*1.5);position:absolute;top:calc(50% - var(--loader-size)*.5);width:var(--loader-size)}.Loader-Dot{animation:loader 1s ease -.18s infinite;background:var(--backgroundColor);border-radius:50%;height:var(--loader-size);left:calc(50% - var(--loader-size)*.5);position:absolute;top:calc(50% - var(--loader-size)*.5);width:var(--loader-size)}.Loader_size_s{--loader-size:4px}.Loader_size_m{--loader-size:8px}@keyframes loader{50%{transform:scale(1.5)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Pagination{display:flex;width:100%}.Pagination_position_left{justify-content:flex-start}.Pagination_position_center{justify-content:center}.Pagination_position_right{justify-content:flex-end}.Pagination_size_xs{--tip-space:var(--control-space-xs)}.Pagination_size_s{--tip-space:var(--control-space-s)}.Pagination_size_m{--tip-space:var(--control-space-m)}.Pagination_size_l{--tip-space:var(--control-space-l)}.Pagination-Pages{display:flex}.Pagination-NextPage,.Pagination-PrevPage{position:relative}.Pagination-TipRight{left:calc(var(--tip-space) + var(--space-xs));position:absolute}.Pagination-TipLeft{position:absolute;right:calc(var(--tip-space) + var(--space-xs))}.Pagination-Item:not(.Pagination-Item_isActive),.Pagination-ItemLeft:not(.Pagination-ItemLeft_isActive),.Pagination-ItemRight:not(.Pagination-ItemRight_isActive){background-color:unset}.Pagination-Item:hover,.Pagination-ItemLeft:hover,.Pagination-ItemRight:hover{background-color:var(--color-control-bg-ghost-hover)}.Pagination-ItemLeft{margin-right:var(--space-xs)}.Pagination-ItemRight{margin-left:var(--space-xs)}.Pagination-Item.Button{padding:unset}.Pagination-Item.Button:not(:last-child)
|
|
1
|
+
.Pagination{display:flex;width:100%}.Pagination_position_left{justify-content:flex-start}.Pagination_position_center{justify-content:center}.Pagination_position_right{justify-content:flex-end}.Pagination_size_xs{--tip-space:var(--control-space-xs)}.Pagination_size_s{--tip-space:var(--control-space-s)}.Pagination_size_m{--tip-space:var(--control-space-m)}.Pagination_size_l{--tip-space:var(--control-space-l)}.Pagination-Pages{display:flex}.Pagination-NextPage,.Pagination-PrevPage{position:relative}.Pagination-TipRight{left:calc(var(--tip-space) + var(--space-xs));position:absolute}.Pagination-TipLeft{position:absolute;right:calc(var(--tip-space) + var(--space-xs))}.Pagination-Item:not(.Pagination-Item_isActive),.Pagination-ItemLeft:not(.Pagination-ItemLeft_isActive),.Pagination-ItemRight:not(.Pagination-ItemRight_isActive){background-color:unset}.Pagination-Item:hover,.Pagination-ItemLeft:hover,.Pagination-ItemRight:hover{background-color:var(--color-control-bg-ghost-hover)}.Pagination-ItemLeft{margin-right:var(--space-xs)}.Pagination-ItemRight{margin-left:var(--space-xs)}.Pagination-Item.Button{padding:unset}.Pagination-Item.Button:not(:last-child){margin-right:var(--space-3xs)}.Pagination-More{align-items:center;display:flex;justify-content:center;margin-right:var(--space-3xs)}.Pagination-Input{margin-right:var(--space-xs);max-width:var(--space-6xl)}.Pagination-Total{align-items:center;color:var(--color-control-typo-ghost);display:flex}.Pagination-ItemLeft_minified,.Pagination-ItemRight_minified{opacity:0;transition:opacity .2s;z-index:-1}.Pagination:hover .Pagination-ItemLeft_show,.Pagination:hover .Pagination-ItemRight_show{opacity:1;z-index:unset}.Pagination:hover-ItemLeft_show,.Pagination:hover-ItemRight_show{opacity:1}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["currentPage","totalPages","onChange","getLabel","form","size","type","position","minified","hotkeys","containerEventListener","className"];import"./Pagination.css";import{IconBackward}from"@consta/icons/IconBackward";import{IconForward}from"@consta/icons/IconForward";import React from"react";import{cn}from"../../utils/bem";import{Button}from"../Button/Button";import{Text}from"../Text/Text";import{TextField}from"../TextField/TextField";import{getPaginationInfo}from"./helpers";export var paginationForms=["default","round","brick"];export var paginationDefaultForm="default";export var paginationSizes=["xs","s","m","l"];export var paginationDefaultSize="m";export var paginationTypes=["default","input"];export var paginationDefaultType="default";export var paginationPositions=["left","center","right"];export var paginationDefaultPosition="center";var getDefaultLabel=function(a){return"\u0438\u0437 ".concat(a)};export var cnPagination=cn("Pagination");export var Pagination=React.forwardRef(function(a,b){var c=a.currentPage,d=void 0===c?0:c,e=a.totalPages,f=void 0===e?0:e,g=a.onChange,h=a.getLabel,i=void 0===h?getDefaultLabel:h,j=a.form,k=void 0===j?paginationDefaultForm:j,l=a.size,m=void 0===l?paginationDefaultSize:l,n=a.type,o=void 0===n?paginationDefaultType:n,p=a.position,q=void 0===p?paginationDefaultPosition:p,r=a.minified,s=void 0!==r&&r,t=a.hotkeys,u=void 0===t?{nextPage:{label:"Alt \u2192",values:["Alt","ArrowRight"]},prevPage:{label:"\u2190 Alt",values:["Alt","ArrowLeft"]}}:t,v=a.containerEventListener,w=void 0===v?window:v,x=a.className,y=_objectWithoutProperties(a,_excluded),z=d+1,A=getPaginationInfo(z,f),B=A.prevPage,C=A.nextPage,D=A.isStartDots,E=A.isEndDots,F=A.pages,G=A.isEmpty,H=React.useState([]),I=_slicedToArray(H,2),J=I[0],K=I[1],L=function(a){a&&a!==z&&g&&g(a-1)},M=function(a){return function(b){b.preventDefault(),L(a)}},N=function(a){var b=a.key;K(function(a){return a.filter(function(a){return a!==b})})},O=function(a){var b=a.key;if(u.nextPage.values.includes(b)||u.prevPage.values.includes(b)){var c=[].concat(_toConsumableArray(J),[b]);u.nextPage.values.every(function(a){return c.includes(a)})?L(C):u.prevPage.values.every(function(a){return c.includes(a)})&&L(B),K(c)}};React.useEffect(function(){return w.addEventListener("keydown",O),w.addEventListener("keyup",N),function(){w.removeEventListener("keydown",O),w.removeEventListener("keyup",N)}});var P="var(--control-height-".concat(m,")");return f?!G&&React.createElement("nav",Object.assign({className:cnPagination({form:k,size:m,position:s?paginationDefaultPosition:q},[x]),ref:b},y),(1<z||s)&&React.createElement("div",{className:cnPagination("PrevPage")},React.createElement(Button,{className:cnPagination("ItemLeft",{minified:s,show:1<z}),label:"\u041D\u0430\u0437\u0430\u0434",iconLeft:IconBackward,view:"ghost",form:k,size:m,onClick:M(B)}),!s&&React.createElement(Text,{className:cnPagination("TipLeft"),size:"xs",view:"ghost"},u.prevPage.label)),o===paginationDefaultType?React.createElement("div",{className:cnPagination("Pages")},D&&React.createElement(Button,{className:cnPagination("Item",{isActive:1===z}),style:{width:P},label:"1",title:"1",view:"ghost",form:k,size:m,onClick:M(1)}),D&&React.createElement(Text,{size:m,view:"linkMinor",className:cnPagination("More"),style:{width:P}},"..."),F.map(function(a){return React.createElement(Button,{key:a,className:cnPagination("Item",{isActive:z===a}),style:{width:P},label:a,title:"".concat(a),view:"ghost",form:k,size:m,onClick:M(a)})}),E&&React.createElement(Text,{size:m,view:"linkMinor",className:cnPagination("More"),style:{width:P}},"..."),E&&React.createElement(Button,{className:cnPagination("Item",{isActive:z===f}),style:{width:P},label:f,title:"".concat(f),view:"ghost",form:k,size:m,onClick:M(f)})):React.createElement("div",{className:cnPagination("Pages")},React.createElement(TextField,{className:cnPagination("Input"),form:k,size:m,value:z.toString(),onChange:function handleChange(a){var b=a.value,c=+b;c>f||Number.isNaN(c)||g&&g(c-1)}}),React.createElement(Text,{size:m,view:"linkMinor",className:cnPagination("Total")},i(f))),(z<f||s)&&React.createElement("div",{className:cnPagination("NextPage")},React.createElement(Button,{className:cnPagination("ItemRight",{minified:s,show:z<f}),label:"\u0412\u043F\u0435\u0440\u0451\u0434",iconRight:IconForward,view:"ghost",form:k,size:m,onClick:M(C)}),!s&&React.createElement(Text,{className:cnPagination("TipRight"),size:"xs",view:"ghost"},u.nextPage.label)))||null:null});
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["currentPage","totalPages","onChange","getLabel","form","size","type","position","minified","hotkeys","containerEventListener","className"];import"./Pagination.css";import{IconBackward}from"@consta/icons/IconBackward";import{IconForward}from"@consta/icons/IconForward";import React from"react";import{cn}from"../../utils/bem";import{Button}from"../Button/Button";import{Text}from"../Text/Text";import{TextField}from"../TextField/TextField";import{getPaginationInfo}from"./helpers";export var paginationForms=["default","round","brick"];export var paginationDefaultForm="default";export var paginationSizes=["xs","s","m","l"];export var paginationDefaultSize="m";export var paginationTypes=["default","input"];export var paginationDefaultType="default";export var paginationPositions=["left","center","right"];export var paginationDefaultPosition="center";var getDefaultLabel=function(a){return"\u0438\u0437 ".concat(a)};export var cnPagination=cn("Pagination");export var Pagination=React.forwardRef(function(a,b){var c=a.currentPage,d=void 0===c?0:c,e=a.totalPages,f=void 0===e?0:e,g=a.onChange,h=a.getLabel,i=void 0===h?getDefaultLabel:h,j=a.form,k=void 0===j?paginationDefaultForm:j,l=a.size,m=void 0===l?paginationDefaultSize:l,n=a.type,o=void 0===n?paginationDefaultType:n,p=a.position,q=void 0===p?paginationDefaultPosition:p,r=a.minified,s=void 0!==r&&r,t=a.hotkeys,u=void 0===t?{nextPage:{label:"Alt \u2192",values:["Alt","ArrowRight"]},prevPage:{label:"\u2190 Alt",values:["Alt","ArrowLeft"]}}:t,v=a.containerEventListener,w=void 0===v?window:v,x=a.className,y=_objectWithoutProperties(a,_excluded),z=d+1,A=getPaginationInfo(z,f),B=A.prevPage,C=A.nextPage,D=A.isStartDots,E=A.isEndDots,F=A.pages,G=A.isEmpty,H=React.useState([]),I=_slicedToArray(H,2),J=I[0],K=I[1],L=function(a){a&&a!==z&&g&&g(a-1)},M=function(a){return function(b){b.preventDefault(),L(a)}},N=function(a){var b=a.key;K(function(a){return a.filter(function(a){return a!==b})})},O=function(a){var b=a.key;if(u.nextPage.values.includes(b)||u.prevPage.values.includes(b)){var c=[].concat(_toConsumableArray(J),[b]);u.nextPage.values.every(function(a){return c.includes(a)})?L(C):u.prevPage.values.every(function(a){return c.includes(a)})&&L(B),K(c)}};React.useEffect(function(){return w.addEventListener("keydown",O),w.addEventListener("keyup",N),function(){w.removeEventListener("keydown",O),w.removeEventListener("keyup",N)}});var P="var(--control-height-".concat(m,")");return f?!G&&React.createElement("nav",Object.assign({className:cnPagination({form:k,size:m,position:s?paginationDefaultPosition:q},[x]),ref:b},y),(1<z||s)&&React.createElement("div",{className:cnPagination("PrevPage")},React.createElement(Button,{type:"button",className:cnPagination("ItemLeft",{minified:s,show:1<z}),label:"\u041D\u0430\u0437\u0430\u0434",iconLeft:IconBackward,view:"ghost",form:k,size:m,onClick:M(B)}),!s&&React.createElement(Text,{className:cnPagination("TipLeft"),size:"xs",view:"ghost"},u.prevPage.label)),o===paginationDefaultType?React.createElement("div",{className:cnPagination("Pages")},D&&React.createElement(Button,{type:"button",className:cnPagination("Item",{isActive:1===z}),style:{width:P},label:"1",title:"1",view:"ghost",form:k,size:m,onClick:M(1)}),D&&React.createElement(Text,{size:m,view:"linkMinor",className:cnPagination("More"),style:{width:P}},"..."),F.map(function(a){return React.createElement(Button,{type:"button",key:a,className:cnPagination("Item",{isActive:z===a}),style:{width:P},label:a,title:"".concat(a),view:"ghost",form:k,size:m,onClick:M(a)})}),E&&React.createElement(Text,{size:m,view:"linkMinor",className:cnPagination("More"),style:{width:P}},"..."),E&&React.createElement(Button,{type:"button",className:cnPagination("Item",{isActive:z===f}),style:{width:P},label:f,title:"".concat(f),view:"ghost",form:k,size:m,onClick:M(f)})):React.createElement("div",{className:cnPagination("Pages")},React.createElement(TextField,{className:cnPagination("Input"),form:k,size:m,value:z.toString(),onChange:function handleChange(a){var b=a.value,c=+b;c>f||Number.isNaN(c)||g&&g(c-1)}}),React.createElement(Text,{size:m,view:"linkMinor",className:cnPagination("Total")},i(f))),(z<f||s)&&React.createElement("div",{className:cnPagination("NextPage")},React.createElement(Button,{type:"button",className:cnPagination("ItemRight",{minified:s,show:z<f}),label:"\u0412\u043F\u0435\u0440\u0451\u0434",iconRight:IconForward,view:"ghost",form:k,size:m,onClick:M(C)}),!s&&React.createElement(Text,{className:cnPagination("TipRight"),size:"xs",view:"ghost"},u.nextPage.label)))||null:null});
|
|
2
2
|
//# sourceMappingURL=Pagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","names":["IconBackward","IconForward","React","cn","Button","Text","TextField","getPaginationInfo","paginationForms","paginationDefaultForm","paginationSizes","paginationDefaultSize","paginationTypes","paginationDefaultType","paginationPositions","paginationDefaultPosition","getDefaultLabel","totalPages","cnPagination","Pagination","forwardRef","props","ref","currentPage","onChange","getLabel","form","size","type","position","minified","hotkeys","nextPage","label","values","prevPage","containerEventListener","window","className","otherProps","currPage","isStartDots","isEndDots","pages","isEmpty","useState","keys","setKeys","changePage","page","handleClick","e","preventDefault","keyUpListener","event","key","prevState","filter","hotKey","keyDownListener","includes","newKeys","every","useEffect","addEventListener","removeEventListener","itemWidth","show","isActive","width","map","toString","handleChange","args","value","pageNumber","Number","isNaN"],"sources":["../../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import './Pagination.css';\n\nimport { IconBackward } from '@consta/icons/IconBackward';\nimport { IconForward } from '@consta/icons/IconForward';\nimport React from 'react';\n\nimport { cn } from '../../utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport { Button } from '../Button/Button';\nimport { Text } from '../Text/Text';\nimport { TextField, TextFieldOnChangeArguments } from '../TextField/TextField';\nimport { getPaginationInfo } from './helpers';\n\nexport const paginationForms = ['default', 'round', 'brick'] as const;\nexport type PaginationPropForm = typeof paginationForms[number];\nexport const paginationDefaultForm: PaginationPropForm = 'default';\n\nexport const paginationSizes = ['xs', 's', 'm', 'l'] as const;\nexport type PaginationPropSize = typeof paginationSizes[number];\nexport const paginationDefaultSize: PaginationPropSize = 'm';\n\nexport const paginationTypes = ['default', 'input'] as const;\nexport type PaginationPropType = typeof paginationTypes[number];\nexport const paginationDefaultType: PaginationPropType = 'default';\n\nexport const paginationPositions = ['left', 'center', 'right'] as const;\nexport type PaginationPropPosition = typeof paginationPositions[number];\nexport const paginationDefaultPosition: PaginationPropPosition = 'center';\n\nconst getDefaultLabel = (totalPages: number): string => `из ${totalPages}`;\n\nexport const cnPagination = cn('Pagination');\n\ntype HotKey = {\n label: string;\n values: string[];\n};\n\nexport type HotKeys = {\n nextPage: HotKey;\n prevPage: HotKey;\n};\n\ntype Props = {\n currentPage: number;\n totalPages: number;\n onChange: (pageNumber: number) => void;\n getLabel?: (totalPages: number) => string;\n form?: PaginationPropForm;\n size?: PaginationPropSize;\n type?: PaginationPropType;\n hotkeys?: HotKeys;\n containerEventListener?: HTMLElement | Window;\n className?: string;\n} & (\n | {\n minified?: true;\n position?: never;\n }\n | {\n minified?: false;\n position?: PaginationPropPosition;\n }\n);\n\ntype Pagination = (\n props: PropsWithHTMLAttributesAndRef<Props, HTMLDivElement>,\n) => React.ReactElement | null;\n\nexport const Pagination: Pagination = React.forwardRef((props, ref) => {\n const {\n currentPage = 0,\n totalPages = 0,\n onChange,\n getLabel = getDefaultLabel,\n form = paginationDefaultForm,\n size = paginationDefaultSize,\n type = paginationDefaultType,\n position = paginationDefaultPosition,\n minified = false,\n hotkeys = {\n nextPage: {\n label: 'Alt →',\n values: ['Alt', 'ArrowRight'],\n },\n prevPage: {\n label: '← Alt',\n values: ['Alt', 'ArrowLeft'],\n },\n },\n containerEventListener = window,\n className,\n ...otherProps\n } = props;\n\n const currPage = currentPage + 1;\n const { prevPage, nextPage, isStartDots, isEndDots, pages, isEmpty } =\n getPaginationInfo(currPage, totalPages);\n const [keys, setKeys] = React.useState<string[]>([]);\n\n const changePage = (page: number | null) => {\n if (page && page !== currPage && onChange) {\n onChange(page - 1);\n }\n };\n\n const handleClick = (page: number | null) => (e: React.MouseEvent) => {\n e.preventDefault();\n changePage(page);\n };\n\n const handleChange = (args: TextFieldOnChangeArguments) => {\n const { value } = args;\n const pageNumber = Number(value);\n\n if (pageNumber > totalPages || Number.isNaN(pageNumber)) return;\n\n if (onChange) {\n onChange(pageNumber - 1);\n }\n };\n\n const keyUpListener: EventListener = (event) => {\n const { key } = event as KeyboardEvent;\n\n setKeys((prevState) => prevState.filter((hotKey) => hotKey !== key));\n };\n\n const keyDownListener: EventListener = (event) => {\n const { key } = event as KeyboardEvent;\n\n if (\n hotkeys.nextPage.values.includes(key) ||\n hotkeys.prevPage.values.includes(key)\n ) {\n const newKeys = [...keys, key];\n if (hotkeys.nextPage.values.every((hotKey) => newKeys.includes(hotKey))) {\n changePage(nextPage);\n } else if (\n hotkeys.prevPage.values.every((hotKey) => newKeys.includes(hotKey))\n ) {\n changePage(prevPage);\n }\n setKeys(newKeys);\n }\n };\n\n React.useEffect(() => {\n containerEventListener.addEventListener('keydown', keyDownListener);\n containerEventListener.addEventListener('keyup', keyUpListener);\n return () => {\n containerEventListener.removeEventListener('keydown', keyDownListener);\n containerEventListener.removeEventListener('keyup', keyUpListener);\n };\n });\n\n const itemWidth = `var(--control-height-${size})`;\n\n if (!totalPages) return null;\n\n return (\n (!isEmpty && (\n <nav\n className={cnPagination(\n {\n form,\n size,\n position: minified ? paginationDefaultPosition : position,\n },\n [className],\n )}\n ref={ref}\n {...otherProps}\n >\n {(currPage > 1 || minified) && (\n <div className={cnPagination('PrevPage')}>\n <Button\n className={cnPagination('ItemLeft', {\n minified,\n show: currPage > 1,\n })}\n label=\"Назад\"\n iconLeft={IconBackward}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(prevPage)}\n />\n {!minified && (\n <Text className={cnPagination('TipLeft')} size=\"xs\" view=\"ghost\">\n {hotkeys.prevPage.label}\n </Text>\n )}\n </div>\n )}\n {type === paginationDefaultType ? (\n <div className={cnPagination('Pages')}>\n {isStartDots && (\n <Button\n className={cnPagination('Item', { isActive: currPage === 1 })}\n style={{ width: itemWidth }}\n label=\"1\"\n title=\"1\"\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(1)}\n />\n )}\n {isStartDots && (\n <Text\n size={size}\n view=\"linkMinor\"\n className={cnPagination('More')}\n style={{ width: itemWidth }}\n >\n ...\n </Text>\n )}\n {pages.map((page) => (\n <Button\n key={page}\n className={cnPagination('Item', {\n isActive: currPage === page,\n })}\n style={{ width: itemWidth }}\n label={page}\n title={`${page}`}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(page)}\n />\n ))}\n {isEndDots && (\n <Text\n size={size}\n view=\"linkMinor\"\n className={cnPagination('More')}\n style={{ width: itemWidth }}\n >\n ...\n </Text>\n )}\n {isEndDots && (\n <Button\n className={cnPagination('Item', {\n isActive: currPage === totalPages,\n })}\n style={{ width: itemWidth }}\n label={totalPages}\n title={`${totalPages}`}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(totalPages)}\n />\n )}\n </div>\n ) : (\n <div className={cnPagination('Pages')}>\n <TextField\n className={cnPagination('Input')}\n form={form}\n size={size}\n value={currPage.toString()}\n onChange={handleChange}\n />\n <Text\n size={size}\n view=\"linkMinor\"\n className={cnPagination('Total')}\n >\n {getLabel(totalPages)}\n </Text>\n </div>\n )}\n {(currPage < totalPages || minified) && (\n <div className={cnPagination('NextPage')}>\n <Button\n className={cnPagination('ItemRight', {\n minified,\n show: currPage < totalPages,\n })}\n label=\"Вперёд\"\n iconRight={IconForward}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(nextPage)}\n />\n {!minified && (\n <Text className={cnPagination('TipRight')} size=\"xs\" view=\"ghost\">\n {hotkeys.nextPage.label}\n </Text>\n )}\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CATR,CAUE,OAAO,CAAEuB,CAAW,CAAClB,CAAD,CAVtB,EADF,CAaG,CAACF,CAAD,EACC,oBAAC,IAAD,EAAM,SAAS,CAAEZ,YAAY,CAAC,UAAD,CAA7B,CAA2C,IAAI,CAAC,IAAhD,CAAqD,IAAI,CAAC,OAA1D,EACGa,CAAO,CAACC,QAAR,CAAiBC,KADpB,CAdJ,CApHJ,CADF,EA2IA,IAvOmE,CAyF7C,IAgJzB,CAzOqC,CAA/B"}
|
|
1
|
+
{"version":3,"file":"Pagination.js","names":["IconBackward","IconForward","React","cn","Button","Text","TextField","getPaginationInfo","paginationForms","paginationDefaultForm","paginationSizes","paginationDefaultSize","paginationTypes","paginationDefaultType","paginationPositions","paginationDefaultPosition","getDefaultLabel","totalPages","cnPagination","Pagination","forwardRef","props","ref","currentPage","onChange","getLabel","form","size","type","position","minified","hotkeys","nextPage","label","values","prevPage","containerEventListener","window","className","otherProps","currPage","isStartDots","isEndDots","pages","isEmpty","useState","keys","setKeys","changePage","page","handleClick","e","preventDefault","keyUpListener","event","key","prevState","filter","hotKey","keyDownListener","includes","newKeys","every","useEffect","addEventListener","removeEventListener","itemWidth","show","isActive","width","map","toString","handleChange","args","value","pageNumber","Number","isNaN"],"sources":["../../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import './Pagination.css';\n\nimport { IconBackward } from '@consta/icons/IconBackward';\nimport { IconForward } from '@consta/icons/IconForward';\nimport React from 'react';\n\nimport { cn } from '../../utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport { Button } from '../Button/Button';\nimport { Text } from '../Text/Text';\nimport { TextField, TextFieldOnChangeArguments } from '../TextField/TextField';\nimport { getPaginationInfo } from './helpers';\n\nexport const paginationForms = ['default', 'round', 'brick'] as const;\nexport type PaginationPropForm = typeof paginationForms[number];\nexport const paginationDefaultForm: PaginationPropForm = 'default';\n\nexport const paginationSizes = ['xs', 's', 'm', 'l'] as const;\nexport type PaginationPropSize = typeof paginationSizes[number];\nexport const paginationDefaultSize: PaginationPropSize = 'm';\n\nexport const paginationTypes = ['default', 'input'] as const;\nexport type PaginationPropType = typeof paginationTypes[number];\nexport const paginationDefaultType: PaginationPropType = 'default';\n\nexport const paginationPositions = ['left', 'center', 'right'] as const;\nexport type PaginationPropPosition = typeof paginationPositions[number];\nexport const paginationDefaultPosition: PaginationPropPosition = 'center';\n\nconst getDefaultLabel = (totalPages: number): string => `из ${totalPages}`;\n\nexport const cnPagination = cn('Pagination');\n\ntype HotKey = {\n label: string;\n values: string[];\n};\n\nexport type HotKeys = {\n nextPage: HotKey;\n prevPage: HotKey;\n};\n\ntype Props = {\n currentPage: number;\n totalPages: number;\n onChange: (pageNumber: number) => void;\n getLabel?: (totalPages: number) => string;\n form?: PaginationPropForm;\n size?: PaginationPropSize;\n type?: PaginationPropType;\n hotkeys?: HotKeys;\n containerEventListener?: HTMLElement | Window;\n className?: string;\n} & (\n | {\n minified?: true;\n position?: never;\n }\n | {\n minified?: false;\n position?: PaginationPropPosition;\n }\n);\n\ntype Pagination = (\n props: PropsWithHTMLAttributesAndRef<Props, HTMLDivElement>,\n) => React.ReactElement | null;\n\nexport const Pagination: Pagination = React.forwardRef((props, ref) => {\n const {\n currentPage = 0,\n totalPages = 0,\n onChange,\n getLabel = getDefaultLabel,\n form = paginationDefaultForm,\n size = paginationDefaultSize,\n type = paginationDefaultType,\n position = paginationDefaultPosition,\n minified = false,\n hotkeys = {\n nextPage: {\n label: 'Alt →',\n values: ['Alt', 'ArrowRight'],\n },\n prevPage: {\n label: '← Alt',\n values: ['Alt', 'ArrowLeft'],\n },\n },\n containerEventListener = window,\n className,\n ...otherProps\n } = props;\n\n const currPage = currentPage + 1;\n const { prevPage, nextPage, isStartDots, isEndDots, pages, isEmpty } =\n getPaginationInfo(currPage, totalPages);\n const [keys, setKeys] = React.useState<string[]>([]);\n\n const changePage = (page: number | null) => {\n if (page && page !== currPage && onChange) {\n onChange(page - 1);\n }\n };\n\n const handleClick = (page: number | null) => (e: React.MouseEvent) => {\n e.preventDefault();\n changePage(page);\n };\n\n const handleChange = (args: TextFieldOnChangeArguments) => {\n const { value } = args;\n const pageNumber = Number(value);\n\n if (pageNumber > totalPages || Number.isNaN(pageNumber)) return;\n\n if (onChange) {\n onChange(pageNumber - 1);\n }\n };\n\n const keyUpListener: EventListener = (event) => {\n const { key } = event as KeyboardEvent;\n\n setKeys((prevState) => prevState.filter((hotKey) => hotKey !== key));\n };\n\n const keyDownListener: EventListener = (event) => {\n const { key } = event as KeyboardEvent;\n\n if (\n hotkeys.nextPage.values.includes(key) ||\n hotkeys.prevPage.values.includes(key)\n ) {\n const newKeys = [...keys, key];\n if (hotkeys.nextPage.values.every((hotKey) => newKeys.includes(hotKey))) {\n changePage(nextPage);\n } else if (\n hotkeys.prevPage.values.every((hotKey) => newKeys.includes(hotKey))\n ) {\n changePage(prevPage);\n }\n setKeys(newKeys);\n }\n };\n\n React.useEffect(() => {\n containerEventListener.addEventListener('keydown', keyDownListener);\n containerEventListener.addEventListener('keyup', keyUpListener);\n return () => {\n containerEventListener.removeEventListener('keydown', keyDownListener);\n containerEventListener.removeEventListener('keyup', keyUpListener);\n };\n });\n\n const itemWidth = `var(--control-height-${size})`;\n\n if (!totalPages) return null;\n\n return (\n (!isEmpty && (\n <nav\n className={cnPagination(\n {\n form,\n size,\n position: minified ? paginationDefaultPosition : position,\n },\n [className],\n )}\n ref={ref}\n {...otherProps}\n >\n {(currPage > 1 || minified) && (\n <div className={cnPagination('PrevPage')}>\n <Button\n type=\"button\"\n className={cnPagination('ItemLeft', {\n minified,\n show: currPage > 1,\n })}\n label=\"Назад\"\n iconLeft={IconBackward}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(prevPage)}\n />\n {!minified && (\n <Text className={cnPagination('TipLeft')} size=\"xs\" view=\"ghost\">\n {hotkeys.prevPage.label}\n </Text>\n )}\n </div>\n )}\n {type === paginationDefaultType ? (\n <div className={cnPagination('Pages')}>\n {isStartDots && (\n <Button\n type=\"button\"\n className={cnPagination('Item', { isActive: currPage === 1 })}\n style={{ width: itemWidth }}\n label=\"1\"\n title=\"1\"\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(1)}\n />\n )}\n {isStartDots && (\n <Text\n size={size}\n view=\"linkMinor\"\n className={cnPagination('More')}\n style={{ width: itemWidth }}\n >\n ...\n </Text>\n )}\n {pages.map((page) => (\n <Button\n type=\"button\"\n key={page}\n className={cnPagination('Item', {\n isActive: currPage === page,\n })}\n style={{ width: itemWidth }}\n label={page}\n title={`${page}`}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(page)}\n />\n ))}\n {isEndDots && (\n <Text\n size={size}\n view=\"linkMinor\"\n className={cnPagination('More')}\n style={{ width: itemWidth }}\n >\n ...\n </Text>\n )}\n {isEndDots && (\n <Button\n type=\"button\"\n className={cnPagination('Item', {\n isActive: currPage === totalPages,\n })}\n style={{ width: itemWidth }}\n label={totalPages}\n title={`${totalPages}`}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(totalPages)}\n />\n )}\n </div>\n ) : (\n <div className={cnPagination('Pages')}>\n <TextField\n className={cnPagination('Input')}\n form={form}\n size={size}\n value={currPage.toString()}\n onChange={handleChange}\n />\n <Text\n size={size}\n view=\"linkMinor\"\n className={cnPagination('Total')}\n >\n {getLabel(totalPages)}\n </Text>\n </div>\n )}\n {(currPage < totalPages || minified) && (\n <div className={cnPagination('NextPage')}>\n <Button\n type=\"button\"\n className={cnPagination('ItemRight', {\n minified,\n show: currPage < totalPages,\n })}\n label=\"Вперёд\"\n iconRight={IconForward}\n view=\"ghost\"\n form={form}\n size={size}\n onClick={handleClick(nextPage)}\n />\n {!minified && (\n <Text className={cnPagination('TipRight')} size=\"xs\" view=\"ghost\">\n {hotkeys.nextPage.label}\n </Text>\n )}\n </div>\n )}\n </nav>\n )) ||\n null\n );\n});\n"],"mappings":"0XAAA,yBAEA,OAASA,YAAT,KAA6B,4BAA7B,CAC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EyB,CATR,CAUE,IAAI,CAAEC,CAVR,CAWE,OAAO,CAAEuB,CAAW,CAAClB,CAAD,CAXtB,EADF,CAcG,CAACF,CAAD,EACC,oBAAC,IAAD,EAAM,SAAS,CAAEZ,YAAY,CAAC,UAAD,CAA7B,CAA2C,IAAI,CAAC,IAAhD,CAAqD,IAAI,CAAC,OAA1D,EACGa,CAAO,CAACC,QAAR,CAAiBC,KADpB,CAfJ,CAxHJ,CADF,EAgJA,IA5OmE,CAyF7C,IAqJzB,CA9OqC,CAA/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ProgressLine{position:relative;width:100%}.ProgressLine_size_s{--progress-line-height:var(--space-3xs)}.ProgressLine_size_m{--progress-line-height:var(--space-2xs)}.ProgressLine:after{content:"";position:absolute;top:0}.ProgressLine_mode_step{min-height:var(--progress-line-height)}.ProgressLine_mode_step:before{background:var(--color-bg-system);content:"";
|
|
1
|
+
.ProgressLine{position:relative;width:100%}.ProgressLine_size_s{--progress-line-height:var(--space-3xs)}.ProgressLine_size_m{--progress-line-height:var(--space-2xs)}.ProgressLine:after{content:"";position:absolute;top:0}.ProgressLine_mode_step{min-height:var(--progress-line-height)}.ProgressLine_mode_step:before{background:var(--color-bg-system);content:"";height:var(--progress-line-height);-webkit-mask-image:var(--progress-line-mask);mask-image:var(--progress-line-mask);position:absolute;top:0;width:100%}.ProgressLine_mode_step:after{background:var(--color-control-bg-primary);height:var(--progress-line-height);-webkit-mask-image:var(--progress-line-mask);mask-image:var(--progress-line-mask);transition:width .3s;width:var(--progress-line-background-active-width)}.ProgressLine_mode_determinate{background:var(--color-bg-system);height:var(--progress-line-height)}.ProgressLine_mode_determinate:after{background-color:var(--color-bg-brand);height:100%;transform:scaleX(var(--progress-line-value));transform-origin:left;transition:transform .3s;width:100%}.ProgressLine_mode_indeterminate{background:var(--color-bg-system);height:var(--progress-line-height);overflow-x:hidden}.ProgressLine_mode_indeterminate:after{animation:ProgressLineAnimation 2s linear infinite;background-color:var(--color-bg-brand);height:100%;transform-origin:left;transition:transform .3s;width:80%}.ProgressLine-Step{display:inline-flex;flex-direction:column;justify-content:flex-start}.ProgressLine-Steps{--progress-line-width-no-gap:calc(100% - (var(--progress-line-steps) - 1)*var(--space-3xs));grid-gap:var(--space-3xs);background:transparent;display:grid;grid-template-columns:repeat(var(--progress-line-steps),calc(var(--progress-line-width-no-gap)/var(--progress-line-steps)));height:auto;margin-top:var(--progress-line-height)}.ProgressLine-Label{margin-top:var(--space-3xs)}@keyframes ProgressLineAnimation{0%{transform:translateX(-100%)}to{transform:translateX(130%)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ProgressSpin{--animation-duration:0.3s;stroke:currentColor;fill:none;color:var(--color-control-typo-ghost);transform:rotate(-90deg)}.ProgressSpin_spin{
|
|
1
|
+
.ProgressSpin{--animation-duration:0.3s;stroke:currentColor;fill:none;color:var(--color-control-typo-ghost);transform:rotate(-90deg)}.ProgressSpin_spin{animation:ProgressSpin-Animate 1.2s linear infinite}.ProgressSpin-Circle_animation{transition:var(--animation-duration) linear}@keyframes ProgressSpin-Animate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["steps","direction","size","className","activeStepIndex","onItemClick","getItemContent","getItemLabel","getItemPoint","getItemProgress","getItemStatus","getItemTooltipContent","getItemLineStatus","getItemOnClick","style"];import"./ProgressStepBar.css";import{IconArrowLeft}from"@consta/icons/IconArrowLeft";import{IconArrowRight}from"@consta/icons/IconArrowRight";import React,{createRef,forwardRef,useEffect,useMemo,useRef,useState}from"react";import{useComponentSize}from"../../hooks/useComponentSize/useComponentSize";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{useOverflow}from"../../hooks/useOverflow/useOverflow";import{useScrollElements}from"../../hooks/useScrollElements/useScrollElements";import{Button}from"../Button/Button";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{calculateLines,cnProgressStepBar,getItemPosition,propDirectionDefault,propSizeDefault,withDefaultGetters}from"./helpers";import{ProgressStepBarItem}from"./ProgressStepBarItem/ProgressStepBarItem";import{ProgressStepBarLine}from"./ProgressStepBarLine/ProgressStepBarLine";export var COMPONENT_NAME="ProgressStepBar";function ProgressStepBarRender(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),c),e=d.steps,f=void 0===e?[]:e,g=d.direction,h=void 0===g?propDirectionDefault:g,i=d.size,j=void 0===i?propSizeDefault:i,k=d.className,l=d.activeStepIndex,m=d.onItemClick,n=d.getItemContent,o=d.getItemLabel,p=d.getItemPoint,q=d.getItemProgress,r=d.getItemStatus,s=d.getItemTooltipContent,t=d.getItemLineStatus,u=d.getItemOnClick,v=d.style,w=_objectWithoutProperties(d,_excluded),x=useState(l||0),y=_slicedToArray(x,2),z=y[0],A=y[1],B=useRef(null),C=useComponentSize(c),D=C.width,E=C.height,F=useScrollElements(f),G=F.refs,H=F.scrollTo,I=useMemo(function(){return Array(f.length).fill(null).map(function(){return createRef()})},[f.length]),J=useMemo(function(){var a=[],b=calculateLines(G,h);return f.forEach(function(c,d){var e;d!==f.length-1&&a.push({status:t(c)||"normal",size:null!==(e=b[d])&&void 0!==e?e:0})}),a},[l,f,h,j,D,E]);useEffect(function(){A(l||0)},[l]),useEffect(function(){H(z)},[z]);var K=function(a){a&&0!==z&&A(z-1),a||z===f.length-1||A(z+1)},L=function(a,b){var c=u(a),d=m?function(d){m({e:d,item:a,index:b}),null===c||void 0===c?void 0:c(d)}:void 0;return{content:n(a),label:o(a),point:p(a),progress:q(a),status:"number"==typeof l&&l>=b?r(a)||"normal":"system",tooltipContent:s(a),size:j,position:getItemPosition(b,f.length),pointRef:I[b],direction:h,className:cnProgressStepBar("Item"),onClick:c||d,key:cnProgressStepBar({index:b}),tooltipZIndex:"number"==typeof(null===v||void 0===v?void 0:v.zIndex)?v.zIndex+1:void 0}},M=useOverflow({currentRef:B});return React.createElement("div",Object.assign({},w,{style:v,className:cnProgressStepBar({isOverflow:M},[k]),ref:useForkRef([b,c])}),M&&"vertical"!==h&&React.createElement(Button,{iconLeft:function iconLeft(){return React.createElement(IconArrowLeft,{size:"xs"})},view:"clear",onlyIcon:!0,size:"xs",className:cnProgressStepBar("Button",{side:"left"}),onClick:function onClick(){return K(!0)}}),React.createElement("div",{ref:B,className:cnProgressStepBar("List",{direction:h,overflow:M})},React.createElement(ProgressStepBarLine,{lines:J,size:j,direction:h,activeStepIndex:l}),f.map(function(a,b){return React.createElement(ProgressStepBarItem,Object.assign({ref:G[b]},L(a,b)))})),M&&"vertical"!==h&&React.createElement(Button,{iconLeft:function iconLeft(){return React.createElement(IconArrowRight,{size:"xs"})},view:"clear",onlyIcon:!0,size:"xs",className:cnProgressStepBar("Button",{side:"right"}),onClick:function onClick(){return K(!1)}}))}export var ProgressStepBar=forwardRef(ProgressStepBarRender);
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["steps","direction","size","className","activeStepIndex","onItemClick","getItemContent","getItemLabel","getItemPoint","getItemProgress","getItemStatus","getItemTooltipContent","getItemLineStatus","getItemOnClick","style"];import"./ProgressStepBar.css";import{IconArrowLeft}from"@consta/icons/IconArrowLeft";import{IconArrowRight}from"@consta/icons/IconArrowRight";import React,{createRef,forwardRef,useEffect,useMemo,useRef,useState}from"react";import{useComponentSize}from"../../hooks/useComponentSize/useComponentSize";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{useOverflow}from"../../hooks/useOverflow/useOverflow";import{useScrollElements}from"../../hooks/useScrollElements/useScrollElements";import{Button}from"../Button/Button";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{calculateLines,cnProgressStepBar,getItemPosition,propDirectionDefault,propSizeDefault,withDefaultGetters}from"./helpers";import{ProgressStepBarItem}from"./ProgressStepBarItem/ProgressStepBarItem";import{ProgressStepBarLine}from"./ProgressStepBarLine/ProgressStepBarLine";export var COMPONENT_NAME="ProgressStepBar";function ProgressStepBarRender(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),c),e=d.steps,f=void 0===e?[]:e,g=d.direction,h=void 0===g?propDirectionDefault:g,i=d.size,j=void 0===i?propSizeDefault:i,k=d.className,l=d.activeStepIndex,m=d.onItemClick,n=d.getItemContent,o=d.getItemLabel,p=d.getItemPoint,q=d.getItemProgress,r=d.getItemStatus,s=d.getItemTooltipContent,t=d.getItemLineStatus,u=d.getItemOnClick,v=d.style,w=_objectWithoutProperties(d,_excluded),x=useState(l||0),y=_slicedToArray(x,2),z=y[0],A=y[1],B=useRef(null),C=useComponentSize(c),D=C.width,E=C.height,F=useScrollElements(f),G=F.refs,H=F.scrollTo,I=useMemo(function(){return Array(f.length).fill(null).map(function(){return createRef()})},[f.length]),J=useMemo(function(){var a=[],b=calculateLines(G,h);return f.forEach(function(c,d){var e;d!==f.length-1&&a.push({status:t(c)||"normal",size:null!==(e=b[d])&&void 0!==e?e:0})}),a},[l,f,h,j,D,E]);useEffect(function(){A(l||0)},[l]),useEffect(function(){H(z)},[z]);var K=function(a){a&&0!==z&&A(z-1),a||z===f.length-1||A(z+1)},L=function(a,b){var c=u(a),d=m?function(d){m({e:d,item:a,index:b}),null===c||void 0===c?void 0:c(d)}:void 0;return{content:n(a),label:o(a),point:p(a),progress:q(a),status:"number"==typeof l&&l>=b?r(a)||"normal":"system",tooltipContent:s(a),size:j,position:getItemPosition(b,f.length),pointRef:I[b],direction:h,className:cnProgressStepBar("Item"),onClick:c||d,key:cnProgressStepBar({index:b}),tooltipZIndex:"number"==typeof(null===v||void 0===v?void 0:v.zIndex)?v.zIndex+1:void 0}},M=useOverflow({currentRef:B});return React.createElement("div",Object.assign({},w,{style:v,className:cnProgressStepBar({isOverflow:M},[k]),ref:useForkRef([b,c])}),M&&"vertical"!==h&&React.createElement(Button,{iconLeft:function iconLeft(){return React.createElement(IconArrowLeft,{size:"xs"})},view:"clear",onlyIcon:!0,type:"button",size:"xs",className:cnProgressStepBar("Button",{side:"left"}),onClick:function onClick(){return K(!0)}}),React.createElement("div",{ref:B,className:cnProgressStepBar("List",{direction:h,overflow:M})},React.createElement(ProgressStepBarLine,{lines:J,size:j,direction:h,activeStepIndex:l}),f.map(function(a,b){return React.createElement(ProgressStepBarItem,Object.assign({ref:G[b]},L(a,b)))})),M&&"vertical"!==h&&React.createElement(Button,{iconLeft:function iconLeft(){return React.createElement(IconArrowRight,{size:"xs"})},view:"clear",onlyIcon:!0,size:"xs",type:"button",className:cnProgressStepBar("Button",{side:"right"}),onClick:function onClick(){return K(!1)}}))}export var ProgressStepBar=forwardRef(ProgressStepBarRender);
|
|
2
2
|
//# sourceMappingURL=ProgressStepBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressStepBar.js","names":["IconArrowLeft","IconArrowRight","React","createRef","forwardRef","useEffect","useMemo","useRef","useState","useComponentSize","useForkRef","useOverflow","useScrollElements","Button","usePropsHandler","calculateLines","cnProgressStepBar","getItemPosition","propDirectionDefault","propSizeDefault","withDefaultGetters","ProgressStepBarItem","ProgressStepBarLine","COMPONENT_NAME","ProgressStepBarRender","props","ref","containerRef","steps","direction","size","className","activeStepIndex","onItemClick","getItemContent","getItemLabel","getItemPoint","getItemProgress","getItemStatus","getItemTooltipContent","getItemLineStatus","getItemOnClick","style","otherProps","visibleIndex","setVisibleIndex","listRef","width","height","refs","scrollTo","stepsRef","Array","length","fill","map","lines","linesArray","sizes","forEach","step","index","push","status","changePosition","prev","getStepItem","item","onClick","onItemClickHandler","e","content","label","point","progress","tooltipContent","position","pointRef","key","tooltipZIndex","zIndex","isOverflow","currentRef","side","overflow","ProgressStepBar"],"sources":["../../../../../src/components/ProgressStepBar/ProgressStepBar.tsx"],"sourcesContent":["import './ProgressStepBar.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport React, {\n createRef,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useComponentSize } from '../../hooks/useComponentSize/useComponentSize';\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { useOverflow } from '../../hooks/useOverflow/useOverflow';\nimport { useScrollElements } from '../../hooks/useScrollElements/useScrollElements';\nimport { Button } from '../Button/Button';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\nimport {\n calculateLines,\n cnProgressStepBar,\n DefaultItem,\n getItemPosition,\n Line,\n ProgressStepBarComponent,\n ProgressStepBarItemProps,\n ProgressStepBarProps,\n propDirectionDefault,\n propSizeDefault,\n withDefaultGetters,\n} from './helpers';\nimport { ProgressStepBarItem } from './ProgressStepBarItem/ProgressStepBarItem';\nimport { ProgressStepBarLine } from './ProgressStepBarLine/ProgressStepBarLine';\n\nexport const COMPONENT_NAME = 'ProgressStepBar' as const;\n\nfunction ProgressStepBarRender<ITEM = DefaultItem>(\n props: ProgressStepBarProps<ITEM>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const {\n steps = [],\n direction = propDirectionDefault,\n size = propSizeDefault,\n className,\n activeStepIndex,\n onItemClick,\n getItemContent,\n getItemLabel,\n getItemPoint,\n getItemProgress,\n getItemStatus,\n getItemTooltipContent,\n getItemLineStatus,\n getItemOnClick,\n style,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, withDefaultGetters(props), containerRef);\n\n const [visibleIndex, setVisibleIndex] = useState<number>(\n activeStepIndex || 0,\n );\n\n const listRef = useRef<HTMLDivElement>(null);\n\n const { width, height } = useComponentSize(containerRef);\n\n const { refs, scrollTo } = useScrollElements(steps);\n\n const stepsRef = useMemo(\n () =>\n new Array(steps.length)\n .fill(null)\n .map(() => createRef<HTMLButtonElement>()),\n [steps.length],\n );\n\n const lines = useMemo(() => {\n const linesArray: Line[] = [];\n const sizes = calculateLines(refs, direction);\n steps.forEach((step, index) => {\n if (index !== steps.length - 1)\n linesArray.push({\n status: getItemLineStatus(step) || 'normal',\n size: sizes[index] ?? 0,\n });\n });\n return linesArray;\n }, [activeStepIndex, steps, direction, size, width, height]);\n\n useEffect(() => {\n setVisibleIndex(activeStepIndex || 0);\n }, [activeStepIndex]);\n\n useEffect(() => {\n scrollTo(visibleIndex);\n }, [visibleIndex]);\n\n const changePosition = (prev: boolean) => {\n if (prev && visibleIndex !== 0) {\n setVisibleIndex(visibleIndex - 1);\n }\n if (!prev && visibleIndex !== steps.length - 1) {\n setVisibleIndex(visibleIndex + 1);\n }\n };\n\n const getStepItem: (item: ITEM, index: number) => ProgressStepBarItemProps = (\n item,\n index,\n ) => {\n const onClick = getItemOnClick(item);\n\n const onItemClickHandler = onItemClick\n ? (e: React.MouseEvent<Element, MouseEvent>) => {\n onItemClick({ e, item, index });\n onClick?.(e);\n }\n : undefined;\n\n return {\n content: getItemContent(item),\n label: getItemLabel(item),\n point: getItemPoint(item),\n progress: getItemProgress(item),\n status:\n typeof activeStepIndex === 'number' && activeStepIndex >= index\n ? getItemStatus(item) || 'normal'\n : 'system',\n tooltipContent: getItemTooltipContent(item),\n size,\n position: getItemPosition(index, steps.length),\n pointRef: stepsRef[index] as React.RefObject<HTMLButtonElement>,\n direction,\n className: cnProgressStepBar('Item'),\n onClick: onClick || onItemClickHandler,\n key: cnProgressStepBar({ index }),\n tooltipZIndex:\n typeof style?.zIndex === 'number' ? style.zIndex + 1 : undefined,\n };\n };\n\n const isOverflow = useOverflow({ currentRef: listRef });\n\n return (\n <div\n {...otherProps}\n style={style}\n className={cnProgressStepBar({ isOverflow }, [className])}\n ref={useForkRef([ref, containerRef])}\n >\n {isOverflow && direction !== 'vertical' && (\n <Button\n iconLeft={() => <IconArrowLeft size=\"xs\" />}\n view=\"clear\"\n onlyIcon\n size=\"xs\"\n className={cnProgressStepBar('Button', { side: 'left' })}\n onClick={() => changePosition(true)}\n />\n )}\n <div\n ref={listRef}\n className={cnProgressStepBar('List', {\n direction,\n overflow: isOverflow,\n })}\n >\n <ProgressStepBarLine\n lines={lines}\n size={size}\n direction={direction}\n activeStepIndex={activeStepIndex}\n />\n {steps.map((step, index) => (\n <ProgressStepBarItem\n ref={refs[index] as React.RefObject<HTMLDivElement>}\n {...getStepItem(step, index)}\n />\n ))}\n </div>\n {isOverflow && direction !== 'vertical' && (\n <Button\n iconLeft={() => <IconArrowRight size=\"xs\" />}\n view=\"clear\"\n onlyIcon\n size=\"xs\"\n className={cnProgressStepBar('Button', { side: 'right' })}\n onClick={() => changePosition(false)}\n />\n )}\n </div>\n );\n}\n\nexport const ProgressStepBar = forwardRef(\n ProgressStepBarRender,\n) as ProgressStepBarComponent;\n"],"mappings":"mYAAA,8BAEA,OAASA,aAAT,KAA8B,6BAA9B,CACA,OAASC,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EACEC,SADF,CAEEC,UAFF,CAGEC,SAHF,CAIEC,OAJF,CAKEC,MALF,CAMEC,QANF,KAOO,OAPP,CASA,OAASC,gBAAT,qDACA,OAASC,UAAT,yCACA,OAASC,WAAT,2CACA,OAASC,iBAAT,uDACA,OAASC,MAAT,wBACA,OAASC,eAAT,2CACA,OACEC,cADF,CAEEC,iBAFF,CAIEC,eAJF,CASEC,oBATF,CAUEC,eAVF,CAWEC,kBAXF,iBAaA,OAASC,mBAAT,iDACA,OAASC,mBAAT,iDAEA,MAAO,IAAMC,eAAc,CAAG,iBAAvB,CAEP,QAASC,sBAAT,CACEC,CADF,CAEEC,CAFF,CAGE,IACMC,EAAY,CAAGpB,MAAM,CAAiB,IAAjB,CAD3B,GAoBIO,eAAe,CAACS,cAAD,CAAiBH,kBAAkB,CAACK,CAAD,CAAnC,CAA4CE,CAA5C,CApBnB,KAIEC,KAJF,CAIEA,CAJF,YAIU,EAJV,OAKEC,SALF,CAKEA,CALF,YAKcX,oBALd,OAMEY,IANF,CAMEA,CANF,YAMSX,eANT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QAAD,CAAW,CAAEmE,IAAI,CAAE,MAAR,CAAX,CAL9B,CAME,OAAO,CAAE,yBAAMnB,EAAc,IAApB,CANX,EAPJ,CAgBE,2BACE,GAAG,CAAElB,CADP,CAEE,SAAS,CAAE9B,iBAAiB,CAAC,MAAD,CAAS,CACnCa,SAAS,CAATA,CADmC,CAEnCuD,QAAQ,CAAEH,CAFyB,CAAT,CAF9B,EAOE,oBAAC,mBAAD,EACE,KAAK,CAAEzB,CADT,CAEE,IAAI,CAAE1B,CAFR,CAGE,SAAS,CAAED,CAHb,CAIE,eAAe,CAAEG,CAJnB,EAPF,CAaGJ,CAAK,CAAC2B,GAAN,CAAU,SAACK,CAAD,CAAOC,CAAP,QACT,qBAAC,mBAAD,gBACE,GAAG,CAAEZ,CAAI,CAACY,CAAD,CADX,EAEMK,CAAW,CAACN,CAAD,CAAOC,CAAP,CAFjB,EADS,CAAV,CAbH,CAhBF,CAoCGoB,CAAU,EAAkB,UAAd,GAAApD,CAAd,EACC,oBAAC,MAAD,EACE,QAAQ,CAAE,0BAAM,qBAAC,cAAD,EAAgB,IAAI,CAAC,IAArB,EAAN,CADZ,CAEE,IAAI,CAAC,OAFP,CAGE,QAAQ,GAHV,CAIE,IAAI,CAAC,IAJP,CAKE,SAAS,CAAEb,iBAAiB,CAAC,QAAD,CAAW,CAAEmE,IAAI,CAAE,OAAR,CAAX,CAL9B,CAME,OAAO,CAAE,yBAAMnB,EAAc,IAApB,CANX,EArCJ,CAgDH,CAED,MAAO,IAAMqB,gBAAe,CAAGjF,UAAU,CACvCoB,qBADuC,CAAlC"}
|
|
1
|
+
{"version":3,"file":"ProgressStepBar.js","names":["IconArrowLeft","IconArrowRight","React","createRef","forwardRef","useEffect","useMemo","useRef","useState","useComponentSize","useForkRef","useOverflow","useScrollElements","Button","usePropsHandler","calculateLines","cnProgressStepBar","getItemPosition","propDirectionDefault","propSizeDefault","withDefaultGetters","ProgressStepBarItem","ProgressStepBarLine","COMPONENT_NAME","ProgressStepBarRender","props","ref","containerRef","steps","direction","size","className","activeStepIndex","onItemClick","getItemContent","getItemLabel","getItemPoint","getItemProgress","getItemStatus","getItemTooltipContent","getItemLineStatus","getItemOnClick","style","otherProps","visibleIndex","setVisibleIndex","listRef","width","height","refs","scrollTo","stepsRef","Array","length","fill","map","lines","linesArray","sizes","forEach","step","index","push","status","changePosition","prev","getStepItem","item","onClick","onItemClickHandler","e","content","label","point","progress","tooltipContent","position","pointRef","key","tooltipZIndex","zIndex","isOverflow","currentRef","side","overflow","ProgressStepBar"],"sources":["../../../../../src/components/ProgressStepBar/ProgressStepBar.tsx"],"sourcesContent":["import './ProgressStepBar.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport React, {\n createRef,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useComponentSize } from '../../hooks/useComponentSize/useComponentSize';\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { useOverflow } from '../../hooks/useOverflow/useOverflow';\nimport { useScrollElements } from '../../hooks/useScrollElements/useScrollElements';\nimport { Button } from '../Button/Button';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\nimport {\n calculateLines,\n cnProgressStepBar,\n DefaultItem,\n getItemPosition,\n Line,\n ProgressStepBarComponent,\n ProgressStepBarItemProps,\n ProgressStepBarProps,\n propDirectionDefault,\n propSizeDefault,\n withDefaultGetters,\n} from './helpers';\nimport { ProgressStepBarItem } from './ProgressStepBarItem/ProgressStepBarItem';\nimport { ProgressStepBarLine } from './ProgressStepBarLine/ProgressStepBarLine';\n\nexport const COMPONENT_NAME = 'ProgressStepBar' as const;\n\nfunction ProgressStepBarRender<ITEM = DefaultItem>(\n props: ProgressStepBarProps<ITEM>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const {\n steps = [],\n direction = propDirectionDefault,\n size = propSizeDefault,\n className,\n activeStepIndex,\n onItemClick,\n getItemContent,\n getItemLabel,\n getItemPoint,\n getItemProgress,\n getItemStatus,\n getItemTooltipContent,\n getItemLineStatus,\n getItemOnClick,\n style,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, withDefaultGetters(props), containerRef);\n\n const [visibleIndex, setVisibleIndex] = useState<number>(\n activeStepIndex || 0,\n );\n\n const listRef = useRef<HTMLDivElement>(null);\n\n const { width, height } = useComponentSize(containerRef);\n\n const { refs, scrollTo } = useScrollElements(steps);\n\n const stepsRef = useMemo(\n () =>\n new Array(steps.length)\n .fill(null)\n .map(() => createRef<HTMLButtonElement>()),\n [steps.length],\n );\n\n const lines = useMemo(() => {\n const linesArray: Line[] = [];\n const sizes = calculateLines(refs, direction);\n steps.forEach((step, index) => {\n if (index !== steps.length - 1)\n linesArray.push({\n status: getItemLineStatus(step) || 'normal',\n size: sizes[index] ?? 0,\n });\n });\n return linesArray;\n }, [activeStepIndex, steps, direction, size, width, height]);\n\n useEffect(() => {\n setVisibleIndex(activeStepIndex || 0);\n }, [activeStepIndex]);\n\n useEffect(() => {\n scrollTo(visibleIndex);\n }, [visibleIndex]);\n\n const changePosition = (prev: boolean) => {\n if (prev && visibleIndex !== 0) {\n setVisibleIndex(visibleIndex - 1);\n }\n if (!prev && visibleIndex !== steps.length - 1) {\n setVisibleIndex(visibleIndex + 1);\n }\n };\n\n const getStepItem: (item: ITEM, index: number) => ProgressStepBarItemProps = (\n item,\n index,\n ) => {\n const onClick = getItemOnClick(item);\n\n const onItemClickHandler = onItemClick\n ? (e: React.MouseEvent<Element, MouseEvent>) => {\n onItemClick({ e, item, index });\n onClick?.(e);\n }\n : undefined;\n\n return {\n content: getItemContent(item),\n label: getItemLabel(item),\n point: getItemPoint(item),\n progress: getItemProgress(item),\n status:\n typeof activeStepIndex === 'number' && activeStepIndex >= index\n ? getItemStatus(item) || 'normal'\n : 'system',\n tooltipContent: getItemTooltipContent(item),\n size,\n position: getItemPosition(index, steps.length),\n pointRef: stepsRef[index] as React.RefObject<HTMLButtonElement>,\n direction,\n className: cnProgressStepBar('Item'),\n onClick: onClick || onItemClickHandler,\n key: cnProgressStepBar({ index }),\n tooltipZIndex:\n typeof style?.zIndex === 'number' ? style.zIndex + 1 : undefined,\n };\n };\n\n const isOverflow = useOverflow({ currentRef: listRef });\n\n return (\n <div\n {...otherProps}\n style={style}\n className={cnProgressStepBar({ isOverflow }, [className])}\n ref={useForkRef([ref, containerRef])}\n >\n {isOverflow && direction !== 'vertical' && (\n <Button\n iconLeft={() => <IconArrowLeft size=\"xs\" />}\n view=\"clear\"\n onlyIcon\n type=\"button\"\n size=\"xs\"\n className={cnProgressStepBar('Button', { side: 'left' })}\n onClick={() => changePosition(true)}\n />\n )}\n <div\n ref={listRef}\n className={cnProgressStepBar('List', {\n direction,\n overflow: isOverflow,\n })}\n >\n <ProgressStepBarLine\n lines={lines}\n size={size}\n direction={direction}\n activeStepIndex={activeStepIndex}\n />\n {steps.map((step, index) => (\n <ProgressStepBarItem\n ref={refs[index] as React.RefObject<HTMLDivElement>}\n {...getStepItem(step, index)}\n />\n ))}\n </div>\n {isOverflow && direction !== 'vertical' && (\n <Button\n iconLeft={() => <IconArrowRight size=\"xs\" />}\n view=\"clear\"\n onlyIcon\n size=\"xs\"\n type=\"button\"\n className={cnProgressStepBar('Button', { side: 'right' })}\n onClick={() => changePosition(false)}\n />\n )}\n </div>\n );\n}\n\nexport const ProgressStepBar = forwardRef(\n ProgressStepBarRender,\n) as ProgressStepBarComponent;\n"],"mappings":"mYAAA,8BAEA,OAASA,aAAT,KAA8B,6BAA9B,CACA,OAASC,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EACEC,SADF,CAEEC,UAFF,CAGEC,SAHF,CAIEC,OAJF,CAKEC,MALF,CAMEC,QANF,KAOO,OAPP,CASA,OAASC,gBAAT,qDACA,OAASC,UAAT,yCACA,OAASC,WAAT,2CACA,OAASC,iBAAT,uDACA,OAASC,MAAT,wBACA,OAASC,eAAT,2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AIE,IAAI,CAAC,IAJP,CAKE,IAAI,CAAC,QALP,CAME,SAAS,CAAEb,iBAAiB,CAAC,QAAD,CAAW,CAAEmE,IAAI,CAAE,OAAR,CAAX,CAN9B,CAOE,OAAO,CAAE,yBAAMnB,EAAc,IAApB,CAPX,EAtCJ,CAkDH,CAED,MAAO,IAAMqB,gBAAe,CAAGjF,UAAU,CACvCoB,qBADuC,CAAlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Radio{
|
|
1
|
+
.Radio{display:inline-flex;font-family:var(--font-sans)}.Radio,.Radio-Input{cursor:pointer;position:relative}.Radio-Input{-webkit-appearance:none;border:var(--control-border-width) solid;border-radius:50%;box-sizing:border-box;flex-shrink:0;height:var(--radio-size);margin:0;transition:border-color .15s,background-color .15s;width:var(--radio-size)}.Radio-Input:before{border-radius:50%;box-sizing:border-box;content:"";height:var(--radio-size);left:calc(50% - var(--radio-size)/2);opacity:0;position:absolute;top:calc(50% - var(--radio-size)/2);transform:scale(0);transition:background-color .15s,opacity .15s,transform .15s;width:var(--radio-size)}.Radio-Label{color:var(--color-control-typo-default);font-size:var(--radio-font-size);margin-left:var(--radio-offset)}.Radio_size_xs{--radio-font-size:var(--control-text-size-xs);--radio-size:var(--control-box-size-s);--radio-offset:var(--space-xs)}.Radio_size_s{--radio-font-size:var(--control-text-size-s);--radio-size:var(--control-box-size-s);--radio-offset:var(--space-xs)}.Radio_size_m{--radio-font-size:var(--control-text-size-m);--radio-size:var(--control-box-size-m);--radio-offset:var(--space-xs)}.Radio_size_l{--radio-font-size:var(--control-text-size-l);--radio-size:var(--control-box-size-l);--radio-offset:var(--space-s)}.Radio_view_primary:hover .Radio-Input{border-color:var(--color-control-bg-border-default-hover)}.Radio_view_primary .Radio-Input{border-color:var(--color-control-bg-border-default)}.Radio_view_primary .Radio-Input:before{background-color:var(--color-control-bg-primary)}.Radio_view_primary .Radio-Input:checked{border-color:var(--color-control-bg-primary)}.Radio_view_primary .Radio-Input:checked:before{background-color:var(--color-control-bg-primary)}.Radio_view_primary:hover .Radio-Input:checked{border-color:var(--color-control-bg-primary-hover)}.Radio_view_primary:hover .Radio-Input:checked:before{background-color:var(--color-control-bg-primary-hover)}.Radio_view_ghost:hover .Radio-Input{border-color:var(--color-control-bg-border-default-hover)}.Radio_view_ghost .Radio-Input{border-color:var(--color-control-bg-border-default)}.Radio_view_ghost .Radio-Input:before{background-color:var(--color-control-bg-primary)}.Radio_view_ghost .Radio-Input:checked{background-color:var(--color-control-bg-ghost);border-color:var(--color-control-bg-border-default)}.Radio_view_ghost .Radio-Input:checked:before{background-color:var(--color-control-typo-ghost)}.Radio_view_ghost:hover .Radio-Input:checked{background-color:var(--color-control-bg-ghost-hover);border-color:var(--color-control-bg-border-default)}.Radio_view_ghost:hover .Radio-Input:checked:before{background-color:var(--color-control-typo-ghost-hover)}.Radio-Input:checked:before{opacity:1;transform:scale(.4)}.Radio_disabled{pointer-events:none}.Radio_disabled .Radio-Input:disabled{background-color:var(--color-control-bg-disable);border-color:transparent}.Radio_disabled .Radio-Input:disabled:before{background-color:var(--color-control-typo-disable)}.Radio_disabled .Radio-Input:disabled~.Radio-Label{color:var(--color-control-typo-disable)}.Radio_align_center{align-items:center}.Radio_align_top{align-items:top}.Radio_align_top .Radio-Input{margin-top:var(--space-3xs)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from"react";import{ResponsesImage403}from"../../responsesImages/ResponsesImage403/ResponsesImage403";import{Button}from"../Button/Button";import{createResponses}from"../Responses/createResponses";export var Responses403=createResponses({name:"Responses403",image:ResponsesImage403,title:"\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u0430",description:"\u0415\u0441\u043B\u0438 \u0432\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B, \u0447\u0442\u043E \u0432\u0430\u043C \u043D\u0443\u0436\u043D\u0430 \u044D\u0442\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430, \u0437\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u0435 \u0434\u043E\u0441\u0442\u0443\u043F \u0443 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430",actions:React.createElement(Button,{label:"\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F",view:"ghost"})});
|
|
1
|
+
import React from"react";import{ResponsesImage403}from"../../responsesImages/ResponsesImage403/ResponsesImage403";import{Button}from"../Button/Button";import{createResponses}from"../Responses/createResponses";export var Responses403=createResponses({name:"Responses403",image:ResponsesImage403,title:"\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u0430",description:"\u0415\u0441\u043B\u0438 \u0432\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B, \u0447\u0442\u043E \u0432\u0430\u043C \u043D\u0443\u0436\u043D\u0430 \u044D\u0442\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430, \u0437\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u0435 \u0434\u043E\u0441\u0442\u0443\u043F \u0443 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430",actions:React.createElement(Button,{type:"button",label:"\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F",view:"ghost"})});
|
|
2
2
|
//# sourceMappingURL=Responses403.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Responses403.js","names":["React","ResponsesImage403","Button","createResponses","Responses403","name","image","title","description","actions"],"sources":["../../../../../src/components/Responses403/Responses403.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ResponsesImage403 } from '../../responsesImages/ResponsesImage403/ResponsesImage403';\nimport { Button } from '../Button/Button';\nimport { createResponses } from '../Responses/createResponses';\n\nexport const Responses403 = createResponses({\n name: 'Responses403',\n image: ResponsesImage403,\n title: 'Нет доступа',\n description:\n 'Если вы уверены, что вам нужна эта страница, запросите доступ у администратора',\n actions: <Button label=\"Запросить доступ\" view=\"ghost\" />,\n});\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,iBAAT,iEACA,OAASC,MAAT,wBACA,OAASC,eAAT,oCAEA,MAAO,IAAMC,aAAY,CAAGD,eAAe,CAAC,CAC1CE,IAAI,CAAE,cADoC,CAE1CC,KAAK,CAAEL,iBAFmC,CAG1CM,KAAK,CAAE,+DAHmC,CAI1CC,WAAW,CACT,qZALwC,CAM1CC,OAAO,CAAE,oBAAC,MAAD,EAAQ,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"Responses403.js","names":["React","ResponsesImage403","Button","createResponses","Responses403","name","image","title","description","actions"],"sources":["../../../../../src/components/Responses403/Responses403.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ResponsesImage403 } from '../../responsesImages/ResponsesImage403/ResponsesImage403';\nimport { Button } from '../Button/Button';\nimport { createResponses } from '../Responses/createResponses';\n\nexport const Responses403 = createResponses({\n name: 'Responses403',\n image: ResponsesImage403,\n title: 'Нет доступа',\n description:\n 'Если вы уверены, что вам нужна эта страница, запросите доступ у администратора',\n actions: <Button type=\"button\" label=\"Запросить доступ\" view=\"ghost\" />,\n});\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,iBAAT,iEACA,OAASC,MAAT,wBACA,OAASC,eAAT,oCAEA,MAAO,IAAMC,aAAY,CAAGD,eAAe,CAAC,CAC1CE,IAAI,CAAE,cADoC,CAE1CC,KAAK,CAAEL,iBAFmC,CAG1CM,KAAK,CAAE,+DAHmC,CAI1CC,WAAW,CACT,qZALwC,CAM1CC,OAAO,CAAE,oBAAC,MAAD,EAAQ,IAAI,CAAC,QAAb,CAAsB,KAAK,CAAC,6FAA5B,CAA+C,IAAI,CAAC,OAApD,EANiC,CAAD,CAApC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from"react";import{ResponsesImage404}from"../../responsesImages/ResponsesImage404/ResponsesImage404";import{Button}from"../Button/Button";import{createResponses}from"../Responses/createResponses";export var Responses404=createResponses({name:"Responses404",image:ResponsesImage404,title:"\u0422\u0430\u043A\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u043D\u0435\u0442",description:"\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u044D\u0442\u0443 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0443\u0436\u0435 \u0443\u0434\u0430\u043B\u0438\u043B\u0438, \u0438\u043B\u0438 \u0432\xA0\u0432\u0430\u0448\u0435\u0439 \u0441\u0441\u044B\u043B\u043A\u0435 \u043E\u0448\u0438\u0431\u043A\u0430",actions:React.createElement(Button,{label:"\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430\u0437\u0430\u0434",view:"ghost"})});
|
|
1
|
+
import React from"react";import{ResponsesImage404}from"../../responsesImages/ResponsesImage404/ResponsesImage404";import{Button}from"../Button/Button";import{createResponses}from"../Responses/createResponses";export var Responses404=createResponses({name:"Responses404",image:ResponsesImage404,title:"\u0422\u0430\u043A\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u043D\u0435\u0442",description:"\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u044D\u0442\u0443 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0443\u0436\u0435 \u0443\u0434\u0430\u043B\u0438\u043B\u0438, \u0438\u043B\u0438 \u0432\xA0\u0432\u0430\u0448\u0435\u0439 \u0441\u0441\u044B\u043B\u043A\u0435 \u043E\u0448\u0438\u0431\u043A\u0430",actions:React.createElement(Button,{type:"button",label:"\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430\u0437\u0430\u0434",view:"ghost"})});
|
|
2
2
|
//# sourceMappingURL=Responses404.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Responses404.js","names":["React","ResponsesImage404","Button","createResponses","Responses404","name","image","title","description","actions"],"sources":["../../../../../src/components/Responses404/Responses404.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ResponsesImage404 } from '../../responsesImages/ResponsesImage404/ResponsesImage404';\nimport { Button } from '../Button/Button';\nimport { createResponses } from '../Responses/createResponses';\n\nexport const Responses404 = createResponses({\n name: 'Responses404',\n image: ResponsesImage404,\n title: 'Такой страницы нет',\n description: 'Возможно, эту страницу уже удалили, или в вашей ссылке ошибка',\n actions: <Button label=\"Вернуться назад\" view=\"ghost\" />,\n});\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,iBAAT,iEACA,OAASC,MAAT,wBACA,OAASC,eAAT,oCAEA,MAAO,IAAMC,aAAY,CAAGD,eAAe,CAAC,CAC1CE,IAAI,CAAE,cADoC,CAE1CC,KAAK,CAAEL,iBAFmC,CAG1CM,KAAK,CAAE,oGAHmC,CAI1CC,WAAW,CAAE,4TAJ6B,CAK1CC,OAAO,CAAE,oBAAC,MAAD,EAAQ,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"Responses404.js","names":["React","ResponsesImage404","Button","createResponses","Responses404","name","image","title","description","actions"],"sources":["../../../../../src/components/Responses404/Responses404.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ResponsesImage404 } from '../../responsesImages/ResponsesImage404/ResponsesImage404';\nimport { Button } from '../Button/Button';\nimport { createResponses } from '../Responses/createResponses';\n\nexport const Responses404 = createResponses({\n name: 'Responses404',\n image: ResponsesImage404,\n title: 'Такой страницы нет',\n description: 'Возможно, эту страницу уже удалили, или в вашей ссылке ошибка',\n actions: <Button type=\"button\" label=\"Вернуться назад\" view=\"ghost\" />,\n});\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,iBAAT,iEACA,OAASC,MAAT,wBACA,OAASC,eAAT,oCAEA,MAAO,IAAMC,aAAY,CAAGD,eAAe,CAAC,CAC1CE,IAAI,CAAE,cADoC,CAE1CC,KAAK,CAAEL,iBAFmC,CAG1CM,KAAK,CAAE,oGAHmC,CAI1CC,WAAW,CAAE,4TAJ6B,CAK1CC,OAAO,CAAE,oBAAC,MAAD,EAAQ,IAAI,CAAC,QAAb,CAAsB,KAAK,CAAC,uFAA5B,CAA8C,IAAI,CAAC,OAAnD,EALiC,CAAD,CAApC"}
|