@laerdal/life-react-components 1.2.1-dev.7.full → 1.2.2-dev.10

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 (50) hide show
  1. package/dist/esm/Button/Iconbutton.js +11 -4
  2. package/dist/esm/Button/Iconbutton.js.map +1 -1
  3. package/dist/esm/InputFields/Checkbox.js +0 -1
  4. package/dist/esm/InputFields/Checkbox.js.map +1 -1
  5. package/dist/esm/InputFields/SearchBar.js +28 -31
  6. package/dist/esm/InputFields/SearchBar.js.map +1 -1
  7. package/dist/esm/NotificationDot/NotificationDot.js +1 -1
  8. package/dist/esm/NotificationDot/NotificationDot.js.map +1 -1
  9. package/dist/esm/NotificationDot/__tests__/NotificationDot.test.js +40 -0
  10. package/dist/esm/NotificationDot/__tests__/NotificationDot.test.js.map +1 -0
  11. package/dist/esm/Paginator/Paginator.js +56 -48
  12. package/dist/esm/Paginator/Paginator.js.map +1 -1
  13. package/dist/esm/Paginator/__tests__/Paginator.test.js +4 -4
  14. package/dist/esm/Paginator/__tests__/Paginator.test.js.map +1 -1
  15. package/dist/esm/Toasters/Toast.js +5 -1
  16. package/dist/esm/Toasters/Toast.js.map +1 -1
  17. package/dist/js/Button/Iconbutton.d.ts +2 -1
  18. package/dist/js/Button/Iconbutton.js +22 -11
  19. package/dist/js/Button/Iconbutton.js.map +1 -1
  20. package/dist/js/InputFields/Checkbox.js +0 -1
  21. package/dist/js/InputFields/Checkbox.js.map +1 -1
  22. package/dist/js/InputFields/SearchBar.js +28 -34
  23. package/dist/js/InputFields/SearchBar.js.map +1 -1
  24. package/dist/js/NotificationDot/NotificationDot.js +1 -1
  25. package/dist/js/NotificationDot/NotificationDot.js.map +1 -1
  26. package/dist/js/NotificationDot/__tests__/NotificationDot.test.js +86 -0
  27. package/dist/js/NotificationDot/__tests__/NotificationDot.test.js.map +1 -0
  28. package/dist/js/Paginator/Paginator.js +37 -38
  29. package/dist/js/Paginator/Paginator.js.map +1 -1
  30. package/dist/js/Paginator/__tests__/Paginator.test.js +6 -6
  31. package/dist/js/Paginator/__tests__/Paginator.test.js.map +1 -1
  32. package/dist/js/Toasters/Toast.js +8 -4
  33. package/dist/js/Toasters/Toast.js.map +1 -1
  34. package/dist/umd/Button/Iconbutton.js +22 -61
  35. package/dist/umd/Button/Iconbutton.js.map +1 -1
  36. package/dist/umd/InputFields/Checkbox.js +0 -1
  37. package/dist/umd/InputFields/Checkbox.js.map +1 -1
  38. package/dist/umd/InputFields/SearchBar.js +33 -34
  39. package/dist/umd/InputFields/SearchBar.js.map +1 -1
  40. package/dist/umd/NotificationDot/NotificationDot.js +1 -1
  41. package/dist/umd/NotificationDot/NotificationDot.js.map +1 -1
  42. package/dist/umd/NotificationDot/__tests__/NotificationDot.test.js +61 -0
  43. package/dist/umd/NotificationDot/__tests__/NotificationDot.test.js.map +1 -0
  44. package/dist/umd/Paginator/Paginator.js +57 -51
  45. package/dist/umd/Paginator/Paginator.js.map +1 -1
  46. package/dist/umd/Paginator/__tests__/Paginator.test.js +4 -4
  47. package/dist/umd/Paginator/__tests__/Paginator.test.js.map +1 -1
  48. package/dist/umd/Toasters/Toast.js +5 -1
  49. package/dist/umd/Toasters/Toast.js.map +1 -1
  50. package/package.json +10 -19
@@ -1,5 +1,5 @@
1
1
  import _pt from "prop-types";
2
- import * as React from 'react';
2
+ import React from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { BREAKPOINTS, COLORS } from '../styles';
5
5
 
@@ -198,7 +198,8 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
198
198
  borderRadius,
199
199
  onKeyPress,
200
200
  tabbedHereBackgroundColor,
201
- type
201
+ type,
202
+ hidden
202
203
  }, ref) => {
203
204
  const supressFocusRef = React.useRef(null);
204
205
  const [tabbedHere, setTabbedHere] = React.useState(false);
@@ -211,8 +212,11 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
211
212
  }
212
213
 
213
214
  return false;
214
- }; // Let's render button
215
+ };
215
216
 
217
+ React.useEffect(() => {
218
+ !!disabled && setTabbedHere(false);
219
+ }, [disabled]); // Let's render button
216
220
 
217
221
  switch (variant) {
218
222
  case 'secondary':
@@ -244,6 +248,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
244
248
  },
245
249
  tabbedHere: tabbedHere,
246
250
  onKeyPress: onKeyPress,
251
+ hidden: hidden,
247
252
  tabbedHereBackgroundColor: tabbedHereBackgroundColor
248
253
  }, /*#__PURE__*/React.createElement("div", null, children));
249
254
 
@@ -278,6 +283,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
278
283
  },
279
284
  tabbedHere: tabbedHere,
280
285
  onKeyPress: onKeyPress,
286
+ hidden: hidden,
281
287
  tabbedHereBackgroundColor: tabbedHereBackgroundColor
282
288
  }, /*#__PURE__*/React.createElement("div", null, children));
283
289
  }
@@ -297,7 +303,8 @@ IconButton.propTypes = {
297
303
  borderRadius: _pt.number,
298
304
  onKeyPress: _pt.func,
299
305
  tabbedHereBackgroundColor: _pt.string,
300
- children: _pt.node
306
+ children: _pt.node,
307
+ hidden: _pt.bool
301
308
  };
302
309
  export default IconButton;
