@laerdal/life-react-components 2.2.1-dev.9 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/Accordion/AccordionItem.cjs +17 -8
  2. package/dist/Accordion/AccordionItem.cjs.map +1 -1
  3. package/dist/Accordion/AccordionItem.d.ts +0 -2
  4. package/dist/Accordion/AccordionItem.js +18 -9
  5. package/dist/Accordion/AccordionItem.js.map +1 -1
  6. package/dist/Accordion/AccordionMenu.cjs +2 -6
  7. package/dist/Accordion/AccordionMenu.cjs.map +1 -1
  8. package/dist/Accordion/AccordionMenu.d.ts +0 -3
  9. package/dist/Accordion/AccordionMenu.js +2 -6
  10. package/dist/Accordion/AccordionMenu.js.map +1 -1
  11. package/dist/Accordion/styles.cjs +11 -7
  12. package/dist/Accordion/styles.cjs.map +1 -1
  13. package/dist/Accordion/styles.d.ts +4 -1
  14. package/dist/Accordion/styles.js +9 -6
  15. package/dist/Accordion/styles.js.map +1 -1
  16. package/dist/AuthPage/AuthPage.js +1 -1
  17. package/dist/Banners/Banner.cjs.map +1 -1
  18. package/dist/Banners/Banner.js.map +1 -1
  19. package/dist/Button/Button.cjs +1 -1
  20. package/dist/Button/Button.cjs.map +1 -1
  21. package/dist/Button/Button.js +2 -2
  22. package/dist/Button/Button.js.map +1 -1
  23. package/dist/Button/Iconbutton.cjs.map +1 -1
  24. package/dist/Button/Iconbutton.d.ts +1 -1
  25. package/dist/Button/Iconbutton.js.map +1 -1
  26. package/dist/Card/HorizontalCard/HorizontalCard.cjs +9 -12
  27. package/dist/Card/HorizontalCard/HorizontalCard.cjs.map +1 -1
  28. package/dist/Card/HorizontalCard/HorizontalCard.d.ts +0 -2
  29. package/dist/Card/HorizontalCard/HorizontalCard.js +8 -9
  30. package/dist/Card/HorizontalCard/HorizontalCard.js.map +1 -1
  31. package/dist/Card/HorizontalCard/HorizontalCardBody.cjs +9 -13
  32. package/dist/Card/HorizontalCard/HorizontalCardBody.cjs.map +1 -1
  33. package/dist/Card/HorizontalCard/HorizontalCardBody.d.ts +0 -4
  34. package/dist/Card/HorizontalCard/HorizontalCardBody.js +8 -8
  35. package/dist/Card/HorizontalCard/HorizontalCardBody.js.map +1 -1
  36. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs +5 -7
  37. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs.map +1 -1
  38. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.d.ts +0 -2
  39. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js +5 -5
  40. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js.map +1 -1
  41. package/dist/Card/HorizontalCard/index.cjs +12 -33
  42. package/dist/Card/HorizontalCard/index.cjs.map +1 -1
  43. package/dist/Card/HorizontalCard/index.d.ts +1 -3
  44. package/dist/Card/HorizontalCard/index.js +1 -3
  45. package/dist/Card/HorizontalCard/index.js.map +1 -1
  46. package/dist/Card/HorizontalCard/types.cjs.map +1 -1
  47. package/dist/Card/HorizontalCard/types.d.ts +1 -1
  48. package/dist/Card/HorizontalCard/types.js.map +1 -1
  49. package/dist/ChipsInput/ChipInputField.cjs +1 -1
  50. package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
  51. package/dist/ChipsInput/ChipInputField.js +1 -1
  52. package/dist/ChipsInput/ChipInputField.js.map +1 -1
  53. package/dist/Dropdown/BasicDropdown.cjs +21 -6
  54. package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
  55. package/dist/Dropdown/BasicDropdown.d.ts +2 -0
  56. package/dist/Dropdown/BasicDropdown.js +22 -7
  57. package/dist/Dropdown/BasicDropdown.js.map +1 -1
  58. package/dist/Dropdown/CommonStyling.cjs +7 -4
  59. package/dist/Dropdown/CommonStyling.cjs.map +1 -1
  60. package/dist/Dropdown/CommonStyling.d.ts +3 -1
  61. package/dist/Dropdown/CommonStyling.js +7 -4
  62. package/dist/Dropdown/CommonStyling.js.map +1 -1
  63. package/dist/Dropdown/DropdownContent.cjs +1 -1
  64. package/dist/Dropdown/DropdownContent.js +1 -1
  65. package/dist/Dropdown/DropdownFilter.cjs +16 -3
  66. package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
  67. package/dist/Dropdown/DropdownFilter.d.ts +1 -0
  68. package/dist/Dropdown/DropdownFilter.js +16 -3
  69. package/dist/Dropdown/DropdownFilter.js.map +1 -1
  70. package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs.map +1 -1
  71. package/dist/Footer/Components/FooterNewsletterAndSocialSection.js.map +1 -1
  72. package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +3 -1
  73. package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
  74. package/dist/GlobalNavigationBar/GlobalNavigationBar.js +4 -2
  75. package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
  76. package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
  77. package/dist/GlobalNavigationBar/Logo.js.map +1 -1
  78. package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs +7 -2
  79. package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -1
  80. package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.d.ts +4 -0
  81. package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js +6 -5
  82. package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -1
  83. package/dist/GlobalNavigationBar/desktop/MainMenu.cjs +178 -56
  84. package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -1
  85. package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +2 -2
  86. package/dist/GlobalNavigationBar/desktop/MainMenu.js +178 -56
  87. package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -1
  88. package/dist/GlobalNavigationBar/desktop/SubMenu.cjs +243 -0
  89. package/dist/GlobalNavigationBar/desktop/SubMenu.cjs.map +1 -0
  90. package/dist/GlobalNavigationBar/desktop/SubMenu.d.ts +18 -0
  91. package/dist/GlobalNavigationBar/desktop/SubMenu.js +233 -0
  92. package/dist/GlobalNavigationBar/desktop/SubMenu.js.map +1 -0
  93. package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
  94. package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
  95. package/dist/GlobalNavigationBar/types.cjs.map +1 -1
  96. package/dist/GlobalNavigationBar/types.d.ts +12 -2
  97. package/dist/GlobalNavigationBar/types.js.map +1 -1
  98. package/dist/GlobalNavigationBar/utils.cjs +17 -0
  99. package/dist/GlobalNavigationBar/utils.cjs.map +1 -0
  100. package/dist/GlobalNavigationBar/utils.d.ts +2 -0
  101. package/dist/GlobalNavigationBar/utils.js +10 -0
  102. package/dist/GlobalNavigationBar/utils.js.map +1 -0
  103. package/dist/Image/ImageWithFallbacks.js +1 -1
  104. package/dist/InputFields/DatepickerField.cjs +54 -33
  105. package/dist/InputFields/DatepickerField.cjs.map +1 -1
  106. package/dist/InputFields/DatepickerField.d.ts +1 -0
  107. package/dist/InputFields/DatepickerField.js +55 -34
  108. package/dist/InputFields/DatepickerField.js.map +1 -1
  109. package/dist/InputFields/DatepickerFieldHeader.cjs.map +1 -1
  110. package/dist/InputFields/DatepickerFieldHeader.js +1 -1
  111. package/dist/InputFields/DatepickerFieldHeader.js.map +1 -1
  112. package/dist/InputFields/Label.cjs +12 -8
  113. package/dist/InputFields/Label.cjs.map +1 -1
  114. package/dist/InputFields/Label.js +12 -8
  115. package/dist/InputFields/Label.js.map +1 -1
  116. package/dist/InputFields/NumberField.cjs +33 -14
  117. package/dist/InputFields/NumberField.cjs.map +1 -1
  118. package/dist/InputFields/NumberField.d.ts +1 -0
  119. package/dist/InputFields/NumberField.js +36 -17
  120. package/dist/InputFields/NumberField.js.map +1 -1
  121. package/dist/InputFields/PasswordField.cjs +50 -44
  122. package/dist/InputFields/PasswordField.cjs.map +1 -1
  123. package/dist/InputFields/PasswordField.js +51 -45
  124. package/dist/InputFields/PasswordField.js.map +1 -1
  125. package/dist/InputFields/SearchBar.cjs +2 -1
  126. package/dist/InputFields/SearchBar.cjs.map +1 -1
  127. package/dist/InputFields/SearchBar.js +3 -2
  128. package/dist/InputFields/SearchBar.js.map +1 -1
  129. package/dist/InputFields/TextField.cjs +14 -2
  130. package/dist/InputFields/TextField.cjs.map +1 -1
  131. package/dist/InputFields/TextField.d.ts +1 -0
  132. package/dist/InputFields/TextField.js +15 -3
  133. package/dist/InputFields/TextField.js.map +1 -1
  134. package/dist/InputFields/Textarea.cjs +3 -8
  135. package/dist/InputFields/Textarea.cjs.map +1 -1
  136. package/dist/InputFields/Textarea.d.ts +7 -3
  137. package/dist/InputFields/Textarea.js +6 -12
  138. package/dist/InputFields/Textarea.js.map +1 -1
  139. package/dist/InputFields/components/SearchField.cjs +1 -1
  140. package/dist/InputFields/components/SearchField.cjs.map +1 -1
  141. package/dist/InputFields/components/SearchField.js +1 -1
  142. package/dist/InputFields/components/SearchField.js.map +1 -1
  143. package/dist/InputFields/styling.cjs +11 -11
  144. package/dist/InputFields/styling.cjs.map +1 -1
  145. package/dist/InputFields/styling.d.ts +2 -3
  146. package/dist/InputFields/styling.js +11 -10
  147. package/dist/InputFields/styling.js.map +1 -1
  148. package/dist/InputFields/types.cjs.map +1 -1
  149. package/dist/InputFields/types.d.ts +8 -4
  150. package/dist/InputFields/types.js.map +1 -1
  151. package/dist/LinearProgress/LinearProgress.js +1 -1
  152. package/dist/NavItem/NavItem.cjs +2 -1
  153. package/dist/NavItem/NavItem.cjs.map +1 -1
  154. package/dist/NavItem/NavItem.d.ts +1 -0
  155. package/dist/NavItem/NavItem.js +1 -1
  156. package/dist/NavItem/NavItem.js.map +1 -1
  157. package/dist/NavItem/NestedNavItem.cjs +38 -0
  158. package/dist/NavItem/NestedNavItem.cjs.map +1 -0
  159. package/dist/NavItem/NestedNavItem.d.ts +13 -0
  160. package/dist/NavItem/NestedNavItem.js +28 -0
  161. package/dist/NavItem/NestedNavItem.js.map +1 -0
  162. package/dist/Paginator/Paginator.cjs.map +1 -1
  163. package/dist/Paginator/Paginator.js.map +1 -1
  164. package/dist/Table/Table.cjs +1 -2
  165. package/dist/Table/Table.cjs.map +1 -1
  166. package/dist/Table/Table.js +1 -2
  167. package/dist/Table/Table.js.map +1 -1
  168. package/dist/Table/TableFooter.cjs.map +1 -1
  169. package/dist/Table/TableFooter.js +1 -1
  170. package/dist/Table/TableFooter.js.map +1 -1
  171. package/dist/Table/TableStyles.cjs +4 -4
  172. package/dist/Table/TableStyles.cjs.map +1 -1
  173. package/dist/Table/TableStyles.js +4 -4
  174. package/dist/Table/TableStyles.js.map +1 -1
  175. package/dist/Table/TableTypes.cjs.map +1 -1
  176. package/dist/Table/TableTypes.d.ts +0 -1
  177. package/dist/Table/TableTypes.js.map +1 -1
  178. package/dist/Tabs/HorizontalTabs.cjs +12 -10
  179. package/dist/Tabs/HorizontalTabs.cjs.map +1 -1
  180. package/dist/Tabs/HorizontalTabs.d.ts +1 -2
  181. package/dist/Tabs/HorizontalTabs.js +14 -13
  182. package/dist/Tabs/HorizontalTabs.js.map +1 -1
  183. package/dist/Tabs/TabLink.cjs +41 -17
  184. package/dist/Tabs/TabLink.cjs.map +1 -1
  185. package/dist/Tabs/TabLink.d.ts +14 -10
  186. package/dist/Tabs/TabLink.js +41 -17
  187. package/dist/Tabs/TabLink.js.map +1 -1
  188. package/dist/Tabs/VerticalTabs.cjs +2 -0
  189. package/dist/Tabs/VerticalTabs.cjs.map +1 -1
  190. package/dist/Tabs/VerticalTabs.d.ts +1 -0
  191. package/dist/Tabs/VerticalTabs.js +2 -0
  192. package/dist/Tabs/VerticalTabs.js.map +1 -1
  193. package/dist/Toggles/ToggleSwitch.cjs +1 -11
  194. package/dist/Toggles/ToggleSwitch.cjs.map +1 -1
  195. package/dist/Toggles/ToggleSwitch.js +2 -12
  196. package/dist/Toggles/ToggleSwitch.js.map +1 -1
  197. package/dist/Toggles/TogglerStyles.cjs +1 -1
  198. package/dist/Toggles/TogglerStyles.cjs.map +1 -1
  199. package/dist/Toggles/TogglerStyles.js +1 -1
  200. package/dist/Toggles/TogglerStyles.js.map +1 -1
  201. package/dist/Tooltips/TooltipOverflow.cjs +112 -0
  202. package/dist/Tooltips/TooltipOverflow.cjs.map +1 -0
  203. package/dist/Tooltips/TooltipOverflow.d.ts +10 -0
  204. package/dist/Tooltips/TooltipOverflow.js +102 -0
  205. package/dist/Tooltips/TooltipOverflow.js.map +1 -0
  206. package/dist/Tooltips/TooltipStyles.cjs +8 -5
  207. package/dist/Tooltips/TooltipStyles.cjs.map +1 -1
  208. package/dist/Tooltips/TooltipStyles.d.ts +3 -1
  209. package/dist/Tooltips/TooltipStyles.js +8 -5
  210. package/dist/Tooltips/TooltipStyles.js.map +1 -1
  211. package/dist/Tooltips/TooltipWrapper.cjs +2 -1
  212. package/dist/Tooltips/TooltipWrapper.cjs.map +1 -1
  213. package/dist/Tooltips/TooltipWrapper.js +2 -1
  214. package/dist/Tooltips/TooltipWrapper.js.map +1 -1
  215. package/dist/assets/index.cjs.map +1 -1
  216. package/dist/assets/index.js.map +1 -1
  217. package/dist/common/ActionWithin.cjs +1 -1
  218. package/dist/common/ActionWithin.js +1 -1
  219. package/dist/common/FocusVisible.cjs +1 -1
  220. package/dist/common/FocusVisible.js +1 -1
  221. package/dist/icons/index.cjs +1 -1
  222. package/dist/icons/index.cjs.map +1 -1
  223. package/dist/icons/index.js +1 -1
  224. package/dist/icons/index.js.map +1 -1
  225. package/dist/icons/systemicons/SystemIcons.cjs.map +1 -1
  226. package/dist/icons/systemicons/SystemIcons.js.map +1 -1
  227. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TabLink.js","names":["React","NavLink","styled","NotificationDot","Size","COLORS","focusStyles","Z_INDEXES","defaultOnMouseDownHandler","useState","StyledTabLink","neutral_600","props","disabled","neutral_100","active","neutral_20","primary_20","hover","primary_600","primary_100","primary_800","primary_500","white","neutral_300","OptionalLineWrapperWithIcon","div","TopWrapper","TextContainer","StyledNotification","OptionalLineWrapper","Wrapper","TabLink","to","requiredLine","optionalLine","OptionalLineIcon","onLinkClick","testId","showNotificationDot","size","Small","variant","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 { useLocation } from 'react-router';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { BaseProps } from '../icons';\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 requiredLine: string;\n optionalLine?: string;\n OptionalLineIcon?: React.ReactNode; //React.FunctionComponent<BaseProps>;\n onLinkClick?: (e: React.MouseEvent) => void;\n testId?: string;\n showNotificationDot?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n variant?: 'positive' | 'critical';\n} & NavLinkProps;\n\ntype StyledTabLinkProps = {\n disabled?: boolean;\n};\n\nconst StyledTabLink = styled(NavLink)<StyledTabLinkProps>`\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: 0;\n bottom: 0;\n left: -1px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 2px;\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\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 OptionalLineWrapper = styled.div`\n font-size: 12px;\n`;\n\nconst Wrapper = styled.div`\n &.disabled {\n cursor: not-allowed;\n\n ${StyledTabLink} {\n pointer-events: none;\n }\n }\n`;\n\nconst TabLink = ({\n to,\n disabled = false,\n requiredLine,\n optionalLine,\n OptionalLineIcon,\n onLinkClick,\n testId,\n showNotificationDot = false,\n size = Size.Small,\n variant = 'critical',\n}: TabLinkProps) => {\n const ref = React.useRef<any>(null);\n const [activeState, setActiveState] = useState<boolean>(false);\n return (\n <Wrapper className={disabled ? 'disabled' : ''}>\n <StyledTabLink\n to={to.toString()}\n disabled={disabled}\n className={({ isActive }) => {\n if(isActive != activeState)\n setActiveState(isActive);\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 <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 </StyledTabLink>\n </Wrapper>\n );\n};\n\nexport default TabLink;\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,OAAO,QAAsB,kBAAkB;AAExD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,eAAe,QAAQ,oBAAoB;AAEpD,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;AAkBjC,IAAMC,aAAa,GAAGR,MAAM,CAACD,OAAO,CAAC,8yCAO1BI,MAAM,CAACM,WAAW,EAEP,UAACC,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAGR,MAAM,CAACS,WAAW,GAAG,aAAa;AAAA,CAAC,EAC1E,UAACF,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,aAAa,GAAG,SAAS;AAAA,CAAC,EAW7DP,WAAW,EAIFC,SAAS,CAACQ,MAAM,EACPV,MAAM,CAACW,UAAU,EAIjBX,MAAM,CAACY,UAAU,EAI1BV,SAAS,CAACW,KAAK,EACNb,MAAM,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AA;EAC9H,EACR;AAEd,CAAC;AAED,eAAeV,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 { useLocation } from 'react-router';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { BaseProps } from '../icons';\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;AAExD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,eAAe,QAAQ,oBAAoB;AAEpD,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,EACPjB,MAAM,CAACkB,UAAU,EAIjBlB,MAAM,CAACmB,UAAU,EAI1BjB,SAAS,CAACkB,KAAK,EACNpB,MAAM,CAACmB,UAAU,EAC5BnB,MAAM,CA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C,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"}
