@consta/header 2.0.0 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Navbar/index.d.ts +1 -0
- package/Navbar/index.js +1 -0
- package/__internal__/src/components/ButtonMenu/types.d.ts +1 -2
- package/__internal__/src/components/ButtonMenu/types.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenu.js +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenu.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuBannerBar/MegaMenuBannerBar.js +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuBannerBar/MegaMenuBannerBar.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuBannerBar/MegaMenuBannerBarItem/MegaMenuBannerBarItem.js +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuBannerBar/MegaMenuBannerBarItem/MegaMenuBannerBarItem.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuBannerBar/types.d.ts +8 -8
- package/__internal__/src/components/MegaMenu/MegaMenuBannerBar/types.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuGlobal/MegaMenuGlobal.js +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuGlobal/MegaMenuGlobal.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuGlobal/MegaMenuGlobalGroup/MegaMenuGlobalGroup.js +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuGlobal/MegaMenuGlobalGroup/MegaMenuGlobalGroup.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuGlobal/types.d.ts +9 -10
- package/__internal__/src/components/MegaMenu/MegaMenuGlobal/types.js.map +1 -1
- package/__internal__/src/components/MegaMenu/MegaMenuNavBar/types.d.ts +8 -8
- package/__internal__/src/components/MegaMenu/MegaMenuNavBar/types.js.map +1 -1
- package/__internal__/src/components/MegaMenu/types.d.ts +6 -6
- package/__internal__/src/components/MegaMenu/types.js.map +1 -1
- package/__internal__/src/components/Menu/Menu.js +1 -1
- package/__internal__/src/components/Menu/Menu.js.map +1 -1
- package/__internal__/src/components/Menu/types.d.ts +1 -2
- package/__internal__/src/components/Menu/types.js.map +1 -1
- package/__internal__/src/components/Navbar/Navbar.d.ts +2 -0
- package/__internal__/src/components/Navbar/Navbar.js +2 -0
- package/__internal__/src/components/Navbar/Navbar.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarArrow/NavbarArrow.d.ts +5 -0
- package/__internal__/src/components/Navbar/NavbarArrow/NavbarArrow.js +2 -0
- package/__internal__/src/components/Navbar/NavbarArrow/NavbarArrow.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarArrow/index.d.ts +1 -0
- package/__internal__/src/components/Navbar/NavbarArrow/index.js +2 -0
- package/__internal__/src/components/Navbar/NavbarArrow/index.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarItem/NavbarDrawer.d.ts +2 -0
- package/__internal__/src/components/Navbar/NavbarItem/NavbarDrawer.js +2 -0
- package/__internal__/src/components/Navbar/NavbarItem/NavbarDrawer.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarItem/NavbarItem.css +1 -0
- package/__internal__/src/components/Navbar/NavbarItem/NavbarItem.d.ts +3 -0
- package/__internal__/src/components/Navbar/NavbarItem/NavbarItem.js +2 -0
- package/__internal__/src/components/Navbar/NavbarItem/NavbarItem.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarItem/index.d.ts +1 -0
- package/__internal__/src/components/Navbar/NavbarItem/index.js +2 -0
- package/__internal__/src/components/Navbar/NavbarItem/index.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverLeftAnimate/NavbarMixDriverLeftAnimate.css +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverLeftAnimate/NavbarMixDriverLeftAnimate.d.ts +8 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverLeftAnimate/NavbarMixDriverLeftAnimate.js +2 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverLeftAnimate/NavbarMixDriverLeftAnimate.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverLeftAnimate/index.d.ts +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverLeftAnimate/index.js +2 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverLeftAnimate/index.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverRightAnimate/NavbarMixDriverRightAnimate.css +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverRightAnimate/NavbarMixDriverRightAnimate.d.ts +8 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverRightAnimate/NavbarMixDriverRightAnimate.js +2 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverRightAnimate/NavbarMixDriverRightAnimate.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverRightAnimate/index.d.ts +1 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverRightAnimate/index.js +2 -0
- package/__internal__/src/components/Navbar/NavbarMixDriverRightAnimate/index.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarMixFadeAnimate/NavbarMixFadeAnimate.css +1 -0
- package/__internal__/src/components/Navbar/NavbarMixFadeAnimate/NavbarMixFadeAnimate.d.ts +8 -0
- package/__internal__/src/components/Navbar/NavbarMixFadeAnimate/NavbarMixFadeAnimate.js +2 -0
- package/__internal__/src/components/Navbar/NavbarMixFadeAnimate/NavbarMixFadeAnimate.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarMixFadeAnimate/index.d.ts +1 -0
- package/__internal__/src/components/Navbar/NavbarMixFadeAnimate/index.js +2 -0
- package/__internal__/src/components/Navbar/NavbarMixFadeAnimate/index.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarRail/NavbarRail.d.ts +2 -0
- package/__internal__/src/components/Navbar/NavbarRail/NavbarRail.js +2 -0
- package/__internal__/src/components/Navbar/NavbarRail/NavbarRail.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarRail/index.d.ts +1 -0
- package/__internal__/src/components/Navbar/NavbarRail/index.js +2 -0
- package/__internal__/src/components/Navbar/NavbarRail/index.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarRailItem/NavbarRailItem.css +1 -0
- package/__internal__/src/components/Navbar/NavbarRailItem/NavbarRailItem.d.ts +6 -0
- package/__internal__/src/components/Navbar/NavbarRailItem/NavbarRailItem.js +2 -0
- package/__internal__/src/components/Navbar/NavbarRailItem/NavbarRailItem.js.map +1 -0
- package/__internal__/src/components/Navbar/NavbarRailItem/index.d.ts +1 -0
- package/__internal__/src/components/Navbar/NavbarRailItem/index.js +2 -0
- package/__internal__/src/components/Navbar/NavbarRailItem/index.js.map +1 -0
- package/__internal__/src/components/Navbar/helpers.d.ts +70 -0
- package/__internal__/src/components/Navbar/helpers.js +2 -0
- package/__internal__/src/components/Navbar/helpers.js.map +1 -0
- package/__internal__/src/components/Navbar/index.d.ts +6 -0
- package/__internal__/src/components/Navbar/index.js +2 -0
- package/__internal__/src/components/Navbar/index.js.map +1 -0
- package/__internal__/src/components/Navbar/types.d.ts +138 -0
- package/__internal__/src/components/Navbar/types.js +2 -0
- package/__internal__/src/components/Navbar/types.js.map +1 -0
- package/__internal__/src/components/Notifications/NotificationsActions/NotificationsActions.js +1 -1
- package/__internal__/src/components/Notifications/NotificationsActions/NotificationsActions.js.map +1 -1
- package/__internal__/src/components/Notifications/NotificationsActions/types.d.ts +1 -2
- package/__internal__/src/components/Notifications/NotificationsActions/types.js.map +1 -1
- package/__internal__/src/components/Notifications/NotificationsItem/NotificationsItem.css +1 -1
- package/__internal__/src/components/Notifications/NotificationsItem/NotificationsItem.d.ts +1 -1
- package/__internal__/src/components/Notifications/NotificationsItem/NotificationsItem.js +1 -1
- package/__internal__/src/components/Notifications/NotificationsItem/NotificationsItem.js.map +1 -1
- package/__internal__/src/components/Notifications/NotificationsItemFooter/NotificationsItemFooter.css +1 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/NotificationsItemFooter.d.ts +4 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/NotificationsItemFooter.js +2 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/NotificationsItemFooter.js.map +1 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/helpers.js.map +1 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/index.d.ts +1 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/index.js +2 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/index.js.map +1 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/types.d.ts +12 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/types.js +2 -0
- package/__internal__/src/components/Notifications/NotificationsItemFooter/types.js.map +1 -0
- package/__internal__/src/components/Notifications/NotificationsList/NotificationsList.js +1 -1
- package/__internal__/src/components/Notifications/NotificationsList/NotificationsList.js.map +1 -1
- package/__internal__/src/components/Notifications/NotificationsList/helpers.d.ts +1 -1
- package/__internal__/src/components/PopoverButton/PopoverButton.d.ts +1 -1
- package/__internal__/src/components/SelectMenu/SelectMenu.js +1 -1
- package/__internal__/src/components/SelectMenu/SelectMenu.js.map +1 -1
- package/__internal__/src/components/SelectMenu/types.d.ts +1 -2
- package/__internal__/src/components/SelectMenu/types.js.map +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.js +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.js.map +1 -1
- package/__internal__/src/components/TileMenu/TileMenuItem/TileMenuItem.js +1 -1
- package/__internal__/src/components/TileMenu/TileMenuItem/TileMenuItem.js.map +1 -1
- package/__internal__/src/components/TileMenu/TileMenuList/types.d.ts +1 -2
- package/__internal__/src/components/TileMenu/TileMenuList/types.js.map +1 -1
- package/__internal__/src/components/VerticalMenu/VerticalMenuItem/VerticalMenuItem.js +1 -1
- package/__internal__/src/components/VerticalMenu/VerticalMenuItem/VerticalMenuItem.js.map +1 -1
- package/__internal__/src/components/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.js +1 -1
- package/__internal__/src/components/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.js.map +1 -1
- package/__internal__/src/components/VerticalMenu/types.d.ts +1 -2
- package/__internal__/src/components/VerticalMenu/types.js.map +1 -1
- package/__internal__/src/helpers/getItemClick.d.ts +1 -2
- package/__internal__/src/helpers/getItemClick.js +1 -1
- package/__internal__/src/helpers/getItemClick.js.map +1 -1
- package/__internal__/src/utils/bem.d.ts +3 -0
- package/__internal__/src/utils/bem.js +1 -1
- package/__internal__/src/utils/bem.js.map +1 -1
- package/package.json +3 -3
- package/__internal__/src/components/Notifications/NotificationsItem/helpers.js.map +0 -1
- /package/__internal__/src/components/Notifications/{NotificationsItem → NotificationsItemFooter}/helpers.d.ts +0 -0
- /package/__internal__/src/components/Notifications/{NotificationsItem → NotificationsItemFooter}/helpers.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["items","className","getItemHref","getItemLabel","getItemOnClick","getItemTarget","onItemClick","label","onClick","getItemSubMenu","style"];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"./SelectMenu.css";import{IconSelect}from"@consta/icons/IconSelect";import{ContextMenu}from"@consta/uikit/ContextMenu";import{Text}from"@consta/uikit/Text";import{useFlag}from"@consta/uikit/useFlag";import{useForkRef}from"@consta/uikit/useForkRef";import{useMutableRef}from"@consta/uikit/useMutableRef";import React,{forwardRef,useCallback,useRef}from"react";import{getItemClick}from"../../helpers/getItemClick";import{cn}from"../../utils/bem";import{withDefaultGetters}from"./helpers";export const cnSelectMenu=cn("SelectMenu");const SelectMenuRender=(a,b)=>{const c=withDefaultGetters(a),{items:d,className:e,getItemHref:f,getItemLabel:g,getItemOnClick:h,getItemTarget:i,onItemClick:j,label:k,onClick:l,getItemSubMenu:m,style:n}=c,o=_objectWithoutProperties(c,_excluded),[p,q]=useFlag(),r=useRef(null),s=useMutableRef(f),t=useMutableRef(i),u=useMutableRef(l),v=useCallback(a=>s.current(a)?"a":"span",[]),w=useCallback(a=>{const b=s.current(a),c=t.current(a);return _objectSpread(_objectSpread({},b&&{href:s.current(a)}),c&&{href:t.current(a)})},[]),x=useCallback(a=>{var b;null===(b=u.current)||void 0===b?void 0:b.call(u,a),q.toggle()},[]);return React.createElement(React.Fragment,null,React.createElement("div",Object.assign({},o,{className:cnSelectMenu(null,[e]),ref:useForkRef([r,b]),onClick:x,style:n}),React.createElement(Text,{className:cnSelectMenu("Label"),size:"s"},k),React.createElement("span",{className:cnSelectMenu("ArrowBox",{open:p})},React.createElement(IconSelect,{size:"xs"}))),d&&React.createElement(ContextMenu,{className:cnSelectMenu("Menu"),anchorRef:r,isOpen:p,items:d,getItemLabel:g,getItemAs:v,getItemAttributes:w,onClickOutside:q.off,onItemClick:({e:
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["items","className","getItemHref","getItemLabel","getItemOnClick","getItemTarget","onItemClick","label","onClick","getItemSubMenu","style"];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"./SelectMenu.css";import{IconSelect}from"@consta/icons/IconSelect";import{ContextMenu}from"@consta/uikit/ContextMenu";import{Text}from"@consta/uikit/Text";import{useFlag}from"@consta/uikit/useFlag";import{useForkRef}from"@consta/uikit/useForkRef";import{useMutableRef}from"@consta/uikit/useMutableRef";import React,{forwardRef,useCallback,useRef}from"react";import{getItemClick}from"../../helpers/getItemClick";import{cn}from"../../utils/bem";import{withDefaultGetters}from"./helpers";export const cnSelectMenu=cn("SelectMenu");const SelectMenuRender=(a,b)=>{const c=withDefaultGetters(a),{items:d,className:e,getItemHref:f,getItemLabel:g,getItemOnClick:h,getItemTarget:i,onItemClick:j,label:k,onClick:l,getItemSubMenu:m,style:n}=c,o=_objectWithoutProperties(c,_excluded),[p,q]=useFlag(),r=useRef(null),s=useMutableRef(f),t=useMutableRef(i),u=useMutableRef(l),v=useCallback(a=>s.current(a)?"a":"span",[]),w=useCallback(a=>{const b=s.current(a),c=t.current(a);return _objectSpread(_objectSpread({},b&&{href:s.current(a)}),c&&{href:t.current(a)})},[]),x=useCallback(a=>{var b;null===(b=u.current)||void 0===b?void 0:b.call(u,a),q.toggle()},[]);return React.createElement(React.Fragment,null,React.createElement("div",Object.assign({},o,{className:cnSelectMenu(null,[e]),ref:useForkRef([r,b]),onClick:x,style:n}),React.createElement(Text,{className:cnSelectMenu("Label"),size:"s",view:"primary",lineHeight:"m"},k),React.createElement("span",{className:cnSelectMenu("ArrowBox",{open:p})},React.createElement(IconSelect,{size:"xs"}))),d&&React.createElement(ContextMenu,{className:cnSelectMenu("Menu"),anchorRef:r,isOpen:p,items:d,getItemLabel:g,getItemAs:v,getItemAttributes:w,onClickOutside:q.off,onItemClick:(a,{e:b})=>getItemClick(a,h,j)(b),direction:"rightStartDown",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],getItemSubMenu:m,style:{zIndex:"number"==typeof(null===n||void 0===n?void 0:n.zIndex)?n.zIndex+1:"auto"}}))};export const SelectMenu=forwardRef(SelectMenuRender);export*from"./types";
|
|
2
2
|
//# sourceMappingURL=SelectMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.js","names":["IconSelect","ContextMenu","Text","useFlag","useForkRef","useMutableRef","React","forwardRef","useCallback","useRef","getItemClick","cn","withDefaultGetters","cnSelectMenu","SelectMenuRender","props","componentRef","c","items","className","getItemHref","getItemLabel","getItemOnClick","getItemTarget","onItemClick","label","onClick","onClickProp","getItemSubMenu","style","otherProps","_objectWithoutProperties","_excluded","open","setOpen","ref","getItemHrefRef","getItemTargetRef","onClickRef","getItemAs","item","current","getItemHTMLAttributes","href","target","_objectSpread","e","b","call","toggle","createElement","Fragment","Object","assign","size","anchorRef","isOpen","getItemAttributes","onClickOutside","off","direction","possibleDirections","zIndex","SelectMenu"],"sources":["../../../../../src/components/SelectMenu/SelectMenu.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport './SelectMenu.css';\n\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport { ContextMenu } from '@consta/uikit/ContextMenu';\nimport { Text } from '@consta/uikit/Text';\nimport { useFlag } from '@consta/uikit/useFlag';\nimport { useForkRef } from '@consta/uikit/useForkRef';\nimport { useMutableRef } from '@consta/uikit/useMutableRef';\nimport React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { getItemClick } from '##/helpers/getItemClick';\nimport { cn } from '##/utils/bem';\n\nimport { withDefaultGetters } from './helpers';\nimport {\n SelectMenuComponent,\n SelectMenuDefaultItem,\n SelectMenuProps,\n} from './types';\n\nexport const cnSelectMenu = cn('SelectMenu');\n\nconst SelectMenuRender = (\n props: SelectMenuProps,\n componentRef: React.Ref<HTMLDivElement>,\n) => {\n const {\n items,\n className,\n getItemHref,\n getItemLabel,\n getItemOnClick,\n getItemTarget,\n onItemClick,\n label,\n onClick: onClickProp,\n getItemSubMenu,\n style,\n ...otherProps\n } = withDefaultGetters(props);\n\n const [open, setOpen] = useFlag();\n\n const ref = useRef<HTMLDivElement>(null);\n\n const getItemHrefRef = useMutableRef(getItemHref);\n const getItemTargetRef = useMutableRef(getItemTarget);\n const onClickRef = useMutableRef(onClickProp);\n\n const getItemAs = useCallback(\n (item: SelectMenuDefaultItem) =>\n getItemHrefRef.current(item) ? 'a' : 'span',\n [],\n );\n\n const getItemHTMLAttributes = useCallback((item: SelectMenuDefaultItem) => {\n const href = getItemHrefRef.current(item);\n const target = getItemTargetRef.current(item);\n\n return {\n ...(href && { href: getItemHrefRef.current(item) }),\n ...(target && { href: getItemTargetRef.current(item) }),\n };\n }, []);\n\n const onClick = useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n onClickRef.current?.(e);\n setOpen.toggle();\n }, []);\n\n return (\n <>\n <div\n {...otherProps}\n className={cnSelectMenu(null, [className])}\n ref={useForkRef([ref, componentRef])}\n onClick={onClick}\n style={style}\n >\n <Text
|
|
1
|
+
{"version":3,"file":"SelectMenu.js","names":["IconSelect","ContextMenu","Text","useFlag","useForkRef","useMutableRef","React","forwardRef","useCallback","useRef","getItemClick","cn","withDefaultGetters","cnSelectMenu","SelectMenuRender","props","componentRef","c","items","className","getItemHref","getItemLabel","getItemOnClick","getItemTarget","onItemClick","label","onClick","onClickProp","getItemSubMenu","style","otherProps","_objectWithoutProperties","_excluded","open","setOpen","ref","getItemHrefRef","getItemTargetRef","onClickRef","getItemAs","item","current","getItemHTMLAttributes","href","target","_objectSpread","e","b","call","toggle","createElement","Fragment","Object","assign","size","view","lineHeight","anchorRef","isOpen","getItemAttributes","onClickOutside","off","direction","possibleDirections","zIndex","SelectMenu"],"sources":["../../../../../src/components/SelectMenu/SelectMenu.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport './SelectMenu.css';\n\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport { ContextMenu } from '@consta/uikit/ContextMenu';\nimport { Text } from '@consta/uikit/Text';\nimport { useFlag } from '@consta/uikit/useFlag';\nimport { useForkRef } from '@consta/uikit/useForkRef';\nimport { useMutableRef } from '@consta/uikit/useMutableRef';\nimport React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { getItemClick } from '##/helpers/getItemClick';\nimport { cn } from '##/utils/bem';\n\nimport { withDefaultGetters } from './helpers';\nimport {\n SelectMenuComponent,\n SelectMenuDefaultItem,\n SelectMenuProps,\n} from './types';\n\nexport const cnSelectMenu = cn('SelectMenu');\n\nconst SelectMenuRender = (\n props: SelectMenuProps,\n componentRef: React.Ref<HTMLDivElement>,\n) => {\n const {\n items,\n className,\n getItemHref,\n getItemLabel,\n getItemOnClick,\n getItemTarget,\n onItemClick,\n label,\n onClick: onClickProp,\n getItemSubMenu,\n style,\n ...otherProps\n } = withDefaultGetters(props);\n\n const [open, setOpen] = useFlag();\n\n const ref = useRef<HTMLDivElement>(null);\n\n const getItemHrefRef = useMutableRef(getItemHref);\n const getItemTargetRef = useMutableRef(getItemTarget);\n const onClickRef = useMutableRef(onClickProp);\n\n const getItemAs = useCallback(\n (item: SelectMenuDefaultItem) =>\n getItemHrefRef.current(item) ? 'a' : 'span',\n [],\n );\n\n const getItemHTMLAttributes = useCallback((item: SelectMenuDefaultItem) => {\n const href = getItemHrefRef.current(item);\n const target = getItemTargetRef.current(item);\n\n return {\n ...(href && { href: getItemHrefRef.current(item) }),\n ...(target && { href: getItemTargetRef.current(item) }),\n };\n }, []);\n\n const onClick = useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n onClickRef.current?.(e);\n setOpen.toggle();\n }, []);\n\n return (\n <>\n <div\n {...otherProps}\n className={cnSelectMenu(null, [className])}\n ref={useForkRef([ref, componentRef])}\n onClick={onClick}\n style={style}\n >\n <Text\n className={cnSelectMenu('Label')}\n size=\"s\"\n view=\"primary\"\n lineHeight=\"m\"\n >\n {label}\n </Text>\n <span className={cnSelectMenu('ArrowBox', { open })}>\n <IconSelect size=\"xs\" />\n </span>\n </div>\n {items && (\n <ContextMenu\n className={cnSelectMenu('Menu')}\n anchorRef={ref}\n isOpen={open}\n items={items}\n getItemLabel={getItemLabel}\n getItemAs={getItemAs}\n getItemAttributes={getItemHTMLAttributes}\n onClickOutside={setOpen.off}\n onItemClick={(item, { e }) =>\n getItemClick(item, getItemOnClick, onItemClick)(e)\n }\n direction=\"rightStartDown\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n getItemSubMenu={getItemSubMenu}\n style={{\n zIndex:\n typeof style?.zIndex === 'number' ? style.zIndex + 1 : 'auto',\n }}\n />\n )}\n </>\n );\n};\n\nexport const SelectMenu = forwardRef(SelectMenuRender) as SelectMenuComponent;\n\nexport * from './types';\n"],"mappings":"u5BAEA,yBAEA,OAASA,UAAU,KAAQ,0BAA0B,CACrD,OAASC,WAAW,KAAQ,2BAA2B,CACvD,OAASC,IAAI,KAAQ,oBAAoB,CACzC,OAASC,OAAO,KAAQ,uBAAuB,CAC/C,OAASC,UAAU,KAAQ,0BAA0B,CACrD,OAASC,aAAa,KAAQ,6BAA6B,CAC3D,MAAO,CAAAC,KAAK,EAAIC,UAAU,CAAEC,WAAW,CAAEC,MAAM,KAAQ,OAAO,CAE9D,OAASC,YAAY,kCACrB,OAASC,EAAE,uBAEX,OAASC,kBAAkB,iBAO3B,MAAO,MAAM,CAAAC,YAAY,CAAGF,EAAE,CAAC,YAAY,CAAC,CAE5C,KAAM,CAAAG,gBAAgB,CAAGA,CACvBC,CAAsB,CACtBC,CAAuC,GACpC,OAAAC,CAAA,CAcCL,kBAAkB,CAACG,CAAK,CAAC,CAbvB,CACJG,KAAK,CAALA,CAAK,CACLC,SA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AC8B,CAAI,CAAElB,CAAc,CAAEE,CAAW,CAAC,CAACsB,CAAC,CAClD,CACDgB,SAAS,CAAC,gBAAgB,CAC1BC,kBAAkB,CAAE,CAClB,eAAe,CACf,aAAa,CACb,gBAAgB,CAChB,cAAc,CACd,CACFnC,cAAc,CAAEA,CAAe,CAC/BC,KAAK,CAAE,CACLmC,MAAM,CACqB,QAAQ,EAAjC,cAAOnC,CAAK,WAALA,CAAK,QAALA,CAAK,CAAEmC,MAAM,CAAa,CAAGnC,CAAK,CAACmC,MAAM,CAAG,CAAC,CAAG,MAC3D,CAAE,CACH,CAEH,CAEN,CAAC,CAED,MAAO,MAAM,CAAAC,UAAU,CAAG1D,UAAU,CAACO,gBAAgB,CAAwB,CAE7E"}
|
|
@@ -11,9 +11,8 @@ export type SelectMenuPropGetItemLabel<ITEM> = (item: ITEM) => string;
|
|
|
11
11
|
export type SelectMenuPropGetItemHref<ITEM> = (item: ITEM) => string | undefined;
|
|
12
12
|
export type SelectMenuPropGetItemTarget<ITEM> = (item: ITEM) => string | undefined;
|
|
13
13
|
export type SelectMenuPropGetItemOnClick<ITEM> = (item: ITEM) => React.EventHandler<React.MouseEvent> | undefined;
|
|
14
|
-
export type SelectMenuPropOnItemClick<ITEM> = (props: {
|
|
14
|
+
export type SelectMenuPropOnItemClick<ITEM> = (item: ITEM, props: {
|
|
15
15
|
e: React.MouseEvent;
|
|
16
|
-
item: ITEM;
|
|
17
16
|
}) => void;
|
|
18
17
|
export type SelectMenuPropGetItemSubMenu<ITEM> = (item: ITEM) => ITEM[] | undefined;
|
|
19
18
|
export type SelectMenuProps<ITEM = SelectMenuDefaultItem> = PropsWithHTMLAttributesAndRef<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/SelectMenu/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type SelectMenuDefaultItem = {\n label: string;\n href?: string;\n target?: string;\n onClick?: React.EventHandler<React.MouseEvent>;\n subMenu?: SelectMenuDefaultItem[];\n};\n\nexport type SelectMenuPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type SelectMenuPropGetItemHref<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type SelectMenuPropGetItemTarget<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type SelectMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type SelectMenuPropOnItemClick<ITEM> = (props: {\n
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/SelectMenu/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type SelectMenuDefaultItem = {\n label: string;\n href?: string;\n target?: string;\n onClick?: React.EventHandler<React.MouseEvent>;\n subMenu?: SelectMenuDefaultItem[];\n};\n\nexport type SelectMenuPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type SelectMenuPropGetItemHref<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type SelectMenuPropGetItemTarget<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type SelectMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type SelectMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n props: {\n e: React.MouseEvent;\n },\n) => void;\nexport type SelectMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type SelectMenuProps<ITEM = SelectMenuDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n onItemClick?: SelectMenuPropOnItemClick<ITEM>;\n getItemHref?: SelectMenuPropGetItemHref<ITEM>;\n getItemLabel?: SelectMenuPropGetItemLabel<ITEM>;\n getItemTarget?: SelectMenuPropGetItemTarget<ITEM>;\n getItemOnClick?: SelectMenuPropGetItemOnClick<ITEM>;\n getItemSubMenu?: SelectMenuPropGetItemSubMenu<ITEM>;\n label: string;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: SelectMenuDefaultItem['label'] }\n ? {}\n : { getItemLabel: SelectMenuPropGetItemLabel<ITEM> });\n\nexport type SelectMenuComponent = <ITEM = SelectMenuDefaultItem>(\n props: SelectMenuProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["children","title","onClose","className"];import"./Sidebar.css";import{IconClose}from"@consta/icons/IconClose";import{Button}from"@consta/uikit/Button";import{cnMixSpace}from"@consta/uikit/MixSpace";import{Sidebar as ConstaSidebar}from"@consta/uikit/Sidebar";import{Text}from"@consta/uikit/Text";import{useBreakpoints}from"@consta/uikit/useBreakpoints";import React from"react";import{cn}from"../../utils/bem";const cnSidebar=cn("Sidebar");export const Sidebar=a=>{const{children:b,title:c,onClose:d,className:e}=a,f=_objectWithoutProperties(a,_excluded),{bigScreen:g}=useBreakpoints({bigScreen:520});return React.createElement(ConstaSidebar,Object.assign({},f,{position:g?"right":"bottom",size:g?"l":"full",className:cnSidebar(null,[e])}),(c||d)&&React.createElement("div",{className:cnSidebar("Header",[cnMixSpace({pV:"l",pH:"xl"})])},React.createElement(Text,{className:cnSidebar("Title"),size:"xl",truncate:!0},c),d&&React.createElement(Button,{size:"s",view:"clear",iconLeft:IconClose,onClick:d})),b)};
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["children","title","onClose","className"];import"./Sidebar.css";import{IconClose}from"@consta/icons/IconClose";import{Button}from"@consta/uikit/Button";import{cnMixSpace}from"@consta/uikit/MixSpace";import{Sidebar as ConstaSidebar}from"@consta/uikit/Sidebar";import{Text}from"@consta/uikit/Text";import{useBreakpoints}from"@consta/uikit/useBreakpoints";import React from"react";import{cn}from"../../utils/bem";const cnSidebar=cn("Sidebar");export const Sidebar=a=>{const{children:b,title:c,onClose:d,className:e}=a,f=_objectWithoutProperties(a,_excluded),{bigScreen:g}=useBreakpoints({map:{bigScreen:520}});return React.createElement(ConstaSidebar,Object.assign({},f,{position:g?"right":"bottom",size:g?"l":"full",className:cnSidebar(null,[e])}),(c||d)&&React.createElement("div",{className:cnSidebar("Header",[cnMixSpace({pV:"l",pH:"xl"})])},React.createElement(Text,{className:cnSidebar("Title"),size:"xl",truncate:!0,view:"primary",lineHeight:"m"},c),d&&React.createElement(Button,{size:"s",view:"clear",iconLeft:IconClose,onClick:d})),b)};
|
|
2
2
|
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.js","names":["IconClose","Button","cnMixSpace","Sidebar","ConstaSidebar","Text","useBreakpoints","React","cn","cnSidebar","props","children","title","onClose","className","otherProps","_objectWithoutProperties","_excluded","bigScreen","createElement","Object","assign","position","size","pV","pH","truncate","view","iconLeft","onClick"],"sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import './Sidebar.css';\n\nimport { IconClose } from '@consta/icons/IconClose';\nimport { Button } from '@consta/uikit/Button';\nimport { cnMixSpace } from '@consta/uikit/MixSpace';\nimport { Sidebar as ConstaSidebar } from '@consta/uikit/Sidebar';\nimport { Text } from '@consta/uikit/Text';\nimport { useBreakpoints } from '@consta/uikit/useBreakpoints';\nimport React from 'react';\n\nimport { cn } from '##/utils/bem';\n\ntype SidebarProps = Omit<\n React.ComponentProps<typeof ConstaSidebar>,\n 'position' | 'onClose'\n> & {\n title?: string;\n onClose?: React.EventHandler<React.MouseEvent>;\n};\n\nconst cnSidebar = cn('Sidebar');\n\nexport const Sidebar = (props: SidebarProps) => {\n const { children, title, onClose, className, ...otherProps } = props;\n const { bigScreen } = useBreakpoints({ bigScreen: 520 });\n return (\n <ConstaSidebar\n {...otherProps}\n position={bigScreen ? 'right' : 'bottom'}\n size={bigScreen ? 'l' : 'full'}\n className={cnSidebar(null, [className])}\n >\n {(title || onClose) && (\n <div\n className={cnSidebar('Header', [cnMixSpace({ pV: 'l', pH: 'xl' })])}\n >\n <Text
|
|
1
|
+
{"version":3,"file":"Sidebar.js","names":["IconClose","Button","cnMixSpace","Sidebar","ConstaSidebar","Text","useBreakpoints","React","cn","cnSidebar","props","children","title","onClose","className","otherProps","_objectWithoutProperties","_excluded","bigScreen","map","createElement","Object","assign","position","size","pV","pH","truncate","view","lineHeight","iconLeft","onClick"],"sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import './Sidebar.css';\n\nimport { IconClose } from '@consta/icons/IconClose';\nimport { Button } from '@consta/uikit/Button';\nimport { cnMixSpace } from '@consta/uikit/MixSpace';\nimport { Sidebar as ConstaSidebar } from '@consta/uikit/Sidebar';\nimport { Text } from '@consta/uikit/Text';\nimport { useBreakpoints } from '@consta/uikit/useBreakpoints';\nimport React from 'react';\n\nimport { cn } from '##/utils/bem';\n\ntype SidebarProps = Omit<\n React.ComponentProps<typeof ConstaSidebar>,\n 'position' | 'onClose'\n> & {\n title?: string;\n onClose?: React.EventHandler<React.MouseEvent>;\n};\n\nconst cnSidebar = cn('Sidebar');\n\nexport const Sidebar = (props: SidebarProps) => {\n const { children, title, onClose, className, ...otherProps } = props;\n const { bigScreen } = useBreakpoints({ map: { bigScreen: 520 } });\n return (\n <ConstaSidebar\n {...otherProps}\n position={bigScreen ? 'right' : 'bottom'}\n size={bigScreen ? 'l' : 'full'}\n className={cnSidebar(null, [className])}\n >\n {(title || onClose) && (\n <div\n className={cnSidebar('Header', [cnMixSpace({ pV: 'l', pH: 'xl' })])}\n >\n <Text\n className={cnSidebar('Title')}\n size=\"xl\"\n truncate\n view=\"primary\"\n lineHeight=\"m\"\n >\n {title}\n </Text>\n {onClose && (\n <Button\n size=\"s\"\n view=\"clear\"\n iconLeft={IconClose}\n onClick={onClose}\n />\n )}\n </div>\n )}\n\n {children}\n </ConstaSidebar>\n );\n};\n"],"mappings":"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,CAAC,OAAO,CAAE,CAC9Be,IAAI,CAAC,IAAI,CACTG,QAAQ,IACRC,IAAI,CAAC,SAAS,CACdC,UAAU,CAAC,GAAG,EAEbjB,CACG,CAAC,CACNC,CAAO,EACNN,KAAA,CAAAa,aAAA,CAACnB,MAAM,EACLuB,IAAI,CAAC,GAAG,CACRI,IAAI,CAAC,OAAO,CACZE,QAAQ,CAAE9B,SAAU,CACpB+B,OAAO,CAAElB,CAAQ,CAClB,CAEA,CACN,CAEAF,CACY,CAEnB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["image","className","title","description","view","as"];import"./TileMenuItem.css";import{forwardRefWithAs}from"@consta/uikit/__internal__/src/utils/types/PropsWithAsAttributes";import{cnMixSpace}from"@consta/uikit/MixSpace";import{Text}from"@consta/uikit/Text";import React from"react";import{cn}from"../../../utils/bem";const cnTileMenuItem=cn("TileMenuItem"),renderImage=(a,b)=>{if("string"==typeof a)return React.createElement("img",{src:a,alt:b});return React.createElement(a,null)};export const TileMenuItem=forwardRefWithAs((a,b)=>{const{image:c,className:d,title:e,description:f,view:g="default",as:h="div"}=a,i=_objectWithoutProperties(a,_excluded);return React.createElement(h,Object.assign({},i,{ref:b,className:cnTileMenuItem({view:g},["card"===g?cnMixSpace({p:"s",pT:"m"}):cnMixSpace({pV:"s"}),d])}),c&&React.createElement("div",{className:cnTileMenuItem("ImageWrapper")},renderImage(c,e)),React.createElement("div",{className:cnTileMenuItem("ContentWrapper")},React.createElement(Text,{weight:"default"===g?"bold":void 0,align:"card"===g?"center":void 0,className:cnTileMenuItem("Title",["default"===g?cnMixSpace({pB:"2xs"}):void 0])},e),f&&"default"===g&&React.createElement(Text,{view:"secondary",className:cnTileMenuItem("Description")},f)))});export*from"./types";
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["image","className","title","description","view","as"];import"./TileMenuItem.css";import{forwardRefWithAs}from"@consta/uikit/__internal__/src/utils/types/PropsWithAsAttributes";import{cnMixSpace}from"@consta/uikit/MixSpace";import{Text}from"@consta/uikit/Text";import React from"react";import{cn}from"../../../utils/bem";const cnTileMenuItem=cn("TileMenuItem"),renderImage=(a,b)=>{if("string"==typeof a)return React.createElement("img",{src:a,alt:b});return React.createElement(a,null)};export const TileMenuItem=forwardRefWithAs((a,b)=>{const{image:c,className:d,title:e,description:f,view:g="default",as:h="div"}=a,i=_objectWithoutProperties(a,_excluded);return React.createElement(h,Object.assign({},i,{ref:b,className:cnTileMenuItem({view:g},["card"===g?cnMixSpace({p:"s",pT:"m"}):cnMixSpace({pV:"s"}),d])}),c&&React.createElement("div",{className:cnTileMenuItem("ImageWrapper")},renderImage(c,e)),React.createElement("div",{className:cnTileMenuItem("ContentWrapper")},React.createElement(Text,{weight:"default"===g?"bold":void 0,align:"card"===g?"center":void 0,className:cnTileMenuItem("Title",["default"===g?cnMixSpace({pB:"2xs"}):void 0]),view:"primary",size:"m",lineHeight:"m"},e),f&&"default"===g&&React.createElement(Text,{view:"secondary",className:cnTileMenuItem("Description"),size:"m",lineHeight:"m"},f)))});export*from"./types";
|
|
2
2
|
//# sourceMappingURL=TileMenuItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileMenuItem.js","names":["forwardRefWithAs","cnMixSpace","Text","React","cn","cnTileMenuItem","renderImage","image","title","createElement","src","alt","TileMenuItem","props","ref","className","description","view","as","otherProps","_objectWithoutProperties","_excluded","Object","assign","p","pT","pV","weight","align","pB"],"sources":["../../../../../../src/components/TileMenu/TileMenuItem/TileMenuItem.tsx"],"sourcesContent":["import './TileMenuItem.css';\n\nimport { forwardRefWithAs } from '@consta/uikit/__internal__/src/utils/types/PropsWithAsAttributes';\nimport { cnMixSpace } from '@consta/uikit/MixSpace';\nimport { Text } from '@consta/uikit/Text';\nimport React from 'react';\n\nimport { cn } from '##/utils/bem';\n\nimport { TileMenuItemProps } from './types';\n\nconst cnTileMenuItem = cn('TileMenuItem');\n\nconst renderImage = (image: string | React.FC, title: string) => {\n if (typeof image === 'string') {\n return <img src={image} alt={title} />;\n }\n const ImageComponent = image;\n return <ImageComponent />;\n};\n\nexport const TileMenuItem = forwardRefWithAs<TileMenuItemProps>(\n (props, ref) => {\n const {\n image,\n className,\n title,\n description,\n view = 'default',\n as = 'div',\n ...otherProps\n } = props;\n\n const Tag = as as string;\n\n return (\n <Tag\n {...otherProps}\n ref={ref}\n className={cnTileMenuItem({ view }, [\n view === 'card'\n ? cnMixSpace({ p: 's', pT: 'm' })\n : cnMixSpace({ pV: 's' }),\n className,\n ])}\n >\n {image && (\n <div className={cnTileMenuItem('ImageWrapper')}>\n {renderImage(image, title)}\n </div>\n )}\n <div className={cnTileMenuItem('ContentWrapper')}>\n <Text\n weight={view === 'default' ? 'bold' : undefined}\n align={view === 'card' ? 'center' : undefined}\n className={cnTileMenuItem('Title', [\n view === 'default' ? cnMixSpace({ pB: '2xs' }) : undefined,\n ])}\n >\n {title}\n </Text>\n {description && view === 'default' && (\n <Text
|
|
1
|
+
{"version":3,"file":"TileMenuItem.js","names":["forwardRefWithAs","cnMixSpace","Text","React","cn","cnTileMenuItem","renderImage","image","title","createElement","src","alt","TileMenuItem","props","ref","className","description","view","as","otherProps","_objectWithoutProperties","_excluded","Object","assign","p","pT","pV","weight","align","pB","size","lineHeight"],"sources":["../../../../../../src/components/TileMenu/TileMenuItem/TileMenuItem.tsx"],"sourcesContent":["import './TileMenuItem.css';\n\nimport { forwardRefWithAs } from '@consta/uikit/__internal__/src/utils/types/PropsWithAsAttributes';\nimport { cnMixSpace } from '@consta/uikit/MixSpace';\nimport { Text } from '@consta/uikit/Text';\nimport React from 'react';\n\nimport { cn } from '##/utils/bem';\n\nimport { TileMenuItemProps } from './types';\n\nconst cnTileMenuItem = cn('TileMenuItem');\n\nconst renderImage = (image: string | React.FC, title: string) => {\n if (typeof image === 'string') {\n return <img src={image} alt={title} />;\n }\n const ImageComponent = image;\n return <ImageComponent />;\n};\n\nexport const TileMenuItem = forwardRefWithAs<TileMenuItemProps>(\n (props, ref) => {\n const {\n image,\n className,\n title,\n description,\n view = 'default',\n as = 'div',\n ...otherProps\n } = props;\n\n const Tag = as as string;\n\n return (\n <Tag\n {...otherProps}\n ref={ref}\n className={cnTileMenuItem({ view }, [\n view === 'card'\n ? cnMixSpace({ p: 's', pT: 'm' })\n : cnMixSpace({ pV: 's' }),\n className,\n ])}\n >\n {image && (\n <div className={cnTileMenuItem('ImageWrapper')}>\n {renderImage(image, title)}\n </div>\n )}\n <div className={cnTileMenuItem('ContentWrapper')}>\n <Text\n weight={view === 'default' ? 'bold' : undefined}\n align={view === 'card' ? 'center' : undefined}\n className={cnTileMenuItem('Title', [\n view === 'default' ? cnMixSpace({ pB: '2xs' }) : undefined,\n ])}\n view=\"primary\"\n size=\"m\"\n lineHeight=\"m\"\n >\n {title}\n </Text>\n {description && view === 'default' && (\n <Text\n view=\"secondary\"\n className={cnTileMenuItem('Description')}\n size=\"m\"\n lineHeight=\"m\"\n >\n {description}\n </Text>\n )}\n </div>\n </Tag>\n );\n },\n);\n\nexport * from './types';\n"],"mappings":"6JAAA,2BAEA,OAASA,gBAAgB,KAAQ,kEAAkE,CACnG,OAASC,UAAU,KAAQ,wBAAwB,CACnD,OAASC,IAAI,KAAQ,oBAAoB,CACzC,MAAO,CAAAC,KAAK,KAAM,OAAO,CAEzB,OAASC,EAAE,0BAAuB,KAI5B,CAAAC,cAAc,CAAGD,EAAE,CAAC,cAAc,CAAC,CAEnCE,WAAW,CAAGA,CAACC,CAAwB,CAAEC,CAAa,GAAK,CAC/D,GAAqB,QAAQ,EAAzB,MAAO,CAAAD,CAAkB,CAC3B,MAAO,CAAAJ,KAAA,CAAAM,aAAA,QAAKC,GAAG,CAAEH,CAAM,CAACI,GAAG,CAAEH,CAAM,CAAE,CAAC,CAGxC,MAAO,CAAAL,KAAA,CAAAM,aAAA,CADgBF,CAAK,KACJ,CAC1B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D,CAAE,CACHZ,IAAI,CAAC,SAAS,CACda,IAAI,CAAC,GAAG,CACRC,UAAU,CAAC,GAAG,EAEbvB,CACG,CAAC,CACNQ,CAAW,EAAa,SAAS,GAAlBC,CAAkB,EAChCd,KAAA,CAAAM,aAAA,CAACP,IAAI,EACHe,IAAI,CAAC,WAAW,CAChBF,SAAS,CAAEV,cAAc,CAAC,aAAa,CAAE,CACzCyB,IAAI,CAAC,GAAG,CACRC,UAAU,CAAC,GAAG,EAEbf,CACG,CAEL,CACF,CAET,CACF,CAAC,CAED"}
|
|
@@ -19,9 +19,8 @@ export type TileMenuListPropGetItemLabel<ITEM> = (item: ITEM) => string;
|
|
|
19
19
|
export type TileMenuListPropGetItemDescription<ITEM> = (item: ITEM) => string | undefined;
|
|
20
20
|
export type TileMenuListPropGetItemHref<ITEM> = (item: ITEM) => string | undefined;
|
|
21
21
|
export type TileMenuListPropGetItemOnClick<ITEM> = (item: ITEM) => React.MouseEventHandler | undefined;
|
|
22
|
-
export type TileMenuListPropOnItemClick<ITEM> = (props: {
|
|
22
|
+
export type TileMenuListPropOnItemClick<ITEM> = (item: ITEM, props: {
|
|
23
23
|
e: React.MouseEvent;
|
|
24
|
-
item: ITEM;
|
|
25
24
|
}) => void;
|
|
26
25
|
export type TileMenuListCommonProps<ITEM> = {
|
|
27
26
|
view?: TileMenuListPropView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["tileMenuListPropView","tileMenuListPropViewDefault"],"sources":["../../../../../../src/components/TileMenu/TileMenuList/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport const tileMenuListPropView = ['lines', 'twoLines', 'cards'] as const;\nexport type TileMenuListPropView = (typeof tileMenuListPropView)[number];\nexport const tileMenuListPropViewDefault: TileMenuListPropView =\n tileMenuListPropView[0];\n\nexport type TileMenuListDefaultItem = {\n label: string;\n description?: string;\n image?: string;\n} & (\n | {\n href: string;\n onClick?: React.MouseEventHandler<HTMLAnchorElement>;\n }\n | { href?: undefined; onClick?: React.MouseEventHandler<HTMLDivElement> }\n);\n\nexport type TileMenuListPropGetItemImage<ITEM> = (\n item: ITEM,\n) => string | React.FC | undefined;\nexport type TileMenuListPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type TileMenuListPropGetItemDescription<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type TileMenuListPropGetItemHref<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type TileMenuListPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\nexport type TileMenuListPropOnItemClick<ITEM> = (props: {\n
|
|
1
|
+
{"version":3,"file":"types.js","names":["tileMenuListPropView","tileMenuListPropViewDefault"],"sources":["../../../../../../src/components/TileMenu/TileMenuList/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport const tileMenuListPropView = ['lines', 'twoLines', 'cards'] as const;\nexport type TileMenuListPropView = (typeof tileMenuListPropView)[number];\nexport const tileMenuListPropViewDefault: TileMenuListPropView =\n tileMenuListPropView[0];\n\nexport type TileMenuListDefaultItem = {\n label: string;\n description?: string;\n image?: string;\n} & (\n | {\n href: string;\n onClick?: React.MouseEventHandler<HTMLAnchorElement>;\n }\n | { href?: undefined; onClick?: React.MouseEventHandler<HTMLDivElement> }\n);\n\nexport type TileMenuListPropGetItemImage<ITEM> = (\n item: ITEM,\n) => string | React.FC | undefined;\nexport type TileMenuListPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type TileMenuListPropGetItemDescription<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type TileMenuListPropGetItemHref<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type TileMenuListPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\nexport type TileMenuListPropOnItemClick<ITEM> = (\n item: ITEM,\n props: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type TileMenuListCommonProps<ITEM> = {\n view?: TileMenuListPropView;\n items: ITEM[];\n onItemClick?: TileMenuListPropOnItemClick<ITEM>;\n getItemImage?: TileMenuListPropGetItemImage<ITEM>;\n getItemLabel?: TileMenuListPropGetItemLabel<ITEM>;\n getItemDescription?: TileMenuListPropGetItemDescription<ITEM>;\n getItemHref?: TileMenuListPropGetItemHref<ITEM>;\n getItemOnClick?: TileMenuListPropGetItemOnClick<ITEM>;\n};\n\nexport type TileMenuListProps<ITEM = TileMenuListDefaultItem> =\n PropsWithHTMLAttributesAndRef<TileMenuListCommonProps<ITEM>, HTMLDivElement> &\n TileMenuListCommonProps<ITEM> &\n (ITEM extends { label: TileMenuListDefaultItem['label'] }\n ? {}\n : { getItemLabel: TileMenuListPropGetItemLabel<ITEM> });\n\nexport type TileMenuListComponent = <ITEM = TileMenuListDefaultItem>(\n props: TileMenuListProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":"AAEA,MAAO,MAAM,CAAAA,oBAAoB,CAAG,CAAC,OAAO,CAAE,UAAU,CAAE,OAAO,CAAU,CAE3E,MAAO,MAAM,CAAAC,2BAAiD,CAC5DD,oBAAoB,CAAC,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["className","label","href","target","active","onClick","withSubMenu"];import"./VerticalMenuItem.css";import{IconArrowRight}from"@consta/icons/IconArrowRight";import{Text}from"@consta/uikit/Text";import React from"react";import{cn}from"../../../utils/bem";export const cnVerticalMenuItem=cn("VerticalMenuItem");export const VerticalMenuItem=a=>{const{className:b,label:c,href:d,target:e,active:f,onClick:g,withSubMenu:h}=a,i=_objectWithoutProperties(a,_excluded),j=d?{as:"a",href:d,target:e}:{as:"span"};return React.createElement(Text,Object.assign({},i,j,{className:cnVerticalMenuItem({active:f},[b]),onClick:g}),c,h&&React.createElement(IconArrowRight,{className:cnVerticalMenuItem("Icon"),size:"xs"}))};
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["className","label","href","target","active","onClick","withSubMenu"];import"./VerticalMenuItem.css";import{IconArrowRight}from"@consta/icons/IconArrowRight";import{Text}from"@consta/uikit/Text";import React from"react";import{cn}from"../../../utils/bem";export const cnVerticalMenuItem=cn("VerticalMenuItem");export const VerticalMenuItem=a=>{const{className:b,label:c,href:d,target:e,active:f,onClick:g,withSubMenu:h}=a,i=_objectWithoutProperties(a,_excluded),j=d?{as:"a",href:d,target:e}:{as:"span"};return React.createElement(Text,Object.assign({},i,j,{className:cnVerticalMenuItem({active:f},[b]),onClick:g,view:"primary",size:"m",lineHeight:"m"}),c,h&&React.createElement(IconArrowRight,{className:cnVerticalMenuItem("Icon"),size:"xs"}))};
|
|
2
2
|
//# sourceMappingURL=VerticalMenuItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalMenuItem.js","names":["IconArrowRight","Text","React","cn","cnVerticalMenuItem","VerticalMenuItem","props","className","label","href","target","active","onClick","withSubMenu","otherProps","_objectWithoutProperties","_excluded","propsLink","as","createElement","Object","assign","size"],"sources":["../../../../../../src/components/VerticalMenu/VerticalMenuItem/VerticalMenuItem.tsx"],"sourcesContent":["import './VerticalMenuItem.css';\n\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport { Text } from '@consta/uikit/Text';\nimport React from 'react';\n\nimport { cn } from '##/utils/bem';\n\nimport { VerticalMenuItemComponent } from '../types';\n\nexport const cnVerticalMenuItem = cn('VerticalMenuItem');\n\nexport const VerticalMenuItem: VerticalMenuItemComponent = (props) => {\n const {\n className,\n label,\n href,\n target,\n active,\n onClick,\n withSubMenu,\n ...otherProps\n } = props;\n\n const propsLink = href\n ? ({\n as: 'a',\n href,\n target,\n } as const)\n : ({\n as: 'span',\n } as const);\n\n return (\n <Text\n {...otherProps}\n {...propsLink}\n className={cnVerticalMenuItem({ active }, [className])}\n onClick={onClick}\n >\n {label}\n {withSubMenu && (\n <IconArrowRight className={cnVerticalMenuItem('Icon')} size=\"xs\" />\n )}\n </Text>\n );\n};\n"],"mappings":"4KAAA,+BAEA,OAASA,cAAc,KAAQ,8BAA8B,CAC7D,OAASC,IAAI,KAAQ,oBAAoB,CACzC,MAAO,CAAAC,KAAK,KAAM,OAAO,CAEzB,OAASC,EAAE,0BAIX,MAAO,MAAM,CAAAC,kBAAkB,CAAGD,EAAE,CAAC,kBAAkB,CAAC,CAExD,MAAO,MAAM,CAAAE,gBAA2C,CAAIC,CAAK,EAAK,MAC9D,CACJC,SAAS,CAATA,CAAS,CACTC,KAAK,CAALA,CAAK,CACLC,IAAI,CAAJA,CAAI,CACJC,MAAM,CAANA,CAAM,CACNC,MAAM,CAANA,CAAM,CACNC,OAAO,CAAPA,CAAO,CACPC,WAAW,CAAXA,CAEF,CAAC,CAAGP,CAAK,CADJQ,CAAU,CAAAC,wBAAA,CACXT,CAAK,CAAAU,SAAA,EAEHC,CAAS,CAAGR,CAAI,CACjB,CACCS,EAAE,CAAE,GAAG,CACPT,IAAI,CAAJA,CAAI,CACJC,MAAM,CAANA,CACF,CAAC,CACA,CACCQ,EAAE,CAAE,MACN,CAAW,CAEf,MACE,CAAAhB,KAAA,CAAAiB,aAAA,CAAClB,IAAI,CAAAmB,MAAA,CAAAC,MAAA,IACCP,CAAU,CACVG,CAAS,EACbV,SAAS,CAAEH,kBAAkB,CAAC,CAAEO,MAAM,CAANA,CAAO,CAAC,CAAE,CAACJ,CAAS,CAAC,CAAE,CACvDK,OAAO,CAAEA,CAAQ,
|
|
1
|
+
{"version":3,"file":"VerticalMenuItem.js","names":["IconArrowRight","Text","React","cn","cnVerticalMenuItem","VerticalMenuItem","props","className","label","href","target","active","onClick","withSubMenu","otherProps","_objectWithoutProperties","_excluded","propsLink","as","createElement","Object","assign","view","size","lineHeight"],"sources":["../../../../../../src/components/VerticalMenu/VerticalMenuItem/VerticalMenuItem.tsx"],"sourcesContent":["import './VerticalMenuItem.css';\n\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport { Text } from '@consta/uikit/Text';\nimport React from 'react';\n\nimport { cn } from '##/utils/bem';\n\nimport { VerticalMenuItemComponent } from '../types';\n\nexport const cnVerticalMenuItem = cn('VerticalMenuItem');\n\nexport const VerticalMenuItem: VerticalMenuItemComponent = (props) => {\n const {\n className,\n label,\n href,\n target,\n active,\n onClick,\n withSubMenu,\n ...otherProps\n } = props;\n\n const propsLink = href\n ? ({\n as: 'a',\n href,\n target,\n } as const)\n : ({\n as: 'span',\n } as const);\n\n return (\n <Text\n {...otherProps}\n {...propsLink}\n className={cnVerticalMenuItem({ active }, [className])}\n onClick={onClick}\n view=\"primary\"\n size=\"m\"\n lineHeight=\"m\"\n >\n {label}\n {withSubMenu && (\n <IconArrowRight className={cnVerticalMenuItem('Icon')} size=\"xs\" />\n )}\n </Text>\n );\n};\n"],"mappings":"4KAAA,+BAEA,OAASA,cAAc,KAAQ,8BAA8B,CAC7D,OAASC,IAAI,KAAQ,oBAAoB,CACzC,MAAO,CAAAC,KAAK,KAAM,OAAO,CAEzB,OAASC,EAAE,0BAIX,MAAO,MAAM,CAAAC,kBAAkB,CAAGD,EAAE,CAAC,kBAAkB,CAAC,CAExD,MAAO,MAAM,CAAAE,gBAA2C,CAAIC,CAAK,EAAK,MAC9D,CACJC,SAAS,CAATA,CAAS,CACTC,KAAK,CAALA,CAAK,CACLC,IAAI,CAAJA,CAAI,CACJC,MAAM,CAANA,CAAM,CACNC,MAAM,CAANA,CAAM,CACNC,OAAO,CAAPA,CAAO,CACPC,WAAW,CAAXA,CAEF,CAAC,CAAGP,CAAK,CADJQ,CAAU,CAAAC,wBAAA,CACXT,CAAK,CAAAU,SAAA,EAEHC,CAAS,CAAGR,CAAI,CACjB,CACCS,EAAE,CAAE,GAAG,CACPT,IAAI,CAAJA,CAAI,CACJC,MAAM,CAANA,CACF,CAAC,CACA,CACCQ,EAAE,CAAE,MACN,CAAW,CAEf,MACE,CAAAhB,KAAA,CAAAiB,aAAA,CAAClB,IAAI,CAAAmB,MAAA,CAAAC,MAAA,IACCP,CAAU,CACVG,CAAS,EACbV,SAAS,CAAEH,kBAAkB,CAAC,CAAEO,MAAM,CAANA,CAAO,CAAC,CAAE,CAACJ,CAAS,CAAC,CAAE,CACvDK,OAAO,CAAEA,CAAQ,CACjBU,IAAI,CAAC,SAAS,CACdC,IAAI,CAAC,GAAG,CACRC,UAAU,CAAC,GAAG,GAEbhB,CAAK,CACLK,CAAW,EACVX,KAAA,CAAAiB,aAAA,CAACnB,cAAc,EAACO,SAAS,CAAEH,kBAAkB,CAAC,MAAM,CAAE,CAACmB,IAAI,CAAC,IAAI,CAAE,CAEhE,CAEV,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["items","className","getItemActive","getItemHref","getItemLabel","getItemOnClick","getItemTarget","getItemSubMenu","addLevel","removeLevel","label","header","getItemGroup","id","footer"];import"./VerticalMenuLevel.css";import{IconArrowLeft}from"@consta/icons/IconArrowLeft";import{fabricIndex}from"@consta/uikit/__internal__/src/utils/fabricIndex";import{getGroups}from"@consta/uikit/__internal__/src/utils/getGroups";import{Button}from"@consta/uikit/Button";import{cnMixSpace}from"@consta/uikit/MixSpace";import{Text}from"@consta/uikit/Text";import React,{forwardRef}from"react";import{cn}from"../../../utils/bem";import{VerticalMenuItem}from"../VerticalMenuItem/VerticalMenuItem";export const cnVerticalMenuLevel=cn("VerticalMenuLevel");export const VerticalMenuLevel=forwardRef((a,b)=>{const{items:c,className:d,getItemActive:e,getItemHref:f,getItemLabel:g,getItemOnClick:h,getItemTarget:i,getItemSubMenu:j,addLevel:k,removeLevel:l,label:m,header:n,getItemGroup:o,id:p,footer:q}=a,r=_objectWithoutProperties(a,_excluded),s=getGroups(c,o,void 0,void 0,void 0),t=fabricIndex(-1);return React.createElement("div",Object.assign({},r,{ref:b,className:cnVerticalMenuLevel(null,[d])}),m&&React.createElement("div",{className:cnVerticalMenuLevel("Label",[cnMixSpace({pV:"s",pH:"xl"})])},React.createElement(Button,{iconLeft:IconArrowLeft,view:"clear",size:"s",onClick:l}),React.createElement(Text,{className:cnMixSpace({mL:"s"}),truncate:!0},m)),n&&React.createElement("div",{className:cnVerticalMenuLevel("Header")},n),React.createElement("nav",{className:cnVerticalMenuLevel("Nav")},s.map((a,b)=>React.createElement(React.Fragment,null,!!b&&React.createElement("div",{className:cnVerticalMenuLevel("Divider",[cnMixSpace({mV:"s",mH:"xl"})])}),a.items.map((a,c)=>{const d=t(),l=j(a),m=l&&0<l.length||!1,n=h(a),o=g(a),q=m?a=>{null===n||void 0===n?void 0:n(a),l&&k({items:l,label:o,id:`${p}-${d}`})}:n;return React.createElement(VerticalMenuItem,{key:cnVerticalMenuLevel("Item",{groupIndex:b,index:c}),label:o,href:f(a),active:e(a),onClick:q,target:i(a),withSubMenu:m,className:cnMixSpace({pV:"s",pH:"xl"})})})))),q&&React.createElement("div",{className:cnVerticalMenuLevel("Footer")},React.createElement("div",{className:cnVerticalMenuLevel("Divider",[cnMixSpace({mV:"s",mH:"xl"})])}),q))});
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";const _excluded=["items","className","getItemActive","getItemHref","getItemLabel","getItemOnClick","getItemTarget","getItemSubMenu","addLevel","removeLevel","label","header","getItemGroup","id","footer"];import"./VerticalMenuLevel.css";import{IconArrowLeft}from"@consta/icons/IconArrowLeft";import{fabricIndex}from"@consta/uikit/__internal__/src/utils/fabricIndex";import{getGroups}from"@consta/uikit/__internal__/src/utils/getGroups";import{Button}from"@consta/uikit/Button";import{cnMixSpace}from"@consta/uikit/MixSpace";import{Text}from"@consta/uikit/Text";import React,{forwardRef}from"react";import{cn}from"../../../utils/bem";import{VerticalMenuItem}from"../VerticalMenuItem/VerticalMenuItem";export const cnVerticalMenuLevel=cn("VerticalMenuLevel");export const VerticalMenuLevel=forwardRef((a,b)=>{const{items:c,className:d,getItemActive:e,getItemHref:f,getItemLabel:g,getItemOnClick:h,getItemTarget:i,getItemSubMenu:j,addLevel:k,removeLevel:l,label:m,header:n,getItemGroup:o,id:p,footer:q}=a,r=_objectWithoutProperties(a,_excluded),s=getGroups(c,o,void 0,void 0,void 0),t=fabricIndex(-1);return React.createElement("div",Object.assign({},r,{ref:b,className:cnVerticalMenuLevel(null,[d])}),m&&React.createElement("div",{className:cnVerticalMenuLevel("Label",[cnMixSpace({pV:"s",pH:"xl"})])},React.createElement(Button,{iconLeft:IconArrowLeft,view:"clear",size:"s",onClick:l}),React.createElement(Text,{className:cnMixSpace({mL:"s"}),truncate:!0,view:"primary",size:"m",lineHeight:"m"},m)),n&&React.createElement("div",{className:cnVerticalMenuLevel("Header")},n),React.createElement("nav",{className:cnVerticalMenuLevel("Nav")},s.map((a,b)=>React.createElement(React.Fragment,null,!!b&&React.createElement("div",{className:cnVerticalMenuLevel("Divider",[cnMixSpace({mV:"s",mH:"xl"})])}),a.items.map((a,c)=>{const d=t(),l=j(a),m=l&&0<l.length||!1,n=h(a),o=g(a),q=m?a=>{null===n||void 0===n?void 0:n(a),l&&k({items:l,label:o,id:`${p}-${d}`})}:n;return React.createElement(VerticalMenuItem,{key:cnVerticalMenuLevel("Item",{groupIndex:b,index:c}),label:o,href:f(a),active:e(a),onClick:q,target:i(a),withSubMenu:m,className:cnMixSpace({pV:"s",pH:"xl"})})})))),q&&React.createElement("div",{className:cnVerticalMenuLevel("Footer")},React.createElement("div",{className:cnVerticalMenuLevel("Divider",[cnMixSpace({mV:"s",mH:"xl"})])}),q))});
|
|
2
2
|
//# sourceMappingURL=VerticalMenuLevel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalMenuLevel.js","names":["IconArrowLeft","fabricIndex","getGroups","Button","cnMixSpace","Text","React","forwardRef","cn","VerticalMenuItem","cnVerticalMenuLevel","VerticalMenuLevel","props","ref","items","className","getItemActive","getItemHref","getItemLabel","getItemOnClick","getItemTarget","getItemSubMenu","addLevel","removeLevel","label","levelLabel","header","getItemGroup","id","footer","otherProps","_objectWithoutProperties","_excluded","groups","getIndex","createElement","Object","assign","pV","pH","iconLeft","view","size","onClick","mL","truncate","map","group","groupIndex","Fragment","mV","mH","item","index","levelId","subMenu","withSubMenu","length","itemClick","e","key","href","active","target"],"sources":["../../../../../../src/components/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.tsx"],"sourcesContent":["import './VerticalMenuLevel.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { fabricIndex } from '@consta/uikit/__internal__/src/utils/fabricIndex';\nimport { getGroups } from '@consta/uikit/__internal__/src/utils/getGroups';\nimport { Button } from '@consta/uikit/Button';\nimport { cnMixSpace } from '@consta/uikit/MixSpace';\nimport { Text } from '@consta/uikit/Text';\nimport React, { forwardRef } from 'react';\n\nimport { cn } from '##/utils/bem';\n\nimport { VerticalMenuLevelComponent } from '../types';\nimport { VerticalMenuItem } from '../VerticalMenuItem/VerticalMenuItem';\n\nexport const cnVerticalMenuLevel = cn('VerticalMenuLevel');\n\nexport const VerticalMenuLevel: VerticalMenuLevelComponent = forwardRef(\n (props, ref) => {\n const {\n items,\n className,\n getItemActive,\n getItemHref,\n getItemLabel,\n getItemOnClick,\n getItemTarget,\n getItemSubMenu,\n addLevel,\n removeLevel,\n label: levelLabel,\n header,\n getItemGroup,\n id,\n footer,\n ...otherProps\n } = props;\n\n const groups = getGroups(\n items,\n getItemGroup,\n undefined,\n undefined,\n undefined,\n );\n\n const getIndex = fabricIndex(-1);\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnVerticalMenuLevel(null, [className])}\n >\n {levelLabel && (\n <div\n className={cnVerticalMenuLevel('Label', [\n cnMixSpace({ pV: 's', pH: 'xl' }),\n ])}\n >\n <Button\n iconLeft={IconArrowLeft}\n view=\"clear\"\n size=\"s\"\n onClick={removeLevel}\n />\n <Text
|
|
1
|
+
{"version":3,"file":"VerticalMenuLevel.js","names":["IconArrowLeft","fabricIndex","getGroups","Button","cnMixSpace","Text","React","forwardRef","cn","VerticalMenuItem","cnVerticalMenuLevel","VerticalMenuLevel","props","ref","items","className","getItemActive","getItemHref","getItemLabel","getItemOnClick","getItemTarget","getItemSubMenu","addLevel","removeLevel","label","levelLabel","header","getItemGroup","id","footer","otherProps","_objectWithoutProperties","_excluded","groups","getIndex","createElement","Object","assign","pV","pH","iconLeft","view","size","onClick","mL","truncate","lineHeight","map","group","groupIndex","Fragment","mV","mH","item","index","levelId","subMenu","withSubMenu","length","itemClick","e","key","href","active","target"],"sources":["../../../../../../src/components/VerticalMenu/VerticalMenuLevel/VerticalMenuLevel.tsx"],"sourcesContent":["import './VerticalMenuLevel.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { fabricIndex } from '@consta/uikit/__internal__/src/utils/fabricIndex';\nimport { getGroups } from '@consta/uikit/__internal__/src/utils/getGroups';\nimport { Button } from '@consta/uikit/Button';\nimport { cnMixSpace } from '@consta/uikit/MixSpace';\nimport { Text } from '@consta/uikit/Text';\nimport React, { forwardRef } from 'react';\n\nimport { cn } from '##/utils/bem';\n\nimport { VerticalMenuLevelComponent } from '../types';\nimport { VerticalMenuItem } from '../VerticalMenuItem/VerticalMenuItem';\n\nexport const cnVerticalMenuLevel = cn('VerticalMenuLevel');\n\nexport const VerticalMenuLevel: VerticalMenuLevelComponent = forwardRef(\n (props, ref) => {\n const {\n items,\n className,\n getItemActive,\n getItemHref,\n getItemLabel,\n getItemOnClick,\n getItemTarget,\n getItemSubMenu,\n addLevel,\n removeLevel,\n label: levelLabel,\n header,\n getItemGroup,\n id,\n footer,\n ...otherProps\n } = props;\n\n const groups = getGroups(\n items,\n getItemGroup,\n undefined,\n undefined,\n undefined,\n );\n\n const getIndex = fabricIndex(-1);\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnVerticalMenuLevel(null, [className])}\n >\n {levelLabel && (\n <div\n className={cnVerticalMenuLevel('Label', [\n cnMixSpace({ pV: 's', pH: 'xl' }),\n ])}\n >\n <Button\n iconLeft={IconArrowLeft}\n view=\"clear\"\n size=\"s\"\n onClick={removeLevel}\n />\n <Text\n className={cnMixSpace({ mL: 's' })}\n truncate\n view=\"primary\"\n size=\"m\"\n lineHeight=\"m\"\n >\n {levelLabel}\n </Text>\n </div>\n )}\n {header && (\n <div className={cnVerticalMenuLevel('Header')}>{header}</div>\n )}\n <nav className={cnVerticalMenuLevel('Nav')}>\n {groups.map((group, groupIndex) => {\n return (\n <>\n {!!groupIndex && (\n <div\n className={cnVerticalMenuLevel('Divider', [\n cnMixSpace({ mV: 's', mH: 'xl' }),\n ])}\n />\n )}\n {group.items.map((item, index) => {\n const levelId = getIndex();\n const subMenu = getItemSubMenu(item);\n const withSubMenu = (subMenu && subMenu.length > 0) || false;\n const itemClick = getItemOnClick(item);\n const label = getItemLabel(item);\n const onClick = withSubMenu\n ? (e: React.MouseEvent<Element, MouseEvent>) => {\n itemClick?.(e);\n subMenu &&\n addLevel({\n items: subMenu,\n label,\n id: `${id}-${levelId}`,\n });\n }\n : itemClick;\n return (\n <VerticalMenuItem\n key={cnVerticalMenuLevel('Item', { groupIndex, index })}\n label={label}\n href={getItemHref(item)}\n active={getItemActive(item)}\n onClick={onClick}\n target={getItemTarget(item)}\n withSubMenu={withSubMenu}\n className={cnMixSpace({ pV: 's', pH: 'xl' })}\n />\n );\n })}\n </>\n );\n })}\n </nav>\n {footer && (\n <div className={cnVerticalMenuLevel('Footer')}>\n <div\n className={cnVerticalMenuLevel('Divider', [\n cnMixSpace({ mV: 's', mH: 'xl' }),\n ])}\n />\n {footer}\n </div>\n )}\n </div>\n );\n },\n);\n"],"mappings":"iSAAA,gCAEA,OAASA,aAAa,KAAQ,6BAA6B,CAC3D,OAASC,WAAW,KAAQ,kDAAkD,CAC9E,OAASC,SAAS,KAAQ,gDAAgD,CAC1E,OAASC,MAAM,KAAQ,sBAAsB,CAC7C,OAASC,UAAU,KAAQ,wB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AAGc,CAAW,CACtBG,CAAwC,EAAK,QAC5CD,CAAS,WAATA,CAAS,QAATA,CAAS,CAAGC,CAAC,CAAC,CACdJ,CAAO,EACLlC,CAAQ,CAAC,CACPR,KAAK,CAAE0C,CAAO,CACdhC,KAAK,CAALA,CAAK,CACLI,EAAE,CAAG,GAAEA,CAAG,IAAG2B,CAAQ,EACvB,CAAC,CACL,CAAC,CACDI,CAAS,CACb,MACE,CAAArD,KAAA,CAAA6B,aAAA,CAAC1B,gBAAgB,EACfoD,GAAG,CAAEnD,mBAAmB,CAAC,MAAM,CAAE,CAAEuC,UAAU,CAAVA,CAAU,CAAEK,KAAK,CAALA,CAAM,CAAC,CAAE,CACxD9B,KAAK,CAAEA,CAAM,CACbsC,IAAI,CAAE7C,CAAW,CAACoC,CAAI,CAAE,CACxBU,MAAM,CAAE/C,CAAa,CAACqC,CAAI,CAAE,CAC5BV,OAAO,CAAEA,CAAQ,CACjBqB,MAAM,CAAE5C,CAAa,CAACiC,CAAI,CAAE,CAC5BI,WAAW,CAAEA,CAAY,CACzB1C,SAAS,CAAEX,UAAU,CAAC,CAAEkC,EAAE,CAAE,GAAG,CAAEC,EAAE,CAAE,IAAK,CAAC,CAAE,CAC9C,CAEL,CAAC,CACD,CAEL,CACE,CAAC,CACLV,CAAM,EACLvB,KAAA,CAAA6B,aAAA,QAAKpB,SAAS,CAAEL,mBAAmB,CAAC,QAAQ,CAAE,EAC5CJ,KAAA,CAAA6B,aAAA,QACEpB,SAAS,CAAEL,mBAAmB,CAAC,SAAS,CAAE,CACxCN,UAAU,CAAC,CAAE+C,EAAE,CAAE,GAAG,CAAEC,EAAE,CAAE,IAAK,CAAC,CAAC,CAClC,CAAE,CACJ,CAAC,CACDvB,CACE,CAEJ,CAET,CACF,CAAC"}
|
|
@@ -15,9 +15,8 @@ export type VerticalMenuPropGetItemTarget<ITEM> = (item: ITEM) => string | undef
|
|
|
15
15
|
export type VerticalMenuPropGetItemActive<ITEM> = (item: ITEM) => boolean | undefined;
|
|
16
16
|
export type VerticalMenuPropGetItemSubMenu<ITEM> = (item: ITEM) => ITEM[] | undefined;
|
|
17
17
|
export type VerticalMenuPropGetItemOnClick<ITEM> = (item: ITEM) => React.EventHandler<React.MouseEvent> | undefined;
|
|
18
|
-
export type VerticalMenuPropOnItemClick<ITEM> = (props: {
|
|
18
|
+
export type VerticalMenuPropOnItemClick<ITEM> = (item: ITEM, props: {
|
|
19
19
|
e: React.MouseEvent;
|
|
20
|
-
item: ITEM;
|
|
21
20
|
}) => void;
|
|
22
21
|
export type VerticalMenuPropGetItemGroup<ITEM> = (item: ITEM) => string | number | undefined;
|
|
23
22
|
export type VerticalMenuProps<ITEM = VerticalMenuDefaultItem> = PropsWithHTMLAttributes<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/VerticalMenu/types.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type VerticalMenuDefaultItem = {\n label: string;\n href?: string;\n target?: string;\n active?: boolean;\n onClick?: React.EventHandler<React.MouseEvent>;\n subMenu?: VerticalMenuDefaultItem[];\n groupId?: string;\n};\n\nexport type VerticalMenuPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type VerticalMenuPropGetItemHref<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type VerticalMenuPropGetItemTarget<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type VerticalMenuPropGetItemActive<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type VerticalMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\nexport type VerticalMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type VerticalMenuPropOnItemClick<ITEM> = (props: {\n
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/VerticalMenu/types.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type VerticalMenuDefaultItem = {\n label: string;\n href?: string;\n target?: string;\n active?: boolean;\n onClick?: React.EventHandler<React.MouseEvent>;\n subMenu?: VerticalMenuDefaultItem[];\n groupId?: string;\n};\n\nexport type VerticalMenuPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type VerticalMenuPropGetItemHref<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type VerticalMenuPropGetItemTarget<ITEM> = (\n item: ITEM,\n) => string | undefined;\nexport type VerticalMenuPropGetItemActive<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type VerticalMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\nexport type VerticalMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type VerticalMenuPropOnItemClick<ITEM> = (\n item: ITEM,\n props: {\n e: React.MouseEvent;\n },\n) => void;\nexport type VerticalMenuPropGetItemGroup<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type VerticalMenuProps<ITEM = VerticalMenuDefaultItem> =\n PropsWithHTMLAttributes<\n {\n items: ITEM[];\n getItemHref?: VerticalMenuPropGetItemHref<ITEM>;\n getItemLabel?: VerticalMenuPropGetItemLabel<ITEM>;\n getItemTarget?: VerticalMenuPropGetItemTarget<ITEM>;\n getItemActive?: VerticalMenuPropGetItemActive<ITEM>;\n getItemOnClick?: VerticalMenuPropGetItemOnClick<ITEM>;\n getItemSubMenu?: VerticalMenuPropGetItemSubMenu<ITEM>;\n onItemClick?: VerticalMenuPropOnItemClick<ITEM>;\n getItemGroup?: VerticalMenuPropGetItemGroup<ITEM>;\n header?: React.ReactNode;\n footer?: React.ReactNode;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: VerticalMenuDefaultItem['label'] }\n ? {}\n : { getItemLabel: VerticalMenuPropGetItemLabel<ITEM> });\n\nexport type VerticalMenuComponent = <ITEM = VerticalMenuDefaultItem>(\n props: VerticalMenuProps<ITEM>,\n) => React.ReactElement | null;\n\nexport type VerticalMenuLevel<ITEM> = {\n items: ITEM[];\n id: string;\n label?: string;\n};\n\nexport type VerticalMenuLevelProps<ITEM = VerticalMenuDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n id: string;\n items: ITEM[];\n getItemHref: VerticalMenuPropGetItemHref<ITEM>;\n getItemLabel: VerticalMenuPropGetItemLabel<ITEM>;\n getItemTarget: VerticalMenuPropGetItemTarget<ITEM>;\n getItemActive: VerticalMenuPropGetItemActive<ITEM>;\n getItemOnClick: VerticalMenuPropGetItemOnClick<ITEM>;\n getItemSubMenu: VerticalMenuPropGetItemSubMenu<ITEM>;\n getItemGroup: VerticalMenuPropGetItemGroup<ITEM>;\n addLevel: (level: VerticalMenuLevel<ITEM>) => void;\n removeLevel: () => void;\n label?: string;\n header?: React.ReactNode;\n footer?: React.ReactNode;\n },\n HTMLDivElement\n >;\n\nexport type VerticalMenuLevelComponent = <ITEM = VerticalMenuDefaultItem>(\n props: VerticalMenuLevelProps<ITEM>,\n) => React.ReactElement | null;\n\nexport type VerticalMenuItemProps = PropsWithHTMLAttributes<\n {\n label: string;\n href?: string;\n target?: string;\n active?: boolean;\n onClick?: React.EventHandler<React.MouseEvent>;\n withSubMenu?: boolean;\n },\n HTMLSpanElement\n>;\n\nexport type VerticalMenuItemComponent = (\n props: VerticalMenuItemProps,\n) => React.ReactElement | null;\n"],"mappings":""}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export type GetItemOnClick<ITEM> = (item: ITEM) => React.EventHandler<React.MouseEvent> | undefined;
|
|
3
|
-
export type OnItemClick<ITEM> = (props: {
|
|
3
|
+
export type OnItemClick<ITEM> = (item: ITEM, props: {
|
|
4
4
|
e: React.MouseEvent;
|
|
5
|
-
item: ITEM;
|
|
6
5
|
}) => void;
|
|
7
6
|
export declare const getItemClick: <ITEM>(item: ITEM, getItemOnClick: GetItemOnClick<ITEM>, onItemClick?: OnItemClick<ITEM> | undefined) => React.MouseEventHandler;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const getItemClick=(a,b,c)=>d=>{var e;null===c||void 0===c?void 0:c({e:d
|
|
1
|
+
export const getItemClick=(a,b,c)=>d=>{var e;null===c||void 0===c?void 0:c(a,{e:d}),null===(e=b(a))||void 0===e?void 0:e(d)};
|
|
2
2
|
//# sourceMappingURL=getItemClick.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getItemClick.js","names":["getItemClick","item","getItemOnClick","onItemClick","e"],"sources":["../../../../src/helpers/getItemClick.ts"],"sourcesContent":["export type GetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type OnItemClick<ITEM> = (props: {\n
|
|
1
|
+
{"version":3,"file":"getItemClick.js","names":["getItemClick","item","getItemOnClick","onItemClick","e"],"sources":["../../../../src/helpers/getItemClick.ts"],"sourcesContent":["export type GetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type OnItemClick<ITEM> = (\n item: ITEM,\n props: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport const getItemClick =\n <ITEM>(\n item: ITEM,\n getItemOnClick: GetItemOnClick<ITEM>,\n onItemClick?: OnItemClick<ITEM>,\n ): React.MouseEventHandler =>\n (e) => {\n onItemClick?.(item, { e });\n getItemOnClick(item)?.(e);\n };\n"],"mappings":"AAUA,MAAO,MAAM,CAAAA,YAAY,CACvBA,CACEC,CAAU,CACVC,CAAoC,CACpCC,CAA+B,GAEhCC,CAAC,EAAK,KAAAA,CAAA,QACLD,CAAW,WAAXA,CAAW,QAAXA,CAAW,CAAGF,CAAI,CAAE,CAAEG,CAAC,CAADA,CAAE,CAAC,CAAC,SAAAA,CAAA,CAC1BF,CAAc,CAACD,CAAI,CAAC,YAAAG,CAAA,QAApBA,CAAA,CAAuBA,CAAC,CAC1B,CAAC"}
|
|
@@ -1 +1,4 @@
|
|
|
1
1
|
export declare const cn: import("@bem-react/classname").ClassNameInitilizer;
|
|
2
|
+
export declare const withPrefix: (prefix: string) => import("@bem-react/classname").ClassNameInitilizer;
|
|
3
|
+
export declare const cnCanary: import("@bem-react/classname").ClassNameInitilizer;
|
|
4
|
+
export declare const cnDeprecated: import("@bem-react/classname").ClassNameInitilizer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{withNaming}from"@bem-react/classname";
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";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{withNaming}from"@bem-react/classname";const reactBemNaming={n:"che--",e:"-",m:"_",v:"_"};export const cn=withNaming(reactBemNaming);export const withPrefix=a=>withNaming(_objectSpread(_objectSpread({},reactBemNaming),{},{n:a+reactBemNaming.n}));export const cnCanary=withPrefix("canary");export const cnDeprecated=withPrefix("deprecated");
|
|
2
2
|
//# sourceMappingURL=bem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bem.js","names":["withNaming","
|
|
1
|
+
{"version":3,"file":"bem.js","names":["withNaming","reactBemNaming","n","e","m","v","cn","withPrefix","prefix","_objectSpread","cnCanary","cnDeprecated"],"sources":["../../../../src/utils/bem.ts"],"sourcesContent":["import { withNaming } from '@bem-react/classname';\n\nconst reactBemNaming = { n: 'che--', e: '-', m: '_', v: '_' };\n\nexport const cn = withNaming(reactBemNaming);\n\nexport const withPrefix = (prefix: string) =>\n withNaming({ ...reactBemNaming, n: prefix + reactBemNaming.n });\n\nexport const cnCanary = withPrefix('canary');\n\nexport const cnDeprecated = withPrefix('deprecated');\n"],"mappings":"qqBAAA,OAASA,UAAU,KAAQ,sBAAsB,CAEjD,KAAM,CAAAC,cAAc,CAAG,CAAEC,CAAC,CAAE,OAAO,CAAEC,CAAC,CAAE,GAAG,CAAEC,CAAC,CAAE,GAAG,CAAEC,CAAC,CAAE,GAAI,CAAC,CAE7D,MAAO,MAAM,CAAAC,EAAE,CAAGN,UAAU,CAACC,cAAc,CAAC,CAE5C,MAAO,MAAM,CAAAM,UAAU,CAAIC,CAAc,EACvCR,UAAU,CAAAS,aAAA,CAAAA,aAAA,IAAMR,cAAc,MAAEC,CAAC,CAAEM,CAAM,CAAGP,cAAc,CAACC,CAAC,EAAE,CAAC,CAEjE,MAAO,MAAM,CAAAQ,QAAQ,CAAGH,UAAU,CAAC,QAAQ,CAAC,CAE5C,MAAO,MAAM,CAAAI,YAAY,CAAGJ,UAAU,CAAC,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consta/header",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"*",
|
|
6
6
|
"!**/__mocks__",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@consta/icons": "^0.
|
|
22
|
-
"@consta/uikit": "^
|
|
21
|
+
"@consta/icons": "^1.0.0-beta.1",
|
|
22
|
+
"@consta/uikit": "^5.0.0-beta.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["format","formatDistanceToNow","ruLocale","defaultDateFormat","date","currentDate","Date","getTime","locale","addSuffix"],"sources":["../../../../../../src/components/Notifications/NotificationsItem/helpers.ts"],"sourcesContent":["import format from 'date-fns/format';\nimport formatDistanceToNow from 'date-fns/formatDistanceToNow';\nimport ruLocale from 'date-fns/locale/ru';\n\nexport const defaultDateFormat = (date: Date): string => {\n const currentDate = new Date();\n\n if (currentDate.getTime() - date.getTime() < 3600000) {\n return formatDistanceToNow(date, { locale: ruLocale, addSuffix: true });\n }\n\n if (format(currentDate, 'dd.MM.yyyy') === format(date, 'dd.MM.yyyy')) {\n return format(date, 'HH:mm');\n }\n\n return format(date, 'dd.MM.yyyy HH:mm');\n};\n"],"mappings":"AAAA,MAAO,CAAAA,MAAM,KAAM,iBAAiB,CACpC,MAAO,CAAAC,mBAAmB,KAAM,8BAA8B,CAC9D,MAAO,CAAAC,QAAQ,KAAM,oBAAoB,CAEzC,MAAO,MAAM,CAAAC,iBAAiB,CAAIC,CAAU,EAAa,CACvD,KAAM,CAAAC,CAAW,CAAG,GAAI,CAAAC,IAAM,CAAC,MAEc,KAAO,CAAhDD,CAAW,CAACE,OAAO,CAAC,CAAC,CAAGH,CAAI,CAACG,OAAO,CAAC,CAAW,CAC3CN,mBAAmB,CAACG,CAAI,CAAE,CAAEI,MAAM,CAAEN,QAAQ,CAAEO,SAAS,GAAO,CAAC,CAAC,CAGrET,MAAM,CAACK,CAAW,CAAE,YAAY,CAAC,GAAKL,MAAM,CAACI,CAAI,CAAE,YAAY,CAAC,CAC3DJ,MAAM,CAACI,CAAI,CAAE,OAAO,CAAC,CAGvBJ,MAAM,CAACI,CAAI,CAAE,kBAAkB,CACxC,CAAC"}
|
|
File without changes
|
|
File without changes
|