@consta/uikit 4.17.2 → 4.19.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 (79) hide show
  1. package/__internal__/src/components/Avatar/Avatar.css +1 -1
  2. package/__internal__/src/components/Badge/Badge.css +1 -1
  3. package/__internal__/src/components/Badge/Badge.d.ts +5 -0
  4. package/__internal__/src/components/Badge/Badge.js +1 -1
  5. package/__internal__/src/components/Badge/Badge.js.map +1 -1
  6. package/__internal__/src/components/Breadcrumbs/BreadcrumbsMore/BreadcrumbsMore.js +1 -1
  7. package/__internal__/src/components/Breadcrumbs/BreadcrumbsMore/BreadcrumbsMore.js.map +1 -1
  8. package/__internal__/src/components/Breadcrumbs/helpers.d.ts +2 -2
  9. package/__internal__/src/components/Breadcrumbs/helpers.js +1 -1
  10. package/__internal__/src/components/Breadcrumbs/helpers.js.map +1 -1
  11. package/__internal__/src/components/Checkbox/Checkbox.css +2 -2
  12. package/__internal__/src/components/CheckboxGroup/CheckboxGroup.js +1 -1
  13. package/__internal__/src/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
  14. package/__internal__/src/components/CheckboxGroup/helper.d.ts +2 -1
  15. package/__internal__/src/components/CheckboxGroup/helper.js +1 -1
  16. package/__internal__/src/components/CheckboxGroup/helper.js.map +1 -1
  17. package/__internal__/src/components/CheckboxGroup/types.d.ts +3 -0
  18. package/__internal__/src/components/CheckboxGroup/types.js.map +1 -1
  19. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.css +1 -1
  20. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js +1 -1
  21. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
  22. package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js +1 -1
  23. package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js.map +1 -1
  24. package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js +1 -1
  25. package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js.map +1 -1
  26. package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js +1 -1
  27. package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js.map +1 -1
  28. package/__internal__/src/components/DragNDropField/DragNDropField.d.ts +1 -2
  29. package/__internal__/src/components/DragNDropField/DragNDropField.js +1 -1
  30. package/__internal__/src/components/DragNDropField/DragNDropField.js.map +1 -1
  31. package/__internal__/src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.css +1 -1
  32. package/__internal__/src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.js +1 -1
  33. package/__internal__/src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.js.map +1 -1
  34. package/__internal__/src/components/File/File.css +1 -1
  35. package/__internal__/src/components/Informer/Informer.d.ts +1 -1
  36. package/__internal__/src/components/Informer/Informer.js +1 -1
  37. package/__internal__/src/components/Informer/Informer.js.map +1 -1
  38. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js +1 -1
  39. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js.map +1 -1
  40. package/__internal__/src/components/ListCanary/maps.d.ts +1 -0
  41. package/__internal__/src/components/ListCanary/maps.js +1 -1
  42. package/__internal__/src/components/ListCanary/maps.js.map +1 -1
  43. package/__internal__/src/components/Popover/Popover.css +1 -1
  44. package/__internal__/src/components/Popover/Popover.d.ts +3 -4
  45. package/__internal__/src/components/Popover/Popover.js +1 -1
  46. package/__internal__/src/components/Popover/Popover.js.map +1 -1
  47. package/__internal__/src/components/Popover/index.d.ts +1 -0
  48. package/__internal__/src/components/Popover/index.js +1 -1
  49. package/__internal__/src/components/Popover/index.js.map +1 -1
  50. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.css +9 -1
  51. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.js +1 -1
  52. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.js.map +1 -1
  53. package/__internal__/src/components/ProgressStepBar/ProgressStepBarLine/ProgressStepBarLine.js +1 -1
  54. package/__internal__/src/components/ProgressStepBar/ProgressStepBarLine/ProgressStepBarLine.js.map +1 -1
  55. package/__internal__/src/components/RadioGroup/RadioGroup.css +1 -1
  56. package/__internal__/src/components/RadioGroup/RadioGroup.js +1 -1
  57. package/__internal__/src/components/RadioGroup/RadioGroup.js.map +1 -1
  58. package/__internal__/src/components/RadioGroup/helper.d.ts +2 -1
  59. package/__internal__/src/components/RadioGroup/helper.js +1 -1
  60. package/__internal__/src/components/RadioGroup/helper.js.map +1 -1
  61. package/__internal__/src/components/RadioGroup/types.d.ts +3 -0
  62. package/__internal__/src/components/RadioGroup/types.js.map +1 -1
  63. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
  64. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
  65. package/__internal__/src/components/Slider/SliderPoint/SliderPoint.js +1 -1
  66. package/__internal__/src/components/Slider/SliderPoint/SliderPoint.js.map +1 -1
  67. package/__internal__/src/components/TabsDeprecated/Tab/TabsTab.css +1 -1
  68. package/__internal__/src/components/TabsDeprecated/Tab/TabsTab.js +1 -1
  69. package/__internal__/src/components/TabsDeprecated/Tab/TabsTab.js.map +1 -1
  70. package/__internal__/src/components/Tooltip/Tooltip.d.ts +2 -1
  71. package/__internal__/src/components/Tooltip/Tooltip.js +1 -1
  72. package/__internal__/src/components/Tooltip/Tooltip.js.map +1 -1
  73. package/__internal__/src/components/User/User.css +1 -1
  74. package/__internal__/src/components/User/User.js +1 -1
  75. package/__internal__/src/components/User/User.js.map +1 -1
  76. package/__internal__/src/utils/isRenderProp.d.ts +2 -0
  77. package/__internal__/src/utils/isRenderProp.js +2 -0
  78. package/__internal__/src/utils/isRenderProp.js.map +1 -0
  79. package/package.json +1 -1
@@ -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"];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.onMove,q=a.onChangeCurrentVisibleDate,r=_objectWithoutProperties(a,_excluded),s=useFlag(),t=_slicedToArray(s,2),u=t[0],v=t[1],w=v.on,x=v.off;useEffect(function(){u||(null===p||void 0===p?void 0:p(moveTypes[1]))},[u]);var y=useCurrentVisibleDate({currentVisibleDate:i,maxDate:d,minDate:c,value:e,startOfUnit:startOfYear,onChangeCurrentVisibleDate:q}),z=_slicedToArray(y,2),A=z[0],B=z[1];if(u)return React.createElement(DateTimeTypeYear,Object.assign({},r,{ref:b,className:m,currentVisibleDate:A,minDate:c,maxDate:d,locale:l,events:j,view:o,onChange:function(a){var b=a.value;B(b),x()},onMove:p}));var C=getHandleSelectDate({minDate:c,maxDate:d,value:e,onChange:f,onChangeRange:g,isEqualUnit:isEqualMount}),D=getMonthsOfYear({date:A,onChange:C,value:e,events:j,disableDates:h,minDate:c,maxDate:d,locale:l}),E=getYearTitle(A),F=function(){return B(addYears(A,1))},G=function(){return B(addYears(A,-1))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:G,nextOnClick:F,label:E,onLabelClick:w}),React.createElement(DateTimeYear,{years:D}));var H=addYears(A,1),I=getYearTitle(H),J=getMonthsOfYear({date:H,onChange:C,value:e,events:j,minDate:c,maxDate:d,locale:l});return o===dateTimePropView[1]?React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:G,label:E,onLabelClick:w}),React.createElement(DateTime10Years,{years:D})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:F,label:I,onLabelClick:w}),React.createElement(DateTime10Years,{years:J}))):React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTime10YearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:A,onChange:B,value:e,locale:l}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:E,onClick:w,cursor:"pointer"}),React.createElement(DateTime10Years,{years:D})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:I,onClick:w,cursor:"pointer"}),React.createElement(DateTime10Years,{years:J}))))});
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){var b=a.value;E(b),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}))))});
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","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 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":"4UAAA,OAASA,QAAT,CAAmBC,WAAnB,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,CAAE1B,mBAAmB,CAAC,MAAD,CAAnC,EACE,oBAAC,aAAD,EACE,SAAS,CAAEA,mBAAmB,CAAC,OAAD,CADhC,CAEE,KAAK,CAAEgC,CAFT,CAGE,OAAO,CAAEZ,CAHX,CAIE,MAAM,CAAC,SAJT,EADF,CAOE,oBAAC,eAAD,EAAiB,KAAK,CAAEa,CAAxB,EAPF,CAVF,CAZF,CAkCH,CAnLwE,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 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,gBAAT,CAA2BC,uBAA3B,wBACA,OAASC,mBAAT,eAEA,MAAO,IAAMC,kBAAiD,CAAGlB,UAAU,CACzE,SAACmB,CAAD,CAAQC,CAAR,CAAgB,IAEZC,EAFY,CAmBVF,CAnBU,CAEZE,OAFY,CAGZC,CAHY,CAmBVH,CAnBU,CAGZG,OAHY,CAIZC,CAJY,CAmBVJ,CAnBU,CAIZI,KAJY,CAKZC,CALY,CAmBVL,CAnBU,CAKZK,QALY,CAMZC,CANY,CAmBVN,CAnBU,CAMZM,aANY,CAOZC,CAPY,CAmBVP,CAnBU,CAOZO,YAPY,CAQQC,CARR,CAmBVR,CAnBU,CAQZS,kBARY,CASZC,CATY,CAmBVV,CAnBU,CASZU,MATY,GAmBVV,CAnBU,CAUZW,MAVY,CAUZA,CAVY,YAUHhC,QAVG,GAWZiC,CAXY,CAmBVZ,CAnBU,CAWZY,SAXY,GAmBVZ,CAnBU,CAYZa,IAZY,CAYZA,CAZY,YAYLhB,uBAZK,GAaZiB,CAbY,CAmBVd,CAnBU,CAaZc,iBAbY,CAcZC,CAdY,CAmBVf,CAnBU,CAcZe,mBAd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M,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,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,CAtLwE,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"];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=_objectWithoutProperties(a,_excluded);useEffect(function(){null===p||void 0===p?void 0:p(moveTypes[0])},[]);var s=useCurrentVisibleDate({currentVisibleDate:i,maxDate:d,minDate:c,value:e,startOfUnit:startOfDecade,onChangeCurrentVisibleDate:q}),t=_slicedToArray(s,2),u=t[0],v=t[1],w=getHandleSelectDate({minDate:c,maxDate:d,value:e,onChange:f,onChangeRange:g,isEqualUnit:isEqualYear}),x=getYearsOfDecade({date:u,onChange:w,value:e,disableDates:h,events:j,minDate:c,maxDate:d,locale:l}),y=getDecadeTitle(u),z=function(){return v(addYears(u,10))},A=function(){return v(addYears(u,-10))};if(o===dateTimePropView[0])return React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:A,nextOnClick:z,label:y}),React.createElement(DateTime10Years,{years:x}));var B=addYears(u,10),C=getYearsOfDecade({date:B,onChange:w,value:e,events:j,minDate:c,maxDate:d,locale:l}),D=getDecadeTitle(B);return o===dateTimePropView[1]?React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),prevOnClick:A,label:y}),React.createElement(DateTime10Years,{years:x})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeToggler,{className:cnDateTimeMixLayout("Label"),nextOnClick:z,label:D}),React.createElement(DateTime10Years,{years:C}))):React.createElement("div",Object.assign({},r,{className:cnDateTimeMixLayout({view:o},[m]),ref:b}),React.createElement(DateTime100YearSlider,{className:cnDateTimeMixLayout("Slider"),currentVisibleDate:u,onChange:v,value:e,locale:l}),React.createElement("div",{className:cnDateTimeMixLayout("PageWrapper")},React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:y}),React.createElement(DateTime10Years,{years:x})),React.createElement("div",{className:cnDateTimeMixLayout("Page")},React.createElement(DateTimeLabel,{className:cnDateTimeMixLayout("Label"),label:D}),React.createElement(DateTime10Years,{years:C}))))});
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}))))});
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","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\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":"4UAAA,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,CAgBIF,CAhBJ,CACEE,OADF,CAEEC,CAFF,CAgBIH,CAhBJ,CAEEG,OAFF,CAGEC,CAHF,CAgBIJ,CAhBJ,CAGEI,KAHF,CAIEC,CAJF,CAgBIL,CAhBJ,CAIEK,QAJF,CAKEC,CALF,CAgBIN,CAhBJ,CAKEM,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KAAK,CAAE8B,CAFT,EADF,CAKE,oBAAC,eAAD,EAAiB,KAAK,CAAED,CAAxB,EALF,CARF,CAZF,CA8BH,CAtJsE,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 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,CA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BAAK,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,CAxJsE,CAAlE"}
@@ -1,6 +1,5 @@
1
1
  import './DragNDropField.css';