@@ -24,6 +24,7 @@ var VerticalTabs = function VerticalTabs(_ref) {
24
24
  to: entry.to,
25
25
  requiredLine: entry.requiredLine,
26
26
  optionalLine: entry.optionalLine,
27
+ endLineIcon: entry.endLineIcon,
27
28
  OptionalLineIcon: entry.optionalLineIcon,
28
29
  disabled: entry.disabled,
29
30
  showNotificationDot: entry.showNotificationDot,
@@ -43,6 +44,7 @@ VerticalTabs.propTypes = {
43
44
  requiredLine: _propTypes.default.string.isRequired,
44
45
  optionalLine: _propTypes.default.string,
45
46
  optionalLineIcon: _propTypes.default.node,
47
+ endLineIcon: _propTypes.default.node,
46
48
  to: _propTypes.default.string.isRequired,
47
49
  disabled: _propTypes.default.bool,
48
50
  onClick: _propTypes.default.func,
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalTabs.cjs","names":["VerticalTabs","size","entries","Size","Large","map","entry","to","requiredLine","optionalLine","optionalLineIcon","disabled","showNotificationDot","variant","e","onClick"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport Tabs from './Tabs';\nimport TabLink from './TabLink';\nimport { BaseProps } from '../icons';\nimport { Size } from '../types';\n\nexport interface VerticalTabEntry {\n requiredLine: string;\n optionalLine?: string;\n optionalLineIcon?: React.ReactNode;\n to: string;\n disabled?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n showNotificationDot?: boolean;\n variant?: 'critical' | 'positive';\n}\ninterface VerticalTabsProps {\n size?: Size.Small | Size.Medium | Size.Large;\n entries: VerticalTabEntry[];\n}\n\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\n return (\n <Tabs size={size ?? Size.Large}>\n {entries?.map((entry: VerticalTabEntry) => (\n <TabLink\n key={entry.to}\n to={entry.to}\n requiredLine={entry.requiredLine}\n optionalLine={entry.optionalLine}\n OptionalLineIcon={entry.optionalLineIcon}\n disabled={entry.disabled}\n showNotificationDot={entry.showNotificationDot}\n size={size}\n variant={entry.variant}\n onLinkClick={(e) => {\n if (entry.onClick) {\n entry.onClick(e);\n }\n }}/>\n ))}\n </Tabs>\n );\n};\n\nexport default VerticalTabs;\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAEA;AAAgC;AAAA;AAAA;AAiBhC,IAAMA,YAAY,GAAG,SAAfA,YAAY,OAA6C;EAAA,IAAvCC,IAAI,QAAJA,IAAI;IAAEC,OAAO,QAAPA,OAAO;EACnC,oBACE,qBAAC,aAAI;IAAC,IAAI,EAAED,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIE,WAAI,CAACC,KAAM;IAAA,UAC5BF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,GAAG,CAAC,UAACC,KAAuB;MAAA,oBACpC,qBAAC,gBAAO;QAEN,EAAE,EAAEA,KAAK,CAACC,EAAG;QACb,YAAY,EAAED,KAAK,CAACE,YAAa;QACjC,YAAY,EAAEF,KAAK,CAACG,YAAa;QACjC,gBAAgB,EAAEH,KAAK,CAACI,gBAAiB;QACzC,QAAQ,EAAEJ,KAAK,CAACK,QAAS;QACzB,mBAAmB,EAAEL,KAAK,CAACM,mBAAoB;QAC/C,IAAI,EAAEX,IAAK;QACX,OAAO,EAAEK,KAAK,CAACO,OAAQ;QACvB,WAAW,EAAE,qBAACC,CAAC,EAAK;UAClB,IAAIR,KAAK,CAACS,OAAO,EAAE;YACjBT,KAAK,CAACS,OAAO,CAACD,CAAC,CAAC;UAClB;QACF;MAAE,GAbGR,KAAK,CAACC,EAAE,CAaT;IAAA,CACP;EAAC,EACG;AAEX,CAAC;AAAC;EAzBAL,OAAO;IAXPM,YAAY;IACZC,YAAY;IACZC,gBAAgB;IAChBH,EAAE;IACFI,QAAQ;IACRI,OAAO;IACPH,mBAAmB;IACnBC,OAAO,4BAAG,UAAU,EAAG,UAAU;EAAA;AAAA;AAAA,eA+BpBb,YAAY;AAAA"}
1
+ {"version":3,"file":"VerticalTabs.cjs","names":["VerticalTabs","size","entries","Size","Large","map","entry","to","requiredLine","optionalLine","endLineIcon","optionalLineIcon","disabled","showNotificationDot","variant","e","onClick"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport Tabs from './Tabs';\nimport TabLink from './TabLink';\nimport { BaseProps } from '../icons';\nimport { Size } from '../types';\n\nexport interface VerticalTabEntry {\n requiredLine: string;\n optionalLine?: string;\n optionalLineIcon?: React.ReactNode;\n endLineIcon?: React.ReactNode;\n to: string;\n disabled?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n showNotificationDot?: boolean;\n variant?: 'critical' | 'positive';\n}\ninterface VerticalTabsProps {\n size?: Size.Small | Size.Medium | Size.Large;\n entries: VerticalTabEntry[];\n}\n\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\n return (\n <Tabs size={size ?? Size.Large}>\n {entries?.map((entry: VerticalTabEntry) => (\n <TabLink\n key={entry.to}\n to={entry.to}\n requiredLine={entry.requiredLine}\n optionalLine={entry.optionalLine}\n endLineIcon={entry.endLineIcon}\n OptionalLineIcon={entry.optionalLineIcon}\n disabled={entry.disabled}\n showNotificationDot={entry.showNotificationDot}\n size={size}\n variant={entry.variant}\n onLinkClick={(e) => {\n if (entry.onClick) {\n entry.onClick(e);\n }\n }}/>\n ))}\n </Tabs>\n );\n};\n\nexport default VerticalTabs;\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAEA;AAAgC;AAAA;AAAA;AAkBhC,IAAMA,YAAY,GAAG,SAAfA,YAAY,OAA6C;EAAA,IAAvCC,IAAI,QAAJA,IAAI;IAAEC,OAAO,QAAPA,OAAO;EACnC,oBACE,qBAAC,aAAI;IAAC,IAAI,EAAED,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIE,WAAI,CAACC,KAAM;IAAA,UAC5BF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,GAAG,CAAC,UAACC,KAAuB;MAAA,oBACpC,qBAAC,gBAAO;QAEN,EAAE,EAAEA,KAAK,CAACC,EAAG;QACb,YAAY,EAAED,KAAK,CAACE,YAAa;QACjC,YAAY,EAAEF,KAAK,CAACG,YAAa;QACjC,WAAW,EAAEH,KAAK,CAACI,WAAY;QAC/B,gBAAgB,EAAEJ,KAAK,CAACK,gBAAiB;QACzC,QAAQ,EAAEL,KAAK,CAACM,QAAS;QACzB,mBAAmB,EAAEN,KAAK,CAACO,mBAAoB;QAC/C,IAAI,EAAEZ,IAAK;QACX,OAAO,EAAEK,KAAK,CAACQ,OAAQ;QACvB,WAAW,EAAE,qBAACC,CAAC,EAAK;UAClB,IAAIT,KAAK,CAACU,OAAO,EAAE;YACjBV,KAAK,CAACU,OAAO,CAACD,CAAC,CAAC;UAClB;QACF;MAAE,GAdGT,KAAK,CAACC,EAAE,CAcT;IAAA,CACP;EAAC,EACG;AAEX,CAAC;AAAC;EA1BAL,OAAO;IAZPM,YAAY;IACZC,YAAY;IACZE,gBAAgB;IAChBD,WAAW;IACXH,EAAE;IACFK,QAAQ;IACRI,OAAO;IACPH,mBAAmB;IACnBC,OAAO,4BAAG,UAAU,EAAG,UAAU;EAAA;AAAA;AAAA,eAgCpBd,YAAY;AAAA"}
@@ -4,6 +4,7 @@ export interface VerticalTabEntry {
4
4
  requiredLine: string;
5
5
  optionalLine?: string;
6
6
  optionalLineIcon?: React.ReactNode;
7
+ endLineIcon?: React.ReactNode;
7
8
  to: string;
8
9
  disabled?: boolean;
9
10
  onClick?: (e: React.MouseEvent) => void;
@@ -14,6 +14,7 @@ var VerticalTabs = function VerticalTabs(_ref) {
14
14
  to: entry.to,
15
15
  requiredLine: entry.requiredLine,
16
16
  optionalLine: entry.optionalLine,
17
+ endLineIcon: entry.endLineIcon,
17
18
  OptionalLineIcon: entry.optionalLineIcon,
18
19
  disabled: entry.disabled,
19
20
  showNotificationDot: entry.showNotificationDot,
@@ -33,6 +34,7 @@ VerticalTabs.propTypes = {
33
34
  requiredLine: _pt.string.isRequired,
34
35
  optionalLine: _pt.string,
35
36
  optionalLineIcon: _pt.node,
37
+ endLineIcon: _pt.node,
36
38
  to: _pt.string.isRequired,
37
39
  disabled: _pt.bool,
38
40
  onClick: _pt.func,
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalTabs.js","names":["React","Tabs","TabLink","Size","VerticalTabs","size","entries","Large","map","entry","to","requiredLine","optionalLine","optionalLineIcon","disabled","showNotificationDot","variant","e","onClick"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport Tabs from './Tabs';\nimport TabLink from './TabLink';\nimport { BaseProps } from '../icons';\nimport { Size } from '../types';\n\nexport interface VerticalTabEntry {\n requiredLine: string;\n optionalLine?: string;\n optionalLineIcon?: React.ReactNode;\n to: string;\n disabled?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n showNotificationDot?: boolean;\n variant?: 'critical' | 'positive';\n}\ninterface VerticalTabsProps {\n size?: Size.Small | Size.Medium | Size.Large;\n entries: VerticalTabEntry[];\n}\n\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\n return (\n <Tabs size={size ?? Size.Large}>\n {entries?.map((entry: VerticalTabEntry) => (\n <TabLink\n key={entry.to}\n to={entry.to}\n requiredLine={entry.requiredLine}\n optionalLine={entry.optionalLine}\n OptionalLineIcon={entry.optionalLineIcon}\n disabled={entry.disabled}\n showNotificationDot={entry.showNotificationDot}\n size={size}\n variant={entry.variant}\n onLinkClick={(e) => {\n if (entry.onClick) {\n entry.onClick(e);\n }\n }}/>\n ))}\n </Tabs>\n );\n};\n\nexport default VerticalTabs;\n"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,OAAO,MAAM,WAAW;AAE/B,SAASC,IAAI,QAAQ,UAAU;AAAC;AAiBhC,IAAMC,YAAY,GAAG,SAAfA,YAAY,OAA6C;EAAA,IAAvCC,IAAI,QAAJA,IAAI;IAAEC,OAAO,QAAPA,OAAO;EACnC,oBACE,KAAC,IAAI;IAAC,IAAI,EAAED,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIF,IAAI,CAACI,KAAM;IAAA,UAC5BD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,CAAC,UAACC,KAAuB;MAAA,oBACpC,KAAC,OAAO;QAEN,EAAE,EAAEA,KAAK,CAACC,EAAG;QACb,YAAY,EAAED,KAAK,CAACE,YAAa;QACjC,YAAY,EAAEF,KAAK,CAACG,YAAa;QACjC,gBAAgB,EAAEH,KAAK,CAACI,gBAAiB;QACzC,QAAQ,EAAEJ,KAAK,CAACK,QAAS;QACzB,mBAAmB,EAAEL,KAAK,CAACM,mBAAoB;QAC/C,IAAI,EAAEV,IAAK;QACX,OAAO,EAAEI,KAAK,CAACO,OAAQ;QACvB,WAAW,EAAE,qBAACC,CAAC,EAAK;UAClB,IAAIR,KAAK,CAACS,OAAO,EAAE;YACjBT,KAAK,CAACS,OAAO,CAACD,CAAC,CAAC;UAClB;QACF;MAAE,GAbGR,KAAK,CAACC,EAAE,CAaT;IAAA,CACP;EAAC,EACG;AAEX,CAAC;AAAC;EAzBAJ,OAAO;IAXPK,YAAY;IACZC,YAAY;IACZC,gBAAgB;IAChBH,EAAE;IACFI,QAAQ;IACRI,OAAO;IACPH,mBAAmB;IACnBC,OAAO,aAAG,UAAU,EAAG,UAAU;EAAA;AAAA;AA+BnC,eAAeZ,YAAY"}
1
+ {"version":3,"file":"VerticalTabs.js","names":["React","Tabs","TabLink","Size","VerticalTabs","size","entries","Large","map","entry","to","requiredLine","optionalLine","endLineIcon","optionalLineIcon","disabled","showNotificationDot","variant","e","onClick"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport Tabs from './Tabs';\nimport TabLink from './TabLink';\nimport { BaseProps } from '../icons';\nimport { Size } from '../types';\n\nexport interface VerticalTabEntry {\n requiredLine: string;\n optionalLine?: string;\n optionalLineIcon?: React.ReactNode;\n endLineIcon?: React.ReactNode;\n to: string;\n disabled?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n showNotificationDot?: boolean;\n variant?: 'critical' | 'positive';\n}\ninterface VerticalTabsProps {\n size?: Size.Small | Size.Medium | Size.Large;\n entries: VerticalTabEntry[];\n}\n\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\n return (\n <Tabs size={size ?? Size.Large}>\n {entries?.map((entry: VerticalTabEntry) => (\n <TabLink\n key={entry.to}\n to={entry.to}\n requiredLine={entry.requiredLine}\n optionalLine={entry.optionalLine}\n endLineIcon={entry.endLineIcon}\n OptionalLineIcon={entry.optionalLineIcon}\n disabled={entry.disabled}\n showNotificationDot={entry.showNotificationDot}\n size={size}\n variant={entry.variant}\n onLinkClick={(e) => {\n if (entry.onClick) {\n entry.onClick(e);\n }\n }}/>\n ))}\n </Tabs>\n );\n};\n\nexport default VerticalTabs;\n"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,OAAO,MAAM,WAAW;AAE/B,SAASC,IAAI,QAAQ,UAAU;AAAC;AAkBhC,IAAMC,YAAY,GAAG,SAAfA,YAAY,OAA6C;EAAA,IAAvCC,IAAI,QAAJA,IAAI;IAAEC,OAAO,QAAPA,OAAO;EACnC,oBACE,KAAC,IAAI;IAAC,IAAI,EAAED,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIF,IAAI,CAACI,KAAM;IAAA,UAC5BD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,CAAC,UAACC,KAAuB;MAAA,oBACpC,KAAC,OAAO;QAEN,EAAE,EAAEA,KAAK,CAACC,EAAG;QACb,YAAY,EAAED,KAAK,CAACE,YAAa;QACjC,YAAY,EAAEF,KAAK,CAACG,YAAa;QACjC,WAAW,EAAEH,KAAK,CAACI,WAAY;QAC/B,gBAAgB,EAAEJ,KAAK,CAACK,gBAAiB;QACzC,QAAQ,EAAEL,KAAK,CAACM,QAAS;QACzB,mBAAmB,EAAEN,KAAK,CAACO,mBAAoB;QAC/C,IAAI,EAAEX,IAAK;QACX,OAAO,EAAEI,KAAK,CAACQ,OAAQ;QACvB,WAAW,EAAE,qBAACC,CAAC,EAAK;UAClB,IAAIT,KAAK,CAACU,OAAO,EAAE;YACjBV,KAAK,CAACU,OAAO,CAACD,CAAC,CAAC;UAClB;QACF;MAAE,GAdGT,KAAK,CAACC,EAAE,CAcT;IAAA,CACP;EAAC,EACG;AAEX,CAAC;AAAC;EA1BAJ,OAAO;IAZPK,YAAY;IACZC,YAAY;IACZE,gBAAgB;IAChBD,WAAW;IACXH,EAAE;IACFK,QAAQ;IACRI,OAAO;IACPH,mBAAmB;IACnBC,OAAO,aAAG,UAAU,EAAG,UAAU;EAAA;AAAA;AAgCnC,eAAeb,YAAY"}
@@ -8,20 +8,16 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
12
11
  var React = _interopRequireWildcard(require("react"));
13
12
  var _TogglerStyles = require("./TogglerStyles");
14
13
  var _ = require("..");
15
14
  var _common = require("../common");
16
- var _styledComponents = _interopRequireDefault(require("styled-components"));
17
15
  var _jsxRuntime = require("react/jsx-runtime");
18
16
  var _excluded = ["id", "disabled", "selected", "label", "isSemantic", "size", "onToggle", "className"];
19
- var _templateObject;
20
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
20
  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) { (0, _defineProperty2.default)(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; }
24
- var CheckmarkContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: 14px;\n height: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n left: 2px;\n"])));
25
21
  var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
26
22
  var _size;
27
23
  var id = _ref.id,
@@ -63,13 +59,7 @@ var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
63
59
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TogglerStyles.ToggleSwitchContainer, {
64
60
  id: "switchContainer",
65
61
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TogglerStyles.ToggleSwitch, {
66
- className: isSemantic ? 'semantic' : '',
67
- children: selected && /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckmarkContainer, {
68
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.SystemIcons.CheckMark, {
69
- size: '14px',
70
- color: _.COLORS.white
71
- })
72
- })
62
+ className: isSemantic ? 'semantic' : ''
73
63
  })
74
64
  }), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
75
65
  className: 'label',
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleSwitch.cjs","names":["CheckmarkContainer","styled","div","ToggleSwitch","React","forwardRef","ref","id","disabled","selected","label","isSemantic","size","onToggle","className","rest","toggle","focusVisibleRef","useFocusVisibleRef","useImperativeHandle","current","Size","Medium","e","key","toString","toLowerCase","concat","COLORS","white"],"sources":["../../src/Toggles/ToggleSwitch.tsx"],"sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom types.\n */\nimport {ToggleSwitchProps} from './TogglerTypes';\n\n/**\n * Import custom styles.\n */\nimport {ToggleSwitchContainer, ToggleSwitch as Switch, StyledSwitch} from './TogglerStyles';\nimport {COLORS, Size, SystemIcons} from '..';\nimport {useFocusVisibleRef} from '../common';\nimport styled from \"styled-components\";\n\nconst CheckmarkContainer = styled.div`\n position: absolute;\n width: 14px;\n height: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n left: 2px;\n`;\n\nconst ToggleSwitch = React.forwardRef(({\n id,\n disabled,\n selected,\n label,\n isSemantic,\n size,\n onToggle,\n className,\n ...rest\n }: ToggleSwitchProps, ref) => {\n /**\n * Does all required pre-requisites and toggles the switcher state.\n */\n const toggle = () => {\n // If disabled, don't do anything\n if (disabled) return;\n\n // Toggle state change\n onToggle(!selected);\n };\n\n const focusVisibleRef = useFocusVisibleRef([]);\n\n React.useImperativeHandle(ref, () => focusVisibleRef.current, [focusVisibleRef]);\n\n size = size ?? Size.Medium;\n\n return (\n <StyledSwitch\n ref={focusVisibleRef}\n onClick={(e) => toggle()}\n onKeyDown={e => (e.key === 'Enter' || e.key === ' ') && toggle()}\n className={size\n .toString()\n .toLowerCase()\n .concat(disabled ? ' disabled' : '')\n .concat(className ? ` ${className}` : '')}\n selected={selected}\n tabIndex={disabled ? -1 : 0}\n {...rest}>\n <ToggleSwitchContainer id=\"switchContainer\">\n <Switch className={isSemantic ? 'semantic' : ''} >\n {selected && <CheckmarkContainer><SystemIcons.CheckMark size={'14px'} color={COLORS.white}/></CheckmarkContainer>}\n </Switch>\n </ToggleSwitchContainer>\n {label && (\n <label className={'label'} htmlFor={id}>\n {label}\n </label>\n )}\n </StyledSwitch>\n );\n});\n\nexport default ToggleSwitch;\n"],"mappings":";;;;;;;;;;;AAGA;AAUA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,kBAAkB,GAAIC,yBAAM,CAACC,GAAG,iOAQrC;AAED,IAAMC,YAAY,gBAAGC,KAAK,CAACC,UAAU,CAAC,gBAUuBC,GAAG,EAAK;EAAA;EAAA,IAT5BC,EAAE,QAAFA,EAAE;IACFC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,UAAU,QAAVA,UAAU;IACVC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;IACNC,IAAI;EAE9C;AACF;AACA;EACE,IAAMC,MAAM,GAAG,SAATA,MAAM,GAAS;IACnB;IACA,IAAIR,QAAQ,EAAE;;IAEd;IACAK,QAAQ,CAAC,CAACJ,QAAQ,CAAC;EACrB,CA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}
1
+ {"version":3,"file":"ToggleSwitch.cjs","names":["ToggleSwitch","React","forwardRef","ref","id","disabled","selected","label","isSemantic","size","onToggle","className","rest","toggle","focusVisibleRef","useFocusVisibleRef","useImperativeHandle","current","Size","Medium","e","key","toString","toLowerCase","concat"],"sources":["../../src/Toggles/ToggleSwitch.tsx"],"sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom types.\n */\nimport {ToggleSwitchProps} from './TogglerTypes';\n\n/**\n * Import custom styles.\n */\nimport {ToggleSwitchContainer, ToggleSwitch as Switch, StyledSwitch} from './TogglerStyles';\nimport {Size} from '..';\nimport {useFocusVisibleRef} from '../common';\n\nconst ToggleSwitch = React.forwardRef(({\n id,\n disabled,\n selected,\n label,\n isSemantic,\n size,\n onToggle,\n className,\n ...rest\n }: ToggleSwitchProps, ref) => {\n /**\n * Does all required pre-requisites and toggles the switcher state.\n */\n const toggle = () => {\n // If disabled, don't do anything\n if (disabled) return;\n\n // Toggle state change\n onToggle(!selected);\n };\n\n const focusVisibleRef = useFocusVisibleRef([]);\n\n React.useImperativeHandle(ref, () => focusVisibleRef.current, [focusVisibleRef]);\n\n size = size ?? Size.Medium;\n\n return (\n <StyledSwitch\n ref={focusVisibleRef}\n onClick={(e) => toggle()}\n onKeyDown={e => (e.key === 'Enter' || e.key === ' ') && toggle()}\n className={size\n .toString()\n .toLowerCase()\n .concat(disabled ? ' disabled' : '')\n .concat(className ? ` ${className}` : '')}\n selected={selected}\n tabIndex={disabled ? -1 : 0}\n {...rest}>\n <ToggleSwitchContainer id=\"switchContainer\">\n <Switch className={isSemantic ? 'semantic' : ''} />\n </ToggleSwitchContainer>\n {label && (\n <label className={'label'} htmlFor={id}>\n {label}\n </label>\n )}\n </StyledSwitch>\n );\n});\n\nexport default ToggleSwitch;\n"],"mappings":";;;;;;;;;;AAGA;AAUA;AACA;AACA;AAA6C;AAAA;AAAA;AAAA;AAAA;AAAA;AAE7C,IAAMA,YAAY,gBAAGC,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EAAE,EAAC,iBAAiB;MAAA,uBACzC,qBAAC,2BAAM;QAAC,SAAS,EAAEJ,UAAU,GAAG,UAAU,GAAG;MAAG;IAAG,EAC7B,EACvBD,KAAK,iBACJ;MAAO,SAAS,EAAE,OAAQ;MAAC,OAAO,EAAEH,EAAG;MAAA,UACpCG;IAAK,EAET;EAAA,GACY;AAEnB,CAAC,CAAC;AAAC,eAEYP,YAAY;AAAA"}
@@ -1,8 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
3
  var _excluded = ["id", "disabled", "selected", "label", "isSemantic", "size", "onToggle", "className"];
