@vkontakte/vkui 4.22.0 → 4.22.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/.cache/.eslintcache +1 -1
- package/.cache/.stylelintcache +1 -1
- package/.cache/.tsbuildinfo +14 -8
- package/.cache/ts/src/components/TabbarItem/TabbarItem.d.ts +3 -1
- package/dist/cjs/components/CardScroll/CardScroll.js +1 -1
- package/dist/cjs/components/CardScroll/CardScroll.js.map +1 -1
- package/dist/cjs/components/Cell/useDraggable.js +3 -1
- package/dist/cjs/components/Cell/useDraggable.js.map +1 -1
- package/dist/cjs/components/FocusTrap/FocusTrap.js +3 -5
- package/dist/cjs/components/FocusTrap/FocusTrap.js.map +1 -1
- package/dist/cjs/components/Tabbar/Tabbar.js +3 -1
- package/dist/cjs/components/Tabbar/Tabbar.js.map +1 -1
- package/dist/cjs/components/TabbarItem/TabbarItem.d.ts +3 -1
- package/dist/cjs/components/TabbarItem/TabbarItem.js +29 -11
- package/dist/cjs/components/TabbarItem/TabbarItem.js.map +1 -1
- package/dist/components/CardScroll/CardScroll.js +1 -1
- package/dist/components/CardScroll/CardScroll.js.map +1 -1
- package/dist/components/Cell/useDraggable.js +2 -1
- package/dist/components/Cell/useDraggable.js.map +1 -1
- package/dist/components/FocusTrap/FocusTrap.js +3 -5
- package/dist/components/FocusTrap/FocusTrap.js.map +1 -1
- package/dist/components/Tabbar/Tabbar.js +3 -1
- package/dist/components/Tabbar/Tabbar.js.map +1 -1
- package/dist/components/TabbarItem/TabbarItem.d.ts +3 -1
- package/dist/components/TabbarItem/TabbarItem.js +26 -10
- package/dist/components/TabbarItem/TabbarItem.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/CardScroll/CardScroll.js +1 -1
- package/dist/cssm/components/CardScroll/CardScroll.js.map +1 -1
- package/dist/cssm/components/Cell/useDraggable.js +2 -1
- package/dist/cssm/components/Cell/useDraggable.js.map +1 -1
- package/dist/cssm/components/FocusTrap/FocusTrap.js +3 -5
- package/dist/cssm/components/FocusTrap/FocusTrap.js.map +1 -1
- package/dist/cssm/components/Tabbar/Tabbar.css +1 -1
- package/dist/cssm/components/Tabbar/Tabbar.js +3 -1
- package/dist/cssm/components/Tabbar/Tabbar.js.map +1 -1
- package/dist/cssm/components/TabbarItem/TabbarItem.css +1 -1
- package/dist/cssm/components/TabbarItem/TabbarItem.js +26 -10
- package/dist/cssm/components/TabbarItem/TabbarItem.js.map +1 -1
- package/dist/cssm/styles/components.css +1 -1
- package/dist/vkui.css +1 -1
- package/dist/vkui.css.map +1 -1
- package/package.json +1 -1
- package/src/components/CardScroll/CardScroll.tsx +4 -1
- package/src/components/Cell/useDraggable.tsx +1 -1
- package/src/components/Epic/Readme.md +1 -0
- package/src/components/FocusTrap/FocusTrap.tsx +11 -8
- package/src/components/Tabbar/Tabbar.css +15 -4
- package/src/components/Tabbar/Tabbar.tsx +3 -1
- package/src/components/TabbarItem/Readme.md +72 -0
- package/src/components/TabbarItem/TabbarItem.css +65 -14
- package/src/components/TabbarItem/TabbarItem.tsx +46 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Cell/useDraggable.tsx"],"names":["React","useDraggable","onDragFinish","useState","dragging","setDragging","rootElRef","useRef","undefined","siblings","setSiblings","dragStartIndex","setDragStartIndex","dragEndIndex","setDragEndIndex","dragShift","setDragShift","dragDirection","setDragDirection","onDragStart","rootEl","current","_siblings","
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Cell/useDraggable.tsx"],"names":["React","useDraggable","onDragFinish","useState","dragging","setDragging","rootElRef","useRef","undefined","siblings","setSiblings","dragStartIndex","setDragStartIndex","dragEndIndex","setDragEndIndex","dragShift","setDragShift","dragDirection","setDragDirection","onDragStart","rootEl","current","_siblings","parentElement","childNodes","idx","indexOf","onDragMove","e","originalEvent","preventDefault","style","transform","shiftY","rootGesture","getBoundingClientRect","forEach","sibling","siblingIndex","siblingGesture","siblingHalfHeight","height","rootOverSibling","bottom","top","rootUnderSibling","onDragEnd","from","to","useDraggableProps"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAeA,OAAO,IAAMC,YAAY,GAAG,SAAfA,YAAe,OAAuD;AAAA,MAApDC,YAAoD,QAApDA,YAAoD;;AACjF,wBAAgCF,KAAK,CAACG,QAAN,CAAwB,KAAxB,CAAhC;AAAA;AAAA,MAAOC,QAAP;AAAA,MAAiBC,WAAjB;;AACA,MAAMC,SAAS,GAAGN,KAAK,CAACO,MAAN,CAAa,IAAb,CAAlB;;AAEA,yBAAgCP,KAAK,CAACG,QAAN,CAA8BK,SAA9B,CAAhC;AAAA;AAAA,MAAOC,QAAP;AAAA,MAAiBC,WAAjB;;AACA,yBAA4CV,KAAK,CAACG,QAAN,CAAuBK,SAAvB,CAA5C;AAAA;AAAA,MAAOG,cAAP;AAAA,MAAuBC,iBAAvB;;AACA,yBAAwCZ,KAAK,CAACG,QAAN,CAAuBK,SAAvB,CAAxC;AAAA;AAAA,MAAOK,YAAP;AAAA,MAAqBC,eAArB;;AACA,yBAAkCd,KAAK,CAACG,QAAN,CAAuB,CAAvB,CAAlC;AAAA;AAAA,MAAOY,SAAP;AAAA,MAAkBC,YAAlB;;AACA,0BAA0ChB,KAAK,CAACG,QAAN,CAA8BK,SAA9B,CAA1C;AAAA;AAAA,MAAOS,aAAP;AAAA,MAAsBC,gBAAtB;;AAEA,MAAMC,WAAW,GAAG,SAAdA,WAAc,GAAM;AACxB,QAAMC,MAAM,GAAGd,SAAS,CAACe,OAAzB;AAEAhB,IAAAA,WAAW,CAAC,IAAD,CAAX;;AAEA,QAAMiB,SAAwB,sBAAOF,MAAM,CAACG,aAAP,CAAqBC,UAA5B,CAA9B;;AACA,QAAMC,GAAG,GAAGH,SAAS,CAACI,OAAV,CAAkBN,MAAlB,CAAZ;;AAEAR,IAAAA,iBAAiB,CAACa,GAAD,CAAjB;AACAX,IAAAA,eAAe,CA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9B,IAAAA,WAAW,EAAXA,WAD2C;AAE3CQ,IAAAA,UAAU,EAAVA,UAF2C;AAG3CmB,IAAAA,SAAS,EAATA,SAH2C;AAI3C1C,IAAAA,QAAQ,EAARA,QAJ2C;AAK3CE,IAAAA,SAAS,EAATA;AAL2C,GAA7C;AAQA,SAAO2C,iBAAP;AACD,CAhGM","sourcesContent":["import * as React from 'react';\nimport { TouchEvent } from '../Touch/Touch';\nimport { CellProps } from './Cell';\n\nexport interface DraggableProps {\n onDragStart: () => void;\n onDragEnd: () => void;\n onDragMove: (e: TouchEvent) => void;\n}\n\ninterface UseDraggableProps extends DraggableProps {\n dragging: boolean;\n rootElRef: any;\n}\n\nexport const useDraggable = ({ onDragFinish }: Pick<CellProps, 'onDragFinish'>) => {\n const [dragging, setDragging] = React.useState<boolean>(false);\n const rootElRef = React.useRef(null);\n\n const [siblings, setSiblings] = React.useState<HTMLElement[]>(undefined);\n const [dragStartIndex, setDragStartIndex] = React.useState<number>(undefined);\n const [dragEndIndex, setDragEndIndex] = React.useState<number>(undefined);\n const [dragShift, setDragShift] = React.useState<number>(0);\n const [dragDirection, setDragDirection] = React.useState<'down' | 'up'>(undefined);\n\n const onDragStart = () => {\n const rootEl = rootElRef.current;\n\n setDragging(true);\n\n const _siblings: HTMLElement[] = [...rootEl.parentElement.childNodes];\n const idx = _siblings.indexOf(rootEl);\n\n setDragStartIndex(idx);\n setDragEndIndex(idx);\n setSiblings(_siblings);\n setDragShift(0);\n };\n\n const onDragMove = (e: TouchEvent) => {\n e.originalEvent.preventDefault();\n\n const rootEl = rootElRef.current;\n\n rootEl.style.transform = `translateY(${e.shiftY}px)`;\n const rootGesture = rootEl.getBoundingClientRect();\n\n setDragDirection(dragShift - e.shiftY < 0 ? 'down' : 'up');\n setDragShift(e.shiftY);\n setDragEndIndex(dragStartIndex);\n\n siblings.forEach((sibling: HTMLElement, siblingIndex: number) => {\n const siblingGesture = sibling.getBoundingClientRect();\n const siblingHalfHeight = siblingGesture.height / 2;\n\n const rootOverSibling = rootGesture.bottom > siblingGesture.top + siblingHalfHeight;\n const rootUnderSibling = rootGesture.top < siblingGesture.bottom - siblingHalfHeight;\n\n if (dragStartIndex < siblingIndex) {\n if (rootOverSibling) {\n if (dragDirection === 'down') {\n sibling.style.transform = 'translateY(-100%)';\n }\n\n setDragEndIndex((dragEndIndex) => dragEndIndex + 1);\n }\n if (rootUnderSibling && dragDirection === 'up') {\n sibling.style.transform = 'translateY(0)';\n }\n } else if (dragStartIndex > siblingIndex) {\n if (rootUnderSibling) {\n if (dragDirection === 'up') {\n sibling.style.transform = 'translateY(100%)';\n }\n\n setDragEndIndex((dragEndIndex) => dragEndIndex - 1);\n }\n if (rootOverSibling && dragDirection === 'down') {\n sibling.style.transform = 'translateY(0)';\n }\n }\n });\n };\n\n const onDragEnd = () => {\n const [from, to] = [dragStartIndex, dragEndIndex];\n\n siblings.forEach((sibling: HTMLElement) => {\n sibling.style.transform = null;\n });\n\n setSiblings(undefined);\n setDragEndIndex(undefined);\n setDragStartIndex(undefined);\n setDragDirection(undefined);\n setDragShift(undefined);\n\n setDragging(false);\n\n onDragFinish && onDragFinish({ from, to });\n };\n\n const useDraggableProps: UseDraggableProps = {\n onDragStart,\n onDragMove,\n onDragEnd,\n dragging,\n rootElRef,\n };\n\n return useDraggableProps;\n};\n"],"file":"useDraggable.js"}
|
|
@@ -60,15 +60,13 @@ export var FocusTrap = function FocusTrap(_ref) {
|
|
|
60
60
|
}, []); // HANDLE FOCUSABLE NODES
|
|
61
61
|
|
|
62
62
|
useIsomorphicLayoutEffect(function () {
|
|
63
|
-
var _ref$current2;
|
|
64
|
-
|
|
65
63
|
if (!ref.current) {
|
|
66
64
|
return noop();
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
var nodes = [];
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
var nodes = [];
|
|
68
|
+
Array.prototype.forEach.call( // eslint-disable-next-line no-restricted-properties
|
|
69
|
+
ref.current.querySelectorAll(FOCUSABLE_ELEMENTS), function (focusableEl) {
|
|
72
70
|
var _window$getComputedSt = window.getComputedStyle(focusableEl),
|
|
73
71
|
display = _window$getComputedSt.display,
|
|
74
72
|
visibility = _window$getComputedSt.visibility;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/FocusTrap/FocusTrap.tsx"],"names":["React","useExternRef","useGlobalEventListener","useTimeout","FOCUSABLE_ELEMENTS_LIST","Keys","pressedKey","useDOM","useIsomorphicLayoutEffect","noop","AppRootContext","FOCUSABLE_ELEMENTS","join","FocusTrap","Component","onClose","restoreFocus","timeout","getRootRef","children","restProps","ref","document","window","activeElement","useState","focusableNodes","setFocusableNodes","restoreFocusTo","setRestoreFocusTo","useContext","keyboardInput","focusOnTrapMount","current","contains","length","focus","set","nodes","
|
|
1
|
+
{"version":3,"sources":["../../../src/components/FocusTrap/FocusTrap.tsx"],"names":["React","useExternRef","useGlobalEventListener","useTimeout","FOCUSABLE_ELEMENTS_LIST","Keys","pressedKey","useDOM","useIsomorphicLayoutEffect","noop","AppRootContext","FOCUSABLE_ELEMENTS","join","FocusTrap","Component","onClose","restoreFocus","timeout","getRootRef","children","restProps","ref","document","window","activeElement","useState","focusableNodes","setFocusableNodes","restoreFocusTo","setRestoreFocusTo","useContext","keyboardInput","focusOnTrapMount","current","contains","length","focus","set","nodes","Array","prototype","forEach","call","querySelectorAll","focusableEl","getComputedStyle","display","visibility","push","focusOnTrapUnmount","onDocumentKeydown","e","TAB","lastIdx","targetIdx","findIndex","node","target","shouldFocusFirstNode","shiftKey","preventDefault","ESCAPE","capture"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,YAAT;AACA,SAASC,sBAAT;AACA,SAASC,UAAT;AACA,SAASC,uBAAT,EAAkCC,IAAlC,EAAwCC,UAAxC;AACA,SAASC,MAAT;AACA,SAASC,yBAAT;AACA,SAASC,IAAT;AAEA,SAASC,cAAT;AAEA,IAAMC,kBAA0B,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GD,QADH,CADF;AAKD,CA5GM","sourcesContent":["import * as React from 'react';\nimport { useExternRef } from '../../hooks/useExternRef';\nimport { useGlobalEventListener } from '../../hooks/useGlobalEventListener';\nimport { useTimeout } from '../../hooks/useTimeout';\nimport { FOCUSABLE_ELEMENTS_LIST, Keys, pressedKey } from '../../lib/accessibility';\nimport { useDOM } from '../../lib/dom';\nimport { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';\nimport { noop } from '../../lib/utils';\nimport { HasComponent, HasRootRef } from '../../types';\nimport { AppRootContext } from '../AppRoot/AppRootContext';\n\nconst FOCUSABLE_ELEMENTS: string = FOCUSABLE_ELEMENTS_LIST.join();\n\nexport interface FocusTrapProps extends React.AllHTMLAttributes<HTMLElement>, HasRootRef<HTMLElement>, HasComponent {\n onClose?: (props?: any) => void;\n restoreFocus?: boolean;\n timeout?: number;\n}\n\nexport const FocusTrap: React.FC<FocusTrapProps> = ({\n Component = 'div',\n onClose = noop,\n restoreFocus = true,\n timeout = 0,\n getRootRef,\n children,\n ...restProps\n}) => {\n const ref = useExternRef<HTMLElement>(getRootRef);\n\n const { document, window } = useDOM();\n const activeElement = document.activeElement as HTMLElement;\n\n const [focusableNodes, setFocusableNodes] = React.useState<HTMLElement[]>(null);\n const [restoreFocusTo, setRestoreFocusTo] = React.useState<HTMLElement>(null);\n\n // HANDLE TRAP MOUNT\n\n const { keyboardInput } = React.useContext(AppRootContext);\n const focusOnTrapMount = useTimeout(() => {\n if (keyboardInput && !ref.current?.contains(activeElement) && focusableNodes?.length) {\n focusableNodes[0].focus();\n }\n }, timeout);\n useIsomorphicLayoutEffect(() => {\n focusOnTrapMount.set();\n }, []);\n\n // HANDLE FOCUSABLE NODES\n\n useIsomorphicLayoutEffect(() => {\n if (!ref.current) {\n return noop();\n }\n\n const nodes: HTMLElement[] = [];\n Array.prototype.forEach.call(\n // eslint-disable-next-line no-restricted-properties\n ref.current.querySelectorAll(FOCUSABLE_ELEMENTS),\n (focusableEl: Element) => {\n const { display, visibility } = window.getComputedStyle(focusableEl);\n\n if (display !== 'none' && visibility !== 'hidden') {\n nodes.push(focusableEl as HTMLElement);\n }\n },\n );\n\n if (nodes?.length) {\n setFocusableNodes(nodes);\n }\n\n return noop();\n }, [children]);\n\n // HANDLE TRAP UNMOUNT\n\n const focusOnTrapUnmount = useTimeout(() => {\n if (restoreFocusTo) {\n restoreFocusTo.focus();\n }\n }, timeout);\n useIsomorphicLayoutEffect(() => {\n if (restoreFocus) {\n setRestoreFocusTo(activeElement);\n\n return () => {\n focusOnTrapUnmount.set();\n };\n }\n\n return noop();\n }, [restoreFocus]);\n\n const onDocumentKeydown = (e: KeyboardEvent) => {\n if (pressedKey(e) === Keys.TAB && focusableNodes?.length) {\n const lastIdx = focusableNodes.length - 1;\n const targetIdx = focusableNodes.findIndex((node) => node === e.target);\n\n const shouldFocusFirstNode = targetIdx === -1 || targetIdx === lastIdx && !e.shiftKey;\n\n if (shouldFocusFirstNode || targetIdx === 0 && e.shiftKey) {\n e.preventDefault();\n\n const node = focusableNodes[shouldFocusFirstNode ? 0 : lastIdx];\n\n if (node !== activeElement) {\n node.focus();\n }\n\n return false;\n }\n }\n\n if (pressedKey(e) === Keys.ESCAPE) {\n onClose();\n }\n\n return true;\n };\n useGlobalEventListener(document, 'keydown', onDocumentKeydown, { capture: true });\n\n return (\n <Component ref={ref} {...restProps}>\n {children}\n </Component>\n );\n};\n"],"file":"FocusTrap.js"}
|
|
@@ -30,7 +30,9 @@ var Tabbar = function Tabbar(props) {
|
|
|
30
30
|
vkuiClass: classNames(getClassName('Tabbar', platform), "Tabbar--l-".concat(getItemsLayout()), {
|
|
31
31
|
'Tabbar--shadow': shadow
|
|
32
32
|
})
|
|
33
|
-
}, restProps),
|
|
33
|
+
}, restProps), createScopedElement("div", {
|
|
34
|
+
vkuiClass: "Tabbar__in"
|
|
35
|
+
}, children));
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
Tabbar.defaultProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Tabbar/Tabbar.tsx"],"names":["React","getClassName","classNames","usePlatform","Tabbar","props","children","shadow","itemsLayout","restProps","platform","getItemsLayout","Children","count","defaultProps"],"mappings":";;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,YAAT;AACA,SAASC,UAAT;AACA,SAASC,WAAT;;AAWA,IAAMC,MAA4C,GAAG,SAA/CA,MAA+C,CAACC,KAAD,EAAwB;AAC3E,MAAQC,QAAR,GAAwDD,KAAxD,CAAQC,QAAR;AAAA,MAAkBC,MAAlB,GAAwDF,KAAxD,CAAkBE,MAAlB;AAAA,MAA0BC,WAA1B,GAAwDH,KAAxD,CAA0BG,WAA1B;AAAA,MAA0CC,SAA1C,4BAAwDJ,KAAxD;;AACA,MAAMK,QAAQ,GAAGP,WAAW,EAA5B;;AAEA,MAAMQ,cAAc,GAAG,SAAjBA,cAAiB,GAAM;AAC3B,YAAQH,WAAR;AACE,WAAK,YAAL;AACA,WAAK,UAAL;AACE,eAAOA,WAAP;;AACF;AACE,eAAOR,KAAK,CAACY,QAAN,CAAeC,KAAf,CAAqBP,QAArB,IAAiC,CAAjC,GAAqC,UAArC,GAAkD,YAAzD;AALJ;AAOD,GARD;;AAUA,SACE;AACE,IAAA,SAAS,EAAEJ,UAAU,CAACD,YAAY,CAAC,QAAD,EAAWS,QAAX,CAAb,sBAAgDC,cAAc,EAA9D,GAAoE;AACvF,wBAAkBJ;AADqE,KAApE;AADvB,KAIME,SAJN,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tabbar/Tabbar.tsx"],"names":["React","getClassName","classNames","usePlatform","Tabbar","props","children","shadow","itemsLayout","restProps","platform","getItemsLayout","Children","count","defaultProps"],"mappings":";;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,YAAT;AACA,SAASC,UAAT;AACA,SAASC,WAAT;;AAWA,IAAMC,MAA4C,GAAG,SAA/CA,MAA+C,CAACC,KAAD,EAAwB;AAC3E,MAAQC,QAAR,GAAwDD,KAAxD,CAAQC,QAAR;AAAA,MAAkBC,MAAlB,GAAwDF,KAAxD,CAAkBE,MAAlB;AAAA,MAA0BC,WAA1B,GAAwDH,KAAxD,CAA0BG,WAA1B;AAAA,MAA0CC,SAA1C,4BAAwDJ,KAAxD;;AACA,MAAMK,QAAQ,GAAGP,WAAW,EAA5B;;AAEA,MAAMQ,cAAc,GAAG,SAAjBA,cAAiB,GAAM;AAC3B,YAAQH,WAAR;AACE,WAAK,YAAL;AACA,WAAK,UAAL;AACE,eAAOA,WAAP;;AACF;AACE,eAAOR,KAAK,CAACY,QAAN,CAAeC,KAAf,CAAqBP,QAArB,IAAiC,CAAjC,GAAqC,UAArC,GAAkD,YAAzD;AALJ;AAOD,GARD;;AAUA,SACE;AACE,IAAA,SAAS,EAAEJ,UAAU,CAACD,YAAY,CAAC,QAAD,EAAWS,QAAX,CAAb,sBAAgDC,cAAc,EAA9D,GAAoE;AACvF,wBAAkBJ;AADqE,KAApE;AADvB,KAIME,SAJN,GAME;AAAK,IAAA,SAAS,EAAC;AAAf,KACGH,QADH,CANF,CADF;AAYD,CA1BD;;AA4BAF,MAAM,CAACU,YAAP,GAAsB;AACpBP,EAAAA,MAAM,EAAE;AADY,CAAtB;AAIA,eAAeH,MAAf","sourcesContent":["import * as React from 'react';\nimport { getClassName } from '../../helpers/getClassName';\nimport { classNames } from '../../lib/classNames';\nimport { usePlatform } from '../../hooks/usePlatform';\nimport './Tabbar.css';\n\nexport interface TabbarProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Флаг для показа/скрытия верхней тени (Android) или границы (iOS)\n */\n shadow?: boolean;\n itemsLayout?: 'vertical' | 'horizontal' | 'auto';\n}\n\nconst Tabbar: React.FunctionComponent<TabbarProps> = (props: TabbarProps) => {\n const { children, shadow, itemsLayout, ...restProps } = props;\n const platform = usePlatform();\n\n const getItemsLayout = () => {\n switch (itemsLayout) {\n case 'horizontal':\n case 'vertical':\n return itemsLayout;\n default:\n return React.Children.count(children) > 2 ? 'vertical' : 'horizontal';\n }\n };\n\n return (\n <div\n vkuiClass={classNames(getClassName('Tabbar', platform), `Tabbar--l-${getItemsLayout()}`, {\n 'Tabbar--shadow': shadow,\n })}\n {...restProps}\n >\n <div vkuiClass=\"Tabbar__in\">\n {children}\n </div>\n </div>\n );\n};\n\nTabbar.defaultProps = {\n shadow: true,\n};\n\nexport default Tabbar;\n"],"file":"Tabbar.js"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { HasComponent, HasRootRef } from '../../types';
|
|
2
3
|
import './TabbarItem.css';
|
|
3
|
-
export interface TabbarItemProps extends React.
|
|
4
|
+
export interface TabbarItemProps extends Omit<React.AllHTMLAttributes<HTMLElement>, 'label'>, // TODO убрать Omit после удаления свойства label
|
|
5
|
+
HasRootRef<HTMLElement>, HasComponent {
|
|
4
6
|
selected?: boolean;
|
|
5
7
|
/**
|
|
6
8
|
* Тест рядом с иконкой
|
|
@@ -1,28 +1,44 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "selected", "label", "indicator", "text"];
|
|
3
|
+
var _excluded = ["children", "selected", "label", "indicator", "text", "href", "Component", "disabled"];
|
|
4
4
|
import { createScopedElement } from "../../lib/jsxRuntime";
|
|
5
5
|
import { getClassName } from "../../helpers/getClassName";
|
|
6
6
|
import Counter from "../Counter/Counter";
|
|
7
7
|
import { classNames } from "../../lib/classNames";
|
|
8
8
|
import { usePlatform } from "../../hooks/usePlatform";
|
|
9
9
|
import { hasReactNode } from "../../lib/utils";
|
|
10
|
+
import Tappable from "../Tappable/Tappable";
|
|
11
|
+
import { Platform } from "../../lib/platform";
|
|
10
12
|
|
|
11
|
-
var TabbarItem = function TabbarItem(
|
|
12
|
-
var children =
|
|
13
|
-
selected =
|
|
14
|
-
label =
|
|
15
|
-
indicator =
|
|
16
|
-
text =
|
|
17
|
-
|
|
13
|
+
var TabbarItem = function TabbarItem(_ref) {
|
|
14
|
+
var children = _ref.children,
|
|
15
|
+
selected = _ref.selected,
|
|
16
|
+
label = _ref.label,
|
|
17
|
+
indicator = _ref.indicator,
|
|
18
|
+
text = _ref.text,
|
|
19
|
+
href = _ref.href,
|
|
20
|
+
_ref$Component = _ref.Component,
|
|
21
|
+
Component = _ref$Component === void 0 ? href ? 'a' : 'button' : _ref$Component,
|
|
22
|
+
disabled = _ref.disabled,
|
|
23
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
|
|
25
|
+
var platform = usePlatform(); // @ts-ignore ругается на то, что у AllHTMLAttributes type это строка, а button не любую строку считает валидным значением
|
|
18
26
|
|
|
19
|
-
var platform = usePlatform();
|
|
20
|
-
var Component = restProps.href ? 'a' : 'div';
|
|
21
27
|
return createScopedElement(Component, _extends({}, restProps, {
|
|
28
|
+
disabled: disabled,
|
|
29
|
+
href: href,
|
|
22
30
|
vkuiClass: classNames(getClassName('TabbarItem', platform), {
|
|
23
31
|
'TabbarItem--selected': selected,
|
|
24
32
|
'TabbarItem--text': !!text
|
|
25
33
|
})
|
|
34
|
+
}), createScopedElement(Tappable, {
|
|
35
|
+
role: "presentation",
|
|
36
|
+
Component: "div",
|
|
37
|
+
disabled: disabled,
|
|
38
|
+
activeMode: platform === Platform.IOS ? 'TabbarItem__tappable--active' : 'background',
|
|
39
|
+
activeEffectDelay: platform === Platform.IOS ? 0 : 300,
|
|
40
|
+
hasHover: false,
|
|
41
|
+
vkuiClass: "TabbarItem__tappable"
|
|
26
42
|
}), createScopedElement("div", {
|
|
27
43
|
vkuiClass: "TabbarItem__in"
|
|
28
44
|
}, createScopedElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TabbarItem/TabbarItem.tsx"],"names":["getClassName","Counter","classNames","usePlatform","hasReactNode","
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TabbarItem/TabbarItem.tsx"],"names":["getClassName","Counter","classNames","usePlatform","hasReactNode","Tappable","Platform","TabbarItem","children","selected","label","indicator","text","href","Component","disabled","restProps","platform","IOS"],"mappings":";;;;AACA,SAASA,YAAT;AACA,OAAOC,OAAP;AACA,SAASC,UAAT;AACA,SAASC,WAAT;AACA,SAASC,YAAT;AACA,OAAOC,QAAP;AACA,SAASC,QAAT;;AAuBA,IAAMC,UAAoD,GAAG,SAAvDA,UAAuD,OAUtC;AAAA,MATrBC,QASqB,QATrBA,QASqB;AAAA,MARrBC,QAQqB,QARrBA,QAQqB;AAAA,MAPrBC,KAOqB,QAPrBA,KAOqB;AAAA,MANrBC,SAMqB,QANrBA,SAMqB;AAAA,MALrBC,IAKqB,QALrBA,IAKqB;AAAA,MAJrBC,IAIqB,QAJrBA,IAIqB;AAAA,4BAHrBC,SAGqB;AAAA,MAHrBA,SAGqB,+BAHTD,IAAI,GAAG,GAAH,GAAS,QAGJ;AAAA,MAFrBE,QAEqB,QAFrBA,QAEqB;AAAA,MADlBC,SACkB;;AACrB,MAAMC,QAAQ,GAAGd,WAAW,EAA5B,CADqB,CAGrB;;AACA,SAAQ,oBAAC,SAAD,eACFa,SADE;AAEN,IAAA,QAAQ,EAAED,QAFJ;AAGN,IAAA,IAAI,EAAEF,IAHA;AAIN,IAAA,SAAS,EAAEX,UAAU,CAACF,YAAY,CAAC,YAAD,EAAeiB,QAAf,CAAb,EAAuC;AAC1D,8BAAwBR,QADkC;AAE1D,0BAAoB,CAAC,CAACG;AAFoC,KAAvC;AAJf,MASN,oBAAC,QAAD;AACE,IAAA,IAAI,EAAC,cADP;AAEE,IAAA,SAAS,EAAC,KAFZ;AAGE,IAAA,QAAQ,EAAEG,QAHZ;AAIE,IAAA,UAAU,EAAEE,QAAQ,KAAKX,QAAQ,CAACY,GAAtB,GAA4B,8BAA5B,GAA6D,YAJ3E;AAKE,IAAA,iBAAiB,EAAED,QAAQ,KAAKX,QAAQ,CAACY,GAAtB,GAA4B,CAA5B,GAAgC,GALrD;AAME,IAAA,QAAQ,EAAE,KANZ;AAOE,IAAA,SAAS,EAAC;AAPZ,IATM,EAkBN;AAAK,IAAA,SAAS,EAAC;AAAf,KACE;AAAK,IAAA,SAAS,EAAC;AAAf,KACGV,QADH,EAEE;AAAK,IAAA,SAAS,EAAC;AAAf,KACGJ,YAAY,CAACO,SAAD,CAAZ,IAA2BA,SAD9B,EAEG,CAACA,SAAD,IAAcD,KAAd,IAAuB,oBAAC,OAAD;AAAS,IAAA,IAAI,EAAC,GAAd;AAAkB,IAAA,IAAI,EAAC;AAAvB,KAAoCA,KAApC,CAF1B,CAFF,CADF,EAQGE,IAAI,IAAI;AAAK,IAAA,SAAS,EAAC;AAAf,KAAmCA,IAAnC,CARX,CAlBM,CAAR;AA6BD,CA3CD;;AA6CA,eAAeL,UAAf","sourcesContent":["import * as React from 'react';\nimport { getClassName } from '../../helpers/getClassName';\nimport Counter from '../Counter/Counter';\nimport { classNames } from '../../lib/classNames';\nimport { usePlatform } from '../../hooks/usePlatform';\nimport { hasReactNode } from '../../lib/utils';\nimport Tappable from '../Tappable/Tappable';\nimport { Platform } from '../../lib/platform';\nimport { HasComponent, HasRootRef } from '../../types';\nimport './TabbarItem.css';\n\nexport interface TabbarItemProps extends\n Omit<React.AllHTMLAttributes<HTMLElement>, 'label'>, // TODO убрать Omit после удаления свойства label\n HasRootRef<HTMLElement>,\n HasComponent {\n selected?: boolean;\n /**\n * Тест рядом с иконкой\n */\n text?: React.ReactNode;\n /**\n * Индикатор над иконкой. Принимает `<Badge mode=\"prominent\" />` или `<Counter size=\"s\" mode=\"prominent\" />`\n */\n indicator?: React.ReactNode;\n /**\n * @deprecated будет удалено в 5.0.0. Используйте `indicator`\n */\n label?: React.ReactNode;\n}\n\nconst TabbarItem: React.FunctionComponent<TabbarItemProps> = ({\n children,\n selected,\n label,\n indicator,\n text,\n href,\n Component = href ? 'a' : 'button',\n disabled,\n ...restProps\n}: TabbarItemProps) => {\n const platform = usePlatform();\n\n // @ts-ignore ругается на то, что у AllHTMLAttributes type это строка, а button не любую строку считает валидным значением\n return (<Component\n {...restProps}\n disabled={disabled}\n href={href}\n vkuiClass={classNames(getClassName('TabbarItem', platform), {\n 'TabbarItem--selected': selected,\n 'TabbarItem--text': !!text,\n })}\n >\n <Tappable\n role=\"presentation\"\n Component=\"div\"\n disabled={disabled}\n activeMode={platform === Platform.IOS ? 'TabbarItem__tappable--active' : 'background'}\n activeEffectDelay={platform === Platform.IOS ? 0 : 300}\n hasHover={false}\n vkuiClass=\"TabbarItem__tappable\"\n />\n <div vkuiClass=\"TabbarItem__in\">\n <div vkuiClass=\"TabbarItem__icon\">\n {children}\n <div vkuiClass=\"TabbarItem__label\">\n {hasReactNode(indicator) && indicator}\n {!indicator && label && <Counter size=\"s\" mode=\"prominent\">{label}</Counter>}\n </div>\n </div>\n {text && <div vkuiClass=\"TabbarItem__text\">{text}</div>}\n </div>\n </Component>);\n};\n\nexport default TabbarItem;\n"],"file":"TabbarItem.js"}
|