@ntbjs/react-components 2.0.0-rc.26 → 2.0.0-rc.28
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/{ActionButton-03dc5f67.js → ActionButton-4db754c3.js} +17 -24
- package/build/{Alert-8a511bdc.js → Alert-e6847a22.js} +29 -36
- package/build/{AssetAction-d081e4b7.js → AssetGallery-f67393d4.js} +588 -622
- package/build/{Badge-aa4cd9c1.js → Badge-d93586a9.js} +35 -42
- package/build/{Button-2e26f5da.js → Button-179a2fe4.js} +83 -90
- package/build/{Checkbox-0b8faf49.js → Checkbox-4a5fd716.js} +45 -52
- package/build/{CompactAutocompleteSelect-797778cb.js → CompactAutocompleteSelect-52c49513.js} +116 -125
- package/build/{CompactStarRating-da21b53f.js → CompactStarRating-9af2f427.js} +76 -101
- package/build/{CompactTextInput-d56aec71.js → CompactTextInput-42ca5d42.js} +104 -129
- package/build/InputGroup-1294d190.js +23 -0
- package/build/{MultiLevelCheckboxSelect-d229cf98.js → MultiLevelCheckboxSelect-d8044c88.js} +139 -167
- package/build/{MultiSelect-d7920eb1.js → MultiSelect-9f497e62.js} +81 -90
- package/build/{Popover-c4be47ea.js → Popover-20050b91.js} +35 -44
- package/build/{Radio-150fb2c9.js → Radio-73ca3ae2.js} +28 -35
- package/build/SectionSeparator-f47760a2.js +31 -0
- package/build/{Switch-d2d6e9ec.js → Switch-ecf3122b.js} +35 -42
- package/build/Tab-04d435c3.js +32 -0
- package/build/{Tabs-b06c0e24.js → Tabs-74d1ea8a.js} +37 -44
- package/build/{TextArea-26d3c8a1.js → TextArea-1e5b9201.js} +105 -113
- package/build/{TextInput-3a567daa.js → TextInput-fab35842.js} +78 -86
- package/build/Tooltip-c1d1199e.js +65 -0
- package/build/{VerificationStatusIcon-9876b68f.js → VerificationStatusIcon-49cb1c1b.js} +19 -44
- package/build/{_rollupPluginBabelHelpers-4b342fad.js → _rollupPluginBabelHelpers-c245b26a.js} +1 -3
- package/build/arrow-forward-ad12c5f3.js +15 -0
- package/build/close-a5d37608.js +15 -0
- package/build/data/Alert/index.js +6 -12
- package/build/data/Badge/index.js +5 -11
- package/build/data/Popover/index.js +10 -16
- package/build/data/Tab/index.js +5 -11
- package/build/data/Tabs/index.js +7 -13
- package/build/data/Tooltip/index.js +7 -13
- package/build/data/index.js +16 -30
- package/build/{defaultTheme-d9a7342e.js → defaultTheme-1bcc2541.js} +3 -7
- package/build/edit-note-283a0e15.js +15 -0
- package/build/expand-more-c5523c46.js +15 -0
- package/build/inputs/ActionButton/index.js +6 -12
- package/build/inputs/Button/index.js +13 -19
- package/build/inputs/Checkbox/index.js +6 -12
- package/build/inputs/CompactAutocompleteSelect/index.js +23 -29
- package/build/inputs/CompactStarRating/index.js +17 -23
- package/build/inputs/CompactTextInput/index.js +19 -25
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js +26 -0
- package/build/inputs/MultiSelect/index.js +10 -16
- package/build/inputs/Radio/index.js +7 -13
- package/build/inputs/Switch/index.js +6 -12
- package/build/inputs/TextArea/index.js +20 -26
- package/build/inputs/TextInput/index.js +9 -15
- package/build/inputs/index.js +40 -60
- package/build/layout/InputGroup/index.js +5 -11
- package/build/layout/SectionSeparator/index.js +5 -11
- package/build/layout/index.js +6 -15
- package/build/{shift-away-subtle-158617af.js → shift-away-subtle-0dd94a03.js} +3 -5
- package/build/ssr/index.js +1 -12
- package/build/styles/utils/colors.scss +4 -4
- package/build/warning-circle-24f3efcd.js +15 -0
- package/build/widgets/AssetGallery/AssetGallery.js +45 -0
- package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js +127 -0
- package/build/widgets/ContextMenu/ContextMenu.js +26 -0
- package/build/{ContextMenuItem-3967010d.js → widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js} +23 -48
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js +37 -0
- package/build/{InfoCard-d0fdf377.js → widgets/InfoCard/InfoCard.js} +27 -34
- package/build/widgets/Instructions/Instructions.js +255 -0
- package/build/{ProgressBar-2d26c1fb.js → widgets/ProgressBar/ProgressBar.js} +39 -46
- package/build/widgets/index.js +50 -65
- package/package.json +3 -3
- package/styles/utils/colors.scss +4 -4
- package/build/AssetPreviewTopBar-623cfa18.js +0 -152
- package/build/ContextMenu-82f9d728.js +0 -33
- package/build/InputGroup-8d4a4644.js +0 -30
- package/build/Instructions-af191987.js +0 -274
- package/build/SectionSeparator-e06c7660.js +0 -38
- package/build/Tab-ccbca1f2.js +0 -39
- package/build/Tooltip-d5882b82.js +0 -73
- package/build/arrow-forward-d7c77ae3.js +0 -37
- package/build/close-1751121a.js +0 -37
- package/build/edit-note-cefe2215.js +0 -37
- package/build/expand-more-d74e2bd2.js +0 -37
- package/build/widgets/AssetGallery/index.js +0 -55
- package/build/widgets/AssetPreview/AssetPreviewTopBar/index.js +0 -12
- package/build/widgets/ContextMenu/ContextMenuItem/index.js +0 -11
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/index.js +0 -44
- package/build/widgets/ContextMenu/index.js +0 -11
- package/build/widgets/InfoCard/index.js +0 -12
- package/build/widgets/Instructions/index.js +0 -33
- package/build/widgets/ProgressBar/index.js +0 -12
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
-
|
|
21
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
|
-
var useMergedRefs__default = /*#__PURE__*/_interopDefaultLegacy(useMergedRefs);
|
|
23
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
24
|
-
|
|
25
|
-
const fadeInCheck = styled.keyframes`
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-c245b26a.js';
|
|
2
|
+
import React__default, { useRef, useState, useMemo, useEffect, useCallback } from 'react';
|
|
3
|
+
import { isEmpty } from 'lodash';
|
|
4
|
+
import useMergedRefs from '@restart/hooks/useMergedRefs';
|
|
5
|
+
import { nanoid } from 'nanoid';
|
|
6
|
+
import { a as applyDefaultTheme, P as PropTypes } from './defaultTheme-1bcc2541.js';
|
|
7
|
+
import './Alert-e6847a22.js';
|
|
8
|
+
import './Badge-d93586a9.js';
|
|
9
|
+
import './Popover-20050b91.js';
|
|
10
|
+
import './Tab-04d435c3.js';
|
|
11
|
+
import './Tabs-74d1ea8a.js';
|
|
12
|
+
import { T as Tooltip } from './Tooltip-c1d1199e.js';
|
|
13
|
+
import './VerificationStatusIcon-49cb1c1b.js';
|
|
14
|
+
import { S as SvgEditNote } from './edit-note-283a0e15.js';
|
|
15
|
+
import styled, { keyframes, css } from 'styled-components';
|
|
16
|
+
|
|
17
|
+
const fadeInCheck = keyframes`
|
|
26
18
|
from {
|
|
27
19
|
opacity: 0
|
|
28
20
|
}
|
|
@@ -30,7 +22,7 @@ const fadeInCheck = styled.keyframes`
|
|
|
30
22
|
opacity: 1
|
|
31
23
|
}
|
|
32
24
|
`;
|
|
33
|
-
const fadeOutCheck =
|
|
25
|
+
const fadeOutCheck = keyframes`
|
|
34
26
|
from {
|
|
35
27
|
opacity: 1
|
|
36
28
|
}
|
|
@@ -38,7 +30,7 @@ const fadeOutCheck = styled.keyframes`
|
|
|
38
30
|
opacity: 0
|
|
39
31
|
}
|
|
40
32
|
`;
|
|
41
|
-
const activeLabel =
|
|
33
|
+
const activeLabel = css`
|
|
42
34
|
font-size: 0.75rem;
|
|
43
35
|
padding: 0 3px;
|
|
44
36
|
top: -7px;
|
|
@@ -46,10 +38,10 @@ const activeLabel = styled.css`
|
|
|
46
38
|
left: 8px !important;
|
|
47
39
|
opacity: 1 !important;
|
|
48
40
|
`;
|
|
49
|
-
const TextAreaContainter =
|
|
41
|
+
const TextAreaContainter = styled.div.attrs(applyDefaultTheme)`
|
|
50
42
|
display: flex;
|
|
51
43
|
`;
|
|
52
|
-
const Label =
|
|
44
|
+
const Label = styled.label.attrs(applyDefaultTheme)`
|
|
53
45
|
${props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700'))};
|
|
54
46
|
flex-basis: 33.33%;
|
|
55
47
|
font-size: 0.875rem;
|
|
@@ -59,11 +51,11 @@ const Label = styled__default["default"].label.attrs(defaultTheme.applyDefaultTh
|
|
|
59
51
|
justify-content: space-between;
|
|
60
52
|
align-items: center;
|
|
61
53
|
padding-top: 13px;
|
|
62
|
-
${props => props.disabled &&
|
|
54
|
+
${props => props.disabled && css`
|
|
63
55
|
cursor: not-allowed;
|
|
64
56
|
`}
|
|
65
57
|
`;
|
|
66
|
-
const InputIconContainer =
|
|
58
|
+
const InputIconContainer = styled.div.attrs(applyDefaultTheme)`
|
|
67
59
|
opacity: 0;
|
|
68
60
|
pointer-events: none;
|
|
69
61
|
border-top-right-radius: 3px;
|
|
@@ -89,12 +81,12 @@ const InputIconContainer = styled__default["default"].div.attrs(defaultTheme.app
|
|
|
89
81
|
opacity: 0.7;
|
|
90
82
|
transition: opacity 250ms;
|
|
91
83
|
|
|
92
|
-
${props => props.disabled &&
|
|
84
|
+
${props => props.disabled && css`
|
|
93
85
|
display: none;
|
|
94
86
|
`}
|
|
95
87
|
}
|
|
96
88
|
`;
|
|
97
|
-
const TextInputField =
|
|
89
|
+
const TextInputField = styled.textarea.attrs(applyDefaultTheme)`
|
|
98
90
|
width: 100%;
|
|
99
91
|
font-family: inherit;
|
|
100
92
|
font-size: 0.875rem;
|
|
@@ -109,37 +101,37 @@ const TextInputField = styled__default["default"].textarea.attrs(defaultTheme.ap
|
|
|
109
101
|
|
|
110
102
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
|
|
111
103
|
|
|
112
|
-
${props => props.borderRadius &&
|
|
104
|
+
${props => props.borderRadius && css`
|
|
113
105
|
border-radius: ${props.borderRadius}px;
|
|
114
106
|
`}
|
|
115
107
|
|
|
116
108
|
${props => {
|
|
117
109
|
if (props.type === 'error') {
|
|
118
|
-
return
|
|
110
|
+
return css`
|
|
119
111
|
${props.theme.themeProp('color', 'white', 'black')}
|
|
120
112
|
${props.theme.themeProp('background', '#7f1b1b', '#FBEAE6')}
|
|
121
113
|
${props.theme.themeProp('border-color', '#7f1b1b', '#FBEAE6')}
|
|
122
114
|
`;
|
|
123
115
|
} else if (props.type === 'warning') {
|
|
124
|
-
return
|
|
116
|
+
return css`
|
|
125
117
|
${props.theme.themeProp('color', 'white', 'black')}
|
|
126
118
|
${props.theme.themeProp('background', '#634E01', '#FFFDE8')}
|
|
127
119
|
${props.theme.themeProp('border-color', '#634E01', '#FFFDE8')}
|
|
128
120
|
`;
|
|
129
121
|
} else if (props.type === 'error-border') {
|
|
130
|
-
return
|
|
122
|
+
return css`
|
|
131
123
|
${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
|
|
132
124
|
${props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'))}
|
|
133
125
|
${props.theme.themeProp('border-color', props.theme.getColor('red-200'), props.theme.getColor('red-500'))}
|
|
134
126
|
`;
|
|
135
127
|
} else if (props.type === 'warning-border') {
|
|
136
|
-
return
|
|
128
|
+
return css`
|
|
137
129
|
${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
|
|
138
130
|
${props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'))}
|
|
139
131
|
${props.theme.themeProp('border-color', props.theme.getColor('red-200'), props.theme.getColor('orange-500'))}
|
|
140
132
|
`;
|
|
141
133
|
} else {
|
|
142
|
-
return
|
|
134
|
+
return css`
|
|
143
135
|
${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
|
|
144
136
|
${props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'))}
|
|
145
137
|
${props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'))}
|
|
@@ -148,43 +140,43 @@ const TextInputField = styled__default["default"].textarea.attrs(defaultTheme.ap
|
|
|
148
140
|
}}
|
|
149
141
|
|
|
150
142
|
|
|
151
|
-
${props => props.readOnly &&
|
|
143
|
+
${props => props.readOnly && css`
|
|
152
144
|
cursor: default;
|
|
153
145
|
border-color: transparent !important;
|
|
154
146
|
padding: 12px 10px;
|
|
155
147
|
`}
|
|
156
148
|
|
|
157
|
-
${props => props.disabled &&
|
|
149
|
+
${props => props.disabled && css`
|
|
158
150
|
cursor: not-allowed;
|
|
159
151
|
`}
|
|
160
152
|
|
|
161
153
|
|
|
162
|
-
${props => props.noBorder && !props.type &&
|
|
154
|
+
${props => props.noBorder && !props.type && css`
|
|
163
155
|
${props => props.theme.themeProp('border-color', props.theme.getColor('gray-900'), props.theme.getColor('white'))}
|
|
164
156
|
`}
|
|
165
157
|
|
|
166
|
-
${props => props.noBorder && props.type === 'warning' &&
|
|
158
|
+
${props => props.noBorder && props.type === 'warning' && css`
|
|
167
159
|
${props => props.theme.themeProp('border-color', '#634E01', '#FFFDE8')}
|
|
168
160
|
`}
|
|
169
161
|
|
|
170
|
-
${props => props.noBorder && props.type === 'error' &&
|
|
162
|
+
${props => props.noBorder && props.type === 'error' && css`
|
|
171
163
|
${props => props.theme.themeProp('border-color', '#7f1b1b', '#FBEAE6')}
|
|
172
164
|
`}
|
|
173
165
|
|
|
174
166
|
|
|
175
|
-
${props => props.padding === 'small' &&
|
|
167
|
+
${props => props.padding === 'small' && css`
|
|
176
168
|
padding: 5px 10px;
|
|
177
169
|
`}
|
|
178
170
|
|
|
179
|
-
${props => props.padding === 'medium' &&
|
|
171
|
+
${props => props.padding === 'medium' && css`
|
|
180
172
|
padding: 13px 15px;
|
|
181
173
|
`}
|
|
182
174
|
|
|
183
|
-
${props => props.padding === 'large' &&
|
|
175
|
+
${props => props.padding === 'large' && css`
|
|
184
176
|
padding: 15px 55px;
|
|
185
177
|
`}
|
|
186
178
|
|
|
187
|
-
${props => props.hasIcon &&
|
|
179
|
+
${props => props.hasIcon && css`
|
|
188
180
|
padding-left: 55px;
|
|
189
181
|
padding-right: 35px;
|
|
190
182
|
padding-top: 13.5px;
|
|
@@ -220,7 +212,7 @@ const TextInputField = styled__default["default"].textarea.attrs(defaultTheme.ap
|
|
|
220
212
|
|
|
221
213
|
& + ${InputIconContainer} {
|
|
222
214
|
opacity: 1;
|
|
223
|
-
${props => props.type === 'success' &&
|
|
215
|
+
${props => props.type === 'success' && css`
|
|
224
216
|
opacity: 0;
|
|
225
217
|
`}
|
|
226
218
|
}
|
|
@@ -282,19 +274,19 @@ const TextInputField = styled__default["default"].textarea.attrs(defaultTheme.ap
|
|
|
282
274
|
return '';
|
|
283
275
|
}
|
|
284
276
|
if (props.type === 'error') {
|
|
285
|
-
return
|
|
277
|
+
return css`
|
|
286
278
|
${props.theme.themeProp('border-color', '#D83018', '#D83018')}
|
|
287
279
|
${props.theme.themeProp('background', 'white', 'white')}
|
|
288
280
|
${props.theme.themeProp('color', 'black', 'black')}
|
|
289
281
|
`;
|
|
290
282
|
} else if (props.type === 'warning') {
|
|
291
|
-
return
|
|
283
|
+
return css`
|
|
292
284
|
${props.theme.themeProp('border-color', '#F4E21E', '#F4E21E')}
|
|
293
285
|
${props.theme.themeProp('background', 'white', 'white')}
|
|
294
286
|
${props.theme.themeProp('color', 'black', 'black')}
|
|
295
287
|
`;
|
|
296
288
|
} else {
|
|
297
|
-
return
|
|
289
|
+
return css`
|
|
298
290
|
${props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-600'))}
|
|
299
291
|
${props.theme.themeProp('background', 'transparent', props.theme.getColor('white'))}
|
|
300
292
|
`;
|
|
@@ -317,12 +309,12 @@ const TextInputField = styled__default["default"].textarea.attrs(defaultTheme.ap
|
|
|
317
309
|
|
|
318
310
|
${props => props.edit && props.theme.themeProp('border-color', 'rgba(39,39,42, 0.7)', 'rgba(228,228,231, 0.3)')}
|
|
319
311
|
|
|
320
|
-
${props => props.noBorder && props.edit &&
|
|
312
|
+
${props => props.noBorder && props.edit && css`
|
|
321
313
|
${props => props.theme.themeProp('border-color', '#27272A', 'rgba(244,244,245, 0.3)')}
|
|
322
314
|
`}
|
|
323
315
|
}
|
|
324
316
|
`;
|
|
325
|
-
const TextInputLabel =
|
|
317
|
+
const TextInputLabel = styled.label.attrs(applyDefaultTheme)`
|
|
326
318
|
position: absolute;
|
|
327
319
|
top: 13px;
|
|
328
320
|
left: 11px;
|
|
@@ -335,20 +327,20 @@ const TextInputLabel = styled__default["default"].label.attrs(defaultTheme.apply
|
|
|
335
327
|
|
|
336
328
|
${props => props.theme.themeProp('background', `linear-gradient(0deg, ${props.theme.getColor('gray-900')} calc(50% + 1px), transparent 50%)`, `linear-gradient(0deg, ${props.theme.getColor('white')} calc(50% + 1px), transparent 50%)`)}
|
|
337
329
|
|
|
338
|
-
${props => !props.inputIsEmpty &&
|
|
330
|
+
${props => !props.inputIsEmpty && css`
|
|
339
331
|
${activeLabel}
|
|
340
332
|
`}
|
|
341
333
|
|
|
342
|
-
${props => props.hasPlaceholder &&
|
|
334
|
+
${props => props.hasPlaceholder && css`
|
|
343
335
|
${activeLabel};
|
|
344
336
|
`}
|
|
345
337
|
content: "";
|
|
346
338
|
|
|
347
|
-
${props => props.hasIcon &&
|
|
339
|
+
${props => props.hasIcon && css`
|
|
348
340
|
left: 55px;
|
|
349
341
|
`}
|
|
350
342
|
`;
|
|
351
|
-
const TextInputFieldIcon =
|
|
343
|
+
const TextInputFieldIcon = styled.div.attrs(applyDefaultTheme)`
|
|
352
344
|
position: absolute;
|
|
353
345
|
top: 0;
|
|
354
346
|
left: 0;
|
|
@@ -362,7 +354,7 @@ const TextInputFieldIcon = styled__default["default"].div.attrs(defaultTheme.app
|
|
|
362
354
|
transition: opacity 250ms;
|
|
363
355
|
}
|
|
364
356
|
`;
|
|
365
|
-
const TextInputFieldIconAlert =
|
|
357
|
+
const TextInputFieldIconAlert = styled.div.attrs(applyDefaultTheme)`
|
|
366
358
|
position: absolute;
|
|
367
359
|
top: 2.8px;
|
|
368
360
|
display: flex;
|
|
@@ -375,11 +367,11 @@ const TextInputFieldIconAlert = styled__default["default"].div.attrs(defaultThem
|
|
|
375
367
|
width: 15px;
|
|
376
368
|
}
|
|
377
369
|
`;
|
|
378
|
-
const TextInput =
|
|
370
|
+
const TextInput = styled.div.attrs(applyDefaultTheme)`
|
|
379
371
|
position: relative;
|
|
380
372
|
flex-basis: ${props => props.$fieldLabel ? '66.66%' : '100%'};
|
|
381
373
|
|
|
382
|
-
${props => props.disabled &&
|
|
374
|
+
${props => props.disabled && css`
|
|
383
375
|
opacity: 0.5;
|
|
384
376
|
|
|
385
377
|
> * {
|
|
@@ -404,7 +396,7 @@ const TextInput = styled__default["default"].div.attrs(defaultTheme.applyDefault
|
|
|
404
396
|
${props => props.type === 'error' && props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'))}
|
|
405
397
|
}
|
|
406
398
|
`;
|
|
407
|
-
const Description =
|
|
399
|
+
const Description = styled.div.attrs(applyDefaultTheme)`
|
|
408
400
|
margin: 8px 0 0 0;
|
|
409
401
|
padding: 0 0.6875rem;
|
|
410
402
|
font-size: 0.75rem;
|
|
@@ -412,15 +404,15 @@ const Description = styled__default["default"].div.attrs(defaultTheme.applyDefau
|
|
|
412
404
|
|
|
413
405
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
|
|
414
406
|
|
|
415
|
-
${props => (props.type === 'warning-border' || props.type === 'warning') &&
|
|
407
|
+
${props => (props.type === 'warning-border' || props.type === 'warning') && css`
|
|
416
408
|
${props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('orange-500'))}
|
|
417
409
|
`}
|
|
418
410
|
|
|
419
|
-
${props => (props.type === 'error-border' || props.type === 'error') &&
|
|
411
|
+
${props => (props.type === 'error-border' || props.type === 'error') && css`
|
|
420
412
|
${props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'))}
|
|
421
413
|
`}
|
|
422
414
|
`;
|
|
423
|
-
const SuccessContainer =
|
|
415
|
+
const SuccessContainer = styled.div.attrs(applyDefaultTheme)`
|
|
424
416
|
opacity: 1;
|
|
425
417
|
pointer-events: none;
|
|
426
418
|
opacity: ${props => props.fadeIn ? 0 : 1};
|
|
@@ -438,7 +430,7 @@ const SuccessContainer = styled__default["default"].div.attrs(defaultTheme.apply
|
|
|
438
430
|
width: 15px;
|
|
439
431
|
}
|
|
440
432
|
`;
|
|
441
|
-
const SuccessContainerLabel =
|
|
433
|
+
const SuccessContainerLabel = styled.div.attrs(applyDefaultTheme)`
|
|
442
434
|
opacity: 1;
|
|
443
435
|
pointer-events: none;
|
|
444
436
|
opacity: ${props => props.fadeIn ? 0 : 1};
|
|
@@ -456,7 +448,7 @@ const SuccessContainerLabel = styled__default["default"].div.attrs(defaultTheme.
|
|
|
456
448
|
}
|
|
457
449
|
`;
|
|
458
450
|
|
|
459
|
-
const TextArea = React__default
|
|
451
|
+
const TextArea = React__default.forwardRef(function TextArea({
|
|
460
452
|
value,
|
|
461
453
|
defaultValue,
|
|
462
454
|
name,
|
|
@@ -485,36 +477,36 @@ const TextArea = React__default["default"].forwardRef(function TextArea({
|
|
|
485
477
|
fieldLabel,
|
|
486
478
|
...rest
|
|
487
479
|
}, forwardedRef) {
|
|
488
|
-
const textInputDomNode =
|
|
489
|
-
const textInputRef =
|
|
490
|
-
const [inputIsEmpty, setInputIsEmpty] =
|
|
491
|
-
const [autoFocus, setAutoFocus] =
|
|
492
|
-
const [uniqueId] =
|
|
493
|
-
const memoizedDescriptionToolTip =
|
|
480
|
+
const textInputDomNode = useRef(null);
|
|
481
|
+
const textInputRef = useMergedRefs(forwardedRef, textInputDomNode);
|
|
482
|
+
const [inputIsEmpty, setInputIsEmpty] = useState(!(value || defaultValue));
|
|
483
|
+
const [autoFocus, setAutoFocus] = useState(false);
|
|
484
|
+
const [uniqueId] = useState(nanoid());
|
|
485
|
+
const memoizedDescriptionToolTip = useMemo(() => {
|
|
494
486
|
return descriptionToolTip;
|
|
495
487
|
}, [descriptionToolTip]);
|
|
496
|
-
|
|
488
|
+
useEffect(() => {
|
|
497
489
|
setAutoFocus(false);
|
|
498
490
|
}, [value, defaultValue]);
|
|
499
|
-
const onKeyDown =
|
|
491
|
+
const onKeyDown = useCallback(event => {
|
|
500
492
|
if (event.key === 'Enter') {
|
|
501
493
|
event.stopPropagation();
|
|
502
494
|
}
|
|
503
495
|
}, []);
|
|
504
496
|
const input = () => {
|
|
505
|
-
return React__default
|
|
497
|
+
return React__default.createElement(TextAreaContainter, null, fieldLabel && React__default.createElement(Label, {
|
|
506
498
|
htmlFor: uniqueId,
|
|
507
499
|
disabled: disabled
|
|
508
|
-
}, fieldLabel, React__default
|
|
509
|
-
$fieldLabel: !
|
|
500
|
+
}, fieldLabel, React__default.createElement(SuccessContainerLabel, null, type === 'loading' && loadingIcon, type === 'success' && successIcon)), React__default.createElement(TextInput, {
|
|
501
|
+
$fieldLabel: !isEmpty(fieldLabel),
|
|
510
502
|
disabled: disabled,
|
|
511
503
|
readOnly: readOnly,
|
|
512
504
|
type: type,
|
|
513
505
|
className: className,
|
|
514
506
|
style: style
|
|
515
|
-
}, React__default
|
|
507
|
+
}, React__default.createElement(TextInputFieldIconAlert, {
|
|
516
508
|
type: type
|
|
517
|
-
}, icon), React__default
|
|
509
|
+
}, icon), React__default.createElement(TextInputField, _extends({
|
|
518
510
|
autoFocus: autoFocus,
|
|
519
511
|
borderRadius: borderRadius,
|
|
520
512
|
ref: textInputRef,
|
|
@@ -551,21 +543,21 @@ const TextArea = React__default["default"].forwardRef(function TextArea({
|
|
|
551
543
|
onKeyDown: onKeyDown,
|
|
552
544
|
onBlur: onBlur,
|
|
553
545
|
noBorder: noBorder
|
|
554
|
-
}, rest)), !fieldLabel && (type === 'loading' || type === 'success') && React__default
|
|
546
|
+
}, rest)), !fieldLabel && (type === 'loading' || type === 'success') && React__default.createElement(SuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon), !readOnly && noBorder && React__default.createElement(InputIconContainer, {
|
|
555
547
|
disabled: disabled
|
|
556
|
-
}, React__default
|
|
548
|
+
}, React__default.createElement(SvgEditNote, {
|
|
557
549
|
className: padding === 'small' ? 'smallPadingIcon' : undefined
|
|
558
|
-
})), label && React__default
|
|
550
|
+
})), label && React__default.createElement(TextInputLabel, {
|
|
559
551
|
htmlFor: `text-input-${uniqueId}`,
|
|
560
552
|
hasPlaceholder: Boolean(placeholder),
|
|
561
553
|
hasIcon: Boolean(icon),
|
|
562
554
|
inputIsEmpty: inputIsEmpty
|
|
563
|
-
}, label, required && ' *'), typeof description === 'string' && description.length > 0 && React__default
|
|
555
|
+
}, label, required && ' *'), typeof description === 'string' && description.length > 0 && React__default.createElement(Description, {
|
|
564
556
|
type: type
|
|
565
557
|
}, description)));
|
|
566
558
|
};
|
|
567
559
|
if (hidden) return null;
|
|
568
|
-
return React__default
|
|
560
|
+
return React__default.createElement(React__default.Fragment, null, !memoizedDescriptionToolTip && input(), memoizedDescriptionToolTip && React__default.createElement("div", null, React__default.createElement(Tooltip, {
|
|
569
561
|
content: memoizedDescriptionToolTip,
|
|
570
562
|
key: "tooltipTextArea1",
|
|
571
563
|
placement: "bottom-end",
|
|
@@ -587,33 +579,33 @@ TextArea.defaultProps = {
|
|
|
587
579
|
borderRadius: 0
|
|
588
580
|
};
|
|
589
581
|
TextArea.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
590
|
-
value:
|
|
591
|
-
defaultValue:
|
|
592
|
-
name:
|
|
593
|
-
label:
|
|
594
|
-
fieldLabel:
|
|
595
|
-
placeholder:
|
|
596
|
-
required:
|
|
597
|
-
disabled:
|
|
598
|
-
hidden:
|
|
599
|
-
readOnly:
|
|
600
|
-
edit:
|
|
601
|
-
autoComplete:
|
|
602
|
-
description:
|
|
603
|
-
icon:
|
|
604
|
-
rows:
|
|
605
|
-
className:
|
|
606
|
-
style:
|
|
607
|
-
padding:
|
|
608
|
-
onChange:
|
|
609
|
-
onBlur:
|
|
610
|
-
noBorder:
|
|
611
|
-
isExpanded:
|
|
612
|
-
type:
|
|
613
|
-
loadingIcon:
|
|
614
|
-
successIcon:
|
|
615
|
-
descriptionToolTip:
|
|
616
|
-
borderRadius:
|
|
582
|
+
value: PropTypes.string,
|
|
583
|
+
defaultValue: PropTypes.string,
|
|
584
|
+
name: PropTypes.string,
|
|
585
|
+
label: PropTypes.string,
|
|
586
|
+
fieldLabel: PropTypes.string,
|
|
587
|
+
placeholder: PropTypes.string,
|
|
588
|
+
required: PropTypes.bool,
|
|
589
|
+
disabled: PropTypes.bool,
|
|
590
|
+
hidden: PropTypes.bool,
|
|
591
|
+
readOnly: PropTypes.bool,
|
|
592
|
+
edit: PropTypes.bool,
|
|
593
|
+
autoComplete: PropTypes.string,
|
|
594
|
+
description: PropTypes.string,
|
|
595
|
+
icon: PropTypes.element,
|
|
596
|
+
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
597
|
+
className: PropTypes.string,
|
|
598
|
+
style: PropTypes.object,
|
|
599
|
+
padding: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
600
|
+
onChange: PropTypes.func,
|
|
601
|
+
onBlur: PropTypes.func,
|
|
602
|
+
noBorder: PropTypes.bool,
|
|
603
|
+
isExpanded: PropTypes.func,
|
|
604
|
+
type: PropTypes.oneOf(['', 'error', 'error-border', 'warning-border', 'warning', 'loading', 'success']),
|
|
605
|
+
loadingIcon: PropTypes.element,
|
|
606
|
+
successIcon: PropTypes.element,
|
|
607
|
+
descriptionToolTip: PropTypes.string,
|
|
608
|
+
borderRadius: PropTypes.number
|
|
617
609
|
} : {};
|
|
618
610
|
|
|
619
|
-
|
|
611
|
+
export { TextArea as T };
|