@ntbjs/react-components 2.0.2-rc.2 → 2.0.2-rc.3

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 (23) hide show
  1. package/build/inputs/ActionButton/ActionButton.js +9 -5
  2. package/build/inputs/ActionButton/ActionButton.js.map +1 -1
  3. package/build/inputs/ActionButton/ActionButton.styled.js +16 -13
  4. package/build/inputs/ActionButton/ActionButton.styled.js.map +1 -1
  5. package/build/inputs/CompactTextInput/CompactTextInput.js +59 -72
  6. package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
  7. package/build/inputs/CompactTextInput/CompactTextInput.styled.js +141 -226
  8. package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
  9. package/build/inputs/TextArea/TextArea.js +67 -77
  10. package/build/inputs/TextArea/TextArea.js.map +1 -1
  11. package/build/inputs/TextArea/TextArea.styled.js +179 -220
  12. package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
  13. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +20 -26
  14. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
  15. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +19 -15
  16. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
  17. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js +18 -16
  18. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js.map +1 -1
  19. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js +75 -34
  20. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js.map +1 -1
  21. package/build/widgets/Instructions/Instructions.js +0 -9
  22. package/build/widgets/Instructions/Instructions.js.map +1 -1
  23. package/package.json +1 -1
@@ -10,15 +10,17 @@ const ActionButton = React__default.forwardRef(function ActionButton({
10
10
  onClick,
11
11
  actionWidthHeight,
12
12
  backgroundColors,
13
+ useShadow,
13
14
  ...props
14
15
  }, forwardedRef) {
15
16
  return React__default.createElement(ActionButton$1, _extends({
16
17
  ref: forwardedRef,
17
18
  disabled: disabled,
18
- active: active,
19
+ $active: active,
19
20
  onClick: onClick,
20
- actionWidthHeight: actionWidthHeight,
21
- backgroundColors: backgroundColors
21
+ $actionWidthHeight: actionWidthHeight,
22
+ $backgroundColors: backgroundColors,
23
+ $useShadow: useShadow
22
24
  }, props), icon);
23
25
  });
