@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
|
@@ -4,8 +4,8 @@ var defaultTheme = require('./defaultTheme-50f2b88f.js');
|
|
|
4
4
|
var lodash = require('lodash');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var warningCircle = require('./warning-circle-24522402.js');
|
|
7
|
-
var CompactAutocompleteSelect = require('./CompactAutocompleteSelect-
|
|
8
|
-
var TextArea = require('./TextArea-
|
|
7
|
+
var CompactAutocompleteSelect = require('./CompactAutocompleteSelect-d1a7836f.js');
|
|
8
|
+
var TextArea = require('./TextArea-9a78ac53.js');
|
|
9
9
|
var styled = require('styled-components');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -31,6 +31,7 @@ var Instructions = React__default['default'].forwardRef(function Instructions(_r
|
|
|
31
31
|
selectedOption = _ref.selectedOption,
|
|
32
32
|
loadOptions = _ref.loadOptions,
|
|
33
33
|
readOnly = _ref.readOnly,
|
|
34
|
+
disabled = _ref.disabled,
|
|
34
35
|
hidden = _ref.hidden,
|
|
35
36
|
name = _ref.name,
|
|
36
37
|
lightBackground = _ref.lightBackground,
|
|
@@ -43,10 +44,12 @@ var Instructions = React__default['default'].forwardRef(function Instructions(_r
|
|
|
43
44
|
availableOptions = _ref.availableOptions,
|
|
44
45
|
loadingMessageFunc = _ref.loadingMessageFunc,
|
|
45
46
|
placeholder = _ref.placeholder,
|
|
46
|
-
|
|
47
|
-
error = _ref.error,
|
|
47
|
+
state = _ref.state,
|
|
48
48
|
editWarning = _ref.editWarning,
|
|
49
|
-
|
|
49
|
+
rows = _ref.rows,
|
|
50
|
+
showMore = _ref.showMore,
|
|
51
|
+
showMoreText = _ref.showMoreText,
|
|
52
|
+
props = defaultTheme._objectWithoutProperties(_ref, ["clickToAdd", "customAddMessage", "selectedOption", "loadOptions", "readOnly", "disabled", "hidden", "name", "lightBackground", "autoSelect", "subscribeCurrentValue", "onChange", "onFocus", "onBlur", "onUpdateCallback", "availableOptions", "loadingMessageFunc", "placeholder", "state", "editWarning", "rows", "showMore", "showMoreText"]);
|
|
50
53
|
|
|
51
54
|
var _useState = React.useState(false),
|
|
52
55
|
_useState2 = defaultTheme._slicedToArray(_useState, 2),
|
|
@@ -171,29 +174,31 @@ var Instructions = React__default['default'].forwardRef(function Instructions(_r
|
|
|
171
174
|
initialHover: initialHover,
|
|
172
175
|
onMouseEnter: handleMouseEnter,
|
|
173
176
|
onMouseLeave: handleMouseLeave
|
|
174
|
-
}, props), React__default['default'].createElement(TopBarContainer, {
|
|
177
|
+
}, props), !readOnly && !disabled && React__default['default'].createElement(TopBarContainer, {
|
|
175
178
|
initialHover: initialHover,
|
|
176
|
-
className: isHovered && !readOnly && 'slide-in'
|
|
179
|
+
className: isHovered && !readOnly && !disabled && 'slide-in'
|
|
177
180
|
}, React__default['default'].createElement(SelectContainer, null, React__default['default'].createElement(CompactAutocompleteSelect.CompactAutocompleteSelect, defaultTheme._extends({
|
|
178
|
-
|
|
181
|
+
state: state,
|
|
179
182
|
value: selectedOption,
|
|
180
183
|
creatable: false,
|
|
181
184
|
onChange: handleChange
|
|
182
185
|
}, sharedSelectProps)))), React__default['default'].createElement(InstructionsArea, {
|
|
183
|
-
|
|
186
|
+
state: state
|
|
184
187
|
}, React__default['default'].createElement(TextArea.TextArea, {
|
|
185
188
|
noBorder: true,
|
|
189
|
+
state: state,
|
|
186
190
|
lightBackground: background,
|
|
187
191
|
readOnly: readOnly,
|
|
188
|
-
|
|
189
|
-
warningAlert: !success,
|
|
192
|
+
disabled: disabled,
|
|
190
193
|
name: name,
|
|
191
194
|
editWarning: editWarning,
|
|
192
|
-
success: success,
|
|
193
195
|
value: currentValue === null ? '' : currentValue,
|
|
194
196
|
onFocus: onFocus,
|
|
195
197
|
onChange: onChange,
|
|
196
198
|
onBlur: onBlur,
|
|
199
|
+
rows: rows,
|
|
200
|
+
showMore: showMore,
|
|
201
|
+
showMoreText: showMoreText,
|
|
197
202
|
icon: React__default['default'].createElement(warningCircle.SvgWarningCircle, null)
|
|
198
203
|
})));
|
|
199
204
|
});
|
|
@@ -202,11 +207,15 @@ Instructions.defaultProps = {
|
|
|
202
207
|
lightBackground: false,
|
|
203
208
|
autoSelect: true,
|
|
204
209
|
hidden: false,
|
|
205
|
-
editWarning: false
|
|
210
|
+
editWarning: false,
|
|
211
|
+
disabled: false,
|
|
212
|
+
readOnly: false,
|
|
213
|
+
state: ''
|
|
206
214
|
};
|
|
207
215
|
Instructions.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
208
216
|
name: defaultTheme.PropTypes.string,
|
|
209
217
|
placeholder: defaultTheme.PropTypes.string,
|
|
218
|
+
rows: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.number, defaultTheme.PropTypes.string]),
|
|
210
219
|
selectedOption: defaultTheme.PropTypes.any,
|
|
211
220
|
loadOptions: defaultTheme.PropTypes.func,
|
|
212
221
|
loadingMessageFunc: defaultTheme.PropTypes.func,
|
|
@@ -214,9 +223,10 @@ Instructions.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
214
223
|
customAddMessage: defaultTheme.PropTypes.string,
|
|
215
224
|
autoSelect: defaultTheme.PropTypes.bool,
|
|
216
225
|
readOnly: defaultTheme.PropTypes.bool,
|
|
217
|
-
|
|
218
|
-
error: defaultTheme.PropTypes.bool,
|
|
226
|
+
disabled: defaultTheme.PropTypes.bool,
|
|
219
227
|
hidden: defaultTheme.PropTypes.bool,
|
|
228
|
+
showMore: defaultTheme.PropTypes.bool,
|
|
229
|
+
showMoreText: defaultTheme.PropTypes.string,
|
|
220
230
|
availableOptions: defaultTheme.PropTypes.arrayOf(defaultTheme.PropTypes.object),
|
|
221
231
|
lightBackground: defaultTheme.PropTypes.bool,
|
|
222
232
|
editWarning: defaultTheme.PropTypes.bool,
|
|
@@ -225,7 +235,8 @@ Instructions.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
225
235
|
onChange: defaultTheme.PropTypes.func,
|
|
226
236
|
onFocus: defaultTheme.PropTypes.func,
|
|
227
237
|
onBlur: defaultTheme.PropTypes.func,
|
|
228
|
-
onUpdateCallback: defaultTheme.PropTypes.func
|
|
238
|
+
onUpdateCallback: defaultTheme.PropTypes.func,
|
|
239
|
+
state: defaultTheme.PropTypes.oneOf(['', 'error', 'error-border', 'warning', 'loading', 'success'])
|
|
229
240
|
} : {};
|
|
230
241
|
|
|
231
242
|
exports.Instructions = Instructions;
|
|
@@ -6,7 +6,7 @@ var nanoid = require('nanoid');
|
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var close = require('./close-ebf2f3cf.js');
|
|
8
8
|
var Select = require('react-select');
|
|
9
|
-
var reactSelectCreatable_esm = require('./react-select-creatable.esm-
|
|
9
|
+
var reactSelectCreatable_esm = require('./react-select-creatable.esm-7231b55e.js');
|
|
10
10
|
var reactSelectAsyncPaginate = require('react-select-async-paginate');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var defaultTheme = require('./defaultTheme-50f2b88f.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var nanoid = require('nanoid');
|
|
6
|
+
var check = require('./check-555d831b.js');
|
|
7
|
+
var editNote = require('./edit-note-c47d292e.js');
|
|
8
|
+
var styled = require('styled-components');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
14
|
+
|
|
15
|
+
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, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37;
|
|
16
|
+
var fadeInCheck = styled.keyframes(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n from {\n opacity: 0\n }\n to {\n opacity: 1\n }\n"])));
|
|
17
|
+
var fadeOutCheck = styled.keyframes(_templateObject2 || (_templateObject2 = defaultTheme._taggedTemplateLiteral(["\n from {\n opacity: 1\n }\n to {\n opacity: 0\n }\n"])));
|
|
18
|
+
var activeLabel = styled.css(_templateObject3 || (_templateObject3 = 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"])));
|
|
19
|
+
var placeholderBaseStyle = styled.css(_templateObject4 || (_templateObject4 = defaultTheme._taggedTemplateLiteral(["\n ", "\n\n ", "\n"])), function (props) {
|
|
20
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'));
|
|
21
|
+
}, function (props) {
|
|
22
|
+
return props.theme.themeProp('opacity', 0.6, 0.5);
|
|
23
|
+
});
|
|
24
|
+
var InputIconContainer = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject5 || (_templateObject5 = 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 }\n"])), function (props) {
|
|
25
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-900'), '!important');
|
|
26
|
+
}, function (props) {
|
|
27
|
+
return props.disabled && styled.css(_templateObject6 || (_templateObject6 = defaultTheme._taggedTemplateLiteral(["\n display: none;\n "])));
|
|
28
|
+
});
|
|
29
|
+
var Container = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject7 || (_templateObject7 = defaultTheme._taggedTemplateLiteral([""])));
|
|
30
|
+
var TextInputField = styled__default['default'].textarea.attrs(defaultTheme.applyDefaultTheme)(_templateObject8 || (_templateObject8 = 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 ", "\n \n ", "\n ", "\n ", "\n border: 1px solid;\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) {
|
|
31
|
+
return props.theme.themeProp('color', 'white', 'black');
|
|
32
|
+
}, function (props) {
|
|
33
|
+
return props.disabled && styled.css(_templateObject9 || (_templateObject9 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0.5;\n cursor: not-allowed;\n "])));
|
|
34
|
+
}, function (props) {
|
|
35
|
+
return props.readOnly && styled.css(_templateObject10 || (_templateObject10 = defaultTheme._taggedTemplateLiteral(["\n pointer-events: none;\n "])));
|
|
36
|
+
}, function (props) {
|
|
37
|
+
return props.expanded && styled.css(_templateObject11 || (_templateObject11 = defaultTheme._taggedTemplateLiteral(["\n height: ", "em;\n "])), props.maxHeight);
|
|
38
|
+
}, function (props) {
|
|
39
|
+
return props.showMore && styled.css(_templateObject12 || (_templateObject12 = defaultTheme._taggedTemplateLiteral(["\n overflow: hidden;\n "])));
|
|
40
|
+
}, function (props) {
|
|
41
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'));
|
|
42
|
+
}, function (props) {
|
|
43
|
+
return (props.state === 'warning' || props.state === 'error') && props.theme.themeProp('color', props.theme.getColor('gray-900'), props.theme.getColor('gray-900'));
|
|
44
|
+
}, function (props) {
|
|
45
|
+
return props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'));
|
|
46
|
+
}, function (props) {
|
|
47
|
+
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
48
|
+
}, function (props) {
|
|
49
|
+
return props.noBorder && styled.css(_templateObject13 || (_templateObject13 = defaultTheme._taggedTemplateLiteral(["\n padding: 13px 15px 13px 10px;\n border-color: transparent !important;\n "])));
|
|
50
|
+
}, function (props) {
|
|
51
|
+
return props.state === 'error-border' && styled.css(_templateObject14 || (_templateObject14 = defaultTheme._taggedTemplateLiteral(["\n ", "\n "])), props.theme.themeProp('border-color', props.theme.getColor('red-200'), props.theme.getColor('red-500')));
|
|
52
|
+
}, function (props) {
|
|
53
|
+
return props.state === 'warning' && !props.editWarning && styled.css(_templateObject15 || (_templateObject15 = defaultTheme._taggedTemplateLiteral(["\n ", "\n ", "\n :focus {\n background: white !important;\n color: black !important;\n }\n &&:hover:not(:focus) {\n ", "\n ", "\n }\n &&:read-only:hover {\n ", "\n }\n "])), props.theme.themeProp('color', 'white', 'black'), props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400')), function (props) {
|
|
54
|
+
return props.disabled && styled.css(_templateObject16 || (_templateObject16 = defaultTheme._taggedTemplateLiteral(["\n background: none !important;\n "])));
|
|
55
|
+
}, props.theme.themeProp('background', '#816600', '#F4E21E'), props.theme.themeProp('background', props.theme.getColor('signal-yellow-500'), props.theme.getColor('signal-yellow-400')));
|
|
56
|
+
}, function (props) {
|
|
57
|
+
return props.state === 'warning' && props.editWarning && styled.css(_templateObject17 || (_templateObject17 = 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')));
|
|
58
|
+
}, function (props) {
|
|
59
|
+
return props.state === 'error' && styled.css(_templateObject18 || (_templateObject18 = 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'));
|
|
60
|
+
}, function (props) {
|
|
61
|
+
return props.lightBackground && styled.css(_templateObject19 || (_templateObject19 = 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'));
|
|
62
|
+
}, function (props) {
|
|
63
|
+
return props.edit && props.theme.themeProp('background', '#505050', '#eff1f4');
|
|
64
|
+
}, function (props) {
|
|
65
|
+
return props.noBorder && !props.readOnly && props.state != 'warning' ? props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100')) : 'background: transparent';
|
|
66
|
+
}, InputIconContainer, function (props) {
|
|
67
|
+
return props.state === 'success' && styled.css(_templateObject20 || (_templateObject20 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0;\n "])));
|
|
68
|
+
}, function (props) {
|
|
69
|
+
return props.state === 'warning' && styled.css(_templateObject21 || (_templateObject21 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", ";\n "])), props.theme.getColor('orange-500'));
|
|
70
|
+
}, function (props) {
|
|
71
|
+
return props.state === 'error' && styled.css(_templateObject22 || (_templateObject22 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", ";\n "])), props.theme.getColor('red-500'));
|
|
72
|
+
}, function (props) {
|
|
73
|
+
return props.hasIcon && styled.css(_templateObject23 || (_templateObject23 = defaultTheme._taggedTemplateLiteral(["\n padding-left: 35px;\n "])));
|
|
74
|
+
}, function (props) {
|
|
75
|
+
return (props.state === 'warning' || props.state === 'error' || props.state === 'loading' || props.state === 'success' || props.state === 'error-border') && styled.css(_templateObject24 || (_templateObject24 = defaultTheme._taggedTemplateLiteral(["\n padding-left: 55px;\n padding-top: 15px;\n padding-right: 50px;\n "])));
|
|
76
|
+
}, function (props) {
|
|
77
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'), 1);
|
|
78
|
+
}, function (props) {
|
|
79
|
+
return props.theme.themeProp('opacity', 0.6, 0.5, 1);
|
|
80
|
+
}, function (props) {
|
|
81
|
+
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-600'));
|
|
82
|
+
}, function (props) {
|
|
83
|
+
return props.theme.getColor('gray-600');
|
|
84
|
+
});
|
|
85
|
+
var TextInputLabel = styled__default['default'].label.attrs(defaultTheme.applyDefaultTheme)(_templateObject25 || (_templateObject25 = 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) {
|
|
86
|
+
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%)"));
|
|
87
|
+
}, function (props) {
|
|
88
|
+
return props.hasPlaceholder && styled.css(_templateObject26 || (_templateObject26 = defaultTheme._taggedTemplateLiteral(["\n ", ";\n ", "\n "])), activeLabel, props.state === 'error' && styled.css(_templateObject27 || (_templateObject27 = defaultTheme._taggedTemplateLiteral(["\n color: ", " !important;\n "])), props.theme.getColor('red-500')));
|
|
89
|
+
}, function (props) {
|
|
90
|
+
return props.hasIcon && styled.css(_templateObject28 || (_templateObject28 = defaultTheme._taggedTemplateLiteral(["\n left: 35px;\n "])));
|
|
91
|
+
});
|
|
92
|
+
var TextInputFieldIcon = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject29 || (_templateObject29 = 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"])));
|
|
93
|
+
var TextInputFieldIconAlert = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject30 || (_templateObject30 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n top: 2.8px;\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) {
|
|
94
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-600'));
|
|
95
|
+
});
|
|
96
|
+
var TextInput = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject31 || (_templateObject31 = defaultTheme._taggedTemplateLiteral(["\n position: relative;\n\n ", "\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"])), function (props) {
|
|
97
|
+
return props.disabled && styled.css(_templateObject32 || (_templateObject32 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0.5;\n cursor: not-allowed;\n "])));
|
|
98
|
+
}, TextInputLabel, activeLabel, TextInputFieldIcon, TextInputField, TextInputLabel, activeLabel, function (props) {
|
|
99
|
+
return props.state === 'error' && props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'));
|
|
100
|
+
});
|
|
101
|
+
var Description = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject33 || (_templateObject33 = 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) {
|
|
102
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'));
|
|
103
|
+
}, function (props) {
|
|
104
|
+
return (props.state === 'error-border' || props.state === 'error') && styled.css(_templateObject34 || (_templateObject34 = defaultTheme._taggedTemplateLiteral(["\n ", "\n "])), props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500')));
|
|
105
|
+
});
|
|
106
|
+
var SuccessContainer = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject35 || (_templateObject35 = defaultTheme._taggedTemplateLiteral(["\n opacity: 1;\n pointer-events: none;\n opacity: ", ";\n animation: ", " 0.5s ease-in-out;\n transition: opacity 0.5s ease-in-out;\n position: absolute;\n margin-top: -35px;\n margin-left: 5px;\n width: 15px;\n height: 15px;\n padding: 5px;\n border-radius: 30px;\n ", "\n ", "\n > svg {\n width: 15px;\n }\n"])), function (props) {
|
|
107
|
+
return props.fadeIn ? 0 : 1;
|
|
108
|
+
}, function (props) {
|
|
109
|
+
return props.fadeIn ? fadeOutCheck : fadeInCheck;
|
|
110
|
+
}, function (props) {
|
|
111
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-500'));
|
|
112
|
+
}, function (props) {
|
|
113
|
+
return props.theme.themeProp('background-color', props.theme.getColor('gray-600'), props.theme.getColor('gray-100'));
|
|
114
|
+
});
|
|
115
|
+
var ShowMoreText = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject36 || (_templateObject36 = defaultTheme._taggedTemplateLiteral(["\n margin: 0 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"])), function (props) {
|
|
116
|
+
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('emerald-500'));
|
|
117
|
+
}, function (props) {
|
|
118
|
+
return props.state === 'error' && styled.css(_templateObject37 || (_templateObject37 = defaultTheme._taggedTemplateLiteral(["\n content: 'error';\n ", "\n "])), props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500')));
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
var TextArea = React__default['default'].forwardRef(function TextArea(_ref, forwardedRef) {
|
|
122
|
+
var value = _ref.value,
|
|
123
|
+
defaultValue = _ref.defaultValue,
|
|
124
|
+
name = _ref.name,
|
|
125
|
+
label = _ref.label,
|
|
126
|
+
placeholder = _ref.placeholder,
|
|
127
|
+
required = _ref.required,
|
|
128
|
+
disabled = _ref.disabled,
|
|
129
|
+
hidden = _ref.hidden,
|
|
130
|
+
readOnly = _ref.readOnly,
|
|
131
|
+
edit = _ref.edit,
|
|
132
|
+
editWarning = _ref.editWarning,
|
|
133
|
+
maxRows = _ref.maxRows,
|
|
134
|
+
showMore = _ref.showMore,
|
|
135
|
+
showMoreText = _ref.showMoreText,
|
|
136
|
+
autoComplete = _ref.autoComplete,
|
|
137
|
+
description = _ref.description,
|
|
138
|
+
state = _ref.state,
|
|
139
|
+
icon = _ref.icon,
|
|
140
|
+
rows = _ref.rows,
|
|
141
|
+
className = _ref.className,
|
|
142
|
+
style = _ref.style,
|
|
143
|
+
onChange = _ref.onChange,
|
|
144
|
+
onBlur = _ref.onBlur,
|
|
145
|
+
lightBackground = _ref.lightBackground,
|
|
146
|
+
noBorder = _ref.noBorder,
|
|
147
|
+
rest = defaultTheme._objectWithoutProperties(_ref, ["value", "defaultValue", "name", "label", "placeholder", "required", "disabled", "hidden", "readOnly", "edit", "editWarning", "maxRows", "showMore", "showMoreText", "autoComplete", "description", "state", "icon", "rows", "className", "style", "onChange", "onBlur", "lightBackground", "noBorder"]);
|
|
148
|
+
|
|
149
|
+
var textInputRef = React.useRef(null);
|
|
150
|
+
|
|
151
|
+
var _useState = React.useState(''),
|
|
152
|
+
_useState2 = defaultTheme._slicedToArray(_useState, 2),
|
|
153
|
+
contentRows = _useState2[0],
|
|
154
|
+
setContentRows = _useState2[1];
|
|
155
|
+
|
|
156
|
+
var _useState3 = React.useState(''),
|
|
157
|
+
_useState4 = defaultTheme._slicedToArray(_useState3, 2),
|
|
158
|
+
maxContentRows = _useState4[0],
|
|
159
|
+
setMaxContentRows = _useState4[1];
|
|
160
|
+
|
|
161
|
+
var _useState5 = React.useState(rows),
|
|
162
|
+
_useState6 = defaultTheme._slicedToArray(_useState5, 2),
|
|
163
|
+
defaultRows = _useState6[0],
|
|
164
|
+
setDefaultRows = _useState6[1];
|
|
165
|
+
|
|
166
|
+
var _useState7 = React.useState(false),
|
|
167
|
+
_useState8 = defaultTheme._slicedToArray(_useState7, 2),
|
|
168
|
+
expanded = _useState8[0],
|
|
169
|
+
setExpanded = _useState8[1];
|
|
170
|
+
|
|
171
|
+
var _useState9 = React.useState(''),
|
|
172
|
+
_useState10 = defaultTheme._slicedToArray(_useState9, 2),
|
|
173
|
+
maxHeight = _useState10[0],
|
|
174
|
+
setMaxHeight = _useState10[1];
|
|
175
|
+
|
|
176
|
+
var _useState11 = React.useState(false),
|
|
177
|
+
_useState12 = defaultTheme._slicedToArray(_useState11, 2),
|
|
178
|
+
showReadMore = _useState12[0],
|
|
179
|
+
setShowReadMore = _useState12[1];
|
|
180
|
+
|
|
181
|
+
React.useEffect(function () {
|
|
182
|
+
setDefaultRows(rows);
|
|
183
|
+
}, [rows]);
|
|
184
|
+
|
|
185
|
+
var _useState13 = React.useState(nanoid.nanoid()),
|
|
186
|
+
_useState14 = defaultTheme._slicedToArray(_useState13, 1),
|
|
187
|
+
uniqueId = _useState14[0];
|
|
188
|
+
|
|
189
|
+
var handleTextAreaChange = function handleTextAreaChange() {
|
|
190
|
+
setExpanded(!expanded);
|
|
191
|
+
|
|
192
|
+
if (expanded === true) {
|
|
193
|
+
setContentRows(maxContentRows);
|
|
194
|
+
setMaxHeight(maxHeight);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (expanded === false) {
|
|
198
|
+
setContentRows(defaultRows);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
React.useEffect(function () {
|
|
203
|
+
var calculateRows = function calculateRows() {
|
|
204
|
+
var lineheight = 1.5;
|
|
205
|
+
var textareaRefCurrent = textInputRef.current;
|
|
206
|
+
|
|
207
|
+
if (textareaRefCurrent) {
|
|
208
|
+
var textarea = textareaRefCurrent.scrollHeight;
|
|
209
|
+
var rowsLimit = Math.floor(textarea / (lineheight * 12));
|
|
210
|
+
setMaxContentRows(rowsLimit);
|
|
211
|
+
|
|
212
|
+
if (rowsLimit > defaultRows) {
|
|
213
|
+
setExpanded(true);
|
|
214
|
+
setShowReadMore(true);
|
|
215
|
+
} else {
|
|
216
|
+
setShowReadMore(false);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (typeof maxRows === 'function') {
|
|
220
|
+
maxRows(rowsLimit);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
calculateRows();
|
|
226
|
+
}, [value, defaultRows]);
|
|
227
|
+
if (hidden) return null;
|
|
228
|
+
return React__default['default'].createElement(TextInput, {
|
|
229
|
+
disabled: disabled,
|
|
230
|
+
readOnly: readOnly,
|
|
231
|
+
state: state,
|
|
232
|
+
className: className,
|
|
233
|
+
style: style
|
|
234
|
+
}, state !== 'warning' && state !== 'error' && React__default['default'].createElement(TextInputFieldIcon, null, icon), (state === 'warning' || state === 'error') && React__default['default'].createElement(TextInputFieldIconAlert, null, icon), React__default['default'].createElement(Container, null, React__default['default'].createElement(TextInputField, defaultTheme._extends({
|
|
235
|
+
ref: forwardedRef ? forwardedRef : textInputRef,
|
|
236
|
+
rows: contentRows > rows ? contentRows : rows,
|
|
237
|
+
expanded: expanded,
|
|
238
|
+
maxHeight: maxHeight,
|
|
239
|
+
value: value,
|
|
240
|
+
defaultValue: defaultValue,
|
|
241
|
+
name: name,
|
|
242
|
+
placeholder: placeholder || ' ',
|
|
243
|
+
required: required,
|
|
244
|
+
readOnly: readOnly,
|
|
245
|
+
disabled: disabled,
|
|
246
|
+
edit: edit,
|
|
247
|
+
editWarning: editWarning,
|
|
248
|
+
showMore: showMore,
|
|
249
|
+
state: state,
|
|
250
|
+
autoComplete: autoComplete,
|
|
251
|
+
hasIcon: Boolean(icon),
|
|
252
|
+
icon: icon,
|
|
253
|
+
id: "text-input-".concat(uniqueId),
|
|
254
|
+
lightBackground: lightBackground,
|
|
255
|
+
onChange: onChange,
|
|
256
|
+
onBlur: onBlur,
|
|
257
|
+
noBorder: noBorder
|
|
258
|
+
}, rest)), (state === 'loading' || state === 'success') && React__default['default'].createElement(SuccessContainer, null, state === 'loading' && React__default['default'].createElement(check._default, {
|
|
259
|
+
color: '#b0b6b9',
|
|
260
|
+
size: 12
|
|
261
|
+
}), state === 'success' && React__default['default'].createElement(check.SvgCheck, null)), !readOnly && noBorder && React__default['default'].createElement(InputIconContainer, {
|
|
262
|
+
disabled: disabled
|
|
263
|
+
}, React__default['default'].createElement(editNote.SvgEditNote, null))), label && React__default['default'].createElement(TextInputLabel, {
|
|
264
|
+
htmlFor: "text-input-".concat(uniqueId),
|
|
265
|
+
hasPlaceholder: Boolean(placeholder),
|
|
266
|
+
hasIcon: Boolean(icon),
|
|
267
|
+
state: state
|
|
268
|
+
}, label, required && ' *'), typeof description === 'string' && description.length > 0 && React__default['default'].createElement(Description, {
|
|
269
|
+
state: state
|
|
270
|
+
}, description), maxContentRows > defaultRows && showMore && showReadMore && React__default['default'].createElement(ShowMoreText, {
|
|
271
|
+
onClick: handleTextAreaChange
|
|
272
|
+
}, showMoreText));
|
|
273
|
+
});
|
|
274
|
+
TextArea.defaultProps = {
|
|
275
|
+
rows: 4,
|
|
276
|
+
noBorder: false,
|
|
277
|
+
readOnly: false,
|
|
278
|
+
edit: false,
|
|
279
|
+
editWarning: false,
|
|
280
|
+
hidden: false,
|
|
281
|
+
showMore: false,
|
|
282
|
+
showMoreText: '',
|
|
283
|
+
state: ''
|
|
284
|
+
};
|
|
285
|
+
TextArea.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
286
|
+
value: defaultTheme.PropTypes.string,
|
|
287
|
+
defaultValue: defaultTheme.PropTypes.string,
|
|
288
|
+
name: defaultTheme.PropTypes.string,
|
|
289
|
+
label: defaultTheme.PropTypes.string,
|
|
290
|
+
placeholder: defaultTheme.PropTypes.string,
|
|
291
|
+
required: defaultTheme.PropTypes.bool,
|
|
292
|
+
disabled: defaultTheme.PropTypes.bool,
|
|
293
|
+
hidden: defaultTheme.PropTypes.bool,
|
|
294
|
+
readOnly: defaultTheme.PropTypes.bool,
|
|
295
|
+
showMore: defaultTheme.PropTypes.bool,
|
|
296
|
+
showMoreText: defaultTheme.PropTypes.string,
|
|
297
|
+
edit: defaultTheme.PropTypes.bool,
|
|
298
|
+
editWarning: defaultTheme.PropTypes.bool,
|
|
299
|
+
autoComplete: defaultTheme.PropTypes.string,
|
|
300
|
+
description: defaultTheme.PropTypes.string,
|
|
301
|
+
error: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.bool, defaultTheme.PropTypes.string]),
|
|
302
|
+
warning: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.bool, defaultTheme.PropTypes.string]),
|
|
303
|
+
icon: defaultTheme.PropTypes.element,
|
|
304
|
+
rows: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.number, defaultTheme.PropTypes.string]),
|
|
305
|
+
className: defaultTheme.PropTypes.string,
|
|
306
|
+
style: defaultTheme.PropTypes.object,
|
|
307
|
+
lightBackground: defaultTheme.PropTypes.bool,
|
|
308
|
+
onChange: defaultTheme.PropTypes.func,
|
|
309
|
+
onBlur: defaultTheme.PropTypes.func,
|
|
310
|
+
noBorder: defaultTheme.PropTypes.bool,
|
|
311
|
+
maxRows: defaultTheme.PropTypes.func,
|
|
312
|
+
isExpanded: defaultTheme.PropTypes.func,
|
|
313
|
+
state: defaultTheme.PropTypes.oneOf(['', 'error', 'error-border', 'warning', 'loading', 'success'])
|
|
314
|
+
} : {};
|
|
315
|
+
|
|
316
|
+
exports.TextArea = TextArea;
|
|
@@ -13,7 +13,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
13
13
|
var TippyTooltip__default = /*#__PURE__*/_interopDefaultLegacy(TippyTooltip);
|
|
14
14
|
|
|
15
15
|
var _templateObject;
|
|
16
|
-
var Tooltip$1 = styled__default['default'](TippyTooltip__default['default']).attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 1rem;\n font-weight: 400;\n background: ", ";\n border-radius: 3px;\n
|
|
16
|
+
var Tooltip$1 = styled__default['default'](TippyTooltip__default['default']).attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 1rem;\n font-weight: 400;\n background: ", ";\n border-radius: 3px;\n pointer-events: default !important;\n .tippy-content {\n padding: 9px 12px;\n }\n\n .tippy-arrow {\n color: ", ";\n }\n\n a {\n color: inherit;\n }\n"])), function (props) {
|
|
17
17
|
return props.theme.primaryFontFamily;
|
|
18
18
|
}, function (props) {
|
|
19
19
|
return props.theme.getColor('gray-700');
|
|
@@ -46,8 +46,7 @@ Tooltip.defaultProps = {
|
|
|
46
46
|
content: 'Tooltip',
|
|
47
47
|
interactive: false,
|
|
48
48
|
placement: 'top',
|
|
49
|
-
duration: 350
|
|
50
|
-
trigger: 'mouseenter focus'
|
|
49
|
+
duration: 350
|
|
51
50
|
};
|
|
52
51
|
Tooltip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
53
52
|
content: defaultTheme.PropTypes.oneOfType([defaultTheme.PropTypes.string, defaultTheme.PropTypes.element]).isRequired,
|