@consta/header 0.1.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/Badges/Badges.css +1 -0
- package/Badges/Badges.d.ts +5 -0
- package/Badges/Badges.js +2 -0
- package/Badges/Badges.js.map +1 -0
- package/Badges/helpers.d.ts +20 -0
- package/Badges/helpers.js +2 -0
- package/Badges/helpers.js.map +1 -0
- package/Badges/index.d.ts +1 -0
- package/Badges/index.js +2 -0
- package/Badges/index.js.map +1 -0
- package/Badges/types.d.ts +27 -0
- package/Badges/types.js +2 -0
- package/Badges/types.js.map +1 -0
- package/Header/Header.css +1 -0
- package/Header/Header.d.ts +5 -0
- package/Header/Header.js +2 -0
- package/Header/Header.js.map +1 -0
- package/Header/HeaderLogin/HeaderLogin.d.ts +15 -0
- package/Header/HeaderLogin/HeaderLogin.js +2 -0
- package/Header/HeaderLogin/HeaderLogin.js.map +1 -0
- package/Header/HeaderLogin/index.d.ts +1 -0
- package/Header/HeaderLogin/index.js +2 -0
- package/Header/HeaderLogin/index.js.map +1 -0
- package/Header/HeaderLogo/HeaderLogo.d.ts +9 -0
- package/Header/HeaderLogo/HeaderLogo.js +2 -0
- package/Header/HeaderLogo/HeaderLogo.js.map +1 -0
- package/Header/HeaderLogo/index.d.ts +1 -0
- package/Header/HeaderLogo/index.js +2 -0
- package/Header/HeaderLogo/index.js.map +1 -0
- package/Header/index.d.ts +1 -0
- package/Header/index.js +2 -0
- package/Header/index.js.map +1 -0
- package/Header/types.d.ts +80 -0
- package/Header/types.js +2 -0
- package/Header/types.js.map +1 -0
- package/Layout/Layout.css +1 -0
- package/Layout/Layout.d.ts +8 -0
- package/Layout/Layout.js +2 -0
- package/Layout/Layout.js.map +1 -0
- package/Layout/LayoutRow/LayoutRow.css +1 -0
- package/Layout/LayoutRow/LayoutRow.d.ts +11 -0
- package/Layout/LayoutRow/LayoutRow.js +2 -0
- package/Layout/LayoutRow/LayoutRow.js.map +1 -0
- package/Layout/helpers.d.ts +2 -0
- package/Layout/helpers.js +2 -0
- package/Layout/helpers.js.map +1 -0
- package/Layout/index.d.ts +1 -0
- package/Layout/index.js +2 -0
- package/Layout/index.js.map +1 -0
- package/Layout/types.d.ts +17 -0
- package/Layout/types.js +2 -0
- package/Layout/types.js.map +1 -0
- package/Menu/Menu.css +1 -0
- package/Menu/Menu.d.ts +5 -0
- package/Menu/Menu.js +2 -0
- package/Menu/Menu.js.map +1 -0
- package/Menu/helpers.d.ts +31 -0
- package/Menu/helpers.js +2 -0
- package/Menu/helpers.js.map +1 -0
- package/Menu/index.d.ts +1 -0
- package/Menu/index.js +2 -0
- package/Menu/index.js.map +1 -0
- package/Menu/types.d.ts +35 -0
- package/Menu/types.js +2 -0
- package/Menu/types.js.map +1 -0
- package/MobileMenu/MobileMenu.css +1 -0
- package/MobileMenu/MobileMenu.d.ts +5 -0
- package/MobileMenu/MobileMenu.js +2 -0
- package/MobileMenu/MobileMenu.js.map +1 -0
- package/MobileMenu/index.d.ts +1 -0
- package/MobileMenu/index.js +2 -0
- package/MobileMenu/index.js.map +1 -0
- package/MobileMenu/types.d.ts +21 -0
- package/MobileMenu/types.js +2 -0
- package/MobileMenu/types.js.map +1 -0
- package/Notifications/Notifications.css +1 -0
- package/Notifications/Notifications.d.ts +4 -0
- package/Notifications/Notifications.js +2 -0
- package/Notifications/Notifications.js.map +1 -0
- package/Notifications/index.d.ts +1 -0
- package/Notifications/index.js +2 -0
- package/Notifications/index.js.map +1 -0
- package/Notifications/types.d.ts +8 -0
- package/Notifications/types.js +2 -0
- package/Notifications/types.js.map +1 -0
- package/NotificationsList/NotificationsList.css +1 -0
- package/NotificationsList/NotificationsList.d.ts +5 -0
- package/NotificationsList/NotificationsList.js +2 -0
- package/NotificationsList/NotificationsList.js.map +1 -0
- package/NotificationsList/helpers.d.ts +4150 -0
- package/NotificationsList/helpers.js +2 -0
- package/NotificationsList/helpers.js.map +1 -0
- package/NotificationsList/index.d.ts +1 -0
- package/NotificationsList/index.js +2 -0
- package/NotificationsList/index.js.map +1 -0
- package/NotificationsList/types.d.ts +88 -0
- package/NotificationsList/types.js +2 -0
- package/NotificationsList/types.js.map +1 -0
- package/README.md +80 -0
- package/TileMenu/TileMenu.css +1 -0
- package/TileMenu/TileMenu.d.ts +5 -0
- package/TileMenu/TileMenu.js +2 -0
- package/TileMenu/TileMenu.js.map +1 -0
- package/TileMenu/TileMenuItem/TileMenuItem.css +1 -0
- package/TileMenu/TileMenuItem/TileMenuItem.d.ts +12 -0
- package/TileMenu/TileMenuItem/TileMenuItem.js +2 -0
- package/TileMenu/TileMenuItem/TileMenuItem.js.map +1 -0
- package/TileMenu/TileMenuList/TileMenuList.css +1 -0
- package/TileMenu/TileMenuList/TileMenuList.d.ts +4 -0
- package/TileMenu/TileMenuList/TileMenuList.js +2 -0
- package/TileMenu/TileMenuList/TileMenuList.js.map +1 -0
- package/TileMenu/TileMenuList/types.d.ts +32 -0
- package/TileMenu/TileMenuList/types.js +2 -0
- package/TileMenu/TileMenuList/types.js.map +1 -0
- package/TileMenu/helpers.d.ts +274 -0
- package/TileMenu/helpers.js +2 -0
- package/TileMenu/helpers.js.map +1 -0
- package/TileMenu/index.d.ts +1 -0
- package/TileMenu/index.js +2 -0
- package/TileMenu/index.js.map +1 -0
- package/TileMenu/types.d.ts +48 -0
- package/TileMenu/types.js +2 -0
- package/TileMenu/types.js.map +1 -0
- package/VerticalMenu/VerticalMenu.css +1 -0
- package/VerticalMenu/VerticalMenu.d.ts +5 -0
- package/VerticalMenu/VerticalMenu.js +2 -0
- package/VerticalMenu/VerticalMenu.js.map +1 -0
- package/VerticalMenu/VerticalMenuItem/VerticalMenuItem.css +1 -0
- package/VerticalMenu/VerticalMenuItem/VerticalMenuItem.d.ts +4 -0
- package/VerticalMenu/VerticalMenuItem/VerticalMenuItem.js +2 -0
- package/VerticalMenu/VerticalMenuItem/VerticalMenuItem.js.map +1 -0
- package/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.css +1 -0
- package/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.d.ts +5 -0
- package/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.js +2 -0
- package/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.js.map +1 -0
- package/VerticalMenu/helpers.d.ts +31 -0
- package/VerticalMenu/helpers.js +2 -0
- package/VerticalMenu/helpers.js.map +1 -0
- package/VerticalMenu/index.d.ts +1 -0
- package/VerticalMenu/index.js +2 -0
- package/VerticalMenu/index.js.map +1 -0
- package/VerticalMenu/types.d.ts +63 -0
- package/VerticalMenu/types.js +2 -0
- package/VerticalMenu/types.js.map +1 -0
- package/__private__/AnimatedContextMenu/AnimatedContextMenu.css +1 -0
- package/__private__/AnimatedContextMenu/AnimatedContextMenu.d.ts +8 -0
- package/__private__/AnimatedContextMenu/AnimatedContextMenu.js +2 -0
- package/__private__/AnimatedContextMenu/AnimatedContextMenu.js.map +1 -0
- package/__private__/components/NotificationCard/NotificationCard.css +1 -0
- package/__private__/components/NotificationCard/NotificationCard.d.ts +19 -0
- package/__private__/components/NotificationCard/NotificationCard.js +2 -0
- package/__private__/components/NotificationCard/NotificationCard.js.map +1 -0
- package/__private__/components/NotificationCard/helpers.d.ts +1 -0
- package/__private__/components/NotificationCard/helpers.js +2 -0
- package/__private__/components/NotificationCard/helpers.js.map +1 -0
- package/__private__/components/NotificationCard/index.d.ts +1 -0
- package/__private__/components/NotificationCard/index.js +2 -0
- package/__private__/components/NotificationCard/index.js.map +1 -0
- package/__private__/components/NotificationCard/types.d.ts +28 -0
- package/__private__/components/NotificationCard/types.js +2 -0
- package/__private__/components/NotificationCard/types.js.map +1 -0
- package/__private__/components/NotificationsActions/NotificationsActions.d.ts +2 -0
- package/__private__/components/NotificationsActions/NotificationsActions.js +2 -0
- package/__private__/components/NotificationsActions/NotificationsActions.js.map +1 -0
- package/__private__/components/NotificationsActions/helpers.d.ts +23 -0
- package/__private__/components/NotificationsActions/helpers.js +2 -0
- package/__private__/components/NotificationsActions/helpers.js.map +1 -0
- package/__private__/components/NotificationsActions/index.d.ts +1 -0
- package/__private__/components/NotificationsActions/index.js +2 -0
- package/__private__/components/NotificationsActions/index.js.map +1 -0
- package/__private__/components/NotificationsActions/types.d.ts +32 -0
- package/__private__/components/NotificationsActions/types.js +2 -0
- package/__private__/components/NotificationsActions/types.js.map +1 -0
- package/__private__/components/Sidebar/Sidebar.css +1 -0
- package/__private__/components/Sidebar/Sidebar.d.ts +9 -0
- package/__private__/components/Sidebar/Sidebar.js +2 -0
- package/__private__/components/Sidebar/Sidebar.js.map +1 -0
- package/__private__/components/Sidebar/index.d.ts +1 -0
- package/__private__/components/Sidebar/index.js +2 -0
- package/__private__/components/Sidebar/index.js.map +1 -0
- package/__private__/hooks/useHideElementsLine.d.ts +8 -0
- package/__private__/hooks/useHideElementsLine.js +2 -0
- package/__private__/hooks/useHideElementsLine.js.map +1 -0
- package/__private__/mixs/MixPopoverAnimate/MixPopoverAnimate.css +1 -0
- package/__private__/mixs/MixPopoverAnimate/MixPopoverAnimate.d.ts +4 -0
- package/__private__/mixs/MixPopoverAnimate/MixPopoverAnimate.js +2 -0
- package/__private__/mixs/MixPopoverAnimate/MixPopoverAnimate.js.map +1 -0
- package/__private__/mixs/MixPopoverArrow/MixPopoverArrow.css +1 -0
- package/__private__/mixs/MixPopoverArrow/MixPopoverArrow.d.ts +8 -0
- package/__private__/mixs/MixPopoverArrow/MixPopoverArrow.js +2 -0
- package/__private__/mixs/MixPopoverArrow/MixPopoverArrow.js.map +1 -0
- package/__private__/utils/bem.d.ts +1 -0
- package/__private__/utils/bem.js +2 -0
- package/__private__/utils/bem.js.map +1 -0
- package/__private__/utils/types/PropsWithHTMLAttributes.d.ts +3 -0
- package/__private__/utils/types/PropsWithHTMLAttributes.js +2 -0
- package/__private__/utils/types/PropsWithHTMLAttributes.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DefaultItem, MenuProps, MenuPropGetItemActive, MenuPropGetItemHref, MenuPropGetItemLabel, MenuPropGetItemOnClick, MenuPropGetItemSubMenu, MenuPropGetItemTarget, MenuPropOnItemClick } from "./types";
|
|
3
|
+
export declare const defaultGetItemLabel: MenuPropGetItemLabel<DefaultItem>;
|
|
4
|
+
export declare const defaultGetItemActive: MenuPropGetItemActive<DefaultItem>;
|
|
5
|
+
export declare const defaultGetItemHref: MenuPropGetItemHref<DefaultItem>;
|
|
6
|
+
export declare const defaultGetItemOnClick: MenuPropGetItemOnClick<DefaultItem>;
|
|
7
|
+
export declare const defaultGetItemTarget: MenuPropGetItemTarget<DefaultItem>;
|
|
8
|
+
export declare const defaultGetItemSubMenu: MenuPropGetItemSubMenu<DefaultItem>;
|
|
9
|
+
export declare function withDefaultGetters<ITEM>(props: MenuProps<ITEM>): {
|
|
10
|
+
items: ITEM[];
|
|
11
|
+
onItemClick?: MenuPropOnItemClick<ITEM> | undefined;
|
|
12
|
+
getItemHref?: MenuPropGetItemHref<ITEM> | undefined;
|
|
13
|
+
getItemLabel?: MenuPropGetItemLabel<ITEM> | undefined;
|
|
14
|
+
getItemTarget?: MenuPropGetItemTarget<ITEM> | undefined;
|
|
15
|
+
getItemActive?: MenuPropGetItemActive<ITEM> | undefined;
|
|
16
|
+
getItemOnClick?: MenuPropGetItemOnClick<ITEM> | undefined;
|
|
17
|
+
getItemSubMenu?: MenuPropGetItemSubMenu<ITEM> | undefined;
|
|
18
|
+
} & Pick<import("react").HTMLAttributes<HTMLDivElement>, "hidden" | "dir" | "slot" | "style" | "title" | "color" | "children" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("react").RefAttributes<HTMLDivElement> & (ITEM extends {
|
|
19
|
+
label: string;
|
|
20
|
+
} ? {} : {
|
|
21
|
+
getItemLabel: MenuPropGetItemLabel<ITEM>;
|
|
22
|
+
}) & {
|
|
23
|
+
getItemLabel: MenuPropGetItemLabel<DefaultItem> | MenuPropGetItemLabel<ITEM>;
|
|
24
|
+
getItemActive: MenuPropGetItemActive<DefaultItem> | MenuPropGetItemActive<ITEM>;
|
|
25
|
+
getItemHref: MenuPropGetItemHref<DefaultItem> | MenuPropGetItemHref<ITEM>;
|
|
26
|
+
getItemOnClick: MenuPropGetItemOnClick<DefaultItem> | MenuPropGetItemOnClick<ITEM>;
|
|
27
|
+
getItemTarget: MenuPropGetItemTarget<DefaultItem> | MenuPropGetItemTarget<ITEM>;
|
|
28
|
+
getItemSubMenu: MenuPropGetItemSubMenu<DefaultItem> | MenuPropGetItemSubMenu<ITEM>;
|
|
29
|
+
};
|
|
30
|
+
export declare function getItemClick<ITEM>(item: ITEM, getItemOnClick: MenuPropGetItemOnClick<ITEM>, onItemClick?: MenuPropOnItemClick<ITEM>): React.MouseEventHandler;
|
|
31
|
+
export declare const animateTimeout = 200;
|
package/Menu/helpers.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectSpread from"@babel/runtime/helpers/objectSpread";export const defaultGetItemLabel=a=>a.label;export const defaultGetItemActive=a=>a.active;export const defaultGetItemHref=a=>a.href;export const defaultGetItemOnClick=a=>a.onClick;export const defaultGetItemTarget=a=>a.target;export const defaultGetItemSubMenu=a=>a.subMenu;export function withDefaultGetters(a){return _objectSpread({},a,{getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemActive:a.getItemActive||defaultGetItemActive,getItemHref:a.getItemHref||defaultGetItemHref,getItemOnClick:a.getItemOnClick||defaultGetItemOnClick,getItemTarget:a.getItemTarget||defaultGetItemTarget,getItemSubMenu:a.getItemSubMenu||defaultGetItemSubMenu})}export function getItemClick(a,b,c){return d=>{var e;null===c||void 0===c?void 0:c({e:d,item:a}),null===(e=b(a))||void 0===e?void 0:e(d)}}export const animateTimeout=200;
|
|
2
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Menu/helpers.ts"],"names":["defaultGetItemLabel","item","label","defaultGetItemActive","active","defaultGetItemHref","href","defaultGetItemOnClick","onClick","defaultGetItemTarget","target","defaultGetItemSubMenu","subMenu","withDefaultGetters","props","getItemLabel","getItemActive","getItemHref","getItemOnClick","getItemTarget","getItemSubMenu","getItemClick","onItemClick","e","animateTimeout"],"mappings":"+DAYA,MAAO,MAAMA,CAAAA,mBAAsD,CAAGC,CAAI,EAAIA,CAAI,CAACC,KAA5E,CACP,MAAO,MAAMC,CAAAA,oBAAwD,CAAGF,CAAI,EAAIA,CAAI,CAACG,MAA9E,CACP,MAAO,MAAMC,CAAAA,kBAAoD,CAAGJ,CAAI,EAAIA,CAAI,CAACK,IAA1E,CACP,MAAO,MAAMC,CAAAA,qBAA0D,CAAGN,CAAI,EAAIA,CAAI,CAACO,OAAhF,CACP,MAAO,MAAMC,CAAAA,oBAAwD,CAAGR,CAAI,EAAIA,CAAI,CAACS,MAA9E,CACP,MAAO,MAAMC,CAAAA,qBAA0D,CAAGV,CAAI,EAAIA,CAAI,CAACW,OAAhF,CAEP,MAAO,SAASC,CAAAA,kBAAT,CAAkCC,CAAlC,CAA0D,CAC/D,wBACKA,CADL,EAEEC,YAAY,CAAED,CAAK,CAACC,YAAN,EAAsBf,mBAFtC,CAGEgB,aAAa,CAAEF,CAAK,CAACE,aAAN,EAAuBb,oBAHxC,CAIEc,WAAW,CAAEH,CAAK,CAACG,WAAN,EAAqBZ,kBAJpC,CAKEa,cAAc,CAAEJ,CAAK,CAACI,cAAN,EAAwBX,qBAL1C,CAMEY,aAAa,CAAEL,CAAK,CAACK,aAAN,EAAuBV,oBANxC,CAOEW,cAAc,CAAEN,CAAK,CAACM,cAAN,EAAwBT,qBAP1C,EASD,CAED,MAAO,SAASU,CAAAA,YAAT,CACLpB,CADK,CAELiB,CAFK,CAGLI,CAHK,CAIoB,CACzB,MAAOC,CAAAA,CAAC,EAAI,cACVD,CADU,WACVA,CADU,QACVA,CAAW,CAAG,CAAEC,CAAC,CAADA,CAAF,CAAKtB,IAAI,CAAJA,CAAL,CAAH,CADD,WAEViB,CAAc,CAACjB,CAAD,CAFJ,qBAEV,EAAuBsB,CAAvB,CACD,CACF,CAED,MAAO,MAAMC,CAAAA,cAAc,CAAG,GAAvB","sourcesContent":["import {\n DefaultItem,\n MenuProps,\n MenuPropGetItemActive,\n MenuPropGetItemHref,\n MenuPropGetItemLabel,\n MenuPropGetItemOnClick,\n MenuPropGetItemSubMenu,\n MenuPropGetItemTarget,\n MenuPropOnItemClick,\n} from './types'\n\nexport const defaultGetItemLabel: MenuPropGetItemLabel<DefaultItem> = item => item.label\nexport const defaultGetItemActive: MenuPropGetItemActive<DefaultItem> = item => item.active\nexport const defaultGetItemHref: MenuPropGetItemHref<DefaultItem> = item => item.href\nexport const defaultGetItemOnClick: MenuPropGetItemOnClick<DefaultItem> = item => item.onClick\nexport const defaultGetItemTarget: MenuPropGetItemTarget<DefaultItem> = item => item.target\nexport const defaultGetItemSubMenu: MenuPropGetItemSubMenu<DefaultItem> = item => item.subMenu\n\nexport function withDefaultGetters<ITEM>(props: MenuProps<ITEM>) {\n return {\n ...props,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemActive: props.getItemActive || defaultGetItemActive,\n getItemHref: props.getItemHref || defaultGetItemHref,\n getItemOnClick: props.getItemOnClick || defaultGetItemOnClick,\n getItemTarget: props.getItemTarget || defaultGetItemTarget,\n getItemSubMenu: props.getItemSubMenu || defaultGetItemSubMenu,\n }\n}\n\nexport function getItemClick<ITEM>(\n item: ITEM,\n getItemOnClick: MenuPropGetItemOnClick<ITEM>,\n onItemClick?: MenuPropOnItemClick<ITEM>\n): React.MouseEventHandler {\n return e => {\n onItemClick?.({ e, item })\n getItemOnClick(item)?.(e)\n }\n}\n\nexport const animateTimeout = 200\n"],"file":"helpers.js"}
|
package/Menu/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Menu";
|
package/Menu/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Menu/index.ts"],"names":[],"mappings":"AAAA","sourcesContent":["export * from './Menu'\n"],"file":"index.js"}
|
package/Menu/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
|
|
3
|
+
export declare type DefaultItem = {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
target?: string;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
onClick?: React.EventHandler<React.MouseEvent>;
|
|
9
|
+
subMenu?: DefaultItem[];
|
|
10
|
+
};
|
|
11
|
+
export declare type MenuPropGetItemLabel<ITEM> = (item: ITEM) => string;
|
|
12
|
+
export declare type MenuPropGetItemHref<ITEM> = (item: ITEM) => string | undefined;
|
|
13
|
+
export declare type MenuPropGetItemTarget<ITEM> = (item: ITEM) => string | undefined;
|
|
14
|
+
export declare type MenuPropGetItemActive<ITEM> = (item: ITEM) => boolean | undefined;
|
|
15
|
+
export declare type MenuPropGetItemSubMenu<ITEM> = (item: ITEM) => ITEM[] | undefined;
|
|
16
|
+
export declare type MenuPropGetItemOnClick<ITEM> = (item: ITEM) => React.EventHandler<React.MouseEvent> | undefined;
|
|
17
|
+
export declare type MenuPropOnItemClick<ITEM> = (props: {
|
|
18
|
+
e: React.MouseEvent;
|
|
19
|
+
item: ITEM;
|
|
20
|
+
}) => void;
|
|
21
|
+
export declare type MenuProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRef<{
|
|
22
|
+
items: ITEM[];
|
|
23
|
+
onItemClick?: MenuPropOnItemClick<ITEM>;
|
|
24
|
+
getItemHref?: MenuPropGetItemHref<ITEM>;
|
|
25
|
+
getItemLabel?: MenuPropGetItemLabel<ITEM>;
|
|
26
|
+
getItemTarget?: MenuPropGetItemTarget<ITEM>;
|
|
27
|
+
getItemActive?: MenuPropGetItemActive<ITEM>;
|
|
28
|
+
getItemOnClick?: MenuPropGetItemOnClick<ITEM>;
|
|
29
|
+
getItemSubMenu?: MenuPropGetItemSubMenu<ITEM>;
|
|
30
|
+
}, HTMLDivElement> & (ITEM extends {
|
|
31
|
+
label: DefaultItem['label'];
|
|
32
|
+
} ? {} : {
|
|
33
|
+
getItemLabel: MenuPropGetItemLabel<ITEM>;
|
|
34
|
+
});
|
|
35
|
+
export declare type MenuComponent = <ITEM = DefaultItem>(props: MenuProps<ITEM>) => React.ReactElement | null;
|
package/Menu/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.che--MobileMenu-Sidebar.Sidebar-Window_position_left,.che--MobileMenu-Sidebar.Sidebar-Window_position_right{overflow:hidden;width:380px;max-width:calc(100% - var(--space-4xl))}.che--MobileMenu-Menu{overflow-x:hidden;overflow-y:auto;height:100%}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _jsx from"@babel/runtime/helpers/jsx";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import React,{forwardRef}from"react";import{cn}from"../__private__/utils/bem";import{VerticalMenu}from"../VerticalMenu";import{Sidebar}from"@consta/uikit/Sidebar";import{Button}from"@consta/uikit/Button";import{IconHamburger}from"@consta/uikit/IconHamburger";import{useFlag}from"@consta/uikit/useFlag";import"./MobileMenu.css";export const cnMobileMenu=cn("MobileMenu");const MobileMenuRender=(a,b)=>{var c;const{items:d,className:e,getItemActive:f,getItemHref:g,getItemLabel:h,getItemOnClick:i,getItemTarget:j,getItemSubMenu:k,header:l,onItemClick:m,sidebarClassName:n}=a,o=_objectWithoutProperties(a,["items","className","getItemActive","getItemHref","getItemLabel","getItemOnClick","getItemTarget","getItemSubMenu","header","onItemClick","sidebarClassName"]),[p,{toogle:q,off:r}]=useFlag(),s="number"==typeof(null===(c=a.style)||void 0===c?void 0:c.zIndex)?a.style.zIndex+1:void 0;return React.createElement(React.Fragment,null,React.createElement(Button,Object.assign({},o,{size:"s",view:"clear",className:cnMobileMenu(null,[e]),iconLeft:IconHamburger,ref:b,onClick:q})),_jsx(Sidebar,{className:cnMobileMenu("Sidebar",[n]),position:"left",isOpen:p,onClickOutside:r,size:"m",style:{zIndex:s}},void 0,_jsx(VerticalMenu,{className:cnMobileMenu("Menu"),items:d,getItemActive:f,getItemHref:g,getItemLabel:h,getItemOnClick:i,getItemTarget:j,getItemSubMenu:k,onItemClick:m,header:l})))};export const MobileMenu=forwardRef(MobileMenuRender);export*from"./types";
|
|
2
|
+
//# sourceMappingURL=MobileMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MobileMenu/MobileMenu.tsx"],"names":["React","forwardRef","cn","VerticalMenu","Sidebar","Button","IconHamburger","useFlag","cnMobileMenu","MobileMenuRender","props","ref","items","className","getItemActive","getItemHref","getItemLabel","getItemOnClick","getItemTarget","getItemSubMenu","header","onItemClick","sidebarClassName","otherProps","visibleMenu","toogle","off","elementZIndex","style","zIndex","MobileMenu"],"mappings":"kIAAA,MAAOA,CAAAA,KAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,EAAT,gCAIA,OAASC,YAAT,uBACA,OAASC,OAAT,KAAwB,uBAAxB,CAEA,OAASC,MAAT,KAAuB,sBAAvB,CAEA,OAASC,aAAT,KAA8B,6BAA9B,CACA,OAASC,OAAT,KAAwB,uBAAxB,CAEA,yBAEA,MAAO,MAAMC,CA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D,CADzB,CAEE,KAAK,CAAEI,CAFT,CAGE,aAAa,CAAEE,CAHjB,CAIE,WAAW,CAAEC,CAJf,CAKE,YAAY,CAAEC,CALhB,CAME,cAAc,CAAEC,CANlB,CAOE,aAAa,CAAEC,CAPjB,CAQE,cAAc,CAAEC,CARlB,CASE,WAAW,CAAEE,CATf,CAUE,MAAM,CAAED,CAVV,EARF,CAVF,CAiCH,CAtDD,CAwDA,MAAO,MAAMU,CAAAA,UAAU,CAAG7B,UAAU,CAACQ,gBAAD,CAA7B,CAEP","sourcesContent":["import React, { forwardRef } from 'react'\n\nimport { cn } from '@/__private__/utils/bem'\n\nimport { MobileMenuProps, MobileMenuComponent } from './types'\n\nimport { VerticalMenu } from '@/VerticalMenu'\nimport { Sidebar } from '@consta/uikit/Sidebar'\n\nimport { Button } from '@consta/uikit/Button'\n\nimport { IconHamburger } from '@consta/uikit/IconHamburger'\nimport { useFlag } from '@consta/uikit/useFlag'\n\nimport './MobileMenu.css'\n\nexport const cnMobileMenu = cn('MobileMenu')\n\nconst MobileMenuRender = (props: MobileMenuProps, ref: React.Ref<HTMLButtonElement>) => {\n const {\n items,\n className,\n getItemActive,\n getItemHref,\n getItemLabel,\n getItemOnClick,\n getItemTarget,\n getItemSubMenu,\n header,\n onItemClick,\n sidebarClassName,\n ...otherProps\n } = props\n\n const [visibleMenu, { toogle, off }] = useFlag()\n\n const elementZIndex = typeof props.style?.zIndex === 'number' ? props.style.zIndex + 1 : undefined\n\n return (\n <>\n <Button\n {...otherProps}\n size=\"s\"\n view=\"clear\"\n className={cnMobileMenu(null, [className])}\n iconLeft={IconHamburger}\n ref={ref}\n onClick={toogle}\n />\n <Sidebar\n className={cnMobileMenu('Sidebar', [sidebarClassName])}\n position=\"left\"\n isOpen={visibleMenu}\n onClickOutside={off}\n size=\"m\"\n style={{ zIndex: elementZIndex }}\n >\n <VerticalMenu\n className={cnMobileMenu('Menu')}\n items={items}\n getItemActive={getItemActive}\n getItemHref={getItemHref}\n getItemLabel={getItemLabel}\n getItemOnClick={getItemOnClick}\n getItemTarget={getItemTarget}\n getItemSubMenu={getItemSubMenu}\n onItemClick={onItemClick}\n header={header}\n />\n </Sidebar>\n </>\n )\n}\n\nexport const MobileMenu = forwardRef(MobileMenuRender) as MobileMenuComponent\n\nexport * from './types'\n"],"file":"MobileMenu.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MobileMenu";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MobileMenu/index.ts"],"names":[],"mappings":"AAAA","sourcesContent":["export * from './MobileMenu'\n"],"file":"index.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DefaultItem, VerticalMenuPropGetItemHref, VerticalMenuPropGetItemLabel, VerticalMenuPropGetItemActive, VerticalMenuPropGetItemOnClick, VerticalMenuPropOnItemClick, VerticalMenuPropGetItemTarget, VerticalMenuPropGetItemSubMenu } from "../VerticalMenu/index";
|
|
3
|
+
import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
|
|
4
|
+
export declare type MobileMenuProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRef<{
|
|
5
|
+
items: ITEM[];
|
|
6
|
+
getItemHref?: VerticalMenuPropGetItemHref<ITEM>;
|
|
7
|
+
getItemLabel?: VerticalMenuPropGetItemLabel<ITEM>;
|
|
8
|
+
getItemTarget?: VerticalMenuPropGetItemTarget<ITEM>;
|
|
9
|
+
getItemActive?: VerticalMenuPropGetItemActive<ITEM>;
|
|
10
|
+
getItemOnClick?: VerticalMenuPropGetItemOnClick<ITEM>;
|
|
11
|
+
getItemSubMenu?: VerticalMenuPropGetItemSubMenu<ITEM>;
|
|
12
|
+
onItemClick?: VerticalMenuPropOnItemClick<ITEM>;
|
|
13
|
+
header?: React.ReactNode;
|
|
14
|
+
sidebarClassName?: string;
|
|
15
|
+
children?: never;
|
|
16
|
+
}, HTMLButtonElement> & (ITEM extends {
|
|
17
|
+
label: DefaultItem['label'];
|
|
18
|
+
} ? {} : {
|
|
19
|
+
getItemLabel: VerticalMenuPropGetItemLabel<ITEM>;
|
|
20
|
+
});
|
|
21
|
+
export declare type MobileMenuComponent = <ITEM = DefaultItem>(props: MobileMenuProps<ITEM>) => React.ReactElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.che--Notifications-Popover{--popover-bg-color:var(--color-bg-default);--popover-arrow-bg-color:var(--popover-bg-color);position:relative;width:90vw;max-width:450px;border-radius:var(--control-radius);background:var(--popover-bg-color);box-shadow:var(--shadow-layer)}.che--Notifications-List{height:100%}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _jsx from"@babel/runtime/helpers/jsx";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import React,{forwardRef,useRef,useState,useCallback}from"react";import{CSSTransition}from"react-transition-group";import{cn}from"../__private__/utils/bem";import{NotificationsList}from"../NotificationsList";import{Sidebar}from"../__private__/components/Sidebar";import{Button}from"@consta/uikit/Button";import{Popover}from"@consta/uikit/Popover";import{useForkRef}from"@consta/uikit/useForkRef";import{IconRing}from"@consta/uikit/IconRing";import{useFlag}from"@consta/uikit/useFlag";import{cnMixPopoverArrow}from"../__private__/mixs/MixPopoverArrow/MixPopoverArrow";import{cnMixPopoverAnimateForCssTransition}from"../__private__/mixs/MixPopoverAnimate/MixPopoverAnimate";import"./Notifications.css";const ARROW_SIZE=6,ARROW_OFFSET=10;export const cnNotifications=cn("Notifications");const NotificationsRender=(a,b)=>{var c;const{className:d,items:e,groupByDay:f,groups:g,groupLabelFormat:h,itemDateFormat:i,title:j,actions:k,getActionIcon:l,getActionLabel:m,getActionOnClick:n,getGroupId:o,getGroupLabel:p,getItemActions:q,getItemBadges:r,getItemDate:s,getItemDescription:t,getItemGroup:u,getItemImage:v,getItemLabel:w,getItemRead:x,getItemView:y,listClassName:z,isMobile:A}=a,B=_objectWithoutProperties(a,["className","items","groupByDay","groups","groupLabelFormat","itemDateFormat","title","actions","getActionIcon","getActionLabel","getActionOnClick","getGroupId","getGroupLabel","getItemActions","getItemBadges","getItemDate","getItemDescription","getItemGroup","getItemImage","getItemLabel","getItemRead","getItemView","listClassName","isMobile"]),C=useRef(null),[D,E]=useState(void 0),[F,{toogle:G,off:H}]=useFlag(),I=useCallback(a=>{E(a)},[]),J={className:cnNotifications("List",[z]),items:e,groupByDay:f,groups:g,groupLabelFormat:h,title:j,actions:k,getActionIcon:l,getActionLabel:m,getActionOnClick:n,getGroupId:o,getGroupLabel:p,getItemActions:q,getItemBadges:r,getItemDate:s,getItemDescription:t,getItemGroup:u,getItemImage:v,getItemLabel:w,getItemRead:x,getItemView:y},K="number"==typeof(null===(c=a.style)||void 0===c?void 0:c.zIndex)?a.style.zIndex+1:void 0;return React.createElement(React.Fragment,null,React.createElement(Button,Object.assign({},B,{size:"s",view:"clear",className:cnNotifications(null,[d]),iconLeft:IconRing,ref:useForkRef([b,C]),onClick:G})),A?_jsx(Sidebar,{isOpen:F,onClickOutside:H,style:{zIndex:K}},void 0,React.createElement(NotificationsList,Object.assign({},J,{onClose:H,style:{zIndex:K}}))):_jsx(CSSTransition,{classNames:cnMixPopoverAnimateForCssTransition,timeout:200,unmountOnExit:!0,in:F},void 0,_jsx(Popover,{className:cnNotifications("Popover"),anchorRef:C,arrowOffset:ARROW_OFFSET+ARROW_SIZE,offset:10,onSetDirection:I,style:{"--popover-arrow-size":`${ARROW_SIZE}px`,"--popover-arrow-offset":`${ARROW_OFFSET}px`,zIndex:K},onClickOutside:H},void 0,_jsx("div",{className:cnMixPopoverArrow({direction:D})}),React.createElement(NotificationsList,Object.assign({},J,{style:{zIndex:K}})))))};export const Notifications=forwardRef(NotificationsRender);
|
|
2
|
+
//# sourceMappingURL=Notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Notifications/Notifications.tsx"],"names":["React","forwardRef","useRef","useState","useCallback","CSSTransition","cn","NotificationsList","Sidebar","Button","Popover","useForkRef","IconRing","useFlag","cnMixPopoverArrow","cnMixPopoverAnimateForCssTransition","ARROW_SIZE","ARROW_OFFSET","cnNotifications","NotificationsRender","props","ref","className","items","groupByDay","groups","groupLabelFormat","itemDateFormat","title","actions","getActionIcon","getActionLabel","getActionOnClick","getGroupId","getGroupLabel","getItemActions","getItemBadges","getItemDate","getItemDescription","getItemGroup","getItemImage","getItemLabel","getItemRead","getItemView","listClassName","isMobile","otherProps","buttonRef","direction","setDirection","visibleMenu","toogle","off","onSetDirection","dir","listProps","elementZIndex","style","zIndex","Notifications"],"mappings":"kIAAA,MAAOA,CAAAA,KAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,CAAoCC,QAApC,CAA8CC,WAA9C,KAAiE,OAAjE,CAEA,OAASC,aAAT,KAA8B,wBAA9B,CACA,OAASC,EAAT,gCAIA,OAASC,iBAAT,4BACA,OAASC,OAAT,yCAEA,OAASC,MAAT,KAAuB,sBAAvB,CAEA,OAASC,OAAT,KAAmC,uBAAnC,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,OAASC,QAAT,KAAyB,wBAAzB,CACA,OAASC,OAAT,KAAwB,uBAAxB,CACA,OAASC,iBAAT,2DACA,OAASC,mCAAT,+DAEA,4B,KAEMC,CAAAA,UAAU,CAAG,C,CACbC,YAAY,CAAG,E,CAErB,MAAO,MAAMC,CAAAA,eAAe,CAAGZ,EAAE,CAAC,eAAD,CAA1B,CAEP,KAAMa,CAAAA,mBAAmB,CAAG,CAACC,CAAD,CAA4BC,CAA5B,GAAkE,YACtF,CACJC,SAAS,CAATA,CADI,CAEJC,KAAK,CAALA,CAFI,CAGJC,UAAU,CAAVA,CAHI,CAIJC,MAAM,CAANA,CAJI,CAKJC,gBAAgB,CAAhBA,CALI,CAMJC,cAAc,CAAdA,CANI,CAOJC,KA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AE6B,CAFb,CAGE,WAAW,CAAE9B,YAAY,CAAGD,UAH9B,CAIE,MAAM,GAJR,CAKE,cAAc,CAAEqC,CALlB,CAME,KAAK,CAAE,CACL,uBAAqC,GAAErC,UAAW,IAD7C,CAEL,yBAAuC,GAAEC,YAAa,IAFjD,CAGLyC,MAAM,CAAEF,CAHH,CANT,CAWE,cAAc,CAAEJ,CAXlB,SAaE,YAAK,SAAS,CAAEtC,iBAAiB,CAAC,CAAEkC,SAAS,CAATA,CAAF,CAAD,CAAjC,EAbF,CAcE,oBAAC,iBAAD,kBAAuBO,CAAvB,EAAkC,KAAK,CAAE,CAAEG,MAAM,CAAEF,CAAV,CAAzC,GAdF,CANF,CAfJ,CAyCH,CA1GD,CA4GA,MAAO,MAAMG,CAAAA,aAAa,CAAG1D,UAAU,CAACkB,mBAAD,CAAhC","sourcesContent":["import React, { forwardRef, useRef, useState, useCallback } from 'react'\n\nimport { CSSTransition } from 'react-transition-group'\nimport { cn } from '@/__private__/utils/bem'\n\nimport { NotificationsProps, NotificationsComponent } from './types'\n\nimport { NotificationsList } from '@/NotificationsList'\nimport { Sidebar } from '@/__private__/components/Sidebar'\n\nimport { Button } from '@consta/uikit/Button'\n\nimport { Popover, Direction } from '@consta/uikit/Popover'\nimport { useForkRef } from '@consta/uikit/useForkRef'\nimport { IconRing } from '@consta/uikit/IconRing'\nimport { useFlag } from '@consta/uikit/useFlag'\nimport { cnMixPopoverArrow } from '@/__private__/mixs/MixPopoverArrow/MixPopoverArrow'\nimport { cnMixPopoverAnimateForCssTransition } from '@/__private__/mixs/MixPopoverAnimate/MixPopoverAnimate'\n\nimport './Notifications.css'\n\nconst ARROW_SIZE = 6\nconst ARROW_OFFSET = 10\n\nexport const cnNotifications = cn('Notifications')\n\nconst NotificationsRender = (props: NotificationsProps, ref: React.Ref<HTMLButtonElement>) => {\n const {\n className,\n items,\n groupByDay,\n groups,\n groupLabelFormat,\n itemDateFormat,\n title,\n actions,\n getActionIcon,\n getActionLabel,\n getActionOnClick,\n getGroupId,\n getGroupLabel,\n getItemActions,\n getItemBadges,\n getItemDate,\n getItemDescription,\n getItemGroup,\n getItemImage,\n getItemLabel,\n getItemRead,\n getItemView,\n listClassName,\n isMobile,\n ...otherProps\n } = props\n\n const buttonRef = useRef<HTMLButtonElement>(null)\n const [direction, setDirection] = useState<Direction | undefined>(undefined)\n\n const [visibleMenu, { toogle, off }] = useFlag()\n\n const onSetDirection = useCallback((dir: Direction) => {\n setDirection(dir)\n }, [])\n\n const listProps = {\n className: cnNotifications('List', [listClassName]),\n items,\n groupByDay,\n groups,\n groupLabelFormat,\n title,\n actions,\n getActionIcon,\n getActionLabel,\n getActionOnClick,\n getGroupId,\n getGroupLabel,\n getItemActions,\n getItemBadges,\n getItemDate,\n getItemDescription,\n getItemGroup,\n getItemImage,\n getItemLabel,\n getItemRead,\n getItemView,\n }\n\n const elementZIndex = typeof props.style?.zIndex === 'number' ? props.style.zIndex + 1 : undefined\n\n return (\n <>\n <Button\n {...otherProps}\n size=\"s\"\n view=\"clear\"\n className={cnNotifications(null, [className])}\n iconLeft={IconRing}\n ref={useForkRef([ref, buttonRef])}\n onClick={toogle}\n />\n {isMobile ? (\n <Sidebar isOpen={visibleMenu} onClickOutside={off} style={{ zIndex: elementZIndex }}>\n <NotificationsList {...listProps} onClose={off} style={{ zIndex: elementZIndex }} />\n </Sidebar>\n ) : (\n <CSSTransition\n classNames={cnMixPopoverAnimateForCssTransition}\n timeout={200}\n unmountOnExit\n in={visibleMenu}\n >\n <Popover\n className={cnNotifications('Popover')}\n anchorRef={buttonRef}\n arrowOffset={ARROW_OFFSET + ARROW_SIZE}\n offset={ARROW_SIZE + 4}\n onSetDirection={onSetDirection}\n style={{\n ['--popover-arrow-size' as string]: `${ARROW_SIZE}px`,\n ['--popover-arrow-offset' as string]: `${ARROW_OFFSET}px`,\n zIndex: elementZIndex,\n }}\n onClickOutside={off}\n >\n <div className={cnMixPopoverArrow({ direction })} />\n <NotificationsList {...listProps} style={{ zIndex: elementZIndex }} />\n </Popover>\n </CSSTransition>\n )}\n </>\n )\n}\n\nexport const Notifications = forwardRef(NotificationsRender) as NotificationsComponent\n"],"file":"Notifications.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Notifications";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Notifications/index.ts"],"names":[],"mappings":"AAAA","sourcesContent":["export * from './Notifications'\n"],"file":"index.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Props, DefaultAction, DefaultItem, DefaultGroup } from "../NotificationsList/index";
|
|
3
|
+
import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
|
|
4
|
+
export declare type NotificationsProps<ITEM = DefaultItem, GROUP = DefaultGroup, ACTION = DefaultAction, GROUP_BY_DAY extends boolean = false> = PropsWithHTMLAttributesAndRef<Omit<Props<ITEM, GROUP, ACTION, GROUP_BY_DAY>, 'onClose'> & {
|
|
5
|
+
listClassName?: string;
|
|
6
|
+
isMobile?: boolean;
|
|
7
|
+
}, HTMLButtonElement>;
|
|
8
|
+
export declare type NotificationsComponent = <ITEM = DefaultItem, GROUP = DefaultGroup, ACTION = DefaultAction, GROUP_BY_DAY extends boolean = false>(props: NotificationsProps<ITEM, GROUP, ACTION, GROUP_BY_DAY>) => React.ReactElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.che--NotificationsList{display:flex;flex-direction:column}.che--NotificationsList-GroupLabel{padding:var(--space-2xs) var(--space-xl);background:var(--color-bg-secondary)}.che--NotificationsList-Header,.che--NotificationsList-Item{padding:var(--space-l) var(--space-xl)}.che--NotificationsList-Header{display:flex;align-items:center;flex:none;border-bottom:1px solid var(--color-bg-border)}.che--NotificationsList-HeaderItem{flex:none;margin-right:var(--space-xs)}.che--NotificationsList-HeaderItem:last-child{margin-right:0}.che--NotificationsList-HeaderItem:first-child{flex:1}.che--NotificationsList-List{overflow:auto;height:100%}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NotificationsListComponent } from "./types";
|
|
2
|
+
import './NotificationsList.css';
|
|
3
|
+
export declare const cnNotificationsList: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
+
export declare const NotificationsList: NotificationsListComponent;
|
|
5
|
+
export * from "./types";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _jsx from"@babel/runtime/helpers/jsx";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import React,{forwardRef,useEffect,useRef,useCallback,Fragment}from"react";import{cn}from"../__private__/utils/bem";import{getGroups,withDefaultGetters,defaultGroupLabelFormat}from"./helpers";import{NotificationCard}from"../__private__/components/NotificationCard";import{Text}from"@consta/uikit/Text";import{NotificationsActions}from"../__private__/components/NotificationsActions";import{Button}from"@consta/uikit/Button";import{IconClose}from"@consta/uikit/IconClose";import"./NotificationsList.css";export const cnNotificationsList=cn("NotificationsList");function NotificationsListRender(a,b){var c;const d=withDefaultGetters(a),{className:e,items:f,groupByDay:z=!1,groups:g,groupLabelFormat:A=defaultGroupLabelFormat,itemDateFormat:h,title:i,actions:j,getItemLabel:k,getActionIcon:l,getActionLabel:m,getActionOnClick:n,getGroupId:o,getGroupLabel:p,getItemActions:q,getItemBadges:r,getItemDate:s,getItemDescription:t,getItemGroup:u,getItemImage:v,getItemRead:w,getItemView:x,onClose:y}=d,B=_objectWithoutProperties(d,["className","items","groupByDay","groups","groupLabelFormat","itemDateFormat","title","actions","getItemLabel","getActionIcon","getActionLabel","getActionOnClick","getGroupId","getGroupLabel","getItemActions","getItemBadges","getItemDate","getItemDescription","getItemGroup","getItemImage","getItemRead","getItemView","onClose"]),C=getGroups(f,g,z,u,s,o),D=useRef({}),E=useRef(null),F=useCallback(()=>{for(const a in D.current)Object.prototype.hasOwnProperty.call(D.current,a)&&D.current[a](!1)},[]);useEffect(()=>{var a;return null===(a=E.current)||void 0===a?void 0:a.addEventListener("scroll",F,{passive:!0}),()=>{var a;return null===(a=E.current)||void 0===a?void 0:a.removeEventListener("scroll",F)}},[E.current]);const G="number"==typeof(null===(c=a.style)||void 0===c?void 0:c.zIndex)?a.style.zIndex+1:void 0;return React.createElement("div",Object.assign({},B,{ref:b,className:cnNotificationsList(null,[e])}),(i||j)&&_jsx("div",{className:cnNotificationsList("Header")},void 0,_jsx(Text,{className:cnNotificationsList("HeaderItem"),size:"xl",truncate:!0},void 0,i),(null===j||void 0===j?void 0:j.length)&&_jsx(NotificationsActions,{className:cnNotificationsList("HeaderItem"),items:j,getItemIcon:l,getItemOnClick:n,getItemLabel:m,style:{zIndex:G}}),y&&_jsx(Button,{className:cnNotificationsList("HeaderItem"),size:"s",view:"clear",iconLeft:IconClose,onClick:y})),React.createElement("div",{ref:E,className:cnNotificationsList("List")},C.map((a,b)=>{const c=z?A(+a.key):a.group&&p(a.group);return _jsx(Fragment,{},cnNotificationsList("Group",{groupIndex:b}),c&&_jsx(Text,{className:cnNotificationsList("GroupLabel"),view:"secondary",transform:"uppercase",weight:"bold",size:"2xs"},cnNotificationsList("GroupLabel",{groupIndex:b}),c),a.items.map((a,c)=>_jsx(NotificationCard,{className:cnNotificationsList("Item"),title:k(a),description:t(a),imageUrl:v(a),read:w(a),date:s(a),dateFormat:h,badges:r(a),actions:q(a),view:x(a),setVisibleMenu:a=>{D.current[`${b}-${c}`]=a},style:{zIndex:G}},cnNotificationsList("Item",{groupIndex:b,itemIndex:c}))))})))}export const NotificationsList=forwardRef(NotificationsListRender);export*from"./types";
|
|
2
|
+
//# sourceMappingURL=NotificationsList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/NotificationsList/NotificationsList.tsx"],"names":["React","forwardRef","useEffect","useRef","useCallback","Fragment","cn","getGroups","withDefaultGetters","defaultGroupLabelFormat","NotificationCard","Text","NotificationsActions","Button","IconClose","cnNotificationsList","NotificationsListRender","props","ref","className","items","groupByDay","groups","groupLabelFormat","itemDateFormat","title","actions","getItemLabel","getActionIcon","getActionLabel","getActionOnClick","getGroupId","getGroupLabel","getItemActions","getItemBadges","getItemDate","getItemDescription","getItemGroup","getItemImage","getItemRead","getItemView","onClose","otherProps","resultGroups","setVisibleMenuRef","listRef","closeAllMenu","key","current","Object","prototype","hasOwnProperty","call","addEventListener","passive","removeEventListener","elementZIndex","style","zIndex","length","map","group","groupIndex","groupLabel","item","itemIndex","value","NotificationsList"],"mappings":"kIAAA,MAAOA,CAAAA,KAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,MAAvC,CAA+CC,WAA/C,CAA4DC,QAA5D,KAA4E,OAA5E,CAEA,OAASC,EAAT,gCAGA,OAASC,SAAT,CAAoBC,kBAApB,CAAwCC,uBAAxC,iBACA,OAASC,gBAAT,kDACA,OAASC,IAAT,KAAqB,oBAArB,CACA,OAASC,oBAAT,sDACA,OAASC,MAAT,KAAuB,sBAAvB,CACA,OAASC,SAAT,KAA0B,yBAA1B,CAEA,gCAEA,MAAO,MAAMC,CAAAA,mBAAmB,CAAGT,EAAE,CAAC,mBAAD,CAA9B,CAEP,QAASU,CAAAA,uBAAT,CAAiCC,CAAjC,CAAgEC,CAAhE,CAAgG,eA0B1FV,kBAAkB,CAACS,CAAD,CA1BwE,CACxF,CACJE,SAAS,CAATA,CADI,CAEJC,KAAK,CAALA,CAFI,CAGJC,UAAU,CAAVA,CAAU,GAHN,CAIJC,MAAM,CAANA,CAJI,CAKJC,gBAAgB,CAAhBA,CAAgB,CAAGd,uBALf,CAMJe,cAAc,CAAdA,CANI,CAOJC,KAAK,CAALA,CAPI,CAQJC,OAAO,CAAPA,CARI,CASJC,YAAY,CAAZA,CATI,CAUJC,aAAa,CAAbA,CAVI,CAWJC,cAAc,CAAdA,CAXI,CAYJC,gBAAgB,CAAhBA,CAZI,CAaJC,UAAU,CAAVA,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ApC,CAEP","sourcesContent":["import React, { forwardRef, useEffect, useRef, useCallback, Fragment } from 'react'\n\nimport { cn } from '@/__private__/utils/bem'\n\nimport { NotificationsListProps, NotificationsListComponent } from './types'\nimport { getGroups, withDefaultGetters, defaultGroupLabelFormat } from './helpers'\nimport { NotificationCard } from '@/__private__/components/NotificationCard'\nimport { Text } from '@consta/uikit/Text'\nimport { NotificationsActions } from '@/__private__/components/NotificationsActions'\nimport { Button } from '@consta/uikit/Button'\nimport { IconClose } from '@consta/uikit/IconClose'\n\nimport './NotificationsList.css'\n\nexport const cnNotificationsList = cn('NotificationsList')\n\nfunction NotificationsListRender(props: NotificationsListProps, ref: React.Ref<HTMLDivElement>) {\n const {\n className,\n items,\n groupByDay = false,\n groups,\n groupLabelFormat = defaultGroupLabelFormat,\n itemDateFormat,\n title,\n actions,\n getItemLabel,\n getActionIcon,\n getActionLabel,\n getActionOnClick,\n getGroupId,\n getGroupLabel,\n getItemActions,\n getItemBadges,\n getItemDate,\n getItemDescription,\n getItemGroup,\n getItemImage,\n getItemRead,\n getItemView,\n onClose,\n ...otherProps\n } = withDefaultGetters(props)\n\n const resultGroups = getGroups(items, groups, groupByDay, getItemGroup, getItemDate, getGroupId)\n\n const setVisibleMenuRef = useRef<Record<string, Function>>({})\n const listRef = useRef<HTMLDivElement>(null)\n\n const closeAllMenu = useCallback(() => {\n for (const key in setVisibleMenuRef.current) {\n if (Object.prototype.hasOwnProperty.call(setVisibleMenuRef.current, key)) {\n setVisibleMenuRef.current[key](false)\n }\n }\n }, [])\n\n useEffect(() => {\n listRef.current?.addEventListener('scroll', closeAllMenu, { passive: true })\n\n return () => listRef.current?.removeEventListener('scroll', closeAllMenu)\n }, [listRef.current])\n\n const elementZIndex = typeof props.style?.zIndex === 'number' ? props.style.zIndex + 1 : undefined\n\n return (\n <div {...otherProps} ref={ref} className={cnNotificationsList(null, [className])}>\n {(title || actions) && (\n <div className={cnNotificationsList('Header')}>\n <Text className={cnNotificationsList('HeaderItem')} size=\"xl\" truncate>\n {title}\n </Text>\n {actions?.length && (\n <NotificationsActions\n className={cnNotificationsList('HeaderItem')}\n items={actions}\n getItemIcon={getActionIcon}\n getItemOnClick={getActionOnClick}\n getItemLabel={getActionLabel}\n style={{ zIndex: elementZIndex }}\n />\n )}\n {onClose && (\n <Button\n className={cnNotificationsList('HeaderItem')}\n size=\"s\"\n view=\"clear\"\n iconLeft={IconClose}\n onClick={onClose}\n />\n )}\n </div>\n )}\n <div ref={listRef} className={cnNotificationsList('List')}>\n {resultGroups.map((group, groupIndex) => {\n const groupLabel = groupByDay\n ? groupLabelFormat(Number(group.key))\n : group.group && getGroupLabel(group.group)\n return (\n <Fragment key={cnNotificationsList('Group', { groupIndex })}>\n {groupLabel && (\n <Text\n className={cnNotificationsList('GroupLabel')}\n key={cnNotificationsList('GroupLabel', { groupIndex })}\n view=\"secondary\"\n transform=\"uppercase\"\n weight=\"bold\"\n size=\"2xs\"\n >\n {groupLabel}\n </Text>\n )}\n {group.items.map((item, itemIndex) => {\n return (\n <NotificationCard\n className={cnNotificationsList('Item')}\n key={cnNotificationsList('Item', { groupIndex, itemIndex })}\n title={getItemLabel(item)}\n description={getItemDescription(item)}\n imageUrl={getItemImage(item)}\n read={getItemRead(item)}\n date={getItemDate(item)}\n dateFormat={itemDateFormat}\n badges={getItemBadges(item)}\n actions={getItemActions(item)}\n view={getItemView(item)}\n setVisibleMenu={value => {\n setVisibleMenuRef.current[`${groupIndex}-${itemIndex}`] = value\n }}\n style={{ zIndex: elementZIndex }}\n />\n )\n })}\n </Fragment>\n )\n })}\n </div>\n </div>\n )\n}\n\nexport const NotificationsList = forwardRef(NotificationsListRender) as NotificationsListComponent\n\nexport * from './types'\n"],"file":"NotificationsList.js"}
|