@consta/uikit 5.25.0 → 5.26.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 (160) hide show
  1. package/FlatSelect/index.d.ts +1 -0
  2. package/FlatSelect/index.js +1 -0
  3. package/__internal__/src/components/Combobox/Combobox.js +1 -1
  4. package/__internal__/src/components/Combobox/Combobox.js.map +1 -1
  5. package/__internal__/src/components/ContextMenu/ContextMenu.js +1 -1
  6. package/__internal__/src/components/ContextMenu/ContextMenu.js.map +1 -1
  7. package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.d.ts +2 -2
  8. package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js +1 -1
  9. package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js.map +1 -1
  10. package/__internal__/src/components/ContextMenu/helpers.d.ts +2 -2
  11. package/__internal__/src/components/ContextMenu/types.d.ts +5 -5
  12. package/__internal__/src/components/ContextMenu/types.js.map +1 -1
  13. package/__internal__/src/components/FieldComponents/FieldButton/FieldButton.d.ts +1 -1
  14. package/__internal__/src/components/FieldComponents/FieldButton/FieldButton.js.map +1 -1
  15. package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.d.ts +1 -0
  16. package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.js +1 -1
  17. package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.js.map +1 -1
  18. package/__internal__/src/components/FlatSelect/FlatSelect.css +9 -0
  19. package/__internal__/src/components/FlatSelect/FlatSelect.d.ts +4 -0
  20. package/__internal__/src/components/FlatSelect/FlatSelect.js +2 -0
  21. package/__internal__/src/components/FlatSelect/FlatSelect.js.map +1 -0
  22. package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.d.ts +16 -0
  23. package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.js +2 -0
  24. package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.js.map +1 -0
  25. package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.d.ts +1 -0
  26. package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.js +2 -0
  27. package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.js.map +1 -0
  28. package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.css +1 -0
  29. package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.d.ts +19 -0
  30. package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js +2 -0
  31. package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js.map +1 -0
  32. package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.d.ts +1 -0
  33. package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.js +2 -0
  34. package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.js.map +1 -0
  35. package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.css +1 -0
  36. package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.d.ts +12 -0
  37. package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.js +2 -0
  38. package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.js.map +1 -0
  39. package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.d.ts +1 -0
  40. package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.js +2 -0
  41. package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.js.map +1 -0
  42. package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.d.ts +10 -0
  43. package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.js +2 -0
  44. package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.js.map +1 -0
  45. package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.d.ts +1 -0
  46. package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.js +2 -0
  47. package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.js.map +1 -0
  48. package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.css +1 -0
  49. package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.d.ts +17 -0
  50. package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.js +2 -0
  51. package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.js.map +1 -0
  52. package/__internal__/src/components/FlatSelect/FlatSelectItem/index.d.ts +1 -0
  53. package/__internal__/src/components/FlatSelect/FlatSelectItem/index.js +2 -0
  54. package/__internal__/src/components/FlatSelect/FlatSelectItem/index.js.map +1 -0
  55. package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.css +1 -0
  56. package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.d.ts +17 -0
  57. package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.js +2 -0
  58. package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.js.map +1 -0
  59. package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.d.ts +1 -0
  60. package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.js +2 -0
  61. package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.js.map +1 -0
  62. package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.css +1 -0
  63. package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.d.ts +53 -0
  64. package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.js +2 -0
  65. package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.js.map +1 -0
  66. package/__internal__/src/components/FlatSelect/FlatSelectList/index.d.ts +1 -0
  67. package/__internal__/src/components/FlatSelect/FlatSelectList/index.js +2 -0
  68. package/__internal__/src/components/FlatSelect/FlatSelectList/index.js.map +1 -0
  69. package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.css +1 -0
  70. package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.d.ts +3 -0
  71. package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.js +2 -0
  72. package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.js.map +1 -0
  73. package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.d.ts +1 -0
  74. package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.js +2 -0
  75. package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.js.map +1 -0
  76. package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.d.ts +24 -0
  77. package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.js +2 -0
  78. package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.js.map +1 -0
  79. package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.d.ts +1 -0
  80. package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.js +2 -0
  81. package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.js.map +1 -0
  82. package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.css +1 -0
  83. package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.d.ts +14 -0
  84. package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js +2 -0
  85. package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js.map +1 -0
  86. package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.d.ts +1 -0
  87. package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.js +2 -0
  88. package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.js.map +1 -0
  89. package/__internal__/src/components/FlatSelect/defaultProps.d.ts +22 -0
  90. package/__internal__/src/components/FlatSelect/defaultProps.js +2 -0
  91. package/__internal__/src/components/FlatSelect/defaultProps.js.map +1 -0
  92. package/__internal__/src/components/FlatSelect/index.d.ts +2 -0
  93. package/__internal__/src/components/FlatSelect/index.js +2 -0
  94. package/__internal__/src/components/FlatSelect/index.js.map +1 -0
  95. package/__internal__/src/components/FlatSelect/types.d.ts +133 -0
  96. package/__internal__/src/components/FlatSelect/types.js +2 -0
  97. package/__internal__/src/components/FlatSelect/types.js.map +1 -0
  98. package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.d.ts +4 -0
  99. package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.js +2 -0
  100. package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.js.map +1 -0
  101. package/__internal__/src/components/FlatSelect/useFlatSelect/index.d.ts +1 -0
  102. package/__internal__/src/components/FlatSelect/useFlatSelect/index.js +2 -0
  103. package/__internal__/src/components/FlatSelect/useFlatSelect/index.js.map +1 -0
  104. package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.d.ts +52 -0
  105. package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.js +2 -0
  106. package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.js.map +1 -0
  107. package/__internal__/src/components/FlatSelect/useRenderItem/index.d.ts +1 -0
  108. package/__internal__/src/components/FlatSelect/useRenderItem/index.js +2 -0
  109. package/__internal__/src/components/FlatSelect/useRenderItem/index.js.map +1 -0
  110. package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.d.ts +10 -0
  111. package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.js +2 -0
  112. package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.js.map +1 -0
  113. package/__internal__/src/components/ListCanary/ListBox/ListBox.js +1 -1
  114. package/__internal__/src/components/ListCanary/ListBox/ListBox.js.map +1 -1
  115. package/__internal__/src/components/ListCanary/types.d.ts +1 -0
  116. package/__internal__/src/components/ListCanary/types.js.map +1 -1
  117. package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.d.ts +1 -0
  118. package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.js +1 -1
  119. package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.js.map +1 -1
  120. package/__internal__/src/components/Popover/Popover.d.ts +2 -2
  121. package/__internal__/src/components/Popover/Popover.js.map +1 -1
  122. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.d.ts +1 -0
  123. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.js +1 -1
  124. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.js.map +1 -1
  125. package/__internal__/src/components/ProgressStepBar/helpers.d.ts +0 -1
  126. package/__internal__/src/components/ProgressStepBar/helpers.js +1 -1
  127. package/__internal__/src/components/ProgressStepBar/helpers.js.map +1 -1
  128. package/__internal__/src/components/SelectCanary/helpers.d.ts +1 -1
  129. package/__internal__/src/components/Sidebar/Sidebar.d.ts +1 -1
  130. package/__internal__/src/components/Sidebar/Sidebar.js.map +1 -1
  131. package/__internal__/src/components/ThemeToggler/helpers.d.ts +1 -1
  132. package/__internal__/src/components/ThemeToggler/types.d.ts +1 -1
  133. package/__internal__/src/components/ThemeToggler/types.js.map +1 -1
  134. package/__internal__/src/components/Tooltip/types.d.ts +1 -1
  135. package/__internal__/src/components/Tooltip/types.js.map +1 -1
  136. package/__internal__/src/components/TooltipDeprecated/TooltipDeprecated.d.ts +1 -1
  137. package/__internal__/src/components/TooltipDeprecated/TooltipDeprecated.js.map +1 -1
  138. package/__internal__/src/utils/state/useClickOutsideAtom/index.d.ts +1 -0
  139. package/__internal__/src/utils/state/useClickOutsideAtom/index.js +2 -0
  140. package/__internal__/src/utils/state/useClickOutsideAtom/index.js.map +1 -0
  141. package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.d.ts +9 -0
  142. package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.js +2 -0
  143. package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.js.map +1 -0
  144. package/__internal__/src/utils/state/useElementAtomEventListener/index.d.ts +1 -0
  145. package/__internal__/src/utils/state/useElementAtomEventListener/index.js +2 -0
  146. package/__internal__/src/utils/state/useElementAtomEventListener/index.js.map +1 -0
  147. package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.d.ts +2 -0
  148. package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.js +2 -0
  149. package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.js.map +1 -0
  150. package/__internal__/src/utils/state/useKeysAtom/index.d.ts +1 -0
  151. package/__internal__/src/utils/state/useKeysAtom/index.js +2 -0
  152. package/__internal__/src/utils/state/useKeysAtom/index.js.map +1 -0
  153. package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.d.ts +14 -0
  154. package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.js +2 -0
  155. package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.js.map +1 -0
  156. package/__internal__/src/utils/state/useRefAtom/useRefAtom.d.ts +1 -1
  157. package/__internal__/src/utils/state/useRefAtom/useRefAtom.js.map +1 -1
  158. package/__internal__/src/utils/state/withCtx/withCtx.js +1 -1
  159. package/__internal__/src/utils/state/withCtx/withCtx.js.map +1 -1
  160. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/components/FlatSelect";
