@laerdal/life-react-components 2.3.1-dev.12 → 2.3.1-dev.14
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/dist/AuthPage/AuthPage.d.ts +1 -0
- package/dist/Banners/Banner.cjs.map +1 -1
- package/dist/Banners/Banner.js.map +1 -1
- package/dist/Dropdown/DropdownButtonTypes.d.ts +1 -0
- package/dist/Dropdown/DropdownContent.cjs +1 -1
- package/dist/Dropdown/DropdownContent.js +1 -1
- package/dist/Footer/Components/FooterBottomLinks.d.ts +1 -0
- package/dist/Footer/Components/FooterDropdownLinks.d.ts +1 -0
- package/dist/Footer/Components/FooterNavSection.d.ts +1 -0
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs.map +1 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.d.ts +1 -0
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.js.map +1 -1
- package/dist/Footer/Components/FooterTop.d.ts +1 -0
- package/dist/Footer/Footer.d.ts +1 -0
- package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
- package/dist/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.d.ts +1 -0
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js +2 -2
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs +6 -65
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.js +6 -65
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs +19 -102
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.d.ts +1 -4
- package/dist/GlobalNavigationBar/desktop/SubMenu.js +19 -102
- package/dist/GlobalNavigationBar/desktop/SubMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.d.ts +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +1 -0
- package/dist/InputFields/DatepickerFieldHeader.cjs +2 -4
- package/dist/InputFields/DatepickerFieldHeader.cjs.map +1 -1
- package/dist/InputFields/DatepickerFieldHeader.d.ts +1 -0
- package/dist/InputFields/DatepickerFieldHeader.js +2 -4
- package/dist/InputFields/DatepickerFieldHeader.js.map +1 -1
- package/dist/LoadingIndicator/LoadingIndicator.d.ts +1 -0
- package/dist/MiniProductCard/MiniProductCard.d.ts +1 -0
- package/dist/Paginator/Paginator.cjs.map +1 -1
- package/dist/Paginator/Paginator.d.ts +1 -0
- package/dist/Paginator/Paginator.js.map +1 -1
- package/dist/SideMenu/SideMenuBody.d.ts +1 -0
- package/dist/SideMenu/SideMenuFooter.d.ts +1 -0
- package/dist/SideMenu/SideMenuHeader.d.ts +1 -0
- package/dist/SideMenu/types.d.ts +1 -0
- package/dist/Switcher/MobileCustomMenuContent.cjs +3 -0
- package/dist/Switcher/MobileCustomMenuContent.cjs.map +1 -1
- package/dist/Switcher/MobileCustomMenuContent.d.ts +1 -0
- package/dist/Switcher/MobileCustomMenuContent.js +3 -0
- package/dist/Switcher/MobileCustomMenuContent.js.map +1 -1
- package/dist/Switcher/SwitcherMenuItem.d.ts +1 -0
- package/dist/Table/Table.cjs +1 -1
- package/dist/Table/Table.js +1 -1
- package/dist/Table/TableFooter.cjs.map +1 -1
- package/dist/Table/TableFooter.js.map +1 -1
- package/dist/Table/TableTypes.d.ts +1 -0
- package/dist/Tabs/TabLink.cjs +53 -50
- package/dist/Tabs/TabLink.cjs.map +1 -1
- package/dist/Tabs/TabLink.d.ts +14 -13
- package/dist/Tabs/TabLink.js +53 -50
- package/dist/Tabs/TabLink.js.map +1 -1
- package/dist/Tile/TileCommonItems.d.ts +1 -0
- package/dist/Toggles/TogglerTypes.d.ts +1 -0
- package/dist/Tooltips/TooltipOverflow.cjs +1 -1
- package/dist/Tooltips/TooltipOverflow.cjs.map +1 -1
- package/dist/Tooltips/TooltipOverflow.js +1 -1
- package/dist/Tooltips/TooltipOverflow.js.map +1 -1
- package/dist/Tooltips/TooltipTypes.d.ts +1 -0
- package/dist/Tooltips/TooltipWrapper.d.ts +1 -0
- package/dist/assets/index.cjs.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/common/ActionWithin.cjs +1 -1
- package/dist/common/ActionWithin.js +1 -1
- package/dist/common/FocusVisible.cjs +1 -1
- package/dist/common/FocusVisible.js +1 -1
- package/dist/icons/systemicons/LoadingMedium.cjs.map +1 -1
- package/dist/icons/systemicons/LoadingMedium.js.map +1 -1
- package/dist/icons/systemicons/LoadingSmall.cjs.map +1 -1
- package/dist/icons/systemicons/LoadingSmall.js.map +1 -1
- package/package.json +6 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabLink.cjs","names":["OptionalLineWrapperWithIcon","styled","div","TopWrapper","TextContainer","StyledNotification","EndLineIcon","OptionalLineWrapper","Wrapper","COLORS","neutral_600","props","disabled","neutral_100","focusStyles","Z_INDEXES","active","neutral_20","primary_20","hover","primary_600","primary_100","primary_800","primary_500","white","neutral_300","TabLink","React","forwardRef","ref","to","requiredLine","optionalLine","OptionalLineIcon","onLinkClick","forceDeactivate","testId","showNotificationDot","size","Size","Small","endLineIcon","onActiveStateChanged","variant","children","containerOnMouseEnter","containerOnMouseLeave","className","rest","useState","activeState","setActiveState","toString","isActive","defaultOnMouseDownHandler","e"],"sources":["../../src/Tabs/TabLink.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { Size } from '../types';\nimport { COLORS, focusStyles } from '../styles';\nimport { Z_INDEXES } from '../styles/z-indexes';\nimport { defaultOnMouseDownHandler } from '../common';\nimport { useState } from 'react';\n\ntype TabLinkProps = {\n disabled?: boolean;\n forceDeactivate?: boolean;\n requiredLine: string;\n optionalLine?: string;\n OptionalLineIcon?: React.ReactNode; //React.FunctionComponent<BaseProps>;\n endLineIcon?: React.ReactNode;\n onLinkClick?: (e: React.MouseEvent) => void;\n testId?: string;\n onActiveStateChanged?: (state: boolean) => void;\n showNotificationDot?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n variant?: 'positive' | 'critical';\n containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n} & NavLinkProps;\n\nconst OptionalLineWrapperWithIcon = styled.div`\n display: flex;\n flex-direction: row;\n\n span {\n margin: 0 0 0 4px !important;\n font-size: 12px;\n line-height: 16px;\n }\n`;\n\nconst TopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n\n span:not(:only-child) {\n width: calc(100% - 32px);\n }\n`;\n\nconst TextContainer = styled.div`\n width: 100%;\n margin: auto 0 auto 16px !important;\n`;\n\nconst StyledNotification = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst EndLineIcon = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst OptionalLineWrapper = styled.div`\n font-size: 12px;\n`;\n//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed\nconst Wrapper = styled.div<{disabled: boolean}>`\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ${COLORS.neutral_600};\n \n background-color: ${(props) => (props.disabled ? COLORS.neutral_100 : 'transparent')};\n cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ${focusStyles}\n }\n \n &.active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.neutral_20};\n }\n \n &.active:hover, &.active.dropdown-hover {\n background-color: ${COLORS.primary_20};\n }\n \n &:hover, &.dropdown-hover {\n z-index: ${Z_INDEXES.hover};\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n \n &:active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ${COLORS.primary_500};\n \n border-radius: 4px;\n }\n }\n \n &.active:hover, &.active.dropdown-hover {\n &::after {\n background-color: ${COLORS.primary_600};\n }\n }\n \n &.active:active {\n background-color: ${COLORS.primary_100};\n \n &::after {\n background-color: ${COLORS.primary_800};\n }\n }\n \n &.disabled {\n background-color: ${COLORS.white};\n color: ${COLORS.neutral_300};\n \n span {\n color: ${COLORS.neutral_300};\n }\n \n &::after {\n background-color: ${COLORS.neutral_300};\n }\n }\n }\n`;\n\nconst TabLink = React.forwardRef<HTMLAnchorElement, TabLinkProps>(({\n to,\n disabled = false,\n requiredLine,\n optionalLine,\n OptionalLineIcon,\n onLinkClick,\n forceDeactivate,\n testId,\n showNotificationDot = false,\n size = Size.Small,\n endLineIcon,\n onActiveStateChanged,\n variant = 'critical',\n children,\n containerOnMouseEnter,\n containerOnMouseLeave,\n className,\n ...rest\n}: TabLinkProps, ref) => {\n \n const [activeState, setActiveState] = useState<boolean>(false);\n\n return (\n <Wrapper disabled={disabled} className={disabled ? 'disabled' : ''} onMouseEnter={containerOnMouseEnter} onMouseLeave={containerOnMouseLeave}>\n <NavLink\n to={forceDeactivate ? 'invalid' : to.toString()}\n //disabled={disabled}\n className={({ isActive }) => {\n onActiveStateChanged && onActiveStateChanged(activeState);\n if(forceDeactivate)\n {\n if(disabled) \n return 'disabled';\n else \n return '';\n }\n\n if(isActive != activeState)\n setActiveState(isActive);\n\n return (isActive ? 'active ' : '') + (disabled ? 'disabled' : '');\n }}\n onMouseDown={defaultOnMouseDownHandler}\n tabIndex={disabled ? -1 : 0}\n role=\"tab\"\n aria-selected={activeState}\n onClick={(e: React.MouseEvent) => !disabled && onLinkClick && onLinkClick(e)}\n ref={ref}\n data-testid={testId}\n {...rest}>\n <TextContainer>\n <TopWrapper>\n <span>{requiredLine}</span>\n </TopWrapper>\n {optionalLine && OptionalLineIcon ? (\n <OptionalLineWrapperWithIcon>\n {OptionalLineIcon}\n {!!optionalLine && <span>{optionalLine}</span>}\n </OptionalLineWrapperWithIcon>\n ) : optionalLine ? (\n <OptionalLineWrapper>\n <span>{optionalLine}</span>\n </OptionalLineWrapper>\n ) : (\n <></>\n )}\n </TextContainer>\n <StyledNotification>{showNotificationDot && <NotificationDot testId=\"NotificationDot\" size={size} variant={variant} />}</StyledNotification>\n {endLineIcon && <EndLineIcon>{endLineIcon}</EndLineIcon>}\n </NavLink>\n {children}\n </Wrapper>\n );\n});\n\nexport default TabLink;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBtD,IAAMA,2BAA2B,GAAGC,yBAAM,CAACC,GAAG,iOAS7C;AAED,IAAMC,UAAU,GAAGF,yBAAM,CAACC,GAAG,kMAO5B;AAED,IAAME,aAAa,GAAGH,yBAAM,CAACC,GAAG,+IAG/B;AAED,IAAMG,kBAAkB,GAAGJ,yBAAM,CAACC,GAAG,yHAEpC;AAED,IAAMI,WAAW,GAAGL,yBAAM,CAACC,GAAG,yHAE7B;AAED,IAAMK,mBAAmB,GAAGN,yBAAM,CAACC,GAAG,2GAErC;AACD;AACA,IAAMM,OAAO,GAAGP,yBAAM,CAACC,GAAG,srDAkBbO,cAAM,CAACC,WAAW,EAEP,UAACC,KAAK;EAAA,OAAMA,KAAK,CAACC,QAA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WACzBA,gBAAgB,EAChB,CAAC,CAACD,YAAY,iBAAI;YAAA,UAAOA;UAAY,EAAQ;QAAA,EAClB,GAC5BA,YAAY,gBACd,qBAAC,mBAAmB;UAAA,uBAClB;YAAA,UAAOA;UAAY;QAAQ,EACP,gBAEtB,8CACD;MAAA,EACa,eAChB,qBAAC,kBAAkB;QAAA,UAAEK,mBAAmB,iBAAI,qBAAC,gCAAe;UAAC,MAAM,EAAC,iBAAiB;UAAC,IAAI,EAAEC,IAAK;UAAC,OAAO,EAAEK;QAAQ;MAAG,EAAsB,EAC3IF,WAAW,iBAAI,qBAAC,WAAW;QAAA,UAAEA;MAAW,EAAe;IAAA,GAChD,EACTG,QAAQ;EAAA,EACD;AAEd,CAAC,CAAC;AAAC,eAEYlB,OAAO;AAAA"}
|
|
1
|
+
{"version":3,"file":"TabLink.cjs","names":["OptionalLineWrapperWithIcon","styled","div","TopWrapper","TextContainer","StyledNotification","EndLineIcon","OptionalLineWrapper","Wrapper","COLORS","neutral_600","props","disabled","neutral_100","focusStyles","Z_INDEXES","active","neutral_20","primary_20","hover","primary_600","primary_100","primary_800","primary_500","white","neutral_300","TabLink","to","requiredLine","optionalLine","OptionalLineIcon","onLinkClick","forceDeactivate","testId","showNotificationDot","size","Size","Small","endLineIcon","onActiveStateChanged","variant","children","containerOnMouseEnter","containerOnMouseLeave","className","rest","ref","React","useRef","useState","activeState","setActiveState","toString","isActive","defaultOnMouseDownHandler","e"],"sources":["../../src/Tabs/TabLink.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { Size } from '../types';\nimport { COLORS, focusStyles } from '../styles';\nimport { Z_INDEXES } from '../styles/z-indexes';\nimport { defaultOnMouseDownHandler } from '../common';\nimport { useState } from 'react';\n\ntype TabLinkProps = {\n disabled?: boolean;\n forceDeactivate?: boolean;\n requiredLine: string;\n optionalLine?: string;\n OptionalLineIcon?: React.ReactNode; //React.FunctionComponent<BaseProps>;\n endLineIcon?: React.ReactNode;\n onLinkClick?: (e: React.MouseEvent) => void;\n testId?: string;\n onActiveStateChanged?: (state: boolean) => void;\n showNotificationDot?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n variant?: 'positive' | 'critical';\n containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n} & NavLinkProps;\n\nconst OptionalLineWrapperWithIcon = styled.div`\n display: flex;\n flex-direction: row;\n\n span {\n margin: 0 0 0 4px !important;\n font-size: 12px;\n line-height: 16px;\n }\n`;\n\nconst TopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n\n span:not(:only-child) {\n width: calc(100% - 32px);\n }\n`;\n\nconst TextContainer = styled.div`\n width: 100%;\n margin: auto 0 auto 16px !important;\n`;\n\nconst StyledNotification = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst EndLineIcon = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst OptionalLineWrapper = styled.div`\n font-size: 12px;\n`;\n//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed\nconst Wrapper = styled.div<{ disabled: boolean }>`\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n display: flex;\n flex-direction: row;\n align-items: center;\n\n font-size: 16px;\n line-height: 120%;\n color: ${COLORS.neutral_600};\n\n background-color: ${(props) => (props.disabled ? COLORS.neutral_100 : 'transparent')};\n cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n\n &:not(:last-child) {\n margin-bottom: 4px;\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &.active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.neutral_20};\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n }\n\n &:hover {\n z-index: ${Z_INDEXES.hover};\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n\n &:active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n\n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n &.active:hover {\n &::after {\n background-color: ${COLORS.primary_600};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n &::after {\n background-color: ${COLORS.primary_800};\n }\n }\n\n &.disabled {\n background-color: ${COLORS.white};\n color: ${COLORS.neutral_300};\n\n span {\n color: ${COLORS.neutral_300};\n }\n\n &::after {\n background-color: ${COLORS.neutral_300};\n }\n }\n }\n`;\n\nconst TabLink = ({\n to,\n disabled = false,\n requiredLine,\n optionalLine,\n OptionalLineIcon,\n onLinkClick,\n forceDeactivate,\n testId,\n showNotificationDot = false,\n size = Size.Small,\n endLineIcon,\n onActiveStateChanged,\n variant = 'critical',\n children,\n containerOnMouseEnter,\n containerOnMouseLeave,\n className,\n ...rest\n}: TabLinkProps) => {\n const ref = React.useRef<any>(null);\n const [activeState, setActiveState] = useState<boolean>(false);\n\n return (\n <Wrapper disabled={disabled} className={disabled ? 'disabled' : ''} onMouseEnter={containerOnMouseEnter} onMouseLeave={containerOnMouseLeave}>\n <>\n <NavLink\n to={forceDeactivate ? 'invalid' : to.toString()}\n //disabled={disabled}\n className={({ isActive }) => {\n onActiveStateChanged && onActiveStateChanged(activeState);\n if (forceDeactivate) {\n if (disabled) return 'disabled';\n else return '';\n }\n\n if (isActive != activeState) setActiveState(isActive);\n\n return (isActive ? 'active ' : '') + (disabled ? 'disabled' : '');\n }}\n onMouseDown={defaultOnMouseDownHandler}\n tabIndex={disabled ? -1 : 0}\n role=\"tab\"\n aria-selected={activeState}\n onClick={(e: React.MouseEvent) => !disabled && onLinkClick && onLinkClick(e)}\n ref={ref}\n data-testid={testId}\n {...rest}>\n <TextContainer>\n <TopWrapper>\n <span>{requiredLine}</span>\n </TopWrapper>\n {optionalLine && OptionalLineIcon ? (\n <OptionalLineWrapperWithIcon>\n {OptionalLineIcon}\n {!!optionalLine && <span>{optionalLine}</span>}\n </OptionalLineWrapperWithIcon>\n ) : optionalLine ? (\n <OptionalLineWrapper>\n <span>{optionalLine}</span>\n </OptionalLineWrapper>\n ) : (\n <></>\n )}\n </TextContainer>\n <StyledNotification>{showNotificationDot && <NotificationDot testId=\"NotificationDot\" size={size} variant={variant} />}</StyledNotification>\n {endLineIcon && <EndLineIcon>{endLineIcon}</EndLineIcon>}\n </NavLink>\n {children}\n </>\n </Wrapper>\n );\n};\n\nexport default TabLink;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBtD,IAAMA,2BAA2B,GAAGC,yBAAM,CAACC,GAAG,iOAS7C;AAED,IAAMC,UAAU,GAAGF,yBAAM,CAACC,GAAG,kMAO5B;AAED,IAAME,aAAa,GAAGH,yBAAM,CAACC,GAAG,+IAG/B;AAED,IAAMG,kBAAkB,GAAGJ,yBAAM,CAACC,GAAG,yHAEpC;AAED,IAAMI,WAAW,GAAGL,yBAAM,CAACC,GAAG,yHAE7B;AAED,IAAMK,mBAAmB,GAAGN,yBAAM,CAACC,GAAG,2GAErC;AACD;AACA,IAAMM,OAAO,GAAGP,yBAAM,CAACC,GAAG,4kDAiBbO,cAAM,CAACC,WAAW,EAEP,UAACC,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAGH,cAAM,CAACI,WAAW,GAAG,aAAa;AAAA,CAAC,EAC1E,UAACF,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,aAAa,GAAG,SAAS;AAAA,CAAC,EAW7DE,mBAAW,EAIFC,mBAAS,CAACC,MAAM,EACPP,cAAM,CAACQ,UAAU,EAIjBR,cA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ACD;QAAA,EACa,eAChB,qBAAC,kBAAkB;UAAA,UAAEK,mBAAmB,iBAAI,qBAAC,gCAAe;YAAC,MAAM,EAAC,iBAAiB;YAAC,IAAI,EAAEC,IAAK;YAAC,OAAO,EAAEK;UAAQ;QAAG,EAAsB,EAC3IF,WAAW,iBAAI,qBAAC,WAAW;UAAA,UAAEA;QAAW,EAAe;MAAA,GAChD,EACTG,QAAQ;IAAA;EACR,EACK;AAEd,CAAC;AAAC,eAEaf,OAAO;AAAA"}
|
package/dist/Tabs/TabLink.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { NavLinkProps } from 'react-router-dom';
|
|
3
3
|
import { Size } from '../types';
|
|
4
|
-
|
|
5
|
-
disabled?: boolean
|
|
6
|
-
forceDeactivate?: boolean
|
|
4
|
+
type TabLinkProps = {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
forceDeactivate?: boolean;
|
|
7
7
|
requiredLine: string;
|
|
8
|
-
optionalLine?: string
|
|
8
|
+
optionalLine?: string;
|
|
9
9
|
OptionalLineIcon?: React.ReactNode;
|
|
10
10
|
endLineIcon?: React.ReactNode;
|
|
11
|
-
onLinkClick?: (
|
|
12
|
-
testId?: string
|
|
13
|
-
onActiveStateChanged?: (
|
|
14
|
-
showNotificationDot?: boolean
|
|
15
|
-
size?: Size.Small | Size.Medium | Size.Large
|
|
16
|
-
variant?:
|
|
17
|
-
containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement
|
|
18
|
-
containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement
|
|
19
|
-
} & NavLinkProps
|
|
11
|
+
onLinkClick?: (e: React.MouseEvent) => void;
|
|
12
|
+
testId?: string;
|
|
13
|
+
onActiveStateChanged?: (state: boolean) => void;
|
|
14
|
+
showNotificationDot?: boolean;
|
|
15
|
+
size?: Size.Small | Size.Medium | Size.Large;
|
|
16
|
+
variant?: 'positive' | 'critical';
|
|
17
|
+
containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
18
|
+
containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
|
19
|
+
} & NavLinkProps;
|
|
20
|
+
declare const TabLink: ({ to, disabled, requiredLine, optionalLine, OptionalLineIcon, onLinkClick, forceDeactivate, testId, showNotificationDot, size, endLineIcon, onActiveStateChanged, variant, children, containerOnMouseEnter, containerOnMouseLeave, className, ...rest }: TabLinkProps) => JSX.Element;
|
|
20
21
|
export default TabLink;
|
package/dist/Tabs/TabLink.js
CHANGED
|
@@ -25,12 +25,12 @@ var StyledNotification = styled.div(_templateObject4 || (_templateObject4 = _tag
|
|
|
25
25
|
var EndLineIcon = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0 15px 0 0 !important;\n"])));
|
|
26
26
|
var OptionalLineWrapper = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 12px;\n"])));
|
|
27
27
|
//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed
|
|
28
|
-
var Wrapper = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n
|
|
28
|
+
var Wrapper = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n display: flex;\n flex-direction: row;\n align-items: center;\n\n font-size: 16px;\n line-height: 120%;\n color: ", ";\n\n background-color: ", ";\n cursor: ", ";\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n\n &:not(:last-child) {\n margin-bottom: 4px;\n }\n\n &:focus {\n ", "\n }\n\n &.active {\n z-index: ", ";\n background-color: ", ";\n }\n\n &.active:hover {\n background-color: ", ";\n }\n\n &:hover {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n\n &:active {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n\n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ", ";\n\n border-radius: 4px;\n }\n }\n\n &.active:hover {\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active {\n background-color: ", ";\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.disabled {\n background-color: ", ";\n color: ", ";\n\n span {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n }\n"])), COLORS.neutral_600, function (props) {
|
|
29
29
|
return props.disabled ? COLORS.neutral_100 : 'transparent';
|
|
30
30
|
}, function (props) {
|
|
31
31
|
return props.disabled ? 'not-allowed' : 'pointer';
|
|
32
32
|
}, focusStyles, Z_INDEXES.active, COLORS.neutral_20, COLORS.primary_20, Z_INDEXES.hover, COLORS.primary_20, COLORS.primary_600, Z_INDEXES.active, COLORS.primary_100, COLORS.primary_800, COLORS.primary_500, COLORS.primary_600, COLORS.primary_100, COLORS.primary_800, COLORS.white, COLORS.neutral_300, COLORS.neutral_300, COLORS.neutral_300);
|
|
33
|
-
var TabLink =
|
|
33
|
+
var TabLink = function TabLink(_ref) {
|
|
34
34
|
var to = _ref.to,
|
|
35
35
|
_ref$disabled = _ref.disabled,
|
|
36
36
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
@@ -53,63 +53,66 @@ var TabLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
53
53
|
containerOnMouseLeave = _ref.containerOnMouseLeave,
|
|
54
54
|
className = _ref.className,
|
|
55
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
+
var ref = React.useRef(null);
|
|
56
57
|
var _useState = useState(false),
|
|
57
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
58
59
|
activeState = _useState2[0],
|
|
59
60
|
setActiveState = _useState2[1];
|
|
60
|
-
return /*#__PURE__*/
|
|
61
|
+
return /*#__PURE__*/_jsx(Wrapper, {
|
|
61
62
|
disabled: disabled,
|
|
62
63
|
className: disabled ? 'disabled' : '',
|
|
63
64
|
onMouseEnter: containerOnMouseEnter,
|
|
64
65
|
onMouseLeave: containerOnMouseLeave,
|
|
65
|
-
children:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
children: [/*#__PURE__*/
|
|
90
|
-
children: /*#__PURE__*/_jsx(
|
|
91
|
-
children:
|
|
66
|
+
children: /*#__PURE__*/_jsxs(_Fragment, {
|
|
67
|
+
children: [/*#__PURE__*/_jsxs(NavLink, _objectSpread(_objectSpread({
|
|
68
|
+
to: forceDeactivate ? 'invalid' : to.toString()
|
|
69
|
+
//disabled={disabled}
|
|
70
|
+
,
|
|
71
|
+
className: function className(_ref2) {
|
|
72
|
+
var isActive = _ref2.isActive;
|
|
73
|
+
onActiveStateChanged && onActiveStateChanged(activeState);
|
|
74
|
+
if (forceDeactivate) {
|
|
75
|
+
if (disabled) return 'disabled';else return '';
|
|
76
|
+
}
|
|
77
|
+
if (isActive != activeState) setActiveState(isActive);
|
|
78
|
+
return (isActive ? 'active ' : '') + (disabled ? 'disabled' : '');
|
|
79
|
+
},
|
|
80
|
+
onMouseDown: defaultOnMouseDownHandler,
|
|
81
|
+
tabIndex: disabled ? -1 : 0,
|
|
82
|
+
role: "tab",
|
|
83
|
+
"aria-selected": activeState,
|
|
84
|
+
onClick: function onClick(e) {
|
|
85
|
+
return !disabled && onLinkClick && onLinkClick(e);
|
|
86
|
+
},
|
|
87
|
+
ref: ref,
|
|
88
|
+
"data-testid": testId
|
|
89
|
+
}, rest), {}, {
|
|
90
|
+
children: [/*#__PURE__*/_jsxs(TextContainer, {
|
|
91
|
+
children: [/*#__PURE__*/_jsx(TopWrapper, {
|
|
92
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
93
|
+
children: requiredLine
|
|
94
|
+
})
|
|
95
|
+
}), optionalLine && OptionalLineIcon ? /*#__PURE__*/_jsxs(OptionalLineWrapperWithIcon, {
|
|
96
|
+
children: [OptionalLineIcon, !!optionalLine && /*#__PURE__*/_jsx("span", {
|
|
97
|
+
children: optionalLine
|
|
98
|
+
})]
|
|
99
|
+
}) : optionalLine ? /*#__PURE__*/_jsx(OptionalLineWrapper, {
|
|
100
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
101
|
+
children: optionalLine
|
|
102
|
+
})
|
|
103
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {})]
|
|
104
|
+
}), /*#__PURE__*/_jsx(StyledNotification, {
|
|
105
|
+
children: showNotificationDot && /*#__PURE__*/_jsx(NotificationDot, {
|
|
106
|
+
testId: "NotificationDot",
|
|
107
|
+
size: size,
|
|
108
|
+
variant: variant
|
|
92
109
|
})
|
|
93
|
-
}),
|
|
94
|
-
children:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
99
|
-
children: optionalLine
|
|
100
|
-
})
|
|
101
|
-
}) : /*#__PURE__*/_jsx(_Fragment, {})]
|
|
102
|
-
}), /*#__PURE__*/_jsx(StyledNotification, {
|
|
103
|
-
children: showNotificationDot && /*#__PURE__*/_jsx(NotificationDot, {
|
|
104
|
-
testId: "NotificationDot",
|
|
105
|
-
size: size,
|
|
106
|
-
variant: variant
|
|
107
|
-
})
|
|
108
|
-
}), endLineIcon && /*#__PURE__*/_jsx(EndLineIcon, {
|
|
109
|
-
children: endLineIcon
|
|
110
|
-
})]
|
|
111
|
-
})), children]
|
|
110
|
+
}), endLineIcon && /*#__PURE__*/_jsx(EndLineIcon, {
|
|
111
|
+
children: endLineIcon
|
|
112
|
+
})]
|
|
113
|
+
})), children]
|
|
114
|
+
})
|
|
112
115
|
});
|
|
113
|
-
}
|
|
116
|
+
};
|
|
114
117
|
export default TabLink;
|
|
115
118
|
//# sourceMappingURL=TabLink.js.map
|
package/dist/Tabs/TabLink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabLink.js","names":["React","NavLink","styled","NotificationDot","Size","COLORS","focusStyles","Z_INDEXES","defaultOnMouseDownHandler","useState","OptionalLineWrapperWithIcon","div","TopWrapper","TextContainer","StyledNotification","EndLineIcon","OptionalLineWrapper","Wrapper","neutral_600","props","disabled","neutral_100","active","neutral_20","primary_20","hover","primary_600","primary_100","primary_800","primary_500","white","neutral_300","TabLink","forwardRef","ref","to","requiredLine","optionalLine","OptionalLineIcon","onLinkClick","forceDeactivate","testId","showNotificationDot","size","Small","endLineIcon","onActiveStateChanged","variant","children","containerOnMouseEnter","containerOnMouseLeave","className","rest","activeState","setActiveState","toString","isActive","e"],"sources":["../../src/Tabs/TabLink.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { Size } from '../types';\nimport { COLORS, focusStyles } from '../styles';\nimport { Z_INDEXES } from '../styles/z-indexes';\nimport { defaultOnMouseDownHandler } from '../common';\nimport { useState } from 'react';\n\ntype TabLinkProps = {\n disabled?: boolean;\n forceDeactivate?: boolean;\n requiredLine: string;\n optionalLine?: string;\n OptionalLineIcon?: React.ReactNode; //React.FunctionComponent<BaseProps>;\n endLineIcon?: React.ReactNode;\n onLinkClick?: (e: React.MouseEvent) => void;\n testId?: string;\n onActiveStateChanged?: (state: boolean) => void;\n showNotificationDot?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n variant?: 'positive' | 'critical';\n containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n} & NavLinkProps;\n\nconst OptionalLineWrapperWithIcon = styled.div`\n display: flex;\n flex-direction: row;\n\n span {\n margin: 0 0 0 4px !important;\n font-size: 12px;\n line-height: 16px;\n }\n`;\n\nconst TopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n\n span:not(:only-child) {\n width: calc(100% - 32px);\n }\n`;\n\nconst TextContainer = styled.div`\n width: 100%;\n margin: auto 0 auto 16px !important;\n`;\n\nconst StyledNotification = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst EndLineIcon = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst OptionalLineWrapper = styled.div`\n font-size: 12px;\n`;\n//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed\nconst Wrapper = styled.div<{disabled: boolean}>`\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ${COLORS.neutral_600};\n \n background-color: ${(props) => (props.disabled ? COLORS.neutral_100 : 'transparent')};\n cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ${focusStyles}\n }\n \n &.active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.neutral_20};\n }\n \n &.active:hover, &.active.dropdown-hover {\n background-color: ${COLORS.primary_20};\n }\n \n &:hover, &.dropdown-hover {\n z-index: ${Z_INDEXES.hover};\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n \n &:active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ${COLORS.primary_500};\n \n border-radius: 4px;\n }\n }\n \n &.active:hover, &.active.dropdown-hover {\n &::after {\n background-color: ${COLORS.primary_600};\n }\n }\n \n &.active:active {\n background-color: ${COLORS.primary_100};\n \n &::after {\n background-color: ${COLORS.primary_800};\n }\n }\n \n &.disabled {\n background-color: ${COLORS.white};\n color: ${COLORS.neutral_300};\n \n span {\n color: ${COLORS.neutral_300};\n }\n \n &::after {\n background-color: ${COLORS.neutral_300};\n }\n }\n }\n`;\n\nconst TabLink = React.forwardRef<HTMLAnchorElement, TabLinkProps>(({\n to,\n disabled = false,\n requiredLine,\n optionalLine,\n OptionalLineIcon,\n onLinkClick,\n forceDeactivate,\n testId,\n showNotificationDot = false,\n size = Size.Small,\n endLineIcon,\n onActiveStateChanged,\n variant = 'critical',\n children,\n containerOnMouseEnter,\n containerOnMouseLeave,\n className,\n ...rest\n}: TabLinkProps, ref) => {\n \n const [activeState, setActiveState] = useState<boolean>(false);\n\n return (\n <Wrapper disabled={disabled} className={disabled ? 'disabled' : ''} onMouseEnter={containerOnMouseEnter} onMouseLeave={containerOnMouseLeave}>\n <NavLink\n to={forceDeactivate ? 'invalid' : to.toString()}\n //disabled={disabled}\n className={({ isActive }) => {\n onActiveStateChanged && onActiveStateChanged(activeState);\n if(forceDeactivate)\n {\n if(disabled) \n return 'disabled';\n else \n return '';\n }\n\n if(isActive != activeState)\n setActiveState(isActive);\n\n return (isActive ? 'active ' : '') + (disabled ? 'disabled' : '');\n }}\n onMouseDown={defaultOnMouseDownHandler}\n tabIndex={disabled ? -1 : 0}\n role=\"tab\"\n aria-selected={activeState}\n onClick={(e: React.MouseEvent) => !disabled && onLinkClick && onLinkClick(e)}\n ref={ref}\n data-testid={testId}\n {...rest}>\n <TextContainer>\n <TopWrapper>\n <span>{requiredLine}</span>\n </TopWrapper>\n {optionalLine && OptionalLineIcon ? (\n <OptionalLineWrapperWithIcon>\n {OptionalLineIcon}\n {!!optionalLine && <span>{optionalLine}</span>}\n </OptionalLineWrapperWithIcon>\n ) : optionalLine ? (\n <OptionalLineWrapper>\n <span>{optionalLine}</span>\n </OptionalLineWrapper>\n ) : (\n <></>\n )}\n </TextContainer>\n <StyledNotification>{showNotificationDot && <NotificationDot testId=\"NotificationDot\" size={size} variant={variant} />}</StyledNotification>\n {endLineIcon && <EndLineIcon>{endLineIcon}</EndLineIcon>}\n </NavLink>\n {children}\n </Wrapper>\n );\n});\n\nexport default TabLink;\n"],"mappings":";;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,OAAO,QAAsB,kBAAkB;AACxD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,MAAM,EAAEC,WAAW,QAAQ,WAAW;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,yBAAyB,QAAQ,WAAW;AACrD,SAASC,QAAQ,QAAQ,OAAO;AAAC;AAAA;AAAA;AAmBjC,IAAMC,2BAA2B,GAAGR,MAAM,CAACS,GAAG,mNAS7C;AAED,IAAMC,UAAU,GAAGV,MAAM,CAACS,GAAG,oLAO5B;AAED,IAAME,aAAa,GAAGX,MAAM,CAACS,GAAG,iIAG/B;AAED,IAAMG,kBAAkB,GAAGZ,MAAM,CAACS,GAAG,2GAEpC;AAED,IAAMI,WAAW,GAAGb,MAAM,CAACS,GAAG,2GAE7B;AAED,IAAMK,mBAAmB,GAAGd,MAAM,CAACS,GAAG,6FAErC;AACD;AACA,IAAMM,OAAO,GAAGf,MAAM,CAACS,GAAG,wqDAkBbN,MAAM,CAACa,WAAW,EAEP,UAACC,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAGf,MAAM,CAACgB,WAAW,GAAG,aAAa;AAAA,CAAC,EAC1E,UAACF,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,aAAa,GAAG,SAAS;AAAA,CAAC,EAW7Dd,WAAW,EAIFC,SAAS,CAACe,MAAM,EAC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EtB,mBACD;MAAA,EACa,eAChB,KAAC,kBAAkB;QAAA,UAAEK,mBAAmB,iBAAI,KAAC,eAAe;UAAC,MAAM,EAAC,iBAAiB;UAAC,IAAI,EAAEC,IAAK;UAAC,OAAO,EAAEI;QAAQ;MAAG,EAAsB,EAC3IF,WAAW,iBAAI,KAAC,WAAW;QAAA,UAAEA;MAAW,EAAe;IAAA,GAChD,EACTG,QAAQ;EAAA,EACD;AAEd,CAAC,CAAC;AAEF,eAAehB,OAAO"}
|
|
1
|
+
{"version":3,"file":"TabLink.js","names":["React","NavLink","styled","NotificationDot","Size","COLORS","focusStyles","Z_INDEXES","defaultOnMouseDownHandler","useState","OptionalLineWrapperWithIcon","div","TopWrapper","TextContainer","StyledNotification","EndLineIcon","OptionalLineWrapper","Wrapper","neutral_600","props","disabled","neutral_100","active","neutral_20","primary_20","hover","primary_600","primary_100","primary_800","primary_500","white","neutral_300","TabLink","to","requiredLine","optionalLine","OptionalLineIcon","onLinkClick","forceDeactivate","testId","showNotificationDot","size","Small","endLineIcon","onActiveStateChanged","variant","children","containerOnMouseEnter","containerOnMouseLeave","className","rest","ref","useRef","activeState","setActiveState","toString","isActive","e"],"sources":["../../src/Tabs/TabLink.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { Size } from '../types';\nimport { COLORS, focusStyles } from '../styles';\nimport { Z_INDEXES } from '../styles/z-indexes';\nimport { defaultOnMouseDownHandler } from '../common';\nimport { useState } from 'react';\n\ntype TabLinkProps = {\n disabled?: boolean;\n forceDeactivate?: boolean;\n requiredLine: string;\n optionalLine?: string;\n OptionalLineIcon?: React.ReactNode; //React.FunctionComponent<BaseProps>;\n endLineIcon?: React.ReactNode;\n onLinkClick?: (e: React.MouseEvent) => void;\n testId?: string;\n onActiveStateChanged?: (state: boolean) => void;\n showNotificationDot?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n variant?: 'positive' | 'critical';\n containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n} & NavLinkProps;\n\nconst OptionalLineWrapperWithIcon = styled.div`\n display: flex;\n flex-direction: row;\n\n span {\n margin: 0 0 0 4px !important;\n font-size: 12px;\n line-height: 16px;\n }\n`;\n\nconst TopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n\n span:not(:only-child) {\n width: calc(100% - 32px);\n }\n`;\n\nconst TextContainer = styled.div`\n width: 100%;\n margin: auto 0 auto 16px !important;\n`;\n\nconst StyledNotification = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst EndLineIcon = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst OptionalLineWrapper = styled.div`\n font-size: 12px;\n`;\n//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed\nconst Wrapper = styled.div<{ disabled: boolean }>`\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n display: flex;\n flex-direction: row;\n align-items: center;\n\n font-size: 16px;\n line-height: 120%;\n color: ${COLORS.neutral_600};\n\n background-color: ${(props) => (props.disabled ? COLORS.neutral_100 : 'transparent')};\n cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n\n &:not(:last-child) {\n margin-bottom: 4px;\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &.active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.neutral_20};\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n }\n\n &:hover {\n z-index: ${Z_INDEXES.hover};\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n\n &:active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n\n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n &.active:hover {\n &::after {\n background-color: ${COLORS.primary_600};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n &::after {\n background-color: ${COLORS.primary_800};\n }\n }\n\n &.disabled {\n background-color: ${COLORS.white};\n color: ${COLORS.neutral_300};\n\n span {\n color: ${COLORS.neutral_300};\n }\n\n &::after {\n background-color: ${COLORS.neutral_300};\n }\n }\n }\n`;\n\nconst TabLink = ({\n to,\n disabled = false,\n requiredLine,\n optionalLine,\n OptionalLineIcon,\n onLinkClick,\n forceDeactivate,\n testId,\n showNotificationDot = false,\n size = Size.Small,\n endLineIcon,\n onActiveStateChanged,\n variant = 'critical',\n children,\n containerOnMouseEnter,\n containerOnMouseLeave,\n className,\n ...rest\n}: TabLinkProps) => {\n const ref = React.useRef<any>(null);\n const [activeState, setActiveState] = useState<boolean>(false);\n\n return (\n <Wrapper disabled={disabled} className={disabled ? 'disabled' : ''} onMouseEnter={containerOnMouseEnter} onMouseLeave={containerOnMouseLeave}>\n <>\n <NavLink\n to={forceDeactivate ? 'invalid' : to.toString()}\n //disabled={disabled}\n className={({ isActive }) => {\n onActiveStateChanged && onActiveStateChanged(activeState);\n if (forceDeactivate) {\n if (disabled) return 'disabled';\n else return '';\n }\n\n if (isActive != activeState) setActiveState(isActive);\n\n return (isActive ? 'active ' : '') + (disabled ? 'disabled' : '');\n }}\n onMouseDown={defaultOnMouseDownHandler}\n tabIndex={disabled ? -1 : 0}\n role=\"tab\"\n aria-selected={activeState}\n onClick={(e: React.MouseEvent) => !disabled && onLinkClick && onLinkClick(e)}\n ref={ref}\n data-testid={testId}\n {...rest}>\n <TextContainer>\n <TopWrapper>\n <span>{requiredLine}</span>\n </TopWrapper>\n {optionalLine && OptionalLineIcon ? (\n <OptionalLineWrapperWithIcon>\n {OptionalLineIcon}\n {!!optionalLine && <span>{optionalLine}</span>}\n </OptionalLineWrapperWithIcon>\n ) : optionalLine ? (\n <OptionalLineWrapper>\n <span>{optionalLine}</span>\n </OptionalLineWrapper>\n ) : (\n <></>\n )}\n </TextContainer>\n <StyledNotification>{showNotificationDot && <NotificationDot testId=\"NotificationDot\" size={size} variant={variant} />}</StyledNotification>\n {endLineIcon && <EndLineIcon>{endLineIcon}</EndLineIcon>}\n </NavLink>\n {children}\n </>\n </Wrapper>\n );\n};\n\nexport default TabLink;\n"],"mappings":";;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,OAAO,QAAsB,kBAAkB;AACxD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,MAAM,EAAEC,WAAW,QAAQ,WAAW;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,yBAAyB,QAAQ,WAAW;AACrD,SAASC,QAAQ,QAAQ,OAAO;AAAC;AAAA;AAAA;AAmBjC,IAAMC,2BAA2B,GAAGR,MAAM,CAACS,GAAG,mNAS7C;AAED,IAAMC,UAAU,GAAGV,MAAM,CAACS,GAAG,oLAO5B;AAED,IAAME,aAAa,GAAGX,MAAM,CAACS,GAAG,iIAG/B;AAED,IAAMG,kBAAkB,GAAGZ,MAAM,CAACS,GAAG,2GAEpC;AAED,IAAMI,WAAW,GAAGb,MAAM,CAACS,GAAG,2GAE7B;AAED,IAAMK,mBAAmB,GAAGd,MAAM,CAACS,GAAG,6FAErC;AACD;AACA,IAAMM,OAAO,GAAGf,MAAM,CAACS,GAAG,8jDAiBbN,MAAM,CAACa,WAAW,EAEP,UAACC,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAGf,MAAM,CAACgB,WAAW,GAAG,aAAa;AAAA,CAAC,EAC1E,UAACF,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,aAAa,GAAG,SAAS;AAAA,CAAC,EAW7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ClB,GAC5BA,YAAY,gBACd,KAAC,mBAAmB;YAAA,uBAClB;cAAA,UAAOA;YAAY;UAAQ,EACP,gBAEtB,mBACD;QAAA,EACa,eAChB,KAAC,kBAAkB;UAAA,UAAEK,mBAAmB,iBAAI,KAAC,eAAe;YAAC,MAAM,EAAC,iBAAiB;YAAC,IAAI,EAAEC,IAAK;YAAC,OAAO,EAAEI;UAAQ;QAAG,EAAsB,EAC3IF,WAAW,iBAAI,KAAC,WAAW;UAAA,UAAEA;QAAW,EAAe;MAAA,GAChD,EACTG,QAAQ;IAAA;EACR,EACK;AAEd,CAAC;AAED,eAAed,OAAO"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TileDropdownButton, TileHyperLink, TileIconButton, TileNote, TileStandardButton, TileToggleButton } from './TileTypes';
|
|
2
3
|
import { Size } from '../types';
|
|
3
4
|
export declare const TileNoteText: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -82,7 +82,7 @@ var TooltipOverflow = function TooltipOverflow(_ref) {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
}, []);
|
|
85
|
-
var renderedCallback = React.useCallback(function (
|
|
85
|
+
var renderedCallback = React.useCallback(function () {
|
|
86
86
|
if (input && input.current) {
|
|
87
87
|
input.current.addEventListener("focus", onFocus);
|
|
88
88
|
input.current.addEventListener("blur", onBlur);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipOverflow.cjs","names":["TooltipOverflow","label","children","input","withArrow","maxWidth","width","value","size","Size","Small","height","align","position","props","React","useState","textOverflowed","setTextOverflowed","focused","setFocused","useResizeDetector","targetRef","customW","customH","useEffect","checkIfOverflowed","over","current","offsetWidth","scrollWidth","id","console","log","onFocus","onBlur","removeEventListener","renderedCallback","useCallback","
|
|
1
|
+
{"version":3,"file":"TooltipOverflow.cjs","names":["TooltipOverflow","label","children","input","withArrow","maxWidth","width","value","size","Size","Small","height","align","position","props","React","useState","textOverflowed","setTextOverflowed","focused","setFocused","useResizeDetector","targetRef","customW","customH","useEffect","checkIfOverflowed","over","current","offsetWidth","scrollWidth","id","console","log","onFocus","onBlur","removeEventListener","renderedCallback","useCallback","addEventListener"],"sources":["../../src/Tooltips/TooltipOverflow.tsx"],"sourcesContent":["\nimport * as React from 'react';\n\nimport { TooltipProps } from './TooltipTypes';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { TooltipContainer, Tooltip } from './TooltipStyles';\nimport { Size } from '..';\n \ninterface TooltipOverflowProps extends TooltipProps {\n input?: React.MutableRefObject<HTMLInputElement | null>;\n maxWidth?: string;\n width?: string;\n value?: string;\n}\n\n const TooltipOverflow = ({\n label, children,\n input,\n withArrow,\n maxWidth,\n width,\n value,\n size = Size.Small,\n height = 'auto',\n align = 'center', \n position = 'bottom',\n ...props } : TooltipOverflowProps) => {\n\n const [textOverflowed, setTextOverflowed] = React.useState<boolean>(false);\n const [focused, setFocused] = React.useState<boolean>(false);\n const {width: customW, height: customH} = useResizeDetector({ targetRef: input });\n\n React.useEffect(() => {\n checkIfOverflowed();\n }, [customW, customH]);\n\n const checkIfOverflowed = () => {\n //adding +3 offset to offsetWidth, because sometimes when there is no overflow, scrollWidth can be equal to offsetWidth + 1\n const over = (input && !focused && input.current && input.current.offsetWidth + 3 < input.current.scrollWidth) ?? false;\n if(input?.current?.id == \"overflowTest\")\n {\n console.log(input.current.offsetWidth);\n console.log(input.current.scrollWidth);\n console.log(input.current);\n }\n setTextOverflowed(over);\n };\n\n React.useEffect(() => {\n checkIfOverflowed();\n });\n\n const onFocus = () => {\n checkIfOverflowed();\n setFocused(true);\n };\n\n const onBlur = () => {\n setFocused(false);\n };\n\n React.useEffect(() => {\n return () => {\n if(input?.current)\n {\n input?.current.removeEventListener(\"focus\", onFocus);\n input?.current.removeEventListener(\"blur\", onBlur);\n }\n }\n }, []);\n\n const renderedCallback = React.useCallback(() => {\n if(input && input.current)\n {\n input.current.addEventListener(\"focus\", onFocus);\n input.current.addEventListener(\"blur\", onBlur);\n checkIfOverflowed();\n }\n }, []);\n \n return <div ref={renderedCallback}>{textOverflowed && <Tooltip align={align}\n height={height}\n role=\"tooltip\"\n maxWidth={maxWidth}\n width={width}\n size={size}\n withArrow={withArrow}\n position={position}\n {...props}>\n <span>\n {children} </span>\n </Tooltip> }</div>;\n };\n \n export default TooltipOverflow;\n"],"mappings":";;;;;;;;;;;;AACA;AAGA;AAEA;AACA;AAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AASzB,IAAMA,eAAe,GAAG,SAAlBA,eAAe,OAWmB;EAAA,IAVtCC,KAAK,QAALA,KAAK;IAAEC,QAAQ,QAARA,QAAQ;IACfC,KAAK,QAALA,KAAK;IACLC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK;IAAA,iBACLC,IAAI;IAAJA,IAAI,0BAAGC,MAAI,CAACC,KAAK;IAAA,mBACjBC,MAAM;IAANA,MAAM,4BAAG,MAAM;IAAA,kBACfC,KAAK;IAALA,KAAK,2BAAG,QAAQ;IAAA,qBAChBC,QAAQ;IAARA,QAAQ,8BAAG,QAAQ;IAChBC,KAAK;EAET,sBAA4CC,KAAK,CAACC,QAAQ,CAAU,KAAK,CAAC;IAAA;IAAnEC,cAAc;IAAEC,iBAAiB;EACxC,uBAA8BH,KAAK,CAACC,QAAQ,CAAU,KAAK,CAAC;IAAA;IAArDG,OAAO;IAAEC,UAAU;EAC1B,yBAA0C,IAAAC,sCAAiB,EAAC;MAAEC,SAAS,EAAEnB;IAAM,CAAC,CAAC;IAAnEoB,OAAO,sBAAdjB,KAAK;IAAmBkB,OAAO,sBAAfb,MAAM;EAE7BI,KAAK,CAACU,SAAS,CAAC,YAAM;IACpBC,iBAAiB,EAAE;EACrB,CAAC,EAAE,CAACH,OAAO,EAAEC,OAAO,CAAC,CAAC;EAEtB,IAAME,iBAAiB,GAAG,SAApBA,iBAAiB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AK,CAACuB,WAAW,CAAC,YAAM;IAC/C,IAAGnC,KAAK,IAAIA,KAAK,CAACyB,OAAO,EACzB;MACEzB,KAAK,CAACyB,OAAO,CAACW,gBAAgB,CAAC,OAAO,EAAEL,OAAO,CAAC;MAChD/B,KAAK,CAACyB,OAAO,CAACW,gBAAgB,CAAC,MAAM,EAAEJ,MAAM,CAAC;MAC9CT,iBAAiB,EAAE;IACrB;EACF,CAAC,EAAE,EAAE,CAAC;EAEJ,oBAAO;IAAK,GAAG,EAAEW,gBAAiB;IAAA,UAAEpB,cAAc,iBAAI,qBAAC,sBAAO;MAAC,KAAK,EAAEL,KAAM;MACjE,MAAM,EAAED,MAAO;MACf,IAAI,EAAC,SAAS;MACd,QAAQ,EAAEN,QAAS;MACnB,KAAK,EAAEC,KAAM;MACb,IAAI,EAAEE,IAAK;MACX,SAAS,EAAEJ,SAAU;MACrB,QAAQ,EAAES;IAAS,GACfC,KAAK;MAAA,uBACR;QAAA,WACAZ,QAAQ,EAAC,GAAC;MAAA;IAAO;EACX,EAAQ;AAC7B,CAAC;AAAC;EAlFCG,QAAQ;EACRC,KAAK;EACLC,KAAK;AAAA;AAAA,eAkFOP,eAAe;AAAA"}
|
|
@@ -73,7 +73,7 @@ var TooltipOverflow = function TooltipOverflow(_ref) {
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
}, []);
|
|
76
|
-
var renderedCallback = React.useCallback(function (
|
|
76
|
+
var renderedCallback = React.useCallback(function () {
|
|
77
77
|
if (input && input.current) {
|
|
78
78
|
input.current.addEventListener("focus", onFocus);
|
|
79
79
|
input.current.addEventListener("blur", onBlur);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipOverflow.js","names":["React","useResizeDetector","Tooltip","Size","TooltipOverflow","label","children","input","withArrow","maxWidth","width","value","size","Small","height","align","position","props","useState","textOverflowed","setTextOverflowed","focused","setFocused","targetRef","customW","customH","useEffect","checkIfOverflowed","over","current","offsetWidth","scrollWidth","id","console","log","onFocus","onBlur","removeEventListener","renderedCallback","useCallback","
|
|
1
|
+
{"version":3,"file":"TooltipOverflow.js","names":["React","useResizeDetector","Tooltip","Size","TooltipOverflow","label","children","input","withArrow","maxWidth","width","value","size","Small","height","align","position","props","useState","textOverflowed","setTextOverflowed","focused","setFocused","targetRef","customW","customH","useEffect","checkIfOverflowed","over","current","offsetWidth","scrollWidth","id","console","log","onFocus","onBlur","removeEventListener","renderedCallback","useCallback","addEventListener"],"sources":["../../src/Tooltips/TooltipOverflow.tsx"],"sourcesContent":["\nimport * as React from 'react';\n\nimport { TooltipProps } from './TooltipTypes';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { TooltipContainer, Tooltip } from './TooltipStyles';\nimport { Size } from '..';\n \ninterface TooltipOverflowProps extends TooltipProps {\n input?: React.MutableRefObject<HTMLInputElement | null>;\n maxWidth?: string;\n width?: string;\n value?: string;\n}\n\n const TooltipOverflow = ({\n label, children,\n input,\n withArrow,\n maxWidth,\n width,\n value,\n size = Size.Small,\n height = 'auto',\n align = 'center', \n position = 'bottom',\n ...props } : TooltipOverflowProps) => {\n\n const [textOverflowed, setTextOverflowed] = React.useState<boolean>(false);\n const [focused, setFocused] = React.useState<boolean>(false);\n const {width: customW, height: customH} = useResizeDetector({ targetRef: input });\n\n React.useEffect(() => {\n checkIfOverflowed();\n }, [customW, customH]);\n\n const checkIfOverflowed = () => {\n //adding +3 offset to offsetWidth, because sometimes when there is no overflow, scrollWidth can be equal to offsetWidth + 1\n const over = (input && !focused && input.current && input.current.offsetWidth + 3 < input.current.scrollWidth) ?? false;\n if(input?.current?.id == \"overflowTest\")\n {\n console.log(input.current.offsetWidth);\n console.log(input.current.scrollWidth);\n console.log(input.current);\n }\n setTextOverflowed(over);\n };\n\n React.useEffect(() => {\n checkIfOverflowed();\n });\n\n const onFocus = () => {\n checkIfOverflowed();\n setFocused(true);\n };\n\n const onBlur = () => {\n setFocused(false);\n };\n\n React.useEffect(() => {\n return () => {\n if(input?.current)\n {\n input?.current.removeEventListener(\"focus\", onFocus);\n input?.current.removeEventListener(\"blur\", onBlur);\n }\n }\n }, []);\n\n const renderedCallback = React.useCallback(() => {\n if(input && input.current)\n {\n input.current.addEventListener(\"focus\", onFocus);\n input.current.addEventListener(\"blur\", onBlur);\n checkIfOverflowed();\n }\n }, []);\n \n return <div ref={renderedCallback}>{textOverflowed && <Tooltip align={align}\n height={height}\n role=\"tooltip\"\n maxWidth={maxWidth}\n width={width}\n size={size}\n withArrow={withArrow}\n position={position}\n {...props}>\n <span>\n {children} </span>\n </Tooltip> }</div>;\n };\n \n export default TooltipOverflow;\n"],"mappings":";;;;;;;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,SAASC,iBAAiB,QAAQ,uBAAuB;AAEzD,SAA2BC,OAAO,QAAQ,iBAAiB;AAC3D,SAASC,IAAI,QAAQ,IAAI;AAAC;AAAA;AASzB,IAAMC,eAAe,GAAG,SAAlBA,eAAe,OAWmB;EAAA,IAVtCC,KAAK,QAALA,KAAK;IAAEC,QAAQ,QAARA,QAAQ;IACfC,KAAK,QAALA,KAAK;IACLC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK;IAAA,iBACLC,IAAI;IAAJA,IAAI,0BAAGT,IAAI,CAACU,KAAK;IAAA,mBACjBC,MAAM;IAANA,MAAM,4BAAG,MAAM;IAAA,kBACfC,KAAK;IAALA,KAAK,2BAAG,QAAQ;IAAA,qBAChBC,QAAQ;IAARA,QAAQ,8BAAG,QAAQ;IAChBC,KAAK;EAET,sBAA4CjB,KAAK,CAACkB,QAAQ,CAAU,KAAK,CAAC;IAAA;IAAnEC,cAAc;IAAEC,iBAAiB;EACxC,uBAA8BpB,KAAK,CAACkB,QAAQ,CAAU,KAAK,CAAC;IAAA;IAArDG,OAAO;IAAEC,UAAU;EAC1B,yBAA0CrB,iBAAiB,CAAC;MAAEsB,SAAS,EAAEh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AK,CAAEsB,OAAO,CAACQ,mBAAmB,CAAC,OAAO,EAAEF,OAAO,CAAC;QACpD5B,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEsB,OAAO,CAACQ,mBAAmB,CAAC,MAAM,EAAED,MAAM,CAAC;MACpD;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,IAAME,gBAAgB,GAAGtC,KAAK,CAACuC,WAAW,CAAC,YAAM;IAC/C,IAAGhC,KAAK,IAAIA,KAAK,CAACsB,OAAO,EACzB;MACEtB,KAAK,CAACsB,OAAO,CAACW,gBAAgB,CAAC,OAAO,EAAEL,OAAO,CAAC;MAChD5B,KAAK,CAACsB,OAAO,CAACW,gBAAgB,CAAC,MAAM,EAAEJ,MAAM,CAAC;MAC9CT,iBAAiB,EAAE;IACrB;EACF,CAAC,EAAE,EAAE,CAAC;EAEJ,oBAAO;IAAK,GAAG,EAAEW,gBAAiB;IAAA,UAAEnB,cAAc,iBAAI,KAAC,OAAO;MAAC,KAAK,EAAEJ,KAAM;MACjE,MAAM,EAAED,MAAO;MACf,IAAI,EAAC,SAAS;MACd,QAAQ,EAAEL,QAAS;MACnB,KAAK,EAAEC,KAAM;MACb,IAAI,EAAEE,IAAK;MACX,SAAS,EAAEJ,SAAU;MACrB,QAAQ,EAAEQ;IAAS,GACfC,KAAK;MAAA,uBACR;QAAA,WACAX,QAAQ,EAAC,GAAC;MAAA;IAAO;EACX,EAAQ;AAC7B,CAAC;AAAC;EAlFCG,QAAQ;EACRC,KAAK;EACLC,KAAK;AAAA;AAkFR,eAAeP,eAAe"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TooltipProps } from './TooltipTypes';
|
|
2
3
|
declare const TooltipWrapper: ({ label, children, withArrow, tabIndex, size, height, delay, align, position, trigger, hideAfter, ...props }: TooltipProps) => JSX.Element;
|
|
3
4
|
export default TooltipWrapper;
|