@consta/uikit 5.24.1 → 5.25.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.
Files changed (37) hide show
  1. package/AutoCompleteCanary/index.d.ts +1 -0
  2. package/AutoCompleteCanary/index.js +1 -0
  3. package/Banner/index.d.ts +1 -0
  4. package/Banner/index.js +1 -0
  5. package/__internal__/src/components/Attachment/Attachment.js +1 -1
  6. package/__internal__/src/components/Attachment/Attachment.js.map +1 -1
  7. package/__internal__/src/components/AutoCompleteCanary/{AutoComplete.js → AutoCompleteCanary.js} +1 -1
  8. package/__internal__/src/components/AutoCompleteCanary/AutoCompleteCanary.js.map +1 -0
  9. package/__internal__/src/components/AutoCompleteCanary/index.d.ts +1 -1
  10. package/__internal__/src/components/AutoCompleteCanary/index.js +1 -1
  11. package/__internal__/src/components/AutoCompleteCanary/index.js.map +1 -1
  12. package/__internal__/src/components/Banner/Banner.css +1 -0
  13. package/__internal__/src/components/Banner/Banner.d.ts +32 -0
  14. package/__internal__/src/components/Banner/Banner.js +2 -0
  15. package/__internal__/src/components/Banner/Banner.js.map +1 -0
  16. package/__internal__/src/components/Banner/index.d.ts +1 -0
  17. package/__internal__/src/components/Banner/index.js +2 -0
  18. package/__internal__/src/components/Banner/index.js.map +1 -0
  19. package/__internal__/src/components/Button/Button.js +1 -1
  20. package/__internal__/src/components/Button/Button.js.map +1 -1
  21. package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js +1 -1
  22. package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js.map +1 -1
  23. package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js +1 -1
  24. package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js.map +1 -1
  25. package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js +1 -1
  26. package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js.map +1 -1
  27. package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js +1 -1
  28. package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js.map +1 -1
  29. package/__internal__/src/components/FieldComponents/FieldArrayValueInlineControl/FieldArrayValueInlineControl.js +1 -1
  30. package/__internal__/src/components/FieldComponents/FieldArrayValueInlineControl/FieldArrayValueInlineControl.js.map +1 -1
  31. package/__internal__/src/components/FieldComponents/FieldControlLayout/FieldControlLayout.css +1 -1
  32. package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArray/TextFieldTypeTextArray.css +1 -1
  33. package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArray/TextFieldTypeTextArray.js +1 -1
  34. package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArray/TextFieldTypeTextArray.js.map +1 -1
  35. package/package.json +1 -1
  36. package/__internal__/src/components/AutoCompleteCanary/AutoComplete.js.map +0 -1
  37. /package/__internal__/src/components/AutoCompleteCanary/{AutoComplete.d.ts → AutoCompleteCanary.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/components/AutoCompleteCanary";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/components/AutoCompleteCanary";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/components/Banner";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/components/Banner";
@@ -1,2 +1,2 @@
1
- import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","as","fileExtension","withPictogram","loading","fileName","errorText","loadingText","loadingProgress","fileDescription","size","onClick","actions","buttonTitle","buttonIcon","onButtonClick"];import"./Attachment.css";import React from"react";import{Button}from"../Button";import{File}from"../File";import{Text}from"../Text";import{cnMixFlex}from"../../mixs/MixFlex";import{cn}from"../../utils/bem";import{isDefined}from"../../utils/type-guards";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{attachmentPropSizeDefault}from"./types";var cnAttachment=cn("Attachment"),fileSizeMap={xs:"s",s:"s",m:"m"},textSizeMap={xs:"xs",s:"s",m:"s"},descriptionSizeMap={xs:"xs",s:"xs",m:"s"},Attachment=forwardRefWithAs(function(a,b){var c=a.className,d=a.as,e=void 0===d?"div":d,f=a.fileExtension,g=a.withPictogram,h=a.loading,i=a.fileName,j=a.errorText,k=a.loadingText,l=void 0===k?"Loading":k,m=a.loadingProgress,n=a.fileDescription,o=a.size,p=void 0===o?attachmentPropSizeDefault:o,q=a.onClick,r=a.actions,s=void 0===r?[]:r,t=a.buttonTitle,u=a.buttonIcon,v=a.onButtonClick,w=_objectWithoutProperties(a,_excluded),x=[v&&u?{onClick:v,icon:u,title:t}:void 0].concat(_toConsumableArray(s)).filter(isDefined),y=!(!(null!==x&&void 0!==x)||!x.length);return React.createElement(e,Object.assign({},w,{onClick:q,className:cnAttachment({size:p,hoverEffect:!!((null===x||void 0===x?void 0:x.length)||q),cursor:q?"pointer":void 0,withActions:y,error:!!j},[cnMixFlex({flex:"flex",gap:"xs"}),c]),ref:b}),g&&React.createElement(File,{className:cnAttachment("File"),extension:f,loading:h,loadingWithProgressSpin:!0,loadingProgress:m,size:fileSizeMap[p]}),React.createElement("div",{className:cnAttachment("Content",[cnMixFlex({flex:"flex",direction:"column",gap:"2xs"})])},i&&React.createElement(Text,{className:cnAttachment("FileName"),size:textSizeMap[p],view:"primary",lineHeight:"xs"},i),n&&!h&&React.createElement(Text,{className:cnAttachment("FileDescription"),size:descriptionSizeMap[p],lineHeight:"xs",view:"ghost"},n),l&&h&&React.createElement(Text,{className:cnAttachment("LoadingText"),size:descriptionSizeMap[p],lineHeight:"xs",view:"ghost"},m?"".concat(l," ").concat(m,"%"):"".concat(l,"...")),j&&React.createElement(Text,{className:cnAttachment("ErrorText"),size:descriptionSizeMap[p],lineHeight:"xs",view:"alert"},j)),y&&React.createElement("div",{className:cnAttachment("Actions",[cnMixFlex({flex:"flex",gap:"xs"})])},x.map(function(a,b){return React.createElement(Button,{key:a.title||b,className:cnAttachment("Button"),tabIndex:-1,onlyIcon:!0,iconLeft:a.icon,onClick:a.onClick,title:a.title,ref:a.ref,size:"xs",view:"clear"})})))});export{Attachment,cnAttachment};
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","as","fileExtension","withPictogram","loading","fileName","errorText","loadingText","loadingProgress","fileDescription","size","onClick","actions","buttonTitle","buttonIcon","onButtonClick","withAction"];import"./Attachment.css";import React from"react";import{Button}from"../Button";import{File}from"../File";import{Text}from"../Text";import{cnMixFlex}from"../../mixs/MixFlex";import{cn}from"../../utils/bem";import{isDefined}from"../../utils/type-guards";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{attachmentPropSizeDefault}from"./types";var cnAttachment=cn("Attachment"),fileSizeMap={xs:"s",s:"s",m:"m"},textSizeMap={xs:"xs",s:"s",m:"s"},descriptionSizeMap={xs:"xs",s:"xs",m:"s"},Attachment=forwardRefWithAs(function(a,b){var c=a.className,d=a.as,e=void 0===d?"div":d,f=a.fileExtension,g=a.withPictogram,h=a.loading,i=a.fileName,j=a.errorText,k=a.loadingText,l=void 0===k?"Loading":k,m=a.loadingProgress,n=a.fileDescription,o=a.size,p=void 0===o?attachmentPropSizeDefault:o,q=a.onClick,r=a.actions,s=void 0===r?[]:r,t=a.buttonTitle,u=a.buttonIcon,v=a.onButtonClick,w=a.withAction,x=_objectWithoutProperties(a,_excluded),y=[v&&u?{onClick:v,icon:u,title:t}:void 0].concat(_toConsumableArray(s)).filter(isDefined),z=!(!(null!==y&&void 0!==y)||!y.length);return React.createElement(e,Object.assign({},x,{onClick:q,className:cnAttachment({size:p,hoverEffect:!!((null===y||void 0===y?void 0:y.length)||q),cursor:q?"pointer":void 0,withActions:z,error:!!j},[cnMixFlex({flex:"flex",gap:"xs"}),c]),ref:b}),g&&React.createElement(File,{className:cnAttachment("File"),extension:f,loading:h,loadingWithProgressSpin:!0,loadingProgress:m,size:fileSizeMap[p]}),React.createElement("div",{className:cnAttachment("Content",[cnMixFlex({flex:"flex",direction:"column",gap:"2xs"})])},i&&React.createElement(Text,{className:cnAttachment("FileName"),size:textSizeMap[p],view:"primary",lineHeight:"xs"},i),n&&!h&&React.createElement(Text,{className:cnAttachment("FileDescription"),size:descriptionSizeMap[p],lineHeight:"xs",view:"ghost"},n),l&&h&&React.createElement(Text,{className:cnAttachment("LoadingText"),size:descriptionSizeMap[p],lineHeight:"xs",view:"ghost"},m?"".concat(l," ").concat(m,"%"):"".concat(l,"...")),j&&React.createElement(Text,{className:cnAttachment("ErrorText"),size:descriptionSizeMap[p],lineHeight:"xs",view:"alert"},j)),z&&React.createElement("div",{className:cnAttachment("Actions",[cnMixFlex({flex:"flex",gap:"xs"})])},y.map(function(a,b){return React.createElement(Button,{key:a.title||b,className:cnAttachment("Button"),tabIndex:-1,onlyIcon:!0,iconLeft:a.icon,onClick:a.onClick,title:a.title,ref:a.ref,size:"xs",view:"clear"})})))});export{Attachment,cnAttachment};
2
2
  //# sourceMappingURL=Attachment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Attachment.js","names":["React","Button","File","Text","cnMixFlex","cn","isDefined","forwardRefWithAs","attachmentPropSizeDefault","cnAttachment","fileSizeMap","xs","s","m","textSizeMap","descriptionSizeMap","Attachment","props","ref","className","as","fileExtension","withPictogram","loading","fileName","errorText","loadingText","loadingProgress","fileDescription","size","onClick","actions","actionsProp","buttonTitle","buttonIcon","onButtonClick","otherProps","icon","title","filter","withActions","length","hoverEffect","cursor","error","flex","gap","direction","map","action","index"],"sources":["../../../../../src/components/Attachment/Attachment.tsx"],"sourcesContent":["import './Attachment.css';\n\nimport React from 'react';\n\nimport { Button } from '##/components/Button';\nimport { File } from '##/components/File';\nimport { Text, TextPropSize } from '##/components/Text';\nimport { FileIconPropSize } from '##/fileIcons/FileIcon/FileIcon';\nimport { cnMixFlex } from '##/mixs/MixFlex';\nimport { cn } from '##/utils/bem';\nimport { isDefined } from '##/utils/type-guards';\nimport { forwardRefWithAs } from '##/utils/types/PropsWithAsAttributes';\n\nimport {\n AttachmentActions,\n AttachmentProps,\n AttachmentPropSize,\n attachmentPropSizeDefault,\n} from './types';\n\nconst cnAttachment = cn('Attachment');\n\nconst fileSizeMap: Record<AttachmentPropSize, FileIconPropSize> = {\n xs: 's',\n s: 's',\n m: 'm',\n};\n\nconst textSizeMap: Record<AttachmentPropSize, TextPropSize> = {\n xs: 'xs',\n s: 's',\n m: 's',\n};\n\nconst descriptionSizeMap: Record<AttachmentPropSize, TextPropSize> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n};\n\nconst Attachment = forwardRefWithAs<AttachmentProps>((props, ref) => {\n const {\n className,\n as = 'div',\n fileExtension,\n withPictogram,\n loading,\n fileName,\n errorText,\n loadingText = 'Loading',\n loadingProgress,\n fileDescription,\n size = attachmentPropSizeDefault,\n onClick,\n actions: actionsProp = [],\n buttonTitle,\n buttonIcon,\n onButtonClick,\n ...otherProps\n } = props;\n const Tag = as as string;\n\n const actions: AttachmentActions[] = [\n onButtonClick && buttonIcon\n ? {\n onClick: onButtonClick,\n icon: buttonIcon,\n title: buttonTitle,\n }\n : undefined,\n ...actionsProp,\n ].filter(isDefined);\n\n const withActions = Boolean(actions?.length);\n\n return (\n <Tag\n {...otherProps}\n onClick={onClick}\n className={cnAttachment(\n {\n size,\n hoverEffect: Boolean(actions?.length || onClick),\n cursor: onClick ? 'pointer' : undefined,\n withActions,\n error: Boolean(errorText),\n },\n [cnMixFlex({ flex: 'flex', gap: 'xs' }), className],\n )}\n ref={ref}\n >\n {withPictogram && (\n <File\n className={cnAttachment('File')}\n extension={fileExtension}\n loading={loading}\n loadingWithProgressSpin\n loadingProgress={loadingProgress}\n size={fileSizeMap[size]}\n />\n )}\n <div\n className={cnAttachment('Content', [\n cnMixFlex({ flex: 'flex', direction: 'column', gap: '2xs' }),\n ])}\n >\n {fileName && (\n <Text\n className={cnAttachment('FileName')}\n size={textSizeMap[size]}\n view=\"primary\"\n lineHeight=\"xs\"\n >\n {fileName}\n </Text>\n )}\n {fileDescription && !loading && (\n <Text\n className={cnAttachment('FileDescription')}\n size={descriptionSizeMap[size]}\n lineHeight=\"xs\"\n view=\"ghost\"\n >\n {fileDescription}\n </Text>\n )}\n {loadingText && loading && (\n <Text\n className={cnAttachment('LoadingText')}\n size={descriptionSizeMap[size]}\n lineHeight=\"xs\"\n view=\"ghost\"\n >\n {loadingProgress\n ? `${loadingText} ${loadingProgress}%`\n : `${loadingText}...`}\n </Text>\n )}\n {errorText && (\n <Text\n className={cnAttachment('ErrorText')}\n size={descriptionSizeMap[size]}\n lineHeight=\"xs\"\n view=\"alert\"\n >\n {errorText}\n </Text>\n )}\n </div>\n {withActions && (\n <div\n className={cnAttachment('Actions', [\n cnMixFlex({ flex: 'flex', gap: 'xs' }),\n ])}\n >\n {actions.map((action, index) => (\n <Button\n key={action.title || index}\n className={cnAttachment('Button')}\n tabIndex={-1}\n onlyIcon\n iconLeft={action.icon}\n onClick={action.onClick}\n title={action.title}\n ref={action.ref}\n size=\"xs\"\n view=\"clear\"\n />\n ))}\n </div>\n )}\n </Tag>\n );\n});\n\nexport { Attachment, cnAttachment };\n"],"mappings":"wXAAA,yBAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,MAAT,iBACA,OAASC,IAAT,eACA,OAASC,IAAT,eAEA,OAASC,SAAT,0BACA,OAASC,EAAT,uBACA,OAASC,SAAT,+BACA,OAASC,gBAAT,+CAEA,OAIEC,yBAJF,e,GAOMC,aAAY,CAAGJ,EAAE,CAAC,YAAD,C,CAEjBK,WAAyD,CAAG,CAChEC,EAAE,CAAE,GAD4D,CAEhEC,CAAC,CAAE,GAF6D,CAGhEC,CAAC,CAAE,GAH6D,C,CAM5DC,WAAqD,CAAG,CAC5DH,EAAE,CAAE,IADwD,CAE5DC,CAAC,CAAE,GAFyD,CAG5DC,CAAC,CAAE,GAHyD,C,CAMx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T,CAAqBP,YAArB"}
1
+ {"version":3,"file":"Attachment.js","names":["React","Button","File","Text","cnMixFlex","cn","isDefined","forwardRefWithAs","attachmentPropSizeDefault","cnAttachment","fileSizeMap","xs","s","m","textSizeMap","descriptionSizeMap","Attachment","props","ref","className","as","fileExtension","withPictogram","loading","fileName","errorText","loadingText","loadingProgress","fileDescription","size","onClick","actions","actionsProp","buttonTitle","buttonIcon","onButtonClick","withAction","otherProps","icon","title","filter","withActions","length","hoverEffect","cursor","error","flex","gap","direction","map","action","index"],"sources":["../../../../../src/components/Attachment/Attachment.tsx"],"sourcesContent":["import './Attachment.css';\n\nimport React from 'react';\n\nimport { Button } from '##/components/Button';\nimport { File } from '##/components/File';\nimport { Text, TextPropSize } from '##/components/Text';\nimport { FileIconPropSize } from '##/fileIcons/FileIcon/FileIcon';\nimport { cnMixFlex } from '##/mixs/MixFlex';\nimport { cn } from '##/utils/bem';\nimport { isDefined } from '##/utils/type-guards';\nimport { forwardRefWithAs } from '##/utils/types/PropsWithAsAttributes';\n\nimport {\n AttachmentActions,\n AttachmentProps,\n AttachmentPropSize,\n attachmentPropSizeDefault,\n} from './types';\n\nconst cnAttachment = cn('Attachment');\n\nconst fileSizeMap: Record<AttachmentPropSize, FileIconPropSize> = {\n xs: 's',\n s: 's',\n m: 'm',\n};\n\nconst textSizeMap: Record<AttachmentPropSize, TextPropSize> = {\n xs: 'xs',\n s: 's',\n m: 's',\n};\n\nconst descriptionSizeMap: Record<AttachmentPropSize, TextPropSize> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n};\n\nconst Attachment = forwardRefWithAs<AttachmentProps>((props, ref) => {\n const {\n className,\n as = 'div',\n fileExtension,\n withPictogram,\n loading,\n fileName,\n errorText,\n loadingText = 'Loading',\n loadingProgress,\n fileDescription,\n size = attachmentPropSizeDefault,\n onClick,\n actions: actionsProp = [],\n buttonTitle,\n buttonIcon,\n onButtonClick,\n withAction,\n ...otherProps\n } = props;\n const Tag = as as string;\n\n const actions: AttachmentActions[] = [\n onButtonClick && buttonIcon\n ? {\n onClick: onButtonClick,\n icon: buttonIcon,\n title: buttonTitle,\n }\n : undefined,\n ...actionsProp,\n ].filter(isDefined);\n\n const withActions = Boolean(actions?.length);\n\n return (\n <Tag\n {...otherProps}\n onClick={onClick}\n className={cnAttachment(\n {\n size,\n hoverEffect: Boolean(actions?.length || onClick),\n cursor: onClick ? 'pointer' : undefined,\n withActions,\n error: Boolean(errorText),\n },\n [cnMixFlex({ flex: 'flex', gap: 'xs' }), className],\n )}\n ref={ref}\n >\n {withPictogram && (\n <File\n className={cnAttachment('File')}\n extension={fileExtension}\n loading={loading}\n loadingWithProgressSpin\n loadingProgress={loadingProgress}\n size={fileSizeMap[size]}\n />\n )}\n <div\n className={cnAttachment('Content', [\n cnMixFlex({ flex: 'flex', direction: 'column', gap: '2xs' }),\n ])}\n >\n {fileName && (\n <Text\n className={cnAttachment('FileName')}\n size={textSizeMap[size]}\n view=\"primary\"\n lineHeight=\"xs\"\n >\n {fileName}\n </Text>\n )}\n {fileDescription && !loading && (\n <Text\n className={cnAttachment('FileDescription')}\n size={descriptionSizeMap[size]}\n lineHeight=\"xs\"\n view=\"ghost\"\n >\n {fileDescription}\n </Text>\n )}\n {loadingText && loading && (\n <Text\n className={cnAttachment('LoadingText')}\n size={descriptionSizeMap[size]}\n lineHeight=\"xs\"\n view=\"ghost\"\n >\n {loadingProgress\n ? `${loadingText} ${loadingProgress}%`\n : `${loadingText}...`}\n </Text>\n )}\n {errorText && (\n <Text\n className={cnAttachment('ErrorText')}\n size={descriptionSizeMap[size]}\n lineHeight=\"xs\"\n view=\"alert\"\n >\n {errorText}\n </Text>\n )}\n </div>\n {withActions && (\n <div\n className={cnAttachment('Actions', [\n cnMixFlex({ flex: 'flex', gap: 'xs' }),\n ])}\n >\n {actions.map((action, index) => (\n <Button\n key={action.title || index}\n className={cnAttachment('Button')}\n tabIndex={-1}\n onlyIcon\n iconLeft={action.icon}\n onClick={action.onClick}\n title={action.title}\n ref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AC,SAAD,CAAY,CACjCL,SAAS,CAAC,CAAE0C,IAAI,CAAE,MAAR,CAAgBC,GAAG,CAAE,IAArB,CAAD,CADwB,CAAZ,CADzB,EAKGhB,CAAO,CAACkB,GAAR,CAAY,SAACC,CAAD,CAASC,CAAT,QACX,qBAAC,MAAD,EACE,GAAG,CAAED,CAAM,CAACX,KAAP,EAAgBY,CADvB,CAEE,SAAS,CAAE1C,YAAY,CAAC,QAAD,CAFzB,CAGE,QAAQ,CAAE,CAAC,CAHb,CAIE,QAAQ,GAJV,CAKE,QAAQ,CAAEyC,CAAM,CAACZ,IALnB,CAME,OAAO,CAAEY,CAAM,CAACpB,OANlB,CAOE,KAAK,CAAEoB,CAAM,CAACX,KAPhB,CAQE,GAAG,CAAEW,CAAM,CAAChC,GARd,CASE,IAAI,CAAC,IATP,CAUE,IAAI,CAAC,OAVP,EADW,CAAZ,CALH,CA1EJ,CAiGH,CAtIkC,C,CAwInC,OAASF,UAAT,CAAqBP,YAArB"}
@@ -1,2 +1,2 @@
1
1
  import React from"react";import{cnCanary}from"../../utils/bem";import{AutoCompleteTypeText}from"./AutoCompleteTypeText";import{AutoCompleteTypeTextArray}from"./AutoCompleteTypeTextArray";var typeMap={text:AutoCompleteTypeText,textarray:AutoCompleteTypeTextArray};export var cnAutoComplete=cnCanary("AutoComplete");var AutoCompleteRender=function(a,b){var c=a.type||"text",d=typeMap[c]||typeMap.text;return React.createElement(d,Object.assign({},a,{ref:b,className:cnAutoComplete({type:c},[a.className])}))};export var AutoComplete=React.forwardRef(AutoCompleteRender);export*from"./types";
2
- //# sourceMappingURL=AutoComplete.js.map
2
+ //# sourceMappingURL=AutoCompleteCanary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoCompleteCanary.js","names":["React","cnCanary","AutoCompleteTypeText","AutoCompleteTypeTextArray","typeMap","text","textarray","cnAutoComplete","AutoCompleteRender","props","ref","type","Component","className","AutoComplete","forwardRef"],"sources":["../../../../../src/components/AutoCompleteCanary/AutoCompleteCanary.tsx"],"sourcesContent":["import React from 'react';\n\nimport { cnCanary } from '##/utils/bem';\n\nimport { AutoCompleteTypeText } from './AutoCompleteTypeText';\nimport { AutoCompleteTypeTextArray } from './AutoCompleteTypeTextArray';\nimport {\n AutoCompleteComponent,\n AutoCompleteGroupDefault,\n AutoCompleteItemDefault,\n AutoCompleteProps,\n AutoCompleteTypeComponent,\n} from './types';\n\nconst typeMap: Record<\n string,\n AutoCompleteTypeComponent<string> | AutoCompleteTypeComponent<'textarray'>\n> = {\n text: AutoCompleteTypeText,\n textarray: AutoCompleteTypeTextArray,\n};\n\nexport const cnAutoComplete = cnCanary('AutoComplete');\n\nconst AutoCompleteRender = <\n TYPE extends string,\n ITEM = AutoCompleteItemDefault,\n GROUP = AutoCompleteGroupDefault,\n>(\n props: AutoCompleteProps<TYPE, ITEM, GROUP>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const type = props.type || 'text';\n const Component = typeMap[type] || typeMap.text;\n\n return (\n <Component\n {...(props as unknown as AutoCompleteTypeComponent<TYPE, ITEM, GROUP>)}\n ref={ref}\n className={cnAutoComplete({ type }, [props.className])}\n />\n );\n};\n\nexport const AutoComplete = React.forwardRef(\n AutoCompleteRender,\n) as AutoCompleteComponent;\n\nexport * from './types';\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,QAAT,uBAEA,OAASC,oBAAT,8BACA,OAASC,yBAAT,mCASA,GAAMC,QAGL,CAAG,CACFC,IAAI,CAAEH,oBADJ,CAEFI,SAAS,CAAEH,yBAFT,CAHJ,CAQA,MAAO,IAAMI,eAAc,CAAGN,QAAQ,CAAC,cAAD,CAA/B,CAEP,GAAMO,mBAAkB,CAAG,SAKzBC,CALyB,CAMzBC,CANyB,CAOtB,IACGC,EAAI,CAAGF,CAAK,CAACE,IAAN,EAAc,MADxB,CAEGC,CAAS,CAAGR,OAAO,CAACO,CAAD,CAAP,EAAiBP,OAAO,CAACC,IAFxC,CAIH,MACE,qBAAC,CAAD,kBACOI,CADP,EAEE,GAAG,CAAEC,CAFP,CAGE,SAAS,CAAEH,cAAc,CAAC,CAAEI,IAAI,CAAJA,CAAF,CAAD,CAAW,CAACF,CAAK,CAACI,SAAP,CAAX,CAH3B,GAMH,CAlBD,CAoBA,MAAO,IAAMC,aAAY,CAAGd,KAAK,CAACe,UAAN,CAC1BP,kBAD0B,CAArB,CAIP"}
@@ -1,2 +1,2 @@
1
- export * from './AutoComplete';
1
+ export * from './AutoCompleteCanary';
2
2
  export * from './types';
@@ -1,2 +1,2 @@
1
- export*from"./AutoComplete";export*from"./types";
1
+ export*from"./AutoCompleteCanary";export*from"./types";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/AutoCompleteCanary/index.ts"],"sourcesContent":["export * from './AutoComplete';\nexport * from './types';\n"],"mappings":"AAAA,4BACA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/AutoCompleteCanary/index.ts"],"sourcesContent":["export * from './AutoCompleteCanary';\nexport * from './types';\n"],"mappings":"AAAA,kCACA"}
@@ -0,0 +1 @@
1
+ .Banner{--banner-bg-opacity:30%;--banner-height:calc(var(--banner-inner-height) + var(--space-padding-top) + var(--space-padding-bottom));color:var(--color-typo-primary);min-height:var(--banner-height)}.Banner_form_default{border-radius:var(--space-xs)}.Banner_form_round{border-radius:calc(var(--banner-height)/2)}.Banner_view_filled{background-color:var(--banner-bg-color)}.Banner_view_ghost{background-color:color-mix(in srgb,var(--banner-bg-color) var(--banner-bg-opacity),var(--color-bg-default))}.Banner-Icon.icons--Icon{display:flex}
@@ -0,0 +1,32 @@
1
+ import './Banner.css';
2
+ import { IconComponent } from '@consta/icons/Icon';
3
+ import React from 'react';
4
+ import { MixSpaceProps, Space } from '../../mixs/MixSpace';
5
+ import { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';
6
+ export type BannerProps = PropsWithJsxAttributes<{
7
+ leftSide?: React.ReactNode;
8
+ rightSide?: React.ReactNode;
9
+ icon?: IconComponent;
10
+ size?: 'xs' | 's' | 'm' | 'l';
11
+ view?: 'filled' | 'ghost' | 'transparent';
12
+ space?: MixSpaceProps;
13
+ itemsGap?: Space | [Space, Space];
14
+ status?: 'normal' | 'warning' | 'alert' | 'success' | 'system';
15
+ form?: 'default' | 'round' | 'brick';
16
+ }>;
17
+ export declare const cnBanner: import("@bem-react/classname").ClassNameFormatter;
18
+ /**
19
+ * Компонент Banner, отображающий содержимое слева и справа.
20
+ * Поддерживает иконки, размеры, виды, статусы и формы.
21
+ *
22
+ * @property {React.ReactNode} [leftSide] - Содержимое на левой стороне.
23
+ * @property {React.ReactNode} [rightSide] - Содержимое на правой стороне.
24
+ * @property {IconComponent} [icon] - Иконка.
25
+ * @property {'xs' | 's' | 'm' | 'l'} [size] - Размер компонента.
26
+ * @property {'filled' | 'ghost' | 'transparent'} [view] - Визуальный стиль.
27
+ * @property {MixSpaceProps} [space] - Параметры отступов.
28
+ * @property {Space | [Space, Space]} [itemsGap] - Отступы между элементами.
29
+ * @property {'normal' | 'warning' | 'alert' | 'success' | 'system'} [status] - Статус (цветовая схема).
30
+ * @property {'default' | 'round' | 'brick'} [form] - Форма компонента.
31
+ */
32
+ export declare const Banner: React.ForwardRefExoticComponent<Omit<BannerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Banner.css";import React,{forwardRef}from"react";import{cnText,Text}from"../Text";import{useTheme}from"../Theme/Theme";import{cnMixFlex}from"../../mixs/MixFlex";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{isNotNil,isString}from"../../utils/type-guards";export var cnBanner=cn("Banner");var SlotWrapper=function(a){var b=a.children;return React.createElement("div",{className:cnBanner("Slot")},b)},renderSlot=function(a,b,c){return isString(a)?React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},React.createElement(Text,{className:cnBanner("Text"),view:"primary",weight:0===b&&0===c?"bold":void 0,lineHeight:"m"},a)):React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},a)},renderSlots=function(a,b){return Array.isArray(a)?a.filter(isNotNil).map(function(a,c){return renderSlot(a,c,b)}):renderSlots([a],b)},getGap=function(a,b){return Array.isArray(a)?a[b]:a},textSizeMap={xs:"s",s:"s",m:"m",l:"l"},controlSizeMap={xs:"xs",s:"s",m:"s",l:"m"};export var Banner=forwardRef(function(a,b){var c,d=a.leftSide,e=a.rightSide,f=a.icon,g=a.size,h=void 0===g?"m":g,i=a.view,j=void 0===i?"filled":i,k=a.className,l=a.space,m=a.itemsGap,n=void 0===m?"s":m,o=a.status,p=void 0===o?"normal":o,q=a.style,r=a.form,s=void 0===r?"default":r,t=useTheme(),u=t.themeClassNames,v=[f?React.createElement(SlotWrapper,null,React.createElement(f,{className:cnBanner("Icon")})):null].concat(_toConsumableArray(renderSlots(d,0))).filter(isNotNil),w=renderSlots(e,1);return React.createElement("div",{className:cnBanner({view:j,form:s},[cnMixFlex({justify:w.length&&!v.length?"flex-end":"space-between",align:"center",gap:"m"}),cnMixSpace(l||{pH:h,pV:"xs"}),cnText({size:textSizeMap[h]}),"system"!==p&&"filled"===j?u.color.accent:void 0,k]),style:_objectSpread(_objectSpread({},q),{},(c={},_defineProperty(c,"--banner-bg-color","var(--color-bg-".concat(p,")")),_defineProperty(c,"--banner-inner-height","var(--control-height-".concat(controlSizeMap[h],")")),c)),ref:b},v.length?React.createElement("div",{className:cnMixFlex({gap:getGap(n,0),align:"center"})},v):void 0,w.length?React.createElement("div",{className:cnMixFlex({gap:getGap(n,1),align:"center"})},w):void 0)});
2
+ //# sourceMappingURL=Banner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Banner.js","names":["React","forwardRef","cnText","Text","useTheme","cnMixFlex","cnMixSpace","cn","isNotNil","isString","cnBanner","SlotWrapper","children","renderSlot","slot","index","position","renderSlots","Array","isArray","filter","map","item","getGap","gap","textSizeMap","xs","s","m","l","controlSizeMap","Banner","props","ref","leftSide","rightSide","Icon","icon","size","view","className","space","itemsGap","status","style","form","themeClassNames","leftSlots","rightSlots","justify","length","align","pH","pV","color","accent"],"sources":["../../../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import './Banner.css';\n\nimport { IconComponent } from '@consta/icons/Icon';\nimport React, { forwardRef } from 'react';\n\nimport { cnText, Text } from '##/components/Text';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { cnMixFlex } from '##/mixs/MixFlex';\nimport { cnMixSpace, MixSpaceProps, Space } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { isNotNil, isString } from '##/utils/type-guards';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nexport type BannerProps = PropsWithJsxAttributes<{\n leftSide?: React.ReactNode;\n rightSide?: React.ReactNode;\n icon?: IconComponent;\n size?: 'xs' | 's' | 'm' | 'l';\n view?: 'filled' | 'ghost' | 'transparent';\n space?: MixSpaceProps;\n itemsGap?: Space | [Space, Space];\n status?: 'normal' | 'warning' | 'alert' | 'success' | 'system';\n form?: 'default' | 'round' | 'brick';\n}>;\n\nexport const cnBanner = cn('Banner');\n\nconst SlotWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className={cnBanner('Slot')}>{children}</div>\n);\n\nconst renderSlot = (slot: React.ReactNode, index: number, position: number) => {\n if (isString(slot)) {\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n <Text\n className={cnBanner('Text')}\n view=\"primary\"\n weight={index === 0 && position === 0 ? 'bold' : undefined}\n lineHeight=\"m\"\n >\n {slot}\n </Text>\n </SlotWrapper>\n );\n }\n\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n {slot}\n </SlotWrapper>\n );\n};\n\nconst renderSlots = (slot: React.ReactNode, position: number) => {\n if (Array.isArray(slot)) {\n return slot\n .filter(isNotNil)\n .map((item, index) => renderSlot(item, index, position));\n }\n return renderSlots([slot], position);\n};\n\nconst getGap = (gap: Space | [Space, Space], index: number) => {\n if (Array.isArray(gap)) {\n return gap[index];\n }\n return gap;\n};\n\nconst textSizeMap = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n} as const;\n\nconst controlSizeMap = {\n xs: 'xs',\n s: 's',\n m: 's',\n l: 'm',\n} as const;\n\n/**\n * Компонент Banner, отображающий содержимое слева и справа.\n * Поддерживает иконки, размеры, виды, статусы и формы.\n *\n * @property {React.ReactNode} [leftSide] - Содержимое на левой стороне.\n * @property {React.ReactNode} [rightSide] - Содержимое на правой стороне.\n * @property {IconComponent} [icon] - Иконка.\n * @property {'xs' | 's' | 'm' | 'l'} [size] - Размер компонента.\n * @property {'filled' | 'ghost' | 'transparent'} [view] - Визуальный стиль.\n * @property {MixSpaceProps} [space] - Параметры отступов.\n * @property {Space | [Space, Space]} [itemsGap] - Отступы между элементами.\n * @property {'normal' | 'warning' | 'alert' | 'success' | 'system'} [status] - Статус (цветовая схема).\n * @property {'default' | 'round' | 'brick'} [form] - Форма компонента.\n */\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>((props, ref) => {\n const {\n leftSide,\n rightSide,\n icon: Icon,\n size = 'm',\n view = 'filled',\n className,\n space,\n itemsGap = 's',\n status = 'normal',\n style,\n form = 'default',\n } = props;\n\n const { themeClassNames } = useTheme();\n\n const leftSlots = [\n Icon ? (\n <SlotWrapper>\n <Icon className={cnBanner('Icon')} />\n </SlotWrapper>\n ) : null,\n ...renderSlots(leftSide, 0),\n ].filter(isNotNil);\n\n const rightSlots = renderSlots(rightSide, 1);\n\n return (\n <div\n className={cnBanner({ view, form }, [\n cnMixFlex({\n justify:\n rightSlots.length && !leftSlots.length\n ? 'flex-end'\n : 'space-between',\n align: 'center',\n gap: 'm',\n }),\n cnMixSpace(space || { pH: size, pV: 'xs' }),\n cnText({ size: textSizeMap[size] }),\n status !== 'system' && view === 'filled'\n ? themeClassNames.color.accent\n : undefined,\n className,\n ])}\n style={{\n ...style,\n ['--banner-bg-color' as string]: `var(--color-bg-${status})`,\n ['--banner-inner-height' as string]: `var(--control-height-${controlSizeMap[size]})`,\n }}\n ref={ref}\n >\n {leftSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 0), align: 'center' })}\n >\n {leftSlots}\n </div>\n ) : undefined}\n {rightSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 1), align: 'center' })}\n >\n {rightSlots}\n </div>\n ) : undefined}\n </div>\n );\n});\n"],"mappings":"8uBAAA,qBAGA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,MAAT,CAAiBC,IAAjB,eACA,OAASC,QAAT,sBACA,OAASC,SAAT,0BACA,OAASC,UAAT,2BACA,OAASC,EAAT,uBACA,OAASC,QAAT,CAAmBC,QAAnB,+BAeA,MAAO,IAAMC,SAAQ,CAAGH,EAAE,CAAC,QAAD,CAAnB,C,GAEDI,YAAoD,CAAG,eAAGC,EAAH,GAAGA,QAAH,OAC3D,4BAAK,SAAS,CAAEF,QAAQ,CAAC,MAAD,CAAxB,EAAmCE,CAAnC,CAD2D,C,CAIvDC,UAAU,CAAG,SAACC,CAAD,CAAwBC,CAAxB,CAAuCC,CAAvC,CAA4D,OAC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,CACI,UADJ,CAEI,eAJE,CAKRC,KAAK,CAAE,QALC,CAMR3B,GAAG,CAAE,GANG,CAAD,CADyB,CASlClB,UAAU,CAACmC,CAAK,EAAI,CAAEW,EAAE,CAAEd,CAAN,CAAYe,EAAE,CAAE,IAAhB,CAAV,CATwB,CAUlCnD,MAAM,CAAC,CAAEoC,IAAI,CAAEb,WAAW,CAACa,CAAD,CAAnB,CAAD,CAV4B,CAWvB,QAAX,GAAAK,CAAM,EAA0B,QAAT,GAAAJ,CAAvB,CACIO,CAAe,CAACQ,KAAhB,CAAsBC,MAD1B,OAXkC,CAclCf,CAdkC,CAAjB,CADrB,CAiBE,KAAK,gCACAI,CADA,6BAEF,mBAFE,0BAEgDD,CAFhD,yBAGF,uBAHE,gCAG0Db,cAAc,CAACQ,CAAD,CAHxE,UAjBP,CAsBE,GAAG,CAAEL,CAtBP,EAwBGc,CAAS,CAACG,MAAV,CACC,2BACE,SAAS,CAAE7C,SAAS,CAAC,CAAEmB,GAAG,CAAED,MAAM,CAACmB,CAAD,CAAW,CAAX,CAAb,CAA4BS,KAAK,CAAE,QAAnC,CAAD,CADtB,EAGGJ,CAHH,CADD,OAxBH,CA+BGC,CAAU,CAACE,MAAX,CACC,2BACE,SAAS,CAAE7C,SAAS,CAAC,CAAEmB,GAAG,CAAED,MAAM,CAACmB,CAAD,CAAW,CAAX,CAAb,CAA4BS,KAAK,CAAE,QAAnC,CAAD,CADtB,EAGGH,CAHH,CADD,OA/BH,CAwCH,CArE+B,CAAzB"}
@@ -0,0 +1 @@
1
+ export * from './Banner';
@@ -0,0 +1,2 @@
1
+ export*from"./Banner";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/Banner/index.ts"],"sourcesContent":["export * from './Banner';\n"],"mappings":"AAAA"}
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSize","formId"];import"./Button.css";import React,{useRef}from"react";import{Loader}from"../Loader";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../mixs/MixFocus/MixFocus";import{cn}from"../../utils/bem";import{getByMap}from"../../utils/getByMap";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";export var buttonPropSize=["m","xs","s","l"];export var buttonPropSizeDefault=buttonPropSize[0];export var buttonPropView=["primary","clear","ghost","secondary"];export var buttonPropViewDefault=buttonPropView[0];export var buttonPropWidth=["default","full"];export var buttonPropWidthDefault=buttonPropWidth[0];export var buttonPropForm=["default","brick","round","brickRound","roundBrick","brickDefault","defaultBrick"];var mapStableForm={default:"default",defaultClear:"defaultBrick",defaultBrick:"defaultBrick",brick:"brick",brickDefault:"brickDefault",brickClear:"brick",brickRound:"brickRound",round:"round",roundClear:"roundBrick",roundBrick:"roundBrick",clearRound:"brickRound",clearDefault:"brickDefault",clearBrick:"brick",clearClear:"brick"};export var buttonPropFormDefault=buttonPropForm[0];export var COMPONENT_NAME="Button";export var cnButton=cn("Button");var sizeMap={xs:"xs",s:"xs",m:"s",l:"m"},sizeMapOnlyIcon={xs:"xs",s:"s",m:"m",l:"m"};export var Button=forwardRefWithAs(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.size,f=void 0===e?buttonPropSizeDefault:e,g=d.view,h=void 0===g?buttonPropViewDefault:g,i=d.width,j=void 0===i?buttonPropWidthDefault:i,k=d.form,l=void 0===k?buttonPropFormDefault:k,m=d.iconLeft,n=d.iconRight,o=d.label,p=d.className,q=d.onClick,r=d.disabled,s=d.loading,t=d.type,u=void 0===t?"button":t,v=d.tabIndex,w=d.as,x=void 0===w?"button":w,y=d.onlyIcon,z=d.iconSize,A=d.formId,B=_objectWithoutProperties(d,_excluded),C=(!o||y)&&(m||n),D=m,E=n,F=a.title||!!C&&o||void 0,G=C?getByMap(sizeMapOnlyIcon,f,z):getByMap(sizeMap,f,z);return React.createElement(x,Object.assign({},B,{onClick:q?function handleClick(a){r||s||!q||q(a)}:void 0,form:A,type:u,className:cnButton({size:f,view:h,width:j,form:mapStableForm[l],loading:s,disabled:r,withIcon:!!m||!!n,onlyIcon:!!C},[r||s?void 0:cnMixFocus(),p]),disabled:r,tabIndex:v,title:F,ref:useForkRef([b,c])}),C&&React.createElement(C,{className:cnButton("Icon"),size:G}),!C&&((D||E)&&o?React.createElement(React.Fragment,null,D&&React.createElement(D,{className:cnButton("Icon",{position:"left"}),size:G}),React.createElement("span",{className:cnButton("Label")},o),E&&React.createElement(E,{className:cnButton("Icon",{position:"right"}),size:G})):o),s&&React.createElement("div",{className:cnButton("Loader")},React.createElement(Loader,{size:"s"})))});
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSize","formId"];import"./Button.css";import React,{useRef}from"react";import{Loader}from"../Loader";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../mixs/MixFocus/MixFocus";import{cn}from"../../utils/bem";import{getByMap}from"../../utils/getByMap";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";export var buttonPropSize=["m","xs","s","l"];export var buttonPropSizeDefault=buttonPropSize[0];export var buttonPropView=["primary","clear","ghost","secondary"];export var buttonPropViewDefault=buttonPropView[0];export var buttonPropWidth=["default","full"];export var buttonPropWidthDefault=buttonPropWidth[0];export var buttonPropForm=["default","brick","round","brickRound","roundBrick","brickDefault","defaultBrick"];var mapStableForm={default:"default",defaultClear:"defaultBrick",defaultBrick:"defaultBrick",brick:"brick",brickDefault:"brickDefault",brickClear:"brick",brickRound:"brickRound",round:"round",roundClear:"roundBrick",roundBrick:"roundBrick",clearRound:"brickRound",clearDefault:"brickDefault",clearBrick:"brick",clearClear:"brick"};export var buttonPropFormDefault=buttonPropForm[0];export var COMPONENT_NAME="Button";export var cnButton=cn("Button");var sizeMap={xs:"xs",s:"xs",m:"s",l:"m"},sizeMapOnlyIcon={xs:"xs",s:"s",m:"m",l:"m"};export var Button=forwardRefWithAs(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.size,f=void 0===e?buttonPropSizeDefault:e,g=d.view,h=void 0===g?buttonPropViewDefault:g,i=d.width,j=void 0===i?buttonPropWidthDefault:i,k=d.form,l=void 0===k?buttonPropFormDefault:k,m=d.iconLeft,n=d.iconRight,o=d.label,p=d.className,q=d.onClick,r=d.disabled,s=d.loading,t=d.type,u=void 0===t?"button":t,v=d.tabIndex,w=d.as,x=void 0===w?"button":w,y=d.onlyIcon,z=d.iconSize,A=d.formId,B=_objectWithoutProperties(d,_excluded),C=(!o||y)&&(m||n),D=m,E=n,F=a.title||!!C&&o||void 0,G=C?getByMap(sizeMapOnlyIcon,f,z):getByMap(sizeMap,f,z);return React.createElement(x,Object.assign({},B,{onClick:q?function handleClick(a){r||s||!q||q(a)}:void 0,form:A,type:u,className:cnButton({size:f,view:h,width:j,form:mapStableForm[l],loading:s,disabled:r,withIcon:!!m||!!n,onlyIcon:!!C},[r||s?void 0:cnMixFocus(),p]),disabled:r,tabIndex:v,title:F,ref:useForkRef([b,c])}),C&&React.createElement(C,{className:cnButton("Icon"),size:G}),!C&&((D||E)&&o?React.createElement(React.Fragment,null,D&&React.createElement(D,{className:cnButton("Icon",{position:"left"}),size:G}),React.createElement("span",{className:cnButton("Label")},o),E&&React.createElement(E,{className:cnButton("Icon",{position:"right"}),size:G})):o),s&&React.createElement("div",{className:cnButton("Loader")},React.createElement(Loader,{size:sizeMapOnlyIcon[f],type:"circle"})))});
2
2
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["React","useRef","Loader","useForkRef","cnMixFocus","cn","getByMap","forwardRefWithAs","usePropsHandler","buttonPropSize","buttonPropSizeDefault","buttonPropView","buttonPropViewDefault","buttonPropWidth","buttonPropWidthDefault","buttonPropForm","mapStableForm","defaultClear","defaultBrick","brick","brickDefault","brickClear","brickRound","round","roundClear","roundBrick","clearRound","clearDefault","clearBrick","clearClear","buttonPropFormDefault","COMPONENT_NAME","cnButton","sizeMap","xs","s","m","l","sizeMapOnlyIcon","Button","props","ref","buttonRef","size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSizeProp","iconSize","formId","otherProps","IconOnly","IconLeft","IconRight","title","handleClick","e","withIcon","position"],"sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import './Button.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React, { HTMLProps, useRef } from 'react';\n\nimport { Loader } from '##/components/Loader';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\nexport const buttonPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type ButtonPropSize = typeof buttonPropSize[number];\nexport const buttonPropSizeDefault: ButtonPropSize = buttonPropSize[0];\n\nexport const buttonPropView = [\n 'primary',\n 'clear',\n 'ghost',\n 'secondary',\n] as const;\nexport type ButtonPropView = typeof buttonPropView[number];\nexport const buttonPropViewDefault: ButtonPropView = buttonPropView[0];\n\nexport const buttonPropWidth = ['default', 'full'] as const;\nexport type ButtonPropWidth = typeof buttonPropWidth[number];\nexport const buttonPropWidthDefault: ButtonPropWidth = buttonPropWidth[0];\n\nexport const buttonPropForm = [\n 'default',\n 'brick',\n 'round',\n 'brickRound',\n 'roundBrick',\n 'brickDefault',\n 'defaultBrick',\n] as const;\n\nexport type ButtonPropForm = typeof buttonPropForm[number];\n\ntype GlobalForm =\n | 'default'\n | 'brick'\n | 'round'\n | 'brickRound'\n | 'roundBrick'\n | 'brickDefault'\n | 'defaultBrick'\n | 'defaultClear'\n | 'brickClear'\n | 'roundClear'\n | 'clearRound'\n | 'clearDefault'\n | 'clearBrick'\n | 'clearClear';\n\nconst mapStableForm: Record<GlobalForm, ButtonPropForm> = {\n default: 'default',\n defaultClear: 'defaultBrick',\n defaultBrick: 'defaultBrick',\n brick: 'brick',\n brickDefault: 'brickDefault',\n brickClear: 'brick',\n brickRound: 'brickRound',\n round: 'round',\n roundClear: 'roundBrick',\n roundBrick: 'roundBrick',\n clearRound: 'brickRound',\n clearDefault: 'brickDefault',\n clearBrick: 'brick',\n clearClear: 'brick',\n};\n\nexport const buttonPropFormDefault = buttonPropForm[0];\n\nexport type Props = {\n size?: ButtonPropSize;\n view?: ButtonPropView;\n width?: ButtonPropWidth;\n form?: ButtonPropForm;\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n label?: string | number;\n onClick?: React.EventHandler<React.MouseEvent>;\n iconLeft?: IconComponent;\n iconRight?: IconComponent;\n onlyIcon?: boolean;\n iconSize?: IconPropSize;\n title?: string;\n children?: never;\n type?: 'button' | 'reset' | 'submit';\n formId?: HTMLProps<HTMLButtonElement>['form'];\n};\n\nexport const COMPONENT_NAME = 'Button' as const;\nexport const cnButton = cn(COMPONENT_NAME);\n\nconst sizeMap: Record<ButtonPropSize, IconPropSize> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 'm',\n};\n\nconst sizeMapOnlyIcon: Record<ButtonPropSize, IconPropSize> = {\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'm',\n};\n\nexport const Button = forwardRefWithAs<Props, 'button'>((props, ref) => {\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n\n const {\n size = buttonPropSizeDefault,\n view = buttonPropViewDefault,\n width = buttonPropWidthDefault,\n form = buttonPropFormDefault,\n iconLeft,\n iconRight,\n label,\n className,\n onClick,\n disabled,\n loading,\n type = 'button',\n tabIndex,\n as = 'button',\n onlyIcon,\n iconSize: iconSizeProp,\n formId,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, buttonRef);\n\n const Tag = as as string;\n const IconOnly = (!label || onlyIcon) && (iconLeft || iconRight);\n const IconLeft = iconLeft;\n const IconRight = iconRight;\n const withIcon = !!iconLeft || !!iconRight;\n const title = props.title || (!!IconOnly && label) || undefined;\n const iconSize = IconOnly\n ? getByMap(sizeMapOnlyIcon, size, iconSizeProp)\n : getByMap(sizeMap, size, iconSizeProp);\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!disabled && !loading && onClick) {\n onClick(e);\n }\n };\n\n return (\n <Tag\n {...otherProps}\n onClick={onClick ? handleClick : undefined}\n form={formId}\n type={type}\n className={cnButton(\n {\n size,\n view,\n width,\n form: mapStableForm[form],\n loading,\n disabled,\n withIcon,\n onlyIcon: !!IconOnly,\n },\n [!(disabled || loading) ? cnMixFocus() : undefined, className],\n )}\n disabled={disabled}\n tabIndex={tabIndex}\n title={title}\n ref={useForkRef([ref, buttonRef])}\n >\n {IconOnly && <IconOnly className={cnButton('Icon')} size={iconSize} />}\n {!IconOnly &&\n ((IconLeft || IconRight) && label ? (\n <>\n {IconLeft && (\n <IconLeft\n className={cnButton('Icon', { position: 'left' })}\n size={iconSize}\n />\n )}\n <span className={cnButton('Label')}>{label}</span>\n {IconRight && (\n <IconRight\n className={cnButton('Icon', { position: 'right' })}\n size={iconSize}\n />\n )}\n </>\n ) : (\n label\n ))}\n {loading && (\n <div className={cnButton('Loader')}>\n <Loader size=\"s\" />\n </div>\n )}\n </Tag>\n );\n});\n"],"mappings":"kQAAA,qBAGA,MAAOA,MAAP,EAA2BC,MAA3B,KAAyC,OAAzC,CAEA,OAASC,MAAT,iBAEA,OAASC,UAAT,yCACA,OAASC,UAAT,oCACA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,gBAAT,+CACA,O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,CAAQ,EACP,oBAAC,CAAD,EACE,SAAS,CAAE/B,QAAQ,CAAC,MAAD,CAAS,CAAEqC,QAAQ,CAAE,MAAZ,CAAT,CADrB,CAEE,IAAI,CAAEV,CAFR,EAFJ,CAOE,4BAAM,SAAS,CAAE3B,QAAQ,CAAC,OAAD,CAAzB,EAAqCiB,CAArC,CAPF,CAQGe,CAAS,EACR,oBAAC,CAAD,EACE,SAAS,CAAEhC,QAAQ,CAAC,MAAD,CAAS,CAAEqC,QAAQ,CAAE,OAAZ,CAAT,CADrB,CAEE,IAAI,CAAEV,CAFR,EATJ,CADD,CAiBCV,CAlBH,CAxBH,CA4CGI,CAAO,EACN,2BAAK,SAAS,CAAErB,QAAQ,CAAC,QAAD,CAAxB,EACE,oBAAC,MAAD,EAAQ,IAAI,CAAC,GAAb,EADF,CA7CJ,CAmDH,CA5FqC,CAA/B"}
1
+ {"version":3,"file":"Button.js","names":["React","useRef","Loader","useForkRef","cnMixFocus","cn","getByMap","forwardRefWithAs","usePropsHandler","buttonPropSize","buttonPropSizeDefault","buttonPropView","buttonPropViewDefault","buttonPropWidth","buttonPropWidthDefault","buttonPropForm","mapStableForm","defaultClear","defaultBrick","brick","brickDefault","brickClear","brickRound","round","roundClear","roundBrick","clearRound","clearDefault","clearBrick","clearClear","buttonPropFormDefault","COMPONENT_NAME","cnButton","sizeMap","xs","s","m","l","sizeMapOnlyIcon","Button","props","ref","buttonRef","size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSizeProp","iconSize","formId","otherProps","IconOnly","IconLeft","IconRight","title","handleClick","e","withIcon","position"],"sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import './Button.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React, { HTMLProps, useRef } from 'react';\n\nimport { Loader } from '##/components/Loader';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\nexport const buttonPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type ButtonPropSize = typeof buttonPropSize[number];\nexport const buttonPropSizeDefault: ButtonPropSize = buttonPropSize[0];\n\nexport const buttonPropView = [\n 'primary',\n 'clear',\n 'ghost',\n 'secondary',\n] as const;\nexport type ButtonPropView = typeof buttonPropView[number];\nexport const buttonPropViewDefault: ButtonPropView = buttonPropView[0];\n\nexport const buttonPropWidth = ['default', 'full'] as const;\nexport type ButtonPropWidth = typeof buttonPropWidth[number];\nexport const buttonPropWidthDefault: ButtonPropWidth = buttonPropWidth[0];\n\nexport const buttonPropForm = [\n 'default',\n 'brick',\n 'round',\n 'brickRound',\n 'roundBrick',\n 'brickDefault',\n 'defaultBrick',\n] as const;\n\nexport type ButtonPropForm = typeof buttonPropForm[number];\n\ntype GlobalForm =\n | 'default'\n | 'brick'\n | 'round'\n | 'brickRound'\n | 'roundBrick'\n | 'brickDefault'\n | 'defaultBrick'\n | 'defaultClear'\n | 'brickClear'\n | 'roundClear'\n | 'clearRound'\n | 'clearDefault'\n | 'clearBrick'\n | 'clearClear';\n\nconst mapStableForm: Record<GlobalForm, ButtonPropForm> = {\n default: 'default',\n defaultClear: 'defaultBrick',\n defaultBrick: 'defaultBrick',\n brick: 'brick',\n brickDefault: 'brickDefault',\n brickClear: 'brick',\n brickRound: 'brickRound',\n round: 'round',\n roundClear: 'roundBrick',\n roundBrick: 'roundBrick',\n clearRound: 'brickRound',\n clearDefault: 'brickDefault',\n clearBrick: 'brick',\n clearClear: 'brick',\n};\n\nexport const buttonPropFormDefault = buttonPropForm[0];\n\nexport type Props = {\n size?: ButtonPropSize;\n view?: ButtonPropView;\n width?: ButtonPropWidth;\n form?: ButtonPropForm;\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n label?: string | number;\n onClick?: React.EventHandler<React.MouseEvent>;\n iconLeft?: IconComponent;\n iconRight?: IconComponent;\n onlyIcon?: boolean;\n iconSize?: IconPropSize;\n title?: string;\n children?: never;\n type?: 'button' | 'reset' | 'submit';\n formId?: HTMLProps<HTMLButtonElement>['form'];\n};\n\nexport const COMPONENT_NAME = 'Button' as const;\nexport const cnButton = cn(COMPONENT_NAME);\n\nconst sizeMap = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 'm',\n} as const;\n\nconst sizeMapOnlyIcon = {\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'm',\n} as const;\n\nexport const Button = forwardRefWithAs<Props, 'button'>((props, ref) => {\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n\n const {\n size = buttonPropSizeDefault,\n view = buttonPropViewDefault,\n width = buttonPropWidthDefault,\n form = buttonPropFormDefault,\n iconLeft,\n iconRight,\n label,\n className,\n onClick,\n disabled,\n loading,\n type = 'button',\n tabIndex,\n as = 'button',\n onlyIcon,\n iconSize: iconSizeProp,\n formId,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, buttonRef);\n\n const Tag = as as string;\n const IconOnly = (!label || onlyIcon) && (iconLeft || iconRight);\n const IconLeft = iconLeft;\n const IconRight = iconRight;\n const withIcon = !!iconLeft || !!iconRight;\n const title = props.title || (!!IconOnly && label) || undefined;\n const iconSize = IconOnly\n ? getByMap(sizeMapOnlyIcon, size, iconSizeProp)\n : getByMap(sizeMap, size, iconSizeProp);\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!disabled && !loading && onClick) {\n onClick(e);\n }\n };\n\n return (\n <Tag\n {...otherProps}\n onClick={onClick ? handleClick : undefined}\n form={formId}\n type={type}\n className={cnButton(\n {\n size,\n view,\n width,\n form: mapStableForm[form],\n loading,\n disabled,\n withIcon,\n onlyIcon: !!IconOnly,\n },\n [!(disabled || loading) ? cnMixFocus() : undefined, className],\n )}\n disabled={disabled}\n tabIndex={tabIndex}\n title={title}\n ref={useForkRef([ref, buttonRef])}\n >\n {IconOnly && <IconOnly className={cnButton('Icon')} size={iconSize} />}\n {!IconOnly &&\n ((IconLeft || IconRight) && label ? (\n <>\n {IconLeft && (\n <IconLeft\n className={cnButton('Icon', { position: 'left' })}\n size={iconSize}\n />\n )}\n <span className={cnButton('Label')}>{label}</span>\n {IconRight && (\n <IconRight\n className={cnButton('Icon', { position: 'right' })}\n size={iconSize}\n />\n )}\n </>\n ) : (\n label\n ))}\n {loading && (\n <div className={cnButton('Loader')}>\n <Loader size={sizeMapOnlyIcon[size]} type=\"circle\" />\n </div>\n )}\n </Tag>\n );\n});\n"],"mappings":"kQAAA,qBAGA,MAAOA,MAAP,EAA2BC,MAA3B,KAAyC,OAAzC,CAEA,OAASC,MAAT,iBAEA,OAASC,UAAT,yCACA,OAASC,UAAT,oCACA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,gBAAT,+CACA,OAASC,eAAT,2CAEA,MAAO,IAAMC,eAAc,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAvB,CAEP,MAAO,IAAMC,sBAAqC,CAAGD,cAAc,CAAC,CAAD,CAA5D,CAEP,MAAO,IAAME,eAAc,CAAG,CAC5B,SAD4B,CAE5B,OAF4B,CAG5B,OAH4B,CAI5B,WAJ4B,CAAvB,CAOP,MAAO,IAAMC,sBAAqC,CAAGD,cAAc,CAAC,CAAD,CAA5D,CAEP,MAAO,IAAME,gBAAe,CAAG,CAAC,SAAD,CAAY,MAAZ,CAAxB,CAEP,MAAO,IAAMC,uBAAuC,CAAGD,eAAe,CAAC,CAAD,CAA/D,CAEP,MAAO,IAAME,eAAc,CAAG,CAC5B,SAD4B,CAE5B,OAF4B,CAG5B,OAH4B,CAI5B,YAJ4B,CAK5B,YAL4B,CAM5B,cAN4B,CAO5B,cAP4B,CAAvB,CA4BP,GAAMC,cAAiD,CAAG,CACxD,QAAS,SAD+C,CAExDC,YAAY,CAA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"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRef"];import addMonths from"date-fns/addMonths";import startOfMonth from"date-fns/startOfMonth";import React,{forwardRef,useEffect,useRef}from"react";import{useClickOutside}from"../../../hooks/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{setRef}from"../../../utils/setRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDate}from"../DatePickerFieldTypeDate/DatePickerFieldTypeDate";import{getDropdownZIndex}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDate=forwardRef(function(a,b){var c=a.events,d=a.dateTimeView,e=void 0===d?datePickerPropDateTimeViewDefault:d,f=a.locale,g=a.dropdownClassName,h=a.dropdownRef,i=a.dropdownForm,j=a.currentVisibleDate,k=a.onChangeCurrentVisibleDate,l=a.renderAdditionalControls,m=a.onDropdownOpen,n=a.dropdownOpen,o=a.ignoreOutsideClicksRefs,p=a.disabled,q=a.disableDates,r=a.inputRef,s=_objectWithoutProperties(a,_excluded),t=useRef(null),u=useRef(null),v=useRef(null),w=useCalendarVisible({dropdownOpen:n,onDropdownOpen:m,disabled:p,startRef:v}),x=_slicedToArray(w,2),y=x[0],z=x[1],A=useCurrentVisibleDate({currentVisibleDate:j,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:k,calendarVisible:y}),B=_slicedToArray(A,2),C=B[0],D=B[1];return useEffect(function(){b&&setRef(b,t.current)},[b,t]),useEffect(function(){if(a.value&&"classic"===e&&C){var b=startOfMonth(a.value);return void(b.getTime()!==C.getTime()&&D(b))}if(a.value&&"classic"!==e&&C){var c=startOfMonth(a.value);c.getTime()!==C.getTime()&&c.getTime()!==addMonths(C,1).getTime()&&D(c)}},[a.value]),useClickOutside({isActive:y,ignoreClicksInsideRefs:[t,u].concat(_toConsumableArray(null!==o&&void 0!==o?o:[])),handler:z.off}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeDate,Object.assign({},s,{disabled:p,ref:t,inputRef:useForkRef([v,r]),onClick:z.on})),React.createElement(DatePickerDropdown,{ref:useForkRef([h,u]),anchorRef:t,isOpen:y,value:a.value||void 0,type:"date",view:e,events:c,locale:f,minDate:a.minDate,className:g,maxDate:a.maxDate,currentVisibleDate:C,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)),z.off()},renderAdditionalControls:l,zIndex:getDropdownZIndex(a.style),onChangeCurrentVisibleDate:D}))});
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRef"];import addMonths from"date-fns/addMonths";import startOfMonth from"date-fns/startOfMonth";import React,{forwardRef,useEffect,useRef}from"react";import{useClickOutside}from"../../../hooks/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{setRef}from"../../../utils/setRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeDate}from"../DatePickerFieldTypeDate/DatePickerFieldTypeDate";import{getDropdownZIndex}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCalendarVisible}from"../useCalendarVisible";import{useCurrentVisibleDate}from"../useCurrentVisibleDate";export var DatePickerTypeDate=forwardRef(function(a,b){var c=a.events,d=a.dateTimeView,e=void 0===d?datePickerPropDateTimeViewDefault:d,f=a.locale,g=a.dropdownClassName,h=a.dropdownRef,i=a.dropdownForm,j=a.currentVisibleDate,k=a.onChangeCurrentVisibleDate,l=a.renderAdditionalControls,m=a.onDropdownOpen,n=a.dropdownOpen,o=a.ignoreOutsideClicksRefs,p=a.disabled,q=a.disableDates,r=a.inputRef,s=_objectWithoutProperties(a,_excluded),t=useRef(null),u=useRef(null),v=useRef(null),w=useCalendarVisible({dropdownOpen:n,onDropdownOpen:m,disabled:p,startRef:v}),x=_slicedToArray(w,2),y=x[0],z=x[1],A=useCurrentVisibleDate({currentVisibleDate:j,maxDate:a.maxDate,minDate:a.minDate,value:a.value,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:k,calendarVisible:y}),B=_slicedToArray(A,2),C=B[0],D=B[1];return useEffect(function(){b&&setRef(b,t.current)},[b,t]),useEffect(function(){if(a.value&&"classic"===e&&C){var b=startOfMonth(a.value);return void(b.getTime()!==C.getTime()&&D(b))}if(a.value&&"classic"!==e&&C){var c=startOfMonth(a.value);c.getTime()!==C.getTime()&&c.getTime()!==addMonths(C,1).getTime()&&D(c)}},[a.value]),useClickOutside({isActive:y,ignoreClicksInsideRefs:[t,u].concat(_toConsumableArray(null!==o&&void 0!==o?o:[])),handler:z.off}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeDate,Object.assign({},s,{disabled:p,ref:t,inputRef:useForkRef([v,r]),onClick:z.on})),React.createElement(DatePickerDropdown,{ref:useForkRef([h,u]),anchorRef:t,isOpen:y,value:a.value||void 0,type:"date",view:e,events:c,locale:f,minDate:a.minDate,className:g,maxDate:a.maxDate,currentVisibleDate:C,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)),z.off()},renderAdditionalControls:l,disableDates:q,zIndex:getDropdownZIndex(a.style),onChangeCurrentVisibleDate:D}))});
2
2
  //# sourceMappingURL=DatePickerTypeDate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerTypeDate.js","names":["addMonths","startOfMonth","React","forwardRef","useEffect","useRef","useClickOutside","useForkRef","setRef","DatePickerDropdown","DatePickerFieldTypeDate","getDropdownZIndex","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDate","props","ref","events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRefProp","inputRef","otherProps","fieldRef","calendarRef","startRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","current","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","on","args","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.tsx"],"sourcesContent":["import addMonths from 'date-fns/addMonths';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport React, { forwardRef, useEffect, useRef } from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { setRef } from '##/utils/setRef';\n\nimport { DatePickerDropdown } from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDate } from '../DatePickerFieldTypeDate/DatePickerFieldTypeDate';\nimport { getDropdownZIndex } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDate: DatePickerTypeComponent<'date'> = forwardRef(\n (props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownClassName,\n dropdownRef,\n dropdownForm,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\n inputRef: inputRefProp,\n ...otherProps\n } = props;\n\n const fieldRef = useRef<HTMLDivElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: inputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n calendarVisible,\n });\n\n useEffect(() => {\n if (ref) {\n setRef(ref, fieldRef.current);\n }\n }, [ref, fieldRef]);\n\n useEffect(() => {\n if (props.value && dateTimeView === 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (newVisibleDate.getTime() !== currentVisibleDate.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value && dateTimeView !== 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (\n newVisibleDate.getTime() !== currentVisibleDate.getTime() &&\n newVisibleDate.getTime() !==\n addMonths(currentVisibleDate, 1).getTime()\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n fieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: setCalendarVisible.off,\n });\n\n return (\n <>\n <DatePickerFieldTypeDate\n {...otherProps}\n disabled={disabled}\n ref={fieldRef}\n inputRef={useForkRef([inputRef, inputRefProp])}\n onClick={setCalendarVisible.on}\n />\n <DatePickerDropdown\n ref={useForkRef([dropdownRef, calendarRef])}\n anchorRef={fieldRef}\n isOpen={calendarVisible}\n value={props.value || undefined}\n type=\"date\"\n view={dateTimeView}\n events={events}\n locale={locale}\n minDate={props.minDate}\n className={dropdownClassName}\n maxDate={props.maxDate}\n currentVisibleDate={currentVisibleDate}\n form={dropdownForm}\n onChange={(...args) => {\n props.onChange?.(...args);\n setCalendarVisible.off();\n }}\n renderAdditionalControls={renderAdditionalControls}\n zIndex={getDropdownZIndex(props.style)}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n />\n </>\n );\n },\n);\n"],"mappings":"6eAAA,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,CAkBVF,CAlBU,CAEZE,MAFY,GAkBVF,CAlBU,CAGZG,YAHY,CAGZA,CAHY,YAGGP,iCAHH,GAIZQ,CAJY,CAkBVJ,CAlBU,CAIZI,MAJY,CAKZC,CALY,CAkBVL,CAlBU,CAKZK,iBALY,CAMZC,CANY,CAkBVN,CAlBU,CAMZM,WANY,CAOZC,CAPY,CAkBVP,CAlBU,CAOZO,YAPY,CAQQC,CARR,CAkBVR,CAlBU,CAQZS,kBARY,CASZC,CATY,CAkBVV,CAlBU,CASZU,0BATY,CAUZC,CAVY,CAkBVX,CAlBU,CAUZW,wBAVY,CAWZC,CAXY,CAkBVZ,CAlBU,CAWZY,cAXY,CAYZC,CAZY,CAkBVb,CAlBU,CAYZa,YAZY,CAaZC,CAbY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OATjB,CAUE,SAAS,CAAErB,CAVb,CAWE,OAAO,CAAEL,CAAK,CAACyB,OAXjB,CAYE,kBAAkB,CAAEhB,CAZtB,CAaE,IAAI,CAAEF,CAbR,CAcE,QAAQ,CAAE,mBAAa,8BAAT+B,CAAS,sBAATA,CAAS,2BACrBtC,CAAK,CAACuC,QADe,qBACrB,gBAAAvC,CAAK,QAAL,CAAoBsC,CAApB,EADqB,CAErBd,CAAkB,CAACY,GAAnB,EACD,CAjBH,CAkBE,wBAAwB,CAAEzB,CAlB5B,CAmBE,MAAM,CAAEhB,iBAAiB,CAACK,CAAK,CAACwC,KAAP,CAnB3B,CAoBE,0BAA0B,CAAEX,CApB9B,EARF,CAgCH,CA/G0E,CAAtE"}
1
+ {"version":3,"file":"DatePickerTypeDate.js","names":["addMonths","startOfMonth","React","forwardRef","useEffect","useRef","useClickOutside","useForkRef","setRef","DatePickerDropdown","DatePickerFieldTypeDate","getDropdownZIndex","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeDate","props","ref","events","dateTimeView","locale","dropdownClassName","dropdownRef","dropdownForm","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","inputRefProp","inputRef","otherProps","fieldRef","calendarRef","startRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","setCurrentVisibleDate","current","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","on","args","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.tsx"],"sourcesContent":["import addMonths from 'date-fns/addMonths';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport React, { forwardRef, useEffect, useRef } from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { setRef } from '##/utils/setRef';\n\nimport { DatePickerDropdown } from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeDate } from '../DatePickerFieldTypeDate/DatePickerFieldTypeDate';\nimport { getDropdownZIndex } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeDate: DatePickerTypeComponent<'date'> = forwardRef(\n (props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownClassName,\n dropdownRef,\n dropdownForm,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\n inputRef: inputRefProp,\n ...otherProps\n } = props;\n\n const fieldRef = useRef<HTMLDivElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: inputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n calendarVisible,\n });\n\n useEffect(() => {\n if (ref) {\n setRef(ref, fieldRef.current);\n }\n }, [ref, fieldRef]);\n\n useEffect(() => {\n if (props.value && dateTimeView === 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (newVisibleDate.getTime() !== currentVisibleDate.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value && dateTimeView !== 'classic' && currentVisibleDate) {\n const newVisibleDate = startOfMonth(props.value);\n if (\n newVisibleDate.getTime() !== currentVisibleDate.getTime() &&\n newVisibleDate.getTime() !==\n addMonths(currentVisibleDate, 1).getTime()\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n fieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: setCalendarVisible.off,\n });\n\n return (\n <>\n <DatePickerFieldTypeDate\n {...otherProps}\n disabled={disabled}\n ref={fieldRef}\n inputRef={useForkRef([inputRef, inputRefProp])}\n onClick={setCalendarVisible.on}\n />\n <DatePickerDropdown\n ref={useForkRef([dropdownRef, calendarRef])}\n anchorRef={fieldRef}\n isOpen={calendarVisible}\n value={props.value || undefined}\n type=\"date\"\n view={dateTimeView}\n events={events}\n locale={locale}\n minDate={props.minDate}\n className={dropdownClassName}\n maxDate={props.maxDate}\n currentVisibleDate={currentVisibleDate}\n form={dropdownForm}\n onChange={(...args) => {\n props.onChange?.(...args);\n setCalendarVisible.off();\n }}\n renderAdditionalControls={renderAdditionalControls}\n disableDates={disableDates}\n zIndex={getDropdownZIndex(props.style)}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n />\n </>\n );\n },\n);\n"],"mappings":"6eAAA,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,CAkBVF,CAlBU,CAEZE,MAFY,GAkBVF,CAlBU,CAGZG,YAHY,CAGZA,CAHY,YAGGP,iCAHH,GAIZQ,CAJY,CAkB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AAD,CAJtB,CAKE,OAAO,CAAEO,CAAkB,CAACa,EAL9B,GADF,CAQE,oBAAC,kBAAD,EACE,GAAG,CAAE9C,UAAU,CAAC,CAACe,CAAD,CAAce,CAAd,CAAD,CADjB,CAEE,SAAS,CAAED,CAFb,CAGE,MAAM,CAAEG,CAHV,CAIE,KAAK,CAAEvB,CAAK,CAAC2B,KAAN,QAJT,CAKE,IAAI,CAAC,MALP,CAME,IAAI,CAAExB,CANR,CAOE,MAAM,CAAED,CAPV,CAQE,MAAM,CAAEE,CARV,CASE,OAAO,CAAEJ,CAAK,CAAC0B,OATjB,CAUE,SAAS,CAAErB,CAVb,CAWE,OAAO,CAAEL,CAAK,CAACyB,OAXjB,CAYE,kBAAkB,CAAEhB,CAZtB,CAaE,IAAI,CAAEF,CAbR,CAcE,QAAQ,CAAE,mBAAa,8BAAT+B,CAAS,sBAATA,CAAS,2BACrBtC,CAAK,CAACuC,QADe,qBACrB,gBAAAvC,CAAK,QAAL,CAAoBsC,CAApB,EADqB,CAErBd,CAAkB,CAACY,GAAnB,EACD,CAjBH,CAkBE,wBAAwB,CAAEzB,CAlB5B,CAmBE,YAAY,CAAEK,CAnBhB,CAoBE,MAAM,CAAErB,iBAAiB,CAACK,CAAK,CAACwC,KAAP,CApB3B,CAqBE,0BAA0B,CAAEX,CArB9B,EARF,CAiCH,CAhH0E,CAAtE"}
@@ -1,2 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","minDate","maxDate","value","disableDates","onChange","onChangeRange","currentVisibleDate","events","locale","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate"];import{addMonths,startOfMonth}from"date-fns";import ruLocale from"date-fns/locale/ru";import React,{forwardRef,useEffect}from"react";import{useFlag}from"../../../hooks/useFlag/useFlag";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";import{DateTimeMonth}from"../DateTimeMonth/DateTimeMonth";import{DateTimeToggler}from"../DateTimeToggler/DateTimeToggler";import{DateTimeTypeMonth}from"../DateTimeTypeMonth/DateTimeTypeMonth";import{DateTimeYearSlider}from"../DateTimeYearSlider/DateTimeYearSlider";import{getDaysOfMonth,getDaysOfWeek,getHandleSelectDate,getMouthLabelWithYear,isEqualDay,moveTypes,useCurrentVisibleDate}from"../helpers";import{dateTimePropView,dateTimePropViewDefault}from"../helpers/types";import{cnDateTimeMixLayout}from"../mixs";export var DateTimeTypeDate=forwardRef(function(a,b){var c=a.className,d=a.minDate,e=a.maxDate,f=a.value,g=a.disableDates,h=a.onChange,i=a.onChangeRange,j=a.currentVisibleDate,k=a.events,l=a.locale,m=void 0===l?ruLocale:l,n=a.view,o=void 0===n?dateTimePropViewDefault:n,p=a.multiplicityHours,q=a.multiplicityMinutes,r=a.multiplicitySeconds,s=a.onMove,t=a.onChangeCurrentVisibleDate,u=_objectWithoutProperties(a,_excluded),v=useFlag(),w=_slicedToArray(v,2),x=w[0],y=w[1];useEffect(function(){x||(null===s||void 0===s?void 0:s(moveTypes[2]))},[x]);var z=useCurrentVisibleDate({currentVisibleDate:j,maxDate:e,minDate:d,value:f,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:t}),A=_slicedToArray(z,2),B=A[0],C=A[1];if(x)return React.createElement(DateTimeTypeMonth,Object.assign({},u,{ref:b,className:c,minDate:d,maxDate:e,locale:m,events:k,currentVisibleDate:B,view:o,onChange:function(a){C(a),y.off()},onMove:s}));var D=getHandleSelectDate({minDate:d,maxDate:e,value:f,onChange:h,onChangeRange:i,isEqualUnit:isEqualDay}),E=getDaysOfMonth({date:B,disableDates:g,handleDayClick:D,value:f,events:k,minDate:d,maxDate:e,locale:m}),F=getMouthLabelWithYear(B,m),G=getDaysOfWeek(m),H=function(){return C(addMonths(B,1))},I=function(){return C(addMonths(B,-1))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},u,{ref:b,className:cnDateTimeMixLayout({view:o},[c])}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:I,nextOnClick:H,label:F,onLabelClick:y.on}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:E}));var J=addMonths(B,1),K=getDaysOfMonth({date:J,handleDayClick:D,value:f,events:k,minDate:d,maxDate:e,locale:m}),L=getMouthLabelWithYear(J,m);return o===dateTimePropView[1]?React.createElement("div",Object.assign({},u,{ref:b,className:cnDateTimeMixLayout({view:o},[c])}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:I,label:F,onLabelClick:y.on}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:E})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:H,label:L,onLabelClick:y.on}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:K}))):React.createElement("div",Object.assign({},u,{ref:b,className:cnDateTimeMixLayout({view:o},[c])}),React.createElement(DateTimeYearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:B,onChange:C,value:f,locale:m}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:F,onClick:y.on,cursor:"pointer"}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:E})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:L,onClick:y.on,cursor:"pointer"}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:K}))))});
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","minDate","maxDate","value","disableDates","onChange","onChangeRange","currentVisibleDate","events","locale","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate"];import{addMonths,startOfMonth}from"date-fns";import ruLocale from"date-fns/locale/ru";import React,{forwardRef,useEffect}from"react";import{useFlag}from"../../../hooks/useFlag/useFlag";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";import{DateTimeMonth}from"../DateTimeMonth/DateTimeMonth";import{DateTimeToggler}from"../DateTimeToggler/DateTimeToggler";import{DateTimeTypeMonth}from"../DateTimeTypeMonth/DateTimeTypeMonth";import{DateTimeYearSlider}from"../DateTimeYearSlider/DateTimeYearSlider";import{getDaysOfMonth,getDaysOfWeek,getHandleSelectDate,getMouthLabelWithYear,isEqualDay,moveTypes,useCurrentVisibleDate}from"../helpers";import{dateTimePropView,dateTimePropViewDefault}from"../helpers/types";import{cnDateTimeMixLayout}from"../mixs";export var DateTimeTypeDate=forwardRef(function(a,b){var c=a.className,d=a.minDate,e=a.maxDate,f=a.value,g=a.disableDates,h=a.onChange,i=a.onChangeRange,j=a.currentVisibleDate,k=a.events,l=a.locale,m=void 0===l?ruLocale:l,n=a.view,o=void 0===n?dateTimePropViewDefault:n,p=a.multiplicityHours,q=a.multiplicityMinutes,r=a.multiplicitySeconds,s=a.onMove,t=a.onChangeCurrentVisibleDate,u=_objectWithoutProperties(a,_excluded),v=useFlag(),w=_slicedToArray(v,2),x=w[0],y=w[1];useEffect(function(){x||(null===s||void 0===s?void 0:s(moveTypes[2]))},[x]);var z=useCurrentVisibleDate({currentVisibleDate:j,maxDate:e,minDate:d,value:f,startOfUnit:startOfMonth,onChangeCurrentVisibleDate:t}),A=_slicedToArray(z,2),B=A[0],C=A[1];if(x)return React.createElement(DateTimeTypeMonth,Object.assign({},u,{ref:b,className:c,minDate:d,maxDate:e,locale:m,events:k,currentVisibleDate:B,view:o,onChange:function(a){C(a),y.off()},onMove:s}));var D=getHandleSelectDate({minDate:d,maxDate:e,value:f,onChange:h,onChangeRange:i,isEqualUnit:isEqualDay}),E=getDaysOfMonth({date:B,disableDates:g,handleDayClick:D,value:f,events:k,minDate:d,maxDate:e,locale:m}),F=getMouthLabelWithYear(B,m),G=getDaysOfWeek(m),H=function(){return C(addMonths(B,1))},I=function(){return C(addMonths(B,-1))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},u,{ref:b,className:cnDateTimeMixLayout({view:o},[c])}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:I,nextOnClick:H,label:F,onLabelClick:y.on}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:E}));var J=addMonths(B,1),K=getDaysOfMonth({date:J,disableDates:g,handleDayClick:D,value:f,events:k,minDate:d,maxDate:e,locale:m}),L=getMouthLabelWithYear(J,m);return o===dateTimePropView[1]?React.createElement("div",Object.assign({},u,{ref:b,className:cnDateTimeMixLayout({view:o},[c])}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:I,label:F,onLabelClick:y.on}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:E})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:H,label:L,onLabelClick:y.on}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:K}))):React.createElement("div",Object.assign({},u,{ref:b,className:cnDateTimeMixLayout({view:o},[c])}),React.createElement(DateTimeYearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:B,onChange:C,value:f,locale:m}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:F,onClick:y.on,cursor:"pointer"}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:E})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:L,onClick:y.on,cursor:"pointer"}),React.createElement(DateTimeMonth,{daysOfWeek:G,daysOfMonth:K}))))});
2
2
  //# sourceMappingURL=DateTimeTypeDate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeTypeDate.js","names":["addMonths","startOfMonth","ruLocale","React","forwardRef","useEffect","useFlag","DateTimeLabel","DateTimeMonth","DateTimeToggler","DateTimeTypeMonth","DateTimeYearSlider","getDaysOfMonth","getDaysOfWeek","getHandleSelectDate","getMouthLabelWithYear","isEqualDay","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeDate","props","ref","className","minDate","maxDate","value","disableDates","onChange","onChangeRange","currentVisibleDateProp","currentVisibleDate","events","locale","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate","otherProps","changeMonth","setChangeMonth","startOfUnit","setCurrentVisibleDate","off","handleSelectDate","isEqualUnit","pageOneDaysOfMonth","date","handleDayClick","pageOneLabel","daysOfWeek","nextMonthHandle","prevMonthHandle","on","pageTwoCurrentVisibleDate","pageTwoDaysOfMonth","pageTwoLabel"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.tsx"],"sourcesContent":["import { addMonths, startOfMonth } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeMonth } from '../DateTimeMonth/DateTimeMonth';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport { DateTimeTypeMonth } from '../DateTimeTypeMonth/DateTimeTypeMonth';\nimport { DateTimeYearSlider } from '../DateTimeYearSlider/DateTimeYearSlider';\nimport {\n DateTimeTypeComponent,\n getDaysOfMonth,\n getDaysOfWeek,\n getHandleSelectDate,\n getMouthLabelWithYear,\n isEqualDay,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeDate: DateTimeTypeComponent<'date'> = forwardRef(\n (props, ref) => {\n const {\n className,\n minDate,\n maxDate,\n value,\n disableDates,\n onChange,\n onChangeRange,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n view = dateTimePropViewDefault,\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n onMove,\n onChangeCurrentVisibleDate,\n ...otherProps\n } = props;\n\n const [changeMonth, setChangeMonth] = useFlag();\n\n useEffect(() => {\n !changeMonth && onMove?.(moveTypes[2]);\n }, [changeMonth]);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n });\n\n if (changeMonth) {\n return (\n <DateTimeTypeMonth\n {...otherProps}\n ref={ref}\n className={className}\n minDate={minDate}\n maxDate={maxDate}\n locale={locale}\n events={events}\n currentVisibleDate={currentVisibleDate}\n view={view}\n onChange={(value) => {\n setCurrentVisibleDate(value);\n setChangeMonth.off();\n }}\n onMove={onMove}\n />\n );\n }\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualDay,\n });\n\n const pageOneDaysOfMonth = getDaysOfMonth({\n date: currentVisibleDate,\n disableDates,\n handleDayClick: handleSelectDate,\n value,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getMouthLabelWithYear(currentVisibleDate, locale);\n\n const daysOfWeek = getDaysOfWeek(locale);\n\n const nextMonthHandle = () =>\n setCurrentVisibleDate(addMonths(currentVisibleDate, 1));\n const prevMonthHandle = () =>\n setCurrentVisibleDate(addMonths(currentVisibleDate, -1));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnDateTimeMixLayout({ view }, [className])}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={prevMonthHandle}\n nextOnClick={nextMonthHandle}\n label={pageOneLabel}\n onLabelClick={setChangeMonth.on}\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageOneDaysOfMonth}\n />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addMonths(currentVisibleDate, 1);\n\n const pageTwoDaysOfMonth = getDaysOfMonth({\n date: pageTwoCurrentVisibleDate,\n handleDayClick: handleSelectDate,\n value,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageTwoLabel = getMouthLabelWithYear(\n pageTwoCurrentVisibleDate,\n locale,\n );\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnDateTimeMixLayout({ view }, [className])}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={prevMonthHandle}\n label={pageOneLabel}\n onLabelClick={setChangeMonth.on}\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageOneDaysOfMonth}\n />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={nextMonthHandle}\n label={pageTwoLabel}\n onLabelClick={setChangeMonth.on}\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageTwoDaysOfMonth}\n />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnDateTimeMixLayout({ view }, [className])}\n >\n <DateTimeYearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n onClick={setChangeMonth.on}\n cursor=\"pointer\"\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageOneDaysOfMonth}\n />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n onClick={setChangeMonth.on}\n cursor=\"pointer\"\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageTwoDaysOfMonth}\n />\n </div>\n </div>\n </div>\n );\n },\n);\n"],"mappings":"4YAAA,OAASA,SAAT,CAAoBC,YAApB,KAAwC,UAAxC,CACA,MAAOC,SAAP,KAAqB,oBAArB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OAASC,OAAT,sCACA,OAASC,aAAT,sCACA,OAASC,aAAT,sCACA,OAASC,eAAT,0CACA,OAASC,iBAAT,8CACA,OAASC,kBAAT,gDACA,OAEEC,cAFF,CAGEC,aAHF,CAIEC,mBAJF,CAKEC,qBALF,CAMEC,UANF,CAOEC,SAPF,CAQEC,qBARF,kBAUA,OAASC,gBAAT,CAA2BC,uBAA3B,wBACA,OAASC,mBAAT,eAEA,MAAO,IAAMC,iBAA+C,CAAGlB,UAAU,CACvE,SAACmB,CAAD,CAAQC,CAAR,CAAgB,IAEZC,EAFY,CAmBVF,CAnBU,CAEZE,SAFY,CAGZC,CAHY,CAmBVH,CAnBU,CAGZG,OAHY,CAIZC,CAJY,CAmBVJ,CAnBU,CAIZI,OAJY,CAKZC,CALY,CAmBVL,CAnBU,CAKZK,KALY,CAMZC,CANY,CAmBVN,CAnBU,CAMZM,YANY,CAOZC,CAPY,CAmBVP,CAnBU,CAOZO,QAPY,CAQZC,CARY,CAmBVR,CAnBU,CAQZQ,aARY,CASQC,CATR,CAmBVT,CAnBU,CASZU,kBATY,CAUZC,CAVY,CAmBVX,CAnBU,CAUZW,MAV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AEE,WAAW,CAAEK,CAFf,EAPF,CAjBF,CA/HU,CAiKZ,2CACMjB,CADN,EAEE,GAAG,CAAElB,CAFP,CAGE,SAAS,CAAEH,mBAAmB,CAAC,CAAEe,IAAI,CAAJA,CAAF,CAAD,CAAW,CAACX,CAAD,CAAX,CAHhC,GAKE,oBAAC,kBAAD,EACE,SAAS,CAAEJ,mBAAmB,CAAC,QAAD,CADhC,CAEE,kBAAkB,CAAEY,CAFtB,CAGE,QAAQ,CAAEa,CAHZ,CAIE,KAAK,CAAElB,CAJT,CAKE,MAAM,CAAEO,CALV,EALF,CAYE,2BAAK,SAAS,CAAEd,mBAAmB,CAAC,aAAD,CAAnC,EACE,2BAAK,SAAS,CAAEA,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEgC,CAFT,CAGE,OAAO,CAAET,CAAc,CAACa,EAH1B,CAIE,MAAM,CAAC,SAJT,EADF,CAOE,oBAAC,aAAD,EACE,UAAU,CAAEH,CADd,CAEE,WAAW,CAAEJ,CAFf,EAPF,CADF,CAaE,2BAAK,SAAS,CAAE7B,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEuC,CAFT,CAGE,OAAO,CAAEhB,CAAc,CAACa,EAH1B,CAIE,MAAM,CAAC,SAJT,EADF,CAOE,oBAAC,aAAD,EACE,UAAU,CAAEH,CADd,CAEE,WAAW,CAAEK,CAFf,EAPF,CAbF,CAZF,CAwCH,CA1MsE,CAAlE"}