@@ -0,0 +1 @@
1
+ export * from "../__internal__/src/components/FlatSelect";
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValue","renderValue","onCreate","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs"];import"../SelectComponents/Select.css";import{IconClear}from"@consta/icons/IconClear";import{IconSelect}from"@consta/icons/IconSelect";import React,{forwardRef,useRef}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{cnSelect}from"../SelectComponents/cnSelect";import{defaultLabelForCreate,defaultLabelForEmptyItems,defaultLabelForNotFound,getInputWidth}from"../SelectComponents/helpers";import{SelectContainer}from"../SelectComponents/SelectContainer";import{SelectDropdown}from"../SelectComponents/SelectDropdown";import{SelectItem}from"../SelectComponents/SelectItem";import{SelectValueTag}from"../SelectComponents/SelectValueTag";import{defaultPropForm,defaultPropSize,defaultPropView}from"../SelectComponents/types";import{useSelect}from"../SelectComponents/useSelect";import{useForkRef}from"../../hooks/useForkRef";import{isNotNil}from"../../utils/type-guards";import{Text}from"../Text";import{clearSizeMap,iconSizeMap,isMultipleParams,isNotMultipleParams,withDefaultGetters}from"./helpers";export var COMPONENT_NAME="Combobox";var ComboboxRender=function(a,b){var c=useRef(null),d=useRef(null),e=useRef(null),f=useRef(null),g=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),f),h=g.placeholder,i=g.onBlur,j=g.onFocus,k=g.items,l=g.onChange,m=g.value,n=g.disabled,o=g.ariaLabel,p=g.id,q=g.required,r=g.dropdownRef,s=g.form,t=void 0===s?defaultPropForm:s,u=g.view,v=void 0===u?defaultPropView:u,w=g.size,x=void 0===w?defaultPropSize:w,y=g.dropdownClassName,z=g.name,A=g.groups,B=void 0===A?[]:A,C=g.getItemLabel,D=g.getItemKey,E=g.getItemGroupKey,F=g.getItemDisabled,G=g.getGroupKey,H=g.getGroupLabel,I=g.renderItem,J=g.allSelectedAllLabel,K=void 0===J?"\u0412\u0441\u0435":J,L=g.searchValue,M=g.renderValue,N=g.onCreate,O=g.inputRef,P=g.labelForNotFound,Q=void 0===P?defaultLabelForNotFound:P,R=g.labelForCreate,S=void 0===R?defaultLabelForCreate:R,T=g.labelForEmptyItems,U=void 0===T?defaultLabelForEmptyItems:T,V=g.searchFunction,W=g.selectAll,X=g.isLoading,Y=g.multiple,Z=void 0!==Y&&Y,$=g.style,_=g.dropdownForm,aa=void 0===_?"default":_,ba=g.virtualScroll,ca=g.onScrollToBottom,da=g.onDropdownOpen,ea=g.onSearchValueChange,fa=g.dropdownOpen,ga=g.ignoreOutsideClicksRefs,ha=_objectWithoutProperties(g,_excluded),ia=useSelect({items:k,groups:B,value:m,onChange:l,selectAll:W,dropdownRef:c,controlRef:f,disabled:n,getItemLabel:C,getItemKey:D,getGroupKey:G,searchValue:L,getItemGroupKey:E,getItemDisabled:F,multiple:Z,onBlur:i,onFocus:j,onCreate:N,searchFunction:V,onDropdownOpen:da,onSearchValueChange:ea,dropdownOpen:fa,ignoreOutsideClicksRefs:ga}),ja=ia.getKeyProps,ka=ia.getOptionProps,la=ia.isOpen,ma=ia.visibleItems,na=ia.isFocused,oa=ia.handleInputFocus,pa=ia.handleInputBlur,qa=ia.handleToggleDropdown,ra=ia.inputRef,sa=ia.handleInputClick,ta=ia.handleInputChange,ua=ia.searchValue,va=ia.clearValue,wa=ia.getHandleRemoveValue,xa=ia.notFound,ya=ia.hasItems,za=ia.optionsRefs,Aa=ia.allItemsSelected,Ba=p?"".concat(p,"-input"):p,Ca=M||(Z?function renderValueDefaultMultiple(a){var b=a.item,c=a.handleRemove;return React.createElement(SelectValueTag,{label:C(b),key:D(b),size:x,disabled:n||F(b),handleRemove:c})}:function renderValueDefaultNotMultiple(a){var b=C(a.item);return React.createElement("span",{className:cnSelect("ControlValue"),title:b},b)}),Da=useForkRef([ra,O]),Ea=function(){var b=Z?getInputWidth(d,e):void 0;return React.createElement(React.Fragment,null,isMultipleParams(a)&&Array.isArray(a.value)&&a.value.map(function(a){return Ca({item:a,handleRemove:wa(a)})}),isNotMultipleParams(a)&&isNotNil(a.value)&&Ca({item:a.value}),(!isNotNil(m)||Array.isArray(m)&&0===m.length)&&!ua&&h&&React.createElement("span",{className:cnSelect("Placeholder"),title:"placeholder"},h),React.createElement("input",Object.assign({},ja(),{type:"text",name:z,id:Ba,onFocus:oa,onBlur:pa,"aria-label":o,onChange:ta,ref:Da,className:cnSelect("Input",{size:x,hide:!Z&&isNotNil(m),multiple:Z}),value:ua,style:{width:b}})))};return React.createElement(React.Fragment,null,React.createElement(SelectContainer,Object.assign({focused:na,disabled:n,size:x,view:v,required:q,form:t,multiple:Z,ref:b,type:"combobox",style:$,id:Ba},ha),React.createElement("div",{className:cnSelect("Control",{hasInput:!0}),ref:f,"aria-expanded":la,"aria-haspopup":"listbox",id:p},React.createElement("div",{className:cnSelect("ControlInner"),onClick:sa,role:"button",ref:d,"aria-hidden":"true"},React.createElement("div",{className:cnSelect("ControlValueContainer")},function renderValueList(){return Aa?React.createElement(Text,{view:"primary",size:x,className:cnSelect("SelectAll"),lineHeight:"m"},K):Z?React.createElement("div",{className:cnSelect("ControlValue")},Ea()):Ea()}())),React.createElement("span",{className:cnSelect("Indicators")},isNotNil(m)&&React.createElement("button",{type:"button",onClick:va,tabIndex:-1,className:cnSelect("ClearIndicator")},React.createElement(IconClear,{size:clearSizeMap[x],className:cnSelect("ClearIndicatorIcon")})),React.createElement("span",{className:cnSelect("Delimiter")}),React.createElement("button",{type:"button",className:cnSelect("IndicatorsDropdown"),tabIndex:-1,onClick:qa},React.createElement(IconSelect,{size:iconSizeMap[x],className:cnSelect("DropdownIndicatorIcon")})))),React.createElement("div",{className:cnSelect("HelperInputFakeElement"),ref:e},ua)),React.createElement(SelectDropdown,{isOpen:la,size:x,controlRef:f,getOptionProps:ka,dropdownRef:useForkRef([r,c]),form:aa,className:y,renderItem:I||function renderItemDefault(a){var b=a.item,c=a.active,d=a.hovered,e=a.onClick,f=a.onMouseEnter,g=a.ref;return React.createElement(SelectItem,{label:C(b),active:c,hovered:d,multiple:Z,size:x,indent:"round"===aa?"increased":"normal",onClick:e,onMouseEnter:f,disabled:F(b),ref:g})},getGroupLabel:H,visibleItems:ma,labelForNotFound:Q,labelForCreate:S,isLoading:X,labelForEmptyItems:U,notFound:xa,hasItems:ya,itemsRefs:za,virtualScroll:ba,onScrollToBottom:ca,style:"number"==typeof(null===$||void 0===$?void 0:$.zIndex)?{zIndex:$.zIndex+1}:void 0}))};export var Combobox=forwardRef(ComboboxRender);
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValue","renderValue","onCreate","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs"];import"../SelectComponents/Select.css";import{IconClear}from"@consta/icons/IconClear";import{IconSelect}from"@consta/icons/IconSelect";import React,{forwardRef,useRef}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{cnSelect}from"../SelectComponents/cnSelect";import{defaultLabelForCreate,defaultLabelForEmptyItems,defaultLabelForNotFound,getInputWidth}from"../SelectComponents/helpers";import{SelectContainer}from"../SelectComponents/SelectContainer";import{SelectDropdown}from"../SelectComponents/SelectDropdown";import{SelectItem}from"../SelectComponents/SelectItem";import{SelectValueTag}from"../SelectComponents/SelectValueTag";import{defaultPropForm,defaultPropSize,defaultPropView}from"../SelectComponents/types";import{useSelect}from"../SelectComponents/useSelect";import{useForkRef}from"../../hooks/useForkRef";import{isNotNil}from"../../utils/type-guards";import{Text}from"../Text";import{clearSizeMap,iconSizeMap,isMultipleParams,isNotMultipleParams,withDefaultGetters}from"./helpers";export var COMPONENT_NAME="Combobox";var ComboboxRender=function(a,b){var c=useRef(null),d=useRef(null),e=useRef(null),f=useRef(null),g=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),f),h=g.placeholder,i=g.onBlur,j=g.onFocus,k=g.items,l=g.onChange,m=g.value,n=g.disabled,o=g.ariaLabel,p=g.id,q=g.required,r=g.dropdownRef,s=g.form,t=void 0===s?defaultPropForm:s,u=g.view,v=void 0===u?defaultPropView:u,w=g.size,x=void 0===w?defaultPropSize:w,y=g.dropdownClassName,z=g.name,A=g.groups,B=void 0===A?[]:A,C=g.getItemLabel,D=g.getItemKey,E=g.getItemGroupKey,F=g.getItemDisabled,G=g.getGroupKey,H=g.getGroupLabel,I=g.renderItem,J=g.allSelectedAllLabel,K=void 0===J?"\u0412\u0441\u0435":J,L=g.searchValue,M=g.renderValue,N=g.onCreate,O=g.inputRef,P=g.labelForNotFound,Q=void 0===P?defaultLabelForNotFound:P,R=g.labelForCreate,S=void 0===R?defaultLabelForCreate:R,T=g.labelForEmptyItems,U=void 0===T?defaultLabelForEmptyItems:T,V=g.searchFunction,W=g.selectAll,X=g.isLoading,Y=g.multiple,Z=void 0!==Y&&Y,$=g.style,_=g.dropdownForm,aa=void 0===_?"default":_,ba=g.virtualScroll,ca=g.onScrollToBottom,da=g.onDropdownOpen,ea=g.onSearchValueChange,fa=g.dropdownOpen,ga=g.ignoreOutsideClicksRefs,ha=_objectWithoutProperties(g,_excluded),ia=useSelect({items:k,groups:B,value:m,onChange:l,selectAll:W,dropdownRef:c,controlRef:f,disabled:n,getItemLabel:C,getItemKey:D,getGroupKey:G,searchValue:L,getItemGroupKey:E,getItemDisabled:F,multiple:Z,onBlur:i,onFocus:j,onCreate:N,searchFunction:V,onDropdownOpen:da,onSearchValueChange:ea,dropdownOpen:fa,ignoreOutsideClicksRefs:ga}),ja=ia.getKeyProps,ka=ia.getOptionProps,la=ia.isOpen,ma=ia.visibleItems,na=ia.isFocused,oa=ia.handleInputFocus,pa=ia.handleInputBlur,qa=ia.handleToggleDropdown,ra=ia.inputRef,sa=ia.handleInputClick,ta=ia.handleInputChange,ua=ia.searchValue,va=ia.clearValue,wa=ia.getHandleRemoveValue,xa=ia.notFound,ya=ia.hasItems,za=ia.optionsRefs,Aa=ia.allItemsSelected,Ba=p?"".concat(p,"-input"):p,Ca=M||(Z?function renderValueDefaultMultiple(a){var b=a.item,c=a.handleRemove;return React.createElement(SelectValueTag,{label:C(b),key:D(b),size:x,disabled:n||F(b),handleRemove:c})}:function renderValueDefaultNotMultiple(a){var b=C(a.item);return React.createElement("span",{className:cnSelect("ControlValue"),title:b},b)}),Da=useForkRef([ra,O]),Ea=function(){var b=Z?getInputWidth(d,e):void 0;return React.createElement(React.Fragment,null,isMultipleParams(a)&&Array.isArray(a.value)&&a.value.map(function(a){return Ca({item:a,handleRemove:wa(a)})}),isNotMultipleParams(a)&&isNotNil(a.value)&&Ca({item:a.value}),(!isNotNil(m)||Array.isArray(m)&&0===m.length)&&!ua&&h&&React.createElement("span",{className:cnSelect("Placeholder"),title:"placeholder"},h),React.createElement("input",Object.assign({},ja(),{type:"text",name:z,id:Ba,onFocus:oa,onBlur:pa,"aria-label":o,onChange:ta,ref:Da,className:cnSelect("Input",{size:x,hide:!Z&&isNotNil(m),multiple:Z}),value:ua,style:{width:b}})))},Fa=isMultipleParams(a)?isNotNil(a.value)&&0<a.value.length:isNotNil(a.value);return React.createElement(React.Fragment,null,React.createElement(SelectContainer,Object.assign({focused:na,disabled:n,size:x,view:v,required:q,form:t,multiple:Z,ref:b,type:"combobox",style:$,id:Ba},ha),React.createElement("div",{className:cnSelect("Control",{hasInput:!0}),ref:f,"aria-expanded":la,"aria-haspopup":"listbox",id:p},React.createElement("div",{className:cnSelect("ControlInner"),onClick:sa,role:"button",ref:d,"aria-hidden":"true"},React.createElement("div",{className:cnSelect("ControlValueContainer")},function renderValueList(){return Aa?React.createElement(Text,{view:"primary",size:x,className:cnSelect("SelectAll"),lineHeight:"m"},K):Z?React.createElement("div",{className:cnSelect("ControlValue")},Ea()):Ea()}())),React.createElement("span",{className:cnSelect("Indicators")},Fa&&React.createElement("button",{type:"button",onClick:va,tabIndex:-1,className:cnSelect("ClearIndicator")},React.createElement(IconClear,{size:clearSizeMap[x],className:cnSelect("ClearIndicatorIcon")})),React.createElement("span",{className:cnSelect("Delimiter")}),React.createElement("button",{type:"button",className:cnSelect("IndicatorsDropdown"),tabIndex:-1,onClick:qa},React.createElement(IconSelect,{size:iconSizeMap[x],className:cnSelect("DropdownIndicatorIcon")})))),React.createElement("div",{className:cnSelect("HelperInputFakeElement"),ref:e},ua)),React.createElement(SelectDropdown,{isOpen:la,size:x,controlRef:f,getOptionProps:ka,dropdownRef:useForkRef([r,c]),form:aa,className:y,renderItem:I||function renderItemDefault(a){var b=a.item,c=a.active,d=a.hovered,e=a.onClick,f=a.onMouseEnter,g=a.ref;return React.createElement(SelectItem,{label:C(b),active:c,hovered:d,multiple:Z,size:x,indent:"round"===aa?"increased":"normal",onClick:e,onMouseEnter:f,disabled:F(b),ref:g})},getGroupLabel:H,visibleItems:ma,labelForNotFound:Q,labelForCreate:S,isLoading:X,labelForEmptyItems:U,notFound:xa,hasItems:ya,itemsRefs:za,virtualScroll:ba,onScrollToBottom:ca,style:"number"==typeof(null===$||void 0===$?void 0:$.zIndex)?{zIndex:$.zIndex+1}:void 0}))};export var Combobox=forwardRef(ComboboxRender);
2
2
  //# sourceMappingURL=Combobox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.js","names":["IconClear","IconSelect","React","forwardRef","useRef","usePropsHandler","cnSelect","defaultLabelForCreate","defaultLabelForEmptyItems","defaultLabelForNotFound","getInputWidth","SelectContainer","SelectDropdown","SelectItem","SelectValueTag","defaultPropForm","defaultPropSize","defaultPropView","useSelect","useForkRef","isNotNil","Text","clearSizeMap","iconSizeMap","isMultipleParams","isNotMultipleParams","withDefaultGetters","COMPONENT_NAME","ComboboxRender","props","ref","defaultDropdownRef","controlInnerRef","helperInputFakeElement","controlRef","placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValueProp","searchValue","renderValueProp","renderValue","onCreate","inputRefProp","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs","otherProps","getKeyProps","getOptionProps","isOpen","visibleItems","isFocused","handleInputFocus","handleInputBlur","handleToggleDropdown","handleInputClick","handleInputChange","clearValue","getHandleRemoveValue","notFound","hasItems","optionsRefs","allItemsSelected","inputId","renderValueDefaultMultiple","item","handleRemove","renderValueDefaultNotMultiple","valueLabel","inputRefForRender","renderControlValue","width","Array","isArray","map","length","hide","hasInput","renderValueList","renderItemDefault","active","hovered","onClick","onMouseEnter","zIndex","Combobox"],"sources":["../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import '##/components/SelectComponents/Select.css';\n\nimport { IconClear } from '@consta/icons/IconClear';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { cnSelect } from '##/components/SelectComponents/cnSelect';\nimport {\n defaultLabelForCreate,\n defaultLabelForEmptyItems,\n defaultLabelForNotFound,\n getInputWidth,\n} from '##/components/SelectComponents/helpers';\nimport { SelectContainer } from '##/components/SelectComponents/SelectContainer';\nimport { SelectDropdown } from '##/components/SelectComponents/SelectDropdown';\nimport { SelectItem } from '##/components/SelectComponents/SelectItem';\nimport { SelectValueTag } from '##/components/SelectComponents/SelectValueTag';\nimport {\n defaultPropForm,\n defaultPropSize,\n defaultPropView,\n} from '##/components/SelectComponents/types';\nimport { useSelect } from '##/components/SelectComponents/useSelect';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { isNotNil } from '##/utils/type-guards';\n\nimport { Text } from '../Text';\nimport {\n clearSizeMap,\n ComboboxComponent,\n ComboboxGroupDefault,\n ComboboxItemDefault,\n ComboboxPropRenderItem,\n ComboboxPropRenderValue,\n ComboboxProps,\n iconSizeMap,\n isMultipleParams,\n isNotMultipleParams,\n withDefaultGetters,\n} from './helpers';\n\nexport const COMPONENT_NAME = 'Combobox' as const;\n\nconst ComboboxRender = <\n ITEM = ComboboxItemDefault,\n GROUP = ComboboxGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: ComboboxProps<ITEM, GROUP, MULTIPLE>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const defaultDropdownRef = useRef<HTMLDivElement | null>(null);\n const controlInnerRef = useRef<HTMLDivElement>(null);\n const helperInputFakeElement = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLDivElement | null>(null);\n\n const {\n placeholder,\n onBlur,\n onFocus,\n items,\n onChange,\n value,\n disabled,\n ariaLabel,\n id,\n required,\n dropdownRef,\n form = defaultPropForm,\n view = defaultPropView,\n size = defaultPropSize,\n dropdownClassName,\n name,\n groups = [],\n getItemLabel,\n getItemKey,\n getItemGroupKey,\n getItemDisabled,\n getGroupKey,\n getGroupLabel,\n renderItem,\n allSelectedAllLabel = 'Все',\n searchValue: searchValueProp,\n renderValue: renderValueProp,\n onCreate,\n inputRef: inputRefProp,\n labelForNotFound = defaultLabelForNotFound,\n labelForCreate = defaultLabelForCreate,\n labelForEmptyItems = defaultLabelForEmptyItems,\n searchFunction,\n selectAll,\n isLoading,\n multiple = false,\n style,\n dropdownForm = 'default',\n virtualScroll,\n onScrollToBottom,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, withDefaultGetters(props), controlRef);\n\n const {\n getKeyProps,\n getOptionProps,\n isOpen,\n visibleItems,\n isFocused,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n searchValue,\n clearValue,\n getHandleRemoveValue,\n notFound,\n hasItems,\n optionsRefs,\n allItemsSelected,\n } = useSelect({\n items,\n groups,\n value,\n onChange,\n selectAll,\n dropdownRef: defaultDropdownRef,\n controlRef,\n disabled,\n getItemLabel,\n getItemKey,\n getGroupKey,\n searchValue: searchValueProp,\n getItemGroupKey,\n getItemDisabled,\n multiple,\n onBlur,\n onFocus,\n onCreate,\n searchFunction,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n });\n\n const inputId = id ? `${id}-input` : id;\n\n const renderItemDefault: ComboboxPropRenderItem<ITEM> = (props) => {\n const { item, active, hovered, onClick, onMouseEnter, ref } = props;\n\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n multiple={multiple}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n />\n );\n };\n\n const renderValueDefaultMultiple: ComboboxPropRenderValue<ITEM> = ({\n item,\n handleRemove,\n }) => {\n return (\n <SelectValueTag\n label={getItemLabel(item)}\n key={getItemKey(item)}\n size={size}\n disabled={disabled || getItemDisabled(item)}\n handleRemove={handleRemove}\n />\n );\n };\n\n const renderValueDefaultNotMultiple: ComboboxPropRenderValue<ITEM> = (\n props,\n ) => {\n const valueLabel = getItemLabel(props.item);\n\n return (\n <span className={cnSelect('ControlValue')} title={valueLabel}>\n {valueLabel}\n </span>\n );\n };\n\n const renderValue =\n renderValueProp ||\n (multiple ? renderValueDefaultMultiple : renderValueDefaultNotMultiple);\n\n const inputRefForRender = useForkRef([inputRef, inputRefProp]);\n\n const renderControlValue = () => {\n const width = multiple\n ? getInputWidth(controlInnerRef, helperInputFakeElement)\n : undefined;\n return (\n <>\n {isMultipleParams(props) &&\n Array.isArray(props.value) &&\n props.value.map((item) =>\n renderValue({ item, handleRemove: getHandleRemoveValue(item) }),\n )}\n {isNotMultipleParams(props) &&\n isNotNil(props.value) &&\n renderValue({ item: props.value })}\n {(!isNotNil(value) || (Array.isArray(value) && value.length === 0)) &&\n !searchValue &&\n placeholder && (\n <span className={cnSelect('Placeholder')} title=\"placeholder\">\n {placeholder}\n </span>\n )}\n <input\n {...getKeyProps()}\n type=\"text\"\n name={name}\n id={inputId}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n aria-label={ariaLabel}\n onChange={handleInputChange}\n ref={inputRefForRender}\n className={cnSelect('Input', {\n size,\n hide: !multiple && isNotNil(value),\n multiple,\n })}\n value={searchValue}\n style={{ width }}\n />\n </>\n );\n };\n\n const renderValueList = () => {\n if (allItemsSelected) {\n return (\n <Text\n view=\"primary\"\n size={size}\n className={cnSelect('SelectAll')}\n lineHeight=\"m\"\n >\n {allSelectedAllLabel}\n </Text>\n );\n }\n if (multiple) {\n return (\n <div className={cnSelect('ControlValue')}>{renderControlValue()}</div>\n );\n }\n return renderControlValue();\n };\n\n return (\n <>\n <SelectContainer\n focused={isFocused}\n disabled={disabled}\n size={size}\n view={view}\n required={required}\n form={form}\n multiple={multiple}\n ref={ref}\n type=\"combobox\"\n style={style}\n id={inputId}\n {...otherProps}\n >\n <div\n className={cnSelect('Control', { hasInput: true })}\n ref={controlRef}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n id={id}\n >\n <div\n className={cnSelect('ControlInner')}\n onClick={handleInputClick}\n role=\"button\"\n ref={controlInnerRef}\n aria-hidden=\"true\"\n >\n <div className={cnSelect('ControlValueContainer')}>\n {renderValueList()}\n </div>\n </div>\n <span className={cnSelect('Indicators')}>\n {isNotNil(value) && (\n <button\n type=\"button\"\n onClick={clearValue}\n tabIndex={-1}\n className={cnSelect('ClearIndicator')}\n >\n <IconClear\n size={clearSizeMap[size]}\n className={cnSelect('ClearIndicatorIcon')}\n />\n </button>\n )}\n <span className={cnSelect('Delimiter')} />\n <button\n type=\"button\"\n className={cnSelect('IndicatorsDropdown')}\n tabIndex={-1}\n onClick={handleToggleDropdown}\n >\n <IconSelect\n size={iconSizeMap[size]}\n className={cnSelect('DropdownIndicatorIcon')}\n />\n </button>\n </span>\n </div>\n <div\n className={cnSelect('HelperInputFakeElement')}\n ref={helperInputFakeElement}\n >\n {searchValue}\n </div>\n </SelectContainer>\n <SelectDropdown\n isOpen={isOpen}\n size={size}\n controlRef={controlRef}\n getOptionProps={getOptionProps}\n dropdownRef={useForkRef([dropdownRef, defaultDropdownRef])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItems={visibleItems}\n labelForNotFound={labelForNotFound}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n notFound={notFound}\n hasItems={hasItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex + 1 }\n : undefined\n }\n />\n </>\n );\n};\n\nexport const Combobox = forwardRef(ComboboxRender) as ComboboxComponent;\n"],"mappings":"yrBAAA,uCAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,eAAT,2CACA,OAASC,QAAT,oCACA,OACEC,qBADF,CAEEC,yBAFF,CAGEC,uBAHF,CAIEC,aAJF,mCAMA,OAASC,eAAT,2CACA,OAASC,cAAT,0CACA,OAASC,UAAT,sCACA,OAASC,cAAT,0CACA,OACEC,eADF,CAEEC,eAFF,CAGEC,eAHF,iCAKA,OAASC,SAAT,qCACA,OAASC,UAAT,8BACA,OAASC,QAAT,+BAEA,OAASC,IAAT,eACA,OACEC,YADF,CAQEC,WARF,CASEC,gBATF,CAUEC,mBAVF,CAWEC,kBAXF,iBAcA,MAAO,IAAMC,eAAc,CAAG,UAAvB,CAEP,GAAMC,eAAc,CAAG,SAKrBC,CALqB,CAMrBC,CANqB,CAOlB,IACGC,EAAkB,CAAG3B,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A/B,CAAwCC,CAAxC,CAA8D1F,CAA9D,CAAwC0F,YAAxC,CAAsDzF,CAAtD,CAA8DD,CAA9D,CAAsDC,GAAtD,CAEA,MACE,qBAAC,UAAD,EACE,KAAK,CAAEsB,CAAY,CAACiD,CAAD,CADrB,CAEE,MAAM,CAAEe,CAFV,CAGE,OAAO,CAAEC,CAHX,CAIE,QAAQ,CAAE5C,CAJZ,CAKE,IAAI,CAAEzB,CALR,CAME,MAAM,CAAmB,OAAjB,GAAA2B,EAAY,CAAe,WAAf,CAA6B,QANnD,CAOE,OAAO,CAAE2C,CAPX,CAQE,YAAY,CAAEC,CARhB,CASE,QAAQ,CAAEhE,CAAe,CAAC8C,CAAD,CAT3B,CAUE,GAAG,CAAEvE,CAVP,EAaH,CAwKG,CASE,aAAa,CAAE2B,CATjB,CAUE,YAAY,CAAE6B,EAVhB,CAWE,gBAAgB,CAAEnB,CAXpB,CAYE,cAAc,CAAEC,CAZlB,CAaE,SAAS,CAAEI,CAbb,CAcE,kBAAkB,CAAEH,CAdtB,CAeE,QAAQ,CAAE0B,EAfZ,CAgBE,QAAQ,CAAEC,EAhBZ,CAiBE,SAAS,CAAEC,EAjBb,CAkBE,aAAa,CAAErB,EAlBjB,CAmBE,gBAAgB,CAAEC,EAnBpB,CAoBE,KAAK,CACsB,QAAzB,gBAAOH,CAAP,WAAOA,CAAP,QAAOA,CAAK,CAAE8C,MAAd,EACI,CAAEA,MAAM,CAAE9C,CAAK,CAAC8C,MAAN,CAAe,CAAzB,CADJ,OArBJ,EApEF,CAgGH,CAjUD,CAmUA,MAAO,IAAMC,SAAQ,CAAGtH,UAAU,CAACyB,cAAD,CAA3B"}
