@consta/uikit 5.2.1 → 5.3.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 (97) hide show
  1. package/MixFlex/index.d.ts +1 -0
  2. package/MixFlex/index.js +1 -0
  3. package/MixScrollBar/index.d.ts +1 -0
  4. package/MixScrollBar/index.js +1 -0
  5. package/__internal__/src/components/DragNDropField/DragNDropField.js +1 -1
  6. package/__internal__/src/components/DragNDropField/DragNDropField.js.map +1 -1
  7. package/__internal__/src/components/DragNDropField/formatAccept.d.ts +3 -0
  8. package/__internal__/src/components/DragNDropField/formatAccept.js +2 -0
  9. package/__internal__/src/components/DragNDropField/formatAccept.js.map +1 -0
  10. package/__internal__/src/components/DragNDropFieldCanary/DragNDropField.css +1 -0
  11. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldCanary.d.ts +17 -0
  12. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldCanary.js +2 -0
  13. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldCanary.js.map +1 -0
  14. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/DragNDropFieldContent.css +1 -0
  15. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/DragNDropFieldContent.d.ts +4 -0
  16. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/DragNDropFieldContent.js +2 -0
  17. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/DragNDropFieldContent.js.map +1 -0
  18. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/formatFileRequirements.d.ts +2 -0
  19. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/formatFileRequirements.js +2 -0
  20. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/formatFileRequirements.js.map +1 -0
  21. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/index.d.ts +1 -0
  22. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/index.js +2 -0
  23. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldContent/index.js.map +1 -0
  24. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.css +1 -0
  25. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.d.ts +4 -0
  26. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.js +2 -0
  27. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.js.map +1 -0
  28. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/index.d.ts +1 -0
  29. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/index.js +2 -0
  30. package/__internal__/src/components/DragNDropFieldCanary/DragNDropFieldInformer/index.js.map +1 -0
  31. package/__internal__/src/components/DragNDropFieldCanary/formatFileSize.d.ts +2 -0
  32. package/__internal__/src/components/DragNDropFieldCanary/formatFileSize.js +2 -0
  33. package/__internal__/src/components/DragNDropFieldCanary/formatFileSize.js.map +1 -0
  34. package/__internal__/src/components/DragNDropFieldCanary/getErrorsList.d.ts +3 -0
  35. package/__internal__/src/components/DragNDropFieldCanary/getErrorsList.js +2 -0
  36. package/__internal__/src/components/DragNDropFieldCanary/getErrorsList.js.map +1 -0
  37. package/__internal__/src/components/DragNDropFieldCanary/index.d.ts +3 -0
  38. package/__internal__/src/components/DragNDropFieldCanary/index.js +2 -0
  39. package/__internal__/src/components/DragNDropFieldCanary/index.js.map +1 -0
  40. package/__internal__/src/components/DragNDropFieldCanary/locale.d.ts +4 -0
  41. package/__internal__/src/components/DragNDropFieldCanary/locale.js +2 -0
  42. package/__internal__/src/components/DragNDropFieldCanary/locale.js.map +1 -0
  43. package/__internal__/src/components/DragNDropFieldCanary/renderCildren.d.ts +3 -0
  44. package/__internal__/src/components/DragNDropFieldCanary/renderCildren.js +2 -0
  45. package/__internal__/src/components/DragNDropFieldCanary/renderCildren.js.map +1 -0
  46. package/__internal__/src/components/DragNDropFieldCanary/types.d.ts +81 -0
  47. package/__internal__/src/components/DragNDropFieldCanary/types.js +2 -0
  48. package/__internal__/src/components/DragNDropFieldCanary/types.js.map +1 -0
  49. package/package.json +2 -2
  50. package/useBreakpoints/index.d.ts +1 -0
  51. package/useBreakpoints/index.js +1 -0
  52. package/useBreakpointsDepricated/index.d.ts +1 -0
  53. package/useBreakpointsDepricated/index.js +1 -0
  54. package/useChoiceGroupIndexed/index.d.ts +1 -0
  55. package/useChoiceGroupIndexed/index.js +1 -0
  56. package/useComponentBreakpointsDepricated/index.d.ts +1 -0
  57. package/useComponentBreakpointsDepricated/index.js +1 -0
  58. package/useDebounce/index.d.ts +1 -0
  59. package/useDebounce/index.js +1 -0
  60. package/useFlag/index.d.ts +1 -0
  61. package/useFlag/index.js +1 -0
  62. package/useForkRef/index.d.ts +1 -0
  63. package/useForkRef/index.js +1 -0
  64. package/useGlobalKeys/index.d.ts +1 -0
  65. package/useGlobalKeys/index.js +1 -0
  66. package/useHideElementsInLine/index.d.ts +1 -0
  67. package/useHideElementsInLine/index.js +1 -0
  68. package/useHideElementsInLineDepricated/index.d.ts +1 -0
  69. package/useHideElementsInLineDepricated/index.js +1 -0
  70. package/useKeys/index.d.ts +1 -0
  71. package/useKeys/index.js +1 -0
  72. package/useKeysRef/index.d.ts +1 -0
  73. package/useKeysRef/index.js +1 -0
  74. package/useMutableRef/index.d.ts +1 -0
  75. package/useMutableRef/index.js +1 -0
  76. package/useOverflow/index.d.ts +1 -0
  77. package/useOverflow/index.js +1 -0
  78. package/usePrevious/index.d.ts +1 -0
  79. package/usePrevious/index.js +1 -0
  80. package/useRefs/index.d.ts +1 -0
  81. package/useRefs/index.js +1 -0
  82. package/useResizableContent/index.d.ts +1 -0
  83. package/useResizableContent/index.js +1 -0
  84. package/useResizeObserved/index.d.ts +1 -0
  85. package/useResizeObserved/index.js +1 -0
  86. package/useScrollPosition/index.d.ts +1 -0
  87. package/useScrollPosition/index.js +1 -0
  88. package/useSelect/index.d.ts +1 -0
  89. package/useSelect/index.js +1 -0
  90. package/useSortSteps/index.d.ts +1 -0
  91. package/useSortSteps/index.js +1 -0
  92. package/useStyleProps/index.d.ts +1 -0
  93. package/useStyleProps/index.js +1 -0
  94. package/useThemeVars/index.d.ts +1 -0
  95. package/useThemeVars/index.js +1 -0
  96. package/useVirtualScroll/index.d.ts +1 -0
  97. package/useVirtualScroll/index.js +1 -0
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/mixs/MixFlex";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/mixs/MixFlex";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/mixs/MixScrollBar";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/mixs/MixScrollBar";
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["accept","maxSize","minSize","multiple","onDropFiles","children","locale","disabled","onClick"];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"./DragNDropField.css";import React,{forwardRef,useRef}from"react";import{useDropzone}from"react-dropzone";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{Text}from"../Text/Text";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{useMutableRef}from"../../hooks/useMutableRef/useMutableRef";import{cn}from"../../utils/bem";import{isRenderProp}from"../../utils/isRenderProp";import{DragNDropFieldContent}from"./DragNDropFieldContent/DragNDropFieldContent";import{DragNDropFieldTooltip}from"./DragNDropFieldTooltip/DragNDropFieldTooltip";import{getErrorsList}from"./getErrorsList";import{withdefaultLocale}from"./locale";var cnDragNDropField=cn("DragNDropField");export var COMPONENT_NAME="DragNDropField";export var DragNDropField=forwardRef(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.accept,f=d.maxSize,g=d.minSize,h=d.multiple,i=void 0!==h&&h,j=d.onDropFiles,k=d.children,l=void 0===k?DragNDropFieldContent:k,m=d.locale,n=d.disabled,o=d.onClick,p=_objectWithoutProperties(d,_excluded),q=useMutableRef(o),r=withdefaultLocale(m),s=React.useCallback(function(a){return 0<a.length&&j(a)},[j]),t=useDropzone({accept:null!==e&&void 0!==e&&e.length?e:void 0,maxSize:f||void 0,minSize:g||void 0,onDrop:s,multiple:i,disabled:n}),u=t.fileRejections,v=t.getRootProps,w=t.getInputProps,x=t.isDragActive,y=t.rootRef,z=t.open,A=React.useCallback(function(a){var b;a.target!==y.current&&a.stopPropagation(),null===(b=q.current)||void 0===b?void 0:b.call(q,a)},[]),B=v(_objectSpread(_objectSpread({},p),{},{className:cnDragNDropField({active:x,disabled:n},[p.className]),onClick:A})),C=isRenderProp(l)?l({accept:e,maxSize:f,minSize:g,multiple:i,openFileDialog:z,locale:r,disabled:n}):l,D=React.useMemo(function(){return getErrorsList(u,{maxSize:f,minSize:g},r)},[u]);return React.createElement(React.Fragment,null,React.createElement("div",Object.assign({},B,{ref:useForkRef([b,y,c])}),React.createElement("input",w()),x?React.createElement(Text,{view:"secondary",size:"s",align:"center",lineHeight:"m"},"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430"):C),React.createElement(DragNDropFieldTooltip,{anchorRef:y,errors:D}))});export*from"./types";
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["accept","maxSize","minSize","multiple","onDropFiles","children","locale","disabled","onClick"];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"./DragNDropField.css";import React,{forwardRef,useRef}from"react";import{useDropzone}from"react-dropzone";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{Text}from"../Text/Text";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{useMutableRef}from"../../hooks/useMutableRef/useMutableRef";import{cn}from"../../utils/bem";import{isRenderProp}from"../../utils/isRenderProp";import{DragNDropFieldContent}from"./DragNDropFieldContent/DragNDropFieldContent";import{DragNDropFieldTooltip}from"./DragNDropFieldTooltip/DragNDropFieldTooltip";import{formatAccept}from"./formatAccept";import{getErrorsList}from"./getErrorsList";import{withdefaultLocale}from"./locale";var cnDragNDropField=cn("DragNDropField");export var COMPONENT_NAME="DragNDropField";export var DragNDropField=forwardRef(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.accept,f=d.maxSize,g=d.minSize,h=d.multiple,i=void 0!==h&&h,j=d.onDropFiles,k=d.children,l=void 0===k?DragNDropFieldContent:k,m=d.locale,n=d.disabled,o=d.onClick,p=_objectWithoutProperties(d,_excluded),q=useMutableRef(o),r=withdefaultLocale(m),s=React.useCallback(function(a){return 0<a.length&&j(a)},[j]),t=useDropzone({accept:formatAccept(e),maxSize:f||void 0,minSize:g||void 0,onDrop:s,multiple:i,disabled:n}),u=t.fileRejections,v=t.getRootProps,w=t.getInputProps,x=t.isDragActive,y=t.rootRef,z=t.open,A=React.useCallback(function(a){var b;a.target!==y.current&&a.stopPropagation(),null===(b=q.current)||void 0===b?void 0:b.call(q,a)},[]),B=v(_objectSpread(_objectSpread({},p),{},{className:cnDragNDropField({active:x,disabled:n},[p.className]),onClick:A})),C=isRenderProp(l)?l({accept:e,maxSize:f,minSize:g,multiple:i,openFileDialog:z,locale:r,disabled:n}):l,D=React.useMemo(function(){return getErrorsList(u,{maxSize:f,minSize:g},r)},[u]);return React.createElement(React.Fragment,null,React.createElement("div",Object.assign({},B,{ref:useForkRef([b,y,c])}),React.createElement("input",w()),x?React.createElement(Text,{view:"secondary",size:"s",align:"center",lineHeight:"m"},"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430"):C),React.createElement(DragNDropFieldTooltip,{anchorRef:y,errors:D}))});export*from"./types";
2
2
  //# sourceMappingURL=DragNDropField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragNDropField.js","names":["React","forwardRef","useRef","useDropzone","usePropsHandler","Text","useForkRef","useMutableRef","cn","isRenderProp","DragNDropFieldContent","DragNDropFieldTooltip","getErrorsList","withdefaultLocale","cnDragNDropField","COMPONENT_NAME","DragNDropField","props","ref","dragNDropFieldRef","accept","maxSize","minSize","multiple","onDropFiles","children","localeProp","locale","disabled","onClick","otherProps","onClickRef","handleDrop","useCallback","acceptedFiles","length","onDrop","fileRejections","getRootProps","getInputProps","isDragActive","rootRef","open","handleRootClick","e","target","current","stopPropagation","rootProps","className","active","content","openFileDialog","errors","useMemo"],"sources":["../../../../../src/components/DragNDropField/DragNDropField.tsx"],"sourcesContent":["import './DragNDropField.css';\n\nimport React, { forwardRef, useRef } from 'react';\nimport { DropzoneOptions, useDropzone } from 'react-dropzone';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { Text } from '##/components/Text/Text';\nimport { useForkRef } from '##/hooks/useForkRef/useForkRef';\nimport { useMutableRef } from '##/hooks/useMutableRef/useMutableRef';\nimport { cn } from '##/utils/bem';\nimport { isRenderProp } from '##/utils/isRenderProp';\n\nimport { DragNDropFieldContent } from './DragNDropFieldContent/DragNDropFieldContent';\nimport { DragNDropFieldTooltip } from './DragNDropFieldTooltip/DragNDropFieldTooltip';\nimport { getErrorsList } from './getErrorsList';\nimport { withdefaultLocale } from './locale';\nimport { DragNDropFieldProps } from './types';\n\nconst cnDragNDropField = cn('DragNDropField');\n\nexport const COMPONENT_NAME = 'DragNDropField' as const;\n\nexport const DragNDropField = forwardRef<HTMLDivElement, DragNDropFieldProps>(\n (props, ref) => {\n const dragNDropFieldRef = useRef<HTMLDivElement>(null);\n\n const {\n accept,\n maxSize,\n minSize,\n multiple = false,\n onDropFiles,\n children = DragNDropFieldContent,\n locale: localeProp,\n disabled,\n onClick,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, dragNDropFieldRef);\n\n const onClickRef = useMutableRef(onClick);\n\n const locale = withdefaultLocale(localeProp);\n\n const handleDrop: DropzoneOptions['onDrop'] = React.useCallback(\n (acceptedFiles: File[]) =>\n acceptedFiles.length > 0 && onDropFiles(acceptedFiles),\n [onDropFiles],\n );\n\n const {\n fileRejections,\n getRootProps,\n getInputProps,\n isDragActive,\n rootRef,\n open,\n } = useDropzone({\n accept: accept?.length ? accept : undefined,\n maxSize: maxSize || undefined,\n minSize: minSize || undefined,\n onDrop: handleDrop,\n multiple,\n disabled,\n });\n\n const handleRootClick: React.MouseEventHandler<HTMLDivElement> =\n React.useCallback((e) => {\n // Чтобы не открывалось окно выбора файла при клике по внутренним элементам\n if (e.target !== rootRef.current) {\n e.stopPropagation();\n }\n onClickRef.current?.(e);\n }, []);\n\n const rootProps = getRootProps({\n ...otherProps,\n className: cnDragNDropField({ active: isDragActive, disabled }, [\n otherProps.className,\n ]),\n onClick: handleRootClick,\n });\n\n const content = isRenderProp(children)\n ? children({\n accept,\n maxSize,\n minSize,\n multiple,\n openFileDialog: open,\n locale,\n disabled,\n })\n : children;\n\n const errors = React.useMemo(\n () => getErrorsList(fileRejections, { maxSize, minSize }, locale),\n [fileRejections],\n );\n\n return (\n <>\n <div {...rootProps} ref={useForkRef([ref, rootRef, dragNDropFieldRef])}>\n <input {...getInputProps()} />\n {isDragActive ? (\n <Text view=\"secondary\" size=\"s\" align=\"center\" lineHeight=\"m\">\n Перетащите файлы сюда\n </Text>\n ) : (\n content\n )}\n </div>\n <DragNDropFieldTooltip anchorRef={rootRef} errors={errors} />\n </>\n );\n },\n);\n\nexport * from './types';\n"],"mappings":"y2BAAA,6BAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CACA,OAA0BC,WAA1B,KAA6C,gBAA7C,CAEA,OAASC,eAAT,2CACA,OAASC,IAAT,oBACA,OAASC,UAAT,yCACA,OAASC,aAAT,+CACA,OAASC,EAAT,uBACA,OAASC,YAAT,gCAEA,OAASC,qBAAT,qDACA,OAASC,qBAAT,qDACA,OAASC,aAAT,uBACA,OAASC,iBAAT,gBAGA,GAAMC,iBAAgB,CAAGN,EAAE,CAAC,gBAAD,CAA3B,CAEA,MAAO,IAAMO,eAAc,CAAG,gBAAvB,CAEP,MAAO,IAAMC,eAAc,CAAGf,UAAU,CACtC,SAACgB,CAAD,CAAQC,CAAR,CAAgB,IACRC,EAAiB,CAAGjB,MAAM,CAAiB,IAAjB,CADlB,GAcVE,eAAe,CAACW,cAAD,CAAiBE,CAAjB,CAAwBE,CAAxB,CAdL,CAIZC,CAJY,GAIZA,MAJY,CAKZC,CALY,GAKZA,OALY,CAMZC,CANY,GAMZA,OANY,KAOZC,QAPY,CAOZA,CAPY,eAQZC,CARY,GAQZA,WARY,KASZC,QATY,CASZA,CATY,YASDf,qBATC,GAUJgB,CAVI,GAUZC,MAVY,CAWZC,CAXY,GAWZA,QAXY,CAYZ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B,GAnDhB,CA2DRQ,CAAO,CAAG1C,YAAY,CAACgB,CAAD,CAAZ,CACZA,CAAQ,CAAC,CACPL,MAAM,CAANA,CADO,CAEPC,OAAO,CAAPA,CAFO,CAGPC,OAAO,CAAPA,CAHO,CAIPC,QAAQ,CAARA,CAJO,CAKP6B,cAAc,CAAEV,CALT,CAMPf,MAAM,CAANA,CANO,CAOPC,QAAQ,CAARA,CAPO,CAAD,CADI,CAUZH,CArEU,CAuER4B,CAAM,CAAGrD,KAAK,CAACsD,OAAN,CACb,iBAAM1C,cAAa,CAACyB,CAAD,CAAiB,CAAEhB,OAAO,CAAPA,CAAF,CAAWC,OAAO,CAAPA,CAAX,CAAjB,CAAuCK,CAAvC,CAAnB,CADa,CAEb,CAACU,CAAD,CAFa,CAvED,CA4Ed,MACE,yCACE,2CAASW,CAAT,EAAoB,GAAG,CAAE1C,UAAU,CAAC,CAACY,CAAD,CAAMuB,CAAN,CAAetB,CAAf,CAAD,CAAnC,GACE,4BAAWoB,CAAa,EAAxB,CADF,CAEGC,CAAY,CACX,oBAAC,IAAD,EAAM,IAAI,CAAC,WAAX,CAAuB,IAAI,CAAC,GAA5B,CAAgC,KAAK,CAAC,QAAtC,CAA+C,UAAU,CAAC,GAA1D,yHADW,CAKXW,CAPJ,CADF,CAWE,oBAAC,qBAAD,EAAuB,SAAS,CAAEV,CAAlC,CAA2C,MAAM,CAAEY,CAAnD,EAXF,CAcH,CA5FqC,CAAjC,CA+FP"}
