@consta/uikit 4.6.4 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ListCanary/index.d.ts +1 -0
- package/ListCanary/index.js +1 -0
- package/__internal__/src/components/AutoCompleteCanary/useAutoComplete.d.ts +1 -6
- package/__internal__/src/components/Breadcrumbs/useElements.d.ts +6 -6
- package/__internal__/src/components/Breadcrumbs/useElements.js +1 -1
- package/__internal__/src/components/Breadcrumbs/useElements.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenu.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenu.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.css +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.d.ts +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.js.map +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.d.ts +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.js.map +1 -0
- package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -2
- package/__internal__/src/components/ContextMenu/types.d.ts +6 -1
- package/__internal__/src/components/ContextMenu/types.js +1 -1
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js +2 -0
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListAddItem/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/ListAddItem/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListAddItem/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.css +1 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/cnListBox.d.ts +2 -0
- package/__internal__/src/components/ListCanary/ListBox/cnListBox.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/cnListBox.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/index.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListBox/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListCanary.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListCanary.js +2 -0
- package/__internal__/src/components/ListCanary/ListCanary.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.css +1 -0
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.d.ts +5 -0
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js +2 -0
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListDivider/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/ListDivider/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListDivider/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.css +1 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.d.ts +5 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js +2 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListItem/ListItem.css +1 -0
- package/__internal__/src/components/ListCanary/ListItem/ListItem.d.ts +4 -0
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js +2 -0
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListItem/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/ListItem/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListItem/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.css +1 -0
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.d.ts +6 -0
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js +2 -0
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListItemGrid/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/ListItemGrid/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListItemGrid/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.css +1 -0
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.d.ts +10 -0
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js +2 -0
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListLoader/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/ListLoader/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListLoader/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/helper.d.ts +57 -0
- package/__internal__/src/components/ListCanary/helper.js +2 -0
- package/__internal__/src/components/ListCanary/helper.js.map +1 -0
- package/__internal__/src/components/ListCanary/index.d.ts +10 -0
- package/__internal__/src/components/ListCanary/index.js +2 -0
- package/__internal__/src/components/ListCanary/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/maps.d.ts +9 -0
- package/__internal__/src/components/ListCanary/maps.js +2 -0
- package/__internal__/src/components/ListCanary/maps.js.map +1 -0
- package/__internal__/src/components/ListCanary/types.d.ts +72 -44
- package/__internal__/src/components/ListCanary/types.js +1 -1
- package/__internal__/src/components/ListCanary/types.js.map +1 -1
- package/__internal__/src/components/Popover/helpers.d.ts +1 -1
- package/__internal__/src/components/Popover/helpers.js.map +1 -1
- package/__internal__/src/components/Radio/Radio.css +1 -1
- package/__internal__/src/components/Radio/Radio.d.ts +2 -2
- package/__internal__/src/components/Radio/Radio.js +1 -1
- package/__internal__/src/components/Radio/Radio.js.map +1 -1
- package/__internal__/src/components/RadioGroup/RadioGroup.css +1 -1
- package/__internal__/src/components/RadioGroup/helper.d.ts +1 -1
- package/__internal__/src/components/RadioGroup/types.d.ts +1 -1
- package/__internal__/src/components/RadioGroup/types.js +1 -1
- package/__internal__/src/components/RadioGroup/types.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.css +1 -1
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.d.ts +1 -1
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.css +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.d.ts +1 -3
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.css +1 -1
- package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.js.map +1 -1
- package/__internal__/src/components/SelectComponents/helpers.d.ts +1 -1
- package/__internal__/src/components/SelectComponents/helpers.js +1 -1
- package/__internal__/src/components/SelectComponents/helpers.js.map +1 -1
- package/__internal__/src/components/TagBase/TagBase.d.ts +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.css +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.d.ts +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.js +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.js.map +1 -1
- package/__internal__/src/hooks/useRefs/useRefs.d.ts +3 -1
- package/__internal__/src/hooks/useRefs/useRefs.js +1 -1
- package/__internal__/src/hooks/useRefs/useRefs.js.map +1 -1
- package/__internal__/src/hooks/useSelect/useSelect.d.ts +1 -6
- package/__internal__/src/mixs/MixSpace/MixSpace.d.ts +17 -17
- package/__internal__/src/mixs/MixSpace/MixSpace.js.map +1 -1
- package/__internal__/src/utils/getGroups.d.ts +1 -1
- package/__internal__/src/utils/getGroups.js.map +1 -1
- package/package.json +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.css +0 -1
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.d.ts +0 -4
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.js +0 -2
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +0 -1
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/ListCanary";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/ListCanary";
|
|
@@ -34,12 +34,7 @@ declare type GetOptionPropsResult = {
|
|
|
34
34
|
};
|
|
35
35
|
export declare function useAutoComplete<ITEM, GROUP>(params: UseAutoCompleteProps<ITEM, GROUP>): {
|
|
36
36
|
isOpen: boolean;
|
|
37
|
-
visibleItems:
|
|
38
|
-
items: ITEM[];
|
|
39
|
-
key: string | number;
|
|
40
|
-
group?: GROUP | undefined;
|
|
41
|
-
groupIndex: number;
|
|
42
|
-
}[];
|
|
37
|
+
visibleItems: import("../../utils/getGroups").Group<ITEM, GROUP>[];
|
|
43
38
|
getOptionProps: ({ index, item, }: OptionProps<ITEM>) => GetOptionPropsResult;
|
|
44
39
|
handleInputFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
45
40
|
handleInputBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export declare const useElements: <ITEM>(items: ITEM[]) => {
|
|
3
3
|
visibleItems: ITEM[];
|
|
4
4
|
hiddenItems: ITEM[];
|
|
5
|
-
itemsRefs:
|
|
6
|
-
wrapperRef:
|
|
7
|
-
moreRef:
|
|
5
|
+
itemsRefs: import("react").RefObject<HTMLLIElement>[];
|
|
6
|
+
wrapperRef: import("react").RefObject<HTMLUListElement>;
|
|
7
|
+
moreRef: import("react").RefObject<HTMLLIElement> | undefined;
|
|
8
8
|
firstItem: ITEM | undefined;
|
|
9
9
|
lastItem: ITEM | undefined;
|
|
10
10
|
readyToHideItems: ITEM[];
|
|
11
|
-
firstItemRef:
|
|
12
|
-
lastItemRef:
|
|
11
|
+
firstItemRef: import("react").RefObject<HTMLLIElement>;
|
|
12
|
+
lastItemRef: import("react").RefObject<HTMLLIElement>;
|
|
13
13
|
lastWidth: string;
|
|
14
14
|
compression: string;
|
|
15
15
|
elementsSizeSum: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var _excluded=["itemsDimensions","wrapperWidth"];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{useMemo}from"react";import{useHideElementsInLine}from"../../hooks/useHideElementsInLine/useHideElementsInLine";import{useRefs}from"../../hooks/useRefs/useRefs";import{useResizeObserved}from"../../hooks/useResizeObserved/useResizeObserved";var useReadyToHideItems=function(a){return useMemo(function(){
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var _excluded=["itemsDimensions","wrapperWidth"];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{useMemo}from"react";import{useHideElementsInLine}from"../../hooks/useHideElementsInLine/useHideElementsInLine";import{useRefs}from"../../hooks/useRefs/useRefs";import{useResizeObserved}from"../../hooks/useResizeObserved/useResizeObserved";var useReadyToHideItems=function(a){return useMemo(function(){var b=_toConsumableArray(a),c=b.shift(),d=b.pop();return[c,b,d]},[a])},getLastWidth=function(a,b,c,d){var e=b+c.reduce(function(a,b,c){return a+(d[c]?0:b)},0);return"".concat(a-e,"px")},getCompression=function(a){return 380>=a?"s":900>=a?"m":1200>=a?"l":"xl"};export var useElements=function(a){var b=useReadyToHideItems(a),c=_slicedToArray(b,3),d=c[0],e=c[1],f=c[2],g=useRefs(2),h=useResizeObserved(g,function(a){return a?parseInt(getComputedStyle(a).marginRight,10)+parseInt(getComputedStyle(a).marginLeft,10)+a.offsetWidth:0}),i=h.reduce(function(a,b){return a+b},0),j=useHideElementsInLine(e,i,!0),k=j.itemsDimensions,l=j.wrapperWidth,m=_objectWithoutProperties(j,_excluded),n=i+k.reduce(function(a,b){return a+b},0),o=getLastWidth(l,h[0],k,m.hiddenItems),p=getCompression(l);return _objectSpread({firstItem:d,lastItem:f,readyToHideItems:e,firstItemRef:g[0],lastItemRef:g[1],lastWidth:o,compression:p,elementsSizeSum:n},m)};
|
|
2
2
|
//# sourceMappingURL=useElements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useElements.js","names":["useMemo","useHideElementsInLine","useRefs","useResizeObserved","useReadyToHideItems","items","
|
|
1
|
+
{"version":3,"file":"useElements.js","names":["useMemo","useHideElementsInLine","useRefs","useResizeObserved","useReadyToHideItems","items","returnedItems","first","shift","last","pop","getLastWidth","wrapperWidth","fistWidth","itemsDimensions","hiddenItems","widthExceptLast","reduce","previous","current","currentIndex","getCompression","componentWidth","useElements","firstItem","readyToHideItems","lastItem","noHideElementsRef","noHideElementsSize","el","parseInt","getComputedStyle","marginRight","marginLeft","offsetWidth","noHideElementsSizeSum","hideElementsInLineResult","elementsSizeSum","lastWidth","compression","firstItemRef","lastItemRef"],"sources":["../../../../../src/components/Breadcrumbs/useElements.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { useHideElementsInLine } from '../../hooks/useHideElementsInLine/useHideElementsInLine';\nimport { useRefs } from '../../hooks/useRefs/useRefs';\nimport { useResizeObserved } from '../../hooks/useResizeObserved/useResizeObserved';\n\nconst useReadyToHideItems = <ITEM>(items: ITEM[]) =>\n useMemo(() => {\n const returnedItems = [...items];\n const first = returnedItems.shift();\n const last = returnedItems.pop();\n return [first, returnedItems, last] as const;\n }, [items]);\n\nconst getLastWidth = (\n wrapperWidth: number,\n fistWidth: number,\n itemsDimensions: number[],\n hiddenItems: unknown[],\n) => {\n const widthExceptLast =\n fistWidth +\n itemsDimensions.reduce(\n (previous, current, currentIndex) =>\n previous + (hiddenItems[currentIndex] ? 0 : current),\n 0,\n );\n\n const lastWidthCalculate = wrapperWidth - widthExceptLast;\n\n return `${lastWidthCalculate}px`;\n};\n\nconst getCompression = (componentWidth: number) => {\n if (componentWidth <= 380) {\n return 's';\n }\n if (componentWidth <= 900) {\n return 'm';\n }\n if (componentWidth <= 1200) {\n return 'l';\n }\n return 'xl';\n};\n\nexport const useElements = <ITEM>(items: ITEM[]) => {\n const [firstItem, readyToHideItems, lastItem] = useReadyToHideItems(items);\n\n const noHideElementsRef = useRefs<HTMLLIElement>(2);\n\n const noHideElementsSize = useResizeObserved(noHideElementsRef, (el) =>\n el\n ? parseInt(getComputedStyle(el).marginRight, 10) +\n parseInt(getComputedStyle(el).marginLeft, 10) +\n el.offsetWidth\n : 0,\n );\n\n const noHideElementsSizeSum = noHideElementsSize.reduce(\n (previous, current) => previous + current,\n 0,\n );\n\n const { itemsDimensions, wrapperWidth, ...hideElementsInLineResult } =\n useHideElementsInLine<ITEM, HTMLLIElement, HTMLUListElement>(\n readyToHideItems,\n noHideElementsSizeSum,\n true,\n );\n\n const elementsSizeSum =\n noHideElementsSizeSum +\n itemsDimensions.reduce((previous, current) => previous + current, 0);\n\n const lastWidth = getLastWidth(\n wrapperWidth,\n noHideElementsSize[0],\n itemsDimensions,\n hideElementsInLineResult.hiddenItems,\n );\n\n const compression = getCompression(wrapperWidth);\n\n return {\n firstItem,\n lastItem,\n readyToHideItems,\n firstItemRef: noHideElementsRef[0],\n lastItemRef: noHideElementsRef[1],\n lastWidth,\n compression,\n elementsSizeSum,\n ...hideElementsInLineResult,\n };\n};\n"],"mappings":"q7BAAA,OAASA,OAAT,KAAwB,OAAxB,CAEA,OAASC,qBAAT,+DACA,OAASC,OAAT,mCACA,OAASC,iBAAT,uD,GAEMC,oBAAmB,CAAG,SAAOC,CAAP,QAC1BL,QAAO,CAAC,UAAM,IACNM,EAAa,oBAAOD,CAAP,CADP,CAENE,CAAK,CAAGD,CAAa,CAACE,KAAd,EAFF,CAGNC,CAAI,CAAGH,CAAa,CAACI,GAAd,EAHD,CAIZ,MAAO,CAACH,CAAD,CAAQD,CAAR,CAAuBG,CAAvB,CACR,CALM,CAKJ,CAACJ,CAAD,CALI,CADmB,C,CAQtBM,YAAY,CAAG,SACnBC,CADmB,CAEnBC,CAFmB,CAGnBC,CAHmB,CAInBC,CAJmB,CAKhB,IACGC,EAAe,CACnBH,CAAS,CACTC,CAAe,CAACG,MAAhB,CACE,SAACC,CAAD,CAAWC,CAAX,CAAoBC,CAApB,QACEF,EAAQ,EAAIH,CAAW,CAACK,CAAD,CAAX,CAA4B,CAA5B,CAAgCD,CAApC,CADV,CADF,CAGE,CAHF,CAHC,CAWH,gBAF2BP,CAAY,CAAGI,CAE1C,MACD,C,CAEKK,cAAc,CAAG,SAACC,CAAD,CAA4B,OAC3B,IAAlB,EAAAA,CAD6C,CAExC,GAFwC,CAI3B,GAAlB,EAAAA,CAJ6C,CAKxC,GALwC,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AHF,CAIEe,YAAY,CAAEb,CAAiB,CAAC,CAAD,CAJjC,CAKEc,WAAW,CAAEd,CAAiB,CAAC,CAAD,CALhC,CAMEW,SAAS,CAATA,CANF,CAOEC,WAAW,CAAXA,CAPF,CAQEF,eAAe,CAAfA,CARF,EASKD,CATL,CAWD,CAjDM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["isOpen","className","onSetDirection"];import"./ContextMenu.css";import React,{useRef,useState}from"react";import{Transition}from"react-transition-group";import{useFlag}from"../../hooks/useFlag
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["isOpen","className","onSetDirection"];import"./ContextMenu.css";import React,{useRef,useState}from"react";import{Transition}from"react-transition-group";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{useFlag}from"../../hooks/useFlag";import{useForkRef}from"../../hooks/useForkRef";import{animateTimeout,cnMixPopoverAnimate}from"../../mixs/MixPopoverAnimate";import{cn}from"../../utils/bem";import{ContextMenuLevels}from"./ContextMenuLevels";var cnContextMenu=cn("ContextMenuCanary");export var COMPONENT_NAME="ContextMenu";var ContextMenuRender=function(a,b){var c=useRef(null),d=useForkRef([b,c]),e=usePropsHandler(COMPONENT_NAME,a,d),f=e.isOpen,g=e.className,h=e.onSetDirection,i=_objectWithoutProperties(e,_excluded),j=useFlag(),k=_slicedToArray(j,2),l=k[0],m=k[1],n=useFlag(!0),o=_slicedToArray(n,2),p=o[0],q=o[1],r=useState(a.direction),s=_slicedToArray(r,2),t=s[0],u=s[1],v=function(a){u(a),null===h||void 0===h?void 0:h(a)};return React.createElement(Transition,{in:f,unmountOnExit:!0,timeout:animateTimeout,onEntered:q.off,onEnter:m.off,onExit:function onExit(){m.on(),q.on()},nodeRef:c},function(a){return React.createElement(ContextMenuLevels,Object.assign({},i,{ref:d,onSetDirection:v,className:cnContextMenu("Level",{playAnimation:l,eventsNone:p},[g,cnMixPopoverAnimate({animate:a,direction:t})])}))})};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","useRef","useState","Transition","useFlag","useForkRef","animateTimeout","cnMixPopoverAnimate","cn","
|
|
1
|
+
{"version":3,"file":"ContextMenu.js","names":["React","useRef","useState","Transition","usePropsHandler","useFlag","useForkRef","animateTimeout","cnMixPopoverAnimate","cn","ContextMenuLevels","cnContextMenu","COMPONENT_NAME","ContextMenuRender","props","ref","nodeRef","levelRef","isOpen","className","onSetDirection","otherProps","playAnimation","setPlayAnimation","eventsNone","setEventsNone","direction","setDirection","handleSetDirection","d","off","on","animate","ContextMenu","forwardRef"],"sources":["../../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import './ContextMenu.css';\n\nimport React, { useRef, useState } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { Direction } from '##/components/Popover';\nimport { useFlag } from '##/hooks/useFlag';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cn } from '##/utils/bem';\n\nimport { ContextMenuLevels } from './ContextMenuLevels';\nimport { ContextMenuComponent, ContextMenuProps } from './types';\n\nconst cnContextMenu = cn('ContextMenuCanary');\n\nexport const COMPONENT_NAME = 'ContextMenu' as const;\n\nconst ContextMenuRender = (\n props: ContextMenuProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const nodeRef = useRef<HTMLDivElement>(null);\n const levelRef = useForkRef([ref, nodeRef]);\n\n const { isOpen, className, onSetDirection, ...otherProps } = usePropsHandler(\n COMPONENT_NAME,\n props,\n levelRef,\n );\n const [playAnimation, setPlayAnimation] = useFlag();\n const [eventsNone, setEventsNone] = useFlag(true);\n const [direction, setDirection] = useState<Direction | undefined>(\n props.direction,\n );\n\n const handleSetDirection = (d: Direction) => {\n setDirection(d);\n onSetDirection?.(d);\n };\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n timeout={animateTimeout}\n onEntered={setEventsNone.off}\n onEnter={setPlayAnimation.off}\n onExit={() => {\n setPlayAnimation.on();\n setEventsNone.on();\n }}\n nodeRef={nodeRef}\n >\n {(animate) => (\n <ContextMenuLevels\n {...otherProps}\n ref={levelRef}\n onSetDirection={handleSetDirection}\n className={cnContextMenu('Level', { playAnimation, eventsNone }, [\n className,\n cnMixPopoverAnimate({ animate, direction }),\n ])}\n />\n )}\n </Transition>\n );\n};\n\nexport const ContextMenu = React.forwardRef(\n ContextMenuRender,\n) as ContextMenuComponent;\n\nexport * from './types';\n"],"mappings":"4MAAA,0BAEA,MAAOA,MAAP,EAAgBC,MAAhB,CAAwBC,QAAxB,KAAwC,OAAxC,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OAASC,eAAT,2CAEA,OAASC,OAAT,2BACA,OAASC,UAAT,8BACA,OAASC,cAAT,CAAyBC,mBAAzB,oCACA,OAASC,EAAT,uBAEA,OAASC,iBAAT,2BAGA,GAAMC,cAAa,CAAGF,EAAE,CAAC,mBAAD,CAAxB,CAEA,MAAO,IAAMG,eAAc,CAAG,aAAvB,CAEP,GAAMC,kBAAiB,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGrB,IACGC,EAAO,CAAGf,MAAM,CAAiB,IAAjB,CADnB,CAEGgB,CAAQ,CAAGX,UAAU,CAAC,CAACS,CAAD,CAAMC,CAAN,CAAD,CAFxB,GAI0DZ,eAAe,CAC1EQ,cAD0E,CAE1EE,CAF0E,CAG1EG,CAH0E,CAJzE,CAIKC,CAJL,GAIKA,MAJL,CAIaC,CAJb,GAIaA,SAJb,CAIwBC,CAJxB,GAIwBA,cAJxB,CAI2CC,CAJ3C,yCASuChB,OAAO,EAT9C,uBASIiB,CATJ,MASmBC,CATnB,QAUiClB,OAAO,IAVxC,uBAUImB,CAVJ,MAUgBC,CAVhB,QAW+BvB,QAAQ,CACxCY,CAAK,CAACY,SADkC,CAXvC,uBAWIA,CAXJ,MAWeC,CAXf,MAeGC,CAAkB,CAAG,SAACC,CAAD,CAAkB,CAC3CF,CAAY,CAACE,CAAD,CAD+B,QAE3CT,CAF2C,WAE3CA,CAF2C,QAE3CA,CAAc,CAAGS,CAAH,CACf,CAlBE,CAoBH,MACE,qBAAC,UAAD,EACE,GAAIX,CADN,CAEE,aAAa,GAFf,CAGE,OAAO,CAAEX,cAHX,CAIE,SAAS,CAAEkB,CAAa,CAACK,GAJ3B,CAKE,OAAO,CAAEP,CAAgB,CAACO,GAL5B,CAME,MAAM,CAAE,iBAAM,CACZP,CAAgB,CAACQ,EAAjB,EADY,CAEZN,CAAa,CAACM,EAAd,EACD,CATH,CAUE,OAAO,CAAEf,CAVX,EAYG,SAACgB,CAAD,QACC,qBAAC,iBAAD,kBACMX,CADN,EAEE,GAAG,CAAEJ,CAFP,CAGE,cAAc,CAAEW,CAHlB,CAIE,SAAS,CAAEjB,aAAa,CAAC,OAAD,CAAU,CAAEW,aAAa,CAAbA,CAAF,CAAiBE,UAAU,CAAVA,CAAjB,CAAV,CAAyC,CAC/DL,CAD+D,CAE/DX,mBAAmB,CAAC,CAAEwB,OAAO,CAAPA,CAAF,CAAWN,SAAS,CAATA,CAAX,CAAD,CAF4C,CAAzC,CAJ1B,GADD,CAZH,CAyBH,CAjDD,CAmDA,MAAO,IAAMO,YAAW,CAAGjC,KAAK,CAACkC,UAAN,CACzBrB,iBADyB,CAApB,CAIP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ContextMenuLevelCanary{
|
|
1
|
+
.ContextMenuLevelCanary{visibility:hidden;width:240px}.ContextMenuLevelCanary:not(.ContextMenuLevelCanary_firstLevel).ContextMenuLevelCanary_direction_leftStartUp,.ContextMenuLevelCanary:not(.ContextMenuLevelCanary_firstLevel).ContextMenuLevelCanary_direction_rightStartUp{transform:translateY(calc((var(--space-xs) + 1px)*-1))}.ContextMenuLevelCanary:not(.ContextMenuLevelCanary_firstLevel).ContextMenuLevelCanary_direction_leftStartDown,.ContextMenuLevelCanary:not(.ContextMenuLevelCanary_firstLevel).ContextMenuLevelCanary_direction_rightStartDown{transform:translateY(calc(var(--space-xs) + 1px))}.ContextMenuLevelCanary_visible{visibility:visible}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","items","groups","className","levelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId"];function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}import"./ContextMenuLevel.css";import React,{
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","items","groups","className","form","levelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId"];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}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}import"./ContextMenuLevel.css";import{IconArrowRight}from"@consta/icons/IconArrowRight";import React,{forwardRef,useEffect}from"react";import{cnListBox,List,mapIconSize}from"../../ListCanary";import{Popover}from"../../Popover";import{useDebounce}from"../../../hooks/useDebounce";import{useFlag}from"../../../hooks/useFlag/useFlag";import{useRefs}from"../../../hooks/useRefs/useRefs";import{cn}from"../../../utils/bem";import{contextMenuDefaultSize}from"../types";export var cnContextMenuLevel=cn("ContextMenuLevelCanary");var timers=[];export function clearTimers(){var a,b=_createForOfIteratorHelper(timers);try{for(b.s();!(a=b.n()).done;){var c=a.value;clearTimeout(c)}}catch(a){b.e(a)}finally{b.f()}timers=[]}var closeDelay=300,ContextMenuLevelRender=function(a,b){var c=a.size,d=void 0===c?contextMenuDefaultSize:c,e=a.items,f=a.groups,g=a.className,h=a.form,i=void 0===h?"default":h,j=a.levelDepth,k=a.activeItem,l=a.addLevel,m=a.deleteLevel,n=a.setHoveredParenLevel,o=a.hoveredParenLevel,p=a.sortGroup,q=a.onItemClick,r=a.direction,s=a.possibleDirections,t=a.offset,u=a.onSetDirection,v=a.spareDirection,w=a.anchorRef,x=a.getItemLabel,y=a.getItemRightSide,z=a.getItemLeftSide,A=a.getItemSubMenu,B=a.getItemStatus,C=a.getItemDisabled,D=a.getItemKey,E=a.getItemOnClick,F=a.getItemAs,G=a.getItemAttributes,H=a.getItemGroupId,I=a.getItemLeftIcon,J=a.getItemRightIcon,K=a.getGroupLabel,L=a.getGroupId,M=_objectWithoutProperties(a,_excluded),N=useFlag(!1),O=_slicedToArray(N,2),P=O[0],Q=O[1],R=useFlag(!1),S=_slicedToArray(R,2),T=S[0],U=S[1],V=useDebounce(U.on,20),W=function(a){return(D(a)||x(a)).toString()},X=useRefs(e.map(function(a){return W(a)}),[f]);useEffect(function(){return 0!==j&&!P&&o<j&&(clearTimeout(timers[j]),timers[j]=setTimeout(function(){return m(j)},closeDelay)),function(){return clearTimeout(timers[j])}},[P,o]);var Y=function(a){return function(b){var c,d=A(a),e=C(a),f=null===(c=G(a))||void 0===c?void 0:c.onMouseEnter;if(null===f||void 0===f?void 0:f(b),Array.isArray(d)&&!e){var g=W(a);l({level:j+1,items:d,anchorRef:X[g],activeItem:g}),n(j+1)}else n(j)}};return React.createElement(Popover,Object.assign({anchorRef:w,className:cnContextMenuLevel({firstLevel:0===j,direction:r,visible:T},[cnListBox({size:d,form:i,border:!0,shadow:!0}),g]),possibleDirections:s,spareDirection:v,direction:r,offset:t,onSetDirection:function onSetDirection(a){V(),null===u||void 0===u?void 0:u(a)},onMouseEnter:Q.on,onMouseLeave:Q.off,ref:b},M),React.createElement(List,{size:d,items:e,getItemLabel:x,onItemClick:q?function(a,b){var c=b.e;return q({item:a,e:c})}:void 0,sortGroup:p?function(c,a){return p(c.key,a.key)}:void 0,getItemOnClick:E?function(a){return function(b){var c;return null===(c=E(a))||void 0===c?void 0:c({e:b,item:a})}}:void 0,getItemAs:F,getItemAttributes:function getItemAttributes(a){return _objectSpread(_objectSpread({},G(a)),{},{onMouseEnter:Y(a)})},getItemGroupKey:H,getItemLeftIcon:I,getItemRightIcon:J,getItemLeftSide:z,getItemRightSide:function getItemRightSide(a){var b=y(a);if(!A(a))return b;var c=Array.isArray(b)?b:[b];return c.push(React.createElement(IconArrowRight,{size:mapIconSize[d]})),c},getGroupKey:L,getGroupLabel:K,getItemDisabled:C,getItemStatus:B,getItemRef:function getItemRef(a){return X[W(a)]},groups:f,getItemActive:function getItemActive(a){return W(a)===k},innerOffset:"round"===i?"increased":"normal"}))};export var ContextMenuLevel=forwardRef(ContextMenuLevelRender);
|
|
2
2
|
//# sourceMappingURL=ContextMenuLevel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuLevel.js","names":["React","createRef","forwardRef","useEffect","useMemo","useFlag","cn","getByMap","getGroups","Popover","Text","ContextMenuItem","getItemIndex","sizeMapHeader","contextMenuDefaultSize","cnContextMenuLevel","renderHeader","groupLabel","first","size","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevelRender","props","ref","items","groupsProp","groups","className","levelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId","otherProps","hovered","setHovered","a","b","key","itemsRefs","constructItemRefs","refs","group","i","length","setTimeout","onMouseEnter","item","itemIndex","subMenu","disabled","Array","isArray","level","firstLevel","on","off","map","groupIndex","index","onClick","e","ContextMenuLevel"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport React, { createRef, forwardRef, useEffect, useMemo } from 'react';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { cn } from '../../../utils/bem';\nimport { getByMap } from '../../../utils/getByMap';\nimport { getGroups } from '../../../utils/getGroups';\nimport { Popover } from '../../Popover/Popover';\nimport { Text } from '../../Text/Text';\nimport { ContextMenuItem } from '../ContextMenuItem/ContextMenuItem';\nimport { getItemIndex, sizeMapHeader } from '../helpers';\nimport {\n contextMenuDefaultSize,\n ContextMenuLevelComponent,\n ContextMenuLevelProps,\n ContextMenuPropSize,\n} from '../types';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevelCanary');\n\nconst renderHeader = (\n groupLabel: string | number | undefined,\n first: boolean,\n size: ContextMenuPropSize = contextMenuDefaultSize,\n): React.ReactNode | null => {\n if (!groupLabel) {\n if (first) {\n return null;\n }\n return <div className={cnContextMenuLevel('Divider', { size })} />;\n }\n return (\n <Text\n view=\"secondary\"\n transform=\"uppercase\"\n className={cnContextMenuLevel('Header', { size, first })}\n size={getByMap(sizeMapHeader, size)}\n >\n {groupLabel}\n </Text>\n );\n};\n\nlet timers: ReturnType<typeof setTimeout>[] = [];\nexport function clearTimers() {\n for (const timer of timers) {\n clearTimeout(timer);\n }\n timers = [];\n}\nconst closeDelay = 300;\n\nconst ContextMenuLevelRender = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n size = contextMenuDefaultSize,\n items,\n groups: groupsProp,\n className,\n // Свойства относящиеся к меню\n levelDepth,\n activeItem,\n addLevel,\n deleteLevel,\n setHoveredParenLevel,\n hoveredParenLevel,\n sortGroup,\n onItemClick,\n // Свойства для поповера\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n spareDirection,\n anchorRef,\n // Геттеры для ITEM\n getItemLabel,\n getItemRightSide,\n getItemLeftSide,\n getItemSubMenu,\n getItemStatus,\n getItemDisabled,\n getItemKey,\n getItemOnClick,\n getItemAs,\n getItemAttributes,\n getItemGroupId,\n getItemLeftIcon,\n getItemRightIcon,\n // Геттеры для GROUP\n getGroupLabel,\n getGroupId,\n ...otherProps\n } = props;\n\n const [hovered, setHovered] = useFlag(false);\n\n const groups = getGroups<ITEM, GROUP>(\n items,\n getItemGroupId,\n groupsProp,\n getGroupId,\n sortGroup && ((a, b) => sortGroup(a.key, b.key)),\n );\n\n const constructItemRefs: () => Record<\n string,\n React.RefObject<HTMLDivElement>\n > = () => {\n const refs: Record<string, React.RefObject<HTMLDivElement>> = {};\n\n for (const group of groups) {\n for (let i = 0; i < items.length; i++) {\n refs[getItemIndex(group.key, i)] = createRef<HTMLDivElement>();\n }\n }\n return refs;\n };\n\n const itemsRefs = useMemo(constructItemRefs, [items, groupsProp]);\n\n useEffect(() => {\n if (levelDepth !== 0 && !hovered && hoveredParenLevel < levelDepth) {\n clearTimeout(timers[levelDepth]);\n timers[levelDepth] = setTimeout(\n () => deleteLevel(levelDepth),\n closeDelay,\n );\n }\n return () => clearTimeout(timers[levelDepth]);\n }, [hovered, hoveredParenLevel]);\n\n const onMouseEnter = (item: ITEM, itemIndex: string) => {\n const subMenu = getItemSubMenu(item);\n const disabled = getItemDisabled(item);\n if (Array.isArray(subMenu) && !disabled) {\n addLevel({\n level: levelDepth + 1,\n items: subMenu,\n anchorRef: itemsRefs[itemIndex],\n activeItem: itemIndex,\n });\n setHoveredParenLevel(levelDepth + 1);\n } else {\n setHoveredParenLevel(levelDepth);\n }\n };\n\n return (\n <Popover\n anchorRef={anchorRef}\n className={cnContextMenuLevel(\n { firstLevel: levelDepth === 0, direction },\n [className],\n )}\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n onSetDirection={onSetDirection}\n onMouseEnter={setHovered.on}\n onMouseLeave={setHovered.off}\n ref={ref}\n {...otherProps}\n >\n {groups.map((group, groupIndex) => {\n return (\n <div\n className={cnContextMenuLevel('Group', { size })}\n key={group.key}\n >\n {renderHeader(\n group.group && getGroupLabel(group.group),\n groupIndex === 0,\n size,\n )}\n {group.items.map((item, index) => {\n const itemIndex = getItemIndex(group.key, index);\n const onClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (!getItemDisabled(item)) {\n if (typeof getItemOnClick(item) === 'function') {\n getItemOnClick(item)?.({ e, item });\n }\n if (typeof onItemClick === 'function') {\n onItemClick?.({ e, item });\n }\n }\n };\n return (\n <ContextMenuItem\n label={getItemLabel(item)}\n rightSide={getItemRightSide(item)}\n rightIcon={getItemRightIcon(item)}\n leftSide={getItemLeftSide(item)}\n leftIcon={getItemLeftIcon(item)}\n status={getItemStatus(item)}\n key={cnContextMenuLevel('Item', { groupIndex, index })}\n disabled={getItemDisabled(item)}\n onClick={onClick}\n as={getItemAs(item)}\n {...(getItemAttributes(item) ?? {})}\n ref={itemsRefs[itemIndex]}\n className={cnContextMenuLevel('Item')}\n onMouseEnter={() => onMouseEnter(item, itemIndex)}\n active={activeItem === itemIndex}\n size={size}\n withSubMenu={!!getItemSubMenu(item)}\n />\n );\n })}\n </div>\n );\n })}\n </Popover>\n );\n};\n\nexport const ContextMenuLevel = forwardRef(\n ContextMenuLevelRender,\n) as ContextMenuLevelComponent;\n"],"mappings":"uyDAAA,+BAEA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,UAA3B,CAAuCC,SAAvC,CAAkDC,OAAlD,KAAiE,OAAjE,CAEA,OAASC,OAAT,sCACA,OAASC,EAAT,0BACA,OAASC,QAAT,+BACA,OAASC,SAAT,gCACA,OAASC,OAAT,6BACA,OAASC,IAAT,uBACA,OAASC,eAAT,0CACA,OAASC,YAAT,CAAuBC,aAAvB,kBACA,OACEC,sBADF,gBAOA,MAAO,IAAMC,mBAAkB,CAAGT,EAAE,CAAC,wBAAD,CAA7B,C,GAEDU,aAAY,CAAG,SACnBC,CADmB,CAEnBC,CAFmB,CAIQ,IAD3BC,EAC2B,wDADCL,sBACD,OACtBG,EADsB,CAQzB,oBAAC,IAAD,EACE,IAAI,CAAC,WADP,CAEE,SAAS,CAAC,WAFZ,CAGE,SAAS,CAAEF,kBAAkB,CAAC,QAAD,CAAW,CAAEI,IAAI,CAAJA,CAAF,CAAQD,KAAK,CAALA,CAAR,CAAX,CAH/B,CAIE,IAAI,CAAEX,QAAQ,CAACM,aAAD,CAAgBM,CAAhB,CAJhB,EAMGF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EpC,CAAe,CAACwB,CAAD,CAR3B,CASE,OAAO,CApBK,QAAVa,QAAU,CAACC,CAAD,CAAyC,CACvD,GAAI,CAACtC,CAAe,CAACwB,CAAD,CAApB,CAA4B,CAC1B,GAAoC,UAAhC,QAAOtB,EAAc,CAACsB,CAAD,CAAzB,CAAgD,iBAC9CtB,CAAc,CAACsB,CAAD,CADgC,qBAC9C,EAAuB,CAAEc,CAAC,CAADA,CAAF,CAAKd,IAAI,CAAJA,CAAL,CAAvB,CACD,CAC0B,UAAvB,QAAOpC,EAJe,UAKxBA,CALwB,WAKxBA,CALwB,QAKxBA,CAAW,CAAG,CAAEkD,CAAC,CAADA,CAAF,CAAKd,IAAI,CAAJA,CAAL,CAAH,CALa,CAO3B,CACF,CAEC,CAUE,EAAE,CAAErB,CAAS,CAACqB,CAAD,CAVf,YAWOpB,CAAiB,CAACoB,CAAD,CAXxB,gBAWkC,EAXlC,EAYE,GAAG,CAAER,CAAS,CAACS,CAAD,CAZhB,CAaE,SAAS,CAAE7D,kBAAkB,CAAC,MAAD,CAb/B,CAcE,YAAY,CAAE,8BAAM2D,EAAY,CAACC,CAAD,CAAOC,CAAP,CAAlB,CAdhB,CAeE,MAAM,CAAE3C,CAAU,GAAK2C,CAfzB,CAgBE,IAAI,CAAEzD,CAhBR,CAiBE,WAAW,CAAE,CAAC,CAAC8B,CAAc,CAAC0B,CAAD,CAjB/B,GAoBH,CAjCA,CATH,CA6CH,CA/CA,CAhBH,CAkEH,C,CAED,MAAO,IAAMe,iBAAgB,CAAGxF,UAAU,CACxCuB,sBADwC,CAAnC"}
|
|
1
|
+
{"version":3,"file":"ContextMenuLevel.js","names":["IconArrowRight","React","forwardRef","useEffect","cnListBox","List","mapIconSize","Popover","useDebounce","useFlag","useRefs","cn","contextMenuDefaultSize","cnContextMenuLevel","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevelRender","props","ref","size","items","groupsProp","groups","className","form","levelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId","otherProps","hovered","setHovered","visible","setVisible","setVisibleTrue","on","getKey","item","toString","itemsRefs","map","setTimeout","onMouseEnter","e","subMenu","disabled","Array","isArray","key","level","firstLevel","border","shadow","off","a","b","side","sides","push","ContextMenuLevel"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport { cnListBox, List, mapIconSize } from '##/components/ListCanary';\nimport { Popover } from '##/components/Popover';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag/useFlag';\nimport { useRefs } from '##/hooks/useRefs/useRefs';\nimport { cn } from '##/utils/bem';\n\nimport {\n contextMenuDefaultSize,\n ContextMenuItemDefault,\n ContextMenuLevelComponent,\n ContextMenuLevelProps,\n} from '../types';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevelCanary');\n\nlet timers: ReturnType<typeof setTimeout>[] = [];\nexport function clearTimers() {\n for (const timer of timers) {\n clearTimeout(timer);\n }\n timers = [];\n}\n\nconst closeDelay = 300;\n\nconst ContextMenuLevelRender = (\n props: ContextMenuLevelProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n size = contextMenuDefaultSize,\n items,\n groups: groupsProp,\n className,\n form = 'default',\n // Свойства относящиеся к меню\n levelDepth,\n activeItem,\n addLevel,\n deleteLevel,\n setHoveredParenLevel,\n hoveredParenLevel,\n sortGroup,\n onItemClick,\n // Свойства для поповера\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n spareDirection,\n anchorRef,\n // Геттеры для ITEM\n getItemLabel,\n getItemRightSide,\n getItemLeftSide,\n getItemSubMenu,\n getItemStatus,\n getItemDisabled,\n getItemKey,\n getItemOnClick,\n getItemAs,\n getItemAttributes,\n getItemGroupId,\n getItemLeftIcon,\n getItemRightIcon,\n // Геттеры для GROUP\n getGroupLabel,\n getGroupId,\n\n ...otherProps\n } = props;\n\n const [hovered, setHovered] = useFlag(false);\n // скрываем блок пока не найдем тоную позицию для оображения\n const [visible, setVisible] = useFlag(false);\n\n const setVisibleTrue = useDebounce(setVisible.on, 20);\n\n const getKey = (item: ContextMenuItemDefault) =>\n (getItemKey(item) || getItemLabel(item)).toString();\n\n const itemsRefs = useRefs<HTMLDivElement, string[]>(\n items.map((item) => getKey(item)),\n [groupsProp],\n );\n\n useEffect(() => {\n if (levelDepth !== 0 && !hovered && hoveredParenLevel < levelDepth) {\n clearTimeout(timers[levelDepth]);\n timers[levelDepth] = setTimeout(\n () => deleteLevel(levelDepth),\n closeDelay,\n );\n }\n return () => clearTimeout(timers[levelDepth]);\n }, [hovered, hoveredParenLevel]);\n\n const onMouseEnter =\n (\n item: ContextMenuItemDefault,\n ): JSX.IntrinsicElements['div']['onMouseEnter'] =>\n (e) => {\n const subMenu = getItemSubMenu(item);\n const disabled = getItemDisabled(item);\n const onMouseEnter = getItemAttributes(item)\n ?.onMouseEnter as JSX.IntrinsicElements['div']['onMouseEnter'];\n\n onMouseEnter?.(e);\n\n if (Array.isArray(subMenu) && !disabled) {\n const key = getKey(item);\n addLevel({\n level: levelDepth + 1,\n items: subMenu,\n anchorRef: itemsRefs[key],\n activeItem: key,\n });\n setHoveredParenLevel(levelDepth + 1);\n } else {\n setHoveredParenLevel(levelDepth);\n }\n };\n\n return (\n <Popover\n anchorRef={anchorRef}\n className={cnContextMenuLevel(\n { firstLevel: levelDepth === 0, direction, visible },\n [cnListBox({ size, form, border: true, shadow: true }), className],\n )}\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n onSetDirection={(item) => {\n setVisibleTrue();\n onSetDirection?.(item);\n }}\n onMouseEnter={setHovered.on}\n onMouseLeave={setHovered.off}\n ref={ref}\n {...otherProps}\n >\n <List\n size={size}\n items={items}\n getItemLabel={getItemLabel}\n onItemClick={\n onItemClick\n ? (item, { e }) =>\n onItemClick({ item, e: e as React.MouseEvent<HTMLDivElement> })\n : undefined\n }\n sortGroup={sortGroup ? (a, b) => sortGroup(a.key, b.key) : undefined}\n getItemOnClick={\n getItemOnClick\n ? (item) => (e) =>\n getItemOnClick(item)?.({\n e: e as React.MouseEvent<HTMLDivElement>,\n item,\n })\n : undefined\n }\n getItemAs={getItemAs}\n getItemAttributes={(item) =>\n ({\n ...getItemAttributes(item),\n onMouseEnter: onMouseEnter(item),\n } as JSX.IntrinsicElements[keyof JSX.IntrinsicElements])\n }\n getItemGroupKey={getItemGroupId}\n getItemLeftIcon={getItemLeftIcon}\n getItemRightIcon={getItemRightIcon}\n getItemLeftSide={getItemLeftSide}\n getItemRightSide={(item) => {\n const side = getItemRightSide(item);\n if (!getItemSubMenu(item)) {\n return side;\n }\n\n const sides: React.ReactNode[] = Array.isArray(side) ? side : [side];\n sides.push(<IconArrowRight size={mapIconSize[size]} />);\n return sides;\n }}\n getGroupKey={getGroupId}\n getGroupLabel={getGroupLabel}\n getItemDisabled={getItemDisabled}\n getItemStatus={getItemStatus}\n getItemRef={(item) => itemsRefs[getKey(item)]}\n groups={groupsProp}\n getItemActive={(item) => getKey(item) === activeItem}\n innerOffset={form === 'round' ? 'increased' : 'normal'}\n />\n </Popover>\n );\n};\n\nexport const ContextMenuLevel = forwardRef(\n ContextMenuLevelRender,\n) as ContextMenuLevelComponent;\n"],"mappings":"m9EAAA,+BAEA,OAASA,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OAASC,SAAT,CAAoBC,IAApB,CAA0BC,WAA1B,wBACA,OAASC,OAAT,qBAC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["../../../../../../src/components/ContextMenu/ContextMenuLevel/index.ts"],"sourcesContent":["export * from './ContextMenuLevel';\n"],"mappings":"AAAA"}
|
|
@@ -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"];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,{useEffect,useState}from"react";import{useClickOutside}from"../../../hooks/useClickOutside
|
|
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"];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,{useEffect,useState}from"react";import{directions}from"../../Popover";import{useClickOutside}from"../../../hooks/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{useRefs}from"../../../hooks/useRefs";import{clearTimers,ContextMenuLevel}from"../ContextMenuLevel";import{getLevels,withDefaultGetters}from"../helpers";import{contextMenuPropDefaultSubMenuDirection,contextMenuPropSubMenuDirections}from"../types";var ContextMenuLevelsRender=function(a,b){var c=withDefaultGetters(a),d=c.items,e=c.anchorRef,f=c.position,g=c.direction,h=c.possibleDirections,i=void 0===h?directions:h,j=c.offset,k=c.onClickOutside,l=c.getItemKey,m=c.getItemLabel,n=c.getItemSubMenu,o=c.style,p=c.spareDirection,q=c.subMenuDirection,r=void 0===q?contextMenuPropDefaultSubMenuDirection:q,s=_objectWithoutProperties(c,_excluded),t=[{items:d,anchorRef:e,position:f,direction:g,possibleDirections:i,offset:j}],u=useState(t),v=_slicedToArray(u,2),w=v[0],x=v[1],y=useState(r),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useState(-1),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useRefs(w.length),H=function(a){var b=a.level,c=a.items,d=a.anchorRef,e=a.activeItem,f=_toConsumableArray(w),g=f[b]&&1<f.length-b?f[b].direction:void 0;f[b]&&1<f.length-b&&g&&B(g),f[b-1].activeItem=e,f.splice(b),f.push({items:c,anchorRef:d,direction:g||A,possibleDirections:contextMenuPropSubMenuDirections,position:void 0}),x(f)},I=function(a){var b=_toConsumableArray(w);b.splice(a),b[a-1]=_objectSpread(_objectSpread({},b[a-1]),{},{activeItem:void 0}),x(b)};useClickOutside({isActive:!!k,ignoreClicksInsideRefs:[].concat(_toConsumableArray(G),[e||{current:null}]),handler:function handler(a){return null===k||void 0===k?void 0:k(a)}}),useEffect(function(){return clearTimers(),x(getLevels({levels:w,items:d,getItemKey:l,getItemSubMenu:n})),function(){return clearTimers()}},[d]);var J=useForkRef([G[0],b]);return useEffect(function(){x(t)},[f]),React.createElement(React.Fragment,null,w.map(function(a,b){return React.createElement(ContextMenuLevel,Object.assign({},s,a,{key:"ContextMenu-".concat(b),style:_objectSpread(_objectSpread({},o),{zIndex:"number"==typeof(null===o||void 0===o?void 0:o.zIndex)?o.zIndex+1:void 0}),levelDepth:b,getItemLabel:m,addLevel:H,deleteLevel:I,onSetDirection:0<b?B:c.onSetDirection,hoveredParenLevel:E,setHoveredParenLevel:F,getItemSubMenu:n,getItemKey:l,ref:0===b?J:G[b],spareDirection:0===b?p:"rightStartUp"}))}))};export var ContextMenuLevels=React.forwardRef(ContextMenuLevelsRender);
|
|
2
2
|
//# sourceMappingURL=ContextMenuLevels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuLevels.js","names":["React","useEffect","useState","useClickOutside","useForkRef","useRefs","
|
|
1
|
+
{"version":3,"file":"ContextMenuLevels.js","names":["React","useEffect","useState","directions","useClickOutside","useForkRef","useRefs","clearTimers","ContextMenuLevel","getLevels","withDefaultGetters","contextMenuPropDefaultSubMenuDirection","contextMenuPropSubMenuDirections","ContextMenuLevelsRender","propsComponent","ref","props","items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","subMenuDirectionProp","otherProps","defaultLevels","levels","setLevels","setSubMenuDirection","hoveredParenLevel","setHoveredParenLevel","levelsRefs","length","addLevel","level","activeItem","newLevels","oldDirection","splice","push","deleteLevel","isActive","ignoreClicksInsideRefs","current","handler","e","firstLevelRef","map","index","zIndex","onSetDirection","ContextMenuLevels","forwardRef"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\n\nimport { Direction, directions } from '##/components/Popover';\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { useRefs } from '##/hooks/useRefs';\n\nimport { clearTimers, ContextMenuLevel } from '../ContextMenuLevel';\nimport { getLevels, withDefaultGetters } from '../helpers';\nimport {\n AddLevel,\n ContextMenuComponent,\n contextMenuPropDefaultSubMenuDirection,\n ContextMenuProps,\n contextMenuPropSubMenuDirections,\n Level,\n} from '../types';\n\nconst ContextMenuLevelsRender = (\n propsComponent: ContextMenuProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const props = withDefaultGetters(propsComponent);\n const {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections = directions,\n offset,\n onClickOutside,\n getItemKey,\n getItemLabel,\n getItemSubMenu,\n style,\n spareDirection,\n subMenuDirection:\n subMenuDirectionProp = contextMenuPropDefaultSubMenuDirection,\n ...otherProps\n } = props;\n\n type Item = typeof items[number];\n\n const defaultLevels: Level<Item>[] = [\n {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n } as Level<Item>,\n ];\n\n const [levels, setLevels] = useState<Level<Item>[]>(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 }) => {\n const newLevels = [...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,\n direction: oldDirection || subMenuDirection,\n possibleDirections: contextMenuPropSubMenuDirections,\n position: undefined,\n });\n setLevels(newLevels);\n };\n\n const deleteLevel = (level: number) => {\n const newLevels = [...levels];\n newLevels.splice(level);\n newLevels[level - 1] = { ...newLevels[level - 1], activeItem: undefined };\n setLevels(newLevels);\n };\n\n useClickOutside({\n isActive: !!onClickOutside,\n ignoreClicksInsideRefs: [...levelsRefs, anchorRef || { current: null }],\n handler: (e) => onClickOutside?.(e),\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 const firstLevelRef = useForkRef([levelsRefs[0], ref]);\n\n useEffect(() => {\n setLevels(defaultLevels);\n }, [position]);\n\n return (\n <>\n {levels.map((level, index) => (\n <ContextMenuLevel\n {...otherProps}\n {...level}\n key={`ContextMenu-${index}`}\n style={{\n ...style,\n ...{\n zIndex:\n typeof style?.zIndex === 'number'\n ? style.zIndex + 1\n : undefined,\n },\n }}\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={index === 0 ? firstLevelRef : levelsRefs[index]}\n spareDirection={index === 0 ? spareDirection : 'rightStartUp'}\n />\n ))}\n </>\n );\n};\n\nexport const ContextMenuLevels = React.forwardRef(\n ContextMenuLevelsRender,\n) as ContextMenuComponent;\n"],"mappings":"ukCAAA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,QAA3B,KAA2C,OAA3C,CAEA,OAAoBC,UAApB,qBACA,OAASC,eAAT,sCACA,OAASC,UAAT,iCACA,OAASC,OAAT,8BAEA,OAASC,WAAT,CAAsBC,gBAAtB,2BACA,OAASC,SAAT,CAAoBC,kBAApB,kBACA,OAGEC,sCAHF,CAKEC,gCALF,gBASA,GAAMC,wBAAuB,CAAG,SAC9BC,CAD8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U,CAACiB,CAAD,CAxB/C,CAyBE,cAAc,CAAY,CAAV,GAAAA,CAAK,CAAS3B,CAAT,CAA0B,cAzBjD,GADU,CAAX,CADH,CAgCH,CAxID,CA0IA,MAAO,IAAM8B,kBAAiB,CAAG1D,KAAK,CAAC2D,UAAN,CAC/B9C,uBAD+B,CAA1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ContextMenuLevels';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevels/index.ts"],"sourcesContent":["export * from './ContextMenuLevels';\n"],"mappings":"AAAA"}
|
|
@@ -16,10 +16,11 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuProps<
|
|
|
16
16
|
onSetDirection?: ((direction: "downCenter" | "upCenter" | "downRight" | "downLeft" | "upRight" | "upLeft" | "leftUp" | "leftCenter" | "leftDown" | "rightUp" | "rightCenter" | "rightDown" | "downStartLeft" | "upStartLeft" | "downStartRight" | "upStartRight" | "leftStartUp" | "leftStartDown" | "rightStartUp" | "rightStartDown") => void) | undefined;
|
|
17
17
|
onClickOutside?: import("../../hooks/useClickOutside").ClickOutsideHandler | undefined;
|
|
18
18
|
isOpen?: boolean | undefined;
|
|
19
|
+
form?: "default" | "round" | "brick" | undefined;
|
|
19
20
|
} & import("./types").MappersItem<ITEM> & MappersGroup<GROUP> & {
|
|
20
21
|
anchorRef: import("react").RefObject<HTMLElement>;
|
|
21
22
|
position?: undefined;
|
|
22
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "
|
|
23
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "form" | "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "onItemClick" | "sortGroup" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "subMenuDirection" | keyof import("./types").MappersItem<ITEM_1> | keyof MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
23
24
|
id: unknown;
|
|
24
25
|
} ? {} : {
|
|
25
26
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -57,10 +58,11 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuProps<
|
|
|
57
58
|
onSetDirection?: ((direction: "downCenter" | "upCenter" | "downRight" | "downLeft" | "upRight" | "upLeft" | "leftUp" | "leftCenter" | "leftDown" | "rightUp" | "rightCenter" | "rightDown" | "downStartLeft" | "upStartLeft" | "downStartRight" | "upStartRight" | "leftStartUp" | "leftStartDown" | "rightStartUp" | "rightStartDown") => void) | undefined;
|
|
58
59
|
onClickOutside?: import("../../hooks/useClickOutside").ClickOutsideHandler | undefined;
|
|
59
60
|
isOpen?: boolean | undefined;
|
|
61
|
+
form?: "default" | "round" | "brick" | undefined;
|
|
60
62
|
} & import("./types").MappersItem<ITEM> & MappersGroup<GROUP> & {
|
|
61
63
|
anchorRef?: undefined;
|
|
62
64
|
position: import("../Popover").Position;
|
|
63
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "
|
|
65
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "form" | "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "onItemClick" | "sortGroup" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "subMenuDirection" | keyof import("./types").MappersItem<ITEM_1> | keyof MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
64
66
|
id: unknown;
|
|
65
67
|
} ? {} : {
|
|
66
68
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconComponent } from '@consta/icons/Icon';
|
|
3
|
+
import { ListPropForm } from "../ListCanary";
|
|
3
4
|
import { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';
|
|
4
5
|
import { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';
|
|
5
6
|
import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
@@ -10,6 +11,9 @@ export declare const contextMenuDefaultSize: ContextMenuPropSize;
|
|
|
10
11
|
export declare const contextMenuStatus: readonly ["alert", "success", "warning"];
|
|
11
12
|
export declare type ContextMenuStatus = typeof contextMenuStatus[number];
|
|
12
13
|
export declare const contextMenuDefaultStatus: ContextMenuStatus;
|
|
14
|
+
export declare const contextMenuForm: readonly ["default", "brick", "round"];
|
|
15
|
+
export declare type ContextMenuForm = ListPropForm;
|
|
16
|
+
export declare const defaultContextMenuForm: "default";
|
|
13
17
|
export declare const contextMenuPropSubMenuDirections: readonly ["rightStartUp", "rightStartDown", "leftStartUp", "leftStartDown"];
|
|
14
18
|
export declare type ContextMenuPropSubMenuDirection = typeof contextMenuPropSubMenuDirections[number];
|
|
15
19
|
export declare const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection;
|
|
@@ -105,6 +109,7 @@ export declare type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = Cont
|
|
|
105
109
|
onSetDirection?: (direction: Direction) => void;
|
|
106
110
|
onClickOutside?: ClickOutsideHandler;
|
|
107
111
|
isOpen?: boolean;
|
|
112
|
+
form?: ContextMenuForm;
|
|
108
113
|
} & MappersItem<ITEM> & MappersGroup<GROUP> & PositioningProps, HTMLDivElement> & (GROUP extends {
|
|
109
114
|
id: ContextMenuGroupDefault['id'] | unknown;
|
|
110
115
|
} ? {} : {
|
|
@@ -115,7 +120,7 @@ export declare type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = Cont
|
|
|
115
120
|
getItemLabel: ContextMenuPropGetItemLabel<ITEM>;
|
|
116
121
|
});
|
|
117
122
|
export declare type ContextMenuComponent = <ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault>(props: ContextMenuProps<ITEM, GROUP>) => React.ReactElement | null;
|
|
118
|
-
export declare type ContextMenuLevelProps<ITEM, GROUP> = Omit<ContextMenuProps<ITEM, GROUP>, 'subMenuDirection' | 'onClickOutside' | keyof MappersItem<ITEM> | keyof MappersGroup<GROUP>> & {
|
|
123
|
+
export declare type ContextMenuLevelProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault> = Omit<ContextMenuProps<ITEM, GROUP>, 'subMenuDirection' | 'onClickOutside' | keyof MappersItem<ITEM> | keyof MappersGroup<GROUP>> & {
|
|
119
124
|
levelDepth: number;
|
|
120
125
|
addLevel: AddLevel<ITEM>;
|
|
121
126
|
deleteLevel: (level: number) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var contextMenuSizes=["m","xs","s","l"];export var contextMenuDefaultSize=contextMenuSizes[0];export var contextMenuStatus=["alert","success","warning"];export var contextMenuDefaultStatus=contextMenuStatus[0];export var contextMenuPropSubMenuDirections=["rightStartUp","rightStartDown","leftStartUp","leftStartDown"];export var contextMenuPropDefaultSubMenuDirection=contextMenuPropSubMenuDirections[0];
|
|
1
|
+
import{defaultListPropForm,listPropForm}from"../ListCanary";export var contextMenuSizes=["m","xs","s","l"];export var contextMenuDefaultSize=contextMenuSizes[0];export var contextMenuStatus=["alert","success","warning"];export var contextMenuDefaultStatus=contextMenuStatus[0];export var contextMenuForm=listPropForm;export var defaultContextMenuForm=defaultListPropForm;export var contextMenuPropSubMenuDirections=["rightStartUp","rightStartDown","leftStartUp","leftStartDown"];export var contextMenuPropDefaultSubMenuDirection=contextMenuPropSubMenuDirections[0];
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport { PropsWithHTMLAttributesAndRef } 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 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 ContextMenuPropOnClick<ITEM> = (params: {\n e: React.MouseEvent<HTMLDivElement>;\n item: ITEM;\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?: ContextMenuPropOnClick<ContextMenuItemDefault>;\n as?: keyof JSX.IntrinsicElements;\n attributes?: JSX.IntrinsicElements[keyof JSX.IntrinsicElements];\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => ContextMenuPropOnClick<ITEM> | undefined;\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type ContextMenuPropGetItemAs<ITEM> = (\n item: ITEM,\n) => keyof JSX.IntrinsicElements | undefined;\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | undefined;\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\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} & PositioningProps;\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n anchorRef?: React.RefObject<HTMLElement>;\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?: ContextMenuPropOnClick<ITEM>;\n possibleDirections?: readonly Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\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 ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ContextMenuLevelProps
|
|
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';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport { PropsWithHTMLAttributesAndRef } 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 ContextMenuPropOnClick<ITEM> = (params: {\n e: React.MouseEvent<HTMLDivElement>;\n item: ITEM;\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?: ContextMenuPropOnClick<ContextMenuItemDefault>;\n as?: keyof JSX.IntrinsicElements;\n attributes?: JSX.IntrinsicElements[keyof JSX.IntrinsicElements];\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) => ContextMenuPropOnClick<ITEM> | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (\n item: ITEM,\n) => keyof JSX.IntrinsicElements | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | 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} & PositioningProps;\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n anchorRef?: React.RefObject<HTMLElement>;\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?: ContextMenuPropOnClick<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 } & 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 ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\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} & 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.ReactElement | null;\n\nexport type ContextMenuItemProps<\n AS extends keyof JSX.IntrinsicElements = '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 = <\n AS extends keyof JSX.IntrinsicElements = 'div',\n>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAWA,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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ListAddItemProps } from '../types';
|
|
3
|
+
export declare const ListAddItem: React.ForwardRefExoticComponent<Pick<ListAddItemProps, "label" | "slot" | "style" | "title" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "active" | "innerOffset" | "underLine"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","innerOffset","underLine"];import{IconAdd}from"@consta/icons/IconAdd";import React,{forwardRef}from"react";import{ListDivider,ListItem}from"..";import{mapGroupVerticalSpaseBottom,mapHorisontalSpase,mapHorisontalSpaseIncreased}from"../maps";import{defaultListPropSize}from"../types";export var ListAddItem=forwardRef(function(a,b){var c=a.size,d=void 0===c?defaultListPropSize:c,e=a.innerOffset,f=a.underLine,g=_objectWithoutProperties(a,_excluded),h="increased"===e?mapHorisontalSpaseIncreased[d]:mapHorisontalSpase[d];return React.createElement(React.Fragment,null,React.createElement(ListItem,Object.assign({},g,{size:d,ref:b,leftIcon:IconAdd,space:{pH:h,pV:mapGroupVerticalSpaseBottom[d]}})),f&&React.createElement(ListDivider,{size:d,space:{mH:h}}))});
|
|
2
|
+
//# sourceMappingURL=ListAddItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListAddItem.js","names":["IconAdd","React","forwardRef","ListDivider","ListItem","mapGroupVerticalSpaseBottom","mapHorisontalSpase","mapHorisontalSpaseIncreased","defaultListPropSize","ListAddItem","props","ref","size","innerOffset","underLine","otherProps","horisontalSpase","pH","pV","mH"],"sources":["../../../../../../src/components/ListCanary/ListAddItem/ListAddItem.tsx"],"sourcesContent":["import { IconAdd } from '@consta/icons/IconAdd';\nimport React, { forwardRef } from 'react';\n\nimport { ListDivider, ListItem } from '..';\nimport {\n mapGroupVerticalSpaseBottom,\n mapHorisontalSpase,\n mapHorisontalSpaseIncreased,\n} from '../maps';\nimport { defaultListPropSize, ListAddItemProps } from '../types';\n\nexport const ListAddItem = forwardRef<HTMLDivElement, ListAddItemProps>(\n (props, ref) => {\n const {\n size = defaultListPropSize,\n innerOffset,\n underLine,\n ...otherProps\n } = props;\n\n const horisontalSpase =\n innerOffset === 'increased'\n ? mapHorisontalSpaseIncreased[size]\n : mapHorisontalSpase[size];\n\n return (\n <>\n <ListItem\n {...otherProps}\n size={size}\n ref={ref}\n leftIcon={IconAdd}\n space={{\n pH: horisontalSpase,\n pV: mapGroupVerticalSpaseBottom[size],\n }}\n />\n {underLine && (\n <ListDivider size={size} space={{ mH: horisontalSpase }} />\n )}\n </>\n );\n },\n);\n"],"mappings":"sIAAA,OAASA,OAAT,KAAwB,uBAAxB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,WAAT,CAAsBC,QAAtB,KAAsC,IAAtC,CACA,OACEC,2BADF,CAEEC,kBAFF,CAGEC,2BAHF,eAKA,OAASC,mBAAT,gBAEA,MAAO,IAAMC,YAAW,CAAGP,UAAU,CACnC,SAACQ,CAAD,CAAQC,CAAR,CAAgB,OAMVD,CANU,CAEZE,IAFY,CAEZA,CAFY,YAELJ,mBAFK,GAGZK,CAHY,CAMVH,CANU,CAGZG,WAHY,CAIZC,CAJY,CAMVJ,CANU,CAIZI,SAJY,CAKTC,CALS,0BAMVL,CANU,YAQRM,CAAe,CACH,WAAhB,GAAAH,CAAW,CACPN,2BAA2B,CAACK,CAAD,CADpB,CAEPN,kBAAkB,CAACM,CAAD,CAXV,CAad,MACE,yCACE,oBAAC,QAAD,kBACMG,CADN,EAEE,IAAI,CAAEH,CAFR,CAGE,GAAG,CAAED,CAHP,CAIE,QAAQ,CAAEX,OAJZ,CAKE,KAAK,CAAE,CACLiB,EAAE,CAAED,CADC,CAELE,EAAE,CAAEb,2BAA2B,CAACO,CAAD,CAF1B,CALT,GADF,CAWGE,CAAS,EACR,oBAAC,WAAD,EAAa,IAAI,CAAEF,CAAnB,CAAyB,KAAK,CAAE,CAAEO,EAAE,CAAEH,CAAN,CAAhC,EAZJ,CAgBH,CA/BkC,CAA9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ListAddItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/ListCanary/ListAddItem/index.ts"],"sourcesContent":["export * from './ListAddItem';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ListBox{background:var(--color-bg-default);box-sizing:border-box;overflow:auto}.ListBox_size_xs{--list-box-control-height:var(--control-height-xs)}.ListBox_size_s{--list-box-control-height:var(--control-height-s)}.ListBox_size_m{--list-box-control-height:var(--control-height-m)}.ListBox_size_l{--list-box-control-height:var(--control-height-l)}.ListBox_form_default{border-radius:var(--control-radius)}.ListBox_form_brick{border-radius:0}.ListBox_form_round{border-radius:calc(var(--list-box-control-height)*.5)}.ListBox_border{border:var(--control-border-width) solid var(--color-control-bg-border-default)}.ListBox_shadow{box-shadow:var(--shadow-layer)}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ListBoxProps } from '../types';
|
|
3
|
+
export declare const ListBox: React.ForwardRefExoticComponent<Pick<ListBoxProps, "form" | "slot" | "style" | "title" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "border" | "shadow"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","form","border","shadow","className"];import React,{forwardRef}from"react";import{cnMixSpace}from"../../../mixs/MixSpace";import{defaultListPropSize}from"../types";import{cnListBox}from"./cnListBox";import{mapVerticalSpase}from"./mapVerticalSpase";export var ListBox=forwardRef(function(a,b){var c=a.size,d=void 0===c?defaultListPropSize:c,e=a.form,f=a.border,g=a.shadow,h=a.className,i=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},i,{ref:b,className:cnListBox({size:d,form:e,border:f,shadow:g},[cnMixSpace({pV:mapVerticalSpase[d]}),h])}))});
|
|
2
|
+
//# sourceMappingURL=ListBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListBox.js","names":["React","forwardRef","cnMixSpace","defaultListPropSize","cnListBox","mapVerticalSpase","ListBox","props","ref","size","form","border","shadow","className","otherProps","pV"],"sources":["../../../../../../src/components/ListCanary/ListBox/ListBox.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { cnMixSpace } from '##/mixs/MixSpace';\n\nimport { defaultListPropSize, ListBoxProps } from '../types';\nimport { cnListBox } from './cnListBox';\nimport { mapVerticalSpase } from './mapVerticalSpase';\n\nexport const ListBox = forwardRef<HTMLDivElement, ListBoxProps>(\n (props, ref) => {\n const {\n size = defaultListPropSize,\n form,\n border,\n shadow,\n className,\n ...otherProps\n } = props;\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnListBox({ size, form, border, shadow }, [\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n className,\n ])}\n />\n );\n },\n);\n"],"mappings":"iJAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,UAAT,8BAEA,OAASC,mBAAT,gBACA,OAASC,SAAT,mBACA,OAASC,gBAAT,0BAEA,MAAO,IAAMC,QAAO,CAAGL,UAAU,CAC/B,SAACM,CAAD,CAAQC,CAAR,CAAgB,CACd,MAOID,CAPJ,CACEE,IADF,CACEA,CADF,YACSN,mBADT,GAEEO,CAFF,CAOIH,CAPJ,CAEEG,IAFF,CAGEC,CAHF,CAOIJ,CAPJ,CAGEI,MAHF,CAIEC,CAJF,CAOIL,CAPJ,CAIEK,MAJF,CAKEC,CALF,CAOIN,CAPJ,CAKEM,SALF,CAMKC,CANL,0BAOIP,CAPJ,YASA,MACE,4CACMO,CADN,EAEE,GAAG,CAAEN,CAFP,CAGE,SAAS,CAAEJ,SAAS,CAAC,CAAEK,IAAI,CAAJA,CAAF,CAAQC,IAAI,CAAJA,CAAR,CAAcC,MAAM,CAANA,CAAd,CAAsBC,MAAM,CAANA,CAAtB,CAAD,CAAiC,CACnDV,UAAU,CAAC,CACTa,EAAE,CAAEV,gBAAgB,CAACI,CAAD,CADX,CAAD,CADyC,CAInDI,CAJmD,CAAjC,CAHtB,GAWH,CAvB8B,CAA1B"}
|