@consta/uikit 5.30.0 → 5.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FileCanary/index.d.ts +1 -0
- package/FileCanary/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/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.js.map +1 -1
- package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -2
- package/__internal__/src/components/ContextMenu/types.d.ts +3 -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/types.d.ts +1 -0
- package/__internal__/src/components/DatePicker/types.js.map +1 -1
- package/__internal__/src/components/FileCanary/FileCanary.d.ts +1 -0
- package/__internal__/src/components/FileCanary/FileCanary.js +2 -0
- package/__internal__/src/components/FileCanary/FileCanary.js.map +1 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.css +1 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.d.ts +4 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.js +2 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.js.map +1 -0
- package/__internal__/src/components/FileCanary/config.d.ts +2 -0
- package/__internal__/src/components/FileCanary/config.js +2 -0
- package/__internal__/src/components/FileCanary/config.js.map +1 -0
- package/__internal__/src/components/FileCanary/fileCanaryGenerator.d.ts +2 -0
- package/__internal__/src/components/FileCanary/fileCanaryGenerator.js +2 -0
- package/__internal__/src/components/FileCanary/fileCanaryGenerator.js.map +1 -0
- package/__internal__/src/components/FileCanary/index.d.ts +4 -0
- package/__internal__/src/components/FileCanary/index.js +2 -0
- package/__internal__/src/components/FileCanary/index.js.map +1 -0
- package/__internal__/src/components/FileCanary/types.d.ts +25 -0
- package/__internal__/src/components/FileCanary/types.js +2 -0
- package/__internal__/src/components/FileCanary/types.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.js +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelect.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 +1 -1
- 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/SelectMultiple/__test__/SelectMultiple.test.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectMultiple/__test__/SelectMultiple.test.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.d.ts +1 -0
- package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.js +1 -1
- 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/SelectSingle/__test__/SelectSingle.test.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectSingle/__test__/SelectSingle.test.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/Theme/_font/Silkscreen-Regular.woff +0 -0
- package/__internal__/src/components/Theme/_font/Silkscreen-Regular.woff2 +0 -0
- package/__internal__/src/components/Theme/_font/Theme_font_gpnDefault.css +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/package.json +2 -2
|
@@ -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","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":"
|
|
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","container","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 container,\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 container={container}\n >\n {children}\n </Popover>\n );\n },\n);\n"],"mappings":"4RAAA,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,CAgBIF,CAhBJ,CACEE,QADF,CAEEC,CAFF,CAgBIH,CAhBJ,CAEEG,QAFF,CAGEC,CAHF,CAgBIJ,CAhBJ,CAGEI,SAHF,GAgBIJ,CAhBJ,CAIEK,IAJF,CAIEA,CAJF,YAISR,sBAJT,GAKES,CALF,CAgBIN,CAhBJ,CAKEM,cALF,CAMEC,CANF,CAgBIP,CAhBJ,CAMEO,cANF,CAOEC,CAPF,CAgBIR,CAhBJ,CAOEQ,kBAPF,CAQEC,CARF,CAgBIT,CAhBJ,CAQES,SARF,CASEC,CATF,CAgBIV,CAhBJ,CASEU,MATF,CAUEC,CAVF,CAgBIX,CAhBJ,CAUEW,SAVF,CAWEC,CAXF,CAgBIZ,CAhBJ,CAWEY,QAXF,CAYEC,CAZF,CAgBIb,CAhBJ,CAYEa,cAZF,CAaEC,CAbF,CAgBId,CAhBJ,CAaEc,WAbF,CAcEC,CAdF,CAgBIf,CAhBJ,CAcEe,SAdF,CAeKC,CAfL,0BAgBIhB,CAhBJ,YADuE,MAmBnEE,EAnBmE,CAqBnE,2BAAK,SAAS,CAAEE,CAAhB,EACE,yCACE,SAAS,CAAEN,yBAAyB,CAAC,QAAD,CAAW,CAC7CH,UAAU,CAAC,CACTsB,EAAE,CAAExB,gBAAgB,CAACY,CAAD,CADX,CAAD,CADmC,CAAX,CADtC,CAME,GAAG,CAAEJ,CANP,EAOMe,CAPN,EASGb,CATH,CADF,CArBmE,CAsCrE,oBAAC,OAAD,kBACMa,CADN,EAEE,WAAW,CAAEF,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,CAaE,SAAS,CAAEE,CAbb,GAeGZ,CAfH,CAkBH,CAzD8C,CAA1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import"./ContextMenuWrapper.css";import React,{Fragment,useCallback,useRef,useState}from"react";import{Transition}from"react-transition-group";import{cnListBox,mapVerticalSpace}from"../../ListCanary";import{Popover}from"../../Popover";import{useFlag}from"../../../hooks/useFlag";import{useMutableRef}from"../../../hooks/useMutableRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{contextMenuDefaultSize,defaultContextMenuForm}from"../types";var cnContextMenuWrapper=cn("ContextMenuWrapper");export var ContextMenuWrapper=function(a){var b=a.isMobile,c=a.children,d=a.form,e=void 0===d?defaultContextMenuForm:d,f=a.isOpen,g=a.size,h=void 0===g?contextMenuDefaultSize:g,i=a.anchorRef,j=a.possibleDirections,k=a.position,l=a.direction,m=a.spareDirection,n=a.onClickOutside,o=a.offset,p=a.onSetDirection,q=a.className,r=a.animationBack,s=a.
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import"./ContextMenuWrapper.css";import React,{Fragment,useCallback,useRef,useState}from"react";import{Transition}from"react-transition-group";import{cnListBox,mapVerticalSpace}from"../../ListCanary";import{Popover}from"../../Popover";import{useFlag}from"../../../hooks/useFlag";import{useMutableRef}from"../../../hooks/useMutableRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{contextMenuDefaultSize,defaultContextMenuForm}from"../types";var cnContextMenuWrapper=cn("ContextMenuWrapper");export var ContextMenuWrapper=function(a){var b=a.isMobile,c=a.children,d=a.form,e=void 0===d?defaultContextMenuForm:d,f=a.isOpen,g=a.size,h=void 0===g?contextMenuDefaultSize:g,i=a.anchorRef,j=a.possibleDirections,k=a.position,l=a.direction,m=a.spareDirection,n=a.onClickOutside,o=a.offset,p=a.onSetDirection,q=a.className,r=a.animationBack,s=a.container,t=a.style,u=useFlag(b),v=_slicedToArray(u,2),w=v[0],x=v[1],y=useState(l),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useMutableRef(p),D=useRef(null),E=useCallback(function(a){var b;B(a),null===(b=C.current)||void 0===b?void 0:b.call(C,a)},[]);return b?React.createElement(Transition,{timeout:animateTimeout,in:f,unmountOnExit:!0,onEntered:x.on,onExit:x.off,nodeRef:D},function(a){return React.createElement(Popover,{className:cnContextMenuWrapper({animationBack:r,innerAnimation:w},[cnListBox({size:h,form:e,border:!0,shadow:!0}),cnMixSpace({pV:mapVerticalSpace[h]}),cnMixPopoverAnimate({animate:a}),q]),ref:D,anchorRef:i,possibleDirections:j,position:k,direction:A,spareDirection:m,onClickOutside:n,offset:o,onSetDirection:E,container:s,style:t},c)}):React.createElement(Fragment,{key:ContextMenuWrapper.name},c)};
|
|
2
2
|
//# sourceMappingURL=ContextMenuWrapper.js.map
|
package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuWrapper.js","names":["React","Fragment","useCallback","useRef","useState","Transition","cnListBox","mapVerticalSpace","Popover","useFlag","useMutableRef","animateTimeout","cnMixPopoverAnimate","cnMixSpace","cn","contextMenuDefaultSize","defaultContextMenuForm","cnContextMenuWrapper","ContextMenuWrapper","props","isMobile","children","form","isOpen","size","anchorRef","possibleDirections","position","directionProp","direction","spareDirection","onClickOutside","offset","onSetDirectionProp","onSetDirection","className","animationBack","style","innerAnimation","setInnerAnimation","setDirection","onSetDirectionRef","rootRef","current","on","off","animate","border","shadow","pV","name"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.tsx"],"sourcesContent":["import './ContextMenuWrapper.css';\n\nimport React, { Fragment, useCallback, useRef, useState } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { cnListBox, mapVerticalSpace } from '##/components/ListCanary';\nimport { Direction, Popover } from '##/components/Popover';\nimport { useFlag } from '##/hooks/useFlag';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport {\n contextMenuDefaultSize,\n ContextMenuWrapperProps,\n defaultContextMenuForm,\n} from '../types';\n\nconst cnContextMenuWrapper = cn('ContextMenuWrapper');\n\nexport const ContextMenuWrapper = (props: ContextMenuWrapperProps) => {\n const {\n isMobile,\n children,\n form = defaultContextMenuForm,\n isOpen,\n size = contextMenuDefaultSize,\n anchorRef,\n possibleDirections,\n position,\n direction: directionProp,\n spareDirection,\n onClickOutside,\n offset,\n onSetDirection: onSetDirectionProp,\n className,\n animationBack,\n style,\n } = props;\n\n const [innerAnimation, setInnerAnimation] = useFlag(isMobile);\n // запоминаем позицию последнего удовлетворяющего разворота,\n // для того чтоб следующий экран разворачивался в эту же строну.\n const [direction, setDirection] = useState(directionProp);\n\n const onSetDirectionRef = useMutableRef(onSetDirectionProp);\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const onSetDirection = useCallback((direction: Direction) => {\n setDirection(direction);\n onSetDirectionRef.current?.(direction);\n }, []);\n\n if (isMobile) {\n return (\n <Transition\n timeout={animateTimeout}\n in={isOpen}\n unmountOnExit\n onEntered={setInnerAnimation.on}\n onExit={setInnerAnimation.off}\n nodeRef={rootRef}\n >\n {(animate) => (\n <Popover\n className={cnContextMenuWrapper({ animationBack, innerAnimation }, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixPopoverAnimate({ animate }),\n className,\n ])}\n ref={rootRef}\n anchorRef={anchorRef}\n possibleDirections={possibleDirections}\n position={position}\n direction={direction}\n spareDirection={spareDirection}\n onClickOutside={onClickOutside}\n offset={offset}\n onSetDirection={onSetDirection}\n style={style}\n >\n {children}\n </Popover>\n )}\n </Transition>\n );\n }\n\n return <Fragment key={ContextMenuWrapper.name}>{children}</Fragment>;\n};\n"],"mappings":"iEAAA,iCAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,WAA1B,CAAuCC,MAAvC,CAA+CC,QAA/C,KAA+D,OAA/D,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OAASC,SAAT,CAAoBC,gBAApB,wBACA,OAAoBC,OAApB,qBACA,OAASC,OAAT,8BACA,OAASC,aAAT,oCACA,OAASC,cAAT,CAAyBC,mBAAzB,uCACA,OAASC,UAAT,8BACA,OAASC,EAAT,0BAEA,OACEC,sBADF,CAGEC,sBAHF,gBAMA,GAAMC,qBAAoB,CAAGH,EAAE,CAAC,oBAAD,CAA/B,CAEA,MAAO,IAAMI,mBAAkB,CAAG,SAACC,CAAD,CAAoC,IAElEC,EAFkE,
|
|
1
|
+
{"version":3,"file":"ContextMenuWrapper.js","names":["React","Fragment","useCallback","useRef","useState","Transition","cnListBox","mapVerticalSpace","Popover","useFlag","useMutableRef","animateTimeout","cnMixPopoverAnimate","cnMixSpace","cn","contextMenuDefaultSize","defaultContextMenuForm","cnContextMenuWrapper","ContextMenuWrapper","props","isMobile","children","form","isOpen","size","anchorRef","possibleDirections","position","directionProp","direction","spareDirection","onClickOutside","offset","onSetDirectionProp","onSetDirection","className","animationBack","container","style","innerAnimation","setInnerAnimation","setDirection","onSetDirectionRef","rootRef","current","on","off","animate","border","shadow","pV","name"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.tsx"],"sourcesContent":["import './ContextMenuWrapper.css';\n\nimport React, { Fragment, useCallback, useRef, useState } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { cnListBox, mapVerticalSpace } from '##/components/ListCanary';\nimport { Direction, Popover } from '##/components/Popover';\nimport { useFlag } from '##/hooks/useFlag';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport {\n contextMenuDefaultSize,\n ContextMenuWrapperProps,\n defaultContextMenuForm,\n} from '../types';\n\nconst cnContextMenuWrapper = cn('ContextMenuWrapper');\n\nexport const ContextMenuWrapper = (props: ContextMenuWrapperProps) => {\n const {\n isMobile,\n children,\n form = defaultContextMenuForm,\n isOpen,\n size = contextMenuDefaultSize,\n anchorRef,\n possibleDirections,\n position,\n direction: directionProp,\n spareDirection,\n onClickOutside,\n offset,\n onSetDirection: onSetDirectionProp,\n className,\n animationBack,\n container,\n style,\n } = props;\n\n const [innerAnimation, setInnerAnimation] = useFlag(isMobile);\n // запоминаем позицию последнего удовлетворяющего разворота,\n // для того чтоб следующий экран разворачивался в эту же строну.\n const [direction, setDirection] = useState(directionProp);\n\n const onSetDirectionRef = useMutableRef(onSetDirectionProp);\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const onSetDirection = useCallback((direction: Direction) => {\n setDirection(direction);\n onSetDirectionRef.current?.(direction);\n }, []);\n\n if (isMobile) {\n return (\n <Transition\n timeout={animateTimeout}\n in={isOpen}\n unmountOnExit\n onEntered={setInnerAnimation.on}\n onExit={setInnerAnimation.off}\n nodeRef={rootRef}\n >\n {(animate) => (\n <Popover\n className={cnContextMenuWrapper({ animationBack, innerAnimation }, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixPopoverAnimate({ animate }),\n className,\n ])}\n ref={rootRef}\n anchorRef={anchorRef}\n possibleDirections={possibleDirections}\n position={position}\n direction={direction}\n spareDirection={spareDirection}\n onClickOutside={onClickOutside}\n offset={offset}\n onSetDirection={onSetDirection}\n container={container}\n style={style}\n >\n {children}\n </Popover>\n )}\n </Transition>\n );\n }\n\n return <Fragment key={ContextMenuWrapper.name}>{children}</Fragment>;\n};\n"],"mappings":"iEAAA,iCAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,WAA1B,CAAuCC,MAAvC,CAA+CC,QAA/C,KAA+D,OAA/D,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OAASC,SAAT,CAAoBC,gBAApB,wBACA,OAAoBC,OAApB,qBACA,OAASC,OAAT,8BACA,OAASC,aAAT,oCACA,OAASC,cAAT,CAAyBC,mBAAzB,uCACA,OAASC,UAAT,8BACA,OAASC,EAAT,0BAEA,OACEC,sBADF,CAGEC,sBAHF,gBAMA,GAAMC,qBAAoB,CAAGH,EAAE,CAAC,oBAAD,CAA/B,CAEA,MAAO,IAAMI,mBAAkB,CAAG,SAACC,CAAD,CAAoC,IAElEC,EAFkE,CAmBhED,CAnBgE,CAElEC,QAFkE,CAGlEC,CAHkE,CAmBhEF,CAnBgE,CAGlEE,QAHkE,GAmBhEF,CAnBgE,CAIlEG,IAJkE,CAIlEA,CAJkE,YAI3DN,sBAJ2D,GAKlEO,CALkE,CAmBhEJ,CAnBgE,CAKlEI,MALkE,GAmBhEJ,CAnBgE,CAMlEK,IANkE,CAMlEA,CANkE,YAM3DT,sBAN2D,GAOlEU,CAPkE,CAmBhEN,CAnBgE,CAOlEM,SAPkE,CAQlEC,CARkE,CAmBhEP,CAnBgE,CAQlEO,kBARkE,CASlEC,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AAbA,CAAF,CAAiBG,cAAc,CAAdA,CAAjB,CAAD,CAAoC,CACjEjC,SAAS,CAAC,CAAEkB,IAAI,CAAJA,CAAF,CAAQF,IAAI,CAAJA,CAAR,CAAc0B,MAAM,GAApB,CAA4BC,MAAM,GAAlC,CAAD,CADwD,CAEjEpC,UAAU,CAAC,CACTqC,EAAE,CAAE3C,gBAAgB,CAACiB,CAAD,CADX,CAAD,CAFuD,CAKjEZ,mBAAmB,CAAC,CAAEmC,OAAO,CAAPA,CAAF,CAAD,CAL8C,CAMjEZ,CANiE,CAApC,CADjC,CASE,GAAG,CAAEQ,CATP,CAUE,SAAS,CAAElB,CAVb,CAWE,kBAAkB,CAAEC,CAXtB,CAYE,QAAQ,CAAEC,CAZZ,CAaE,SAAS,CAAEE,CAbb,CAcE,cAAc,CAAEC,CAdlB,CAeE,cAAc,CAAEC,CAflB,CAgBE,MAAM,CAAEC,CAhBV,CAiBE,cAAc,CAAEE,CAjBlB,CAkBE,SAAS,CAAEG,CAlBb,CAmBE,KAAK,CAAEC,CAnBT,EAqBGjB,CArBH,CADD,CARH,CArCgE,CA0E7D,oBAAC,QAAD,EAAU,GAAG,CAAEH,kBAAkB,CAACiC,IAAlC,EAAyC9B,CAAzC,CACR,CA3EM"}
|
|
@@ -17,10 +17,11 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
17
17
|
isMobile?: boolean;
|
|
18
18
|
onEsc?: React.KeyboardEventHandler;
|
|
19
19
|
viewportRef?: React.RefObject<HTMLElement>;
|
|
20
|
+
container?: Element;
|
|
20
21
|
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
21
22
|
anchorRef: React.RefObject<HTMLElement>;
|
|
22
23
|
position?: never;
|
|
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 {
|
|
24
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "direction" | "position" | "offset" | "onItemClick" | "sortGroup" | "container" | "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 {
|
|
24
25
|
id: ContextMenuGroupDefault["id"] | unknown;
|
|
25
26
|
} ? {} : {
|
|
26
27
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -65,10 +66,11 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
65
66
|
isMobile?: boolean;
|
|
66
67
|
onEsc?: React.KeyboardEventHandler;
|
|
67
68
|
viewportRef?: React.RefObject<HTMLElement>;
|
|
69
|
+
container?: Element;
|
|
68
70
|
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
69
71
|
anchorRef?: never;
|
|
70
72
|
position: import("../Popover").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 {
|
|
73
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "direction" | "position" | "offset" | "onItemClick" | "sortGroup" | "container" | "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 {
|
|
72
74
|
id: ContextMenuGroupDefault["id"] | unknown;
|
|
73
75
|
} ? {} : {
|
|
74
76
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -119,6 +119,7 @@ export type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuG
|
|
|
119
119
|
isMobile?: boolean;
|
|
120
120
|
onEsc?: React.KeyboardEventHandler;
|
|
121
121
|
viewportRef?: React.RefObject<HTMLElement>;
|
|
122
|
+
container?: Element;
|
|
122
123
|
} & MappersItem<ITEM> & MappersGroup<GROUP> & PositioningProps, HTMLDivElement> & (GROUP extends {
|
|
123
124
|
id: ContextMenuGroupDefault['id'] | unknown;
|
|
124
125
|
} ? {} : {
|
|
@@ -177,6 +178,7 @@ export type ContextMenuWrapperProps = PropsWithHTMLAttributes<{
|
|
|
177
178
|
onSetDirection?: (direction: Direction) => void;
|
|
178
179
|
className?: string;
|
|
179
180
|
animationBack?: boolean;
|
|
181
|
+
container?: Element;
|
|
180
182
|
}, HTMLDivElement>;
|
|
181
183
|
export type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<{
|
|
182
184
|
children: React.ReactNode;
|
|
@@ -191,5 +193,6 @@ export type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<{
|
|
|
191
193
|
position?: Position;
|
|
192
194
|
onSetDirection?: (direction: Direction) => void;
|
|
193
195
|
viewportRef?: React.RefObject<HTMLElement>;
|
|
196
|
+
container?: Element;
|
|
194
197
|
}, HTMLDivElement>;
|
|
195
198
|
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 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"}
|
|
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 container?: Element;\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 container?: Element;\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 container?: Element;\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"}
|
|
@@ -27,6 +27,7 @@ export type DatePickerDropdownProps = PropsWithHTMLAttributesAndRef<{
|
|
|
27
27
|
timeFor?: 'start' | 'end';
|
|
28
28
|
disableDates?: DateTimePropDisableDates;
|
|
29
29
|
viewportRef?: React.RefObject<HTMLElement>;
|
|
30
|
+
container?: Element;
|
|
30
31
|
}, HTMLDivElement>;
|
|
31
32
|
type DatePickerDropdownComponent = (props: DatePickerDropdownProps) => React.ReactNode | null;
|
|
32
33
|
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","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),
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","anchorRef","isOpen","className","zIndex","renderAdditionalControls","viewportRef","container"];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=a.container,l=_objectWithoutProperties(a,_excluded),m=useRef(null),n=useState(),o=_slicedToArray(n,2),p=o[0],q=o[1],r=useFlag(!0),s=_slicedToArray(r,2),t=s[0],u=s[1],v=useCallback(function(b){b===moveMap[a.type]?u.on():u.off()},[a.type]),w=useForkRef([b,m]);return React.createElement(Transition,{in:f,unmountOnExit:!0,timeout:animateTimeout,nodeRef:m},function(b){return React.createElement(Popover,{ref:w,anchorRef:e,className:cnDatePickerDropdown({form:d},[g,cnMixPopoverAnimate({direction:p,animate:b})]),direction:"downStartLeft",spareDirection:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],style:{zIndex:h},role:"listbox",onSetDirection:q,viewportRef:j,container:k},React.createElement(DateTime,Object.assign({},l,{onMove:v})),t&&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","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":"
|
|
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","container","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 container?: Element;\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 container,\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 container={container}\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":"4QAAA,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,GAwCMC,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,OAWnBD,CAXmB,CAErBE,IAFqB,CAErBA,CAFqB,YAEdN,iCAFc,GAGrBO,CAHqB,CAWnBH,CAXmB,CAGrBG,SAHqB,CAIrBC,CAJqB,CAWnBJ,CA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AFkB,CAGlB,gBAHkB,CAIlB,cAJkB,CATtB,CAeE,KAAK,CAAE,CAAEhB,MAAM,CAANA,CAAF,CAfT,CAgBE,IAAI,CAAC,SAhBP,CAiBE,cAAc,CAAEO,CAjBlB,CAkBE,WAAW,CAAEL,CAlBf,CAmBE,SAAS,CAAEC,CAnBb,EAqBE,oBAAC,QAAD,kBAAcC,CAAd,EAA0B,MAAM,CAAEM,CAAlC,GArBF,CAsBGF,CAAyB,EACxB,oBAAC,4BAAD,EACE,kBAAkB,CAAEd,CAAK,CAACuB,kBAD5B,CAEE,wBAAwB,CAAEhB,CAF5B,CAGE,IAAI,CAAEP,CAAK,CAACkB,IAHd,CAIE,IAAI,CAAElB,CAAK,CAACwB,IAJd,EAvBJ,CAgCH,CAxCH,CA2CH,CA3EsE,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","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),
|
|
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","dropdownContainer"];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=a.dropdownContainer,u=_objectWithoutProperties(a,_excluded),v=useRef(null),w=useRef(null),x=useRef(null),y=useCalendarVisible({dropdownOpen:n,onDropdownOpen:m,disabled:p,startRef:x}),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useCurrentVisibleDate({currentVisibleDate:j,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:k,calendarVisible:A}),D=_slicedToArray(C,2),E=D[0],F=D[1];return useEffect(function(){b&&setRef(b,v.current)},[b,v]),useEffect(function(){if(a.value&&"classic"===e&&E){var b=startOfMonth(a.value);return void(b.getTime()!==E.getTime()&&F(b))}if(a.value&&"classic"!==e&&E){var c=startOfMonth(a.value);c.getTime()!==E.getTime()&&c.getTime()!==addMonths(E,1).getTime()&&F(c)}},[a.value]),useClickOutside({isActive:A,ignoreClicksInsideRefs:[v,w].concat(_toConsumableArray(null!==o&&void 0!==o?o:[])),handler:B.off}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeDate,Object.assign({},u,{disabled:p,ref:v,inputRef:useForkRef([x,r]),onClick:B.on})),React.createElement(DatePickerDropdown,{ref:useForkRef([h,w]),viewportRef:s,anchorRef:v,isOpen:A,value:a.value||void 0,type:"date",view:e,events:c,locale:f,minDate:a.minDate,className:g,maxDate:a.maxDate,currentVisibleDate:E,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)),B.off()},renderAdditionalControls:l,disableDates:q,zIndex:getDropdownZIndex(a.style),onChangeCurrentVisibleDate:F,container:t}))});
|
|
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","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":"
|
|
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","dropdownContainer","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 dropdownContainer,\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 container={dropdownContainer}\n />\n </>\n );\n },\n);\n"],"mappings":"uhBAAA,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,CAoBVF,CApBU,CAEZE,MAFY,GAoBVF,CApBU,CAGZG,YAHY,CAGZA,CAHY,YAGGP,iCAHH,GAIZQ,CAJY,CAoBVJ,CApBU,CAIZI,MAJY,CAKZC,CALY,CAoBVL,CApBU,CAKZK,iBALY,CAMZC,CANY,CAoBVN,CApBU,CAMZM,WANY,CAOZC,CAPY,CAoBVP,CApBU,CAOZO,YAPY,CAQQC,CARR,CAoBVR,CApBU,CAQZS,kBARY,CASZC,CATY,CAoBVV,CApBU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AAd,CAAD,CADjB,CAEE,WAAW,CAAEJ,CAFf,CAGE,SAAS,CAAEG,CAHb,CAIE,MAAM,CAAEG,CAJV,CAKE,KAAK,CAAEzB,CAAK,CAAC6B,KAAN,QALT,CAME,IAAI,CAAC,MANP,CAOE,IAAI,CAAE1B,CAPR,CAQE,MAAM,CAAED,CARV,CASE,MAAM,CAAEE,CATV,CAUE,OAAO,CAAEJ,CAAK,CAAC4B,OAVjB,CAWE,SAAS,CAAEvB,CAXb,CAYE,OAAO,CAAEL,CAAK,CAAC2B,OAZjB,CAaE,kBAAkB,CAAElB,CAbtB,CAcE,IAAI,CAAEF,CAdR,CAeE,QAAQ,CAAE,mBAAa,8BAATiC,CAAS,sBAATA,CAAS,2BACrBxC,CAAK,CAACyC,QADe,qBACrB,gBAAAzC,CAAK,QAAL,CAAoBwC,CAApB,EADqB,CAErBd,CAAkB,CAACY,GAAnB,EACD,CAlBH,CAmBE,wBAAwB,CAAE3B,CAnB5B,CAoBE,YAAY,CAAEK,CApBhB,CAqBE,MAAM,CAAErB,iBAAiB,CAACK,CAAK,CAAC0C,KAAP,CArB3B,CAsBE,0BAA0B,CAAEX,CAtB9B,CAuBE,SAAS,CAAEX,CAvBb,EARF,CAmCH,CApH0E,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","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),
|
|
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","dropdownContainer"];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=a.dropdownContainer,E=_objectWithoutProperties(a,_excluded),F=useRef(null),G=useRef(null),H=useRef(null),I=useRef(null),J=useRef(null),K=useState(),L=_slicedToArray(K,2),M=L[0],N=L[1],O=0===M,P=1===M,Q=useCalendarVisible({dropdownOpen:y,onDropdownOpen:x,disabled:A,startRef:H,endRef:I}),R=_slicedToArray(Q,2),S=R[0],T=R[1],U=useCurrentVisibleDate({currentVisibleDate:p,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:q,calendarVisible:S,rangeIndex:M}),V=_slicedToArray(U,2),W=V[0],X=V[1];return useEffect(function(){var b,c;if(null!==(b=a.value)&&void 0!==b&&b[0]&&"classic"===i&&O){var d=startOfMonth(a.value[0]);return void(d.getTime()!==(null===W||void 0===W?void 0:W.getTime())&&X(d))}if(null!==(c=a.value)&&void 0!==c&&c[0]&&"classic"!==i&&O){var e=startOfMonth(a.value[0]);e.getTime()!==(null===W||void 0===W?void 0:W.getTime())&&e.getTime()!==(W&&addMonths(W,1).getTime())&&X(e)}},[null===(c=a.value)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.getTime(),S,O]),useEffect(function(){var b,c;if(null!==(b=a.value)&&void 0!==b&&b[1]&&"classic"===i&&P){var d=startOfMonth(a.value[1]);return void(d.getTime()!==(null===W||void 0===W?void 0:W.getTime())&&X(d))}if(null!==(c=a.value)&&void 0!==c&&c[1]&&"classic"!==i&&P){var e=startOfMonth(a.value[1]);e.getTime()!==(null===W||void 0===W?void 0:W.getTime())&&e.getTime()!==(W&&addMonths(W,1).getTime())&&X(addMonths(e,-1))}},[null===(e=a.value)||void 0===e||null===(f=e[1])||void 0===f?void 0:f.getTime(),S,P]),useClickOutside({isActive:S,ignoreClicksInsideRefs:[F,G,J].concat(_toConsumableArray(null!==z&&void 0!==z?z:[])),handler:useCallback(function(){N(void 0),T.off()},[])}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeDateRange,Object.assign({},E,{ref:b,startFieldRef:F,endFieldRef:G,startFieldInputRef:useForkRef([H,null===s||void 0===s?void 0:s[0]]),endFieldInputRef:useForkRef([I,null===s||void 0===s?void 0:s[1]]),startFieldOnFocus:function startFieldOnFocusHandler(a){var b;N(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;N(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:T.on,endFieldOnClick:T.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:O,endFocused:P,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,J]),viewportRef:C,anchorRef:F,className:t,isOpen:S,onChangeCurrentVisibleDate:X,currentVisibleDate:W,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(O){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(P){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,container:D}))});
|
|
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","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,qBA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CAAED,CAXV,CAYE,MAAM,CAAEE,CAZV,CAaE,OAAO,CAAEJ,CAAK,CAACwC,OAbjB,CAcE,OAAO,CAAExC,CAAK,CAACuC,OAdjB,CAeE,IAAI,CAAElC,CAfR,CAgBE,QAAQ,CA9JuC,QAA/CsD,aAA+C,CAAClB,CAAD,GAAkB,IAARW,EAAQ,GAARA,CAAQ,CACrE,GAAInB,CAAJ,CAAkB,SACV2B,CAAQ,CAAGjE,mBAAmB,CAAC,CAAC8C,CAAD,QAAQzC,CAAR,WAAQA,CAAR,YAAQA,CAAK,CAAEyC,KAAf,qBAAQ,EAAe,CAAf,CAAR,CAAD,CADpB,WAEhBzC,CAAK,CAAC6D,QAFU,qBAEhB,OAAA7D,CAAK,CAAY4D,CAAZ,CAAsB,CACzBR,CAAC,CAADA,CADyB,CAAtB,CAGN,CACD,GAAIlB,CAAJ,CAAgB,SACR0B,CAAQ,CAAGjE,mBAAmB,CAAC,QAACK,CAAD,WAACA,CAAD,YAACA,CAAK,CAAEyC,KAAR,qBAAC,EAAe,CAAf,CAAD,CAAoBA,CAApB,CAAD,CADtB,WAEdzC,CAAK,CAAC6D,QAFQ,qBAEd,OAAA7D,CAAK,CAAY4D,CAAZ,CAAsB,CACzBR,CAAC,CAADA,CADyB,CAAtB,CAGN,CACF,CAiIG,CAiBE,wBAAwB,CAAEvC,CAjB5B,CAkBE,MAAM,CAAEpB,iBAAiB,CAACO,CAAK,CAAC8D,KAAP,CAlB3B,CAmBE,YAAY,CAAEvC,CAnBhB,EApCF,CA2DH,CA3MS,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","dropdownContainer","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 dropdownContainer,\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 container={dropdownContainer}\n />\n </>\n );\n });\n"],"mappings":"slBAAA,MAAOA,UAAP,KAAsB,oBAAtB,CACA,MAAOC,aAAP,KAAyB,uBAAzB,CACA,MAAOC,MAAP,EACEC,UADF,CAEEC,WAFF,CAGEC,SAHF,CAIEC,MAJF,CAKEC,Q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,EApCF,CA4DH,CA7MS,CADL"}
|
package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.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","dropdownClassName","dropdownRef","currentVisibleDate","onChangeCurrentVisibleDate","timeOptions","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","inputRef","disableDates","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/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{setRef}from"../../../utils/setRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDateTime}from"../DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime";import{datePickerPropFormatTypeDateTime,getDropdownZIndex,getTimeOptionsByFormat}from"../helpers";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDateTime=forwardRef(function(a,b){var c=a.events,d=a.dateTimeView,e=a.locale,f=a.dropdownForm,g=a.dropdownClassName,h=a.dropdownRef,i=a.currentVisibleDate,j=a.onChangeCurrentVisibleDate,k=a.timeOptions,l=a.renderAdditionalControls,m=a.onDropdownOpen,n=a.dropdownOpen,o=a.ignoreOutsideClicksRefs,p=a.disabled,q=a.inputRef,r=a.disableDates,s=a.dropdownViewportRef,t=_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","dropdownClassName","dropdownRef","currentVisibleDate","onChangeCurrentVisibleDate","timeOptions","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","inputRef","disableDates","dropdownViewportRef","dropdownContainer"];import addMonths from"date-fns/addMonths";import startOfMonth from"date-fns/startOfMonth";import React,{forwardRef,useEffect,useRef}from"react";import{useClickOutside}from"../../../hooks/useClickOutside/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{setRef}from"../../../utils/setRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDateTime}from"../DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime";import{datePickerPropFormatTypeDateTime,getDropdownZIndex,getTimeOptionsByFormat}from"../helpers";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDateTime=forwardRef(function(a,b){var c=a.events,d=a.dateTimeView,e=a.locale,f=a.dropdownForm,g=a.dropdownClassName,h=a.dropdownRef,i=a.currentVisibleDate,j=a.onChangeCurrentVisibleDate,k=a.timeOptions,l=a.renderAdditionalControls,m=a.onDropdownOpen,n=a.dropdownOpen,o=a.ignoreOutsideClicksRefs,p=a.disabled,q=a.inputRef,r=a.disableDates,s=a.dropdownViewportRef,t=a.dropdownContainer,u=_objectWithoutProperties(a,_excluded),v=getTimeOptionsByFormat(u.format||datePickerPropFormatTypeDateTime,k),w=useRef(null),x=useRef(null),y=useRef(null),z=useCalendarVisible({dropdownOpen:n,onDropdownOpen:m,disabled:p,startRef:y}),A=_slicedToArray(z,2),B=A[0],C=A[1],D=useCurrentVisibleDate({currentVisibleDate:i,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:j,calendarVisible:B}),E=_slicedToArray(D,2),F=E[0],G=E[1];return useEffect(function(){b&&setRef(b,w.current)},[b,w]),useEffect(function(){if(a.value&&"classic"===d&&F){var b=startOfMonth(a.value);return void(b.getTime()!==F.getTime()&&G(b))}if(a.value&&"classic"!==d&&F){var c=startOfMonth(a.value);c.getTime()!==F.getTime()&&c.getTime()!==addMonths(F,1).getTime()&&G(c)}},[a.value]),useClickOutside({isActive:B,ignoreClicksInsideRefs:[w,x].concat(_toConsumableArray(null!==o&&void 0!==o?o:[])),handler:C.off}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeDateTime,Object.assign({},u,{ref:w,inputRef:useForkRef([y,q]),onClick:C.on,timeOptions:v,disabled:p})),React.createElement(DatePickerDropdown,{ref:useForkRef([h,x]),viewportRef:s,anchorRef:w,isOpen:B,value:a.value||void 0,type:"date-time",view:"classic",events:c,className:g,locale:e,minDate:a.minDate,maxDate:a.maxDate,currentVisibleDate:F,form:f,onChange:a.onChange,renderAdditionalControls:l,onChangeCurrentVisibleDate:G,timeOptions:v,zIndex:getDropdownZIndex(a.style),disableDates:r,container:t}))});
|
|
2
2
|
//# sourceMappingURL=DatePickerTypeDateTime.js.map
|
package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerTypeDateTime.js","names":["addMonths","startOfMonth","React","forwardRef","useEffect","useRef","useClickOutside","useForkRef","setRef","DatePickerDropdown","DatePickerFieldTypeDateTime","datePickerPropFormatTypeDateTime","getDropdownZIndex","getTimeOptionsByFormat","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDateTime","props","ref","events","dateTimeView","locale","dropdownForm","dropdownClassName","dropdownRef","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","timeOptionsProp","timeOptions","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","inputRefProp","inputRef","disableDates","dropdownViewportRef","otherProps","format","fieldRef","calendarRef","startRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","current","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","on","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.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/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { setRef } from '##/utils/setRef';\n\nimport { DatePickerDropdown } from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDateTime } from '../DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime';\nimport {\n datePickerPropFormatTypeDateTime,\n getDropdownZIndex,\n getTimeOptionsByFormat,\n} from '../helpers';\nimport { DatePickerTypeComponent } from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDateTime: DatePickerTypeComponent<'date-time'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView,\n locale,\n dropdownForm,\n dropdownClassName,\n dropdownRef,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n timeOptions: timeOptionsProp,\n renderAdditionalControls,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n inputRef: inputRefProp,\n disableDates,\n dropdownViewportRef,\n ...otherProps\n } = props;\n\n const timeOptions = getTimeOptionsByFormat(\n otherProps.format || datePickerPropFormatTypeDateTime,\n timeOptionsProp,\n );\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 <DatePickerFieldTypeDateTime\n {...otherProps}\n ref={fieldRef}\n inputRef={useForkRef([inputRef, inputRefProp])}\n onClick={setCalendarVisible.on}\n timeOptions={timeOptions}\n disabled={disabled}\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-time\"\n view=\"classic\"\n events={events}\n className={dropdownClassName}\n locale={locale}\n minDate={props.minDate}\n maxDate={props.maxDate}\n currentVisibleDate={currentVisibleDate}\n form={dropdownForm}\n onChange={props.onChange}\n renderAdditionalControls={renderAdditionalControls}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n timeOptions={timeOptions}\n zIndex={getDropdownZIndex(props.style)}\n disableDates={disableDates}\n />\n </>\n );\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePickerTypeDateTime.js","names":["addMonths","startOfMonth","React","forwardRef","useEffect","useRef","useClickOutside","useForkRef","setRef","DatePickerDropdown","DatePickerFieldTypeDateTime","datePickerPropFormatTypeDateTime","getDropdownZIndex","getTimeOptionsByFormat","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDateTime","props","ref","events","dateTimeView","locale","dropdownForm","dropdownClassName","dropdownRef","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","timeOptionsProp","timeOptions","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","inputRefProp","inputRef","disableDates","dropdownViewportRef","dropdownContainer","otherProps","format","fieldRef","calendarRef","startRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","current","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","on","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.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/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { setRef } from '##/utils/setRef';\n\nimport { DatePickerDropdown } from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDateTime } from '../DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime';\nimport {\n datePickerPropFormatTypeDateTime,\n getDropdownZIndex,\n getTimeOptionsByFormat,\n} from '../helpers';\nimport { DatePickerTypeComponent } from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDateTime: DatePickerTypeComponent<'date-time'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView,\n locale,\n dropdownForm,\n dropdownClassName,\n dropdownRef,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n timeOptions: timeOptionsProp,\n renderAdditionalControls,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n inputRef: inputRefProp,\n disableDates,\n dropdownViewportRef,\n dropdownContainer,\n ...otherProps\n } = props;\n\n const timeOptions = getTimeOptionsByFormat(\n otherProps.format || datePickerPropFormatTypeDateTime,\n timeOptionsProp,\n );\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 <DatePickerFieldTypeDateTime\n {...otherProps}\n ref={fieldRef}\n inputRef={useForkRef([inputRef, inputRefProp])}\n onClick={setCalendarVisible.on}\n timeOptions={timeOptions}\n disabled={disabled}\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-time\"\n view=\"classic\"\n events={events}\n className={dropdownClassName}\n locale={locale}\n minDate={props.minDate}\n maxDate={props.maxDate}\n currentVisibleDate={currentVisibleDate}\n form={dropdownForm}\n onChange={props.onChange}\n renderAdditionalControls={renderAdditionalControls}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n timeOptions={timeOptions}\n zIndex={getDropdownZIndex(props.style)}\n disableDates={disableDates}\n container={dropdownContainer}\n />\n </>\n );\n });\n"],"mappings":"qiBAAA,MAAOA,UAAP,KAAsB,oBAAtB,CACA,MAAOC,aAAP,KAAyB,uBAAzB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,MAAvC,KAAqD,OAArD,CAEA,OAASC,eAAT,sDACA,OAASC,UAAT,iCACA,OAASC,MAAT,6BAEA,OAASC,kBAAT,gDACA,OAASC,2BAAT,kEACA,OACEC,gCADF,CAEEC,iBAFF,CAGEC,sBAHF,kBAMA,OAASC,kBAAT,6BACA,OAASC,qBAAT,gCAEA,MAAO,IAAMC,uBAA4D,CACvEb,UAAU,CAAC,SAACc,CAAD,CAAQC,CAAR,CAAgB,IAEvBC,EAFuB,CAqBrBF,CArBqB,CAEvBE,MAFuB,CAGvBC,CAHuB,CAqBrBH,CArBqB,CAGvBG,YAHuB,CAIvBC,CAJuB,CAqBrBJ,CArBqB,CAIvBI,MAJuB,CAKvBC,CALuB,CAqBrBL,CArBqB,CAKvBK,YALuB,CAMvBC,CANuB,CAqBrBN,CArBqB,CAMvBM,iBANuB,CAOvBC,CAPuB,CAqBrBP,CArBqB,CAOvBO,WAPuB,CAQHC,CARG,CAqBrBR,CArBqB,CAQvBS,kBARuB,CASvBC,CATuB,CAqBrBV,CArB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