303
310
  //# sourceMappingURL=Iconbutton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Button/Iconbutton.tsx"],"names":["React","styled","css","BREAKPOINTS","COLORS","tabbedHereStyle","variant","tabbedHereBackgroundColor","primary_500","neutral_600","primary_700","white","getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","StyledIconButton","button","hideOnLowWidth","MEDIUM","unsetIconSize","StyledPrimaryIconButton","useTransparentBackground","iconColor","primary_800","neutral_200","tabbedHere","StyledSecondaryIconButton","primary_20","primary_100","neutral_300","IconButton","forwardRef","id","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","type","ref","supressFocusRef","useRef","setTabbedHere","useState","isPressingEnter","e","key","preventDefault","stopPropagation","event","current"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAA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GAA4C,CAf5D;AAgBE,QAAA,WAAW,EAAGc,CAAD,IAAY;AACvB,cAAI,CAACV,QAAD,IAAa,CAACZ,UAAlB,EAA8BiB,eAAe,CAACU,OAAhB,GAA0B,IAA1B;AAC/B,SAlBH;AAmBE,QAAA,OAAO,EAAGL,CAAD,IAAY;AACnB,cAAI,CAACV,QAAL,EAAe;AACb,gBAAI,CAACK,eAAe,CAACU,OAArB,EAA8BR,aAAa,CAAC,IAAD,CAAb,CAA9B,KACKF,eAAe,CAACU,OAAhB,GAA0B,KAA1B;AACN;AACF,SAxBH;AAyBE,QAAA,MAAM,EAAE,MAAM;AACZR,UAAAA,aAAa,CAAC,KAAD,CAAb;AACD,SA3BH;AA4BE,QAAA,UAAU,EAAEnB,UA5Bd;AA6BE,QAAA,UAAU,EAAEc,UA7Bd;AA8BE,QAAA,yBAAyB,EAAEnC;AA9B7B,sBA+BE,iCAAMgC,QAAN,CA/BF,CADF;AAtCJ;AA0ED,CA1GkB,CAAnB;;AAnBEJ,EAAAA,E;AACA7B,EAAAA,O,aAAU,S,EAAY,W;AACtB8B,EAAAA,K,aAAQ,Q,EAAW,U;AACnBC,EAAAA,M;AACAjB,EAAAA,c;AAEAkB,EAAAA,c;AACAE,EAAAA,Q;AACAhB,EAAAA,wB;AACAC,EAAAA,S;AACAH,EAAAA,a;AACAmB,EAAAA,Q;AACA3B,EAAAA,Y;AACA4B,EAAAA,U;AACAnC,EAAAA,yB;AAEAgC,EAAAA,Q;;AA+GF,eAAeN,UAAf","sourcesContent":["import * as React from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../styles';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n tabbedHere?: boolean;\n tabbedHereBackgroundColor?: string;\n}\n\nconst tabbedHereStyle = (variant: string, tabbedHereBackgroundColor?: string) => {\n switch (variant) {\n case 'secondary':\n return css`\n div {\n background-color: ${tabbedHereBackgroundColor || 'transparent'} !important;\n box-shadow: 0px 0px 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n }\n div svg path,\n div svg {\n fill: ${COLORS.neutral_600};\n }\n `;\n case 'primary':\n default:\n return css`\n div {\n background-color: ${tabbedHereBackgroundColor || COLORS.primary_700} !important;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2e7fa1;\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n `;\n }\n};\n\nconst getBorderRadius = (props:HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px'); \n\nconst getBorderRadiusStyle = (props:HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch(props.flatEdge)\n {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n \n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nconst StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n div {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n &:focus:not(:disabled) {\n outline: none;\n div {\n outline: none;\n }\n }\n &:active:not(:disabled) {\n div {\n box-shadow: none;\n }\n }\n`;\n\nconst StyledPrimaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_700};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_800};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n div {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n ${(props) => (props.tabbedHere ? tabbedHereStyle('primary', props.tabbedHereBackgroundColor) : '')};\n`;\n\nconst StyledSecondaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_20};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_100};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n\n ${(props) => (props.tabbedHere ? tabbedHereStyle('secondary', props.tabbedHereBackgroundColor) : '')};\n`;\n\ninterface Props {\n id?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n tabbedHereBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n};\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n tabbedHereBackgroundColor,\n type,\n}: Props, ref) => {\n const supressFocusRef = React.useRef<any>(null);\n const [tabbedHere, setTabbedHere] = React.useState<boolean>(false);\n\n const isPressingEnter = (e: any) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => action(event)}\n onKeyDown={(e: any) => (isPressingEnter(e) ? action() : null)}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={(e: any) => {\n if (!disabled && !tabbedHere) supressFocusRef.current = true;\n }}\n onFocus={(e: any) => {\n if (!disabled) {\n if (!supressFocusRef.current) setTabbedHere(true);\n else supressFocusRef.current = false;\n }\n }}\n onBlur={() => {\n setTabbedHere(false);\n }}\n tabbedHere={tabbedHere}\n onKeyPress={onKeyPress}\n tabbedHereBackgroundColor={tabbedHereBackgroundColor}>\n <div>{children}</div>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => action(event)}\n onKeyDown={(e: any) => (isPressingEnter(e) ? action() : null)}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={(e: any) => {\n if (!disabled && !tabbedHere) supressFocusRef.current = true;\n }}\n onFocus={(e: any) => {\n if (!disabled) {\n if (!supressFocusRef.current) setTabbedHere(true);\n else supressFocusRef.current = false;\n }\n }}\n onBlur={() => {\n setTabbedHere(false);\n }}\n tabbedHere={tabbedHere}\n onKeyPress={onKeyPress}\n tabbedHereBackgroundColor={tabbedHereBackgroundColor}>\n <div>{children}</div>\n </StyledPrimaryIconButton>\n );\n }\n});\n\nexport default IconButton;\n"],"file":"Iconbutton.js"}