1
+ {"version":3,"file":"DateTimeTypeDate.js","names":["addMonths","startOfMonth","ruLocale","React","forwardRef","useEffect","useFlag","DateTimeLabel","DateTimeMonth","DateTimeToggler","DateTimeTypeMonth","DateTimeYearSlider","getDaysOfMonth","getDaysOfWeek","getHandleSelectDate","getMouthLabelWithYear","isEqualDay","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeDate","props","ref","className","minDate","maxDate","value","disableDates","onChange","onChangeRange","currentVisibleDateProp","currentVisibleDate","events","locale","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate","otherProps","changeMonth","setChangeMonth","startOfUnit","setCurrentVisibleDate","off","handleSelectDate","isEqualUnit","pageOneDaysOfMonth","date","handleDayClick","pageOneLabel","daysOfWeek","nextMonthHandle","prevMonthHandle","on","pageTwoCurrentVisibleDate","pageTwoDaysOfMonth","pageTwoLabel"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.tsx"],"sourcesContent":["import { addMonths, startOfMonth } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeMonth } from '../DateTimeMonth/DateTimeMonth';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport { DateTimeTypeMonth } from '../DateTimeTypeMonth/DateTimeTypeMonth';\nimport { DateTimeYearSlider } from '../DateTimeYearSlider/DateTimeYearSlider';\nimport {\n DateTimeTypeComponent,\n getDaysOfMonth,\n getDaysOfWeek,\n getHandleSelectDate,\n getMouthLabelWithYear,\n isEqualDay,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeDate: DateTimeTypeComponent<'date'> = forwardRef(\n (props, ref) => {\n const {\n className,\n minDate,\n maxDate,\n value,\n disableDates,\n onChange,\n onChangeRange,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n view = dateTimePropViewDefault,\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n onMove,\n onChangeCurrentVisibleDate,\n ...otherProps\n } = props;\n\n const [changeMonth, setChangeMonth] = useFlag();\n\n useEffect(() => {\n !changeMonth && onMove?.(moveTypes[2]);\n }, [changeMonth]);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfMonth,\n onChangeCurrentVisibleDate,\n });\n\n if (changeMonth) {\n return (\n <DateTimeTypeMonth\n {...otherProps}\n ref={ref}\n className={className}\n minDate={minDate}\n maxDate={maxDate}\n locale={locale}\n events={events}\n currentVisibleDate={currentVisibleDate}\n view={view}\n onChange={(value) => {\n setCurrentVisibleDate(value);\n setChangeMonth.off();\n }}\n onMove={onMove}\n />\n );\n }\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualDay,\n });\n\n const pageOneDaysOfMonth = getDaysOfMonth({\n date: currentVisibleDate,\n disableDates,\n handleDayClick: handleSelectDate,\n value,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getMouthLabelWithYear(currentVisibleDate, locale);\n\n const daysOfWeek = getDaysOfWeek(locale);\n\n const nextMonthHandle = () =>\n setCurrentVisibleDate(addMonths(currentVisibleDate, 1));\n const prevMonthHandle = () =>\n setCurrentVisibleDate(addMonths(currentVisibleDate, -1));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnDateTimeMixLayout({ view }, [className])}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={prevMonthHandle}\n nextOnClick={nextMonthHandle}\n label={pageOneLabel}\n onLabelClick={setChangeMonth.on}\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageOneDaysOfMonth}\n />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addMonths(currentVisibleDate, 1);\n\n const pageTwoDaysOfMonth = getDaysOfMonth({\n date: pageTwoCurrentVisibleDate,\n disableDates,\n handleDayClick: handleSelectDate,\n value,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageTwoLabel = getMouthLabelWithYear(\n pageTwoCurrentVisibleDate,\n locale,\n );\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnDateTimeMixLayout({ view }, [className])}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={prevMonthHandle}\n label={pageOneLabel}\n onLabelClick={setChangeMonth.on}\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageOneDaysOfMonth}\n />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={nextMonthHandle}\n label={pageTwoLabel}\n onLabelClick={setChangeMonth.on}\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageTwoDaysOfMonth}\n />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnDateTimeMixLayout({ view }, [className])}\n >\n <DateTimeYearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n onClick={setChangeMonth.on}\n cursor=\"pointer\"\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n daysOfMonth={pageOneDaysOfMonth}\n />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n onClick={setChangeMonth.on}\n cursor=\"pointer\"\n />\n <DateTimeMonth\n daysOfWeek={daysOfWeek}\n da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AEY,CAFtB,CAGE,QAAQ,CAAEa,CAHZ,CAIE,KAAK,CAAElB,CAJT,CAKE,MAAM,CAAEO,CALV,EALF,CAYE,2BAAK,SAAS,CAAEd,mBAAmB,CAAC,aAAD,CAAnC,EACE,2BAAK,SAAS,CAAEA,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEgC,CAFT,CAGE,OAAO,CAAET,CAAc,CAACa,EAH1B,CAIE,MAAM,CAAC,SAJT,EADF,CAOE,oBAAC,aAAD,EACE,UAAU,CAAEH,CADd,CAEE,WAAW,CAAEJ,CAFf,EAPF,CADF,CAaE,2BAAK,SAAS,CAAE7B,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEuC,CAFT,CAGE,OAAO,CAAEhB,CAAc,CAACa,EAH1B,CAIE,MAAM,CAAC,SAJT,EADF,CAOE,oBAAC,aAAD,EACE,UAAU,CAAEH,CADd,CAEE,WAAW,CAAEK,CAFf,EAPF,CAbF,CAZF,CAwCH,CA3MsE,CAAlE"}
@@ -1,2 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDate","events","locale","className","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate"];import{addYears,startOfYear}from"date-fns";import ruLocale from"date-fns/locale/ru";import React,{forwardRef,useEffect}from"react";import{useFlag}from"../../../hooks/useFlag/useFlag";import{DateTime10Years}from"../DateTime10Years/DateTime10Years";import{DateTime10YearSlider}from"../DateTime10YearSlider/DateTime10YearSlider";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";import{DateTimeToggler}from"../DateTimeToggler/DateTimeToggler";import{DateTimeTypeYear}from"../DateTimeTypeYear/DateTimeTypeYear";import{DateTimeYear}from"../DateTimeYear/DateTimeYear";import{getHandleSelectDate,getMonthsOfYear,getYearTitle,isEqualMount,moveTypes,useCurrentVisibleDate}from"../helpers";import{dateTimePropView,dateTimePropViewDefault}from"../helpers/types";import{cnDateTimeMixLayout}from"../mixs";export var DateTimeTypeMonth=forwardRef(function(a,b){var c=a.minDate,d=a.maxDate,e=a.value,f=a.onChange,g=a.onChangeRange,h=a.disableDates,i=a.currentVisibleDate,j=a.events,k=a.locale,l=void 0===k?ruLocale:k,m=a.className,n=a.view,o=void 0===n?dateTimePropViewDefault:n,p=a.multiplicityHours,q=a.multiplicityMinutes,r=a.multiplicitySeconds,s=a.onMove,t=a.onChangeCurrentVisibleDate,u=_objectWithoutProperties(a,_excluded),v=useFlag(),w=_slicedToArray(v,2),x=w[0],y=w[1],z=y.on,A=y.off;useEffect(function(){x||(null===s||void 0===s?void 0:s(moveTypes[1]))},[x]);var B=useCurrentVisibleDate({currentVisibleDate:i,maxDate:d,minDate:c,value:e,startOfUnit:startOfYear,onChangeCurrentVisibleDate:t}),C=_slicedToArray(B,2),D=C[0],E=C[1];if(x)return React.createElement(DateTimeTypeYear,Object.assign({},u,{ref:b,className:m,currentVisibleDate:D,minDate:c,maxDate:d,locale:l,events:j,view:o,onChange:function(a){E(a),A()},onMove:s}));var F=getHandleSelectDate({minDate:c,maxDate:d,value:e,onChange:f,onChangeRange:g,isEqualUnit:isEqualMount}),G=getMonthsOfYear({date:D,onChange:F,value:e,events:j,disableDates:h,minDate:c,maxDate:d,locale:l}),H=getYearTitle(D),I=function(){return E(addYears(D,1))},J=function(){return E(addYears(D,-1))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:J,nextOnClick:I,label:H,onLabelClick:z}),React.createElement(DateTimeYear,{years:G}));var K=addYears(D,1),L=getYearTitle(K),M=getMonthsOfYear({date:K,onChange:F,value:e,events:j,minDate:c,maxDate:d,locale:l});return o===dateTimePropView[1]?React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:J,label:H,onLabelClick:z}),React.createElement(DateTime10Years,{years:G})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:I,label:L,onLabelClick:z}),React.createElement(DateTime10Years,{years:M}))):React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTime10YearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:D,onChange:E,value:e,locale:l}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:H,onClick:z,cursor:"pointer"}),React.createElement(DateTime10Years,{years:G})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:L,onClick:z,cursor:"pointer"}),React.createElement(DateTime10Years,{years:M}))))});
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDate","events","locale","className","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate"];import{addYears,startOfYear}from"date-fns";import ruLocale from"date-fns/locale/ru";import React,{forwardRef,useEffect}from"react";import{useFlag}from"../../../hooks/useFlag/useFlag";import{DateTime10Years}from"../DateTime10Years/DateTime10Years";import{DateTime10YearSlider}from"../DateTime10YearSlider/DateTime10YearSlider";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";import{DateTimeToggler}from"../DateTimeToggler/DateTimeToggler";import{DateTimeTypeYear}from"../DateTimeTypeYear/DateTimeTypeYear";import{DateTimeYear}from"../DateTimeYear/DateTimeYear";import{getHandleSelectDate,getMonthsOfYear,getYearTitle,isEqualMount,moveTypes,useCurrentVisibleDate}from"../helpers";import{dateTimePropView,dateTimePropViewDefault}from"../helpers/types";import{cnDateTimeMixLayout}from"../mixs";export var DateTimeTypeMonth=forwardRef(function(a,b){var c=a.minDate,d=a.maxDate,e=a.value,f=a.onChange,g=a.onChangeRange,h=a.disableDates,i=a.currentVisibleDate,j=a.events,k=a.locale,l=void 0===k?ruLocale:k,m=a.className,n=a.view,o=void 0===n?dateTimePropViewDefault:n,p=a.multiplicityHours,q=a.multiplicityMinutes,r=a.multiplicitySeconds,s=a.onMove,t=a.onChangeCurrentVisibleDate,u=_objectWithoutProperties(a,_excluded),v=useFlag(),w=_slicedToArray(v,2),x=w[0],y=w[1],z=y.on,A=y.off;useEffect(function(){x||(null===s||void 0===s?void 0:s(moveTypes[1]))},[x]);var B=useCurrentVisibleDate({currentVisibleDate:i,maxDate:d,minDate:c,value:e,startOfUnit:startOfYear,onChangeCurrentVisibleDate:t}),C=_slicedToArray(B,2),D=C[0],E=C[1];if(x)return React.createElement(DateTimeTypeYear,Object.assign({},u,{ref:b,className:m,currentVisibleDate:D,minDate:c,maxDate:d,locale:l,events:j,view:o,onChange:function(a){E(a),A()},onMove:s}));var F=getHandleSelectDate({minDate:c,maxDate:d,value:e,onChange:f,onChangeRange:g,isEqualUnit:isEqualMount}),G=getMonthsOfYear({date:D,onChange:F,value:e,events:j,disableDates:h,minDate:c,maxDate:d,locale:l}),H=getYearTitle(D),I=function(){return E(addYears(D,1))},J=function(){return E(addYears(D,-1))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:J,nextOnClick:I,label:H,onLabelClick:z}),React.createElement(DateTimeYear,{years:G}));var K=addYears(D,1),L=getYearTitle(K),M=getMonthsOfYear({date:K,onChange:F,value:e,events:j,disableDates:h,minDate:c,maxDate:d,locale:l});return o===dateTimePropView[1]?React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:J,label:H,onLabelClick:z}),React.createElement(DateTime10Years,{years:G})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:I,label:L,onLabelClick:z}),React.createElement(DateTime10Years,{years:M}))):React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTime10YearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:D,onChange:E,value:e,locale:l}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:H,onClick:z,cursor:"pointer"}),React.createElement(DateTime10Years,{years:G})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:L,onClick:z,cursor:"pointer"}),React.createElement(DateTime10Years,{years:M}))))});
2
2
  //# sourceMappingURL=DateTimeTypeMonth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeTypeMonth.js","names":["addYears","startOfYear","ruLocale","React","forwardRef","useEffect","useFlag","DateTime10Years","DateTime10YearSlider","DateTimeLabel","DateTimeToggler","DateTimeTypeYear","DateTimeYear","getHandleSelectDate","getMonthsOfYear","getYearTitle","isEqualMount","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeMonth","props","ref","minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDateProp","currentVisibleDate","events","locale","className","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate","otherProps","changeYear","on","off","startOfUnit","setCurrentVisibleDate","handleSelectDate","isEqualUnit","pageOneMonthsOfYear","date","pageOneLabel","handleNext","handlePrev","pageTwoCurrentVisibleDate","pageTwoLabel","pageTwoMonthsOfYear"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.tsx"],"sourcesContent":["import { addYears, startOfYear } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { DateTime10Years } from '../DateTime10Years/DateTime10Years';\nimport { DateTime10YearSlider } from '../DateTime10YearSlider/DateTime10YearSlider';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport { DateTimeTypeYear } from '../DateTimeTypeYear/DateTimeTypeYear';\nimport { DateTimeYear } from '../DateTimeYear/DateTimeYear';\nimport {\n DateTimeTypeComponent,\n getHandleSelectDate,\n getMonthsOfYear,\n getYearTitle,\n isEqualMount,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeMonth: DateTimeTypeComponent<'month'> = forwardRef(\n (props, ref) => {\n const {\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n disableDates,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n className,\n view = dateTimePropViewDefault,\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n onMove,\n onChangeCurrentVisibleDate,\n ...otherProps\n } = props;\n\n const [changeYear, { on, off }] = useFlag();\n\n useEffect(() => {\n !changeYear && onMove?.(moveTypes[1]);\n }, [changeYear]);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfYear,\n onChangeCurrentVisibleDate,\n });\n\n if (changeYear) {\n return (\n <DateTimeTypeYear\n {...otherProps}\n ref={ref}\n className={className}\n currentVisibleDate={currentVisibleDate}\n minDate={minDate}\n maxDate={maxDate}\n locale={locale}\n events={events}\n view={view}\n onChange={(value) => {\n setCurrentVisibleDate(value);\n off();\n }}\n onMove={onMove}\n />\n );\n }\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualMount,\n });\n\n const pageOneMonthsOfYear = getMonthsOfYear({\n date: currentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n disableDates,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getYearTitle(currentVisibleDate);\n\n const handleNext = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, 1));\n const handlePrev = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, -1));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n nextOnClick={handleNext}\n label={pageOneLabel}\n onLabelClick={on}\n />\n <DateTimeYear years={pageOneMonthsOfYear} />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addYears(currentVisibleDate, 1);\n\n const pageTwoLabel = getYearTitle(pageTwoCurrentVisibleDate);\n\n const pageTwoMonthsOfYear = getMonthsOfYear({\n date: pageTwoCurrentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n label={pageOneLabel}\n onLabelClick={on}\n />\n <DateTime10Years years={pageOneMonthsOfYear} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={handleNext}\n label={pageTwoLabel}\n onLabelClick={on}\n />\n <DateTime10Years years={pageTwoMonthsOfYear} />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTime10YearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n onClick={on}\n cursor=\"pointer\"\n />\n <DateTime10Years years={pageOneMonthsOfYear} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n onClick={on}\n cursor=\"pointer\"\n />\n <DateTime10Years years={pageTwoMonthsOfYear} />\n </div>\n </div>\n </div>\n );\n },\n);\n"],"mappings":"4YAAA,OAASA,QAAT,CAAmBC,WAAnB,KAAsC,UAAtC,CACA,MAAOC,SAAP,KAAqB,oBAArB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OAASC,OAAT,sCACA,OAASC,eAAT,0CACA,OAASC,oBAAT,oDACA,OAASC,aAAT,sCACA,OAASC,eAAT,0CACA,OAASC,gBAAT,4CACA,OAASC,YAAT,oCACA,OAEEC,mBAFF,CAGEC,eAHF,CAIEC,YAJF,CAKEC,YALF,CAMEC,SANF,CAOEC,qBAPF,kBASA,OAASC,gBA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KAAK,CAAEa,CAAxB,EAPF,CAVF,CAZF,CAkCH,CAtLwE,CAApE"}
