@ntbjs/react-components 2.0.1-rc.31 → 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/Radio/Radio.js +13 -4
- package/build/inputs/Radio/Radio.js.map +1 -1
- package/build/inputs/Radio/Radio.styled.js +40 -23
- package/build/inputs/Radio/Radio.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/styles/.config.scss +2 -2
- 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/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js +2 -2
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js +7 -7
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js +0 -4
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js.map +1 -1
- package/package.json +11 -4
- package/styles/.config.scss +2 -2
|
@@ -3,27 +3,31 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
import { applyDefaultTheme } from '../../utils/defaultTheme.js';
|
|
4
4
|
|
|
5
5
|
const radioSize = '18px';
|
|
6
|
-
const
|
|
7
|
-
return prop !== 'theme' && !prop.startsWith('$');
|
|
8
|
-
};
|
|
9
|
-
const RadioLabel = styled.div.withConfig({
|
|
10
|
-
shouldForwardProp
|
|
11
|
-
}).attrs(applyDefaultTheme)`
|
|
6
|
+
const RadioLabel = styled.div.attrs(applyDefaultTheme)`
|
|
12
7
|
padding-left: ${math(`${radioSize} + 10px`)};
|
|
13
8
|
font-weight: 400;
|
|
14
9
|
font-size: 0.875rem;
|
|
10
|
+
pointer-events: none;
|
|
15
11
|
|
|
16
12
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'))};
|
|
17
13
|
`;
|
|
18
|
-
const Radio = styled.label.
|
|
19
|
-
shouldForwardProp
|
|
20
|
-
}).attrs(applyDefaultTheme)`
|
|
14
|
+
const Radio = styled.label.attrs(applyDefaultTheme)`
|
|
21
15
|
display: block;
|
|
22
16
|
position: relative;
|
|
23
|
-
cursor: pointer;
|
|
17
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
|
|
24
18
|
line-height: ${radioSize};
|
|
25
19
|
user-select: none;
|
|
26
20
|
|
|
21
|
+
input[type='radio'] {
|
|
22
|
+
position: absolute;
|
|
23
|
+
opacity: 0;
|
|
24
|
+
width: ${radioSize};
|
|
25
|
+
height: ${radioSize};
|
|
26
|
+
margin: 0;
|
|
27
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
|
|
28
|
+
z-index: 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
&::before {
|
|
28
32
|
content: '';
|
|
29
33
|
position: absolute;
|
|
@@ -31,9 +35,16 @@ const Radio = styled.label.withConfig({
|
|
|
31
35
|
width: ${radioSize};
|
|
32
36
|
height: ${radioSize};
|
|
33
37
|
top: 0;
|
|
38
|
+
left: 0;
|
|
34
39
|
border-radius: 50%;
|
|
35
40
|
transition: all 200ms;
|
|
36
41
|
box-sizing: border-box;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
|
|
44
|
+
/* Apply checked styling based on $isChecked prop */
|
|
45
|
+
${props => props.$isChecked && css`
|
|
46
|
+
border-color: ${props.theme.getColor('emerald-500')};
|
|
47
|
+
`}
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
&::after {
|
|
@@ -44,30 +55,32 @@ const Radio = styled.label.withConfig({
|
|
|
44
55
|
top: 5px;
|
|
45
56
|
left: 5px;
|
|
46
57
|
border-radius: 50%;
|
|
58
|
+
background: transparent;
|
|
47
59
|
transform: scale(0);
|
|
48
60
|
transition: all 200ms;
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
|
|
63
|
+
/* Apply checked styling based on $isChecked prop */
|
|
64
|
+
${props => props.$isChecked && css`
|
|
65
|
+
background: ${props.theme.getColor('emerald-500')};
|
|
66
|
+
transform: scale(1);
|
|
67
|
+
`}
|
|
49
68
|
}
|
|
50
69
|
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
/* Fallback: :has() selector for browsers that support it */
|
|
71
|
+
&:has(input[type='radio']:checked) {
|
|
72
|
+
&::before {
|
|
53
73
|
border-color: ${props => props.theme.getColor('emerald-500')};
|
|
54
74
|
}
|
|
55
75
|
|
|
56
|
-
|
|
76
|
+
&::after {
|
|
57
77
|
background: ${props => props.theme.getColor('emerald-500')};
|
|
58
78
|
transform: scale(1);
|
|
59
79
|
}
|
|
60
|
-
|
|
61
|
-
${RadioLabel} {
|
|
62
|
-
opacity: 1;
|
|
63
|
-
}
|
|
64
80
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
opacity: 0;
|
|
69
|
-
pointer-events: none;
|
|
70
|
-
}
|
|
81
|
+
|
|
82
|
+
input[type='radio']:checked + ${RadioLabel} {
|
|
83
|
+
opacity: 1;
|
|
71
84
|
}
|
|
72
85
|
|
|
73
86
|
${props => props.readOnly && css`
|
|
@@ -80,6 +93,10 @@ const Radio = styled.label.withConfig({
|
|
|
80
93
|
opacity: 0.5;
|
|
81
94
|
cursor: not-allowed;
|
|
82
95
|
user-select: text;
|
|
96
|
+
|
|
97
|
+
input[type='radio'] {
|
|
98
|
+
cursor: not-allowed;
|
|
99
|
+
}
|
|
83
100
|
`}
|
|
84
101
|
`;
|
|
85
102
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.styled.js","sources":["../../../src/components/inputs/Radio/Radio.styled.js"],"sourcesContent":["import { math } from 'polished';\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst radioSize = '18px';\n\
|
|
1
|
+
{"version":3,"file":"Radio.styled.js","sources":["../../../src/components/inputs/Radio/Radio.styled.js"],"sourcesContent":["import { math } from 'polished';\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst radioSize = '18px';\n\nexport const RadioLabel = styled.div.attrs(applyDefaultTheme)`\n padding-left: ${math(`${radioSize} + 10px`)};\n font-weight: 400;\n font-size: 0.875rem;\n pointer-events: none;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-300'),\n props.theme.getColor('gray-600')\n )};\n`;\n\nexport const Radio = styled.label.attrs(applyDefaultTheme)`\n display: block;\n position: relative;\n cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};\n line-height: ${radioSize};\n user-select: none;\n\n input[type='radio'] {\n position: absolute;\n opacity: 0;\n width: ${radioSize};\n height: ${radioSize};\n margin: 0;\n cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};\n z-index: 1;\n }\n\n &::before {\n content: '';\n position: absolute;\n border: 2px solid ${props => props.theme.getColor('gray-300')};\n width: ${radioSize};\n height: ${radioSize};\n top: 0;\n left: 0;\n border-radius: 50%;\n transition: all 200ms;\n box-sizing: border-box;\n pointer-events: none;\n\n /* Apply checked styling based on $isChecked prop */\n ${props =>\n props.$isChecked &&\n css`\n border-color: ${props.theme.getColor('emerald-500')};\n `}\n }\n\n &::after {\n content: '';\n position: absolute;\n width: 8px;\n height: 8px;\n top: 5px;\n left: 5px;\n border-radius: 50%;\n background: transparent;\n transform: scale(0);\n transition: all 200ms;\n pointer-events: none;\n\n /* Apply checked styling based on $isChecked prop */\n ${props =>\n props.$isChecked &&\n css`\n background: ${props.theme.getColor('emerald-500')};\n transform: scale(1);\n `}\n }\n\n /* Fallback: :has() selector for browsers that support it */\n &:has(input[type='radio']:checked) {\n &::before {\n border-color: ${props => props.theme.getColor('emerald-500')};\n }\n\n &::after {\n background: ${props => props.theme.getColor('emerald-500')};\n transform: scale(1);\n }\n }\n\n input[type='radio']:checked + ${RadioLabel} {\n opacity: 1;\n }\n\n ${props =>\n props.readOnly &&\n css`\n opacity: 0.5;\n pointer-events: none;\n user-select: text;\n `}\n\n ${props =>\n props.disabled &&\n css`\n opacity: 0.5;\n cursor: not-allowed;\n user-select: text;\n\n input[type='radio'] {\n cursor: not-allowed;\n }\n `}\n`;\n"],"names":["radioSize","RadioLabel","styled","div","attrs","applyDefaultTheme","math","props","theme","themeProp","getColor","Radio","label","disabled","$isChecked","css","readOnly"],"mappings":";;;;AAIA,MAAMA,SAAS,GAAG,MAAM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;AACA;AACA;AACA;AACA,IAAA,EAAMH,KAAK,IACLA,KAAK,CAACO,UAAU,IAChBC,GAAG,CAAA;AACT,oBAAA,EAAsBR,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAAA;AACzD;AACA,MAAO,CAAA,CAAA;AACP;AACA;AACA;AACA;AACA;AACA,oBAAsBH,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAAA;AAClE;AACA;AACA;AACA,kBAAoBH,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAAA;AAChE;AACA;AACA;AACA;AACA,gCAAA,EAAkCT,UAAU,CAAA;AAC5C;AACA;AACA;AACA,EAAA,EAAIM,KAAK,IACLA,KAAK,CAACS,QAAQ,IACdD,GAAG,CAAA;AACP;AACA;AACA;AACA,IAAK,CAAA,CAAA;AACL;AACA,EAAA,EAAIR,KAAK,IACLA,KAAK,CAACM,QAAQ,IACdE,GAAG,CAAA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAK,CAAA,CAAA;AACL;;;;"}
|
|
@@ -67,11 +67,11 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
67
67
|
$fieldLabel: !isEmpty(fieldLabel),
|
|
68
68
|
disabled: disabled,
|
|
69
69
|
readOnly: readOnly,
|
|
70
|
-
type: type,
|
|
70
|
+
$type: type,
|
|
71
71
|
className: className,
|
|
72
72
|
style: style
|
|
73
73
|
}, React__default.createElement(TextInputFieldIconAlert, {
|
|
74
|
-
type: type
|
|
74
|
+
$type: type
|
|
75
75
|
}, icon), React__default.createElement(TextInputField, _extends({
|
|
76
76
|
autoFocus: autoFocus,
|
|
77
77
|
$borderRadius: borderRadius,
|
|
@@ -85,7 +85,7 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
85
85
|
readOnly: readOnly,
|
|
86
86
|
disabled: disabled,
|
|
87
87
|
$edit: edit,
|
|
88
|
-
type: type,
|
|
88
|
+
$type: type,
|
|
89
89
|
autoComplete: autoComplete,
|
|
90
90
|
$hasIcon: Boolean(icon),
|
|
91
91
|
id: `text-input-${uniqueId}`,
|
|
@@ -108,7 +108,7 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
108
108
|
onKeyDown: onKeyDown,
|
|
109
109
|
onBlur: onBlur,
|
|
110
110
|
$noBorder: noBorder
|
|
111
|
-
}, rest)), !fieldLabel && (type === 'loading' || type === 'success') && React__default.createElement(SuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon), !readOnly && noBorder && React__default.createElement(InputIconContainer, {
|
|
111
|
+
}, rest)), !fieldLabel && (type === 'loading' || type === 'success') && React__default.createElement(SuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon), !readOnly && (edit || noBorder) && React__default.createElement(InputIconContainer, {
|
|
112
112
|
disabled: disabled
|
|
113
113
|
}, React__default.createElement(SvgEditNote, {
|
|
114
114
|
className: padding === 'small' ? 'smallPadingIcon' : undefined
|
|
@@ -118,7 +118,7 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
118
118
|
$hasIcon: Boolean(icon),
|
|
119
119
|
$inputIsEmpty: inputIsEmpty
|
|
120
120
|
}, label, required && ' *'), typeof description === 'string' && description.length > 0 && React__default.createElement(Description, {
|
|
121
|
-
type: type
|
|
121
|
+
$type: type
|
|
122
122
|
}, description)));
|
|
123
123
|
};
|
|
124
124
|
if (hidden) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","sources":["../../../src/components/inputs/TextArea/TextArea.js"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState, useMemo } from 'react';\n\nimport { isEmpty } from 'lodash';\nimport useMergedRefs from '@restart/hooks/useMergedRefs';\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\nimport { Tooltip } from '../../data';\n\nimport { ReactComponent as EditNoteIcon } from '../../../icons/edit-note.svg';\nimport * as S from './TextArea.styled';\n\n/**\n * Text areas let users enter and edit text in the UI. They typically appear in forms and dialogs.\n *\n * ### Import\n *\n * ``` js\n * import { TextArea } from '@ntbjs/react-components/inputs'\n * // or\n * import TextArea from '@ntbjs/react-components/inputs/TextArea'\n * ```\n */\nconst TextArea = React.forwardRef(function TextArea(\n {\n value,\n defaultValue,\n name,\n label,\n placeholder,\n required,\n disabled,\n hidden,\n readOnly,\n edit,\n autoComplete,\n description,\n type,\n icon,\n rows,\n className,\n style,\n onChange,\n onBlur,\n noBorder,\n loadingIcon,\n successIcon,\n padding,\n descriptionToolTip,\n borderRadius,\n fieldLabel,\n ...rest\n },\n forwardedRef\n) {\n const textInputDomNode = useRef(null);\n const textInputRef = useMergedRefs(forwardedRef, textInputDomNode);\n\n const [inputIsEmpty, setInputIsEmpty] = useState(!(value || defaultValue));\n const [autoFocus, setAutoFocus] = useState(false);\n\n const [uniqueId] = useState(nanoid());\n\n const memoizedDescriptionToolTip = useMemo(() => {\n return descriptionToolTip;\n }, [descriptionToolTip]);\n\n useEffect(() => {\n setAutoFocus(false);\n }, [value, defaultValue]);\n\n const onKeyDown = useCallback(event => {\n if (event.key === 'Enter') {\n event.stopPropagation();\n }\n }, []);\n\n const input = () => {\n return (\n <S.TextAreaContainter>\n {fieldLabel && (\n <S.Label htmlFor={uniqueId} disabled={disabled}>\n {fieldLabel}\n <S.SuccessContainerLabel>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.SuccessContainerLabel>\n </S.Label>\n )}\n <S.TextInput\n $fieldLabel={!isEmpty(fieldLabel)}\n disabled={disabled}\n readOnly={readOnly}\n type={type}\n className={className}\n style={style}\n >\n <S.TextInputFieldIconAlert type={type}>{icon}</S.TextInputFieldIconAlert>\n <S.TextInputField\n autoFocus={autoFocus}\n $borderRadius={borderRadius}\n ref={textInputRef}\n rows={rows}\n value={value}\n defaultValue={defaultValue}\n name={name}\n placeholder={placeholder || ' '}\n required={required}\n readOnly={readOnly}\n disabled={disabled}\n $edit={edit}\n type={type}\n autoComplete={autoComplete}\n $hasIcon={Boolean(icon)}\n id={`text-input-${uniqueId}`}\n key={uniqueId}\n $padding={padding}\n onChange={e => {\n if (e.target.value) {\n setInputIsEmpty(false);\n if (!autoFocus) {\n setAutoFocus(true);\n }\n } else {\n setInputIsEmpty(true);\n if (!autoFocus) {\n setAutoFocus(true);\n }\n }\n onChange(e);\n }}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n $noBorder={noBorder}\n {...rest}\n />\n {!fieldLabel && (type === 'loading' || type === 'success') && (\n <S.SuccessContainer>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.SuccessContainer>\n )}\n {!readOnly && noBorder && (\n <S.InputIconContainer disabled={disabled}>\n <EditNoteIcon className={padding === 'small' ? 'smallPadingIcon' : undefined} />\n </S.InputIconContainer>\n )}\n {label && (\n <S.TextInputLabel\n htmlFor={`text-input-${uniqueId}`}\n $hasPlaceholder={Boolean(placeholder)}\n $hasIcon={Boolean(icon)}\n $inputIsEmpty={inputIsEmpty}\n >\n {label}\n {required && ' *'}\n </S.TextInputLabel>\n )}\n {typeof description === 'string' && description.length > 0 && (\n <S.Description type={type}>{description}</S.Description>\n )}\n </S.TextInput>\n </S.TextAreaContainter>\n );\n };\n\n if (hidden) return null;\n\n return (\n <>\n {!memoizedDescriptionToolTip && input()}\n {memoizedDescriptionToolTip && (\n <div>\n <Tooltip\n content={memoizedDescriptionToolTip}\n key=\"tooltipTextArea1\"\n placement=\"bottom-end\"\n trigger={'mouseenter'}\n zIndex={999999}\n >\n {input()}\n </Tooltip>\n </div>\n )}\n </>\n );\n});\n\nTextArea.defaultProps = {\n rows: 4,\n noBorder: false,\n readOnly: false,\n edit: false,\n hidden: false,\n type: '',\n padding: 'medium',\n descriptionToolTip: '',\n onChange: () => {},\n borderRadius: 0\n};\n\nTextArea.propTypes = {\n /**\n * Value to be sent. Typically the content of the text area.\n */\n value: PropTypes.string,\n\n /**\n * Default value/text to be displayed in the text area by default.\n */\n defaultValue: PropTypes.string,\n\n /**\n * Name of the text area (used when sending form data)\n */\n name: PropTypes.string,\n\n /**\n * Label text for the text area. If the text area is empty (no input and no placeholder)\n * and isn't in focus, the label text will be displayed grayed out in the text area itself.\n * Otherwise, the label text will be displayed in the top left corner.\n */\n label: PropTypes.string,\n\n /**\n * Field Label text for the text area field. I\n */\n fieldLabel: PropTypes.string,\n\n /**\n * Placeholder text to be displayed if the text area is empty (no input)\n */\n placeholder: PropTypes.string,\n\n /**\n * Whether the user is required to fill in the text area\n */\n required: PropTypes.bool,\n\n /**\n * Whether the text area is disabled\n */\n disabled: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n /**\n * Whether the text area is read-only\n */\n readOnly: PropTypes.bool,\n /**\n * Displays a grey background to show that value is editable\n */\n edit: PropTypes.bool,\n /**\n * ?\n */\n autoComplete: PropTypes.string,\n /**\n * Descriptive text displayed below the text area\n */\n description: PropTypes.string,\n\n /**\n * Optional icon to be displayed left of the text inside the text area\n */\n icon: PropTypes.element,\n /**\n * How many rows/lines of text to be displayed by default\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Add custom class names to the HTML element\n */\n className: PropTypes.string,\n /**\n * Add custom CSS styling\n */\n style: PropTypes.object,\n /**\n * Add padding (small-medium-large)\n */\n padding: PropTypes.oneOf(['small', 'medium', 'large']),\n /**\n * Optional callback function for the `onChange` event\n */\n onChange: PropTypes.func,\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur: PropTypes.func,\n noBorder: PropTypes.bool,\n // warningAlert: PropTypes.bool,\n // errorAlert: PropTypes.bool,\n /**\n * Define the type based on error,error-border , warning, loading and success.\n */\n type: PropTypes.oneOf([\n '',\n 'error',\n 'error-border',\n 'warning-border',\n 'warning',\n 'loading',\n 'success'\n ]),\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 * Description ToolTip text.\n */\n descriptionToolTip: PropTypes.string,\n /**\n * Border Radius for rounded borders.\n */\n borderRadius: PropTypes.number\n};\n\nexport default TextArea;\n"],"names":["TextArea","React","forwardRef","value","defaultValue","name","label","placeholder","required","disabled","hidden","readOnly","edit","autoComplete","description","type","icon","rows","className","style","onChange","onBlur","noBorder","loadingIcon","successIcon","padding","descriptionToolTip","borderRadius","fieldLabel","rest","forwardedRef","textInputDomNode","useRef","textInputRef","useMergedRefs","inputIsEmpty","setInputIsEmpty","useState","autoFocus","setAutoFocus","uniqueId","nanoid","memoizedDescriptionToolTip","useMemo","useEffect","onKeyDown","useCallback","event","key","stopPropagation","input","createElement","S","htmlFor","$fieldLabel","isEmpty","_extends","$borderRadius","ref","$edit","$hasIcon","Boolean","id","$padding","e","target","$noBorder","EditNoteIcon","undefined","$hasPlaceholder","$inputIsEmpty","length","Fragment","Tooltip","content","placement","trigger","zIndex","defaultProps","propTypes","process","env","NODE_ENV","PropTypes","string","bool","element","oneOfType","number","object","oneOf","func"],"mappings":";;;;;;;;;;;;;;;;AAsBMA,MAAAA,QAAQ,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,QAAQA,CACjD;EACEG,KAAK;EACLC,YAAY;EACZC,IAAI;EACJC,KAAK;EACLC,WAAW;EACXC,QAAQ;EACRC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC,IAAI;EACJC,YAAY;EACZC,WAAW;EACXC,IAAI;EACJC,IAAI;EACJC,IAAI;EACJC,SAAS;EACTC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC,OAAO;EACPC,kBAAkB;EAClBC,YAAY;EACZC,UAAU;EACV,GAAGC,IAAAA;AACL,CAAC,EACDC,YAAY,EACZ;AACA,EAAA,MAAMC,gBAAgB,GAAGC,MAAM,CAAC,IAAI,CAAC,CAAA;AACrC,EAAA,MAAMC,YAA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D,YAAY,EAAEwD,SAAS,CAACK,MAAAA;AAC1B,CAAC,GAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"TextArea.js","sources":["../../../src/components/inputs/TextArea/TextArea.js"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState, useMemo } from 'react';\n\nimport { isEmpty } from 'lodash';\nimport useMergedRefs from '@restart/hooks/useMergedRefs';\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\nimport { Tooltip } from '../../data';\n\nimport { ReactComponent as EditNoteIcon } from '../../../icons/edit-note.svg';\nimport * as S from './TextArea.styled';\n\n/**\n * Text areas let users enter and edit text in the UI. They typically appear in forms and dialogs.\n *\n * ### Import\n *\n * ``` js\n * import { TextArea } from '@ntbjs/react-components/inputs'\n * // or\n * import TextArea from '@ntbjs/react-components/inputs/TextArea'\n * ```\n */\nconst TextArea = React.forwardRef(function TextArea(\n {\n value,\n defaultValue,\n name,\n label,\n placeholder,\n required,\n disabled,\n hidden,\n readOnly,\n edit,\n autoComplete,\n description,\n type,\n icon,\n rows,\n className,\n style,\n onChange,\n onBlur,\n noBorder,\n loadingIcon,\n successIcon,\n padding,\n descriptionToolTip,\n borderRadius,\n fieldLabel,\n ...rest\n },\n forwardedRef\n) {\n const textInputDomNode = useRef(null);\n const textInputRef = useMergedRefs(forwardedRef, textInputDomNode);\n\n const [inputIsEmpty, setInputIsEmpty] = useState(!(value || defaultValue));\n const [autoFocus, setAutoFocus] = useState(false);\n\n const [uniqueId] = useState(nanoid());\n\n const memoizedDescriptionToolTip = useMemo(() => {\n return descriptionToolTip;\n }, [descriptionToolTip]);\n\n useEffect(() => {\n setAutoFocus(false);\n }, [value, defaultValue]);\n\n const onKeyDown = useCallback(event => {\n if (event.key === 'Enter') {\n event.stopPropagation();\n }\n }, []);\n\n const input = () => {\n return (\n <S.TextAreaContainter>\n {fieldLabel && (\n <S.Label htmlFor={uniqueId} disabled={disabled}>\n {fieldLabel}\n <S.SuccessContainerLabel>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.SuccessContainerLabel>\n </S.Label>\n )}\n <S.TextInput\n $fieldLabel={!isEmpty(fieldLabel)}\n disabled={disabled}\n readOnly={readOnly}\n $type={type}\n className={className}\n style={style}\n >\n <S.TextInputFieldIconAlert $type={type}>{icon}</S.TextInputFieldIconAlert>\n <S.TextInputField\n autoFocus={autoFocus}\n $borderRadius={borderRadius}\n ref={textInputRef}\n rows={rows}\n value={value}\n defaultValue={defaultValue}\n name={name}\n placeholder={placeholder || ' '}\n required={required}\n readOnly={readOnly}\n disabled={disabled}\n $edit={edit}\n $type={type}\n autoComplete={autoComplete}\n $hasIcon={Boolean(icon)}\n id={`text-input-${uniqueId}`}\n key={uniqueId}\n $padding={padding}\n onChange={e => {\n if (e.target.value) {\n setInputIsEmpty(false);\n if (!autoFocus) {\n setAutoFocus(true);\n }\n } else {\n setInputIsEmpty(true);\n if (!autoFocus) {\n setAutoFocus(true);\n }\n }\n onChange(e);\n }}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n $noBorder={noBorder}\n {...rest}\n />\n {!fieldLabel && (type === 'loading' || type === 'success') && (\n <S.SuccessContainer>\n {type === 'loading' && loadingIcon}\n {type === 'success' && successIcon}\n </S.SuccessContainer>\n )}\n {!readOnly && (edit || noBorder) && (\n <S.InputIconContainer disabled={disabled}>\n <EditNoteIcon className={padding === 'small' ? 'smallPadingIcon' : undefined} />\n </S.InputIconContainer>\n )}\n {label && (\n <S.TextInputLabel\n htmlFor={`text-input-${uniqueId}`}\n $hasPlaceholder={Boolean(placeholder)}\n $hasIcon={Boolean(icon)}\n $inputIsEmpty={inputIsEmpty}\n >\n {label}\n {required && ' *'}\n </S.TextInputLabel>\n )}\n {typeof description === 'string' && description.length > 0 && (\n <S.Description $type={type}>{description}</S.Description>\n )}\n </S.TextInput>\n </S.TextAreaContainter>\n );\n };\n\n if (hidden) return null;\n\n return (\n <>\n {!memoizedDescriptionToolTip && input()}\n {memoizedDescriptionToolTip && (\n <div>\n <Tooltip\n content={memoizedDescriptionToolTip}\n key=\"tooltipTextArea1\"\n placement=\"bottom-end\"\n trigger={'mouseenter'}\n zIndex={999999}\n >\n {input()}\n </Tooltip>\n </div>\n )}\n </>\n );\n});\n\nTextArea.defaultProps = {\n rows: 4,\n noBorder: false,\n readOnly: false,\n edit: false,\n hidden: false,\n type: '',\n padding: 'medium',\n descriptionToolTip: '',\n onChange: () => {},\n borderRadius: 0\n};\n\nTextArea.propTypes = {\n /**\n * Value to be sent. Typically the content of the text area.\n */\n value: PropTypes.string,\n\n /**\n * Default value/text to be displayed in the text area by default.\n */\n defaultValue: PropTypes.string,\n\n /**\n * Name of the text area (used when sending form data)\n */\n name: PropTypes.string,\n\n /**\n * Label text for the text area. If the text area is empty (no input and no placeholder)\n * and isn't in focus, the label text will be displayed grayed out in the text area itself.\n * Otherwise, the label text will be displayed in the top left corner.\n */\n label: PropTypes.string,\n\n /**\n * Field Label text for the text area field. I\n */\n fieldLabel: PropTypes.string,\n\n /**\n * Placeholder text to be displayed if the text area is empty (no input)\n */\n placeholder: PropTypes.string,\n\n /**\n * Whether the user is required to fill in the text area\n */\n required: PropTypes.bool,\n\n /**\n * Whether the text area is disabled\n */\n disabled: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n /**\n * Whether the text area is read-only\n */\n readOnly: PropTypes.bool,\n /**\n * Displays a grey background to show that value is editable\n */\n edit: PropTypes.bool,\n /**\n * ?\n */\n autoComplete: PropTypes.string,\n /**\n * Descriptive text displayed below the text area\n */\n description: PropTypes.string,\n\n /**\n * Optional icon to be displayed left of the text inside the text area\n */\n icon: PropTypes.element,\n /**\n * How many rows/lines of text to be displayed by default\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Add custom class names to the HTML element\n */\n className: PropTypes.string,\n /**\n * Add custom CSS styling\n */\n style: PropTypes.object,\n /**\n * Add padding (small-medium-large)\n */\n padding: PropTypes.oneOf(['small', 'medium', 'large']),\n /**\n * Optional callback function for the `onChange` event\n */\n onChange: PropTypes.func,\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur: PropTypes.func,\n noBorder: PropTypes.bool,\n // warningAlert: PropTypes.bool,\n // errorAlert: PropTypes.bool,\n /**\n * Define the type based on error,error-border , warning, loading and success.\n */\n type: PropTypes.oneOf([\n '',\n 'error',\n 'error-border',\n 'warning-border',\n 'warning',\n 'loading',\n 'success'\n ]),\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 * Description ToolTip text.\n */\n descriptionToolTip: PropTypes.string,\n /**\n * Border Radius for rounded borders.\n */\n borderRadius: PropTypes.number\n};\n\nexport default TextArea;\n"],"names":["TextArea","React","forwardRef","value","defaultValue","name","label","placeholder","required","disabled","hidden","readOnly","edit","autoComplete","description","type","icon","rows","className","style","onChange","onBlur","noBorder","loadingIcon","successIcon","padding","descriptionToolTip","borderRadius","fieldLabel","rest","forwardedRef","textInputDomNode","useRef","textInputRef","useMergedRefs","inputIsEmpty","setInputIsEmpty","useState","autoFocus","setAutoFocus","uniqueId","nanoid","memoizedDescriptionToolTip","useMemo","useEffect","onKeyDown","useCallback","event","key","stopPropagation","input","createElement","S","htmlFor","$fieldLabel","isEmpty","$type","_extends","$borderRadius","ref","$edit","$hasIcon","Boolean","id","$padding","e","target","$noBorder","EditNoteIcon","undefined","$hasPlaceholder","$inputIsEmpty","length","Fragment","Tooltip","content","placement","trigger","zIndex","defaultProps","propTypes","process","env","NODE_ENV","PropTypes","string","bool","element","oneOfType","number","object","oneOf","func"],"mappings":";;;;;;;;;;;;;;;;AAsBMA,MAAAA,QAAQ,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,QAAQA,CACjD;EACEG,KAAK;EACLC,YAAY;EACZC,IAAI;EACJC,KAAK;EACLC,WAAW;EACXC,QAAQ;EACRC,QA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C,CAAC;EAItDvE,QAAQ,EAAEgE,SAAS,CAACQ,IAAI;EAIxBvE,MAAM,EAAE+D,SAAS,CAACQ,IAAI;EACtBtE,QAAQ,EAAE8D,SAAS,CAACE,IAAI;EAMxBvE,IAAI,EAAEqE,SAAS,CAACO,KAAK,CAAC,CACpB,EAAE,EACF,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,SAAS,CACV,CAAC;EAIFpE,WAAW,EAAE6D,SAAS,CAACG,OAAO;EAI9B/D,WAAW,EAAE4D,SAAS,CAACG,OAAO;EAI9B7D,kBAAkB,EAAE0D,SAAS,CAACC,MAAM;EAIpC1D,YAAY,EAAEyD,SAAS,CAACK,MAAAA;AAC1B,CAAC,GAAA,EAAA;;;;"}
|
|
@@ -107,25 +107,25 @@ const TextInputField = styled.textarea.withConfig({
|
|
|
107
107
|
`}
|
|
108
108
|
|
|
109
109
|
${props => {
|
|
110
|
-
if (props
|
|
110
|
+
if (props.$type === 'error') {
|
|
111
111
|
return css`
|
|
112
112
|
${props.theme.themeProp('color', 'white', 'black')}
|
|
113
113
|
${props.theme.themeProp('background', '#7f1b1b', '#FBEAE6')}
|
|
114
114
|
${props.theme.themeProp('border-color', '#7f1b1b', '#FBEAE6')}
|
|
115
115
|
`;
|
|
116
|
-
} else if (props
|
|
116
|
+
} else if (props.$type === 'warning') {
|
|
117
117
|
return css`
|
|
118
118
|
${props.theme.themeProp('color', 'white', 'black')}
|
|
119
119
|
${props.theme.themeProp('background', '#634E01', '#FFFDE8')}
|
|
120
120
|
${props.theme.themeProp('border-color', '#634E01', '#FFFDE8')}
|
|
121
121
|
`;
|
|
122
|
-
} else if (props
|
|
122
|
+
} else if (props.$type === 'error-border') {
|
|
123
123
|
return css`
|
|
124
124
|
${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
|
|
125
125
|
${props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'))}
|
|
126
126
|
${props.theme.themeProp('border-color', props.theme.getColor('red-200'), props.theme.getColor('red-500'))}
|
|
127
127
|
`;
|
|
128
|
-
} else if (props
|
|
128
|
+
} else if (props.$type === 'warning-border') {
|
|
129
129
|
return css`
|
|
130
130
|
${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
|
|
131
131
|
${props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'))}
|
|
@@ -152,15 +152,15 @@ const TextInputField = styled.textarea.withConfig({
|
|
|
152
152
|
`}
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
${props => props.$noBorder && !props
|
|
155
|
+
${props => props.$noBorder && !props.$type && css`
|
|
156
156
|
${props => props.theme.themeProp('border-color', props.theme.getColor('gray-900'), props.theme.getColor('white'))}
|
|
157
157
|
`}
|
|
158
158
|
|
|
159
|
-
${props => props.$noBorder && props
|
|
159
|
+
${props => props.$noBorder && props.$type === 'warning' && css`
|
|
160
160
|
${props => props.theme.themeProp('border-color', '#634E01', '#FFFDE8')}
|
|
161
161
|
`}
|
|
162
162
|
|
|
163
|
-
${props => props.$noBorder && props
|
|
163
|
+
${props => props.$noBorder && props.$type === 'error' && css`
|
|
164
164
|
${props => props.theme.themeProp('border-color', '#7f1b1b', '#FBEAE6')}
|
|
165
165
|
`}
|
|
166
166
|
|
|
@@ -190,16 +190,16 @@ const TextInputField = styled.textarea.withConfig({
|
|
|
190
190
|
return '';
|
|
191
191
|
}
|
|
192
192
|
if (props.readOnly) {
|
|
193
|
-
if (props
|
|
193
|
+
if (props.$type === 'error') {
|
|
194
194
|
return props.theme.themeProp('background', '#7f1b1b', '#FBEAE6');
|
|
195
|
-
} else if (props
|
|
195
|
+
} else if (props.$type === 'warning') {
|
|
196
196
|
return props.theme.themeProp('background', '#634E01', '#FFFDE8');
|
|
197
197
|
}
|
|
198
198
|
return '';
|
|
199
199
|
}
|
|
200
|
-
if (props
|
|
200
|
+
if (props.$type === 'error') {
|
|
201
201
|
return props.theme.themeProp('background', '#901d1d', '#F7D5D0');
|
|
202
|
-
} else if (props
|
|
202
|
+
} else if (props.$type === 'warning') {
|
|
203
203
|
return props.theme.themeProp('background', '#806403', '#FFFEBF');
|
|
204
204
|
} else if (!props.disabled) {
|
|
205
205
|
return props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100'));
|
|
@@ -209,55 +209,47 @@ const TextInputField = styled.textarea.withConfig({
|
|
|
209
209
|
|
|
210
210
|
${props => props.$edit && props.theme.themeProp('border-color', props.theme.getColor('gray-700'), props.theme.getColor('gray-100'))}
|
|
211
211
|
|
|
212
|
-
${props => props.$noBorder && !props.readOnly && props
|
|
212
|
+
${props => props.$noBorder && !props.readOnly && props.$type !== 'warning' && props.$type !== 'error' ? props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100')) : ''}
|
|
213
213
|
|
|
214
214
|
& + ${InputIconContainer} {
|
|
215
215
|
opacity: 1;
|
|
216
|
-
${props => props
|
|
216
|
+
${props => props.$type === 'success' && css`
|
|
217
217
|
opacity: 0;
|
|
218
218
|
`}
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
&::placeholder {
|
|
223
|
+
${props => {
|
|
224
|
+
if (props.$type === 'error' || props.$type === 'warning') {
|
|
225
|
+
return css`
|
|
226
|
+
color: ${props.theme.getColor('gray-400')};
|
|
227
|
+
opacity: 0.9;
|
|
228
|
+
`;
|
|
229
|
+
} else {
|
|
230
|
+
return css`
|
|
231
|
+
${props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))}
|
|
232
|
+
opacity: 0.6;
|
|
233
|
+
`;
|
|
232
234
|
}
|
|
233
|
-
return '';
|
|
234
235
|
}}
|
|
235
|
-
|
|
236
|
+
}
|
|
236
237
|
|
|
237
|
-
|
|
238
|
-
${props => props.theme.themeProp('opacity', 0.6, 0.5)}
|
|
238
|
+
${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'))};
|
|
239
239
|
|
|
240
|
-
${props => {
|
|
241
|
-
if (props.type === 'warning') {
|
|
242
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-900'), props.theme.getColor('gray-900'));
|
|
243
|
-
} else if (props.type === 'error') {
|
|
244
|
-
return props.theme.themeProp('color', props.theme.getColor('red-600'), props.theme.getColor('red-600'));
|
|
245
|
-
} else {
|
|
246
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'));
|
|
247
|
-
}
|
|
248
|
-
}}
|
|
249
|
-
}
|
|
250
240
|
|
|
251
|
-
&:focus::placeholder {
|
|
252
|
-
${props => props.theme.themeProp('opacity', 0.6, 0.5)}
|
|
253
241
|
|
|
242
|
+
&:focus::placeholder {
|
|
254
243
|
${props => {
|
|
255
|
-
if (props
|
|
256
|
-
return
|
|
257
|
-
|
|
258
|
-
|
|
244
|
+
if (props.$type === 'warning' || props.$type === 'error') {
|
|
245
|
+
return css`
|
|
246
|
+
color: ${props.theme.getColor('gray-500')} !important;
|
|
247
|
+
opacity: 0.8 !important;
|
|
248
|
+
`;
|
|
259
249
|
} else {
|
|
260
|
-
return
|
|
250
|
+
return css`
|
|
251
|
+
${props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'))}
|
|
252
|
+
`;
|
|
261
253
|
}
|
|
262
254
|
}}
|
|
263
255
|
}
|
|
@@ -267,20 +259,20 @@ const TextInputField = styled.textarea.withConfig({
|
|
|
267
259
|
|
|
268
260
|
${props => {
|
|
269
261
|
if (props.readOnly) {
|
|
270
|
-
if (props
|
|
262
|
+
if (props.$type === 'error') {
|
|
271
263
|
return props.theme.themeProp('background', '#7f1b1b', '#FBEAE6');
|
|
272
|
-
} else if (props
|
|
264
|
+
} else if (props.$type === 'warning') {
|
|
273
265
|
return props.theme.themeProp('background', '#634E01', '#FFFDE8');
|
|
274
266
|
}
|
|
275
267
|
return '';
|
|
276
268
|
}
|
|
277
|
-
if (props
|
|
269
|
+
if (props.$type === 'error') {
|
|
278
270
|
return css`
|
|
279
271
|
${props.theme.themeProp('border-color', '#D83018', '#D83018')}
|
|
280
272
|
${props.theme.themeProp('background', 'white', 'white')}
|
|
281
273
|
${props.theme.themeProp('color', 'black', 'black')}
|
|
282
274
|
`;
|
|
283
|
-
} else if (props
|
|
275
|
+
} else if (props.$type === 'warning') {
|
|
284
276
|
return css`
|
|
285
277
|
${props.theme.themeProp('border-color', '#F4E21E', '#F4E21E')}
|
|
286
278
|
${props.theme.themeProp('background', 'white', 'white')}
|
|
@@ -288,8 +280,8 @@ const TextInputField = styled.textarea.withConfig({
|
|
|
288
280
|
`;
|
|
289
281
|
} else {
|
|
290
282
|
return css`
|
|
291
|
-
|
|
292
|
-
${props.theme.themeProp('background', '
|
|
283
|
+
border-color: ${props.theme.getColor('gray-600')};
|
|
284
|
+
${props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100'))}
|
|
293
285
|
`;
|
|
294
286
|
}
|
|
295
287
|
}}
|
|
@@ -298,9 +290,9 @@ const TextInputField = styled.textarea.withConfig({
|
|
|
298
290
|
&&:not(:hover):not(:focus) {
|
|
299
291
|
${props => {
|
|
300
292
|
if (props.$edit) {
|
|
301
|
-
if (props
|
|
293
|
+
if (props.$type === 'error') {
|
|
302
294
|
return props.theme.themeProp('background', '#7f1b1b', '#FEE2E2');
|
|
303
|
-
} else if (props
|
|
295
|
+
} else if (props.$type === 'warning') {
|
|
304
296
|
return props.theme.themeProp('background', '#634E01', '#FFFDE8');
|
|
305
297
|
} else {
|
|
306
298
|
return props.theme.themeProp('background', 'rgba(39,39,42, 0.7)', 'rgba(244,244,245, 0.3)');
|
|
@@ -371,7 +363,7 @@ const TextInputFieldIconAlert = styled.div.withConfig({
|
|
|
371
363
|
padding: 0 10px 0 30px;
|
|
372
364
|
opacity: 0.6;
|
|
373
365
|
transition: opacity 250ms;
|
|
374
|
-
${props => props
|
|
366
|
+
${props => props.$type === 'warning' && props.theme.themeProp('color', '#EAB308', '#2F2402')}
|
|
375
367
|
svg {
|
|
376
368
|
margin-top: 12px;
|
|
377
369
|
width: 15px;
|
|
@@ -405,7 +397,7 @@ const TextInput = styled.div.withConfig({
|
|
|
405
397
|
|
|
406
398
|
${TextInputField}:not(:placeholder-shown) + ${TextInputLabel} {
|
|
407
399
|
${activeLabel};
|
|
408
|
-
${props => props
|
|
400
|
+
${props => props.$type === 'error' && props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'))}
|
|
409
401
|
}
|
|
410
402
|
`;
|
|
411
403
|
const Description = styled.div.withConfig({
|
|
@@ -418,11 +410,11 @@ const Description = styled.div.withConfig({
|
|
|
418
410
|
|
|
419
411
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
|
|
420
412
|
|
|
421
|
-
${props => (props
|
|
413
|
+
${props => (props.$type === 'warning-border' || props.$type === 'warning') && css`
|
|
422
414
|
${props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('orange-500'))}
|
|
423
415
|
`}
|
|
424
416
|
|
|
425
|
-
${props => (props
|
|
417
|
+
${props => (props.$type === 'error-border' || props.$type === 'error') && css`
|
|
426
418
|
${props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'))}
|
|
427
419
|
`}
|
|
428
420
|
`;
|