@consta/uikit 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.d.ts +0 -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/ContextMenuLevelWrapper/ContextMenuLevelWrapper.css +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.d.ts +4 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js.map +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/index.d.ts +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/index.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/index.js.map +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.d.ts +2 -2
- 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/ContextMenuLevels/useSize.d.ts +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/useSize.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/useSize.js.map +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.css +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.d.ts +3 -0
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.js.map +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/index.d.ts +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/index.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/index.js.map +1 -0
- package/__internal__/src/components/ContextMenu/helpers.d.ts +16 -15
- package/__internal__/src/components/ContextMenu/helpers.js +1 -1
- package/__internal__/src/components/ContextMenu/helpers.js.map +1 -1
- package/__internal__/src/components/ContextMenu/types.d.ts +57 -3
- package/__internal__/src/components/ContextMenu/types.js +1 -1
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuDivider/ContextMenuDivider.css +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuDivider/ContextMenuDivider.js +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuDivider/ContextMenuDivider.js.map +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuGroupHeader/ContextMenuGroupHeader.css +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuGroupHeader/ContextMenuGroupHeader.js +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuGroupHeader/ContextMenuGroupHeader.js.map +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.css +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.js +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.d.ts +1 -2
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js +1 -1
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListAddItem/index.js.map +1 -1
- 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 +0 -1
- package/__internal__/src/components/ListCanary/ListCanary.js +1 -1
- package/__internal__/src/components/ListCanary/ListCanary.js.map +1 -1
- 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 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.d.ts +2 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js +1 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.css +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItem/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.css +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.d.ts +7 -3
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/helper.d.ts +17 -19
- package/__internal__/src/components/ListCanary/helper.js +1 -1
- package/__internal__/src/components/ListCanary/helper.js.map +1 -1
- package/__internal__/src/components/ListCanary/index.d.ts +4 -0
- package/__internal__/src/components/ListCanary/index.js +1 -1
- package/__internal__/src/components/ListCanary/index.js.map +1 -1
- 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 +55 -31
- 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/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/useComponentSize/useComponentSize.d.ts +2 -2
- package/__internal__/src/hooks/useComponentSize/useComponentSize.js +1 -1
- package/__internal__/src/hooks/useComponentSize/useComponentSize.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/MixPopoverAnimate/MixPopoverAnimate.css +1 -1
- 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 +2 -2
- package/__internal__/src/components/ContextMenu/ContextMenu.css +0 -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/ListCanary/List.css +0 -1
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.css +0 -1
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.css +0 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { ContextMenuGroupDefault, ContextMenuItemDefault, ContextMenuPropGetGroupId, ContextMenuPropGetGroupLabel, ContextMenuPropGetItemAs, ContextMenuPropGetItemAttributes, ContextMenuPropGetItemDisabled, ContextMenuPropGetItemGroupId, ContextMenuPropGetItemKey, ContextMenuPropGetItemLabel, ContextMenuPropGetItemLeftIcon, ContextMenuPropGetItemLeftSide, ContextMenuPropGetItemOnClick, ContextMenuPropGetItemRightIcon, ContextMenuPropGetItemRightSide, ContextMenuPropGetItemStatus, ContextMenuPropGetItemSubMenu, ContextMenuProps, ContextMenuPropSize, GetLevelsParams, Level, MappersGroup } from './types';
|
|
5
|
-
export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuProps<ITEM, GROUP>): ({
|
|
2
|
+
import { ContextMenuGroupDefault, ContextMenuItemDefault, ContextMenuLevelsProps, ContextMenuPropGetGroupId, ContextMenuPropGetGroupLabel, ContextMenuPropGetItemAs, ContextMenuPropGetItemAttributes, ContextMenuPropGetItemDisabled, ContextMenuPropGetItemGroupId, ContextMenuPropGetItemKey, ContextMenuPropGetItemLabel, ContextMenuPropGetItemLeftIcon, ContextMenuPropGetItemLeftSide, ContextMenuPropGetItemOnClick, ContextMenuPropGetItemRightIcon, ContextMenuPropGetItemRightSide, ContextMenuPropGetItemStatus, ContextMenuPropGetItemSubMenu, GetLevelsParams, Level } from './types';
|
|
3
|
+
export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevelsProps<ITEM, GROUP>): ({
|
|
6
4
|
items: ITEM[];
|
|
7
5
|
size?: "s" | "m" | "xs" | "l" | undefined;
|
|
8
6
|
direction?: "downCenter" | "upCenter" | "downRight" | "downLeft" | "upRight" | "upLeft" | "leftUp" | "leftCenter" | "leftDown" | "rightUp" | "rightCenter" | "rightDown" | "downStartLeft" | "upStartLeft" | "downStartRight" | "upStartRight" | "leftStartUp" | "leftStartDown" | "rightStartUp" | "rightStartDown" | undefined;
|
|
@@ -16,10 +14,12 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuProps<
|
|
|
16
14
|
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
15
|
onClickOutside?: import("../../hooks/useClickOutside").ClickOutsideHandler | undefined;
|
|
18
16
|
isOpen?: boolean | undefined;
|
|
19
|
-
|
|
17
|
+
form?: "default" | "round" | "brick" | undefined;
|
|
18
|
+
isMobile?: boolean | undefined;
|
|
19
|
+
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
20
20
|
anchorRef: import("react").RefObject<HTMLElement>;
|
|
21
21
|
position?: undefined;
|
|
22
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "
|
|
22
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "form" | "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "onItemClick" | "sortGroup" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "subMenuDirection" | "isMobile" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
23
23
|
id: unknown;
|
|
24
24
|
} ? {} : {
|
|
25
25
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -43,6 +43,9 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuProps<
|
|
|
43
43
|
getItemGroupId: ContextMenuPropGetItemGroupId<ContextMenuItemDefault> | ContextMenuPropGetItemGroupId<ITEM>;
|
|
44
44
|
getGroupId: ContextMenuPropGetGroupId<ContextMenuGroupDefault> | ContextMenuPropGetGroupId<GROUP>;
|
|
45
45
|
getGroupLabel: ContextMenuPropGetGroupLabel<ContextMenuGroupDefault> | ContextMenuPropGetGroupLabel<GROUP>;
|
|
46
|
+
setComponentSize: import("react").Dispatch<import("react").SetStateAction<import("../../hooks/useComponentSize").ComponentSize>>;
|
|
47
|
+
disableAnimationBack: () => void;
|
|
48
|
+
enableAnimationBack: () => void;
|
|
46
49
|
}) | ({
|
|
47
50
|
items: ITEM[];
|
|
48
51
|
size?: "s" | "m" | "xs" | "l" | undefined;
|
|
@@ -57,10 +60,12 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuProps<
|
|
|
57
60
|
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
61
|
onClickOutside?: import("../../hooks/useClickOutside").ClickOutsideHandler | undefined;
|
|
59
62
|
isOpen?: boolean | undefined;
|
|
60
|
-
|
|
63
|
+
form?: "default" | "round" | "brick" | undefined;
|
|
64
|
+
isMobile?: boolean | undefined;
|
|
65
|
+
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
61
66
|
anchorRef?: undefined;
|
|
62
67
|
position: import("../Popover").Position;
|
|
63
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "
|
|
68
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "form" | "direction" | "offset" | "size" | "css" | "items" | "groups" | "position" | "isOpen" | "onItemClick" | "sortGroup" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "subMenuDirection" | "isMobile" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
64
69
|
id: unknown;
|
|
65
70
|
} ? {} : {
|
|
66
71
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -84,12 +89,8 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuProps<
|
|
|
84
89
|
getItemGroupId: ContextMenuPropGetItemGroupId<ContextMenuItemDefault> | ContextMenuPropGetItemGroupId<ITEM>;
|
|
85
90
|
getGroupId: ContextMenuPropGetGroupId<ContextMenuGroupDefault> | ContextMenuPropGetGroupId<GROUP>;
|
|
86
91
|
getGroupLabel: ContextMenuPropGetGroupLabel<ContextMenuGroupDefault> | ContextMenuPropGetGroupLabel<GROUP>;
|
|
92
|
+
setComponentSize: import("react").Dispatch<import("react").SetStateAction<import("../../hooks/useComponentSize").ComponentSize>>;
|
|
93
|
+
disableAnimationBack: () => void;
|
|
94
|
+
enableAnimationBack: () => void;
|
|
87
95
|
});
|
|
88
|
-
export declare const getGroup: <GROUP>(group: GROUP, props: Required<MappersGroup<GROUP>>) => {
|
|
89
|
-
id: number;
|
|
90
|
-
name: string | undefined;
|
|
91
|
-
};
|
|
92
96
|
export declare const getLevels: <ITEM>(params: GetLevelsParams<ITEM>) => Level<ITEM>[];
|
|
93
|
-
export declare const getItemIndex: (groupId: number | string, itemIndex: number) => string;
|
|
94
|
-
export declare const sizeMapHeader: Record<ContextMenuPropSize, TextPropSize>;
|
|
95
|
-
export declare const sizeMapIcon: Record<ContextMenuPropSize, IconPropSize>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";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}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{isNotNil}from"../../utils/type-guards";var defaultGetItemKey=function(a){return a.key||a.label},defaultGetItemRightSide=function(a){return a.rightSide},defaultGetItemLeftSide=function(a){return a.leftSide},defaultGetItemRightIcon=function(a){return a.rightIcon},defaultGetItemLeftIcon=function(a){return a.leftIcon},defaultGetItemStatus=function(a){return a.status},defaultGetItemDisabled=function(a){return a.disabled},defaultGetItemLabel=function(a){return a.label},defaultGetItemOnClick=function(a){return a.onClick},defaultGetItemSubMenu=function(a){return a.subMenu},defaultGetItemAs=function(a){return a.as},defaultGetItemAttributes=function(a){return a.attributes},defaultGetItemGroupId=function(a){return a.groupId},defaultGetGroupId=function(a){return a.id},defaultGetGroupLabel=function(a){return a.label};export function withDefaultGetters(a){return _objectSpread(_objectSpread({},a),{},{getItemKey:a.getItemKey||defaultGetItemKey,getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemRightSide:a.getItemRightSide||defaultGetItemRightSide,getItemLeftSide:a.getItemLeftSide||defaultGetItemLeftSide,getItemRightIcon:a.getItemRightIcon||defaultGetItemRightIcon,getItemLeftIcon:a.getItemLeftIcon||defaultGetItemLeftIcon,getItemSubMenu:a.getItemSubMenu||defaultGetItemSubMenu,getItemStatus:a.getItemStatus||defaultGetItemStatus,getItemDisabled:a.getItemDisabled||defaultGetItemDisabled,getItemOnClick:a.getItemOnClick||defaultGetItemOnClick,getItemAs:a.getItemAs||defaultGetItemAs,getItemAttributes:a.getItemAttributes||defaultGetItemAttributes,getItemGroupId:a.getItemGroupId||defaultGetItemGroupId,getGroupId:a.getGroupId||defaultGetGroupId,getGroupLabel:a.getGroupLabel||defaultGetGroupLabel})}
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";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}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{isNotNil}from"../../utils/type-guards";var defaultGetItemKey=function(a){return a.key||a.label},defaultGetItemRightSide=function(a){return a.rightSide},defaultGetItemLeftSide=function(a){return a.leftSide},defaultGetItemRightIcon=function(a){return a.rightIcon},defaultGetItemLeftIcon=function(a){return a.leftIcon},defaultGetItemStatus=function(a){return a.status},defaultGetItemDisabled=function(a){return a.disabled},defaultGetItemLabel=function(a){return a.label},defaultGetItemOnClick=function(a){return a.onClick},defaultGetItemSubMenu=function(a){return a.subMenu},defaultGetItemAs=function(a){return a.as},defaultGetItemAttributes=function(a){return a.attributes},defaultGetItemGroupId=function(a){return a.groupId},defaultGetGroupId=function(a){return a.id},defaultGetGroupLabel=function(a){return a.label};export function withDefaultGetters(a){return _objectSpread(_objectSpread({},a),{},{getItemKey:a.getItemKey||defaultGetItemKey,getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemRightSide:a.getItemRightSide||defaultGetItemRightSide,getItemLeftSide:a.getItemLeftSide||defaultGetItemLeftSide,getItemRightIcon:a.getItemRightIcon||defaultGetItemRightIcon,getItemLeftIcon:a.getItemLeftIcon||defaultGetItemLeftIcon,getItemSubMenu:a.getItemSubMenu||defaultGetItemSubMenu,getItemStatus:a.getItemStatus||defaultGetItemStatus,getItemDisabled:a.getItemDisabled||defaultGetItemDisabled,getItemOnClick:a.getItemOnClick||defaultGetItemOnClick,getItemAs:a.getItemAs||defaultGetItemAs,getItemAttributes:a.getItemAttributes||defaultGetItemAttributes,getItemGroupId:a.getItemGroupId||defaultGetItemGroupId,getGroupId:a.getGroupId||defaultGetGroupId,getGroupLabel:a.getGroupLabel||defaultGetGroupLabel})}var findItem=function(a){var b,c=a.items,d=a.getItemKey,e=a.getItemSubMenu,f=a.key,g=_createForOfIteratorHelper(c);try{for(g.s();!(b=g.n()).done;){var h=b.value;if(d(h)===f)return h;var i="function"==typeof e&&e(h);if(i){var j=findItem({items:i,key:f,getItemKey:d,getItemSubMenu:e});if(j)return j}}}catch(a){g.e(a)}finally{g.f()}};export var getLevels=function(a){var b=a.levels,c=a.items,d=a.getItemKey,e=a.getItemSubMenu;return b.map(function(a){return _objectSpread(_objectSpread({},a),{},{items:a.items.map(function(a){return findItem({items:c,getItemSubMenu:e,getItemKey:d,key:d(a)})}).filter(isNotNil)})})};
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["isNotNil","defaultGetItemKey","item","key","label","defaultGetItemRightSide","rightSide","defaultGetItemLeftSide","leftSide","defaultGetItemRightIcon","rightIcon","defaultGetItemLeftIcon","leftIcon","defaultGetItemStatus","status","defaultGetItemDisabled","disabled","defaultGetItemLabel","defaultGetItemOnClick","onClick","defaultGetItemSubMenu","subMenu","defaultGetItemAs","as","defaultGetItemAttributes","attributes","defaultGetItemGroupId","groupId","defaultGetGroupId","group","id","defaultGetGroupLabel","withDefaultGetters","props","getItemKey","getItemLabel","getItemRightSide","getItemLeftSide","getItemRightIcon","getItemLeftIcon","getItemSubMenu","getItemStatus","getItemDisabled","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getGroupId","getGroupLabel","
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["isNotNil","defaultGetItemKey","item","key","label","defaultGetItemRightSide","rightSide","defaultGetItemLeftSide","leftSide","defaultGetItemRightIcon","rightIcon","defaultGetItemLeftIcon","leftIcon","defaultGetItemStatus","status","defaultGetItemDisabled","disabled","defaultGetItemLabel","defaultGetItemOnClick","onClick","defaultGetItemSubMenu","subMenu","defaultGetItemAs","as","defaultGetItemAttributes","attributes","defaultGetItemGroupId","groupId","defaultGetGroupId","group","id","defaultGetGroupLabel","withDefaultGetters","props","getItemKey","getItemLabel","getItemRightSide","getItemLeftSide","getItemRightIcon","getItemLeftIcon","getItemSubMenu","getItemStatus","getItemDisabled","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getGroupId","getGroupLabel","findItem","params","items","subItems","subItem","getLevels","levels","map","level","filter"],"sources":["../../../../../src/components/ContextMenu/helpers.ts"],"sourcesContent":["import { isNotNil } from '../../utils/type-guards';\nimport {\n ContextMenuGroupDefault,\n ContextMenuItemDefault,\n ContextMenuLevelsProps,\n ContextMenuPropGetGroupId,\n ContextMenuPropGetGroupLabel,\n ContextMenuPropGetItemAs,\n ContextMenuPropGetItemAttributes,\n ContextMenuPropGetItemDisabled,\n ContextMenuPropGetItemGroupId,\n ContextMenuPropGetItemKey,\n ContextMenuPropGetItemLabel,\n ContextMenuPropGetItemLeftIcon,\n ContextMenuPropGetItemLeftSide,\n ContextMenuPropGetItemOnClick,\n ContextMenuPropGetItemRightIcon,\n ContextMenuPropGetItemRightSide,\n ContextMenuPropGetItemStatus,\n ContextMenuPropGetItemSubMenu,\n GetLevelsParams,\n Level,\n} from './types';\n\nconst defaultGetItemKey: ContextMenuPropGetItemKey<ContextMenuItemDefault> = (\n item,\n) => item.key || item.label;\nconst defaultGetItemRightSide: ContextMenuPropGetItemRightSide<\n ContextMenuItemDefault\n> = (item) => item.rightSide;\nconst defaultGetItemLeftSide: ContextMenuPropGetItemLeftSide<\n ContextMenuItemDefault\n> = (item) => item.leftSide;\nconst defaultGetItemRightIcon: ContextMenuPropGetItemRightIcon<\n ContextMenuItemDefault\n> = (item) => item.rightIcon;\nconst defaultGetItemLeftIcon: ContextMenuPropGetItemLeftIcon<\n ContextMenuItemDefault\n> = (item) => item.leftIcon;\nconst defaultGetItemStatus: ContextMenuPropGetItemStatus<\n ContextMenuItemDefault\n> = (item) => item.status;\nconst defaultGetItemDisabled: ContextMenuPropGetItemDisabled<\n ContextMenuItemDefault\n> = (item) => item.disabled;\nconst defaultGetItemLabel: ContextMenuPropGetItemLabel<\n ContextMenuItemDefault\n> = (item) => item.label;\nconst defaultGetItemOnClick: ContextMenuPropGetItemOnClick<\n ContextMenuItemDefault\n> = (item) => item.onClick;\nconst defaultGetItemSubMenu: ContextMenuPropGetItemSubMenu<\n ContextMenuItemDefault\n> = (item) => item.subMenu;\nconst defaultGetItemAs: ContextMenuPropGetItemAs<ContextMenuItemDefault> = (\n item,\n) => item.as;\nconst defaultGetItemAttributes: ContextMenuPropGetItemAttributes<\n ContextMenuItemDefault\n> = (item) => item.attributes;\nconst defaultGetItemGroupId: ContextMenuPropGetItemGroupId<\n ContextMenuItemDefault\n> = (item) => item.groupId;\n\nconst defaultGetGroupId: ContextMenuPropGetGroupId<ContextMenuGroupDefault> = (\n group,\n) => group.id;\nconst defaultGetGroupLabel: ContextMenuPropGetGroupLabel<\n ContextMenuGroupDefault\n> = (group) => group.label;\n\nexport function withDefaultGetters<ITEM, GROUP>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) {\n return {\n ...props,\n getItemKey: props.getItemKey || defaultGetItemKey,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemRightSide: props.getItemRightSide || defaultGetItemRightSide,\n getItemLeftSide: props.getItemLeftSide || defaultGetItemLeftSide,\n getItemRightIcon: props.getItemRightIcon || defaultGetItemRightIcon,\n getItemLeftIcon: props.getItemLeftIcon || defaultGetItemLeftIcon,\n getItemSubMenu: props.getItemSubMenu || defaultGetItemSubMenu,\n getItemStatus: props.getItemStatus || defaultGetItemStatus,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n getItemOnClick: props.getItemOnClick || defaultGetItemOnClick,\n getItemAs: props.getItemAs || defaultGetItemAs,\n getItemAttributes: props.getItemAttributes || defaultGetItemAttributes,\n getItemGroupId: props.getItemGroupId || defaultGetItemGroupId,\n getGroupId: props.getGroupId || defaultGetGroupId,\n getGroupLabel: props.getGroupLabel || defaultGetGroupLabel,\n };\n}\n\nconst findItem = <ITEM>(\n params: Omit<GetLevelsParams<ITEM>, 'levels'> & {\n key: ContextMenuItemDefault['key'];\n },\n): ITEM | undefined => {\n const { items, getItemKey, getItemSubMenu, key } = params;\n for (const item of items) {\n if (getItemKey(item) === key) {\n return item;\n }\n const subItems =\n typeof getItemSubMenu === 'function' && getItemSubMenu(item);\n if (subItems) {\n const subItem = findItem({\n items: subItems,\n key,\n getItemKey,\n getItemSubMenu,\n });\n if (subItem) {\n return subItem;\n }\n }\n }\n return undefined;\n};\n\nexport const getLevels = <ITEM>(\n params: GetLevelsParams<ITEM>,\n): Level<ITEM>[] => {\n const { levels, items, getItemKey, getItemSubMenu } = params;\n\n return levels.map((level) => ({\n ...level,\n items: level.items\n .map((item) =>\n findItem({\n items,\n getItemSubMenu,\n getItemKey,\n key: getItemKey(item),\n }),\n )\n .filter(isNotNil),\n }));\n};\n"],"mappings":"0zDAAA,OAASA,QAAT,+B,GAwBMC,kBAAoE,CAAG,SAC3EC,CAD2E,QAExEA,EAAI,CAACC,GAAL,EAAYD,CAAI,CAACE,KAFuD,C,CAGvEC,uBAEL,CAAG,SAACH,CAAD,QAAUA,EAAI,CAACI,SAAf,C,CACEC,sBAEL,CAAG,SAACL,CAAD,QAAUA,EAAI,CAACM,QAAf,C,CACEC,uBAEL,CAAG,SAACP,CAAD,QAAUA,EAAI,CAACQ,SAAf,C,CACEC,sBAEL,CAAG,SAACT,CAAD,QAAUA,EAAI,CAACU,QAAf,C,CACEC,oBAEL,CAAG,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CAEA,MAAOe,EAAM,CAACC,GAAP,CAAW,SAACC,CAAD,wCACbA,CADa,MAEhBN,KAAK,CAAEM,CAAK,CAACN,KAAN,CACJK,GADI,CACA,SAACtD,CAAD,QACH+C,SAAQ,CAAC,CACPE,KAAK,CAALA,CADO,CAEPX,cAAc,CAAdA,CAFO,CAGPN,UAAU,CAAVA,CAHO,CAIP/B,GAAG,CAAE+B,CAAU,CAAChC,CAAD,CAJR,CAAD,CADL,CADA,EASJwD,MATI,CASG1D,QATH,CAFS,GAAX,CAaR,CAlBM"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconComponent } from '@consta/icons/Icon';
|
|
3
|
+
import { ListPropForm } from "../ListCanary";
|
|
4
|
+
import { ComponentSize } from "../../hooks/useComponentSize";
|
|
5
|
+
import { Animate } from "../../mixs/MixPopoverAnimate";
|
|
3
6
|
import { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';
|
|
4
7
|
import { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';
|
|
5
|
-
import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
8
|
+
import { PropsWithHTMLAttributes, PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
6
9
|
import { Direction, PopoverPropOffset, Position } from '../Popover/Popover';
|
|
7
10
|
export declare const contextMenuSizes: readonly ["m", "xs", "s", "l"];
|
|
8
11
|
export declare type ContextMenuPropSize = typeof contextMenuSizes[number];
|
|
@@ -10,6 +13,9 @@ export declare const contextMenuDefaultSize: ContextMenuPropSize;
|
|
|
10
13
|
export declare const contextMenuStatus: readonly ["alert", "success", "warning"];
|
|
11
14
|
export declare type ContextMenuStatus = typeof contextMenuStatus[number];
|
|
12
15
|
export declare const contextMenuDefaultStatus: ContextMenuStatus;
|
|
16
|
+
export declare const contextMenuForm: readonly ["default", "brick", "round"];
|
|
17
|
+
export declare type ContextMenuForm = ListPropForm;
|
|
18
|
+
export declare const defaultContextMenuForm: "default";
|
|
13
19
|
export declare const contextMenuPropSubMenuDirections: readonly ["rightStartUp", "rightStartDown", "leftStartUp", "leftStartDown"];
|
|
14
20
|
export declare type ContextMenuPropSubMenuDirection = typeof contextMenuPropSubMenuDirections[number];
|
|
15
21
|
export declare const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection;
|
|
@@ -84,11 +90,16 @@ export declare type Level<ITEM> = {
|
|
|
84
90
|
direction?: Direction;
|
|
85
91
|
possibleDirections?: readonly Direction[];
|
|
86
92
|
offset?: PopoverPropOffset;
|
|
87
|
-
|
|
93
|
+
parent?: ITEM;
|
|
94
|
+
anchorRef?: React.RefObject<HTMLElement>;
|
|
95
|
+
position?: Position;
|
|
96
|
+
};
|
|
88
97
|
export declare type AddLevel<ITEM> = (params: {
|
|
89
98
|
level: number;
|
|
90
99
|
items: ITEM[];
|
|
100
|
+
parent?: ITEM;
|
|
91
101
|
anchorRef?: React.RefObject<HTMLElement>;
|
|
102
|
+
position?: Position;
|
|
92
103
|
activeItem: string;
|
|
93
104
|
}) => void;
|
|
94
105
|
export declare type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault> = PropsWithHTMLAttributesAndRef<{
|
|
@@ -105,6 +116,8 @@ export declare type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = Cont
|
|
|
105
116
|
onSetDirection?: (direction: Direction) => void;
|
|
106
117
|
onClickOutside?: ClickOutsideHandler;
|
|
107
118
|
isOpen?: boolean;
|
|
119
|
+
form?: ContextMenuForm;
|
|
120
|
+
isMobile?: boolean;
|
|
108
121
|
} & MappersItem<ITEM> & MappersGroup<GROUP> & PositioningProps, HTMLDivElement> & (GROUP extends {
|
|
109
122
|
id: ContextMenuGroupDefault['id'] | unknown;
|
|
110
123
|
} ? {} : {
|
|
@@ -114,8 +127,15 @@ export declare type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = Cont
|
|
|
114
127
|
} ? {} : {
|
|
115
128
|
getItemLabel: ContextMenuPropGetItemLabel<ITEM>;
|
|
116
129
|
});
|
|
130
|
+
export declare type ContextMenuLevelsProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault> = ContextMenuProps<ITEM, GROUP> & {
|
|
131
|
+
setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;
|
|
132
|
+
disableAnimationBack: () => void;
|
|
133
|
+
enableAnimationBack: () => void;
|
|
134
|
+
};
|
|
135
|
+
export declare type ContextMenuLevelsComponent = <ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault>(props: ContextMenuLevelsProps<ITEM, GROUP>) => React.ReactElement | null;
|
|
117
136
|
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>> & {
|
|
137
|
+
export declare type ContextMenuLevelProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault> = Omit<ContextMenuProps<ITEM, GROUP>, 'subMenuDirection' | 'onClickOutside' | 'setComponentSize' | 'animationBack' | 'disableAnimationBack' | 'enableAnimationBack' | keyof MappersItem<ITEM> | keyof MappersGroup<GROUP>> & {
|
|
138
|
+
parent?: ITEM;
|
|
119
139
|
levelDepth: number;
|
|
120
140
|
addLevel: AddLevel<ITEM>;
|
|
121
141
|
deleteLevel: (level: number) => void;
|
|
@@ -123,6 +143,7 @@ export declare type ContextMenuLevelProps<ITEM, GROUP> = Omit<ContextMenuProps<I
|
|
|
123
143
|
onSetDirection?: (direction: Direction) => void;
|
|
124
144
|
hoveredParenLevel: number;
|
|
125
145
|
setHoveredParenLevel: (level: number) => void;
|
|
146
|
+
animate: Animate;
|
|
126
147
|
} & Required<MappersItem<ITEM>> & Required<MappersGroup<GROUP>>;
|
|
127
148
|
export declare type ContextMenuLevelComponent = <ITEM, GROUP>(props: ContextMenuLevelProps<ITEM, GROUP>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
128
149
|
export declare type ContextMenuItemProps<AS extends keyof JSX.IntrinsicElements = 'div'> = PropsWithAsAttributes<Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {
|
|
@@ -137,4 +158,37 @@ export declare type GetLevelsParams<ITEM> = {
|
|
|
137
158
|
getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;
|
|
138
159
|
getItemKey: ContextMenuPropGetItemKey<ITEM>;
|
|
139
160
|
};
|
|
161
|
+
export declare type ContextMenuWrapperProps = PropsWithHTMLAttributes<{
|
|
162
|
+
children: React.ReactNode;
|
|
163
|
+
isOpen?: boolean;
|
|
164
|
+
isMobile?: boolean;
|
|
165
|
+
form?: ContextMenuForm;
|
|
166
|
+
onClickOutside?: ClickOutsideHandler;
|
|
167
|
+
spareDirection?: Direction;
|
|
168
|
+
possibleDirections?: readonly Direction[];
|
|
169
|
+
size?: ContextMenuPropSize;
|
|
170
|
+
direction?: Direction;
|
|
171
|
+
offset?: PopoverPropOffset;
|
|
172
|
+
anchorRef?: React.RefObject<HTMLElement>;
|
|
173
|
+
position?: Position;
|
|
174
|
+
onSetDirection?: (direction: Direction) => void;
|
|
175
|
+
className?: string;
|
|
176
|
+
animationBack?: boolean;
|
|
177
|
+
}, HTMLDivElement>;
|
|
178
|
+
export declare type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<{
|
|
179
|
+
children: React.ReactNode;
|
|
180
|
+
isOpen?: boolean;
|
|
181
|
+
isMobile?: boolean;
|
|
182
|
+
form?: ContextMenuForm;
|
|
183
|
+
onClickOutside?: ClickOutsideHandler;
|
|
184
|
+
spareDirection?: Direction;
|
|
185
|
+
possibleDirections?: readonly Direction[];
|
|
186
|
+
size?: ContextMenuPropSize;
|
|
187
|
+
direction?: Direction;
|
|
188
|
+
offset?: PopoverPropOffset;
|
|
189
|
+
anchorRef?: React.RefObject<HTMLElement>;
|
|
190
|
+
position?: Position;
|
|
191
|
+
onSetDirection?: (direction: Direction) => void;
|
|
192
|
+
classname?: string;
|
|
193
|
+
}, HTMLDivElement>;
|
|
140
194
|
export {};
|
|
@@ -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<ITEM, GROUP> = 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":"AAOA,MAAO,IAAMA,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,iCAAgC,CAAG,CAC9C,cAD8C,CAE9C,gBAF8C,CAG9C,aAH8C,CAI9C,eAJ8C,CAAzC,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n] as const;\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type 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 parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: 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 isMobile?: 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 ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactElement | null;\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 | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\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 animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.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\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n classname?: string;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAgBA,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"}
|
package/__internal__/src/components/ContextMenuDeprecated/ContextMenuDivider/ContextMenuDivider.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.ContextMenuDividerDeprecated{--vertical-space:0;background:var(--color-control-bg-border-default);height:var(--control-border-width);margin:var(--vertical-space) var(--space-s)}.ContextMenuDividerDeprecated_size_l{--vertical-space:var(--space-xs)}.ContextMenuDividerDeprecated_size_m,.ContextMenuDividerDeprecated_size_s{--vertical-space:var(--space-2xs)}
|
package/__internal__/src/components/ContextMenuDeprecated/ContextMenuDivider/ContextMenuDivider.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./ContextMenuDivider.css";import React from"react";import{cn}from"../../../utils/bem";import{contextMenuDefaultSize}from"../helpers";var cnContextMenuDivider=cn("
|
|
1
|
+
import"./ContextMenuDivider.css";import React from"react";import{cn}from"../../../utils/bem";import{contextMenuDefaultSize}from"../helpers";var cnContextMenuDivider=cn("ContextMenuDividerDeprecated");export var ContextMenuDivider=function(a){var b=a.size,c=void 0===b?contextMenuDefaultSize:b;return React.createElement("div",{className:cnContextMenuDivider({size:c})})};
|
|
2
2
|
//# sourceMappingURL=ContextMenuDivider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuDivider.js","names":["React","cn","contextMenuDefaultSize","cnContextMenuDivider","ContextMenuDivider","props","size"],"sources":["../../../../../../src/components/ContextMenuDeprecated/ContextMenuDivider/ContextMenuDivider.tsx"],"sourcesContent":["import './ContextMenuDivider.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { contextMenuDefaultSize, ContextMenuPropSize } from '../helpers';\n\nconst cnContextMenuDivider = cn('
|
|
1
|
+
{"version":3,"file":"ContextMenuDivider.js","names":["React","cn","contextMenuDefaultSize","cnContextMenuDivider","ContextMenuDivider","props","size"],"sources":["../../../../../../src/components/ContextMenuDeprecated/ContextMenuDivider/ContextMenuDivider.tsx"],"sourcesContent":["import './ContextMenuDivider.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { contextMenuDefaultSize, ContextMenuPropSize } from '../helpers';\n\nconst cnContextMenuDivider = cn('ContextMenuDividerDeprecated');\n\nexport const ContextMenuDivider: React.FC<{\n size?: ContextMenuPropSize;\n children?: never;\n}> = (props) => {\n const { size = contextMenuDefaultSize } = props;\n return <div className={cnContextMenuDivider({ size })} />;\n};\n"],"mappings":"AAAA,iCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BACA,OAASC,sBAAT,kBAEA,GAAMC,qBAAoB,CAAGF,EAAE,CAAC,8BAAD,CAA/B,CAEA,MAAO,IAAMG,mBAGX,CAAG,SAACC,CAAD,CAAW,CACd,MAA0CA,CAA1C,CAAQC,IAAR,CAAQA,CAAR,YAAeJ,sBAAf,GACA,MAAO,4BAAK,SAAS,CAAEC,oBAAoB,CAAC,CAAEG,IAAI,CAAJA,CAAF,CAAD,CAApC,EACR,CANM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.ContextMenuGroupHeaderDeprecated{--top-space:0;--bottom-space:0;border-bottom:solid var(--control-border-width) var(--color-control-bg-border-default);letter-spacing:.05em;margin:0 var(--space-s);padding:var(--top-space) 0 var(--bottom-space) 0}.ContextMenuGroupHeaderDeprecated_size_s{--top-space:var(--space-xs);--bottom-space:var(--space-2xs)}.ContextMenuGroupHeaderDeprecated_size_m{--top-space:var(--space-s);--bottom-space:var(--space-xs)}.ContextMenuGroupHeaderDeprecated_size_l{--top-space:var(--space-s);--bottom-space:var(--space-s)}.ContextMenuGroupHeaderDeprecated_first{padding:calc(var(--top-space) - var(--space-xs)) 0 var(--bottom-space) 0}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./ContextMenuGroupHeader.css";import React from"react";import{cn}from"../../../utils/bem";import{getByMap}from"../../../utils/getByMap";import{Text}from"../../Text/Text";import{contextMenuDefaultSize}from"../helpers";export var cnContextMenuGroupHeader=cn("
|
|
1
|
+
import"./ContextMenuGroupHeader.css";import React from"react";import{cn}from"../../../utils/bem";import{getByMap}from"../../../utils/getByMap";import{Text}from"../../Text/Text";import{contextMenuDefaultSize}from"../helpers";export var cnContextMenuGroupHeader=cn("ContextMenuGroupHeaderDeprecated");var sizeMap={s:"2xs",m:"xs",l:"s"};export var ContextMenuGroupHeader=function(a){var b=a.label,c=a.size,d=void 0===c?contextMenuDefaultSize:c,e=a.first;return React.createElement(Text,{view:"secondary",transform:"uppercase",className:cnContextMenuGroupHeader({size:d,first:e}),size:getByMap(sizeMap,d)},b)};
|
|
2
2
|
//# sourceMappingURL=ContextMenuGroupHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuGroupHeader.js","names":["React","cn","getByMap","Text","contextMenuDefaultSize","cnContextMenuGroupHeader","sizeMap","s","m","l","ContextMenuGroupHeader","label","size","first"],"sources":["../../../../../../src/components/ContextMenuDeprecated/ContextMenuGroupHeader/ContextMenuGroupHeader.tsx"],"sourcesContent":["import './ContextMenuGroupHeader.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { getByMap } from '../../../utils/getByMap';\nimport { Text, TextPropSize } from '../../Text/Text';\nimport { contextMenuDefaultSize, ContextMenuPropSize } from '../helpers';\n\nexport const cnContextMenuGroupHeader = cn('
|
|
1
|
+
{"version":3,"file":"ContextMenuGroupHeader.js","names":["React","cn","getByMap","Text","contextMenuDefaultSize","cnContextMenuGroupHeader","sizeMap","s","m","l","ContextMenuGroupHeader","label","size","first"],"sources":["../../../../../../src/components/ContextMenuDeprecated/ContextMenuGroupHeader/ContextMenuGroupHeader.tsx"],"sourcesContent":["import './ContextMenuGroupHeader.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { getByMap } from '../../../utils/getByMap';\nimport { Text, TextPropSize } from '../../Text/Text';\nimport { contextMenuDefaultSize, ContextMenuPropSize } from '../helpers';\n\nexport const cnContextMenuGroupHeader = cn('ContextMenuGroupHeaderDeprecated');\n\nconst sizeMap: Record<ContextMenuPropSize, TextPropSize> = {\n s: '2xs',\n m: 'xs',\n l: 's',\n};\n\nexport const ContextMenuGroupHeader: React.FC<{\n label: string | number;\n size?: ContextMenuPropSize;\n children?: never;\n first: boolean;\n}> = ({ label, size = contextMenuDefaultSize, first }) => (\n <Text\n view=\"secondary\"\n transform=\"uppercase\"\n className={cnContextMenuGroupHeader({ size, first })}\n size={getByMap(sizeMap, size)}\n >\n {label}\n </Text>\n);\n"],"mappings":"AAAA,qCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BACA,OAASC,QAAT,+BACA,OAASC,IAAT,uBACA,OAASC,sBAAT,kBAEA,MAAO,IAAMC,yBAAwB,CAAGJ,EAAE,CAAC,kCAAD,CAAnC,CAEP,GAAMK,QAAkD,CAAG,CACzDC,CAAC,CAAE,KADsD,CAEzDC,CAAC,CAAE,IAFsD,CAGzDC,CAAC,CAAE,GAHsD,CAA3D,CAMA,MAAO,IAAMC,uBAKX,CAAG,eAAGC,EAAH,GAAGA,KAAH,KAAUC,IAAV,CAAUA,CAAV,YAAiBR,sBAAjB,GAAyCS,CAAzC,GAAyCA,KAAzC,OACH,qBAAC,IAAD,EACE,IAAI,CAAC,WADP,CAEE,SAAS,CAAC,WAFZ,CAGE,SAAS,CAAER,wBAAwB,CAAC,CAAEO,IAAI,CAAJA,CAAF,CAAQC,KAAK,CAALA,CAAR,CAAD,CAHrC,CAIE,IAAI,CAAEX,QAAQ,CAACI,OAAD,CAAUM,CAAV,CAJhB,EAMGD,CANH,CADG,CALE"}
|
package/__internal__/src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.ContextMenuLevelDeprecated{background:var(--color-bg-default);border:var(--control-border-width) solid var(--color-control-bg-border-default);border-radius:var(--control-radius);box-shadow:var(--shadow-layer);box-sizing:border-box;padding:var(--space-xs) 0;width:240px;z-index:9999}.ContextMenuLevelDeprecated:not(.ContextMenuLevelDeprecated_firstLevel).ContextMenuLevelDeprecated_direction_leftStartUp,.ContextMenuLevelDeprecated:not(.ContextMenuLevelDeprecated_firstLevel).ContextMenuLevelDeprecated_direction_rightStartUp{transform:translateY(calc((var(--space-xs) + 1px)*-1))}.ContextMenuLevelDeprecated:not(.ContextMenuLevelDeprecated_firstLevel).ContextMenuLevelDeprecated_direction_leftStartDown,.ContextMenuLevelDeprecated:not(.ContextMenuLevelDeprecated_firstLevel).ContextMenuLevelDeprecated_direction_rightStartDown{transform:translateY(calc(var(--space-xs) + 1px))}
|
package/__internal__/src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","level","activeItem","addLevel","className","deleteLevel","items","setHoveredParenLevel","getLabel","getRightSideBar","getLeftSideBar","getSubItems","getGroupId","getAccent","getDisabled","getOnClick","getItemOnClick","onItemClick","getItemHTMLAttributes","getItemAs","sortGroup","getGroupLabel","direction","possibleDirections","offset","onSetDirection","hoveredParenLevel","spareDirection","anchorRef"];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,{createRef,useEffect,useMemo,useState}from"react";import{cn}from"../../../utils/bem";import{getGroups}from"../../../utils/getGroups";import{Popover}from"../../Popover/Popover";import{ContextMenuDivider}from"../ContextMenuDivider/ContextMenuDivider";import{ContextMenuGroupHeader}from"../ContextMenuGroupHeader/ContextMenuGroupHeader";import{ContextMenuItem}from"../ContextMenuItem/ContextMenuItem";import{contextMenuDefaultSize}from"../helpers";export var cnContextMenuLevel=cn("
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","level","activeItem","addLevel","className","deleteLevel","items","setHoveredParenLevel","getLabel","getRightSideBar","getLeftSideBar","getSubItems","getGroupId","getAccent","getDisabled","getOnClick","getItemOnClick","onItemClick","getItemHTMLAttributes","getItemAs","sortGroup","getGroupLabel","direction","possibleDirections","offset","onSetDirection","hoveredParenLevel","spareDirection","anchorRef"];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,{createRef,useEffect,useMemo,useState}from"react";import{cn}from"../../../utils/bem";import{getGroups}from"../../../utils/getGroups";import{Popover}from"../../Popover/Popover";import{ContextMenuDivider}from"../ContextMenuDivider/ContextMenuDivider";import{ContextMenuGroupHeader}from"../ContextMenuGroupHeader/ContextMenuGroupHeader";import{ContextMenuItem}from"../ContextMenuItem/ContextMenuItem";import{contextMenuDefaultSize}from"../helpers";export var cnContextMenuLevel=cn("ContextMenuLevelDeprecated");function renderHeader(a,b,c,d){return a?React.createElement(ContextMenuGroupHeader,{label:a,first:b,size:d}):b?null:React.createElement(ContextMenuDivider,{size:d})}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;export var ContextMenuLevel=React.forwardRef(function(a,b){var c=a.size,d=void 0===c?contextMenuDefaultSize:c,e=a.level,f=a.activeItem,g=a.addLevel,h=a.className,i=a.deleteLevel,j=a.items,k=a.setHoveredParenLevel,l=a.getLabel,m=a.getRightSideBar,n=a.getLeftSideBar,o=a.getSubItems,p=a.getGroupId,q=a.getAccent,r=a.getDisabled,s=a.getOnClick,t=a.getItemOnClick,u=a.onItemClick,v=a.getItemHTMLAttributes,w=a.getItemAs,x=a.sortGroup,y=a.getGroupLabel,z=a.direction,A=a.possibleDirections,B=a.offset,C=a.onSetDirection,D=a.hoveredParenLevel,E=a.spareDirection,F=a.anchorRef,G=_objectWithoutProperties(a,_excluded),H=useState(!1),I=_slicedToArray(H,2),J=I[0],K=I[1],L=getGroups(j,p,void 0,void 0,x&&function(c,a){return x(c.key,a.key)}),M=function(a,b){return"".concat(a,"-").concat(b)},N=useMemo(function constructItemRefs(){var a,b={},c=_createForOfIteratorHelper(L);try{for(c.s();!(a=c.n()).done;)for(var d=a.value,e=0;e<j.length;e++)b[M(d.key,e)]=createRef()}catch(a){c.e(a)}finally{c.f()}return b},[j]);return useEffect(function(){return 0!==e&&!J&&D<e&&(clearTimeout(timers[e]),timers[e]=setTimeout(function(){return i(e)},closeDelay)),function(){clearTimeout(timers[e])}},[J,D]),React.createElement(Popover,Object.assign({},G,{anchorRef:F,className:cnContextMenuLevel({firstLevel:0===e,direction:z},[h]),possibleDirections:A,spareDirection:E,direction:z,offset:B,onSetDirection:C,onMouseEnter:function onMouseEnter(){return K(!0)},onMouseLeave:function onMouseLeave(){return K(!1)},ref:b}),L.map(function(a,b){var c="function"==typeof y?y(a.key):void 0;return React.createElement("div",{className:cnContextMenuLevel("Group"),key:a.key},renderHeader(c,0===b,L.length,d),a.items.map(function(b,c){var h=M(a.key,c),i=N[h],j="function"==typeof r&&r(b),p=l(b),x="function"==typeof n?n(b):void 0,y="function"==typeof m?m(b):void 0,z="function"==typeof o?o(b):void 0,A=z&&!j?function(){g(e+1,z,i,h),k(e+1)}:function(){k(e)},B="function"==typeof q?q(b):void 0,C="function"==typeof v?v(b):{},D="function"==typeof w?w(b):void 0;return React.createElement(ContextMenuItem,Object.assign({},C,{ref:i,label:p,leftSide:x,rightSide:y,size:d,key:h,onMouseEnter:A,onClick:function onClick(a){if(!j){if("function"==typeof t){var c;null===(c=t(b))||void 0===c?void 0:c(a)}if("function"==typeof s){var d;null===(d=s(b))||void 0===d?void 0:d(a)}"function"==typeof u&&(null===u||void 0===u?void 0:u({e:a,item:b}))}},active:f===h,withSubMenu:!!z,accent:B,disabled:j,as:D}))}))}))});
|
|
2
2
|
//# sourceMappingURL=ContextMenuLevel.js.map
|
package/__internal__/src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuLevel.js","names":["React","createRef","useEffect","useMemo","useState","cn","getGroups","Popover","ContextMenuDivider","ContextMenuGroupHeader","ContextMenuItem","contextMenuDefaultSize","cnContextMenuLevel","renderHeader","groupLabel","first","length","size","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevel","forwardRef","props","ref","level","activeItem","addLevel","className","deleteLevel","items","setHoveredParenLevel","getLabel","getRightSideBar","getLeftSideBar","getSubItems","getGroupId","getAccent","getDisabled","getOnClick","getItemOnClick","onItemClick","getItemHTMLAttributes","getItemAs","sortGroup","getGroupLabel","direction","possibleDirections","offset","onSetDirection","hoveredParenLevel","spareDirection","anchorRef","otherProps","hovered","setHovered","groups","a","b","key","getItemIndex","groupId","itemIndex","itemsRefs","constructItemRefs","refs","group","i","setTimeout","firstLevel","map","groupIndex","item","index","disabled","label","leftSide","rightSide","subItems","onMouseEnter","accent","atributes","as","onClick","e"],"sources":["../../../../../../src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport React, { createRef, useEffect, useMemo, useState } from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { getGroups } from '../../../utils/getGroups';\nimport { Popover } from '../../Popover/Popover';\nimport { ContextMenuDivider } from '../ContextMenuDivider/ContextMenuDivider';\nimport { ContextMenuGroupHeader } from '../ContextMenuGroupHeader/ContextMenuGroupHeader';\nimport { ContextMenuItem } from '../ContextMenuItem/ContextMenuItem';\nimport {\n contextMenuDefaultSize,\n ContextMenuLevelType,\n ContextMenuPropSize,\n} from '../helpers';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevel');\n\nfunction renderHeader(\n groupLabel: string | number | undefined,\n first: boolean,\n length: number,\n size?: ContextMenuPropSize,\n): React.ReactNode | null {\n if (!groupLabel) {\n if (first) {\n return null;\n }\n return <ContextMenuDivider size={size} />;\n }\n return (\n <ContextMenuGroupHeader label={groupLabel} first={first} size={size} />\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\nexport const ContextMenuLevel: ContextMenuLevelType = React.forwardRef(\n (props, ref: React.Ref<HTMLDivElement>) => {\n const {\n // props относящиеся к уровню меню\n size = contextMenuDefaultSize,\n level,\n activeItem,\n addLevel,\n className,\n deleteLevel,\n items,\n setHoveredParenLevel,\n\n // props относящиеся к пунктам меню\n getLabel,\n getRightSideBar,\n getLeftSideBar,\n getSubItems,\n getGroupId,\n getAccent,\n getDisabled,\n getOnClick,\n getItemOnClick,\n onItemClick,\n getItemHTMLAttributes,\n getItemAs,\n\n // props относящиеся к группам меню\n sortGroup,\n getGroupLabel,\n\n // props относящиеся к поповеру\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n hoveredParenLevel,\n spareDirection,\n anchorRef,\n ...otherProps\n } = props;\n\n const [hovered, setHovered] = useState<boolean>(false);\n\n const groups = getGroups(\n items,\n getGroupId,\n undefined,\n undefined,\n sortGroup && ((a, b) => sortGroup(a.key, b.key)),\n );\n\n const getItemIndex = (groupId: number | string, itemIndex: number) =>\n `${groupId}-${itemIndex}`;\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]);\n\n useEffect(() => {\n if (level !== 0 && !hovered && hoveredParenLevel < level) {\n clearTimeout(timers[level]);\n timers[level] = setTimeout(() => deleteLevel(level), closeDelay);\n }\n return () => {\n clearTimeout(timers[level]);\n };\n }, [hovered, hoveredParenLevel]);\n\n return (\n <Popover\n {...otherProps}\n anchorRef={anchorRef}\n className={cnContextMenuLevel({ firstLevel: level === 0, direction }, [\n className,\n ])}\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n onSetDirection={onSetDirection}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n ref={ref}\n >\n {groups.map((group, groupIndex) => {\n const groupLabel =\n typeof getGroupLabel === 'function'\n ? getGroupLabel(group.key)\n : undefined;\n return (\n <div className={cnContextMenuLevel('Group')} key={group.key}>\n {renderHeader(groupLabel, groupIndex === 0, groups.length, size)}\n {group.items.map((item, index) => {\n const itemIndex = getItemIndex(group.key, index);\n const ref = itemsRefs[itemIndex];\n const disabled =\n typeof getDisabled === 'function' ? getDisabled(item) : false;\n const label = getLabel(item);\n const leftSide =\n typeof getLeftSideBar === 'function'\n ? getLeftSideBar(item)\n : undefined;\n const rightSide =\n typeof getRightSideBar === 'function'\n ? getRightSideBar(item)\n : undefined;\n const subItems =\n typeof getSubItems === 'function'\n ? getSubItems(item)\n : undefined;\n const onClick = (\n e: React.MouseEvent<HTMLDivElement, MouseEvent>,\n ) => {\n if (!disabled) {\n if (typeof getItemOnClick === 'function') {\n getItemOnClick(item)?.(e);\n }\n if (typeof getOnClick === 'function') {\n getOnClick(item)?.(e);\n }\n if (typeof onItemClick === 'function') {\n onItemClick?.({ e, item });\n }\n }\n };\n const onMouseEnter =\n subItems && !disabled\n ? () => {\n addLevel(level + 1, subItems, ref, itemIndex);\n setHoveredParenLevel(level + 1);\n }\n : () => {\n setHoveredParenLevel(level);\n };\n const accent =\n typeof getAccent === 'function' ? getAccent(item) : undefined;\n const atributes =\n typeof getItemHTMLAttributes === 'function'\n ? getItemHTMLAttributes(item)\n : {};\n const as =\n typeof getItemAs === 'function' ? getItemAs(item) : undefined;\n\n return (\n <ContextMenuItem\n {...atributes}\n ref={ref}\n label={label}\n leftSide={leftSide}\n rightSide={rightSide}\n size={size}\n key={itemIndex}\n onMouseEnter={onMouseEnter}\n onClick={onClick}\n active={activeItem === itemIndex}\n withSubMenu={Boolean(subItems)}\n accent={accent}\n disabled={disabled}\n as={as}\n />\n );\n })}\n </div>\n );\n })}\n </Popover>\n );\n },\n);\n"],"mappings":"stDAAA,+BAEA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,SAA3B,CAAsCC,OAAtC,CAA+CC,QAA/C,KAA+D,OAA/D,CAEA,O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,CAdN,GAiBH,CArEA,CAFH,CA0EH,CAhFA,CAfH,CAkGH,CApLmD,CAA/C"}
|
|
1
|
+
{"version":3,"file":"ContextMenuLevel.js","names":["React","createRef","useEffect","useMemo","useState","cn","getGroups","Popover","ContextMenuDivider","ContextMenuGroupHeader","ContextMenuItem","contextMenuDefaultSize","cnContextMenuLevel","renderHeader","groupLabel","first","length","size","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevel","forwardRef","props","ref","level","activeItem","addLevel","className","deleteLevel","items","setHoveredParenLevel","getLabel","getRightSideBar","getLeftSideBar","getSubItems","getGroupId","getAccent","getDisabled","getOnClick","getItemOnClick","onItemClick","getItemHTMLAttributes","getItemAs","sortGroup","getGroupLabel","direction","possibleDirections","offset","onSetDirection","hoveredParenLevel","spareDirection","anchorRef","otherProps","hovered","setHovered","groups","a","b","key","getItemIndex","groupId","itemIndex","itemsRefs","constructItemRefs","refs","group","i","setTimeout","firstLevel","map","groupIndex","item","index","disabled","label","leftSide","rightSide","subItems","onMouseEnter","accent","atributes","as","onClick","e"],"sources":["../../../../../../src/components/ContextMenuDeprecated/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport React, { createRef, useEffect, useMemo, useState } from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { getGroups } from '../../../utils/getGroups';\nimport { Popover } from '../../Popover/Popover';\nimport { ContextMenuDivider } from '../ContextMenuDivider/ContextMenuDivider';\nimport { ContextMenuGroupHeader } from '../ContextMenuGroupHeader/ContextMenuGroupHeader';\nimport { ContextMenuItem } from '../ContextMenuItem/ContextMenuItem';\nimport {\n contextMenuDefaultSize,\n ContextMenuLevelType,\n ContextMenuPropSize,\n} from '../helpers';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevelDeprecated');\n\nfunction renderHeader(\n groupLabel: string | number | undefined,\n first: boolean,\n length: number,\n size?: ContextMenuPropSize,\n): React.ReactNode | null {\n if (!groupLabel) {\n if (first) {\n return null;\n }\n return <ContextMenuDivider size={size} />;\n }\n return (\n <ContextMenuGroupHeader label={groupLabel} first={first} size={size} />\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\nexport const ContextMenuLevel: ContextMenuLevelType = React.forwardRef(\n (props, ref: React.Ref<HTMLDivElement>) => {\n const {\n // props относящиеся к уровню меню\n size = contextMenuDefaultSize,\n level,\n activeItem,\n addLevel,\n className,\n deleteLevel,\n items,\n setHoveredParenLevel,\n\n // props относящиеся к пунктам меню\n getLabel,\n getRightSideBar,\n getLeftSideBar,\n getSubItems,\n getGroupId,\n getAccent,\n getDisabled,\n getOnClick,\n getItemOnClick,\n onItemClick,\n getItemHTMLAttributes,\n getItemAs,\n\n // props относящиеся к группам меню\n sortGroup,\n getGroupLabel,\n\n // props относящиеся к поповеру\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n hoveredParenLevel,\n spareDirection,\n anchorRef,\n ...otherProps\n } = props;\n\n const [hovered, setHovered] = useState<boolean>(false);\n\n const groups = getGroups(\n items,\n getGroupId,\n undefined,\n undefined,\n sortGroup && ((a, b) => sortGroup(a.key, b.key)),\n );\n\n const getItemIndex = (groupId: number | string, itemIndex: number) =>\n `${groupId}-${itemIndex}`;\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]);\n\n useEffect(() => {\n if (level !== 0 && !hovered && hoveredParenLevel < level) {\n clearTimeout(timers[level]);\n timers[level] = setTimeout(() => deleteLevel(level), closeDelay);\n }\n return () => {\n clearTimeout(timers[level]);\n };\n }, [hovered, hoveredParenLevel]);\n\n return (\n <Popover\n {...otherProps}\n anchorRef={anchorRef}\n className={cnContextMenuLevel({ firstLevel: level === 0, direction }, [\n className,\n ])}\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n onSetDirection={onSetDirection}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n ref={ref}\n >\n {groups.map((group, groupIndex) => {\n const groupLabel =\n typeof getGroupLabel === 'function'\n ? getGroupLabel(group.key)\n : undefined;\n return (\n <div className={cnContextMenuLevel('Group')} key={group.key}>\n {renderHeader(groupLabel, groupIndex === 0, groups.length, size)}\n {group.items.map((item, index) => {\n const itemIndex = getItemIndex(group.key, index);\n const ref = itemsRefs[itemIndex];\n const disabled =\n typeof getDisabled === 'function' ? getDisabled(item) : false;\n const label = getLabel(item);\n const leftSide =\n typeof getLeftSideBar === 'function'\n ? getLeftSideBar(item)\n : undefined;\n const rightSide =\n typeof getRightSideBar === 'function'\n ? getRightSideBar(item)\n : undefined;\n const subItems =\n typeof getSubItems === 'function'\n ? getSubItems(item)\n : undefined;\n const onClick = (\n e: React.MouseEvent<HTMLDivElement, MouseEvent>,\n ) => {\n if (!disabled) {\n if (typeof getItemOnClick === 'function') {\n getItemOnClick(item)?.(e);\n }\n if (typeof getOnClick === 'function') {\n getOnClick(item)?.(e);\n }\n if (typeof onItemClick === 'function') {\n onItemClick?.({ e, item });\n }\n }\n };\n const onMouseEnter =\n subItems && !disabled\n ? () => {\n addLevel(level + 1, subItems, ref, itemIndex);\n setHoveredParenLevel(level + 1);\n }\n : () => {\n setHoveredParenLevel(level);\n };\n const accent =\n typeof getAccent === 'function' ? getAccent(item) : undefined;\n const atributes =\n typeof getItemHTMLAttributes === 'function'\n ? getItemHTMLAttributes(item)\n : {};\n const as =\n typeof getItemAs === 'function' ? getItemAs(item) : undefined;\n\n return (\n <ContextMenuItem\n {...atributes}\n ref={ref}\n label={label}\n leftSide={leftSide}\n rightSide={rightSide}\n size={size}\n key={itemIndex}\n onMouseEnter={onMouseEnter}\n onClick={onClick}\n active={activeItem === itemIndex}\n withSubMenu={Boolean(subItems)}\n accent={accent}\n disabled={disabled}\n as={as}\n />\n );\n })}\n </div>\n );\n })}\n </Popover>\n );\n },\n);\n"],"mappings":"stDAAA,+BAEA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,SAA3B,CAAsCC,OAAtC,CAA+CC,QAA/C,KAA+D,OAA/D,CAEA,OAASC,EAAT,0BACA,OAASC,SAAT,gCACA,OAASC,OAAT,6BACA,OAASC,kBAAT,gDACA,OAASC,sBAAT,wDACA,OAASC,eAAT,0CACA,OACEC,sBADF,kBAMA,MAAO,IAAMC,mBAAkB,CAAGP,EAAE,CAAC,4BAAD,CAA7B,CAEP,QAASQ,aAAT,CACEC,CADF,CAEEC,CAFF,CAGEC,CAHF,CAIEC,CAJF,CAK0B,OACnBH,EADmB,CAQtB,oBAAC,sBAAD,EAAwB,KAAK,CAAEA,CAA/B,CAA2C,KAAK,CAAEC,CAAlD,CAAyD,IAAI,CAAEE,CAA/D,EARsB,CAElBF,CAFkB,CAGb,IAHa,CAKf,oBAAC,kBAAD,EAAoB,IAAI,CAAEE,CAA1B,EAKV,CAED,GAAIC,OAAuC,CAAG,EAA9C,CACA,MAAO,SAASC,YAAT,EAAuB,oCACRD,MADQ,MAC5B,2BAA4B,IAAjBE,EAAiB,SAC1BC,YAAY,CAACD,CAAD,CACb,CAH2B,+BAI5BF,MAAM,CAAG,EACV,CACD,GAAMI,WAAU,CAAG,GAAnB,CAEA,MAAO,IAAMC,iBAAsC,CAAGvB,KAAK,CAACwB,UAAN,CACpD,SAACC,CAAD,CAAQC,CAAR,CAA2C,OAuCrCD,CAvCqC,CAGvCR,IAHuC,CAGvCA,CAHuC,YAGhCN,sBAHgC,GAIvCgB,CAJuC,CAuCrCF,CAvCqC,CAIvCE,KAJuC,CAKvCC,CALuC,CAuCrCH,CAvCqC,CAKvCG,UALuC,CAMvCC,CANuC,CAuCrCJ,CAvCqC,CA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E,UAQXA,CARW,WAQXA,CARW,QAQXA,CAAW,CAAG,CAAE2C,CAAC,CAADA,CAAF,CAAKZ,IAAI,CAAJA,CAAL,CAAH,CARA,CAUd,CACF,CAoBC,CAUE,MAAM,CAAE9C,CAAU,GAAKoC,CAVzB,CAWE,WAAW,GAAUgB,CAXvB,CAYE,MAAM,CAAEE,CAZV,CAaE,QAAQ,CAAEN,CAbZ,CAcE,EAAE,CAAEQ,CAdN,GAiBH,CArEA,CAFH,CA0EH,CAhFA,CAfH,CAkGH,CApLmD,CAA/C"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import './ListAddItem.css';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { ListAddItemProps } from '../types';
|
|
4
|
-
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" | "
|
|
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>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","
|
|
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
2
|
//# sourceMappingURL=ListAddItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListAddItem.js","names":["React","forwardRef","
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/ListCanary/ListAddItem/index.
|
|
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)}
|