1
+ {"version":3,"file":"DateTimeTypeMonth.js","names":["addYears","startOfYear","ruLocale","React","forwardRef","useEffect","useFlag","DateTime10Years","DateTime10YearSlider","DateTimeLabel","DateTimeToggler","DateTimeTypeYear","DateTimeYear","getHandleSelectDate","getMonthsOfYear","getYearTitle","isEqualMount","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeMonth","props","ref","minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDateProp","currentVisibleDate","events","locale","className","view","multiplicityHours","multiplicityMinutes","multiplicitySeconds","onMove","onChangeCurrentVisibleDate","otherProps","changeYear","on","off","startOfUnit","setCurrentVisibleDate","handleSelectDate","isEqualUnit","pageOneMonthsOfYear","date","pageOneLabel","handleNext","handlePrev","pageTwoCurrentVisibleDate","pageTwoLabel","pageTwoMonthsOfYear"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.tsx"],"sourcesContent":["import { addYears, startOfYear } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { DateTime10Years } from '../DateTime10Years/DateTime10Years';\nimport { DateTime10YearSlider } from '../DateTime10YearSlider/DateTime10YearSlider';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport { DateTimeTypeYear } from '../DateTimeTypeYear/DateTimeTypeYear';\nimport { DateTimeYear } from '../DateTimeYear/DateTimeYear';\nimport {\n DateTimeTypeComponent,\n getHandleSelectDate,\n getMonthsOfYear,\n getYearTitle,\n isEqualMount,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeMonth: DateTimeTypeComponent<'month'> = forwardRef(\n (props, ref) => {\n const {\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n disableDates,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n className,\n view = dateTimePropViewDefault,\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n onMove,\n onChangeCurrentVisibleDate,\n ...otherProps\n } = props;\n\n const [changeYear, { on, off }] = useFlag();\n\n useEffect(() => {\n !changeYear && onMove?.(moveTypes[1]);\n }, [changeYear]);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfYear,\n onChangeCurrentVisibleDate,\n });\n\n if (changeYear) {\n return (\n <DateTimeTypeYear\n {...otherProps}\n ref={ref}\n className={className}\n currentVisibleDate={currentVisibleDate}\n minDate={minDate}\n maxDate={maxDate}\n locale={locale}\n events={events}\n view={view}\n onChange={(value) => {\n setCurrentVisibleDate(value);\n off();\n }}\n onMove={onMove}\n />\n );\n }\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualMount,\n });\n\n const pageOneMonthsOfYear = getMonthsOfYear({\n date: currentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n disableDates,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getYearTitle(currentVisibleDate);\n\n const handleNext = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, 1));\n const handlePrev = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, -1));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n nextOnClick={handleNext}\n label={pageOneLabel}\n onLabelClick={on}\n />\n <DateTimeYear years={pageOneMonthsOfYear} />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addYears(currentVisibleDate, 1);\n\n const pageTwoLabel = getYearTitle(pageTwoCurrentVisibleDate);\n\n const pageTwoMonthsOfYear = getMonthsOfYear({\n date: pageTwoCurrentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n disableDates,\n minDate,\n maxDate,\n locale,\n });\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n label={pageOneLabel}\n onLabelClick={on}\n />\n <DateTime10Years years={pageOneMonthsOfYear} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={handleNext}\n label={pageTwoLabel}\n onLabelClick={on}\n />\n <DateTime10Years years={pageTwoMonthsOfYear} />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTime10YearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n onClick={on}\n cursor=\"pointer\"\n />\n <DateTime10Years years={pageOneMonthsOfYear} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n onClick={on}\n cursor=\"pointer\"\n />\n <DateTime10Years years={pageTwoMonthsOfYear} />\n </div>\n </div>\n </div>\n );\n },\n);\n"],"mappings":"4YAAA,OAASA,QAAT,CAAmBC,WAAnB,KAAs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hC,CAEE,KAAK,CAAE+B,CAFT,CAGE,OAAO,CAAER,CAHX,CAIE,MAAM,CAAC,SAJT,EADF,CAOE,oBAAC,eAAD,EAAiB,KAAK,CAAEM,CAAxB,EAPF,CADF,CAUE,2BAAK,SAAS,CAAE7B,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEmC,CAFT,CAGE,OAAO,CAAEZ,CAHX,CAIE,MAAM,CAAC,SAJT,EADF,CAOE,oBAAC,eAAD,EAAiB,KAAK,CAAEa,CAAxB,EAPF,CAVF,CAZF,CAkCH,CAvLwE,CAApE"}
@@ -1,2 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate","multiplicityHours","multiplicityMinutes","multiplicitySeconds"];import{addYears,startOfDecade}from"date-fns";import ruLocale from"date-fns/locale/ru";import React,{forwardRef,useEffect}from"react";import{DateTime10Years}from"../DateTime10Years/DateTime10Years";import{DateTime100YearSlider}from"../DateTime100YearSlider/DateTime100YearSlider";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";import{DateTimeToggler}from"../DateTimeToggler/DateTimeToggler";import{getDecadeTitle,getHandleSelectDate,getYearsOfDecade,isEqualYear,moveTypes,useCurrentVisibleDate}from"../helpers";import{dateTimePropView,dateTimePropViewDefault}from"../helpers/types";import{cnDateTimeMixLayout}from"../mixs";export var DateTimeTypeYear=forwardRef(function(a,b){var c=a.minDate,d=a.maxDate,e=a.value,f=a.onChange,g=a.onChangeRange,h=a.disableDates,i=a.currentVisibleDate,j=a.events,k=a.locale,l=void 0===k?ruLocale:k,m=a.className,n=a.view,o=void 0===n?dateTimePropViewDefault:n,p=a.onMove,q=a.onChangeCurrentVisibleDate,r=a.multiplicityHours,s=a.multiplicityMinutes,t=a.multiplicitySeconds,u=_objectWithoutProperties(a,_excluded);useEffect(function(){null===p||void 0===p?void 0:p(moveTypes[0])},[]);var v=useCurrentVisibleDate({currentVisibleDate:i,maxDate:d,minDate:c,value:e,startOfUnit:startOfDecade,onChangeCurrentVisibleDate:q}),w=_slicedToArray(v,2),x=w[0],y=w[1],z=getHandleSelectDate({minDate:c,maxDate:d,value:e,onChange:f,onChangeRange:g,isEqualUnit:isEqualYear}),A=getYearsOfDecade({date:x,onChange:z,value:e,disableDates:h,events:j,minDate:c,maxDate:d,locale:l}),B=getDecadeTitle(x),C=function(){return y(addYears(x,10))},D=function(){return y(addYears(x,-10))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:D,nextOnClick:C,label:B}),React.createElement(DateTime10Years,{years:A}));var E=addYears(x,10),F=getYearsOfDecade({date:E,onChange:z,value:e,events:j,minDate:c,maxDate:d,locale:l}),G=getDecadeTitle(E);return o===dateTimePropView[1]?React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:D,label:B}),React.createElement(DateTime10Years,{years:A})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:C,label:G}),React.createElement(DateTime10Years,{years:F}))):React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTime100YearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:x,onChange:y,value:e,locale:l}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:B}),React.createElement(DateTime10Years,{years:A})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:G}),React.createElement(DateTime10Years,{years:F}))))});
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate","multiplicityHours","multiplicityMinutes","multiplicitySeconds"];import{addYears,startOfDecade}from"date-fns";import ruLocale from"date-fns/locale/ru";import React,{forwardRef,useEffect}from"react";import{DateTime10Years}from"../DateTime10Years/DateTime10Years";import{DateTime100YearSlider}from"../DateTime100YearSlider/DateTime100YearSlider";import{DateTimeLabel}from"../DateTimeLabel/DateTimeLabel";import{DateTimeToggler}from"../DateTimeToggler/DateTimeToggler";import{getDecadeTitle,getHandleSelectDate,getYearsOfDecade,isEqualYear,moveTypes,useCurrentVisibleDate}from"../helpers";import{dateTimePropView,dateTimePropViewDefault}from"../helpers/types";import{cnDateTimeMixLayout}from"../mixs";export var DateTimeTypeYear=forwardRef(function(a,b){var c=a.minDate,d=a.maxDate,e=a.value,f=a.onChange,g=a.onChangeRange,h=a.disableDates,i=a.currentVisibleDate,j=a.events,k=a.locale,l=void 0===k?ruLocale:k,m=a.className,n=a.view,o=void 0===n?dateTimePropViewDefault:n,p=a.onMove,q=a.onChangeCurrentVisibleDate,r=a.multiplicityHours,s=a.multiplicityMinutes,t=a.multiplicitySeconds,u=_objectWithoutProperties(a,_excluded);useEffect(function(){null===p||void 0===p?void 0:p(moveTypes[0])},[]);var v=useCurrentVisibleDate({currentVisibleDate:i,maxDate:d,minDate:c,value:e,startOfUnit:startOfDecade,onChangeCurrentVisibleDate:q}),w=_slicedToArray(v,2),x=w[0],y=w[1],z=getHandleSelectDate({minDate:c,maxDate:d,value:e,onChange:f,onChangeRange:g,isEqualUnit:isEqualYear}),A=getYearsOfDecade({date:x,onChange:z,value:e,disableDates:h,events:j,minDate:c,maxDate:d,locale:l}),B=getDecadeTitle(x),C=function(){return y(addYears(x,10))},D=function(){return y(addYears(x,-10))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:D,nextOnClick:C,label:B}),React.createElement(DateTime10Years,{years:A}));var E=addYears(x,10),F=getYearsOfDecade({date:E,onChange:z,value:e,events:j,disableDates:h,minDate:c,maxDate:d,locale:l}),G=getDecadeTitle(E);return o===dateTimePropView[1]?React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:D,label:B}),React.createElement(DateTime10Years,{years:A})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:C,label:G}),React.createElement(DateTime10Years,{years:F}))):React.createElement("div",Object.assign({},u,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTime100YearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:x,onChange:y,value:e,locale:l}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:B}),React.createElement(DateTime10Years,{years:A})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:G}),React.createElement(DateTime10Years,{years:F}))))});
2
2
  //# sourceMappingURL=DateTimeTypeYear.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeTypeYear.js","names":["addYears","startOfDecade","ruLocale","React","forwardRef","useEffect","DateTime10Years","DateTime100YearSlider","DateTimeLabel","DateTimeToggler","getDecadeTitle","getHandleSelectDate","getYearsOfDecade","isEqualYear","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeYear","props","ref","minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDateProp","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate","multiplicityHours","multiplicityMinutes","multiplicitySeconds","otherProps","startOfUnit","setCurrentVisibleDate","handleSelectDate","isEqualUnit","pageOneYearsOfDecade","date","pageOneLabel","handleNext","handlePrev","pageTwoCurrentVisibleDate","pageTwoYearsOfDecade","pageTwoLabel"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { DateTime10Years } from '../DateTime10Years/DateTime10Years';\nimport { DateTime100YearSlider } from '../DateTime100YearSlider/DateTime100YearSlider';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport {\n DateTimeTypeComponent,\n getDecadeTitle,\n getHandleSelectDate,\n getYearsOfDecade,\n isEqualYear,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeYear: DateTimeTypeComponent<'year'> = forwardRef(\n (props, ref) => {\n const {\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n disableDates,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n className,\n view = dateTimePropViewDefault,\n onMove,\n onChangeCurrentVisibleDate,\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n ...otherProps\n } = props;\n\n useEffect(() => {\n onMove?.(moveTypes[0]);\n }, []);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n });\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualYear,\n });\n\n const pageOneYearsOfDecade = getYearsOfDecade({\n date: currentVisibleDate,\n onChange: handleSelectDate,\n value,\n disableDates,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getDecadeTitle(currentVisibleDate);\n\n const handleNext = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, 10));\n const handlePrev = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, -10));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n nextOnClick={handleNext}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addYears(currentVisibleDate, 10);\n\n const pageTwoYearsOfDecade = getYearsOfDecade({\n date: pageTwoCurrentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageTwoLabel = getDecadeTitle(pageTwoCurrentVisibleDate);\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={handleNext}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTime100YearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n </div>\n );\n },\n);\n"],"mappings":"4YAAA,OAASA,QAAT,CAAmBC,aAAnB,KAAwC,UAAxC,CACA,MAAOC,SAAP,KAAqB,oBAArB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OAASC,eAAT,0CACA,OAASC,qBAAT,sDACA,OAASC,aAAT,sCACA,OAASC,eAAT,0CACA,OAEEC,cAFF,CAGEC,mBAHF,CAIEC,gBAJF,CAKEC,WALF,CAMEC,SANF,CAOEC,qBAPF,kBASA,OAASC,gBAAT,CAA2BC,uBAA3B,wBACA,OAASC,mBAAT,eAEA,MAAO,IAAMC,iBAA+C,CAAGf,UAAU,CACvE,SAACgB,CAAD,CAAQC,CAAR,CAAgB,CACd,GACEC,EADF,CAkBIF,CAlBJ,CACEE,OADF,CAEEC,CAFF,CAkBIH,CAlBJ,CAEEG,OAFF,CAGEC,CAHF,CAkBIJ,CAlBJ,CAGEI,KAHF,CAIEC,CAJF,CAkBIL,CAlBJ,CAIEK,QAJF,CAKEC,CALF,CAkBIN,CAlBJ,CAKEM,aALF,CAMEC,CANF,CAkBI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EALF,CADF,CAQE,2BAAK,SAAS,CAAE1B,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEiC,CAFT,EADF,CAKE,oBAAC,eAAD,EAAiB,KAAK,CAAED,CAAxB,EALF,CARF,CAZF,CA8BH,CAxJsE,CAAlE"}