5
- var _templateObject;
6
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
5
  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; }
8
6
  /**
@@ -18,12 +16,10 @@ import * as React from 'react';
18
16
  * Import custom styles.
19
17
  */
20
18
  import { ToggleSwitchContainer, ToggleSwitch as Switch, StyledSwitch } from './TogglerStyles';
21
- import { COLORS, Size, SystemIcons } from '..';
19
+ import { Size } from '..';
22
20
  import { useFocusVisibleRef } from '../common';
23
- import styled from "styled-components";
24
21
  import { jsx as _jsx } from "react/jsx-runtime";
25
22
  import { jsxs as _jsxs } from "react/jsx-runtime";
26
- var CheckmarkContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n width: 14px;\n height: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n left: 2px;\n"])));
27
23
  var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
28
24
  var _size;
29
25
  var id = _ref.id,
@@ -65,13 +61,7 @@ var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
65
61
  children: [/*#__PURE__*/_jsx(ToggleSwitchContainer, {
66
62
  id: "switchContainer",
67
63
  children: /*#__PURE__*/_jsx(Switch, {
68
- className: isSemantic ? 'semantic' : '',
69
- children: selected && /*#__PURE__*/_jsx(CheckmarkContainer, {
70
- children: /*#__PURE__*/_jsx(SystemIcons.CheckMark, {
71
- size: '14px',
72
- color: COLORS.white
73
- })
74
- })
64
+ className: isSemantic ? 'semantic' : ''
75
65
  })
76
66
  }), label && /*#__PURE__*/_jsx("label", {
77
67
  className: 'label',
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleSwitch.js","names":["React","ToggleSwitchContainer","ToggleSwitch","Switch","StyledSwitch","COLORS","Size","SystemIcons","useFocusVisibleRef","styled","CheckmarkContainer","div","forwardRef","ref","id","disabled","selected","label","isSemantic","size","onToggle","className","rest","toggle","focusVisibleRef","useImperativeHandle","current","Medium","e","key","toString","toLowerCase","concat","white"],"sources":["../../src/Toggles/ToggleSwitch.tsx"],"sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom types.\n */\nimport {ToggleSwitchProps} from './TogglerTypes';\n\n/**\n * Import custom styles.\n */\nimport {ToggleSwitchContainer, ToggleSwitch as Switch, StyledSwitch} from './TogglerStyles';\nimport {COLORS, Size, SystemIcons} from '..';\nimport {useFocusVisibleRef} from '../common';\nimport styled from \"styled-components\";\n\nconst CheckmarkContainer = styled.div`\n position: absolute;\n width: 14px;\n height: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n left: 2px;\n`;\n\nconst ToggleSwitch = React.forwardRef(({\n id,\n disabled,\n selected,\n label,\n isSemantic,\n size,\n onToggle,\n className,\n ...rest\n }: ToggleSwitchProps, ref) => {\n /**\n * Does all required pre-requisites and toggles the switcher state.\n */\n const toggle = () => {\n // If disabled, don't do anything\n if (disabled) return;\n\n // Toggle state change\n onToggle(!selected);\n };\n\n const focusVisibleRef = useFocusVisibleRef([]);\n\n React.useImperativeHandle(ref, () => focusVisibleRef.current, [focusVisibleRef]);\n\n size = size ?? Size.Medium;\n\n return (\n <StyledSwitch\n ref={focusVisibleRef}\n onClick={(e) => toggle()}\n onKeyDown={e => (e.key === 'Enter' || e.key === ' ') && toggle()}\n className={size\n .toString()\n .toLowerCase()\n .concat(disabled ? ' disabled' : '')\n .concat(className ? ` ${className}` : '')}\n selected={selected}\n tabIndex={disabled ? -1 : 0}\n {...rest}>\n <ToggleSwitchContainer id=\"switchContainer\">\n <Switch className={isSemantic ? 'semantic' : ''} >\n {selected && <CheckmarkContainer><SystemIcons.CheckMark size={'14px'} color={COLORS.white}/></CheckmarkContainer>}\n </Switch>\n </ToggleSwitchContainer>\n {label && (\n <label className={'label'} htmlFor={id}>\n {label}\n </label>\n )}\n </StyledSwitch>\n );\n});\n\nexport default ToggleSwitch;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;;AAE9B;AACA;AACA;;AAGA;AACA;AACA;AACA,SAAQC,qBAAqB,EAAEC,YAAY,IAAIC,MAAM,EAAEC,YAAY,QAAO,iBAAiB;AAC3F,SAAQC,MAAM,EAAEC,IAAI,EAAEC,WAAW,QAAO,IAAI;AAC5C,SAAQC,kBAAkB,QAAO,WAAW;AAC5C,OAAOC,MAAM,MAAM,mBAAmB;AAAC;AAAA;AAEvC,IAAMC,kBAAkB,GAAID,MAAM,CAACE,GAAG,mNAQrC;AAED,IAAMT,YAAY,gBAAGF,KAAK,CAACY,UAAU,CAAC,gBAUuBC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,MAAM;QAAC,SAAS,EAAEJ,UAAU,GAAG,UAAU,GAAG,EAAG;QAAA,UAC7CF,QAAQ,iBAAI,KAAC,kBAAkB;UAAA,uBAAC,KAAC,WAAW,CAAC,SAAS;YAAC,IAAI,EAAE,MAAO;YAAC,KAAK,EAAEX,MAAM,CAAC4B;UAAM;QAAE;MAAqB;IAC1G,EACa,EACvBhB,KAAK,iBACJ;MAAO,SAAS,EAAE,OAAQ;MAAC,OAAO,EAAEH,EAAG;MAAA,UACpCG;IAAK,EAET;EAAA,GACY;AAEnB,CAAC,CAAC;AAEF,eAAef,YAAY"}
1
+ {"version":3,"file":"ToggleSwitch.js","names":["React","ToggleSwitchContainer","ToggleSwitch","Switch","StyledSwitch","Size","useFocusVisibleRef","forwardRef","ref","id","disabled","selected","label","isSemantic","size","onToggle","className","rest","toggle","focusVisibleRef","useImperativeHandle","current","Medium","e","key","toString","toLowerCase","concat"],"sources":["../../src/Toggles/ToggleSwitch.tsx"],"sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom types.\n */\nimport {ToggleSwitchProps} from './TogglerTypes';\n\n/**\n * Import custom styles.\n */\nimport {ToggleSwitchContainer, ToggleSwitch as Switch, StyledSwitch} from './TogglerStyles';\nimport {Size} from '..';\nimport {useFocusVisibleRef} from '../common';\n\nconst ToggleSwitch = React.forwardRef(({\n id,\n disabled,\n selected,\n label,\n isSemantic,\n size,\n onToggle,\n className,\n ...rest\n }: ToggleSwitchProps, ref) => {\n /**\n * Does all required pre-requisites and toggles the switcher state.\n */\n const toggle = () => {\n // If disabled, don't do anything\n if (disabled) return;\n\n // Toggle state change\n onToggle(!selected);\n };\n\n const focusVisibleRef = useFocusVisibleRef([]);\n\n React.useImperativeHandle(ref, () => focusVisibleRef.current, [focusVisibleRef]);\n\n size = size ?? Size.Medium;\n\n return (\n <StyledSwitch\n ref={focusVisibleRef}\n onClick={(e) => toggle()}\n onKeyDown={e => (e.key === 'Enter' || e.key === ' ') && toggle()}\n className={size\n .toString()\n .toLowerCase()\n .concat(disabled ? ' disabled' : '')\n .concat(className ? ` ${className}` : '')}\n selected={selected}\n tabIndex={disabled ? -1 : 0}\n {...rest}>\n <ToggleSwitchContainer id=\"switchContainer\">\n <Switch className={isSemantic ? 'semantic' : ''} />\n </ToggleSwitchContainer>\n {label && (\n <label className={'label'} htmlFor={id}>\n {label}\n </label>\n )}\n </StyledSwitch>\n );\n});\n\nexport default ToggleSwitch;\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;;AAE9B;AACA;AACA;;AAGA;AACA;AACA;AACA,SAAQC,qBAAqB,EAAEC,YAAY,IAAIC,MAAM,EAAEC,YAAY,QAAO,iBAAiB;AAC3F,SAAQC,IAAI,QAAO,IAAI;AACvB,SAAQC,kBAAkB,QAAO,WAAW;AAAC;AAAA;AAE7C,IAAMJ,YAAY,gBAAGF,KAAK,CAACO,UAAU,CAAC,gBAUuBC,GAAG,EAAK;EAAA;EAAA,IAT5BC,EAAE,QAAFA,EAAE;IACFC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,UAAU,QAAVA,UAAU;IACVC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;IACNC,IAAI;EAE9C;AACF;AACA;EACE,IAAMC,MAAM,GAAG,SAATA,MAAM,GAAS;IACnB;IACA,IAAIR,QAAQ,EAAE;;IAEd;IACAK,QAAQ,CAAC,CAACJ,QAAQ,CAAC;EACrB,CAAC;EAED,IAAMQ,eAAe,GAAGb,kBAAkB,CAAC,EAAE,CAAC;EAE9CN,KAAK,CAACoB,mBAAmB,CAACZ,GAAG,EAAE;IAAA,OAAMW,eAAe,CAACE,OAAO;EAAA,GAAE,CAACF,eAAe,CAAC,CAAC;EAEhFL,IAAI,YAAGA,IAAI,yCAAIT,IAAI,CAACiB,MAAM;EAE1B,oBACE,MAAC,YAAY;IACX,GAAG,EAAEH,eAAgB;IACrB,OAAO,EAAE,iBAACI,CAAC;MAAA,OAAKL,MAAM,EAAE;IAAA,CAAC;IACzB,SAAS,EAAE,mBAAAK,CAAC;MAAA,OAAI,CAACA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAID,CAAC,CAACC,GAAG,KAAK,GAAG,KAAKN,MAAM,EAAE;IAAA,CAAC;IACjE,SAAS,EAAEJ,IAAI,CACZW,QAAQ,EAAE,CACVC,WAAW,EAAE,CACbC,MAAM,CAACjB,QAAQ,GAAG,WAAW,GAAG,EAAE,CAAC,CACnCiB,MAAM,CAACX,SAAS,cAAOA,SAAS,IAAK,EAAE,CAAE;IAC5C,QAAQ,EAAEL,QAAS;IACnB,QAAQ,EAAED,QAAQ,GAAG,CAAC,CAAC,GAAG;EAAE,GACxBO,IAAI;IAAA,wBACR,KAAC,qBAAqB;MAAC,EAAE,EAAC,iBAAiB;MAAA,uBACzC,KAAC,MAAM;QAAC,SAAS,EAAEJ,UAAU,GAAG,UAAU,GAAG;MAAG;IAAG,EAC7B,EACvBD,KAAK,iBACJ;MAAO,SAAS,EAAE,OAAQ;MAAC,OAAO,EAAEH,EAAG;MAAA,UACpCG;IAAK,EAET;EAAA,GACY;AAEnB,CAAC,CAAC;AAEF,eAAeV,YAAY"}
@@ -19,6 +19,6 @@ var StyledSwitch = _styledComponents.default.div(_templateObject || (_templateOb
19
19
  exports.StyledSwitch = StyledSwitch;
20
20
  var ToggleSwitchContainer = _styledComponents.default.label(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n align-items: center;\n display: inline-flex;\n height: 28px;\n width: auto;\n padding: 10px 6px;\n"])));
21
21
  exports.ToggleSwitchContainer = ToggleSwitchContainer;
22
- var ToggleSwitch = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n align-items: center;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ", ";\n border-radius: 100px;\n\n &.semantic {\n background-color: ", ";\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ", ";\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n"])), _styles.COLORS.neutral_500, _styles.COLORS.critical_500, _styles.COLORS.white);
22
+ var ToggleSwitch = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: inline-block;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ", ";\n border-radius: 100px;\n\n &.semantic {\n background-color: ", ";\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ", ";\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n"])), _styles.COLORS.neutral_500, _styles.COLORS.critical_500, _styles.COLORS.white);
23
23
  exports.ToggleSwitch = ToggleSwitch;
24
24
  //# sourceMappingURL=TogglerStyles.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TogglerStyles.cjs","names":["StyledSwitch","styled","div","ComponentSStyling","ComponentTextStyle","Regular","COLORS","black","ComponentMStyling","ComponentLStyling","neutral_300","primary_100","props","selected","css","neutral_200","correct_500","primary_20","primary_500","neutral_100","critical_500","focusStyles","ToggleSwitchContainer","label","ToggleSwitch","span","neutral_500","white"],"sources":["../../src/Toggles/TogglerStyles.ts"],"sourcesContent":["/**\n * Import custom styles.\n */\nimport {COLORS, focusStyles} from '../styles';\n\n/**\n * Import third-party libraries.\n */\nimport styled, { css } from 'styled-components';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nexport const StyledSwitch = styled.div<{ selected: boolean | undefined }>`\n display: flex;\n flex-direction: row;\n width: max-content;\n min-height: 48px;\n min-width: 48px;\n align-items: center;\n cursor: pointer;\n &.small {\n ${ComponentSStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.large {\n ${ComponentLStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n &.disabled {\n color: ${COLORS.neutral_300};\n\n .label {\n cursor: not-allowed;\n }\n }\n .label {\n cursor: inherit;\n margin-left: 8px;\n }\n\n &:not(.disabled):active label:first-of-type span {\n &:before {\n background-color: ${COLORS.primary_100};\n }\n }\n\n ${(props) =>\n props.selected\n ? css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_200} !important;\n cursor: not-allowed;\n }\n }\n &:hover span {\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n label:first-of-type span {\n background-color: ${COLORS.primary_500};\n\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n -webkit-transform: translateX(20px);\n -ms-transform: translateX(20px);\n transform: translateX(20px);\n }\n }\n `\n : css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_100} !important;\n cursor: not-allowed;\n }\n }\n &:hover label:first-of-type span {\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n `}\n &:not(.disabled).focus-visible {\n ${focusStyles}\n }\n\n &:not(.disabled) label:first-of-type {\n cursor: inherit;\n }\n`;\n\nexport const ToggleSwitchContainer = styled.label`\n position: relative;\n align-items: center;\n display: inline-flex;\n height: 28px;\n width: auto;\n padding: 10px 6px;\n`;\n\nexport const ToggleSwitch = styled.span`\n position: relative;\n display: flex;\n align-items: center;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ${COLORS.neutral_500};\n border-radius: 100px;\n\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ${COLORS.white};\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n`;\n"],"mappings":";;;;;;;;;AAGA;AAKA;AACA;AAAmH;AAAA;AAAA;AAE5G,IAAMA,YAAY,GAAGC,yBAAM,CAACC,GAAG,otBAShC,IAAAC,6BAAiB,EAACC,8BAAkB,CAACC,OAAO,EAAEC,cAAM,CAACC,KAAK,CAAC,EAI3D,IAAAC,6BAAiB,EAACJ,8BAAkB,CAACC,OAAO,EAAEC,cAAM,CAACC,KAAK,CAAC,EAI3D,IAAAE,6BAAiB,EAACL,8BAAkB,CAACC,OAAO,EAAEC,cAAM,CAACC,KAAK,CAAC,EAGpDD,cAAM,CAACI,WAAW,EAaLJ,cAAM,CAACK,WAAW,EAIxC,UAACC,KAAK;EAAA,OACNA,KAAK,CAACC,QAAQ,OACVC,qBAAG,05BAEqBR,cAAM,CAACI,WAAW,EAIhBJ,cAAM,CAACS,WAAW,EAMlBT,cAAM,CAACU,WAAW,EAIlBV,cAAM,CAACW,UAAU,EAInBX,cAAM,CAACY,WAAW,EAGhBZ,cAAM,CAACU,WAAW,QAU5CF,qBAAG,2kBAEqBR,cAAM,CAACI,WAAW,EAIhBJ,cAAM,CAACa,WAAW,EAMlBb,cAAM,CAACc,YAAY,EAInBd,cAAM,CAACW,UAAU,CAG1C;AAAA,GAEHI,mBAAW,CAMhB;AAAC;AAEK,IAAMC,qBAAqB,GAAGrB,yBAAM,CAACsB,KAAK,sNAOhD;AAAC;AAEK,IAAMC,YAAY,GAAGvB,yBAAM,CAACwB,IAAI,8sBAYjBnB,cAAM,CAACoB,WAAW,EAIhBpB,cAAM,CAACc,YAAY,EAUnBd,cAAM,CAACqB,KAAK,CAMnC;AAAC"}
1
+ {"version":3,"file":"TogglerStyles.cjs","names":["StyledSwitch","styled","div","ComponentSStyling","ComponentTextStyle","Regular","COLORS","black","ComponentMStyling","ComponentLStyling","neutral_300","primary_100","props","selected","css","neutral_200","correct_500","primary_20","primary_500","neutral_100","critical_500","focusStyles","ToggleSwitchContainer","label","ToggleSwitch","span","neutral_500","white"],"sources":["../../src/Toggles/TogglerStyles.ts"],"sourcesContent":["/**\n * Import custom styles.\n */\nimport {COLORS, focusStyles} from '../styles';\n\n/**\n * Import third-party libraries.\n */\nimport styled, { css } from 'styled-components';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nexport const StyledSwitch = styled.div<{ selected: boolean | undefined }>`\n display: flex;\n flex-direction: row;\n width: max-content;\n min-height: 48px;\n min-width: 48px;\n align-items: center;\n cursor: pointer;\n &.small {\n ${ComponentSStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.large {\n ${ComponentLStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n &.disabled {\n color: ${COLORS.neutral_300};\n\n .label {\n cursor: not-allowed;\n }\n }\n .label {\n cursor: inherit;\n margin-left: 8px;\n }\n\n &:not(.disabled):active label:first-of-type span {\n &:before {\n background-color: ${COLORS.primary_100};\n }\n }\n\n ${(props) =>\n props.selected\n ? css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_200} !important;\n cursor: not-allowed;\n }\n }\n &:hover span {\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n label:first-of-type span {\n background-color: ${COLORS.primary_500};\n\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n -webkit-transform: translateX(20px);\n -ms-transform: translateX(20px);\n transform: translateX(20px);\n }\n }\n `\n : css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_100} !important;\n cursor: not-allowed;\n }\n }\n &:hover label:first-of-type span {\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n `}\n &:not(.disabled).focus-visible {\n ${focusStyles}\n }\n\n &:not(.disabled) label:first-of-type {\n cursor: inherit;\n }\n`;\n\nexport const ToggleSwitchContainer = styled.label`\n position: relative;\n align-items: center;\n display: inline-flex;\n height: 28px;\n width: auto;\n padding: 10px 6px;\n`;\n\nexport const ToggleSwitch = styled.span`\n position: relative;\n display: inline-block;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ${COLORS.neutral_500};\n border-radius: 100px;\n\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ${COLORS.white};\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n`;\n"],"mappings":";;;;;;;;;AAGA;AAKA;AACA;AAAmH;AAAA;AAAA;AAE5G,IAAMA,YAAY,GAAGC,yBAAM,CAACC,GAAG,otBAShC,IAAAC,6BAAiB,EAACC,8BAAkB,CAACC,OAAO,EAAEC,cAAM,CAACC,KAAK,CAAC,EAI3D,IAAAC,6BAAiB,EAACJ,8BAAkB,CAACC,OAAO,EAAEC,cAAM,CAACC,KAAK,CAAC,EAI3D,IAAAE,6BAAiB,EAACL,8BAAkB,CAACC,OAAO,EAAEC,cAAM,CAACC,KAAK,CAAC,EAGpDD,cAAM,CAACI,WAAW,EAaLJ,cAAM,CAACK,WAAW,EAIxC,UAACC,KAAK;EAAA,OACNA,KAAK,CAACC,QAAQ,OACVC,qBAAG,05BAEqBR,cAAM,CAACI,WAAW,EAIhBJ,cAAM,CAACS,WAAW,EAMlBT,cAAM,CAACU,WAAW,EAIlBV,cAAM,CAACW,UAAU,EAInBX,cAAM,CAACY,WAAW,EAGhBZ,cAAM,CAACU,WAAW,QAU5CF,qBAAG,2kBAEqBR,cAAM,CAACI,WAAW,EAIhBJ,cAAM,CAACa,WAAW,EAMlBb,cAAM,CAACc,YAAY,EAInBd,cAAM,CAACW,UAAU,CAG1C;AAAA,GAEHI,mBAAW,CAMhB;AAAC;AAEK,IAAMC,qBAAqB,GAAGrB,yBAAM,CAACsB,KAAK,sNAOhD;AAAC;AAEK,IAAMC,YAAY,GAAGvB,yBAAM,CAACwB,IAAI,8rBAWjBnB,cAAM,CAACoB,WAAW,EAIhBpB,cAAM,CAACc,YAAY,EAUnBd,cAAM,CAACqB,KAAK,CAMnC;AAAC"}
@@ -14,5 +14,5 @@ export var StyledSwitch = styled.div(_templateObject || (_templateObject = _tagg
14
14
  return props.selected ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.disabled label:first-of-type span {\n background-color: ", " !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ", " !important;\n cursor: not-allowed;\n }\n }\n &:hover span {\n &.semantic {\n background-color: ", ";\n }\n\n &:before {\n background-color: ", ";\n }\n }\n label:first-of-type span {\n background-color: ", ";\n\n &.semantic {\n background-color: ", ";\n }\n\n &:before {\n -webkit-transform: translateX(20px);\n -ms-transform: translateX(20px);\n transform: translateX(20px);\n }\n }\n "])), COLORS.neutral_300, COLORS.neutral_200, COLORS.correct_500, COLORS.primary_20, COLORS.primary_500, COLORS.correct_500) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.disabled label:first-of-type span {\n background-color: ", " !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ", " !important;\n cursor: not-allowed;\n }\n }\n &:hover label:first-of-type span {\n &.semantic {\n background-color: ", ";\n }\n\n &:before {\n background-color: ", ";\n }\n }\n "])), COLORS.neutral_300, COLORS.neutral_100, COLORS.critical_500, COLORS.primary_20);
15
15
  }, focusStyles);
16
16
  export var ToggleSwitchContainer = styled.label(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n align-items: center;\n display: inline-flex;\n height: 28px;\n width: auto;\n padding: 10px 6px;\n"])));
17
- export var ToggleSwitch = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n align-items: center;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ", ";\n border-radius: 100px;\n\n &.semantic {\n background-color: ", ";\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ", ";\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n"])), COLORS.neutral_500, COLORS.critical_500, COLORS.white);
17
+ export var ToggleSwitch = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ", ";\n border-radius: 100px;\n\n &.semantic {\n background-color: ", ";\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ", ";\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n"])), COLORS.neutral_500, COLORS.critical_500, COLORS.white);
18
18
  //# sourceMappingURL=TogglerStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TogglerStyles.js","names":["COLORS","focusStyles","styled","css","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentTextStyle","StyledSwitch","div","Regular","black","neutral_300","primary_100","props","selected","neutral_200","correct_500","primary_20","primary_500","neutral_100","critical_500","ToggleSwitchContainer","label","ToggleSwitch","span","neutral_500","white"],"sources":["../../src/Toggles/TogglerStyles.ts"],"sourcesContent":["/**\n * Import custom styles.\n */\nimport {COLORS, focusStyles} from '../styles';\n\n/**\n * Import third-party libraries.\n */\nimport styled, { css } from 'styled-components';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nexport const StyledSwitch = styled.div<{ selected: boolean | undefined }>`\n display: flex;\n flex-direction: row;\n width: max-content;\n min-height: 48px;\n min-width: 48px;\n align-items: center;\n cursor: pointer;\n &.small {\n ${ComponentSStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.large {\n ${ComponentLStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n &.disabled {\n color: ${COLORS.neutral_300};\n\n .label {\n cursor: not-allowed;\n }\n }\n .label {\n cursor: inherit;\n margin-left: 8px;\n }\n\n &:not(.disabled):active label:first-of-type span {\n &:before {\n background-color: ${COLORS.primary_100};\n }\n }\n\n ${(props) =>\n props.selected\n ? css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_200} !important;\n cursor: not-allowed;\n }\n }\n &:hover span {\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n label:first-of-type span {\n background-color: ${COLORS.primary_500};\n\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n -webkit-transform: translateX(20px);\n -ms-transform: translateX(20px);\n transform: translateX(20px);\n }\n }\n `\n : css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_100} !important;\n cursor: not-allowed;\n }\n }\n &:hover label:first-of-type span {\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n `}\n &:not(.disabled).focus-visible {\n ${focusStyles}\n }\n\n &:not(.disabled) label:first-of-type {\n cursor: inherit;\n }\n`;\n\nexport const ToggleSwitchContainer = styled.label`\n position: relative;\n align-items: center;\n display: inline-flex;\n height: 28px;\n width: auto;\n padding: 10px 6px;\n`;\n\nexport const ToggleSwitch = styled.span`\n position: relative;\n display: flex;\n align-items: center;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ${COLORS.neutral_500};\n border-radius: 100px;\n\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ${COLORS.white};\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n`;\n"],"mappings":";;AAAA;AACA;AACA;AACA,SAAQA,MAAM,EAAEC,WAAW,QAAO,WAAW;;AAE7C;AACA;AACA;AACA,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,iBAAiB,EAAEC,iBAAiB,EAAEC,iBAAiB,EAAEC,kBAAkB,QAAQ,sBAAsB;AAElH,OAAO,IAAMC,YAAY,GAAGN,MAAM,CAACO,GAAG,ssBAShCH,iBAAiB,CAACC,kBAAkB,CAACG,OAAO,EAAEV,MAAM,CAACW,KAAK,CAAC,EAI3DN,iBAAiB,CAACE,kBAAkB,CAACG,OAAO,EAAEV,MAAM,CAACW,KAAK,CAAC,EAI3DP,iBAAiB,CAACG,kBAAkB,CAACG,OAAO,EAAEV,MAAM,CAACW,KAAK,CAAC,EAGpDX,MAAM,CAACY,WAAW,EAaLZ,MAAM,CAACa,WAAW,EAIxC,UAACC,KAAK;EAAA,OACNA,KAAK,CAACC,QAAQ,GACVZ,GAAG,24BAEqBH,MAAM,CAACY,WAAW,EAIhBZ,MAAM,CAACgB,WAAW,EAMlBhB,MAAM,CAACiB,WAAW,EAIlBjB,MAAM,CAACkB,UAAU,EAInBlB,MAAM,CAACmB,WAAW,EAGhBnB,MAAM,CAACiB,WAAW,IAU5Cd,GAAG,4jBAEqBH,MAAM,CAACY,WAAW,EAIhBZ,MAAM,CAACoB,WAAW,EAMlBpB,MAAM,CAACqB,YAAY,EAInBrB,MAAM,CAACkB,UAAU,CAG1C;AAAA,GAEHjB,WAAW,CAMhB;AAED,OAAO,IAAMqB,qBAAqB,GAAGpB,MAAM,CAACqB,KAAK,wMAOhD;AAED,OAAO,IAAMC,YAAY,GAAGtB,MAAM,CAACuB,IAAI,gsBAYjBzB,MAAM,CAAC0B,WAAW,EAIhB1B,MAAM,CAACqB,YAAY,EAUnBrB,MAAM,CAAC2B,KAAK,CAMnC"}
1
+ {"version":3,"file":"TogglerStyles.js","names":["COLORS","focusStyles","styled","css","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentTextStyle","StyledSwitch","div","Regular","black","neutral_300","primary_100","props","selected","neutral_200","correct_500","primary_20","primary_500","neutral_100","critical_500","ToggleSwitchContainer","label","ToggleSwitch","span","neutral_500","white"],"sources":["../../src/Toggles/TogglerStyles.ts"],"sourcesContent":["/**\n * Import custom styles.\n */\nimport {COLORS, focusStyles} from '../styles';\n\n/**\n * Import third-party libraries.\n */\nimport styled, { css } from 'styled-components';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nexport const StyledSwitch = styled.div<{ selected: boolean | undefined }>`\n display: flex;\n flex-direction: row;\n width: max-content;\n min-height: 48px;\n min-width: 48px;\n align-items: center;\n cursor: pointer;\n &.small {\n ${ComponentSStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n &.large {\n ${ComponentLStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n &.disabled {\n color: ${COLORS.neutral_300};\n\n .label {\n cursor: not-allowed;\n }\n }\n .label {\n cursor: inherit;\n margin-left: 8px;\n }\n\n &:not(.disabled):active label:first-of-type span {\n &:before {\n background-color: ${COLORS.primary_100};\n }\n }\n\n ${(props) =>\n props.selected\n ? css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_200} !important;\n cursor: not-allowed;\n }\n }\n &:hover span {\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n label:first-of-type span {\n background-color: ${COLORS.primary_500};\n\n &.semantic {\n background-color: ${COLORS.correct_500};\n }\n\n &:before {\n -webkit-transform: translateX(20px);\n -ms-transform: translateX(20px);\n transform: translateX(20px);\n }\n }\n `\n : css`\n &.disabled label:first-of-type span {\n background-color: ${COLORS.neutral_300} !important;\n cursor: not-allowed;\n\n &:before {\n background-color: ${COLORS.neutral_100} !important;\n cursor: not-allowed;\n }\n }\n &:hover label:first-of-type span {\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n background-color: ${COLORS.primary_20};\n }\n }\n `}\n &:not(.disabled).focus-visible {\n ${focusStyles}\n }\n\n &:not(.disabled) label:first-of-type {\n cursor: inherit;\n }\n`;\n\nexport const ToggleSwitchContainer = styled.label`\n position: relative;\n align-items: center;\n display: inline-flex;\n height: 28px;\n width: auto;\n padding: 10px 6px;\n`;\n\nexport const ToggleSwitch = styled.span`\n position: relative;\n display: inline-block;\n vertical-align: middle;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 36px;\n height: 16px;\n background-color: ${COLORS.neutral_500};\n border-radius: 100px;\n\n &.semantic {\n background-color: ${COLORS.critical_500};\n }\n\n &:before {\n position: absolute;\n content: '';\n height: 12px;\n width: 12px;\n left: 2px;\n top: calc(50% - 6px);\n background-color: ${COLORS.white};\n -webkit-transition: background-color 0.1s, transform 0.1s;\n transition: 0.1s;\n transition-timing-function: ease-in-out;\n border-radius: 50%;\n }\n`;\n"],"mappings":";;AAAA;AACA;AACA;AACA,SAAQA,MAAM,EAAEC,WAAW,QAAO,WAAW;;AAE7C;AACA;AACA;AACA,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,iBAAiB,EAAEC,iBAAiB,EAAEC,iBAAiB,EAAEC,kBAAkB,QAAQ,sBAAsB;AAElH,OAAO,IAAMC,YAAY,GAAGN,MAAM,CAACO,GAAG,ssBAShCH,iBAAiB,CAACC,kBAAkB,CAACG,OAAO,EAAEV,MAAM,CAACW,KAAK,CAAC,EAI3DN,iBAAiB,CAACE,kBAAkB,CAACG,OAAO,EAAEV,MAAM,CAACW,KAAK,CAAC,EAI3DP,iBAAiB,CAACG,kBAAkB,CAACG,OAAO,EAAEV,MAAM,CAACW,KAAK,CAAC,EAGpDX,MAAM,CAACY,WAAW,EAaLZ,MAAM,CAACa,WAAW,EAIxC,UAACC,KAAK;EAAA,OACNA,KAAK,CAACC,QAAQ,GACVZ,GAAG,24BAEqBH,MAAM,CAACY,WAAW,EAIhBZ,MAAM,CAACgB,WAAW,EAMlBhB,MAAM,CAACiB,WAAW,EAIlBjB,MAAM,CAACkB,UAAU,EAInBlB,MAAM,CAACmB,WAAW,EAGhBnB,MAAM,CAACiB,WAAW,IAU5Cd,GAAG,4jBAEqBH,MAAM,CAACY,WAAW,EAIhBZ,MAAM,CAACoB,WAAW,EAMlBpB,MAAM,CAACqB,YAAY,EAInBrB,MAAM,CAACkB,UAAU,CAG1C;AAAA,GAEHjB,WAAW,CAMhB;AAED,OAAO,IAAMqB,qBAAqB,GAAGpB,MAAM,CAACqB,KAAK,wMAOhD;AAED,OAAO,IAAMC,YAAY,GAAGtB,MAAM,CAACuB,IAAI,grBAWjBzB,MAAM,CAAC0B,WAAW,EAIhB1B,MAAM,CAACqB,YAAY,EAUnBrB,MAAM,CAAC2B,KAAK,CAMnC"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+ var React = _interopRequireWildcard(require("react"));
14
+ var _reactResizeDetector = require("react-resize-detector");
15
+ var _TooltipStyles = require("./TooltipStyles");
16
+ var _ = require("..");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ var _excluded = ["label", "children", "input", "withArrow", "maxWidth", "width", "value", "size", "height", "align", "position"];
19
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
+ 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) { (0, _defineProperty2.default)(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; }
23
+ var TooltipOverflow = function TooltipOverflow(_ref) {
24
+ var label = _ref.label,
25
+ children = _ref.children,
26
+ input = _ref.input,
27
+ withArrow = _ref.withArrow,
28
+ maxWidth = _ref.maxWidth,
29
+ width = _ref.width,
30
+ value = _ref.value,
31
+ _ref$size = _ref.size,
32
+ size = _ref$size === void 0 ? _.Size.Small : _ref$size,
33
+ _ref$height = _ref.height,
34
+ height = _ref$height === void 0 ? 'auto' : _ref$height,
35
+ _ref$align = _ref.align,
36
+ align = _ref$align === void 0 ? 'center' : _ref$align,
37
+ _ref$position = _ref.position,
38
+ position = _ref$position === void 0 ? 'top' : _ref$position,
39
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
40
+ var _React$useState = React.useState(false),
41
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
42
+ textOverflowed = _React$useState2[0],
43
+ setTextOverflowed = _React$useState2[1];
44
+ var _React$useState3 = React.useState(false),
45
+ _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
46
+ focused = _React$useState4[0],
47
+ setFocused = _React$useState4[1];
48
+ var _useResizeDetector = (0, _reactResizeDetector.useResizeDetector)({
49
+ targetRef: input
50
+ }),
51
+ customW = _useResizeDetector.width,
52
+ customH = _useResizeDetector.height;
53
+ React.useEffect(function () {
54
+ checkIfOverflowed();
55
+ }, [customW, customH]);
56
+ var checkIfOverflowed = function checkIfOverflowed() {
57
+ var _ref2;
58
+ //adding +3 offset to offsetWidth, because sometimes when there is no overflow, scrollWidth can be equal to offsetWidth + 1
59
+ var over = (_ref2 = input && !focused && input.current && input.current.offsetWidth + 3 < input.current.scrollWidth) !== null && _ref2 !== void 0 ? _ref2 : false;
60
+ setTextOverflowed(over);
61
+ };
62
+ React.useEffect(function () {
63
+ checkIfOverflowed();
64
+ });
65
+ var onFocus = function onFocus() {
66
+ checkIfOverflowed();
67
+ setFocused(true);
68
+ };
69
+ var onBlur = function onBlur() {
70
+ setFocused(false);
71
+ };
72
+ React.useEffect(function () {
73
+ return function () {
74
+ if (input !== null && input !== void 0 && input.current) {
75
+ input === null || input === void 0 ? void 0 : input.current.removeEventListener("focus", onFocus);
76
+ input === null || input === void 0 ? void 0 : input.current.removeEventListener("blur", onBlur);
77
+ }
78
+ };
79
+ }, []);
80
+ var renderedCallback = React.useCallback(function (node) {
81
+ if (input && input.current) {
82
+ input.current.addEventListener("focus", onFocus);
83
+ input.current.addEventListener("blur", onBlur);
84
+ checkIfOverflowed();
85
+ }
86
+ }, []);
87
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
88
+ ref: renderedCallback,
89
+ children: textOverflowed && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TooltipStyles.Tooltip, _objectSpread(_objectSpread({
90
+ align: align,
91
+ height: height,
92
+ role: "tooltip",
93
+ maxWidth: maxWidth,
94
+ width: width,
95
+ size: size,
96
+ withArrow: withArrow,
97
+ position: position
98
+ }, props), {}, {
99
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
100
+ children: [children, " "]
101
+ })
102
+ }))
103
+ });
104
+ };
105
+ TooltipOverflow.propTypes = {
106
+ maxWidth: _propTypes.default.string,
107
+ width: _propTypes.default.string,
108
+ value: _propTypes.default.string
109
+ };
110
+ var _default = TooltipOverflow;
111
+ exports.default = _default;
112
+ //# sourceMappingURL=TooltipOverflow.cjs.map
@@ -0,0 +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","onFocus","onBlur","removeEventListener","renderedCallback","useCallback","node","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 = 'top',\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 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(node => {\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,KAAK;IACbC,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;E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AAC,UAAAC,IAAI,EAAI;IACjD,IAAGjC,KAAK,IAAIA,KAAK,CAACyB,OAAO,EACzB;MACEzB,KAAK,CAACyB,OAAO,CAACS,gBAAgB,CAAC,OAAO,EAAEN,OAAO,CAAC;MAChD5B,KAAK,CAACyB,OAAO,CAACS,gBAAgB,CAAC,MAAM,EAAEL,MAAM,CAAC;MAC9CN,iBAAiB,EAAE;IACrB;EACF,CAAC,EAAE,EAAE,CAAC;EAEJ,oBAAO;IAAK,GAAG,EAAEQ,gBAAiB;IAAA,UAAEjB,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;MAAA;IAAS;EACX,EAAQ;AAC7B,CAAC;AAAC;EA5ECG,QAAQ;EACRC,KAAK;EACLC,KAAK;AAAA;AAAA,eA4EOP,eAAe;AAAA"}
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { TooltipProps } from './TooltipTypes';
3
+ interface TooltipOverflowProps extends TooltipProps {
4
+ input?: React.MutableRefObject<HTMLInputElement | null>;
5
+ maxWidth?: string;
6
+ width?: string;
7
+ value?: string;
8
+ }
9
+ declare const TooltipOverflow: ({ label, children, input, withArrow, maxWidth, width, value, size, height, align, position, ...props }: TooltipOverflowProps) => JSX.Element;
10
+ export default TooltipOverflow;
@@ -0,0 +1,102 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ import _pt from "prop-types";
5
+ var _excluded = ["label", "children", "input", "withArrow", "maxWidth", "width", "value", "size", "height", "align", "position"];
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
+ 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; }
8
+ import * as React from 'react';
9
+ import { useResizeDetector } from 'react-resize-detector';
10
+ import { Tooltip } from './TooltipStyles';
11
+ import { Size } from '..';
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ var TooltipOverflow = function TooltipOverflow(_ref) {
15
+ var label = _ref.label,
16
+ children = _ref.children,
17
+ input = _ref.input,
18
+ withArrow = _ref.withArrow,
19
+ maxWidth = _ref.maxWidth,
20
+ width = _ref.width,
21
+ value = _ref.value,
22
+ _ref$size = _ref.size,
23
+ size = _ref$size === void 0 ? Size.Small : _ref$size,
24
+ _ref$height = _ref.height,
25
+ height = _ref$height === void 0 ? 'auto' : _ref$height,
26
+ _ref$align = _ref.align,
27
+ align = _ref$align === void 0 ? 'center' : _ref$align,
28
+ _ref$position = _ref.position,
29
+ position = _ref$position === void 0 ? 'top' : _ref$position,
30
+ props = _objectWithoutProperties(_ref, _excluded);
31
+ var _React$useState = React.useState(false),
32
+ _React$useState2 = _slicedToArray(_React$useState, 2),
33
+ textOverflowed = _React$useState2[0],
34
+ setTextOverflowed = _React$useState2[1];
35
+ var _React$useState3 = React.useState(false),
36
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
37
+ focused = _React$useState4[0],
38
+ setFocused = _React$useState4[1];
39
+ var _useResizeDetector = useResizeDetector({
40
+ targetRef: input
41
+ }),
42
+ customW = _useResizeDetector.width,
43
+ customH = _useResizeDetector.height;
44
+ React.useEffect(function () {
45
+ checkIfOverflowed();
46
+ }, [customW, customH]);
47
+ var checkIfOverflowed = function checkIfOverflowed() {
48
+ var _ref2;
49
+ //adding +3 offset to offsetWidth, because sometimes when there is no overflow, scrollWidth can be equal to offsetWidth + 1
50
+ var over = (_ref2 = input && !focused && input.current && input.current.offsetWidth + 3 < input.current.scrollWidth) !== null && _ref2 !== void 0 ? _ref2 : false;
51
+ setTextOverflowed(over);
52
+ };
53
+ React.useEffect(function () {
54
+ checkIfOverflowed();
55
+ });
56
+ var onFocus = function onFocus() {
57
+ checkIfOverflowed();
58
+ setFocused(true);
59
+ };
60
+ var onBlur = function onBlur() {
61
+ setFocused(false);
62
+ };
63
+ React.useEffect(function () {
64
+ return function () {
65
+ if (input !== null && input !== void 0 && input.current) {
66
+ input === null || input === void 0 ? void 0 : input.current.removeEventListener("focus", onFocus);
67
+ input === null || input === void 0 ? void 0 : input.current.removeEventListener("blur", onBlur);
68
+ }
69
+ };
70
+ }, []);
71
+ var renderedCallback = React.useCallback(function (node) {
72
+ if (input && input.current) {
73
+ input.current.addEventListener("focus", onFocus);
74
+ input.current.addEventListener("blur", onBlur);
75
+ checkIfOverflowed();
76
+ }
77
+ }, []);
78
+ return /*#__PURE__*/_jsx("div", {
79
+ ref: renderedCallback,
80
+ children: textOverflowed && /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({
81
+ align: align,
82
+ height: height,
83
+ role: "tooltip",
84
+ maxWidth: maxWidth,
85
+ width: width,
86
+ size: size,
87
+ withArrow: withArrow,
88
+ position: position
89
+ }, props), {}, {
90
+ children: /*#__PURE__*/_jsxs("span", {
91
+ children: [children, " "]
92
+ })
93
+ }))
94
+ });
95
+ };
96
+ TooltipOverflow.propTypes = {
97
+ maxWidth: _pt.string,
98
+ width: _pt.string,
99
+ value: _pt.string
100
+ };
101
+ export default TooltipOverflow;
102
+ //# sourceMappingURL=TooltipOverflow.js.map
@@ -0,0 +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","onFocus","onBlur","removeEventListener","renderedCallback","useCallback","node","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 = 'top',\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 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(node => {\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,KAAK;IACbC,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,EAAEhB;IAAM,CAAC,CAAC;IAAnEiB,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