@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,16 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-c245b26a.js';
|
|
2
|
+
import { a as applyDefaultTheme, P as PropTypes } from './defaultTheme-1bcc2541.js';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
var defaultTheme = require('./defaultTheme-d9a7342e.js');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var styled = require('styled-components');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
11
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
12
|
-
|
|
13
|
-
const Badge$1 = styled__default["default"].span.attrs(defaultTheme.applyDefaultTheme)`
|
|
6
|
+
const Badge$1 = styled.span.attrs(applyDefaultTheme)`
|
|
14
7
|
align-content: center;
|
|
15
8
|
display: ${props => props.elevated || !props.hasChildren ? 'inline-flex' : 'flex'};
|
|
16
9
|
font-family: ${props => props.theme.primaryFontFamily};
|
|
@@ -20,12 +13,12 @@ const Badge$1 = styled__default["default"].span.attrs(defaultTheme.applyDefaultT
|
|
|
20
13
|
position: relative;
|
|
21
14
|
width: ${props => props.elevated ? 'fit-content' : 'initial'};
|
|
22
15
|
`;
|
|
23
|
-
const BadgeChildrenContainer =
|
|
16
|
+
const BadgeChildrenContainer = styled.span.attrs(applyDefaultTheme)`
|
|
24
17
|
align-self: center;
|
|
25
18
|
height: fit-content;
|
|
26
19
|
margin-right: 8px;
|
|
27
20
|
`;
|
|
28
|
-
const BadgeLabel =
|
|
21
|
+
const BadgeLabel = styled.span.attrs(applyDefaultTheme)`
|
|
29
22
|
border-radius: ${props => props.elevated ? '12px' : '14px'};
|
|
30
23
|
display: flex;
|
|
31
24
|
align-items: center;
|
|
@@ -48,15 +41,15 @@ const BadgeLabel = styled__default["default"].span.attrs(defaultTheme.applyDefau
|
|
|
48
41
|
right: 0;
|
|
49
42
|
transform: ${props => props.elevated ? 'translate(33%, -8px)' : 'initial'};
|
|
50
43
|
|
|
51
|
-
${props => props.width ?
|
|
44
|
+
${props => props.width ? css`
|
|
52
45
|
width: ${props.width}px;
|
|
53
46
|
` : null}
|
|
54
47
|
|
|
55
|
-
${props => props.minWidth ?
|
|
48
|
+
${props => props.minWidth ? css`
|
|
56
49
|
min-width: ${props.minWidth}px;
|
|
57
50
|
` : null}
|
|
58
51
|
|
|
59
|
-
${props => props.minHeight ?
|
|
52
|
+
${props => props.minHeight ? css`
|
|
60
53
|
min-height: ${props.minHeight}px;
|
|
61
54
|
` : null}
|
|
62
55
|
|
|
@@ -64,7 +57,7 @@ const BadgeLabel = styled__default["default"].span.attrs(defaultTheme.applyDefau
|
|
|
64
57
|
${props => {
|
|
65
58
|
const verticalPadding = props.verticalPadding ? `${props.verticalPadding}px` : props.elevated ? '4px' : '6px';
|
|
66
59
|
const horizontalPadding = props.horizontalPadding ? `${props.horizontalPadding}px` : props.elevated ? '7px' : '10px';
|
|
67
|
-
return
|
|
60
|
+
return css`
|
|
68
61
|
padding: ${verticalPadding} ${horizontalPadding};
|
|
69
62
|
`;
|
|
70
63
|
}}
|
|
@@ -129,7 +122,7 @@ const BadgeLabel = styled__default["default"].span.attrs(defaultTheme.applyDefau
|
|
|
129
122
|
}
|
|
130
123
|
})}
|
|
131
124
|
`;
|
|
132
|
-
const BadgeIcon =
|
|
125
|
+
const BadgeIcon = styled.span.attrs(applyDefaultTheme)`
|
|
133
126
|
display: flex;
|
|
134
127
|
align-items: center;
|
|
135
128
|
margin-right: ${props => props.useGutter ? '4px' : 0};
|
|
@@ -138,7 +131,7 @@ const BadgeIcon = styled__default["default"].span.attrs(defaultTheme.applyDefaul
|
|
|
138
131
|
}
|
|
139
132
|
`;
|
|
140
133
|
|
|
141
|
-
const Badge = React__default
|
|
134
|
+
const Badge = React__default.forwardRef(function Badge({
|
|
142
135
|
badgeContent,
|
|
143
136
|
badgeIcon,
|
|
144
137
|
children,
|
|
@@ -164,11 +157,11 @@ const Badge = React__default["default"].forwardRef(function Badge({
|
|
|
164
157
|
notation: 'compact'
|
|
165
158
|
}).format(badgeContent);
|
|
166
159
|
}
|
|
167
|
-
return React__default
|
|
160
|
+
return React__default.createElement(Badge$1, _extends({
|
|
168
161
|
ref: forwardedRef,
|
|
169
162
|
elevated: elevated,
|
|
170
163
|
hasChildren: Boolean(children)
|
|
171
|
-
}, props), children && React__default
|
|
164
|
+
}, props), children && React__default.createElement(BadgeChildrenContainer, null, children), (badgeIcon || badgeContent) && React__default.createElement(BadgeLabel, {
|
|
172
165
|
backgroundColors: backgroundColors,
|
|
173
166
|
colors: colors,
|
|
174
167
|
elevated: elevated,
|
|
@@ -184,29 +177,29 @@ const Badge = React__default["default"].forwardRef(function Badge({
|
|
|
184
177
|
minHeight: minHeight,
|
|
185
178
|
width: width,
|
|
186
179
|
minWidth: minWidth
|
|
187
|
-
}, badgeIcon && React__default
|
|
180
|
+
}, badgeIcon && React__default.createElement(BadgeIcon, {
|
|
188
181
|
useGutter: !!badgeContent
|
|
189
182
|
}, badgeIcon), badgeContent));
|
|
190
183
|
});
|
|
191
184
|
Badge.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
192
|
-
badgeIcon:
|
|
193
|
-
badgeContent:
|
|
194
|
-
children:
|
|
195
|
-
elevated:
|
|
196
|
-
active:
|
|
197
|
-
error:
|
|
198
|
-
warning:
|
|
199
|
-
fontSize:
|
|
200
|
-
fontWeight:
|
|
201
|
-
lineHeight:
|
|
202
|
-
colors:
|
|
203
|
-
backgroundColors:
|
|
204
|
-
verticalPadding:
|
|
205
|
-
horizontalPadding:
|
|
206
|
-
height:
|
|
207
|
-
minHeight:
|
|
208
|
-
width:
|
|
209
|
-
minWidth:
|
|
185
|
+
badgeIcon: PropTypes.node,
|
|
186
|
+
badgeContent: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.func, PropTypes.element]),
|
|
187
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
188
|
+
elevated: PropTypes.bool,
|
|
189
|
+
active: PropTypes.bool,
|
|
190
|
+
error: PropTypes.bool,
|
|
191
|
+
warning: PropTypes.bool,
|
|
192
|
+
fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
193
|
+
fontWeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
194
|
+
lineHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
195
|
+
colors: PropTypes.arrayOf(PropTypes.string),
|
|
196
|
+
backgroundColors: PropTypes.arrayOf(PropTypes.string),
|
|
197
|
+
verticalPadding: PropTypes.number,
|
|
198
|
+
horizontalPadding: PropTypes.number,
|
|
199
|
+
height: PropTypes.number,
|
|
200
|
+
minHeight: PropTypes.number,
|
|
201
|
+
width: PropTypes.number,
|
|
202
|
+
minWidth: PropTypes.number
|
|
210
203
|
} : {};
|
|
211
204
|
Badge.defaultProps = {
|
|
212
205
|
elevated: false,
|
|
@@ -218,4 +211,4 @@ Badge.defaultProps = {
|
|
|
218
211
|
lineHeight: 'normal'
|
|
219
212
|
};
|
|
220
213
|
|
|
221
|
-
|
|
214
|
+
export { Badge as B };
|
|
@@ -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 };
|