@consta/uikit 5.28.5 → 5.29.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/TextAreaAutoSize/index.d.ts +1 -0
- package/TextAreaAutoSize/index.js +1 -0
- package/__internal__/src/components/AutoComplete/AutoComplete.js +1 -1
- package/__internal__/src/components/AutoComplete/AutoComplete.js.map +1 -1
- package/__internal__/src/components/AutoComplete/helpers.d.ts +1 -0
- package/__internal__/src/components/AutoComplete/types.d.ts +1 -0
- package/__internal__/src/components/AutoComplete/types.js.map +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeText/AutoCompleteTypeText.js +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeText/AutoCompleteTypeText.js.map +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeTextArray/AutoCompleteTypeTextArray.js +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeTextArray/AutoCompleteTypeTextArray.js.map +1 -1
- package/__internal__/src/components/AutoCompleteCanary/helpers.d.ts +1 -0
- package/__internal__/src/components/AutoCompleteCanary/types.d.ts +1 -0
- package/__internal__/src/components/AutoCompleteCanary/types.js.map +1 -1
- package/__internal__/src/components/Combobox/Combobox.js +1 -1
- package/__internal__/src/components/Combobox/Combobox.js.map +1 -1
- package/__internal__/src/components/Combobox/helpers.d.ts +3 -1
- package/__internal__/src/components/Combobox/helpers.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js.map +1 -1
- package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -2
- package/__internal__/src/components/ContextMenu/types.d.ts +2 -0
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.d.ts +1 -0
- 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/DatePicker/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/types.d.ts +1 -0
- package/__internal__/src/components/DatePicker/types.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldControlLayout/FieldControlLayout.js +1 -1
- package/__internal__/src/components/FieldComponents/FieldControlLayout/FieldControlLayout.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldControlLayout/helpers.js +1 -1
- package/__internal__/src/components/FieldComponents/FieldControlLayout/helpers.js.map +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js.map +1 -1
- package/__internal__/src/components/FlatSelect/types.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/types.js.map +1 -1
- package/__internal__/src/components/Select/Select.js +1 -1
- package/__internal__/src/components/Select/Select.js.map +1 -1
- package/__internal__/src/components/Select/helpers.d.ts +3 -1
- package/__internal__/src/components/Select/helpers.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectDropdown/SelectDropdown.d.ts +1 -0
- package/__internal__/src/components/SelectCanary/SelectDropdown/SelectDropdown.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectMultiple/SelectMultiple.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectMultiple/SelectMultiple.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.d.ts +1 -0
- package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectSingle/SelectSingle.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectSingle/SelectSingle.js.map +1 -1
- package/__internal__/src/components/SelectCanary/helpers.d.ts +2 -1
- package/__internal__/src/components/SelectCanary/types.d.ts +1 -0
- package/__internal__/src/components/SelectCanary/types.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.d.ts +1 -0
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
- package/__internal__/src/components/TagBase/TagBase.d.ts +1 -1
- package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.css +1 -0
- package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.d.ts +11 -0
- package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.js +2 -0
- package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.js.map +1 -0
- package/__internal__/src/components/TextAreaAutoSize/index.d.ts +1 -0
- package/__internal__/src/components/TextAreaAutoSize/index.js +2 -0
- package/__internal__/src/components/TextAreaAutoSize/index.js.map +1 -0
- package/__internal__/src/components/TextField/TextField.js +1 -1
- package/__internal__/src/components/TextField/TextField.js.map +1 -1
- package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArea/TextFieldTypeTextArea.css +1 -1
- package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArea/TextFieldTypeTextArea.js +1 -1
- package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArea/TextFieldTypeTextArea.js.map +1 -1
- package/__internal__/src/components/UserSelect/UserSelect.js +1 -1
- package/__internal__/src/components/UserSelect/UserSelect.js.map +1 -1
- package/__internal__/src/components/UserSelect/helpers.d.ts +3 -1
- package/__internal__/src/components/UserSelect/helpers.js.map +1 -1
- package/__internal__/src/utils/objectCompare.d.ts +7 -0
- package/__internal__/src/utils/objectCompare.js +2 -0
- package/__internal__/src/utils/objectCompare.js.map +1 -0
- package/__internal__/src/utils/state/index.d.ts +3 -0
- package/__internal__/src/utils/state/index.js +1 -1
- package/__internal__/src/utils/state/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","items","groups","className","form","animate","levelDepth","activeLevelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","onEsc","isOpen","parent","isMobile","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}import"./ContextMenuLevel.css";import{IconArrowLeft}from"@consta/icons/IconArrowLeft";import{IconArrowRight}from"@consta/icons/IconArrowRight";import React,{forwardRef,useEffect,useMemo}from"react";import{cnListBox,List,ListDivider,ListItem,mapIconSize,mapVerticalSpace}from"../../ListCanary";import{useFlag}from"../../../hooks/useFlag/useFlag";import{useForkRef}from"../../../hooks/useForkRef";import{cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{ContextMenuLevelWrapper}from"../ContextMenuLevelWrapper";import{contextMenuDefaultSize}from"../types";import{useMenuNavigation}from"../useMenuNavigation";export var cnContextMenuLevel=cn("ContextMenuLevel");var timers=[];export function clearTimers(){var a,b=_createForOfIteratorHelper(timers);try{for(b.s();!(a=b.n()).done;){var c=a.value;clearTimeout(c)}}catch(a){b.e(a)}finally{b.f()}timers=[]}var closeDelay=300,ContextMenuLevelRender=function(a,b){var c=a.size,d=void 0===c?contextMenuDefaultSize:c,f=a.items,g=a.groups,h=a.className,i=a.form,j=void 0===i?"default":i,k=a.animate,l=a.levelDepth,m=a.activeLevelDepth,n=a.activeItem,o=a.addLevel,p=a.deleteLevel,q=a.setHoveredParenLevel,r=a.hoveredParenLevel,s=a.sortGroup,t=a.onItemClick,u=a.onEsc,v=a.isOpen,w=a.parent,x=a.isMobile,y=a.
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","items","groups","className","form","animate","levelDepth","activeLevelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","onEsc","isOpen","parent","isMobile","viewportRef","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}import"./ContextMenuLevel.css";import{IconArrowLeft}from"@consta/icons/IconArrowLeft";import{IconArrowRight}from"@consta/icons/IconArrowRight";import React,{forwardRef,useEffect,useMemo}from"react";import{cnListBox,List,ListDivider,ListItem,mapIconSize,mapVerticalSpace}from"../../ListCanary";import{useFlag}from"../../../hooks/useFlag/useFlag";import{useForkRef}from"../../../hooks/useForkRef";import{cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{ContextMenuLevelWrapper}from"../ContextMenuLevelWrapper";import{contextMenuDefaultSize}from"../types";import{useMenuNavigation}from"../useMenuNavigation";export var cnContextMenuLevel=cn("ContextMenuLevel");var timers=[];export function clearTimers(){var a,b=_createForOfIteratorHelper(timers);try{for(b.s();!(a=b.n()).done;){var c=a.value;clearTimeout(c)}}catch(a){b.e(a)}finally{b.f()}timers=[]}var closeDelay=300,ContextMenuLevelRender=function(a,b){var c=a.size,d=void 0===c?contextMenuDefaultSize:c,f=a.items,g=a.groups,h=a.className,i=a.form,j=void 0===i?"default":i,k=a.animate,l=a.levelDepth,m=a.activeLevelDepth,n=a.activeItem,o=a.addLevel,p=a.deleteLevel,q=a.setHoveredParenLevel,r=a.hoveredParenLevel,s=a.sortGroup,t=a.onItemClick,u=a.onEsc,v=a.isOpen,w=a.parent,x=a.isMobile,y=a.viewportRef,z=a.direction,A=a.possibleDirections,B=a.offset,C=a.onSetDirection,D=a.spareDirection,E=a.anchorRef,F=a.getItemLabel,G=a.getItemRightSide,H=a.getItemLeftSide,I=a.getItemSubMenu,J=a.getItemStatus,K=a.getItemDisabled,L=a.getItemKey,M=a.getItemOnClick,N=a.getItemAs,O=a.getItemAttributes,P=a.getItemGroupId,Q=a.getItemLeftIcon,R=a.getItemRightIcon,S=a.getGroupLabel,T=a.getGroupId,U=_objectWithoutProperties(a,_excluded),V=0===l,W=useFlag(!1),X=_slicedToArray(W,2),Y=X[0],Z=X[1],$=function(a){return(L(a)||F(a)).toString()},_=function(a){var b=I(a),c=K(a);if(Array.isArray(b)&&!c){var d=$(a);o({level:l+1,items:b,anchorRef:ia[d],activeItem:d,parent:a}),q(l+1)}else q(l)},aa=useMenuNavigation({items:f,getItemSubMenu:I,addLevel:_,active:m===l,deleteLevel:function deleteLevel(){return p(l)},onEsc:function handleEscClick(a){var b;null===u||void 0===u?void 0:u(a),null===E||void 0===E||null===(b=E.current)||void 0===b?void 0:b.focus()},level:l,isMobile:x}),ba=aa.refs,ca=aa.onKeyDown,da=aa.activeIndex,ea=aa.setActiveIndex,fa=aa.setDirection,ga=aa.parentRef,ha=aa.containerRef,ia=useMemo(function(){return f.map(function(a){return $(a)}).reduce(function(b,a,c){return _objectSpread(_objectSpread({},b),{},_defineProperty({},a,ba[c]))},{})},[g,ba]),ja=useMemo(function(){var a=f[da];return a?$(a):void 0},[f,da]),ka=x?void 0:function(a){return function(b){var c;_(a);var d=null===(c=O(a))||void 0===c?void 0:c.onMouseEnter;ea(f.indexOf(a)),null===d||void 0===d?void 0:d(b)}},la=M?function(a){return function(b){var c;return null===(c=M(a))||void 0===c?void 0:c(b)}}:void 0;return useEffect(function(){return 0!==l&&!Y&&r<l&&(clearTimeout(timers[l]),timers[l]=setTimeout(function(){return p(l)},closeDelay)),function(){return clearTimeout(timers[l])}},[Y,r]),useEffect(function(){v||clearTimeout(timers[l])},[v]),React.createElement(ContextMenuLevelWrapper,Object.assign({anchorRef:E,className:x?cnContextMenuLevel("Mobile",{animate:k,firstLevel:V,level:l.toString()},[h]):cnContextMenuLevel("Desktop",{firstLevel:V,level:l.toString()},[cnListBox({size:d,form:j,border:!0,shadow:!0}),cnMixSpace({pV:mapVerticalSpace[d]}),cnMixPopoverAnimate({animate:k}),h]),possibleDirections:A,spareDirection:D,direction:z,offset:B,tabIndex:0,onKeyDown:ca,onSetDirection:function onSetDirection(a){null===C||void 0===C?void 0:C(a),fa(a)},onMouseEnter:Z.on,onMouseLeave:function onMouseLeave(){Z.off(),ea(-1)},ref:useForkRef([b,ha]),isMobile:x,viewportRef:y},U),w&&React.createElement(React.Fragment,null,React.createElement(ListItem,{label:F(w),size:d,tabIndex:0,ref:ga,leftIcon:IconArrowLeft,onClick:function onClick(){return p(l)},active:-1===da,className:cnContextMenuLevel("Item",{active:-1===da})}),React.createElement(ListDivider,{size:d,space:{mV:mapVerticalSpace[d]}})),React.createElement(List,{size:d,items:f,getItemLabel:F,onItemClick:function onItemClick(a,b){var c=b.e;x&&(_(a),ea(f.indexOf(a))),null===t||void 0===t?void 0:t(a,{e:c})},sortGroup:s?function(c,a){return s(c.key,a.key)}:void 0,getItemOnClick:la,getItemAs:N,getItemAttributes:function getItemAttributes(a){return _objectSpread(_objectSpread({},O(a)),{},{tabIndex:0,onMouseEnter:null===ka||void 0===ka?void 0:ka(a)})},getItemGroupKey:P,getItemLeftIcon:Q,getItemRightIcon:R,getItemLeftSide:H,getItemRightSide:function getItemRightSide(a){var b=G(a);if(!I(a))return b;var c=Array.isArray(b)?b:[b];return c.push(React.createElement(IconArrowRight,{size:mapIconSize[d]})),c},getGroupKey:T,getGroupLabel:S,getItemDisabled:K,getItemStatus:J,getItemActive:function getItemActive(a){var b=$(a);return b===n||b===ja},getItemAdditionalClassName:function getItemAdditionalClassName(a){return cnContextMenuLevel("Item",{active:$(a)===n})},getItemRef:function getItemRef(a){return ia[$(a)]},groups:g,innerOffset:"round"===j?"increased":"normal"}))};export var ContextMenuLevel=forwardRef(ContextMenuLevelRender);
|
|
2
2
|
//# sourceMappingURL=ContextMenuLevel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuLevel.js","names":["IconArrowLeft","IconArrowRight","React","forwardRef","useEffect","useMemo","cnListBox","List","ListDivider","ListItem","mapIconSize","mapVerticalSpace","useFlag","useForkRef","cnMixPopoverAnimate","cnMixSpace","cn","ContextMenuLevelWrapper","contextMenuDefaultSize","useMenuNavigation","cnContextMenuLevel","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevelRender","props","ref","size","items","groupsProp","groups","className","form","animate","levelDepth","activeLevelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClickProp","onItemClick","onEsc","isOpen","parent","isMobile","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSideProp","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClickProp","getItemOnClick","getItemAs","getItemAttributesProp","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId","otherProps","firstLevel","hovered","setHovered","getKey","item","toString","addCurrentLevel","subMenu","disabled","Array","isArray","key","level","itemsRefs","active","handleEscClick","e","current","focus","refs","onKeyDown","activeIndex","setActiveIndex","setDirection","parentRef","containerRef","map","reduce","a","v","index","activeKey","onMouseEnter","indexOf","setTimeout","border","shadow","pV","on","onMouseLeave","off","mV","b","tabIndex","side","sides","push","getItemActive","ContextMenuLevel"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport React, { forwardRef, useEffect, useMemo } from 'react';\n\nimport {\n cnListBox,\n List,\n ListDivider,\n ListItem,\n ListPropOnItemClick,\n mapIconSize,\n mapVerticalSpace,\n} from '##/components/ListCanary';\nimport { useFlag } from '##/hooks/useFlag/useFlag';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { AsAttributes, AsTagAttribute } from '##/utils/types/AsTags';\n\nimport { ContextMenuLevelWrapper } from '../ContextMenuLevelWrapper';\nimport {\n contextMenuDefaultSize,\n ContextMenuItemDefault,\n ContextMenuLevelComponent,\n ContextMenuLevelProps,\n} from '../types';\nimport { useMenuNavigation } from '../useMenuNavigation';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevel');\n\nlet timers: ReturnType<typeof setTimeout>[] = [];\nexport function clearTimers() {\n for (const timer of timers) {\n clearTimeout(timer);\n }\n timers = [];\n}\n\nconst closeDelay = 300;\n\nconst ContextMenuLevelRender = (\n props: ContextMenuLevelProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n size = contextMenuDefaultSize,\n items,\n groups: groupsProp,\n className,\n form = 'default',\n animate,\n // Свойства относящиеся к меню\n levelDepth,\n activeLevelDepth,\n activeItem,\n addLevel,\n deleteLevel,\n setHoveredParenLevel,\n hoveredParenLevel,\n sortGroup,\n onItemClick: onItemClickProp,\n onEsc,\n isOpen,\n parent,\n isMobile,\n\n // Свойства для поповера\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n spareDirection,\n anchorRef,\n // Геттеры для ITEM\n getItemLabel,\n getItemRightSide: getItemRightSideProp,\n getItemLeftSide,\n getItemSubMenu,\n getItemStatus,\n getItemDisabled,\n getItemKey,\n getItemOnClick: getItemOnClickProp,\n getItemAs,\n getItemAttributes: getItemAttributesProp,\n getItemGroupId,\n getItemLeftIcon,\n getItemRightIcon,\n // Геттеры для GROUP\n getGroupLabel,\n getGroupId,\n ...otherProps\n } = props;\n\n const firstLevel = levelDepth === 0;\n\n const [hovered, setHovered] = useFlag(false);\n\n const getKey = (item: ContextMenuItemDefault) =>\n (getItemKey(item) || getItemLabel(item)).toString();\n\n const addCurrentLevel = (item: ContextMenuItemDefault) => {\n const subMenu = getItemSubMenu(item);\n const disabled = getItemDisabled(item);\n\n if (Array.isArray(subMenu) && !disabled) {\n const key = getKey(item);\n addLevel({\n level: levelDepth + 1,\n items: subMenu,\n anchorRef: itemsRefs[key],\n activeItem: key,\n parent: item,\n });\n setHoveredParenLevel(levelDepth + 1);\n } else {\n setHoveredParenLevel(levelDepth);\n }\n };\n\n const handleEscClick: React.KeyboardEventHandler = (e) => {\n onEsc?.(e);\n anchorRef?.current?.focus();\n };\n\n const {\n refs,\n onKeyDown,\n activeIndex,\n setActiveIndex,\n setDirection,\n parentRef,\n containerRef,\n } = useMenuNavigation({\n items,\n getItemSubMenu,\n addLevel: addCurrentLevel,\n active: activeLevelDepth === levelDepth,\n deleteLevel: () => deleteLevel(levelDepth),\n onEsc: handleEscClick,\n level: levelDepth,\n isMobile,\n });\n\n const itemsRefs = useMemo(() => {\n return items\n .map((item) => getKey(item))\n .reduce((a, v, index) => ({ ...a, [v]: refs[index] }), {}) as Record<\n string,\n React.RefObject<HTMLDivElement>\n >;\n }, [groupsProp, refs]);\n\n const activeKey = useMemo(() => {\n const item = items[activeIndex];\n return item ? getKey(item) : undefined;\n }, [items, activeIndex]);\n\n const onMouseEnter = isMobile\n ? undefined\n : (item: ContextMenuItemDefault): AsTagAttribute<'div'>['onMouseEnter'] =>\n (e) => {\n addCurrentLevel(item);\n const onMouseEnter = getItemAttributesProp(item)\n ?.onMouseEnter as AsTagAttribute<'div'>['onMouseEnter'];\n setActiveIndex(items.indexOf(item));\n onMouseEnter?.(e);\n };\n\n // GETTERS\n\n const getItemOnClick = getItemOnClickProp\n ? (item: ContextMenuItemDefault) => (e: React.MouseEvent) =>\n getItemOnClickProp(item)?.(e as React.MouseEvent<HTMLDivElement>)\n : undefined;\n\n const getItemAttributes = (item: ContextMenuItemDefault) =>\n ({\n ...getItemAttributesProp(item),\n tabIndex: 0,\n onMouseEnter: onMouseEnter?.(item),\n } as AsAttributes);\n\n const getItemActive = (item: ContextMenuItemDefault) => {\n const key = getKey(item);\n return key === activeItem || key === activeKey;\n };\n\n const getItemRightSide = (item: ContextMenuItemDefault) => {\n const side = getItemRightSideProp(item);\n if (!getItemSubMenu(item)) {\n return side;\n }\n\n const sides: React.ReactNode[] = Array.isArray(side) ? side : [side];\n sides.push(<IconArrowRight size={mapIconSize[size]} />);\n return sides;\n };\n\n const onMouseLeave: React.MouseEventHandler = () => {\n setHovered.off();\n setActiveIndex(-1);\n };\n\n const onItemClick: ListPropOnItemClick<ContextMenuItemDefault> = (\n item,\n { e },\n ) => {\n if (isMobile) {\n addCurrentLevel(item);\n setActiveIndex(items.indexOf(item));\n }\n onItemClickProp?.(item, {\n e: e as React.MouseEvent<HTMLDivElement>,\n });\n };\n\n // EFFECTS\n\n useEffect(() => {\n if (levelDepth !== 0 && !hovered && hoveredParenLevel < levelDepth) {\n clearTimeout(timers[levelDepth]);\n timers[levelDepth] = setTimeout(\n () => deleteLevel(levelDepth),\n closeDelay,\n );\n }\n return () => clearTimeout(timers[levelDepth]);\n }, [hovered, hoveredParenLevel]);\n\n useEffect(() => {\n if (!isOpen) {\n clearTimeout(timers[levelDepth]);\n }\n }, [isOpen]);\n\n return (\n <ContextMenuLevelWrapper\n anchorRef={anchorRef}\n className={\n isMobile\n ? cnContextMenuLevel(\n 'Mobile',\n { animate, firstLevel, level: levelDepth.toString() },\n [className],\n )\n : cnContextMenuLevel(\n 'Desktop',\n { firstLevel, level: levelDepth.toString() },\n [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixPopoverAnimate({ animate }),\n className,\n ],\n )\n }\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n tabIndex={0}\n onKeyDown={onKeyDown}\n onSetDirection={(direction) => {\n onSetDirection?.(direction);\n setDirection(direction);\n }}\n onMouseEnter={setHovered.on}\n onMouseLeave={onMouseLeave}\n ref={useForkRef([ref, containerRef])}\n isMobile={isMobile}\n {...otherProps}\n >\n {parent && (\n <>\n <ListItem\n label={getItemLabel(parent)}\n size={size}\n tabIndex={0}\n ref={parentRef}\n leftIcon={IconArrowLeft}\n onClick={() => deleteLevel(levelDepth)}\n active={activeIndex === -1}\n className={cnContextMenuLevel('Item', {\n active: activeIndex === -1,\n })}\n />\n <ListDivider size={size} space={{ mV: mapVerticalSpace[size] }} />\n </>\n )}\n <List\n size={size}\n items={items}\n getItemLabel={getItemLabel}\n onItemClick={onItemClick}\n sortGroup={sortGroup ? (a, b) => sortGroup(a.key, b.key) : undefined}\n getItemOnClick={getItemOnClick}\n getItemAs={getItemAs}\n getItemAttributes={getItemAttributes}\n getItemGroupKey={getItemGroupId}\n getItemLeftIcon={getItemLeftIcon}\n getItemRightIcon={getItemRightIcon}\n getItemLeftSide={getItemLeftSide}\n getItemRightSide={getItemRightSide}\n getGroupKey={getGroupId}\n getGroupLabel={getGroupLabel}\n getItemDisabled={getItemDisabled}\n getItemStatus={getItemStatus}\n getItemActive={getItemActive}\n getItemAdditionalClassName={(item) =>\n cnContextMenuLevel('Item', {\n active: getKey(item) === activeItem,\n })\n }\n getItemRef={(item) => itemsRefs[getKey(item)]}\n groups={groupsProp}\n innerOffset={form === 'round' ? 'increased' : 'normal'}\n />\n </ContextMenuLevelWrapper>\n );\n};\n\nexport const ContextMenuLevel = forwardRef(\n ContextMenuLevelRender,\n) as ContextMenuLevelComponent;\n"],"mappings":"qhFAAA,+BAEA,OAASA,aAAT,KAA8B,6BAA9B,CACA,OAASC,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,OAAvC,KAAsD,OAAtD,CAEA,OACEC,SADF,CAEEC,IAFF,CAGEC,WAHF,CAIEC,QAJF,CAMEC,WANF,CAOEC,gBAPF,wBASA,OAASC,OAAT,sCACA,OAASC,UAAT,iCACA,OAASC,mBAAT,uCACA,OAASC,UAAT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ED,CAjBjB,CAkBE,aAAa,CA/HG,QAAhB6D,cAAgB,CAAC3C,CAAD,CAAkC,CACtD,GAAMO,EAAG,CAAGR,CAAM,CAACC,CAAD,CAAlB,CACA,MAAOO,EAAG,GAAKhD,CAAR,EAAsBgD,CAAG,GAAKoB,EACtC,CA0GG,CAmBE,0BAA0B,CAAE,oCAAC3B,CAAD,QAC1B3D,mBAAkB,CAAC,MAAD,CAAS,CACzBqE,MAAM,CAAEX,CAAM,CAACC,CAAD,CAAN,GAAiBzC,CADA,CAAT,CADQ,CAnB9B,CAwBE,UAAU,CAAE,oBAACyC,CAAD,QAAUS,GAAS,CAACV,CAAM,CAACC,CAAD,CAAP,CAAnB,CAxBd,CAyBE,MAAM,CAAEhD,CAzBV,CA0BE,WAAW,CAAW,OAAT,GAAAG,CAAI,CAAe,WAAf,CAA6B,QA1BhD,EAvDF,CAqFH,C,CAED,MAAO,IAAMyF,iBAAgB,CAAGxH,UAAU,CACxCuB,sBADwC,CAAnC"}
|
|
1
|
+
{"version":3,"file":"ContextMenuLevel.js","names":["IconArrowLeft","IconArrowRight","React","forwardRef","useEffect","useMemo","cnListBox","List","ListDivider","ListItem","mapIconSize","mapVerticalSpace","useFlag","useForkRef","cnMixPopoverAnimate","cnMixSpace","cn","ContextMenuLevelWrapper","contextMenuDefaultSize","useMenuNavigation","cnContextMenuLevel","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevelRender","props","ref","size","items","groupsProp","groups","className","form","animate","levelDepth","activeLevelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClickProp","onItemClick","onEsc","isOpen","parent","isMobile","viewportRef","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSideProp","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClickProp","getItemOnClick","getItemAs","getItemAttributesProp","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId","otherProps","firstLevel","hovered","setHovered","getKey","item","toString","addCurrentLevel","subMenu","disabled","Array","isArray","key","level","itemsRefs","active","handleEscClick","e","current","focus","refs","onKeyDown","activeIndex","setActiveIndex","setDirection","parentRef","containerRef","map","reduce","a","v","index","activeKey","onMouseEnter","indexOf","setTimeout","border","shadow","pV","on","onMouseLeave","off","mV","b","tabIndex","side","sides","push","getItemActive","ContextMenuLevel"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport React, { forwardRef, useEffect, useMemo } from 'react';\n\nimport {\n cnListBox,\n List,\n ListDivider,\n ListItem,\n ListPropOnItemClick,\n mapIconSize,\n mapVerticalSpace,\n} from '##/components/ListCanary';\nimport { useFlag } from '##/hooks/useFlag/useFlag';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { AsAttributes, AsTagAttribute } from '##/utils/types/AsTags';\n\nimport { ContextMenuLevelWrapper } from '../ContextMenuLevelWrapper';\nimport {\n contextMenuDefaultSize,\n ContextMenuItemDefault,\n ContextMenuLevelComponent,\n ContextMenuLevelProps,\n} from '../types';\nimport { useMenuNavigation } from '../useMenuNavigation';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevel');\n\nlet timers: ReturnType<typeof setTimeout>[] = [];\nexport function clearTimers() {\n for (const timer of timers) {\n clearTimeout(timer);\n }\n timers = [];\n}\n\nconst closeDelay = 300;\n\nconst ContextMenuLevelRender = (\n props: ContextMenuLevelProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n size = contextMenuDefaultSize,\n items,\n groups: groupsProp,\n className,\n form = 'default',\n animate,\n // Свойства относящиеся к меню\n levelDepth,\n activeLevelDepth,\n activeItem,\n addLevel,\n deleteLevel,\n setHoveredParenLevel,\n hoveredParenLevel,\n sortGroup,\n onItemClick: onItemClickProp,\n onEsc,\n isOpen,\n parent,\n isMobile,\n viewportRef,\n // Свойства для поповера\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n spareDirection,\n anchorRef,\n // Геттеры для ITEM\n getItemLabel,\n getItemRightSide: getItemRightSideProp,\n getItemLeftSide,\n getItemSubMenu,\n getItemStatus,\n getItemDisabled,\n getItemKey,\n getItemOnClick: getItemOnClickProp,\n getItemAs,\n getItemAttributes: getItemAttributesProp,\n getItemGroupId,\n getItemLeftIcon,\n getItemRightIcon,\n // Геттеры для GROUP\n getGroupLabel,\n getGroupId,\n ...otherProps\n } = props;\n\n const firstLevel = levelDepth === 0;\n\n const [hovered, setHovered] = useFlag(false);\n\n const getKey = (item: ContextMenuItemDefault) =>\n (getItemKey(item) || getItemLabel(item)).toString();\n\n const addCurrentLevel = (item: ContextMenuItemDefault) => {\n const subMenu = getItemSubMenu(item);\n const disabled = getItemDisabled(item);\n\n if (Array.isArray(subMenu) && !disabled) {\n const key = getKey(item);\n addLevel({\n level: levelDepth + 1,\n items: subMenu,\n anchorRef: itemsRefs[key],\n activeItem: key,\n parent: item,\n });\n setHoveredParenLevel(levelDepth + 1);\n } else {\n setHoveredParenLevel(levelDepth);\n }\n };\n\n const handleEscClick: React.KeyboardEventHandler = (e) => {\n onEsc?.(e);\n anchorRef?.current?.focus();\n };\n\n const {\n refs,\n onKeyDown,\n activeIndex,\n setActiveIndex,\n setDirection,\n parentRef,\n containerRef,\n } = useMenuNavigation({\n items,\n getItemSubMenu,\n addLevel: addCurrentLevel,\n active: activeLevelDepth === levelDepth,\n deleteLevel: () => deleteLevel(levelDepth),\n onEsc: handleEscClick,\n level: levelDepth,\n isMobile,\n });\n\n const itemsRefs = useMemo(() => {\n return items\n .map((item) => getKey(item))\n .reduce((a, v, index) => ({ ...a, [v]: refs[index] }), {}) as Record<\n string,\n React.RefObject<HTMLDivElement>\n >;\n }, [groupsProp, refs]);\n\n const activeKey = useMemo(() => {\n const item = items[activeIndex];\n return item ? getKey(item) : undefined;\n }, [items, activeIndex]);\n\n const onMouseEnter = isMobile\n ? undefined\n : (item: ContextMenuItemDefault): AsTagAttribute<'div'>['onMouseEnter'] =>\n (e) => {\n addCurrentLevel(item);\n const onMouseEnter = getItemAttributesProp(item)\n ?.onMouseEnter as AsTagAttribute<'div'>['onMouseEnter'];\n setActiveIndex(items.indexOf(item));\n onMouseEnter?.(e);\n };\n\n // GETTERS\n\n const getItemOnClick = getItemOnClickProp\n ? (item: ContextMenuItemDefault) => (e: React.MouseEvent) =>\n getItemOnClickProp(item)?.(e as React.MouseEvent<HTMLDivElement>)\n : undefined;\n\n const getItemAttributes = (item: ContextMenuItemDefault) =>\n ({\n ...getItemAttributesProp(item),\n tabIndex: 0,\n onMouseEnter: onMouseEnter?.(item),\n } as AsAttributes);\n\n const getItemActive = (item: ContextMenuItemDefault) => {\n const key = getKey(item);\n return key === activeItem || key === activeKey;\n };\n\n const getItemRightSide = (item: ContextMenuItemDefault) => {\n const side = getItemRightSideProp(item);\n if (!getItemSubMenu(item)) {\n return side;\n }\n\n const sides: React.ReactNode[] = Array.isArray(side) ? side : [side];\n sides.push(<IconArrowRight size={mapIconSize[size]} />);\n return sides;\n };\n\n const onMouseLeave: React.MouseEventHandler = () => {\n setHovered.off();\n setActiveIndex(-1);\n };\n\n const onItemClick: ListPropOnItemClick<ContextMenuItemDefault> = (\n item,\n { e },\n ) => {\n if (isMobile) {\n addCurrentLevel(item);\n setActiveIndex(items.indexOf(item));\n }\n onItemClickProp?.(item, {\n e: e as React.MouseEvent<HTMLDivElement>,\n });\n };\n\n // EFFECTS\n\n useEffect(() => {\n if (levelDepth !== 0 && !hovered && hoveredParenLevel < levelDepth) {\n clearTimeout(timers[levelDepth]);\n timers[levelDepth] = setTimeout(\n () => deleteLevel(levelDepth),\n closeDelay,\n );\n }\n return () => clearTimeout(timers[levelDepth]);\n }, [hovered, hoveredParenLevel]);\n\n useEffect(() => {\n if (!isOpen) {\n clearTimeout(timers[levelDepth]);\n }\n }, [isOpen]);\n\n return (\n <ContextMenuLevelWrapper\n anchorRef={anchorRef}\n className={\n isMobile\n ? cnContextMenuLevel(\n 'Mobile',\n { animate, firstLevel, level: levelDepth.toString() },\n [className],\n )\n : cnContextMenuLevel(\n 'Desktop',\n { firstLevel, level: levelDepth.toString() },\n [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixPopoverAnimate({ animate }),\n className,\n ],\n )\n }\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n tabIndex={0}\n onKeyDown={onKeyDown}\n onSetDirection={(direction) => {\n onSetDirection?.(direction);\n setDirection(direction);\n }}\n onMouseEnter={setHovered.on}\n onMouseLeave={onMouseLeave}\n ref={useForkRef([ref, containerRef])}\n isMobile={isMobile}\n viewportRef={viewportRef}\n {...otherProps}\n >\n {parent && (\n <>\n <ListItem\n label={getItemLabel(parent)}\n size={size}\n tabIndex={0}\n ref={parentRef}\n leftIcon={IconArrowLeft}\n onClick={() => deleteLevel(levelDepth)}\n active={activeIndex === -1}\n className={cnContextMenuLevel('Item', {\n active: activeIndex === -1,\n })}\n />\n <ListDivider size={size} space={{ mV: mapVerticalSpace[size] }} />\n </>\n )}\n <List\n size={size}\n items={items}\n getItemLabel={getItemLabel}\n onItemClick={onItemClick}\n sortGroup={sortGroup ? (a, b) => sortGroup(a.key, b.key) : undefined}\n getItemOnClick={getItemOnClick}\n getItemAs={getItemAs}\n getItemAttributes={getItemAttributes}\n getItemGroupKey={getItemGroupId}\n getItemLeftIcon={getItemLeftIcon}\n getItemRightIcon={getItemRightIcon}\n getItemLeftSide={getItemLeftSide}\n getItemRightSide={getItemRightSide}\n getGroupKey={getGroupId}\n getGroupLabel={getGroupLabel}\n getItemDisabled={getItemDisabled}\n getItemStatus={getItemStatus}\n getItemActive={getItemActive}\n getItemAdditionalClassName={(item) =>\n cnContextMenuLevel('Item', {\n active: getKey(item) === activeItem,\n })\n }\n getItemRef={(item) => itemsRefs[getKey(item)]}\n groups={groupsProp}\n innerOffset={form === 'round' ? 'increased' : 'normal'}\n />\n </ContextMenuLevelWrapper>\n );\n};\n\nexport const ContextMenuLevel = forwardRef(\n ContextMenuLevelRender,\n) as ContextMenuLevelComponent;\n"],"mappings":"miFAAA,+BAEA,OAASA,aAAT,KAA8B,6BAA9B,CACA,OAASC,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,OAAvC,KAAsD,OAAtD,CAEA,OACEC,SADF,CAEEC,IAFF,CAGEC,WAHF,CAIEC,QAJF,CAMEC,WANF,CAOEC,gBAPF,wBASA,OAASC,OAAT,sCACA,OAASC,UAAT,iCACA,OAASC,mBAAT,uCACA,OAASC,UAAT,8BACA,OAASC,EAAT,0BAGA,OAASC,uBAAT,kCACA,OACEC,sBADF,gBAMA,OAASC,iBAAT,4BAEA,MAAO,IAAMC,mBAAkB,CAAGJ,EAAE,CAAC,kBAAD,CAA7B,CAEP,GAAIK,OAAuC,CAAG,EAA9C,CACA,MAAO,SAASC,YAAT,EAAuB,oCACRD,MADQ,MAC5B,2BAA4B,IAAjBE,EAAiB,SAC1BC,YAAY,CAACD,CAAD,CACb,CAH2B,+BAI5BF,MAAM,CAAG,EACV,C,GAEKI,WAAU,CAAG,G,CAEbC,sBAAsB,CAAG,SAC7BC,CAD6B,CAE7BC,CAF6B,CAG1B,OAgDCD,CAhDD,CAEDE,IAFC,CAEDA,CAFC,YAEMX,sBAFN,GAGDY,CAHC,CAgDCH,CAhDD,CAGDG,KAHC,CAIOC,CAJP,CAgDCJ,CAhDD,CAIDK,MAJC,CAKDC,CALC,CAgDCN,CAhDD,CAKDM,SALC,GAgDCN,CAhDD,CAMDO,IANC,CAMDA,CANC,YAMM,SANN,GAOD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AM0F,iBAAgB,CAAGzH,UAAU,CACxCuB,sBADwC,CAAnC"}
|
package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["isMobile","children","className","size","onClickOutside","spareDirection","possibleDirections","direction","offset","anchorRef","position","onSetDirection"];import"./ContextMenuLevelWrapper.css";import React,{forwardRef}from"react";import{mapVerticalSpace}from"../../ListCanary";import{Popover}from"../../Popover";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{contextMenuDefaultSize}from"../types";var cnContextMenuLevelWrapper=cn("ContextMenuLevelWrapper");export var ContextMenuLevelWrapper=forwardRef(function(a,b){var c=a.isMobile,d=a.children,e=a.className,f=a.size,g=void 0===f?contextMenuDefaultSize:f,h=a.onClickOutside,i=a.spareDirection,j=a.possibleDirections,k=a.direction,l=a.offset,m=a.anchorRef,n=a.position,o=a.onSetDirection,p=_objectWithoutProperties(a,_excluded);return c?React.createElement("div",{className:e},React.createElement("div",Object.assign({className:cnContextMenuLevelWrapper("Mobile",[cnMixSpace({pV:mapVerticalSpace[g]})]),ref:b},
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["isMobile","children","className","size","onClickOutside","spareDirection","possibleDirections","direction","offset","anchorRef","position","onSetDirection","viewportRef"];import"./ContextMenuLevelWrapper.css";import React,{forwardRef}from"react";import{mapVerticalSpace}from"../../ListCanary";import{Popover}from"../../Popover";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{contextMenuDefaultSize}from"../types";var cnContextMenuLevelWrapper=cn("ContextMenuLevelWrapper");export var ContextMenuLevelWrapper=forwardRef(function(a,b){var c=a.isMobile,d=a.children,e=a.className,f=a.size,g=void 0===f?contextMenuDefaultSize:f,h=a.onClickOutside,i=a.spareDirection,j=a.possibleDirections,k=a.direction,l=a.offset,m=a.anchorRef,n=a.position,o=a.onSetDirection,p=a.viewportRef,q=_objectWithoutProperties(a,_excluded);return c?React.createElement("div",{className:e},React.createElement("div",Object.assign({className:cnContextMenuLevelWrapper("Mobile",[cnMixSpace({pV:mapVerticalSpace[g]})]),ref:b},q),d)):React.createElement(Popover,Object.assign({},q,{viewportRef:p,ref:b,className:e,onClickOutside:h,spareDirection:i,possibleDirections:j,direction:k,offset:l,anchorRef:m,position:n,onSetDirection:o}),d)});
|
|
2
2
|
//# sourceMappingURL=ContextMenuLevelWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuLevelWrapper.js","names":["React","forwardRef","mapVerticalSpace","Popover","cnMixSpace","cn","contextMenuDefaultSize","cnContextMenuLevelWrapper","ContextMenuLevelWrapper","props","ref","isMobile","children","className","size","onClickOutside","spareDirection","possibleDirections","direction","offset","anchorRef","position","onSetDirection","otherProps","pV"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.tsx"],"sourcesContent":["import './ContextMenuLevelWrapper.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { mapVerticalSpace } from '##/components/ListCanary';\nimport { Popover } from '##/components/Popover';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport { contextMenuDefaultSize, ContextMenuLevelWrapperProps } from '../types';\n\nconst cnContextMenuLevelWrapper = cn('ContextMenuLevelWrapper');\n\nexport const ContextMenuLevelWrapper = forwardRef(\n (props: ContextMenuLevelWrapperProps, ref: React.Ref<HTMLDivElement>) => {\n const {\n isMobile,\n children,\n className,\n size = contextMenuDefaultSize,\n onClickOutside,\n spareDirection,\n possibleDirections,\n direction,\n offset,\n anchorRef,\n position,\n onSetDirection,\n ...otherProps\n } = props;\n\n if (isMobile) {\n return (\n <div className={className}>\n <div\n className={cnContextMenuLevelWrapper('Mobile', [\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n ])}\n ref={ref}\n {...otherProps}\n >\n {children}\n </div>\n </div>\n );\n }\n\n return (\n <Popover\n {...otherProps}\n ref={ref}\n className={className}\n onClickOutside={onClickOutside}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n direction={direction}\n offset={offset}\n anchorRef={anchorRef}\n position={position}\n onSetDirection={onSetDirection}\n >\n {children}\n </Popover>\n );\n },\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextMenuLevelWrapper.js","names":["React","forwardRef","mapVerticalSpace","Popover","cnMixSpace","cn","contextMenuDefaultSize","cnContextMenuLevelWrapper","ContextMenuLevelWrapper","props","ref","isMobile","children","className","size","onClickOutside","spareDirection","possibleDirections","direction","offset","anchorRef","position","onSetDirection","viewportRef","otherProps","pV"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.tsx"],"sourcesContent":["import './ContextMenuLevelWrapper.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { mapVerticalSpace } from '##/components/ListCanary';\nimport { Popover } from '##/components/Popover';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport { contextMenuDefaultSize, ContextMenuLevelWrapperProps } from '../types';\n\nconst cnContextMenuLevelWrapper = cn('ContextMenuLevelWrapper');\n\nexport const ContextMenuLevelWrapper = forwardRef(\n (props: ContextMenuLevelWrapperProps, ref: React.Ref<HTMLDivElement>) => {\n const {\n isMobile,\n children,\n className,\n size = contextMenuDefaultSize,\n onClickOutside,\n spareDirection,\n possibleDirections,\n direction,\n offset,\n anchorRef,\n position,\n onSetDirection,\n viewportRef,\n ...otherProps\n } = props;\n\n if (isMobile) {\n return (\n <div className={className}>\n <div\n className={cnContextMenuLevelWrapper('Mobile', [\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n ])}\n ref={ref}\n {...otherProps}\n >\n {children}\n </div>\n </div>\n );\n }\n\n return (\n <Popover\n {...otherProps}\n viewportRef={viewportRef}\n ref={ref}\n className={className}\n onClickOutside={onClickOutside}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n direction={direction}\n offset={offset}\n anchorRef={anchorRef}\n position={position}\n onSetDirection={onSetDirection}\n >\n {children}\n </Popover>\n );\n },\n);\n"],"mappings":"gRAAA,sCAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,gBAAT,wBACA,OAASC,OAAT,qBACA,OAASC,UAAT,8BACA,OAASC,EAAT,0BAEA,OAASC,sBAAT,gBAEA,GAAMC,0BAAyB,CAAGF,EAAE,CAAC,yBAAD,CAApC,CAEA,MAAO,IAAMG,wBAAuB,CAAGP,UAAU,CAC/C,SAACQ,CAAD,CAAsCC,CAAtC,CAAyE,CACvE,GACEC,EADF,CAeIF,CAfJ,CACEE,QADF,CAEEC,CAFF,CAeIH,CAfJ,CAEEG,QAFF,CAGEC,CAHF,CAeIJ,CAfJ,CAGEI,SAHF,GAeIJ,CAfJ,CAIEK,IAJF,CAIEA,CAJF,YAISR,sBAJT,GAKES,CALF,CAeIN,CAfJ,CAKEM,cALF,CAMEC,CANF,CAeIP,CAfJ,CAMEO,cANF,CAOEC,CAPF,CAeIR,CAfJ,CAOEQ,kBAPF,CAQEC,CARF,CAeIT,CAfJ,CAQES,SARF,CASEC,CATF,CAeIV,CAfJ,CASEU,MATF,CAUEC,CAVF,CAeIX,CAfJ,CAUEW,SAVF,CAWEC,CAXF,CAeIZ,CAfJ,CAWEY,QAXF,CAYEC,CAZF,CAeIb,CAfJ,CAYEa,cAZF,CAaEC,CAbF,CAeId,CAfJ,CAaEc,WAbF,CAcKC,CAdL,0BAeIf,CAfJ,YADuE,MAkBnEE,EAlBmE,CAoBnE,2BAAK,SAAS,CAAEE,CAAhB,EACE,yCACE,SAAS,CAAEN,yBAAyB,CAAC,QAAD,CAAW,CAC7CH,UAAU,CAAC,CACTqB,EAAE,CAAEvB,gBAAgB,CAACY,CAAD,CADX,CAAD,CADmC,CAAX,CADtC,CAME,GAAG,CAAEJ,CANP,EAOMc,CAPN,EASGZ,CATH,CADF,CApBmE,CAqCrE,oBAAC,OAAD,kBACMY,CADN,EAEE,WAAW,CAAED,CAFf,CAGE,GAAG,CAAEb,CAHP,CAIE,SAAS,CAAEG,CAJb,CAKE,cAAc,CAAEE,CALlB,CAME,cAAc,CAAEC,CANlB,CAOE,kBAAkB,CAAEC,CAPtB,CAQE,SAAS,CAAEC,CARb,CASE,MAAM,CAAEC,CATV,CAUE,SAAS,CAAEC,CAVb,CAWE,QAAQ,CAAEC,CAXZ,CAYE,cAAc,CAAEC,CAZlB,GAcGV,CAdH,CAiBH,CAvD8C,CAA1C"}
|
|
@@ -16,10 +16,11 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
16
16
|
form?: import("./types").ContextMenuForm;
|
|
17
17
|
isMobile?: boolean;
|
|
18
18
|
onEsc?: React.KeyboardEventHandler;
|
|
19
|
+
viewportRef?: React.RefObject<HTMLElement>;
|
|
19
20
|
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
20
21
|
anchorRef: React.RefObject<HTMLElement>;
|
|
21
22
|
position?: never;
|
|
22
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "position" | "
|
|
23
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "direction" | "position" | "offset" | "onItemClick" | "sortGroup" | "onClickOutside" | "possibleDirections" | "spareDirection" | "onSetDirection" | "viewportRef" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | "onEsc" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
23
24
|
id: ContextMenuGroupDefault["id"] | unknown;
|
|
24
25
|
} ? {} : {
|
|
25
26
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -63,10 +64,11 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
63
64
|
form?: import("./types").ContextMenuForm;
|
|
64
65
|
isMobile?: boolean;
|
|
65
66
|
onEsc?: React.KeyboardEventHandler;
|
|
67
|
+
viewportRef?: React.RefObject<HTMLElement>;
|
|
66
68
|
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
67
69
|
anchorRef?: never;
|
|
68
70
|
position: import("../Popover").Position;
|
|
69
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "position" | "
|
|
71
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "direction" | "position" | "offset" | "onItemClick" | "sortGroup" | "onClickOutside" | "possibleDirections" | "spareDirection" | "onSetDirection" | "viewportRef" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | "onEsc" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
70
72
|
id: ContextMenuGroupDefault["id"] | unknown;
|
|
71
73
|
} ? {} : {
|
|
72
74
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -118,6 +118,7 @@ export type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuG
|
|
|
118
118
|
form?: ContextMenuForm;
|
|
119
119
|
isMobile?: boolean;
|
|
120
120
|
onEsc?: React.KeyboardEventHandler;
|
|
121
|
+
viewportRef?: React.RefObject<HTMLElement>;
|
|
121
122
|
} & MappersItem<ITEM> & MappersGroup<GROUP> & PositioningProps, HTMLDivElement> & (GROUP extends {
|
|
122
123
|
id: ContextMenuGroupDefault['id'] | unknown;
|
|
123
124
|
} ? {} : {
|
|
@@ -189,5 +190,6 @@ export type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<{
|
|
|
189
190
|
anchorRef?: React.RefObject<HTMLElement>;
|
|
190
191
|
position?: Position;
|
|
191
192
|
onSetDirection?: (direction: Direction) => void;
|
|
193
|
+
viewportRef?: React.RefObject<HTMLElement>;
|
|
192
194
|
}, HTMLDivElement>;
|
|
193
195
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\nimport { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections: Direction[] = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n];\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: React.MouseEventHandler;\n as?: AsTags;\n attributes?: AsAttributes;\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnItemClick<ITEM>;\n possibleDirections?: Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n onEsc?: React.KeyboardEventHandler;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n activeLevelDepth: number;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n onEsc?: React.KeyboardEventHandler;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isMobile?: boolean;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAiBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAA6C,CAAG,CAC3D,cAD2D,CAE3D,gBAF2D,CAG3D,aAH2D,CAI3D,eAJ2D,CAAtD,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\nimport { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections: Direction[] = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n];\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: React.MouseEventHandler;\n as?: AsTags;\n attributes?: AsAttributes;\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnItemClick<ITEM>;\n possibleDirections?: Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n onEsc?: React.KeyboardEventHandler;\n viewportRef?: React.RefObject<HTMLElement>;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n activeLevelDepth: number;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n onEsc?: React.KeyboardEventHandler;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isMobile?: boolean;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n viewportRef?: React.RefObject<HTMLElement>;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAiBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAA6C,CAAG,CAC3D,cAD2D,CAE3D,gBAF2D,CAG3D,aAH2D,CAI3D,eAJ2D,CAAtD,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
|
@@ -26,6 +26,7 @@ export type DatePickerDropdownProps = PropsWithHTMLAttributesAndRef<{
|
|
|
26
26
|
timeOptions?: TimeOptions;
|
|
27
27
|
timeFor?: 'start' | 'end';
|
|
28
28
|
disableDates?: DateTimePropDisableDates;
|
|
29
|
+
viewportRef?: React.RefObject<HTMLElement>;
|
|
29
30
|
}, HTMLDivElement>;
|
|
30
31
|
type DatePickerDropdownComponent = (props: DatePickerDropdownProps) => React.ReactNode | null;
|
|
31
32
|
export declare const DatePickerDropdown: DatePickerDropdownComponent;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","anchorRef","isOpen","className","zIndex","renderAdditionalControls"];import"./DatePickerDropdown.css";import React,{forwardRef,useCallback,useRef,useState}from"react";import{Transition}from"react-transition-group";import{DateTime}from"../../DateTime";import{Popover}from"../../Popover";import{useFlag}from"../../../hooks/useFlag";import{useForkRef}from"../../../hooks/useForkRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cn}from"../../../utils/bem";import{DatePickerAdditionalControls}from"../DatePickerAdditionalControls/DatePickerAdditionalControls";import{datePickerPropDropdownFormDefault}from"../types";var moveMap={year:"year",month:"month",date:"day",time:"time","date-time":"day"},cnDatePickerDropdown=cn("DatePickerDropdown");export var DatePickerDropdown=forwardRef(function(a,b){var c=a.form,d=void 0===c?datePickerPropDropdownFormDefault:c,e=a.anchorRef,f=a.isOpen,g=a.className,h=a.zIndex,i=a.renderAdditionalControls,j=_objectWithoutProperties(a,_excluded),
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","anchorRef","isOpen","className","zIndex","renderAdditionalControls","viewportRef"];import"./DatePickerDropdown.css";import React,{forwardRef,useCallback,useRef,useState}from"react";import{Transition}from"react-transition-group";import{DateTime}from"../../DateTime";import{Popover}from"../../Popover";import{useFlag}from"../../../hooks/useFlag";import{useForkRef}from"../../../hooks/useForkRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cn}from"../../../utils/bem";import{DatePickerAdditionalControls}from"../DatePickerAdditionalControls/DatePickerAdditionalControls";import{datePickerPropDropdownFormDefault}from"../types";var moveMap={year:"year",month:"month",date:"day",time:"time","date-time":"day"},cnDatePickerDropdown=cn("DatePickerDropdown");export var DatePickerDropdown=forwardRef(function(a,b){var c=a.form,d=void 0===c?datePickerPropDropdownFormDefault:c,e=a.anchorRef,f=a.isOpen,g=a.className,h=a.zIndex,i=a.renderAdditionalControls,j=a.viewportRef,k=_objectWithoutProperties(a,_excluded),l=useRef(null),m=useState(),n=_slicedToArray(m,2),o=n[0],p=n[1],q=useFlag(!0),r=_slicedToArray(q,2),s=r[0],t=r[1],u=useCallback(function(b){b===moveMap[a.type]?t.on():t.off()},[a.type]),v=useForkRef([b,l]);return React.createElement(Transition,{in:f,unmountOnExit:!0,timeout:animateTimeout,nodeRef:l},function(b){return React.createElement(Popover,{ref:v,anchorRef:e,className:cnDatePickerDropdown({form:d},[g,cnMixPopoverAnimate({direction:o,animate:b})]),direction:"downStartLeft",spareDirection:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],style:{zIndex:h},role:"listbox",onSetDirection:p,viewportRef:j},React.createElement(DateTime,Object.assign({},k,{onMove:u})),s&&React.createElement(DatePickerAdditionalControls,{currentVisibleDate:a.currentVisibleDate,renderAdditionalControls:i,type:a.type,view:a.view}))})});
|
|
2
2
|
//# sourceMappingURL=DatePickerDropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerDropdown.js","names":["React","forwardRef","useCallback","useRef","useState","Transition","DateTime","Popover","useFlag","useForkRef","animateTimeout","cnMixPopoverAnimate","cn","DatePickerAdditionalControls","datePickerPropDropdownFormDefault","moveMap","cnDatePickerDropdown","DatePickerDropdown","props","componentRef","form","anchorRef","isOpen","className","zIndex","renderAdditionalControls","otherProps","rootRef","direction","setDirection","visibleAdditionalControls","setVisibleAdditionalControls","onMove","to","type","on","off","ref","animate","currentVisibleDate","view"],"sources":["../../../../../../src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.tsx"],"sourcesContent":["import './DatePickerDropdown.css';\n\nimport React, { forwardRef, useCallback, useRef, useState } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n DateTime,\n DateTimePropOnChange,\n DateTimePropType,\n MoveType,\n} from '##/components/DateTime';\nimport {\n DateTimePropDisableDates,\n TimeOptions,\n} from '##/components/DateTime/helpers/types';\nimport { Direction, Popover } from '##/components/Popover';\nimport { useFlag } from '##/hooks/useFlag';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cn } from '##/utils/bem';\nimport { DateRange } from '##/utils/types/Date';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { DatePickerAdditionalControls } from '../DatePickerAdditionalControls/DatePickerAdditionalControls';\nimport {\n DatePickerAdditionalControlRenderProp,\n DatePickerPropDateTimeView,\n DatePickerPropDropdownForm,\n datePickerPropDropdownFormDefault,\n} from '../types';\n\nexport type DatePickerDropdownPropOnChange = DateTimePropOnChange;\n\nexport type DatePickerDropdownProps = PropsWithHTMLAttributesAndRef<\n {\n anchorRef: React.RefObject<HTMLElement>;\n currentVisibleDate?: Date;\n type: DateTimePropType;\n value?: Date | DateRange;\n onChange?: DatePickerDropdownPropOnChange;\n minDate?: Date;\n maxDate?: Date;\n events?: Date[];\n view: DatePickerPropDateTimeView;\n locale?: Locale;\n children?: never;\n form?: DatePickerPropDropdownForm;\n isOpen?: boolean;\n onChangeCurrentVisibleDate?: (date: Date) => void;\n zIndex?: number;\n renderAdditionalControls?: DatePickerAdditionalControlRenderProp;\n timeOptions?: TimeOptions;\n timeFor?: 'start' | 'end';\n disableDates?: DateTimePropDisableDates;\n },\n HTMLDivElement\n>;\n\ntype DatePickerDropdownComponent = (\n props: DatePickerDropdownProps,\n) => React.ReactNode | null;\n\nconst moveMap: Record<DateTimePropType, MoveType> = {\n 'year': 'year',\n 'month': 'month',\n 'date': 'day',\n 'time': 'time',\n 'date-time': 'day',\n};\n\nconst cnDatePickerDropdown = cn('DatePickerDropdown');\n\nexport const DatePickerDropdown: DatePickerDropdownComponent = forwardRef(\n (props, componentRef) => {\n const {\n form = datePickerPropDropdownFormDefault,\n anchorRef,\n isOpen,\n className,\n zIndex,\n renderAdditionalControls,\n ...otherProps\n } = props;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const [direction, setDirection] = useState<Direction>();\n\n const [visibleAdditionalControls, setVisibleAdditionalControls] =\n useFlag(true);\n\n const onMove = useCallback(\n (to: MoveType) => {\n to === moveMap[props.type]\n ? setVisibleAdditionalControls.on()\n : setVisibleAdditionalControls.off();\n },\n [props.type],\n );\n\n const ref = useForkRef([componentRef, rootRef]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n timeout={animateTimeout}\n nodeRef={rootRef}\n >\n {(animate) => {\n return (\n <Popover\n ref={ref}\n anchorRef={anchorRef}\n className={cnDatePickerDropdown({ form }, [\n className,\n cnMixPopoverAnimate({ direction, animate }),\n ])}\n direction=\"downStartLeft\"\n spareDirection=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n style={{ zIndex }}\n role=\"listbox\"\n onSetDirection={setDirection}\n >\n <DateTime {...otherProps} onMove={onMove} />\n {visibleAdditionalControls && (\n <DatePickerAdditionalControls\n currentVisibleDate={props.currentVisibleDate}\n renderAdditionalControls={renderAdditionalControls}\n type={props.type}\n view={props.view}\n />\n )}\n </Popover>\n );\n }}\n </Transition>\n );\n },\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePickerDropdown.js","names":["React","forwardRef","useCallback","useRef","useState","Transition","DateTime","Popover","useFlag","useForkRef","animateTimeout","cnMixPopoverAnimate","cn","DatePickerAdditionalControls","datePickerPropDropdownFormDefault","moveMap","cnDatePickerDropdown","DatePickerDropdown","props","componentRef","form","anchorRef","isOpen","className","zIndex","renderAdditionalControls","viewportRef","otherProps","rootRef","direction","setDirection","visibleAdditionalControls","setVisibleAdditionalControls","onMove","to","type","on","off","ref","animate","currentVisibleDate","view"],"sources":["../../../../../../src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.tsx"],"sourcesContent":["import './DatePickerDropdown.css';\n\nimport React, { forwardRef, useCallback, useRef, useState } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n DateTime,\n DateTimePropOnChange,\n DateTimePropType,\n MoveType,\n} from '##/components/DateTime';\nimport {\n DateTimePropDisableDates,\n TimeOptions,\n} from '##/components/DateTime/helpers/types';\nimport { Direction, Popover } from '##/components/Popover';\nimport { useFlag } from '##/hooks/useFlag';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cn } from '##/utils/bem';\nimport { DateRange } from '##/utils/types/Date';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { DatePickerAdditionalControls } from '../DatePickerAdditionalControls/DatePickerAdditionalControls';\nimport {\n DatePickerAdditionalControlRenderProp,\n DatePickerPropDateTimeView,\n DatePickerPropDropdownForm,\n datePickerPropDropdownFormDefault,\n} from '../types';\n\nexport type DatePickerDropdownPropOnChange = DateTimePropOnChange;\n\nexport type DatePickerDropdownProps = PropsWithHTMLAttributesAndRef<\n {\n anchorRef: React.RefObject<HTMLElement>;\n currentVisibleDate?: Date;\n type: DateTimePropType;\n value?: Date | DateRange;\n onChange?: DatePickerDropdownPropOnChange;\n minDate?: Date;\n maxDate?: Date;\n events?: Date[];\n view: DatePickerPropDateTimeView;\n locale?: Locale;\n children?: never;\n form?: DatePickerPropDropdownForm;\n isOpen?: boolean;\n onChangeCurrentVisibleDate?: (date: Date) => void;\n zIndex?: number;\n renderAdditionalControls?: DatePickerAdditionalControlRenderProp;\n timeOptions?: TimeOptions;\n timeFor?: 'start' | 'end';\n disableDates?: DateTimePropDisableDates;\n viewportRef?: React.RefObject<HTMLElement>;\n },\n HTMLDivElement\n>;\n\ntype DatePickerDropdownComponent = (\n props: DatePickerDropdownProps,\n) => React.ReactNode | null;\n\nconst moveMap: Record<DateTimePropType, MoveType> = {\n 'year': 'year',\n 'month': 'month',\n 'date': 'day',\n 'time': 'time',\n 'date-time': 'day',\n};\n\nconst cnDatePickerDropdown = cn('DatePickerDropdown');\n\nexport const DatePickerDropdown: DatePickerDropdownComponent = forwardRef(\n (props, componentRef) => {\n const {\n form = datePickerPropDropdownFormDefault,\n anchorRef,\n isOpen,\n className,\n zIndex,\n renderAdditionalControls,\n viewportRef,\n ...otherProps\n } = props;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const [direction, setDirection] = useState<Direction>();\n\n const [visibleAdditionalControls, setVisibleAdditionalControls] =\n useFlag(true);\n\n const onMove = useCallback(\n (to: MoveType) => {\n to === moveMap[props.type]\n ? setVisibleAdditionalControls.on()\n : setVisibleAdditionalControls.off();\n },\n [props.type],\n );\n\n const ref = useForkRef([componentRef, rootRef]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n timeout={animateTimeout}\n nodeRef={rootRef}\n >\n {(animate) => {\n return (\n <Popover\n ref={ref}\n anchorRef={anchorRef}\n className={cnDatePickerDropdown({ form }, [\n className,\n cnMixPopoverAnimate({ direction, animate }),\n ])}\n direction=\"downStartLeft\"\n spareDirection=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n style={{ zIndex }}\n role=\"listbox\"\n onSetDirection={setDirection}\n viewportRef={viewportRef}\n >\n <DateTime {...otherProps} onMove={onMove} />\n {visibleAdditionalControls && (\n <DatePickerAdditionalControls\n currentVisibleDate={props.currentVisibleDate}\n renderAdditionalControls={renderAdditionalControls}\n type={props.type}\n view={props.view}\n />\n )}\n </Popover>\n );\n }}\n </Transition>\n );\n },\n);\n"],"mappings":"gQAAA,iCAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,WAA5B,CAAyCC,MAAzC,CAAiDC,QAAjD,KAAiE,OAAjE,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,QADF,sBAUA,OAAoBC,OAApB,qBACA,OAASC,OAAT,8BACA,OAASC,UAAT,iCACA,OAASC,cAAT,CAAyBC,mBAAzB,uCACA,OAASC,EAAT,0BAIA,OAASC,4BAAT,oEACA,OAIEC,iCAJF,gB,GAuCMC,QAA2C,CAAG,CAClD,KAAQ,MAD0C,CAElD,MAAS,OAFyC,CAGlD,KAAQ,KAH0C,CAIlD,KAAQ,MAJ0C,CAKlD,YAAa,KALqC,C,CAQ9CC,oBAAoB,CAAGJ,EAAE,CAAC,oBAAD,C,CAE/B,MAAO,IAAMK,mBAA+C,CAAGhB,UAAU,CACvE,SAACiB,CAAD,CAAQC,CAAR,CAAyB,OAUnBD,CAVmB,CAErBE,IAFqB,CAErBA,CAFqB,YAEdN,iCAFc,GAGrBO,CAHqB,CAUnBH,CAVmB,CAGrBG,SAHqB,CAIrBC,CAJqB,CAUnBJ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E,KAAK,CAAE,CAAEf,MAAM,CAANA,CAAF,CAfT,CAgBE,IAAI,CAAC,SAhBP,CAiBE,cAAc,CAAEM,CAjBlB,CAkBE,WAAW,CAAEJ,CAlBf,EAoBE,oBAAC,QAAD,kBAAcC,CAAd,EAA0B,MAAM,CAAEM,CAAlC,GApBF,CAqBGF,CAAyB,EACxB,oBAAC,4BAAD,EACE,kBAAkB,CAAEb,CAAK,CAACsB,kBAD5B,CAEE,wBAAwB,CAAEf,CAF5B,CAGE,IAAI,CAAEP,CAAK,CAACiB,IAHd,CAIE,IAAI,CAAEjB,CAAK,CAACuB,IAJd,EAtBJ,CA+BH,CAvCH,CA0CH,CAzEsE,CAAlE"}
|
|
@@ -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=["events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRef"];import addMonths from"date-fns/addMonths";import startOfMonth from"date-fns/startOfMonth";import React,{forwardRef,useEffect,useRef}from"react";import{useClickOutside}from"../../../hooks/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{setRef}from"../../../utils/setRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDate}from"../DatePickerFieldTypeDate/DatePickerFieldTypeDate";import{getDropdownZIndex}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDate=forwardRef(function(a,b){var c=a.events,d=a.dateTimeView,e=void 0===d?datePickerPropDateTimeViewDefault:d,f=a.locale,g=a.dropdownClassName,h=a.dropdownRef,i=a.dropdownForm,j=a.currentVisibleDate,k=a.onChangeCurrentVisibleDate,l=a.renderAdditionalControls,m=a.onDropdownOpen,n=a.dropdownOpen,o=a.ignoreOutsideClicksRefs,p=a.disabled,q=a.disableDates,r=a.inputRef,s=_objectWithoutProperties(a,_excluded),
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRef","dropdownViewportRef"];import addMonths from"date-fns/addMonths";import startOfMonth from"date-fns/startOfMonth";import React,{forwardRef,useEffect,useRef}from"react";import{useClickOutside}from"../../../hooks/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{setRef}from"../../../utils/setRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDate}from"../DatePickerFieldTypeDate/DatePickerFieldTypeDate";import{getDropdownZIndex}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDate=forwardRef(function(a,b){var c=a.events,d=a.dateTimeView,e=void 0===d?datePickerPropDateTimeViewDefault:d,f=a.locale,g=a.dropdownClassName,h=a.dropdownRef,i=a.dropdownForm,j=a.currentVisibleDate,k=a.onChangeCurrentVisibleDate,l=a.renderAdditionalControls,m=a.onDropdownOpen,n=a.dropdownOpen,o=a.ignoreOutsideClicksRefs,p=a.disabled,q=a.disableDates,r=a.inputRef,s=a.dropdownViewportRef,t=_objectWithoutProperties(a,_excluded),u=useRef(null),v=useRef(null),w=useRef(null),x=useCalendarVisible({dropdownOpen:n,onDropdownOpen:m,disabled:p,startRef:w}),y=_slicedToArray(x,2),z=y[0],A=y[1],B=useCurrentVisibleDate({currentVisibleDate:j,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:k,calendarVisible:z}),C=_slicedToArray(B,2),D=C[0],E=C[1];return useEffect(function(){b&&setRef(b,u.current)},[b,u]),useEffect(function(){if(a.value&&"classic"===e&&D){var b=startOfMonth(a.value);return void(b.getTime()!==D.getTime()&&E(b))}if(a.value&&"classic"!==e&&D){var c=startOfMonth(a.value);c.getTime()!==D.getTime()&&c.getTime()!==addMonths(D,1).getTime()&&E(c)}},[a.value]),useClickOutside({isActive:z,ignoreClicksInsideRefs:[u,v].concat(_toConsumableArray(null!==o&&void 0!==o?o:[])),handler:A.off}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeDate,Object.assign({},t,{disabled:p,ref:u,inputRef:useForkRef([w,r]),onClick:A.on})),React.createElement(DatePickerDropdown,{ref:useForkRef([h,v]),viewportRef:s,anchorRef:u,isOpen:z,value:a.value||void 0,type:"date",view:e,events:c,locale:f,minDate:a.minDate,className:g,maxDate:a.maxDate,currentVisibleDate:D,form:i,onChange:function onChange(){for(var b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];null===(b=a.onChange)||void 0===b?void 0:b.call.apply(b,[a].concat(d)),A.off()},renderAdditionalControls:l,disableDates:q,zIndex:getDropdownZIndex(a.style),onChangeCurrentVisibleDate:E}))});
|
|
2
2
|
//# sourceMappingURL=DatePickerTypeDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerTypeDate.js","names":["addMonths","startOfMonth","React","forwardRef","useEffect","useRef","useClickOutside","useForkRef","setRef","DatePickerDropdown","DatePickerFieldTypeDate","getDropdownZIndex","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDate","props","ref","events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRefProp","inputRef","otherProps","fieldRef","calendarRef","startRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","current","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","on","args","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.tsx"],"sourcesContent":["import addMonths from 'date-fns/addMonths';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport React, { forwardRef, useEffect, useRef } from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { setRef } from '##/utils/setRef';\n\nimport { DatePickerDropdown } from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDate } from '../DatePickerFieldTypeDate/DatePickerFieldTypeDate';\nimport { getDropdownZIndex } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDate: DatePickerTypeComponent<'date'> = forwardRef(\n (props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownClassName,\n dropdownRef,\n dropdownForm,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\n inputRef: inputRefProp,\n ...otherProps\n } = props;\n\n const fieldRef = useRef<HTMLDivElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: inputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n calendarVisible,\n });\n\n useEffect(() => {\n if (ref) {\n setRef(ref, fieldRef.current);\n }\n }, [ref, fieldRef]);\n\n useEffect(() => {\n if (props.value && dateTimeView === 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (newVisibleDate.getTime() !== currentVisibleDate.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value && dateTimeView !== 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (\n newVisibleDate.getTime() !== currentVisibleDate.getTime() &&\n newVisibleDate.getTime() !==\n addMonths(currentVisibleDate, 1).getTime()\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n fieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: setCalendarVisible.off,\n });\n\n return (\n <>\n <DatePickerFieldTypeDate\n {...otherProps}\n disabled={disabled}\n ref={fieldRef}\n inputRef={useForkRef([inputRef, inputRefProp])}\n onClick={setCalendarVisible.on}\n />\n <DatePickerDropdown\n ref={useForkRef([dropdownRef, calendarRef])}\n anchorRef={fieldRef}\n isOpen={calendarVisible}\n value={props.value || undefined}\n type=\"date\"\n view={dateTimeView}\n events={events}\n locale={locale}\n minDate={props.minDate}\n className={dropdownClassName}\n maxDate={props.maxDate}\n currentVisibleDate={currentVisibleDate}\n form={dropdownForm}\n onChange={(...args) => {\n props.onChange?.(...args);\n setCalendarVisible.off();\n }}\n renderAdditionalControls={renderAdditionalControls}\n disableDates={disableDates}\n zIndex={getDropdownZIndex(props.style)}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n />\n </>\n );\n },\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePickerTypeDate.js","names":["addMonths","startOfMonth","React","forwardRef","useEffect","useRef","useClickOutside","useForkRef","setRef","DatePickerDropdown","DatePickerFieldTypeDate","getDropdownZIndex","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDate","props","ref","events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRefProp","inputRef","dropdownViewportRef","otherProps","fieldRef","calendarRef","startRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","current","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","on","args","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.tsx"],"sourcesContent":["import addMonths from 'date-fns/addMonths';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport React, { forwardRef, useEffect, useRef } from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { setRef } from '##/utils/setRef';\n\nimport { DatePickerDropdown } from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDate } from '../DatePickerFieldTypeDate/DatePickerFieldTypeDate';\nimport { getDropdownZIndex } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDate: DatePickerTypeComponent<'date'> = forwardRef(\n (props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownClassName,\n dropdownRef,\n dropdownForm,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\n inputRef: inputRefProp,\n dropdownViewportRef,\n ...otherProps\n } = props;\n\n const fieldRef = useRef<HTMLDivElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: inputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n calendarVisible,\n });\n\n useEffect(() => {\n if (ref) {\n setRef(ref, fieldRef.current);\n }\n }, [ref, fieldRef]);\n\n useEffect(() => {\n if (props.value && dateTimeView === 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (newVisibleDate.getTime() !== currentVisibleDate.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value && dateTimeView !== 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (\n newVisibleDate.getTime() !== currentVisibleDate.getTime() &&\n newVisibleDate.getTime() !==\n addMonths(currentVisibleDate, 1).getTime()\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n fieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: setCalendarVisible.off,\n });\n\n return (\n <>\n <DatePickerFieldTypeDate\n {...otherProps}\n disabled={disabled}\n ref={fieldRef}\n inputRef={useForkRef([inputRef, inputRefProp])}\n onClick={setCalendarVisible.on}\n />\n <DatePickerDropdown\n ref={useForkRef([dropdownRef, calendarRef])}\n viewportRef={dropdownViewportRef}\n anchorRef={fieldRef}\n isOpen={calendarVisible}\n value={props.value || undefined}\n type=\"date\"\n view={dateTimeView}\n events={events}\n locale={locale}\n minDate={props.minDate}\n className={dropdownClassName}\n maxDate={props.maxDate}\n currentVisibleDate={currentVisibleDate}\n form={dropdownForm}\n onChange={(...args) => {\n props.onChange?.(...args);\n setCalendarVisible.off();\n }}\n renderAdditionalControls={renderAdditionalControls}\n disableDates={disableDates}\n zIndex={getDropdownZIndex(props.style)}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n />\n </>\n );\n },\n);\n"],"mappings":"mgBAAA,MAAOA,UAAP,KAAsB,oBAAtB,CACA,MAAOC,aAAP,KAAyB,uBAAzB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,MAAvC,KAAqD,OAArD,CAEA,OAASC,eAAT,sCACA,OAASC,UAAT,iCACA,OAASC,MAAT,6BAEA,OAASC,kBAAT,gDACA,OAASC,uBAAT,0DACA,OAASC,iBAAT,kBACA,OACEC,iCADF,gBAIA,OAASC,kBAAT,6BACA,OAASC,qBAAT,gCAEA,MAAO,IAAMC,mBAAmD,CAAGZ,UAAU,CAC3E,SAACa,CAAD,CAAQC,CAAR,CAAgB,IAEZC,EAFY,CAmBVF,CAnBU,CAEZE,MAFY,GAmBVF,CAnBU,CAGZG,YAHY,CAGZA,CAHY,YAGGP,iCAHH,GAIZQ,CAJY,CAmBVJ,CAnBU,CAIZI,MAJY,CAKZC,CALY,CAmBVL,CAnBU,CAKZK,iBALY,CAMZC,CANY,CAmBVN,CAnBU,CAMZM,WANY,CAOZC,CAPY,CAmBVP,CAnBU,CAOZO,YAPY,CAQQC,CARR,CAmBVR,CAnBU,CAQZS,kBARY,CASZC,CATY,CAmBVV,CAnBU,CASZU,0BATY,CAUZC,CAVY,CAmBVX,CAnBU,CAUZW,wBAVY,CAWZC,CAXY,CAmBVZ,CAnBU,CAWZY,cAXY,CAYZC,CAZY,CAmBVb,CAnBU,CAYZa,YAZY,CAaZC,CAbY,CAmBVd,CAnBU,CAaZc,uBAbY,CAcZC,CAdY,CAmBVf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AAO,CAAEJ,CAAK,CAAC2B,OAVjB,CAWE,SAAS,CAAEtB,CAXb,CAYE,OAAO,CAAEL,CAAK,CAAC0B,OAZjB,CAaE,kBAAkB,CAAEjB,CAbtB,CAcE,IAAI,CAAEF,CAdR,CAeE,QAAQ,CAAE,mBAAa,8BAATgC,CAAS,sBAATA,CAAS,2BACrBvC,CAAK,CAACwC,QADe,qBACrB,gBAAAxC,CAAK,QAAL,CAAoBuC,CAApB,EADqB,CAErBd,CAAkB,CAACY,GAAnB,EACD,CAlBH,CAmBE,wBAAwB,CAAE1B,CAnB5B,CAoBE,YAAY,CAAEK,CApBhB,CAqBE,MAAM,CAAErB,iBAAiB,CAACK,CAAK,CAACyC,KAAP,CArB3B,CAsBE,0BAA0B,CAAEX,CAtB9B,EARF,CAkCH,CAlH0E,CAAtE"}
|
package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js
CHANGED
|
@@ -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=["events","dateTimeView","locale","dropdownForm","onFocus","onBlur","leftSide","rightSide","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","dropdownClassName","dropdownRef","name","placeholder","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates"];import addMonths from"date-fns/addMonths";import startOfMonth from"date-fns/startOfMonth";import React,{forwardRef,useCallback,useEffect,useRef,useState}from"react";import{useClickOutside}from"../../../hooks/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDateRange}from"../DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange";import{getDropdownZIndex,getFieldName,normalizeRangeValue}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDateRange=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.leftSide,o=a.rightSide,p=a.currentVisibleDate,q=a.onChangeCurrentVisibleDate,r=a.renderAdditionalControls,s=a.inputRef,t=a.dropdownClassName,u=a.dropdownRef,v=a.name,w=a.placeholder,x=a.onDropdownOpen,y=a.dropdownOpen,z=a.ignoreOutsideClicksRefs,A=a.disabled,B=a.disableDates,C=_objectWithoutProperties(a,_excluded),
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["events","dateTimeView","locale","dropdownForm","onFocus","onBlur","leftSide","rightSide","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","dropdownClassName","dropdownRef","name","placeholder","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","dropdownViewportRef"];import addMonths from"date-fns/addMonths";import startOfMonth from"date-fns/startOfMonth";import React,{forwardRef,useCallback,useEffect,useRef,useState}from"react";import{useClickOutside}from"../../../hooks/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDateRange}from"../DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange";import{getDropdownZIndex,getFieldName,normalizeRangeValue}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDateRange=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.leftSide,o=a.rightSide,p=a.currentVisibleDate,q=a.onChangeCurrentVisibleDate,r=a.renderAdditionalControls,s=a.inputRef,t=a.dropdownClassName,u=a.dropdownRef,v=a.name,w=a.placeholder,x=a.onDropdownOpen,y=a.dropdownOpen,z=a.ignoreOutsideClicksRefs,A=a.disabled,B=a.disableDates,C=a.dropdownViewportRef,D=_objectWithoutProperties(a,_excluded),E=useRef(null),F=useRef(null),G=useRef(null),H=useRef(null),I=useRef(null),J=useState(),K=_slicedToArray(J,2),L=K[0],M=K[1],N=0===L,O=1===L,P=useCalendarVisible({dropdownOpen:y,onDropdownOpen:x,disabled:A,startRef:G,endRef:H}),Q=_slicedToArray(P,2),R=Q[0],S=Q[1],T=useCurrentVisibleDate({currentVisibleDate:p,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:q,calendarVisible:R,rangeIndex:L}),U=_slicedToArray(T,2),V=U[0],W=U[1];return useEffect(function(){var b,c;if(null!==(b=a.value)&&void 0!==b&&b[0]&&"classic"===i&&N){var d=startOfMonth(a.value[0]);return void(d.getTime()!==(null===V||void 0===V?void 0:V.getTime())&&W(d))}if(null!==(c=a.value)&&void 0!==c&&c[0]&&"classic"!==i&&N){var e=startOfMonth(a.value[0]);e.getTime()!==(null===V||void 0===V?void 0:V.getTime())&&e.getTime()!==(V&&addMonths(V,1).getTime())&&W(e)}},[null===(c=a.value)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.getTime(),R,N]),useEffect(function(){var b,c;if(null!==(b=a.value)&&void 0!==b&&b[1]&&"classic"===i&&O){var d=startOfMonth(a.value[1]);return void(d.getTime()!==(null===V||void 0===V?void 0:V.getTime())&&W(d))}if(null!==(c=a.value)&&void 0!==c&&c[1]&&"classic"!==i&&O){var e=startOfMonth(a.value[1]);e.getTime()!==(null===V||void 0===V?void 0:V.getTime())&&e.getTime()!==(V&&addMonths(V,1).getTime())&&W(addMonths(e,-1))}},[null===(e=a.value)||void 0===e||null===(f=e[1])||void 0===f?void 0:f.getTime(),R,O]),useClickOutside({isActive:R,ignoreClicksInsideRefs:[E,F,I].concat(_toConsumableArray(null!==z&&void 0!==z?z:[])),handler:useCallback(function(){M(void 0),S.off()},[])}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeDateRange,Object.assign({},D,{ref:b,startFieldRef:E,endFieldRef:F,startFieldInputRef:useForkRef([G,null===s||void 0===s?void 0:s[0]]),endFieldInputRef:useForkRef([H,null===s||void 0===s?void 0:s[1]]),startFieldOnFocus:function startFieldOnFocusHandler(a){var b;M(0),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;M(1),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(n)?null===n||void 0===n?void 0:n[0]:n,startFieldRightSide:Array.isArray(o)?null===o||void 0===o?void 0:o[0]:void 0,endFieldLeftSide:Array.isArray(n)?null===n||void 0===n?void 0:n[1]:void 0,endFieldRightSide:Array.isArray(o)?null===o||void 0===o?void 0:o[1]:o,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)},startFieldOnClick:S.on,endFieldOnClick:S.on,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:N,endFocused:O,startFieldName:getFieldName(v,0),endFieldName:getFieldName(v,1),startFieldPlaceholder:Array.isArray(w)?null===w||void 0===w?void 0:w[0]:w,endFieldPlaceholder:Array.isArray(w)?null===w||void 0===w?void 0:w[1]:w,disabled:A})),React.createElement(DatePickerDropdown,{type:"date",ref:useForkRef([u,I]),viewportRef:C,anchorRef:E,className:t,isOpen:R,onChangeCurrentVisibleDate:W,currentVisibleDate:V,value:a.value||void 0,view:i,events:g,locale:j,minDate:a.minDate,maxDate:a.maxDate,form:k,onChange:function handleChange(b,c){var d=c.e;if(N){var e,f,g=normalizeRangeValue([b,null===a||void 0===a||null===(e=a.value)||void 0===e?void 0:e[1]]);null===(f=a.onChange)||void 0===f?void 0:f.call(a,g,{e:d})}if(O){var h,i,j=normalizeRangeValue([null===a||void 0===a||null===(h=a.value)||void 0===h?void 0:h[0],b]);null===(i=a.onChange)||void 0===i?void 0:i.call(a,j,{e:d})}},renderAdditionalControls:r,zIndex:getDropdownZIndex(a.style),disableDates:B}))});
|
|
2
2
|
//# sourceMappingURL=DatePickerTypeDateRange.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerTypeDateRange.js","names":["addMonths","startOfMonth","React","forwardRef","useCallback","useEffect","useRef","useState","useClickOutside","useForkRef","DatePickerDropdown","DatePickerFieldTypeDateRange","getDropdownZIndex","getFieldName","normalizeRangeValue","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDateRange","props","ref","events","dateTimeView","locale","dropdownForm","onFocus","onBlur","leftSide","rightSide","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","dropdownClassName","dropdownRef","name","placeholder","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","fieldProps","startFieldRef","endFieldRef","startFieldInputRef","endFieldInputRef","calendarRef","fieldFocused","setFieldFocused","startFocused","endFocused","startRef","endRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","rangeIndex","setCurrentVisibleDate","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","startFieldOnFocusHandler","e","Array","isArray","endFieldOnFocusHandler","startFieldOnBlurHandler","on","endFieldOnBlurHandler","handleChange","newValue","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.tsx"],"sourcesContent":["import addMonths from 'date-fns/addMonths';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\n\nimport {\n DatePickerDropdown,\n DatePickerDropdownPropOnChange,\n} from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDateRange } from '../DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange';\nimport {\n getDropdownZIndex,\n getFieldName,\n normalizeRangeValue,\n} from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDateRange: DatePickerTypeComponent<'date-range'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownForm,\n onFocus,\n onBlur,\n leftSide,\n rightSide,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n inputRef,\n dropdownClassName,\n dropdownRef,\n name,\n placeholder,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\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<0 | 1 | undefined>();\n\n const startFocused = fieldFocused === 0;\n const endFocused = fieldFocused === 1;\n\n const handleChange: DatePickerDropdownPropOnChange = (value, { e }) => {\n if (startFocused) {\n const newValue = normalizeRangeValue([value, props?.value?.[1]]);\n props.onChange?.(newValue, {\n e,\n });\n }\n if (endFocused) {\n const newValue = normalizeRangeValue([props?.value?.[0], value]);\n props.onChange?.(newValue, {\n e,\n });\n }\n };\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: startFieldInputRef,\n endRef: endFieldInputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n calendarVisible,\n rangeIndex: fieldFocused,\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(0);\n Array.isArray(onFocus) ? onFocus[0]?.(e) : onFocus?.(e);\n };\n\n const endFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused(1);\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 = startOfMonth(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 = startOfMonth(props.value[0]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addMonths(currentVisibleDate, 1).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 = startOfMonth(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 = startOfMonth(props.value[1]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addMonths(currentVisibleDate, 1).getTime())\n ) {\n setCurrentVisibleDate(addMonths(newVisibleDate, -1));\n }\n }\n }, [props.value?.[1]?.getTime(), calendarVisible, endFocused]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n startFieldRef,\n endFieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: useCallback(() => {\n setFieldFocused(undefined);\n setCalendarVisible.off();\n }, []),\n });\n\n return (\n <>\n <DatePickerFieldTypeDateRange\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 startFieldOnClick={setCalendarVisible.on}\n endFieldOnClick={setCalendarVisible.on}\n endFieldOnBlur={endFieldOnBlurHandler}\n startFocused={startFocused}\n endFocused={endFocused}\n startFieldName={getFieldName(name, 0)}\n endFieldName={getFieldName(name, 1)}\n startFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[0] : placeholder\n }\n endFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[1] : placeholder\n }\n disabled={disabled}\n />\n <DatePickerDropdown\n type=\"date\"\n ref={useForkRef([dropdownRef, calendarRef])}\n anchorRef={startFieldRef}\n className={dropdownClassName}\n isOpen={calendarVisible}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n currentVisibleDate={currentVisibleDate}\n value={props.value || undefined}\n view={dateTimeView}\n events={events}\n locale={locale}\n minDate={props.minDate}\n maxDate={props.maxDate}\n form={dropdownForm}\n onChange={handleChange}\n renderAdditionalControls={renderAdditionalControls}\n zIndex={getDropdownZIndex(props.style)}\n disableDates={disableDates}\n />\n </>\n );\n });\n"],"mappings":"4iBAAA,MAAOA,UAAP,KAAsB,oBAAtB,CACA,MAAOC,aAAP,KAAyB,uBAAzB,CACA,MAAOC,MAAP,EACEC,UADF,CAEEC,WAFF,CAGEC,SAHF,CAIEC,MAJF,CAKEC,QALF,KAMO,OANP,CAQA,OAASC,eAAT,sCACA,OAASC,UAAT,iCAEA,OACEC,kBADF,gDAIA,OAASC,4BAAT,oEACA,OACEC,iBADF,CAEEC,YAFF,CAGEC,mBAHF,kBAKA,OACEC,iCADF,gBAIA,OAASC,kBAAT,6BACA,OAASC,qBAAT,gCAEA,MAAO,IAAMC,wBAA8D,CACzEf,UAAU,CAAC,SAACgB,CAAD,CAAQC,CAAR,CAAgB,aAEvBC,CAFuB,CAwBrBF,CAxBqB,CAEvBE,MAFuB,GAwBrBF,CAxBqB,CAGvBG,YAHuB,CAGvBA,CAHuB,YAGRP,iCAHQ,GAIvBQ,CAJuB,CAwBrBJ,CAxBqB,CAIvBI,MAJuB,CAKvBC,CALuB,CAwBrBL,CAxBqB,CAKvBK,YALuB,CAMvBC,CANuB,CAwBrBN,CAxBqB,CAMvBM,OANuB,CAOvBC,CAPuB,CAwBrBP,C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AK,CAAY2D,CAAZ,CAAsB,CACzBR,CAAC,CAADA,CADyB,CAAtB,CAGN,CACD,GAAIlB,CAAJ,CAAgB,SACR0B,CAAQ,CAAGhE,mBAAmB,CAAC,QAACK,CAAD,WAACA,CAAD,YAACA,CAAK,CAAEwC,KAAR,qBAAC,EAAe,CAAf,CAAD,CAAoBA,CAApB,CAAD,CADtB,WAEdxC,CAAK,CAAC4D,QAFQ,qBAEd,OAAA5D,CAAK,CAAY2D,CAAZ,CAAsB,CACzBR,CAAC,CAADA,CADyB,CAAtB,CAGN,CACF,CAiIG,CAgBE,wBAAwB,CAAEtC,CAhB5B,CAiBE,MAAM,CAAEpB,iBAAiB,CAACO,CAAK,CAAC6D,KAAP,CAjB3B,CAkBE,YAAY,CAAEtC,CAlBhB,EApCF,CA0DH,CAzMS,CADL"}
|
|
1
|
+
{"version":3,"file":"DatePickerTypeDateRange.js","names":["addMonths","startOfMonth","React","forwardRef","useCallback","useEffect","useRef","useState","useClickOutside","useForkRef","DatePickerDropdown","DatePickerFieldTypeDateRange","getDropdownZIndex","getFieldName","normalizeRangeValue","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDateRange","props","ref","events","dateTimeView","locale","dropdownForm","onFocus","onBlur","leftSide","rightSide","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","dropdownClassName","dropdownRef","name","placeholder","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","dropdownViewportRef","fieldProps","startFieldRef","endFieldRef","startFieldInputRef","endFieldInputRef","calendarRef","fieldFocused","setFieldFocused","startFocused","endFocused","startRef","endRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","rangeIndex","setCurrentVisibleDate","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","startFieldOnFocusHandler","e","Array","isArray","endFieldOnFocusHandler","startFieldOnBlurHandler","on","endFieldOnBlurHandler","handleChange","newValue","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.tsx"],"sourcesContent":["import addMonths from 'date-fns/addMonths';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\n\nimport {\n DatePickerDropdown,\n DatePickerDropdownPropOnChange,\n} from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDateRange } from '../DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange';\nimport {\n getDropdownZIndex,\n getFieldName,\n normalizeRangeValue,\n} from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDateRange: DatePickerTypeComponent<'date-range'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownForm,\n onFocus,\n onBlur,\n leftSide,\n rightSide,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n inputRef,\n dropdownClassName,\n dropdownRef,\n name,\n placeholder,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\n dropdownViewportRef,\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<0 | 1 | undefined>();\n\n const startFocused = fieldFocused === 0;\n const endFocused = fieldFocused === 1;\n\n const handleChange: DatePickerDropdownPropOnChange = (value, { e }) => {\n if (startFocused) {\n const newValue = normalizeRangeValue([value, props?.value?.[1]]);\n props.onChange?.(newValue, {\n e,\n });\n }\n if (endFocused) {\n const newValue = normalizeRangeValue([props?.value?.[0], value]);\n props.onChange?.(newValue, {\n e,\n });\n }\n };\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: startFieldInputRef,\n endRef: endFieldInputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n calendarVisible,\n rangeIndex: fieldFocused,\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(0);\n Array.isArray(onFocus) ? onFocus[0]?.(e) : onFocus?.(e);\n };\n\n const endFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused(1);\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 = startOfMonth(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 = startOfMonth(props.value[0]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addMonths(currentVisibleDate, 1).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 = startOfMonth(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 = startOfMonth(props.value[1]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addMonths(currentVisibleDate, 1).getTime())\n ) {\n setCurrentVisibleDate(addMonths(newVisibleDate, -1));\n }\n }\n }, [props.value?.[1]?.getTime(), calendarVisible, endFocused]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n startFieldRef,\n endFieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: useCallback(() => {\n setFieldFocused(undefined);\n setCalendarVisible.off();\n }, []),\n });\n\n return (\n <>\n <DatePickerFieldTypeDateRange\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 startFieldOnClick={setCalendarVisible.on}\n endFieldOnClick={setCalendarVisible.on}\n endFieldOnBlur={endFieldOnBlurHandler}\n startFocused={startFocused}\n endFocused={endFocused}\n startFieldName={getFieldName(name, 0)}\n endFieldName={getFieldName(name, 1)}\n startFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[0] : placeholder\n }\n endFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[1] : placeholder\n }\n disabled={disabled}\n />\n <DatePickerDropdown\n type=\"date\"\n ref={useForkRef([dropdownRef, calendarRef])}\n viewportRef={dropdownViewportRef}\n anchorRef={startFieldRef}\n className={dropdownClassName}\n isOpen={calendarVisible}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n currentVisibleDate={currentVisibleDate}\n value={props.value || undefined}\n view={dateTimeView}\n events={events}\n locale={locale}\n minDate={props.minDate}\n maxDate={props.maxDate}\n form={dropdownForm}\n onChange={handleChange}\n renderAdditionalControls={renderAdditionalControls}\n zIndex={getDropdownZIndex(props.style)}\n disableDates={disableDates}\n />\n </>\n );\n });\n"],"mappings":"kkBAAA,MAAOA,UAAP,KAAsB,oBAAtB,CACA,MAAOC,aAAP,KAAyB,uBAAzB,CACA,MAAOC,MAAP,EACEC,UADF,CAEEC,WAFF,CAGEC,SAHF,CAIEC,MAJF,CAKEC,QALF,KAMO,OANP,CAQA,OAASC,eAAT,sCACA,OAASC,UAAT,iCAEA,OACEC,kBADF,gDAIA,OAASC,4BAAT,oEACA,OACEC,iBADF,CAEEC,YAFF,CAGEC,mBAHF,kBAKA,OACEC,iCADF,gBAIA,OAASC,kBAAT,6BACA,OAASC,qBAAT,gCAEA,MAAO,IAAMC,wBAA8D,CACzEf,UAAU,CAAC,SAACgB,CAAD,CAAQC,CAAR,CAAgB,aAEvBC,CAFuB,CAyBrBF,CAzBqB,CAEvBE,MAFuB,GAyBrBF,CAzBqB,CAGvBG,YAHuB,CAGvBA,CAHuB,YAGRP,iCAHQ,GAIvBQ,CAJuB,CAyBrBJ,CAzBqB,CAIvBI,MAJuB,CAKvBC,CALuB,CAyBrBL,CAzBqB,CAKvBK,YALu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