1
+ {"version":3,"sources":["../../../src/Button/Iconbutton.tsx"],"names":["React","styled","css","BREAKPOINTS","COLORS","tabbedHereStyle","variant","tabbedHereBackgroundColor","primary_500","neutral_600","primary_700","white","getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","StyledIconButton","button","hideOnLowWidth","MEDIUM","unsetIconSize","StyledPrimaryIconButton","useTransparentBackground","iconColor","primary_800","neutral_200","tabbedHere","StyledSecondaryIconButton","primary_20","primary_100","neutral_300","IconButton","forwardRef","id","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","type","hidden","ref","supressFocusRef","useRef","setTabbedHere","useState","isPressingEnter","e","key","preventDefault","stopPropagation","useEffect","event","current"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AAEA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,WAApC;;AAeA,MAA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EmB,QAAQ,IAAI,CAdxB;AAeE,QAAA,YAAY,EAAE3B,YAAY,IAAIsB,KAAK,KAAK,UAA1B,GAAuC,EAAvC,GAA4C,CAf5D;AAgBE,QAAA,WAAW,EAAGe,CAAD,IAAY;AACvB,cAAI,CAACX,QAAD,IAAa,CAACZ,UAAlB,EAA8BkB,eAAe,CAACW,OAAhB,GAA0B,IAA1B;AAC/B,SAlBH;AAmBE,QAAA,OAAO,EAAGN,CAAD,IAAY;AACnB,cAAI,CAACX,QAAL,EAAe;AACb,gBAAI,CAACM,eAAe,CAACW,OAArB,EAA8BT,aAAa,CAAC,IAAD,CAAb,CAA9B,KACKF,eAAe,CAACW,OAAhB,GAA0B,KAA1B;AACN;AACF,SAxBH;AAyBE,QAAA,MAAM,EAAE,MAAM;AACZT,UAAAA,aAAa,CAAC,KAAD,CAAb;AACD,SA3BH;AA4BE,QAAA,UAAU,EAAEpB,UA5Bd;AA6BE,QAAA,UAAU,EAAEc,UA7Bd;AA8BE,QAAA,MAAM,EAAEE,MA9BV;AA+BE,QAAA,yBAAyB,EAAErC;AA/B7B,sBAgCE,iCAAMgC,QAAN,CAhCF,CADF;AAvCJ;AA4ED,CAjHkB,CAAnB;;AApBEJ,EAAAA,E;AACA7B,EAAAA,O,aAAU,S,EAAY,W;AACtB8B,EAAAA,K,aAAQ,Q,EAAW,U;AACnBC,EAAAA,M;AACAjB,EAAAA,c;AAEAkB,EAAAA,c;AACAE,EAAAA,Q;AACAhB,EAAAA,wB;AACAC,EAAAA,S;AACAH,EAAAA,a;AACAmB,EAAAA,Q;AACA3B,EAAAA,Y;AACA4B,EAAAA,U;AACAnC,EAAAA,yB;AAEAgC,EAAAA,Q;AACAK,EAAAA,M;;AAsHF,eAAeX,UAAf","sourcesContent":["import React from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../styles';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n tabbedHere?: boolean;\n tabbedHereBackgroundColor?: string;\n}\n\nconst tabbedHereStyle = (variant: string, tabbedHereBackgroundColor?: string) => {\n switch (variant) {\n case 'secondary':\n return css`\n div {\n background-color: ${tabbedHereBackgroundColor || 'transparent'} !important;\n box-shadow: 0px 0px 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n }\n div svg path,\n div svg {\n fill: ${COLORS.neutral_600};\n }\n `;\n case 'primary':\n default:\n return css`\n div {\n background-color: ${tabbedHereBackgroundColor || COLORS.primary_700} !important;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2e7fa1;\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n `;\n }\n};\n\nconst getBorderRadius = (props:HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px'); \n\nconst getBorderRadiusStyle = (props:HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch(props.flatEdge)\n {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n \n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nconst StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n div {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n &:focus:not(:disabled) {\n outline: none;\n div {\n outline: none;\n }\n }\n &:active:not(:disabled) {\n div {\n box-shadow: none;\n }\n }\n`;\n\nconst StyledPrimaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_700};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_800};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n div {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n ${(props) => (props.tabbedHere ? tabbedHereStyle('primary', props.tabbedHereBackgroundColor) : '')};\n`;\n\nconst StyledSecondaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_20};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_100};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n\n ${(props) => (props.tabbedHere ? tabbedHereStyle('secondary', props.tabbedHereBackgroundColor) : '')};\n`;\n\ninterface Props {\n id?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n tabbedHereBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n};\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n tabbedHereBackgroundColor,\n type,\n hidden\n}: Props, ref) => {\n const supressFocusRef = React.useRef<any>(null);\n const [tabbedHere, setTabbedHere] = React.useState<boolean>(false);\n\n const isPressingEnter = (e: any) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n React.useEffect(() => {\n !!disabled && setTabbedHere(false)\n }, [disabled]);\n\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => action(event)}\n onKeyDown={(e: any) => (isPressingEnter(e) ? action() : null)}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={(e: any) => {\n if (!disabled && !tabbedHere) supressFocusRef.current = true;\n }}\n onFocus={(e: any) => {\n if (!disabled) {\n if (!supressFocusRef.current) setTabbedHere(true);\n else supressFocusRef.current = false;\n }\n }}\n onBlur={() => {\n setTabbedHere(false);\n }}\n tabbedHere={tabbedHere}\n onKeyPress={onKeyPress}\n hidden={hidden}\n tabbedHereBackgroundColor={tabbedHereBackgroundColor}>\n <div>{children}</div>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => action(event)}\n onKeyDown={(e: any) => (isPressingEnter(e) ? action() : null)}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={(e: any) => {\n if (!disabled && !tabbedHere) supressFocusRef.current = true;\n }}\n onFocus={(e: any) => {\n if (!disabled) {\n if (!supressFocusRef.current) setTabbedHere(true);\n else supressFocusRef.current = false;\n }\n }}\n onBlur={() => {\n setTabbedHere(false);\n }}\n tabbedHere={tabbedHere}\n onKeyPress={onKeyPress}\n hidden={hidden}\n tabbedHereBackgroundColor={tabbedHereBackgroundColor}>\n <div>{children}</div>\n </StyledPrimaryIconButton>\n );\n }\n});\n\nexport default IconButton;\n"],"file":"Iconbutton.js"}
@@ -135,7 +135,6 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
135
135
  };
136
136
 
137
137
  size = size ?? Size.Medium;
138
- console.log('size prop', size.toString().toLowerCase());
139
138
  return /*#__PURE__*/React.createElement(StyledCheckBox, {
140
139
  key: id,
141
140
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/InputFields/Checkbox.tsx"],"names":["React","styled","CheckboxOff","CheckboxOn","CheckboxSemi","COLORS","ComponentTextStyle","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","StyledCheckBox","div","props","margin","black","selected","primary_500","showWarning","warning_400","neutral_600","Regular","white","primary_20","primary_700","primary_100","primary_800","neutral_300","Checkbox","forwardRef","id","select","label","iconPointerEventsTransparent","disabled","size","semiSelected","ref","onKeyPress","e","keyCode","handleClick","Medium","console","log","toString","toLowerCase","concat","preventDefault"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,WAAR,EAAqBC,UAArB,EAAiCC,YAAjC,QAAoD,kCAApD;AACA,SAAQC,MAAR,EAAgBC,kBAAhB,QAAyC,WAAzC;AACA,SAASC,IAAT,QAAqB,UAArB;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,QAAsE,sBAAtE;AAEA,MAAMC,cAAc,GAAGV,MAAM,CAACW,GAAwF;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,KAAK,IAAKA,KAAK,CAACC,MAAN,GAAgB,WAAUD,KAAK,CAACC,MAAO,GAAvC,GAA4C,EAAI;AAC9D;AACA;AACA,WAAWT,MAAM,CAACU,KAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeF,KAAK,IAAKA,KAAK,CAACG,QAAN,GAAiBX,MAAM,CAACY,WAAxB,GAAsCJ,KAAK,CAACK,WAAN,GAAoBb,MAAM,CAACc,WAA3B,GAAyCd,MAAM,CAACe,WAAa;AAC5H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMV,iBAAiB,CAACJ,kBAAkB,CAACe,OAApB,EAA6BhB,MAAM,CAACU,KAApC,CAA2C;AAClE;AACA;AACA;AACA,MAAMN,iBAAiB,CAACH,kBAAkB,CAACe,OAApB,EAA6BhB,MAAM,CAACU,KAApC,CAA2C;AAClE;AACA;AACA;AACA,MAAMP,iBAAiB,CAACF,kBAAkB,CAACe,OAApB,EAA6BhB,MA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BN,CADF;AAgCD,CA5DgB,CAAjB;;AAZEF,EAAAA,E;AACAd,EAAAA,Q;AACAe,EAAAA,M;AACAC,EAAAA,K;AACAd,EAAAA,W;AACAgB,EAAAA,Q;AACApB,EAAAA,M;AAEAmB,EAAAA,4B;AACAG,EAAAA,Y;;AAiEF,eAAeR,QAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {CheckboxOff, CheckboxOn, CheckboxSemi} from '../icons/systemicons/SystemIcons';\nimport {COLORS, ComponentTextStyle} from '../styles';\nimport { Size } from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\n\nconst StyledCheckBox = styled.div<{ disabled?: boolean; showWarning?: boolean; selected?: boolean; margin?: string }>`\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 48px;\n min-width: 48px;\n align-items: center;\n\n ${props => (props.margin ? `margin: ${props.margin};` : '')}\n cursor: pointer;\n\n color: ${COLORS.black};\n\n .pointerTransparent {\n pointer-events: none;\n }\n\n .icon {\n margin: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n border-radius: 50%;\n\n svg {\n color: ${props => (props.selected ? COLORS.primary_500 : props.showWarning ? COLORS.warning_400 : COLORS.neutral_600)};\n }\n }\n\n .label {\n user-select: none;\n cursor: inherit;\n }\n\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\n &:not(.disabled):focus {\n outline: none;\n\n .icon {\n background-color: ${COLORS.white};\n box-shadow: 0 0 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n\n svg {\n color: ${COLORS.neutral_600};\n }\n }\n }\n\n &:not(.disabled):hover {\n .icon {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_700};\n }\n }\n }\n\n &:not(.disabled):active {\n .icon {\n background: ${COLORS.primary_100};\n box-shadow: none;\n\n svg {\n color: ${COLORS.primary_800};\n }\n }\n }\n\n &.disabled {\n box-shadow: none;\n cursor: not-allowed;\n\n color: ${COLORS.neutral_300};\n\n .icon,\n .label {\n pointer-events: none;\n }\n\n .icon{\n background-color: ${COLORS.white};\n }\n\n .icon svg {\n color: ${COLORS.neutral_300};\n }\n }\n`;\n\ninterface Props {\n id: string;\n selected: boolean;\n select: (selected: boolean) => void;\n label?: string;\n showWarning?: boolean;\n disabled?: boolean;\n margin?: string;\n size?: Size;\n iconPointerEventsTransparent?: boolean;\n semiSelected?: boolean;\n}\n\nconst Checkbox = React.forwardRef<HTMLDivElement, Props>(({\n id,\n selected,\n select,\n label,\n showWarning,\n iconPointerEventsTransparent,\n disabled,\n margin,\n size,\n semiSelected\n }: Props, ref) => {\n const onKeyPress = (e: any) => {\n if (e.keyCode === 13 && !disabled) {\n select(!selected);\n }\n };\n\n const handleClick = () => {\n if (disabled) {\n return;\n }\n select(!selected);\n };\n\n size = size ?? Size.Medium;\n\n console.log('size prop', size.toString().toLowerCase());\n return (\n <StyledCheckBox key={id}\n ref={ref}\n disabled={disabled}\n className={size.toString().toLowerCase().concat(disabled ? ' disabled' : '')}\n selected={selected}\n tabIndex={disabled ? -1 : 0}\n showWarning={showWarning}\n margin={margin}\n onClick={handleClick}\n onKeyDown={onKeyPress}\n onMouseDown={e => e.preventDefault()}>\n <div id={id} className={'icon'}>\n {\n selected\n ? <CheckboxOn className={iconPointerEventsTransparent ? \"pointerTransparent\" : \"\"} size=\"24px\"/>\n : semiSelected\n ? <CheckboxSemi className={iconPointerEventsTransparent ? \"pointerTransparent\" : \"\"} size=\"24px\"/>\n : <CheckboxOff className={iconPointerEventsTransparent ? \"pointerTransparent\" : \"\"} size=\"24px\"/>\n }\n </div>\n {\n label &&\n (\n <label className={'label'}\n htmlFor={id}>\n {label}\n </label>\n )\n }\n </StyledCheckBox>\n );\n});\n\nexport default Checkbox;\n"],"file":"Checkbox.js"}
1
+ {"version":3,"sources":["../../../src/InputFields/Checkbox.tsx"],"names":["React","styled","CheckboxOff","CheckboxOn","CheckboxSemi","COLORS","ComponentTextStyle","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","StyledCheckBox","div","props","margin","black","selected","primary_500","showWarning","warning_400","neutral_600","Regular","white","primary_20","primary_700","primary_100","primary_800","neutral_300","Checkbox","forwardRef","id","select","label","iconPointerEventsTransparent","disabled","size","semiSelected","ref","onKeyPress","e","keyCode","handleClick","Medium","toString","toLowerCase","concat","preventDefault"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,WAAR,EAAqBC,UAArB,EAAiCC,YAAjC,QAAoD,kCAApD;AACA,SAAQC,MAAR,EAAgBC,kBAAhB,QAAyC,WAAzC;AACA,SAASC,IAAT,QAAqB,UAArB;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,QAAsE,sBAAtE;AAEA,MAAMC,cAAc,GAAGV,MAAM,CAACW,GAAwF;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,KAAK,IAAKA,KAAK,CAACC,MAAN,GAAgB,WAAUD,KAAK,CAACC,MAAO,GAAvC,GAA4C,EAAI;AAC9D;AACA;AACA,WAAWT,MAAM,CAACU,KAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeF,KAAK,IAAKA,KAAK,CAACG,QAAN,GAAiBX,MAAM,CAACY,WAAxB,GAAsCJ,KAAK,CAACK,WAAN,GAAoBb,MAAM,CAACc,WAA3B,GAAyCd,MAAM,CAACe,WAAa;AAC5H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMV,iBAAiB,CAACJ,kBAAkB,CAACe,OAApB,EAA6BhB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V,CAXF,EAqBID,KAAK,iBAEH;AAAO,IAAA,SAAS,EAAE,OAAlB;AACO,IAAA,OAAO,EAAEF;AADhB,KAEGE,KAFH,CAvBN,CADF;AAgCD,CA3DgB,CAAjB;;AAZEF,EAAAA,E;AACAd,EAAAA,Q;AACAe,EAAAA,M;AACAC,EAAAA,K;AACAd,EAAAA,W;AACAgB,EAAAA,Q;AACApB,EAAAA,M;AAEAmB,EAAAA,4B;AACAG,EAAAA,Y;;AAgEF,eAAeR,QAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {CheckboxOff, CheckboxOn, CheckboxSemi} from '../icons/systemicons/SystemIcons';\nimport {COLORS, ComponentTextStyle} from '../styles';\nimport { Size } from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\n\nconst StyledCheckBox = styled.div<{ disabled?: boolean; showWarning?: boolean; selected?: boolean; margin?: string }>`\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 48px;\n min-width: 48px;\n align-items: center;\n\n ${props => (props.margin ? `margin: ${props.margin};` : '')}\n cursor: pointer;\n\n color: ${COLORS.black};\n\n .pointerTransparent {\n pointer-events: none;\n }\n\n .icon {\n margin: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n border-radius: 50%;\n\n svg {\n color: ${props => (props.selected ? COLORS.primary_500 : props.showWarning ? COLORS.warning_400 : COLORS.neutral_600)};\n }\n }\n\n .label {\n user-select: none;\n cursor: inherit;\n }\n\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\n &:not(.disabled):focus {\n outline: none;\n\n .icon {\n background-color: ${COLORS.white};\n box-shadow: 0 0 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n\n svg {\n color: ${COLORS.neutral_600};\n }\n }\n }\n\n &:not(.disabled):hover {\n .icon {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_700};\n }\n }\n }\n\n &:not(.disabled):active {\n .icon {\n background: ${COLORS.primary_100};\n box-shadow: none;\n\n svg {\n color: ${COLORS.primary_800};\n }\n }\n }\n\n &.disabled {\n box-shadow: none;\n cursor: not-allowed;\n\n color: ${COLORS.neutral_300};\n\n .icon,\n .label {\n pointer-events: none;\n }\n\n .icon{\n background-color: ${COLORS.white};\n }\n\n .icon svg {\n color: ${COLORS.neutral_300};\n }\n }\n`;\n\ninterface Props {\n id: string;\n selected: boolean;\n select: (selected: boolean) => void;\n label?: string;\n showWarning?: boolean;\n disabled?: boolean;\n margin?: string;\n size?: Size;\n iconPointerEventsTransparent?: boolean;\n semiSelected?: boolean;\n}\n\nconst Checkbox = React.forwardRef<HTMLDivElement, Props>(({\n id,\n selected,\n select,\n label,\n showWarning,\n iconPointerEventsTransparent,\n disabled,\n margin,\n size,\n semiSelected\n }: Props, ref) => {\n const onKeyPress = (e: any) => {\n if (e.keyCode === 13 && !disabled) {\n select(!selected);\n }\n };\n\n const handleClick = () => {\n if (disabled) {\n return;\n }\n select(!selected);\n };\n\n size = size ?? Size.Medium;\n\n return (\n <StyledCheckBox key={id}\n ref={ref}\n disabled={disabled}\n className={size.toString().toLowerCase().concat(disabled ? ' disabled' : '')}\n selected={selected}\n tabIndex={disabled ? -1 : 0}\n showWarning={showWarning}\n margin={margin}\n onClick={handleClick}\n onKeyDown={onKeyPress}\n onMouseDown={e => e.preventDefault()}>\n <div id={id} className={'icon'}>\n {\n selected\n ? <CheckboxOn className={iconPointerEventsTransparent ? \"pointerTransparent\" : \"\"} size=\"24px\"/>\n : semiSelected\n ? <CheckboxSemi className={iconPointerEventsTransparent ? \"pointerTransparent\" : \"\"} size=\"24px\"/>\n : <CheckboxOff className={iconPointerEventsTransparent ? \"pointerTransparent\" : \"\"} size=\"24px\"/>\n }\n </div>\n {\n label &&\n (\n <label className={'label'}\n htmlFor={id}>\n {label}\n </label>\n )\n }\n </StyledCheckBox>\n );\n});\n\nexport default Checkbox;\n"],"file":"Checkbox.js"}
@@ -2,10 +2,19 @@ import _pt from "prop-types";
2
2
  import React from 'react';
3
3
  import { COLORS } from '../styles/index';
4
4
  import { Search as SearchIcon, Clear as ClearIcon, TechnicalWarning } from '../icons/systemicons/SystemIcons';
5
- import { WarningMessage, InputWrapper, SearchIconWrapper, StyledIcon } from './styling';
5
+ import { WarningMessage, InputWrapper, SearchIconWrapper } from './styling';
6
6
  import { IconButton } from '../Button';
7
7
  import SearchBarInput from './components/SearchBarInput';
8
8
  import SearchField from './components/SearchField';
9
+ import styled from 'styled-components';
10
+ const ClearIconWrapper = styled.div`
11
+ display: flex;
12
+ align-items: center;
13
+
14
+ &.hidden{
15
+ display: none !important;
16
+ }
17
+ `;
9
18
 
10
19
  const SearchBar = ({
11
20
  id,
@@ -36,14 +45,7 @@ const SearchBar = ({
36
45
 
37
46
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InputWrapper, {
38
47
  disabled: disabled,
39
- tabIndex: disabled ? -1 : 0,
40
- margin: margin,
41
- onFocus: e => {
42
- if (!e?.target?.id.includes(id) && !disabled) {
43
- setTabbedHere(true);
44
- inputRef.current.focus();
45
- }
46
- }
48
+ margin: margin
47
49
  }, /*#__PURE__*/React.createElement(SearchField, {
48
50
  id: `${id}_main`,
49
51
  size: size || '',
@@ -51,7 +53,19 @@ const SearchBar = ({
51
53
  disabled: disabled,
52
54
  tabbedHere: tabbedHere,
53
55
  validationMessage: validationMessage
54
- }, /*#__PURE__*/React.createElement(SearchBarInput, {
56
+ }, /*#__PURE__*/React.createElement(SearchIconWrapper, {
57
+ className: size ? size : '',
58
+ "aria-label": performSearchLabel
59
+ }, /*#__PURE__*/React.createElement(IconButton, {
60
+ id: `${id}_Search`,
61
+ variant: "secondary",
62
+ shape: "circular",
63
+ action: enterSearch,
64
+ disabled: disabled,
65
+ onKeyPress: e => isPressingEnter(e) ? enterSearch(e) : null
66
+ }, /*#__PURE__*/React.createElement(SearchIcon, {
67
+ size: "24px"
68
+ }))), /*#__PURE__*/React.createElement(SearchBarInput, {
55
69
  placeholder: disabled ? '' : placeholder,
56
70
  ref: inputRef,
57
71
  id: id,
@@ -62,34 +76,17 @@ const SearchBar = ({
62
76
  searchTerm: searchTerm,
63
77
  onKeyDown: onKeyDown,
64
78
  enterSearch: enterSearch
65
- }), /*#__PURE__*/React.createElement(SearchIconWrapper, {
66
- className: size ? size : '',
67
- role: "button",
68
- "aria-label": performSearchLabel,
69
- tabIndex: disabled ? -1 : 0
70
- }, /*#__PURE__*/React.createElement(IconButton, {
71
- id: `${id}_Search`,
72
- variant: "secondary",
73
- shape: "circular",
74
- action: enterSearch,
75
- onKeyPress: e => isPressingEnter(e) ? enterSearch(e) : null
76
- }, /*#__PURE__*/React.createElement(SearchIcon, {
77
- size: "24px",
78
- color: disabled ? COLORS.neutral_300 : COLORS.neutral_600
79
- }))), /*#__PURE__*/React.createElement(StyledIcon, {
80
- className: size ? size : '',
81
- role: "button",
82
- tabIndex: disabled ? -1 : 0,
83
- hidden: searchTerm === '' || searchTerm === undefined
79
+ }), /*#__PURE__*/React.createElement(ClearIconWrapper, {
80
+ className: (size ? size : '').concat(!searchTerm ? ' hidden' : '')
84
81
  }, /*#__PURE__*/React.createElement(IconButton, {
85
82
  id: `${id}_Clear`,
86
83
  variant: "secondary",
87
84
  shape: "circular",
88
85
  action: removeSearch,
86
+ disabled: disabled,
89
87
  onKeyPress: e => isPressingEnter(e) ? removeSearch(e) : null
90
88
  }, /*#__PURE__*/React.createElement(ClearIcon, {
91
- size: "24px",
92
- color: disabled ? COLORS.neutral_300 : COLORS.neutral_600
89
+ size: "24px"
93
90
  }))))), validationMessage && /*#__PURE__*/React.createElement(WarningMessage, {
94
91
  className: size || ''
95
92
  }, /*#__PURE__*/React.createElement(TechnicalWarning, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/InputFields/SearchBar.tsx"],"names":["React","COLORS","Search","SearchIcon","Clear","ClearIcon","TechnicalWarning","WarningMessage","InputWrapper","SearchIconWrapper","StyledIcon","IconButton","SearchBarInput","SearchField","SearchBar","id","searchTerm","setSearchTerm","enterSearch","removeSearch","placeholder","performSearchLabel","disabled","validationMessage","onKeyDown","size","margin","inputRef","useRef","tabbedHere","setTabbedHere","useState","isPressingEnter","e","key","preventDefault","stopPropagation","target","includes","current","focus","term","neutral_300","neutral_600","undefined","warning_400"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,MAAM,IAAIC,UAAnB,EAA+BC,KAAK,IAAIC,SAAxC,EAAmDC,gBAAnD,QAA2E,kCAA3E;AACA,SAASC,cAAT,EAAyBC,YAAzB,EAAuCC,iBAAvC,EAA0DC,UAA1D,QAA4E,WAA5E;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,WAAP,MAAwB,0BAAxB;;AAiBA,MAAMC,SAAiD,GAAG,CAAC;AACzDC,EAAAA,EADyD;AAEzDC,EAAAA,UAFyD;AAGzDC,EAAAA,aAHyD;AAIzDC,EAAAA,WAJyD;AAKzDC,EAAAA,YALyD;AAMzDC,EAAAA,WANyD;AAOzDC,EAAAA,kBAPyD;AAQzDC,EAAAA,QARyD;AASzDC,EAAAA,iBATyD;AAUzDC,EAAAA,SAVyD;AAWzDC,EAAAA,IAXyD;AAYzDC,EAAAA,MAAM,GAAG;AAZgD,CAAD,KAapD;AACJ,QAAMC,QAAQ,GAAG3B,KAAK,CAAC4B,MAAN,CAAkB,IAAlB,CAAjB;AACA,QAAM,CAACC,UAAD,EAAaC,aAAb,IAA8B9B,KAAK,CAAC+B,QAAN,CAAwB,KAAxB,CAApC;;AAEA,QAAMC,eAAe,GAAIC,CAAD,IAAY;AAClC,QAAIA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AAQ,GAAGrB,MAAM,CAACyC,WAAV,GAAwBzC,MAAM,CAAC0C;AAArE,IADF,CADF,CAlBF,CAVF,CADF,EAoCGpB,iBAAiB,iBAChB,oBAAC,cAAD;AAAgB,IAAA,SAAS,EAAEE,IAAI,IAAI;AAAnC,kBACE,oBAAC,gBAAD;AAAkB,IAAA,KAAK,EAAExB,MAAM,CAAC4C,WAAhC;AAA6C,IAAA,SAAS,EAAEpB,IAAI,IAAI;AAAhE,IADF,eAEE,kCAAOF,iBAAP,CAFF,CArCJ,CADF;AA6CD,CAvED;;;AAdER,EAAAA,E;AACAC,EAAAA,U;AACAC,EAAAA,a;AACAC,EAAAA,W;AACAC,EAAAA,Y;AACAC,EAAAA,W;AACAC,EAAAA,kB;AACAC,EAAAA,Q;AACAC,EAAAA,iB;AACAC,EAAAA,S;AACAC,EAAAA,I,aAAO,O,EAAU,Q;AACjBC,EAAAA,M;;AA4EF,eAAeZ,SAAf","sourcesContent":["import React from 'react';\nimport { COLORS } from '../styles/index';\nimport { Search as SearchIcon, Clear as ClearIcon, TechnicalWarning } from '../icons/systemicons/SystemIcons';\nimport { WarningMessage, InputWrapper, SearchIconWrapper, StyledIcon } from './styling';\nimport { IconButton } from '../Button';\nimport SearchBarInput from './components/SearchBarInput';\nimport SearchField from './components/SearchField';\n\ntype SeachBarProps = {\n id: string;\n searchTerm?: string;\n setSearchTerm: (term: string) => void;\n enterSearch: (e: any) => void;\n removeSearch: (e: any) => void;\n placeholder?: string;\n performSearchLabel?: string;\n disabled?: boolean;\n validationMessage?: string;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n size?: 'small' | 'medium';\n margin?: string;\n};\n\nconst SearchBar: React.FunctionComponent<SeachBarProps> = ({\n id,\n searchTerm,\n setSearchTerm,\n enterSearch,\n removeSearch,\n placeholder,\n performSearchLabel,\n disabled,\n validationMessage,\n onKeyDown,\n size,\n margin = '4px 0',\n}) => {\n const inputRef = React.useRef<any>(null);\n const [tabbedHere, setTabbedHere] = React.useState<boolean>(false);\n\n const isPressingEnter = (e: any) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n return (\n <>\n <InputWrapper\n disabled={disabled}\n tabIndex={disabled ? -1 : 0}\n margin={margin}\n onFocus={(e: any) => {\n if (!e?.target?.id.includes(id) && !disabled) {\n setTabbedHere(true);\n inputRef.current.focus();\n }\n }}>\n <SearchField id={`${id}_main`} size={size || ''} searchTerm={searchTerm} disabled={disabled} tabbedHere={tabbedHere} validationMessage={validationMessage}>\n <SearchBarInput\n placeholder={disabled ? '' : placeholder}\n ref={inputRef}\n id={id}\n size={size}\n disabled={disabled}\n setTabbedHere={setTabbedHere}\n setSearchTerm={(term: string) => setSearchTerm(term)}\n searchTerm={searchTerm}\n onKeyDown={onKeyDown}\n enterSearch={enterSearch}\n />\n <SearchIconWrapper className={size ? size : ''} role=\"button\" aria-label={performSearchLabel} tabIndex={disabled ? -1 : 0}>\n <IconButton id={`${id}_Search`} variant=\"secondary\" shape=\"circular\" action={enterSearch} onKeyPress={(e: any) => (isPressingEnter(e) ? enterSearch(e) : null)}>\n <SearchIcon size=\"24px\" color={disabled ? COLORS.neutral_300 : COLORS.neutral_600} />\n </IconButton>\n </SearchIconWrapper>\n <StyledIcon className={size ? size : ''} role=\"button\" tabIndex={disabled ? -1 : 0} hidden={searchTerm === '' || searchTerm === undefined}>\n <IconButton id={`${id}_Clear`} variant=\"secondary\" shape=\"circular\" action={removeSearch} onKeyPress={(e: any) => (isPressingEnter(e) ? removeSearch(e) : null)}>\n <ClearIcon size=\"24px\" color={disabled ? COLORS.neutral_300 : COLORS.neutral_600} />\n </IconButton>\n </StyledIcon>\n </SearchField>\n </InputWrapper>\n {validationMessage && (\n <WarningMessage className={size || ''}>\n <TechnicalWarning color={COLORS.warning_400} className={size || ''} />\n <span>{validationMessage}</span>\n </WarningMessage>\n )}\n </>\n );\n};\n\nexport default SearchBar;\n"],"file":"SearchBar.js"}
1
+ {"version":3,"sources":["../../../src/InputFields/SearchBar.tsx"],"names":["React","COLORS","Search","SearchIcon","Clear","ClearIcon","TechnicalWarning","WarningMessage","InputWrapper","SearchIconWrapper","IconButton","SearchBarInput","SearchField","styled","ClearIconWrapper","div","SearchBar","id","searchTerm","setSearchTerm","enterSearch","removeSearch","placeholder","performSearchLabel","disabled","validationMessage","onKeyDown","size","margin","inputRef","useRef","tabbedHere","setTabbedHere","useState","isPressingEnter","e","key","preventDefault","stopPropagation","term","concat","warning_400"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,MAAM,IAAIC,UAAnB,EAA+BC,KAAK,IAAIC,SAAxC,EAAmDC,gBAAnD,QAA2E,kCAA3E;AACA,SAASC,cAAT,EAAyBC,YAAzB,EAAuCC,iBAAvC,QAA4E,WAA5E;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,WAAP,MAAwB,0BAAxB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAiBA,MAAMC,gBAAgB,GAAGD,MAAM,CAACE,GAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,CAPA;;AASA,MAAMC,SAAiD,GAAG,CAAC;AACzDC,EAAAA,EADyD;AAEzDC,EAAAA,UAFyD;AAGzDC,EAAAA,aAHyD;AAIzDC,EAAAA,WAJyD;AAKzDC,EAAAA,YALyD;AAMzDC,EAAAA,WANyD;AAOzDC,EAAAA,kBAPyD;AAQzDC,EAAAA,QARyD;AASzDC,EAAAA,iBATyD;AAUzDC,EAAAA,SAVyD;AAWzDC,EAAAA,IAXyD;AAYzDC,EAAAA,MAAM,GAAG;AAZgD,CAAD,KAapD;AACJ,QAAMC,QAAQ,GAAG7B,KAAK,CAAC8B,MAAN,CAAkB,IAAlB,CAAjB;AACA,QAAM,CAACC,UAAD,EAAaC,aAAb,IAA8BhC,KAAK,CAACiC,QAAN,CAAwB,KAAxB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'react';\nimport { COLORS } from '../styles/index';\nimport { Search as SearchIcon, Clear as ClearIcon, TechnicalWarning } from '../icons/systemicons/SystemIcons';\nimport { WarningMessage, InputWrapper, SearchIconWrapper, StyledIcon } from './styling';\nimport { IconButton } from '../Button';\nimport SearchBarInput from './components/SearchBarInput';\nimport SearchField from './components/SearchField';\nimport styled from 'styled-components';\n\ntype SeachBarProps = {\n id: string;\n searchTerm?: string;\n setSearchTerm: (term: string) => void;\n enterSearch: (e: any) => void;\n removeSearch: (e: any) => void;\n placeholder?: string;\n performSearchLabel?: string;\n disabled?: boolean;\n validationMessage?: string;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n size?: 'small' | 'medium';\n margin?: string;\n};\n\nconst ClearIconWrapper = styled.div`\n display: flex;\n align-items: center;\n \n &.hidden{\n display: none !important;\n }\n`;\n\nconst SearchBar: React.FunctionComponent<SeachBarProps> = ({\n id,\n searchTerm,\n setSearchTerm,\n enterSearch,\n removeSearch,\n placeholder,\n performSearchLabel,\n disabled,\n validationMessage,\n onKeyDown,\n size,\n margin = '4px 0',\n}) => {\n const inputRef = React.useRef<any>(null);\n const [tabbedHere, setTabbedHere] = React.useState<boolean>(false);\n\n const isPressingEnter = (e: any) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n return (\n <>\n <InputWrapper\n disabled={disabled}\n margin={margin}>\n <SearchField id={`${id}_main`} size={size || ''} searchTerm={searchTerm} disabled={disabled} tabbedHere={tabbedHere} validationMessage={validationMessage}>\n <SearchIconWrapper className={size ? size : ''} aria-label={performSearchLabel}>\n <IconButton id={`${id}_Search`}\n variant=\"secondary\"\n shape=\"circular\"\n action={enterSearch}\n disabled={disabled}\n onKeyPress={(e: any) => (isPressingEnter(e) ? enterSearch(e) : null)}>\n <SearchIcon size=\"24px\"/>\n </IconButton>\n </SearchIconWrapper>\n <SearchBarInput\n placeholder={disabled ? '' : placeholder}\n ref={inputRef}\n id={id}\n size={size}\n disabled={disabled}\n setTabbedHere={setTabbedHere}\n setSearchTerm={(term: string) => setSearchTerm(term)}\n searchTerm={searchTerm}\n onKeyDown={onKeyDown}\n enterSearch={enterSearch}\n />\n <ClearIconWrapper className={(size ? size : '').concat(!searchTerm ? ' hidden' : '')}>\n <IconButton id={`${id}_Clear`}\n variant=\"secondary\"\n shape=\"circular\"\n action={removeSearch}\n disabled={disabled}\n onKeyPress={(e: any) => (isPressingEnter(e) ? removeSearch(e) : null)}>\n <ClearIcon size=\"24px\"/>\n </IconButton>\n </ClearIconWrapper>\n </SearchField>\n </InputWrapper>\n {validationMessage && (\n <WarningMessage className={size || ''}>\n <TechnicalWarning color={COLORS.warning_400} className={size || ''} />\n <span>{validationMessage}</span>\n </WarningMessage>\n )}\n </>\n );\n};\n\nexport default SearchBar;\n"],"file":"SearchBar.js"}
@@ -28,7 +28,7 @@ const NotificationDot = ({
28
28
  }, /*#__PURE__*/React.createElement(Content, {
29
29
  size: size,
30
30
  variant: variant,
31
- "data-testId": testId
31
+ "data-testid": testId
32
32
  }));
33
33
  };
34
34
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/NotificationDot/NotificationDot.tsx"],"names":["React","styled","COLORS","ContentWrapper","div","props","size","Content","variant","correct_500","critical_500","white","NotificationDot","testId"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,MAAR,QAAqB,IAArB;AAQA,MAAMC,cAAc,GAAGF,MAAM,CAACG,GAAuB;AACrD,WAAYC,KAAD,IAAWA,KAAK,CAACC,IAAN,KAAe,OAAf,GAAyB,MAAzB,GAAmCD,KAAK,CAACC,IAAN,KAAe,OAAf,GAAyB,MAAzB,GAAkC,MAAQ;AACnG,YAAaD,KAAD,IAAWA,KAAK,CAACC,IAAN,KAAe,OAAf,GAAyB,MAAzB,GAAmCD,KAAK,CAACC,IAAN,KAAe,OAAf,GAAyB,MAAzB,GAAkC,MAAQ;A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,EAAEE,OAA9B;AAAuC,mBAAaK;AAApD,IADF,CADF;AAKD,CAND;;;AArBEP,EAAAA,I;AACAE,EAAAA,O,aAAS,U,EAAa,U;AACtBK,EAAAA,M;;AA2BF,eAAeD,eAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {COLORS} from '..';\n\nexport interface NotificationProps {\n size?: string;\n variant: 'critical' | 'positive';\n testId?: string;\n}\n\nconst ContentWrapper = styled.div<NotificationProps>`\n width: ${(props) => props.size === 'small' ? '16px' : (props.size === 'large' ? '24px' : '20px')};\n height: ${(props) => props.size === 'small' ? '16px' : (props.size === 'large' ? '24px' : '20px')};\n padding: ${(props) => props.size === 'small' ? '3px' : (props.size === 'large' ? '4px' : '4px')};\n box-sizing: border-box;\n`;\n\nconst Content = styled.div<NotificationProps>`\n background-color: ${(props) => props.variant === 'positive' ? COLORS.correct_500 : COLORS.critical_500};\n height: ${(props) => props.size === 'small' ? '10px' : (props.size === 'large' ? '16px' : '12px')};\n width: ${(props) => props.size === 'small' ? '10px' : (props.size === 'large' ? '16px' : '12px')};\n border-radius: ${(props) => props.size === 'small' ? '10px' : (props.size === 'large' ? '16px' : '12px')};\n border: ${(props) => props.size === 'small' ? '2px solid ' + COLORS.white : (props.size === 'large' ? '3px solid ' + COLORS.white : '2px solid ' + COLORS.white)};\n box-sizing: border-box;\n`;\n\nconst NotificationDot: React.FunctionComponent<NotificationProps> = ({size = 'medium', variant, testId}) => {\n return (\n <ContentWrapper size={size} variant={variant}>\n <Content size={size} variant={variant} data-testId={testId}/>\n </ContentWrapper>\n );\n};\n\nexport default NotificationDot;\n"],"file":"NotificationDot.js"}
1
+ {"version":3,"sources":["../../../src/NotificationDot/NotificationDot.tsx"],"names":["React","styled","COLORS","ContentWrapper","div","props","size","Content","variant","correct_500","critical_500","white","NotificationDot","testId"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,M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,KAA/C,GAAuD,eAAeT,MAAM,CAACS,KAAO;AACnK;AACA,CAPA;;AASA,MAAMC,eAA2D,GAAG,CAAC;AAACN,EAAAA,IAAI,GAAG,QAAR;AAAkBE,EAAAA,OAAlB;AAA2BK,EAAAA;AAA3B,CAAD,KAAwC;AAC1G,sBACE,oBAAC,cAAD;AAAgB,IAAA,IAAI,EAAEP,IAAtB;AAA4B,IAAA,OAAO,EAAEE;AAArC,kBACE,oBAAC,OAAD;AAAS,IAAA,IAAI,EAAEF,IAAf;AAAqB,IAAA,OAAO,EAAEE,OAA9B;AAAuC,mBAAaK;AAApD,IADF,CADF;AAKD,CAND;;;AArBEP,EAAAA,I;AACAE,EAAAA,O,aAAS,U,EAAa,U;AACtBK,EAAAA,M;;AA2BF,eAAeD,eAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {COLORS} from '..';\n\nexport interface NotificationProps {\n size?: string;\n variant: 'critical' | 'positive';\n testId?: string;\n}\n\nconst ContentWrapper = styled.div<NotificationProps>`\n width: ${(props) => props.size === 'small' ? '16px' : (props.size === 'large' ? '24px' : '20px')};\n height: ${(props) => props.size === 'small' ? '16px' : (props.size === 'large' ? '24px' : '20px')};\n padding: ${(props) => props.size === 'small' ? '3px' : (props.size === 'large' ? '4px' : '4px')};\n box-sizing: border-box;\n`;\n\nconst Content = styled.div<NotificationProps>`\n background-color: ${(props) => props.variant === 'positive' ? COLORS.correct_500 : COLORS.critical_500};\n height: ${(props) => props.size === 'small' ? '10px' : (props.size === 'large' ? '16px' : '12px')};\n width: ${(props) => props.size === 'small' ? '10px' : (props.size === 'large' ? '16px' : '12px')};\n border-radius: ${(props) => props.size === 'small' ? '10px' : (props.size === 'large' ? '16px' : '12px')};\n border: ${(props) => props.size === 'small' ? '2px solid ' + COLORS.white : (props.size === 'large' ? '3px solid ' + COLORS.white : '2px solid ' + COLORS.white)};\n box-sizing: border-box;\n`;\n\nconst NotificationDot: React.FunctionComponent<NotificationProps> = ({size = 'medium', variant, testId}) => {\n return (\n <ContentWrapper size={size} variant={variant}>\n <Content size={size} variant={variant} data-testid={testId}/>\n </ContentWrapper>\n );\n};\n\nexport default NotificationDot;\n"],"file":"NotificationDot.js"}
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import 'jest-styled-components';
4
+ import { NotificationDot } from '..';
5
+ import COLORS from '../../styles/colors';
6
+ describe('<NotificationDot />', () => {
7
+ it('renders positive small notification dot', async () => {
8
+ const {
9
+ getByTestId
10
+ } = render( /*#__PURE__*/React.createElement(NotificationDot, {
11
+ variant: "positive",
12
+ size: "small",
13
+ testId: "testId"
14
+ }));
15
+ expect(getByTestId('testId')).toHaveStyleRule('background-color', COLORS.correct_500);
16
+ expect(getByTestId('testId')).toHaveStyleRule('border', '2px solid ' + COLORS.white);
17
+ });
18
+ it('renders critical large notification dot', async () => {
19
+ const {
20
+ getByTestId
21
+ } = render( /*#__PURE__*/React.createElement(NotificationDot, {
22
+ variant: "critical",
23
+ size: "large",
24
+ testId: "testId"
25
+ }));
26
+ expect(getByTestId('testId')).toHaveStyleRule('background-color', COLORS.critical_500);
27
+ expect(getByTestId('testId')).toHaveStyleRule('border', '3px solid ' + COLORS.white);
28
+ });
29
+ it('renders critical medium notification dot', async () => {
30
+ const {
31
+ getByTestId
32
+ } = render( /*#__PURE__*/React.createElement(NotificationDot, {
33
+ variant: "critical",
34
+ testId: "testId"
35
+ }));
36
+ expect(getByTestId('testId')).toHaveStyleRule('background-color', COLORS.critical_500);
37
+ expect(getByTestId('testId')).toHaveStyleRule('border', '2px solid ' + COLORS.white);
38
+ });
39
+ });
40
+ //# sourceMappingURL=NotificationDot.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/NotificationDot/__tests__/NotificationDot.test.tsx"],"names":["React","render","NotificationDot","COLORS","describe","it","getByTestId","expect","toHaveStyleRule","correct_500","white","critical_500"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAC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,OAAO,EAAC,UAAzB;AAAoC,MAAA,MAAM,EAAC;AAA3C,MADuB,CAA3B;AAGAM,IAAAA,MAAM,CAACD,WAAW,CAAC,QAAD,CAAZ,CAAN,CAA8BE,eAA9B,CAA8C,kBAA9C,EAAiEL,MAAM,CAACQ,YAAxE;AACAJ,IAAAA,MAAM,CAACD,WAAW,CAAC,QAAD,CAAZ,CAAN,CAA8BE,eAA9B,CAA8C,QAA9C,EAAwD,eAAeL,MAAM,CAACO,KAA9E;AACH,GANC,CAAF;AAOH,CAxBO,CAAR","sourcesContent":["import React from 'react';\nimport { render } from '@testing-library/react';\nimport 'jest-styled-components';\nimport { NotificationDot } from '..';\nimport COLORS from '../../styles/colors';\n\ndescribe('<NotificationDot />',()=>{\n it('renders positive small notification dot', async () => {\n const{getByTestId} = render(\n <NotificationDot variant='positive' size='small' testId='testId'/>\n );\n expect(getByTestId('testId')).toHaveStyleRule('background-color',COLORS.correct_500);\n expect(getByTestId('testId')).toHaveStyleRule('border', '2px solid ' + COLORS.white);\n });\n\n it('renders critical large notification dot', async () => {\n const{getByTestId} = render(\n <NotificationDot variant='critical' size='large' testId='testId'/>\n );\n expect(getByTestId('testId')).toHaveStyleRule('background-color',COLORS.critical_500);\n expect(getByTestId('testId')).toHaveStyleRule('border', '3px solid ' + COLORS.white);\n });\n\n it('renders critical medium notification dot', async () => {\n const{getByTestId} = render(\n <NotificationDot variant='critical' testId='testId'/>\n );\n expect(getByTestId('testId')).toHaveStyleRule('background-color',COLORS.critical_500);\n expect(getByTestId('testId')).toHaveStyleRule('border', '2px solid ' + COLORS.white);\n });\n});"],"file":"NotificationDot.test.js"}
@@ -3,8 +3,10 @@ import * as React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { NavLink } from 'react-router-dom';
5
5
  import { BREAKPOINTS, COLORS, ComponentTextStyle } from '../styles';
6
- import { ChevronLeft, ChevronRight, MoreHorizontal } from '../icons/systemicons/SystemIcons';
6
+ import { ChevronLeft, ChevronRight } from '../icons/systemicons/SystemIcons';
7
7
  import { ComponentMStyling } from '../styles/typography';
8
+ import { useHistory } from 'react-router';
9
+ import { IconButton } from '../Button';
8
10
  const Container = styled.nav`
