@ntbjs/react-components 2.0.2-rc.1 → 2.0.2-rc.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.
- package/build/data/Badge/Badge.js +6 -6
- package/build/data/Badge/Badge.js.map +1 -1
- package/build/data/Badge/Badge.styled.js +10 -11
- package/build/data/Badge/Badge.styled.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.js +2 -2
- package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.styled.js +107 -117
- package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.js +163 -103
- package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.styled.js +123 -111
- package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
- package/build/inputs/TextArea/TextArea.js +5 -5
- package/build/inputs/TextArea/TextArea.js.map +1 -1
- package/build/inputs/TextArea/TextArea.styled.js +48 -56
- package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
- package/build/utils/defaultTheme.js +10 -1
- package/build/utils/defaultTheme.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +8 -8
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +2 -2
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
- package/package.json +3 -3
|
@@ -37,17 +37,17 @@ const Badge = React__default.forwardRef(function Badge({
|
|
|
37
37
|
$backgroundColors: backgroundColors,
|
|
38
38
|
$colors: colors,
|
|
39
39
|
$elevated: elevated,
|
|
40
|
-
fontSize: fontSize,
|
|
41
|
-
fontWeight: fontWeight,
|
|
40
|
+
$fontSize: fontSize,
|
|
41
|
+
$fontWeight: fontWeight,
|
|
42
42
|
$lineHeight: lineHeight,
|
|
43
43
|
$active: active,
|
|
44
44
|
$error: error,
|
|
45
45
|
$warning: warning,
|
|
46
|
-
$
|
|
46
|
+
$verticalPadding: verticalPadding,
|
|
47
47
|
$horizontalPadding: horizontalPadding,
|
|
48
|
-
height: height,
|
|
49
|
-
minHeight: minHeight,
|
|
50
|
-
width: width,
|
|
48
|
+
$height: height,
|
|
49
|
+
$minHeight: minHeight,
|
|
50
|
+
$width: width,
|
|
51
51
|
$minWidth: minWidth
|
|
52
52
|
}, badgeIcon && React__default.createElement(BadgeIcon, {
|
|
53
53
|
$useGutter: !!badgeContent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/data/Badge/Badge.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport * as S from './Badge.styled';\n\n/**\n * Badges show a bubble containing a `number` or a `string`. It may be used by itself or with children passed as props\n * (to display a badge on top of an icon, for example, pass the icon as the child).\n *\n * If the badge content is passed as a `float`, it will be rounded up to the nearest `integer`,\n * and if the number is higher than 1 000 or 1 000 000 it will be abbreviated to for example \"1.4K\" or \"1.4M\" respectively.\n * If you need to display a `float` instead of a rounded `integer`, pass it as a `string` instead (e.g. \"1,4\").\n *\n * ### Import\n *\n * ``` js\n * import { Badge } from '@ntbjs/react-components/data'\n * // or\n * import Badge from '@ntbjs/react-components/data/Badge'\n * ```\n * ## Props\n * ```\n * Pass `badgeIcon={<svg></svg>}` to display an icon.\n * Pass a number or string to the badgeContent to display it alongside the icon.\n * Pass `align={\"left\"}`or `align={\"center\"}` to align content.\n * Pass `elevated={true}` to display the badge on top of the children\n * Pass `active={true}` to reflect the active status of the badge\n * Pass `error={true}` to reflect the error status of the badge\n * Pass `warning={true}` to reflect the warning status of the badge\n * Pass `fontSize={15}` to set the font size of the badge in pixel\n * Pass `fontWeight={500}` to set the font weight of the badge\n * Pass `lineHeight={12}` to set the line height of the badge in pixel\n * Pass `colors={[#ffffff, #000000]}` to set the font color of the badge\n * Pass `backgroundColors={[#ffffff, #000000]}` to set the background color of the badge\n * Pass `verticalPadding={15}` to set the bottom and top padding of the badge in pixel\n * Pass `horizontalPadding={20}` to set the left and right padding of the badge in pixel\n * Pass `height={24}` to set the height of the badge in pixel\n * Pass `minHeight={24}` to set the minimum height of the badge in pixel\n * Pass `width={50}` to set the width of the badge in pixel\n * Pass `minWidth={32}` to set the minimum width of the badge in pixel\n * ```\n */\nconst Badge = React.forwardRef(function Badge(\n {\n badgeContent,\n badgeIcon,\n children,\n elevated,\n fontSize,\n fontWeight,\n lineHeight,\n active,\n error,\n warning,\n backgroundColors,\n colors,\n verticalPadding,\n horizontalPadding,\n height,\n minHeight,\n width,\n minWidth,\n ...props\n },\n forwardedRef\n) {\n if (typeof badgeContent === 'number') {\n badgeContent = Intl.NumberFormat('en', { notation: 'compact' }).format(badgeContent);\n }\n\n return (\n <S.Badge ref={forwardedRef} $elevated={elevated} $hasChildren={Boolean(children)} {...props}>\n {children && <S.BadgeChildrenContainer>{children}</S.BadgeChildrenContainer>}\n {(badgeIcon || badgeContent) && (\n <S.BadgeLabel\n $backgroundColors={backgroundColors}\n $colors={colors}\n $elevated={elevated}\n fontSize={fontSize}\n fontWeight={fontWeight}\n $lineHeight={lineHeight}\n $active={active}\n $error={error}\n $warning={warning}\n $
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/components/data/Badge/Badge.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport * as S from './Badge.styled';\n\n/**\n * Badges show a bubble containing a `number` or a `string`. It may be used by itself or with children passed as props\n * (to display a badge on top of an icon, for example, pass the icon as the child).\n *\n * If the badge content is passed as a `float`, it will be rounded up to the nearest `integer`,\n * and if the number is higher than 1 000 or 1 000 000 it will be abbreviated to for example \"1.4K\" or \"1.4M\" respectively.\n * If you need to display a `float` instead of a rounded `integer`, pass it as a `string` instead (e.g. \"1,4\").\n *\n * ### Import\n *\n * ``` js\n * import { Badge } from '@ntbjs/react-components/data'\n * // or\n * import Badge from '@ntbjs/react-components/data/Badge'\n * ```\n * ## Props\n * ```\n * Pass `badgeIcon={<svg></svg>}` to display an icon.\n * Pass a number or string to the badgeContent to display it alongside the icon.\n * Pass `align={\"left\"}`or `align={\"center\"}` to align content.\n * Pass `elevated={true}` to display the badge on top of the children\n * Pass `active={true}` to reflect the active status of the badge\n * Pass `error={true}` to reflect the error status of the badge\n * Pass `warning={true}` to reflect the warning status of the badge\n * Pass `fontSize={15}` to set the font size of the badge in pixel\n * Pass `fontWeight={500}` to set the font weight of the badge\n * Pass `lineHeight={12}` to set the line height of the badge in pixel\n * Pass `colors={[#ffffff, #000000]}` to set the font color of the badge\n * Pass `backgroundColors={[#ffffff, #000000]}` to set the background color of the badge\n * Pass `verticalPadding={15}` to set the bottom and top padding of the badge in pixel\n * Pass `horizontalPadding={20}` to set the left and right padding of the badge in pixel\n * Pass `height={24}` to set the height of the badge in pixel\n * Pass `minHeight={24}` to set the minimum height of the badge in pixel\n * Pass `width={50}` to set the width of the badge in pixel\n * Pass `minWidth={32}` to set the minimum width of the badge in pixel\n * ```\n */\nconst Badge = React.forwardRef(function Badge(\n {\n badgeContent,\n badgeIcon,\n children,\n elevated,\n fontSize,\n fontWeight,\n lineHeight,\n active,\n error,\n warning,\n backgroundColors,\n colors,\n verticalPadding,\n horizontalPadding,\n height,\n minHeight,\n width,\n minWidth,\n ...props\n },\n forwardedRef\n) {\n if (typeof badgeContent === 'number') {\n badgeContent = Intl.NumberFormat('en', { notation: 'compact' }).format(badgeContent);\n }\n\n return (\n <S.Badge ref={forwardedRef} $elevated={elevated} $hasChildren={Boolean(children)} {...props}>\n {children && <S.BadgeChildrenContainer>{children}</S.BadgeChildrenContainer>}\n {(badgeIcon || badgeContent) && (\n <S.BadgeLabel\n $backgroundColors={backgroundColors}\n $colors={colors}\n $elevated={elevated}\n $fontSize={fontSize}\n $fontWeight={fontWeight}\n $lineHeight={lineHeight}\n $active={active}\n $error={error}\n $warning={warning}\n $verticalPadding={verticalPadding}\n $horizontalPadding={horizontalPadding}\n $height={height}\n $minHeight={minHeight}\n $width={width}\n $minWidth={minWidth}\n >\n {badgeIcon && <S.BadgeIcon $useGutter={!!badgeContent}>{badgeIcon}</S.BadgeIcon>}\n {badgeContent}\n </S.BadgeLabel>\n )}\n </S.Badge>\n );\n});\n\nBadge.propTypes = {\n /**\n * An Icon to show in the badge alongside with a text\n */\n badgeIcon: PropTypes.node,\n\n /**\n * Content to be showed in the badge – e.g. number of results.\n */\n badgeContent: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.number,\n PropTypes.func,\n PropTypes.element\n ]),\n\n /**\n * The element(s) for which the badge will be displayed – e.g. an icon or a text.\n */\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),\n\n /**\n * Whether the badge should be displayed in an elevated position on top of the child element(s) or not.\n */\n elevated: PropTypes.bool,\n\n /**\n * Whether the element is active or not (e.g. the currently selected menu item). This changes the color of the badge.\n */\n active: PropTypes.bool,\n\n /**\n * There is an error present – 'error be prioritized over warnings if both are set to `true`.\n */\n error: PropTypes.bool,\n\n /**\n * There is a warning present.\n */\n warning: PropTypes.bool,\n /**\n * Font size for the badge\n */\n fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Font weight for the badge\n */\n fontWeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Line weight for the badge\n */\n lineHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Colors of the font in the manner of [darkThemeColor, lightThemeColor]\n */\n colors: PropTypes.arrayOf(PropTypes.string),\n /**\n * Background colors for the badge in the manner of [darkThemeColor, lightThemeColor]\n */\n backgroundColors: PropTypes.arrayOf(PropTypes.string),\n /**\n * Top and bottom padding for the badge\n */\n verticalPadding: PropTypes.number,\n /**\n * Left and right padding for the badge\n */\n horizontalPadding: PropTypes.number,\n /**\n * Height of the badge\n */\n height: PropTypes.number,\n /**\n * Minimum height of the badge\n */\n minHeight: PropTypes.number,\n /**\n * Width of the badge\n */\n width: PropTypes.number,\n /**\n * Minimum width of the badge\n */\n minWidth: PropTypes.number\n};\n\nBadge.defaultProps = {\n elevated: false,\n active: false,\n error: false,\n warning: false,\n badgeIcon: null,\n fontWeight: 'normal',\n lineHeight: 'normal'\n};\n\nexport default Badge;\n"],"names":["Badge","React","forwardRef","badgeContent","badgeIcon","children","elevated","fontSize","fontWeight","lineHeight","active","error","warning","backgroundColors","colors","verticalPadding","horizontalPadding","height","minHeight","width","minWidth","props","forwardedRef","Intl","NumberFormat","notation","format","createElement","S","_extends","ref","$elevated","$hasChildren","Boolean","$backgroundColors","$colors","$fontSize","$fontWeight","$lineHeight","$active","$error","$warning","$verticalPadding","$horizontalPadding","$height","$minHeight","$width","$minWidth","$useGutter","propTypes","process","env","NODE_ENV","PropTypes","node","oneOfType","string","number","func","element","bool","arrayOf","defaultProps"],"mappings":";;;;;AAyCMA,MAAAA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAC3C;EACEG,YAAY;EACZC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,UAAU;EACVC,UAAU;EACVC,MAAM;EACNC,KAAK;EACLC,OAAO;EACPC,gBAAgB;EAChBC,MAAM;EACNC,eAAe;EACfC,iBAAiB;EACjBC,MAAM;EACNC,SAAS;EACTC,KAAK;EACLC,QAAQ;EACR,GAAGC,KAAAA;AACL,CAAC,EACDC,YAAY,EACZ;AACA,EAAA,IAAI,OAAOnB,YAAY,KAAK,QAAQ,EAAE;AACpCA,IAAAA,YAAY,GAAGoB,IAAI,CAACC,YAAY,CAAC,IAAI,EAAE;AAAEC,MAAAA,QAAQ,EAAE,SAAA;AAAU,KAAC,CAAC,CAACC,M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EAAEiC,SAAS,CAACI,MAAAA;AACtB,CAAC,GAAA,EAAA,CAAA;AAEDzD,KAAK,CAAC8D,YAAY,GAAG;AACnBxD,EAAAA,QAAQ,EAAE,KAAK;AACfI,EAAAA,MAAM,EAAE,KAAK;AACbC,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,OAAO,EAAE,KAAK;AACdR,EAAAA,SAAS,EAAE,IAAI;AACfI,EAAAA,UAAU,EAAE,QAAQ;AACpBC,EAAAA,UAAU,EAAE,QAAA;AACd,CAAC;;;;"}
|
|
@@ -33,36 +33,35 @@ const BadgeLabel = styled.span.withConfig({
|
|
|
33
33
|
box-sizing: border-box;
|
|
34
34
|
|
|
35
35
|
font-size: ${props => {
|
|
36
|
-
if (props
|
|
37
|
-
return `${props
|
|
36
|
+
if (props.$fontSize) {
|
|
37
|
+
return `${props.$fontSize}px`;
|
|
38
38
|
} else {
|
|
39
|
-
return props
|
|
39
|
+
return props.$elevated ? '0.625rem' : '0.750rem';
|
|
40
40
|
}
|
|
41
41
|
}};
|
|
42
|
-
font-weight: ${props => props
|
|
42
|
+
font-weight: ${props => props.$fontWeight ? props.$fontWeight : 'normal'};
|
|
43
43
|
line-height: ${props => props.$lineHeight ? `${props.$lineHeight}px` : 'normal'};
|
|
44
|
-
height: ${props => props
|
|
44
|
+
height: ${props => props.$height ? `${props.$height}px` : 'fit-content'};
|
|
45
45
|
letter-spacing: 0.32px;
|
|
46
46
|
margin-left: ${props => props.$elevated ? '15px' : 'auto'};
|
|
47
47
|
position: ${props => props.$elevated ? 'absolute' : 'initial'};
|
|
48
48
|
right: 0;
|
|
49
49
|
transform: ${props => props.$elevated ? 'translate(33%, -8px)' : 'initial'};
|
|
50
50
|
|
|
51
|
-
${props => props
|
|
52
|
-
width: ${props
|
|
51
|
+
${props => props.$width ? css`
|
|
52
|
+
width: ${props.$width}px;
|
|
53
53
|
` : null}
|
|
54
54
|
|
|
55
55
|
${props => props.$minWidth ? css`
|
|
56
56
|
min-width: ${props.$minWidth}px;
|
|
57
57
|
` : null}
|
|
58
58
|
|
|
59
|
-
${props => props
|
|
60
|
-
min-height: ${props
|
|
59
|
+
${props => props.$minHeight ? css`
|
|
60
|
+
min-height: ${props.$minHeight}px;
|
|
61
61
|
` : null}
|
|
62
|
-
|
|
63
62
|
|
|
64
63
|
${props => {
|
|
65
|
-
const verticalPadding = props
|
|
64
|
+
const verticalPadding = props.$verticalPadding ? `${props.$verticalPadding}px` : props.$elevated ? '4px' : '6px';
|
|
66
65
|
const horizontalPadding = props.$horizontalPadding ? `${props.$horizontalPadding}px` : props.$elevated ? '7px' : '10px';
|
|
67
66
|
return css`
|
|
68
67
|
padding: ${verticalPadding} ${horizontalPadding};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.styled.js","sources":["../../../src/components/data/Badge/Badge.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst shouldForwardProp = prop => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Badge = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-content: center;\n display: ${props => (props.$elevated || !props.$hasChildren ? 'inline-flex' : 'flex')};\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 500;\n min-height: 24px;\n position: relative;\n width: ${props => (props.$elevated ? 'fit-content' : 'initial')};\n`;\n\nexport const BadgeChildrenContainer = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-self: center;\n height: fit-content;\n margin-right: 8px;\n`;\n\nexport const BadgeLabel = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n border-radius: ${props => (props.$elevated ? '12px' : '14px')};\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n\n font-size: ${props => {\n if (props.fontSize) {\n return `${props.fontSize}px`;\n } else {\n return props.elevated ? '0.625rem' : '0.750rem';\n }\n }};\n font-weight: ${props => (props.fontWeight ? props.fontWeight : 'normal')};\n line-height: ${props => (props.$lineHeight ? `${props.$lineHeight}px` : 'normal')};\n height: ${props => (props.height ? `${props.height}px` : 'fit-content')};\n letter-spacing: 0.32px;\n margin-left: ${props => (props.$elevated ? '15px' : 'auto')};\n position: ${props => (props.$elevated ? 'absolute' : 'initial')};\n right: 0;\n transform: ${props => (props.$elevated ? 'translate(33%, -8px)' : 'initial')};\n\n ${props =>\n props.width\n ? css`\n width: ${props.width}px;\n `\n : null}\n\n ${props =>\n props.$minWidth\n ? css`\n min-width: ${props.$minWidth}px;\n `\n : null}\n\n ${props =>\n props.minHeight\n ? css`\n min-height: ${props.minHeight}px;\n `\n : null}\n \n\n ${props => {\n const verticalPadding = props.verticalPadding\n ? `${props.verticalPadding}px`\n : props.$elevated\n ? '4px'\n : '6px';\n const horizontalPadding = props.$horizontalPadding\n ? `${props.$horizontalPadding}px`\n : props.$elevated\n ? '7px'\n : '10px';\n return css`\n padding: ${verticalPadding} ${horizontalPadding};\n `;\n }}\n\n ${props =>\n props.theme.themeProp(\n 'background',\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.backgroundColors?.[0] ?? props.theme.getColor('gray-600');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('gray-700');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-600');\n }\n },\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.$backgroundColors?.[1] ?? props.theme.getColor('gray-200');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('white');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-200');\n }\n }\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n () => {\n const defaultColor = props?.$colors?.[0] ?? props.theme.getColor('white');\n if ((props.$warning && !props.$error) || (props.error && !props.$active)) {\n return props.theme.getColor('gray-900');\n } else {\n return defaultColor;\n }\n },\n () => {\n const defaultColor = props?.$colors?.[1] ?? props.theme.getColor('gray-900');\n if (props.$error && props.$active) {\n return props.theme.getColor('white');\n } else {\n return defaultColor;\n }\n }\n )}\n`;\n\nexport const BadgeIcon = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: flex;\n align-items: center;\n margin-right: ${props => (props.$useGutter ? '4px' : 0)};\n svg {\n height: 12px;\n }\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Badge","styled","span","withConfig","attrs","applyDefaultTheme","props","$elevated","$hasChildren","theme","primaryFontFamily","BadgeChildrenContainer","BadgeLabel","fontSize","elevated","fontWeight","$lineHeight","height","width","css","$minWidth","minHeight","verticalPadding","horizontalPadding","$horizontalPadding","themeProp","active","$active","error","$error","warning","$warning","defaultBgColor","backgroundColors","getColor","$backgroundColors","defaultColor","$colors","BadgeIcon","$useGutter"],"mappings":";;;AAGA,MAAMA,iBAAiB,GAAGC,IAAI,IAAI;EAChC,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AAClD,CAAC,CAAA;AAEM,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAC7BC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA,WAAA,EAAaC,KAAK,IAAKA,KAAK,CAACC,SAAS,IAAI,CAACD,KAAK,CAACE,Y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M;AACJ,EAAA,MAAMW,YAAY,GAAG9B,KAAK,EAAE+B,OAAO,GAAG,CAAC,CAAC,IAAI/B,KAAK,CAACG,KAAK,CAACyB,QAAQ,CAAC,OAAO,CAAC,CAAA;AACzE,EAAA,IAAK5B,KAAK,CAACyB,QAAQ,IAAI,CAACzB,KAAK,CAACuB,MAAM,IAAMvB,KAAK,CAACsB,KAAK,IAAI,CAACtB,KAAK,CAACqB,OAAQ,EAAE;AACxE,IAAA,OAAOrB,KAAK,CAACG,KAAK,CAACyB,QAAQ,CAAC,UAAU,CAAC,CAAA;AACzC,GAAC,MAAM;AACL,IAAA,OAAOE,YAAY,CAAA;AACrB,GAAA;AACF,CAAC,EACD,MAAM;AACJ,EAAA,MAAMA,YAAY,GAAG9B,KAAK,EAAE+B,OAAO,GAAG,CAAC,CAAC,IAAI/B,KAAK,CAACG,KAAK,CAACyB,QAAQ,CAAC,UAAU,CAAC,CAAA;AAC5E,EAAA,IAAI5B,KAAK,CAACuB,MAAM,IAAIvB,KAAK,CAACqB,OAAO,EAAE;AACjC,IAAA,OAAOrB,KAAK,CAACG,KAAK,CAACyB,QAAQ,CAAC,OAAO,CAAC,CAAA;AACtC,GAAC,MAAM;AACL,IAAA,OAAOE,YAAY,CAAA;AACrB,GAAA;AACF,CACF,CAAC,CAAA;AACP,EAAC;AAEM,MAAME,SAAS,GAAGrC,MAAM,CAACC,IAAI,CACjCC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA,gBAAkBC,EAAAA,KAAK,IAAKA,KAAK,CAACiC,UAAU,GAAG,KAAK,GAAG,CAAE,CAAA;AACzD;AACA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"Badge.styled.js","sources":["../../../src/components/data/Badge/Badge.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst shouldForwardProp = prop => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Badge = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-content: center;\n display: ${props => (props.$elevated || !props.$hasChildren ? 'inline-flex' : 'flex')};\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 500;\n min-height: 24px;\n position: relative;\n width: ${props => (props.$elevated ? 'fit-content' : 'initial')};\n`;\n\nexport const BadgeChildrenContainer = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-self: center;\n height: fit-content;\n margin-right: 8px;\n`;\n\nexport const BadgeLabel = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n border-radius: ${props => (props.$elevated ? '12px' : '14px')};\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n\n font-size: ${props => {\n if (props.$fontSize) {\n return `${props.$fontSize}px`;\n } else {\n return props.$elevated ? '0.625rem' : '0.750rem';\n }\n }};\n font-weight: ${props => (props.$fontWeight ? props.$fontWeight : 'normal')};\n line-height: ${props => (props.$lineHeight ? `${props.$lineHeight}px` : 'normal')};\n height: ${props => (props.$height ? `${props.$height}px` : 'fit-content')};\n letter-spacing: 0.32px;\n margin-left: ${props => (props.$elevated ? '15px' : 'auto')};\n position: ${props => (props.$elevated ? 'absolute' : 'initial')};\n right: 0;\n transform: ${props => (props.$elevated ? 'translate(33%, -8px)' : 'initial')};\n\n ${props =>\n props.$width\n ? css`\n width: ${props.$width}px;\n `\n : null}\n\n ${props =>\n props.$minWidth\n ? css`\n min-width: ${props.$minWidth}px;\n `\n : null}\n\n ${props =>\n props.$minHeight\n ? css`\n min-height: ${props.$minHeight}px;\n `\n : null}\n\n ${props => {\n const verticalPadding = props.$verticalPadding\n ? `${props.$verticalPadding}px`\n : props.$elevated\n ? '4px'\n : '6px';\n const horizontalPadding = props.$horizontalPadding\n ? `${props.$horizontalPadding}px`\n : props.$elevated\n ? '7px'\n : '10px';\n return css`\n padding: ${verticalPadding} ${horizontalPadding};\n `;\n }}\n\n ${props =>\n props.theme.themeProp(\n 'background',\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.backgroundColors?.[0] ?? props.theme.getColor('gray-600');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('gray-700');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-600');\n }\n },\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.$backgroundColors?.[1] ?? props.theme.getColor('gray-200');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('white');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-200');\n }\n }\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n () => {\n const defaultColor = props?.$colors?.[0] ?? props.theme.getColor('white');\n if ((props.$warning && !props.$error) || (props.error && !props.$active)) {\n return props.theme.getColor('gray-900');\n } else {\n return defaultColor;\n }\n },\n () => {\n const defaultColor = props?.$colors?.[1] ?? props.theme.getColor('gray-900');\n if (props.$error && props.$active) {\n return props.theme.getColor('white');\n } else {\n return defaultColor;\n }\n }\n )}\n`;\n\nexport const BadgeIcon = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: flex;\n align-items: center;\n margin-right: ${props => (props.$useGutter ? '4px' : 0)};\n svg {\n height: 12px;\n }\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Badge","styled","span","withConfig","attrs","applyDefaultTheme","props","$elevated","$hasChildren","theme","primaryFontFamily","BadgeChildrenContainer","BadgeLabel","$fontSize","$fontWeight","$lineHeight","$height","$width","css","$minWidth","$minHeight","verticalPadding","$verticalPadding","horizontalPadding","$horizontalPadding","themeProp","active","$active","error","$error","warning","$warning","defaultBgColor","backgroundColors","getColor","$backgroundColors","defaultColor","$colors","BadgeIcon","$useGutter"],"mappings":";;;AAGA,MAAMA,iBAAiB,GAAGC,IAAI,IAAI;EAChC,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AAClD,CAAC,CAAA;AAEM,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAC7BC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA,WAAA,EAAaC,KAAK,IAAKA,KAAK,CAACC,SAAS,IAAI,CAACD,KAAK,CAACE,YAAY,GAAG,aAAa,GAAG,MAAO,CAAA;AACvF,eAAA,EAAiBF,KAAK,IAAIA,KAAK,CAACG,KAAK,CAACC,iBAAiB,CAAA;AACvD;AACA;AACA;AACA;AACA,SAAWJ,EAAAA,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,aAAa,GAAG,SAAU,CAAA;AACjE,EAAC;AAEM,MAAMI,sBAAsB,GAAGV,MAAM,CAACC,IAAI,CAC9CC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA;AACA,EAAC;AAEM,MAAMO,UAAU,GAAGX,MAAM,CAACC,IAAI,CAClCC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B,iBAAmBC,EAAAA,KAAK,IAAKA,KAAK,CAACC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,EAAA,IAAI5B,KAAK,CAACuB,MAAM,IAAIvB,KAAK,CAACqB,OAAO,EAAE;AACjC,IAAA,OAAOrB,KAAK,CAACG,KAAK,CAACyB,QAAQ,CAAC,OAAO,CAAC,CAAA;AACtC,GAAC,MAAM;AACL,IAAA,OAAOE,YAAY,CAAA;AACrB,GAAA;AACF,CACF,CAAC,CAAA;AACP,EAAC;AAEM,MAAME,SAAS,GAAGrC,MAAM,CAACC,IAAI,CACjCC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA,gBAAkBC,EAAAA,KAAK,IAAKA,KAAK,CAACiC,UAAU,GAAG,KAAK,GAAG,CAAE,CAAA;AACzD;AACA;AACA;AACA;;;;"}
|
|
@@ -85,7 +85,7 @@ const CompactTextInput = React__default.forwardRef(function CompactTextInput({
|
|
|
85
85
|
placeholder: placeholder,
|
|
86
86
|
defaultValue: defaultValue,
|
|
87
87
|
value: value,
|
|
88
|
-
type: type,
|
|
88
|
+
$type: type,
|
|
89
89
|
$bold: bold,
|
|
90
90
|
$haslink: !isEmpty(link),
|
|
91
91
|
onFocus: onFocus,
|
|
@@ -135,7 +135,7 @@ const CompactTextInput = React__default.forwardRef(function CompactTextInput({
|
|
|
135
135
|
},
|
|
136
136
|
target: linkTarget
|
|
137
137
|
}, currentValue)), !readOnly && !disabled && React__default.createElement(React__default.Fragment, null, React__default.createElement(InputIconContainer, {
|
|
138
|
-
type: type
|
|
138
|
+
$type: type
|
|
139
139
|
}, React__default.createElement(SvgEditNote, null)), isEmpty(label) && React__default.createElement(InputSuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon))));
|
|
140
140
|
});
|
|
141
141
|
CompactTextInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -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,CAAC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AC;;;;"}
|
|
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","$type","$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","one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M,EAAE;AACrBC,EAAAA,iBAAiB,EAAE,KAAK;EACxBS,QAAQ,EAAEA,MAAM,EAAC;AACnB,CAAC;;;;"}
|
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
import styled, {
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
2
|
import { applyDefaultTheme } from '../../utils/defaultTheme.js';
|
|
3
3
|
|
|
4
|
-
const fadeIn = keyframes`
|
|
5
|
-
from {
|
|
6
|
-
background-color: ${props => props.theme.themeProp('rgba(48, 130, 106, 0)', 'rgba(191, 224, 213, 0)')};
|
|
7
|
-
}
|
|
8
|
-
to {
|
|
9
|
-
background-color: ${props => props.theme.themeProp('rgba(48, 130, 106, 1)', 'rgba(191, 224, 213, 1)')};
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
12
|
-
const fadeOut = keyframes`
|
|
13
|
-
from {
|
|
14
|
-
background-color: ${props => props.theme.themeProp('rgba(48, 130, 106, 1)', 'rgba(191, 224, 213, 1)')};
|
|
15
|
-
}
|
|
16
|
-
to {
|
|
17
|
-
background-color: ${props => props.theme.themeProp('rgba(48, 130, 106, 0)', 'rgba(191, 224, 213, 0)')};
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
const fadeInCheck = keyframes`
|
|
21
|
-
from {
|
|
22
|
-
opacity: 0
|
|
23
|
-
}
|
|
24
|
-
to {
|
|
25
|
-
opacity: 1
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
const fadeOutCheck = keyframes`
|
|
29
|
-
from {
|
|
30
|
-
opacity: 1
|
|
31
|
-
}
|
|
32
|
-
to {
|
|
33
|
-
opacity: 0
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
4
|
const linkColor = css`
|
|
37
5
|
${props => props.theme.themeProp('color', '#ACCDC3', props.theme.getColor('emerald-500'))}
|
|
38
6
|
${props => !props.disabled && css`
|
|
@@ -91,8 +59,6 @@ const SuccessContainer = styled.div.withConfig({
|
|
|
91
59
|
opacity: 1;
|
|
92
60
|
pointer-events: none;
|
|
93
61
|
display: flex;
|
|
94
|
-
opacity: ${props => props.fadeIn ? 0 : 1};
|
|
95
|
-
animation: ${props => props.fadeIn ? fadeOutCheck : fadeInCheck} 0.5s ease-in-out;
|
|
96
62
|
transition: opacity 0.5s ease-in-out;
|
|
97
63
|
margin-right: 5px;
|
|
98
64
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-500'))}
|
|
@@ -107,8 +73,6 @@ const InputSuccessContainer = styled.div.withConfig({
|
|
|
107
73
|
pointer-events: none;
|
|
108
74
|
display: flex;
|
|
109
75
|
justify-content: flex-end;
|
|
110
|
-
opacity: ${props => props.fadeIn ? 0 : 1};
|
|
111
|
-
animation: ${props => props.fadeIn ? fadeOutCheck : fadeInCheck} 0.5s ease-in-out;
|
|
112
76
|
transition: opacity 0.5s ease-in-out;
|
|
113
77
|
position: relative;
|
|
114
78
|
margin-top: -20px;
|
|
@@ -126,13 +90,14 @@ const InputIconContainer = styled.div.withConfig({
|
|
|
126
90
|
border-top-right-radius: 3px;
|
|
127
91
|
border-bottom-right-radius: 3px;
|
|
128
92
|
padding: 5px 10px 0 0;
|
|
93
|
+
transition: opacity 250ms;
|
|
129
94
|
${props => props.theme.themeProp('background', css`
|
|
130
95
|
linear-gradient(-90deg,
|
|
131
|
-
${props => props
|
|
96
|
+
${props => props.$type === 'error' ? '#901d1d' : props.$type === 'warning' ? '#816600' : props.theme.getColor('gray-700')} 55%,
|
|
132
97
|
transparent)
|
|
133
98
|
`, css`
|
|
134
99
|
linear-gradient(-90deg,
|
|
135
|
-
${props => props
|
|
100
|
+
${props => props.$type === 'error' ? '#f7d5d0' : props.$type === 'warning' ? '#fffebf' : props.theme.getColor('gray-100')} 55%,
|
|
136
101
|
transparent)
|
|
137
102
|
`)};
|
|
138
103
|
|
|
@@ -144,12 +109,13 @@ const InputIconContainer = styled.div.withConfig({
|
|
|
144
109
|
bottom: 0;
|
|
145
110
|
color: ${props => props.theme.getColor('gray-400')};
|
|
146
111
|
|
|
147
|
-
${props => props
|
|
112
|
+
${props => props.$type === 'warning' && props.theme.themeProp('color', '#C3AF43', '#C3AF43')}
|
|
148
113
|
|
|
149
|
-
${props => props
|
|
114
|
+
${props => props.$type === 'error' && props.theme.themeProp('color', '#CB968F', '#CB968F')}
|
|
150
115
|
|
|
151
116
|
> svg {
|
|
152
117
|
width: 12px;
|
|
118
|
+
transition: opacity 250ms;
|
|
153
119
|
}
|
|
154
120
|
`;
|
|
155
121
|
const Input = styled.input.withConfig({
|
|
@@ -168,16 +134,17 @@ const Input = styled.input.withConfig({
|
|
|
168
134
|
padding: 1px 10px;
|
|
169
135
|
border-radius: 3px;
|
|
170
136
|
border: 1px solid transparent;
|
|
137
|
+
transition: border-color 350ms, background 350ms;
|
|
171
138
|
|
|
172
|
-
${props => {
|
|
173
|
-
if (props
|
|
139
|
+
${props => {
|
|
140
|
+
if (props.$type === 'error') {
|
|
174
141
|
return css`
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
} else if (props
|
|
142
|
+
${props.theme.themeProp('background', '#7f1b1b', '#FEE2E2')} !important;
|
|
143
|
+
`;
|
|
144
|
+
} else if (props.$type === 'warning') {
|
|
178
145
|
return css`
|
|
179
|
-
|
|
180
|
-
|
|
146
|
+
${props.theme.themeProp('background', '#634E01', '#FFFDE8')} !important;
|
|
147
|
+
`;
|
|
181
148
|
} else {
|
|
182
149
|
return props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'));
|
|
183
150
|
}
|
|
@@ -191,49 +158,36 @@ ${props => {
|
|
|
191
158
|
opacity: 0.5;
|
|
192
159
|
`}
|
|
193
160
|
|
|
194
|
-
${props => props.type === 'success' && css`
|
|
195
|
-
animation: ${props => props.type === 'success' ? fadeIn : fadeOut} 0.5s ease-in-out;
|
|
196
|
-
`}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
${props => props.theme.themeProp('color', props.theme.getColor('gray-200'), props.theme.getColor('gray-700'))}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
161
|
|
|
205
|
-
${props => props.haslink && css`
|
|
206
|
-
&&:not(:focus),
|
|
207
|
-
&&:read-only {
|
|
208
|
-
${linkColor}
|
|
209
|
-
}
|
|
210
|
-
&&:read-only {
|
|
211
|
-
cursor: default;
|
|
212
|
-
}
|
|
213
|
-
`};
|
|
214
162
|
|
|
215
|
-
|
|
163
|
+
${props => props.theme.themeProp('color', props.theme.getColor('gray-200'), props.theme.getColor('gray-700'))}
|
|
216
164
|
|
|
165
|
+
${props => props.$haslink && css`
|
|
166
|
+
&&:not(:focus),
|
|
167
|
+
&&:read-only {
|
|
168
|
+
${linkColor}
|
|
169
|
+
}
|
|
170
|
+
&&:read-only {
|
|
171
|
+
cursor: default;
|
|
172
|
+
}
|
|
173
|
+
`};
|
|
217
174
|
|
|
218
175
|
&&:not(:hover):not(:focus) {
|
|
219
|
-
|
|
220
176
|
${props => {
|
|
221
177
|
if (props.$edit) {
|
|
222
|
-
if (props
|
|
178
|
+
if (props.$type === 'error') {
|
|
223
179
|
return props.theme.themeProp('background', '#7f1b1b', '#FEE2E2');
|
|
224
|
-
} else if (props
|
|
180
|
+
} else if (props.$type === 'warning') {
|
|
225
181
|
return props.theme.themeProp('background', '#634E01', '#FFFDE8');
|
|
226
182
|
} else {
|
|
227
183
|
return props.theme.themeProp('background', 'rgba(39,39,42, 0.7)', 'rgba(244,244,245, 0.3)');
|
|
228
184
|
}
|
|
229
185
|
}
|
|
230
186
|
}}
|
|
231
|
-
|
|
232
|
-
|
|
233
187
|
|
|
234
188
|
${props => props.$edit && props.theme.themeProp('border-color', 'rgba(39,39,42, 0.7)', 'rgba(228,228,231, 0.3)')};
|
|
235
189
|
|
|
236
|
-
${props => props
|
|
190
|
+
${props => props.$haslink && css`
|
|
237
191
|
&&:not(:focus),
|
|
238
192
|
&&:read-only {
|
|
239
193
|
cursor: default;
|
|
@@ -243,20 +197,26 @@ ${props => {
|
|
|
243
197
|
}
|
|
244
198
|
|
|
245
199
|
&&:hover:not(:focus) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
200
|
+
${props => {
|
|
201
|
+
if (props.readOnly) {
|
|
202
|
+
if (props.$type === 'error') {
|
|
203
|
+
return props.theme.themeProp('background', '#7f1b1b', '#FEE2E2');
|
|
204
|
+
} else if (props.$type === 'warning') {
|
|
205
|
+
return props.theme.themeProp('background', '#634E01', '#FFFDE8');
|
|
206
|
+
}
|
|
207
|
+
return readOnlyBackground;
|
|
208
|
+
}
|
|
209
|
+
if (props.$type === 'error') {
|
|
210
|
+
return props.theme.themeProp('background', '#901d1d', '#F7D5D0');
|
|
211
|
+
} else if (props.$type === 'warning') {
|
|
212
|
+
return props.theme.themeProp('background', '#806403', '#FFFEBF');
|
|
213
|
+
} else {
|
|
214
|
+
return props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100'));
|
|
215
|
+
}
|
|
216
|
+
}}
|
|
252
217
|
|
|
253
218
|
${props => props.$edit && props.theme.themeProp('border-color', props.theme.getColor('gray-700'), props.theme.getColor('gray-100'))};
|
|
254
219
|
|
|
255
|
-
${props => props.type === 'warning' && props.theme.themeProp('background', '#806403', '#FFFEBF')};
|
|
256
|
-
|
|
257
|
-
${props => props.type === 'error' && props.theme.themeProp('background', '#901d1d', '#F7D5D0')};
|
|
258
|
-
|
|
259
|
-
|
|
260
220
|
${props => props.$haslink && css`
|
|
261
221
|
cursor: pointer;
|
|
262
222
|
&&:read-only {
|
|
@@ -264,48 +224,56 @@ ${props => {
|
|
|
264
224
|
cursor: default;
|
|
265
225
|
}
|
|
266
226
|
`}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
227
|
+
|
|
228
|
+
& + ${InputIconContainer} {
|
|
229
|
+
opacity: 1;
|
|
230
|
+
${props => props.$type === 'success' && css`
|
|
231
|
+
opacity: 0;
|
|
232
|
+
`}
|
|
233
|
+
}
|
|
272
234
|
|
|
273
235
|
${props => props.disabled && css`
|
|
274
236
|
background: none !important;
|
|
275
237
|
cursor: not-allowed;
|
|
276
238
|
`}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
239
|
+
|
|
240
|
+
${props => props.disabled && props.$haslink && css`
|
|
241
|
+
background: none !important;
|
|
242
|
+
cursor: not-allowed !important;
|
|
243
|
+
`}
|
|
282
244
|
}
|
|
283
245
|
|
|
284
246
|
&&:focus {
|
|
285
|
-
${props => !props.readOnly && props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100'))};
|
|
286
|
-
|
|
287
|
-
${props => props.readOnly && css`
|
|
288
|
-
${readOnlyBackground}
|
|
289
|
-
`};
|
|
290
|
-
|
|
291
|
-
${props => props.type === 'error' && !props.readOnly && props.theme.themeProp('color', props.theme.getColor('gray-200'), props.theme.getColor('gray-700'))};
|
|
292
|
-
|
|
293
|
-
${props => !props.readOnly && css`
|
|
294
|
-
border-color: ${props => props.theme.getColor('gray-600')};
|
|
295
|
-
`};
|
|
296
247
|
outline: none;
|
|
297
248
|
|
|
298
|
-
${props =>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
249
|
+
${props => {
|
|
250
|
+
if (props.readOnly) {
|
|
251
|
+
if (props.$type === 'error') {
|
|
252
|
+
return props.theme.themeProp('background', '#7f1b1b', '#FEE2E2');
|
|
253
|
+
} else if (props.$type === 'warning') {
|
|
254
|
+
return props.theme.themeProp('background', '#634E01', '#FFFDE8');
|
|
255
|
+
}
|
|
256
|
+
return readOnlyBackground;
|
|
257
|
+
}
|
|
258
|
+
if (props.$type === 'error') {
|
|
259
|
+
return css`
|
|
260
|
+
${props.theme.themeProp('border-color', '#D83018', '#D83018')}
|
|
261
|
+
${props.theme.themeProp('background', 'white', 'white')}
|
|
262
|
+
${props.theme.themeProp('color', 'black', 'black')}
|
|
263
|
+
`;
|
|
264
|
+
} else if (props.$type === 'warning') {
|
|
265
|
+
return css`
|
|
266
|
+
${props.theme.themeProp('border-color', '#F4E21E', '#F4E21E')}
|
|
267
|
+
${props.theme.themeProp('background', 'white', 'white')}
|
|
268
|
+
${props.theme.themeProp('color', 'black', 'black')}
|
|
269
|
+
`;
|
|
270
|
+
} else {
|
|
271
|
+
return css`
|
|
272
|
+
border-color: ${props.theme.getColor('gray-600')};
|
|
273
|
+
${props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100'))}
|
|
274
|
+
`;
|
|
275
|
+
}
|
|
276
|
+
}}
|
|
309
277
|
}
|
|
310
278
|
|
|
311
279
|
&&::placeholder {
|
|
@@ -313,6 +281,28 @@ ${props => {
|
|
|
313
281
|
opacity: 0.6;
|
|
314
282
|
}
|
|
315
283
|
|
|
284
|
+
&&:hover::placeholder {
|
|
285
|
+
${props => {
|
|
286
|
+
if (props.$type === 'warning') {
|
|
287
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-200'), props.theme.getColor('gray-700'));
|
|
288
|
+
} else if (props.$type === 'error') {
|
|
289
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-200'), props.theme.getColor('gray-700'));
|
|
290
|
+
}
|
|
291
|
+
return '';
|
|
292
|
+
}}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
&&:focus::placeholder {
|
|
296
|
+
${props => {
|
|
297
|
+
if (props.$type === 'warning') {
|
|
298
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-900'), props.theme.getColor('gray-900'));
|
|
299
|
+
} else if (props.$type === 'error') {
|
|
300
|
+
return props.theme.themeProp('color', props.theme.getColor('red-600'), props.theme.getColor('red-600'));
|
|
301
|
+
}
|
|
302
|
+
return '';
|
|
303
|
+
}}
|
|
304
|
+
}
|
|
305
|
+
|
|
316
306
|
${props => props.$bold && css`
|
|
317
307
|
font-size: 1rem;
|
|
318
308
|
font-weight: 500;
|