@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,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 };
|