9
11
  margin: 20px 0;
10
12
  display: flex;
@@ -22,7 +24,7 @@ const Items = styled.ul`
22
24
  `;
23
25
  const Item = styled.li`
24
26
  width: 48px;
25
- height: 45px;
27
+ height: 48px;
26
28
  display: flex;
27
29
  align-items: center;
28
30
  justify-content: center;
@@ -34,7 +36,6 @@ const Item = styled.li`
34
36
  width: 100%;
35
37
  height: 100%;
36
38
  text-decoration: none;
37
- border-bottom: 3px solid transparent;
38
39
 
39
40
  ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}
40
41
 
@@ -42,9 +43,9 @@ const Item = styled.li`
42
43
  &:focus-within {
43
44
  box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2e7fa1;
44
45
  outline-width: 0;
46
+ z-index: 1;
45
47
  }
46
48
  }
47
-
48
49
  & > a:hover {
49
50
  color: ${COLORS.primary_800};
50
51
  background-color: ${COLORS.primary_20};
@@ -55,7 +56,6 @@ const Item = styled.li`
55
56
  background-color: ${COLORS.primary_100};
56
57
  box-shadow: none;
57
58
  }
58
-
59
59
  & > a.active {
60
60
  color: ${COLORS.neutral_800};
61
61
  background-color: ${COLORS.neutral_20};
@@ -72,22 +72,36 @@ const Item = styled.li`
72
72
  }
73
73
  `;
74
74
  const Dots = styled(Item)`
75
- padding-top: 1%;
76
75
  cursor: not-allowed;
76
+ &:after{
77
+ ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}
78
+ content: '...';
79
+ }
77
80
  `;
78
81
  const ItemContent = styled('div')`
79
- width: 100%;
80
82
  text-align:center;
81
- display: table-cell;
82
- vertical-align:middle;
83
- `;
84
- const ItemSelected = styled('div')`
83
+ display: flex;
85
84
  justify-content: center;
86
- margin: 0 20%;
87
- border-radius: 4px;
88
- text-align: center;
89
- height: 4px;
90
- background-color: ${COLORS.primary_500}
85
+ align-items: center;
86
+ position: relative;
87
+ width: 100%;
88
+ height: 100%;
89
+
90
+ &.active:after{
91
+ content: '';
92
+ position: absolute;
93
+ bottom: 4px;
94
+ width: 32px;
95
+ border-radius: 4px;
96
+ height: 4px;
97
+ background-color: ${COLORS.primary_500}
98
+ }
99
+ &.active:hover:after{
100
+ background-color: ${COLORS.primary_700}
101
+ }
102
+ &.active:active:after{
103
+ background-color: ${COLORS.primary_800}
104
+ }
91
105
  `;
92
106
 
93
107
  const Step = ({
@@ -96,30 +110,22 @@ const Step = ({
96
110
  disabled = false,
97
111
  page,
98
112
  onPageChange,
99
- testId
113
+ id
100
114
  }) => {
101
- if (disabled) return /*#__PURE__*/React.createElement(Item, {
102
- style: {
103
- cursor: 'not-allowed'
104
- },
105
- "data-testid": `${testId}_Disabled`
106
- }, up ? /*#__PURE__*/React.createElement(ChevronRight, {
107
- size: "20",
108
- color: COLORS.neutral_300
109
- }) : /*#__PURE__*/React.createElement(ChevronLeft, {
110
- size: "20",
111
- color: COLORS.neutral_300
112
- }));
113
- return /*#__PURE__*/React.createElement(Item, {
114
- "data-testid": `${testId}_Enabled`
115
- }, /*#__PURE__*/React.createElement(NavLink, {
116
- to: target,
117
- onClick: () => {
118
- if (onPageChange) onPageChange(page);
119
- }
120
- }, up ? /*#__PURE__*/React.createElement(ChevronRight, {
121
- size: "20"
122
- }) : /*#__PURE__*/React.createElement(ChevronLeft, null)));
115
+ const history = useHistory();
116
+
117
+ const handleButtonClick = () => {
118
+ history.push(target);
119
+ onPageChange && onPageChange(page);
120
+ };
121
+
122
+ return /*#__PURE__*/React.createElement(IconButton, {
123
+ id: id,
124
+ action: event => handleButtonClick(),
125
+ variant: 'secondary',
126
+ shape: 'circular',
127
+ disabled: disabled
128
+ }, up ? /*#__PURE__*/React.createElement(ChevronRight, null) : /*#__PURE__*/React.createElement(ChevronLeft, null));
123
129
  };
124
130
 
125
131
  const Paginator = ({
@@ -159,29 +165,31 @@ const Paginator = ({
159
165
  onPageChange: () => {
160
166
  if (onPageChange) onPageChange(currentPage - 1);
161
167
  },
162
- testId: "Test-StepLeft"
168
+ id: "paginator-left"
163
169
  }), pages.findIndex(item => item === 1) === -1 && /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement(NavLink, {
164
170
  to: `${baseUrl}/1`,
165
171
  onClick: () => {
166
172
  if (onPageChange) onPageChange(1);
167
173
  }
168
- }, /*#__PURE__*/React.createElement(ItemContent, null, /*#__PURE__*/React.createElement("span", null, "1"), currentPage === 1 && /*#__PURE__*/React.createElement(ItemSelected, null)))), currentPage >= 4 && pageCount > 5 && pageCount && pages.findIndex(item => item === 1) === -1 && /*#__PURE__*/React.createElement(Dots, null, /*#__PURE__*/React.createElement(MoreHorizontal, {
169
- color: COLORS.neutral_600
170
- })), pages.map(page => /*#__PURE__*/React.createElement(Item, {
174
+ }, /*#__PURE__*/React.createElement(ItemContent, {
175
+ className: currentPage === 1 ? 'active' : ''
176
+ }, /*#__PURE__*/React.createElement("span", null, "1")))), currentPage >= 4 && pageCount > 5 && pageCount && pages.findIndex(item => item === 1) === -1 && /*#__PURE__*/React.createElement(Dots, null), pages.map(page => /*#__PURE__*/React.createElement(Item, {
171
177
  key: page
172
178
  }, /*#__PURE__*/React.createElement(NavLink, {
173
179
  to: `${baseUrl}/${page}`,
174
180
  onClick: () => {
175
181
  if (onPageChange) onPageChange(page);
176
182
  }
177
- }, /*#__PURE__*/React.createElement(ItemContent, null, /*#__PURE__*/React.createElement("span", null, page), currentPage === page && /*#__PURE__*/React.createElement(ItemSelected, null))))), pageCount > 5 && currentPage <= pageCount - 3 && /*#__PURE__*/React.createElement(Dots, null, /*#__PURE__*/React.createElement(MoreHorizontal, {
178
- color: COLORS.neutral_600
179
- })), pages.findIndex(item => item === pageCount) === -1 && pageCount !== 1 && /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement(NavLink, {
183
+ }, /*#__PURE__*/React.createElement(ItemContent, {
184
+ className: currentPage === page ? 'active' : ''
185
+ }, /*#__PURE__*/React.createElement("span", null, page))))), pageCount > 5 && currentPage <= pageCount - 3 && /*#__PURE__*/React.createElement(Dots, null), pages.findIndex(item => item === pageCount) === -1 && pageCount !== 1 && /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement(NavLink, {
180
186
  to: `${baseUrl}/${pageCount}`,
181
187
  onClick: () => {
182
188
  if (onPageChange) onPageChange(pageCount);
183
189
  }
184
- }, /*#__PURE__*/React.createElement(ItemContent, null, /*#__PURE__*/React.createElement("span", null, pageCount), currentPage === pageCount && /*#__PURE__*/React.createElement(ItemSelected, null)))), /*#__PURE__*/React.createElement(Step, {
190
+ }, /*#__PURE__*/React.createElement(ItemContent, {
191
+ className: currentPage === pageCount ? 'active' : ''
192
+ }, /*#__PURE__*/React.createElement("span", null, pageCount)))), /*#__PURE__*/React.createElement(Step, {
185
193
  up: true,
186
194
  target: `${baseUrl}/${currentPage + 1}`,
187
195
  page: currentPage + 1,
@@ -189,7 +197,7 @@ const Paginator = ({
189
197
  onPageChange: () => {
190
198
  if (onPageChange) onPageChange(currentPage + 1);
191
199
  },
192
- testId: "Test-StepRight"
200
+ id: "paginator-right"
193
201
  })));
194
202
  };
195
203