1
+ {"version":3,"file":"DateTimeTypeYear.js","names":["addYears","startOfDecade","ruLocale","React","forwardRef","useEffect","DateTime10Years","DateTime100YearSlider","DateTimeLabel","DateTimeToggler","getDecadeTitle","getHandleSelectDate","getYearsOfDecade","isEqualYear","moveTypes","useCurrentVisibleDate","dateTimePropView","dateTimePropViewDefault","cnDateTimeMixLayout","DateTimeTypeYear","props","ref","minDate","maxDate","value","onChange","onChangeRange","disableDates","currentVisibleDateProp","currentVisibleDate","events","locale","className","view","onMove","onChangeCurrentVisibleDate","multiplicityHours","multiplicityMinutes","multiplicitySeconds","otherProps","startOfUnit","setCurrentVisibleDate","handleSelectDate","isEqualUnit","pageOneYearsOfDecade","date","pageOneLabel","handleNext","handlePrev","pageTwoCurrentVisibleDate","pageTwoYearsOfDecade","pageTwoLabel"],"sources":["../../../../../../src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport ruLocale from 'date-fns/locale/ru';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { DateTime10Years } from '../DateTime10Years/DateTime10Years';\nimport { DateTime100YearSlider } from '../DateTime100YearSlider/DateTime100YearSlider';\nimport { DateTimeLabel } from '../DateTimeLabel/DateTimeLabel';\nimport { DateTimeToggler } from '../DateTimeToggler/DateTimeToggler';\nimport {\n DateTimeTypeComponent,\n getDecadeTitle,\n getHandleSelectDate,\n getYearsOfDecade,\n isEqualYear,\n moveTypes,\n useCurrentVisibleDate,\n} from '../helpers';\nimport { dateTimePropView, dateTimePropViewDefault } from '../helpers/types';\nimport { cnDateTimeMixLayout } from '../mixs';\n\nexport const DateTimeTypeYear: DateTimeTypeComponent<'year'> = forwardRef(\n (props, ref) => {\n const {\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n disableDates,\n currentVisibleDate: currentVisibleDateProp,\n events,\n locale = ruLocale,\n className,\n view = dateTimePropViewDefault,\n onMove,\n onChangeCurrentVisibleDate,\n multiplicityHours,\n multiplicityMinutes,\n multiplicitySeconds,\n ...otherProps\n } = props;\n\n useEffect(() => {\n onMove?.(moveTypes[0]);\n }, []);\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate,\n minDate,\n value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n });\n\n const handleSelectDate = getHandleSelectDate({\n minDate,\n maxDate,\n value,\n onChange,\n onChangeRange,\n isEqualUnit: isEqualYear,\n });\n\n const pageOneYearsOfDecade = getYearsOfDecade({\n date: currentVisibleDate,\n onChange: handleSelectDate,\n value,\n disableDates,\n events,\n minDate,\n maxDate,\n locale,\n });\n\n const pageOneLabel = getDecadeTitle(currentVisibleDate);\n\n const handleNext = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, 10));\n const handlePrev = () =>\n setCurrentVisibleDate(addYears(currentVisibleDate, -10));\n\n if (view === dateTimePropView[0]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n nextOnClick={handleNext}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n );\n }\n\n const pageTwoCurrentVisibleDate = addYears(currentVisibleDate, 10);\n\n const pageTwoYearsOfDecade = getYearsOfDecade({\n date: pageTwoCurrentVisibleDate,\n onChange: handleSelectDate,\n value,\n events,\n disableDates,\n minDate,\n maxDate,\n locale,\n });\n\n const pageTwoLabel = getDecadeTitle(pageTwoCurrentVisibleDate);\n\n if (view === dateTimePropView[1]) {\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n prevOnClick={handlePrev}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeToggler\n className={cnDateTimeMixLayout('Label')}\n nextOnClick={handleNext}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnDateTimeMixLayout({ view }, [className])}\n ref={ref}\n >\n <DateTime100YearSlider\n className={cnDateTimeMixLayout('Slider')}\n currentVisibleDate={currentVisibleDate}\n onChange={setCurrentVisibleDate}\n value={value}\n locale={locale}\n />\n <div className={cnDateTimeMixLayout('PageWrapper')}>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageOneLabel}\n />\n <DateTime10Years years={pageOneYearsOfDecade} />\n </div>\n <div className={cnDateTimeMixLayout('Page')}>\n <DateTimeLabel\n className={cnDateTimeMixLayout('Label')}\n label={pageTwoLabel}\n />\n <DateTime10Years years={pageTwoYearsOfDecade} />\n </div>\n </div>\n </div>\n );\n },\n);\n"],"mappings":"4YAAA,OAASA,QAAT,CAAmBC,aAAnB,KAAwC,UAAxC,CACA,MAAOC,SAAP,KAAqB,oBAArB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OAASC,eAAT,0CACA,OAASC,qBAAT,sDACA,OAASC,aAAT,sCACA,OAASC,eAAT,0CACA,OAEEC,cAFF,CAGEC,mBAHF,CAIEC,gBAJF,CAKEC,WALF,CAMEC,SANF,CAOEC,qBAPF,kBASA,OAASC,gBAAT,CAA2BC,uBAA3B,wBAC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CAEE,kBAAkB,CAAEW,CAFtB,CAGE,QAAQ,CAAEY,CAHZ,CAIE,KAAK,CAAEjB,CAJT,CAKE,MAAM,CAAEO,CALV,EALF,CAYE,2BAAK,SAAS,CAAEb,mBAAmB,CAAC,aAAD,CAAnC,EACE,2BAAK,SAAS,CAAEA,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAE4B,CAFT,EADF,CAKE,oBAAC,eAAD,EAAiB,KAAK,CAAEF,CAAxB,EALF,CADF,CAQE,2BAAK,SAAS,CAAE1B,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEiC,CAFT,EADF,CAKE,oBAAC,eAAD,EAAiB,KAAK,CAAED,CAAxB,EALF,CARF,CAZF,CA8BH,CAzJsE,CAAlE"}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["valueAtom","inputMinWidthAtom"],_excluded2=["children","className","inputMinWidthAtom","size","style"],_excluded3=["className","inputRef","inputMaxLength","value","inputValue","inputDefaultValue","renderValue","onFocus","onBlur","autoFocus","inputTabIndex","inputAriaLabel","disabled","size","placeholder","onKeyDown","onKeyDownCapture","onChange","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onWheel","disableInput"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import{useAction,useAtom,useUpdate}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{useComponentSize}from"../../../hooks/useComponentSize";import{useForkRef}from"../../../hooks/useForkRef";import{usePropAtom,useSendToAtom,withCtx}from"../../../utils/state";import{useCreateAtom}from"../../../utils/state/useCreateAtom";import{cnFieldArrayValueInlineControl}from"./cnFieldArrayValueInlineControl";var gapMap={l:"calc(var(--space-3xs) + var(--space-2xs))",m:"var(--space-2xs)",s:"var(--space-3xs)",xs:"var(--space-3xs)"},verticalPaddingMap={l:"var(--space-xs)",m:"calc(var(--space-xs) - var(--space-3xs))",s:"var(--space-2xs)",xs:"var(--space-3xs)"},inputHeightMap={l:"var(--space-2xl)",m:"calc(var(--space-2xl) - var(--space-2xs))",s:"var(--space-xl)",xs:"var(--space-l)"},InputFakeElement=forwardRef(function(a,b){var c=a.valueAtom,d=a.inputMinWidthAtom,e=_objectWithoutProperties(a,_excluded),f=useAtom(c),g=_slicedToArray(f,1),h=g[0],i=useRef(null),j=useComponentSize(i),k=j.width;return useUpdate(function(a,b){d(a,b)},[k]),React.createElement("div",Object.assign({},e,{ref:useForkRef([b,i])}),h)}),Root=forwardRef(function(a,b){var c,d=a.children,e=a.className,f=a.inputMinWidthAtom,g=a.size,h=void 0===g?"m":g,i=a.style,j=_objectWithoutProperties(a,_excluded2),k=useAtom(f),l=_slicedToArray(k,1),m=l[0];return React.createElement("div",Object.assign({},j,{className:cnFieldArrayValueInlineControl(null,[e]),ref:b,style:_objectSpread(_objectSpread({},i),{},(c={},_defineProperty(c,"--field-array-value-inline-control-items-gap",gapMap[h]),_defineProperty(c,"--field-array-value-inline-control-input-min-width","".concat(m,"px")),_defineProperty(c,"--field-array-value-inline-control-vertical-padding","".concat(verticalPaddingMap[h])),_defineProperty(c,"--field-array-value-inline-control-input-height","".concat(inputHeightMap[h])),c))}),d)}),FieldArrayValueInlineControlRender=function(a,b){var c=a.className,d=a.inputRef,e=a.inputMaxLength,f=a.value,g=void 0===f?[]:f,h=a.inputValue,i=a.inputDefaultValue,j=void 0===i?"":i,k=a.renderValue,l=a.onFocus,m=a.onBlur,n=a.autoFocus,o=a.inputTabIndex,p=a.inputAriaLabel,q=a.disabled,r=a.size,s=void 0===r?"m":r,t=a.placeholder,u=a.onKeyDown,v=a.onKeyDownCapture,w=a.onChange,x=a.onKeyUp,y=a.onKeyUpCapture,z=a.onCopy,A=a.onCopyCapture,B=a.onCut,C=a.onCutCapture,D=a.onPaste,E=a.onPasteCapture,F=a.onWheel,G=a.disableInput,H=_objectWithoutProperties(a,_excluded3),I=useSendToAtom(a),J=usePropAtom(I,"inputValue"),K=useCreateAtom(h||j||""),L=useCreateAtom(j),M=useCreateAtom(0),N=useRef(null),O=useRef(null),P=useAction(function(a,b){K(a,b.target.value);var c=a.get(I),d=c.onChange;d&&d(b)},[]);return useAtom(function(a){var b=a.spy(J),c=a.get(L);c?L(a,""):(O.current&&(O.current.value=b||""),K(a,b||""))}),React.createElement(Root,Object.assign({},H,{className:cnFieldArrayValueInlineControl(null,[c]),ref:b,size:s,inputMinWidthAtom:M}),k(g||[]),React.createElement("input",{className:cnFieldArrayValueInlineControl("Input",{disabled:G}),onChange:P,ref:useForkRef([O,d]),maxLength:e,onFocus:l,onBlur:m,autoFocus:n,tabIndex:o,"aria-label":p,onKeyDown:u,onKeyDownCapture:v,onKeyUp:x,onKeyUpCapture:y,disabled:q,type:"text",placeholder:g.length?void 0:t,onCopy:z,onCopyCapture:A,onCut:B,onCutCapture:C,onPaste:D,onPasteCapture:E,onWheel:F,defaultValue:j,readOnly:G}),React.createElement(InputFakeElement,{ref:N,className:cnFieldArrayValueInlineControl("HelperInputFakeElement"),valueAtom:K,inputMinWidthAtom:M}))};export var FieldArrayValueInlineControl=withCtx(forwardRef(FieldArrayValueInlineControlRender));
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["valueAtom","inputMinWidthAtom"],_excluded2=["children","className","inputMinWidthAtom","size","style"],_excluded3=["className","inputRef","inputMaxLength","value","inputValue","inputDefaultValue","renderValue","onFocus","onBlur","autoFocus","inputTabIndex","inputAriaLabel","disabled","size","placeholder","onKeyDown","onKeyDownCapture","onChange","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onWheel","disableInput"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import{useAction,useAtom,useUpdate}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{useComponentSize}from"../../../hooks/useComponentSize";import{useForkRef}from"../../../hooks/useForkRef";import{usePropAtom,useSendToAtom,withCtx}from"../../../utils/state";import{useCreateAtom}from"../../../utils/state/useCreateAtom";import{cnFieldArrayValueInlineControl}from"./cnFieldArrayValueInlineControl";var gapMap={l:"calc(var(--space-3xs) + var(--space-2xs))",m:"var(--space-2xs)",s:"var(--space-3xs)",xs:"var(--space-3xs)"},verticalPaddingMap={l:"var(--space-xs)",m:"calc(var(--space-xs) - var(--space-3xs))",s:"var(--space-2xs)",xs:"var(--space-3xs)"},inputHeightMap={l:"var(--space-2xl)",m:"calc(var(--space-2xl) - var(--space-2xs))",s:"var(--space-xl)",xs:"var(--space-l)"},InputFakeElement=forwardRef(function(a,b){var c=a.valueAtom,d=a.inputMinWidthAtom,e=_objectWithoutProperties(a,_excluded),f=useAtom(c),g=_slicedToArray(f,1),h=g[0],i=useRef(null),j=useComponentSize(i),k=j.width;return useUpdate(function(a,b){d(a,b)},[k]),React.createElement("div",Object.assign({},e,{ref:useForkRef([b,i])}),h)}),Root=forwardRef(function(a,b){var c,d=a.children,e=a.className,f=a.inputMinWidthAtom,g=a.size,h=void 0===g?"m":g,i=a.style,j=_objectWithoutProperties(a,_excluded2),k=useAtom(f),l=_slicedToArray(k,1),m=l[0];return React.createElement("div",Object.assign({},j,{className:cnFieldArrayValueInlineControl(null,[e]),ref:b,style:_objectSpread(_objectSpread({},i),{},(c={},_defineProperty(c,"--field-array-value-inline-control-items-gap",gapMap[h]),_defineProperty(c,"--field-array-value-inline-control-input-min-width","".concat(m,"px")),_defineProperty(c,"--field-array-value-inline-control-vertical-padding","".concat(verticalPaddingMap[h])),_defineProperty(c,"--field-array-value-inline-control-input-height","".concat(inputHeightMap[h])),c))}),d)}),FieldArrayValueInlineControlRender=function(a,b){var c=a.className,d=a.inputRef,e=a.inputMaxLength,f=a.value,g=void 0===f?[]:f,h=a.inputValue,i=a.inputDefaultValue,j=void 0===i?"":i,k=a.renderValue,l=a.onFocus,m=a.onBlur,n=a.autoFocus,o=a.inputTabIndex,p=a.inputAriaLabel,q=a.disabled,r=a.size,s=void 0===r?"m":r,t=a.placeholder,u=a.onKeyDown,v=a.onKeyDownCapture,w=a.onChange,x=a.onKeyUp,y=a.onKeyUpCapture,z=a.onCopy,A=a.onCopyCapture,B=a.onCut,C=a.onCutCapture,D=a.onPaste,E=a.onPasteCapture,F=a.onWheel,G=a.disableInput,H=_objectWithoutProperties(a,_excluded3),I=useSendToAtom(a),J=usePropAtom(I,"inputValue"),K=useCreateAtom(h||j),L=useCreateAtom(j),M=useCreateAtom(0),N=useRef(null),O=useRef(null),P=useAction(function(a,b){K(a,b.target.value);var c=a.get(I),d=c.onChange;d&&d(b)},[]);return useAtom(function(a){var b=a.spy(J),c=a.get(L);c?L(a,""):(O.current&&(O.current.value=b||""),K(a,b))}),React.createElement(Root,Object.assign({},H,{className:cnFieldArrayValueInlineControl(null,[c]),ref:b,size:s,inputMinWidthAtom:M}),k(g||[]),React.createElement("input",{className:cnFieldArrayValueInlineControl("Input",{disabled:G}),onChange:P,ref:useForkRef([O,d]),maxLength:e,onFocus:l,onBlur:m,autoFocus:n,tabIndex:o,"aria-label":p,onKeyDown:u,onKeyDownCapture:v,onKeyUp:x,onKeyUpCapture:y,disabled:q,type:"text",placeholder:g.length?void 0:t,onCopy:z,onCopyCapture:A,onCut:B,onCutCapture:C,onPaste:D,onPasteCapture:E,onWheel:F,defaultValue:j,readOnly:G}),React.createElement(InputFakeElement,{ref:N,className:cnFieldArrayValueInlineControl("HelperInputFakeElement"),valueAtom:K,inputMinWidthAtom:M}))};export var FieldArrayValueInlineControl=withCtx(forwardRef(FieldArrayValueInlineControlRender));
2
2
  //# sourceMappingURL=FieldArrayValueInlineControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldArrayValueInlineControl.js","names":["useAction","useAtom","useUpdate","React","forwardRef","useRef","useComponentSize","useForkRef","usePropAtom","useSendToAtom","withCtx","useCreateAtom","cnFieldArrayValueInlineControl","gapMap","l","m","s","xs","verticalPaddingMap","inputHeightMap","InputFakeElement","componentRef","valueAtom","inputMinWidthAtom","otherProps","value","ref","width","ctx","Root","children","className","size","style","inputMinWidth","FieldArrayValueInlineControlRender","props","inputRefProp","inputRef","inputMaxLength","inputValue","inputDefaultValue","renderValue","onFocus","onBlur","autoFocus","inputTabIndex","inputAriaLabel","disabled","placeholder","onKeyDown","onKeyDownCapture","onChange","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onWheel","disableInput","propsAtom","inputValuePropAtom","inputValueAtom","inputDefaultValueAtom","fakeInputRef","handleChange","e","target","get","inputValueProp","spy","current","length","FieldArrayValueInlineControl"],"sources":["../../../../../../src/components/FieldComponents/FieldArrayValueInlineControl/FieldArrayValueInlineControl.tsx"],"sourcesContent":["import { AtomMut } from '@reatom/framework';\nimport { useAction, useAtom, useUpdate } from '@reatom/npm-react';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { useComponentSize } from '##/hooks/useComponentSize';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { usePropAtom, useSendToAtom, withCtx } from '##/utils/state';\nimport { useCreateAtom } from '##/utils/state/useCreateAtom';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { FieldPropSize } from '../types';\nimport { cnFieldArrayValueInlineControl } from './cnFieldArrayValueInlineControl';\nimport {\n FieldArrayValueInlineControlComponent,\n FieldArrayValueInlineControlProps,\n} from './types';\n\nconst gapMap: Record<FieldPropSize, string> = {\n l: 'calc(var(--space-3xs) + var(--space-2xs))',\n m: 'var(--space-2xs)',\n s: 'var(--space-3xs)',\n xs: 'var(--space-3xs)',\n};\n\nconst verticalPaddingMap: Record<FieldPropSize, string> = {\n l: 'var(--space-xs)',\n m: 'calc(var(--space-xs) - var(--space-3xs))',\n s: 'var(--space-2xs)',\n xs: 'var(--space-3xs)',\n};\n\nconst inputHeightMap: Record<FieldPropSize, string> = {\n l: 'var(--space-2xl)',\n m: 'calc(var(--space-2xl) - var(--space-2xs))',\n s: 'var(--space-xl)',\n xs: 'var(--space-l)',\n};\n\nconst InputFakeElement = forwardRef<\n HTMLDivElement,\n PropsWithHTMLAttributes<\n {\n valueAtom: AtomMut<string>;\n inputMinWidthAtom: AtomMut<number>;\n },\n HTMLDivElement\n >\n>(({ valueAtom, inputMinWidthAtom, ...otherProps }, componentRef) => {\n const [value] = useAtom(valueAtom);\n const ref = useRef<HTMLDivElement>(null);\n\n const { width } = useComponentSize(ref);\n\n useUpdate(\n (ctx, width) => {\n inputMinWidthAtom(ctx, width);\n },\n [width],\n );\n\n return (\n <div {...otherProps} ref={useForkRef([componentRef, ref])}>\n {value}\n </div>\n );\n});\n\nconst Root = forwardRef<\n HTMLDivElement,\n PropsWithHTMLAttributes<\n {\n inputMinWidthAtom: AtomMut<number>;\n size: FieldArrayValueInlineControlProps<unknown>['size'];\n },\n HTMLDivElement\n >\n>(\n (\n {\n children,\n className,\n inputMinWidthAtom,\n size = 'm',\n style,\n ...otherProps\n },\n ref,\n ) => {\n const [inputMinWidth] = useAtom(inputMinWidthAtom);\n\n return (\n <div\n {...otherProps}\n className={cnFieldArrayValueInlineControl(null, [className])}\n ref={ref}\n style={{\n ...style,\n ['--field-array-value-inline-control-items-gap' as string]:\n gapMap[size],\n ['--field-array-value-inline-control-input-min-width' as string]: `${inputMinWidth}px`,\n ['--field-array-value-inline-control-vertical-padding' as string]: `${verticalPaddingMap[size]}`,\n ['--field-array-value-inline-control-input-height' as string]: `${inputHeightMap[size]}`,\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nconst FieldArrayValueInlineControlRender = (\n props: FieldArrayValueInlineControlProps<unknown>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n className,\n inputRef: inputRefProp,\n inputMaxLength,\n value = [],\n inputValue,\n inputDefaultValue = '',\n renderValue,\n onFocus,\n onBlur,\n autoFocus,\n inputTabIndex,\n inputAriaLabel,\n disabled,\n size = 'm',\n placeholder,\n onKeyDown,\n onKeyDownCapture,\n onChange,\n onKeyUp,\n onKeyUpCapture,\n onCopy,\n onCopyCapture,\n onCut,\n onCutCapture,\n onPaste,\n onPasteCapture,\n onWheel,\n disableInput,\n ...otherProps\n } = props;\n\n const propsAtom = useSendToAtom(props);\n const inputValuePropAtom = usePropAtom(propsAtom, 'inputValue');\n // const valueAtom = usePropAtom(propsAtom, 'value');\n const inputValueAtom = useCreateAtom(inputValue || inputDefaultValue || '');\n const inputDefaultValueAtom = useCreateAtom(inputDefaultValue);\n const inputMinWidthAtom = useCreateAtom(0);\n\n const fakeInputRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const handleChange = useAction(\n (ctx, e: React.ChangeEvent<HTMLInputElement>) => {\n inputValueAtom(ctx, e.target.value);\n const { onChange } = ctx.get(propsAtom);\n if (onChange) {\n onChange(e);\n }\n },\n [],\n );\n\n // const [valueNode] = useAtom((ctx) => {\n // const value = ctx.spy(valueAtom);\n // const { renderValue } = ctx.get(propsAtom);\n // return renderValue(value || []);\n // });\n\n useAtom((ctx) => {\n const inputValueProp = ctx.spy(inputValuePropAtom);\n const inputDefaultValue = ctx.get(inputDefaultValueAtom);\n if (inputDefaultValue) {\n inputDefaultValueAtom(ctx, '');\n } else {\n if (inputRef.current) {\n inputRef.current.value = inputValueProp || '';\n }\n\n inputValueAtom(ctx, inputValueProp || '');\n }\n });\n\n return (\n <Root\n {...otherProps}\n className={cnFieldArrayValueInlineControl(null, [className])}\n ref={ref}\n size={size}\n inputMinWidthAtom={inputMinWidthAtom}\n >\n {renderValue(value || [])}\n <input\n className={cnFieldArrayValueInlineControl('Input', {\n disabled: disableInput,\n })}\n onChange={handleChange}\n ref={useForkRef([inputRef, inputRefProp])}\n maxLength={inputMaxLength}\n onFocus={onFocus}\n onBlur={onBlur}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n tabIndex={inputTabIndex}\n aria-label={inputAriaLabel}\n onKeyDown={onKeyDown}\n onKeyDownCapture={onKeyDownCapture}\n onKeyUp={onKeyUp}\n onKeyUpCapture={onKeyUpCapture}\n disabled={disabled}\n type=\"text\"\n placeholder={value.length ? undefined : placeholder}\n onCopy={onCopy}\n onCopyCapture={onCopyCapture}\n onCut={onCut}\n onCutCapture={onCutCapture}\n onPaste={onPaste}\n onPasteCapture={onPasteCapture}\n onWheel={onWheel}\n defaultValue={inputDefaultValue}\n readOnly={disableInput}\n />\n <InputFakeElement\n ref={fakeInputRef}\n className={cnFieldArrayValueInlineControl('HelperInputFakeElement')}\n valueAtom={inputValueAtom}\n inputMinWidthAtom={inputMinWidthAtom}\n />\n </Root>\n );\n};\n\nexport const FieldArrayValueInlineControl = withCtx(\n forwardRef(FieldArrayValueInlineControlRender),\n) as FieldArrayValueInlineControlComponent;\n"],"mappings":"uyCACA,OAASA,SAAT,CAAoBC,OAApB,CAA6BC,SAA7B,KAA8C,mBAA9C,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,gBAAT,uCACA,OAASC,UAAT,iCACA,OAASC,WAAT,CAAsBC,aAAtB,CAAqCC,OAArC,4BACA,OAASC,aAAT,0CAIA,OAASC,8BAAT,wC,GAMMC,OAAqC,CAAG,CAC5CC,CAAC,CAAE,2CADyC,CAE5CC,CAAC,CAAE,kBAFyC,CAG5CC,CAAC,CAAE,kBAHyC,CAI5CC,EAAE,CAAE,kBAJwC,C,CAOxCC,kBAAiD,CAAG,CACxDJ,CAAC,CAAE,iBADqD,CAExDC,CAAC,CAAE,0CAFqD,CAGxDC,CAAC,CAAE,kBAHqD,CAIxDC,EAAE,CAAE,kBAJoD,C,CAOpDE,cAA6C,CAAG,CACpDL,CAAC,CAAE,kBADiD,CAEpDC,CAAC,CAAE,2CAFiD,CAGpDC,CAAC,CAAE,iBAHiD,CAIpDC,EAAE,CAAE,gBAJgD,C,CAOhDG,gBAAgB,CAAGhB,UAAU,CASjC,WAAkDiB,CAAlD,CAAmE,IAAhEC,EAAgE,GAAhEA,SAAgE,CAArDC,CAAqD,GAArDA,iBAAqD,CAA/BC,CAA+B,yCACnDvB,OAAO,CAACqB,CAAD,CAD4C,uBAC5DG,CAD4D,MAE7DC,CAAG,CAAGrB,MAAM,CAAiB,IAAjB,CAFiD,GAIjDC,gBAAgB,CAACoB,CAAD,CAJiC,CAI3DC,CAJ2D,GAI3DA,KAJ2D,CAanE,MAPAzB,UAAS,CACP,SAAC0B,CAAD,CAAMD,CAAN,CAAgB,CACdJ,CAAiB,CAACK,CAAD,CAAMD,CAAN,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D,CAAX,CAAD,CALjB,CAME,SAAS,CAAEE,CANb,CAOE,OAAO,CAAEI,CAPX,CAQE,MAAM,CAAEC,CARV,CAUE,SAAS,CAAEC,CAVb,CAWE,QAAQ,CAAEC,CAXZ,CAYE,aAAYC,CAZd,CAaE,SAAS,CAAEG,CAbb,CAcE,gBAAgB,CAAEC,CAdpB,CAeE,OAAO,CAAEE,CAfX,CAgBE,cAAc,CAAEC,CAhBlB,CAiBE,QAAQ,CAAEN,CAjBZ,CAkBE,IAAI,CAAC,MAlBP,CAmBE,WAAW,CAAEvB,CAAK,CAACkD,MAAN,QAA2B1B,CAnB1C,CAoBE,MAAM,CAAEM,CApBV,CAqBE,aAAa,CAAEC,CArBjB,CAsBE,KAAK,CAAEC,CAtBT,CAuBE,YAAY,CAAEC,CAvBhB,CAwBE,OAAO,CAAEC,CAxBX,CAyBE,cAAc,CAAEC,CAzBlB,CA0BE,OAAO,CAAEC,CA1BX,CA2BE,YAAY,CAAEpB,CA3BhB,CA4BE,QAAQ,CAAEqB,CA5BZ,EARF,CAsCE,oBAAC,gBAAD,EACE,GAAG,CAAEK,CADP,CAEE,SAAS,CAAEvD,8BAA8B,CAAC,wBAAD,CAF3C,CAGE,SAAS,CAAEqD,CAHb,CAIE,iBAAiB,CAAE1C,CAJrB,EAtCF,CA8CH,C,CAED,MAAO,IAAMqD,6BAA4B,CAAGlE,OAAO,CACjDN,UAAU,CAAC+B,kCAAD,CADuC,CAA5C"}
1
+ {"version":3,"file":"FieldArrayValueInlineControl.js","names":["useAction","useAtom","useUpdate","React","forwardRef","useRef","useComponentSize","useForkRef","usePropAtom","useSendToAtom","withCtx","useCreateAtom","cnFieldArrayValueInlineControl","gapMap","l","m","s","xs","verticalPaddingMap","inputHeightMap","InputFakeElement","componentRef","valueAtom","inputMinWidthAtom","otherProps","value","ref","width","ctx","Root","children","className","size","style","inputMinWidth","FieldArrayValueInlineControlRender","props","inputRefProp","inputRef","inputMaxLength","inputValue","inputDefaultValue","renderValue","onFocus","onBlur","autoFocus","inputTabIndex","inputAriaLabel","disabled","placeholder","onKeyDown","onKeyDownCapture","onChange","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onWheel","disableInput","propsAtom","inputValuePropAtom","inputValueAtom","inputDefaultValueAtom","fakeInputRef","handleChange","e","target","get","inputValueProp","spy","current","length","FieldArrayValueInlineControl"],"sources":["../../../../../../src/components/FieldComponents/FieldArrayValueInlineControl/FieldArrayValueInlineControl.tsx"],"sourcesContent":["import { AtomMut } from '@reatom/framework';\nimport { useAction, useAtom, useUpdate } from '@reatom/npm-react';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { useComponentSize } from '##/hooks/useComponentSize';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { usePropAtom, useSendToAtom, withCtx } from '##/utils/state';\nimport { useCreateAtom } from '##/utils/state/useCreateAtom';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { FieldPropSize } from '../types';\nimport { cnFieldArrayValueInlineControl } from './cnFieldArrayValueInlineControl';\nimport {\n FieldArrayValueInlineControlComponent,\n FieldArrayValueInlineControlProps,\n} from './types';\n\nconst gapMap: Record<FieldPropSize, string> = {\n l: 'calc(var(--space-3xs) + var(--space-2xs))',\n m: 'var(--space-2xs)',\n s: 'var(--space-3xs)',\n xs: 'var(--space-3xs)',\n};\n\nconst verticalPaddingMap: Record<FieldPropSize, string> = {\n l: 'var(--space-xs)',\n m: 'calc(var(--space-xs) - var(--space-3xs))',\n s: 'var(--space-2xs)',\n xs: 'var(--space-3xs)',\n};\n\nconst inputHeightMap: Record<FieldPropSize, string> = {\n l: 'var(--space-2xl)',\n m: 'calc(var(--space-2xl) - var(--space-2xs))',\n s: 'var(--space-xl)',\n xs: 'var(--space-l)',\n};\n\nconst InputFakeElement = forwardRef<\n HTMLDivElement,\n PropsWithHTMLAttributes<\n {\n valueAtom: AtomMut<string | undefined>;\n inputMinWidthAtom: AtomMut<number>;\n },\n HTMLDivElement\n >\n>(({ valueAtom, inputMinWidthAtom, ...otherProps }, componentRef) => {\n const [value] = useAtom(valueAtom);\n\n const ref = useRef<HTMLDivElement>(null);\n\n const { width } = useComponentSize(ref);\n\n useUpdate(\n (ctx, width) => {\n inputMinWidthAtom(ctx, width);\n },\n [width],\n );\n\n return (\n <div {...otherProps} ref={useForkRef([componentRef, ref])}>\n {value}\n </div>\n );\n});\n\nconst Root = forwardRef<\n HTMLDivElement,\n PropsWithHTMLAttributes<\n {\n inputMinWidthAtom: AtomMut<number>;\n size: FieldArrayValueInlineControlProps<unknown>['size'];\n },\n HTMLDivElement\n >\n>(\n (\n {\n children,\n className,\n inputMinWidthAtom,\n size = 'm',\n style,\n ...otherProps\n },\n ref,\n ) => {\n const [inputMinWidth] = useAtom(inputMinWidthAtom);\n\n return (\n <div\n {...otherProps}\n className={cnFieldArrayValueInlineControl(null, [className])}\n ref={ref}\n style={{\n ...style,\n ['--field-array-value-inline-control-items-gap' as string]:\n gapMap[size],\n ['--field-array-value-inline-control-input-min-width' as string]: `${inputMinWidth}px`,\n ['--field-array-value-inline-control-vertical-padding' as string]: `${verticalPaddingMap[size]}`,\n ['--field-array-value-inline-control-input-height' as string]: `${inputHeightMap[size]}`,\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nconst FieldArrayValueInlineControlRender = (\n props: FieldArrayValueInlineControlProps<unknown>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n className,\n inputRef: inputRefProp,\n inputMaxLength,\n value = [],\n inputValue,\n inputDefaultValue = '',\n renderValue,\n onFocus,\n onBlur,\n autoFocus,\n inputTabIndex,\n inputAriaLabel,\n disabled,\n size = 'm',\n placeholder,\n onKeyDown,\n onKeyDownCapture,\n onChange,\n onKeyUp,\n onKeyUpCapture,\n onCopy,\n onCopyCapture,\n onCut,\n onCutCapture,\n onPaste,\n onPasteCapture,\n onWheel,\n disableInput,\n ...otherProps\n } = props;\n\n const propsAtom = useSendToAtom(props);\n const inputValuePropAtom = usePropAtom(propsAtom, 'inputValue');\n // const valueAtom = usePropAtom(propsAtom, 'value');\n const inputValueAtom = useCreateAtom<string | undefined>(\n inputValue || inputDefaultValue,\n );\n const inputDefaultValueAtom = useCreateAtom(inputDefaultValue);\n const inputMinWidthAtom = useCreateAtom(0);\n\n const fakeInputRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const handleChange = useAction(\n (ctx, e: React.ChangeEvent<HTMLInputElement>) => {\n inputValueAtom(ctx, e.target.value);\n const { onChange } = ctx.get(propsAtom);\n if (onChange) {\n onChange(e);\n }\n },\n [],\n );\n\n useAtom((ctx) => {\n const inputValueProp = ctx.spy(inputValuePropAtom);\n const inputDefaultValue = ctx.get(inputDefaultValueAtom);\n if (inputDefaultValue) {\n inputDefaultValueAtom(ctx, '');\n } else {\n if (inputRef.current) {\n inputRef.current.value = inputValueProp || '';\n }\n\n inputValueAtom(ctx, inputValueProp);\n }\n });\n\n return (\n <Root\n {...otherProps}\n className={cnFieldArrayValueInlineControl(null, [className])}\n ref={ref}\n size={size}\n inputMinWidthAtom={inputMinWidthAtom}\n >\n {renderValue(value || [])}\n <input\n className={cnFieldArrayValueInlineControl('Input', {\n disabled: disableInput,\n })}\n onChange={handleChange}\n ref={useForkRef([inputRef, inputRefProp])}\n maxLength={inputMaxLength}\n onFocus={onFocus}\n onBlur={onBlur}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n tabIndex={inputTabIndex}\n aria-label={inputAriaLabel}\n onKeyDown={onKeyDown}\n onKeyDownCapture={onKeyDownCapture}\n onKeyUp={onKeyUp}\n onKeyUpCapture={onKeyUpCapture}\n disabled={disabled}\n type=\"text\"\n placeholder={value.length ? undefined : placeholder}\n onCopy={onCopy}\n onCopyCapture={onCopyCapture}\n onCut={onCut}\n onCutCapture={onCutCapture}\n onPaste={onPaste}\n onPasteCapture={onPasteCapture}\n onWheel={onWheel}\n defaultValue={inputDefaultValue}\n readOnly={disableInput}\n />\n <InputFakeElement\n ref={fakeInputRef}\n className={cnFieldArrayValueInlineControl('HelperInputFakeElement')}\n valueAtom={inputValueAtom}\n inputMinWidthAtom={inputMinWidthAtom}\n />\n </Root>\n );\n};\n\nexport const FieldArrayValueInlineControl = withCtx(\n forwardRef(FieldArrayValueInlineControlRender),\n) as FieldArrayValueInlineControlComponent;\n"],"mappings":"uyCACA,OAASA,SAAT,CAAoBC,OAApB,CAA6BC,SAA7B,KAA8C,mBAA9C,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,gBAAT,uCACA,OAASC,UAAT,iCACA,OAASC,WAAT,CAAsBC,aAAtB,CAAqCC,OAArC,4BACA,OAASC,aAAT,0CAIA,OAASC,8BAAT,wC,GAMMC,OAAqC,CAAG,CAC5CC,CAAC,CAAE,2CADyC,CAE5CC,CAAC,CAAE,kBAFyC,CAG5CC,CAAC,CAAE,kBAHyC,CAI5CC,EAAE,CAAE,kBAJwC,C,CAOxCC,kBAAiD,CAAG,CACxDJ,CAAC,CAAE,iBADqD,CAExDC,CAAC,CAAE,0CAFqD,CAGxDC,CAAC,CAAE,kBAHqD,CAIxDC,EAAE,CAAE,kBAJoD,C,CAOpDE,cAA6C,CAAG,CACpDL,CAAC,CAAE,kBADiD,CAEpDC,CAAC,CAAE,2CAFiD,CAGpDC,CAAC,CAAE,iBAHiD,CAIpDC,EAAE,CAAE,gBAJgD,C,CAOhDG,gBAAgB,CAAGhB,UAAU,CASjC,WAAkDiB,CAAlD,CAAmE,IAAhEC,EAAgE,GAAhEA,SAAgE,CAArDC,CAAqD,GAArDA,iBAAqD,CAA/BC,CAA+B,yCACnDvB,OAAO,CAACqB,CAAD,CAD4C,uBAC5DG,CAD4D,MAG7DC,CAAG,CAAGrB,MAAM,CAAiB,IAAjB,CAHiD,GAKjDC,gBAAgB,CAACoB,CAAD,CALiC,CAK3DC,CAL2D,GAK3DA,KAL2D,CAcnE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Q,CAAEM,CAJZ,CAKE,GAAG,CAAE7D,UAAU,CAAC,CAAC+B,CAAD,CAAWD,CAAX,CAAD,CALjB,CAME,SAAS,CAAEE,CANb,CAOE,OAAO,CAAEI,CAPX,CAQE,MAAM,CAAEC,CARV,CAUE,SAAS,CAAEC,CAVb,CAWE,QAAQ,CAAEC,CAXZ,CAYE,aAAYC,CAZd,CAaE,SAAS,CAAEG,CAbb,CAcE,gBAAgB,CAAEC,CAdpB,CAeE,OAAO,CAAEE,CAfX,CAgBE,cAAc,CAAEC,CAhBlB,CAiBE,QAAQ,CAAEN,CAjBZ,CAkBE,IAAI,CAAC,MAlBP,CAmBE,WAAW,CAAEvB,CAAK,CAACkD,MAAN,QAA2B1B,CAnB1C,CAoBE,MAAM,CAAEM,CApBV,CAqBE,aAAa,CAAEC,CArBjB,CAsBE,KAAK,CAAEC,CAtBT,CAuBE,YAAY,CAAEC,CAvBhB,CAwBE,OAAO,CAAEC,CAxBX,CAyBE,cAAc,CAAEC,CAzBlB,CA0BE,OAAO,CAAEC,CA1BX,CA2BE,YAAY,CAAEpB,CA3BhB,CA4BE,QAAQ,CAAEqB,CA5BZ,EARF,CAsCE,oBAAC,gBAAD,EACE,GAAG,CAAEK,CADP,CAEE,SAAS,CAAEvD,8BAA8B,CAAC,wBAAD,CAF3C,CAGE,SAAS,CAAEqD,CAHb,CAIE,iBAAiB,CAAE1C,CAJrB,EAtCF,CA8CH,C,CAED,MAAO,IAAMqD,6BAA4B,CAAGlE,OAAO,CACjDN,UAAU,CAAC+B,kCAAD,CADuC,CAA5C"}
@@ -1,3 +1,3 @@
1
1
  .FieldControlLayout{--field-control-layout-slot-height:calc(var(--field-control-layout-height) - var(--field-control-layout-border-width)*2);--field-control-layout-slot-color:var(--color-control-typo-placeholder);--field-control-layout-placeholder-color:var(
2
2
  --color-control-typo-placeholder
3
- );--field-control-layout-input-color:var(--color-control-typo-default);--field-control-layout-left-slots-width:calc(var(--field-control-layout-left-slots-length)*var(--field-control-layout-space) + var(--field-control-layout-left-slot-contents-width));--field-control-layout-right-slots-width:calc(var(--field-control-layout-right-slots-length)*var(--field-control-layout-space) + var(--field-control-layout-right-slot-contents-width));--field-control-layout-children-width:calc(var(--field-control-layout-container-width) - var(--field-control-layout-right-slots-width) - var(--field-control-layout-left-slots-width));background-color:var(--field-control-layout-bg-color);border-color:var(--field-control-layout-border-color);border-radius:var(--field-control-layout-border-radius);border-style:var(--field-control-layout-border-style);border-width:var(--field-control-layout-border-width);box-sizing:border-box;font-size:var(--field-control-layout-text-size);line-height:var(--field-control-layout-text-line-height);min-height:var(--field-control-layout-height);padding:var(--field-control-layout-padding);transition:border-color .15s,box-shadow .15s;width:100%}.FieldControlLayout_disabled{--field-control-layout-placeholder-color:var(--color-control-typo-disable);--field-control-layout-input-color:var(--color-control-typo-disable);--field-control-layout-slot-color:var(--color-control-typo-disable)}.FieldControlLayout_alignSlots_top .FieldControlLayout-Slot{height:var(--field-control-layout-slot-height)}.FieldControlLayout_alignSlots_center .FieldControlLayout-Slot{height:auto}.FieldControlLayout-Container{display:flex;gap:var(--field-control-layout-space);min-height:var(--field-control-layout-slot-height)}.FieldControlLayout-Slot{align-items:center;color:var(--field-control-layout-slot-color);display:flex;flex:none;font-size:var(--field-control-layout-text-size);justify-content:center}.FieldControlLayout-Children{flex:auto;width:var(--field-control-layout-children-width)}
3
+ );--field-control-layout-input-color:var(--color-control-typo-default);--field-control-layout-left-slots-width:calc(var(--field-control-layout-left-slots-length)*var(--field-control-layout-space) + var(--field-control-layout-left-slot-contents-width));--field-control-layout-right-slots-width:calc(var(--field-control-layout-right-slots-length)*var(--field-control-layout-space) + var(--field-control-layout-right-slot-contents-width));--field-control-layout-children-width:calc(var(--field-control-layout-container-width) - var(--field-control-layout-right-slots-width) - var(--field-control-layout-left-slots-width));background-color:var(--field-control-layout-bg-color);border-color:var(--field-control-layout-border-color);border-radius:var(--field-control-layout-border-radius);border-style:var(--field-control-layout-border-style);border-width:var(--field-control-layout-border-width);box-sizing:border-box;font-size:var(--field-control-layout-text-size);line-height:var(--field-control-layout-text-line-height);min-height:var(--field-control-layout-height);padding:var(--field-control-layout-padding);transition:border-color .15s,box-shadow .15s;width:100%}.FieldControlLayout_disabled{--field-control-layout-placeholder-color:var(--color-control-typo-disable);--field-control-layout-input-color:var(--color-control-typo-disable);--field-control-layout-slot-color:var(--color-control-typo-disable)}.FieldControlLayout_alignSlots_top .FieldControlLayout-Slot{height:var(--field-control-layout-slot-height)}.FieldControlLayout_alignSlots_center .FieldControlLayout-Slot{height:auto}.FieldControlLayout-Container{display:flex;gap:var(--field-control-layout-space);min-height:var(--field-control-layout-slot-height)}.FieldControlLayout-Slot{align-items:center;color:var(--field-control-layout-slot-color);display:flex;flex:none;font-size:var(--field-control-layout-text-size);justify-content:center}.FieldControlLayout-Children{flex:auto}
@@ -1 +1 @@
1
- .TextFieldTypeTextArray{--text-field-textarray-padding:calc((var(--field-control-layout-right-slots-length) + 1)*var(--field-control-layout-space) + var(--field-control-layout-right-slot-contents-width));--text-field-textarray-scroll-wrapper-height:calc(var(--text-field-textarray-max-height) - var(--field-control-layout-border-width)*2)}.TextFieldTypeTextArray-ScrollWrapper{max-height:var(--text-field-textarray-scroll-wrapper-height);overflow:auto;padding-right:var(--text-field-textarray-padding,0);width:calc(100% + var(--text-field-textarray-padding))}
1
+ .TextFieldTypeTextArray{--text-field-textarray-padding:calc((var(--field-control-layout-right-slots-length) + 1)*var(--field-control-layout-space) + var(--field-control-layout-right-slot-contents-width));--text-field-textarray-scroll-wrapper-height:calc(var(--text-field-textarray-max-height) - var(--field-control-layout-border-width)*2)}.TextFieldTypeTextArray-ScrollWrapper{max-height:var(--text-field-textarray-scroll-wrapper-height);overflow:auto;padding-right:var(--text-field-textarray-padding,0);width:calc(100% + var(--text-field-textarray-padding))}.TextFieldTypeTextArray .FieldControlLayout-Children{overflow:hidden}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","value","defaultValue","onChange","id","name","inputRef","maxLength","disabled","size","view","form","status","onBlur","onFocus","autoFocus","placeholder","leftSide","rightSide","autoComplete","clearButton","readOnly","type","tabIndex","ariaLabel","iconSize","onClick","style","inputValue","renderValueItem","onInputChange","onKeyDown","onKeyDownCapture","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onClear","onWheel","iconClear"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{forwardRef,useCallback,useEffect,useMemo,useRef}from"react";import{FieldArrayValueInlineControl,FieldArrayValueItem,FieldClearButton,FieldControlLayout,renderSide}from"../../FieldComponents";import{useComponentSize}from"../../../hooks/useComponentSize";import{useForkRef}from"../../../hooks/useForkRef";import{useKeys}from"../../../hooks/useKeys";import{useMutableRef}from"../../../hooks/useMutableRef";import{getStyleProps}from"../../../hooks/useStyleProps";import{cnMixScrollBar}from"../../../mixs/MixScrollBar";import{useTextField}from"../useTextField";import{cnTextFieldTypeTextArray}from"./cnTextFieldTypeTextArray";var defaultRenderValueItem=function(a){var b=a.item,c=a.index,d=a.size,e=a.disabled,f=a.onRemove;return React.createElement(FieldArrayValueItem,{key:c,size:d,label:b,disabled:e,onRemove:f})};export var TextFieldTypeTextArray=forwardRef(function(a,b){var c=a.className,d=a.value,e=a.defaultValue,f=a.onChange,g=a.id,h=a.name,i=a.inputRef,j=a.maxLength,k=a.disabled,l=a.size,m=void 0===l?"m":l,n=a.view,o=void 0===n?"default":n,p=a.form,q=a.status,r=a.onBlur,s=a.onFocus,t=a.autoFocus,u=a.placeholder,v=a.leftSide,w=a.rightSide,x=a.autoComplete,y=a.clearButton,z=a.readOnly,A=a.type,B=a.tabIndex,C=a.ariaLabel,D=a.iconSize,E=a.onClick,F=a.style,G=a.inputValue,H=a.renderValueItem,I=void 0===H?defaultRenderValueItem:H,J=a.onInputChange,K=a.onKeyDown,L=a.onKeyDownCapture,M=a.onKeyUp,N=a.onKeyUpCapture,O=a.onCopy,P=a.onCopyCapture,Q=a.onCut,R=a.onCutCapture,S=a.onPaste,T=a.onPasteCapture,U=a.onClear,V=a.onWheel,W=a.iconClear,X=_objectWithoutProperties(a,_excluded),Y=useTextField({onClick:E,onChange:J,onBlur:r,onFocus:s,disabled:k,onClear:void 0}),Z=Y.handleBlur,$=Y.handleChange,_=Y.handleClear,aa=Y.handleFocus,ba=Y.focused,ca=Y.withValue,da=Y.ref,ea=Y.inputRef,fa=Y.handleClick,ga=ca||!!(null!==d&&void 0!==d&&d.length),ha=useRef(null),ia=useRef(null),ja=useMutableRef([f,_,d]),ka=function(a){return function(b){if(null!==d&&void 0!==d&&d.length){var c=_toConsumableArray(d);c.splice(a,1),null===f||void 0===f?void 0:f(c.length?c:null,{e:b})}}},la=useCallback(function(a){var b;if(ja.current[1](a),null!==(b=ja.current[2])&&void 0!==b&&b.length){var c,d;null===(c=(d=ja.current)[0])||void 0===c?void 0:c.call(d,null,{e:a})}},[]),ma=useMemo(function(){return{Enter:function Enter(a){var b,c=null===(b=ea.current)||void 0===b?void 0:b.value;if(c){var d,e;null===(d=(e=ja.current)[0])||void 0===d?void 0:d.call(e,[].concat(_toConsumableArray(ja.current[2]||[]),[c]),{e:a}),ha.current&&"function"==typeof ha.current.scrollTo&&ha.current.scrollTo({top:ha.current.scrollHeight})}},Backspace:function Backspace(a){var b,c=null===(b=ea.current)||void 0===b?void 0:b.value,d=ja.current[2];if(!c&&null!==d&&void 0!==d&&d.length){var e,f;a.preventDefault();var g=_toConsumableArray(d);g.pop(),null===(e=(f=ja.current)[0])||void 0===e?void 0:e.call(f,g,{e:a})}}}},[]),na=useKeys({isActive:!!f,keys:ma,onEvent:K}),oa=useComponentSize(ha),pa=da.current?getStyleProps(da.current,["max-height","height"]):void 0;return useEffect(function(){ha.current&&ia.current&&ba&&ia.current.scrollTo({top:oa.height})},[oa.height]),useEffect(function(){ea.current&&ea.current.value!==G&&(ea.current.value=G||"")},[G,ea.current]),React.createElement(FieldControlLayout,Object.assign({},X,{className:cnTextFieldTypeTextArray({withValue:ga},[c]),form:p,status:q,size:m,leftSide:renderSide(v,m,D),rightSide:[y&&!k&&ga&&React.createElement(FieldClearButton,{size:m,onClick:U||la,icon:W}),renderSide(w,m,D)],focused:ba,view:o,ref:useForkRef([b,da]),disabled:k,onClick:fa,style:_objectSpread(_objectSpread({},F),{},_defineProperty({},"--text-field-textarray-max-height",(null===pa||void 0===pa?void 0:pa["max-height"])||(null===pa||void 0===pa?void 0:pa.height)||"auto"))}),React.createElement("div",{ref:ia,className:cnTextFieldTypeTextArray("ScrollWrapper",[cnMixScrollBar({size:"xs"})])},React.createElement(FieldArrayValueInlineControl,{size:m,inputRef:useForkRef([ea,i]),value:null!==d&&void 0!==d?d:void 0,onFocus:aa,onBlur:Z,onChange:$,autoFocus:t,onKeyDown:na,ref:ha,placeholder:u,renderValue:function renderValue(a){return a.map(function(a,b){return I({item:a,index:b,size:m,disabled:k,onRemove:ka(b)})})},onCopy:O,onCopyCapture:P,onCut:Q,onCutCapture:R,onPaste:S,onPasteCapture:T,inputTabIndex:B,onKeyDownCapture:L,onKeyUp:M,onKeyUpCapture:N,onWheel:V,disabled:k,inputDefaultValue:G||""})))});
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","value","defaultValue","onChange","id","name","inputRef","maxLength","disabled","size","view","form","status","onBlur","onFocus","autoFocus","placeholder","leftSide","rightSide","autoComplete","clearButton","readOnly","type","tabIndex","ariaLabel","iconSize","onClick","style","inputValue","renderValueItem","onInputChange","onKeyDown","onKeyDownCapture","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onClear","onWheel","iconClear"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{forwardRef,useCallback,useEffect,useMemo,useRef}from"react";import{FieldArrayValueInlineControl,FieldArrayValueItem,FieldClearButton,FieldControlLayout,renderSide}from"../../FieldComponents";import{useComponentSize}from"../../../hooks/useComponentSize";import{useForkRef}from"../../../hooks/useForkRef";import{useKeys}from"../../../hooks/useKeys";import{useMutableRef}from"../../../hooks/useMutableRef";import{getStyleProps}from"../../../hooks/useStyleProps";import{cnMixScrollBar}from"../../../mixs/MixScrollBar";import{useTextField}from"../useTextField";import{cnTextFieldTypeTextArray}from"./cnTextFieldTypeTextArray";var defaultRenderValueItem=function(a){var b=a.item,c=a.index,d=a.size,e=a.disabled,f=a.onRemove;return React.createElement(FieldArrayValueItem,{key:c,size:d,label:b,disabled:e,onRemove:f})};export var TextFieldTypeTextArray=forwardRef(function(a,b){var c=a.className,d=a.value,e=a.defaultValue,f=a.onChange,g=a.id,h=a.name,i=a.inputRef,j=a.maxLength,k=a.disabled,l=a.size,m=void 0===l?"m":l,n=a.view,o=void 0===n?"default":n,p=a.form,q=a.status,r=a.onBlur,s=a.onFocus,t=a.autoFocus,u=a.placeholder,v=a.leftSide,w=a.rightSide,x=a.autoComplete,y=a.clearButton,z=a.readOnly,A=a.type,B=a.tabIndex,C=a.ariaLabel,D=a.iconSize,E=a.onClick,F=a.style,G=a.inputValue,H=a.renderValueItem,I=void 0===H?defaultRenderValueItem:H,J=a.onInputChange,K=a.onKeyDown,L=a.onKeyDownCapture,M=a.onKeyUp,N=a.onKeyUpCapture,O=a.onCopy,P=a.onCopyCapture,Q=a.onCut,R=a.onCutCapture,S=a.onPaste,T=a.onPasteCapture,U=a.onClear,V=a.onWheel,W=a.iconClear,X=_objectWithoutProperties(a,_excluded),Y=useTextField({onClick:E,onChange:J,onBlur:r,onFocus:s,disabled:k,onClear:void 0}),Z=Y.handleBlur,$=Y.handleChange,_=Y.handleClear,aa=Y.handleFocus,ba=Y.focused,ca=Y.withValue,da=Y.ref,ea=Y.inputRef,fa=Y.handleClick,ga=ca||!!(null!==d&&void 0!==d&&d.length),ha=useRef(null),ia=useRef(null),ja=useMutableRef([f,_,d]),ka=function(a){return function(b){if(null!==d&&void 0!==d&&d.length){var c=_toConsumableArray(d);c.splice(a,1),null===f||void 0===f?void 0:f(c.length?c:null,{e:b})}}},la=useCallback(function(a){var b;if(ja.current[1](a),null!==(b=ja.current[2])&&void 0!==b&&b.length){var c,d;null===(c=(d=ja.current)[0])||void 0===c?void 0:c.call(d,null,{e:a})}},[]),ma=useMemo(function(){return{Enter:function Enter(a){var b,c=null===(b=ea.current)||void 0===b?void 0:b.value;if(c){var d,e;null===(d=(e=ja.current)[0])||void 0===d?void 0:d.call(e,[].concat(_toConsumableArray(ja.current[2]||[]),[c]),{e:a}),ha.current&&"function"==typeof ha.current.scrollTo&&ha.current.scrollTo({top:ha.current.scrollHeight})}},Backspace:function Backspace(a){var b,c=null===(b=ea.current)||void 0===b?void 0:b.value,d=ja.current[2];if(!c&&null!==d&&void 0!==d&&d.length){var e,f;a.preventDefault();var g=_toConsumableArray(d);g.pop(),null===(e=(f=ja.current)[0])||void 0===e?void 0:e.call(f,g,{e:a})}}}},[]),na=useKeys({isActive:!!f,keys:ma,onEvent:K}),oa=useComponentSize(ha),pa=da.current?getStyleProps(da.current,["max-height","height"]):void 0;return useEffect(function(){ha.current&&ia.current&&ba&&ia.current.scrollTo({top:oa.height})},[oa.height]),useEffect(function(){ea.current&&ea.current.value!==G&&(ea.current.value=G||"")},[G,ea.current]),React.createElement(FieldControlLayout,Object.assign({},X,{className:cnTextFieldTypeTextArray({withValue:ga},[c]),form:p,status:q,size:m,leftSide:renderSide(v,m,D),rightSide:[y&&!k&&ga&&React.createElement(FieldClearButton,{size:m,onClick:U||la,icon:W}),renderSide(w,m,D)],focused:ba,view:o,ref:useForkRef([b,da]),disabled:k,onClick:fa,style:_objectSpread(_objectSpread({},F),{},_defineProperty({},"--text-field-textarray-max-height",(null===pa||void 0===pa?void 0:pa["max-height"])||(null===pa||void 0===pa?void 0:pa.height)||"auto"))}),React.createElement("div",{ref:ia,className:cnTextFieldTypeTextArray("ScrollWrapper",[cnMixScrollBar({size:"xs"})])},React.createElement(FieldArrayValueInlineControl,{size:m,inputRef:useForkRef([ea,i]),value:null!==d&&void 0!==d?d:void 0,onFocus:aa,onBlur:Z,onChange:$,autoFocus:t,onKeyDown:na,ref:ha,placeholder:u,renderValue:function renderValue(a){return a.map(function(a,b){return I({item:a,index:b,size:m,disabled:k,onRemove:ka(b)})})},onCopy:O,onCopyCapture:P,onCut:Q,onCutCapture:R,onPaste:S,onPasteCapture:T,inputTabIndex:B,onKeyDownCapture:L,onKeyUp:M,onKeyUpCapture:N,onWheel:V,disabled:k,inputValue:G||""})))});
2
2
  //# sourceMappingURL=TextFieldTypeTextArray.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextFieldTypeTextArray.js","names":["React","forwardRef","useCallback","useEffect","useMemo","useRef","FieldArrayValueInlineControl","FieldArrayValueItem","FieldClearButton","FieldControlLayout","renderSide","useComponentSize","useForkRef","useKeys","useMutableRef","getStyleProps","cnMixScrollBar","useTextField","cnTextFieldTypeTextArray","defaultRenderValueItem","item","index","size","disabled","onRemove","TextFieldTypeTextArray","props","componentRef","className","value","defaultValue","onChange","id","name","inputRefProp","inputRef","maxLength","view","form","status","onBlur","onFocus","autoFocus","placeholder","leftSide","rightSide","autoComplete","clearButton","readOnly","type","tabIndex","ariaLabel","iconSize","onClick","style","inputValue","renderValueItem","onInputChange","onKeyDown","onKeyDownCapture","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onClear","onWheel","iconClear","otherProps","handleBlur","handleChange","inputHandleClear","handleClear","handleFocus","focused","withInputValue","withValue","ref","handleClick","length","controlRef","scrollWrapperRef","mutableRefs","getRemoveItem","e","newValue","splice","current","keys","Enter","stringValue","scrollTo","top","scrollHeight","Backspace","currentValue","preventDefault","pop","handleInputKeyDown","isActive","onEvent","controlSize","stylesRoot","height","items","map"],"sources":["../../../../../../src/components/TextFieldCanary/TextFieldTypeTextArray/TextFieldTypeTextArray.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport {\n FieldArrayValueInlineControl,\n FieldArrayValueItem,\n FieldClearButton,\n FieldControlLayout,\n renderSide,\n} from '##/components/FieldComponents';\nimport { useComponentSize } from '##/hooks/useComponentSize';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { useKeys, UseKeysPropKeys } from '##/hooks/useKeys';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { getStyleProps } from '##/hooks/useStyleProps';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\n\nimport { TextFieldPropRenderValueItem, TextFieldTypeComponent } from '../types';\nimport { useTextField } from '../useTextField';\nimport { cnTextFieldTypeTextArray } from './cnTextFieldTypeTextArray';\n\nconst defaultRenderValueItem: TextFieldPropRenderValueItem = ({\n item,\n index,\n size,\n disabled,\n onRemove,\n}) => (\n <FieldArrayValueItem\n key={index}\n size={size}\n label={item}\n disabled={disabled}\n onRemove={onRemove}\n />\n);\n\nexport const TextFieldTypeTextArray: TextFieldTypeComponent<'textarray'> =\n forwardRef((props, componentRef) => {\n const {\n className,\n value,\n defaultValue,\n onChange,\n id,\n name,\n inputRef: inputRefProp,\n maxLength,\n disabled,\n size = 'm',\n view = 'default',\n form,\n status,\n onBlur,\n onFocus,\n autoFocus,\n placeholder,\n leftSide,\n rightSide,\n autoComplete,\n clearButton,\n readOnly,\n type,\n tabIndex,\n ariaLabel,\n iconSize,\n onClick,\n style,\n inputValue,\n renderValueItem = defaultRenderValueItem,\n onInputChange,\n // onKey props\n onKeyDown,\n onKeyDownCapture,\n onKeyUp,\n onKeyUpCapture,\n onCopy,\n onCopyCapture,\n onCut,\n onCutCapture,\n onPaste,\n onPasteCapture,\n onClear,\n onWheel,\n iconClear,\n ...otherProps\n } = props;\n\n const {\n handleBlur,\n handleChange,\n handleClear: inputHandleClear,\n handleFocus,\n focused,\n withValue: withInputValue,\n ref,\n inputRef,\n handleClick,\n } = useTextField({\n onClick,\n onChange: onInputChange,\n onBlur,\n onFocus,\n disabled,\n onClear: undefined,\n });\n\n const withValue = withInputValue || !!value?.length;\n\n const controlRef = useRef<HTMLDivElement>(null);\n const scrollWrapperRef = useRef<HTMLDivElement>(null);\n\n const mutableRefs = useMutableRef([\n onChange,\n inputHandleClear,\n value,\n ] as const);\n\n const getRemoveItem = (index: number) => (e: React.MouseEvent) => {\n if (value?.length) {\n const newValue = [...value];\n newValue.splice(index, 1);\n onChange?.(newValue.length ? newValue : null, { e });\n }\n };\n\n const handleClear = useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n mutableRefs.current[1](e);\n if (mutableRefs.current[2]?.length) {\n mutableRefs.current[0]?.(null, { e });\n }\n },\n [],\n );\n\n const keys: UseKeysPropKeys<HTMLInputElement> = useMemo(\n () => ({\n Enter: (e) => {\n const stringValue = inputRef.current?.value;\n\n if (stringValue) {\n mutableRefs.current[0]?.(\n [...(mutableRefs.current[2] || []), stringValue],\n {\n e,\n },\n );\n\n if (\n controlRef.current &&\n typeof controlRef.current.scrollTo === 'function'\n ) {\n controlRef.current.scrollTo({\n top: controlRef.current.scrollHeight,\n });\n }\n }\n },\n Backspace: (e) => {\n const stringValue = inputRef.current?.value;\n const currentValue = mutableRefs.current[2];\n\n if (!stringValue && currentValue?.length) {\n e.preventDefault();\n const newValue = [...currentValue];\n newValue.pop();\n mutableRefs.current[0]?.(newValue, {\n e,\n });\n }\n },\n }),\n [],\n );\n\n const handleInputKeyDown = useKeys<HTMLInputElement>({\n isActive: !!onChange,\n keys,\n onEvent: onKeyDown,\n });\n\n const controlSize = useComponentSize(controlRef);\n\n const stylesRoot: Record<'max-height' | 'height', string> | undefined =\n ref.current\n ? getStyleProps(ref.current, ['max-height', 'height'])\n : undefined;\n\n useEffect(() => {\n if (controlRef.current && scrollWrapperRef.current && focused) {\n scrollWrapperRef.current.scrollTo({\n top: controlSize.height,\n });\n }\n }, [controlSize.height]);\n\n useEffect(() => {\n if (inputRef.current && inputRef.current.value !== inputValue) {\n inputRef.current.value = inputValue || '';\n }\n }, [inputValue, inputRef.current]);\n\n return (\n <FieldControlLayout\n {...otherProps}\n className={cnTextFieldTypeTextArray({ withValue }, [className])}\n form={form}\n status={status}\n size={size}\n leftSide={renderSide(leftSide, size, iconSize)}\n rightSide={[\n clearButton && !disabled && withValue && (\n <FieldClearButton\n size={size}\n onClick={onClear || handleClear}\n icon={iconClear}\n />\n ),\n renderSide(rightSide, size, iconSize),\n ]}\n focused={focused}\n view={view}\n ref={useForkRef([componentRef, ref])}\n disabled={disabled}\n onClick={handleClick}\n style={{\n ...style,\n ['--text-field-textarray-max-height' as string]:\n stylesRoot?.['max-height'] || stylesRoot?.height || 'auto',\n }}\n >\n <div\n ref={scrollWrapperRef}\n className={cnTextFieldTypeTextArray('ScrollWrapper', [\n cnMixScrollBar({ size: 'xs' }),\n ])}\n >\n <FieldArrayValueInlineControl\n size={size}\n inputRef={useForkRef([inputRef, inputRefProp])}\n value={value ?? undefined}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n autoFocus={autoFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef}\n placeholder={placeholder}\n renderValue={(items) =>\n items.map((item, index) =>\n renderValueItem({\n item,\n index,\n size,\n disabled,\n onRemove: getRemoveItem(index),\n }),\n )\n }\n onCopy={onCopy}\n onCopyCapture={onCopyCapture}\n onCut={onCut}\n onCutCapture={onCutCapture}\n onPaste={onPaste}\n onPasteCapture={onPasteCapture}\n inputTabIndex={tabIndex}\n onKeyDownCapture={onKeyDownCapture}\n onKeyUp={onKeyUp}\n onKeyUpCapture={onKeyUpCapture}\n onWheel={onWheel}\n disabled={disabled}\n inputDefaultValue={inputValue || ''}\n />\n </div>\n </FieldControlLayout>\n );\n });\n"],"mappings":"w0CAAA,MAAOA,MAAP,EACEC,UADF,CAEEC,WAFF,CAGEC,SAHF,CAIEC,OAJF,CAKEC,MALF,KAMO,OANP,CAQA,OACEC,4BADF,CAEEC,mBAFF,CAGEC,gBAHF,CAIEC,kBAJF,CAKEC,UALF,6BAOA,OAASC,gBAAT,uCACA,OAASC,UAAT,iCACA,OAASC,OAAT,8BACA,OAASC,aAAT,oCACA,OAASC,aAAT,oCACA,OAASC,cAAT,kCAGA,OAASC,YAAT,uBACA,OAASC,wBAAT,kCAEA,GAAMC,uBAAoD,CAAG,eAC3DC,EAD2D,GAC3DA,IAD2D,CAE3DC,CAF2D,GAE3DA,KAF2D,CAG3DC,CAH2D,GAG3DA,IAH2D,CAI3DC,CAJ2D,GAI3DA,QAJ2D,CAK3DC,CAL2D,GAK3DA,QAL2D,OAO3D,qBAAC,mBAAD,EACE,GAAG,CAAEH,CADP,CAEE,IAAI,CAAEC,CAFR,CAGE,KAAK,CAAEF,CAHT,CAIE,QA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AEC,CANZ,CAOE,SAAS,CAAE/B,CAPb,CAQE,SAAS,CAAE2D,EARb,CASE,GAAG,CAAElB,EATP,CAUE,WAAW,CAAExC,CAVf,CAWE,WAAW,CAAE,qBAACgE,CAAD,QACXA,EAAK,CAACC,GAAN,CAAU,SAACxF,CAAD,CAAOC,CAAP,QACRmC,EAAe,CAAC,CACdpC,IAAI,CAAJA,CADc,CAEdC,KAAK,CAALA,CAFc,CAGdC,IAAI,CAAJA,CAHc,CAIdC,QAAQ,CAARA,CAJc,CAKdC,QAAQ,CAAE8D,EAAa,CAACjE,CAAD,CALT,CAAD,CADP,CAAV,CADW,CAXf,CAsBE,MAAM,CAAEyC,CAtBV,CAuBE,aAAa,CAAEC,CAvBjB,CAwBE,KAAK,CAAEC,CAxBT,CAyBE,YAAY,CAAEC,CAzBhB,CA0BE,OAAO,CAAEC,CA1BX,CA2BE,cAAc,CAAEC,CA3BlB,CA4BE,aAAa,CAAEjB,CA5BjB,CA6BE,gBAAgB,CAAES,CA7BpB,CA8BE,OAAO,CAAEC,CA9BX,CA+BE,cAAc,CAAEC,CA/BlB,CAgCE,OAAO,CAAEQ,CAhCX,CAiCE,QAAQ,CAAE9C,CAjCZ,CAkCE,iBAAiB,CAAEgC,CAAU,EAAI,EAlCnC,EANF,CA5BF,CAyEH,CA/OS,CADL"}