2
2
  import React from 'react';
3
- import { DragNDropFieldChildrenRenderProp } from './types';
4
3
  export declare const COMPONENT_NAME: "DragNDropField";
5
4
  export declare const DragNDropField: React.ForwardRefExoticComponent<{
6
5
  accept?: string | string[] | undefined;
@@ -8,7 +7,7 @@ export declare const DragNDropField: React.ForwardRefExoticComponent<{
8
7
  minSize?: number | undefined;
9
8
  multiple?: boolean | undefined;
10
9
  onDropFiles: (files: File[]) => void;
11
- children?: React.ReactNode | DragNDropFieldChildrenRenderProp;
10
+ children?: React.ReactNode | import("./types").DragNDropFieldChildrenRenderProp;
12
11
  locale?: import("./locale").Locale | undefined;
13
12
  disabled?: boolean | undefined;
14
13
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "children" | "disabled" | "accept" | "multiple" | "locale" | "maxSize" | "minSize" | "onDropFiles"> & React.RefAttributes<HTMLDivElement>>;
@@ -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{useForkRef}from"../../hooks/useForkRef/useForkRef";import{useMutableRef}from"../../hooks/useMutableRef/useMutableRef";import{cn}from"../../utils/bem";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{Text}from"../Text/Text";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"},"\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}))});var isRenderProp=function(a){return"function"==typeof a};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{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"},"\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","useForkRef","useMutableRef","cn","usePropsHandler","Text","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","isRenderProp","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 { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { useMutableRef } from '../../hooks/useMutableRef/useMutableRef';\nimport { cn } from '../../utils/bem';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\nimport { Text } from '../Text/Text';\nimport { DragNDropFieldContent } from './DragNDropFieldContent/DragNDropFieldContent';\nimport { DragNDropFieldTooltip } from './DragNDropFieldTooltip/DragNDropFieldTooltip';\nimport { getErrorsList } from './getErrorsList';\nimport { withdefaultLocale } from './locale';\nimport { DragNDropFieldChildrenRenderProp, 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\">\n Перетащите файлы сюда\n </Text>\n ) : (\n content\n )}\n </div>\n <DragNDropFieldTooltip anchorRef={rootRef} errors={errors} />\n </>\n );\n },\n);\n\nconst isRenderProp = (\n children: React.ReactNode | DragNDropFieldChildrenRenderProp,\n): children is DragNDropFieldChildrenRenderProp =>\n typeof children === 'function';\n\nexport * from './types';\n"],"mappings":"y2BAAA,6BAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CACA,OAA0BC,WAA1B,KAA6C,gBAA7C,CAEA,OAASC,UAAT,yCACA,OAASC,aAAT,+CACA,OAASC,EAAT,uBACA,OAASC,eAAT,2CACA,OAASC,IAAT,oBACA,OAASC,qBAAT,qDACA,OAASC,qBAA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AX,CAAuB,IAAI,CAAC,GAA5B,CAAgC,KAAK,CAAC,QAAtC,yHADW,CAKXW,CAPJ,CADF,CAWE,oBAAC,qBAAD,EAAuB,SAAS,CAAEV,CAAlC,CAA2C,MAAM,CAAEa,CAAnD,EAXF,CAcH,CA5FqC,CAAjC,CA+FP,GAAMF,aAAY,CAAG,SACnB3B,CADmB,QAGC,UAApB,QAAOA,EAHY,CAArB,CAKA"}
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\">\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":"y2B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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,yHADW,CAKXW,CAPJ,CADF,CAWE,oBAAC,qBAAD,EAAuB,SAAS,CAAEV,CAAlC,CAA2C,MAAM,CAAEY,CAAnD,EAXF,CAcH,CA5FqC,CAAjC,CA+FP"}
@@ -1 +1 @@
1
- .DragNDropFieldTooltip-List{padding-left:var(--space-xl)}
1
+ .DragNDropFieldTooltip-Text{word-break:break-word}
@@ -1,2 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import"./DragNDropFieldTooltip.css";import React from"react";import{cn}from"../../../utils/bem";import{Text}from"../../Text/Text";import{Tooltip}from"../../Tooltip/Tooltip";var cnDragNDropFieldTooltip=cn("DragNDropFieldTooltip");export var DragNDropFieldTooltip=function(a){var b=a.anchorRef,c=a.errors,d=React.useState(!1),e=_slicedToArray(d,2),f=e[0],g=e[1];return React.useEffect(function(){g(!1)},[c]),f||0===c.length?null:React.createElement(Tooltip,{anchorRef:b,status:"alert",size:"l",isInteractive:!1,onClickOutside:function onClickOutside(){return g(!0)}},React.createElement(Text,{size:"s"},1===c.length?c[0]:React.createElement("ul",{className:cnDragNDropFieldTooltip("List")},c.map(function(a){return React.createElement("li",{key:a},a)}))))};
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import"./DragNDropFieldTooltip.css";import React from"react";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{Text}from"../../Text/Text";import{Tooltip}from"../../Tooltip/Tooltip";var cnDragNDropFieldTooltip=cn("DragNDropFieldTooltip");export var DragNDropFieldTooltip=function(a){var b=a.anchorRef,c=a.errors,d=React.useState(!1),e=_slicedToArray(d,2),f=e[0],g=e[1];return React.useEffect(function(){g(!1)},[c]),f||0===c.length?null:React.createElement(Tooltip,{anchorRef:b,status:"alert",size:"l",isInteractive:!1,onClickOutside:function onClickOutside(){return g(!0)}},React.createElement(Text,{size:"s",className:cnDragNDropFieldTooltip("Text")},1===c.length?c[0]:React.createElement("ul",{className:cnDragNDropFieldTooltip("List",[cnMixSpace({pL:"xl"})])},c.map(function(a){return React.createElement("li",{key:a},a)}))))};
2
2
  //# sourceMappingURL=DragNDropFieldTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragNDropFieldTooltip.js","names":["React","cn","Text","Tooltip","cnDragNDropFieldTooltip","DragNDropFieldTooltip","anchorRef","errors","useState","isHidden","setIsHidden","useEffect","length","map","error"],"sources":["../../../../../../src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.tsx"],"sourcesContent":["import './DragNDropFieldTooltip.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { Text } from '../../Text/Text';\nimport { Tooltip } from '../../Tooltip/Tooltip';\n\ntype DragNDropFieldTooltipProps = {\n anchorRef: React.RefObject<HTMLElement>;\n errors: string[];\n};\n\nconst cnDragNDropFieldTooltip = cn('DragNDropFieldTooltip');\n\nexport const DragNDropFieldTooltip: React.FC<DragNDropFieldTooltipProps> = ({\n anchorRef,\n errors,\n}) => {\n const [isHidden, setIsHidden] = React.useState(false);\n\n React.useEffect(() => {\n setIsHidden(false);\n }, [errors]);\n\n return isHidden || errors.length === 0 ? null : (\n <Tooltip\n anchorRef={anchorRef}\n status=\"alert\"\n size=\"l\"\n isInteractive={false}\n onClickOutside={() => setIsHidden(true)}\n >\n <Text size=\"s\">\n {errors.length === 1 ? (\n errors[0]\n ) : (\n <ul className={cnDragNDropFieldTooltip('List')}>\n {errors.map((error) => (\n <li key={error}>{error}</li>\n ))}\n </ul>\n )}\n </Text>\n </Tooltip>\n );\n};\n"],"mappings":"iEAAA,oCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BACA,OAASC,IAAT,uBACA,OAASC,OAAT,6BAOA,GAAMC,wBAAuB,CAAGH,EAAE,CAAC,uBAAD,CAAlC,CAEA,MAAO,IAAMI,sBAA2D,CAAG,WAGrE,IAFJC,EAEI,GAFJA,SAEI,CADJC,CACI,GADJA,MACI,GAC4BP,KAAK,CAACQ,QAAN,IAD5B,uBACGC,CADH,MACaC,CADb,MAOJ,MAJAV,MAAK,CAACW,SAAN,CAAgB,UAAM,CACpBD,CAAW,IACZ,CAFD,CAEG,CAACH,CAAD,CAFH,CAIA,CAAOE,CAAQ,EAAsB,CAAlB,GAAAF,CAAM,CAACK,MAAnB,CAAkC,IAAlC,CACL,oBAAC,OAAD,EACE,SAAS,CAAEN,CADb,CAEE,MAAM,CAAC,OAFT,CAGE,IAAI,CAAC,GAHP,CAIE,aAAa,GAJf,CAKE,cAAc,CAAE,gCAAMI,EAAW,IAAjB,CALlB,EAOE,oBAAC,IAAD,EAAM,IAAI,CAAC,GAAX,EACqB,CAAlB,GAAAH,CAAM,CAACK,MAAP,CACCL,CAAM,CAAC,CAAD,CADP,CAGC,0BAAI,SAAS,CAAEH,uBAAuB,CAAC,MAAD,CAAtC,EACGG,CAAM,CAACM,GAAP,CAAW,SAACC,CAAD,QACV,2BAAI,GAAG,CAAEA,CAAT,EAAiBA,CAAjB,CADU,CAAX,CADH,CAJJ,CAPF,CAoBH,CA/BM"}
