@ntbjs/react-components 2.0.0-rc.26 → 2.0.0-rc.27
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/{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/warning-circle-24f3efcd.js +15 -0
- package/build/{AssetAction-d081e4b7.js → widgets/AssetGallery/AssetGallery.js} +601 -622
- 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/package.json +1 -1
- 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
- package/build/widgets/index.js +0 -65
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
const Button$1 = styled__default["default"].button.attrs(defaultTheme.applyDefaultTheme)`
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-c245b26a.js';
|
|
2
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { a as applyDefaultTheme, P as PropTypes } from './defaultTheme-1bcc2541.js';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { P as Popover } from './Popover-20050b91.js';
|
|
6
|
+
import ContextMenu from './widgets/ContextMenu/ContextMenu.js';
|
|
7
|
+
import { S as SvgExpandMore } from './expand-more-c5523c46.js';
|
|
8
|
+
|
|
9
|
+
const Button$1 = styled.button.attrs(applyDefaultTheme)`
|
|
17
10
|
position: relative;
|
|
18
11
|
border-radius: 3px;
|
|
19
12
|
font-family: inherit;
|
|
@@ -34,7 +27,7 @@ const Button$1 = styled__default["default"].button.attrs(defaultTheme.applyDefau
|
|
|
34
27
|
${props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('white'))}
|
|
35
28
|
|
|
36
29
|
&& {
|
|
37
|
-
${props => props.secondary &&
|
|
30
|
+
${props => props.secondary && css`
|
|
38
31
|
background: ${props => props.theme.getColor('gray-200')};
|
|
39
32
|
border-color: ${props => props.theme.getColor('gray-200')};
|
|
40
33
|
|
|
@@ -49,7 +42,7 @@ const Button$1 = styled__default["default"].button.attrs(defaultTheme.applyDefau
|
|
|
49
42
|
}
|
|
50
43
|
|
|
51
44
|
&& {
|
|
52
|
-
${props => props.outlined &&
|
|
45
|
+
${props => props.outlined && css`
|
|
53
46
|
background: transparent;
|
|
54
47
|
transition: none;
|
|
55
48
|
|
|
@@ -69,7 +62,7 @@ const Button$1 = styled__default["default"].button.attrs(defaultTheme.applyDefau
|
|
|
69
62
|
}
|
|
70
63
|
|
|
71
64
|
&& {
|
|
72
|
-
${props => props.outlined && props.secondary &&
|
|
65
|
+
${props => props.outlined && props.secondary && css`
|
|
73
66
|
${props.theme.themeProp('border-color', props.theme.getColor('gray-400'), props.theme.getColor('gray-700'))}
|
|
74
67
|
|
|
75
68
|
${props.theme.themeProp('color', props.theme.getColor('gray-200'), props.theme.getColor('gray-700'))}
|
|
@@ -86,7 +79,7 @@ const Button$1 = styled__default["default"].button.attrs(defaultTheme.applyDefau
|
|
|
86
79
|
}
|
|
87
80
|
|
|
88
81
|
&& {
|
|
89
|
-
${props => props.outlined && props.secondary && props.dropdownItems &&
|
|
82
|
+
${props => props.outlined && props.secondary && props.dropdownItems && css`
|
|
90
83
|
&:hover,
|
|
91
84
|
&.dropdown-is-active {
|
|
92
85
|
${props.theme.themeProp('border-color', props.theme.getColor('gray-300'), props.theme.getColor('gray-300'))}
|
|
@@ -94,30 +87,30 @@ const Button$1 = styled__default["default"].button.attrs(defaultTheme.applyDefau
|
|
|
94
87
|
`};
|
|
95
88
|
}
|
|
96
89
|
|
|
97
|
-
${props => props.block &&
|
|
90
|
+
${props => props.block && css`
|
|
98
91
|
width: 100%;
|
|
99
92
|
`};
|
|
100
93
|
|
|
101
|
-
${props => props.disabled &&
|
|
94
|
+
${props => props.disabled && css`
|
|
102
95
|
opacity: 0.5;
|
|
103
96
|
cursor: not-allowed;
|
|
104
97
|
pointer-events: none;
|
|
105
98
|
`};
|
|
106
99
|
|
|
107
|
-
${props => props.size === 'x-small' &&
|
|
100
|
+
${props => props.size === 'x-small' && css`
|
|
108
101
|
padding: 1px 16px;
|
|
109
102
|
height: 24px;
|
|
110
103
|
`};
|
|
111
104
|
|
|
112
|
-
${props => props.size === 'small' &&
|
|
105
|
+
${props => props.size === 'small' && css`
|
|
113
106
|
padding: 6px 16px;
|
|
114
107
|
`};
|
|
115
108
|
|
|
116
|
-
${props => props.size === 'large' &&
|
|
109
|
+
${props => props.size === 'large' && css`
|
|
117
110
|
padding: 16px 16px;
|
|
118
111
|
`};
|
|
119
112
|
|
|
120
|
-
${props => props.singleAction &&
|
|
113
|
+
${props => props.singleAction && css`
|
|
121
114
|
display: flex;
|
|
122
115
|
align-items: center;
|
|
123
116
|
gap: ${props.singleActionGap}px;
|
|
@@ -125,12 +118,12 @@ const Button$1 = styled__default["default"].button.attrs(defaultTheme.applyDefau
|
|
|
125
118
|
transition: all 250ms, opacity 200ms;
|
|
126
119
|
`};
|
|
127
120
|
|
|
128
|
-
${props => props.width &&
|
|
121
|
+
${props => props.width && css`
|
|
129
122
|
min-width: ${props.width}px;
|
|
130
123
|
justify-content: center;
|
|
131
124
|
`};
|
|
132
125
|
`;
|
|
133
|
-
const ButtonContent =
|
|
126
|
+
const ButtonContent = styled.div.attrs(applyDefaultTheme)`
|
|
134
127
|
display: flex;
|
|
135
128
|
justify-content: center;
|
|
136
129
|
align-items: center;
|
|
@@ -144,23 +137,23 @@ const ButtonContent = styled__default["default"].div.attrs(defaultTheme.applyDef
|
|
|
144
137
|
max-height: 16px;
|
|
145
138
|
margin-right: 8px;
|
|
146
139
|
|
|
147
|
-
${props => props.size === 'small' &&
|
|
140
|
+
${props => props.size === 'small' && css`
|
|
148
141
|
max-width: 13px;
|
|
149
142
|
max-height: 13px;
|
|
150
143
|
`};
|
|
151
144
|
|
|
152
|
-
${props => props.size === 'x-small' &&
|
|
145
|
+
${props => props.size === 'x-small' && css`
|
|
153
146
|
max-width: 11px;
|
|
154
147
|
max-height: 11px;
|
|
155
148
|
`};
|
|
156
149
|
}
|
|
157
150
|
|
|
158
|
-
${props => props.$loading &&
|
|
151
|
+
${props => props.$loading && css`
|
|
159
152
|
transform: scale(0.95);
|
|
160
153
|
opacity: 0;
|
|
161
154
|
`}
|
|
162
155
|
|
|
163
|
-
${props => props.singleAction &&
|
|
156
|
+
${props => props.singleAction && css`
|
|
164
157
|
svg {
|
|
165
158
|
width: 100% !important;
|
|
166
159
|
height: 100% !important;
|
|
@@ -168,7 +161,7 @@ const ButtonContent = styled__default["default"].div.attrs(defaultTheme.applyDef
|
|
|
168
161
|
}
|
|
169
162
|
`};
|
|
170
163
|
`;
|
|
171
|
-
const LoadingIndicator =
|
|
164
|
+
const LoadingIndicator = styled.div.attrs(applyDefaultTheme)`
|
|
172
165
|
position: absolute;
|
|
173
166
|
height: 100%;
|
|
174
167
|
width: 100%;
|
|
@@ -180,62 +173,62 @@ const LoadingIndicator = styled__default["default"].div.attrs(defaultTheme.apply
|
|
|
180
173
|
transition: opacity 200ms;
|
|
181
174
|
box-sizing: border-box;
|
|
182
175
|
|
|
183
|
-
${props => props.$loading &&
|
|
176
|
+
${props => props.$loading && css`
|
|
184
177
|
opacity: 1;
|
|
185
178
|
`}
|
|
186
179
|
`;
|
|
187
|
-
const LoadingIndicatorSvg =
|
|
180
|
+
const LoadingIndicatorSvg = styled.svg.attrs(applyDefaultTheme)`
|
|
188
181
|
height: 100%;
|
|
189
182
|
color: inherit;
|
|
190
183
|
transform: rotate(-88deg);
|
|
191
184
|
`;
|
|
192
|
-
const LoadingIndicatorSvgCircle =
|
|
185
|
+
const LoadingIndicatorSvgCircle = styled.circle.attrs(applyDefaultTheme)`
|
|
193
186
|
transition: stroke-dashoffset 300ms linear;
|
|
194
187
|
stroke-dasharray: 113;
|
|
195
188
|
`;
|
|
196
|
-
const ButtonWrapper =
|
|
189
|
+
const ButtonWrapper = styled.span.attrs(applyDefaultTheme)`
|
|
197
190
|
white-space: nowrap;
|
|
198
191
|
display: flex;
|
|
199
|
-
${props => props.block &&
|
|
192
|
+
${props => props.block && css`
|
|
200
193
|
width: 100%;
|
|
201
194
|
`}
|
|
202
195
|
`;
|
|
203
|
-
const MainButtonWrapper =
|
|
196
|
+
const MainButtonWrapper = styled.div.attrs(applyDefaultTheme)`
|
|
204
197
|
border-radius: 3px;
|
|
205
|
-
${props => props.block &&
|
|
198
|
+
${props => props.block && css`
|
|
206
199
|
width: 100%;
|
|
207
200
|
display: flex;
|
|
208
201
|
`}
|
|
209
202
|
|
|
210
203
|
${props => {
|
|
211
|
-
return (props.activeDropdown || props.dropdownItems) && !props.outlined &&
|
|
204
|
+
return (props.activeDropdown || props.dropdownItems) && !props.outlined && css`
|
|
212
205
|
background: ${props.secondary ? props.theme.getColor('gray-200') : props.theme.getColor('emerald-500')};
|
|
213
206
|
`;
|
|
214
207
|
}};
|
|
215
208
|
`;
|
|
216
|
-
const MainButtonContainer =
|
|
209
|
+
const MainButtonContainer = styled.div.attrs(applyDefaultTheme)`
|
|
217
210
|
display: inline-block;
|
|
218
211
|
|
|
219
|
-
${props => props.block &&
|
|
212
|
+
${props => props.block && css`
|
|
220
213
|
flex: 1;
|
|
221
214
|
width: 100%;
|
|
222
215
|
`}
|
|
223
216
|
|
|
224
217
|
button {
|
|
225
|
-
${props => (props.activeDropdown || props.dropdownItems) &&
|
|
218
|
+
${props => (props.activeDropdown || props.dropdownItems) && css`
|
|
226
219
|
border-bottom-right-radius: 0;
|
|
227
220
|
border-top-right-radius: 0;
|
|
228
221
|
`};
|
|
229
222
|
|
|
230
|
-
${props => (props.activeDropdown || props.dropdownItems) && props.outlined &&
|
|
223
|
+
${props => (props.activeDropdown || props.dropdownItems) && props.outlined && css`
|
|
231
224
|
border-right: none;
|
|
232
225
|
`};
|
|
233
226
|
}
|
|
234
227
|
`;
|
|
235
|
-
const MainButtonContainerSingle =
|
|
228
|
+
const MainButtonContainerSingle = styled.div.attrs(applyDefaultTheme)`
|
|
236
229
|
display: inline-block;
|
|
237
230
|
width: 100%;
|
|
238
|
-
${props => props.singleAction &&
|
|
231
|
+
${props => props.singleAction && css`
|
|
239
232
|
display: flex;
|
|
240
233
|
align-items: center;
|
|
241
234
|
border-radius: 3px !important;
|
|
@@ -243,13 +236,13 @@ const MainButtonContainerSingle = styled__default["default"].div.attrs(defaultTh
|
|
|
243
236
|
`};
|
|
244
237
|
|
|
245
238
|
button {
|
|
246
|
-
${props => (props.activeDropdown || props.dropdownItems) &&
|
|
239
|
+
${props => (props.activeDropdown || props.dropdownItems) && css`
|
|
247
240
|
border-bottom-right-radius: 0;
|
|
248
241
|
border-top-right-radius: 0;
|
|
249
242
|
`};
|
|
250
243
|
}
|
|
251
244
|
`;
|
|
252
|
-
const DropdownButtonContainer =
|
|
245
|
+
const DropdownButtonContainer = styled.div.attrs(applyDefaultTheme)`
|
|
253
246
|
display: inline-block;
|
|
254
247
|
|
|
255
248
|
button {
|
|
@@ -268,7 +261,7 @@ const DropdownButtonContainer = styled__default["default"].div.attrs(defaultThem
|
|
|
268
261
|
}
|
|
269
262
|
`;
|
|
270
263
|
|
|
271
|
-
const Button = React__default
|
|
264
|
+
const Button = React__default.forwardRef(function Button({
|
|
272
265
|
onClickEffect,
|
|
273
266
|
singleAction = false,
|
|
274
267
|
activeDropdown = false,
|
|
@@ -287,10 +280,10 @@ const Button = React__default["default"].forwardRef(function Button({
|
|
|
287
280
|
border = 2,
|
|
288
281
|
...props
|
|
289
282
|
}, forwardedRef) {
|
|
290
|
-
const [loadingState, setLoadingState] =
|
|
291
|
-
const [loadingStep, setLoadingStep] =
|
|
292
|
-
const loadingInterval =
|
|
293
|
-
const [dropdownIsActive, setDropdownIsActive] =
|
|
283
|
+
const [loadingState, setLoadingState] = useState(loading || false);
|
|
284
|
+
const [loadingStep, setLoadingStep] = useState(113);
|
|
285
|
+
const loadingInterval = useRef(0);
|
|
286
|
+
const [dropdownIsActive, setDropdownIsActive] = useState(false);
|
|
294
287
|
const enableLoading = () => {
|
|
295
288
|
loadingInterval.current = setInterval(() => {
|
|
296
289
|
setLoadingStep(currentLoadingStep => {
|
|
@@ -311,7 +304,7 @@ const Button = React__default["default"].forwardRef(function Button({
|
|
|
311
304
|
setLoadingStep(113);
|
|
312
305
|
}, 500);
|
|
313
306
|
};
|
|
314
|
-
|
|
307
|
+
useEffect(() => {
|
|
315
308
|
if (loading) {
|
|
316
309
|
enableLoading();
|
|
317
310
|
} else {
|
|
@@ -325,18 +318,18 @@ const Button = React__default["default"].forwardRef(function Button({
|
|
|
325
318
|
const handleDropdownClose = () => {
|
|
326
319
|
setDropdownIsActive(false);
|
|
327
320
|
};
|
|
328
|
-
return React__default
|
|
321
|
+
return React__default.createElement(ButtonWrapper, null, !singleAction ? React__default.createElement(MainButtonWrapper, {
|
|
329
322
|
activeDropdown: activeDropdown,
|
|
330
323
|
dropdownItems: dropdownItems,
|
|
331
324
|
outlined: outlined,
|
|
332
325
|
secondary: secondary,
|
|
333
326
|
block: block
|
|
334
|
-
}, React__default
|
|
327
|
+
}, React__default.createElement(MainButtonContainer, {
|
|
335
328
|
dropdownItems: dropdownItems,
|
|
336
329
|
secondary: secondary,
|
|
337
330
|
outlined: outlined,
|
|
338
331
|
block: block
|
|
339
|
-
}, React__default
|
|
332
|
+
}, React__default.createElement(Button$1, _extends({
|
|
340
333
|
ref: forwardedRef,
|
|
341
334
|
onClick: onClickEffect,
|
|
342
335
|
border: border,
|
|
@@ -350,17 +343,17 @@ const Button = React__default["default"].forwardRef(function Button({
|
|
|
350
343
|
className: className,
|
|
351
344
|
"aria-busy": disabled,
|
|
352
345
|
width: width
|
|
353
|
-
}, props), React__default
|
|
346
|
+
}, props), React__default.createElement(ButtonContent, {
|
|
354
347
|
$loading: loadingState,
|
|
355
348
|
size: size
|
|
356
|
-
}, icon, children), React__default
|
|
349
|
+
}, icon, children), React__default.createElement(LoadingIndicator, {
|
|
357
350
|
$loading: loadingState,
|
|
358
351
|
style: {
|
|
359
352
|
opacity: loadingState ? 1 : 0
|
|
360
353
|
}
|
|
361
|
-
}, React__default
|
|
354
|
+
}, React__default.createElement(LoadingIndicatorSvg, {
|
|
362
355
|
viewBox: "22 22 44 44"
|
|
363
|
-
}, React__default
|
|
356
|
+
}, React__default.createElement(LoadingIndicatorSvgCircle, {
|
|
364
357
|
cx: "44",
|
|
365
358
|
cy: "44",
|
|
366
359
|
r: "18",
|
|
@@ -370,17 +363,17 @@ const Button = React__default["default"].forwardRef(function Button({
|
|
|
370
363
|
style: {
|
|
371
364
|
strokeDashoffset: `${loadingStep}px`
|
|
372
365
|
}
|
|
373
|
-
}))))), (activeDropdown || dropdownItems) && React__default
|
|
366
|
+
}))))), (activeDropdown || dropdownItems) && React__default.createElement(DropdownButtonContainer, {
|
|
374
367
|
dropdownItems: dropdownItems,
|
|
375
368
|
secondary: secondary,
|
|
376
369
|
outlined: outlined
|
|
377
|
-
}, React__default
|
|
378
|
-
content: React__default
|
|
370
|
+
}, React__default.createElement(Popover, {
|
|
371
|
+
content: React__default.createElement(ContextMenu, null, dropdownItems),
|
|
379
372
|
placement: 'bottom-end',
|
|
380
373
|
arrow: false,
|
|
381
374
|
contextMenu: true,
|
|
382
375
|
onHide: handleDropdownClose
|
|
383
|
-
}, React__default
|
|
376
|
+
}, React__default.createElement(Button$1, {
|
|
384
377
|
ref: forwardedRef,
|
|
385
378
|
singleAction: singleAction,
|
|
386
379
|
singleActionGap: singleActionGap,
|
|
@@ -394,20 +387,20 @@ const Button = React__default["default"].forwardRef(function Button({
|
|
|
394
387
|
onClick: handleDropdownButtonClick,
|
|
395
388
|
className: dropdownIsActive ? 'dropdown-is-active' : '',
|
|
396
389
|
width: width
|
|
397
|
-
}, React__default
|
|
390
|
+
}, React__default.createElement(SvgExpandMore, null))))) : React__default.createElement(React__default.Fragment, null, React__default.createElement(MainButtonContainerSingle, {
|
|
398
391
|
dropdownItems: dropdownItems,
|
|
399
392
|
secondary: secondary,
|
|
400
393
|
outlined: outlined,
|
|
401
394
|
className: className
|
|
402
|
-
}, React__default
|
|
395
|
+
}, React__default.createElement(DropdownButtonContainer, {
|
|
403
396
|
singleAction: singleAction
|
|
404
|
-
}, React__default
|
|
405
|
-
content: React__default
|
|
397
|
+
}, React__default.createElement(Popover, {
|
|
398
|
+
content: React__default.createElement(ContextMenu, null, dropdownItems),
|
|
406
399
|
placement: 'bottom-end',
|
|
407
400
|
arrow: false,
|
|
408
401
|
contextMenu: true,
|
|
409
402
|
onHide: handleDropdownClose
|
|
410
|
-
}, React__default
|
|
403
|
+
}, React__default.createElement(Button$1, {
|
|
411
404
|
ref: forwardedRef,
|
|
412
405
|
singleAction: singleAction,
|
|
413
406
|
singleActionGap: singleActionGap,
|
|
@@ -421,29 +414,29 @@ const Button = React__default["default"].forwardRef(function Button({
|
|
|
421
414
|
onClick: handleDropdownButtonClick,
|
|
422
415
|
className: dropdownIsActive ? 'dropdown-is-active' : '',
|
|
423
416
|
width: width
|
|
424
|
-
}, React__default
|
|
417
|
+
}, React__default.createElement(ButtonContent, {
|
|
425
418
|
$loading: loadingState,
|
|
426
419
|
size: size,
|
|
427
420
|
singleAction: singleAction
|
|
428
|
-
}, icon, children), React__default
|
|
421
|
+
}, icon, children), React__default.createElement(SvgExpandMore, null)))))));
|
|
429
422
|
});
|
|
430
423
|
Button.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
431
|
-
onClickEffect:
|
|
432
|
-
singleAction:
|
|
433
|
-
activeDropdown:
|
|
434
|
-
dropdownItems:
|
|
435
|
-
secondary:
|
|
436
|
-
outlined:
|
|
437
|
-
border:
|
|
438
|
-
block:
|
|
439
|
-
icon:
|
|
440
|
-
size:
|
|
441
|
-
disabled:
|
|
442
|
-
loading:
|
|
443
|
-
className:
|
|
444
|
-
children:
|
|
445
|
-
singleActionGap:
|
|
446
|
-
width:
|
|
424
|
+
onClickEffect: PropTypes.func,
|
|
425
|
+
singleAction: PropTypes.bool,
|
|
426
|
+
activeDropdown: PropTypes.bool,
|
|
427
|
+
dropdownItems: PropTypes.node,
|
|
428
|
+
secondary: PropTypes.bool,
|
|
429
|
+
outlined: PropTypes.bool,
|
|
430
|
+
border: PropTypes.number,
|
|
431
|
+
block: PropTypes.bool,
|
|
432
|
+
icon: PropTypes.element,
|
|
433
|
+
size: PropTypes.oneOf(['x-small', 'small', 'normal', 'large']),
|
|
434
|
+
disabled: PropTypes.bool,
|
|
435
|
+
loading: PropTypes.bool,
|
|
436
|
+
className: PropTypes.string,
|
|
437
|
+
children: PropTypes.any.isRequired,
|
|
438
|
+
singleActionGap: PropTypes.number,
|
|
439
|
+
width: PropTypes.number
|
|
447
440
|
} : {};
|
|
448
441
|
|
|
449
|
-
|
|
442
|
+
export { Button as B };
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var lodash = require('lodash');
|
|
7
|
-
var styled = require('styled-components');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
1
|
+
import React__default, { useState, useMemo } from 'react';
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import { a as applyDefaultTheme, P as PropTypes } from './defaultTheme-1bcc2541.js';
|
|
4
|
+
import { isBoolean, isEmpty } from 'lodash';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
13
6
|
|
|
14
7
|
const checkboxSize = '18px';
|
|
15
|
-
const Checkbox$1 =
|
|
8
|
+
const Checkbox$1 = styled.div.attrs(applyDefaultTheme)`
|
|
16
9
|
display: flex;
|
|
17
10
|
flex-direction: column;
|
|
18
11
|
`;
|
|
19
|
-
const CheckIcon =
|
|
12
|
+
const CheckIcon = styled.div.attrs(applyDefaultTheme)`
|
|
20
13
|
opacity: 0;
|
|
21
14
|
transform: scale(0.1);
|
|
22
15
|
transition: all 200ms;
|
|
@@ -31,7 +24,7 @@ const CheckIcon = styled__default["default"].div.attrs(defaultTheme.applyDefault
|
|
|
31
24
|
display: block;
|
|
32
25
|
}
|
|
33
26
|
`;
|
|
34
|
-
const IndeterminateCheckIcon =
|
|
27
|
+
const IndeterminateCheckIcon = styled.div.attrs(applyDefaultTheme)`
|
|
35
28
|
opacity: 0;
|
|
36
29
|
transform: scale(0.1);
|
|
37
30
|
transition: all 200ms;
|
|
@@ -42,7 +35,7 @@ const IndeterminateCheckIcon = styled__default["default"].div.attrs(defaultTheme
|
|
|
42
35
|
background: ${props => props.theme.getColor('gray-100')};
|
|
43
36
|
width: 10px;
|
|
44
37
|
`;
|
|
45
|
-
const CheckboxLabel =
|
|
38
|
+
const CheckboxLabel = styled.label.attrs(applyDefaultTheme)`
|
|
46
39
|
display: inline-flex;
|
|
47
40
|
position: relative;
|
|
48
41
|
cursor: pointer;
|
|
@@ -69,7 +62,7 @@ const CheckboxLabel = styled__default["default"].label.attrs(defaultTheme.applyD
|
|
|
69
62
|
width: ${checkboxSize};
|
|
70
63
|
height: ${checkboxSize};
|
|
71
64
|
box-sizing: border-box;
|
|
72
|
-
${props => props.muted &&
|
|
65
|
+
${props => props.muted && css`
|
|
73
66
|
opacity: 0.75;
|
|
74
67
|
`}
|
|
75
68
|
}
|
|
@@ -95,19 +88,19 @@ const CheckboxLabel = styled__default["default"].label.attrs(defaultTheme.applyD
|
|
|
95
88
|
}
|
|
96
89
|
}
|
|
97
90
|
|
|
98
|
-
${props => props.readOnly &&
|
|
91
|
+
${props => props.readOnly && css`
|
|
99
92
|
opacity: 0.5;
|
|
100
93
|
cursor: default;
|
|
101
94
|
pointer-events: none;
|
|
102
95
|
user-select: text;
|
|
103
96
|
`}
|
|
104
97
|
|
|
105
|
-
${props => props.disabled &&
|
|
98
|
+
${props => props.disabled && css`
|
|
106
99
|
opacity: 0.5;
|
|
107
100
|
cursor: not-allowed;
|
|
108
101
|
`}
|
|
109
102
|
`;
|
|
110
|
-
const CheckboxVisualLabel =
|
|
103
|
+
const CheckboxVisualLabel = styled.div.attrs(applyDefaultTheme)`
|
|
111
104
|
padding-left: 10px;
|
|
112
105
|
font-weight: 400;
|
|
113
106
|
font-size: 0.875rem;
|
|
@@ -115,20 +108,20 @@ const CheckboxVisualLabel = styled__default["default"].div.attrs(defaultTheme.ap
|
|
|
115
108
|
|
|
116
109
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'))};
|
|
117
110
|
`;
|
|
118
|
-
const Description =
|
|
111
|
+
const Description = styled.p.attrs(applyDefaultTheme)`
|
|
119
112
|
margin: 0.375rem 0 0 0;
|
|
120
113
|
font-size: 0.75rem;
|
|
121
114
|
line-height: 1.333;
|
|
122
115
|
|
|
123
116
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
|
|
124
117
|
|
|
125
|
-
${props => props.error &&
|
|
118
|
+
${props => props.error && css`
|
|
126
119
|
content: 'error';
|
|
127
120
|
${props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'))}
|
|
128
121
|
`}
|
|
129
122
|
`;
|
|
130
123
|
|
|
131
|
-
const Checkbox = React__default
|
|
124
|
+
const Checkbox = React__default.forwardRef(function Checkbox({
|
|
132
125
|
checked,
|
|
133
126
|
defaultChecked,
|
|
134
127
|
disabled,
|
|
@@ -145,33 +138,33 @@ const Checkbox = React__default["default"].forwardRef(function Checkbox({
|
|
|
145
138
|
className,
|
|
146
139
|
style
|
|
147
140
|
}, forwardedRef) {
|
|
148
|
-
const [uniqueId] =
|
|
149
|
-
const hasError =
|
|
150
|
-
if (
|
|
141
|
+
const [uniqueId] = useState(nanoid());
|
|
142
|
+
const hasError = useMemo(() => {
|
|
143
|
+
if (isBoolean(error)) {
|
|
151
144
|
return error;
|
|
152
145
|
}
|
|
153
|
-
return !
|
|
146
|
+
return !isEmpty(error);
|
|
154
147
|
}, [error]);
|
|
155
|
-
const descriptionText =
|
|
156
|
-
if (!
|
|
148
|
+
const descriptionText = useMemo(() => {
|
|
149
|
+
if (!isEmpty(error)) {
|
|
157
150
|
return error;
|
|
158
151
|
}
|
|
159
|
-
if (!
|
|
152
|
+
if (!isEmpty(description)) {
|
|
160
153
|
return description;
|
|
161
154
|
}
|
|
162
155
|
return null;
|
|
163
156
|
}, [description, error]);
|
|
164
|
-
return React__default
|
|
157
|
+
return React__default.createElement(Checkbox$1, {
|
|
165
158
|
className: className,
|
|
166
159
|
disabled: disabled,
|
|
167
160
|
readOnly: readOnly,
|
|
168
161
|
style: style
|
|
169
|
-
}, React__default
|
|
162
|
+
}, React__default.createElement(CheckboxLabel, {
|
|
170
163
|
disabled: disabled,
|
|
171
164
|
muted: muted,
|
|
172
165
|
readOnly: readOnly,
|
|
173
166
|
htmlFor: uniqueId
|
|
174
|
-
}, React__default
|
|
167
|
+
}, React__default.createElement("input", {
|
|
175
168
|
ref: forwardedRef,
|
|
176
169
|
id: uniqueId,
|
|
177
170
|
checked: checked,
|
|
@@ -184,32 +177,32 @@ const Checkbox = React__default["default"].forwardRef(function Checkbox({
|
|
|
184
177
|
onChange: onChange,
|
|
185
178
|
onBlur: onBlur,
|
|
186
179
|
"data-indeterminate": indeterminate
|
|
187
|
-
}), React__default
|
|
180
|
+
}), React__default.createElement(IndeterminateCheckIcon, null), React__default.createElement(CheckIcon, null, React__default.createElement("svg", {
|
|
188
181
|
xmlns: "http://www.w3.org/2000/svg",
|
|
189
182
|
viewBox: "0 0 10.9 8.45"
|
|
190
|
-
}, React__default
|
|
183
|
+
}, React__default.createElement("path", {
|
|
191
184
|
d: "m3.68,8.45L0,4.75l1.21-1.21,2.47,2.45L9.7,0l1.21,1.23-7.22,7.22Z",
|
|
192
185
|
fill: "currentColor"
|
|
193
|
-
}))), (typeof label === 'string' && label.length > 0 || typeof label === 'object') && React__default
|
|
186
|
+
}))), (typeof label === 'string' && label.length > 0 || typeof label === 'object') && React__default.createElement(CheckboxVisualLabel, null, label)), typeof descriptionText === 'string' && descriptionText.length > 0 && React__default.createElement(Description, {
|
|
194
187
|
error: hasError
|
|
195
188
|
}, descriptionText));
|
|
196
189
|
});
|
|
197
190
|
Checkbox.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
198
|
-
checked:
|
|
199
|
-
defaultChecked:
|
|
200
|
-
label:
|
|
201
|
-
disabled:
|
|
202
|
-
readOnly:
|
|
203
|
-
name:
|
|
204
|
-
value:
|
|
205
|
-
description:
|
|
206
|
-
error:
|
|
207
|
-
indeterminate:
|
|
208
|
-
muted:
|
|
209
|
-
onChange:
|
|
210
|
-
onBlur:
|
|
211
|
-
className:
|
|
212
|
-
style:
|
|
191
|
+
checked: PropTypes.bool,
|
|
192
|
+
defaultChecked: PropTypes.bool,
|
|
193
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
194
|
+
disabled: PropTypes.bool,
|
|
195
|
+
readOnly: PropTypes.bool,
|
|
196
|
+
name: PropTypes.string,
|
|
197
|
+
value: PropTypes.string,
|
|
198
|
+
description: PropTypes.string,
|
|
199
|
+
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
200
|
+
indeterminate: PropTypes.bool,
|
|
201
|
+
muted: PropTypes.bool,
|
|
202
|
+
onChange: PropTypes.func,
|
|
203
|
+
onBlur: PropTypes.func,
|
|
204
|
+
className: PropTypes.string,
|
|
205
|
+
style: PropTypes.object
|
|
213
206
|
} : {};
|
|
214
207
|
Checkbox.defaultProps = {
|
|
215
208
|
disabled: false,
|
|
@@ -217,4 +210,4 @@ Checkbox.defaultProps = {
|
|
|
217
210
|
indeterminate: false
|
|
218
211
|
};
|
|
219
212
|
|
|
220
|
-
|
|
213
|
+
export { Checkbox as C };
|