@ntbjs/react-components 1.1.0-beta.82 → 1.1.0-beta.84
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/{AssetGallery-6a6fbfc5.js → AssetGallery-198b6467.js} +23 -9
- package/{CompactAutocompleteSelect-160b1620.js → CompactAutocompleteSelect-d1a7836f.js} +84 -80
- package/{CompactStarRating-53593d92.js → CompactStarRating-de1bcfe9.js} +88 -89
- package/CompactTextInput-3a85bb3e.js +317 -0
- package/{Instructions-3de89071.js → Instructions-1d6f2bc5.js} +27 -16
- package/{MultiSelect-9729cedf.js → MultiSelect-01a257b8.js} +1 -1
- package/TextArea-9a78ac53.js +316 -0
- package/{Tooltip-f4f9ab8f.js → Tooltip-1b7b0052.js} +2 -3
- package/check-555d831b.js +213 -0
- package/data/Tooltip/index.js +1 -1
- package/data/index.js +1 -1
- package/inputs/CompactAutocompleteSelect/index.js +5 -5
- package/inputs/CompactStarRating/index.js +3 -3
- package/inputs/CompactTextInput/index.js +5 -5
- package/inputs/MultiSelect/index.js +2 -2
- package/inputs/TextArea/index.js +2 -3
- package/inputs/index.js +8 -8
- package/package.json +2 -1
- package/{react-select-creatable.esm-4c3da560.js → react-select-creatable.esm-7231b55e.js} +5 -1
- package/widgets/AssetGallery/index.js +9 -9
- package/widgets/Instructions/index.js +5 -5
- package/widgets/index.js +10 -10
- package/CompactTextInput-9980612c.js +0 -328
- package/TextArea-45d39ab0.js +0 -343
- package/check-circle-filled-1640873e.js +0 -42
package/TextArea-45d39ab0.js
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var defaultTheme = require('./defaultTheme-50f2b88f.js');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var nanoid = require('nanoid');
|
|
6
|
-
var lodash = require('lodash');
|
|
7
|
-
var checkCircleFilled = require('./check-circle-filled-1640873e.js');
|
|
8
|
-
var editNote = require('./edit-note-c47d292e.js');
|
|
9
|
-
var styled = require('styled-components');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
-
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
|
-
|
|
16
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32;
|
|
17
|
-
var activeLabel = styled.css(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-size: 0.75rem;\n padding: 0 3px;\n top: -7px;\n letter-spacing: 0.03em;\n left: 8px !important;\n opacity: 1 !important;\n"])));
|
|
18
|
-
var placeholderBaseStyle = styled.css(_templateObject2 || (_templateObject2 = defaultTheme._taggedTemplateLiteral(["\n ", "\n\n ", "\n"])), function (props) {
|
|
19
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'));
|
|
20
|
-
}, function (props) {
|
|
21
|
-
return props.theme.themeProp('opacity', 0.6, 0.5);
|
|
22
|
-
});
|
|
23
|
-
var InputIconContainer = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject3 || (_templateObject3 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0;\n pointer-events: none;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n display: flex;\n align-items: flex-start;\n position: absolute;\n right: 5px;\n top: 10px;\n bottom: 0;\n svg {\n width: 15px;\n opacity: 0.7;\n transition: opacity 250ms;\n ", "\n }\n"])), function (props) {
|
|
24
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-900'), '!important');
|
|
25
|
-
});
|
|
26
|
-
var CheckIconContainer = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject4 || (_templateObject4 = defaultTheme._taggedTemplateLiteral(["\n opacity: 1;\n pointer-events: none;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n display: flex;\n align-items: flex-start;\n position: absolute;\n right: 6px;\n top: 8px;\n bottom: 0;\n ", "\n svg {\n width: 15px;\n }\n"])), function (props) {
|
|
27
|
-
return props.theme.themeProp('color', props.theme.getColor('emerald-200'), props.theme.getColor('emerald-500'));
|
|
28
|
-
});
|
|
29
|
-
var Container = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject5 || (_templateObject5 = defaultTheme._taggedTemplateLiteral([""])));
|
|
30
|
-
var OpacityBox = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject6 || (_templateObject6 = defaultTheme._taggedTemplateLiteral([""])));
|
|
31
|
-
var TextInputField = styled__default['default'].textarea.attrs(defaultTheme.applyDefaultTheme)(_templateObject7 || (_templateObject7 = defaultTheme._taggedTemplateLiteral(["\n width: 100%;\n font-family: inherit;\n font-size: 0.875rem;\n border-radius: 2px;\n padding: 13px 10px;\n resize: vertical;\n transition: height 0.3s ease;\n z-index: 0; \n\n ", "\n\n ", "\n \n ", "\n ", "\n ", "\n border: 1px solid;\n ", "\n ", " \n\n \n ", "\n \n\n ", " \n\n ", " \n\n ", " \n ", "\n ", ";\n &&:hover:not(:focus) {\n ", ";\n transition: background 350ms;\n & + ", " {\n opacity: 1;\n ", ";\n transition: opacity 350ms;\n }\n }\n \n border-radius: 3px;\n box-sizing: border-box;\n appearance: none;\n transition: border-color 350ms;\n ", "\n ", "\n ", "\n\n ", "\n\n &::placeholder {\n ", "\n\n ", "\n }\n\n :focus {\n outline: none;\n ", "\n }\n\n :focus {\n outline: none;\n border-color: ", " !important\n \n"])), function (props) {
|
|
32
|
-
return props.expanded && styled.css(_templateObject8 || (_templateObject8 = defaultTheme._taggedTemplateLiteral(["\n height: ", "em;\n "])), props.maxHeight);
|
|
33
|
-
}, function (props) {
|
|
34
|
-
return props.showMore && styled.css(_templateObject9 || (_templateObject9 = defaultTheme._taggedTemplateLiteral(["\n overflow: hidden;\n "])));
|
|
35
|
-
}, function (props) {
|
|
36
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'));
|
|
37
|
-
}, function (props) {
|
|
38
|
-
return (props.warningAlert || props.errorAlert) && props.theme.themeProp('color', props.theme.getColor('gray-900'), props.theme.getColor('gray-900'));
|
|
39
|
-
}, function (props) {
|
|
40
|
-
return props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'));
|
|
41
|
-
}, function (props) {
|
|
42
|
-
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
43
|
-
}, function (props) {
|
|
44
|
-
return props.noBorder && styled.css(_templateObject10 || (_templateObject10 = defaultTheme._taggedTemplateLiteral(["\n padding: 13px 15px 13px 10px;\n border-color: transparent !important;\n "])));
|
|
45
|
-
}, function (props) {
|
|
46
|
-
return props.success && styled.css(_templateObject11 || (_templateObject11 = defaultTheme._taggedTemplateLiteral(["\n ", "\n &&:hover {\n ", "\n }\n "])), props.theme.themeProp('background', props.theme.getColor('emerald-500'), props.theme.getColor('emerald-300')), props.theme.themeProp('background', '#64b49d !important', '#bfe0d5 !important'));
|
|
47
|
-
}, function (props) {
|
|
48
|
-
return props.warningAlert && !props.editWarning && styled.css(_templateObject12 || (_templateObject12 = defaultTheme._taggedTemplateLiteral(["\n ", "\n :focus {\n background: white !important;\n }\n &&:hover:not(:focus) {\n ", "\n }\n &&:read-only:hover {\n ", "\n }\n "])), props.theme.themeProp('background', props.theme.getColor('signal-yellow-500'), props.theme.getColor('signal-yellow-400')), props.theme.themeProp('background', '#fffde8', '#F4E21E'), props.theme.themeProp('background', props.theme.getColor('signal-yellow-500'), props.theme.getColor('signal-yellow-400')));
|
|
49
|
-
}, function (props) {
|
|
50
|
-
return props.warningAlert && props.editWarning && styled.css(_templateObject13 || (_templateObject13 = defaultTheme._taggedTemplateLiteral(["\n ", "\n :focus {\n background: white !important;\n }\n &&:hover:not(:focus) {\n ", "\n }\n &&:read-only:hover {\n ", "\n }\n "])), props.theme.themeProp('background', '#fffde8', '#fffde8'), props.theme.themeProp('background', '#fffebf', '#fffebf'), props.theme.themeProp('background', props.theme.getColor('signal-yellow-500'), props.theme.getColor('signal-yellow-400')));
|
|
51
|
-
}, function (props) {
|
|
52
|
-
return props.errorAlert && styled.css(_templateObject14 || (_templateObject14 = defaultTheme._taggedTemplateLiteral(["\n background: ", " !important;\n :focus {\n background: white !important;\n }\n &&:hover:not(:focus) {\n background: #f7d5d0 !important;\n }\n &&:read-only:hover {\n background: ", " !important;\n }\n "])), props.theme.getColor('red-200'), props.theme.getColor('red-200'));
|
|
53
|
-
}, function (props) {
|
|
54
|
-
return props.lightBackground && styled.css(_templateObject15 || (_templateObject15 = defaultTheme._taggedTemplateLiteral(["\n ", "\n ", "\n &&:hover {\n ", "\n }\n "])), props.theme.themeProp('background', '#FFFDDE', '#fffde8'), props.theme.themeProp('color', props.theme.getColor('gray-900'), props.theme.getColor('gray-900')), props.theme.themeProp('background', 'white', 'white'));
|
|
55
|
-
}, function (props) {
|
|
56
|
-
return props.edit && props.theme.themeProp('background', '#505050', '#eff1f4');
|
|
57
|
-
}, function (props) {
|
|
58
|
-
return props.noBorder && !props.readOnly && !props.warningAlert ? props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100')) : 'background: transparent';
|
|
59
|
-
}, InputIconContainer, function (props) {
|
|
60
|
-
return props.success && styled.css(_templateObject16 || (_templateObject16 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0;\n "])));
|
|
61
|
-
}, function (props) {
|
|
62
|
-
return props.warning && styled.css(_templateObject17 || (_templateObject17 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", " !important;\n "])), props.theme.getColor('orange-500'));
|
|
63
|
-
}, function (props) {
|
|
64
|
-
return props.error && styled.css(_templateObject18 || (_templateObject18 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", " !important;\n "])), props.theme.getColor('red-500'));
|
|
65
|
-
}, function (props) {
|
|
66
|
-
return props.hasIcon && styled.css(_templateObject19 || (_templateObject19 = defaultTheme._taggedTemplateLiteral(["\n padding-left: 35px;\n "])));
|
|
67
|
-
}, function (props) {
|
|
68
|
-
return (props.warningAlert || props.errorAlert) && styled.css(_templateObject20 || (_templateObject20 = defaultTheme._taggedTemplateLiteral(["\n padding-left: 55px;\n padding-top: 25px;\n padding-right: 30px;\n "])));
|
|
69
|
-
}, function (props) {
|
|
70
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'), 1);
|
|
71
|
-
}, function (props) {
|
|
72
|
-
return props.theme.themeProp('opacity', 0.6, 0.5, 1);
|
|
73
|
-
}, function (props) {
|
|
74
|
-
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-600'));
|
|
75
|
-
}, function (props) {
|
|
76
|
-
return props.theme.getColor('gray-600');
|
|
77
|
-
});
|
|
78
|
-
var TextInputLabel = styled__default['default'].label.attrs(defaultTheme.applyDefaultTheme)(_templateObject21 || (_templateObject21 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n top: 13px;\n left: 11px;\n line-height: 1.2;\n font-size: 0.875rem;\n transition: all 150ms;\n\n ", ";\n\n ", "\n\n ", "\n content: \"\";\n\n ", "\n"])), placeholderBaseStyle, function (props) {
|
|
79
|
-
return props.theme.themeProp('background', "linear-gradient(0deg, ".concat(props.theme.getColor('gray-900'), " calc(50% + 1px), transparent 50%)"), "linear-gradient(0deg, ".concat(props.theme.getColor('white'), " calc(50% + 1px), transparent 50%)"));
|
|
80
|
-
}, function (props) {
|
|
81
|
-
return props.hasPlaceholder && styled.css(_templateObject22 || (_templateObject22 = defaultTheme._taggedTemplateLiteral(["\n ", ";\n ", "\n "])), activeLabel, props.error && styled.css(_templateObject23 || (_templateObject23 = defaultTheme._taggedTemplateLiteral(["\n color: ", " !important;\n "])), props.theme.getColor('red-500')));
|
|
82
|
-
}, function (props) {
|
|
83
|
-
return props.hasIcon && styled.css(_templateObject24 || (_templateObject24 = defaultTheme._taggedTemplateLiteral(["\n left: 35px;\n "])));
|
|
84
|
-
});
|
|
85
|
-
var TextInputFieldIcon = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject25 || (_templateObject25 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n height: 2.625rem;\n display: flex;\n padding: 0 10px;\n\n svg {\n width: 15px;\n opacity: 0.6;\n transition: opacity 250ms;\n }\n"])));
|
|
86
|
-
var TextInputFieldIconAlert = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject26 || (_templateObject26 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n top: 13px;\n height: 2.625rem;\n display: flex;\n padding: 0 10px 0 30px;\n svg {\n width: 15px;\n opacity: 0.6;\n transition: opacity 250ms;\n ", "\n }\n"])), function (props) {
|
|
87
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-600'), props.theme.getColor('gray-600'), 1);
|
|
88
|
-
});
|
|
89
|
-
var TextInput = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject27 || (_templateObject27 = defaultTheme._taggedTemplateLiteral(["\n position: relative;\n\n &:focus-within {\n ", " {\n ", ";\n }\n\n ", " {\n svg {\n opacity: 1;\n }\n }\n }\n\n ", ":not(:placeholder-shown) + ", " {\n ", ";\n ", "\n }\n\n ", "\n"])), TextInputLabel, activeLabel, TextInputFieldIcon, TextInputField, TextInputLabel, activeLabel, function (props) {
|
|
90
|
-
return props.error && props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'));
|
|
91
|
-
}, function (props) {
|
|
92
|
-
return props.disabled && styled.css(_templateObject28 || (_templateObject28 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0.5;\n\n > * {\n cursor: not-allowed;\n }\n "])));
|
|
93
|
-
});
|
|
94
|
-
var Description = styled__default['default'].p.attrs(defaultTheme.applyDefaultTheme)(_templateObject29 || (_templateObject29 = defaultTheme._taggedTemplateLiteral(["\n margin: 8px 0 0 0;\n padding: 0 0.6875rem;\n font-size: 0.75rem;\n line-height: 1.333;\n\n ", ";\n\n ", "\n"])), function (props) {
|
|
95
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'));
|
|
96
|
-
}, function (props) {
|
|
97
|
-
return props.error && styled.css(_templateObject30 || (_templateObject30 = defaultTheme._taggedTemplateLiteral(["\n content: 'error';\n ", "\n "])), props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500')));
|
|
98
|
-
});
|
|
99
|
-
var ShowMoreText = styled__default['default'].p.attrs(defaultTheme.applyDefaultTheme)(_templateObject31 || (_templateObject31 = defaultTheme._taggedTemplateLiteral(["\n margin: 8px 0 0 0;\n padding: 0 0.6875rem;\n font-size: 0.75rem;\n line-height: 1.333;\n cursor: pointer;\n\n ", ";\n\n ", "\n"])), function (props) {
|
|
100
|
-
return props.theme.themeProp('color', props.theme.getColor('emerald-300'), props.theme.getColor('emerald-500'));
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return props.error && styled.css(_templateObject32 || (_templateObject32 = defaultTheme._taggedTemplateLiteral(["\n content: 'error';\n ", "\n "])), props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500')));
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
var TextArea = React__default['default'].forwardRef(function TextArea(_ref, forwardedRef) {
|
|
106
|
-
var value = _ref.value,
|
|
107
|
-
defaultValue = _ref.defaultValue,
|
|
108
|
-
name = _ref.name,
|
|
109
|
-
label = _ref.label,
|
|
110
|
-
placeholder = _ref.placeholder,
|
|
111
|
-
required = _ref.required,
|
|
112
|
-
disabled = _ref.disabled,
|
|
113
|
-
hidden = _ref.hidden,
|
|
114
|
-
readOnly = _ref.readOnly,
|
|
115
|
-
edit = _ref.edit,
|
|
116
|
-
editWarning = _ref.editWarning,
|
|
117
|
-
isExpanded = _ref.isExpanded,
|
|
118
|
-
maxRows = _ref.maxRows,
|
|
119
|
-
showMore = _ref.showMore,
|
|
120
|
-
showMoreText = _ref.showMoreText,
|
|
121
|
-
autoComplete = _ref.autoComplete,
|
|
122
|
-
description = _ref.description,
|
|
123
|
-
success = _ref.success,
|
|
124
|
-
error = _ref.error,
|
|
125
|
-
warning = _ref.warning,
|
|
126
|
-
icon = _ref.icon,
|
|
127
|
-
rows = _ref.rows,
|
|
128
|
-
className = _ref.className,
|
|
129
|
-
style = _ref.style,
|
|
130
|
-
onChange = _ref.onChange,
|
|
131
|
-
onBlur = _ref.onBlur,
|
|
132
|
-
lightBackground = _ref.lightBackground,
|
|
133
|
-
noBorder = _ref.noBorder,
|
|
134
|
-
warningAlert = _ref.warningAlert,
|
|
135
|
-
errorAlert = _ref.errorAlert,
|
|
136
|
-
rest = defaultTheme._objectWithoutProperties(_ref, ["value", "defaultValue", "name", "label", "placeholder", "required", "disabled", "hidden", "readOnly", "edit", "editWarning", "isExpanded", "maxRows", "showMore", "showMoreText", "autoComplete", "description", "success", "error", "warning", "icon", "rows", "className", "style", "onChange", "onBlur", "lightBackground", "noBorder", "warningAlert", "errorAlert"]);
|
|
137
|
-
|
|
138
|
-
var textInputRef = React.useRef(null);
|
|
139
|
-
|
|
140
|
-
var _useState = React.useState(''),
|
|
141
|
-
_useState2 = defaultTheme._slicedToArray(_useState, 2),
|
|
142
|
-
contentRows = _useState2[0],
|
|
143
|
-
setContentRows = _useState2[1];
|
|
144
|
-
|
|
145
|
-
var _useState3 = React.useState(''),
|
|
146
|
-
_useState4 = defaultTheme._slicedToArray(_useState3, 2),
|
|
147
|
-
maxContentRows = _useState4[0],
|
|
148
|
-
setMaxContentRows = _useState4[1];
|
|
149
|
-
|
|
150
|
-
var _useState5 = React.useState(rows),
|
|
151
|
-
_useState6 = defaultTheme._slicedToArray(_useState5, 2),
|
|
152
|
-
defaultRows = _useState6[0],
|
|
153
|
-
setDefaultRows = _useState6[1];
|
|
154
|
-
|
|
155
|
-
var _useState7 = React.useState(false),
|
|
156
|
-
_useState8 = defaultTheme._slicedToArray(_useState7, 2),
|
|
157
|
-
expanded = _useState8[0],
|
|
158
|
-
setExpanded = _useState8[1];
|
|
159
|
-
|
|
160
|
-
var _useState9 = React.useState(''),
|
|
161
|
-
_useState10 = defaultTheme._slicedToArray(_useState9, 2),
|
|
162
|
-
maxHeight = _useState10[0],
|
|
163
|
-
setMaxHeight = _useState10[1];
|
|
164
|
-
|
|
165
|
-
React.useEffect(function () {
|
|
166
|
-
setDefaultRows(rows);
|
|
167
|
-
}, [rows]);
|
|
168
|
-
|
|
169
|
-
var _useState11 = React.useState(nanoid.nanoid()),
|
|
170
|
-
_useState12 = defaultTheme._slicedToArray(_useState11, 1),
|
|
171
|
-
uniqueId = _useState12[0];
|
|
172
|
-
|
|
173
|
-
var hasError = React.useMemo(function () {
|
|
174
|
-
if (lodash.isBoolean(error)) {
|
|
175
|
-
return error;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return !lodash.isEmpty(error);
|
|
179
|
-
}, [error]);
|
|
180
|
-
var hasWarning = React.useMemo(function () {
|
|
181
|
-
if (lodash.isBoolean(warning)) {
|
|
182
|
-
return warning;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return !lodash.isEmpty(warning);
|
|
186
|
-
}, [warning]);
|
|
187
|
-
var descriptionText = React.useMemo(function () {
|
|
188
|
-
if (!lodash.isEmpty(error)) {
|
|
189
|
-
return error;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (!lodash.isEmpty(warning)) {
|
|
193
|
-
return warning;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (!lodash.isEmpty(description)) {
|
|
197
|
-
return description;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return null;
|
|
201
|
-
}, [description, error, warning]);
|
|
202
|
-
|
|
203
|
-
var handleTextAreaChange = function handleTextAreaChange() {
|
|
204
|
-
setExpanded(!expanded);
|
|
205
|
-
isExpanded(expanded);
|
|
206
|
-
|
|
207
|
-
if (expanded === true) {
|
|
208
|
-
setContentRows(maxContentRows);
|
|
209
|
-
setMaxHeight(maxHeight);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (expanded === false) {
|
|
213
|
-
setContentRows(defaultRows);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
React.useEffect(function () {
|
|
218
|
-
var calculateRows = function calculateRows() {
|
|
219
|
-
var lineheight = 1.5;
|
|
220
|
-
var textareaRefCurrent = textInputRef.current;
|
|
221
|
-
|
|
222
|
-
if (textareaRefCurrent) {
|
|
223
|
-
var textarea = textareaRefCurrent.scrollHeight;
|
|
224
|
-
var rowsLimit = Math.floor(textarea / (lineheight * 11.5));
|
|
225
|
-
|
|
226
|
-
var _maxHeight = rowsLimit * lineheight + 'em';
|
|
227
|
-
|
|
228
|
-
setMaxContentRows(rowsLimit);
|
|
229
|
-
setMaxHeight(_maxHeight);
|
|
230
|
-
|
|
231
|
-
if (rowsLimit > defaultRows) {
|
|
232
|
-
setExpanded(true);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (typeof maxRows === 'function') {
|
|
236
|
-
maxRows(rowsLimit);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
if (textInputRef.current) {
|
|
242
|
-
calculateRows();
|
|
243
|
-
} else {
|
|
244
|
-
setExpanded(false);
|
|
245
|
-
}
|
|
246
|
-
}, [value]);
|
|
247
|
-
if (hidden) return null;
|
|
248
|
-
return React__default['default'].createElement(TextInput, {
|
|
249
|
-
disabled: disabled,
|
|
250
|
-
readOnly: readOnly,
|
|
251
|
-
error: hasError,
|
|
252
|
-
warning: hasWarning,
|
|
253
|
-
className: className,
|
|
254
|
-
style: style
|
|
255
|
-
}, !warningAlert && !errorAlert && React__default['default'].createElement(TextInputFieldIcon, null, icon), (warningAlert || errorAlert) && React__default['default'].createElement(TextInputFieldIconAlert, null, icon), React__default['default'].createElement(Container, null, React__default['default'].createElement(OpacityBox, null, React__default['default'].createElement(TextInputField, defaultTheme._extends({
|
|
256
|
-
ref: forwardedRef ? forwardedRef : textInputRef,
|
|
257
|
-
rows: contentRows > rows ? contentRows : rows,
|
|
258
|
-
expanded: expanded,
|
|
259
|
-
maxHeight: maxHeight,
|
|
260
|
-
value: value,
|
|
261
|
-
defaultValue: defaultValue,
|
|
262
|
-
name: name,
|
|
263
|
-
placeholder: placeholder || ' ',
|
|
264
|
-
required: required,
|
|
265
|
-
disabled: disabled,
|
|
266
|
-
readOnly: readOnly,
|
|
267
|
-
edit: edit,
|
|
268
|
-
editWarning: editWarning,
|
|
269
|
-
showMore: showMore,
|
|
270
|
-
success: success,
|
|
271
|
-
autoComplete: autoComplete,
|
|
272
|
-
hasIcon: Boolean(icon),
|
|
273
|
-
icon: icon,
|
|
274
|
-
error: hasError,
|
|
275
|
-
warning: hasWarning,
|
|
276
|
-
id: "text-input-".concat(uniqueId),
|
|
277
|
-
lightBackground: lightBackground,
|
|
278
|
-
onChange: onChange,
|
|
279
|
-
onBlur: onBlur,
|
|
280
|
-
noBorder: noBorder,
|
|
281
|
-
warningAlert: warningAlert,
|
|
282
|
-
errorAlert: errorAlert
|
|
283
|
-
}, rest)))), !readOnly && noBorder && React__default['default'].createElement(InputIconContainer, {
|
|
284
|
-
warningAlert: warningAlert,
|
|
285
|
-
errorAlert: errorAlert
|
|
286
|
-
}, React__default['default'].createElement(editNote.SvgEditNote, null)), success && React__default['default'].createElement(CheckIconContainer, null, React__default['default'].createElement(checkCircleFilled.SvgCheckCircleFilled, null)), label && React__default['default'].createElement(TextInputLabel, {
|
|
287
|
-
htmlFor: "text-input-".concat(uniqueId),
|
|
288
|
-
hasPlaceholder: Boolean(placeholder),
|
|
289
|
-
hasIcon: Boolean(icon),
|
|
290
|
-
error: hasError
|
|
291
|
-
}, label, required && ' *'), typeof descriptionText === 'string' && descriptionText.length > 0 && React__default['default'].createElement(Description, {
|
|
292
|
-
error: hasError
|
|
293
|
-
}, descriptionText), maxContentRows > defaultRows && showMore && React__default['default'].createElement(ShowMoreText, {
|
|
294
|
-
onClick: handleTextAreaChange
|
|
295
|
-
}, showMoreText));
|
|
296
|
-
});
|
|
297
|
-
TextArea.defaultProps = {
|
|
298
|
-
rows: 4,
|
|
299
|
-
noBorder: false,
|
|
300
|
-
readOnly: false,
|
|
301
|
-
edit: false,
|
|
302
|
-
editWarning: false,
|
|
303
|
-
warningAlert: false,
|
|
304
|
-
errorAlert: false,
|
|
305
|
-
hidden: false,
|
|
306
|
-
showMore: false,
|
|
307
|
-
showMoreText: '',
|
|
308
|
-
success: false
|
|
309
|
-
};
|
|
310
|
-
TextArea.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
311
|
-
success: defaultTheme.PropTypes.bool,
|
|
312
|
-
value: defaultTheme.PropTypes.string,
|
|
313
|
-
defaultValue: defaultTheme.PropTypes.string,
|
|
314
|
-
name: defaultTheme.PropTypes.string,
|
|
315
|
-
label: defaultTheme.PropTypes.string,
|
|
316
|
-
placeholder: defaultTheme.PropTypes.string,
|
|
317
|
-
required: defaultTheme.PropTypes.bool,
|
|
318
|
-
disabled: defaultTheme.PropTypes.bool,
|
|
319
|
-
hidden: defaultTheme.PropTypes.bool,
|
|
320
|
-
readOnly: defaultTheme.PropTypes.bool,
|
|
321
|
-
showMore: defaultTheme.PropTypes.bool,
|
|
322
|
-
showMoreText: defaultTheme.PropTypes.string,
|
|
323
|
-
edit: defaultTheme.PropTypes.bool,
|
|
324
|
-
editWarning: defaultTheme.PropTypes.bool,
|
|
325
|
-
autoComplete: defaultTheme.PropTypes.string,
|
|
326
|
-
description: defaultTheme.PropTypes.string,
|
|
327
|
-
error: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.bool, defaultTheme.PropTypes.string]),
|
|
328
|
-
warning: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.bool, defaultTheme.PropTypes.string]),
|
|
329
|
-
icon: defaultTheme.PropTypes.element,
|
|
330
|
-
rows: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.number, defaultTheme.PropTypes.string]),
|
|
331
|
-
className: defaultTheme.PropTypes.string,
|
|
332
|
-
style: defaultTheme.PropTypes.object,
|
|
333
|
-
lightBackground: defaultTheme.PropTypes.bool,
|
|
334
|
-
onChange: defaultTheme.PropTypes.func,
|
|
335
|
-
onBlur: defaultTheme.PropTypes.func,
|
|
336
|
-
noBorder: defaultTheme.PropTypes.bool,
|
|
337
|
-
warningAlert: defaultTheme.PropTypes.bool,
|
|
338
|
-
errorAlert: defaultTheme.PropTypes.bool,
|
|
339
|
-
maxRows: defaultTheme.PropTypes.func,
|
|
340
|
-
isExpanded: defaultTheme.PropTypes.func
|
|
341
|
-
} : {};
|
|
342
|
-
|
|
343
|
-
exports.TextArea = TextArea;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
|
|
5
|
-
function _interopNamespace(e) {
|
|
6
|
-
if (e && e.__esModule) return e;
|
|
7
|
-
var n = Object.create(null);
|
|
8
|
-
if (e) {
|
|
9
|
-
Object.keys(e).forEach(function (k) {
|
|
10
|
-
if (k !== 'default') {
|
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return e[k];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
n['default'] = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
-
|
|
27
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
28
|
-
|
|
29
|
-
var _ref = /*#__PURE__*/React__namespace.createElement("path", {
|
|
30
|
-
fill: "currentColor",
|
|
31
|
-
d: "M12 0a12 12 0 1012 12A12 12 0 0012 0zM9.6 18l-6-6 1.69-1.69L9.6 14.6l9.11-9.1 1.69 1.7z",
|
|
32
|
-
fillOpacity: 0.9
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
function SvgCheckCircleFilled(props) {
|
|
36
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
37
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
38
|
-
viewBox: "0 0 24 24"
|
|
39
|
-
}, props), _ref);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
exports.SvgCheckCircleFilled = SvgCheckCircleFilled;
|