1
+ {"version":3,"file":"Combobox.js","names":["IconClear","IconSelect","React","forwardRef","useRef","usePropsHandler","cnSelect","defaultLabelForCreate","defaultLabelForEmptyItems","defaultLabelForNotFound","getInputWidth","SelectContainer","SelectDropdown","SelectItem","SelectValueTag","defaultPropForm","defaultPropSize","defaultPropView","useSelect","useForkRef","isNotNil","Text","clearSizeMap","iconSizeMap","isMultipleParams","isNotMultipleParams","withDefaultGetters","COMPONENT_NAME","ComboboxRender","props","ref","defaultDropdownRef","controlInnerRef","helperInputFakeElement","controlRef","placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValueProp","searchValue","renderValueProp","renderValue","onCreate","inputRefProp","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs","otherProps","getKeyProps","getOptionProps","isOpen","visibleItems","isFocused","handleInputFocus","handleInputBlur","handleToggleDropdown","handleInputClick","handleInputChange","clearValue","getHandleRemoveValue","notFound","hasItems","optionsRefs","allItemsSelected","inputId","renderValueDefaultMultiple","item","handleRemove","renderValueDefaultNotMultiple","valueLabel","inputRefForRender","renderControlValue","width","Array","isArray","map","length","hide","isClearButtonVisible","hasInput","renderValueList","renderItemDefault","active","hovered","onClick","onMouseEnter","zIndex","Combobox"],"sources":["../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import '##/components/SelectComponents/Select.css';\n\nimport { IconClear } from '@consta/icons/IconClear';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { cnSelect } from '##/components/SelectComponents/cnSelect';\nimport {\n defaultLabelForCreate,\n defaultLabelForEmptyItems,\n defaultLabelForNotFound,\n getInputWidth,\n} from '##/components/SelectComponents/helpers';\nimport { SelectContainer } from '##/components/SelectComponents/SelectContainer';\nimport { SelectDropdown } from '##/components/SelectComponents/SelectDropdown';\nimport { SelectItem } from '##/components/SelectComponents/SelectItem';\nimport { SelectValueTag } from '##/components/SelectComponents/SelectValueTag';\nimport {\n defaultPropForm,\n defaultPropSize,\n defaultPropView,\n} from '##/components/SelectComponents/types';\nimport { useSelect } from '##/components/SelectComponents/useSelect';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { isNotNil } from '##/utils/type-guards';\n\nimport { Text } from '../Text';\nimport {\n clearSizeMap,\n ComboboxComponent,\n ComboboxGroupDefault,\n ComboboxItemDefault,\n ComboboxPropRenderItem,\n ComboboxPropRenderValue,\n ComboboxProps,\n iconSizeMap,\n isMultipleParams,\n isNotMultipleParams,\n withDefaultGetters,\n} from './helpers';\n\nexport const COMPONENT_NAME = 'Combobox' as const;\n\nconst ComboboxRender = <\n ITEM = ComboboxItemDefault,\n GROUP = ComboboxGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: ComboboxProps<ITEM, GROUP, MULTIPLE>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const defaultDropdownRef = useRef<HTMLDivElement | null>(null);\n const controlInnerRef = useRef<HTMLDivElement>(null);\n const helperInputFakeElement = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLDivElement | null>(null);\n\n const {\n placeholder,\n onBlur,\n onFocus,\n items,\n onChange,\n value,\n disabled,\n ariaLabel,\n id,\n required,\n dropdownRef,\n form = defaultPropForm,\n view = defaultPropView,\n size = defaultPropSize,\n dropdownClassName,\n name,\n groups = [],\n getItemLabel,\n getItemKey,\n getItemGroupKey,\n getItemDisabled,\n getGroupKey,\n getGroupLabel,\n renderItem,\n allSelectedAllLabel = 'Все',\n searchValue: searchValueProp,\n renderValue: renderValueProp,\n onCreate,\n inputRef: inputRefProp,\n labelForNotFound = defaultLabelForNotFound,\n labelForCreate = defaultLabelForCreate,\n labelForEmptyItems = defaultLabelForEmptyItems,\n searchFunction,\n selectAll,\n isLoading,\n multiple = false,\n style,\n dropdownForm = 'default',\n virtualScroll,\n onScrollToBottom,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, withDefaultGetters(props), controlRef);\n\n const {\n getKeyProps,\n getOptionProps,\n isOpen,\n visibleItems,\n isFocused,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n searchValue,\n clearValue,\n getHandleRemoveValue,\n notFound,\n hasItems,\n optionsRefs,\n allItemsSelected,\n } = useSelect({\n items,\n groups,\n value,\n onChange,\n selectAll,\n dropdownRef: defaultDropdownRef,\n controlRef,\n disabled,\n getItemLabel,\n getItemKey,\n getGroupKey,\n searchValue: searchValueProp,\n getItemGroupKey,\n getItemDisabled,\n multiple,\n onBlur,\n onFocus,\n onCreate,\n searchFunction,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n });\n\n const inputId = id ? `${id}-input` : id;\n\n const renderItemDefault: ComboboxPropRenderItem<ITEM> = (props) => {\n const { item, active, hovered, onClick, onMouseEnter, ref } = props;\n\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n multiple={multiple}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n />\n );\n };\n\n const renderValueDefaultMultiple: ComboboxPropRenderValue<ITEM> = ({\n item,\n handleRemove,\n }) => {\n return (\n <SelectValueTag\n label={getItemLabel(item)}\n key={getItemKey(item)}\n size={size}\n disabled={disabled || getItemDisabled(item)}\n handleRemove={handleRemove}\n />\n );\n };\n\n const renderValueDefaultNotMultiple: ComboboxPropRenderValue<ITEM> = (\n props,\n ) => {\n const valueLabel = getItemLabel(props.item);\n\n return (\n <span className={cnSelect('ControlValue')} title={valueLabel}>\n {valueLabel}\n </span>\n );\n };\n\n const renderValue =\n renderValueProp ||\n (multiple ? renderValueDefaultMultiple : renderValueDefaultNotMultiple);\n\n const inputRefForRender = useForkRef([inputRef, inputRefProp]);\n\n const renderControlValue = () => {\n const width = multiple\n ? getInputWidth(controlInnerRef, helperInputFakeElement)\n : undefined;\n return (\n <>\n {isMultipleParams(props) &&\n Array.isArray(props.value) &&\n props.value.map((item) =>\n renderValue({ item, handleRemove: getHandleRemoveValue(item) }),\n )}\n {isNotMultipleParams(props) &&\n isNotNil(props.value) &&\n renderValue({ item: props.value })}\n {(!isNotNil(value) || (Array.isArray(value) && value.length === 0)) &&\n !searchValue &&\n placeholder && (\n <span className={cnSelect('Placeholder')} title=\"placeholder\">\n {placeholder}\n </span>\n )}\n <input\n {...getKeyProps()}\n type=\"text\"\n name={name}\n id={inputId}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n aria-label={ariaLabel}\n onChange={handleInputChange}\n ref={inputRefForRender}\n className={cnSelect('Input', {\n size,\n hide: !multiple && isNotNil(value),\n multiple,\n })}\n value={searchValue}\n style={{ width }}\n />\n </>\n );\n };\n\n const renderValueList = () => {\n if (allItemsSelected) {\n return (\n <Text\n view=\"primary\"\n size={size}\n className={cnSelect('SelectAll')}\n lineHeight=\"m\"\n >\n {allSelectedAllLabel}\n </Text>\n );\n }\n if (multiple) {\n return (\n <div className={cnSelect('ControlValue')}>{renderControlValue()}</div>\n );\n }\n return renderControlValue();\n };\n\n const isClearButtonVisible = isMultipleParams(props)\n ? isNotNil(props.value) && props.value.length > 0\n : isNotNil(props.value);\n\n return (\n <>\n <SelectContainer\n focused={isFocused}\n disabled={disabled}\n size={size}\n view={view}\n required={required}\n form={form}\n multiple={multiple}\n ref={ref}\n type=\"combobox\"\n style={style}\n id={inputId}\n {...otherProps}\n >\n <div\n className={cnSelect('Control', { hasInput: true })}\n ref={controlRef}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n id={id}\n >\n <div\n className={cnSelect('ControlInner')}\n onClick={handleInputClick}\n role=\"button\"\n ref={controlInnerRef}\n aria-hidden=\"true\"\n >\n <div className={cnSelect('ControlValueContainer')}>\n {renderValueList()}\n </div>\n </div>\n <span className={cnSelect('Indicators')}>\n {isClearButtonVisible && (\n <button\n type=\"button\"\n onClick={clearValue}\n tabIndex={-1}\n className={cnSelect('ClearIndicator')}\n >\n <IconClear\n size={clearSizeMap[size]}\n className={cnSelect('ClearIndicatorIcon')}\n />\n </button>\n )}\n <span className={cnSelect('Delimiter')} />\n <button\n type=\"button\"\n className={cnSelect('IndicatorsDropdown')}\n tabIndex={-1}\n onClick={handleToggleDropdown}\n >\n <IconSelect\n size={iconSizeMap[size]}\n className={cnSelect('DropdownIndicatorIcon')}\n />\n </button>\n </span>\n </div>\n <div\n className={cnSelect('HelperInputFakeElement')}\n ref={helperInputFakeElement}\n >\n {searchValue}\n </div>\n </SelectContainer>\n <SelectDropdown\n isOpen={isOpen}\n size={size}\n controlRef={controlRef}\n getOptionProps={getOptionProps}\n dropdownRef={useForkRef([dropdownRef, defaultDropdownRef])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItems={visibleItems}\n labelForNotFound={labelForNotFound}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n notFound={notFound}\n hasItems={hasItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex + 1 }\n : undefined\n }\n />\n </>\n );\n};\n\nexport const Combobox = forwardRef(ComboboxRender) as ComboboxComponent;\n"],"mappings":"yrBAAA,uCAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,eAAT,2CACA,OAASC,QAAT,oCACA,OACEC,qBADF,CAEEC,yBAFF,CAGEC,uBAHF,CAIEC,aAJF,mCAMA,OAASC,eAAT,2CACA,OAASC,cAAT,0CACA,OAASC,UAAT,sCACA,OAAS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kBE,aAAa,CAAErB,EAlBjB,CAmBE,gBAAgB,CAAEC,EAnBpB,CAoBE,KAAK,CACsB,QAAzB,gBAAOH,CAAP,WAAOA,CAAP,QAAOA,CAAK,CAAE+C,MAAd,EACI,CAAEA,MAAM,CAAE/C,CAAK,CAAC+C,MAAN,CAAe,CAAzB,CADJ,OArBJ,EApEF,CAgGH,CArUD,CAuUA,MAAO,IAAMC,SAAQ,CAAGvH,UAAU,CAACyB,cAAD,CAA3B"}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useState}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{useDebounce}from"../../hooks/useDebounce";import{useFlag}from"../../hooks/useFlag";import{animateTimeout}from"../../mixs/MixPopoverAnimate";import{ContextMenuLevels}from"./ContextMenuLevels";import{ContextMenuWrapper}from"./ContextMenuWrapper";export var COMPONENT_NAME="ContextMenu";var ContextMenuRender=function(a,b){var c=usePropsHandler(COMPONENT_NAME,a,b),d=useState({width:240,height:100}),e=_slicedToArray(d,2),f=e[0],g=e[1],h=useFlag(),i=_slicedToArray(h,2),j=i[0],k=i[1],l=useDebounce(k.off,animateTimeout);return React.createElement(ContextMenuWrapper,Object.assign({},c,{animationBack:j,style:_objectSpread(_objectSpread({},null===c||void 0===c?void 0:c.style),f)}),React.createElement(ContextMenuLevels,Object.assign({},c,{setComponentSize:g,ref:b,enableAnimationBack:k.on,disableAnimationBack:l})))};export var ContextMenu=React.forwardRef(ContextMenuRender);export*from"./types";
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useState}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{useDebounce}from"../../hooks/useDebounce";import{useFlag}from"../../hooks/useFlag";import{animateTimeout}from"../../mixs/MixPopoverAnimate";import{ContextMenuLevels}from"./ContextMenuLevels";import{ContextMenuWrapper}from"./ContextMenuWrapper";export var COMPONENT_NAME="ContextMenu";var ContextMenuRender=function(a,b){var c=usePropsHandler(COMPONENT_NAME,a,b),d=useState({width:240,height:100}),e=_slicedToArray(d,2),f=e[0],g=e[1],h=useFlag(),i=_slicedToArray(h,2),j=i[0],k=i[1],l=useDebounce(k.off,animateTimeout);return React.createElement(ContextMenuWrapper,Object.assign({},c,{animationBack:j,style:_objectSpread(_objectSpread({},null===c||void 0===c?void 0:c.style),f)}),React.createElement(ContextMenuLevels,Object.assign({},c,{setComponentSize:g,enableAnimationBack:k.on,disableAnimationBack:l})))};export var ContextMenu=React.forwardRef(ContextMenuRender);export*from"./types";
2
2
  //# sourceMappingURL=ContextMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.js","names":["React","useState","usePropsHandler","useDebounce","useFlag","animateTimeout","ContextMenuLevels","ContextMenuWrapper","COMPONENT_NAME","ContextMenuRender","props","ref","rest","width","height","componentSize","setComponentSize","animationBack","setAnimationBack","disableAnimationBack","off","style","on","ContextMenu","forwardRef"],"sources":["../../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\n\nimport { ContextMenuLevels } from './ContextMenuLevels';\nimport { ContextMenuWrapper } from './ContextMenuWrapper';\nimport { ContextMenuComponent, ContextMenuProps } from './types';\n\nexport const COMPONENT_NAME = 'ContextMenu' as const;\n\nconst ContextMenuRender = (\n props: ContextMenuProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const rest = usePropsHandler(COMPONENT_NAME, props, ref);\n\n const [componentSize, setComponentSize] = useState<ComponentSize>({\n width: 240,\n height: 100,\n });\n\n const [animationBack, setAnimationBack] = useFlag();\n const disableAnimationBack = useDebounce(\n setAnimationBack.off,\n animateTimeout,\n );\n\n return (\n <ContextMenuWrapper\n {...rest}\n animationBack={animationBack}\n style={{ ...rest?.style, ...componentSize }}\n >\n <ContextMenuLevels\n {...rest}\n setComponentSize={setComponentSize}\n ref={ref}\n enableAnimationBack={setAnimationBack.on}\n disableAnimationBack={disableAnimationBack}\n />\n </ContextMenuWrapper>\n );\n};\n\nexport const ContextMenu = React.forwardRef(\n ContextMenuRender,\n) as ContextMenuComponent;\n\nexport * from './types';\n"],"mappings":"suBAAA,MAAOA,MAAP,EAAgBC,QAAhB,KAAgC,OAAhC,CAEA,OAASC,eAAT,2CAEA,OAASC,WAAT,+BACA,OAASC,OAAT,2BACA,OAASC,cAAT,oCAEA,OAASC,iBAAT,2BACA,OAASC,kBAAT,4BAGA,MAAO,IAAMC,eAAc,CAAG,aAAvB,CAEP,GAAMC,kBAAiB,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGrB,IACGC,EAAI,CAAGV,eAAe,CAACM,cAAD,CAAiBE,CAAjB,CAAwBC,CAAxB,CADzB,GAGuCV,QAAQ,CAAgB,CAChEY,KAAK,CAAE,GADyD,CAEhEC,MAAM,CAAE,GAFwD,CAAhB,CAH/C,uBAGIC,CAHJ,MAGmBC,CAHnB,QAQuCZ,OAAO,EAR9C,uBAQIa,CARJ,MAQmBC,CARnB,MASGC,CAAoB,CAAGhB,WAAW,CACtCe,CAAgB,CAACE,GADqB,CAEtCf,cAFsC,CATrC,CAcH,MACE,qBAAC,kBAAD,kBACMO,CADN,EAEE,aAAa,CAAEK,CAFjB,CAGE,KAAK,uCAAOL,CAAP,WAAOA,CAAP,QAAOA,CAAI,CAAES,KAAb,EAAuBN,CAAvB,CAHP,GAKE,oBAAC,iBAAD,kBACMH,CADN,EAEE,gBAAgB,CAAEI,CAFpB,CAGE,GAAG,CAAEL,CAHP,CAIE,mBAAmB,CAAEO,CAAgB,CAACI,EAJxC,CAKE,oBAAoB,CAAEH,CALxB,GALF,CAcH,CAhCD,CAkCA,MAAO,IAAMI,YAAW,CAAGvB,KAAK,CAACwB,UAAN,CACzBf,iBADyB,CAApB,CAIP"}
