@consta/uikit 4.28.1 → 4.30.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/__internal__/src/components/AutoCompleteCanary/helpers.d.ts +1 -1
- package/__internal__/src/components/AvatarGroup/helpers.d.ts +1 -1
- package/__internal__/src/components/BadgeGroup/types.d.ts +3 -2
- package/__internal__/src/components/BadgeGroup/types.js.map +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/BookmarkTabs.css +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/BookmarkTabsCanary.js +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/BookmarkTabsCanary.js.map +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/BookmarkTabsTab/BookmarkTabsTab.css +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/BookmarkTabsTab/BookmarkTabsTab.js +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/BookmarkTabsTab/BookmarkTabsTab.js.map +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/helper.d.ts +1 -1
- package/__internal__/src/components/BookmarkTabsCanary/types.d.ts +10 -7
- package/__internal__/src/components/BookmarkTabsCanary/types.js.map +1 -1
- package/__internal__/src/components/Button/Button.css +1 -1
- package/__internal__/src/components/Button/Button.d.ts +1 -0
- package/__internal__/src/components/Button/Button.js +1 -1
- package/__internal__/src/components/Button/Button.js.map +1 -1
- package/__internal__/src/components/ChipsCanary/types.d.ts +3 -2
- package/__internal__/src/components/ChipsCanary/types.js.map +1 -1
- package/__internal__/src/components/ChoiceGroup/helper.d.ts +1 -1
- package/__internal__/src/components/CollapseGroup/helpers.d.ts +2 -2
- package/__internal__/src/components/Combobox/helpers.d.ts +2 -2
- package/__internal__/src/components/ComboboxCanary/helpers.d.ts +2 -2
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
- package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -4
- package/__internal__/src/components/ContextMenu/types.d.ts +7 -6
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/ContextMenuDeprecated/helpers.d.ts +5 -4
- package/__internal__/src/components/ContextMenuDeprecated/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/DatePickerFieldTypeDate.d.ts +2 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.d.ts +2 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.d.ts +2 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.d.ts +2 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/DatePickerFieldTypeYear.d.ts +2 -2
- package/__internal__/src/components/FileField/FileField.d.ts +2 -1
- package/__internal__/src/components/FileField/FileField.js.map +1 -1
- package/__internal__/src/components/Header/Logo/HeaderLogo.d.ts +3 -2
- package/__internal__/src/components/Header/Logo/HeaderLogo.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.d.ts +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js.map +1 -1
- package/__internal__/src/components/ListCanary/types.d.ts +5 -4
- package/__internal__/src/components/ListCanary/types.js.map +1 -1
- package/__internal__/src/components/ProgressStepBar/helpers.d.ts +2 -2
- package/__internal__/src/components/Select/helpers.d.ts +2 -2
- package/__internal__/src/components/SelectCanary/helpers.d.ts +2 -2
- package/__internal__/src/components/Sidebar/Sidebar.d.ts +2 -2
- package/__internal__/src/components/Sidebar/Sidebar.js.map +1 -1
- package/__internal__/src/components/SnackBar/helper.d.ts +1 -1
- package/__internal__/src/components/Tabs/FitModeDropdownWrapper/TabsFitModeDropdownWrapper.js +1 -1
- package/__internal__/src/components/Tabs/FitModeDropdownWrapper/TabsFitModeDropdownWrapper.js.map +1 -1
- package/__internal__/src/components/Tabs/FitModeDropdownWrapper/useFittingItems.d.ts +4 -3
- package/__internal__/src/components/Tabs/FitModeDropdownWrapper/useFittingItems.js +1 -1
- package/__internal__/src/components/Tabs/FitModeDropdownWrapper/useFittingItems.js.map +1 -1
- package/__internal__/src/components/Tabs/FitModeScrollWrapper/TabsFitModeScrollWrapper.js +1 -1
- package/__internal__/src/components/Tabs/FitModeScrollWrapper/TabsFitModeScrollWrapper.js.map +1 -1
- package/__internal__/src/components/Tabs/Line/TabsLine.d.ts +1 -0
- package/__internal__/src/components/Tabs/Line/TabsLine.js +1 -1
- package/__internal__/src/components/Tabs/Line/TabsLine.js.map +1 -1
- package/__internal__/src/components/Tabs/Tabs.js +1 -1
- package/__internal__/src/components/Tabs/Tabs.js.map +1 -1
- package/__internal__/src/components/Tabs/types.d.ts +7 -5
- package/__internal__/src/components/Tabs/types.js.map +1 -1
- package/__internal__/src/components/Tag/Tag.d.ts +3 -2
- package/__internal__/src/components/Tag/Tag.js.map +1 -1
- package/__internal__/src/components/TagBase/TagBase.d.ts +1 -1
- package/__internal__/src/components/UserSelect/helpers.d.ts +2 -2
- package/__internal__/src/components/UserSelectCanary/helpers.d.ts +2 -2
- package/__internal__/src/utils/types/AsTags.d.ts +3 -0
- package/__internal__/src/utils/types/AsTags.js +2 -0
- package/__internal__/src/utils/types/AsTags.js.map +1 -0
- package/__internal__/src/utils/types/PropsWithAsAttributes.d.ts +6 -5
- package/__internal__/src/utils/types/PropsWithAsAttributes.js.map +1 -1
- package/__internal__/src/utils/types/PropsWithJsxAttributes.d.ts +2 -1
- package/__internal__/src/utils/types/PropsWithJsxAttributes.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuLevel.js","names":["IconArrowLeft","IconArrowRight","React","forwardRef","useEffect","cnListBox","List","ListDivider","ListItem","mapIconSize","mapVerticalSpase","useFlag","useRefs","cnMixPopoverAnimate","cnMixSpace","cn","ContextMenuLevelWrapper","contextMenuDefaultSize","cnContextMenuLevel","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevelRender","props","ref","size","items","groupsProp","groups","className","form","animate","levelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","isOpen","parent","isMobile","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId","otherProps","hovered","setHovered","getKey","item","toString","itemsRefs","map","setTimeout","addCurrentLevel","subMenu","disabled","Array","isArray","key","level","onMouseEnter","e","firstLevel","border","shadow","pV","on","off","mV","a","b","side","sides","push","ContextMenuLevel"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport {\n cnListBox,\n List,\n ListDivider,\n ListItem,\n mapIconSize,\n mapVerticalSpase,\n} from '##/components/ListCanary';\nimport { useFlag } from '##/hooks/useFlag/useFlag';\nimport { useRefs } from '##/hooks/useRefs/useRefs';\nimport { cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport { ContextMenuLevelWrapper } from '../ContextMenuLevelWrapper';\nimport {\n contextMenuDefaultSize,\n ContextMenuItemDefault,\n ContextMenuLevelComponent,\n ContextMenuLevelProps,\n} from '../types';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevel');\n\nlet timers: ReturnType<typeof setTimeout>[] = [];\nexport function clearTimers() {\n for (const timer of timers) {\n clearTimeout(timer);\n }\n timers = [];\n}\n\nconst closeDelay = 300;\n\nconst ContextMenuLevelRender = (\n props: ContextMenuLevelProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n size = contextMenuDefaultSize,\n items,\n groups: groupsProp,\n className,\n form = 'default',\n animate,\n // Свойства относящиеся к меню\n levelDepth,\n activeItem,\n addLevel,\n deleteLevel,\n setHoveredParenLevel,\n hoveredParenLevel,\n sortGroup,\n onItemClick,\n isOpen,\n parent,\n isMobile,\n\n // Свойства для поповера\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n spareDirection,\n anchorRef,\n // Геттеры для ITEM\n getItemLabel,\n getItemRightSide,\n getItemLeftSide,\n getItemSubMenu,\n getItemStatus,\n getItemDisabled,\n getItemKey,\n getItemOnClick,\n getItemAs,\n getItemAttributes,\n getItemGroupId,\n getItemLeftIcon,\n getItemRightIcon,\n // Геттеры для GROUP\n getGroupLabel,\n getGroupId,\n ...otherProps\n } = props;\n\n const [hovered, setHovered] = useFlag(false);\n\n const getKey = (item: ContextMenuItemDefault) =>\n (getItemKey(item) || getItemLabel(item)).toString();\n\n const itemsRefs = useRefs<HTMLDivElement, string[]>(\n items.map((item) => getKey(item)),\n [groupsProp],\n );\n\n useEffect(() => {\n if (levelDepth !== 0 && !hovered && hoveredParenLevel < levelDepth) {\n clearTimeout(timers[levelDepth]);\n timers[levelDepth] = setTimeout(\n () => deleteLevel(levelDepth),\n closeDelay,\n );\n }\n return () => clearTimeout(timers[levelDepth]);\n }, [hovered, hoveredParenLevel]);\n\n useEffect(() => {\n if (!isOpen) {\n clearTimeout(timers[levelDepth]);\n }\n }, [isOpen]);\n\n const addCurrentLevel = (item: ContextMenuItemDefault) => {\n const subMenu = getItemSubMenu(item);\n const disabled = getItemDisabled(item);\n\n if (Array.isArray(subMenu) && !disabled) {\n const key = getKey(item);\n addLevel({\n level: levelDepth + 1,\n items: subMenu,\n anchorRef: itemsRefs[key],\n activeItem: key,\n parent: item,\n });\n setHoveredParenLevel(levelDepth + 1);\n } else {\n setHoveredParenLevel(levelDepth);\n }\n };\n\n const onMouseEnter = isMobile\n ? undefined\n : (\n item: ContextMenuItemDefault,\n ): JSX.IntrinsicElements['div']['onMouseEnter'] =>\n (e) => {\n addCurrentLevel(item);\n const onMouseEnter = getItemAttributes(item)\n ?.onMouseEnter as JSX.IntrinsicElements['div']['onMouseEnter'];\n\n onMouseEnter?.(e);\n };\n\n const firstLevel = levelDepth === 0;\n\n return (\n <ContextMenuLevelWrapper\n anchorRef={anchorRef}\n className={\n isMobile\n ? cnContextMenuLevel('Mobile', { animate }, [className])\n : cnContextMenuLevel('Desktop', { firstLevel }, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n cnMixPopoverAnimate({ animate }),\n firstLevel ? className : undefined,\n ])\n }\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n onSetDirection={onSetDirection}\n onMouseEnter={setHovered.on}\n onMouseLeave={setHovered.off}\n ref={ref}\n isMobile={isMobile}\n {...otherProps}\n >\n {parent && (\n <>\n <ListItem\n label={getItemLabel(parent)}\n size={size}\n leftIcon={IconArrowLeft}\n onClick={() => deleteLevel(levelDepth)}\n />\n <ListDivider size={size} space={{ mV: mapVerticalSpase[size] }} />\n </>\n )}\n <List\n size={size}\n items={items}\n getItemLabel={getItemLabel}\n onItemClick={(item, { e }) => {\n isMobile && addCurrentLevel(item);\n onItemClick?.({\n item,\n e: e as React.MouseEvent<HTMLDivElement>,\n });\n }}\n sortGroup={sortGroup ? (a, b) => sortGroup(a.key, b.key) : undefined}\n getItemOnClick={\n getItemOnClick\n ? (item) => (e) =>\n getItemOnClick(item)?.({\n e: e as React.MouseEvent<HTMLDivElement>,\n item,\n })\n : undefined\n }\n getItemAs={getItemAs}\n getItemAttributes={\n onMouseEnter\n ? (item) =>\n ({\n ...getItemAttributes(item),\n onMouseEnter: onMouseEnter(item),\n } as JSX.IntrinsicElements[keyof JSX.IntrinsicElements])\n : getItemAttributes\n }\n getItemGroupKey={getItemGroupId}\n getItemLeftIcon={getItemLeftIcon}\n getItemRightIcon={getItemRightIcon}\n getItemLeftSide={getItemLeftSide}\n getItemRightSide={(item) => {\n const side = getItemRightSide(item);\n if (!getItemSubMenu(item)) {\n return side;\n }\n\n const sides: React.ReactNode[] = Array.isArray(side) ? side : [side];\n sides.push(<IconArrowRight size={mapIconSize[size]} />);\n return sides;\n }}\n getGroupKey={getGroupId}\n getGroupLabel={getGroupLabel}\n getItemDisabled={getItemDisabled}\n getItemStatus={getItemStatus}\n getItemRef={(item) => itemsRefs[getKey(item)]}\n groups={groupsProp}\n getItemActive={(item) => getKey(item) === activeItem}\n innerOffset={form === 'round' ? 'increased' : 'normal'}\n />\n </ContextMenuLevelWrapper>\n );\n};\n\nexport const ContextMenuLevel = forwardRef(\n ContextMenuLevelRender,\n) as ContextMenuLevelComponent;\n"],"mappings":"0/EAAA,+BAEA,OAASA,aAAT,KAA8B,6BAA9B,CACA,OAASC,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,KAA6C,OAA7C,CAEA,OACEC,SADF,CAEEC,IAFF,CAGEC,WAHF,CAIEC,QAJF,CAKEC,WALF,CAMEC,gBANF,wBAQA,OAASC,OAAT,sCACA,OAASC,OAAT,sCACA,OAASC,mBAAT,uCACA,OAASC,UAAT,8BACA,OAASC,EAAT,0BAEA,OAASC,uBAAT,kCACA,OACEC,sBADF,gBAOA,MAAO,IAAMC,mBAAkB,CAAGH,EAAE,CAAC,kBAAD,CAA7B,CAEP,GAAII,OAAuC,CAAG,EAA9C,CACA,MAAO,SAASC,YAAT,EAAuB,oCACRD,MADQ,MAC5B,2BAA4B,IAAjBE,EAAiB,SAC1BC,YAAY,CAACD,CAAD,CACb,CAH2B,+BAI5BF,MAAM,CAAG,EACV,C,GAEKI,W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kB,CAAD,CAAjC,EAAX,CACA,CAAOmE,CACR,CA5CH,CA6CE,WAAW,CAAE7B,CA7Cf,CA8CE,aAAa,CAAED,CA9CjB,CA+CE,eAAe,CAAER,CA/CnB,CAgDE,aAAa,CAAED,CAhDjB,CAiDE,UAAU,CAAE,oBAACe,CAAD,QAAUE,EAAS,CAACH,CAAM,CAACC,CAAD,CAAP,CAAnB,CAjDd,CAkDE,MAAM,CAAEzC,CAlDV,CAmDE,aAAa,CAAE,uBAACyC,CAAD,QAAUD,EAAM,CAACC,CAAD,CAAN,GAAiBnC,CAA3B,CAnDjB,CAoDE,WAAW,CAAW,OAAT,GAAAH,CAAI,CAAe,WAAf,CAA6B,QApDhD,EApCF,CA4FH,C,CAED,MAAO,IAAMgE,iBAAgB,CAAG7F,UAAU,CACxCqB,sBADwC,CAAnC"}
|
|
1
|
+
{"version":3,"file":"ContextMenuLevel.js","names":["IconArrowLeft","IconArrowRight","React","forwardRef","useEffect","cnListBox","List","ListDivider","ListItem","mapIconSize","mapVerticalSpase","useFlag","useRefs","cnMixPopoverAnimate","cnMixSpace","cn","ContextMenuLevelWrapper","contextMenuDefaultSize","cnContextMenuLevel","timers","clearTimers","timer","clearTimeout","closeDelay","ContextMenuLevelRender","props","ref","size","items","groupsProp","groups","className","form","animate","levelDepth","activeItem","addLevel","deleteLevel","setHoveredParenLevel","hoveredParenLevel","sortGroup","onItemClick","isOpen","parent","isMobile","direction","possibleDirections","offset","onSetDirection","spareDirection","anchorRef","getItemLabel","getItemRightSide","getItemLeftSide","getItemSubMenu","getItemStatus","getItemDisabled","getItemKey","getItemOnClick","getItemAs","getItemAttributes","getItemGroupId","getItemLeftIcon","getItemRightIcon","getGroupLabel","getGroupId","otherProps","hovered","setHovered","getKey","item","toString","itemsRefs","map","setTimeout","addCurrentLevel","subMenu","disabled","Array","isArray","key","level","onMouseEnter","e","firstLevel","border","shadow","pV","on","off","mV","a","b","side","sides","push","ContextMenuLevel"],"sources":["../../../../../../src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.tsx"],"sourcesContent":["import './ContextMenuLevel.css';\n\nimport { IconArrowLeft } from '@consta/icons/IconArrowLeft';\nimport { IconArrowRight } from '@consta/icons/IconArrowRight';\nimport React, { forwardRef, useEffect } from 'react';\n\nimport {\n cnListBox,\n List,\n ListDivider,\n ListItem,\n mapIconSize,\n mapVerticalSpase,\n} from '##/components/ListCanary';\nimport { useFlag } from '##/hooks/useFlag/useFlag';\nimport { useRefs } from '##/hooks/useRefs/useRefs';\nimport { cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { AsAttributes, AsTagAttribute } from '##/utils/types/AsTags';\n\nimport { ContextMenuLevelWrapper } from '../ContextMenuLevelWrapper';\nimport {\n contextMenuDefaultSize,\n ContextMenuItemDefault,\n ContextMenuLevelComponent,\n ContextMenuLevelProps,\n} from '../types';\n\nexport const cnContextMenuLevel = cn('ContextMenuLevel');\n\nlet timers: ReturnType<typeof setTimeout>[] = [];\nexport function clearTimers() {\n for (const timer of timers) {\n clearTimeout(timer);\n }\n timers = [];\n}\n\nconst closeDelay = 300;\n\nconst ContextMenuLevelRender = (\n props: ContextMenuLevelProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n size = contextMenuDefaultSize,\n items,\n groups: groupsProp,\n className,\n form = 'default',\n animate,\n // Свойства относящиеся к меню\n levelDepth,\n activeItem,\n addLevel,\n deleteLevel,\n setHoveredParenLevel,\n hoveredParenLevel,\n sortGroup,\n onItemClick,\n isOpen,\n parent,\n isMobile,\n\n // Свойства для поповера\n direction,\n possibleDirections,\n offset,\n onSetDirection,\n spareDirection,\n anchorRef,\n // Геттеры для ITEM\n getItemLabel,\n getItemRightSide,\n getItemLeftSide,\n getItemSubMenu,\n getItemStatus,\n getItemDisabled,\n getItemKey,\n getItemOnClick,\n getItemAs,\n getItemAttributes,\n getItemGroupId,\n getItemLeftIcon,\n getItemRightIcon,\n // Геттеры для GROUP\n getGroupLabel,\n getGroupId,\n ...otherProps\n } = props;\n\n const [hovered, setHovered] = useFlag(false);\n\n const getKey = (item: ContextMenuItemDefault) =>\n (getItemKey(item) || getItemLabel(item)).toString();\n\n const itemsRefs = useRefs<HTMLDivElement, string[]>(\n items.map((item) => getKey(item)),\n [groupsProp],\n );\n\n useEffect(() => {\n if (levelDepth !== 0 && !hovered && hoveredParenLevel < levelDepth) {\n clearTimeout(timers[levelDepth]);\n timers[levelDepth] = setTimeout(\n () => deleteLevel(levelDepth),\n closeDelay,\n );\n }\n return () => clearTimeout(timers[levelDepth]);\n }, [hovered, hoveredParenLevel]);\n\n useEffect(() => {\n if (!isOpen) {\n clearTimeout(timers[levelDepth]);\n }\n }, [isOpen]);\n\n const addCurrentLevel = (item: ContextMenuItemDefault) => {\n const subMenu = getItemSubMenu(item);\n const disabled = getItemDisabled(item);\n\n if (Array.isArray(subMenu) && !disabled) {\n const key = getKey(item);\n addLevel({\n level: levelDepth + 1,\n items: subMenu,\n anchorRef: itemsRefs[key],\n activeItem: key,\n parent: item,\n });\n setHoveredParenLevel(levelDepth + 1);\n } else {\n setHoveredParenLevel(levelDepth);\n }\n };\n\n const onMouseEnter = isMobile\n ? undefined\n : (item: ContextMenuItemDefault): AsTagAttribute<'div'>['onMouseEnter'] =>\n (e) => {\n addCurrentLevel(item);\n const onMouseEnter = getItemAttributes(item)\n ?.onMouseEnter as AsTagAttribute<'div'>['onMouseEnter'];\n\n onMouseEnter?.(e);\n };\n\n const firstLevel = levelDepth === 0;\n\n return (\n <ContextMenuLevelWrapper\n anchorRef={anchorRef}\n className={\n isMobile\n ? cnContextMenuLevel('Mobile', { animate }, [className])\n : cnContextMenuLevel('Desktop', { firstLevel }, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n cnMixPopoverAnimate({ animate }),\n firstLevel ? className : undefined,\n ])\n }\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}\n direction={direction}\n offset={offset}\n onSetDirection={onSetDirection}\n onMouseEnter={setHovered.on}\n onMouseLeave={setHovered.off}\n ref={ref}\n isMobile={isMobile}\n {...otherProps}\n >\n {parent && (\n <>\n <ListItem\n label={getItemLabel(parent)}\n size={size}\n leftIcon={IconArrowLeft}\n onClick={() => deleteLevel(levelDepth)}\n />\n <ListDivider size={size} space={{ mV: mapVerticalSpase[size] }} />\n </>\n )}\n <List\n size={size}\n items={items}\n getItemLabel={getItemLabel}\n onItemClick={(item, { e }) => {\n isMobile && addCurrentLevel(item);\n onItemClick?.({\n item,\n e: e as React.MouseEvent<HTMLDivElement>,\n });\n }}\n sortGroup={sortGroup ? (a, b) => sortGroup(a.key, b.key) : undefined}\n getItemOnClick={\n getItemOnClick\n ? (item) => (e) =>\n getItemOnClick(item)?.({\n e: e as React.MouseEvent<HTMLDivElement>,\n item,\n })\n : undefined\n }\n getItemAs={getItemAs}\n getItemAttributes={\n onMouseEnter\n ? (item) =>\n ({\n ...getItemAttributes(item),\n onMouseEnter: onMouseEnter(item),\n } as AsAttributes)\n : getItemAttributes\n }\n getItemGroupKey={getItemGroupId}\n getItemLeftIcon={getItemLeftIcon}\n getItemRightIcon={getItemRightIcon}\n getItemLeftSide={getItemLeftSide}\n getItemRightSide={(item) => {\n const side = getItemRightSide(item);\n if (!getItemSubMenu(item)) {\n return side;\n }\n\n const sides: React.ReactNode[] = Array.isArray(side) ? side : [side];\n sides.push(<IconArrowRight size={mapIconSize[size]} />);\n return sides;\n }}\n getGroupKey={getGroupId}\n getGroupLabel={getGroupLabel}\n getItemDisabled={getItemDisabled}\n getItemStatus={getItemStatus}\n getItemRef={(item) => itemsRefs[getKey(item)]}\n groups={groupsProp}\n getItemActive={(item) => getKey(item) === activeItem}\n innerOffset={form === 'round' ? 'increased' : 'normal'}\n />\n </ContextMenuLevelWrapper>\n );\n};\n\nexport const ContextMenuLevel = forwardRef(\n ContextMenuLevelRender,\n) as ContextMenuLevelComponent;\n"],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iBAAiB,CACfuB,CAAY,CACR,SAACZ,CAAD,wCAEOV,CAAiB,CAACU,CAAD,CAFxB,MAGIY,YAAY,CAAEA,CAAY,CAACZ,CAAD,CAH9B,GADQ,CAMRV,CA7BR,CA+BE,eAAe,CAAEC,CA/BnB,CAgCE,eAAe,CAAEC,CAhCnB,CAiCE,gBAAgB,CAAEC,CAjCpB,CAkCE,eAAe,CAAEV,CAlCnB,CAmCE,gBAAgB,CAAE,0BAACiB,CAAD,CAAU,CAC1B,GAAMuB,EAAI,CAAGzC,CAAgB,CAACkB,CAAD,CAA7B,CACA,GAAI,CAAChB,CAAc,CAACgB,CAAD,CAAnB,CACE,MAAOuB,EAAP,CAGF,GAAMC,EAAwB,CAAGhB,KAAK,CAACC,OAAN,CAAcc,CAAd,EAAsBA,CAAtB,CAA6B,CAACA,CAAD,CAA9D,CAEA,MADAC,EAAK,CAACC,IAAN,CAAW,oBAAC,cAAD,EAAgB,IAAI,CAAEtF,WAAW,CAACkB,CAAD,CAAjC,EAAX,CACA,CAAOmE,CACR,CA5CH,CA6CE,WAAW,CAAE7B,CA7Cf,CA8CE,aAAa,CAAED,CA9CjB,CA+CE,eAAe,CAAER,CA/CnB,CAgDE,aAAa,CAAED,CAhDjB,CAiDE,UAAU,CAAE,oBAACe,CAAD,QAAUE,EAAS,CAACH,CAAM,CAACC,CAAD,CAAP,CAAnB,CAjDd,CAkDE,MAAM,CAAEzC,CAlDV,CAmDE,aAAa,CAAE,uBAACyC,CAAD,QAAUD,EAAM,CAACC,CAAD,CAAN,GAAiBnC,CAA3B,CAnDjB,CAoDE,WAAW,CAAW,OAAT,GAAAH,CAAI,CAAe,WAAf,CAA6B,QApDhD,EApCF,CA4FH,C,CAED,MAAO,IAAMgE,iBAAgB,CAAG7F,UAAU,CACxCqB,sBADwC,CAAnC"}
|
|
@@ -14,12 +14,12 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
14
14
|
onSetDirection?: ((direction: "downCenter" | "upCenter" | "downRight" | "downLeft" | "upRight" | "upLeft" | "leftUp" | "leftCenter" | "leftDown" | "rightUp" | "rightCenter" | "rightDown" | "downStartLeft" | "upStartLeft" | "downStartRight" | "upStartRight" | "leftStartUp" | "leftStartDown" | "rightStartUp" | "rightStartDown") => void) | undefined;
|
|
15
15
|
onClickOutside?: import("../../hooks/useClickOutside").ClickOutsideHandler | undefined;
|
|
16
16
|
isOpen?: boolean | undefined;
|
|
17
|
-
form?: "default" | "
|
|
17
|
+
form?: "default" | "brick" | "round" | undefined;
|
|
18
18
|
isMobile?: boolean | undefined;
|
|
19
19
|
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
20
20
|
anchorRef: import("react").RefObject<HTMLElement>;
|
|
21
21
|
position?: undefined;
|
|
22
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "
|
|
22
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "direction" | "offset" | "position" | "onItemClick" | "sortGroup" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
23
23
|
id: unknown;
|
|
24
24
|
} ? {} : {
|
|
25
25
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -60,12 +60,12 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
|
|
|
60
60
|
onSetDirection?: ((direction: "downCenter" | "upCenter" | "downRight" | "downLeft" | "upRight" | "upLeft" | "leftUp" | "leftCenter" | "leftDown" | "rightUp" | "rightCenter" | "rightDown" | "downStartLeft" | "upStartLeft" | "downStartRight" | "upStartRight" | "leftStartUp" | "leftStartDown" | "rightStartUp" | "rightStartDown") => void) | undefined;
|
|
61
61
|
onClickOutside?: import("../../hooks/useClickOutside").ClickOutsideHandler | undefined;
|
|
62
62
|
isOpen?: boolean | undefined;
|
|
63
|
-
form?: "default" | "
|
|
63
|
+
form?: "default" | "brick" | "round" | undefined;
|
|
64
64
|
isMobile?: boolean | undefined;
|
|
65
65
|
} & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
|
|
66
66
|
anchorRef?: undefined;
|
|
67
67
|
position: import("../Popover").Position;
|
|
68
|
-
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "
|
|
68
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "direction" | "offset" | "position" | "onItemClick" | "sortGroup" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
|
|
69
69
|
id: unknown;
|
|
70
70
|
} ? {} : {
|
|
71
71
|
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
@@ -3,6 +3,7 @@ import { IconComponent } from '@consta/icons/Icon';
|
|
|
3
3
|
import { ListPropForm } from "../ListCanary";
|
|
4
4
|
import { ComponentSize } from "../../hooks/useComponentSize";
|
|
5
5
|
import { Animate } from "../../mixs/MixPopoverAnimate";
|
|
6
|
+
import { AsAttributes, AsTags } from "../../utils/types/AsTags";
|
|
6
7
|
import { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';
|
|
7
8
|
import { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';
|
|
8
9
|
import { PropsWithHTMLAttributes, PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
@@ -39,8 +40,8 @@ export declare type ContextMenuItemDefault = {
|
|
|
39
40
|
disabled?: boolean;
|
|
40
41
|
groupId?: number;
|
|
41
42
|
onClick?: ContextMenuPropOnClick<ContextMenuItemDefault>;
|
|
42
|
-
as?:
|
|
43
|
-
attributes?:
|
|
43
|
+
as?: AsTags;
|
|
44
|
+
attributes?: AsAttributes;
|
|
44
45
|
};
|
|
45
46
|
export declare type ContextMenuPropSortGroup = (a: string | number, b: string | number) => number;
|
|
46
47
|
export declare type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;
|
|
@@ -51,8 +52,8 @@ export declare type ContextMenuPropGetItemStatus<ITEM> = (item: ITEM) => Context
|
|
|
51
52
|
export declare type ContextMenuPropGetItemKey<ITEM> = (item: ITEM) => string | number | undefined;
|
|
52
53
|
export declare type ContextMenuPropGetItemOnClick<ITEM> = (item: ITEM) => ContextMenuPropOnClick<ITEM> | undefined;
|
|
53
54
|
export declare type ContextMenuPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;
|
|
54
|
-
export declare type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) =>
|
|
55
|
-
export declare type ContextMenuPropGetItemAttributes<ITEM> = (item: ITEM) =>
|
|
55
|
+
export declare type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;
|
|
56
|
+
export declare type ContextMenuPropGetItemAttributes<ITEM> = (item: ITEM) => AsAttributes | undefined;
|
|
56
57
|
export declare type ContextMenuPropGetItemGroupId<ITEM> = (item: ITEM) => number | undefined;
|
|
57
58
|
export declare type ContextMenuPropGetItemRightIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
|
|
58
59
|
export declare type ContextMenuPropGetItemLeftIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
|
|
@@ -146,12 +147,12 @@ export declare type ContextMenuLevelProps<ITEM = ContextMenuItemDefault, GROUP =
|
|
|
146
147
|
animate: Animate;
|
|
147
148
|
} & Required<MappersItem<ITEM>> & Required<MappersGroup<GROUP>>;
|
|
148
149
|
export declare type ContextMenuLevelComponent = <ITEM, GROUP>(props: ContextMenuLevelProps<ITEM, GROUP>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
149
|
-
export declare type ContextMenuItemProps<AS extends
|
|
150
|
+
export declare type ContextMenuItemProps<AS extends AsTags = 'div'> = PropsWithAsAttributes<Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {
|
|
150
151
|
size?: ContextMenuPropSize;
|
|
151
152
|
active: boolean;
|
|
152
153
|
withSubMenu: boolean;
|
|
153
154
|
}, AS> & React.RefAttributes<HTMLDivElement>;
|
|
154
|
-
export declare type ContextMenuItemComponent = <AS extends
|
|
155
|
+
export declare type ContextMenuItemComponent = <AS extends AsTags = 'div'>(props: ContextMenuItemProps<AS>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
155
156
|
export declare type GetLevelsParams<ITEM> = {
|
|
156
157
|
levels: Level<ITEM>[];
|
|
157
158
|
items: ITEM[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n] as const;\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnClick<ITEM> = (params: {\n e: React.MouseEvent<HTMLDivElement>;\n item: ITEM;\n}) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: ContextMenuPropOnClick<ContextMenuItemDefault>;\n as?: keyof JSX.IntrinsicElements;\n attributes?: JSX.IntrinsicElements[keyof JSX.IntrinsicElements];\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => ContextMenuPropOnClick<ITEM> | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (\n item: ITEM,\n) => keyof JSX.IntrinsicElements | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: readonly Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnClick<ITEM>;\n possibleDirections?: readonly Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type ContextMenuItemProps<\n AS extends keyof JSX.IntrinsicElements = 'div',\n> = PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n> &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <\n AS extends keyof JSX.IntrinsicElements = 'div',\n>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n classname?: string;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAgBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAAgC,CAAG,CAC9C,cAD8C,CAE9C,gBAF8C,CAG9C,aAH8C,CAI9C,eAJ8C,CAAzC,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["defaultListPropForm","listPropForm","contextMenuSizes","contextMenuDefaultSize","contextMenuStatus","contextMenuDefaultStatus","contextMenuForm","defaultContextMenuForm","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenu/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport {\n defaultListPropForm,\n ListPropForm,\n listPropForm,\n} from '##/components/ListCanary';\nimport { ComponentSize } from '##/hooks/useComponentSize';\nimport { Animate } from '##/mixs/MixPopoverAnimate';\nimport { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport {\n PropsWithHTMLAttributes,\n PropsWithHTMLAttributesAndRef,\n} from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 'xs', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuStatus = ['alert', 'success', 'warning'] as const;\nexport type ContextMenuStatus = typeof contextMenuStatus[number];\nexport const contextMenuDefaultStatus: ContextMenuStatus = contextMenuStatus[0];\n\nexport const contextMenuForm = listPropForm;\nexport type ContextMenuForm = ListPropForm;\nexport const defaultContextMenuForm = defaultListPropForm;\n\nexport const contextMenuPropSubMenuDirections = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n] as const;\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\nexport type ContextMenuPropOnClick<ITEM> = (params: {\n e: React.MouseEvent<HTMLDivElement>;\n item: ITEM;\n}) => void;\n\nexport type ContextMenuGroupDefault = {\n label?: string;\n id: number;\n};\n\nexport type ContextMenuItemDefault = {\n label: string | number;\n key?: string | number;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n subMenu?: ContextMenuItemDefault[];\n status?: ContextMenuStatus;\n disabled?: boolean;\n groupId?: number;\n onClick?: ContextMenuPropOnClick<ContextMenuItemDefault>;\n as?: AsTags;\n attributes?: AsAttributes;\n};\n\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\n\nexport type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;\n\nexport type ContextMenuPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ContextMenuPropGetItemSubMenu<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\n\nexport type ContextMenuPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ContextMenuStatus | undefined;\n\nexport type ContextMenuPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => ContextMenuPropOnClick<ITEM> | undefined;\n\nexport type ContextMenuPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;\n\nexport type ContextMenuPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes | undefined;\n\nexport type ContextMenuPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => number | undefined;\n\nexport type ContextMenuPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ContextMenuPropGetGroupLabel<GROUP> = (\n group: GROUP,\n) => string | undefined;\nexport type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type MappersItem<ITEM> = {\n getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;\n getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;\n getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;\n getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;\n getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;\n getItemKey?: ContextMenuPropGetItemKey<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;\n getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;\n getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;\n getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;\n};\n\nexport type MappersGroup<GROUP> = {\n getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;\n getGroupId?: ContextMenuPropGetGroupId<GROUP>;\n};\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: readonly Direction[];\n offset?: PopoverPropOffset;\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n};\n\nexport type AddLevel<ITEM> = (params: {\n level: number;\n items: ITEM[];\n parent?: ITEM;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n activeItem: string;\n}) => void;\n\nexport type ContextMenuProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n groups?: GROUP[];\n sortGroup?: ContextMenuPropSortGroup;\n onItemClick?: ContextMenuPropOnClick<ITEM>;\n possibleDirections?: readonly Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n spareDirection?: Direction;\n onSetDirection?: (direction: Direction) => void;\n onClickOutside?: ClickOutsideHandler;\n isOpen?: boolean;\n form?: ContextMenuForm;\n isMobile?: boolean;\n } & MappersItem<ITEM> &\n MappersGroup<GROUP> &\n PositioningProps,\n HTMLDivElement\n> &\n (GROUP extends { id: ContextMenuGroupDefault['id'] | unknown }\n ? {}\n : { getGroupId: ContextMenuPropGetGroupId<GROUP> }) &\n (ITEM extends { label: ContextMenuItemDefault['label'] }\n ? {}\n : { getItemLabel: ContextMenuPropGetItemLabel<ITEM> });\n\nexport type ContextMenuLevelsProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = ContextMenuProps<ITEM, GROUP> & {\n setComponentSize: React.Dispatch<React.SetStateAction<ComponentSize>>;\n disableAnimationBack: () => void;\n enableAnimationBack: () => void;\n};\n\nexport type ContextMenuLevelsComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuLevelsProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ContextMenuComponent = <\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n>(\n props: ContextMenuProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ContextMenuLevelProps<\n ITEM = ContextMenuItemDefault,\n GROUP = ContextMenuGroupDefault,\n> = Omit<\n ContextMenuProps<ITEM, GROUP>,\n | 'subMenuDirection'\n | 'onClickOutside'\n | 'setComponentSize'\n | 'animationBack'\n | 'disableAnimationBack'\n | 'enableAnimationBack'\n | keyof MappersItem<ITEM>\n | keyof MappersGroup<GROUP>\n> & {\n parent?: ITEM;\n levelDepth: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: (level: number) => void;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n animate: Animate;\n} & Required<MappersItem<ITEM>> &\n Required<MappersGroup<GROUP>>;\n\nexport type ContextMenuLevelComponent = <ITEM, GROUP>(\n props: ContextMenuLevelProps<ITEM, GROUP>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n Omit<ContextMenuItemDefault, 'onClick' | 'attributes' | 'key'> & {\n size?: ContextMenuPropSize;\n active: boolean;\n withSubMenu: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type GetLevelsParams<ITEM> = {\n levels: Level<ITEM>[];\n items: ITEM[];\n getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;\n getItemKey: ContextMenuPropGetItemKey<ITEM>;\n};\n\nexport type ContextMenuWrapperProps = PropsWithHTMLAttributes<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n className?: string;\n animationBack?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ContextMenuLevelWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n children: React.ReactNode;\n isOpen?: boolean;\n isMobile?: boolean;\n form?: ContextMenuForm;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n possibleDirections?: readonly Direction[];\n size?: ContextMenuPropSize;\n direction?: Direction;\n offset?: PopoverPropOffset;\n anchorRef?: React.RefObject<HTMLElement>;\n position?: Position;\n onSetDirection?: (direction: Direction) => void;\n classname?: string;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAEA,OACEA,mBADF,CAGEC,YAHF,qBAiBA,MAAO,IAAMC,iBAAgB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,gBAAe,CAAGL,YAAxB,CAEP,MAAO,IAAMM,uBAAsB,CAAGP,mBAA/B,CAEP,MAAO,IAAMQ,iCAAgC,CAAG,CAC9C,cAD8C,CAE9C,gBAF8C,CAG9C,aAH8C,CAI9C,eAJ8C,CAAzC,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AsAttributes, AsTags } from "../../utils/types/AsTags";
|
|
2
3
|
import { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';
|
|
3
4
|
import { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';
|
|
4
5
|
import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
@@ -18,8 +19,8 @@ export declare type ContextMenuPropGetDisable<ITEM> = (item: ITEM) => boolean |
|
|
|
18
19
|
export declare type ContextMenuPropGetGroupLabel = (id: string | number | undefined) => string | number | undefined;
|
|
19
20
|
export declare type ContextMenuPropSortGroup = (a: string | number, b: string | number) => number;
|
|
20
21
|
export declare type ContextMenuPropGetItemOnClick<ITEM> = (item: ITEM) => React.EventHandler<React.MouseEvent> | undefined;
|
|
21
|
-
export declare type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) =>
|
|
22
|
-
export declare type ContextMenuPropGetItemHTMLAttributes<ITEM> = (item: ITEM) =>
|
|
22
|
+
export declare type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags;
|
|
23
|
+
export declare type ContextMenuPropGetItemHTMLAttributes<ITEM> = (item: ITEM) => AsAttributes;
|
|
23
24
|
export declare const contextMenuPropSubMenuDirections: readonly ["rightStartUp", "rightStartDown", "leftStartUp", "leftStartDown"];
|
|
24
25
|
export declare type ContextMenuPropSubMenuDirection = typeof contextMenuPropSubMenuDirections[number];
|
|
25
26
|
export declare const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection;
|
|
@@ -70,7 +71,7 @@ declare type ContextMenuLevelProps<ITEM> = Omit<ContextMenuProps<ITEM> & {
|
|
|
70
71
|
hoveredParenLevel: number;
|
|
71
72
|
setHoveredParenLevel: (level: number) => void;
|
|
72
73
|
}, 'subMenuDirection' | 'getKey' | 'onClickOutside' | 'isOpen'>;
|
|
73
|
-
export declare type ContextMenuItemProps<AS extends
|
|
74
|
+
export declare type ContextMenuItemProps<AS extends AsTags = 'div'> = PropsWithAsAttributes<{
|
|
74
75
|
label: string | number;
|
|
75
76
|
rightSide?: React.ReactNode;
|
|
76
77
|
leftSide?: React.ReactNode;
|
|
@@ -87,7 +88,7 @@ export declare type Level<ITEM> = {
|
|
|
87
88
|
possibleDirections?: readonly Direction[];
|
|
88
89
|
offset?: PopoverPropOffset;
|
|
89
90
|
} & PositioningProps;
|
|
90
|
-
export declare type ContextMenuItemComponent = <AS extends
|
|
91
|
+
export declare type ContextMenuItemComponent = <AS extends AsTags = 'div'>(props: ContextMenuItemProps<AS>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
91
92
|
export declare type ContextMenuComponent = <ITEM>(props: ContextMenuProps<ITEM>) => React.ReactElement | null;
|
|
92
93
|
export declare type ContextMenuLevelType = <ITEM>(props: ContextMenuLevelProps<ITEM>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
93
94
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["contextMenuSizes","contextMenuDefaultSize","contextMenuAccent","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenuDeprecated/helpers.tsx"],"sourcesContent":["import { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuAccent = ['alert', 'warning', 'success'] as const;\nexport type ContextMenuAccent = typeof contextMenuAccent[number];\n\nexport type ContextMenuPropGetLabel<ITEM> = (item: ITEM) => string | number;\nexport type ContextMenuPropGetSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | null;\nexport type ContextMenuPropGetSubItems<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\nexport type ContextMenuPropGetAccent<ITEM> = (\n item: ITEM,\n) => ContextMenuAccent | undefined;\nexport type ContextMenuPropGetGroupId<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type ContextMenuPropGetKey<ITEM> = (item: ITEM) => string | number;\nexport type ContextMenuPropGetDisable<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type ContextMenuPropGetGroupLabel = (\n id: string | number | undefined,\n) => string | number | undefined;\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type ContextMenuPropGetItemAs<ITEM> = (
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["contextMenuSizes","contextMenuDefaultSize","contextMenuAccent","contextMenuPropSubMenuDirections","contextMenuPropDefaultSubMenuDirection"],"sources":["../../../../../src/components/ContextMenuDeprecated/helpers.tsx"],"sourcesContent":["import { AsAttributes, AsTags } from '##/utils/types/AsTags';\n\nimport { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';\nimport { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport { Direction, PopoverPropOffset, Position } from '../Popover/Popover';\n\nexport const contextMenuSizes = ['m', 's', 'l'] as const;\nexport type ContextMenuPropSize = typeof contextMenuSizes[number];\nexport const contextMenuDefaultSize: ContextMenuPropSize = contextMenuSizes[0];\n\nexport const contextMenuAccent = ['alert', 'warning', 'success'] as const;\nexport type ContextMenuAccent = typeof contextMenuAccent[number];\n\nexport type ContextMenuPropGetLabel<ITEM> = (item: ITEM) => string | number;\nexport type ContextMenuPropGetSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | null;\nexport type ContextMenuPropGetSubItems<ITEM> = (\n item: ITEM,\n) => ITEM[] | undefined;\nexport type ContextMenuPropGetAccent<ITEM> = (\n item: ITEM,\n) => ContextMenuAccent | undefined;\nexport type ContextMenuPropGetGroupId<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type ContextMenuPropGetKey<ITEM> = (item: ITEM) => string | number;\nexport type ContextMenuPropGetDisable<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type ContextMenuPropGetGroupLabel = (\n id: string | number | undefined,\n) => string | number | undefined;\nexport type ContextMenuPropSortGroup = (\n a: string | number,\n b: string | number,\n) => number;\nexport type ContextMenuPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.EventHandler<React.MouseEvent> | undefined;\nexport type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => AsTags;\nexport type ContextMenuPropGetItemHTMLAttributes<ITEM> = (\n item: ITEM,\n) => AsAttributes;\n\nexport const contextMenuPropSubMenuDirections = [\n 'rightStartUp',\n 'rightStartDown',\n 'leftStartUp',\n 'leftStartDown',\n] as const;\nexport type ContextMenuPropSubMenuDirection =\n typeof contextMenuPropSubMenuDirections[number];\nexport const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection =\n contextMenuPropSubMenuDirections[0];\n\ntype PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n position?: never;\n }\n | {\n anchorRef?: never;\n position: Position;\n };\n\nexport type ContextMenuProps<ITEM> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n getLabel: ContextMenuPropGetLabel<ITEM>;\n getLeftSideBar?: ContextMenuPropGetSide<ITEM>;\n getRightSideBar?: ContextMenuPropGetSide<ITEM>;\n getSubItems?: ContextMenuPropGetSubItems<ITEM>;\n getGroupId?: ContextMenuPropGetGroupId<ITEM>;\n getGroupLabel?: ContextMenuPropGetGroupLabel;\n getAccent?: ContextMenuPropGetAccent<ITEM>;\n size?: ContextMenuPropSize;\n sortGroup?: ContextMenuPropSortGroup;\n getOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;\n direction?: Direction;\n possibleDirections?: readonly Direction[];\n subMenuDirection?: ContextMenuPropSubMenuDirection;\n getKey?: ContextMenuPropGetKey<ITEM>;\n getDisabled?: ContextMenuPropGetDisable<ITEM>;\n offset?: PopoverPropOffset;\n onItemClick?: (props: { e: React.MouseEvent; item: ITEM }) => void;\n onClickOutside?: ClickOutsideHandler;\n spareDirection?: Direction;\n getItemAs?: ContextMenuPropGetItemAs<ITEM>;\n getItemHTMLAttributes?: ContextMenuPropGetItemHTMLAttributes<ITEM>;\n onSetDirection?: (direction: Direction) => void;\n } & PositioningProps,\n HTMLDivElement\n>;\n\nexport type AddLevel<ITEM> = (\n level: number,\n items: ITEM[],\n anchorRef: React.RefObject<HTMLElement>,\n activeItem: string,\n) => void;\n\nexport type DeleteLevel = (level: number) => void;\n\ntype ContextMenuLevelProps<ITEM> = Omit<\n ContextMenuProps<ITEM> & {\n level: number;\n addLevel: AddLevel<ITEM>;\n deleteLevel: DeleteLevel;\n activeItem?: string;\n onSetDirection?: (direction: Direction) => void;\n hoveredParenLevel: number;\n setHoveredParenLevel: (level: number) => void;\n },\n 'subMenuDirection' | 'getKey' | 'onClickOutside' | 'isOpen'\n>;\n\nexport type ContextMenuItemProps<AS extends AsTags = 'div'> =\n PropsWithAsAttributes<\n {\n label: string | number;\n rightSide?: React.ReactNode;\n leftSide?: React.ReactNode;\n size?: ContextMenuPropSize;\n active?: boolean;\n withSubMenu: boolean;\n accent?: ContextMenuAccent;\n disabled?: boolean;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type Level<ITEM> = {\n items: ITEM[];\n activeItem?: string;\n direction?: Direction;\n possibleDirections?: readonly Direction[];\n offset?: PopoverPropOffset;\n} & PositioningProps;\n\nexport type ContextMenuItemComponent = <AS extends AsTags = 'div'>(\n props: ContextMenuItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type ContextMenuComponent = <ITEM>(\n props: ContextMenuProps<ITEM>,\n) => React.ReactElement | null;\n\nexport type ContextMenuLevelType = <ITEM>(\n props: ContextMenuLevelProps<ITEM>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n"],"mappings":"AAOA,MAAO,IAAMA,iBAAgB,CAAG,CAAC,GAAD,CAAM,GAAN,CAAW,GAAX,CAAzB,CAEP,MAAO,IAAMC,uBAA2C,CAAGD,gBAAgB,CAAC,CAAD,CAApE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA1B,CAmCP,MAAO,IAAMC,iCAAgC,CAAG,CAC9C,cAD8C,CAE9C,gBAF8C,CAG9C,aAH8C,CAI9C,eAJ8C,CAAzC,CAQP,MAAO,IAAMC,uCAAuE,CAClFD,gCAAgC,CAAC,CAAD,CAD3B"}
|
package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/DatePickerFieldTypeDate.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const DatePickerFieldTypeDate: React.ForwardRefExoticComponent<{
|
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
size?: "m" | "s" | "xs" | "l" | undefined;
|
|
14
14
|
view?: "default" | "clear" | undefined;
|
|
15
|
-
form?: "default" | "
|
|
15
|
+
form?: "default" | "defaultClear" | "defaultBrick" | "brick" | "brickDefault" | "brickClear" | "brickRound" | "round" | "roundClear" | "roundBrick" | "clearRound" | "clearDefault" | "clearBrick" | "clearClear" | undefined;
|
|
16
16
|
status?: "alert" | "warning" | "success" | undefined;
|
|
17
17
|
width?: "default" | "full" | undefined;
|
|
18
18
|
onFocus?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
@@ -38,4 +38,4 @@ export declare const DatePickerFieldTypeDate: React.ForwardRefExoticComponent<{
|
|
|
38
38
|
caption?: string | undefined;
|
|
39
39
|
labelPosition?: "left" | "top" | undefined;
|
|
40
40
|
withClearButton?: boolean | undefined;
|
|
41
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "
|
|
41
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "autoFocus" | "disabled" | "value" | "readOnly" | "required" | "inputRef" | "focused" | "ariaLabel" | "labelIcon" | "labelPosition" | "format" | "leftSide" | "rightSide" | "withClearButton" | "iconSize" | "minDate" | "maxDate"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -12,7 +12,7 @@ export declare const DatePickerFieldTypeDateTime: React.ForwardRefExoticComponen
|
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
size?: "m" | "s" | "xs" | "l" | undefined;
|
|
14
14
|
view?: "default" | "clear" | undefined;
|
|
15
|
-
form?: "default" | "
|
|
15
|
+
form?: "default" | "defaultClear" | "defaultBrick" | "brick" | "brickDefault" | "brickClear" | "brickRound" | "round" | "roundClear" | "roundBrick" | "clearRound" | "clearDefault" | "clearBrick" | "clearClear" | undefined;
|
|
16
16
|
status?: "alert" | "warning" | "success" | undefined;
|
|
17
17
|
width?: "default" | "full" | undefined;
|
|
18
18
|
onFocus?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
@@ -41,4 +41,4 @@ export declare const DatePickerFieldTypeDateTime: React.ForwardRefExoticComponen
|
|
|
41
41
|
caption?: string | undefined;
|
|
42
42
|
labelPosition?: "left" | "top" | undefined;
|
|
43
43
|
withClearButton?: boolean | undefined;
|
|
44
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "
|
|
44
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "autoFocus" | "disabled" | "value" | "readOnly" | "required" | "inputRef" | "focused" | "ariaLabel" | "labelIcon" | "labelPosition" | "format" | "leftSide" | "rightSide" | "withClearButton" | "iconSize" | "minDate" | "maxDate" | "multiplicitySeconds" | "multiplicityMinutes" | "multiplicityHours"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -12,7 +12,7 @@ export declare const DatePickerFieldTypeMonth: React.ForwardRefExoticComponent<{
|
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
size?: "m" | "s" | "xs" | "l" | undefined;
|
|
14
14
|
view?: "default" | "clear" | undefined;
|
|
15
|
-
form?: "default" | "
|
|
15
|
+
form?: "default" | "defaultClear" | "defaultBrick" | "brick" | "brickDefault" | "brickClear" | "brickRound" | "round" | "roundClear" | "roundBrick" | "clearRound" | "clearDefault" | "clearBrick" | "clearClear" | undefined;
|
|
16
16
|
status?: "alert" | "warning" | "success" | undefined;
|
|
17
17
|
width?: "default" | "full" | undefined;
|
|
18
18
|
onFocus?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
@@ -38,4 +38,4 @@ export declare const DatePickerFieldTypeMonth: React.ForwardRefExoticComponent<{
|
|
|
38
38
|
caption?: string | undefined;
|
|
39
39
|
labelPosition?: "left" | "top" | undefined;
|
|
40
40
|
withClearButton?: boolean | undefined;
|
|
41
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "
|
|
41
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "autoFocus" | "disabled" | "value" | "readOnly" | "required" | "inputRef" | "focused" | "ariaLabel" | "labelIcon" | "labelPosition" | "format" | "leftSide" | "rightSide" | "withClearButton" | "iconSize" | "minDate" | "maxDate"> & React.RefAttributes<HTMLDivElement>>;
|
package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const DatePickerFieldTypeTime: React.ForwardRefExoticComponent<{
|
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
size?: "m" | "s" | "xs" | "l" | undefined;
|
|
14
14
|
view?: "default" | "clear" | undefined;
|
|
15
|
-
form?: "default" | "
|
|
15
|
+
form?: "default" | "defaultClear" | "defaultBrick" | "brick" | "brickDefault" | "brickClear" | "brickRound" | "round" | "roundClear" | "roundBrick" | "clearRound" | "clearDefault" | "clearBrick" | "clearClear" | undefined;
|
|
16
16
|
status?: "alert" | "warning" | "success" | undefined;
|
|
17
17
|
width?: "default" | "full" | undefined;
|
|
18
18
|
onFocus?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
@@ -41,4 +41,4 @@ export declare const DatePickerFieldTypeTime: React.ForwardRefExoticComponent<{
|
|
|
41
41
|
caption?: string | undefined;
|
|
42
42
|
labelPosition?: "left" | "top" | undefined;
|
|
43
43
|
withClearButton?: boolean | undefined;
|
|
44
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "
|
|
44
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "autoFocus" | "disabled" | "value" | "readOnly" | "required" | "inputRef" | "focused" | "ariaLabel" | "labelIcon" | "labelPosition" | "format" | "leftSide" | "rightSide" | "withClearButton" | "iconSize" | "minDate" | "maxDate" | "multiplicitySeconds" | "multiplicityMinutes" | "multiplicityHours"> & React.RefAttributes<HTMLDivElement>>;
|
package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/DatePickerFieldTypeYear.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const DatePickerFieldTypeYear: React.ForwardRefExoticComponent<{
|
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
size?: "m" | "s" | "xs" | "l" | undefined;
|
|
14
14
|
view?: "default" | "clear" | undefined;
|
|
15
|
-
form?: "default" | "
|
|
15
|
+
form?: "default" | "defaultClear" | "defaultBrick" | "brick" | "brickDefault" | "brickClear" | "brickRound" | "round" | "roundClear" | "roundBrick" | "clearRound" | "clearDefault" | "clearBrick" | "clearClear" | undefined;
|
|
16
16
|
status?: "alert" | "warning" | "success" | undefined;
|
|
17
17
|
width?: "default" | "full" | undefined;
|
|
18
18
|
onFocus?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
@@ -38,4 +38,4 @@ export declare const DatePickerFieldTypeYear: React.ForwardRefExoticComponent<{
|
|
|
38
38
|
caption?: string | undefined;
|
|
39
39
|
labelPosition?: "left" | "top" | undefined;
|
|
40
40
|
withClearButton?: boolean | undefined;
|
|
41
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "
|
|
41
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "className" | "id" | "placeholder" | "tabIndex" | "children" | "onFocus" | "onBlur" | "onChange" | "onError" | "size" | "caption" | "form" | "label" | "view" | "separator" | "status" | "name" | "width" | "autoFocus" | "disabled" | "value" | "readOnly" | "required" | "inputRef" | "focused" | "ariaLabel" | "labelIcon" | "labelPosition" | "format" | "leftSide" | "rightSide" | "withClearButton" | "iconSize" | "minDate" | "maxDate"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import './FileField.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { AsTags } from "../../utils/types/AsTags";
|
|
3
4
|
import { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';
|
|
4
5
|
declare type ComponentProps = {
|
|
5
6
|
role: string;
|
|
6
|
-
as:
|
|
7
|
+
as: AsTags;
|
|
7
8
|
};
|
|
8
9
|
declare type RenderFn = (props: ComponentProps) => React.ReactNode;
|
|
9
10
|
export declare type FileFieldProps = PropsWithJsxAttributes<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileField.js","names":["React","useRef","useForkRef","cnMixVisuallyHidden","cn","usePropsHandler","COMPONENT_NAME","isRenderFn","fn","call","cnFileField","FileField","props","fileFieldRef","className","children","id","inputRef","ariaLabel","inputProps","content","role","as"],"sources":["../../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import './FileField.css';\n\nimport React, { useRef } from 'react';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixVisuallyHidden } from '../../mixs/MixVisuallyHidden/MixVisuallyHidden';\nimport { cn } from '../../utils/bem';\nimport { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\ntype ComponentProps = { role: string; as:
|
|
1
|
+
{"version":3,"file":"FileField.js","names":["React","useRef","useForkRef","cnMixVisuallyHidden","cn","usePropsHandler","COMPONENT_NAME","isRenderFn","fn","call","cnFileField","FileField","props","fileFieldRef","className","children","id","inputRef","ariaLabel","inputProps","content","role","as"],"sources":["../../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import './FileField.css';\n\nimport React, { useRef } from 'react';\n\nimport { AsTags } from '##/utils/types/AsTags';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixVisuallyHidden } from '../../mixs/MixVisuallyHidden/MixVisuallyHidden';\nimport { cn } from '../../utils/bem';\nimport { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\ntype ComponentProps = { role: string; as: AsTags };\n\ntype RenderFn = (props: ComponentProps) => React.ReactNode;\n\nexport type FileFieldProps = PropsWithJsxAttributes<\n {\n id: string;\n onChange?: (e: DragEvent | React.ChangeEvent) => void;\n children?: RenderFn | React.ReactNode;\n inputRef?: React.Ref<HTMLInputElement>;\n },\n 'input'\n>;\n\nexport const COMPONENT_NAME = 'FileField' as const;\n\nfunction isRenderFn(fn: RenderFn | React.ReactNode): fn is RenderFn {\n return (fn as RenderFn).call !== undefined;\n}\n\nexport const cnFileField = cn('FileField');\n\nexport const FileField: React.FC<FileFieldProps> = (props) => {\n const fileFieldRef = useRef<HTMLInputElement>(null);\n\n const {\n className,\n children,\n id,\n inputRef,\n 'aria-label': ariaLabel = 'File input',\n ...inputProps\n } = usePropsHandler(COMPONENT_NAME, props, fileFieldRef);\n\n const content = isRenderFn(children)\n ? children({ role: 'button', as: 'span' })\n : children;\n\n return (\n <label htmlFor={id} className={cnFileField(null, [className])}>\n <input\n {...inputProps}\n className={cnFileField('Input', [cnMixVisuallyHidden()])}\n id={id}\n type=\"file\"\n aria-label={ariaLabel}\n ref={useForkRef([inputRef, fileFieldRef])}\n />\n {content}\n </label>\n );\n};\n"],"mappings":"yJAAA,wBAEA,MAAOA,MAAP,EAAgBC,MAAhB,KAA8B,OAA9B,CAIA,OAASC,UAAT,yCACA,OAASC,mBAAT,sDACA,OAASC,EAAT,uBAEA,OAASC,eAAT,2CAgBA,MAAO,IAAMC,eAAc,CAAG,WAAvB,CAEP,QAASC,WAAT,CAAoBC,CAApB,CAAoE,CAClE,MAAQA,EAAD,CAAiBC,IAAjB,SACR,CAED,MAAO,IAAMC,YAAW,CAAGN,EAAE,CAAC,WAAD,CAAtB,CAEP,MAAO,IAAMO,UAAmC,CAAG,SAACC,CAAD,CAAW,IACtDC,EAAY,CAAGZ,MAAM,CAAmB,IAAnB,CADiC,GAUxDI,eAAe,CAACC,cAAD,CAAiBM,CAAjB,CAAwBC,CAAxB,CAVyC,CAI1DC,CAJ0D,GAI1DA,SAJ0D,CAK1DC,CAL0D,GAK1DA,QAL0D,CAM1DC,CAN0D,GAM1DA,EAN0D,CAO1DC,CAP0D,GAO1DA,QAP0D,KAQ1D,YAR0D,EAQ5CC,CAR4C,YAQhC,YARgC,GASvDC,CATuD,uCAYtDC,CAAO,CAAGb,UAAU,CAACQ,CAAD,CAAV,CACZA,CAAQ,CAAC,CAAEM,IAAI,CAAE,QAAR,CAAkBC,EAAE,CAAE,MAAtB,CAAD,CADI,CAEZP,CAdwD,CAgB5D,MACE,8BAAO,OAAO,CAAEC,CAAhB,CAAoB,SAAS,CAAEN,WAAW,CAAC,IAAD,CAAO,CAACI,CAAD,CAAP,CAA1C,EACE,6CACMK,CADN,EAEE,SAAS,CAAET,WAAW,CAAC,OAAD,CAAU,CAACP,mBAAmB,EAApB,CAAV,CAFxB,CAGE,EAAE,CAAEa,CAHN,CAIE,IAAI,CAAC,MAJP,CAKE,aAAYE,CALd,CAME,GAAG,CAAEhB,UAAU,CAAC,CAACe,CAAD,CAAWJ,CAAX,CAAD,CANjB,GADF,CASGO,CATH,CAYH,CA7BM"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './HeaderLogo.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { AsTags } from "../../../utils/types/AsTags";
|
|
3
4
|
import { PropsWithAsAttributes } from '../../../utils/types/PropsWithAsAttributes';
|
|
4
5
|
export declare const cnHeaderLogo: import("@bem-react/classname").ClassNameFormatter;
|
|
5
|
-
export declare type HeaderProps<As extends
|
|
6
|
-
export declare const HeaderLogo: <As extends
|
|
6
|
+
export declare type HeaderProps<As extends AsTags> = PropsWithAsAttributes<{}, As>;
|
|
7
|
+
export declare const HeaderLogo: <As extends AsTags = "div">(props: HeaderProps<As>) => React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderLogo.js","names":["React","cn","cnHeaderLogo","HeaderLogo","props","children","as","className","otherProps"],"sources":["../../../../../../src/components/Header/Logo/HeaderLogo.tsx"],"sourcesContent":["import './HeaderLogo.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithAsAttributes } from '../../../utils/types/PropsWithAsAttributes';\n\nexport const cnHeaderLogo = cn('HeaderLogo');\n\nexport type HeaderProps<As extends
|
|
1
|
+
{"version":3,"file":"HeaderLogo.js","names":["React","cn","cnHeaderLogo","HeaderLogo","props","children","as","className","otherProps"],"sources":["../../../../../../src/components/Header/Logo/HeaderLogo.tsx"],"sourcesContent":["import './HeaderLogo.css';\n\nimport React from 'react';\n\nimport { AsTags } from '##/utils/types/AsTags';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithAsAttributes } from '../../../utils/types/PropsWithAsAttributes';\n\nexport const cnHeaderLogo = cn('HeaderLogo');\n\nexport type HeaderProps<As extends AsTags> = PropsWithAsAttributes<{}, As>;\n\nexport const HeaderLogo = <As extends AsTags = 'div'>(\n props: HeaderProps<As>,\n): React.ReactElement => {\n const { children, as = 'div', className, ...otherProps } = props;\n const Tag = as as string;\n return (\n <Tag className={cnHeaderLogo(null, [className])} {...otherProps}>\n {children}\n </Tag>\n );\n};\n"],"mappings":"iIAAA,yBAEA,MAAOA,MAAP,KAAkB,OAAlB,CAIA,OAASC,EAAT,0BAGA,MAAO,IAAMC,aAAY,CAAGD,EAAE,CAAC,YAAD,CAAvB,CAIP,MAAO,IAAME,WAAU,CAAG,SACxBC,CADwB,CAED,IACfC,EADe,CACoCD,CADpC,CACfC,QADe,GACoCD,CADpC,CACLE,EADK,CACLA,CADK,YACA,KADA,GACOC,CADP,CACoCH,CADpC,CACOG,SADP,CACqBC,CADrB,0BACoCJ,CADpC,YAGvB,MACE,qBAFUE,CAEV,gBAAK,SAAS,CAAEJ,YAAY,CAAC,IAAD,CAAO,CAACK,CAAD,CAAP,CAA5B,EAAqDC,CAArD,EACGH,CADH,CAIH,CAVM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","active","label","innerOffset","disabled","className","leftSide","rightSide","rightIcon","leftIcon","as","checked","onClick","status","space","iconSize"];import"./ListItem.css";import React,{forwardRef}from"react";import{
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","active","label","innerOffset","disabled","className","leftSide","rightSide","rightIcon","leftIcon","as","checked","onClick","status","space","iconSize"];import"./ListItem.css";import React,{forwardRef}from"react";import{cnText}from"../../Text";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{cnListItemGrid,renderSlot}from"../ListItemGrid";import{mapHorisontalSpase,mapHorisontalSpaseIncreased,mapItemVerticalPadding}from"../maps";import{defaultListPropSize}from"../types";export var cnListItem=cn("ListItem");var ListItemRender=function(a,b){var c=a.size,d=void 0===c?defaultListPropSize:c,e=a.active,f=a.label,g=a.innerOffset,h=a.disabled,i=a.className,j=a.leftSide,k=a.rightSide,l=a.rightIcon,m=a.leftIcon,n=a.as,o=void 0===n?"div":n,p=a.checked,q=a.onClick,r=a.status,s=a.space,t=a.iconSize,u=_objectWithoutProperties(a,_excluded),v=q&&!h?q:void 0;return React.createElement(o,Object.assign({},u,{className:cnListItem({active:e,disabled:h,checked:p,interactive:!!v},[cnText({lineHeight:"xs",size:d,view:r}),cnMixSpace(s||{pH:"increased"===g?mapHorisontalSpaseIncreased[d]:mapHorisontalSpase[d],pV:mapItemVerticalPadding[d]}),cnListItemGrid(),i]),onClick:v,ref:b}),renderSlot(j,"left",d,m,t),l||k||j||m?f&&React.createElement("span",{className:cnListItemGrid("Slot",{position:"center"})},f):f,renderSlot(k,"right",d,l,t))};export var ListItem=forwardRef(ListItemRender);
|
|
2
2
|
//# sourceMappingURL=ListItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","names":["React","forwardRef","
|
|
1
|
+
{"version":3,"file":"ListItem.js","names":["React","forwardRef","cnText","cnMixSpace","cn","cnListItemGrid","renderSlot","mapHorisontalSpase","mapHorisontalSpaseIncreased","mapItemVerticalPadding","defaultListPropSize","cnListItem","ListItemRender","props","ref","size","active","label","innerOffset","disabled","className","leftSide","rightSide","rightIcon","leftIcon","as","Tag","checked","onClick","status","space","iconSize","otherProps","handleClick","interactive","lineHeight","view","pH","pV","position","ListItem"],"sources":["../../../../../../src/components/ListCanary/ListItem/ListItem.tsx"],"sourcesContent":["import './ListItem.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { cnText } from '##/components/Text';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\n\nimport { cnListItemGrid, renderSlot } from '../ListItemGrid';\nimport {\n mapHorisontalSpase,\n mapHorisontalSpaseIncreased,\n mapItemVerticalPadding,\n} from '../maps';\nimport {\n defaultListPropSize,\n ListItemComponent,\n ListItemProps,\n} from '../types';\n\nexport const cnListItem = cn('ListItem');\n\nconst ListItemRender = (\n props: ListItemProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n size = defaultListPropSize,\n active,\n label,\n innerOffset,\n disabled,\n className,\n leftSide,\n rightSide,\n rightIcon,\n leftIcon,\n as: Tag = 'div',\n checked,\n onClick,\n status,\n space,\n iconSize,\n ...otherProps\n } = props;\n\n const handleClick: React.MouseEventHandler<HTMLDivElement> | undefined =\n onClick && !disabled ? onClick : undefined;\n\n return (\n <Tag\n {...otherProps}\n className={cnListItem(\n { active, disabled, checked, interactive: !!handleClick },\n [\n cnText({\n lineHeight: 'xs',\n size,\n view: status,\n }),\n cnMixSpace(\n space || {\n pH:\n innerOffset === 'increased'\n ? mapHorisontalSpaseIncreased[size]\n : mapHorisontalSpase[size],\n pV: mapItemVerticalPadding[size],\n },\n ),\n cnListItemGrid(),\n className,\n ],\n )}\n onClick={handleClick}\n ref={ref}\n >\n {renderSlot(leftSide, 'left', size, leftIcon, iconSize)}\n {!rightIcon && !rightSide && !leftSide && !leftIcon\n ? label\n : label && (\n <span className={cnListItemGrid('Slot', { position: 'center' })}>\n {label}\n </span>\n )}\n {renderSlot(rightSide, 'right', size, rightIcon, iconSize)}\n </Tag>\n );\n};\n\nexport const ListItem = forwardRef(ListItemRender) as ListItemComponent;\n"],"mappings":"q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AAUG,QAAQ,CAARA,CAAV,CAAoBQ,OAAO,CAAPA,CAApB,CAA6BO,WAAW,CAAE,CAAC,CAACD,CAA5C,CADmB,CAEnB,CACE/B,MAAM,CAAC,CACLiC,UAAU,CAAE,IADP,CAELpB,IAAI,CAAJA,CAFK,CAGLqB,IAAI,CAAEP,CAHD,CAAD,CADR,CAME1B,UAAU,CACR2B,CAAK,EAAI,CACPO,EAAE,CACgB,WAAhB,GAAAnB,CAAW,CACPV,2BAA2B,CAACO,CAAD,CADpB,CAEPR,kBAAkB,CAACQ,CAAD,CAJjB,CAKPuB,EAAE,CAAE7B,sBAAsB,CAACM,CAAD,CALnB,CADD,CANZ,CAeEV,cAAc,EAfhB,CAgBEe,CAhBF,CAFmB,CAFvB,CAuBE,OAAO,CAAEa,CAvBX,CAwBE,GAAG,CAAEnB,CAxBP,GA0BGR,UAAU,CAACe,CAAD,CAAW,MAAX,CAAmBN,CAAnB,CAAyBS,CAAzB,CAAmCO,CAAnC,CA1Bb,CA2BIR,CAAD,EAAeD,CAAf,EAA6BD,CAA7B,EAA0CG,CAA1C,CAEGP,CAAK,EACH,4BAAM,SAAS,CAAEZ,cAAc,CAAC,MAAD,CAAS,CAAEkC,QAAQ,CAAE,QAAZ,CAAT,CAA/B,EACGtB,CADH,CAHL,CACGA,CA5BN,CAkCGX,UAAU,CAACgB,CAAD,CAAY,OAAZ,CAAqBP,CAArB,CAA2BQ,CAA3B,CAAsCQ,CAAtC,CAlCb,CAqCH,CAjED,CAmEA,MAAO,IAAMS,SAAQ,CAAGvC,UAAU,CAACW,cAAD,CAA3B"}
|
|
@@ -3,4 +3,4 @@ import React from 'react';
|
|
|
3
3
|
import { IconComponent, IconPropSize } from "../../../icons/Icon";
|
|
4
4
|
import { ListPropSize } from '../types';
|
|
5
5
|
export declare const cnListItemGrid: import("@bem-react/classname").ClassNameFormatter;
|
|
6
|
-
export declare const renderSlot: (side: React.ReactNode, position: 'left' | 'right', size: ListPropSize,
|
|
6
|
+
export declare const renderSlot: (side: React.ReactNode, position: 'left' | 'right', size: ListPropSize, Icon?: IconComponent, iconSize?: IconPropSize) => React.ReactNode[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import"./ListItemGrid.css";import React from"react";import{cn}from"../../../utils/bem";import{getByMap}from"../../../utils/getByMap";import{mapIconSize}from"../maps";export var cnListItemGrid=cn("ListItemGrid");export var renderSlot=function(a,b,c,d,e){var f=a?_toConsumableArray(Array.isArray(a)?a:[a]):[];if(d){var g=React.createElement(d,{size:getByMap(mapIconSize,c,e)});"left"===b&&f.push(g),"right"===b&&f.unshift(g)}return f.map(function(a,c){return React.createElement("div",{className:cnListItemGrid("Slot",{position:b}),key:cnListItemGrid("Slot",{position:b,index:c})},a)})};
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import"./ListItemGrid.css";import React from"react";import{cn}from"../../../utils/bem";import{getByMap}from"../../../utils/getByMap";import{isNotNil}from"../../../utils/type-guards";import{mapIconSize}from"../maps";export var cnListItemGrid=cn("ListItemGrid");export var renderSlot=function(a,b,c,d,e){var f=a?_toConsumableArray(Array.isArray(a)?a:[a]):[];if(d){var g=React.createElement(d,{size:getByMap(mapIconSize,c,e)});"left"===b&&f.push(g),"right"===b&&f.unshift(g)}return f.map(function(a,c){if(isNotNil(a))return React.createElement("div",{className:cnListItemGrid("Slot",{position:b}),key:cnListItemGrid("Slot",{position:b,index:c})},a)})};
|
|
2
2
|
//# sourceMappingURL=ListItemGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemGrid.js","names":["React","cn","getByMap","mapIconSize","cnListItemGrid","renderSlot","side","position","size","
|
|
1
|
+
{"version":3,"file":"ListItemGrid.js","names":["React","cn","getByMap","isNotNil","mapIconSize","cnListItemGrid","renderSlot","side","position","size","Icon","iconSize","sides","Array","isArray","render","push","unshift","map","item","index"],"sources":["../../../../../../src/components/ListCanary/ListItemGrid/ListItemGrid.tsx"],"sourcesContent":["import './ListItemGrid.css';\n\nimport React from 'react';\n\nimport { IconComponent, IconPropSize } from '##/icons/Icon';\nimport { cn } from '##/utils/bem';\nimport { getByMap } from '##/utils/getByMap';\nimport { isNotNil } from '##/utils/type-guards';\n\nimport { mapIconSize } from '../maps';\nimport { ListPropSize } from '../types';\n\nexport const cnListItemGrid = cn('ListItemGrid');\n\nexport const renderSlot = (\n side: React.ReactNode,\n position: 'left' | 'right',\n size: ListPropSize,\n Icon?: IconComponent,\n iconSize?: IconPropSize,\n): React.ReactNode[] => {\n const sides: React.ReactNode[] = side\n ? [...(Array.isArray(side) ? side : [side])]\n : [];\n if (Icon) {\n const render = <Icon size={getByMap(mapIconSize, size, iconSize)} />;\n if (position === 'left') {\n sides.push(render);\n }\n if (position === 'right') {\n sides.unshift(render);\n }\n }\n return sides.map((item, index) => {\n if (isNotNil(item)) {\n return (\n <div\n className={cnListItemGrid('Slot', {\n position,\n })}\n key={cnListItemGrid('Slot', {\n position,\n index,\n })}\n >\n {item}\n </div>\n );\n }\n });\n};\n"],"mappings":"yEAAA,2BAEA,MAAOA,MAAP,KAAkB,OAAlB,CAGA,OAASC,EAAT,0BACA,OAASC,QAAT,+BACA,OAASC,QAAT,kCAEA,OAASC,WAAT,eAGA,MAAO,IAAMC,eAAc,CAAGJ,EAAE,CAAC,cAAD,CAAzB,CAEP,MAAO,IAAMK,WAAU,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGxBC,CAHwB,CAIxBC,CAJwB,CAKxBC,CALwB,CAMF,CACtB,GAAMC,EAAwB,CAAGL,CAAI,oBAC5BM,KAAK,CAACC,OAAN,CAAcP,CAAd,EAAsBA,CAAtB,CAA6B,CAACA,CAAD,CADD,EAEjC,EAFJ,CAGA,GAAIG,CAAJ,CAAU,CACR,GAAMK,EAAM,CAAG,oBAAC,CAAD,EAAM,IAAI,CAAEb,QAAQ,CAACE,WAAD,CAAcK,CAAd,CAAoBE,CAApB,CAApB,EAAf,CACiB,MAAb,GAAAH,CAFI,EAGNI,CAAK,CAACI,IAAN,CAAWD,CAAX,CAHM,CAKS,OAAb,GAAAP,CALI,EAMNI,CAAK,CAACK,OAAN,CAAcF,CAAd,CAEH,CACD,MAAOH,EAAK,CAACM,GAAN,CAAU,SAACC,CAAD,CAAOC,CAAP,CAAiB,CAChC,GAAIjB,QAAQ,CAACgB,CAAD,CAAZ,CACE,MACE,4BACE,SAAS,CAAEd,cAAc,CAAC,MAAD,CAAS,CAChCG,QAAQ,CAARA,CADgC,CAAT,CAD3B,CAIE,GAAG,CAAEH,cAAc,CAAC,MAAD,CAAS,CAC1BG,QAAQ,CAARA,CAD0B,CAE1BY,KAAK,CAALA,CAF0B,CAAT,CAJrB,EASGD,CATH,CAaL,CAhBM,CAiBR,CApCM"}
|
|
@@ -2,6 +2,7 @@ import { IconComponent, IconPropSize } from '@consta/icons/Icon';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MixSpaceProps } from "../../mixs/MixSpace";
|
|
4
4
|
import { Group } from "../../utils/getGroups";
|
|
5
|
+
import { AsAttributes, AsTags } from "../../utils/types/AsTags";
|
|
5
6
|
import { PropsWithAsAttributes } from "../../utils/types/PropsWithAsAttributes";
|
|
6
7
|
import { PropsWithHTMLAttributesAndRef } from "../../utils/types/PropsWithHTMLAttributes";
|
|
7
8
|
export declare const listPropSize: readonly ["m", "xs", "s", "l"];
|
|
@@ -49,8 +50,8 @@ export declare type ListPropGetItemLeftSide<ITEM> = (item: ITEM) => React.ReactN
|
|
|
49
50
|
export declare type ListPropGetItemLeftIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
|
|
50
51
|
export declare type ListPropGetItemRightSide<ITEM> = (item: ITEM) => React.ReactNode | undefined;
|
|
51
52
|
export declare type ListPropGetItemRightIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
|
|
52
|
-
export declare type ListPropGetItemAs<ITEM> = (item: ITEM) =>
|
|
53
|
-
export declare type ListPropGetItemAttributes<ITEM> = (item: ITEM) =>
|
|
53
|
+
export declare type ListPropGetItemAs<ITEM> = (item: ITEM) => AsTags | undefined;
|
|
54
|
+
export declare type ListPropGetItemAttributes<ITEM> = (item: ITEM) => AsAttributes | undefined;
|
|
54
55
|
export declare type ListPropGetItemOnClick<ITEM> = (item: ITEM) => React.MouseEventHandler | undefined;
|
|
55
56
|
export declare type ListPropSortGroup<ITEM, GROUP> = (a: Group<ITEM, GROUP>, b: Group<ITEM, GROUP>) => number;
|
|
56
57
|
export declare type ListPropGetGroupKey<GROUP> = (item: GROUP) => string | number;
|
|
@@ -99,13 +100,13 @@ export declare type ListProps<ITEM = DefaultListItem, GROUP = DefaultListGroup>
|
|
|
99
100
|
getGroupKey: ListPropGetGroupKey<GROUP>;
|
|
100
101
|
});
|
|
101
102
|
export declare type ListComponent = <ITEM = DefaultListItem, GROUP = DefaultListGroup>(props: ListProps<ITEM, GROUP>) => React.ReactElement | null;
|
|
102
|
-
export declare type ListItemProps<AS extends
|
|
103
|
+
export declare type ListItemProps<AS extends AsTags = 'div'> = PropsWithAsAttributes<Omit<DefaultListItem, 'id' | 'groupId' | 'attributes' | 'onClick'> & {
|
|
103
104
|
size?: ListPropSize;
|
|
104
105
|
innerOffset?: 'normal' | 'increased';
|
|
105
106
|
space?: MixSpaceProps;
|
|
106
107
|
iconSize?: IconPropSize;
|
|
107
108
|
}, AS>;
|
|
108
|
-
export declare type ListItemComponent = <AS extends
|
|
109
|
+
export declare type ListItemComponent = <AS extends AsTags = 'div'>(props: ListItemProps<AS>) => React.ReactElement | null;
|
|
109
110
|
export declare type ListGroupLabelProps = PropsWithHTMLAttributesAndRef<{
|
|
110
111
|
size?: ListPropSize;
|
|
111
112
|
label: string;
|