@laerdal/life-react-components 2.3.1-dev.16 → 2.3.1-dev.19
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.cjs +1 -1
- package/dist/AuthPage/AuthPage.cjs.map +1 -1
- package/dist/AuthPage/AuthPage.js +1 -1
- package/dist/AuthPage/AuthPage.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.js +2 -2
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs +65 -6
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.js +65 -6
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs +102 -19
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.d.ts +4 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.js +102 -19
- package/dist/GlobalNavigationBar/desktop/SubMenu.js.map +1 -1
- package/dist/Panel/Panel.cjs +4 -4
- package/dist/Panel/Panel.cjs.map +1 -1
- package/dist/Panel/Panel.js +5 -5
- package/dist/Panel/Panel.js.map +1 -1
- package/dist/Tabs/TabLink.cjs +3 -4
- package/dist/Tabs/TabLink.cjs.map +1 -1
- package/dist/Tabs/TabLink.d.ts +13 -14
- package/dist/Tabs/TabLink.js +3 -4
- package/dist/Tabs/TabLink.js.map +1 -1
- package/package.json +1 -1
package/dist/Panel/Panel.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.cjs","names":["Wrapper","styled","div","COLORS","neutral_20","
|
|
1
|
+
{"version":3,"file":"Panel.cjs","names":["Wrapper","styled","div","COLORS","neutral_20","BREAKPOINTS","LARGE","Media","Body","neutral_600","Footer","Panel","props","React","useState","currentImage","setCurrentImage","isLargeScreen","useMediaMatch","replace","rest","order","undefined","media","title","content","items","type","moveLeft","length","moveRight","currentItem","className","fit","src","alt","Size","Large","Small","LinearProgressType","Dots"],"sources":["../../src/Panel/Panel.tsx"],"sourcesContent":["import React from 'react';\nimport styled from \"styled-components\";\nimport {BREAKPOINTS, COLORS, Quote} from \"../styles\";\nimport {IconButton} from \"../Button\";\nimport {SystemIcons} from \"../icons\";\nimport {LinearProgress, LinearProgressType} from \"../LinearProgress\";\nimport {useMediaMatch} from \"rooks\";\nimport {Size} from \"../types\";\n\nconst Wrapper = styled.div`\n display: flex;\n flex-direction: column;\n background: ${COLORS.neutral_20};\n min-height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n overflow: hidden;\n\n gap: 24px;\n padding: 24px 32px 64px;\n\n ${BREAKPOINTS.LARGE} {\n gap: 32px;\n padding: 32px 64px 128px;\n }\n\n &.reverse {\n align-items: flex-start;\n }\n`;\n\nconst Media = styled.div`\n display: flex;\n width: 320px;\n height: 200px;\n\n\n img {\n object-fit: contain;\n }\n\n img.fit {\n object-fit: contain;\n }\n\n img.fill {\n object-fit: cover;\n }\n\n max-width: 100%;\n\n img {\n max-width: 100%;\n width: 320px;\n height: 200px;\n }\n\n ${BREAKPOINTS.LARGE} {\n width: 488px;\n height: 280px;\n\n img {\n width: 488px;\n height: 280px;\n }\n }\n\n`;\n\nconst Body = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n\n width: 100%;\n max-width: 320px;\n\n ${BREAKPOINTS.LARGE} {\n max-width: 488px;\n }\n \n p:not(:first-of-type) {\n flex: 1;\n color: ${COLORS.neutral_600};\n }\n\n\n`;\nconst Footer = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n\n max-width: 320px;\n\n ${BREAKPOINTS.LARGE} {\n max-width: 488px;\n }\n\n .progress {\n width: max-content;\n }\n`;\n\ninterface BasePanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n type?: 'default' | 'carousel';\n}\n\ninterface PanelContent {\n media?: { type: 'image', src: string; alt: string, fit?: 'fill' | 'fit' } | { type: 'custom', content: React.ReactNode };\n title?: string;\n content?: React.ReactNode;\n}\n\ninterface DefaultPanelProps extends BasePanelProps, PanelContent {\n type?: 'default';\n order?: 'default' | 'reverse';\n}\n\ninterface CarouselPanelProps extends BasePanelProps {\n type: 'carousel';\n order?: 'default' | 'reverse';\n items?: PanelContent[];\n}\n\nexport type PanelProps = DefaultPanelProps | CarouselPanelProps;\n\nexport const Panel = (props: PanelProps) => {\n\n const [currentImage, setCurrentImage] = React.useState(0);\n const isLargeScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n let rest: React.HTMLAttributes<HTMLDivElement> = {};\n let order = undefined;\n let media = undefined;\n let title = '';\n let content = undefined;\n let items: PanelContent[] = [];\n\n\n switch (props.type) {\n case 'carousel':\n ({items = [], order, ...rest} = props);\n break;\n case 'default':\n default:\n ({media, content, title = '', order, ...rest} = props)\n break;\n }\n\n\n const moveLeft = () => {\n props.type === 'carousel' && setCurrentImage(currentImage === 0 ? items.length - 1 : currentImage - 1);\n }\n const moveRight = () => {\n props.type === 'carousel' && setCurrentImage(currentImage + 1 > items.length - 1 ? 0 : currentImage + 1);\n }\n\n const currentItem: PanelContent = props.type === 'carousel' ? items[currentImage] : {media, title, content};\n\n return (\n <Wrapper {...rest} className={`${rest.className || ''} ${order || ''} `}>\n <Media>\n {\n currentItem.media?.type === 'image' &&\n <img className={currentItem.media.fit} src={currentItem.media.src} alt={currentItem.media.alt}/>\n }\n {\n currentItem.media?.type === 'custom' && currentItem.media.content\n }\n </Media>\n <Body>\n <Quote>{currentItem.title}</Quote>\n <p>{currentItem.content}</p>\n </Body>\n {\n props.type === 'carousel' &&\n <Footer>\n <IconButton action={moveLeft} variant={'secondary'} shape={'circular'}>\n <SystemIcons.ChevronLeft/>\n </IconButton>\n <LinearProgress size={isLargeScreen ? Size.Large : Size.Small}\n className={'progress'}\n value={currentImage + 1}\n max={props.items!.length }\n type={LinearProgressType.Dots}/>\n <IconButton action={moveRight} variant={'secondary'} shape={'circular'}>\n <SystemIcons.ChevronRight/>\n </IconButton>\n </Footer>\n }\n </Wrapper>\n )\n};\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA8B;AAAA;EAAA;AAAA;AAAA;AAAA;AAE9B,IAAMA,OAAO,GAAGC,yBAAM,CAACC,GAAG,uZAGVC,cAAM,CAACC,UAAU,EAS7BC,mBAAW,CAACC,KAAK,CAQpB;AAED,IAAMC,KAAK,GAAGN,yBAAM,CAACC,GAAG,gfA0BpBG,mBAAW,CAACC,KAAK,CAUpB;AAED,IAAME,IAAI,GAAGP,yBAAM,CAACC,GAAG,uVAUnBG,mBAAW,CAACC,KAAK,EAMRH,cAAM,CAACM,WAAW,CAI9B;AACD,IAAMC,MAAM,GAAGT,yBAAM,CAACC,GAAG,4RAQrBG,mBAAW,CAACC,KAAK,CAOpB;AAyBM,IAAMK,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAiB,EAAK;EAAA;EAE1C,sBAAwCC,cAAK,CAACC,QAAQ,CAAC,CAAC,CAAC;IAAA;IAAlDC,YAAY;IAAEC,eAAe;EACpC,IAAMC,aAAa,GAAG,IAAAC,oBAAa,EAACb,mBAAW,CAACC,KAAK,CAACa,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;EAE7E,IAAIC,IAA0C,GAAG,CAAC,CAAC;EACnD,IAAIC,KAAK,GAAGC,SAAS;EACrB,IAAIC,KAAK,GAAGD,SAAS;EACrB,IAAIE,KAAK,GAAG,EAAE;EACd,IAAIC,OAAO,GAAGH,SAAS;EACvB,IAAII,KAAqB,GAAG,EAAE;EAG9B,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K;EACLC,OAAO;AAAA,qFAIA,SAAS,wFACR,SAAS,EAAG,SAAS,uFAXtB,SAAS,EAAG,UAAU,uFAevB,UAAU,mGACR,SAAS,EAAG,SAAS;EAZ7BF,KAAK;IAAKI,IAAI,4BAAE,OAAO;IAAEO,GAAG;IAAUC,GAAG;IAAUF,GAAG,4BAAG,MAAM,EAAG,KAAK;EAAA;IAAON,IAAI,4BAAE,QAAQ;IAAEF,OAAO;EAAA;EACrGD,KAAK;EACLC,OAAO;AAAA"}
|
package/dist/Panel/Panel.js
CHANGED
|
@@ -10,7 +10,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
10
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import styled from "styled-components";
|
|
13
|
-
import { BREAKPOINTS, COLORS } from "../styles";
|
|
13
|
+
import { BREAKPOINTS, COLORS, Quote } from "../styles";
|
|
14
14
|
import { IconButton } from "../Button";
|
|
15
15
|
import { SystemIcons } from "../icons";
|
|
16
16
|
import { LinearProgress, LinearProgressType } from "../LinearProgress";
|
|
@@ -18,9 +18,9 @@ import { useMediaMatch } from "rooks";
|
|
|
18
18
|
import { Size } from "../types";
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n background: ", ";\n min-height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n overflow: hidden;\n\n gap: 24px;\n padding:
|
|
21
|
+
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n background: ", ";\n min-height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n overflow: hidden;\n\n gap: 24px;\n padding: 24px 32px 64px;\n\n ", " {\n gap: 32px;\n padding: 32px 64px 128px;\n }\n\n &.reverse {\n align-items: flex-start;\n }\n"])), COLORS.neutral_20, BREAKPOINTS.LARGE);
|
|
22
22
|
var Media = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n width: 320px;\n height: 200px;\n\n\n img {\n object-fit: contain;\n }\n\n img.fit {\n object-fit: contain;\n }\n\n img.fill {\n object-fit: cover;\n }\n\n max-width: 100%;\n\n img {\n max-width: 100%;\n width: 320px;\n height: 200px;\n }\n\n ", " {\n width: 488px;\n height: 280px;\n\n img {\n width: 488px;\n height: 280px;\n }\n }\n\n"])), BREAKPOINTS.LARGE);
|
|
23
|
-
var Body = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n\n max-width: 320px;\n\n ", " {\n max-width: 488px;\n }\n\n"])), BREAKPOINTS.LARGE);
|
|
23
|
+
var Body = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n\n width: 100%;\n max-width: 320px;\n\n ", " {\n max-width: 488px;\n }\n \n p:not(:first-of-type) {\n flex: 1;\n color: ", ";\n }\n\n\n"])), BREAKPOINTS.LARGE, COLORS.neutral_600);
|
|
24
24
|
var Footer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n\n max-width: 320px;\n\n ", " {\n max-width: 488px;\n }\n\n .progress {\n width: max-content;\n }\n"])), BREAKPOINTS.LARGE);
|
|
25
25
|
export var Panel = function Panel(props) {
|
|
26
26
|
var _currentItem$media, _currentItem$media2;
|
|
@@ -76,7 +76,7 @@ export var Panel = function Panel(props) {
|
|
|
76
76
|
alt: currentItem.media.alt
|
|
77
77
|
}), ((_currentItem$media2 = currentItem.media) === null || _currentItem$media2 === void 0 ? void 0 : _currentItem$media2.type) === 'custom' && currentItem.media.content]
|
|
78
78
|
}), /*#__PURE__*/_jsxs(Body, {
|
|
79
|
-
children: [/*#__PURE__*/_jsx(
|
|
79
|
+
children: [/*#__PURE__*/_jsx(Quote, {
|
|
80
80
|
children: currentItem.title
|
|
81
81
|
}), /*#__PURE__*/_jsx("p", {
|
|
82
82
|
children: currentItem.content
|
|
@@ -88,7 +88,7 @@ export var Panel = function Panel(props) {
|
|
|
88
88
|
shape: 'circular',
|
|
89
89
|
children: /*#__PURE__*/_jsx(SystemIcons.ChevronLeft, {})
|
|
90
90
|
}), /*#__PURE__*/_jsx(LinearProgress, {
|
|
91
|
-
size: isLargeScreen ? Size.
|
|
91
|
+
size: isLargeScreen ? Size.Large : Size.Small,
|
|
92
92
|
className: 'progress',
|
|
93
93
|
value: currentImage + 1,
|
|
94
94
|
max: props.items.length,
|
package/dist/Panel/Panel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.js","names":["React","styled","BREAKPOINTS","COLORS","IconButton","SystemIcons","LinearProgress","LinearProgressType","useMediaMatch","Size","Wrapper","div","neutral_20","
|
|
1
|
+
{"version":3,"file":"Panel.js","names":["React","styled","BREAKPOINTS","COLORS","Quote","IconButton","SystemIcons","LinearProgress","LinearProgressType","useMediaMatch","Size","Wrapper","div","neutral_20","LARGE","Media","Body","neutral_600","Footer","Panel","props","useState","currentImage","setCurrentImage","isLargeScreen","replace","rest","order","undefined","media","title","content","items","type","moveLeft","length","moveRight","currentItem","className","fit","src","alt","Large","Small","Dots"],"sources":["../../src/Panel/Panel.tsx"],"sourcesContent":["import React from 'react';\nimport styled from \"styled-components\";\nimport {BREAKPOINTS, COLORS, Quote} from \"../styles\";\nimport {IconButton} from \"../Button\";\nimport {SystemIcons} from \"../icons\";\nimport {LinearProgress, LinearProgressType} from \"../LinearProgress\";\nimport {useMediaMatch} from \"rooks\";\nimport {Size} from \"../types\";\n\nconst Wrapper = styled.div`\n display: flex;\n flex-direction: column;\n background: ${COLORS.neutral_20};\n min-height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n overflow: hidden;\n\n gap: 24px;\n padding: 24px 32px 64px;\n\n ${BREAKPOINTS.LARGE} {\n gap: 32px;\n padding: 32px 64px 128px;\n }\n\n &.reverse {\n align-items: flex-start;\n }\n`;\n\nconst Media = styled.div`\n display: flex;\n width: 320px;\n height: 200px;\n\n\n img {\n object-fit: contain;\n }\n\n img.fit {\n object-fit: contain;\n }\n\n img.fill {\n object-fit: cover;\n }\n\n max-width: 100%;\n\n img {\n max-width: 100%;\n width: 320px;\n height: 200px;\n }\n\n ${BREAKPOINTS.LARGE} {\n width: 488px;\n height: 280px;\n\n img {\n width: 488px;\n height: 280px;\n }\n }\n\n`;\n\nconst Body = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n\n width: 100%;\n max-width: 320px;\n\n ${BREAKPOINTS.LARGE} {\n max-width: 488px;\n }\n \n p:not(:first-of-type) {\n flex: 1;\n color: ${COLORS.neutral_600};\n }\n\n\n`;\nconst Footer = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n\n max-width: 320px;\n\n ${BREAKPOINTS.LARGE} {\n max-width: 488px;\n }\n\n .progress {\n width: max-content;\n }\n`;\n\ninterface BasePanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n type?: 'default' | 'carousel';\n}\n\ninterface PanelContent {\n media?: { type: 'image', src: string; alt: string, fit?: 'fill' | 'fit' } | { type: 'custom', content: React.ReactNode };\n title?: string;\n content?: React.ReactNode;\n}\n\ninterface DefaultPanelProps extends BasePanelProps, PanelContent {\n type?: 'default';\n order?: 'default' | 'reverse';\n}\n\ninterface CarouselPanelProps extends BasePanelProps {\n type: 'carousel';\n order?: 'default' | 'reverse';\n items?: PanelContent[];\n}\n\nexport type PanelProps = DefaultPanelProps | CarouselPanelProps;\n\nexport const Panel = (props: PanelProps) => {\n\n const [currentImage, setCurrentImage] = React.useState(0);\n const isLargeScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n let rest: React.HTMLAttributes<HTMLDivElement> = {};\n let order = undefined;\n let media = undefined;\n let title = '';\n let content = undefined;\n let items: PanelContent[] = [];\n\n\n switch (props.type) {\n case 'carousel':\n ({items = [], order, ...rest} = props);\n break;\n case 'default':\n default:\n ({media, content, title = '', order, ...rest} = props)\n break;\n }\n\n\n const moveLeft = () => {\n props.type === 'carousel' && setCurrentImage(currentImage === 0 ? items.length - 1 : currentImage - 1);\n }\n const moveRight = () => {\n props.type === 'carousel' && setCurrentImage(currentImage + 1 > items.length - 1 ? 0 : currentImage + 1);\n }\n\n const currentItem: PanelContent = props.type === 'carousel' ? items[currentImage] : {media, title, content};\n\n return (\n <Wrapper {...rest} className={`${rest.className || ''} ${order || ''} `}>\n <Media>\n {\n currentItem.media?.type === 'image' &&\n <img className={currentItem.media.fit} src={currentItem.media.src} alt={currentItem.media.alt}/>\n }\n {\n currentItem.media?.type === 'custom' && currentItem.media.content\n }\n </Media>\n <Body>\n <Quote>{currentItem.title}</Quote>\n <p>{currentItem.content}</p>\n </Body>\n {\n props.type === 'carousel' &&\n <Footer>\n <IconButton action={moveLeft} variant={'secondary'} shape={'circular'}>\n <SystemIcons.ChevronLeft/>\n </IconButton>\n <LinearProgress size={isLargeScreen ? Size.Large : Size.Small}\n className={'progress'}\n value={currentImage + 1}\n max={props.items!.length }\n type={LinearProgressType.Dots}/>\n <IconButton action={moveRight} variant={'secondary'} shape={'circular'}>\n <SystemIcons.ChevronRight/>\n </IconButton>\n </Footer>\n }\n </Wrapper>\n )\n};\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KA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,KAAK;IAAKI,IAAI,aAAE,OAAO;IAAEO,GAAG;IAAUC,GAAG;IAAUF,GAAG,aAAG,MAAM,EAAG,KAAK;EAAA;IAAON,IAAI,aAAE,QAAQ;IAAEF,OAAO;EAAA;EACrGD,KAAK;EACLC,OAAO;AAAA"}
|
package/dist/Tabs/TabLink.cjs
CHANGED
|
@@ -32,12 +32,12 @@ var StyledNotification = _styledComponents.default.div(_templateObject4 || (_tem
|
|
|
32
32
|
var EndLineIcon = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 15px 0 0 !important;\n"])));
|
|
33
33
|
var OptionalLineWrapper = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 12px;\n"])));
|
|
34
34
|
//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed
|
|
35
|
-
var Wrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\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"])), _styles.COLORS.neutral_600, function (props) {
|
|
35
|
+
var Wrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\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, &.active.dropdown-hover {\n background-color: ", ";\n }\n\n &:hover, &.dropdown-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, &.active.dropdown-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"])), _styles.COLORS.neutral_600, function (props) {
|
|
36
36
|
return props.disabled ? _styles.COLORS.neutral_100 : 'transparent';
|
|
37
37
|
}, function (props) {
|
|
38
38
|
return props.disabled ? 'not-allowed' : 'pointer';
|
|
39
39
|
}, _styles.focusStyles, _zIndexes.Z_INDEXES.active, _styles.COLORS.neutral_20, _styles.COLORS.primary_20, _zIndexes.Z_INDEXES.hover, _styles.COLORS.primary_20, _styles.COLORS.primary_600, _zIndexes.Z_INDEXES.active, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.primary_500, _styles.COLORS.primary_600, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.white, _styles.COLORS.neutral_300, _styles.COLORS.neutral_300, _styles.COLORS.neutral_300);
|
|
40
|
-
var TabLink = function
|
|
40
|
+
var TabLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
41
41
|
var to = _ref.to,
|
|
42
42
|
_ref$disabled = _ref.disabled,
|
|
43
43
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
@@ -60,7 +60,6 @@ var TabLink = function TabLink(_ref) {
|
|
|
60
60
|
containerOnMouseLeave = _ref.containerOnMouseLeave,
|
|
61
61
|
className = _ref.className,
|
|
62
62
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
63
|
-
var ref = React.useRef(null);
|
|
64
63
|
var _useState = (0, React.useState)(false),
|
|
65
64
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
66
65
|
activeState = _useState2[0],
|
|
@@ -120,7 +119,7 @@ var TabLink = function TabLink(_ref) {
|
|
|
120
119
|
})), children]
|
|
121
120
|
})
|
|
122
121
|
});
|
|
123
|
-
};
|
|
122
|
+
});
|
|
124
123
|
var _default = TabLink;
|
|
125
124
|
exports.default = _default;
|
|
126
125
|
//# sourceMappingURL=TabLink.cjs.map
|
|
@@ -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","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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B,WAAW,IAAIA,WAAW,CAACwB,CAAC,CAAC;QAAA,CAAC;QAC7E,GAAG,EAAET,GAAI;QACT,eAAab;MAAO,GAChBY,IAAI;QAAA,wBACR,sBAAC,aAAa;UAAA,wBACZ,qBAAC,UAAU;YAAA,uBACT;cAAA,UAAOjB;YAAY;UAAQ,EAChB,EACZC,YAAY,IAAIC,gBAAgB,gBAC/B,sBAAC,2BAA2B;YAAA,WACzBA,gBAAgB,EAChB,CAAC,CAACD,YAAY,iBAAI;cAAA,UAAOA;YAAY,EAAQ;UAAA,EAClB,GAC5BA,YAAY,gBACd,qBAAC,mBAAmB;YAAA,uBAClB;cAAA,UAAOA;YAAY;UAAQ,EACP,gBAEtB,8CACD;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"}
|
|
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 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 <>\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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,qBAAC,UAAU;YAAA,uBACT;cAAA,UAAOjB;YAAY;UAAQ,EAChB,EACZC,YAAY,IAAIC,gBAAgB,gBAC/B,sBAAC,2BAA2B;YAAA,WACzBA,gBAAgB,EAChB,CAAC,CAACD,YAAY,iBAAI;cAAA,UAAOA;YAAY,EAAQ;UAAA,EAClB,GAC5BA,YAAY,gBACd,qBAAC,mBAAmB;YAAA,uBAClB;cAAA,UAAOA;YAAY;UAAQ,EACP,gBAEtB,8CACD;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,CAAC;AAAC,eAEYlB,OAAO;AAAA"}
|
package/dist/Tabs/TabLink.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
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
|
+
declare const TabLink: React.ForwardRefExoticComponent<{
|
|
5
|
+
disabled?: boolean | undefined;
|
|
6
|
+
forceDeactivate?: boolean | undefined;
|
|
7
7
|
requiredLine: string;
|
|
8
|
-
optionalLine?: string;
|
|
8
|
+
optionalLine?: string | undefined;
|
|
9
9
|
OptionalLineIcon?: React.ReactNode;
|
|
10
10
|
endLineIcon?: React.ReactNode;
|
|
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?:
|
|
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;
|
|
11
|
+
onLinkClick?: ((e: React.MouseEvent) => void) | undefined;
|
|
12
|
+
testId?: string | undefined;
|
|
13
|
+
onActiveStateChanged?: ((state: boolean) => void) | undefined;
|
|
14
|
+
showNotificationDot?: boolean | undefined;
|
|
15
|
+
size?: Size.Small | Size.Medium | Size.Large | undefined;
|
|
16
|
+
variant?: "positive" | "critical" | undefined;
|
|
17
|
+
containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
18
|
+
containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
19
|
+
} & NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
21
20
|
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 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) {
|
|
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, &.active.dropdown-hover {\n background-color: ", ";\n }\n\n &:hover, &.dropdown-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, &.active.dropdown-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 = function
|
|
33
|
+
var TabLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
34
34
|
var to = _ref.to,
|
|
35
35
|
_ref$disabled = _ref.disabled,
|
|
36
36
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
@@ -53,7 +53,6 @@ var TabLink = function TabLink(_ref) {
|
|
|
53
53
|
containerOnMouseLeave = _ref.containerOnMouseLeave,
|
|
54
54
|
className = _ref.className,
|
|
55
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
-
var ref = React.useRef(null);
|
|
57
56
|
var _useState = useState(false),
|
|
58
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
59
58
|
activeState = _useState2[0],
|
|
@@ -113,6 +112,6 @@ var TabLink = function TabLink(_ref) {
|
|
|
113
112
|
})), children]
|
|
114
113
|
})
|
|
115
114
|
});
|
|
116
|
-
};
|
|
115
|
+
});
|
|
117
116
|
export default TabLink;
|
|
118
117
|
//# 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","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 </NavL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EI;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
|
+
{"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 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 <>\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,koDAiBbN,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,EACPjB,MAAM,CAACkB,UAAU,EAIjBlB,MAAM,CAACmB,UAAU,EAI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