1
+ {"version":3,"file":"ContextMenu.js","names":["React","useState","usePropsHandler","useDebounce","useFlag","animateTimeout","ContextMenuLevels","ContextMenuWrapper","COMPONENT_NAME","ContextMenuRender","props","ref","rest","width","height","componentSize","setComponentSize","animationBack","setAnimationBack","disableAnimationBack","off","style","on","ContextMenu","forwardRef"],"sources":["../../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\n\nimport { ContextMenuLevels } from './ContextMenuLevels';\nimport { ContextMenuWrapper } from './ContextMenuWrapper';\nimport { ContextMenuComponent, ContextMenuProps } from './types';\n\nexport const COMPONENT_NAME = 'ContextMenu' as const;\n\nconst ContextMenuRender = (\n props: ContextMenuProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const rest = usePropsHandler(COMPONENT_NAME, props, ref);\n\n const [componentSize, setComponentSize] = useState<ComponentSize>({\n width: 240,\n height: 100,\n });\n\n const [animationBack, setAnimationBack] = useFlag();\n const disableAnimationBack = useDebounce(\n setAnimationBack.off,\n animateTimeout,\n );\n\n return (\n <ContextMenuWrapper\n {...rest}\n animationBack={animationBack}\n style={{ ...rest?.style, ...componentSize }}\n >\n <ContextMenuLevels\n {...rest}\n setComponentSize={setComponentSize}\n enableAnimationBack={setAnimationBack.on}\n disableAnimationBack={disableAnimationBack}\n />\n </ContextMenuWrapper>\n );\n};\n\nexport const ContextMenu = React.forwardRef(\n ContextMenuRender,\n) as ContextMenuComponent;\n\nexport * from './types';\n"],"mappings":"suBAAA,MAAOA,MAAP,EAAgBC,QAAhB,KAAgC,OAAhC,CAEA,OAASC,eAAT,2CAEA,OAASC,WAAT,+BACA,OAASC,OAAT,2BACA,OAASC,cAAT,oCAEA,OAASC,iBAAT,2BACA,OAASC,kBAAT,4BAGA,MAAO,IAAMC,eAAc,CAAG,aAAvB,CAEP,GAAMC,kBAAiB,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGrB,IACGC,EAAI,CAAGV,eAAe,CAACM,cAAD,CAAiBE,CAAjB,CAAwBC,CAAxB,CADzB,GAGuCV,QAAQ,CAAgB,CAChEY,KAAK,CAAE,GADyD,CAEhEC,MAAM,CAAE,GAFwD,CAAhB,CAH/C,uBAGIC,CAHJ,MAGmBC,CAHnB,QAQuCZ,OAAO,EAR9C,uBAQIa,CARJ,MAQmBC,CARnB,MASGC,CAAoB,CAAGhB,WAAW,CACtCe,CAAgB,CAACE,GADqB,CAEtCf,cAFsC,CATrC,CAcH,MACE,qBAAC,kBAAD,kBACMO,CADN,EAEE,aAAa,CAAEK,CAFjB,CAGE,KAAK,uCAAOL,CAAP,WAAOA,CAAP,QAAOA,CAAI,CAAES,KAAb,EAAuBN,CAAvB,CAHP,GAKE,oBAAC,iBAAD,kBACMH,CADN,EAEE,gBAAgB,CAAEI,CAFpB,CAGE,mBAAmB,CAAEE,CAAgB,CAACI,EAHxC,CAIE,oBAAoB,CAAEH,CAJxB,GALF,CAaH,CA/BD,CAiCA,MAAO,IAAMI,YAAW,CAAGvB,KAAK,CAACwB,UAAN,CACzBf,iBADyB,CAApB,CAIP"}
@@ -1,2 +1,2 @@
1
- import { ContextMenuLevelsComponent } from '../types';
2
- export declare const ContextMenuLevels: ContextMenuLevelsComponent;
1
+ import { ContextMenuLevelsProps } from '../types';
2
+ export declare const ContextMenuLevels: (propsComponent: ContextMenuLevelsProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{Fragment,useEffect,useState}from"react";import{Transition,TransitionGroup}from"react-transition-group";import{useClickOutside}from"../../../hooks/useClickOutside";import{useMutableRef}from"../../../hooks/useMutableRef";import{useRefs}from"../../../hooks/useRefs";import{animateTimeout}from"../../../mixs/MixPopoverAnimate";import{setRef}from"../../../utils/setRef";import{clearTimers,ContextMenuLevel}from"../ContextMenuLevel";import{getLevels,withDefaultGetters}from"../helpers";import{contextMenuPropDefaultSubMenuDirection,contextMenuPropSubMenuDirections}from"../types";import{useSize}from"./useSize";var ContextMenuLevelsRender=function(a){var b=withDefaultGetters(a),c=b.items,d=b.anchorRef,e=b.position,f=b.direction,g=b.possibleDirections,h=b.offset,i=b.onClickOutside,j=b.getItemKey,k=b.getItemLabel,l=b.getItemSubMenu,m=b.style,n=b.spareDirection,o=b.subMenuDirection,p=void 0===o?contextMenuPropDefaultSubMenuDirection:o,q=b.isMobile,r=b.isOpen,s=b.setComponentSize,t=b.enableAnimationBack,u=b.disableAnimationBack,v=_objectWithoutProperties(b,_excluded),w=useMutableRef(r),x=[{items:c,anchorRef:d,position:e,direction:f,possibleDirections:g,offset:h}],y=useState(q?x:[]),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useState(p),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useState(-1),H=_slicedToArray(G,2),I=H[0],J=H[1],K=useRefs(A.length),L=function(a){var c=a.level,d=a.items,e=a.anchorRef,f=a.activeItem,g=a.parent,h=_toConsumableArray(A),i=h[c]&&1<h.length-c?h[c].direction:void 0;h[c]&&1<h.length-c&&i&&F(i),h[c-1].activeItem=f,h.splice(c),h.push({items:d,anchorRef:q?b.anchorRef:e,direction:q?b.direction:i||E,possibleDirections:q?b.possibleDirections:contextMenuPropSubMenuDirections,position:q?b.position:void 0,offset:q?b.offset:void 0,parent:g}),w.current?B(h):B([])},M=function(a){if(0<a){t();var b=_toConsumableArray(A);b.splice(a),b[a-1]=_objectSpread(_objectSpread({},b[a-1]),{},{activeItem:void 0}),B(b),u()}};return useClickOutside({isActive:i&&r,ignoreClicksInsideRefs:[].concat(_toConsumableArray(K),[d||{current:null}]),handler:i}),useEffect(function(){return clearTimers(),B(getLevels({levels:A,items:c,getItemKey:j,getItemSubMenu:l})),function(){return clearTimers()}},[c]),useEffect(function(){B(x)},[e]),useEffect(function(){B(r?x:[])},[r]),useSize(K,s,q),React.createElement(TransitionGroup,{component:Fragment},A.map(function(a,c){var d="".concat(c,"-").concat(a.parent?j(a.parent):""),e=c!==A.length-1;return q&&e?React.createElement(Fragment,{key:c}):React.createElement(Transition,{key:d,timeout:animateTimeout,nodeRef:K[c]},function(d){return React.createElement(ContextMenuLevel,Object.assign({},v,a,{key:"".concat(c,"-").concat(a.parent?j(a.parent):""),isMobile:q,isOpen:r,style:_objectSpread(_objectSpread({},m),{zIndex:"number"==typeof(null===m||void 0===m?void 0:m.zIndex)?m.zIndex+1:void 0}),activeLevelDepth:A.length-1,levelDepth:c,getItemLabel:k,addLevel:L,deleteLevel:M,onSetDirection:0<c?F:b.onSetDirection,hoveredParenLevel:I,setHoveredParenLevel:J,getItemSubMenu:l,getItemKey:j,ref:function ref(a){return setRef(K[c],a)},spareDirection:0===c?n:"rightStartUp",parent:q?a.parent:void 0,animate:d}))})}))};export var ContextMenuLevels=React.forwardRef(ContextMenuLevelsRender);
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{Fragment,useEffect,useState}from"react";import{Transition,TransitionGroup}from"react-transition-group";import{useClickOutside}from"../../../hooks/useClickOutside";import{useMutableRef}from"../../../hooks/useMutableRef";import{useRefs}from"../../../hooks/useRefs";import{animateTimeout}from"../../../mixs/MixPopoverAnimate";import{setRef}from"../../../utils/setRef";import{clearTimers,ContextMenuLevel}from"../ContextMenuLevel";import{getLevels,withDefaultGetters}from"../helpers";import{contextMenuPropDefaultSubMenuDirection,contextMenuPropSubMenuDirections}from"../types";import{useSize}from"./useSize";export var ContextMenuLevels=function(a){var b=withDefaultGetters(a),c=b.items,d=b.anchorRef,e=b.position,f=b.direction,g=b.possibleDirections,h=b.offset,i=b.onClickOutside,j=b.getItemKey,k=b.getItemLabel,l=b.getItemSubMenu,m=b.style,n=b.spareDirection,o=b.subMenuDirection,p=void 0===o?contextMenuPropDefaultSubMenuDirection:o,q=b.isMobile,r=b.isOpen,s=b.setComponentSize,t=b.enableAnimationBack,u=b.disableAnimationBack,v=_objectWithoutProperties(b,_excluded),w=useMutableRef(r),x=[{items:c,anchorRef:d,position:e,direction:f,possibleDirections:g,offset:h}],y=useState(q?x:[]),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useState(p),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useState(-1),H=_slicedToArray(G,2),I=H[0],J=H[1],K=useRefs(A.length),L=function(a){var c=a.level,d=a.items,e=a.anchorRef,f=a.activeItem,g=a.parent,h=_toConsumableArray(A),i=h[c]&&1<h.length-c?h[c].direction:void 0;h[c]&&1<h.length-c&&i&&F(i),h[c-1].activeItem=f,h.splice(c),h.push({items:d,anchorRef:q?b.anchorRef:e,direction:q?b.direction:i||E,possibleDirections:q?b.possibleDirections:contextMenuPropSubMenuDirections,position:q?b.position:void 0,offset:q?b.offset:void 0,parent:g}),w.current?B(h):B([])},M=function(a){if(0<a){t();var b=_toConsumableArray(A);b.splice(a),b[a-1]=_objectSpread(_objectSpread({},b[a-1]),{},{activeItem:void 0}),B(b),u()}};return useClickOutside({isActive:i&&r,ignoreClicksInsideRefs:[].concat(_toConsumableArray(K),[d||{current:null}]),handler:i}),useEffect(function(){return clearTimers(),B(getLevels({levels:A,items:c,getItemKey:j,getItemSubMenu:l})),function(){return clearTimers()}},[c]),useEffect(function(){B(x)},[e]),useEffect(function(){B(r?x:[])},[r]),useSize(K,s,q),React.createElement(TransitionGroup,{component:Fragment},A.map(function(a,c){var d="".concat(c,"-").concat(a.parent?j(a.parent):""),e=c!==A.length-1;return q&&e?React.createElement(Fragment,{key:c}):React.createElement(Transition,{key:d,timeout:animateTimeout,nodeRef:K[c]},function(d){return React.createElement(ContextMenuLevel,Object.assign({},v,a,{key:"".concat(c,"-").concat(a.parent?j(a.parent):""),isMobile:q,isOpen:r,style:_objectSpread(_objectSpread({},m),{zIndex:"number"==typeof(null===m||void 0===m?void 0:m.zIndex)?m.zIndex+1:void 0}),activeLevelDepth:A.length-1,levelDepth:c,getItemLabel:k,addLevel:L,deleteLevel:M,onSetDirection:0<c?F:b.onSetDirection,hoveredParenLevel:I,setHoveredParenLevel:J,getItemSubMenu:l,getItemKey:j,ref:function ref(a){return setRef(K[c],a)},spareDirection:0===c?n:"rightStartUp",parent:q?a.parent:void 0,animate:d}))})}))};
2
2
  //# sourceMappingURL=ContextMenuLevels.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuLevels.js","names":["React","Fragment","useEffect","useState","Transition","TransitionGroup","useClickOutside","useMutableRef","useRefs","animateTimeout","setRef","clearTimers","ContextMenuLevel","getLevels","withDefaultGetters","contextMenuPropDefaultSubMenuDirection","contextMenuPropSubMenuDirections","useSize","ContextMenuLevelsRender","propsComponent","props","items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","subMenuDirectionProp","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack","otherProps","isOpenRef","defaultLevels","levels","setLevels","setSubMenuDirection","hoveredParenLevel","setHoveredParenLevel","levelsRefs","length","addLevel","level","activeItem","parent","newLevels","oldDirection","splice","push","current","deleteLevel","isActive","ignoreClicksInsideRefs","handler","map","index","key","last","animate","zIndex","onSetDirection","el","ContextMenuLevels","forwardRef"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useState } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\n\nimport { Direction } from '##/components/Popover';\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { useRefs } from '##/hooks/useRefs';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\nimport { setRef } from '##/utils/setRef';\n\nimport { clearTimers, ContextMenuLevel } from '../ContextMenuLevel';\nimport { getLevels, withDefaultGetters } from '../helpers';\nimport {\n AddLevel,\n ContextMenuItemDefault,\n ContextMenuLevelsComponent,\n ContextMenuLevelsProps,\n contextMenuPropDefaultSubMenuDirection,\n contextMenuPropSubMenuDirections,\n Level,\n} from '../types';\nimport { useSize } from './useSize';\n\nconst ContextMenuLevelsRender = (\n propsComponent: ContextMenuLevelsProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const props = withDefaultGetters(propsComponent);\n const {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n onClickOutside,\n getItemKey,\n getItemLabel,\n getItemSubMenu,\n style,\n spareDirection,\n subMenuDirection:\n subMenuDirectionProp = contextMenuPropDefaultSubMenuDirection,\n isMobile,\n isOpen,\n setComponentSize,\n enableAnimationBack,\n disableAnimationBack,\n ...otherProps\n } = props;\n\n const isOpenRef = useMutableRef(isOpen);\n\n type Item = typeof items[number];\n\n const defaultLevels: Level<ContextMenuItemDefault>[] = [\n {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n },\n ];\n\n const [levels, setLevels] = useState<\n Level<ContextMenuItemDefault & { isParent?: boolean }>[]\n >(isMobile ? defaultLevels : []);\n const [subMenuDirection, setSubMenuDirection] =\n useState<Direction>(subMenuDirectionProp);\n const [hoveredParenLevel, setHoveredParenLevel] = useState<number>(-1);\n\n const levelsRefs = useRefs<HTMLDivElement>(levels.length);\n\n const addLevel: AddLevel<Item> = ({\n level,\n items,\n anchorRef,\n activeItem,\n parent,\n }) => {\n const newLevels: Level<ContextMenuItemDefault & { isParent?: boolean }>[] =\n [...levels];\n const oldDirection =\n newLevels[level] && newLevels.length - level > 1\n ? newLevels[level].direction\n : undefined;\n\n if (newLevels[level] && newLevels.length - level > 1 && oldDirection) {\n setSubMenuDirection(oldDirection);\n }\n\n newLevels[level - 1].activeItem = activeItem;\n newLevels.splice(level);\n newLevels.push({\n items,\n anchorRef: isMobile ? props.anchorRef : anchorRef,\n direction: isMobile ? props.direction : oldDirection || subMenuDirection,\n possibleDirections: isMobile\n ? props.possibleDirections\n : contextMenuPropSubMenuDirections,\n position: isMobile ? props.position : undefined,\n offset: isMobile ? props.offset : undefined,\n parent,\n });\n\n isOpenRef.current ? setLevels(newLevels) : setLevels([]);\n };\n\n const deleteLevel = (level: number) => {\n if (level > 0) {\n enableAnimationBack();\n const newLevels = [...levels];\n newLevels.splice(level);\n newLevels[level - 1] = { ...newLevels[level - 1], activeItem: undefined };\n setLevels(newLevels);\n disableAnimationBack();\n }\n };\n\n useClickOutside({\n isActive: onClickOutside && isOpen,\n ignoreClicksInsideRefs: [...levelsRefs, anchorRef || { current: null }],\n handler: onClickOutside,\n });\n\n useEffect(() => {\n clearTimers();\n setLevels(\n getLevels({\n levels,\n items,\n getItemKey,\n getItemSubMenu,\n }),\n );\n return () => clearTimers();\n }, [items]);\n\n useEffect(() => {\n setLevels(defaultLevels);\n }, [position]);\n\n useEffect(() => {\n setLevels(isOpen ? defaultLevels : []);\n }, [isOpen]);\n\n useSize(levelsRefs, setComponentSize, isMobile);\n\n return (\n <TransitionGroup component={Fragment}>\n {levels.map((level, index) => {\n const key = `${index}-${level.parent ? getItemKey(level.parent) : ''}`;\n\n const last = index !== levels.length - 1;\n\n if (isMobile && last) {\n return <Fragment key={index} />;\n }\n\n return (\n <Transition\n key={key}\n timeout={animateTimeout}\n nodeRef={levelsRefs[index]}\n >\n {(animate) => (\n <ContextMenuLevel\n {...otherProps}\n {...level}\n key={`${index}-${level.parent ? getItemKey(level.parent) : ''}`}\n isMobile={isMobile}\n isOpen={isOpen}\n style={{\n ...style,\n ...{\n zIndex:\n typeof style?.zIndex === 'number'\n ? style.zIndex + 1\n : undefined,\n },\n }}\n activeLevelDepth={levels.length - 1}\n levelDepth={index}\n getItemLabel={getItemLabel}\n addLevel={addLevel}\n deleteLevel={deleteLevel}\n onSetDirection={\n index > 0 ? setSubMenuDirection : props.onSetDirection\n }\n hoveredParenLevel={hoveredParenLevel}\n setHoveredParenLevel={setHoveredParenLevel}\n getItemSubMenu={getItemSubMenu}\n getItemKey={getItemKey}\n ref={(el) => setRef(levelsRefs[index], el)}\n spareDirection={index === 0 ? spareDirection : 'rightStartUp'}\n parent={isMobile ? level.parent : undefined}\n animate={animate}\n />\n )}\n </Transition>\n );\n })}\n </TransitionGroup>\n );\n};\n\nexport const ContextMenuLevels = React.forwardRef(\n ContextMenuLevelsRender,\n) as ContextMenuLevelsComponent;\n"],"mappings":"2pCAAA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,QAArC,KAAqD,OAArD,CACA,OAASC,UAAT,CAAqBC,eAArB,KAA4C,wBAA5C,CAGA,OAASC,eAAT,s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d,CAiBE,YAAY,CAAEnC,CAjBhB,CAkBE,QAAQ,CAAEqB,CAlBZ,CAmBE,WAAW,CAAES,CAnBf,CAoBE,cAAc,CACJ,CAAR,CAAAK,CAAK,CAAOnB,CAAP,CAA6BzB,CAAK,CAACiD,cArB5C,CAuBE,iBAAiB,CAAEvB,CAvBrB,CAwBE,oBAAoB,CAAEC,CAxBxB,CAyBE,cAAc,CAAEjB,CAzBlB,CA0BE,UAAU,CAAEF,CA1Bd,CA2BE,GAAG,CAAE,aAAC0C,CAAD,QAAQ5D,OAAM,CAACsC,CAAU,CAACgB,CAAD,CAAX,CAAoBM,CAApB,CAAd,CA3BP,CA4BE,cAAc,CAAY,CAAV,GAAAN,CAAK,CAAShC,CAAT,CAA0B,cA5BjD,CA6BE,MAAM,CAAEG,CAAQ,CAAGgB,CAAK,CAACE,MAAT,OA7BlB,CA8BE,OAAO,CAAEc,CA9BX,GADD,CALH,CAyCH,CAnDA,CADH,CAuDH,CAvLD,CAyLA,MAAO,IAAMI,kBAAiB,CAAGvE,KAAK,CAACwE,UAAN,CAC/BtD,uBAD+B,CAA1B"}
1
+ {"version":3,"file":"ContextMenuLevels.js","names":["React","Fragment","useEffect","useState","Transition","TransitionGroup","useClickOutside","useMutableRef","useRefs","animateTimeout","setRef","clearTimers","ContextMenuLevel","getLevels","withDefaultGetters","contextMenuPropDefaultSubMenuDirection","contextMenuPropSubMenuDirections","useSize","ContextMenuLevels","propsComponent","props","items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","subMenuDirectionProp","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack","otherProps","isOpenRef","defaultLevels","levels","setLevels","setSubMenuDirection","hoveredParenLevel","setHoveredParenLevel","levelsRefs","length","addLevel","level","activeItem","parent","newLevels","oldDirection","splice","push","current","deleteLevel","isActive","ignoreClicksInsideRefs","handler","map","index","key","last","animate","zIndex","onSetDirection","el"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useState } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\n\nimport { Direction } from '##/components/Popover';\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { useRefs } from '##/hooks/useRefs';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\nimport { setRef } from '##/utils/setRef';\n\nimport { clearTimers, ContextMenuLevel } from '../ContextMenuLevel';\nimport { getLevels, withDefaultGetters } from '../helpers';\nimport {\n AddLevel,\n ContextMenuItemDefault,\n ContextMenuLevelsProps,\n contextMenuPropDefaultSubMenuDirection,\n contextMenuPropSubMenuDirections,\n Level,\n} from '../types';\nimport { useSize } from './useSize';\n\nexport const ContextMenuLevels = (propsComponent: ContextMenuLevelsProps) => {\n const props = withDefaultGetters(propsComponent);\n const {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n onClickOutside,\n getItemKey,\n getItemLabel,\n getItemSubMenu,\n style,\n spareDirection,\n subMenuDirection:\n subMenuDirectionProp = contextMenuPropDefaultSubMenuDirection,\n isMobile,\n isOpen,\n setComponentSize,\n enableAnimationBack,\n disableAnimationBack,\n ...otherProps\n } = props;\n\n const isOpenRef = useMutableRef(isOpen);\n\n type Item = typeof items[number];\n\n const defaultLevels: Level<ContextMenuItemDefault>[] = [\n {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n },\n ];\n\n const [levels, setLevels] = useState<\n Level<ContextMenuItemDefault & { isParent?: boolean }>[]\n >(isMobile ? defaultLevels : []);\n const [subMenuDirection, setSubMenuDirection] =\n useState<Direction>(subMenuDirectionProp);\n const [hoveredParenLevel, setHoveredParenLevel] = useState<number>(-1);\n\n const levelsRefs = useRefs<HTMLDivElement>(levels.length);\n\n const addLevel: AddLevel<Item> = ({\n level,\n items,\n anchorRef,\n activeItem,\n parent,\n }) => {\n const newLevels: Level<ContextMenuItemDefault & { isParent?: boolean }>[] =\n [...levels];\n const oldDirection =\n newLevels[level] && newLevels.length - level > 1\n ? newLevels[level].direction\n : undefined;\n\n if (newLevels[level] && newLevels.length - level > 1 && oldDirection) {\n setSubMenuDirection(oldDirection);\n }\n\n newLevels[level - 1].activeItem = activeItem;\n newLevels.splice(level);\n newLevels.push({\n items,\n anchorRef: isMobile ? props.anchorRef : anchorRef,\n direction: isMobile ? props.direction : oldDirection || subMenuDirection,\n possibleDirections: isMobile\n ? props.possibleDirections\n : contextMenuPropSubMenuDirections,\n position: isMobile ? props.position : undefined,\n offset: isMobile ? props.offset : undefined,\n parent,\n });\n\n isOpenRef.current ? setLevels(newLevels) : setLevels([]);\n };\n\n const deleteLevel = (level: number) => {\n if (level > 0) {\n enableAnimationBack();\n const newLevels = [...levels];\n newLevels.splice(level);\n newLevels[level - 1] = { ...newLevels[level - 1], activeItem: undefined };\n setLevels(newLevels);\n disableAnimationBack();\n }\n };\n\n useClickOutside({\n isActive: onClickOutside && isOpen,\n ignoreClicksInsideRefs: [...levelsRefs, anchorRef || { current: null }],\n handler: onClickOutside,\n });\n\n useEffect(() => {\n clearTimers();\n setLevels(\n getLevels({\n levels,\n items,\n getItemKey,\n getItemSubMenu,\n }),\n );\n return () => clearTimers();\n }, [items]);\n\n useEffect(() => {\n setLevels(defaultLevels);\n }, [position]);\n\n useEffect(() => {\n setLevels(isOpen ? defaultLevels : []);\n }, [isOpen]);\n\n useSize(levelsRefs, setComponentSize, isMobile);\n\n return (\n <TransitionGroup component={Fragment}>\n {levels.map((level, index) => {\n const key = `${index}-${level.parent ? getItemKey(level.parent) : ''}`;\n\n const last = index !== levels.length - 1;\n\n if (isMobile && last) {\n return <Fragment key={index} />;\n }\n\n return (\n <Transition\n key={key}\n timeout={animateTimeout}\n nodeRef={levelsRefs[index]}\n >\n {(animate) => (\n <ContextMenuLevel\n {...otherProps}\n {...level}\n key={`${index}-${level.parent ? getItemKey(level.parent) : ''}`}\n isMobile={isMobile}\n isOpen={isOpen}\n style={{\n ...style,\n ...{\n zIndex:\n typeof style?.zIndex === 'number'\n ? style.zIndex + 1\n : undefined,\n },\n }}\n activeLevelDepth={levels.length - 1}\n levelDepth={index}\n getItemLabel={getItemLabel}\n addLevel={addLevel}\n deleteLevel={deleteLevel}\n onSetDirection={\n index > 0 ? setSubMenuDirection : props.onSetDirection\n }\n hoveredParenLevel={hoveredParenLevel}\n setHoveredParenLevel={setHoveredParenLevel}\n getItemSubMenu={getItemSubMenu}\n getItemKey={getItemKey}\n ref={(el) => setRef(levelsRefs[index], el)}\n spareDirection={index === 0 ? spareDirection : 'rightStartUp'}\n parent={isMobile ? level.parent : undefined}\n animate={animate}\n />\n )}\n </Transition>\n );\n })}\n </TransitionGroup>\n );\n};\n"],"mappings":"2pCAAA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,QAArC,KAAqD,OAArD,CACA,OAASC,UAAT,CAAqBC,eAArB,KAA4C,wBAA5C,CAGA,OAASC,eAAT,sCACA,OAASC,aAAT,oCACA,OAASC,OAAT,8BACA,OAASC,cAAT,uCACA,OAASC,MAAT,6BAEA,OAASC,WAAT,CAAsBC,gBAAtB,2BACA,OAASC,SAAT,CAAoBC,kBAApB,kBACA,OAIEC,sCAJF,CAKEC,gCALF,gBAQA,OAASC,OAAT,iBAEA,MAAO,IAAMC,kBAAiB,CAAG,SAACC,CAAD,CAA4C,IACrEC,EAAK,CAAGN,kBAAkB,CAACK,CAAD,CAD2C,CAGzEE,CAHyE,CAuBvED,CAvBuE,CAGzEC,KAHyE,CAIzEC,CAJyE,CAuBvEF,CAvBuE,CAIzEE,SAJyE,CAKzEC,CALyE,CAuBvEH,CAvBuE,CAKzEG,QALyE,CAMzEC,CANyE,CAuBvEJ,CAvBuE,CAMzEI,SANyE,CAOzEC,CAPyE,CAuBvEL,CAvBuE,CAOzEK,kBAPyE,CAQzEC,CARyE,CAuBvEN,CAvBuE,CAQzEM,MARyE,CASzEC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AT,CAA0B,cA5BjD,CA6BE,MAAM,CAAEG,CAAQ,CAAGgB,CAAK,CAACE,MAAT,OA7BlB,CA8BE,OAAO,CAAEc,CA9BX,GADD,CALH,CAyCH,CAnDA,CADH,CAuDH,CApLM"}
@@ -7,7 +7,7 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
7
7
  groups?: GROUP[] | undefined;
8
8
  sortGroup?: import("./types").ContextMenuPropSortGroup;
9
9
  onItemClick?: import("./types").ContextMenuPropOnItemClick<ITEM> | undefined;
10
- possibleDirections?: readonly import("../Popover").Direction[];
10
+ possibleDirections?: import("../Popover").Direction[];
11
11
  subMenuDirection?: import("./types").ContextMenuPropSubMenuDirection;
12
12
  spareDirection?: import("../Popover").Direction;
13
13
  onSetDirection?: (direction: import("../Popover").Direction) => void;
@@ -54,7 +54,7 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
54
54
  groups?: GROUP[] | undefined;
55
55
  sortGroup?: import("./types").ContextMenuPropSortGroup;
56
56
  onItemClick?: import("./types").ContextMenuPropOnItemClick<ITEM> | undefined;
57
- possibleDirections?: readonly import("../Popover").Direction[];
57
+ possibleDirections?: import("../Popover").Direction[];
58
58
  subMenuDirection?: import("./types").ContextMenuPropSubMenuDirection;
59
59
  spareDirection?: import("../Popover").Direction;
60
60
  onSetDirection?: (direction: import("../Popover").Direction) => void;
@@ -16,7 +16,7 @@ export declare const contextMenuDefaultStatus: ContextMenuStatus;
16
16
  export declare const contextMenuForm: readonly ["default", "brick", "round"];
17
17
  export type ContextMenuForm = ListPropForm;
18
18
  export declare const defaultContextMenuForm: "default";
19
- export declare const contextMenuPropSubMenuDirections: readonly ["rightStartUp", "rightStartDown", "leftStartUp", "leftStartDown"];
19
+ export declare const contextMenuPropSubMenuDirections: Direction[];
20
20
  export type ContextMenuPropSubMenuDirection = typeof contextMenuPropSubMenuDirections[number];
21
21
  export declare const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection;
22
22
  export type ContextMenuPropOnItemClick<ITEM> = (item: ITEM, params: {
@@ -87,7 +87,7 @@ export type Level<ITEM> = {
87
87
  items: ITEM[];
88
88
  activeItem?: string;
89
89
  direction?: Direction;
90
- possibleDirections?: readonly Direction[];
90
+ possibleDirections?: Direction[];
91
91
  offset?: PopoverPropOffset;
92
92
  parent?: ITEM;
93
93
  anchorRef?: React.RefObject<HTMLElement>;
@@ -109,7 +109,7 @@ export type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuG
109
109
  groups?: GROUP[];
110
110
  sortGroup?: ContextMenuPropSortGroup;
111
111
  onItemClick?: ContextMenuPropOnItemClick<ITEM>;
112
- possibleDirections?: readonly Direction[];
112
+ possibleDirections?: Direction[];
113
113
  subMenuDirection?: ContextMenuPropSubMenuDirection;
114
114
  spareDirection?: Direction;
115
115
  onSetDirection?: (direction: Direction) => void;
@@ -167,7 +167,7 @@ export type ContextMenuWrapperProps = PropsWithHTMLAttributes<{
167
167
  form?: ContextMenuForm;
168
168
  onClickOutside?: ClickOutsideHandler;
169
169
  spareDirection?: Direction;
170
- possibleDirections?: readonly Direction[];
170
+ possibleDirections?: Direction[];
171
171
  size?: ContextMenuPropSize;
172
172
  direction?: Direction;
173
173
  offset?: PopoverPropOffset;
@@ -182,7 +182,7 @@ export type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<{
182
182
  isMobile?: boolean;
183
183
  onClickOutside?: ClickOutsideHandler;
184
184
  spareDirection?: Direction;
185
- possibleDirections?: readonly Direction[];
185
+ possibleDirections?: Direction[];
186
186
  size?: ContextMenuPropSize;
187
187
  direction?: Direction;
188
188
  offset?: PopoverPropOffset;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\nimport { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n] as const;\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: React.MouseEventHandler;\n as?: AsTags;\n attributes?: AsAttributes;\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: readonly Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnItemClick<ITEM>;\n possibleDirections?: readonly Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n onEsc?: React.KeyboardEventHandler;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n activeLevelDepth: number;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n onEsc?: React.KeyboardEventHandler;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isMobile?: boolean;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAiBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAAgC,CAAG,CAC9C,cAD8C,CAE9C,gBAF8C,CAG9C,aAH8C,CAI9C,eAJ8C,CAAzC,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
1
+ {"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\nimport { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections: Direction[] = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n];\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: React.MouseEventHandler;\n as?: AsTags;\n attributes?: AsAttributes;\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnItemClick<ITEM>;\n possibleDirections?: Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n onEsc?: React.KeyboardEventHandler;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n activeLevelDepth: number;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n onEsc?: React.KeyboardEventHandler;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isMobile?: boolean;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAiBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAA6C,CAAG,CAC3D,cAD2D,CAE3D,gBAF2D,CAG3D,aAH2D,CAI3D,eAJ2D,CAAtD,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
3
3
  type FieldButtonProps = PropsWithHTMLAttributesAndRef<{
4
- children: React.ReactNode;
4
+ children?: React.ReactNode;
5
5
  }, HTMLButtonElement>;
6
6
  export declare const FieldButton: React.ForwardRefExoticComponent<Omit<FieldButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"FieldButton.js","names":["React","forwardRef","cnMixHitSlop","cnFieldButtonStyleReset","cnFieldButton","FieldButton","ref","className","props","mode"],"sources":["../../../../../../src/components/FieldComponents/FieldButton/FieldButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { cnMixHitSlop } from '##/mixs/MixHitSlop';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { cnFieldButtonStyleReset } from '../FieldButtonStyleReset';\nimport { cnFieldButton } from './cnFieldButton';\n\ntype FieldButtonProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n },\n HTMLButtonElement\n>;\n\nexport const FieldButton = forwardRef<HTMLButtonElement, FieldButtonProps>(\n ({ className, ...props }, ref) => {\n return (\n <button\n {...props}\n ref={ref}\n className={cnFieldButton(null, [\n cnFieldButtonStyleReset(),\n cnMixHitSlop({ mode: 'reverseMargin' }),\n className,\n ])}\n type=\"button\"\n />\n );\n },\n);\n"],"mappings":"iHAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,YAAT,gCAGA,OAASC,uBAAT,gCACA,OAASC,aAAT,uBASA,MAAO,IAAMC,YAAW,CAAGJ,UAAU,CACnC,WAA0BK,CAA1B,CAAkC,IAA/BC,EAA+B,GAA/BA,SAA+B,CAAjBC,CAAiB,uCAChC,MACE,+CACMA,CADN,EAEE,GAAG,CAAEF,CAFP,CAGE,SAAS,CAAEF,aAAa,CAAC,IAAD,CAAO,CAC7BD,uBAAuB,EADM,CAE7BD,YAAY,CAAC,CAAEO,IAAI,CAAE,eAAR,CAAD,CAFiB,CAG7BF,CAH6B,CAAP,CAH1B,CAQE,IAAI,CAAC,QARP,GAWH,CAdkC,CAA9B"}
1
+ {"version":3,"file":"FieldButton.js","names":["React","forwardRef","cnMixHitSlop","cnFieldButtonStyleReset","cnFieldButton","FieldButton","ref","className","props","mode"],"sources":["../../../../../../src/components/FieldComponents/FieldButton/FieldButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { cnMixHitSlop } from '##/mixs/MixHitSlop';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { cnFieldButtonStyleReset } from '../FieldButtonStyleReset';\nimport { cnFieldButton } from './cnFieldButton';\n\ntype FieldButtonProps = PropsWithHTMLAttributesAndRef<\n {\n children?: React.ReactNode;\n },\n HTMLButtonElement\n>;\n\nexport const FieldButton = forwardRef<HTMLButtonElement, FieldButtonProps>(\n ({ className, ...props }, ref) => {\n return (\n <button\n {...props}\n ref={ref}\n className={cnFieldButton(null, [\n cnFieldButtonStyleReset(),\n cnMixHitSlop({ mode: 'reverseMargin' }),\n className,\n ])}\n type=\"button\"\n />\n );\n },\n);\n"],"mappings":"iHAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,YAAT,gCAGA,OAASC,uBAAT,gCACA,OAASC,aAAT,uBASA,MAAO,IAAMC,YAAW,CAAGJ,UAAU,CACnC,WAA0BK,CAA1B,CAAkC,IAA/BC,EAA+B,GAA/BA,SAA+B,CAAjBC,CAAiB,uCAChC,MACE,+CACMA,CADN,EAEE,GAAG,CAAEF,CAFP,CAGE,SAAS,CAAEF,aAAa,CAAC,IAAD,CAAO,CAC7BD,uBAAuB,EADM,CAE7BD,YAAY,CAAC,CAAEO,IAAI,CAAE,eAAR,CAAD,CAFiB,CAG7BF,CAH6B,CAAP,CAH1B,CAQE,IAAI,CAAC,QARP,GAWH,CAdkC,CAA9B"}
@@ -7,5 +7,6 @@ type FieldClearButtonProps = PropsWithHTMLAttributesAndRef<{
7
7
  children?: never;
8
8
  icon?: IconComponent;
9
9
  }, HTMLButtonElement>;
10
+ export declare const cnFieldClearButton: import("@bem-react/classname").ClassNameFormatter;
10
11
  export declare const FieldClearButton: React.ForwardRefExoticComponent<Omit<FieldClearButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
11
12
  export {};
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","icon"];import{IconClear}from"@consta/icons/IconClear";import React,{forwardRef}from"react";import{FieldButton,getFieldIconSize}from"./..";export var FieldClearButton=forwardRef(function(a,b){var c=a.size,d=void 0===c?"m":c,e=a.icon,f=void 0===e?IconClear:e,g=_objectWithoutProperties(a,_excluded);return React.createElement(FieldButton,Object.assign({},g,{ref:b}),React.createElement(f,{size:getFieldIconSize(d)}))});
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","icon","className"];import{IconClear}from"@consta/icons/IconClear";import React,{forwardRef}from"react";import{FieldButton,getFieldIconSize}from"./..";import{cn}from"../../../utils/bem";export var cnFieldClearButton=cn("FieldClearButton");export var FieldClearButton=forwardRef(function(a,b){var c=a.size,d=void 0===c?"m":c,e=a.icon,f=void 0===e?IconClear:e,g=a.className,h=_objectWithoutProperties(a,_excluded);return React.createElement(FieldButton,Object.assign({},h,{className:cnFieldClearButton(null,[g]),ref:b}),React.createElement(f,{size:getFieldIconSize(d)}))});
2
2
  //# sourceMappingURL=FieldClearButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldClearButton.js","names":["IconClear","React","forwardRef","FieldButton","getFieldIconSize","FieldClearButton","ref","size","icon","Icon","props"],"sources":["../../../../../../src/components/FieldComponents/FieldClearButton/FieldClearButton.tsx"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport { IconClear } from '@consta/icons/IconClear';\nimport React, { forwardRef } from 'react';\n\nimport {\n FieldButton,\n FieldPropSize,\n getFieldIconSize,\n} from '##/components/FieldComponents';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\ntype FieldClearButtonProps = PropsWithHTMLAttributesAndRef<\n {\n size?: FieldPropSize;\n children?: never;\n icon?: IconComponent;\n },\n HTMLButtonElement\n>;\n\nexport const FieldClearButton = forwardRef<\n HTMLButtonElement,\n FieldClearButtonProps\n>(({ size = 'm', icon: Icon = IconClear, ...props }, ref) => {\n return (\n <FieldButton {...props} ref={ref}>\n <Icon size={getFieldIconSize(size)} />\n </FieldButton>\n );\n});\n"],"mappings":"mHACA,OAASA,SAAT,KAA0B,yBAA1B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OACEC,WADF,CAGEC,gBAHF,YAgBA,MAAO,IAAMC,iBAAgB,CAAGH,UAAU,CAGxC,WAAmDI,CAAnD,CAA2D,SAAxDC,IAAwD,CAAxDA,CAAwD,YAAjD,GAAiD,OAA5CC,IAA4C,CAAtCC,CAAsC,YAA/BT,SAA+B,GAAjBU,CAAiB,uCAC3D,MACE,qBAAC,WAAD,kBAAiBA,CAAjB,EAAwB,GAAG,CAAEJ,CAA7B,GACE,oBAAC,CAAD,EAAM,IAAI,CAAEF,gBAAgB,CAACG,CAAD,CAA5B,EADF,CAIH,CATyC,CAAnC"}
1
+ {"version":3,"file":"FieldClearButton.js","names":["IconClear","React","forwardRef","FieldButton","getFieldIconSize","cn","cnFieldClearButton","FieldClearButton","ref","size","icon","Icon","className","props"],"sources":["../../../../../../src/components/FieldComponents/FieldClearButton/FieldClearButton.tsx"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport { IconClear } from '@consta/icons/IconClear';\nimport React, { forwardRef } from 'react';\n\nimport {\n FieldButton,\n FieldPropSize,\n getFieldIconSize,\n} from '##/components/FieldComponents';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\ntype FieldClearButtonProps = PropsWithHTMLAttributesAndRef<\n {\n size?: FieldPropSize;\n children?: never;\n icon?: IconComponent;\n },\n HTMLButtonElement\n>;\n\nexport const cnFieldClearButton = cn('FieldClearButton');\n\nexport const FieldClearButton = forwardRef<\n HTMLButtonElement,\n FieldClearButtonProps\n>(({ size = 'm', icon: Icon = IconClear, className, ...props }, ref) => {\n return (\n <FieldButton\n {...props}\n className={cnFieldClearButton(null, [className])}\n ref={ref}\n >\n <Icon size={getFieldIconSize(size)} />\n </FieldButton>\n );\n});\n"],"mappings":"+HACA,OAASA,SAAT,KAA0B,yBAA1B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OACEC,WADF,CAGEC,gBAHF,YAKA,OAASC,EAAT,0BAYA,MAAO,IAAMC,mBAAkB,CAAGD,EAAE,CAAC,kBAAD,CAA7B,CAEP,MAAO,IAAME,iBAAgB,CAAGL,UAAU,CAGxC,WAA8DM,CAA9D,CAAsE,SAAnEC,IAAmE,CAAnEA,CAAmE,YAA5D,GAA4D,OAAvDC,IAAuD,CAAjDC,CAAiD,YAA1CX,SAA0C,GAA/BY,CAA+B,GAA/BA,SAA+B,CAAjBC,CAAiB,uCACtE,MACE,qBAAC,WAAD,kBACMA,CADN,EAEE,SAAS,CAAEP,kBAAkB,CAAC,IAAD,CAAO,CAACM,CAAD,CAAP,CAF/B,CAGE,GAAG,CAAEJ,CAHP,GAKE,oBAAC,CAAD,EAAM,IAAI,CAAEJ,gBAAgB,CAACK,CAAD,CAA5B,EALF,CAQH,CAbyC,CAAnC"}
@@ -0,0 +1,9 @@
1
+ .FlatSelect{--flat-select-radius-round:calc(var(--flat-select-control-height)/2)}.FlatSelect_withAnchor{background:var(--color-bg-default)}.FlatSelect_form_default{border-radius:var(--control-radius)}.FlatSelect_form_round{border-radius:calc(var(--flat-select-control-height)/2)}.FlatSelect_view_clear .FlatSelect-Input{border-bottom:1px solid var(--color-bg-border)}.FlatSelect-Input_border{border:1px solid var(--color-bg-border)}.FlatSelect-Input_form_default{border-radius:var(--control-radius) var(--control-radius) 0 0}.FlatSelect-Input_form_round{border-radius:var(--flat-select-radius-round) var(--flat-select-radius-round) 0 0}.FlatSelect-List{--flat-select-list-border-top-left-radius:0;--flat-select-list-border-top-right-radius:0;--flat-select-list-border-bottom-right-radius:0;--flat-select-list-border-bottom-left-radius:0;border-radius:var(--flat-select-list-border-top-left-radius) var(--flat-select-list-border-top-right-radius) var(--flat-select-list-border-bottom-right-radius) var(--flat-select-list-border-bottom-left-radius)}.FlatSelect-List_borderHorizontal{border-left:1px solid var(--color-bg-border);border-right:1px solid var(--color-bg-border)}.FlatSelect-List_borderBottom{border-bottom:1px solid var(--color-bg-border)}.FlatSelect-List_borderTop{border-top:1px solid var(--color-bg-border)}.FlatSelect-List_formTop_default{--flat-select-list-border-top-right-radius:var(--control-radius);--flat-select-list-border-top-left-radius:var(--control-radius)}.FlatSelect-List_formTop_round{--flat-select-list-border-top-right-radius:var(
2
+ --flat-select-radius-round
3
+ );--flat-select-list-border-top-left-radius:var(
4
+ --flat-select-radius-round
5
+ )}.FlatSelect-List_formBottom_default{--flat-select-list-border-bottom-right-radius:var(--control-radius);--flat-select-list-border-bottom-left-radius:var(--control-radius)}.FlatSelect-List_formBottom_round{--flat-select-list-border-bottom-right-radius:var(
6
+ --flat-select-radius-round
7
+ );--flat-select-list-border-bottom-left-radius:var(
8
+ --flat-select-radius-round
9
+ )}
@@ -0,0 +1,4 @@
1
+ import './FlatSelect.css';
2
+ import { FlatSelectComponent } from './types';
3
+ export declare const cnFlatSelect: import("@bem-react/classname").ClassNameFormatter;
4
+ export declare const FlatSelect: FlatSelectComponent;
@@ -0,0 +1,2 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","disabled","value","isLoading","listRef","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","iconClear","input","inputValue","inputDefaultValue","inputRef","size","view","bordered","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChange","onCreate","onInput","multiple","groups","onOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","autoFocus","footer","listClassName","anchorRef","iconLeft","direction","spareDirection","possibleDirections"];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"./FlatSelect.css";import React,{forwardRef}from"react";import{FieldInput}from"../FieldComponents";import{useForkRef}from"../../hooks/useForkRef";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{useSendToAtom,withCtx}from"../../utils/state";import{withDefault}from"./defaultProps";import{FlatSelectControlLayout}from"./FlatSelectControlLayout";import{FlatSelectFooter}from"./FlatSelectFooter";import{FlatSelectList}from"./FlatSelectList";import{FlatSelectRoot}from"./FlatSelectRoot";import{useFlatSelect}from"./useFlatSelect";import{useRenderItem}from"./useRenderItem";export var cnFlatSelect=cn("FlatSelect");var FlatSelectRender=function(a,b){var c=withDefault(a),d=useSendToAtom(c),e=c.form,f=c.disabled,g=c.value,h=c.isLoading,i=c.listRef,j=c.renderItem,k=c.getGroupLabel,l=c.labelForCreate,m=c.labelForEmptyItems,n=c.virtualScroll,o=c.onScrollToBottom,p=c.style,q=c.className,r=c.placeholder,s=c.iconClear,t=c.input,u=c.inputValue,v=c.inputDefaultValue,w=c.inputRef,x=c.size,y=c.view,z=c.bordered,A=c.getGroupKey,B=c.getItemDisabled,C=c.getItemGroupKey,D=c.getItemKey,E=c.getItemLabel,F=c.items,G=c.onChange,H=c.onCreate,I=c.onInput,J=c.multiple,K=c.groups,L=c.onOpen,M=c.ignoreOutsideClicksRefs,N=c.clearButton,O=c.selectAll,P=c.selectAllLabel,Q=c.autoFocus,R=c.footer,S=c.listClassName,T=c.anchorRef,U=c.iconLeft,V=c.direction,W=c.spareDirection,X=c.possibleDirections,Y=_objectWithoutProperties(c,_excluded),Z=useFlatSelect({propsAtom:d}),$=Z.getOptionActions,_=Z.openAtom,aa=Z.visibleItemsAtom,ba=Z.inputFocusAtom,ca=Z.handleInputFocus,da=Z.handleInputBlur,ea=Z.inputRef,fa=Z.handleInputChange,ga=Z.clearValue,ha=Z.optionsRefs,ia=Z.disabledAtom,ja=Z.listRef,ka=Z.clearButtonAtom,la=Z.highlightedIndexAtom,ma=Z.getItemKeyAtom,na=Z.valueAtom,oa=Z.onChangeAll,pa=Z.onChange,qa=Z.inputValueAtom,ra=Z.hasItemsAtom,sa=Z.groupsCounterAtom,ta=Z.dropdownZIndexAtom,ua=Z.rootRef,va=useRenderItem({getItemLabel:E,getItemDisabled:B,multiple:J,disabled:f,size:x,renderItem:j}),wa=!t||T||z?"clear":y,xa=!!T||z,ya=useForkRef([ea,w]);return React.createElement(FlatSelectRoot,Object.assign({},Y,{ref:useForkRef([b,ua]),className:cnFlatSelect({view:wa,bordered:"clear"===wa?xa:void 0,form:xa?e:void 0,size:x},[q]),style:_objectSpread(_objectSpread({},p),{},_defineProperty({},"--flat-select-control-height","var(--control-height-".concat(x,")"))),anchorRef:T,openAtom:_,tabIndex:0,direction:V,spareDirection:W,possibleDirections:X}),t&&React.createElement("div",{className:cnFlatSelect("Input",{border:"clear"===wa?xa:void 0,form:xa?e:void 0},["clear"===wa?cnMixSpace({pV:"2xs",pH:"s"}):void 0])},React.createElement(FlatSelectControlLayout,{form:e,disabled:f,separator:!0,onClear:ga,focusAtom:ba,iconClear:s,leftSide:U&&React.createElement(U,{size:"s"}),clearButtonAtom:ka,size:x,view:wa,valueAtom:qa},React.createElement(FieldInput,{onFocus:ca,onBlur:da,ref:ya,onChange:fa,value:u,defaultValue:v,disabled:f,placeholder:r}))),React.createElement(FlatSelectList,{className:cnFlatSelect("List",{borderTop:"clear"!==wa||t?void 0:xa,borderHorizontal:"clear"===wa?xa:void 0,borderBottom:"clear"!==wa||R?void 0:xa,formTop:xa&&!t?e:void 0,formBottom:xa&&!R?e:void 0},[S]),view:wa,size:x,form:e,valueAtom:na,getItemKeyAtom:ma,openAtom:_,getOptionActions:$,listRef:useForkRef([ja,i]),renderItem:va,getGroupLabel:k,visibleItemsAtom:aa,labelForCreate:l,isLoading:h,labelForEmptyItems:m,itemsRefs:ha,virtualScroll:n,onScrollToBottom:o,highlightedIndexAtom:la,onChangeAll:oa,onChange:pa,inputValueAtom:qa,hasItemsAtom:ra,groupsCounterAtom:sa,dropdownZIndexAtom:ta,selectAllLabel:P,disabledAtom:ia}),R&&React.createElement(FlatSelectFooter,{view:wa,bordered:xa,form:e,footer:R}))};export var FlatSelect=withCtx(forwardRef(FlatSelectRender));
2
+ //# sourceMappingURL=FlatSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlatSelect.js","names":["React","forwardRef","FieldInput","useForkRef","cnMixSpace","cn","useSendToAtom","withCtx","withDefault","FlatSelectControlLayout","FlatSelectFooter","FlatSelectList","FlatSelectRoot","useFlatSelect","useRenderItem","cnFlatSelect","FlatSelectRender","p","ref","props","propsAtom","form","disabled","value","isLoading","listRefProp","listRef","renderItemProp","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","iconClear","input","inputValue","inputDefaultValue","inputRefProp","inputRef","size","viewProp","view","borderedProp","bordered","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChangeProp","onChange","onCreateProp","onCreate","onInput","multiple","groups","onOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","autoFocus","footer","listClassName","anchorRef","IconLeft","iconLeft","direction","spareDirection","possibleDirections","otherProps","getOptionActions","openAtom","visibleItemsAtom","inputFocusAtom","handleInputFocus","handleInputBlur","handleInputChange","clearValue","optionsRefs","disabledAtom","clearButtonAtom","highlightedIndexAtom","getItemKeyAtom","valueAtom","onChangeAll","inputValueAtom","hasItemsAtom","groupsCounterAtom","dropdownZIndexAtom","rootRef","fieldInputRef","border","pV","pH","borderTop","borderHorizontal","borderBottom","formTop","formBottom","FlatSelect"],"sources":["../../../../../src/components/FlatSelect/FlatSelect.tsx"],"sourcesContent":["import './FlatSelect.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { FieldInput } from '##/components/FieldComponents';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { useSendToAtom, withCtx } from '##/utils/state';\n\nimport { withDefault } from './defaultProps';\nimport { FlatSelectControlLayout } from './FlatSelectControlLayout';\nimport { FlatSelectFooter } from './FlatSelectFooter';\nimport { FlatSelectList } from './FlatSelectList';\nimport { FlatSelectRoot } from './FlatSelectRoot';\nimport {\n FlatSelectComponent,\n FlatSelectGroupDefault,\n FlatSelectItemDefault,\n FlatSelectProps,\n} from './types';\nimport { useFlatSelect } from './useFlatSelect';\nimport { useRenderItem } from './useRenderItem';\n\nexport const cnFlatSelect = cn('FlatSelect');\n\nconst FlatSelectRender = (\n p: FlatSelectProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const props = withDefault(p);\n const propsAtom = useSendToAtom(props);\n\n const {\n form,\n disabled,\n value,\n isLoading,\n listRef: listRefProp,\n renderItem: renderItemProp,\n getGroupLabel,\n labelForCreate,\n labelForEmptyItems,\n virtualScroll,\n onScrollToBottom,\n style,\n className,\n placeholder,\n iconClear,\n input,\n inputValue,\n inputDefaultValue,\n inputRef: inputRefProp,\n size,\n view: viewProp,\n bordered: borderedProp,\n getGroupKey,\n getItemDisabled,\n getItemGroupKey,\n getItemKey,\n getItemLabel,\n items,\n onChange: onChangeProp,\n onCreate: onCreateProp,\n onInput,\n multiple,\n groups,\n onOpen,\n ignoreOutsideClicksRefs,\n clearButton,\n selectAll,\n selectAllLabel,\n autoFocus,\n footer,\n listClassName,\n anchorRef,\n iconLeft: IconLeft,\n direction,\n spareDirection,\n possibleDirections,\n ...otherProps\n } = props;\n\n const {\n getOptionActions,\n openAtom,\n visibleItemsAtom,\n inputFocusAtom,\n handleInputFocus,\n handleInputBlur,\n inputRef,\n handleInputChange,\n clearValue,\n optionsRefs,\n disabledAtom,\n listRef,\n clearButtonAtom,\n highlightedIndexAtom,\n getItemKeyAtom,\n valueAtom,\n onChangeAll,\n onChange,\n inputValueAtom,\n hasItemsAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n rootRef,\n } = useFlatSelect<FlatSelectItemDefault, FlatSelectGroupDefault, false>({\n propsAtom,\n });\n\n const renderItem = useRenderItem({\n getItemLabel,\n getItemDisabled,\n multiple,\n disabled,\n size,\n renderItem: renderItemProp,\n });\n\n const view = !input || anchorRef || borderedProp ? 'clear' : viewProp;\n const bordered = anchorRef ? true : borderedProp;\n const fieldInputRef = useForkRef([inputRef, inputRefProp]);\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <FlatSelectRoot\n {...otherProps}\n ref={useForkRef([ref, rootRef])}\n className={cnFlatSelect(\n {\n view,\n bordered: view === 'clear' ? bordered : undefined,\n form: bordered ? form : undefined,\n size,\n },\n\n [className],\n )}\n style={{\n ...style,\n ['--flat-select-control-height' as string]: `var(--control-height-${size})`,\n }}\n anchorRef={anchorRef}\n openAtom={openAtom}\n tabIndex={0}\n direction={direction}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n >\n {input && (\n <div\n className={cnFlatSelect(\n 'Input',\n {\n border: view === 'clear' ? bordered : undefined,\n form: bordered ? form : undefined,\n },\n [view === 'clear' ? cnMixSpace({ pV: '2xs', pH: 's' }) : undefined],\n )}\n >\n <FlatSelectControlLayout\n form={form}\n disabled={disabled}\n separator\n onClear={clearValue}\n focusAtom={inputFocusAtom}\n iconClear={iconClear}\n leftSide={IconLeft && <IconLeft size=\"s\" />}\n clearButtonAtom={clearButtonAtom}\n size={size}\n view={view}\n valueAtom={inputValueAtom}\n >\n <FieldInput\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n ref={fieldInputRef}\n onChange={handleInputChange}\n value={inputValue}\n defaultValue={inputDefaultValue}\n disabled={disabled}\n placeholder={placeholder}\n />\n </FlatSelectControlLayout>\n </div>\n )}\n <FlatSelectList\n className={cnFlatSelect(\n 'List',\n {\n borderTop: view === 'clear' && !input ? bordered : undefined,\n borderHorizontal: view === 'clear' ? bordered : undefined,\n borderBottom: view === 'clear' && !footer ? bordered : undefined,\n formTop: bordered && !input ? form : undefined,\n formBottom: bordered && !footer ? form : undefined,\n },\n [listClassName],\n )}\n view={view}\n size={size}\n form={form}\n valueAtom={valueAtom}\n getItemKeyAtom={getItemKeyAtom}\n openAtom={openAtom}\n getOptionActions={getOptionActions}\n listRef={useForkRef([listRef, listRefProp])}\n renderItem={renderItem}\n getGroupLabel={getGroupLabel}\n visibleItemsAtom={visibleItemsAtom}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n highlightedIndexAtom={highlightedIndexAtom}\n onChangeAll={onChangeAll}\n onChange={onChange}\n inputValueAtom={inputValueAtom}\n hasItemsAtom={hasItemsAtom}\n groupsCounterAtom={groupsCounterAtom}\n dropdownZIndexAtom={dropdownZIndexAtom}\n selectAllLabel={selectAllLabel}\n disabledAtom={disabledAtom}\n />\n {footer && (\n <FlatSelectFooter\n view={view}\n bordered={bordered}\n form={form}\n footer={footer}\n />\n )}\n </FlatSelectRoot>\n );\n};\n\nexport const FlatSelect = withCtx(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EG,EApBd,CAqBE,aAAa,CAAEC,CArBjB,CAsBE,gBAAgB,CAAEiD,EAtBpB,CAuBE,cAAc,CAAEhD,CAvBlB,CAwBE,SAAS,CAAEN,CAxBb,CAyBE,kBAAkB,CAAEO,CAzBtB,CA0BE,SAAS,CAAEqD,EA1Bb,CA2BE,aAAa,CAAEpD,CA3BjB,CA4BE,gBAAgB,CAAEC,CA5BpB,CA6BE,oBAAoB,CAAEsD,EA7BxB,CA8BE,WAAW,CAAEG,EA9Bf,CA+BE,QAAQ,CAAEnC,EA/BZ,CAgCE,cAAc,CAAEoC,EAhClB,CAiCE,YAAY,CAAEC,EAjChB,CAkCE,iBAAiB,CAAEC,EAlCrB,CAmCE,kBAAkB,CAAEC,EAnCtB,CAoCE,cAAc,CAAE7B,CApClB,CAqCE,YAAY,CAAEoB,EArChB,EA7DF,CAoGGlB,CAAM,EACL,oBAAC,gBAAD,EACE,IAAI,CAAEtB,EADR,CAEE,QAAQ,CAAEE,EAFZ,CAGE,IAAI,CAAE1B,CAHR,CAIE,MAAM,CAAE8C,CAJV,EArGJ,CA8GH,CAlND,CAoNA,MAAO,IAAMsC,WAAU,CAAGlG,OAAO,CAC/BN,UAAU,CAACe,gBAAD,CADqB,CAA1B"}
@@ -0,0 +1,16 @@
1
+ import { IconComponent } from '@consta/icons/Icon';
2
+ import { AtomMut } from '@reatom/framework';
3
+ import React from 'react';
4
+ import { FieldControlLayoutProps } from '../../FieldComponents';
5
+ type FieldButtonProps = Omit<FieldControlLayoutProps, 'leftSide' | 'rightSide'> & {
6
+ focusAtom: AtomMut<boolean>;
7
+ clearButtonAtom: AtomMut<boolean>;
8
+ separator?: boolean;
9
+ onClear: (e: React.SyntheticEvent<Element, Event>) => void;
10
+ onDropdownButton?: (e: React.SyntheticEvent<Element, Event>) => void;
11
+ iconClear?: IconComponent;
12
+ leftSide?: React.ReactNode | React.ReactNode[];
13
+ valueAtom: AtomMut<string>;
14
+ };
15
+ export declare const FlatSelectControlLayout: React.ForwardRefExoticComponent<Omit<FieldButtonProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
+ export {};
@@ -0,0 +1,2 @@
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","size","onClear","focusAtom","separator","onDropdownButton","clearButtonAtom","iconClear","view","valueAtom"];import{useAtom}from"@reatom/npm-react";import React,{forwardRef}from"react";import{FieldClearButton,FieldControlLayout}from"../../FieldComponents";export var FlatSelectControlLayout=forwardRef(function(a,b){var c=a.className,d=a.size,e=void 0===d?"s":d,f=a.onClear,g=a.focusAtom,h=a.separator,i=a.onDropdownButton,j=a.clearButtonAtom,k=a.iconClear,l=a.view,m=a.valueAtom,n=_objectWithoutProperties(a,_excluded),o=useAtom(function(a){return a.spy(j)&&!!a.spy(m)}),p=_slicedToArray(o,1),q=p[0];return React.createElement(FieldControlLayout,Object.assign({},n,{size:e,ref:b,className:c,focused:useAtom(g)[0],alignSlots:"center",view:l,rightSide:[q?React.createElement(FieldClearButton,{tabIndex:-1,size:e,onClick:f,icon:k}):void 0]}))});
2
+ //# sourceMappingURL=FlatSelectControlLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlatSelectControlLayout.js","names":["useAtom","React","forwardRef","FieldClearButton","FieldControlLayout","FlatSelectControlLayout","ref","className","size","onClear","focusAtom","separator","onDropdownButton","clearButtonAtom","iconClear","view","valueAtom","props","ctx","spy","clearButton"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.tsx"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React, { forwardRef } from 'react';\n\nimport {\n FieldClearButton,\n FieldControlLayout,\n FieldControlLayoutProps,\n} from '##/components/FieldComponents';\n\ntype FieldButtonProps = Omit<\n FieldControlLayoutProps,\n 'leftSide' | 'rightSide'\n> & {\n focusAtom: AtomMut<boolean>;\n clearButtonAtom: AtomMut<boolean>;\n separator?: boolean;\n onClear: (e: React.SyntheticEvent<Element, Event>) => void;\n onDropdownButton?: (e: React.SyntheticEvent<Element, Event>) => void;\n iconClear?: IconComponent;\n leftSide?: React.ReactNode | React.ReactNode[];\n valueAtom: AtomMut<string>;\n};\n\nexport const FlatSelectControlLayout = forwardRef<\n HTMLDivElement,\n FieldButtonProps\n>(\n (\n {\n className,\n size = 's',\n onClear,\n focusAtom,\n separator,\n onDropdownButton,\n clearButtonAtom,\n iconClear,\n view,\n valueAtom,\n ...props\n },\n ref,\n ) => {\n const [clearButton] = useAtom(\n (ctx) => ctx.spy(clearButtonAtom) && !!ctx.spy(valueAtom),\n );\n\n return (\n <FieldControlLayout\n {...props}\n size={size}\n ref={ref}\n className={className}\n focused={useAtom(focusAtom)[0]}\n alignSlots=\"center\"\n view={view}\n rightSide={[\n clearButton ? (\n <FieldClearButton\n tabIndex={-1}\n size={size}\n onClick={onClear}\n icon={iconClear}\n />\n ) : undefined,\n ]}\n />\n );\n },\n);\n"],"mappings":"+RAEA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OACEC,gBADF,CAEEC,kBAFF,6BAoBA,MAAO,IAAMC,wBAAuB,CAAGH,UAAU,CAI/C,WAcEI,CAdF,CAeK,IAbDC,EAaC,GAbDA,SAaC,KAZDC,IAYC,CAZDA,CAYC,YAZM,GAYN,GAXDC,CAWC,GAXDA,OAWC,CAVDC,CAUC,GAVDA,SAUC,CATDC,CASC,GATDA,SASC,CARDC,CAQC,GARDA,gBAQC,CAPDC,CAOC,GAPDA,eAOC,CANDC,CAMC,GANDA,SAMC,CALDC,CAKC,GALDA,IAKC,CAJDC,CAIC,GAJDA,SAIC,CAHEC,CAGF,yCACmBjB,OAAO,CAC3B,SAACkB,CAAD,QAASA,EAAG,CAACC,GAAJ,CAAQN,CAAR,GAA4B,CAAC,CAACK,CAAG,CAACC,GAAJ,CAAQH,CAAR,CAAvC,CAD2B,CAD1B,uBACII,CADJ,MAKH,MACE,qBAAC,kBAAD,kBACMH,CADN,EAEE,IAAI,CAAET,CAFR,CAGE,GAAG,CAAEF,CAHP,CAIE,SAAS,CAAEC,CAJb,CAKE,OAAO,CAAEP,OAAO,CAACU,CAAD,CAAP,CAAmB,CAAnB,CALX,CAME,UAAU,CAAC,QANb,CAOE,IAAI,CAAEK,CAPR,CAQE,SAAS,CAAE,CACTK,CAAW,CACT,oBAAC,gBAAD,EACE,QAAQ,CAAE,CAAC,CADb,CAEE,IAAI,CAAEZ,CAFR,CAGE,OAAO,CAAEC,CAHX,CAIE,IAAI,CAAEK,CAJR,EADS,OADF,CARb,GAoBH,CA7C8C,CAA1C"}
@@ -0,0 +1 @@
1
+ export * from './FlatSelectControlLayout';
@@ -0,0 +1,2 @@
1
+ export*from"./FlatSelectControlLayout";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectControlLayout/index.ts"],"sourcesContent":["export * from './FlatSelectControlLayout';\n"],"mappings":"AAAA"}