1
+ {"version":3,"file":"TextFieldTypeTextArray.js","names":["React","forwardRef","useCallback","useEffect","useMemo","useRef","FieldArrayValueInlineControl","FieldArrayValueItem","FieldClearButton","FieldControlLayout","renderSide","useComponentSize","useForkRef","useKeys","useMutableRef","getStyleProps","cnMixScrollBar","useTextField","cnTextFieldTypeTextArray","defaultRenderValueItem","item","index","size","disabled","onRemove","TextFieldTypeTextArray","props","componentRef","className","value","defaultValue","onChange","id","name","inputRefProp","inputRef","maxLength","view","form","status","onBlur","onFocus","autoFocus","placeholder","leftSide","rightSide","autoComplete","clearButton","readOnly","type","tabIndex","ariaLabel","iconSize","onClick","style","inputValue","renderValueItem","onInputChange","onKeyDown","onKeyDownCapture","onKeyUp","onKeyUpCapture","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onClear","onWheel","iconClear","otherProps","handleBlur","handleChange","inputHandleClear","handleClear","handleFocus","focused","withInputValue","withValue","ref","handleClick","length","controlRef","scrollWrapperRef","mutableRefs","getRemoveItem","e","newValue","splice","current","keys","Enter","stringValue","scrollTo","top","scrollHeight","Backspace","currentValue","preventDefault","pop","handleInputKeyDown","isActive","onEvent","controlSize","stylesRoot","height","items","map"],"sources":["../../../../../../src/components/TextFieldCanary/TextFieldTypeTextArray/TextFieldTypeTextArray.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport {\n FieldArrayValueInlineControl,\n FieldArrayValueItem,\n FieldClearButton,\n FieldControlLayout,\n renderSide,\n} from '##/components/FieldComponents';\nimport { useComponentSize } from '##/hooks/useComponentSize';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { useKeys, UseKeysPropKeys } from '##/hooks/useKeys';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { getStyleProps } from '##/hooks/useStyleProps';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\n\nimport { TextFieldPropRenderValueItem, TextFieldTypeComponent } from '../types';\nimport { useTextField } from '../useTextField';\nimport { cnTextFieldTypeTextArray } from './cnTextFieldTypeTextArray';\n\nconst defaultRenderValueItem: TextFieldPropRenderValueItem = ({\n item,\n index,\n size,\n disabled,\n onRemove,\n}) => (\n <FieldArrayValueItem\n key={index}\n size={size}\n label={item}\n disabled={disabled}\n onRemove={onRemove}\n />\n);\n\nexport const TextFieldTypeTextArray: TextFieldTypeComponent<'textarray'> =\n forwardRef((props, componentRef) => {\n const {\n className,\n value,\n defaultValue,\n onChange,\n id,\n name,\n inputRef: inputRefProp,\n maxLength,\n disabled,\n size = 'm',\n view = 'default',\n form,\n status,\n onBlur,\n onFocus,\n autoFocus,\n placeholder,\n leftSide,\n rightSide,\n autoComplete,\n clearButton,\n readOnly,\n type,\n tabIndex,\n ariaLabel,\n iconSize,\n onClick,\n style,\n inputValue,\n renderValueItem = defaultRenderValueItem,\n onInputChange,\n // onKey props\n onKeyDown,\n onKeyDownCapture,\n onKeyUp,\n onKeyUpCapture,\n onCopy,\n onCopyCapture,\n onCut,\n onCutCapture,\n onPaste,\n onPasteCapture,\n onClear,\n onWheel,\n iconClear,\n ...otherProps\n } = props;\n\n const {\n handleBlur,\n handleChange,\n handleClear: inputHandleClear,\n handleFocus,\n focused,\n withValue: withInputValue,\n ref,\n inputRef,\n handleClick,\n } = useTextField({\n onClick,\n onChange: onInputChange,\n onBlur,\n onFocus,\n disabled,\n onClear: undefined,\n });\n\n const withValue = withInputValue || !!value?.length;\n\n const controlRef = useRef<HTMLDivElement>(null);\n const scrollWrapperRef = useRef<HTMLDivElement>(null);\n\n const mutableRefs = useMutableRef([\n onChange,\n inputHandleClear,\n value,\n ] as const);\n\n const getRemoveItem = (index: number) => (e: React.MouseEvent) => {\n if (value?.length) {\n const newValue = [...value];\n newValue.splice(index, 1);\n onChange?.(newValue.length ? newValue : null, { e });\n }\n };\n\n const handleClear = useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n mutableRefs.current[1](e);\n if (mutableRefs.current[2]?.length) {\n mutableRefs.current[0]?.(null, { e });\n }\n },\n [],\n );\n\n const keys: UseKeysPropKeys<HTMLInputElement> = useMemo(\n () => ({\n Enter: (e) => {\n const stringValue = inputRef.current?.value;\n\n if (stringValue) {\n mutableRefs.current[0]?.(\n [...(mutableRefs.current[2] || []), stringValue],\n {\n e,\n },\n );\n\n if (\n controlRef.current &&\n typeof controlRef.current.scrollTo === 'function'\n ) {\n controlRef.current.scrollTo({\n top: controlRef.current.scrollHeight,\n });\n }\n }\n },\n Backspace: (e) => {\n const stringValue = inputRef.current?.value;\n const currentValue = mutableRefs.current[2];\n\n if (!stringValue && currentValue?.length) {\n e.preventDefault();\n const newValue = [...currentValue];\n newValue.pop();\n mutableRefs.current[0]?.(newValue, {\n e,\n });\n }\n },\n }),\n [],\n );\n\n const handleInputKeyDown = useKeys<HTMLInputElement>({\n isActive: !!onChange,\n keys,\n onEvent: onKeyDown,\n });\n\n const controlSize = useComponentSize(controlRef);\n\n const stylesRoot: Record<'max-height' | 'height', string> | undefined =\n ref.current\n ? getStyleProps(ref.current, ['max-height', 'height'])\n : undefined;\n\n useEffect(() => {\n if (controlRef.current && scrollWrapperRef.current && focused) {\n scrollWrapperRef.current.scrollTo({\n top: controlSize.height,\n });\n }\n }, [controlSize.height]);\n\n useEffect(() => {\n if (inputRef.current && inputRef.current.value !== inputValue) {\n inputRef.current.value = inputValue || '';\n }\n }, [inputValue, inputRef.current]);\n\n return (\n <FieldControlLayout\n {...otherProps}\n className={cnTextFieldTypeTextArray({ withValue }, [className])}\n form={form}\n status={status}\n size={size}\n leftSide={renderSide(leftSide, size, iconSize)}\n rightSide={[\n clearButton && !disabled && withValue && (\n <FieldClearButton\n size={size}\n onClick={onClear || handleClear}\n icon={iconClear}\n />\n ),\n renderSide(rightSide, size, iconSize),\n ]}\n focused={focused}\n view={view}\n ref={useForkRef([componentRef, ref])}\n disabled={disabled}\n onClick={handleClick}\n style={{\n ...style,\n ['--text-field-textarray-max-height' as string]:\n stylesRoot?.['max-height'] || stylesRoot?.height || 'auto',\n }}\n >\n <div\n ref={scrollWrapperRef}\n className={cnTextFieldTypeTextArray('ScrollWrapper', [\n cnMixScrollBar({ size: 'xs' }),\n ])}\n >\n <FieldArrayValueInlineControl\n size={size}\n inputRef={useForkRef([inputRef, inputRefProp])}\n value={value ?? undefined}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n autoFocus={autoFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef}\n placeholder={placeholder}\n renderValue={(items) =>\n items.map((item, index) =>\n renderValueItem({\n item,\n index,\n size,\n disabled,\n onRemove: getRemoveItem(index),\n }),\n )\n }\n onCopy={onCopy}\n onCopyCapture={onCopyCapture}\n onCut={onCut}\n onCutCapture={onCutCapture}\n onPaste={onPaste}\n onPasteCapture={onPasteCapture}\n inputTabIndex={tabIndex}\n onKeyDownCapture={onKeyDownCapture}\n onKeyUp={onKeyUp}\n onKeyUpCapture={onKeyUpCapture}\n onWheel={onWheel}\n disabled={disabled}\n inputValue={inputValue || ''}\n />\n </div>\n </FieldControlLayout>\n );\n });\n"],"mappings":"w0CAAA,MAAOA,MAAP,EACEC,UADF,CAEEC,WAFF,CAGEC,SAHF,CAIEC,OAJF,CAKEC,MALF,KAMO,OANP,CAQA,OACEC,4BADF,CAEEC,mBAFF,CAGEC,gBAHF,CAIEC,kBAJF,CAKEC,UALF,6BAOA,OAASC,gBAAT,uCACA,OAASC,UAAT,iCACA,OAASC,OAAT,8BACA,OAASC,aAAT,oCACA,OAASC,aAAT,oCACA,OAASC,cAAT,kCAGA,OAASC,YAAT,uBACA,OAASC,wBAAT,kCAEA,GAAMC,uBAAoD,CAAG,eAC3DC,EAD2D,GAC3DA,IAD2D,CAE3DC,CAF2D,GAE3DA,KAF2D,CAG3DC,CAH2D,GAG3DA,IAH2D,CAI3DC,CAJ2D,GAI3DA,QAJ2D,CAK3DC,CAL2D,GAK3DA,QAL2D,OAO3D,qBAAC,mBAAD,EACE,GAAG,CAAEH,CADP,CAEE,IAAI,CAAEC,CAFR,CAGE,KAAK,CAAEF,CAHT,CAIE,QAAQ,CAAEG,CAJZ,CAKE,QAAQ,CAAEC,CALZ,EAP2D,CAA7D,CAgBA,MAAO,IAAMC,uBAA2D,CACtExB,UAAU,CAAC,SAACyB,CAAD,CAAQC,CAAR,CAAyB,IAEhCC,EAFgC,CAgD9BF,CAhD8B,CAEhCE,SAFgC,CAGhCC,CAHgC,CAgD9BH,CAhD8B,CAGhCG,KAHgC,CAIhCC,CAJgC,CAgD9BJ,CAhD8B,CAIhCI,YAJgC,CAKhCC,CALgC,CAgD9BL,CAhD8B,CAKhCK,QALgC,CAMhCC,CANgC,C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ACjE,CAAD,CALT,CAAD,CADP,CAAV,CADW,CAXf,CAsBE,MAAM,CAAEyC,CAtBV,CAuBE,aAAa,CAAEC,CAvBjB,CAwBE,KAAK,CAAEC,CAxBT,CAyBE,YAAY,CAAEC,CAzBhB,CA0BE,OAAO,CAAEC,CA1BX,CA2BE,cAAc,CAAEC,CA3BlB,CA4BE,aAAa,CAAEjB,CA5BjB,CA6BE,gBAAgB,CAAES,CA7BpB,CA8BE,OAAO,CAAEC,CA9BX,CA+BE,cAAc,CAAEC,CA/BlB,CAgCE,OAAO,CAAEQ,CAhCX,CAiCE,QAAQ,CAAE9C,CAjCZ,CAkCE,UAAU,CAAEgC,CAAU,EAAI,EAlC5B,EANF,CA5BF,CAyEH,CA/OS,CADL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consta/uikit",
3
- "version": "5.24.1",
3
+ "version": "5.25.0",
4
4
  "keywords": [
5
5
  "ui-kit",
6
6
  "design-system",
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutoComplete.js","names":["React","cnCanary","AutoCompleteTypeText","AutoCompleteTypeTextArray","typeMap","text","textarray","cnAutoComplete","AutoCompleteRender","props","ref","type","Component","className","AutoComplete","forwardRef"],"sources":["../../../../../src/components/AutoCompleteCanary/AutoComplete.tsx"],"sourcesContent":["import React from 'react';\n\nimport { cnCanary } from '##/utils/bem';\n\nimport { AutoCompleteTypeText } from './AutoCompleteTypeText';\nimport { AutoCompleteTypeTextArray } from './AutoCompleteTypeTextArray';\nimport {\n AutoCompleteComponent,\n AutoCompleteGroupDefault,\n AutoCompleteItemDefault,\n AutoCompleteProps,\n AutoCompleteTypeComponent,\n} from './types';\n\nconst typeMap: Record<\n string,\n AutoCompleteTypeComponent<string> | AutoCompleteTypeComponent<'textarray'>\n> = {\n text: AutoCompleteTypeText,\n textarray: AutoCompleteTypeTextArray,\n};\n\nexport const cnAutoComplete = cnCanary('AutoComplete');\n\nconst AutoCompleteRender = <\n TYPE extends string,\n ITEM = AutoCompleteItemDefault,\n GROUP = AutoCompleteGroupDefault,\n>(\n props: AutoCompleteProps<TYPE, ITEM, GROUP>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const type = props.type || 'text';\n const Component = typeMap[type] || typeMap.text;\n\n return (\n <Component\n {...(props as unknown as AutoCompleteTypeComponent<TYPE, ITEM, GROUP>)}\n ref={ref}\n className={cnAutoComplete({ type }, [props.className])}\n />\n );\n};\n\nexport const AutoComplete = React.forwardRef(\n AutoCompleteRender,\n) as AutoCompleteComponent;\n\nexport * from './types';\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,QAAT,uBAEA,OAASC,oBAAT,8BACA,OAASC,yBAAT,mCASA,GAAMC,QAGL,CAAG,CACFC,IAAI,CAAEH,oBADJ,CAEFI,SAAS,CAAEH,yBAFT,CAHJ,CAQA,MAAO,IAAMI,eAAc,CAAGN,QAAQ,CAAC,cAAD,CAA/B,CAEP,GAAMO,mBAAkB,CAAG,SAKzBC,CALyB,CAMzBC,CANyB,CAOtB,IACGC,EAAI,CAAGF,CAAK,CAACE,IAAN,EAAc,MADxB,CAEGC,CAAS,CAAGR,OAAO,CAACO,CAAD,CAAP,EAAiBP,OAAO,CAACC,IAFxC,CAIH,MACE,qBAAC,CAAD,kBACOI,CADP,EAEE,GAAG,CAAEC,CAFP,CAGE,SAAS,CAAEH,cAAc,CAAC,CAAEI,IAAI,CAAJA,CAAF,CAAD,CAAW,CAACF,CAAK,CAACI,SAAP,CAAX,CAH3B,GAMH,CAlBD,CAoBA,MAAO,IAAMC,aAAY,CAAGd,KAAK,CAACe,UAAN,CAC1BP,kBAD0B,CAArB,CAIP"}