1
+ {"version":3,"file":"DragNDropFieldTooltip.js","names":["React","cnMixSpace","cn","Text","Tooltip","cnDragNDropFieldTooltip","DragNDropFieldTooltip","anchorRef","errors","useState","isHidden","setIsHidden","useEffect","length","pL","map","error"],"sources":["../../../../../../src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.tsx"],"sourcesContent":["import './DragNDropFieldTooltip.css';\n\nimport React from 'react';\n\nimport { cnMixSpace } from '##/mixs/MixSpace';\n\nimport { cn } from '../../../utils/bem';\nimport { Text } from '../../Text/Text';\nimport { Tooltip } from '../../Tooltip/Tooltip';\n\ntype DragNDropFieldTooltipProps = {\n anchorRef: React.RefObject<HTMLElement>;\n errors: string[];\n};\n\nconst cnDragNDropFieldTooltip = cn('DragNDropFieldTooltip');\n\nexport const DragNDropFieldTooltip: React.FC<DragNDropFieldTooltipProps> = ({\n anchorRef,\n errors,\n}) => {\n const [isHidden, setIsHidden] = React.useState(false);\n\n React.useEffect(() => {\n setIsHidden(false);\n }, [errors]);\n\n return isHidden || errors.length === 0 ? null : (\n <Tooltip\n anchorRef={anchorRef}\n status=\"alert\"\n size=\"l\"\n isInteractive={false}\n onClickOutside={() => setIsHidden(true)}\n >\n <Text size=\"s\" className={cnDragNDropFieldTooltip('Text')}>\n {errors.length === 1 ? (\n errors[0]\n ) : (\n <ul\n className={cnDragNDropFieldTooltip('List', [\n cnMixSpace({ pL: 'xl' }),\n ])}\n >\n {errors.map((error) => (\n <li key={error}>{error}</li>\n ))}\n </ul>\n )}\n </Text>\n </Tooltip>\n );\n};\n"],"mappings":"iEAAA,oCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,UAAT,8BAEA,OAASC,EAAT,0BACA,OAASC,IAAT,uBACA,OAASC,OAAT,6BAOA,GAAMC,wBAAuB,CAAGH,EAAE,CAAC,uBAAD,CAAlC,CAEA,MAAO,IAAMI,sBAA2D,CAAG,WAGrE,IAFJC,EAEI,GAFJA,SAEI,CADJC,CACI,GADJA,MACI,GAC4BR,KAAK,CAACS,QAAN,IAD5B,uBACGC,CADH,MACaC,CADb,MAOJ,MAJAX,MAAK,CAACY,SAAN,CAAgB,UAAM,CACpBD,CAAW,IACZ,CAFD,CAEG,CAACH,CAAD,CAFH,CAIA,CAAOE,CAAQ,EAAsB,CAAlB,GAAAF,CAAM,CAACK,MAAnB,CAAkC,IAAlC,CACL,oBAAC,OAAD,EACE,SAAS,CAAEN,CADb,CAEE,MAAM,CAAC,OAFT,CAGE,IAAI,CAAC,GAHP,CAIE,aAAa,GAJf,CAKE,cAAc,CAAE,gCAAMI,EAAW,IAAjB,CALlB,EAOE,oBAAC,IAAD,EAAM,IAAI,CAAC,GAAX,CAAe,SAAS,CAAEN,uBAAuB,CAAC,MAAD,CAAjD,EACqB,CAAlB,GAAAG,CAAM,CAACK,MAAP,CACCL,CAAM,CAAC,CAAD,CADP,CAGC,0BACE,SAAS,CAAEH,uBAAuB,CAAC,MAAD,CAAS,CACzCJ,UAAU,CAAC,CAAEa,EAAE,CAAE,IAAN,CAAD,CAD+B,CAAT,CADpC,EAKGN,CAAM,CAACO,GAAP,CAAW,SAACC,CAAD,QACV,2BAAI,GAAG,CAAEA,CAAT,EAAiBA,CAAjB,CADU,CAAX,CALH,CAJJ,CAPF,CAwBH,CAnCM"}
@@ -1 +1 @@
1
- .File{position:relative}.File-Loader{align-items:center;background-color:var(--color-control-bg-ghost);border-radius:50%;display:flex;height:var(--loader-size);justify-content:center;position:absolute;width:var(--loader-size)}.File-Loader_size_s{--loader-size:16px}.File-Loader_size_m{--loader-size:24px}.File-Progress{color:#575b5e;display:block}
1
+ .File{position:relative}.File-Loader{align-items:center;background-color:var(--color-control-bg-ghost);border-radius:50%;display:flex;height:var(--space-m);justify-content:center;position:absolute;width:var(--space-m)}.File-Progress{color:#575b5e;display:block}
@@ -5,7 +5,7 @@ import { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttribut
5
5
  export declare const informerPropView: readonly ["filled", "bordered"];
6
6
  export declare type InformerPropView = typeof informerPropView[number];
7
7
  export declare const informerPropViewDefault: InformerPropView;
8
- export declare const informerPropStatus: readonly ["success", "system", "alert", "alert", "warning"];
8
+ export declare const informerPropStatus: readonly ["success", "system", "alert", "warning"];
9
9
  export declare type InformerPropStatus = typeof informerPropStatus[number];
10
10
  export declare const informerPropStatusDefault: InformerPropStatus;
11
11
  export declare const informerPropSize: readonly ["m", "s"];
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["view","status","size","icon","label","title","children"];import"./Informer.css";import{classnames}from"@bem-react/classnames";import React from"react";import{cn}from"../../utils/bem";import{Text}from"../Text/Text";import{useTheme}from"../Theme/Theme";export var informerPropView=["filled","bordered"];export var informerPropViewDefault=informerPropView[0];export var informerPropStatus=["success","system","alert","alert","warning"];export var informerPropStatusDefault=informerPropStatus[0];export var informerPropSize=["m","s"];export var informerPropSiseDefault=informerPropSize[0];export var cnInformer=cn("Informer");export var Informer=React.forwardRef(function(a,b){var c=a.view,d=void 0===c?informerPropViewDefault:c,e=a.status,f=void 0===e?informerPropStatusDefault:e,g=a.size,h=void 0===g?informerPropSiseDefault:g,i=a.icon,j=a.label,k=a.title,l=a.children,m=_objectWithoutProperties(a,_excluded),n=i,o=useTheme(),p=o.themeClassNames,q="system"!==f&&"filled"===d?classnames(a.className,p.color.accent):a.className;return React.createElement("div",Object.assign({},m,{className:cnInformer({view:d,status:f,withIcon:!!i},[q]),ref:b}),n&&React.createElement(n,{className:cnInformer("Icon"),size:"s"}),React.createElement("div",{className:cnInformer("Content")},k&&React.createElement(Text,{className:cnInformer("Title"),weight:"bold",size:h},k),j?React.createElement(Text,{className:cnInformer("Label"),size:h},j):l))});
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["view","status","size","icon","label","title","children"];import"./Informer.css";import{classnames}from"@bem-react/classnames";import React from"react";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{Text}from"../Text/Text";import{useTheme}from"../Theme/Theme";export var informerPropView=["filled","bordered"];export var informerPropViewDefault=informerPropView[0];export var informerPropStatus=["success","system","alert","warning"];export var informerPropStatusDefault=informerPropStatus[0];export var informerPropSize=["m","s"];export var informerPropSiseDefault=informerPropSize[0];export var cnInformer=cn("Informer");export var Informer=React.forwardRef(function(a,b){var c=a.view,d=void 0===c?informerPropViewDefault:c,e=a.status,f=void 0===e?informerPropStatusDefault:e,g=a.size,h=void 0===g?informerPropSiseDefault:g,i=a.icon,j=a.label,k=a.title,l=a.children,m=_objectWithoutProperties(a,_excluded),n=i,o=useTheme(),p=o.themeClassNames,q="system"!==f&&"filled"===d?classnames(a.className,p.color.accent):a.className;return React.createElement("div",Object.assign({},m,{className:cnInformer({view:d,status:f,withIcon:!!i},[q,cnMixSpace({p:h})]),ref:b}),n&&React.createElement(n,{className:cnInformer("Icon"),size:"s"}),React.createElement("div",{className:cnInformer("Content")},k&&React.createElement(Text,{lineHeight:"xs",className:cnInformer("Title",[cnMixSpace({mB:"2xs"})]),weight:"bold",size:h},k),j?React.createElement(Text,{lineHeight:"xs",className:cnInformer("Label"),size:h},j):l))});
2
2
  //# sourceMappingURL=Informer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Informer.js","names":["classnames","React","cn","Text","useTheme","informerPropView","informerPropViewDefault","informerPropStatus","informerPropStatusDefault","informerPropSize","informerPropSiseDefault","cnInformer","Informer","forwardRef","props","ref","view","status","size","icon","label","title","children","otherProps","Icon","themeClassNames","className","color","accent","withIcon"],"sources":["../../../../../src/components/Informer/Informer.tsx"],"sourcesContent":["import './Informer.css';\n\nimport { classnames } from '@bem-react/classnames';\nimport { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { cn } from '../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes';\nimport { Text } from '../Text/Text';\nimport { useTheme } from '../Theme/Theme';\n\nexport const informerPropView = ['filled', 'bordered'] as const;\nexport type InformerPropView = typeof informerPropView[number];\nexport const informerPropViewDefault: InformerPropView = informerPropView[0];\n\nexport const informerPropStatus = [\n 'success',\n 'system',\n 'alert',\n 'alert',\n 'warning',\n] as const;\nexport type InformerPropStatus = typeof informerPropStatus[number];\nexport const informerPropStatusDefault: InformerPropStatus =\n informerPropStatus[0];\n\nexport const informerPropSize = ['m', 's'] as const;\nexport type InformerPropSize = typeof informerPropSize[number];\nexport const informerPropSiseDefault: InformerPropSize = informerPropSize[0];\n\ntype Props = {\n view?: InformerPropView;\n status?: InformerPropStatus;\n icon?: IconComponent;\n label?: React.ReactNode;\n title?: string;\n size?: InformerPropSize;\n};\n\nexport type InformerProps = PropsWithHTMLAttributes<Props, HTMLDivElement>;\n\nexport const cnInformer = cn('Informer');\n\nexport const Informer = React.forwardRef<HTMLDivElement, InformerProps>(\n (props, ref) => {\n const {\n view = informerPropViewDefault,\n status = informerPropStatusDefault,\n size = informerPropSiseDefault,\n icon,\n label,\n title,\n children,\n ...otherProps\n } = props;\n const Icon = icon;\n const withIcon = !!icon;\n const { themeClassNames } = useTheme();\n const className =\n status !== 'system' && view === 'filled'\n ? classnames(props.className, themeClassNames.color.accent)\n : props.className;\n\n return (\n <div\n {...otherProps}\n className={cnInformer(\n {\n view,\n status,\n withIcon,\n },\n [className],\n )}\n ref={ref}\n >\n {Icon && <Icon className={cnInformer('Icon')} size=\"s\" />}\n <div className={cnInformer('Content')}>\n {title && (\n <Text className={cnInformer('Title')} weight=\"bold\" size={size}>\n {title}\n </Text>\n )}\n {label ? (\n <Text className={cnInformer('Label')} size={size}>\n {label}\n </Text>\n ) : (\n children\n )}\n </div>\n </div>\n );\n },\n);\n"],"mappings":"8JAAA,uBAEA,OAASA,UAAT,KAA2B,uBAA3B,CAEA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,uBAEA,OAASC,IAAT,oBACA,OAASC,QAAT,sBAEA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,QAAD,CAAW,UAAX,CAAzB,CAEP,MAAO,IAAMC,wBAAyC,CAAGD,gBAAgB,CAAC,CAAD,CAAlE,CAEP,MAAO,IAAME,mBAAkB,CAAG,CAChC,SADgC,CAEhC,QAFgC,CAGhC,OAHgC,CAIhC,OAJgC,CAKhC,SALgC,CAA3B,CAQP,MAAO,IAAMC,0BAA6C,CACxDD,kBAAkB,CAAC,CAAD,CADb,CAGP,MAAO,IAAME,iBAAg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IAAD,EAAM,SAAS,CAAEV,UAAU,CAAC,OAAD,CAA3B,CAAsC,MAAM,CAAC,MAA7C,CAAoD,IAAI,CAAEO,CAA1D,EACGG,CADH,CAFJ,CAMGD,CAAK,CACJ,oBAAC,IAAD,EAAM,SAAS,CAAET,UAAU,CAAC,OAAD,CAA3B,CAAsC,IAAI,CAAEO,CAA5C,EACGE,CADH,CADI,CAKJE,CAXJ,CAbF,CA6BH,CAlDqB,CAAjB"}
1
+ {"version":3,"file":"Informer.js","names":["classnames","React","cnMixSpace","cn","Text","useTheme","informerPropView","informerPropViewDefault","informerPropStatus","informerPropStatusDefault","informerPropSize","informerPropSiseDefault","cnInformer","Informer","forwardRef","props","ref","view","status","size","icon","label","title","children","otherProps","Icon","themeClassNames","className","color","accent","withIcon","p","mB"],"sources":["../../../../../src/components/Informer/Informer.tsx"],"sourcesContent":["import './Informer.css';\n\nimport { classnames } from '@bem-react/classnames';\nimport { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { cnMixSpace } from '##/mixs/MixSpace';\n\nimport { cn } from '../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes';\nimport { Text } from '../Text/Text';\nimport { useTheme } from '../Theme/Theme';\n\nexport const informerPropView = ['filled', 'bordered'] as const;\nexport type InformerPropView = typeof informerPropView[number];\nexport const informerPropViewDefault: InformerPropView = informerPropView[0];\n\nexport const informerPropStatus = [\n 'success',\n 'system',\n 'alert',\n 'warning',\n] as const;\nexport type InformerPropStatus = typeof informerPropStatus[number];\nexport const informerPropStatusDefault: InformerPropStatus =\n informerPropStatus[0];\n\nexport const informerPropSize = ['m', 's'] as const;\nexport type InformerPropSize = typeof informerPropSize[number];\nexport const informerPropSiseDefault: InformerPropSize = informerPropSize[0];\n\ntype Props = {\n view?: InformerPropView;\n status?: InformerPropStatus;\n icon?: IconComponent;\n label?: React.ReactNode;\n title?: string;\n size?: InformerPropSize;\n};\n\nexport type InformerProps = PropsWithHTMLAttributes<Props, HTMLDivElement>;\n\nexport const cnInformer = cn('Informer');\n\nexport const Informer = React.forwardRef<HTMLDivElement, InformerProps>(\n (props, ref) => {\n const {\n view = informerPropViewDefault,\n status = informerPropStatusDefault,\n size = informerPropSiseDefault,\n icon,\n label,\n title,\n children,\n ...otherProps\n } = props;\n const Icon = icon;\n const withIcon = !!icon;\n const { themeClassNames } = useTheme();\n const className =\n status !== 'system' && view === 'filled'\n ? classnames(props.className, themeClassNames.color.accent)\n : props.className;\n\n return (\n <div\n {...otherProps}\n className={cnInformer(\n {\n view,\n status,\n withIcon,\n },\n [className, cnMixSpace({ p: size })],\n )}\n ref={ref}\n >\n {Icon && <Icon className={cnInformer('Icon')} size=\"s\" />}\n <div className={cnInformer('Content')}>\n {title && (\n <Text\n lineHeight=\"xs\"\n className={cnInformer('Title', [cnMixSpace({ mB: '2xs' })])}\n weight=\"bold\"\n size={size}\n >\n {title}\n </Text>\n )}\n {label ? (\n <Text lineHeight=\"xs\" className={cnInformer('Label')} size={size}>\n {label}\n </Text>\n ) : (\n children\n )}\n </div>\n </div>\n );\n },\n);\n"],"mappings":"8JAAA,uBAEA,OAASA,UAAT,KAA2B,uBAA3B,CAEA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,UAAT,2BAEA,OAASC,EAAT,uBAEA,OAASC,IAAT,oBACA,OAASC,QAAT,sBAEA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,QAAD,CAAW,UAAX,CAAzB,CAEP,MAAO,IAAMC,wBAAyC,CAAGD,gBAAgB,CAAC,CAAD,CAAlE,CAEP,MAAO,IAAME,mBAAkB,CAAG,CAChC,SADgC,CAEhC,QAFgC,CAGhC,OAHgC,CAIhC,SAJgC,CAA3B,CAOP,MAAO,IAAMC,0BAA6C,CACxDD,kBAAkB,CAAC,CAAD,CADb,CAGP,MAAO,IAAME,iBAAgB,CAAG,CAAC,GAAD,CAAM,GAAN,CAAzB,CAEP,MAAO,IAAMC,wBAAyC,CAAGD,gBAAgB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AAC,IADb,CAEE,SAAS,CAAEV,UAAU,CAAC,OAAD,CAAU,CAACV,UAAU,CAAC,CAAE8B,EAAE,CAAE,KAAN,CAAD,CAAX,CAAV,CAFvB,CAGE,MAAM,CAAC,MAHT,CAIE,IAAI,CAAEb,CAJR,EAMGG,CANH,CAFJ,CAWGD,CAAK,CACJ,oBAAC,IAAD,EAAM,UAAU,CAAC,IAAjB,CAAsB,SAAS,CAAET,UAAU,CAAC,OAAD,CAA3C,CAAsD,IAAI,CAAEO,CAA5D,EACGE,CADH,CADI,CAKJE,CAhBJ,CAbF,CAkCH,CAvDqB,CAAjB"}
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","innerOffset","className","space"];import"./ListDivider.css";import React,{forwardRef}from"react";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{mapGroupVerticalSpaseBottom,mapGroupVerticalSpaseTop,mapHorisontalSpase,mapHorisontalSpaseIncreased}from"../maps";import{defaultListPropSize}from"../types";export var cnListDivider=cn("ListDivider");export var ListDivider=forwardRef(function(a,b){var c=a.size,d=void 0===c?defaultListPropSize:c,e=a.innerOffset,f=a.className,g=a.space,h=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},h,{ref:b,className:cnListDivider(null,[cnMixSpace(g||{mH:"increased"===e?mapHorisontalSpaseIncreased[d]:mapHorisontalSpase[d],mT:mapGroupVerticalSpaseTop[d],mB:mapGroupVerticalSpaseBottom[d]}),f])}))});
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","innerOffset","className","space"];import"./ListDivider.css";import React,{forwardRef}from"react";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{mapDividerVerticalSpace,mapHorisontalSpase,mapHorisontalSpaseIncreased}from"../maps";import{defaultListPropSize}from"../types";export var cnListDivider=cn("ListDivider");export var ListDivider=forwardRef(function(a,b){var c=a.size,d=void 0===c?defaultListPropSize:c,e=a.innerOffset,f=a.className,g=a.space,h=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},h,{ref:b,className:cnListDivider(null,[cnMixSpace(g||{mH:"increased"===e?mapHorisontalSpaseIncreased[d]:mapHorisontalSpase[d],mV:mapDividerVerticalSpace[d]}),f])}))});
2
2
  //# sourceMappingURL=ListDivider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListDivider.js","names":["React","forwardRef","cnMixSpace","cn","mapGroupVerticalSpaseBottom","mapGroupVerticalSpaseTop","mapHorisontalSpase","mapHorisontalSpaseIncreased","defaultListPropSize","cnListDivider","ListDivider","props","ref","size","innerOffset","className","space","otherProps","mH","mT","mB"],"sources":["../../../../../../src/components/ListCanary/ListDivider/ListDivider.tsx"],"sourcesContent":["import './ListDivider.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport {\n mapGroupVerticalSpaseBottom,\n mapGroupVerticalSpaseTop,\n mapHorisontalSpase,\n mapHorisontalSpaseIncreased,\n} from '../maps';\nimport { defaultListPropSize, ListDividerProps } from '../types';\n\nexport const cnListDivider = cn('ListDivider');\n\nexport const ListDivider = forwardRef<HTMLDivElement, ListDividerProps>(\n (props, ref) => {\n const {\n size = defaultListPropSize,\n innerOffset,\n className,\n space,\n ...otherProps\n } = props;\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnListDivider(null, [\n cnMixSpace(\n space || {\n mH:\n innerOffset === 'increased'\n ? mapHorisontalSpaseIncreased[size]\n : mapHorisontalSpase[size],\n mT: mapGroupVerticalSpaseTop[size],\n mB: mapGroupVerticalSpaseBottom[size],\n },\n ),\n className,\n ])}\n />\n );\n },\n);\n"],"mappings":"8IAAA,0BAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,UAAT,8BACA,OAASC,EAAT,0BAEA,OACEC,2BADF,CAEEC,wBAFF,CAGEC,kBAHF,CAIEC,2BAJF,eAMA,OAASC,mBAAT,gBAEA,MAAO,IAAMC,cAAa,CAAGN,EAAE,CAAC,aAAD,CAAxB,CAEP,MAAO,IAAMO,YAAW,CAAGT,UAAU,CACnC,SAACU,CAAD,CAAQC,CAAR,CAAgB,CACd,MAMID,CANJ,CACEE,IADF,CACEA,CADF,YACSL,mBADT,GAEEM,CAFF,CAMIH,CANJ,CAEEG,WAFF,CAGEC,CAHF,CAMIJ,CANJ,CAGEI,SAHF,CAIEC,CAJF,CAMIL,CANJ,CAIEK,KAJF,CAKKC,CALL,0BAMIN,CANJ,YAQA,MACE,4CACMM,CADN,EAEE,GAAG,CAAEL,CAFP,CAGE,SAAS,CAAEH,aAAa,CAAC,IAAD,CAAO,CAC7BP,UAAU,CACRc,CAAK,EAAI,CACPE,EAAE,CACgB,WAAhB,GAAAJ,CAAW,CACPP,2BAA2B,CAACM,CAAD,CADpB,CAEPP,kBAAkB,CAACO,CAAD,CAJjB,CAKPM,EAAE,CAAEd,wBAAwB,CAACQ,CAAD,CALrB,CAMPO,EAAE,CAAEhB,2BAA2B,CAACS,CAAD,CANxB,CADD,CADmB,CAW7BE,CAX6B,CAAP,CAH1B,GAkBH,CA7BkC,CAA9B"}
1
+ {"version":3,"file":"ListDivider.js","names":["React","forwardRef","cnMixSpace","cn","mapDividerVerticalSpace","mapHorisontalSpase","mapHorisontalSpaseIncreased","defaultListPropSize","cnListDivider","ListDivider","props","ref","size","innerOffset","className","space","otherProps","mH","mV"],"sources":["../../../../../../src/components/ListCanary/ListDivider/ListDivider.tsx"],"sourcesContent":["import './ListDivider.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport {\n mapDividerVerticalSpace,\n mapHorisontalSpase,\n mapHorisontalSpaseIncreased,\n} from '../maps';\nimport { defaultListPropSize, ListDividerProps } from '../types';\n\nexport const cnListDivider = cn('ListDivider');\n\nexport const ListDivider = forwardRef<HTMLDivElement, ListDividerProps>(\n (props, ref) => {\n const {\n size = defaultListPropSize,\n innerOffset,\n className,\n space,\n ...otherProps\n } = props;\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnListDivider(null, [\n cnMixSpace(\n space || {\n mH:\n innerOffset === 'increased'\n ? mapHorisontalSpaseIncreased[size]\n : mapHorisontalSpase[size],\n mV: mapDividerVerticalSpace[size],\n },\n ),\n className,\n ])}\n />\n );\n },\n);\n"],"mappings":"8IAAA,0BAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,UAAT,8BACA,OAASC,EAAT,0BAEA,OACEC,uBADF,CAEEC,kBAFF,CAGEC,2BAHF,eAKA,OAASC,mBAAT,gBAEA,MAAO,IAAMC,cAAa,CAAGL,EAAE,CAAC,aAAD,CAAxB,CAEP,MAAO,IAAMM,YAAW,CAAGR,UAAU,CACnC,SAACS,CAAD,CAAQC,CAAR,CAAgB,CACd,MAMID,CANJ,CACEE,IADF,CACEA,CADF,YACSL,mBADT,GAEEM,CAFF,CAMIH,CANJ,CAEEG,WAFF,CAGEC,CAHF,CAMIJ,CANJ,CAGEI,SAHF,CAIEC,CAJF,CAMIL,CANJ,CAIEK,KAJF,CAKKC,CALL,0BAMIN,CANJ,YAQA,MACE,4CACMM,CADN,EAEE,GAAG,CAAEL,CAFP,CAGE,SAAS,CAAEH,aAAa,CAAC,IAAD,CAAO,CAC7BN,UAAU,CACRa,CAAK,EAAI,CACPE,EAAE,CACgB,WAAhB,GAAAJ,CAAW,CACPP,2BAA2B,CAACM,CAAD,CADpB,CAEPP,kBAAkB,CAACO,CAAD,CAJjB,CAKPM,EAAE,CAAEd,uBAAuB,CAACQ,CAAD,CALpB,CADD,CADmB,CAU7BE,CAV6B,CAAP,CAH1B,GAiBH,CA5BkC,CAA9B"}
@@ -7,3 +7,4 @@ export declare const mapGroupVerticalSpaseTop: Record<ListPropSize, Space>;
7
7
  export declare const mapGroupVerticalSpaseBottom: Record<ListPropSize, Space>;
8
8
  export declare const mapItemVerticalPadding: Record<ListPropSize, Space>;
9
9
  export declare const mapIconSize: Record<ListPropSize, IconPropSize>;
10
+ export declare const mapDividerVerticalSpace: Record<ListPropSize, Space>;
@@ -1,2 +1,2 @@
1
- export var mapHorisontalSpase={xs:"xs",s:"xs",m:"s",l:"s"};export var mapHorisontalSpaseIncreased={xs:"s",s:"s",m:"m",l:"l"};export var mapGroupVerticalSpaseTop={xs:"s",s:"m",m:"m",l:"l"};export var mapGroupVerticalSpaseBottom={xs:"2xs",s:"2xs",m:"xs",l:"s"};export var mapItemVerticalPadding={xs:"2xs",s:"2xs",m:"xs",l:"xs"};export var mapIconSize={xs:"xs",s:"xs",m:"s",l:"s"};
1
+ export var mapHorisontalSpase={xs:"xs",s:"xs",m:"s",l:"s"};export var mapHorisontalSpaseIncreased={xs:"s",s:"s",m:"m",l:"l"};export var mapGroupVerticalSpaseTop={xs:"s",s:"m",m:"m",l:"l"};export var mapGroupVerticalSpaseBottom={xs:"2xs",s:"2xs",m:"xs",l:"s"};export var mapItemVerticalPadding={xs:"2xs",s:"2xs",m:"xs",l:"xs"};export var mapIconSize={xs:"xs",s:"xs",m:"s",l:"s"};export var mapDividerVerticalSpace={l:"m",m:"s",s:"xs",xs:"2xs"};
2
2
  //# sourceMappingURL=maps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"maps.js","names":["mapHorisontalSpase","xs","s","m","l","mapHorisontalSpaseIncreased","mapGroupVerticalSpaseTop","mapGroupVerticalSpaseBottom","mapItemVerticalPadding","mapIconSize"],"sources":["../../../../../src/components/ListCanary/maps.ts"],"sourcesContent":["import { IconPropSize } from '@consta/icons/Icon';\n\nimport { Space } from '##/mixs/MixSpace';\n\nimport { ListPropSize } from './types';\n\nexport const mapHorisontalSpase: Record<ListPropSize, Space> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 's',\n};\n\nexport const mapHorisontalSpaseIncreased: Record<ListPropSize, Space> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nexport const mapGroupVerticalSpaseTop: Record<ListPropSize, Space> = {\n xs: 's',\n s: 'm',\n m: 'm',\n l: 'l',\n};\n\nexport const mapGroupVerticalSpaseBottom: Record<ListPropSize, Space> = {\n xs: '2xs',\n s: '2xs',\n m: 'xs',\n l: 's',\n};\n\nexport const mapItemVerticalPadding: Record<ListPropSize, Space> = {\n xs: '2xs',\n s: '2xs',\n m: 'xs',\n l: 'xs',\n};\n\nexport const mapIconSize: Record<ListPropSize, IconPropSize> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 's',\n};\n"],"mappings":"AAMA,MAAO,IAAMA,mBAA+C,CAAG,CAC7DC,EAAE,CAAE,IADyD,CAE7DC,CAAC,CAAE,IAF0D,CAG7DC,CAAC,CAAE,GAH0D,CAI7DC,CAAC,CAAE,GAJ0D,CAAxD,CAOP,MAAO,IAAMC,4BAAwD,CAAG,CACtEJ,EAAE,CAAE,GADkE,CAEtEC,CAAC,CAAE,GAFmE,CAGtEC,CAAC,CAAE,GAHmE,CAItEC,CAAC,CAAE,GAJmE,CAAjE,CAOP,MAAO,IAAME,yBAAqD,CAAG,CACnEL,EAAE,CAAE,GAD+D,CAEnEC,CAAC,CAAE,GAFgE,CAGnEC,CAAC,CAAE,GAHgE,CAInEC,CAAC,CAAE,GAJgE,CAA9D,CAOP,MAAO,IAAMG,4BAAwD,CAAG,CACtEN,EAAE,CAAE,KADkE,CAEtEC,CAAC,CAAE,KAFmE,CAGtEC,CAAC,CAAE,IAHmE,CAItEC,CAAC,CAAE,GAJmE,CAAjE,CAOP,MAAO,IAAMI,uBAAmD,CAAG,CACjEP,EAAE,CAAE,KAD6D,CAEjEC,CAAC,CAAE,KAF8D,CAGjEC,CAAC,CAAE,IAH8D,CAIjEC,CAAC,CAAE,IAJ8D,CAA5D,CAOP,MAAO,IAAMK,YAA+C,CAAG,CAC7DR,EAAE,CAAE,IADyD,CAE7DC,CAAC,CAAE,IAF0D,CAG7DC,CAAC,CAAE,GAH0D,CAI7DC,CAAC,CAAE,GAJ0D,CAAxD"}
1
+ {"version":3,"file":"maps.js","names":["mapHorisontalSpase","xs","s","m","l","mapHorisontalSpaseIncreased","mapGroupVerticalSpaseTop","mapGroupVerticalSpaseBottom","mapItemVerticalPadding","mapIconSize","mapDividerVerticalSpace"],"sources":["../../../../../src/components/ListCanary/maps.ts"],"sourcesContent":["import { IconPropSize } from '@consta/icons/Icon';\n\nimport { Space } from '##/mixs/MixSpace';\n\nimport { ListPropSize } from './types';\n\nexport const mapHorisontalSpase: Record<ListPropSize, Space> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 's',\n};\n\nexport const mapHorisontalSpaseIncreased: Record<ListPropSize, Space> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nexport const mapGroupVerticalSpaseTop: Record<ListPropSize, Space> = {\n xs: 's',\n s: 'm',\n m: 'm',\n l: 'l',\n};\n\nexport const mapGroupVerticalSpaseBottom: Record<ListPropSize, Space> = {\n xs: '2xs',\n s: '2xs',\n m: 'xs',\n l: 's',\n};\n\nexport const mapItemVerticalPadding: Record<ListPropSize, Space> = {\n xs: '2xs',\n s: '2xs',\n m: 'xs',\n l: 'xs',\n};\n\nexport const mapIconSize: Record<ListPropSize, IconPropSize> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 's',\n};\n\nexport const mapDividerVerticalSpace: Record<ListPropSize, Space> = {\n l: 'm',\n m: 's',\n s: 'xs',\n xs: '2xs',\n};\n"],"mappings":"AAMA,MAAO,IAAMA,mBAA+C,CAAG,CAC7DC,EAAE,CAAE,IADyD,CAE7DC,CAAC,CAAE,IAF0D,CAG7DC,CAAC,CAAE,GAH0D,CAI7DC,CAAC,CAAE,GAJ0D,CAAxD,CAOP,MAAO,IAAMC,4BAAwD,CAAG,CACtEJ,EAAE,CAAE,GADkE,CAEtEC,CAAC,CAAE,GAFmE,CAGtEC,CAAC,CAAE,GAHmE,CAItEC,CAAC,CAAE,GAJmE,CAAjE,CAOP,MAAO,IAAME,yBAAqD,CAAG,CACnEL,EAAE,CAAE,GAD+D,CAEnEC,CAAC,CAAE,GAFgE,CAGnEC,CAAC,CAAE,GAHgE,CAInEC,CAAC,CAAE,GAJgE,CAA9D,CAOP,MAAO,IAAMG,4BAAwD,CAAG,CACtEN,EAAE,CAAE,KADkE,CAEtEC,CAAC,CAAE,KAFmE,CAGtEC,CAAC,CAAE,IAHmE,CAItEC,CAAC,CAAE,GAJmE,CAAjE,CAOP,MAAO,IAAMI,uBAAmD,CAAG,CACjEP,EAAE,CAAE,KAD6D,CAEjEC,CAAC,CAAE,KAF8D,CAGjEC,CAAC,CAAE,IAH8D,CAIjEC,CAAC,CAAE,IAJ8D,CAA5D,CAOP,MAAO,IAAMK,YAA+C,CAAG,CAC7DR,EAAE,CAAE,IADyD,CAE7DC,CAAC,CAAE,IAF0D,CAG7DC,CAAC,CAAE,GAH0D,CAI7DC,CAAC,CAAE,GAJ0D,CAAxD,CAOP,MAAO,IAAMM,wBAAoD,CAAG,CAClEN,CAAC,CAAE,GAD+D,CAElED,CAAC,CAAE,GAF+D,CAGlED,CAAC,CAAE,IAH+D,CAIlED,EAAE,CAAE,KAJ8D,CAA7D"}
@@ -1 +1 @@
1
- .Popover{left:var(--popover-left);pointer-events:var(--popover-pointer-events);position:absolute;top:var(--popover-top);visibility:var(--popover-visibility);width:var(--popover-width)}
1
+ .Popover{left:var(--popover-left);pointer-events:var(--popover-pointer-events);position:absolute;top:var(--popover-top);visibility:var(--popover-visibility);width:var(--popover-width)}.Popover_notVisible{left:-100vw;pointer-events:none;position:absolute;top:-100vh;visibility:hidden}
@@ -1,9 +1,7 @@
1
1
  import './Popover.css';
2
2
  import React from 'react';
3
- import { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';
4
- import { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';
5
- import { usePopoverReposition } from './usePopoverReposition';
6
- export { usePopoverReposition };
3
+ import { ClickOutsideHandler } from "../../hooks/useClickOutside";
4
+ import { PropsWithJsxAttributes } from "../../utils/types/PropsWithJsxAttributes";
7
5
  /**
8
6
  * Стороны упорядочены по приоритету:
9
7
  * Используется первая сторона, в которую смог вписаться поповер.
@@ -40,3 +38,4 @@ export declare type Props = PropsWithJsxAttributes<{
40
38
  onSetDirection?: (direction: Direction) => void;
41
39
  } & PositioningProps>;
42
40
  export declare const Popover: React.ForwardRefExoticComponent<Pick<Props, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "direction" | "offset" | "position" | "arrowOffset" | "possibleDirections" | "spareDirection" | "isInteractive" | "onClickOutside" | "onSetDirection" | "anchorRef" | "equalAnchorWidth"> & React.RefAttributes<HTMLDivElement>>;
41
+ export {};
@@ -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";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var _excluded=["children","direction","offset","arrowOffset","possibleDirections","isInteractive","onClickOutside","spareDirection","style","className","position","anchorRef","equalAnchorWidth","onSetDirection"];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"./Popover.css";import React,{forwardRef,useEffect,useLayoutEffect,useMemo}from"react";import{useClickOutside}from"../../hooks/useClickOutside/useClickOutside";import{useComponentSize}from"../../hooks/useComponentSize/useComponentSize";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{cn}from"../../utils/bem";import{isNumber,isString}from"../../utils/type-guards";import{PortalWithTheme,usePortalContext}from"../PortalWithTheme/PortalWithTheme";import{useTheme}from"../Theme/Theme";import{getComputedPositionAndDirection}from"./helpers";import{usePopoverReposition}from"./usePopoverReposition";export{usePopoverReposition};export var directionsStartCenter=["downCenter","upCenter","downRight","downLeft","upRight","upLeft","leftUp","leftCenter","leftDown","rightUp","rightCenter","rightDown"];export var directionsStartEdge=["downStartLeft","upStartLeft","downStartRight","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown"];export var popoverPropOffset=["3xs","2xs","xs","s","m","l","xl","2xl","3xl","4xl","5xl","6xl"];export var directions=[].concat(directionsStartCenter,directionsStartEdge);var getOffset=function(a,b){if(isNumber(b))return b;if(isString(b)&&a.current){var g=getComputedStyle(a.current).getPropertyValue("--space-".concat(b));if(g&&/px$/.test(g))return+g.slice(0,g.length-2);if(g&&/rem$/.test(g)){var c=parseFloat(getComputedStyle(document.documentElement).fontSize),d=+g.slice(0,g.length-3);return c*d}if(g&&/em$/.test(g)){var e=parseFloat(getComputedStyle(a.current).fontSize),f=+g.slice(0,g.length-2);return e*f}return 0}return 0},isRenderProp=function(a){return"function"==typeof a},ContextConsumer=function(a){var b=a.onClickOutside,c=a.children,d=a.ignoreClicksInsideRefs,e=usePortalContext(),f=e.refs;return useClickOutside({isActive:!!b,ignoreClicksInsideRefs:[].concat(_toConsumableArray(d||[]),_toConsumableArray(f||[])),handler:b}),c},cnPopover=cn("Popover");export var Popover=forwardRef(function(a,b){var c,d=a.children,e=a.direction,f=void 0===e?"upCenter":e,g=a.offset,h=void 0===g?0:g,i=a.arrowOffset,j=a.possibleDirections,k=void 0===j?directions:j,l=a.isInteractive,m=a.onClickOutside,n=a.spareDirection,o=void 0===n?"downStartLeft":n,p=a.style,q=a.className,r=a.position,s=a.anchorRef,t=a.equalAnchorWidth,u=a.onSetDirection,v=_objectWithoutProperties(a,_excluded),w=React.useRef(null),x=useTheme(),y=x.theme,z=React.useState(),A=_slicedToArray(z,2),B=A[0],C=A[1],D=useComponentSize(w),E=D.width,F=D.height,G=useComponentSize(s||{current:null}),H=React.useRef(null),I=React.useState([]),J=_slicedToArray(I,2),K=J[0],L=J[1],M=function(){L(function(a){return a.length?[]:a}),H.current=null},N=function(){var a;return C(null===s||void 0===s||null===(a=s.current)||void 0===a?void 0:a.getBoundingClientRect())},O=useMemo(function(){return getOffset(w,h)},[h,!!w.current]),P=getComputedPositionAndDirection({contentSize:{width:E,height:F},viewportSize:{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight},arrowOffset:i,offset:O,direction:f,possibleDirections:k,bannedDirections:K,position:B?{x:B.left,y:B.top}:r,anchorSize:G,spareDirection:o}),Q=P.position,R=P.direction;return useLayoutEffect(function(){return null===u||void 0===u?void 0:u(R)},[R]),useEffect(N,[G]),usePopoverReposition({isActive:!0,scrollAnchorRef:s||{current:null},onRequestReposition:function onRequestReposition(){M(),N()}}),useLayoutEffect(function(){H.current!==R&&(H.current&&!K.includes(H.current)&&!K.includes(R)&&R!==o&&L(function(a){return H.current?[].concat(_toConsumableArray(a),[H.current]):a}),H.current=R)},[R]),useLayoutEffect(M,[a]),React.createElement(PortalWithTheme,Object.assign({},v,{preset:y,className:cnPopover({direction:R},[q]),container:window.document.body,ref:useForkRef([w,b]),style:_objectSpread(_objectSpread({},p),{},(c={},_defineProperty(c,"--popover-top","".concat(((null===Q||void 0===Q?void 0:Q.y)||0)+window.scrollY,"px")),_defineProperty(c,"--popover-left","".concat(((null===Q||void 0===Q?void 0:Q.x)||0)+window.scrollX,"px")),_defineProperty(c,"--popover-width",t?"".concat(G.width,"px"):void 0),_defineProperty(c,"--popover-pointer-events",void 0===l||l?void 0:"none"),_defineProperty(c,"--popover-visibility",Q?void 0:"hidden"),c))}),React.createElement(ContextConsumer,{onClickOutside:m,ignoreClicksInsideRefs:[w,s||{current:null}]},isRenderProp(d)?d(R):d))});
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var _excluded=["children","direction","offset","arrowOffset","possibleDirections","isInteractive","onClickOutside","spareDirection","style","className","position","anchorRef","equalAnchorWidth","onSetDirection"];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"./Popover.css";import React,{forwardRef,useEffect,useLayoutEffect,useMemo}from"react";import{PortalWithTheme,usePortalContext}from"../PortalWithTheme";import{useTheme}from"../Theme/Theme";import{useClickOutside}from"../../hooks/useClickOutside";import{useComponentSize}from"../../hooks/useComponentSize";import{useForkRef}from"../../hooks/useForkRef";import{cn}from"../../utils/bem";import{isRenderProp}from"../../utils/isRenderProp";import{isNumber,isString}from"../../utils/type-guards";import{getComputedPositionAndDirection}from"./helpers";import{usePopoverReposition}from"./usePopoverReposition";export var directionsStartCenter=["downCenter","upCenter","downRight","downLeft","upRight","upLeft","leftUp","leftCenter","leftDown","rightUp","rightCenter","rightDown"];export var directionsStartEdge=["downStartLeft","upStartLeft","downStartRight","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown"];export var popoverPropOffset=["3xs","2xs","xs","s","m","l","xl","2xl","3xl","4xl","5xl","6xl"];export var directions=[].concat(directionsStartCenter,directionsStartEdge);var getOffset=function(a,b){if(isNumber(b))return b;if(isString(b)&&a.current){var g=getComputedStyle(a.current).getPropertyValue("--space-".concat(b));if(g&&/px$/.test(g))return+g.slice(0,g.length-2);if(g&&/rem$/.test(g)){var c=parseFloat(getComputedStyle(document.documentElement).fontSize),d=+g.slice(0,g.length-3);return c*d}if(g&&/em$/.test(g)){var e=parseFloat(getComputedStyle(a.current).fontSize),f=+g.slice(0,g.length-2);return e*f}return 0}return 0},ContextConsumer=function(a){var b=a.onClickOutside,c=a.children,d=a.ignoreClicksInsideRefs,e=usePortalContext(),f=e.refs;return useClickOutside({isActive:!!b,ignoreClicksInsideRefs:[].concat(_toConsumableArray(d||[]),_toConsumableArray(f||[])),handler:b}),c},cnPopover=cn("Popover");export var Popover=forwardRef(function(a,b){var c,d=a.children,e=a.direction,f=void 0===e?"upCenter":e,g=a.offset,h=void 0===g?0:g,i=a.arrowOffset,j=a.possibleDirections,k=void 0===j?directions:j,l=a.isInteractive,m=a.onClickOutside,n=a.spareDirection,o=void 0===n?"downStartLeft":n,p=a.style,q=a.className,r=a.position,s=a.anchorRef,t=a.equalAnchorWidth,u=a.onSetDirection,v=_objectWithoutProperties(a,_excluded),w=React.useRef(null),x=useTheme(),y=x.theme,z=React.useState(),A=_slicedToArray(z,2),B=A[0],C=A[1],D=useComponentSize(w),E=D.width,F=D.height,G=useComponentSize(s||{current:null}),H=React.useRef(null),I=React.useState([]),J=_slicedToArray(I,2),K=J[0],L=J[1],M=function(){L(function(a){return a.length?[]:a}),H.current=null},N=function(){var a;return C(null===s||void 0===s||null===(a=s.current)||void 0===a?void 0:a.getBoundingClientRect())},O=useMemo(function(){return getOffset(w,h)},[h,!!w.current]),P=getComputedPositionAndDirection({contentSize:{width:E,height:F},viewportSize:{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight},arrowOffset:i,offset:O,direction:f,possibleDirections:k,bannedDirections:K,position:B?{x:B.left,y:B.top}:r,anchorSize:G,spareDirection:o}),Q=P.position,R=P.direction;useEffect(function(){return null===u||void 0===u?void 0:u(R)},[R]),useEffect(N,[G]),usePopoverReposition({isActive:!0,scrollAnchorRef:s||{current:null},onRequestReposition:function onRequestReposition(){M(),N()}}),useLayoutEffect(function(){H.current!==R&&(H.current&&!K.includes(H.current)&&!K.includes(R)&&R!==o&&L(function(a){return H.current?[].concat(_toConsumableArray(a),[H.current]):a}),H.current=R)},[R]),useLayoutEffect(M,[a]);var S=!Q||!F||!E;return React.createElement(PortalWithTheme,Object.assign({},v,{preset:y,className:cnPopover({direction:R,notVisible:S},[q]),container:window.document.body,ref:useForkRef([w,b]),style:_objectSpread(_objectSpread({},p),S?{}:(c={},_defineProperty(c,"--popover-top","".concat(((null===Q||void 0===Q?void 0:Q.y)||0)+window.scrollY,"px")),_defineProperty(c,"--popover-left","".concat(((null===Q||void 0===Q?void 0:Q.x)||0)+window.scrollX,"px")),_defineProperty(c,"--popover-width",t?"".concat(G.width,"px"):void 0),_defineProperty(c,"--popover-pointer-events",!(void 0!==l)||l?void 0:"none"),_defineProperty(c,"--popover-visibility",Q?void 0:"hidden"),c))}),React.createElement(ContextConsumer,{onClickOutside:m,ignoreClicksInsideRefs:[w,s||{current:null}]},isRenderProp(d)?d(R):d))});
2
2
  //# sourceMappingURL=Popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","names":["React","forwardRef","useEffect","useLayoutEffect","useMemo","useClickOutside","useComponentSize","useForkRef","cn","isNumber","isString","PortalWithTheme","usePortalContext","useTheme","getComputedPositionAndDirection","usePopoverReposition","directionsStartCenter","directionsStartEdge","popoverPropOffset","directions","getOffset","ref","propOffset","current","cssVar","getComputedStyle","getPropertyValue","test","slice","length","fontSize","parseFloat","document","documentElement","rem","em","isRenderProp","children","ContextConsumer","onClickOutside","ignoreClicksInsideRefs","refs","isActive","handler","cnPopover","Popover","props","componentRef","direction","passedDirection","offset","arrowOffset","possibleDirections","isInteractive","spareDirection","style","className","passedPosition","position","anchorRef","equalAnchorWidth","onSetDirection","otherProps","useRef","theme","useState","anchorClientRect","setAnchorClientRect","width","height","anchorSize","previousDirectionRef","bannedDirections","setBannedDirections","resetBannedDirections","state","updateAnchorClientRect","getBoundingClientRect","contentSize","viewportSize","clientWidth","clientHeight","x","left","y","top","scrollAnchorRef","onRequestReposition","includes","window","body","scrollY","scrollX"],"sources":["../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import './Popover.css';\n\nimport React, { forwardRef, useEffect, useLayoutEffect, useMemo } from 'react';\n\nimport {\n ClickOutsideHandler,\n useClickOutside,\n} from '../../hooks/useClickOutside/useClickOutside';\nimport { useComponentSize } from '../../hooks/useComponentSize/useComponentSize';\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cn } from '../../utils/bem';\nimport { isNumber, isString } from '../../utils/type-guards';\nimport { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';\nimport {\n PortalWithTheme,\n usePortalContext,\n} from '../PortalWithTheme/PortalWithTheme';\nimport { useTheme } from '../Theme/Theme';\nimport { getComputedPositionAndDirection } from './helpers';\nimport { usePopoverReposition } from './usePopoverReposition';\n\nexport { usePopoverReposition };\n\n/**\n * Стороны упорядочены по приоритету:\n * Используется первая сторона, в которую смог вписаться поповер.\n */\nexport const directionsStartCenter = [\n 'downCenter',\n 'upCenter',\n\n 'downRight',\n 'downLeft',\n 'upRight',\n 'upLeft',\n\n 'leftUp',\n 'leftCenter',\n 'leftDown',\n\n 'rightUp',\n 'rightCenter',\n 'rightDown',\n] as const;\n\nexport const directionsStartEdge = [\n 'downStartLeft',\n 'upStartLeft',\n\n 'downStartRight',\n 'upStartRight',\n\n 'leftStartUp',\n 'leftStartDown',\n\n 'rightStartUp',\n 'rightStartDown',\n] as const;\n\nexport const popoverPropOffset = [\n '3xs',\n '2xs',\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n] as const;\nexport type PopoverPropOffset = typeof popoverPropOffset[number] | number;\n\nexport const directions = [...directionsStartCenter, ...directionsStartEdge];\n\nexport type Direction = typeof directions[number];\n\nexport type Position = { x: number; y: number } | undefined;\n\nexport type PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n equalAnchorWidth?: boolean;\n position?: never;\n }\n | {\n anchorRef?: never;\n equalAnchorWidth?: never;\n position: Position;\n };\n\ntype ChildrenRenderProp = (direction: Direction) => React.ReactNode;\n\nexport type Props = PropsWithJsxAttributes<\n {\n direction?: Direction;\n spareDirection?: Direction;\n offset?: PopoverPropOffset;\n arrowOffset?: number;\n possibleDirections?: readonly Direction[];\n isInteractive?: boolean;\n children: React.ReactNode | ChildrenRenderProp;\n onClickOutside?: ClickOutsideHandler;\n onSetDirection?: (direction: Direction) => void;\n } & PositioningProps\n>;\n\nconst getOffset = (\n ref: React.RefObject<HTMLDivElement>,\n propOffset: PopoverPropOffset,\n) => {\n if (isNumber(propOffset)) {\n return propOffset;\n }\n\n if (isString(propOffset) && ref.current) {\n const cssVar = getComputedStyle(ref.current).getPropertyValue(\n `--space-${propOffset}`,\n );\n\n if (cssVar && /px$/.test(cssVar)) {\n return Number(cssVar.slice(0, cssVar.length - 2));\n }\n\n if (cssVar && /rem$/.test(cssVar)) {\n const fontSize = parseFloat(\n getComputedStyle(document.documentElement).fontSize,\n );\n const rem = Number(cssVar.slice(0, cssVar.length - 3));\n\n return fontSize * rem;\n }\n\n if (cssVar && /em$/.test(cssVar)) {\n const fontSize = parseFloat(getComputedStyle(ref.current).fontSize);\n const em = Number(cssVar.slice(0, cssVar.length - 2));\n\n return fontSize * em;\n }\n\n return 0;\n }\n\n return 0;\n};\n\nconst isRenderProp = (\n children: React.ReactNode | ChildrenRenderProp,\n): children is ChildrenRenderProp => typeof children === 'function';\n\n/**\n * Подписчик на PortalWithThemeProvider\n * получает рефы всех вложенных порталов в модалку\n * для дальнейшего исключения их из useClickOutside\n */\nconst ContextConsumer: React.FC<{\n onClickOutside?: (event: MouseEvent) => void;\n ignoreClicksInsideRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n children: React.ReactNode;\n}> = ({ onClickOutside, children, ignoreClicksInsideRefs }) => {\n const { refs } = usePortalContext();\n\n useClickOutside({\n isActive: !!onClickOutside,\n ignoreClicksInsideRefs: [\n ...(ignoreClicksInsideRefs || []),\n ...(refs || []),\n ],\n handler: onClickOutside,\n });\n\n return children as React.ReactElement;\n};\n\nconst cnPopover = cn('Popover');\n\nexport const Popover = forwardRef<HTMLDivElement, Props>(\n (props, componentRef) => {\n const {\n children,\n direction: passedDirection = 'upCenter',\n offset: propOffset = 0,\n arrowOffset,\n possibleDirections = directions,\n isInteractive = true,\n onClickOutside,\n spareDirection = 'downStartLeft',\n style,\n className,\n position: passedPosition,\n anchorRef,\n equalAnchorWidth,\n onSetDirection,\n ...otherProps\n } = props;\n\n const ref = React.useRef<HTMLDivElement>(null);\n const { theme } = useTheme();\n\n const [anchorClientRect, setAnchorClientRect] = React.useState<\n DOMRect | undefined\n >();\n const { width, height } = useComponentSize(ref);\n const anchorSize = useComponentSize(anchorRef || { current: null });\n const previousDirectionRef = React.useRef<Direction | null>(null);\n const [bannedDirections, setBannedDirections] = React.useState<\n readonly Direction[]\n >([]);\n\n const resetBannedDirections = () => {\n setBannedDirections((state) => (state.length ? [] : state));\n previousDirectionRef.current = null;\n };\n\n const updateAnchorClientRect = () =>\n setAnchorClientRect(anchorRef?.current?.getBoundingClientRect());\n\n const offset = useMemo(\n () => getOffset(ref, propOffset),\n [propOffset, Boolean(ref.current)],\n );\n\n const { position, direction } = getComputedPositionAndDirection({\n contentSize: { width, height },\n viewportSize: {\n // Размер вьюпорта без скроллбаров\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n },\n arrowOffset,\n offset,\n direction: passedDirection,\n possibleDirections,\n bannedDirections,\n position: anchorClientRect\n ? { x: anchorClientRect.left, y: anchorClientRect.top }\n : passedPosition,\n anchorSize,\n spareDirection,\n });\n\n useLayoutEffect(() => onSetDirection?.(direction), [direction]);\n\n useEffect(updateAnchorClientRect, [anchorSize]);\n\n usePopoverReposition({\n isActive: true,\n scrollAnchorRef: anchorRef || { current: null },\n onRequestReposition: () => {\n resetBannedDirections();\n updateAnchorClientRect();\n },\n });\n\n /**\n * Может возникнуть ситуация, когда перерасчет поповера всегда будет выдавать 2 направления\n * и бесконечно зацикливать себя. Для избежания таких кейсов мы запоминаем стороны,\n * которые не подошли, чтобы не возвращаться к ним и предотвратить бесконечный ререндер.\n * См. PopoverBannedPositionsStory\n */\n\n useLayoutEffect(() => {\n if (previousDirectionRef.current !== direction) {\n if (\n previousDirectionRef.current &&\n !bannedDirections.includes(previousDirectionRef.current) &&\n !bannedDirections.includes(direction) &&\n direction !== spareDirection\n ) {\n setBannedDirections((state) =>\n previousDirectionRef.current\n ? [...state, previousDirectionRef.current]\n : state,\n );\n }\n previousDirectionRef.current = direction;\n }\n }, [direction]);\n\n // Сбрасываем при любом изменении пропсов, чтобы заново начать перебор направлений\n // Главное не сбрасывать при изменении размеров поповера, т.к. именно оно может вызвать бесконечный перебор\n\n useLayoutEffect(resetBannedDirections, [props]);\n\n return (\n <PortalWithTheme\n {...otherProps}\n preset={theme}\n className={cnPopover({ direction }, [className])}\n container={window.document.body}\n ref={useForkRef([ref, componentRef])}\n style={{\n ...style,\n ['--popover-top' as string]: `${\n (position?.y || 0) + window.scrollY\n }px`,\n ['--popover-left' as string]: `${\n (position?.x || 0) + window.scrollX\n }px`,\n [`--popover-width` as string]: equalAnchorWidth\n ? `${anchorSize.width}px`\n : undefined,\n [`--popover-pointer-events` as string]: isInteractive\n ? undefined\n : 'none',\n [`--popover-visibility` as string]: position ? undefined : 'hidden',\n }}\n >\n <ContextConsumer\n onClickOutside={onClickOutside}\n ignoreClicksInsideRefs={[ref, anchorRef || { current: null }]}\n >\n {isRenderProp(children) ? children(direction) : children}\n </ContextConsumer>\n </PortalWithTheme>\n );\n },\n);\n"],"mappings":"wlCAAA,sBAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,eAAvC,CAAwDC,OAAxD,KAAuE,OAAvE,CAEA,OAEEC,eAFF,mDAIA,OAASC,gBAAT,qDACA,OAASC,UAAT,yCACA,OAASC,EAAT,uBACA,OAASC,QAAT,CAAmBC,QAAnB,+BAEA,OACEC,eADF,CAEEC,gBAFF,0CAIA,OAASC,QAAT,sBACA,OAASC,+BAAT,iBACA,OAASC,oBAAT,8BAEA,OAASA,oBAAT,EAMA,MAAO,IAAMC,sBAAqB,CAAG,CACnC,YADmC,CAEnC,UAFmC,CAInC,WAJmC,CAKnC,UALmC,CAMnC,SANmC,CAOnC,QAPmC,CASnC,QATmC,CAUnC,YAVmC,CAWnC,UAXmC,CAanC,SAbmC,CAcnC,aAdmC,CAenC,WAfmC,CAA9B,CAkBP,MAAO,IAAMC,oBAAmB,CAAG,CACjC,eADiC,CAEjC,aAFiC,CAIjC,gBAJiC,CAKjC,cALiC,CAOjC,aAPiC,CAQjC,eARiC,CAUjC,cAViC,CAWjC,gBAXiC,CAA5B,CAcP,MAAO,IAAMC,kBAAiB,CAAG,CAC/B,KAD+B,CAE/B,KAF+B,CAG/B,IAH+B,CAI/B,GAJ+B,CAK/B,GAL+B,CAM/B,GAN+B,CAO/B,IAP+B,CAQ/B,KAR+B,CAS/B,KAT+B,CAU/B,KAV+B,CAW/B,KAX+B,CAY/B,KAZ+B,CAA1B,CAgBP,MAAO,IAAMC,WAAU,WAAOH,qBAAP,CA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CAgBZ,CAACA,CAAD,CAhBY,CAuBf,CAFA7C,eAAe,CAACuE,CAAD,CAAwB,CAAC5B,CAAD,CAAxB,CAEf,CACE,oBAAC,eAAD,kBACMgB,CADN,EAEE,MAAM,CAAEE,CAFV,CAGE,SAAS,CAAEpB,SAAS,CAAC,CAAEI,SAAS,CAATA,CAAF,CAAD,CAAgB,CAACQ,CAAD,CAAhB,CAHtB,CAIE,SAAS,CAAEiC,MAAM,CAACzD,QAAP,CAAgB0D,IAJ7B,CAKE,GAAG,CAAEnF,UAAU,CAAC,CAACc,CAAD,CAAM0B,CAAN,CAAD,CALjB,CAME,KAAK,gCACAQ,CADA,6BAEF,eAFE,WAGD,CAAC,QAAAG,CAAQ,WAARA,CAAA,QAAAA,CAAQ,CAAE0B,CAAV,GAAe,CAAhB,EAAqBK,MAAM,CAACE,OAH3B,0BAKF,gBALE,WAMD,CAAC,QAAAjC,CAAQ,WAARA,CAAA,QAAAA,CAAQ,CAAEwB,CAAV,GAAe,CAAhB,EAAqBO,MAAM,CAACG,OAN3B,4CAQ4BhC,CAAgB,WACxCU,CAAU,CAACF,KAD6B,aAR5C,+CAWqC,qBAEpC,MAbD,2CAciCV,CAAQ,QAAe,QAdxD,KANP,GAuBE,oBAAC,eAAD,EACE,cAAc,CAAEnB,CADlB,CAEE,sBAAsB,CAAE,CAAClB,CAAD,CAAMsC,CAAS,EAAI,CAAEpC,OAAO,CAAE,IAAX,CAAnB,CAF1B,EAIGa,YAAY,CAACC,CAAD,CAAZ,CAAyBA,CAAQ,CAACW,CAAD,CAAjC,CAA+CX,CAJlD,CAvBF,CA+BH,CA5I8B,CAA1B"}
1
+ {"version":3,"file":"Popover.js","names":["React","forwardRef","useEffect","useLayoutEffect","useMemo","PortalWithTheme","usePortalContext","useTheme","useClickOutside","useComponentSize","useForkRef","cn","isRenderProp","isNumber","isString","getComputedPositionAndDirection","usePopoverReposition","directionsStartCenter","directionsStartEdge","popoverPropOffset","directions","getOffset","ref","propOffset","current","cssVar","getComputedStyle","getPropertyValue","test","slice","length","fontSize","parseFloat","document","documentElement","rem","em","ContextConsumer","onClickOutside","children","ignoreClicksInsideRefs","refs","isActive","handler","cnPopover","Popover","props","componentRef","direction","passedDirection","offset","arrowOffset","possibleDirections","isInteractive","spareDirection","style","className","passedPosition","position","anchorRef","equalAnchorWidth","onSetDirection","otherProps","useRef","theme","useState","anchorClientRect","setAnchorClientRect","width","height","anchorSize","previousDirectionRef","bannedDirections","setBannedDirections","resetBannedDirections","state","updateAnchorClientRect","getBoundingClientRect","contentSize","viewportSize","clientWidth","clientHeight","x","left","y","top","scrollAnchorRef","onRequestReposition","includes","notVisible","window","body","scrollY","scrollX"],"sources":["../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import './Popover.css';\n\nimport React, { forwardRef, useEffect, useLayoutEffect, useMemo } from 'react';\n\nimport {\n PortalWithTheme,\n usePortalContext,\n} from '##/components/PortalWithTheme';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { ClickOutsideHandler, useClickOutside } from '##/hooks/useClickOutside';\nimport { useComponentSize } from '##/hooks/useComponentSize';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cn } from '##/utils/bem';\nimport { isRenderProp } from '##/utils/isRenderProp';\nimport { isNumber, isString } from '##/utils/type-guards';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport { getComputedPositionAndDirection } from './helpers';\nimport { usePopoverReposition } from './usePopoverReposition';\n\n/**\n * Стороны упорядочены по приоритету:\n * Используется первая сторона, в которую смог вписаться поповер.\n */\nexport const directionsStartCenter = [\n 'downCenter',\n 'upCenter',\n\n 'downRight',\n 'downLeft',\n 'upRight',\n 'upLeft',\n\n 'leftUp',\n 'leftCenter',\n 'leftDown',\n\n 'rightUp',\n 'rightCenter',\n 'rightDown',\n] as const;\n\nexport const directionsStartEdge = [\n 'downStartLeft',\n 'upStartLeft',\n\n 'downStartRight',\n 'upStartRight',\n\n 'leftStartUp',\n 'leftStartDown',\n\n 'rightStartUp',\n 'rightStartDown',\n] as const;\n\nexport const popoverPropOffset = [\n '3xs',\n '2xs',\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n] as const;\nexport type PopoverPropOffset = typeof popoverPropOffset[number] | number;\n\nexport const directions = [...directionsStartCenter, ...directionsStartEdge];\n\nexport type Direction = typeof directions[number];\n\nexport type Position = { x: number; y: number } | undefined;\n\nexport type PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n equalAnchorWidth?: boolean;\n position?: never;\n }\n | {\n anchorRef?: never;\n equalAnchorWidth?: never;\n position: Position;\n };\n\ntype ChildrenRenderProp = (direction: Direction) => React.ReactNode;\n\nexport type Props = PropsWithJsxAttributes<\n {\n direction?: Direction;\n spareDirection?: Direction;\n offset?: PopoverPropOffset;\n arrowOffset?: number;\n possibleDirections?: readonly Direction[];\n isInteractive?: boolean;\n children: React.ReactNode | ChildrenRenderProp;\n onClickOutside?: ClickOutsideHandler;\n onSetDirection?: (direction: Direction) => void;\n } & PositioningProps\n>;\n\nconst getOffset = (\n ref: React.RefObject<HTMLDivElement>,\n propOffset: PopoverPropOffset,\n) => {\n if (isNumber(propOffset)) {\n return propOffset;\n }\n\n if (isString(propOffset) && ref.current) {\n const cssVar = getComputedStyle(ref.current).getPropertyValue(\n `--space-${propOffset}`,\n );\n\n if (cssVar && /px$/.test(cssVar)) {\n return Number(cssVar.slice(0, cssVar.length - 2));\n }\n\n if (cssVar && /rem$/.test(cssVar)) {\n const fontSize = parseFloat(\n getComputedStyle(document.documentElement).fontSize,\n );\n const rem = Number(cssVar.slice(0, cssVar.length - 3));\n\n return fontSize * rem;\n }\n\n if (cssVar && /em$/.test(cssVar)) {\n const fontSize = parseFloat(getComputedStyle(ref.current).fontSize);\n const em = Number(cssVar.slice(0, cssVar.length - 2));\n\n return fontSize * em;\n }\n\n return 0;\n }\n\n return 0;\n};\n\n/**\n * Подписчик на PortalWithThemeProvider\n * получает рефы всех вложенных порталов в модалку\n * для дальнейшего исключения их из useClickOutside\n */\nconst ContextConsumer: React.FC<{\n onClickOutside?: (event: MouseEvent) => void;\n ignoreClicksInsideRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n children: React.ReactNode;\n}> = ({ onClickOutside, children, ignoreClicksInsideRefs }) => {\n const { refs } = usePortalContext();\n\n useClickOutside({\n isActive: !!onClickOutside,\n ignoreClicksInsideRefs: [\n ...(ignoreClicksInsideRefs || []),\n ...(refs || []),\n ],\n handler: onClickOutside,\n });\n\n return children as React.ReactElement;\n};\n\nconst cnPopover = cn('Popover');\n\nexport const Popover = forwardRef<HTMLDivElement, Props>(\n (props, componentRef) => {\n const {\n children,\n direction: passedDirection = 'upCenter',\n offset: propOffset = 0,\n arrowOffset,\n possibleDirections = directions,\n isInteractive = true,\n onClickOutside,\n spareDirection = 'downStartLeft',\n style,\n className,\n position: passedPosition,\n anchorRef,\n equalAnchorWidth,\n onSetDirection,\n ...otherProps\n } = props;\n\n const ref = React.useRef<HTMLDivElement>(null);\n const { theme } = useTheme();\n\n const [anchorClientRect, setAnchorClientRect] = React.useState<\n DOMRect | undefined\n >();\n const { width, height } = useComponentSize(ref);\n const anchorSize = useComponentSize(anchorRef || { current: null });\n const previousDirectionRef = React.useRef<Direction | null>(null);\n const [bannedDirections, setBannedDirections] = React.useState<\n readonly Direction[]\n >([]);\n\n const resetBannedDirections = () => {\n setBannedDirections((state) => (state.length ? [] : state));\n previousDirectionRef.current = null;\n };\n\n const updateAnchorClientRect = () =>\n setAnchorClientRect(anchorRef?.current?.getBoundingClientRect());\n\n const offset = useMemo(\n () => getOffset(ref, propOffset),\n [propOffset, Boolean(ref.current)],\n );\n\n const { position, direction } = getComputedPositionAndDirection({\n contentSize: { width, height },\n viewportSize: {\n // Размер вьюпорта без скроллбаров\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n },\n arrowOffset,\n offset,\n direction: passedDirection,\n possibleDirections,\n bannedDirections,\n position: anchorClientRect\n ? { x: anchorClientRect.left, y: anchorClientRect.top }\n : passedPosition,\n anchorSize,\n spareDirection,\n });\n\n useEffect(() => onSetDirection?.(direction), [direction]);\n\n useEffect(updateAnchorClientRect, [anchorSize]);\n\n usePopoverReposition({\n isActive: true,\n scrollAnchorRef: anchorRef || { current: null },\n onRequestReposition: () => {\n resetBannedDirections();\n updateAnchorClientRect();\n },\n });\n\n /**\n * Может возникнуть ситуация, когда перерасчет поповера всегда будет выдавать 2 направления\n * и бесконечно зацикливать себя. Для избежания таких кейсов мы запоминаем стороны,\n * которые не подошли, чтобы не возвращаться к ним и предотвратить бесконечный ререндер.\n * См. PopoverBannedPositionsStory\n */\n\n useLayoutEffect(() => {\n if (previousDirectionRef.current !== direction) {\n if (\n previousDirectionRef.current &&\n !bannedDirections.includes(previousDirectionRef.current) &&\n !bannedDirections.includes(direction) &&\n direction !== spareDirection\n ) {\n setBannedDirections((state) =>\n previousDirectionRef.current\n ? [...state, previousDirectionRef.current]\n : state,\n );\n }\n previousDirectionRef.current = direction;\n }\n }, [direction]);\n\n // Сбрасываем при любом изменении пропсов, чтобы заново начать перебор направлений\n // Главное не сбрасывать при изменении размеров поповера, т.к. именно оно может вызвать бесконечный перебор\n\n useLayoutEffect(resetBannedDirections, [props]);\n\n const notVisible = !position || !height || !width;\n\n return (\n <PortalWithTheme\n {...otherProps}\n preset={theme}\n className={cnPopover({ direction, notVisible }, [className])}\n container={window.document.body}\n ref={useForkRef([ref, componentRef])}\n style={{\n ...style,\n ...(notVisible\n ? {}\n : {\n ['--popover-top' as string]: `${\n (position?.y || 0) + window.scrollY\n }px`,\n ['--popover-left' as string]: `${\n (position?.x || 0) + window.scrollX\n }px`,\n [`--popover-width` as string]: equalAnchorWidth\n ? `${anchorSize.width}px`\n : undefined,\n [`--popover-pointer-events` as string]: isInteractive\n ? undefined\n : 'none',\n [`--popover-visibility` as string]: position\n ? undefined\n : 'hidden',\n }),\n }}\n >\n <ContextConsumer\n onClickOutside={onClickOutside}\n ignoreClicksInsideRefs={[ref, anchorRef || { current: null }]}\n >\n {isRenderProp(children) ? children(direction) : children}\n </ContextConsumer>\n </PortalWithTheme>\n );\n },\n);\n"],"mappings":"wlCAAA,sBAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,eAAvC,CAAwDC,OAAxD,KAAuE,OAAvE,CAEA,OACEC,eADF,CAEEC,gBAFF,0BAIA,OAASC,QAAT,sBACA,OAA8BC,eAA9B,mCACA,OAASC,gBAAT,oCACA,OAASC,UAAT,8BACA,OAASC,EAAT,uBACA,OAASC,YAAT,gCACA,OAASC,QAAT,CAAmBC,QAAnB,+BAGA,OAASC,+BAAT,iBACA,OAASC,oBAAT,8BAMA,MAAO,IAAMC,sBAAqB,CAAG,CACnC,YADmC,CAEnC,UAFmC,CAInC,WAJmC,CAKnC,UALmC,CAMnC,SANmC,CAOnC,QAPmC,CASnC,QATmC,CAUnC,YAVmC,CAWnC,UAXmC,CAanC,SAbmC,CAcnC,aAdmC,CAenC,WAfmC,CAA9B,CAkBP,MAAO,IAAMC,oBAAmB,CAAG,CACjC,eADiC,CAEjC,aAFiC,CAIjC,gBAJiC,CAKjC,cALiC,CAOjC,aAPiC,CAQjC,eARiC,CAUjC,cAViC,CAWjC,gBAXiC,CAA5B,CAcP,MAAO,IAAMC,kBAAiB,CAAG,CAC/B,KAD+B,CAE/B,KAF+B,CAG/B,IAH+B,CAI/B,GAJ+B,CAK/B,GAL+B,CAM/B,GAN+B,CAO/B,IAP+B,CAQ/B,KAR+B,CAS/B,KAT+B,CAU/B,KAV+B,CAW/B,KAX+B,CAY/B,KAZ+B,CAA1B,CAgBP,MAAO,IAAMC,WAAU,WAAOH,qBAAP,CAAiCC,mBAAjC,CAAhB,C,GAkCDG,UAAS,CAAG,SAChBC,CADgB,CAEhBC,CAFgB,CAGb,CACH,GAAIV,QAAQ,CAACU,CAAD,CAAZ,CACE,MAAOA,EAAP,CAGF,GAAIT,QAA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