@consta/uikit 5.25.1 → 5.27.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/FlatSelect/index.d.ts +1 -0
- package/FlatSelect/index.js +1 -0
- package/__internal__/src/components/Banner/Banner.d.ts +20 -8
- package/__internal__/src/components/Banner/Banner.js +1 -1
- package/__internal__/src/components/Banner/Banner.js.map +1 -1
- package/__internal__/src/components/Combobox/Combobox.js +1 -1
- package/__internal__/src/components/Combobox/Combobox.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenu.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenu.js.map +1 -1
- package/__internal__/src/components/ContextMenu/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/helpers.d.ts +2 -2
- package/__internal__/src/components/ContextMenu/types.d.ts +5 -5
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldButton/FieldButton.d.ts +1 -1
- package/__internal__/src/components/FieldComponents/FieldButton/FieldButton.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.d.ts +1 -0
- package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.js +1 -1
- package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldWrapper/FieldWrapper.js +1 -1
- package/__internal__/src/components/FieldComponents/FieldWrapper/FieldWrapper.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldWrapper/types.d.ts +1 -0
- package/__internal__/src/components/FieldComponents/FieldWrapper/types.js.map +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelect.css +9 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.d.ts +4 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.d.ts +16 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.d.ts +19 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.d.ts +12 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.d.ts +10 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.d.ts +17 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.d.ts +17 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.d.ts +53 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.d.ts +3 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.d.ts +24 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.d.ts +14 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/defaultProps.d.ts +22 -0
- package/__internal__/src/components/FlatSelect/defaultProps.js +2 -0
- package/__internal__/src/components/FlatSelect/defaultProps.js.map +1 -0
- package/__internal__/src/components/FlatSelect/index.d.ts +2 -0
- package/__internal__/src/components/FlatSelect/index.js +2 -0
- package/__internal__/src/components/FlatSelect/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/types.d.ts +133 -0
- package/__internal__/src/components/FlatSelect/types.js +2 -0
- package/__internal__/src/components/FlatSelect/types.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.d.ts +4 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.js +2 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/index.js +2 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.d.ts +52 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.js +2 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/index.js +2 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.d.ts +10 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.js +2 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js +1 -1
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js.map +1 -1
- package/__internal__/src/components/ListCanary/types.d.ts +1 -0
- package/__internal__/src/components/ListCanary/types.js.map +1 -1
- package/__internal__/src/components/Modal/Modal.css +1 -1
- package/__internal__/src/components/Modal/Modal.d.ts +8 -13
- package/__internal__/src/components/Modal/Modal.js +1 -1
- package/__internal__/src/components/Modal/Modal.js.map +1 -1
- package/__internal__/src/components/Modal/ModalHeader/ModalHeader.css +1 -0
- package/__internal__/src/components/Modal/ModalHeader/ModalHeader.d.ts +14 -0
- package/__internal__/src/components/Modal/ModalHeader/ModalHeader.js +2 -0
- package/__internal__/src/components/Modal/ModalHeader/ModalHeader.js.map +1 -0
- package/__internal__/src/components/Modal/ModalHeader/index.d.ts +1 -0
- package/__internal__/src/components/Modal/ModalHeader/index.js +2 -0
- package/__internal__/src/components/Modal/ModalHeader/index.js.map +1 -0
- package/__internal__/src/components/Modal/ModalLayout/ModalLayout.css +5 -0
- package/__internal__/src/components/Modal/ModalLayout/ModalLayout.d.ts +10 -0
- package/__internal__/src/components/Modal/ModalLayout/ModalLayout.js +2 -0
- package/__internal__/src/components/Modal/ModalLayout/ModalLayout.js.map +1 -0
- package/__internal__/src/components/Modal/ModalLayout/index.d.ts +1 -0
- package/__internal__/src/components/Modal/ModalLayout/index.js +2 -0
- package/__internal__/src/components/Modal/ModalLayout/index.js.map +1 -0
- package/__internal__/src/components/Modal/index.d.ts +3 -0
- package/__internal__/src/components/Modal/index.js +1 -1
- package/__internal__/src/components/Modal/index.js.map +1 -1
- package/__internal__/src/components/Modal/types.d.ts +23 -0
- package/__internal__/src/components/Modal/types.js +2 -0
- package/__internal__/src/components/Modal/types.js.map +1 -0
- package/__internal__/src/components/Modal/useModal.d.ts +20 -0
- package/__internal__/src/components/Modal/useModal.js +2 -0
- package/__internal__/src/components/Modal/useModal.js.map +1 -0
- package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.d.ts +1 -0
- package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.js +1 -1
- package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.js.map +1 -1
- package/__internal__/src/components/Popover/Popover.d.ts +2 -2
- package/__internal__/src/components/Popover/Popover.js.map +1 -1
- package/__internal__/src/components/PortalWithTheme/PortalWithTheme.js +1 -1
- package/__internal__/src/components/PortalWithTheme/PortalWithTheme.js.map +1 -1
- package/__internal__/src/components/RadioGroup/RadioGroup.js +1 -1
- package/__internal__/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/__internal__/src/components/SelectCanary/helpers.d.ts +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.css +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.d.ts +1 -36
- package/__internal__/src/components/Sidebar/Sidebar.js +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.js.map +1 -1
- package/__internal__/src/components/Sidebar/index.d.ts +1 -0
- package/__internal__/src/components/Sidebar/index.js +1 -1
- package/__internal__/src/components/Sidebar/index.js.map +1 -1
- package/__internal__/src/components/Sidebar/types.d.ts +47 -0
- package/__internal__/src/components/Sidebar/types.js +2 -0
- package/__internal__/src/components/Sidebar/types.js.map +1 -0
- package/__internal__/src/components/Sidebar/useAnimateTimeout.d.ts +2 -0
- package/__internal__/src/components/Sidebar/useAnimateTimeout.js +2 -0
- package/__internal__/src/components/Sidebar/useAnimateTimeout.js.map +1 -0
- package/__internal__/src/components/ThemeToggler/helpers.d.ts +1 -1
- package/__internal__/src/components/ThemeToggler/types.d.ts +1 -1
- package/__internal__/src/components/ThemeToggler/types.js.map +1 -1
- package/__internal__/src/components/Tooltip/types.d.ts +1 -1
- package/__internal__/src/components/Tooltip/types.js.map +1 -1
- package/__internal__/src/components/TooltipDeprecated/TooltipDeprecated.d.ts +1 -1
- package/__internal__/src/components/TooltipDeprecated/TooltipDeprecated.js.map +1 -1
- package/__internal__/src/hooks/useComponentSize/useComponentSize.d.ts +1 -1
- package/__internal__/src/hooks/useComponentSize/useComponentSize.js +1 -1
- package/__internal__/src/hooks/useComponentSize/useComponentSize.js.map +1 -1
- package/__internal__/src/mixs/MixFlex/MixFlex.d.ts +2 -2
- package/__internal__/src/mixs/MixFlex/MixFlex.js.map +1 -1
- package/__internal__/src/mixs/MixSpace/MixSpace.d.ts +1 -1
- package/__internal__/src/mixs/MixSpace/MixSpace.js +1 -1
- package/__internal__/src/mixs/MixSpace/MixSpace.js.map +1 -1
- package/__internal__/src/utils/state/useClickOutsideAtom/index.d.ts +1 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/index.js +2 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/index.js.map +1 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.d.ts +9 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.js +2 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.js.map +1 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/getElementSize.d.ts +4 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/getElementSize.js +2 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/getElementSize.js.map +1 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/index.d.ts +3 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/index.js +2 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/index.js.map +1 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/types.d.ts +4 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/types.js +2 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/types.js.map +1 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/useComponentSize.d.ts +2 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/useComponentSize.js +2 -0
- package/__internal__/src/utils/state/useComponentSizeAtom/useComponentSize.js.map +1 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/index.d.ts +1 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/index.js +2 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/index.js.map +1 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.d.ts +2 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.js +2 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.js.map +1 -0
- package/__internal__/src/utils/state/useKeysAtom/index.d.ts +1 -0
- package/__internal__/src/utils/state/useKeysAtom/index.js +2 -0
- package/__internal__/src/utils/state/useKeysAtom/index.js.map +1 -0
- package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.d.ts +14 -0
- package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.js +2 -0
- package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.js.map +1 -0
- package/__internal__/src/utils/state/useRefAtom/useRefAtom.d.ts +1 -1
- package/__internal__/src/utils/state/useRefAtom/useRefAtom.js.map +1 -1
- package/__internal__/src/utils/state/useResizeObservedAtom/index.d.ts +1 -0
- package/__internal__/src/utils/state/useResizeObservedAtom/index.js +2 -0
- package/__internal__/src/utils/state/useResizeObservedAtom/index.js.map +1 -0
- package/__internal__/src/utils/state/useResizeObservedAtom/useResizeObservedAtom.d.ts +2 -0
- package/__internal__/src/utils/state/useResizeObservedAtom/useResizeObservedAtom.js +2 -0
- package/__internal__/src/utils/state/useResizeObservedAtom/useResizeObservedAtom.js.map +1 -0
- package/__internal__/src/utils/state/withCtx/withCtx.js +1 -1
- package/__internal__/src/utils/state/withCtx/withCtx.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/FlatSelect";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/FlatSelect";
|
|
@@ -3,16 +3,28 @@ import { IconComponent } from '@consta/icons/Icon';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { MixSpaceProps, Space } from '../../mixs/MixSpace';
|
|
5
5
|
import { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';
|
|
6
|
+
export declare const bannerPropSize: readonly ["xs", "s", "m", "l"];
|
|
7
|
+
export type BannerPropSize = typeof bannerPropSize[number];
|
|
8
|
+
export declare const bannerPropSizeDefault: BannerPropSize;
|
|
9
|
+
export declare const bannerPropView: readonly ["filled", "ghost", "transparent"];
|
|
10
|
+
export type BannerPropView = typeof bannerPropView[number];
|
|
11
|
+
export declare const bannerPropViewDefault: BannerPropView;
|
|
12
|
+
export declare const bannerPropStatus: readonly ["normal", "warning", "alert", "success", "system"];
|
|
13
|
+
export type BannerPropStatus = typeof bannerPropStatus[number];
|
|
14
|
+
export declare const bannerPropStatusDefault: BannerPropStatus;
|
|
15
|
+
export declare const bannerPropForm: readonly ["default", "round", "brick"];
|
|
16
|
+
export type BannerPropForm = typeof bannerPropForm[number];
|
|
17
|
+
export declare const bannerPropFormDefault: BannerPropForm;
|
|
6
18
|
export type BannerProps = PropsWithJsxAttributes<{
|
|
7
19
|
leftSide?: React.ReactNode;
|
|
8
20
|
rightSide?: React.ReactNode;
|
|
9
21
|
icon?: IconComponent;
|
|
10
|
-
size?:
|
|
11
|
-
view?:
|
|
22
|
+
size?: BannerPropSize;
|
|
23
|
+
view?: BannerPropView;
|
|
12
24
|
space?: MixSpaceProps;
|
|
13
25
|
itemsGap?: Space | [Space, Space];
|
|
14
|
-
status?:
|
|
15
|
-
form?:
|
|
26
|
+
status?: BannerPropStatus;
|
|
27
|
+
form?: BannerPropForm;
|
|
16
28
|
}>;
|
|
17
29
|
export declare const cnBanner: import("@bem-react/classname").ClassNameFormatter;
|
|
18
30
|
/**
|
|
@@ -22,11 +34,11 @@ export declare const cnBanner: import("@bem-react/classname").ClassNameFormatter
|
|
|
22
34
|
* @property {React.ReactNode} [leftSide] - Содержимое на левой стороне.
|
|
23
35
|
* @property {React.ReactNode} [rightSide] - Содержимое на правой стороне.
|
|
24
36
|
* @property {IconComponent} [icon] - Иконка.
|
|
25
|
-
* @property {
|
|
26
|
-
* @property {
|
|
37
|
+
* @property {BannerPropSize} [size] - Размер компонента.
|
|
38
|
+
* @property {BannerPropView} [view] - Визуальный стиль.
|
|
27
39
|
* @property {MixSpaceProps} [space] - Параметры отступов.
|
|
28
40
|
* @property {Space | [Space, Space]} [itemsGap] - Отступы между элементами.
|
|
29
|
-
* @property {
|
|
30
|
-
* @property {
|
|
41
|
+
* @property {BannerPropStatus} [status] - Статус (цветовая схема).
|
|
42
|
+
* @property {BannerPropForm} [form] - Форма компонента.
|
|
31
43
|
*/
|
|
32
44
|
export declare const Banner: React.ForwardRefExoticComponent<Omit<BannerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";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"./Banner.css";import React,{forwardRef}from"react";import{cnText,Text}from"../Text";import{useTheme}from"../Theme/Theme";import{cnMixFlex}from"../../mixs/MixFlex";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{isNotNil,isString}from"../../utils/type-guards";export var cnBanner=cn("Banner");var SlotWrapper=function(a){var b=a.children;return React.createElement("div",{className:cnBanner("Slot")},b)},renderSlot=function(a,b,c){return isString(a)?React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},React.createElement(Text,{className:cnBanner("Text"),view:"primary",weight:0===b&&0===c?"bold":void 0,lineHeight:"m"},a)):React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},a)},renderSlots=function(a,b){return Array.isArray(a)?a.filter(isNotNil).map(function(a,c){return renderSlot(a,c,b)}):renderSlots([a],b)},getGap=function(a,b){return Array.isArray(a)?a[b]:a},textSizeMap={xs:"s",s:"s",m:"m",l:"l"},controlSizeMap={xs:"xs",s:"s",m:"s",l:"m"};export var Banner=forwardRef(function(a,b){var c,d=a.leftSide,e=a.rightSide,f=a.icon,g=a.size,h=void 0===g?
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["leftSide","rightSide","icon","size","view","className","space","itemsGap","status","style","form"];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"./Banner.css";import React,{forwardRef}from"react";import{cnText,Text}from"../Text";import{useTheme}from"../Theme/Theme";import{cnMixFlex}from"../../mixs/MixFlex";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{isNotNil,isString}from"../../utils/type-guards";export var bannerPropSize=["xs","s","m","l"];export var bannerPropSizeDefault=bannerPropSize[2];export var bannerPropView=["filled","ghost","transparent"];export var bannerPropViewDefault=bannerPropView[0];export var bannerPropStatus=["normal","warning","alert","success","system"];export var bannerPropStatusDefault=bannerPropStatus[0];export var bannerPropForm=["default","round","brick"];export var bannerPropFormDefault=bannerPropForm[0];export var cnBanner=cn("Banner");var SlotWrapper=function(a){var b=a.children;return React.createElement("div",{className:cnBanner("Slot")},b)},renderSlot=function(a,b,c){return isString(a)?React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},React.createElement(Text,{className:cnBanner("Text"),view:"primary",weight:0===b&&0===c?"bold":void 0,lineHeight:"m"},a)):React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},a)},renderSlots=function(a,b){return Array.isArray(a)?a.filter(isNotNil).map(function(a,c){return renderSlot(a,c,b)}):renderSlots([a],b)},getGap=function(a,b){return Array.isArray(a)?a[b]:a},textSizeMap={xs:"s",s:"s",m:"m",l:"l"},controlSizeMap={xs:"xs",s:"s",m:"s",l:"m"};export var Banner=forwardRef(function(a,b){var c,d=a.leftSide,e=a.rightSide,f=a.icon,g=a.size,h=void 0===g?bannerPropSizeDefault:g,i=a.view,j=void 0===i?bannerPropViewDefault:i,k=a.className,l=a.space,m=a.itemsGap,n=void 0===m?"s":m,o=a.status,p=void 0===o?bannerPropStatusDefault:o,q=a.style,r=a.form,s=void 0===r?bannerPropFormDefault:r,t=_objectWithoutProperties(a,_excluded),u=useTheme(),v=u.themeClassNames,w=renderSlots([f?React.createElement(f,{className:cnBanner("Icon")}):null].concat(_toConsumableArray(Array.isArray(d)?d:[d])),0),x=renderSlots(e,1);return React.createElement("div",Object.assign({},t,{className:cnBanner({view:j,form:s,size:h},[cnMixFlex({justify:x.length&&!w.length?"flex-end":"space-between",align:"center",gap:"m"}),cnMixSpace(l||{pH:h,pV:"xs"}),cnText({size:textSizeMap[h]}),"system"!==p&&"filled"===j?v.color.accent:void 0,k]),style:_objectSpread(_objectSpread({},q),{},(c={},_defineProperty(c,"--banner-bg-color","var(--color-bg-".concat(p,")")),_defineProperty(c,"--banner-inner-height","var(--control-height-".concat(controlSizeMap[h],")")),c)),ref:b}),w.length?React.createElement("div",{className:cnMixFlex({gap:getGap(n,0),align:"center"})},w):void 0,x.length?React.createElement("div",{className:cnMixFlex({gap:getGap(n,1),align:"center"})},x):void 0)});
|
|
2
2
|
//# sourceMappingURL=Banner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","names":["React","forwardRef","cnText","Text","useTheme","cnMixFlex","cnMixSpace","cn","isNotNil","isString","cnBanner","SlotWrapper","children","renderSlot","slot","index","position","renderSlots","Array","isArray","filter","map","item","getGap","gap","textSizeMap","xs","s","m","l","controlSizeMap","Banner","props","ref","leftSide","rightSide","Icon","icon","size","view","className","space","itemsGap","status","style","form","themeClassNames","leftSlots","rightSlots","justify","length","align","pH","pV","color","accent"],"sources":["../../../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import './Banner.css';\n\nimport { IconComponent } from '@consta/icons/Icon';\nimport React, { forwardRef } from 'react';\n\nimport { cnText, Text } from '##/components/Text';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { cnMixFlex } from '##/mixs/MixFlex';\nimport { cnMixSpace, MixSpaceProps, Space } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { isNotNil, isString } from '##/utils/type-guards';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nexport type BannerProps = PropsWithJsxAttributes<{\n leftSide?: React.ReactNode;\n rightSide?: React.ReactNode;\n icon?: IconComponent;\n size?: 'xs' | 's' | 'm' | 'l';\n view?: 'filled' | 'ghost' | 'transparent';\n space?: MixSpaceProps;\n itemsGap?: Space | [Space, Space];\n status?: 'normal' | 'warning' | 'alert' | 'success' | 'system';\n form?: 'default' | 'round' | 'brick';\n}>;\n\nexport const cnBanner = cn('Banner');\n\nconst SlotWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className={cnBanner('Slot')}>{children}</div>\n);\n\nconst renderSlot = (slot: React.ReactNode, index: number, position: number) => {\n if (isString(slot)) {\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n <Text\n className={cnBanner('Text')}\n view=\"primary\"\n weight={index === 0 && position === 0 ? 'bold' : undefined}\n lineHeight=\"m\"\n >\n {slot}\n </Text>\n </SlotWrapper>\n );\n }\n\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n {slot}\n </SlotWrapper>\n );\n};\n\nconst renderSlots = (slot: React.ReactNode, position: number) => {\n if (Array.isArray(slot)) {\n return slot\n .filter(isNotNil)\n .map((item, index) => renderSlot(item, index, position));\n }\n return renderSlots([slot], position);\n};\n\nconst getGap = (gap: Space | [Space, Space], index: number) => {\n if (Array.isArray(gap)) {\n return gap[index];\n }\n return gap;\n};\n\nconst textSizeMap = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n} as const;\n\nconst controlSizeMap = {\n xs: 'xs',\n s: 's',\n m: 's',\n l: 'm',\n} as const;\n\n/**\n * Компонент Banner, отображающий содержимое слева и справа.\n * Поддерживает иконки, размеры, виды, статусы и формы.\n *\n * @property {React.ReactNode} [leftSide] - Содержимое на левой стороне.\n * @property {React.ReactNode} [rightSide] - Содержимое на правой стороне.\n * @property {IconComponent} [icon] - Иконка.\n * @property {'xs' | 's' | 'm' | 'l'} [size] - Размер компонента.\n * @property {'filled' | 'ghost' | 'transparent'} [view] - Визуальный стиль.\n * @property {MixSpaceProps} [space] - Параметры отступов.\n * @property {Space | [Space, Space]} [itemsGap] - Отступы между элементами.\n * @property {'normal' | 'warning' | 'alert' | 'success' | 'system'} [status] - Статус (цветовая схема).\n * @property {'default' | 'round' | 'brick'} [form] - Форма компонента.\n */\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>((props, ref) => {\n const {\n leftSide,\n rightSide,\n icon: Icon,\n size = 'm',\n view = 'filled',\n className,\n space,\n itemsGap = 's',\n status = 'normal',\n style,\n form = 'default',\n } = props;\n\n const { themeClassNames } = useTheme();\n\n const leftSlots = [\n Icon ? (\n <SlotWrapper>\n <Icon className={cnBanner('Icon')} />\n </SlotWrapper>\n ) : null,\n ...renderSlots(leftSide, 0),\n ].filter(isNotNil);\n\n const rightSlots = renderSlots(rightSide, 1);\n\n return (\n <div\n className={cnBanner({ view, form }, [\n cnMixFlex({\n justify:\n rightSlots.length && !leftSlots.length\n ? 'flex-end'\n : 'space-between',\n align: 'center',\n gap: 'm',\n }),\n cnMixSpace(space || { pH: size, pV: 'xs' }),\n cnText({ size: textSizeMap[size] }),\n status !== 'system' && view === 'filled'\n ? themeClassNames.color.accent\n : undefined,\n className,\n ])}\n style={{\n ...style,\n ['--banner-bg-color' as string]: `var(--color-bg-${status})`,\n ['--banner-inner-height' as string]: `var(--control-height-${controlSizeMap[size]})`,\n }}\n ref={ref}\n >\n {leftSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 0), align: 'center' })}\n >\n {leftSlots}\n </div>\n ) : undefined}\n {rightSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 1), align: 'center' })}\n >\n {rightSlots}\n </div>\n ) : undefined}\n </div>\n );\n});\n"],"mappings":"8uBAAA,qBAGA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,MAAT,CAAiBC,IAAjB,eACA,OAASC,QAAT,sBACA,OAASC,SAAT,0BACA,OAASC,UAAT,2BACA,OAASC,EAAT,uBACA,OAASC,QAAT,CAAmBC,QAAnB,+BAeA,MAAO,IAAMC,SAAQ,CAAGH,EAAE,CAAC,QAAD,CAAnB,C,GAEDI,YAAoD,CAAG,eAAGC,EAAH,GAAGA,QAAH,OAC3D,4BAAK,SAAS,CAAEF,QAAQ,CAAC,MAAD,CAAxB,EAAmCE,CAAnC,CAD2D,C,CAIvDC,UAAU,CAAG,SAACC,CAAD,CAAwBC,CAAxB,CAAuCC,CAAvC,CAA4D,OACzEP,SAAQ,CAACK,CAAD,CADiE,CAGzE,oBAAC,WAAD,EAAa,GAAG,CAAEJ,QAAQ,CAAC,MAAD,CAAS,CAAEK,KAAK,CAALA,CAAF,CAASC,QAAQ,CAARA,CAAT,CAAT,CAA1B,EACE,oBAAC,IAAD,EACE,SAAS,CAAEN,QAAQ,CAAC,MAAD,CADrB,CAEE,IAAI,CAAC,SAFP,CAGE,MAAM,CAAY,CAAV,GAAAK,CAAK,EAAuB,CAAb,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B,QAAT,GAAAJ,CAAvB,CACIO,CAAe,CAACQ,KAAhB,CAAsBC,MAD1B,OAXkC,CAclCf,CAdkC,CAAjB,CADrB,CAiBE,KAAK,gCACAI,CADA,6BAEF,mBAFE,0BAEgDD,CAFhD,yBAGF,uBAHE,gCAG0Db,cAAc,CAACQ,CAAD,CAHxE,UAjBP,CAsBE,GAAG,CAAEL,CAtBP,EAwBGc,CAAS,CAACG,MAAV,CACC,2BACE,SAAS,CAAE7C,SAAS,CAAC,CAAEmB,GAAG,CAAED,MAAM,CAACmB,CAAD,CAAW,CAAX,CAAb,CAA4BS,KAAK,CAAE,QAAnC,CAAD,CADtB,EAGGJ,CAHH,CADD,OAxBH,CA+BGC,CAAU,CAACE,MAAX,CACC,2BACE,SAAS,CAAE7C,SAAS,CAAC,CAAEmB,GAAG,CAAED,MAAM,CAACmB,CAAD,CAAW,CAAX,CAAb,CAA4BS,KAAK,CAAE,QAAnC,CAAD,CADtB,EAGGH,CAHH,CADD,OA/BH,CAwCH,CArE+B,CAAzB"}
|
|
1
|
+
{"version":3,"file":"Banner.js","names":["React","forwardRef","cnText","Text","useTheme","cnMixFlex","cnMixSpace","cn","isNotNil","isString","bannerPropSize","bannerPropSizeDefault","bannerPropView","bannerPropViewDefault","bannerPropStatus","bannerPropStatusDefault","bannerPropForm","bannerPropFormDefault","cnBanner","SlotWrapper","children","renderSlot","slot","index","position","renderSlots","Array","isArray","filter","map","item","getGap","gap","textSizeMap","xs","s","m","l","controlSizeMap","Banner","props","ref","leftSide","rightSide","Icon","icon","size","view","className","space","itemsGap","status","style","form","otherProps","themeClassNames","leftSlots","rightSlots","justify","length","align","pH","pV","color","accent"],"sources":["../../../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import './Banner.css';\n\nimport { IconComponent } from '@consta/icons/Icon';\nimport React, { forwardRef } from 'react';\n\nimport { cnText, Text } from '##/components/Text';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { cnMixFlex } from '##/mixs/MixFlex';\nimport { cnMixSpace, MixSpaceProps, Space } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { isNotNil, isString } from '##/utils/type-guards';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nexport const bannerPropSize = ['xs', 's', 'm', 'l'] as const;\nexport type BannerPropSize = typeof bannerPropSize[number];\nexport const bannerPropSizeDefault: BannerPropSize = bannerPropSize[2]; // 'm'\n\nexport const bannerPropView = ['filled', 'ghost', 'transparent'] as const;\nexport type BannerPropView = typeof bannerPropView[number];\nexport const bannerPropViewDefault: BannerPropView = bannerPropView[0]; // 'filled'\n\nexport const bannerPropStatus = [\n 'normal',\n 'warning',\n 'alert',\n 'success',\n 'system',\n] as const;\nexport type BannerPropStatus = typeof bannerPropStatus[number];\nexport const bannerPropStatusDefault: BannerPropStatus = bannerPropStatus[0]; // 'normal'\n\nexport const bannerPropForm = ['default', 'round', 'brick'] as const;\nexport type BannerPropForm = typeof bannerPropForm[number];\nexport const bannerPropFormDefault: BannerPropForm = bannerPropForm[0]; // 'default'\n\nexport type BannerProps = PropsWithJsxAttributes<{\n leftSide?: React.ReactNode;\n rightSide?: React.ReactNode;\n icon?: IconComponent;\n size?: BannerPropSize;\n view?: BannerPropView;\n space?: MixSpaceProps;\n itemsGap?: Space | [Space, Space];\n status?: BannerPropStatus;\n form?: BannerPropForm;\n}>;\n\nexport const cnBanner = cn('Banner');\n\nconst SlotWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className={cnBanner('Slot')}>{children}</div>\n);\n\nconst renderSlot = (slot: React.ReactNode, index: number, position: number) => {\n if (isString(slot)) {\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n <Text\n className={cnBanner('Text')}\n view=\"primary\"\n weight={index === 0 && position === 0 ? 'bold' : undefined}\n lineHeight=\"m\"\n >\n {slot}\n </Text>\n </SlotWrapper>\n );\n }\n\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n {slot}\n </SlotWrapper>\n );\n};\n\nconst renderSlots = (slot: React.ReactNode, position: number) => {\n if (Array.isArray(slot)) {\n return slot\n .filter(isNotNil)\n .map((item, index) => renderSlot(item, index, position));\n }\n return renderSlots([slot], position);\n};\n\nconst getGap = (gap: Space | [Space, Space], index: number) => {\n if (Array.isArray(gap)) {\n return gap[index];\n }\n return gap;\n};\n\nconst textSizeMap: Record<BannerPropSize, 'xs' | 's' | 'm' | 'l'> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nconst controlSizeMap: Record<BannerPropSize, 'xs' | 's' | 'm'> = {\n xs: 'xs',\n s: 's',\n m: 's',\n l: 'm',\n};\n\n/**\n * Компонент Banner, отображающий содержимое слева и справа.\n * Поддерживает иконки, размеры, виды, статусы и формы.\n *\n * @property {React.ReactNode} [leftSide] - Содержимое на левой стороне.\n * @property {React.ReactNode} [rightSide] - Содержимое на правой стороне.\n * @property {IconComponent} [icon] - Иконка.\n * @property {BannerPropSize} [size] - Размер компонента.\n * @property {BannerPropView} [view] - Визуальный стиль.\n * @property {MixSpaceProps} [space] - Параметры отступов.\n * @property {Space | [Space, Space]} [itemsGap] - Отступы между элементами.\n * @property {BannerPropStatus} [status] - Статус (цветовая схема).\n * @property {BannerPropForm} [form] - Форма компонента.\n */\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>((props, ref) => {\n const {\n leftSide,\n rightSide,\n icon: Icon,\n size = bannerPropSizeDefault,\n view = bannerPropViewDefault,\n className,\n space,\n itemsGap = 's',\n status = bannerPropStatusDefault,\n style,\n form = bannerPropFormDefault,\n ...otherProps\n } = props;\n\n const { themeClassNames } = useTheme();\n\n const leftSlots = renderSlots(\n [\n Icon ? <Icon className={cnBanner('Icon')} /> : null,\n ...(Array.isArray(leftSide) ? leftSide : [leftSide]),\n ],\n 0,\n );\n\n const rightSlots = renderSlots(rightSide, 1);\n\n return (\n <div\n {...otherProps}\n className={cnBanner({ view, form, size }, [\n cnMixFlex({\n justify:\n rightSlots.length && !leftSlots.length\n ? 'flex-end'\n : 'space-between',\n align: 'center',\n gap: 'm',\n }),\n cnMixSpace(space || { pH: size, pV: 'xs' }),\n cnText({ size: textSizeMap[size] }),\n status !== 'system' && view === 'filled'\n ? themeClassNames.color.accent\n : undefined,\n className,\n ])}\n style={{\n ...style,\n ['--banner-bg-color' as string]: `var(--color-bg-${status})`,\n ['--banner-inner-height' as string]: `var(--control-height-${controlSizeMap[size]})`,\n }}\n ref={ref}\n >\n {leftSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 0), align: 'center' })}\n >\n {leftSlots}\n </div>\n ) : undefined}\n {rightSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 1), align: 'center' })}\n >\n {rightSlots}\n </div>\n ) : undefined}\n </div>\n );\n});\n"],"mappings":"s7BAAA,qBAGA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,MAAT,CAAiBC,IAAjB,eACA,OAASC,QAAT,sBACA,OAASC,SAAT,0BACA,OAASC,UAAT,2BACA,OAASC,EAAT,uBACA,OAASC,QAAT,CAAmBC,QAAnB,+BAGA,MAAO,IAAMC,eAAc,CAAG,CAAC,IAAD,CAAO,GAAP,CAAY,GAAZ,CAAiB,GAAjB,CAAvB,CAEP,MAAO,IAAMC,sBAAqC,CAAGD,cAAc,CAAC,CAAD,CAA5D,CAEP,MAAO,IAAME,eAAc,CAAG,CAAC,QAAD,CAAW,OAAX,CAAoB,aAApB,CAAvB,CAEP,MAAO,IAAMC,sBAAqC,CAAGD,cAAc,CAAC,CAAD,CAA5D,CAEP,MAAO,IAAME,iBAAgB,CAAG,CAC9B,QAD8B,CAE9B,SAF8B,CAG9B,OAH8B,CAI9B,SAJ8B,CAK9B,QAL8B,CAAzB,CAQP,MAAO,IAAMC,wBAAyC,CAAGD,gBAAgB,CAAC,CAAD,CAAlE,CAEP,MAAO,IAAME,eAAc,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,C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AS,CAAEtD,SAAS,CAAC,CAAE2B,GAAG,CAAED,MAAM,CAACmB,CAAD,CAAW,CAAX,CAAb,CAA4BU,KAAK,CAAE,QAAnC,CAAD,CADtB,EAGGH,CAHH,CADD,OAhCH,CAyCH,CAtE+B,CAAzB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValue","renderValue","onCreate","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs"];import"../SelectComponents/Select.css";import{IconClear}from"@consta/icons/IconClear";import{IconSelect}from"@consta/icons/IconSelect";import React,{forwardRef,useRef}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{cnSelect}from"../SelectComponents/cnSelect";import{defaultLabelForCreate,defaultLabelForEmptyItems,defaultLabelForNotFound,getInputWidth}from"../SelectComponents/helpers";import{SelectContainer}from"../SelectComponents/SelectContainer";import{SelectDropdown}from"../SelectComponents/SelectDropdown";import{SelectItem}from"../SelectComponents/SelectItem";import{SelectValueTag}from"../SelectComponents/SelectValueTag";import{defaultPropForm,defaultPropSize,defaultPropView}from"../SelectComponents/types";import{useSelect}from"../SelectComponents/useSelect";import{useForkRef}from"../../hooks/useForkRef";import{isNotNil}from"../../utils/type-guards";import{Text}from"../Text";import{clearSizeMap,iconSizeMap,isMultipleParams,isNotMultipleParams,withDefaultGetters}from"./helpers";export var COMPONENT_NAME="Combobox";var ComboboxRender=function(a,b){var c=useRef(null),d=useRef(null),e=useRef(null),f=useRef(null),g=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),f),h=g.placeholder,i=g.onBlur,j=g.onFocus,k=g.items,l=g.onChange,m=g.value,n=g.disabled,o=g.ariaLabel,p=g.id,q=g.required,r=g.dropdownRef,s=g.form,t=void 0===s?defaultPropForm:s,u=g.view,v=void 0===u?defaultPropView:u,w=g.size,x=void 0===w?defaultPropSize:w,y=g.dropdownClassName,z=g.name,A=g.groups,B=void 0===A?[]:A,C=g.getItemLabel,D=g.getItemKey,E=g.getItemGroupKey,F=g.getItemDisabled,G=g.getGroupKey,H=g.getGroupLabel,I=g.renderItem,J=g.allSelectedAllLabel,K=void 0===J?"\u0412\u0441\u0435":J,L=g.searchValue,M=g.renderValue,N=g.onCreate,O=g.inputRef,P=g.labelForNotFound,Q=void 0===P?defaultLabelForNotFound:P,R=g.labelForCreate,S=void 0===R?defaultLabelForCreate:R,T=g.labelForEmptyItems,U=void 0===T?defaultLabelForEmptyItems:T,V=g.searchFunction,W=g.selectAll,X=g.isLoading,Y=g.multiple,Z=void 0!==Y&&Y,$=g.style,_=g.dropdownForm,aa=void 0===_?"default":_,ba=g.virtualScroll,ca=g.onScrollToBottom,da=g.onDropdownOpen,ea=g.onSearchValueChange,fa=g.dropdownOpen,ga=g.ignoreOutsideClicksRefs,ha=_objectWithoutProperties(g,_excluded),ia=useSelect({items:k,groups:B,value:m,onChange:l,selectAll:W,dropdownRef:c,controlRef:f,disabled:n,getItemLabel:C,getItemKey:D,getGroupKey:G,searchValue:L,getItemGroupKey:E,getItemDisabled:F,multiple:Z,onBlur:i,onFocus:j,onCreate:N,searchFunction:V,onDropdownOpen:da,onSearchValueChange:ea,dropdownOpen:fa,ignoreOutsideClicksRefs:ga}),ja=ia.getKeyProps,ka=ia.getOptionProps,la=ia.isOpen,ma=ia.visibleItems,na=ia.isFocused,oa=ia.handleInputFocus,pa=ia.handleInputBlur,qa=ia.handleToggleDropdown,ra=ia.inputRef,sa=ia.handleInputClick,ta=ia.handleInputChange,ua=ia.searchValue,va=ia.clearValue,wa=ia.getHandleRemoveValue,xa=ia.notFound,ya=ia.hasItems,za=ia.optionsRefs,Aa=ia.allItemsSelected,Ba=p?"".concat(p,"-input"):p,Ca=M||(Z?function renderValueDefaultMultiple(a){var b=a.item,c=a.handleRemove;return React.createElement(SelectValueTag,{label:C(b),key:D(b),size:x,disabled:n||F(b),handleRemove:c})}:function renderValueDefaultNotMultiple(a){var b=C(a.item);return React.createElement("span",{className:cnSelect("ControlValue"),title:b},b)}),Da=useForkRef([ra,O]),Ea=function(){var b=Z?getInputWidth(d,e):void 0;return React.createElement(React.Fragment,null,isMultipleParams(a)&&Array.isArray(a.value)&&a.value.map(function(a){return Ca({item:a,handleRemove:wa(a)})}),isNotMultipleParams(a)&&isNotNil(a.value)&&Ca({item:a.value}),(!isNotNil(m)||Array.isArray(m)&&0===m.length)&&!ua&&h&&React.createElement("span",{className:cnSelect("Placeholder"),title:"placeholder"},h),React.createElement("input",Object.assign({},ja(),{type:"text",name:z,id:Ba,onFocus:oa,onBlur:pa,"aria-label":o,onChange:ta,ref:Da,className:cnSelect("Input",{size:x,hide:!Z&&isNotNil(m),multiple:Z}),value:ua,style:{width:b}})))};return React.createElement(React.Fragment,null,React.createElement(SelectContainer,Object.assign({focused:na,disabled:n,size:x,view:v,required:q,form:t,multiple:Z,ref:b,type:"combobox",style:$,id:Ba},ha),React.createElement("div",{className:cnSelect("Control",{hasInput:!0}),ref:f,"aria-expanded":la,"aria-haspopup":"listbox",id:p},React.createElement("div",{className:cnSelect("ControlInner"),onClick:sa,role:"button",ref:d,"aria-hidden":"true"},React.createElement("div",{className:cnSelect("ControlValueContainer")},function renderValueList(){return Aa?React.createElement(Text,{view:"primary",size:x,className:cnSelect("SelectAll"),lineHeight:"m"},K):Z?React.createElement("div",{className:cnSelect("ControlValue")},Ea()):Ea()}())),React.createElement("span",{className:cnSelect("Indicators")},
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValue","renderValue","onCreate","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs"];import"../SelectComponents/Select.css";import{IconClear}from"@consta/icons/IconClear";import{IconSelect}from"@consta/icons/IconSelect";import React,{forwardRef,useRef}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{cnSelect}from"../SelectComponents/cnSelect";import{defaultLabelForCreate,defaultLabelForEmptyItems,defaultLabelForNotFound,getInputWidth}from"../SelectComponents/helpers";import{SelectContainer}from"../SelectComponents/SelectContainer";import{SelectDropdown}from"../SelectComponents/SelectDropdown";import{SelectItem}from"../SelectComponents/SelectItem";import{SelectValueTag}from"../SelectComponents/SelectValueTag";import{defaultPropForm,defaultPropSize,defaultPropView}from"../SelectComponents/types";import{useSelect}from"../SelectComponents/useSelect";import{useForkRef}from"../../hooks/useForkRef";import{isNotNil}from"../../utils/type-guards";import{Text}from"../Text";import{clearSizeMap,iconSizeMap,isMultipleParams,isNotMultipleParams,withDefaultGetters}from"./helpers";export var COMPONENT_NAME="Combobox";var ComboboxRender=function(a,b){var c=useRef(null),d=useRef(null),e=useRef(null),f=useRef(null),g=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),f),h=g.placeholder,i=g.onBlur,j=g.onFocus,k=g.items,l=g.onChange,m=g.value,n=g.disabled,o=g.ariaLabel,p=g.id,q=g.required,r=g.dropdownRef,s=g.form,t=void 0===s?defaultPropForm:s,u=g.view,v=void 0===u?defaultPropView:u,w=g.size,x=void 0===w?defaultPropSize:w,y=g.dropdownClassName,z=g.name,A=g.groups,B=void 0===A?[]:A,C=g.getItemLabel,D=g.getItemKey,E=g.getItemGroupKey,F=g.getItemDisabled,G=g.getGroupKey,H=g.getGroupLabel,I=g.renderItem,J=g.allSelectedAllLabel,K=void 0===J?"\u0412\u0441\u0435":J,L=g.searchValue,M=g.renderValue,N=g.onCreate,O=g.inputRef,P=g.labelForNotFound,Q=void 0===P?defaultLabelForNotFound:P,R=g.labelForCreate,S=void 0===R?defaultLabelForCreate:R,T=g.labelForEmptyItems,U=void 0===T?defaultLabelForEmptyItems:T,V=g.searchFunction,W=g.selectAll,X=g.isLoading,Y=g.multiple,Z=void 0!==Y&&Y,$=g.style,_=g.dropdownForm,aa=void 0===_?"default":_,ba=g.virtualScroll,ca=g.onScrollToBottom,da=g.onDropdownOpen,ea=g.onSearchValueChange,fa=g.dropdownOpen,ga=g.ignoreOutsideClicksRefs,ha=_objectWithoutProperties(g,_excluded),ia=useSelect({items:k,groups:B,value:m,onChange:l,selectAll:W,dropdownRef:c,controlRef:f,disabled:n,getItemLabel:C,getItemKey:D,getGroupKey:G,searchValue:L,getItemGroupKey:E,getItemDisabled:F,multiple:Z,onBlur:i,onFocus:j,onCreate:N,searchFunction:V,onDropdownOpen:da,onSearchValueChange:ea,dropdownOpen:fa,ignoreOutsideClicksRefs:ga}),ja=ia.getKeyProps,ka=ia.getOptionProps,la=ia.isOpen,ma=ia.visibleItems,na=ia.isFocused,oa=ia.handleInputFocus,pa=ia.handleInputBlur,qa=ia.handleToggleDropdown,ra=ia.inputRef,sa=ia.handleInputClick,ta=ia.handleInputChange,ua=ia.searchValue,va=ia.clearValue,wa=ia.getHandleRemoveValue,xa=ia.notFound,ya=ia.hasItems,za=ia.optionsRefs,Aa=ia.allItemsSelected,Ba=p?"".concat(p,"-input"):p,Ca=M||(Z?function renderValueDefaultMultiple(a){var b=a.item,c=a.handleRemove;return React.createElement(SelectValueTag,{label:C(b),key:D(b),size:x,disabled:n||F(b),handleRemove:c})}:function renderValueDefaultNotMultiple(a){var b=C(a.item);return React.createElement("span",{className:cnSelect("ControlValue"),title:b},b)}),Da=useForkRef([ra,O]),Ea=function(){var b=Z?getInputWidth(d,e):void 0;return React.createElement(React.Fragment,null,isMultipleParams(a)&&Array.isArray(a.value)&&a.value.map(function(a){return Ca({item:a,handleRemove:wa(a)})}),isNotMultipleParams(a)&&isNotNil(a.value)&&Ca({item:a.value}),(!isNotNil(m)||Array.isArray(m)&&0===m.length)&&!ua&&h&&React.createElement("span",{className:cnSelect("Placeholder"),title:"placeholder"},h),React.createElement("input",Object.assign({},ja(),{type:"text",name:z,id:Ba,onFocus:oa,onBlur:pa,"aria-label":o,onChange:ta,ref:Da,className:cnSelect("Input",{size:x,hide:!Z&&isNotNil(m),multiple:Z}),value:ua,style:{width:b}})))},Fa=isMultipleParams(a)?isNotNil(a.value)&&0<a.value.length:isNotNil(a.value);return React.createElement(React.Fragment,null,React.createElement(SelectContainer,Object.assign({focused:na,disabled:n,size:x,view:v,required:q,form:t,multiple:Z,ref:b,type:"combobox",style:$,id:Ba},ha),React.createElement("div",{className:cnSelect("Control",{hasInput:!0}),ref:f,"aria-expanded":la,"aria-haspopup":"listbox",id:p},React.createElement("div",{className:cnSelect("ControlInner"),onClick:sa,role:"button",ref:d,"aria-hidden":"true"},React.createElement("div",{className:cnSelect("ControlValueContainer")},function renderValueList(){return Aa?React.createElement(Text,{view:"primary",size:x,className:cnSelect("SelectAll"),lineHeight:"m"},K):Z?React.createElement("div",{className:cnSelect("ControlValue")},Ea()):Ea()}())),React.createElement("span",{className:cnSelect("Indicators")},Fa&&React.createElement("button",{type:"button",onClick:va,tabIndex:-1,className:cnSelect("ClearIndicator")},React.createElement(IconClear,{size:clearSizeMap[x],className:cnSelect("ClearIndicatorIcon")})),React.createElement("span",{className:cnSelect("Delimiter")}),React.createElement("button",{type:"button",className:cnSelect("IndicatorsDropdown"),tabIndex:-1,onClick:qa},React.createElement(IconSelect,{size:iconSizeMap[x],className:cnSelect("DropdownIndicatorIcon")})))),React.createElement("div",{className:cnSelect("HelperInputFakeElement"),ref:e},ua)),React.createElement(SelectDropdown,{isOpen:la,size:x,controlRef:f,getOptionProps:ka,dropdownRef:useForkRef([r,c]),form:aa,className:y,renderItem:I||function renderItemDefault(a){var b=a.item,c=a.active,d=a.hovered,e=a.onClick,f=a.onMouseEnter,g=a.ref;return React.createElement(SelectItem,{label:C(b),active:c,hovered:d,multiple:Z,size:x,indent:"round"===aa?"increased":"normal",onClick:e,onMouseEnter:f,disabled:F(b),ref:g})},getGroupLabel:H,visibleItems:ma,labelForNotFound:Q,labelForCreate:S,isLoading:X,labelForEmptyItems:U,notFound:xa,hasItems:ya,itemsRefs:za,virtualScroll:ba,onScrollToBottom:ca,style:"number"==typeof(null===$||void 0===$?void 0:$.zIndex)?{zIndex:$.zIndex+1}:void 0}))};export var Combobox=forwardRef(ComboboxRender);
|
|
2
2
|
//# sourceMappingURL=Combobox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","names":["IconClear","IconSelect","React","forwardRef","useRef","usePropsHandler","cnSelect","defaultLabelForCreate","defaultLabelForEmptyItems","defaultLabelForNotFound","getInputWidth","SelectContainer","SelectDropdown","SelectItem","SelectValueTag","defaultPropForm","defaultPropSize","defaultPropView","useSelect","useForkRef","isNotNil","Text","clearSizeMap","iconSizeMap","isMultipleParams","isNotMultipleParams","withDefaultGetters","COMPONENT_NAME","ComboboxRender","props","ref","defaultDropdownRef","controlInnerRef","helperInputFakeElement","controlRef","placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValueProp","searchValue","renderValueProp","renderValue","onCreate","inputRefProp","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs","otherProps","getKeyProps","getOptionProps","isOpen","visibleItems","isFocused","handleInputFocus","handleInputBlur","handleToggleDropdown","handleInputClick","handleInputChange","clearValue","getHandleRemoveValue","notFound","hasItems","optionsRefs","allItemsSelected","inputId","renderValueDefaultMultiple","item","handleRemove","renderValueDefaultNotMultiple","valueLabel","inputRefForRender","renderControlValue","width","Array","isArray","map","length","hide","hasInput","renderValueList","renderItemDefault","active","hovered","onClick","onMouseEnter","zIndex","Combobox"],"sources":["../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import '##/components/SelectComponents/Select.css';\n\nimport { IconClear } from '@consta/icons/IconClear';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { cnSelect } from '##/components/SelectComponents/cnSelect';\nimport {\n defaultLabelForCreate,\n defaultLabelForEmptyItems,\n defaultLabelForNotFound,\n getInputWidth,\n} from '##/components/SelectComponents/helpers';\nimport { SelectContainer } from '##/components/SelectComponents/SelectContainer';\nimport { SelectDropdown } from '##/components/SelectComponents/SelectDropdown';\nimport { SelectItem } from '##/components/SelectComponents/SelectItem';\nimport { SelectValueTag } from '##/components/SelectComponents/SelectValueTag';\nimport {\n defaultPropForm,\n defaultPropSize,\n defaultPropView,\n} from '##/components/SelectComponents/types';\nimport { useSelect } from '##/components/SelectComponents/useSelect';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { isNotNil } from '##/utils/type-guards';\n\nimport { Text } from '../Text';\nimport {\n clearSizeMap,\n ComboboxComponent,\n ComboboxGroupDefault,\n ComboboxItemDefault,\n ComboboxPropRenderItem,\n ComboboxPropRenderValue,\n ComboboxProps,\n iconSizeMap,\n isMultipleParams,\n isNotMultipleParams,\n withDefaultGetters,\n} from './helpers';\n\nexport const COMPONENT_NAME = 'Combobox' as const;\n\nconst ComboboxRender = <\n ITEM = ComboboxItemDefault,\n GROUP = ComboboxGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: ComboboxProps<ITEM, GROUP, MULTIPLE>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const defaultDropdownRef = useRef<HTMLDivElement | null>(null);\n const controlInnerRef = useRef<HTMLDivElement>(null);\n const helperInputFakeElement = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLDivElement | null>(null);\n\n const {\n placeholder,\n onBlur,\n onFocus,\n items,\n onChange,\n value,\n disabled,\n ariaLabel,\n id,\n required,\n dropdownRef,\n form = defaultPropForm,\n view = defaultPropView,\n size = defaultPropSize,\n dropdownClassName,\n name,\n groups = [],\n getItemLabel,\n getItemKey,\n getItemGroupKey,\n getItemDisabled,\n getGroupKey,\n getGroupLabel,\n renderItem,\n allSelectedAllLabel = 'Все',\n searchValue: searchValueProp,\n renderValue: renderValueProp,\n onCreate,\n inputRef: inputRefProp,\n labelForNotFound = defaultLabelForNotFound,\n labelForCreate = defaultLabelForCreate,\n labelForEmptyItems = defaultLabelForEmptyItems,\n searchFunction,\n selectAll,\n isLoading,\n multiple = false,\n style,\n dropdownForm = 'default',\n virtualScroll,\n onScrollToBottom,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, withDefaultGetters(props), controlRef);\n\n const {\n getKeyProps,\n getOptionProps,\n isOpen,\n visibleItems,\n isFocused,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n searchValue,\n clearValue,\n getHandleRemoveValue,\n notFound,\n hasItems,\n optionsRefs,\n allItemsSelected,\n } = useSelect({\n items,\n groups,\n value,\n onChange,\n selectAll,\n dropdownRef: defaultDropdownRef,\n controlRef,\n disabled,\n getItemLabel,\n getItemKey,\n getGroupKey,\n searchValue: searchValueProp,\n getItemGroupKey,\n getItemDisabled,\n multiple,\n onBlur,\n onFocus,\n onCreate,\n searchFunction,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n });\n\n const inputId = id ? `${id}-input` : id;\n\n const renderItemDefault: ComboboxPropRenderItem<ITEM> = (props) => {\n const { item, active, hovered, onClick, onMouseEnter, ref } = props;\n\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n multiple={multiple}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n />\n );\n };\n\n const renderValueDefaultMultiple: ComboboxPropRenderValue<ITEM> = ({\n item,\n handleRemove,\n }) => {\n return (\n <SelectValueTag\n label={getItemLabel(item)}\n key={getItemKey(item)}\n size={size}\n disabled={disabled || getItemDisabled(item)}\n handleRemove={handleRemove}\n />\n );\n };\n\n const renderValueDefaultNotMultiple: ComboboxPropRenderValue<ITEM> = (\n props,\n ) => {\n const valueLabel = getItemLabel(props.item);\n\n return (\n <span className={cnSelect('ControlValue')} title={valueLabel}>\n {valueLabel}\n </span>\n );\n };\n\n const renderValue =\n renderValueProp ||\n (multiple ? renderValueDefaultMultiple : renderValueDefaultNotMultiple);\n\n const inputRefForRender = useForkRef([inputRef, inputRefProp]);\n\n const renderControlValue = () => {\n const width = multiple\n ? getInputWidth(controlInnerRef, helperInputFakeElement)\n : undefined;\n return (\n <>\n {isMultipleParams(props) &&\n Array.isArray(props.value) &&\n props.value.map((item) =>\n renderValue({ item, handleRemove: getHandleRemoveValue(item) }),\n )}\n {isNotMultipleParams(props) &&\n isNotNil(props.value) &&\n renderValue({ item: props.value })}\n {(!isNotNil(value) || (Array.isArray(value) && value.length === 0)) &&\n !searchValue &&\n placeholder && (\n <span className={cnSelect('Placeholder')} title=\"placeholder\">\n {placeholder}\n </span>\n )}\n <input\n {...getKeyProps()}\n type=\"text\"\n name={name}\n id={inputId}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n aria-label={ariaLabel}\n onChange={handleInputChange}\n ref={inputRefForRender}\n className={cnSelect('Input', {\n size,\n hide: !multiple && isNotNil(value),\n multiple,\n })}\n value={searchValue}\n style={{ width }}\n />\n </>\n );\n };\n\n const renderValueList = () => {\n if (allItemsSelected) {\n return (\n <Text\n view=\"primary\"\n size={size}\n className={cnSelect('SelectAll')}\n lineHeight=\"m\"\n >\n {allSelectedAllLabel}\n </Text>\n );\n }\n if (multiple) {\n return (\n <div className={cnSelect('ControlValue')}>{renderControlValue()}</div>\n );\n }\n return renderControlValue();\n };\n\n return (\n <>\n <SelectContainer\n focused={isFocused}\n disabled={disabled}\n size={size}\n view={view}\n required={required}\n form={form}\n multiple={multiple}\n ref={ref}\n type=\"combobox\"\n style={style}\n id={inputId}\n {...otherProps}\n >\n <div\n className={cnSelect('Control', { hasInput: true })}\n ref={controlRef}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n id={id}\n >\n <div\n className={cnSelect('ControlInner')}\n onClick={handleInputClick}\n role=\"button\"\n ref={controlInnerRef}\n aria-hidden=\"true\"\n >\n <div className={cnSelect('ControlValueContainer')}>\n {renderValueList()}\n </div>\n </div>\n <span className={cnSelect('Indicators')}>\n {isNotNil(value) && (\n <button\n type=\"button\"\n onClick={clearValue}\n tabIndex={-1}\n className={cnSelect('ClearIndicator')}\n >\n <IconClear\n size={clearSizeMap[size]}\n className={cnSelect('ClearIndicatorIcon')}\n />\n </button>\n )}\n <span className={cnSelect('Delimiter')} />\n <button\n type=\"button\"\n className={cnSelect('IndicatorsDropdown')}\n tabIndex={-1}\n onClick={handleToggleDropdown}\n >\n <IconSelect\n size={iconSizeMap[size]}\n className={cnSelect('DropdownIndicatorIcon')}\n />\n </button>\n </span>\n </div>\n <div\n className={cnSelect('HelperInputFakeElement')}\n ref={helperInputFakeElement}\n >\n {searchValue}\n </div>\n </SelectContainer>\n <SelectDropdown\n isOpen={isOpen}\n size={size}\n controlRef={controlRef}\n getOptionProps={getOptionProps}\n dropdownRef={useForkRef([dropdownRef, defaultDropdownRef])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItems={visibleItems}\n labelForNotFound={labelForNotFound}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n notFound={notFound}\n hasItems={hasItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex + 1 }\n : undefined\n }\n />\n </>\n );\n};\n\nexport const Combobox = forwardRef(ComboboxRender) as ComboboxComponent;\n"],"mappings":"yrBAAA,uCAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,eAAT,2CACA,OAASC,QAAT,oCACA,OACEC,qBADF,CAEEC,yBAFF,CAGEC,uBAHF,CAIEC,aAJF,mCAMA,OAASC,eAAT,2CACA,OAASC,cAAT,0CACA,OAASC,UAAT,sCACA,OAASC,cAAT,0CACA,OACEC,eADF,CAEEC,eAFF,CAGEC,eAHF,iCAKA,OAASC,SAAT,qCACA,OAASC,UAAT,8BACA,OAASC,QAAT,+BAEA,OAASC,IAAT,eACA,OACEC,YADF,CAQEC,WARF,CASEC,gBATF,CAUEC,mBAVF,CAWEC,kBAXF,iBAcA,MAAO,IAAMC,eAAc,CAAG,UAAvB,CAEP,GAAMC,eAAc,CAAG,SAKrBC,CALqB,CAMrBC,CANqB,CAOlB,IACGC,EAAkB,CAAG3B,MAAM,CAAwB,IAAxB,CAD9B,CAEG4B,CAAe,CAAG5B,MAAM,CAAiB,IAAjB,CAF3B,CAGG6B,CAAsB,CAAG7B,MAAM,CAAiB,IAAjB,CAHlC,CAIG8B,CAAU,CAAG9B,MAAM,CAAwB,IAAxB,CAJtB,GAoDCC,eAAe,CAACsB,cAAD,CAAiBD,kBAAkB,CAACG,CAAD,CAAnC,CAA4CK,CAA5C,CApDhB,CAODC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ALR,CAME,MAAM,CAAmB,OAAjB,GAAA2B,EAAY,CAAe,WAAf,CAA6B,QANnD,CAOE,OAAO,CAAE2C,CAPX,CAQE,YAAY,CAAEC,CARhB,CASE,QAAQ,CAAEhE,CAAe,CAAC8C,CAAD,CAT3B,CAUE,GAAG,CAAEvE,CAVP,EAaH,CAwKG,CASE,aAAa,CAAE2B,CATjB,CAUE,YAAY,CAAE6B,EAVhB,CAWE,gBAAgB,CAAEnB,CAXpB,CAYE,cAAc,CAAEC,CAZlB,CAaE,SAAS,CAAEI,CAbb,CAcE,kBAAkB,CAAEH,CAdtB,CAeE,QAAQ,CAAE0B,EAfZ,CAgBE,QAAQ,CAAEC,EAhBZ,CAiBE,SAAS,CAAEC,EAjBb,CAkBE,aAAa,CAAErB,EAlBjB,CAmBE,gBAAgB,CAAEC,EAnBpB,CAoBE,KAAK,CACsB,QAAzB,gBAAOH,CAAP,WAAOA,CAAP,QAAOA,CAAK,CAAE8C,MAAd,EACI,CAAEA,MAAM,CAAE9C,CAAK,CAAC8C,MAAN,CAAe,CAAzB,CADJ,OArBJ,EApEF,CAgGH,CAjUD,CAmUA,MAAO,IAAMC,SAAQ,CAAGtH,UAAU,CAACyB,cAAD,CAA3B"}
|
|
1
|
+
{"version":3,"file":"Combobox.js","names":["IconClear","IconSelect","React","forwardRef","useRef","usePropsHandler","cnSelect","defaultLabelForCreate","defaultLabelForEmptyItems","defaultLabelForNotFound","getInputWidth","SelectContainer","SelectDropdown","SelectItem","SelectValueTag","defaultPropForm","defaultPropSize","defaultPropView","useSelect","useForkRef","isNotNil","Text","clearSizeMap","iconSizeMap","isMultipleParams","isNotMultipleParams","withDefaultGetters","COMPONENT_NAME","ComboboxRender","props","ref","defaultDropdownRef","controlInnerRef","helperInputFakeElement","controlRef","placeholder","onBlur","onFocus","items","onChange","value","disabled","ariaLabel","id","required","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","allSelectedAllLabel","searchValueProp","searchValue","renderValueProp","renderValue","onCreate","inputRefProp","inputRef","labelForNotFound","labelForCreate","labelForEmptyItems","searchFunction","selectAll","isLoading","multiple","style","dropdownForm","virtualScroll","onScrollToBottom","onDropdownOpen","onSearchValueChange","dropdownOpen","ignoreOutsideClicksRefs","otherProps","getKeyProps","getOptionProps","isOpen","visibleItems","isFocused","handleInputFocus","handleInputBlur","handleToggleDropdown","handleInputClick","handleInputChange","clearValue","getHandleRemoveValue","notFound","hasItems","optionsRefs","allItemsSelected","inputId","renderValueDefaultMultiple","item","handleRemove","renderValueDefaultNotMultiple","valueLabel","inputRefForRender","renderControlValue","width","Array","isArray","map","length","hide","isClearButtonVisible","hasInput","renderValueList","renderItemDefault","active","hovered","onClick","onMouseEnter","zIndex","Combobox"],"sources":["../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import '##/components/SelectComponents/Select.css';\n\nimport { IconClear } from '@consta/icons/IconClear';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { cnSelect } from '##/components/SelectComponents/cnSelect';\nimport {\n defaultLabelForCreate,\n defaultLabelForEmptyItems,\n defaultLabelForNotFound,\n getInputWidth,\n} from '##/components/SelectComponents/helpers';\nimport { SelectContainer } from '##/components/SelectComponents/SelectContainer';\nimport { SelectDropdown } from '##/components/SelectComponents/SelectDropdown';\nimport { SelectItem } from '##/components/SelectComponents/SelectItem';\nimport { SelectValueTag } from '##/components/SelectComponents/SelectValueTag';\nimport {\n defaultPropForm,\n defaultPropSize,\n defaultPropView,\n} from '##/components/SelectComponents/types';\nimport { useSelect } from '##/components/SelectComponents/useSelect';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { isNotNil } from '##/utils/type-guards';\n\nimport { Text } from '../Text';\nimport {\n clearSizeMap,\n ComboboxComponent,\n ComboboxGroupDefault,\n ComboboxItemDefault,\n ComboboxPropRenderItem,\n ComboboxPropRenderValue,\n ComboboxProps,\n iconSizeMap,\n isMultipleParams,\n isNotMultipleParams,\n withDefaultGetters,\n} from './helpers';\n\nexport const COMPONENT_NAME = 'Combobox' as const;\n\nconst ComboboxRender = <\n ITEM = ComboboxItemDefault,\n GROUP = ComboboxGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: ComboboxProps<ITEM, GROUP, MULTIPLE>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const defaultDropdownRef = useRef<HTMLDivElement | null>(null);\n const controlInnerRef = useRef<HTMLDivElement>(null);\n const helperInputFakeElement = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLDivElement | null>(null);\n\n const {\n placeholder,\n onBlur,\n onFocus,\n items,\n onChange,\n value,\n disabled,\n ariaLabel,\n id,\n required,\n dropdownRef,\n form = defaultPropForm,\n view = defaultPropView,\n size = defaultPropSize,\n dropdownClassName,\n name,\n groups = [],\n getItemLabel,\n getItemKey,\n getItemGroupKey,\n getItemDisabled,\n getGroupKey,\n getGroupLabel,\n renderItem,\n allSelectedAllLabel = 'Все',\n searchValue: searchValueProp,\n renderValue: renderValueProp,\n onCreate,\n inputRef: inputRefProp,\n labelForNotFound = defaultLabelForNotFound,\n labelForCreate = defaultLabelForCreate,\n labelForEmptyItems = defaultLabelForEmptyItems,\n searchFunction,\n selectAll,\n isLoading,\n multiple = false,\n style,\n dropdownForm = 'default',\n virtualScroll,\n onScrollToBottom,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, withDefaultGetters(props), controlRef);\n\n const {\n getKeyProps,\n getOptionProps,\n isOpen,\n visibleItems,\n isFocused,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n searchValue,\n clearValue,\n getHandleRemoveValue,\n notFound,\n hasItems,\n optionsRefs,\n allItemsSelected,\n } = useSelect({\n items,\n groups,\n value,\n onChange,\n selectAll,\n dropdownRef: defaultDropdownRef,\n controlRef,\n disabled,\n getItemLabel,\n getItemKey,\n getGroupKey,\n searchValue: searchValueProp,\n getItemGroupKey,\n getItemDisabled,\n multiple,\n onBlur,\n onFocus,\n onCreate,\n searchFunction,\n onDropdownOpen,\n onSearchValueChange,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n });\n\n const inputId = id ? `${id}-input` : id;\n\n const renderItemDefault: ComboboxPropRenderItem<ITEM> = (props) => {\n const { item, active, hovered, onClick, onMouseEnter, ref } = props;\n\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n multiple={multiple}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n />\n );\n };\n\n const renderValueDefaultMultiple: ComboboxPropRenderValue<ITEM> = ({\n item,\n handleRemove,\n }) => {\n return (\n <SelectValueTag\n label={getItemLabel(item)}\n key={getItemKey(item)}\n size={size}\n disabled={disabled || getItemDisabled(item)}\n handleRemove={handleRemove}\n />\n );\n };\n\n const renderValueDefaultNotMultiple: ComboboxPropRenderValue<ITEM> = (\n props,\n ) => {\n const valueLabel = getItemLabel(props.item);\n\n return (\n <span className={cnSelect('ControlValue')} title={valueLabel}>\n {valueLabel}\n </span>\n );\n };\n\n const renderValue =\n renderValueProp ||\n (multiple ? renderValueDefaultMultiple : renderValueDefaultNotMultiple);\n\n const inputRefForRender = useForkRef([inputRef, inputRefProp]);\n\n const renderControlValue = () => {\n const width = multiple\n ? getInputWidth(controlInnerRef, helperInputFakeElement)\n : undefined;\n return (\n <>\n {isMultipleParams(props) &&\n Array.isArray(props.value) &&\n props.value.map((item) =>\n renderValue({ item, handleRemove: getHandleRemoveValue(item) }),\n )}\n {isNotMultipleParams(props) &&\n isNotNil(props.value) &&\n renderValue({ item: props.value })}\n {(!isNotNil(value) || (Array.isArray(value) && value.length === 0)) &&\n !searchValue &&\n placeholder && (\n <span className={cnSelect('Placeholder')} title=\"placeholder\">\n {placeholder}\n </span>\n )}\n <input\n {...getKeyProps()}\n type=\"text\"\n name={name}\n id={inputId}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n aria-label={ariaLabel}\n onChange={handleInputChange}\n ref={inputRefForRender}\n className={cnSelect('Input', {\n size,\n hide: !multiple && isNotNil(value),\n multiple,\n })}\n value={searchValue}\n style={{ width }}\n />\n </>\n );\n };\n\n const renderValueList = () => {\n if (allItemsSelected) {\n return (\n <Text\n view=\"primary\"\n size={size}\n className={cnSelect('SelectAll')}\n lineHeight=\"m\"\n >\n {allSelectedAllLabel}\n </Text>\n );\n }\n if (multiple) {\n return (\n <div className={cnSelect('ControlValue')}>{renderControlValue()}</div>\n );\n }\n return renderControlValue();\n };\n\n const isClearButtonVisible = isMultipleParams(props)\n ? isNotNil(props.value) && props.value.length > 0\n : isNotNil(props.value);\n\n return (\n <>\n <SelectContainer\n focused={isFocused}\n disabled={disabled}\n size={size}\n view={view}\n required={required}\n form={form}\n multiple={multiple}\n ref={ref}\n type=\"combobox\"\n style={style}\n id={inputId}\n {...otherProps}\n >\n <div\n className={cnSelect('Control', { hasInput: true })}\n ref={controlRef}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n id={id}\n >\n <div\n className={cnSelect('ControlInner')}\n onClick={handleInputClick}\n role=\"button\"\n ref={controlInnerRef}\n aria-hidden=\"true\"\n >\n <div className={cnSelect('ControlValueContainer')}>\n {renderValueList()}\n </div>\n </div>\n <span className={cnSelect('Indicators')}>\n {isClearButtonVisible && (\n <button\n type=\"button\"\n onClick={clearValue}\n tabIndex={-1}\n className={cnSelect('ClearIndicator')}\n >\n <IconClear\n size={clearSizeMap[size]}\n className={cnSelect('ClearIndicatorIcon')}\n />\n </button>\n )}\n <span className={cnSelect('Delimiter')} />\n <button\n type=\"button\"\n className={cnSelect('IndicatorsDropdown')}\n tabIndex={-1}\n onClick={handleToggleDropdown}\n >\n <IconSelect\n size={iconSizeMap[size]}\n className={cnSelect('DropdownIndicatorIcon')}\n />\n </button>\n </span>\n </div>\n <div\n className={cnSelect('HelperInputFakeElement')}\n ref={helperInputFakeElement}\n >\n {searchValue}\n </div>\n </SelectContainer>\n <SelectDropdown\n isOpen={isOpen}\n size={size}\n controlRef={controlRef}\n getOptionProps={getOptionProps}\n dropdownRef={useForkRef([dropdownRef, defaultDropdownRef])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItems={visibleItems}\n labelForNotFound={labelForNotFound}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n notFound={notFound}\n hasItems={hasItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex + 1 }\n : undefined\n }\n />\n </>\n );\n};\n\nexport const Combobox = forwardRef(ComboboxRender) as ComboboxComponent;\n"],"mappings":"yrBAAA,uCAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,eAAT,2CACA,OAASC,QAAT,oCACA,OACEC,qBADF,CAEEC,yBAFF,CAGEC,uBAHF,CAIEC,aAJF,mCAMA,OAASC,eAAT,2CACA,OAASC,cAAT,0CACA,OAASC,UAAT,sCACA,OAASC,cAAT,0CACA,OACEC,eADF,CAEEC,eAFF,CAGEC,eAHF,iCAKA,OAASC,SAAT,qCACA,OAASC,UAAT,8BACA,OAASC,QAAT,+BAEA,OAASC,IAAT,eACA,OACEC,YADF,CAQEC,WARF,CASEC,gBATF,CAUEC,mBAVF,CAWEC,kBAXF,iBAcA,MAAO,IAAMC,eAAc,CAAG,UAAvB,CAEP,GAAMC,eAAc,CAAG,SAKr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vH,UAAU,CAACyB,cAAD,CAA3B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useState}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{useDebounce}from"../../hooks/useDebounce";import{useFlag}from"../../hooks/useFlag";import{animateTimeout}from"../../mixs/MixPopoverAnimate";import{ContextMenuLevels}from"./ContextMenuLevels";import{ContextMenuWrapper}from"./ContextMenuWrapper";export var COMPONENT_NAME="ContextMenu";var ContextMenuRender=function(a,b){var c=usePropsHandler(COMPONENT_NAME,a,b),d=useState({width:240,height:100}),e=_slicedToArray(d,2),f=e[0],g=e[1],h=useFlag(),i=_slicedToArray(h,2),j=i[0],k=i[1],l=useDebounce(k.off,animateTimeout);return React.createElement(ContextMenuWrapper,Object.assign({},c,{animationBack:j,style:_objectSpread(_objectSpread({},null===c||void 0===c?void 0:c.style),f)}),React.createElement(ContextMenuLevels,Object.assign({},c,{setComponentSize:g,
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useState}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{useDebounce}from"../../hooks/useDebounce";import{useFlag}from"../../hooks/useFlag";import{animateTimeout}from"../../mixs/MixPopoverAnimate";import{ContextMenuLevels}from"./ContextMenuLevels";import{ContextMenuWrapper}from"./ContextMenuWrapper";export var COMPONENT_NAME="ContextMenu";var ContextMenuRender=function(a,b){var c=usePropsHandler(COMPONENT_NAME,a,b),d=useState({width:240,height:100}),e=_slicedToArray(d,2),f=e[0],g=e[1],h=useFlag(),i=_slicedToArray(h,2),j=i[0],k=i[1],l=useDebounce(k.off,animateTimeout);return React.createElement(ContextMenuWrapper,Object.assign({},c,{animationBack:j,style:_objectSpread(_objectSpread({},null===c||void 0===c?void 0:c.style),f)}),React.createElement(ContextMenuLevels,Object.assign({},c,{setComponentSize:g,enableAnimationBack:k.on,disableAnimationBack:l})))};export var ContextMenu=React.forwardRef(ContextMenuRender);export*from"./types";
|
|
2
2
|
//# sourceMappingURL=ContextMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","names":["React","useState","usePropsHandler","useDebounce","useFlag","animateTimeout","ContextMenuLevels","ContextMenuWrapper","COMPONENT_NAME","ContextMenuRender","props","ref","rest","width","height","componentSize","setComponentSize","animationBack","setAnimationBack","disableAnimationBack","off","style","on","ContextMenu","forwardRef"],"sources":["../../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\n\nimport { ContextMenuLevels } from './ContextMenuLevels';\nimport { ContextMenuWrapper } from './ContextMenuWrapper';\nimport { ContextMenuComponent, ContextMenuProps } from './types';\n\nexport const COMPONENT_NAME = 'ContextMenu' as const;\n\nconst ContextMenuRender = (\n props: ContextMenuProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const rest = usePropsHandler(COMPONENT_NAME, props, ref);\n\n const [componentSize, setComponentSize] = useState<ComponentSize>({\n width: 240,\n height: 100,\n });\n\n const [animationBack, setAnimationBack] = useFlag();\n const disableAnimationBack = useDebounce(\n setAnimationBack.off,\n animateTimeout,\n );\n\n return (\n <ContextMenuWrapper\n {...rest}\n animationBack={animationBack}\n style={{ ...rest?.style, ...componentSize }}\n >\n <ContextMenuLevels\n {...rest}\n setComponentSize={setComponentSize}\n
|
|
1
|
+
{"version":3,"file":"ContextMenu.js","names":["React","useState","usePropsHandler","useDebounce","useFlag","animateTimeout","ContextMenuLevels","ContextMenuWrapper","COMPONENT_NAME","ContextMenuRender","props","ref","rest","width","height","componentSize","setComponentSize","animationBack","setAnimationBack","disableAnimationBack","off","style","on","ContextMenu","forwardRef"],"sources":["../../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { usePropsHandler } from '##/components/EventInterceptor/usePropsHandler';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\n\nimport { ContextMenuLevels } from './ContextMenuLevels';\nimport { ContextMenuWrapper } from './ContextMenuWrapper';\nimport { ContextMenuComponent, ContextMenuProps } from './types';\n\nexport const COMPONENT_NAME = 'ContextMenu' as const;\n\nconst ContextMenuRender = (\n props: ContextMenuProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const rest = usePropsHandler(COMPONENT_NAME, props, ref);\n\n const [componentSize, setComponentSize] = useState<ComponentSize>({\n width: 240,\n height: 100,\n });\n\n const [animationBack, setAnimationBack] = useFlag();\n const disableAnimationBack = useDebounce(\n setAnimationBack.off,\n animateTimeout,\n );\n\n return (\n <ContextMenuWrapper\n {...rest}\n animationBack={animationBack}\n style={{ ...rest?.style, ...componentSize }}\n >\n <ContextMenuLevels\n {...rest}\n setComponentSize={setComponentSize}\n enableAnimationBack={setAnimationBack.on}\n disableAnimationBack={disableAnimationBack}\n />\n </ContextMenuWrapper>\n );\n};\n\nexport const ContextMenu = React.forwardRef(\n ContextMenuRender,\n) as ContextMenuComponent;\n\nexport * from './types';\n"],"mappings":"suBAAA,MAAOA,MAAP,EAAgBC,QAAhB,KAAgC,OAAhC,CAEA,OAASC,eAAT,2CAEA,OAASC,WAAT,+BACA,OAASC,OAAT,2BACA,OAASC,cAAT,oCAEA,OAASC,iBAAT,2BACA,OAASC,kBAAT,4BAGA,MAAO,IAAMC,eAAc,CAAG,aAAvB,CAEP,GAAMC,kBAAiB,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGrB,IACGC,EAAI,CAAGV,eAAe,CAACM,cAAD,CAAiBE,CAAjB,CAAwBC,CAAxB,CADzB,GAGuCV,QAAQ,CAAgB,CAChEY,KAAK,CAAE,GADyD,CAEhEC,MAAM,CAAE,GAFwD,CAAhB,CAH/C,uBAGIC,CAHJ,MAGmBC,CAHnB,QAQuCZ,OAAO,EAR9C,uBAQIa,CARJ,MAQmBC,CARnB,MASGC,CAAoB,CAAGhB,WAAW,CACtCe,CAAgB,CAACE,GADqB,CAEtCf,cAFsC,CATrC,CAcH,MACE,qBAAC,kBAAD,kBACMO,CADN,EAEE,aAAa,CAAEK,CAFjB,CAGE,KAAK,uCAAOL,CAAP,WAAOA,CAAP,QAAOA,CAAI,CAAES,KAAb,EAAuBN,CAAvB,CAHP,GAKE,oBAAC,iBAAD,kBACMH,CADN,EAEE,gBAAgB,CAAEI,CAFpB,CAGE,mBAAmB,CAAEE,CAAgB,CAACI,EAHxC,CAIE,oBAAoB,CAAEH,CAJxB,GALF,CAaH,CA/BD,CAiCA,MAAO,IAAMI,YAAW,CAAGvB,KAAK,CAACwB,UAAN,CACzBf,iBADyB,CAApB,CAIP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const ContextMenuLevels:
|
|
1
|
+
import { ContextMenuLevelsProps } from '../types';
|
|
2
|
+
export declare const ContextMenuLevels: (propsComponent: ContextMenuLevelsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{Fragment,useEffect,useState}from"react";import{Transition,TransitionGroup}from"react-transition-group";import{useClickOutside}from"../../../hooks/useClickOutside";import{useMutableRef}from"../../../hooks/useMutableRef";import{useRefs}from"../../../hooks/useRefs";import{animateTimeout}from"../../../mixs/MixPopoverAnimate";import{setRef}from"../../../utils/setRef";import{clearTimers,ContextMenuLevel}from"../ContextMenuLevel";import{getLevels,withDefaultGetters}from"../helpers";import{contextMenuPropDefaultSubMenuDirection,contextMenuPropSubMenuDirections}from"../types";import{useSize}from"./useSize";var
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{Fragment,useEffect,useState}from"react";import{Transition,TransitionGroup}from"react-transition-group";import{useClickOutside}from"../../../hooks/useClickOutside";import{useMutableRef}from"../../../hooks/useMutableRef";import{useRefs}from"../../../hooks/useRefs";import{animateTimeout}from"../../../mixs/MixPopoverAnimate";import{setRef}from"../../../utils/setRef";import{clearTimers,ContextMenuLevel}from"../ContextMenuLevel";import{getLevels,withDefaultGetters}from"../helpers";import{contextMenuPropDefaultSubMenuDirection,contextMenuPropSubMenuDirections}from"../types";import{useSize}from"./useSize";export var ContextMenuLevels=function(a){var b=withDefaultGetters(a),c=b.items,d=b.anchorRef,e=b.position,f=b.direction,g=b.possibleDirections,h=b.offset,i=b.onClickOutside,j=b.getItemKey,k=b.getItemLabel,l=b.getItemSubMenu,m=b.style,n=b.spareDirection,o=b.subMenuDirection,p=void 0===o?contextMenuPropDefaultSubMenuDirection:o,q=b.isMobile,r=b.isOpen,s=b.setComponentSize,t=b.enableAnimationBack,u=b.disableAnimationBack,v=_objectWithoutProperties(b,_excluded),w=useMutableRef(r),x=[{items:c,anchorRef:d,position:e,direction:f,possibleDirections:g,offset:h}],y=useState(q?x:[]),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useState(p),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useState(-1),H=_slicedToArray(G,2),I=H[0],J=H[1],K=useRefs(A.length),L=function(a){var c=a.level,d=a.items,e=a.anchorRef,f=a.activeItem,g=a.parent,h=_toConsumableArray(A),i=h[c]&&1<h.length-c?h[c].direction:void 0;h[c]&&1<h.length-c&&i&&F(i),h[c-1].activeItem=f,h.splice(c),h.push({items:d,anchorRef:q?b.anchorRef:e,direction:q?b.direction:i||E,possibleDirections:q?b.possibleDirections:contextMenuPropSubMenuDirections,position:q?b.position:void 0,offset:q?b.offset:void 0,parent:g}),w.current?B(h):B([])},M=function(a){if(0<a){t();var b=_toConsumableArray(A);b.splice(a),b[a-1]=_objectSpread(_objectSpread({},b[a-1]),{},{activeItem:void 0}),B(b),u()}};return useClickOutside({isActive:i&&r,ignoreClicksInsideRefs:[].concat(_toConsumableArray(K),[d||{current:null}]),handler:i}),useEffect(function(){return clearTimers(),B(getLevels({levels:A,items:c,getItemKey:j,getItemSubMenu:l})),function(){return clearTimers()}},[c]),useEffect(function(){B(x)},[e]),useEffect(function(){B(r?x:[])},[r]),useSize(K,s,q),React.createElement(TransitionGroup,{component:Fragment},A.map(function(a,c){var d="".concat(c,"-").concat(a.parent?j(a.parent):""),e=c!==A.length-1;return q&&e?React.createElement(Fragment,{key:c}):React.createElement(Transition,{key:d,timeout:animateTimeout,nodeRef:K[c]},function(d){return React.createElement(ContextMenuLevel,Object.assign({},v,a,{key:"".concat(c,"-").concat(a.parent?j(a.parent):""),isMobile:q,isOpen:r,style:_objectSpread(_objectSpread({},m),{zIndex:"number"==typeof(null===m||void 0===m?void 0:m.zIndex)?m.zIndex+1:void 0}),activeLevelDepth:A.length-1,levelDepth:c,getItemLabel:k,addLevel:L,deleteLevel:M,onSetDirection:0<c?F:b.onSetDirection,hoveredParenLevel:I,setHoveredParenLevel:J,getItemSubMenu:l,getItemKey:j,ref:function ref(a){return setRef(K[c],a)},spareDirection:0===c?n:"rightStartUp",parent:q?a.parent:void 0,animate:d}))})}))};
|
|
2
2
|
//# sourceMappingURL=ContextMenuLevels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuLevels.js","names":["React","Fragment","useEffect","useState","Transition","TransitionGroup","useClickOutside","useMutableRef","useRefs","animateTimeout","setRef","clearTimers","ContextMenuLevel","getLevels","withDefaultGetters","contextMenuPropDefaultSubMenuDirection","contextMenuPropSubMenuDirections","useSize","ContextMenuLevelsRender","propsComponent","props","items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","subMenuDirectionProp","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack","otherProps","isOpenRef","defaultLevels","levels","setLevels","setSubMenuDirection","hoveredParenLevel","setHoveredParenLevel","levelsRefs","length","addLevel","level","activeItem","parent","newLevels","oldDirection","splice","push","current","deleteLevel","isActive","ignoreClicksInsideRefs","handler","map","index","key","last","animate","zIndex","onSetDirection","el","ContextMenuLevels","forwardRef"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useState } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\n\nimport { Direction } from '##/components/Popover';\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { useRefs } from '##/hooks/useRefs';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\nimport { setRef } from '##/utils/setRef';\n\nimport { clearTimers, ContextMenuLevel } from '../ContextMenuLevel';\nimport { getLevels, withDefaultGetters } from '../helpers';\nimport {\n AddLevel,\n ContextMenuItemDefault,\n ContextMenuLevelsComponent,\n ContextMenuLevelsProps,\n contextMenuPropDefaultSubMenuDirection,\n contextMenuPropSubMenuDirections,\n Level,\n} from '../types';\nimport { useSize } from './useSize';\n\nconst ContextMenuLevelsRender = (\n propsComponent: ContextMenuLevelsProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const props = withDefaultGetters(propsComponent);\n const {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n onClickOutside,\n getItemKey,\n getItemLabel,\n getItemSubMenu,\n style,\n spareDirection,\n subMenuDirection:\n subMenuDirectionProp = contextMenuPropDefaultSubMenuDirection,\n isMobile,\n isOpen,\n setComponentSize,\n enableAnimationBack,\n disableAnimationBack,\n ...otherProps\n } = props;\n\n const isOpenRef = useMutableRef(isOpen);\n\n type Item = typeof items[number];\n\n const defaultLevels: Level<ContextMenuItemDefault>[] = [\n {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n },\n ];\n\n const [levels, setLevels] = useState<\n Level<ContextMenuItemDefault & { isParent?: boolean }>[]\n >(isMobile ? defaultLevels : []);\n const [subMenuDirection, setSubMenuDirection] =\n useState<Direction>(subMenuDirectionProp);\n const [hoveredParenLevel, setHoveredParenLevel] = useState<number>(-1);\n\n const levelsRefs = useRefs<HTMLDivElement>(levels.length);\n\n const addLevel: AddLevel<Item> = ({\n level,\n items,\n anchorRef,\n activeItem,\n parent,\n }) => {\n const newLevels: Level<ContextMenuItemDefault & { isParent?: boolean }>[] =\n [...levels];\n const oldDirection =\n newLevels[level] && newLevels.length - level > 1\n ? newLevels[level].direction\n : undefined;\n\n if (newLevels[level] && newLevels.length - level > 1 && oldDirection) {\n setSubMenuDirection(oldDirection);\n }\n\n newLevels[level - 1].activeItem = activeItem;\n newLevels.splice(level);\n newLevels.push({\n items,\n anchorRef: isMobile ? props.anchorRef : anchorRef,\n direction: isMobile ? props.direction : oldDirection || subMenuDirection,\n possibleDirections: isMobile\n ? props.possibleDirections\n : contextMenuPropSubMenuDirections,\n position: isMobile ? props.position : undefined,\n offset: isMobile ? props.offset : undefined,\n parent,\n });\n\n isOpenRef.current ? setLevels(newLevels) : setLevels([]);\n };\n\n const deleteLevel = (level: number) => {\n if (level > 0) {\n enableAnimationBack();\n const newLevels = [...levels];\n newLevels.splice(level);\n newLevels[level - 1] = { ...newLevels[level - 1], activeItem: undefined };\n setLevels(newLevels);\n disableAnimationBack();\n }\n };\n\n useClickOutside({\n isActive: onClickOutside && isOpen,\n ignoreClicksInsideRefs: [...levelsRefs, anchorRef || { current: null }],\n handler: onClickOutside,\n });\n\n useEffect(() => {\n clearTimers();\n setLevels(\n getLevels({\n levels,\n items,\n getItemKey,\n getItemSubMenu,\n }),\n );\n return () => clearTimers();\n }, [items]);\n\n useEffect(() => {\n setLevels(defaultLevels);\n }, [position]);\n\n useEffect(() => {\n setLevels(isOpen ? defaultLevels : []);\n }, [isOpen]);\n\n useSize(levelsRefs, setComponentSize, isMobile);\n\n return (\n <TransitionGroup component={Fragment}>\n {levels.map((level, index) => {\n const key = `${index}-${level.parent ? getItemKey(level.parent) : ''}`;\n\n const last = index !== levels.length - 1;\n\n if (isMobile && last) {\n return <Fragment key={index} />;\n }\n\n return (\n <Transition\n key={key}\n timeout={animateTimeout}\n nodeRef={levelsRefs[index]}\n >\n {(animate) => (\n <ContextMenuLevel\n {...otherProps}\n {...level}\n key={`${index}-${level.parent ? getItemKey(level.parent) : ''}`}\n isMobile={isMobile}\n isOpen={isOpen}\n style={{\n ...style,\n ...{\n zIndex:\n typeof style?.zIndex === 'number'\n ? style.zIndex + 1\n : undefined,\n },\n }}\n activeLevelDepth={levels.length - 1}\n levelDepth={index}\n getItemLabel={getItemLabel}\n addLevel={addLevel}\n deleteLevel={deleteLevel}\n onSetDirection={\n index > 0 ? setSubMenuDirection : props.onSetDirection\n }\n hoveredParenLevel={hoveredParenLevel}\n setHoveredParenLevel={setHoveredParenLevel}\n getItemSubMenu={getItemSubMenu}\n getItemKey={getItemKey}\n ref={(el) => setRef(levelsRefs[index], el)}\n spareDirection={index === 0 ? spareDirection : 'rightStartUp'}\n parent={isMobile ? level.parent : undefined}\n animate={animate}\n />\n )}\n </Transition>\n );\n })}\n </TransitionGroup>\n );\n};\n\nexport const ContextMenuLevels = React.forwardRef(\n ContextMenuLevelsRender,\n) as ContextMenuLevelsComponent;\n"],"mappings":"2pCAAA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,QAArC,KAAqD,OAArD,CACA,OAASC,UAAT,CAAqBC,eAArB,KAA4C,wBAA5C,CAGA,OAASC,eAAT,sCACA,OAASC,aAAT,oCACA,OAASC,OAAT,8BACA,OAASC,cAAT,uCACA,OAASC,MAAT,6BAEA,OAASC,WAAT,CAAsBC,gBAAtB,2BACA,OAASC,SAAT,CAAoBC,kBAApB,kBACA,OAKEC,sCALF,CAMEC,gCANF,gBASA,OAASC,OAAT,iBAEA,GAAMC,wBAAuB,CAAG,SAC9BC,CAD8B,CAG3B,IACGC,EAAK,CAAGN,kBAAkB,CAACK,CAAD,CAD7B,CAGDE,CAHC,CAuBCD,CAvBD,CAGDC,KAHC,CAIDC,CAJC,CAuBCF,CAvBD,CAIDE,SAJC,CAKDC,CALC,CAuBCH,CAvBD,CAKDG,QALC,CAMDC,CANC,CAuBCJ,CAvBD,CAMDI,SANC,CAODC,CAPC,CAuBCL,CAvBD,CAODK,kBAPC,CAQDC,CARC,CAuBCN,CAvBD,CAQDM,MARC,CASDC,CATC,CAuBCP,CAvBD,CASDO,cATC,CAUDC,CAVC,CAuBCR,CAvBD,CAUDQ,UAVC,CAWDC,CAXC,CAuBCT,CAvBD,CAWDS,YA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E,UAAN,CAC/BtD,uBAD+B,CAA1B"}
|
|
1
|
+
{"version":3,"file":"ContextMenuLevels.js","names":["React","Fragment","useEffect","useState","Transition","TransitionGroup","useClickOutside","useMutableRef","useRefs","animateTimeout","setRef","clearTimers","ContextMenuLevel","getLevels","withDefaultGetters","contextMenuPropDefaultSubMenuDirection","contextMenuPropSubMenuDirections","useSize","ContextMenuLevels","propsComponent","props","items","anchorRef","position","direction","possibleDirections","offset","onClickOutside","getItemKey","getItemLabel","getItemSubMenu","style","spareDirection","subMenuDirection","subMenuDirectionProp","isMobile","isOpen","setComponentSize","enableAnimationBack","disableAnimationBack","otherProps","isOpenRef","defaultLevels","levels","setLevels","setSubMenuDirection","hoveredParenLevel","setHoveredParenLevel","levelsRefs","length","addLevel","level","activeItem","parent","newLevels","oldDirection","splice","push","current","deleteLevel","isActive","ignoreClicksInsideRefs","handler","map","index","key","last","animate","zIndex","onSetDirection","el"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useState } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\n\nimport { Direction } from '##/components/Popover';\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useMutableRef } from '##/hooks/useMutableRef';\nimport { useRefs } from '##/hooks/useRefs';\nimport { animateTimeout } from '##/mixs/MixPopoverAnimate';\nimport { setRef } from '##/utils/setRef';\n\nimport { clearTimers, ContextMenuLevel } from '../ContextMenuLevel';\nimport { getLevels, withDefaultGetters } from '../helpers';\nimport {\n AddLevel,\n ContextMenuItemDefault,\n ContextMenuLevelsProps,\n contextMenuPropDefaultSubMenuDirection,\n contextMenuPropSubMenuDirections,\n Level,\n} from '../types';\nimport { useSize } from './useSize';\n\nexport const ContextMenuLevels = (propsComponent: ContextMenuLevelsProps) => {\n const props = withDefaultGetters(propsComponent);\n const {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n onClickOutside,\n getItemKey,\n getItemLabel,\n getItemSubMenu,\n style,\n spareDirection,\n subMenuDirection:\n subMenuDirectionProp = contextMenuPropDefaultSubMenuDirection,\n isMobile,\n isOpen,\n setComponentSize,\n enableAnimationBack,\n disableAnimationBack,\n ...otherProps\n } = props;\n\n const isOpenRef = useMutableRef(isOpen);\n\n type Item = typeof items[number];\n\n const defaultLevels: Level<ContextMenuItemDefault>[] = [\n {\n items,\n anchorRef,\n position,\n direction,\n possibleDirections,\n offset,\n },\n ];\n\n const [levels, setLevels] = useState<\n Level<ContextMenuItemDefault & { isParent?: boolean }>[]\n >(isMobile ? defaultLevels : []);\n const [subMenuDirection, setSubMenuDirection] =\n useState<Direction>(subMenuDirectionProp);\n const [hoveredParenLevel, setHoveredParenLevel] = useState<number>(-1);\n\n const levelsRefs = useRefs<HTMLDivElement>(levels.length);\n\n const addLevel: AddLevel<Item> = ({\n level,\n items,\n anchorRef,\n activeItem,\n parent,\n }) => {\n const newLevels: Level<ContextMenuItemDefault & { isParent?: boolean }>[] =\n [...levels];\n const oldDirection =\n newLevels[level] && newLevels.length - level > 1\n ? newLevels[level].direction\n : undefined;\n\n if (newLevels[level] && newLevels.length - level > 1 && oldDirection) {\n setSubMenuDirection(oldDirection);\n }\n\n newLevels[level - 1].activeItem = activeItem;\n newLevels.splice(level);\n newLevels.push({\n items,\n anchorRef: isMobile ? props.anchorRef : anchorRef,\n direction: isMobile ? props.direction : oldDirection || subMenuDirection,\n possibleDirections: isMobile\n ? props.possibleDirections\n : contextMenuPropSubMenuDirections,\n position: isMobile ? props.position : undefined,\n offset: isMobile ? props.offset : undefined,\n parent,\n });\n\n isOpenRef.current ? setLevels(newLevels) : setLevels([]);\n };\n\n const deleteLevel = (level: number) => {\n if (level > 0) {\n enableAnimationBack();\n const newLevels = [...levels];\n newLevels.splice(level);\n newLevels[level - 1] = { ...newLevels[level - 1], activeItem: undefined };\n setLevels(newLevels);\n disableAnimationBack();\n }\n };\n\n useClickOutside({\n isActive: onClickOutside && isOpen,\n ignoreClicksInsideRefs: [...levelsRefs, anchorRef || { current: null }],\n handler: onClickOutside,\n });\n\n useEffect(() => {\n clearTimers();\n setLevels(\n getLevels({\n levels,\n items,\n getItemKey,\n getItemSubMenu,\n }),\n );\n return () => clearTimers();\n }, [items]);\n\n useEffect(() => {\n setLevels(defaultLevels);\n }, [position]);\n\n useEffect(() => {\n setLevels(isOpen ? defaultLevels : []);\n }, [isOpen]);\n\n useSize(levelsRefs, setComponentSize, isMobile);\n\n return (\n <TransitionGroup component={Fragment}>\n {levels.map((level, index) => {\n const key = `${index}-${level.parent ? getItemKey(level.parent) : ''}`;\n\n const last = index !== levels.length - 1;\n\n if (isMobile && last) {\n return <Fragment key={index} />;\n }\n\n return (\n <Transition\n key={key}\n timeout={animateTimeout}\n nodeRef={levelsRefs[index]}\n >\n {(animate) => (\n <ContextMenuLevel\n {...otherProps}\n {...level}\n key={`${index}-${level.parent ? getItemKey(level.parent) : ''}`}\n isMobile={isMobile}\n isOpen={isOpen}\n style={{\n ...style,\n ...{\n zIndex:\n typeof style?.zIndex === 'number'\n ? style.zIndex + 1\n : undefined,\n },\n }}\n activeLevelDepth={levels.length - 1}\n levelDepth={index}\n getItemLabel={getItemLabel}\n addLevel={addLevel}\n deleteLevel={deleteLevel}\n onSetDirection={\n index > 0 ? setSubMenuDirection : props.onSetDirection\n }\n hoveredParenLevel={hoveredParenLevel}\n setHoveredParenLevel={setHoveredParenLevel}\n getItemSubMenu={getItemSubMenu}\n getItemKey={getItemKey}\n ref={(el) => setRef(levelsRefs[index], el)}\n spareDirection={index === 0 ? spareDirection : 'rightStartUp'}\n parent={isMobile ? level.parent : undefined}\n animate={animate}\n />\n )}\n </Transition>\n );\n })}\n </TransitionGroup>\n );\n};\n"],"mappings":"2pCAAA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,QAArC,KAAqD,OAArD,CACA,OAASC,UAAT,CAAqBC,eAArB,KAA4C,wBAA5C,CAGA,OAASC,eAAT,sCACA,OA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C,CAAK,CAACqC,MAAN,CAAe,CADnB,OAFD,CAFA,CANP,CAeE,gBAAgB,CAAEzB,CAAM,CAACM,MAAP,CAAgB,CAfpC,CAgBE,UAAU,CAAEe,CAhBd,CAiBE,YAAY,CAAEnC,CAjBhB,CAkBE,QAAQ,CAAEqB,CAlBZ,CAmBE,WAAW,CAAES,CAnBf,CAoBE,cAAc,CACJ,CAAR,CAAAK,CAAK,CAAOnB,CAAP,CAA6BzB,CAAK,CAACiD,cArB5C,CAuBE,iBAAiB,CAAEvB,CAvBrB,CAwBE,oBAAoB,CAAEC,CAxBxB,CAyBE,cAAc,CAAEjB,CAzBlB,CA0BE,UAAU,CAAEF,CA1Bd,CA2BE,GAAG,CAAE,aAAC0C,CAAD,QAAQ5D,OAAM,CAACsC,CAAU,CAACgB,CAAD,CAAX,CAAoBM,CAApB,CAAd,CA3BP,CA4BE,cAAc,CAAY,CAAV,GAAAN,CAAK,CAAShC,CAAT,CAA0B,cA5BjD,CA6BE,MAAM,CAAEG,CAAQ,CAAGgB,CAAK,CAACE,MAAT,OA7BlB,CA8BE,OAAO,CAAEc,CA9BX,GADD,CALH,CAyCH,CAnDA,CADH,CAuDH,CApLM"}
|
|
@@ -7,7 +7,7 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
7
7
|
groups?: GROUP[] | undefined;
|
|
8
8
|
sortGroup?: import("./types").ContextMenuPropSortGroup;
|
|
9
9
|
onItemClick?: import("./types").ContextMenuPropOnItemClick<ITEM> | undefined;
|
|
10
|
-
possibleDirections?:
|
|
10
|
+
possibleDirections?: import("../Popover").Direction[];
|
|
11
11
|
subMenuDirection?: import("./types").ContextMenuPropSubMenuDirection;
|
|
12
12
|
spareDirection?: import("../Popover").Direction;
|
|
13
13
|
onSetDirection?: (direction: import("../Popover").Direction) => void;
|
|
@@ -54,7 +54,7 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
54
54
|
groups?: GROUP[] | undefined;
|
|
55
55
|
sortGroup?: import("./types").ContextMenuPropSortGroup;
|
|
56
56
|
onItemClick?: import("./types").ContextMenuPropOnItemClick<ITEM> | undefined;
|
|
57
|
-
possibleDirections?:
|
|
57
|
+
possibleDirections?: import("../Popover").Direction[];
|
|
58
58
|
subMenuDirection?: import("./types").ContextMenuPropSubMenuDirection;
|
|
59
59
|
spareDirection?: import("../Popover").Direction;
|
|
60
60
|
onSetDirection?: (direction: import("../Popover").Direction) => void;
|
|
@@ -16,7 +16,7 @@ export declare const contextMenuDefaultStatus: ContextMenuStatus;
|
|
|
16
16
|
export declare const contextMenuForm: readonly ["default", "brick", "round"];
|
|
17
17
|
export type ContextMenuForm = ListPropForm;
|
|
18
18
|
export declare const defaultContextMenuForm: "default";
|
|
19
|
-
export declare const contextMenuPropSubMenuDirections:
|
|
19
|
+
export declare const contextMenuPropSubMenuDirections: Direction[];
|
|
20
20
|
export type ContextMenuPropSubMenuDirection = typeof contextMenuPropSubMenuDirections[number];
|
|
21
21
|
export declare const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection;
|
|
22
22
|
export type ContextMenuPropOnItemClick<ITEM> = (item: ITEM, params: {
|
|
@@ -87,7 +87,7 @@ export type Level<ITEM> = {
|
|
|
87
87
|
items: ITEM[];
|
|
88
88
|
activeItem?: string;
|
|
89
89
|
direction?: Direction;
|
|
90
|
-
possibleDirections?:
|
|
90
|
+
possibleDirections?: Direction[];
|
|
91
91
|
offset?: PopoverPropOffset;
|
|
92
92
|
parent?: ITEM;
|
|
93
93
|
anchorRef?: React.RefObject<HTMLElement>;
|
|
@@ -109,7 +109,7 @@ export type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuG
|
|
|
109
109
|
groups?: GROUP[];
|
|
110
110
|
sortGroup?: ContextMenuPropSortGroup;
|
|
111
111
|
onItemClick?: ContextMenuPropOnItemClick<ITEM>;
|
|
112
|
-
possibleDirections?:
|
|
112
|
+
possibleDirections?: Direction[];
|
|
113
113
|
subMenuDirection?: ContextMenuPropSubMenuDirection;
|
|
114
114
|
spareDirection?: Direction;
|
|
115
115
|
onSetDirection?: (direction: Direction) => void;
|
|
@@ -167,7 +167,7 @@ export type ContextMenuWrapperProps = PropsWithHTMLAttributes<{
|
|
|
167
167
|
form?: ContextMenuForm;
|
|
168
168
|
onClickOutside?: ClickOutsideHandler;
|
|
169
169
|
spareDirection?: Direction;
|
|
170
|
-
possibleDirections?:
|
|
170
|
+
possibleDirections?: Direction[];
|
|
171
171
|
size?: ContextMenuPropSize;
|
|
172
172
|
direction?: Direction;
|
|
173
173
|
offset?: PopoverPropOffset;
|
|
@@ -182,7 +182,7 @@ export type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<{
|
|
|
182
182
|
isMobile?: boolean;
|
|
183
183
|
onClickOutside?: ClickOutsideHandler;
|
|
184
184
|
spareDirection?: Direction;
|
|
185
|
-
possibleDirections?:
|
|
185
|
+
possibleDirections?: Direction[];
|
|
186
186
|
size?: ContextMenuPropSize;
|
|
187
187
|
direction?: Direction;
|
|
188
188
|
offset?: PopoverPropOffset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\nimport { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n] as const;\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: React.MouseEventHandler;\n as?: AsTags;\n attributes?: AsAttributes;\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: readonly Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnItemClick<ITEM>;\n possibleDirections?: readonly Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n onEsc?: React.KeyboardEventHandler;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n activeLevelDepth: number;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n onEsc?: React.KeyboardEventHandler;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isMobile?: boolean;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAiBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAAgC,CAAG,CAC9C,cAD8C,CAE9C,gBAF8C,CAG9C,aAH8C,CAI9C,eAJ8C,CAAzC,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\nimport { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections: Direction[] = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n];\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: React.MouseEventHandler;\n as?: AsTags;\n attributes?: AsAttributes;\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnItemClick<ITEM>;\n possibleDirections?: Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n onEsc?: React.KeyboardEventHandler;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n activeLevelDepth: number;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n onEsc?: React.KeyboardEventHandler;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactNode | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isMobile?: boolean;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAiBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAA6C,CAAG,CAC3D,cAD2D,CAE3D,gBAF2D,CAG3D,aAH2D,CAI3D,eAJ2D,CAAtD,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
3
3
|
type FieldButtonProps = PropsWithHTMLAttributesAndRef<{
|
|
4
|
-
children
|
|
4
|
+
children?: React.ReactNode;
|
|
5
5
|
}, HTMLButtonElement>;
|
|
6
6
|
export declare const FieldButton: React.ForwardRefExoticComponent<Omit<FieldButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldButton.js","names":["React","forwardRef","cnMixHitSlop","cnFieldButtonStyleReset","cnFieldButton","FieldButton","ref","className","props","mode"],"sources":["../../../../../../src/components/FieldComponents/FieldButton/FieldButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { cnMixHitSlop } from '##/mixs/MixHitSlop';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { cnFieldButtonStyleReset } from '../FieldButtonStyleReset';\nimport { cnFieldButton } from './cnFieldButton';\n\ntype FieldButtonProps = PropsWithHTMLAttributesAndRef<\n {\n children
|
|
1
|
+
{"version":3,"file":"FieldButton.js","names":["React","forwardRef","cnMixHitSlop","cnFieldButtonStyleReset","cnFieldButton","FieldButton","ref","className","props","mode"],"sources":["../../../../../../src/components/FieldComponents/FieldButton/FieldButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { cnMixHitSlop } from '##/mixs/MixHitSlop';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { cnFieldButtonStyleReset } from '../FieldButtonStyleReset';\nimport { cnFieldButton } from './cnFieldButton';\n\ntype FieldButtonProps = PropsWithHTMLAttributesAndRef<\n {\n children?: React.ReactNode;\n },\n HTMLButtonElement\n>;\n\nexport const FieldButton = forwardRef<HTMLButtonElement, FieldButtonProps>(\n ({ className, ...props }, ref) => {\n return (\n <button\n {...props}\n ref={ref}\n className={cnFieldButton(null, [\n cnFieldButtonStyleReset(),\n cnMixHitSlop({ mode: 'reverseMargin' }),\n className,\n ])}\n type=\"button\"\n />\n );\n },\n);\n"],"mappings":"iHAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,YAAT,gCAGA,OAASC,uBAAT,gCACA,OAASC,aAAT,uBASA,MAAO,IAAMC,YAAW,CAAGJ,UAAU,CACnC,WAA0BK,CAA1B,CAAkC,IAA/BC,EAA+B,GAA/BA,SAA+B,CAAjBC,CAAiB,uCAChC,MACE,+CACMA,CADN,EAEE,GAAG,CAAEF,CAFP,CAGE,SAAS,CAAEF,aAAa,CAAC,IAAD,CAAO,CAC7BD,uBAAuB,EADM,CAE7BD,YAAY,CAAC,CAAEO,IAAI,CAAE,eAAR,CAAD,CAFiB,CAG7BF,CAH6B,CAAP,CAH1B,CAQE,IAAI,CAAC,QARP,GAWH,CAdkC,CAA9B"}
|
|
@@ -7,5 +7,6 @@ type FieldClearButtonProps = PropsWithHTMLAttributesAndRef<{
|
|
|
7
7
|
children?: never;
|
|
8
8
|
icon?: IconComponent;
|
|
9
9
|
}, HTMLButtonElement>;
|
|
10
|
+
export declare const cnFieldClearButton: import("@bem-react/classname").ClassNameFormatter;
|
|
10
11
|
export declare const FieldClearButton: React.ForwardRefExoticComponent<Omit<FieldClearButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
12
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","icon"];import{IconClear}from"@consta/icons/IconClear";import React,{forwardRef}from"react";import{FieldButton,getFieldIconSize}from"./..";export var FieldClearButton=forwardRef(function(a,b){var c=a.size,d=void 0===c?"m":c,e=a.icon,f=void 0===e?IconClear:e,g=_objectWithoutProperties(a,_excluded);return React.createElement(FieldButton,Object.assign({},g,
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","icon","className"];import{IconClear}from"@consta/icons/IconClear";import React,{forwardRef}from"react";import{FieldButton,getFieldIconSize}from"./..";import{cn}from"../../../utils/bem";export var cnFieldClearButton=cn("FieldClearButton");export var FieldClearButton=forwardRef(function(a,b){var c=a.size,d=void 0===c?"m":c,e=a.icon,f=void 0===e?IconClear:e,g=a.className,h=_objectWithoutProperties(a,_excluded);return React.createElement(FieldButton,Object.assign({},h,{className:cnFieldClearButton(null,[g]),ref:b}),React.createElement(f,{size:getFieldIconSize(d)}))});
|
|
2
2
|
//# sourceMappingURL=FieldClearButton.js.map
|