24
26
  ActionButton.propTypes = process.env.NODE_ENV !== "production" ? {
@@ -27,11 +29,13 @@ ActionButton.propTypes = process.env.NODE_ENV !== "production" ? {
27
29
  active: PropTypes.bool,
28
30
  onClick: PropTypes.func,
29
31
  backgroundColors: PropTypes.arrayOf(PropTypes.string),
30
- actionWidthHeight: PropTypes.array
32
+ actionWidthHeight: PropTypes.array,
33
+ useShadow: PropTypes.bool
31
34
  } : {};
32
35
  ActionButton.defaultProps = {
33
36
  onClick: () => {},
34
- actionWidthHeight: [40, 40]
37
+ actionWidthHeight: [40, 40],
38
+ useShadow: false
35
39
  };
36
40
 
37
41
  export { ActionButton as default };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButton.js","sources":["../../../src/components/inputs/ActionButton/ActionButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport * as S from './ActionButton.styled';\n\n/**\n * An action button.\n *\n * ### Import\n *\n * ``` js\n * import { ActionButton } from '@ntbjs/react-components/inputs'\n * // or\n * import ActionButton from '@ntbjs/react-components/inputs/ActionButton'\n * ```\n *\n * ### Props\n * ```\n * Pass `icon={<svg></svg>}` to display an icon.\n * Pass `disabled={true}` to disable the button.\n * Pass `active={true}` to lock the hover state of the button.\n * Pass `onClick={() => {}}` to add an on-click effect.\n * Pass `backgroundColors={[#ffffff, #000000]}` to set the background color of the button\n * ```\n */\nconst ActionButton = React.forwardRef(function ActionButton(\n { icon, disabled, active, onClick, actionWidthHeight, backgroundColors, ...props },\n forwardedRef\n) {\n return (\n <S.ActionButton\n ref={forwardedRef}\n disabled={disabled}\n active={active}\n onClick={onClick}\n actionWidthHeight={actionWidthHeight}\n backgroundColors={backgroundColors}\n {...props}\n >\n {icon}\n </S.ActionButton>\n );\n});\n\nActionButton.propTypes = {\n /**\n * Icon element – e.g: `icon={<SvgAddCircle />}`\n */\n icon: PropTypes.element.isRequired,\n /**\n * Disable the action button\n */\n disabled: PropTypes.bool,\n /**\n * Locks the hover state of the `ActionButton` – this prop only affects the visual appearance of the\n * `ActionButton`\n */\n active: PropTypes.bool,\n /**\n * On-click effect for the action button\n */\n onClick: PropTypes.func,\n /**\n * Color of the button background as an array of [darkThemeColor, lightThemeColor]\n */\n backgroundColors: PropTypes.arrayOf(PropTypes.string),\n /**\n * Width and Height of the Action Button [50, 50]\n */\n actionWidthHeight: PropTypes.array\n};\n\nActionButton.defaultProps = {\n onClick: () => {},\n actionWidthHeight: [40, 40]\n};\n\nexport default ActionButton;\n"],"names":["ActionButton","React","forwardRef","icon","disabled","active","onClick","actionWidthHeight","backgroundColors","props","forwardedRef","createElement","S","_extends","ref","propTypes","process","env","NODE_ENV","PropTypes","element","isRequired","bool","func","arrayOf","string","array","defaultProps"],"mappings":";;;;;AAwBMA,MAAAA,YAAY,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CACzD;EAAEG,IAAI;EAAEC,QAAQ;EAAEC,MAAM;EAAEC,OAAO;EAAEC,iBAAiB;EAAEC,gBAAgB;EAAE,GAAGC,KAAAA;AAAM,CAAC,EAClFC,YAAY,EACZ;EACA,OACET,cAAA,CAAAU,aAAA,CAACC,cAAc,EAAAC,QAAA,CAAA;AACbC,IAAAA,GAAG,EAAEJ,YAAa;AAClBN,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,iBAAiB,EAAEA,iBAAkB;AACrCC,IAAAA,gBAAgB,EAAEA,gBAAAA;GACdC,EAAAA,KAAK,CAERN,EAAAA,IACa,CAAC,CAAA;AAErB,CAAC,EAAC;AAEFH,YAAY,CAACe,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAG,YAAA,GAAA;AAIvBf,EAAAA,IAAI,EAAEgB,SAAS,CAACC,OAAO,CAACC,UAAU;EAIlCjB,QAAQ,EAAEe,SAAS,CAACG,IAAI;EAKxBjB,MAAM,EAAEc,SAAS,CAACG,IAAI;EAItBhB,OAAO,EAAEa,SAAS,CAACI,IAAI;EAIvBf,gBAAgB,EAAEW,SAAS,CAACK,OAAO,CAACL,SAAS,CAACM,MAAM,CAAC;EAIrDlB,iBAAiB,EAAEY,SAAS,CAACO,KAAAA;AAC/B,CAAC,GAAA,EAAA,CAAA;AAED1B,YAAY,CAAC2B,YAAY,GAAG;AAC1BrB,EAAAA,OAAO,EAAEA,MAAM,EAAE;AACjBC,EAAAA,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAA;AAC5B,CAAC;;;;"}
1
+ {"version":3,"file":"ActionButton.js","sources":["../../../src/components/inputs/ActionButton/ActionButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport * as S from './ActionButton.styled';\n\n/**\n * An action button.\n *\n * ### Import\n *\n * ``` js\n * import { ActionButton } from '@ntbjs/react-components/inputs'\n * // or\n * import ActionButton from '@ntbjs/react-components/inputs/ActionButton'\n * ```\n *\n * ### Props\n * ```\n * Pass `icon={<svg></svg>}` to display an icon.\n * Pass `disabled={true}` to disable the button.\n * Pass `active={true}` to lock the hover state of the button.\n * Pass `onClick={() => {}}` to add an on-click effect.\n * Pass `backgroundColors={[#ffffff, #000000]}` to set the background color of the button\n * ```\n */\nconst ActionButton = React.forwardRef(function ActionButton(\n { icon, disabled, active, onClick, actionWidthHeight, backgroundColors, useShadow, ...props },\n forwardedRef\n) {\n return (\n <S.ActionButton\n ref={forwardedRef}\n disabled={disabled}\n $active={active}\n onClick={onClick}\n $actionWidthHeight={actionWidthHeight}\n $backgroundColors={backgroundColors}\n $useShadow={useShadow}\n {...props}\n >\n {icon}\n </S.ActionButton>\n );\n});\n\nActionButton.propTypes = {\n /**\n * Icon element e.g: `icon={<SvgAddCircle />}`\n */\n icon: PropTypes.element.isRequired,\n /**\n * Disable the action button\n */\n disabled: PropTypes.bool,\n /**\n * Locks the hover state of the `ActionButton` this prop only affects the visual appearance of the\n * `ActionButton`\n */\n active: PropTypes.bool,\n /**\n * On-click effect for the action button\n */\n onClick: PropTypes.func,\n /**\n * Color of the button background as an array of [darkThemeColor, lightThemeColor]\n */\n backgroundColors: PropTypes.arrayOf(PropTypes.string),\n /**\n * Width and Height of the Action Button [50, 50]\n */\n actionWidthHeight: PropTypes.array,\n /**\n * Apply shadow to the button\n */\n useShadow: PropTypes.bool\n};\n\nActionButton.defaultProps = {\n onClick: () => {},\n actionWidthHeight: [40, 40],\n useShadow: false\n};\n\nexport default ActionButton;\n"],"names":["ActionButton","React","forwardRef","icon","disabled","active","onClick","actionWidthHeight","backgroundColors","useShadow","props","forwardedRef","createElement","S","_extends","ref","$active","$actionWidthHeight","$backgroundColors","$useShadow","propTypes","process","env","NODE_ENV","PropTypes","element","isRequired","bool","func","arrayOf","string","array","defaultProps"],"mappings":";;;;;AAwBMA,MAAAA,YAAY,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CACzD;EAAEG,IAAI;EAAEC,QAAQ;EAAEC,MAAM;EAAEC,OAAO;EAAEC,iBAAiB;EAAEC,gBAAgB;EAAEC,SAAS;EAAE,GAAGC,KAAAA;AAAM,CAAC,EAC7FC,YAAY,EACZ;EACA,OACEV,cAAA,CAAAW,aAAA,CAACC,cAAc,EAAAC,QAAA,CAAA;AACbC,IAAAA,GAAG,EAAEJ,YAAa;AAClBP,IAAAA,QAAQ,EAAEA,QAAS;AACnBY,IAAAA,OAAO,EAAEX,MAAO;AAChBC,IAAAA,OAAO,EAAEA,OAAQ;AACjBW,IAAAA,kBAAkB,EAAEV,iBAAkB;AACtCW,IAAAA,iBAAiB,EAAEV,gBAAiB;AACpCW,IAAAA,UAAU,EAAEV,SAAAA;GACRC,EAAAA,KAAK,CAERP,EAAAA,IACa,CAAC,CAAA;AAErB,CAAC,EAAC;AAEFH,YAAY,CAACoB,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAG,YAAA,GAAA;AAIvBpB,EAAAA,IAAI,EAAEqB,SAAS,CAACC,OAAO,CAACC,UAAU;EAIlCtB,QAAQ,EAAEoB,SAAS,CAACG,IAAI;EAKxBtB,MAAM,EAAEmB,SAAS,CAACG,IAAI;EAItBrB,OAAO,EAAEkB,SAAS,CAACI,IAAI;EAIvBpB,gBAAgB,EAAEgB,SAAS,CAACK,OAAO,CAACL,SAAS,CAACM,MAAM,CAAC;EAIrDvB,iBAAiB,EAAEiB,SAAS,CAACO,KAAK;EAIlCtB,SAAS,EAAEe,SAAS,CAACG,IAAAA;AACvB,CAAC,GAAA,EAAA,CAAA;AAED3B,YAAY,CAACgC,YAAY,GAAG;AAC1B1B,EAAAA,OAAO,EAAEA,MAAM,EAAE;AACjBC,EAAAA,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;AAC3BE,EAAAA,SAAS,EAAE,KAAA;AACb,CAAC;;;;"}
@@ -2,13 +2,16 @@ import styled, { css } from 'styled-components';
2
2
  import { rgba } from 'polished';
3
3
  import { applyDefaultTheme } from '../../utils/defaultTheme.js';
4
4
 
5
- const ActionButton = styled.button.attrs(applyDefaultTheme)`
5
+ const shouldForwardProp = prop => !prop.startsWith('$');
6
+ const ActionButton = styled.button.withConfig({
7
+ shouldForwardProp
8
+ }).attrs(applyDefaultTheme)`
6
9
  display: inline-flex;
7
10
  justify-content: center;
8
11
  align-items: center;
9
12
  border-radius: 50%;
10
- width: ${props => `${props.actionWidthHeight[0]}px`};
11
- height: ${props => `${props.actionWidthHeight[1]}px`};
13
+ width: ${props => `${props.$actionWidthHeight[0]}px`};
14
+ height: ${props => `${props.$actionWidthHeight[1]}px`};
12
15
  border: 0;
13
16
  color: inherit;
14
17
  background-color: transparent;
@@ -20,30 +23,30 @@ const ActionButton = styled.button.attrs(applyDefaultTheme)`
20
23
  cursor: pointer;
21
24
 
22
25
  ${props => {
23
- const darkThemeBgColor = props?.backgroundColors?.[0] ?? props.theme.getColor('gray-600');
24
- const lightThemeBgColor = props?.backgroundColors?.[1] ?? props.theme.getColor('gray-200');
26
+ const darkThemeBgColor = props?.$backgroundColors?.[0] ?? props.theme.getColor('gray-600');
27
+ const lightThemeBgColor = props?.$backgroundColors?.[1] ?? props.theme.getColor('gray-200');
25
28
  return props.theme.themeProp('background-image', `radial-gradient(circle at center, ${darkThemeBgColor} 50%, transparent 51%)`, `radial-gradient(circle at center, ${lightThemeBgColor} 50%, transparent 51%)`);
26
29
  }}
27
30
 
28
31
  &:hover:not(:disabled) {
29
- background-size: ${props => Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px
30
- ${props => Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px;
32
+ background-size: ${props => Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px
33
+ ${props => Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px;
31
34
 
32
35
  svg {
33
36
  ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-700'))};
34
37
  }
35
38
  }
36
39
 
37
- ${props => props.active && css`
38
- background-size: ${Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px
39
- ${Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px;
40
+ ${props => props.$active && css`
41
+ background-size: ${Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px
42
+ ${Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px;
40
43
 
41
44
  svg {
42
45
  ${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-700'))};
43
46
  }
44
47
  `}
45
48
 
46
- ${props => props.useShadow ? props.theme.themeProp('box-shadow', `0px 3px 6px ${rgba(props.theme.getColor('black'), 0.7)}`, `0px 3px 6px ${props.theme.getColor('black')}`) : null}
49
+ ${props => props.$useShadow && props.theme.themeProp('box-shadow', `0px 3px 6px ${rgba(props.theme.getColor('black'), 0.7)}`, `0px 3px 6px ${props.theme.getColor('black')}`)}
47
50
 
48
51
  &:disabled {
49
52
  opacity: 0.5;
@@ -53,8 +56,8 @@ const ActionButton = styled.button.attrs(applyDefaultTheme)`
53
56
 
54
57
  svg {
55
58
  width: 100%;
56
- max-width: ${props => `${props.actionWidthHeight[0] - 15}px`};
57
- max-height: ${props => `${props.actionWidthHeight[1] - 15}px`};
59
+ max-width: ${props => `${props.$actionWidthHeight[0] - 15}px`};
60
+ max-height: ${props => `${props.$actionWidthHeight[1] - 15}px`};
58
61
  pointer-events: none;
59
62
  transition: color 250ms;
60
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButton.styled.js","sources":["../../../src/components/inputs/ActionButton/ActionButton.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nexport const ActionButton = styled.button.attrs(applyDefaultTheme)`\n display: inline-flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n width: ${props => `${props.actionWidthHeight[0]}px`};\n height: ${props => `${props.actionWidthHeight[1]}px`};\n border: 0;\n color: inherit;\n background-color: transparent;\n\n background-position: center;\n background-repeat: no-repeat;\n background-size: 0 0;\n transition: background-size 250ms ease;\n cursor: pointer;\n\n ${props => {\n const darkThemeBgColor = props?.backgroundColors?.[0] ?? props.theme.getColor('gray-600');\n const lightThemeBgColor = props?.backgroundColors?.[1] ?? props.theme.getColor('gray-200');\n return props.theme.themeProp(\n 'background-image',\n `radial-gradient(circle at center, ${darkThemeBgColor} 50%, transparent 51%)`,\n `radial-gradient(circle at center, ${lightThemeBgColor} 50%, transparent 51%)`\n );\n }}\n\n &:hover:not(:disabled) {\n background-size: ${props =>\n Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px\n ${props => Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px;\n\n svg {\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-700')\n )};\n }\n }\n\n ${props =>\n props.active &&\n css`\n background-size: ${Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px\n ${Math.max(props.actionWidthHeight[0], props.actionWidthHeight[1]) * 2}px;\n\n svg {\n ${props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-700')\n )};\n }\n `}\n\n ${props =>\n props.useShadow\n ? props.theme.themeProp(\n 'box-shadow',\n `0px 3px 6px ${rgba(props.theme.getColor('black'), 0.7)}`,\n `0px 3px 6px ${props.theme.getColor('black')}`\n )\n : null}\n\n &:disabled {\n opacity: 0.5;\n color: inherit;\n cursor: not-allowed;\n }\n\n svg {\n width: 100%;\n max-width: ${props => `${props.actionWidthHeight[0] - 15}px`};\n max-height: ${props => `${props.actionWidthHeight[1] - 15}px`};\n pointer-events: none;\n transition: color 250ms;\n }\n`;\n"],"names":["ActionButton","styled","button","attrs","applyDefaultTheme","props","actionWidthHeight","darkThemeBgColor","backgroundColors","theme","getColor","lightThemeBgColor","themeProp","Math","max","active","css","useShadow","rgba"],"mappings":";;;;AAIO,MAAMA,YAAY,GAAGC,MAAM,CAACC,MAAM,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAClE;AACA;AACA;AACA;AACA,SAAWC,EAAAA,KAAK,IAAI,CAAGA,EAAAA,KAAK,CAACC,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,CAAI,EAAA,CAAA,CAAA;AACjE;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"ActionButton.styled.js","sources":["../../../src/components/inputs/ActionButton/ActionButton.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst shouldForwardProp = prop => !prop.startsWith('$');\n\nexport const ActionButton = styled.button\n .withConfig({ shouldForwardProp })\n .attrs(applyDefaultTheme)`\n display: inline-flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n width: ${props => `${props.$actionWidthHeight[0]}px`};\n height: ${props => `${props.$actionWidthHeight[1]}px`};\n border: 0;\n color: inherit;\n background-color: transparent;\n\n background-position: center;\n background-repeat: no-repeat;\n background-size: 0 0;\n transition: background-size 250ms ease;\n cursor: pointer;\n\n ${props => {\n const darkThemeBgColor = props?.$backgroundColors?.[0] ?? props.theme.getColor('gray-600');\n const lightThemeBgColor = props?.$backgroundColors?.[1] ?? props.theme.getColor('gray-200');\n return props.theme.themeProp(\n 'background-image',\n `radial-gradient(circle at center, ${darkThemeBgColor} 50%, transparent 51%)`,\n `radial-gradient(circle at center, ${lightThemeBgColor} 50%, transparent 51%)`\n );\n }}\n\n &:hover:not(:disabled) {\n background-size: ${props =>\n Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px\n ${props => Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px;\n\n svg {\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-700')\n )};\n }\n }\n\n ${props =>\n props.$active &&\n css`\n background-size: ${Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px\n ${Math.max(props.$actionWidthHeight[0], props.$actionWidthHeight[1]) * 2}px;\n\n svg {\n ${props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-700')\n )};\n }\n `}\n\n ${props =>\n props.$useShadow &&\n props.theme.themeProp(\n 'box-shadow',\n `0px 3px 6px ${rgba(props.theme.getColor('black'), 0.7)}`,\n `0px 3px 6px ${props.theme.getColor('black')}`\n )}\n\n &:disabled {\n opacity: 0.5;\n color: inherit;\n cursor: not-allowed;\n }\n\n svg {\n width: 100%;\n max-width: ${props => `${props.$actionWidthHeight[0] - 15}px`};\n max-height: ${props => `${props.$actionWidthHeight[1] - 15}px`};\n pointer-events: none;\n transition: color 250ms;\n }\n`;\n"],"names":["shouldForwardProp","prop","startsWith","ActionButton","styled","button","withConfig","attrs","applyDefaultTheme","props","$actionWidthHeight","darkThemeBgColor","$backgroundColors","theme","getColor","lightThemeBgColor","themeProp","Math","max","$active","css","$useShadow","rgba"],"mappings":";;;;AAIA,MAAMA,iBAAiB,GAAGC,IAAI,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AAEhD,MAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CACtCC,UAAU,CAAC;AAAEN,EAAAA,iBAAAA;AAAkB,CAAC,CAAC,CACjCO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA;AACA;AACA,SAAWC,EAAAA,KAAK,IAAI,CAAGA,EAAAA,KAAK,CAACC,kBAAkB,CAAC,CAAC,CAAC,CAAI,EAAA,CAAA,CAAA;AACtD,UAAYD,EAAAA,KAAK,IAAI,CAAGA,EAAAA,KAAK,CAACC,kBAAkB,CAAC,CAAC,CAAC,CAAI,EAAA,CAAA,CAAA;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,EAAID,KAAK,IAAI;AACT,EAAA,MAAME,gBAAgB,GAAGF,KAAK,EAAEG,iBAAiB,GAAG,CAAC,CAAC,IAAIH,KAAK,CAACI,KAAK,CAACC,QAAQ,CAAC,UAAU,CAAC,CAAA;AAC1F,EAAA,MAAMC,iBAAiB,GAAGN,KAAK,EAAEG,iBAAiB,GAAG,CAAC,CAAC,IAA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ACI,KAAK,CAACG,SAAS,CACrB,OAAO,EACPP,KAAK,CAACI,KAAK,CAACC,QAAQ,CAAC,UAAU,CAAC,EAChCL,KAAK,CAACI,KAAK,CAACC,QAAQ,CAAC,UAAU,CACjC,CAAC,CAAA;AACT;AACA,IAAK,CAAA,CAAA;AACL;AACA,EAAA,EAAIL,KAAK,IACLA,KAAK,CAACY,UAAU,IAChBZ,KAAK,CAACI,KAAK,CAACG,SAAS,CACnB,YAAY,EACZ,eAAeM,IAAI,CAACb,KAAK,CAACI,KAAK,CAACC,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,EACzD,CAAA,YAAA,EAAeL,KAAK,CAACI,KAAK,CAACC,QAAQ,CAAC,OAAO,CAAC,EAC9C,CAAC,CAAA;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAiBL,EAAAA,KAAK,IAAI,CAAA,EAAGA,KAAK,CAACC,kBAAkB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAI,EAAA,CAAA,CAAA;AACjE,gBAAkBD,EAAAA,KAAK,IAAI,CAAA,EAAGA,KAAK,CAACC,kBAAkB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAI,EAAA,CAAA,CAAA;AAClE;AACA;AACA;AACA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { isFunction, isEmpty } from 'lodash';
2
2
  import { nanoid } from 'nanoid';
3
3
  import PropTypes from 'prop-types';
4
- import React__default, { useState, useMemo, useEffect, useCallback } from 'react';
4
+ import React__default, { useState, useEffect, useCallback, useMemo, memo } from 'react';
5
5
  import { ReactComponent as SvgEditNote } from '../../icons/edit-note.svg.js';
6
6
  import { ReactComponent as SvgLink } from '../../icons/link.svg.js';
7
7
  import '../../data/Alert/Alert.js';
@@ -11,7 +11,7 @@ import '../../data/Tab/Tab.js';
11
11
  import '../../data/Tabs/Tabs.js';
12
12
  import Tooltip from '../../data/Tooltip/Tooltip.js';
13
13
  import '../../data/VerificationStatusIcon/VerificationStatusIcon.js';
14
- import { CompactTextInput as CompactTextInput$1, Label, SuccessContainer, InputContainer, LinkPopoverContainer, StyledLink, ReadOnlyLinkContainer, InputIconContainer, InputSuccessContainer, Input } from './CompactTextInput.styled.js';
14
+ import { LinkPopoverContainer, StyledLink, Input, CompactTextInput as CompactTextInput$2, Label, SuccessContainer, InputContainer, ReadOnlyLinkContainer, InputIconContainer, InputSuccessContainer } from './CompactTextInput.styled.js';
15
15
 
16
16
  const CompactTextInput = React__default.forwardRef(function CompactTextInput({
17
17
  label,
@@ -39,21 +39,13 @@ const CompactTextInput = React__default.forwardRef(function CompactTextInput({
39
39
  successIcon,
40
40
  ...props
41
41
  }, forwardedRef) {
42
- const [uniqueId] = useState(nanoid());
43
- const [currentValue, setCurrentValue] = useState();
44
- const [autoFocus, setAutoFocus] = useState(false);
45
- const memoizedDescriptionToolTip = useMemo(() => {
46
- return descriptionToolTip;
47
- }, [descriptionToolTip]);
42
+ const [uniqueId] = useState(() => nanoid());
43
+ const [currentValue, setCurrentValue] = useState(value || defaultValue);
48
44
  useEffect(() => {
49
45
  setCurrentValue(value || defaultValue);
50
- setAutoFocus(false);
51
46
  }, [value, defaultValue]);
52
47
  const onChange = useCallback(event => {
53
48
  setCurrentValue(event.target.value);
54
- if (!autoFocus) {
55
- setAutoFocus(true);
56
- }
57
49
  if (isFunction(onChangeProp)) {
58
50
  onChangeProp(event);
59
51
  }
@@ -65,78 +57,72 @@ const CompactTextInput = React__default.forwardRef(function CompactTextInput({
65
57
  if (isFunction(onFocusProp)) {
66
58
  onFocusProp(event);
67
59
  }
68
- }, [autoSelect, readOnly, onFocusProp]);
60
+ }, [autoSelect, onFocusProp]);
69
61
  const onBlur = useCallback(event => {
70
62
  if (isFunction(onBlurProp)) {
71
63
  onBlurProp(event);
72
64
  }
73
65
  }, [onBlurProp]);
74
- const input = () => {
75
- return React__default.createElement(Input, {
76
- ref: forwardedRef,
77
- id: uniqueId,
78
- key: uniqueId,
79
- autoFocus: autoFocus,
80
- inputtype: inputType,
81
- name: name,
82
- readOnly: readOnly,
83
- disabled: disabled,
84
- $edit: edit,
85
- placeholder: placeholder,
86
- defaultValue: defaultValue,
87
- value: value,
88
- type: type,
89
- $bold: bold,
90
- $haslink: !isEmpty(link),
91
- onFocus: onFocus,
92
- onChange: onChange,
93
- onBlur: onBlur
94
- });
95
- };
66
+ const linkPopoverContent = useMemo(() => React__default.createElement(LinkPopoverContainer, null, React__default.createElement(StyledLink, {
67
+ href: link,
68
+ target: linkTarget,
69
+ onClick: e => {
70
+ if (activeLinkHandler) {
71
+ e.preventDefault();
72
+ linkHandler();
73
+ }
74
+ },
75
+ rel: "noreferrer"
76
+ }, React__default.createElement(SvgLink, null), currentValue)), [link, linkTarget, activeLinkHandler, linkHandler, currentValue]);
77
+ const inputElement = React__default.createElement(Input, {
78
+ ref: forwardedRef,
79
+ id: uniqueId,
80
+ type: inputType,
81
+ name: name,
82
+ readOnly: readOnly,
83
+ disabled: disabled,
84
+ placeholder: placeholder,
85
+ defaultValue: defaultValue,
86
+ value: value,
87
+ $bold: bold,
88
+ $haslink: !isEmpty(link),
89
+ $edit: edit,
90
+ $type: type,
91
+ onFocus: onFocus,
92
+ onChange: onChange,
93
+ onBlur: onBlur
94
+ });
96
95
  if (hidden) return null;
97
- return React__default.createElement(CompactTextInput$1, props, label && React__default.createElement(Label, {
96
+ const hasLink = link && !readOnly;
97
+ return React__default.createElement(CompactTextInput$2, props, label && React__default.createElement(Label, {
98
98
  htmlFor: uniqueId,
99
- disabled: disabled
100
- }, label, React__default.createElement(SuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon)), React__default.createElement(InputContainer, {
99
+ $disabled: disabled
100
+ }, label, React__default.createElement(SuccessContainer, {
101
+ $type: type
102
+ }, type === 'loading' && loadingIcon, type === 'success' && successIcon)), React__default.createElement(InputContainer, {
101
103
  $hasLabel: !isEmpty(label)
102
- }, !memoizedDescriptionToolTip && !link && React__default.createElement("div", null, input()), memoizedDescriptionToolTip && !link && React__default.createElement("div", null, React__default.createElement(Tooltip, {
103
- content: memoizedDescriptionToolTip,
104
- key: "tooltip1",
105
- placement: "bottom-end",
106
- trigger: 'mouseenter',
107
- zIndex: 999999
108
- }, input())), link && !readOnly && React__default.createElement("div", null, React__default.createElement(Popover, {
104
+ }, link && readOnly ? React__default.createElement(ReadOnlyLinkContainer, null, React__default.createElement(StyledLink, {
105
+ href: link,
106
+ rel: "noreferrer",
107
+ target: linkTarget
108
+ }, currentValue)) : React__default.createElement("div", null, hasLink ? React__default.createElement(Popover, {
109
109
  arrow: false,
110
- content: React__default.createElement(LinkPopoverContainer, null, activeLinkHandler ? React__default.createElement(StyledLink, {
111
- href: link,
112
- target: linkTarget,
113
- onClick: e => {
114
- if (activeLinkHandler) {
115
- e.preventDefault();
116
- linkHandler();
117
- }
118
- },
119
- rel: "noreferrer"
120
- }, React__default.createElement(SvgLink, null), currentValue) : React__default.createElement(StyledLink, {
121
- href: link,
122
- target: linkTarget,
123
- rel: "noreferrer"
124
- }, React__default.createElement(SvgLink, null), currentValue)),
125
- key: "tooltip2",
110
+ content: linkPopoverContent,
126
111
  placement: "bottom-start",
127
112
  trigger: "focusin",
128
113
  zIndex: 999999,
129
114
  interactive: true
130
- }, input())), link && readOnly && React__default.createElement(ReadOnlyLinkContainer, null, React__default.createElement(StyledLink, {
131
- href: link,
132
- rel: "noreferrer",
133
- style: {
134
- display: 'inline-block'
135
- },
136
- target: linkTarget
137
- }, currentValue)), !readOnly && !disabled && React__default.createElement(React__default.Fragment, null, React__default.createElement(InputIconContainer, {
138
- type: type
139
- }, React__default.createElement(SvgEditNote, null)), isEmpty(label) && React__default.createElement(InputSuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon))));
115
+ }, inputElement) : React__default.createElement(Tooltip, {
116
+ content: descriptionToolTip || '',
117
+ placement: "bottom-end",
118
+ trigger: "mouseenter",
119
+ zIndex: 999999,
120
+ disabled: !descriptionToolTip
121
+ }, inputElement)), !readOnly && !disabled && React__default.createElement(React__default.Fragment, null, React__default.createElement(InputIconContainer, {
122
+ $type: type
123
+ }, React__default.createElement(SvgEditNote, null)), isEmpty(label) && React__default.createElement(InputSuccessContainer, {
124
+ $type: type
125
+ }, type === 'loading' && loadingIcon, type === 'success' && successIcon))));
140
126
  });
141
127
  CompactTextInput.propTypes = process.env.NODE_ENV !== "production" ? {
142
128
  label: PropTypes.string,
@@ -179,6 +165,7 @@ CompactTextInput.defaultProps = {
179
165
  activeLinkHandler: false,
180
166
  onChange: () => {}
181
167
  };
168
+ var CompactTextInput$1 = memo(CompactTextInput);
182
169
 
183
- export { CompactTextInput as default };
170
+ export { CompactTextInput$1 as default };
184
171
  //# sourceMappingURL=CompactTextInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompactTextInput.js","sources":["../../../src/components/inputs/CompactTextInput/CompactTextInput.js"],"sourcesContent":["import { isEmpty, isFunction } from 'lodash';\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\nimport React, { useCallback, useState, useEffect, useMemo } from 'react';\nimport { ReactComponent as EditNoteIcon } from '../../../icons/edit-note.svg';\nimport { ReactComponent as LinkIcon } from '../../../icons/link.svg';\nimport { Tooltip, Popover } from '../../data';\nimport * as S from './CompactTextInput.styled';\n\n// const ConditionalWrapper = ({ condition, wrapper, children }) =>\n// condition ? wrapper(children) : children;\n\n/**\n * Compact text inputs let users enter and edit text in the UI in a compact way. They typically appear in forms or displays of metadata.\n *\n * ### Import\n *\n * ``` js\n * import { CompactTextInput } from '@ntbjs/react-components/inputs'\n * // or\n * import CompactTextInput from '@ntbjs/react-components/inputs/CompactTextInput'\n * ```\n */\nconst CompactTextInput = React.forwardRef(function CompactTextInput(\n {\n label,\n inputType,\n name,\n defaultValue,\n value,\n placeholder,\n link,\n linkTarget,\n linkHandler,\n activeLinkHandler,\n autoSelect,\n readOnly,\n disabled,\n edit,\n type,\n descriptionToolTip,\n bold,\n hidden,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n loadingIcon,\n successIcon,\n ...props\n },\n forwardedRef\n) {\n const [uniqueId] = useState(nanoid());\n const [currentValue, setCurrentValue] = useState();\n const [autoFocus, setAutoFocus] = useState(false);\n\n const memoizedDescriptionToolTip = useMemo(() => {\n return descriptionToolTip;\n }, [descriptionToolTip]);\n\n useEffect(() => {\n setCurrentValue(value || defaultValue);\n setAutoFocus(false);\n }, [value, defaultValue]);\n\n const onChange = useCallback(\n event => {\n setCurrentValue(event.target.value);\n\n if (!autoFocus) {\n setAutoFocus(true);\n }\n if (isFunction(onChangeProp)) {\n onChangeProp(event);\n }\n },\n [onChangeProp]\n );\n\n const onFocus = useCallback(\n event => {\n if (autoSelect) {\n event.target.select();\n }\n\n if (isFunction(onFocusProp)) {\n onFocusProp(event);\n }\n },\n [autoSelect, readOnly, onFocusProp]\n );\n\n const onBlur = useCallback(\n event => {\n if (isFunction(onBlurProp)) {\n onBlurProp(event);\n }\n },\n [onBlurProp]\n );\n\n const input = () => {\n return (\n <S.Input\n ref={forwardedRef}\n id={uniqueId}\n key={uniqueId}\n autoFocus={autoFocus}\n inputtype={inputType}\n name={name}\n readOnly={readOnly}\n disabled={disabled}\n $edit={edit}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n type={type}\n $bold={bold}\n $haslink={!isEmpty(link)}\n onFocus={onFocus}\n onChange={onChange}\n onBlur={onBlur}\n />\n );\n };\n\n if (hidden) return null;\n\n return (\n <S.CompactTextInput {...props}>\n {label && (\n <S.Label htmlFor={uniqueId} disabled={disabled}>\n {label}\n <S.SuccessContainer>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.SuccessContainer>\n </S.Label>\n )}\n <S.InputContainer $hasLabel={!isEmpty(label)}>\n {!memoizedDescriptionToolTip && !link && <div>{input()}</div>}\n {memoizedDescriptionToolTip && !link && (\n <div>\n <Tooltip\n content={memoizedDescriptionToolTip}\n key=\"tooltip1\"\n placement=\"bottom-end\"\n trigger={'mouseenter'}\n zIndex={999999}\n >\n {input()}\n </Tooltip>\n </div>\n )}\n {link && !readOnly && (\n <div>\n <Popover\n arrow={false}\n content={\n <S.LinkPopoverContainer>\n {activeLinkHandler ? (\n <S.StyledLink\n href={link}\n target={linkTarget}\n onClick={e => {\n if (activeLinkHandler) {\n e.preventDefault();\n linkHandler();\n } else null;\n }}\n rel=\"noreferrer\"\n >\n <LinkIcon />\n {currentValue}\n </S.StyledLink>\n ) : (\n <S.StyledLink href={link} target={linkTarget} rel=\"noreferrer\">\n <LinkIcon />\n {currentValue}\n </S.StyledLink>\n )}\n </S.LinkPopoverContainer>\n }\n key=\"tooltip2\"\n placement=\"bottom-start\"\n trigger=\"focusin\"\n zIndex={999999}\n interactive={true}\n >\n {input()}\n </Popover>\n </div>\n )}\n {link && readOnly && (\n <S.ReadOnlyLinkContainer>\n <S.StyledLink\n href={link}\n rel=\"noreferrer\"\n style={{ display: 'inline-block' }}\n target={linkTarget}\n >\n {currentValue}\n </S.StyledLink>\n </S.ReadOnlyLinkContainer>\n )}\n {!readOnly && !disabled && (\n <>\n <S.InputIconContainer type={type}>\n <EditNoteIcon />\n </S.InputIconContainer>\n {isEmpty(label) && (\n <S.InputSuccessContainer>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.InputSuccessContainer>\n )}\n </>\n )}\n </S.InputContainer>\n </S.CompactTextInput>\n );\n});\n\nCompactTextInput.propTypes = {\n /**\n * The label of the input field - leave `undefined` to hide the label\n */\n label: PropTypes.string,\n /**\n * Displays a light green background to show that an action was successful.\n */\n success: PropTypes.bool,\n /**\n * The input type - eg. `text`, `number`\n */\n inputType: PropTypes.string,\n /**\n * The input name\n */\n name: PropTypes.string,\n /**\n * The default value of the input - creates an uncontrolled input\n */\n defaultValue: PropTypes.string,\n /**\n * The value of the input - creates a controlled input\n */\n value: PropTypes.string,\n /**\n * The placeholder of the input\n */\n placeholder: PropTypes.string,\n /**\n * A URL associated with the input value. Creates a clickable link that accepts full or relative URL\n */\n link: PropTypes.string,\n /**\n * The target for the link. Only applies when the field is in read-only mode\n */\n linkTarget: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),\n /**\n * Whether the link has a onClick event.\n */\n linkHandler: PropTypes.func,\n /**\n * Whether the handler should preceed the link behavior.\n */\n activeLinkHandler: PropTypes.bool,\n /**\n * Whether to auto select the entire value when the input is focused – does also work when the field is in read-only mode\n */\n autoSelect: PropTypes.bool,\n /**\n * Whether the value is read only\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the value is disabled\n */\n disabled: PropTypes.bool,\n /**\n * Displays a grey background to show that value is editable\n */\n edit: PropTypes.bool,\n /**\n * There is an error present - 'error be prioritized over warnings if both are set to 'true'.\n */\n // error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n /**\n * There is a warning present.\n */\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n /**\n * Whether to bold the input content - Slightly increases the font size and font weight of the input value\n */\n bold: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n /**\n * Callback for `onChange`\n */\n onChange: PropTypes.func,\n /**\n * Callback for `onFocus`\n */\n onFocus: PropTypes.func,\n /**\n * Callback for `onBlur`\n */\n onBlur: PropTypes.func,\n /**\n * Define the type based on error, warning, loading and success.\n */\n type: PropTypes.oneOf(['', 'error', 'warning', 'loading', 'success']),\n /**\n * Description ToolTip text.\n */\n descriptionToolTip: PropTypes.string,\n /**\n * Icon element – E.g: `icon={<Spinner />}`\n */\n loadingIcon: PropTypes.element,\n /**\n * Icon element – E.g: `icon={<Check />}`\n */\n successIcon: PropTypes.element\n};\n\nCompactTextInput.defaultProps = {\n inputType: 'text',\n autoSelect: true,\n linkTarget: '_self',\n bold: false,\n readOnly: false,\n descriptionToolTip: '',\n edit: false,\n hidden: false,\n type: '',\n linkHandler: () => {},\n activeLinkHandler: false,\n onChange: () => {}\n};\n\nexport default CompactTextInput;\n"],"names":["CompactTextInput","React","forwardRef","label","inputType","name","defaultValue","value","placeholder","link","linkTarget","linkHandler","activeLinkHandler","autoSelect","readOnly","disabled","edit","type","descriptionToolTip","bold","hidden","onChange","onChangeProp","onFocus","onFocusProp","onBlur","onBlurProp","loadingIcon","successIcon","props","forwardedRef","uniqueId","useState","nanoid","currentValue","setCurrentValue","autoFocus","setAutoFocus","memoizedDescriptionToolTip","useMemo","useEffect","useCallback","event","target","isFunction","select","input","createElement","S","ref","id","key","inputtype","$edit","$bold","$haslink","isEmpty","htmlFor","$hasLabel","Tooltip","content","placement","trigger","zIndex","Popover","arrow","href","onClick","e","preventDefault","rel","LinkIcon","interactive","style","display","Fragment","EditNoteIcon","propTypes","process","env","NODE_ENV","PropTypes","string","success","bool","oneOf","func","warning","oneOfType","element","defaultProps"],"mappings":";;;;;;;;;;;;;;;AAuBMA,MAAAA,gBAAgB,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,gBAAgBA,CACjE;EACEG,KAAK;EACLC,SAAS;EACTC,IAAI;EACJC,YAAY;EACZC,KAAK;EACLC,WAAW;EACXC,IAAI;EACJC,UAAU;EACVC,WAAW;EACXC,iBAAiB;EACjBC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,IAAI;EACJC,IAAI;EACJC,kBAAkB;EAClBC,IAAI;EACJC,MAAM;AACNC,EAAAA,QAAQ,EAAEC,YAAY;AACtBC,EAAAA,OAAO,EAAEC,WAAW;AACpBC,EAAAA,MAAM,EAAEC,UAAU;EAClBC,WAAW;EACXC,WAAW;EACX,GAAGC,KAAAA;AACL,CAAC,EACDC,YAAY,EACZ;EACA,MAAM,CAACC,QAAQ,CAAC,GAAGC,QAAQ,CAACC,MAAM,EAAE,CAAC,CAAA;EACrC,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGH,QAAQ,EAAE,CAAA;EAClD,MAAM,CAACI,SAAS,EAAEC,YAAY,CAAC,GAAGL,QAAQ,CAAC,KAAK,CAAC,CAAA;AAEjD,EAAA,MAAMM,0BAA0B,GAAGC,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AACQ,OAAO;EAI9B7D,WAAW,EAAEqD,SAAS,CAACQ,OAAAA;AACzB,CAAC,GAAA,EAAA,CAAA;AAEDzF,gBAAgB,CAAC0F,YAAY,GAAG;AAC9BtF,EAAAA,SAAS,EAAE,MAAM;AACjBS,EAAAA,UAAU,EAAE,IAAI;AAChBH,EAAAA,UAAU,EAAE,OAAO;AACnBS,EAAAA,IAAI,EAAE,KAAK;AACXL,EAAAA,QAAQ,EAAE,KAAK;AACfI,EAAAA,kBAAkB,EAAE,EAAE;AACtBF,EAAAA,IAAI,EAAE,KAAK;AACXI,EAAAA,MAAM,EAAE,KAAK;AACbH,EAAAA,IAAI,EAAE,EAAE;AACRN,EAAAA,WAAW,EAAEA,MAAM,EAAE;AACrBC,EAAAA,iBAAiB,EAAE,KAAK;EACxBS,QAAQ,EAAEA,MAAM,EAAC;AACnB,CAAC;;;;"}
1
+ {"version":3,"file":"CompactTextInput.js","sources":["../../../src/components/inputs/CompactTextInput/CompactTextInput.js"],"sourcesContent":["import { isEmpty, isFunction } from 'lodash';\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\nimport React, { useCallback, useState, useEffect, useMemo, memo } from 'react';\nimport { ReactComponent as EditNoteIcon } from '../../../icons/edit-note.svg';\nimport { ReactComponent as LinkIcon } from '../../../icons/link.svg';\nimport { Tooltip, Popover } from '../../data';\nimport * as S from './CompactTextInput.styled';\n\nconst CompactTextInput = React.forwardRef(function CompactTextInput(\n {\n label,\n inputType,\n name,\n defaultValue,\n value,\n placeholder,\n link,\n linkTarget,\n linkHandler,\n activeLinkHandler,\n autoSelect,\n readOnly,\n disabled,\n edit,\n type,\n descriptionToolTip,\n bold,\n hidden,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n loadingIcon,\n successIcon,\n ...props\n },\n forwardedRef\n) {\n const [uniqueId] = useState(() => nanoid());\n const [currentValue, setCurrentValue] = useState(value || defaultValue);\n\n // Update currentValue when value or defaultValue changes\n useEffect(() => {\n setCurrentValue(value || defaultValue);\n }, [value, defaultValue]);\n\n const onChange = useCallback(\n event => {\n setCurrentValue(event.target.value);\n if (isFunction(onChangeProp)) {\n onChangeProp(event);\n }\n },\n [onChangeProp]\n );\n\n const onFocus = useCallback(\n event => {\n if (autoSelect) {\n event.target.select();\n }\n if (isFunction(onFocusProp)) {\n onFocusProp(event);\n }\n },\n [autoSelect, onFocusProp]\n );\n\n const onBlur = useCallback(\n event => {\n if (isFunction(onBlurProp)) {\n onBlurProp(event);\n }\n },\n [onBlurProp]\n );\n\n // Memoize link popover content\n const linkPopoverContent = useMemo(\n () => (\n <S.LinkPopoverContainer>\n <S.StyledLink\n href={link}\n target={linkTarget}\n onClick={e => {\n if (activeLinkHandler) {\n e.preventDefault();\n linkHandler();\n }\n }}\n rel=\"noreferrer\"\n >\n <LinkIcon />\n {currentValue}\n </S.StyledLink>\n </S.LinkPopoverContainer>\n ),\n [link, linkTarget, activeLinkHandler, linkHandler, currentValue]\n );\n\n // Render the input - same structure every time\n const inputElement = (\n <S.Input\n ref={forwardedRef}\n id={uniqueId}\n type={inputType}\n name={name}\n readOnly={readOnly}\n disabled={disabled}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n $bold={bold}\n $haslink={!isEmpty(link)}\n $edit={edit}\n $type={type}\n onFocus={onFocus}\n onChange={onChange}\n onBlur={onBlur}\n />\n );\n\n if (hidden) return null;\n\n // Determine current state\n const hasLink = link && !readOnly;\n\n return (\n <S.CompactTextInput {...props}>\n {label && (\n <S.Label htmlFor={uniqueId} $disabled={disabled}>\n {label}\n <S.SuccessContainer $type={type}>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.SuccessContainer>\n </S.Label>\n )}\n <S.InputContainer $hasLabel={!isEmpty(label)}>\n {link && readOnly ? (\n <S.ReadOnlyLinkContainer>\n <S.StyledLink href={link} rel=\"noreferrer\" target={linkTarget}>\n {currentValue}\n </S.StyledLink>\n </S.ReadOnlyLinkContainer>\n ) : (\n <div>\n {hasLink ? (\n <Popover\n arrow={false}\n content={linkPopoverContent}\n placement=\"bottom-start\"\n trigger=\"focusin\"\n zIndex={999999}\n interactive={true}\n >\n {inputElement}\n </Popover>\n ) : (\n <Tooltip\n content={descriptionToolTip || ''}\n placement=\"bottom-end\"\n trigger=\"mouseenter\"\n zIndex={999999}\n disabled={!descriptionToolTip}\n >\n {inputElement}\n </Tooltip>\n )}\n </div>\n )}\n\n {!readOnly && !disabled && (\n <>\n <S.InputIconContainer $type={type}>\n <EditNoteIcon />\n </S.InputIconContainer>\n {isEmpty(label) && (\n <S.InputSuccessContainer $type={type}>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.InputSuccessContainer>\n )}\n </>\n )}\n </S.InputContainer>\n </S.CompactTextInput>\n );\n});\n\nCompactTextInput.propTypes = {\n /**\n * The label of the input field - leave `undefined` to hide the label\n */\n label: PropTypes.string,\n /**\n * Displays a light green background to show that an action was successful.\n */\n success: PropTypes.bool,\n /**\n * The input type - eg. `text`, `number`\n */\n inputType: PropTypes.string,\n /**\n * The input name\n */\n name: PropTypes.string,\n /**\n * The default value of the input - creates an uncontrolled input\n */\n defaultValue: PropTypes.string,\n /**\n * The value of the input - creates a controlled input\n */\n value: PropTypes.string,\n /**\n * The placeholder of the input\n */\n placeholder: PropTypes.string,\n /**\n * A URL associated with the input value. Creates a clickable link that accepts full or relative URL\n */\n link: PropTypes.string,\n /**\n * The target for the link. Only applies when the field is in read-only mode\n */\n linkTarget: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),\n /**\n * Whether the link has a onClick event.\n */\n linkHandler: PropTypes.func,\n /**\n * Whether the handler should preceed the link behavior.\n */\n activeLinkHandler: PropTypes.bool,\n /**\n * Whether to auto select the entire value when the input is focused, does also work when the field is in read-only mode\n */\n autoSelect: PropTypes.bool,\n /**\n * Whether the value is read only\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the value is disabled\n */\n disabled: PropTypes.bool,\n /**\n * Displays a grey background to show that value is editable\n */\n edit: PropTypes.bool,\n /**\n * There is an error present - 'error be prioritized over warnings if both are set to 'true'.\n */\n // error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n /**\n * There is a warning present.\n */\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n /**\n * Whether to bold the input content - Slightly increases the font size and font weight of the input value\n */\n bold: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n /**\n * Callback for `onChange`\n */\n onChange: PropTypes.func,\n /**\n * Callback for `onFocus`\n */\n onFocus: PropTypes.func,\n /**\n * Callback for `onBlur`\n */\n onBlur: PropTypes.func,\n /**\n * Define the type based on error, warning, loading and success.\n */\n type: PropTypes.oneOf(['', 'error', 'warning', 'loading', 'success']),\n /**\n * Description ToolTip text.\n */\n descriptionToolTip: PropTypes.string,\n /**\n * Icon element E.g: `icon={<Spinner />}`\n */\n loadingIcon: PropTypes.element,\n /**\n * Icon element E.g: `icon={<Check />}`\n */\n successIcon: PropTypes.element\n};\n\nCompactTextInput.defaultProps = {\n inputType: 'text',\n autoSelect: true,\n linkTarget: '_self',\n bold: false,\n readOnly: false,\n descriptionToolTip: '',\n edit: false,\n hidden: false,\n type: '',\n linkHandler: () => {},\n activeLinkHandler: false,\n onChange: () => {}\n};\n\nexport default memo(CompactTextInput);\n"],"names":["CompactTextInput","React","forwardRef","label","inputType","name","defaultValue","value","placeholder","link","linkTarget","linkHandler","activeLinkHandler","autoSelect","readOnly","disabled","edit","type","descriptionToolTip","bold","hidden","onChange","onChangeProp","onFocus","onFocusProp","onBlur","onBlurProp","loadingIcon","successIcon","props","forwardedRef","uniqueId","useState","nanoid","currentValue","setCurrentValue","useEffect","useCallback","event","target","isFunction","select","linkPopoverContent","useMemo","createElement","S","href","onClick","e","preventDefault","rel","LinkIcon","inputElement","ref","id","$bold","$haslink","isEmpty","$edit","$type","hasLink","htmlFor","$disabled","$hasLabel","Popover","arrow","content","placement","trigger","zIndex","interactive","Tooltip","Fragment","EditNoteIcon","propTypes","process","env","NODE_ENV","PropTypes","string","success","bool","oneOf","func","warning","oneOfType","element","defaultProps","memo"],"mappings":";;;;;;;;;;;;;;;AASA,MAAMA,gBAAgB,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,gBAAgBA,CACjE;EACEG,KAAK;EACLC,SAAS;EACTC,IAAI;EACJC,YAAY;EACZC,KAAK;EACLC,WAAW;EACXC,IAAI;EACJC,UAAU;EACVC,WAAW;EACXC,iBAAiB;EACjBC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,IAAI;EACJC,IAAI;EACJC,kBAAkB;EAClBC,IAAI;EACJC,MAAM;AACNC,EAAAA,QAAQ,EAAEC,YAAY;AACtBC,EAAAA,OAAO,EAAEC,WAAW;AACpBC,EAAAA,MAAM,EAAEC,UAAU;EAClBC,WAAW;EACXC,WAAW;EACX,GAAGC,KAAAA;AACL,CAAC,EACDC,YAAY,EACZ;EACA,MAAM,CAACC,QAAQ,CAAC,GAAGC,QAAQ,CAAC,MAAMC,MAAM,EAAE,CAAC,CAAA;EAC3C,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGH,QAAQ,CAACzB,KAAK,IAAID,YAAY,CAAC,CAAA;AAGvE8B,EAAAA,SAAS,CAAC,MAAM;AACdD,IAAAA,eAAe,CAAC5B,KAAK,IAAID,YAAY,CAAC,CAAA;AACxC,GAAC,EAAE,CAACC,KAAK,EAAED,YAAY,CAAC,CAAC,CAAA;AAEzB,EAAA,MAAMe,QAAQ,GAAGgB,WAAW,CAC1BC,KAAK,IAAI;AACPH,IAAAA,eAAe,CAACG,KAAK,CAACC,MAAM,CAAChC,KAAK,CAAC,CAAA;AACnC,IAAA,IAAIiC,UAAU,CAAClB,YAAY,CAAC,EAAE;MAC5BA,YAAY,CAACgB,KAAK,CAAC,CAAA;AACrB,KAAA;AACF,GAAC,EACD,CAAChB,YAAY,CACf,CAAC,CAAA;AAED,EAAA,MAAMC,OAAO,GAAGc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