1
+ {"version":3,"file":"DragNDropField.js","names":["React","forwardRef","useRef","useDropzone","usePropsHandler","Text","useForkRef","useMutableRef","cn","isRenderProp","DragNDropFieldContent","DragNDropFieldTooltip","formatAccept","getErrorsList","withdefaultLocale","cnDragNDropField","COMPONENT_NAME","DragNDropField","props","ref","dragNDropFieldRef","accept","maxSize","minSize","multiple","onDropFiles","children","localeProp","locale","disabled","onClick","otherProps","onClickRef","handleDrop","useCallback","acceptedFiles","length","onDrop","fileRejections","getRootProps","getInputProps","isDragActive","rootRef","open","handleRootClick","e","target","current","stopPropagation","rootProps","className","active","content","openFileDialog","errors","useMemo"],"sources":["../../../../../src/components/DragNDropField/DragNDropField.tsx"],"sourcesContent":["import './DragNDropField.css';\n\nimport React, { forwardRef, useRef } from 'react';\nimport { DropzoneOptions, useDropzone } from 'react-dropzone';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { Text } from '##/components/Text/Text';\nimport { useForkRef } from '##/hooks/useForkRef/useForkRef';\nimport { useMutableRef } from '##/hooks/useMutableRef/useMutableRef';\nimport { cn } from '##/utils/bem';\nimport { isRenderProp } from '##/utils/isRenderProp';\n\nimport { DragNDropFieldContent } from './DragNDropFieldContent/DragNDropFieldContent';\nimport { DragNDropFieldTooltip } from './DragNDropFieldTooltip/DragNDropFieldTooltip';\nimport { formatAccept } from './formatAccept';\nimport { getErrorsList } from './getErrorsList';\nimport { withdefaultLocale } from './locale';\nimport { DragNDropFieldProps } from './types';\n\nconst cnDragNDropField = cn('DragNDropField');\n\nexport const COMPONENT_NAME = 'DragNDropField' as const;\n\nexport const DragNDropField = forwardRef<HTMLDivElement, DragNDropFieldProps>(\n (props, ref) => {\n const dragNDropFieldRef = useRef<HTMLDivElement>(null);\n\n const {\n accept,\n maxSize,\n minSize,\n multiple = false,\n onDropFiles,\n children = DragNDropFieldContent,\n locale: localeProp,\n disabled,\n onClick,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, dragNDropFieldRef);\n\n const onClickRef = useMutableRef(onClick);\n\n const locale = withdefaultLocale(localeProp);\n\n const handleDrop: DropzoneOptions['onDrop'] = React.useCallback(\n (acceptedFiles: File[]) =>\n acceptedFiles.length > 0 && onDropFiles(acceptedFiles),\n [onDropFiles],\n );\n\n const {\n fileRejections,\n getRootProps,\n getInputProps,\n isDragActive,\n rootRef,\n open,\n } = useDropzone({\n accept: formatAccept(accept),\n maxSize: maxSize || undefined,\n minSize: minSize || undefined,\n onDrop: handleDrop,\n multiple,\n disabled,\n });\n\n const handleRootClick: React.MouseEventHandler<HTMLDivElement> =\n React.useCallback((e) => {\n // Чтобы не открывалось окно выбора файла при клике по внутренним элементам\n if (e.target !== rootRef.current) {\n e.stopPropagation();\n }\n onClickRef.current?.(e);\n }, []);\n\n const rootProps = getRootProps({\n ...otherProps,\n className: cnDragNDropField({ active: isDragActive, disabled }, [\n otherProps.className,\n ]),\n onClick: handleRootClick,\n });\n\n const content = isRenderProp(children)\n ? children({\n accept,\n maxSize,\n minSize,\n multiple,\n openFileDialog: open,\n locale,\n disabled,\n })\n : children;\n\n const errors = React.useMemo(\n () => getErrorsList(fileRejections, { maxSize, minSize }, locale),\n [fileRejections],\n );\n\n return (\n <>\n <div {...rootProps} ref={useForkRef([ref, rootRef, dragNDropFieldRef])}>\n <input {...getInputProps()} />\n {isDragActive ? (\n <Text view=\"secondary\" size=\"s\" align=\"center\" lineHeight=\"m\">\n Перетащите файлы сюда\n </Text>\n ) : (\n content\n )}\n </div>\n <DragNDropFieldTooltip anchorRef={rootRef} errors={errors} />\n </>\n );\n },\n);\n\nexport * from './types';\n"],"mappings":"y2BAAA,6BAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CACA,OAA0BC,WAA1B,KAA6C,gBAA7C,CAEA,OAASC,eAAT,2CACA,OAASC,IAAT,oBACA,OAASC,UAAT,yCACA,OAASC,aAAT,+CACA,OAASC,EAAT,uBACA,OAASC,YAAT,gCAEA,OAASC,qBAAT,qDACA,OAASC,qBAAT,qDACA,OAASC,YAAT,sBACA,OAASC,aAAT,uBACA,OAASC,iBAAT,gBAGA,GAAMC,iBAAgB,CAAGP,EAAE,CAAC,gBAAD,CAA3B,CAEA,MAAO,IAAMQ,eAAc,CAAG,gBAAvB,CAEP,MAAO,IAAMC,eAAc,CAAGhB,UAAU,CACtC,SAACiB,CAAD,CAAQC,CAAR,CAAgB,IACRC,EAAiB,CAAGlB,MAAM,CAAiB,IAAjB,CADlB,GAcVE,eAAe,C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
+ var delSpace=function(a){return a.replace(" ","")};export var formatAccept=function(a){var b=Array.isArray(a)?a.map(delSpace):null===a||void 0===a?void 0:a.split(",").map(delSpace);return null!==b&&void 0!==b&&b.length?{"*":b}:void 0};
2
+ //# sourceMappingURL=formatAccept.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatAccept.js","names":["delSpace","str","replace","formatAccept","accept","formating","Array","isArray","map","split","length"],"sources":["../../../../../src/components/DragNDropField/formatAccept.ts"],"sourcesContent":["const delSpace = (str: string) => str.replace(' ', '');\n\nexport const formatAccept = (accept: string | string[] | undefined) => {\n const formating = Array.isArray(accept)\n ? accept.map(delSpace)\n : accept?.split(',').map(delSpace);\n\n return formating?.length ? { '*': formating } : undefined;\n};\n"],"mappings":"AAAA,GAAMA,SAAQ,CAAG,SAACC,CAAD,QAAiBA,EAAG,CAACC,OAAJ,CAAY,GAAZ,CAAiB,EAAjB,CAAjB,CAAjB,CAEA,MAAO,IAAMC,aAAY,CAAG,SAACC,CAAD,CAA2C,CACrE,GAAMC,EAAS,CAAGC,KAAK,CAACC,OAAN,CAAcH,CAAd,EACdA,CAAM,CAACI,GAAP,CAAWR,QAAX,CADc,QAEdI,CAFc,WAEdA,CAFc,QAEdA,CAAM,CAAEK,KAAR,CAAc,GAAd,EAAmBD,GAAnB,CAAuBR,QAAvB,CAFJ,CAIA,MAAO,QAAAK,CAAS,WAATA,CAAA,EAAAA,CAAS,CAAEK,MAAX,CAAoB,CAAE,IAAKL,CAAP,CAApB,OACR,CANM"}
@@ -0,0 +1 @@
1
+ .canary--DragNDropField{align-items:center;background:var(--color-control-bg-clear);border:1px dashed var(--color-control-bg-border-default);border-radius:var(--control-radius);box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;min-height:160px;padding:var(--space-l);position:relative;width:100%}.canary--DragNDropField:not(.canary--DragNDropField_disabled){cursor:pointer}.canary--DragNDropField:hover{background:var(--color-control-bg-clear-hover);border-color:var(--color-control-bg-border-default-hover)}.canary--DragNDropField_active{background:var(--color-control-bg-clear-hover);border-color:var(--color-control-bg-border-focus)}.canary--DragNDropField_disabled,.canary--DragNDropField_disabled:hover{background:var(--color-control-bg-disable);border-color:transparent}
@@ -0,0 +1,17 @@
1
+ import './DragNDropField.css';
2
+ import React from 'react';
3
+ export declare const DragNDropField: React.ForwardRefExoticComponent<{
4
+ accept?: import("react-dropzone").Accept | undefined;
5
+ maxSize?: number | undefined;
6
+ minSize?: number | undefined;
7
+ maxFiles?: number | undefined;
8
+ multiple?: boolean | undefined;
9
+ disabled?: boolean | undefined;
10
+ children?: React.ReactNode | import("./types").DragNDropFieldChildrenRenderFn;
11
+ locale?: import("./types").DragNDropFieldPropLocale | undefined;
12
+ onDrop?: (<T extends File>(acceptedFiles: T[], fileRejections: import("react-dropzone").FileRejection[], event: import("react-dropzone").DropEvent) => void) | undefined;
13
+ onDropAccepted?: (<T_1 extends File>(files: T_1[]) => void) | undefined;
14
+ onDropRejected?: ((fileRejections: import("react-dropzone").FileRejection[], event: import("react-dropzone").DropEvent) => void) | undefined;
15
+ onError?: ((err: Error) => void) | undefined;
16
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onError" | "onDrop" | "disabled" | "accept" | "multiple" | "css" | "locale" | "maxSize" | "minSize" | "maxFiles" | "onDropAccepted" | "onDropRejected"> & React.RefAttributes<HTMLDivElement>>;
17
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["accept","maxSize","minSize","multiple","maxFiles","children","locale","disabled","onClick","onDrop","onDropAccepted","onDropRejected","onError","className"],_excluded2=["getRootProps","getInputProps","rootRef","open","isDragActive"];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"./DragNDropField.css";import React,{forwardRef,useCallback}from"react";import{useDropzone}from"react-dropzone";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{useMutableRef}from"../../hooks/useMutableRef/useMutableRef";import{cnCanary}from"../../utils/bem";import{withDefaultLocale}from"./locale";import{renderCildren}from"./renderCildren";var cnDragNDropField=cnCanary("DragNDropField");export var DragNDropField=forwardRef(function(a,b){var c=a.accept,d=a.maxSize,e=a.minSize,f=a.multiple,g=void 0!==f&&f,h=a.maxFiles,i=a.children,j=a.locale,k=a.disabled,l=a.onClick,m=a.onDrop,n=a.onDropAccepted,o=a.onDropRejected,p=a.onError,q=a.className,r=_objectWithoutProperties(a,_excluded),s=useMutableRef(l),t=withDefaultLocale(j),u=useDropzone({accept:c,maxSize:d||void 0,minSize:e||void 0,maxFiles:h||void 0,multiple:g,disabled:k,onDrop:m,onDropAccepted:n,onDropRejected:o,onError:p}),v=u.getRootProps,w=u.getInputProps,x=u.rootRef,y=u.open,z=u.isDragActive,A=_objectWithoutProperties(u,_excluded2);return React.createElement("div",v(_objectSpread(_objectSpread({},r),{},{className:cnDragNDropField({active:z,disabled:k},[q]),onClick:useCallback(function(a){var b;a.target!==x.current&&a.stopPropagation(),null===(b=s.current)||void 0===b?void 0:b.call(s,a)},[]),ref:useForkRef([b,x])})),React.createElement("input",w()),renderCildren(i,_objectSpread(_objectSpread({},A),{},{accept:c,maxSize:d,minSize:e,multiple:g,openFileDialog:y,locale:t,disabled:k,isDragActive:z})))});export*from"./types";
2
+ //# sourceMappingURL=DragNDropFieldCanary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragNDropFieldCanary.js","names":["React","forwardRef","useCallback","useDropzone","useForkRef","useMutableRef","cnCanary","withDefaultLocale","renderCildren","cnDragNDropField","DragNDropField","props","ref","accept","maxSize","minSize","multiple","maxFiles","children","localeProp","locale","disabled","onClick","onDrop","onDropAccepted","onDropRejected","onError","className","otherProps","onClickRef","getRootProps","getInputProps","rootRef","openFileDialog","open","isDragActive","otherStateProps","active","e","target","current","stopPropagation"],"sources":["../../../../../src/components/DragNDropFieldCanary/DragNDropFieldCanary.tsx"],"sourcesContent":["import './DragNDropField.css';\n\nimport React, { forwardRef, useCallback } from 'react';\nimport { useDropzone } from 'react-dropzone';\n\nimport { useForkRef } from '##/hooks/useForkRef/useForkRef';\nimport { useMutableRef } from '##/hooks/useMutableRef/useMutableRef';\nimport { cnCanary } from '##/utils/bem';\n\nimport { withDefaultLocale } from './locale';\nimport { renderCildren } from './renderCildren';\nimport { DragNDropFieldProps } from './types';\n\nconst cnDragNDropField = cnCanary('DragNDropField');\n\nexport const DragNDropField = forwardRef<HTMLDivElement, DragNDropFieldProps>(\n (props, ref) => {\n const {\n accept,\n maxSize,\n minSize,\n multiple = false,\n maxFiles,\n children,\n locale: localeProp,\n disabled,\n onClick,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n className,\n ...otherProps\n } = props;\n\n const onClickRef = useMutableRef(onClick);\n\n const locale = withDefaultLocale(localeProp);\n\n const {\n getRootProps,\n getInputProps,\n rootRef,\n open: openFileDialog,\n isDragActive,\n ...otherStateProps\n } = useDropzone({\n accept,\n maxSize: maxSize || undefined,\n minSize: minSize || undefined,\n maxFiles: maxFiles || undefined,\n multiple,\n disabled,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n });\n\n return (\n <div\n {...getRootProps({\n ...otherProps,\n className: cnDragNDropField({ active: isDragActive, disabled }, [\n className,\n ]),\n onClick: useCallback<React.MouseEventHandler<HTMLDivElement>>((e) => {\n if (e.target !== rootRef.current) {\n e.stopPropagation();\n }\n onClickRef.current?.(e);\n }, []),\n ref: useForkRef([ref, rootRef]),\n })}\n >\n <input {...getInputProps()} />\n {renderCildren(children, {\n ...otherStateProps,\n accept,\n maxSize,\n minSize,\n multiple,\n openFileDialog,\n locale,\n disabled,\n isDragActive,\n })}\n </div>\n );\n },\n);\n\nexport * from './types';\n"],"mappings":"m/BAAA,6BAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,WAA5B,KAA+C,OAA/C,CACA,OAASC,WAAT,KAA4B,gBAA5B,CAEA,OAASC,UAAT,yCACA,OAASC,aAAT,+CACA,OAASC,QAAT,uBAEA,OAASC,iBAAT,gBACA,OAASC,aAAT,uBAGA,GAAMC,iBAAgB,CAAGH,QAAQ,CAAC,gBAAD,CAAjC,CAEA,MAAO,IAAMI,eAAc,CAAGT,UAAU,CACtC,SAACU,CAAD,CAAQC,CAAR,CAAgB,IAEZC,EAFY,CAiBVF,CAjBU,CAEZE,MAFY,CAGZC,CAHY,CAiBVH,CAjBU,CAGZG,OAHY,CAIZC,CAJY,CAiBVJ,CAjBU,CAIZI,OAJY,GAiBVJ,CAjBU,CAKZK,QALY,CAKZA,CALY,eAMZC,CANY,CAiBVN,CAjBU,CAMZM,QANY,CAOZC,CAPY,CAiBVP,CAjBU,CAOZO,QAPY,CAQJC,CARI,CAiBVR,CAjBU,CAQZS,MARY,CASZC,CATY,CAiBVV,CAjBU,CASZU,QATY,CAUZC,CAVY,CAiBVX,CAjBU,CAUZW,OAVY,CAWZC,CAXY,CAiBVZ,CAjBU,CAWZY,MAXY,CAYZC,CAZY,CAiBVb,CAjBU,CAYZa,cAZY,CAaZC,CAbY,CAiBVd,CAjBU,CAaZc,cAbY,CAcZC,CAdY,CAiBVf,CAjBU,CAcZe,OAdY,CAeZC,CAfY,CAiBVhB,CAjBU,CAeZgB,SAfY,CAgBTC,CAhBS,0BAiBVjB,CAjBU,YAmBRkB,CAAU,CAAGxB,aAAa,CAACiB,CAAD,CAnBlB,CAqBRF,CAAM,CAAGb,iBAAiB,CAACY,CAA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ASZc,YAAY,CAAZA,CATY,GAhBhB,CA6BH,CA1EqC,CAAjC,CA6EP"}
@@ -0,0 +1 @@
1
+ .canary--DragNDropFieldContent-Button{margin-top:var(--space-s)}.canary--DragNDropFieldContent-Text_disabled.Text_view_secondary{color:var(--color-control-typo-disable)}
@@ -0,0 +1,4 @@
1
+ import './DragNDropFieldContent.css';
2
+ import React from 'react';
3
+ import { DragNDropFieldContentProps } from '../DragNDropFieldCanary';
4
+ export declare const DragNDropFieldContent: React.FC<DragNDropFieldContentProps>;
@@ -0,0 +1,2 @@
1
+ import"./DragNDropFieldContent.css";import{IconAttach}from"@consta/icons/IconAttach";import React from"react";import{Button}from"../../Button";import{Text}from"../../Text";import{cnCanary}from"../../../utils/bem";import{getText}from"../locale";import{formatFileRequirements}from"./formatFileRequirements";var cnDragNDropFieldContent=cnCanary("DragNDropFieldContent");export var DragNDropFieldContent=function(a){var b=a.accept,c=a.maxSize,d=a.minSize,e=a.multiple,f=a.openFileDialog,g=a.locale,h=a.disabled,i=a.isDragActive,j=formatFileRequirements(b,c,d,g),k=e?g.files:g.file;return i?React.createElement(Text,{view:"secondary",size:"s",align:"center",lineHeight:"m"},getText(g["drag-active-message"])):React.createElement(React.Fragment,null,React.createElement(Text,{className:cnDragNDropFieldContent("Text",{disabled:h}),view:"secondary",size:"s",lineHeight:"s",align:"center"},getText(g["call-to-action"],{fileText:k}),j&&React.createElement(React.Fragment,null,React.createElement("br",null),j)),React.createElement(Button,{className:cnDragNDropFieldContent("Button"),label:getText(g["action-button"],{fileText:k}),iconLeft:IconAttach,view:"ghost",size:"s",onClick:f,disabled:h}))};
2
+ //# sourceMappingURL=DragNDropFieldContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragNDropFieldContent.js","names":["IconAttach","React","Button","Text","cnCanary","getText","formatFileRequirements","cnDragNDropFieldContent","DragNDropFieldContent","accept","maxSize","minSize","multiple","openFileDialog","locale","disabled","isDragActive","requirements","fileText","files","file"],"sources":["../../../../../../src/components/DragNDropFieldCanary/DragNDropFieldContent/DragNDropFieldContent.tsx"],"sourcesContent":["import './DragNDropFieldContent.css';\n\nimport { IconAttach } from '@consta/icons/IconAttach';\nimport React from 'react';\n\nimport { Button } from '##/components/Button';\nimport { Text } from '##/components/Text';\nimport { cnCanary } from '##/utils/bem';\n\nimport { DragNDropFieldContentProps } from '../DragNDropFieldCanary';\nimport { getText } from '../locale';\nimport { formatFileRequirements } from './formatFileRequirements';\n\nconst cnDragNDropFieldContent = cnCanary('DragNDropFieldContent');\n\nexport const DragNDropFieldContent: React.FC<DragNDropFieldContentProps> = ({\n accept,\n maxSize,\n minSize,\n multiple,\n openFileDialog,\n locale,\n disabled,\n isDragActive,\n}) => {\n const requirements = formatFileRequirements(accept, maxSize, minSize, locale);\n const fileText = multiple ? locale.files : locale.file;\n\n return isDragActive ? (\n <Text view=\"secondary\" size=\"s\" align=\"center\" lineHeight=\"m\">\n {getText(locale['drag-active-message'])}\n </Text>\n ) : (\n <>\n <Text\n className={cnDragNDropFieldContent('Text', { disabled })}\n view=\"secondary\"\n size=\"s\"\n lineHeight=\"s\"\n align=\"center\"\n >\n {getText(locale['call-to-action'], { fileText })}\n {requirements && (\n <>\n <br />\n {requirements}\n </>\n )}\n </Text>\n <Button\n className={cnDragNDropFieldContent('Button')}\n label={getText(locale['action-button'], { fileText })}\n iconLeft={IconAttach}\n view=\"ghost\"\n size=\"s\"\n onClick={openFileDialog}\n disabled={disabled}\n />\n </>\n );\n};\n"],"mappings":"AAAA,oCAEA,OAASA,UAAT,KAA2B,0BAA3B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,MAAT,oBACA,OAASC,IAAT,kBACA,OAASC,QAAT,0BAGA,OAASC,OAAT,iBACA,OAASC,sBAAT,gCAEA,GAAMC,wBAAuB,CAAGH,QAAQ,CAAC,uBAAD,CAAxC,CAEA,MAAO,IAAMI,sBAA2D,CAAG,WASrE,IARJC,EAQI,GARJA,MAQI,CAPJC,CAOI,GAPJ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Locale, DragNDropFieldProps } from '../DragNDropFieldCanary';
2
+ export declare const formatFileRequirements: (accept: DragNDropFieldProps['accept'], maxSize: DragNDropFieldProps['maxSize'], minSize: DragNDropFieldProps['minSize'], locale?: Required<DragNDropFieldPropLocale>) => string;
@@ -0,0 +1,2 @@
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{isNotNil}from"../../../utils/type-guards";import{formatFileSize}from"../formatFileSize";import{defaultLocale}from"../locale";var formatAccept=function(a){return a&&Object.entries(a).map(function(a){var b=_slicedToArray(a,2),c=b[0],d=b[1];return 0<d.length?d.join(", "):c}).join(", ")},formatSize=function(a,b,c){return b?"".concat(a," ").concat(formatFileSize(b,c)):void 0};export var formatFileRequirements=function(a,b,c){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:defaultLocale;return[d["fit-files"],formatAccept(a),formatSize(d.from,c,d),formatSize(d.before,b,d)].filter(isNotNil).join(" ")};
2
+ //# sourceMappingURL=formatFileRequirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatFileRequirements.js","names":["isNotNil","formatFileSize","defaultLocale","formatAccept","accept","Object","entries","map","key","values","length","join","formatSize","prefix","size","locale","formatFileRequirements","maxSize","minSize","from","before","filter"],"sources":["../../../../../../src/components/DragNDropFieldCanary/DragNDropFieldContent/formatFileRequirements.ts"],"sourcesContent":["import { Accept } from 'react-dropzone';\n\nimport { isNotNil } from '../../../utils/type-guards';\nimport {\n DragNDropFieldPropLocale,\n DragNDropFieldProps,\n} from '../DragNDropFieldCanary';\nimport { formatFileSize } from '../formatFileSize';\nimport { defaultLocale } from '../locale';\n\nconst formatAccept = (accept: Accept | undefined): string | undefined => {\n return (\n accept &&\n Object.entries(accept)\n .map(([key, values]) => {\n return values.length > 0 ? values.join(', ') : key;\n })\n .join(', ')\n );\n};\n\nconst formatSize = (\n prefix: string,\n size: number | undefined,\n locale: Required<DragNDropFieldPropLocale>,\n) => (size ? `${prefix} ${formatFileSize(size, locale)}` : undefined);\n\nexport const formatFileRequirements = (\n accept: DragNDropFieldProps['accept'],\n maxSize: DragNDropFieldProps['maxSize'],\n minSize: DragNDropFieldProps['minSize'],\n locale: Required<DragNDropFieldPropLocale> = defaultLocale,\n): string => {\n return [\n locale['fit-files'],\n formatAccept(accept),\n formatSize(locale.from, minSize, locale),\n formatSize(locale.before, maxSize, locale),\n ]\n .filter(isNotNil)\n .join(' ');\n};\n"],"mappings":"iEAEA,OAASA,QAAT,kCAKA,OAASC,cAAT,yBACA,OAASC,aAAT,iB,GAEMC,aAAY,CAAG,SAACC,CAAD,CAAoD,CACvE,MACEA,EAAM,EACNC,MAAM,CAACC,OAAP,CAAeF,CAAf,EACGG,GADH,CACO,WAAmB,2BAAjBC,CAAiB,MAAZC,CAAY,MACtB,MAAuB,EAAhB,CAAAA,CAAM,CAACC,MAAP,CAAoBD,CAAM,CAACE,IAAP,CAAY,IAAZ,CAApB,CAAwCH,CAChD,CAHH,EAIGG,IAJH,CAIQ,IAJR,CAMH,C,CAEKC,UAAU,CAAG,SACjBC,CADiB,CAEjBC,CAFiB,CAGjBC,CAHiB,QAIbD,EAAI,WAAMD,CAAN,aAAgBZ,cAAc,CAACa,CAAD,CAAOC,CAAP,CAA9B,QAJS,C,CAMnB,MAAO,IAAMC,uBAAsB,CAAG,SACpCZ,CADoC,CAEpCa,CAFoC,CAGpCC,CAHoC,CAKzB,IADXH,EACW,wDADkCb,aAClC,CACX,MAAO,CACLa,CAAM,CAAC,WAAD,CADD,CAELZ,YAAY,CAACC,CAAD,CAFP,CAGLQ,UAAU,CAACG,CAAM,CAACI,IAAR,CAAcD,CAAd,CAAuBH,CAAvB,CAHL,CAILH,UAAU,CAACG,CAAM,CAACK,MAAR,CAAgBH,CAAhB,CAAyBF,CAAzB,CAJL,EAMJM,MANI,CAMGrB,QANH,EAOJW,IAPI,CAOC,GAPD,CAQR,CAdM"}
@@ -0,0 +1 @@
1
+ export * from './DragNDropFieldContent';
@@ -0,0 +1,2 @@
1
+ export*from"./DragNDropFieldContent";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/DragNDropFieldCanary/DragNDropFieldContent/index.ts"],"sourcesContent":["export * from './DragNDropFieldContent';\n"],"mappings":"AAAA"}
@@ -0,0 +1 @@
1
+ .canary--DragNDropFieldInformer{align-items:center;background-color:var(--informer-status-bg-color);border:var(--control-border-width) solid var(--informer-status-border-color);border-radius:var(--control-radius);color:var(--color-typo-primary);display:flex;flex-direction:row;margin-top:var(--space-xs);padding:var(--space-xs) var(--space-xs) var(--space-xs) var(--space-s);position:relative;width:100%}.canary--DragNDropFieldInformer_status_default{--informer-status-border-color:var(--color-bg-border);--informer-status-bg-color:var(--color-control-bg-default)}.canary--DragNDropFieldInformer_status_alert{--informer-status-border-color:var(--color-bg-alert);--informer-status-bg-color:rgba(235,87,87,.05)}.canary--DragNDropFieldInformer_status_warning{--informer-status-border-color:var(--color-bg-alert);--informer-status-bg-color:rgba(243,139,0,.05)}.canary--DragNDropFieldInformer-Text{align-content:center;min-height:var(--space-xl);width:100%}.canary--DragNDropFieldInformer-Progress{color:var(--informer-status-border-color);margin-right:var(--space-xs)}.canary--DragNDropFieldInformer-Button{margin-left:var(--space-xs)}.canary--DragNDropFieldInformer-Icon{margin-right:var(--space-xs)}
@@ -0,0 +1,4 @@
1
+ import './DragNDropFieldInformer.css';
2
+ import React from 'react';
3
+ import { DragNDropFieldInformerProps } from '../types';
4
+ export declare const DragNDropFieldInformer: React.ForwardRefExoticComponent<DragNDropFieldInformerProps & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | keyof DragNDropFieldInformerProps> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["status","loading","icon","text","withButton","buttonIcon","buttonLabel","onButtonClick","className"];import"./DragNDropFieldInformer.css";import React from"react";import{Button}from"../../Button";import{ProgressSpin}from"../../ProgressSpin";import{Text}from"../../Text";import{cnCanary}from"../../../utils/bem";import{dragNDropFieldInformerPropStatus}from"../types";var textViewMap={default:"ghost",alert:"alert",warning:"warning"},iconStatusMap={default:"ghost",alert:"alert",warning:"warning"},cnDragNDropFieldInformer=cnCanary("DragNDropFieldInformer"),propStatusDefault=dragNDropFieldInformerPropStatus[0];export var DragNDropFieldInformer=React.forwardRef(function(a,b){var c=a.status,d=void 0===c?propStatusDefault:c,e=a.loading,f=void 0!==e&&e,g=a.icon,h=a.text,i=void 0===h?"":h,j=a.withButton,k=a.buttonIcon,l=a.buttonLabel,m=a.onButtonClick,n=a.className,o=_objectWithoutProperties(a,_excluded),p=g;return React.createElement("div",Object.assign({},o,{className:cnDragNDropFieldInformer({status:d},[n]),ref:b}),f&&React.createElement(ProgressSpin,{value:"number"==typeof f?f:void 0,animation:!0,size:"m",className:cnDragNDropFieldInformer("Progress")}),!f&&p&&React.createElement(p,{view:iconStatusMap[d],size:"s",className:cnDragNDropFieldInformer("Icon")}),i?React.createElement(Text,{align:"left",lineHeight:"xs",size:"xs",className:cnDragNDropFieldInformer("Text"),view:textViewMap[d]},i):" ",void 0!==j&&j&&React.createElement(Button,{onlyIcon:!0,iconLeft:k,onClick:m,view:"ghost",size:"xs",title:l,className:cnDragNDropFieldInformer("Button")}))});
2
+ //# sourceMappingURL=DragNDropFieldInformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragNDropFieldInformer.js","names":["React","Button","ProgressSpin","Text","cnCanary","dragNDropFieldInformerPropStatus","textViewMap","alert","warning","iconStatusMap","cnDragNDropFieldInformer","propStatusDefault","DragNDropFieldInformer","forwardRef","props","ref","status","loading","icon","text","withButton","buttonIcon","buttonLabel","onButtonClick","className","otherProps","Icon"],"sources":["../../../../../../src/components/DragNDropFieldCanary/DragNDropFieldInformer/DragNDropFieldInformer.tsx"],"sourcesContent":["import './DragNDropFieldInformer.css';\n\nimport { IconPropView } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { Button } from '##/components/Button';\nimport { ProgressSpin } from '##/components/ProgressSpin';\nimport { Text, TextPropView } from '##/components/Text';\nimport { cnCanary } from '##/utils/bem';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport {\n DragNDropFieldInformerProps,\n DragNDropFieldInformerPropStatus,\n dragNDropFieldInformerPropStatus,\n} from '../types';\n\nconst textViewMap: Record<DragNDropFieldInformerPropStatus, TextPropView> = {\n default: 'ghost',\n alert: 'alert',\n warning: 'warning',\n};\n\nconst iconStatusMap: Record<DragNDropFieldInformerPropStatus, IconPropView> = {\n default: 'ghost',\n alert: 'alert',\n warning: 'warning',\n};\n\ntype InformerProps = PropsWithHTMLAttributes<\n DragNDropFieldInformerProps,\n HTMLDivElement\n>;\n\nconst cnDragNDropFieldInformer = cnCanary('DragNDropFieldInformer');\n\nconst propStatusDefault: DragNDropFieldInformerPropStatus =\n dragNDropFieldInformerPropStatus[0];\n\nexport const DragNDropFieldInformer = React.forwardRef<\n HTMLDivElement,\n InformerProps\n>((props, ref) => {\n const {\n status = propStatusDefault,\n loading = false,\n icon,\n text = '',\n withButton = false,\n buttonIcon,\n buttonLabel,\n onButtonClick,\n className,\n ...otherProps\n } = props;\n const Icon = icon;\n return (\n <div\n {...otherProps}\n className={cnDragNDropFieldInformer(\n {\n status,\n },\n [className],\n )}\n ref={ref}\n >\n {loading && (\n <ProgressSpin\n value={typeof loading === 'number' ? loading : undefined}\n animation\n size=\"m\"\n className={cnDragNDropFieldInformer('Progress')}\n />\n )}\n {!loading && Icon && (\n <Icon\n view={iconStatusMap[status]}\n size=\"s\"\n className={cnDragNDropFieldInformer('Icon')}\n />\n )}\n {text ? (\n <Text\n align=\"left\"\n lineHeight=\"xs\"\n size=\"xs\"\n className={cnDragNDropFieldInformer('Text')}\n view={textViewMap[status]}\n >\n {text}\n </Text>\n ) : (\n ' '\n )}\n {withButton && (\n <Button\n onlyIcon\n iconLeft={buttonIcon}\n onClick={onButtonCl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QAAnB,QAAOA,EAAP,CAA8BA,CAA9B,OADT,CAEE,SAAS,GAFX,CAGE,IAAI,CAAC,GAHP,CAIE,SAAS,CAAEP,wBAAwB,CAAC,UAAD,CAJrC,EAXJ,CAkBG,CAACO,CAAD,EAAYS,CAAZ,EACC,oBAAC,CAAD,EACE,IAAI,CAAEjB,aAAa,CAACO,CAAD,CADrB,CAEE,IAAI,CAAC,GAFP,CAGE,SAAS,CAAEN,wBAAwB,CAAC,MAAD,CAHrC,EAnBJ,CAyBGS,CAAI,CACH,oBAAC,IAAD,EACE,KAAK,CAAC,MADR,CAEE,UAAU,CAAC,IAFb,CAGE,IAAI,CAAC,IAHP,CAIE,SAAS,CAAET,wBAAwB,CAAC,MAAD,CAJrC,CAKE,IAAI,CAAEJ,WAAW,CAACU,CAAD,CALnB,EAOGG,CAPH,CADG,CAWH,GApCJ,CAsCG,eACC,oBAAC,MAAD,EACE,QAAQ,GADV,CAEE,QAAQ,CAAEE,CAFZ,CAGE,OAAO,CAAEE,CAHX,CAIE,IAAI,CAAC,OAJP,CAKE,IAAI,CAAC,IALP,CAME,KAAK,CAAED,CANT,CAOE,SAAS,CAAEZ,wBAAwB,CAAC,QAAD,CAPrC,EAvCJ,CAmDH,CArEqC,CAA/B"}
@@ -0,0 +1 @@
1
+ export * from './DragNDropFieldInformer';
@@ -0,0 +1,2 @@
1
+ export*from"./DragNDropFieldInformer";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/DragNDropFieldCanary/DragNDropFieldInformer/index.ts"],"sourcesContent":["export * from './DragNDropFieldInformer';\n"],"mappings":"AAAA"}
@@ -0,0 +1,2 @@
1
+ import { DragNDropFieldPropLocale } from './types';
2
+ export declare const formatFileSize: (sizeInBytes: number, locale: Required<DragNDropFieldPropLocale>) => string | undefined;
@@ -0,0 +1,2 @@
1
+ function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}var getUnits=function(a){return[{value:1073741824,name:a.gigabyte},{value:1048576,name:a.megabyte},{value:1024,name:a.kilobyte},{value:1,name:a.byte}]},floorToDecimals=function(a,b){return Math.floor(Math.pow(10,b)*a)/Math.pow(10,b)};export var formatFileSize=function(a,b){var c,d=getUnits(b),e=_createForOfIteratorHelper(d);try{for(e.s();!(c=e.n()).done;){var f=c.value;if(a>=f.value)return"".concat(floorToDecimals(a/f.value,1)," ").concat(f.name)}}catch(a){e.e(a)}finally{e.f()}};
2
+ //# sourceMappingURL=formatFileSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatFileSize.js","names":["getUnits","locale","value","name","gigabyte","megabyte","kilobyte","floorToDecimals","num","decimals","Math","floor","formatFileSize","sizeInBytes","units","step"],"sources":["../../../../../src/components/DragNDropFieldCanary/formatFileSize.ts"],"sourcesContent":["import { DragNDropFieldPropLocale } from './types';\n\nconst getUnits = (locale: Required<DragNDropFieldPropLocale>) => {\n return [\n { value: 1024 * 1024 * 1024, name: locale.gigabyte },\n { value: 1024 * 1024, name: locale.megabyte },\n { value: 1024, name: locale.kilobyte },\n { value: 1, name: locale.byte },\n ];\n};\n\nconst floorToDecimals = (num: number, decimals: number): number =>\n Math.floor(10 ** decimals * num) / 10 ** decimals;\n\nexport const formatFileSize = (\n sizeInBytes: number,\n locale: Required<DragNDropFieldPropLocale>,\n): string | undefined => {\n const units = getUnits(locale);\n for (const step of units) {\n if (sizeInBytes >= step.value) {\n return `${floorToDecimals(sizeInBytes / step.value, 1)} ${step.name}`;\n }\n }\n return undefined;\n};\n"],"mappings":"wpCAEMA,SAAQ,CAAG,SAACC,CAAD,CAAgD,CAC/D,MAAO,CACL,CAAEC,KAAK,WAAP,CAA6BC,IAAI,CAAEF,CAAM,CAACG,QAA1C,CADK,CAEL,CAAEF,KAAK,QAAP,CAAsBC,IAAI,CAAEF,CAAM,CAACI,QAAnC,CAFK,CAGL,CAAEH,KAAK,CAAE,IAAT,CAAeC,IAAI,CAAEF,CAAM,CAACK,QAA5B,CAHK,CAIL,CAAEJ,KAAK,CAAE,CAAT,CAAYC,IAAI,CAAEF,CAAM,KAAxB,CAJK,CAMR,C,CAEKM,eAAe,CAAG,SAACC,CAAD,CAAcC,CAAd,QACtBC,KAAI,CAACC,KAAL,CAAW,YAAMF,CAAN,EAAiBD,CAA5B,WAAmC,EAAnC,CAAyCC,CAAzC,CADsB,C,CAGxB,MAAO,IAAMG,eAAc,CAAG,SAC5BC,CAD4B,CAE5BZ,CAF4B,CAGL,OACjBa,CAAK,CAAGd,QAAQ,CAACC,CAAD,CADC,8BAEJa,CAFI,MAEvB,2BAA0B,IAAfC,EAAe,SACxB,GAAIF,CAAW,EAAIE,CAAI,CAACb,KAAxB,CACE,gBAAUK,eAAe,CAACM,CAAW,CAAGE,CAAI,CAACb,KAApB,CAA2B,CAA3B,CAAzB,aAA0Da,CAAI,CAACZ,IAA/D,CAEH,CANsB,+BAQxB,CAXM"}
@@ -0,0 +1,3 @@
1
+ import { FileRejection } from 'react-dropzone';
2
+ import { DragNDropFieldPropLocale, FileSizes } from './types';
3
+ export declare const getErrorsList: (fileRejections: FileRejection[], locale?: DragNDropFieldPropLocale, sizes?: FileSizes) => string[];
@@ -0,0 +1,2 @@
1
+ function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}import{ErrorCode}from"react-dropzone";import{isNotNil,isString}from"../../utils/type-guards";import{withDefaultLocale}from"./locale";var NO_MESSAGE="no-message",getErrorMessage=function(a,b,c,d){var e=a.code,f=Object.values(ErrorCode).includes(e)?c[e]:c["general-error"];return isNotNil(f)?b?isString(f)?f:f({file:b,sizes:d}):isString(f)?f:NO_MESSAGE:b?"".concat(b.name,": ").concat(c["general-error"]):NO_MESSAGE};export var getErrorsList=function(a,b,c){var d,e=[],f=0,g=withDefaultLocale(b),h=_createForOfIteratorHelper(a);try{for(h.s();!(d=h.n()).done;){var i,j=d.value,k=_createForOfIteratorHelper(j.errors);try{for(k.s();!(i=k.n()).done;){var l=i.value;"too-many-files"===l.code?f++:e.push(getErrorMessage(l,j.file,g,c))}}catch(a){k.e(a)}finally{k.f()}}}catch(a){h.e(a)}finally{h.f()}if(f&&e.unshift(getErrorMessage({code:"too-many-files",message:""},void 0,g,c)),isNotNil(e.find(function(a){return a===NO_MESSAGE}))){var m=e.filter(function(a){return a!==NO_MESSAGE});return m.unshift(g["general-error"]),m}return e};
2
+ //# sourceMappingURL=getErrorsList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getErrorsList.js","names":["ErrorCode","isNotNil","isString","withDefaultLocale","NO_MESSAGE","getErrorMessage","error","file","locale","sizes","code","message","Object","values","includes","name","getErrorsList","fileRejections","errorsList","tooManyFilesErrorsCount","localeWithDefault","rejection","errors","push","unshift","find","text","list","filter"],"sources":["../../../../../src/components/DragNDropFieldCanary/getErrorsList.ts"],"sourcesContent":["import { ErrorCode, FileError, FileRejection } from 'react-dropzone';\n\nimport { isNotNil, isString } from '##/utils/type-guards';\n\nimport { withDefaultLocale } from './locale';\nimport { DragNDropFieldPropLocale, FileSizes } from './types';\n\nconst NO_MESSAGE = 'no-message';\n\nconst getErrorMessage = (\n error: FileRejection['errors'][number],\n file: File | undefined,\n locale: DragNDropFieldPropLocale,\n sizes?: FileSizes,\n): string => {\n const { code } = error as FileError;\n\n const message = (Object.values(ErrorCode) as string[]).includes(code)\n ? locale[code as ErrorCode]\n : locale['general-error'];\n\n if (!isNotNil(message)) {\n return file ? `${file.name}: ${locale['general-error']}` : NO_MESSAGE;\n }\n\n if (file) {\n return isString(message) ? message : message({ file, sizes });\n }\n\n return isString(message) ? message : NO_MESSAGE;\n};\n\nexport const getErrorsList = (\n fileRejections: FileRejection[],\n locale?: DragNDropFieldPropLocale,\n sizes?: FileSizes,\n): string[] => {\n const errorsList: string[] = [];\n let tooManyFilesErrorsCount = 0;\n\n const localeWithDefault = withDefaultLocale(locale);\n\n for (const rejection of fileRejections) {\n for (const error of rejection.errors) {\n if (error.code === 'too-many-files') {\n tooManyFilesErrorsCount++;\n } else {\n errorsList.push(\n getErrorMessage(error, rejection.file, localeWithDefault, sizes),\n );\n }\n }\n }\n\n if (tooManyFilesErrorsCount) {\n errorsList.unshift(\n getErrorMessage(\n { code: 'too-many-files', message: '' },\n undefined,\n localeWithDefault,\n sizes,\n ),\n );\n }\n if (isNotNil(errorsList.find((text) => text === NO_MESSAGE))) {\n const list = errorsList.filter((text) => text !== NO_MESSAGE);\n\n list.unshift(localeWithDefault['general-error']);\n return list;\n }\n\n return errorsList;\n};\n"],"mappings":"qpCAAA,OAASA,SAAT,KAAoD,gBAApD,CAEA,OAASC,QAAT,CAAmBC,QAAnB,+BAEA,OAASC,iBAAT,gB,GAGMC,WAAU,CAAG,Y,CAEbC,eAAe,CAAG,SACtBC,CADsB,CAEtBC,CAFsB,CAGtBC,CAHsB,CAItBC,CAJsB,CAKX,IACHC,EADG,CACMJ,CADN,CACHI,IADG,CAGLC,CAAO,CAAIC,MAAM,CAACC,MAAP,CAAcb,SAAd,CAAD,CAAuCc,QAAvC,CAAgDJ,CAAhD,EACZF,CAAM,CAACE,CAAD,CADM,CAEZF,CAAM,CAAC,eAAD,CALC,OAONP,SAAQ,CAACU,CAAD,CAPF,CAWPJ,CAXO,CAYFL,QAAQ,CAACS,CAAD,CAAR,CAAoBA,CAApB,CAA8BA,CAAO,CAAC,CAAEJ,IAAI,CAAJA,CAAF,CAAQE,KAAK,CAALA,CAAR,CAAD,CAZnC,CAeJP,QAAQ,CAACS,CAAD,CAAR,CAAoBA,CAApB,CAA8BP,UAf1B,CAQFG,CAAI,WAAMA,CAAI,CAACQ,IAAX,cAAoBP,CAAM,CAAC,eAAD,CAA1B,EAAgDJ,UAQ9D,C,CAED,MAAO,IAAMY,cAAa,CAAG,SAC3BC,CAD2B,CAE3BT,CAF2B,CAG3BC,CAH2B,CAId,OACPS,CAAoB,CAAG,EADhB,CAETC,CAAuB,CAAG,CAFjB,CAIPC,CAAiB,CAAGjB,iBAAiB,CAACK,CAAD,CAJ9B,8BAMWS,CANX,MAMb,2BAAwC,OAA7BI,CAA6B,sCAClBA,CAAS,CAACC,MADQ,MACtC,2BAAsC,IAA3BhB,EAA2B,SACjB,gBAAf,GAAAA,CAAK,CAACI,IAD0B,CAElCS,CAAuB,EAFW,CAIlCD,CAAU,CAACK,IAAX,CACElB,eAAe,CAACC,CAAD,CAAQe,CAAS,CAACd,IAAlB,CAAwBa,CAAxB,CAA2CX,CAA3C,CADjB,CAIH,CATqC,+BAUvC,CAhBY,+BA4Bb,GAVIU,CAUJ,EATED,CAAU,CAACM,OAAX,CACEnB,eAAe,CACb,CAAEK,IAAI,CAAE,gBAAR,CAA0BC,OAAO,CAAE,EAAnC,CADa,QAGbS,CAHa,CAIbX,CAJa,CADjB,CASF,CAAIR,QAAQ,CAACiB,CAAU,CAACO,IAAX,CAAgB,SAACC,CAAD,QAAUA,EAAI,GAAKtB,UAAnB,CAAhB,CAAD,CAAZ,CAA8D,CAC5D,GAAMuB,EAAI,CAAGT,CAAU,CAACU,MAAX,CAAkB,SAACF,CAAD,QAAUA,EAAI,GAAKtB,UAAnB,CAAlB,CAAb,CAGA,MADAuB,EAAI,CAACH,OAAL,CAAaJ,CAAiB,CAAC,eAAD,CAA9B,CACA,CAAOO,CACR,CAED,MAAOT,EACR,CAxCM"}
@@ -0,0 +1,3 @@
1
+ export * from './DragNDropFieldCanary';
2
+ export * from './DragNDropFieldInformer';
3
+ export * from './getErrorsList';
@@ -0,0 +1,2 @@
1
+ export*from"./DragNDropFieldCanary";export*from"./DragNDropFieldInformer";export*from"./getErrorsList";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/DragNDropFieldCanary/index.ts"],"sourcesContent":["export * from './DragNDropFieldCanary';\nexport * from './DragNDropFieldInformer';\nexport * from './getErrorsList';\n"],"mappings":"AAAA,oCACA,sCACA"}
@@ -0,0 +1,4 @@
1
+ import { DragNDropFieldPropLocale } from './types';
2
+ export declare const defaultLocale: Required<DragNDropFieldPropLocale>;
3
+ export declare const getText: <PROPS>(textOrFn: string | ((props: PROPS) => string), props?: PROPS | undefined) => string | undefined;
4
+ export declare const withDefaultLocale: (locale?: DragNDropFieldPropLocale) => Required<DragNDropFieldPropLocale>;
@@ -0,0 +1,2 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";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{isDefined,isNotNil,isString}from"../../utils/type-guards";import{formatFileSize}from"./formatFileSize";export var defaultLocale={"file-invalid-type":function fileInvalidType(a){return["".concat(a.file.name,": \u0444\u043E\u0440\u043C\u0430\u0442 \u0444\u0430\u0439\u043B\u0430 \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u0438\u0442"),a.file.type&&"(".concat(a.file.type,")")].filter(isNotNil).join(" ")},"file-too-large":function fileTooLarge(a){return"".concat(a.file.name,": \u0444\u0430\u0439\u043B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0439 ").concat(a.sizes&&a.sizes.maxSize&&"(\u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C ".concat(formatFileSize(a.sizes.maxSize,defaultLocale),")"))},"file-too-small":function fileTooSmall(a){return"".concat(a.file.name,": \u0444\u0430\u0439\u043B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439 ").concat(a.sizes&&a.sizes.minSize&&"(\u043C\u0438\u043D\u0438\u043C\u0443\u043C ".concat(formatFileSize(a.sizes.minSize,defaultLocale),")"))},"too-many-files":"\u0412\u044B \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u043B\u0438 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0444\u0430\u0439\u043B\u043E\u0432. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0434\u0438\u043D, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430","general-error":"\u043D\u0435 \u043F\u043E\u043B\u0443\u0447\u0438\u043B\u043E\u0441\u044C \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0444\u0430\u0439\u043B","fit-files":"\u041F\u043E\u0434\u0445\u043E\u0434\u044F\u0442 \u0444\u0430\u0439\u043B\u044B",file:"\u0444\u0430\u0439\u043B",files:"\u0444\u0430\u0439\u043B\u044B",before:"\u0434\u043E",from:"\u043E\u0442",gigabyte:"\u0413\u0431",megabyte:"\u041C\u0431",kilobyte:"\u041A\u0431",byte:"\u0431\u0430\u0439\u0442","call-to-action":function callToAction(a){return"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 ".concat(a.fileText," \u0441\u044E\u0434\u0430 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435")},"action-button":function actionButton(a){return"\u0412\u044B\u0431\u0440\u0430\u0442\u044C ".concat(a.fileText)},"drag-active-message":"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430"};export var getText=function(a,b){return isString(a)?a:b&&a(b)};export var withDefaultLocale=function(a){return isDefined(a)?_objectSpread(_objectSpread({},defaultLocale),a):defaultLocale};
2
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","names":["isDefined","isNotNil","isString","formatFileSize","defaultLocale","props","file","name","type","filter","join","sizes","maxSize","minSize","fileText","getText","textOrFn","withDefaultLocale","locale"],"sources":["../../../../../src/components/DragNDropFieldCanary/locale.ts"],"sourcesContent":["import { isDefined, isNotNil, isString } from '##/utils/type-guards';\n\nimport { formatFileSize } from './formatFileSize';\nimport { DragNDropFieldPropLocale } from './types';\n\nexport const defaultLocale: Required<DragNDropFieldPropLocale> = {\n 'file-invalid-type': (props) =>\n [\n `${props.file.name}: формат файла не подходит`,\n props.file.type && `(${props.file.type})`,\n ]\n .filter(isNotNil)\n .join(' '),\n 'file-too-large': (props) =>\n `${props.file.name}: файл слишком большой ${\n props.sizes &&\n props.sizes.maxSize &&\n `(максимум ${formatFileSize(props.sizes.maxSize, defaultLocale)})`\n }`,\n 'file-too-small': (props) =>\n `${props.file.name}: файл слишком маленький ${\n props.sizes &&\n props.sizes.minSize &&\n `(минимум ${formatFileSize(props.sizes.minSize, defaultLocale)})`\n }`,\n 'too-many-files': 'Вы перетащили несколько файлов. Выберите один, пожалуйста',\n 'general-error': 'не получилось добавить файл',\n 'fit-files': 'Подходят файлы',\n 'file': 'файл',\n 'files': 'файлы',\n 'before': 'до',\n 'from': 'от',\n 'gigabyte': 'Гб',\n 'megabyte': 'Мб',\n 'kilobyte': 'Кб',\n 'byte': 'байт',\n 'call-to-action': (props) =>\n `Перетащите ${props.fileText} сюда или загрузите по кнопке`,\n 'action-button': (props) => `Выбрать ${props.fileText}`,\n 'drag-active-message': 'Перетащите файлы сюда',\n};\n\nexport const getText = <PROPS>(\n textOrFn: string | ((props: PROPS) => string),\n props?: PROPS,\n) => {\n return isString(textOrFn) ? textOrFn : props && textOrFn(props);\n};\n\nexport const withDefaultLocale = (\n locale?: DragNDropFieldPropLocale,\n): Required<DragNDropFieldPropLocale> =>\n isDefined(locale)\n ? {\n ...defaultLocale,\n ...locale,\n }\n : defaultLocale;\n"],"mappings":"qqBAAA,OAASA,SAAT,CAAoBC,QAApB,CAA8BC,QAA9B,+BAEA,OAASC,cAAT,wBAGA,MAAO,IAAMC,cAAiD,CAAG,CAC/D,oBAAqB,yBAACC,CAAD,QACnB,WACKA,CAAK,CAACC,IAAN,CAAWC,IADhB,wIAEEF,CAAK,CAACC,IAAN,CAAWE,IAAX,aAAuBH,CAAK,CAACC,IAAN,CAAWE,IAAlC,KAFF,EAIGC,MAJH,CAIUR,QAJV,EAKGS,IALH,CAKQ,GALR,CADmB,CAD0C,CAQ/D,iBAAkB,sBAACL,CAAD,kBACbA,CAAK,CAACC,IAAN,CAAWC,IADE,6HAEdF,CAAK,CAACM,KAAN,EACAN,CAAK,CAACM,KAAN,CAAYC,OADZ,8DAEaT,cAAc,CAACE,CAAK,CAACM,KAAN,CAAYC,OAAb,CAAsBR,aAAtB,CAF3B,KAFc,EAR6C,CAc/D,iBAAkB,sBAACC,CAAD,kBACbA,CAAK,CAACC,IAAN,CAAWC,IADE,yIAEdF,CAAK,CAACM,KAAN,EACAN,CAAK,CAACM,KAAN,CAAYE,OADZ,wDAEYV,cAAc,CAACE,CAAK,CAACM,KAAN,CAAYE,OAAb,CAAsBT,aAAtB,CAF1B,KAFc,EAd6C,CAoB/D,iBAAkB,gTApB6C,CAqB/D,gBAAiB,qJArB8C,CAsB/D,YAAa,iFAtBkD,CAuB/D,KAAQ,0BAvBuD,CAwB/D,MAAS,gCAxBsD,CAyB/D,OAAU,cAzBqD,CA0B/D,KAAQ,cA1BuD,CA2B/D,SAAY,cA3BmD,CA4B/D,SAAY,cA5BmD,CA6B/D,SAAY,cA7BmD,CA8B/D,KAAQ,0BA9BuD,CA+B/D,iBAAkB,sBAACC,CAAD,+EACFA,CAAK,CAACS,QADJ,0JA/B6C,CAiC/D,gBAAiB,sBAACT,CAAD,6DAAsBA,CAAK,CAACS,QAA5B,EAjC8C,CAkC/D,sBAAuB,sHAlCwC,CAA1D,CAqCP,MAAO,IAAMC,QAAO,CAAG,SACrBC,CADqB,CAErBX,CAFqB,CAGlB,CACH,MAAOH,SAAQ,CAACc,CAAD,CAAR,CAAqBA,CAArB,CAAgCX,CAAK,EAAIW,CAAQ,CAACX,CAAD,CACzD,CALM,CAOP,MAAO,IAAMY,kBAAiB,CAAG,SAC/BC,CAD+B,QAG/BlB,UAAS,CAACkB,CAAD,CAAT,gCAESd,aAFT,EAGSc,CAHT,EAKId,aAR2B,CAA1B"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { DragNDropFieldChildrenRenderFn, DragNDropFieldContentProps } from './types';
3
+ export declare const renderCildren: (children: React.ReactNode | DragNDropFieldChildrenRenderFn | undefined, props: DragNDropFieldContentProps) => React.ReactNode;
@@ -0,0 +1,2 @@
1
+ import React from"react";import{isRenderProp}from"../../utils/isRenderProp";import{DragNDropFieldContent}from"./DragNDropFieldContent";export var renderCildren=function(a,b){if(!a)return React.createElement(DragNDropFieldContent,b);if(isRenderProp(a)){var c=b.openFileDialog,d=b.isDragAccept,e=b.isDragActive,f=b.isDragReject,g=b.isFileDialogActive,h=b.isFocused,i=b.acceptedFiles,j=b.fileRejections;return a({openFileDialog:c,isDragAccept:d,isDragActive:e,isDragReject:f,isFileDialogActive:g,isFocused:h,acceptedFiles:i,fileRejections:j})}return a};
2
+ //# sourceMappingURL=renderCildren.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCildren.js","names":["React","isRenderProp","DragNDropFieldContent","renderCildren","children","props","openFileDialog","isDragAccept","isDragActive","isDragReject","isFileDialogActive","isFocused","acceptedFiles","fileRejections"],"sources":["../../../../../src/components/DragNDropFieldCanary/renderCildren.tsx"],"sourcesContent":["import React from 'react';\n\nimport { isRenderProp } from '##/utils/isRenderProp';\n\nimport { DragNDropFieldContent } from './DragNDropFieldContent';\nimport {\n DragNDropFieldChildrenRenderFn,\n DragNDropFieldContentProps,\n} from './types';\n\nexport const renderCildren = (\n children: React.ReactNode | DragNDropFieldChildrenRenderFn | undefined,\n props: DragNDropFieldContentProps,\n): React.ReactNode => {\n if (!children) {\n return <DragNDropFieldContent {...props} />;\n }\n if (isRenderProp(children)) {\n const {\n openFileDialog,\n isDragAccept,\n isDragActive,\n isDragReject,\n isFileDialogActive,\n isFocused,\n acceptedFiles,\n fileRejections,\n } = props;\n return children({\n openFileDialog,\n isDragAccept,\n isDragActive,\n isDragReject,\n isFileDialogActive,\n isFocused,\n acceptedFiles,\n fileRejections,\n });\n }\n return children;\n};\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,YAAT,gCAEA,OAASC,qBAAT,+BAMA,MAAO,IAAMC,cAAa,CAAG,SAC3BC,CAD2B,CAE3BC,CAF2B,CAGP,CACpB,GAAI,CAACD,CAAL,CACE,MAAO,qBAAC,qBAAD,CAA2BC,CAA3B,CAAP,CAEF,GAAIJ,YAAY,CAACG,CAAD,CAAhB,CAA4B,CAC1B,GACEE,EADF,CASID,CATJ,CACEC,cADF,CAEEC,CAFF,CASIF,CATJ,CAEEE,YAFF,CAGEC,CAHF,CASIH,CATJ,CAGEG,YAHF,CAIEC,CAJF,CASIJ,CATJ,CAIEI,YAJF,CAKEC,CALF,CASIL,CATJ,CAKEK,kBALF,CAMEC,CANF,CASIN,CATJ,CAMEM,SANF,CAOEC,CAPF,CASIP,CATJ,CAOEO,aAPF,CAQEC,CARF,CASIR,CATJ,CAQEQ,cARF,CAUA,MAAOT,EAAQ,CAAC,CACdE,cAAc,CAAdA,CADc,CAEdC,YAAY,CAAZA,CAFc,CAGdC,YAAY,CAAZA,CAHc,CAIdC,YAAY,CAAZA,CAJc,CAKdC,kBAAkB,CAAlBA,CALc,CAMdC,SAAS,CAATA,CANc,CAOdC,aAAa,CAAbA,CAPc,CAQdC,cAAc,CAAdA,CARc,CAAD,CAUhB,CACD,MAAOT,EACR,CA9BM"}
@@ -0,0 +1,81 @@
1
+ /// <reference types="react" />
2
+ import { IconComponent } from '@consta/icons/Icon';
3
+ import { Accept, DropEvent, FileRejection } from 'react-dropzone';
4
+ import { PropsWithHTMLAttributes } from "../../utils/types/PropsWithHTMLAttributes";
5
+ export declare type DragNDropFieldChildrenRenderFn = (props: {
6
+ openFileDialog: () => void;
7
+ isFocused: boolean;
8
+ isDragActive: boolean;
9
+ isDragAccept: boolean;
10
+ isDragReject: boolean;
11
+ isFileDialogActive: boolean;
12
+ acceptedFiles: File[];
13
+ fileRejections: FileRejection[];
14
+ }) => React.ReactNode;
15
+ export declare type DragNDropFieldContentProps = {
16
+ openFileDialog: () => void;
17
+ locale: Required<DragNDropFieldPropLocale>;
18
+ isFocused: boolean;
19
+ isDragActive: boolean;
20
+ isDragAccept: boolean;
21
+ isDragReject: boolean;
22
+ isFileDialogActive: boolean;
23
+ acceptedFiles: File[];
24
+ fileRejections: FileRejection[];
25
+ } & Pick<DragNDropFieldProps, 'accept' | 'maxSize' | 'multiple' | 'disabled' | 'minSize'>;
26
+ export declare type FileSizes = {
27
+ minSize?: number;
28
+ maxSize?: number;
29
+ };
30
+ export declare type DragNDropFieldProps = PropsWithHTMLAttributes<{
31
+ accept?: Accept;
32
+ maxSize?: number;
33
+ minSize?: number;
34
+ maxFiles?: number;
35
+ multiple?: boolean;
36
+ disabled?: boolean;
37
+ children?: React.ReactNode | DragNDropFieldChildrenRenderFn;
38
+ locale?: DragNDropFieldPropLocale;
39
+ onDrop?: <T extends File>(acceptedFiles: T[], fileRejections: FileRejection[], event: DropEvent) => void;
40
+ onDropAccepted?: <T extends File>(files: T[]) => void;
41
+ onDropRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;
42
+ onError?: (err: Error) => void;
43
+ }, HTMLDivElement>;
44
+ export declare type LocaleError = string | ((props: {
45
+ file: File;
46
+ sizes?: FileSizes;
47
+ }) => string);
48
+ export declare type LocaleLabel = string | ((props: {
49
+ fileText: string;
50
+ }) => string);
51
+ export declare type DragNDropFieldPropLocale = {
52
+ 'file-invalid-type'?: LocaleError;
53
+ 'file-too-large'?: LocaleError;
54
+ 'file-too-small'?: LocaleError;
55
+ 'too-many-files'?: string;
56
+ 'general-error'?: string;
57
+ 'fit-files'?: string;
58
+ 'file'?: string;
59
+ 'files'?: string;
60
+ 'before'?: string;
61
+ 'from'?: string;
62
+ 'gigabyte'?: string;
63
+ 'megabyte'?: string;
64
+ 'kilobyte'?: string;
65
+ 'byte'?: string;
66
+ 'call-to-action'?: LocaleLabel;
67
+ 'action-button'?: LocaleLabel;
68
+ 'drag-active-message'?: string;
69
+ };
70
+ export declare const dragNDropFieldInformerPropStatus: readonly ["default", "alert", "warning"];
71
+ export declare type DragNDropFieldInformerPropStatus = typeof dragNDropFieldInformerPropStatus[number];
72
+ export declare type DragNDropFieldInformerProps = {
73
+ status?: DragNDropFieldInformerPropStatus;
74
+ icon?: IconComponent;
75
+ loading?: boolean | number;
76
+ text?: string;
77
+ withButton?: boolean;
78
+ buttonIcon?: IconComponent;
79
+ buttonLabel?: string;
80
+ onButtonClick?: () => void;
81
+ };
@@ -0,0 +1,2 @@
1
+ export var dragNDropFieldInformerPropStatus=["default","alert","warning"];
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":["dragNDropFieldInformerPropStatus"],"sources":["../../../../../src/components/DragNDropFieldCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport { Accept, DropEvent, FileRejection } from 'react-dropzone';\n\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type DragNDropFieldChildrenRenderFn = (props: {\n openFileDialog: () => void;\n isFocused: boolean;\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFileDialogActive: boolean;\n acceptedFiles: File[];\n fileRejections: FileRejection[];\n}) => React.ReactNode;\n\nexport type DragNDropFieldContentProps = {\n openFileDialog: () => void;\n locale: Required<DragNDropFieldPropLocale>;\n isFocused: boolean;\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFileDialogActive: boolean;\n acceptedFiles: File[];\n fileRejections: FileRejection[];\n} & Pick<\n DragNDropFieldProps,\n 'accept' | 'maxSize' | 'multiple' | 'disabled' | 'minSize'\n>;\n\nexport type FileSizes = {\n minSize?: number;\n maxSize?: number;\n};\n\nexport type DragNDropFieldProps = PropsWithHTMLAttributes<\n {\n accept?: Accept;\n maxSize?: number;\n minSize?: number;\n maxFiles?: number;\n multiple?: boolean;\n disabled?: boolean;\n children?: React.ReactNode | DragNDropFieldChildrenRenderFn;\n locale?: DragNDropFieldPropLocale;\n onDrop?: <T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) => void;\n onDropAccepted?: <T extends File>(files: T[]) => void;\n onDropRejected?: (\n fileRejections: FileRejection[],\n event: DropEvent,\n ) => void;\n onError?: (err: Error) => void;\n },\n HTMLDivElement\n>;\n\nexport type LocaleError =\n | string\n | ((props: { file: File; sizes?: FileSizes }) => string);\n\nexport type LocaleLabel = string | ((props: { fileText: string }) => string);\n\nexport type DragNDropFieldPropLocale = {\n 'file-invalid-type'?: LocaleError;\n 'file-too-large'?: LocaleError;\n 'file-too-small'?: LocaleError;\n 'too-many-files'?: string;\n 'general-error'?: string;\n 'fit-files'?: string;\n 'file'?: string;\n 'files'?: string;\n 'before'?: string;\n 'from'?: string;\n 'gigabyte'?: string;\n 'megabyte'?: string;\n 'kilobyte'?: string;\n 'byte'?: string;\n 'call-to-action'?: LocaleLabel;\n 'action-button'?: LocaleLabel;\n 'drag-active-message'?: string;\n};\n\nexport const dragNDropFieldInformerPropStatus = [\n 'default',\n 'alert',\n 'warning',\n] as const;\n\nexport type DragNDropFieldInformerPropStatus =\n typeof dragNDropFieldInformerPropStatus[number];\n\nexport type DragNDropFieldInformerProps = {\n status?: DragNDropFieldInformerPropStatus;\n icon?: IconComponent;\n loading?: boolean | number;\n text?: string;\n withButton?: boolean;\n buttonIcon?: IconComponent;\n buttonLabel?: string;\n onButtonClick?: () => void;\n};\n"],"mappings":"AAuFA,MAAO,IAAMA,iCAAgC,CAAG,CAC9C,SAD8C,CAE9C,OAF8C,CAG9C,SAH8C,CAAzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consta/uikit",
3
- "version": "5.2.1",
3
+ "version": "5.3.0",
4
4
  "keywords": [
5
5
  "ui-kit",
6
6
  "design-system",
@@ -21,7 +21,7 @@
21
21
  "date-fns": "^2.30.0",
22
22
  "react": ">= 16.8.0",
23
23
  "react-dom": ">= 16.8.0",
24
- "react-dropzone": "11.3.4",
24
+ "react-dropzone": "^14.2.3",
25
25
  "react-imask": "^7.2.1",
26
26
  "react-textarea-autosize": "^8.5.3",
27
27
  "react-transition-group": "^4.4.5"
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useBreakpoints";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useBreakpoints";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useBreakpointsDepricated";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useBreakpointsDepricated";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useChoiceGroupIndexed";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useChoiceGroupIndexed";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useComponentBreakpointsDepricated";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useComponentBreakpointsDepricated";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useDebounce";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useDebounce";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useFlag";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useFlag";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useForkRef";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useForkRef";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useGlobalKeys";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useGlobalKeys";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useHideElementsInLine";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useHideElementsInLine";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useHideElementsInLineDepricated";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useHideElementsInLineDepricated";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useKeys";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useKeys";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useKeysRef";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useKeysRef";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useMutableRef";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useMutableRef";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useOverflow";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useOverflow";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/usePrevious";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/usePrevious";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useRefs";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useRefs";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useResizableContent";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useResizableContent";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useResizeObserved";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useResizeObserved";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useScrollPosition";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useScrollPosition";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useSelect";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useSelect";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useSortSteps";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useSortSteps";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useStyleProps";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useStyleProps";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useThemeVars";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useThemeVars";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useVirtualScroll";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/hooks/useVirtualScroll";