@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-c245b26a.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { a as applyDefaultTheme, P as PropTypes } from './defaultTheme-1bcc2541.js';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
|
|
6
|
+
const SectionSeparator$1 = styled.div.attrs(applyDefaultTheme)`
|
|
7
|
+
height: ${props => props.vertical ? '100%' : '1px'};
|
|
8
|
+
width: ${props => props.vertical ? '1px' : '100%'};
|
|
9
|
+
|
|
10
|
+
${props => props.vertical ? `margin-left: ${props.margin}px; margin-right: ${props.margin}px;` : `margin-top: ${props.margin}px; margin-bottom: ${props.margin}px;`}
|
|
11
|
+
|
|
12
|
+
${props => props.theme.themeProp('background-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-200'))}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const SectionSeparator = React__default.forwardRef(function SectionSeparator({
|
|
16
|
+
vertical = false,
|
|
17
|
+
margin = 0,
|
|
18
|
+
...props
|
|
19
|
+
}, forwardedRef) {
|
|
20
|
+
return React__default.createElement(SectionSeparator$1, _extends({
|
|
21
|
+
vertical: vertical,
|
|
22
|
+
margin: margin,
|
|
23
|
+
ref: forwardedRef
|
|
24
|
+
}, props));
|
|
25
|
+
});
|
|
26
|
+
SectionSeparator.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
27
|
+
vertical: PropTypes.bool,
|
|
28
|
+
margin: PropTypes.number
|
|
29
|
+
} : {};
|
|
30
|
+
|
|
31
|
+
export { SectionSeparator as S };
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var polished = require('polished');
|
|
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 } from 'react';
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import { a as applyDefaultTheme, P as PropTypes } from './defaultTheme-1bcc2541.js';
|
|
4
|
+
import { math, rgba } from 'polished';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
13
6
|
|
|
14
7
|
const switchButtonSize = '16px';
|
|
15
|
-
const Switch$1 =
|
|
8
|
+
const Switch$1 = styled.div.attrs(applyDefaultTheme)`
|
|
16
9
|
* {
|
|
17
10
|
box-sizing: border-box;
|
|
18
11
|
}
|
|
@@ -20,7 +13,7 @@ const Switch$1 = styled__default["default"].div.attrs(defaultTheme.applyDefaultT
|
|
|
20
13
|
display: flex;
|
|
21
14
|
flex-direction: column;
|
|
22
15
|
|
|
23
|
-
${props => props.readOnly &&
|
|
16
|
+
${props => props.readOnly && css`
|
|
24
17
|
opacity: 0.5;
|
|
25
18
|
> * {
|
|
26
19
|
pointer-events: none;
|
|
@@ -28,7 +21,7 @@ const Switch$1 = styled__default["default"].div.attrs(defaultTheme.applyDefaultT
|
|
|
28
21
|
}
|
|
29
22
|
`}
|
|
30
23
|
|
|
31
|
-
${props => props.disabled &&
|
|
24
|
+
${props => props.disabled && css`
|
|
32
25
|
opacity: 0.5;
|
|
33
26
|
cursor: not-allowed;
|
|
34
27
|
* {
|
|
@@ -37,18 +30,18 @@ const Switch$1 = styled__default["default"].div.attrs(defaultTheme.applyDefaultT
|
|
|
37
30
|
}
|
|
38
31
|
`}
|
|
39
32
|
`;
|
|
40
|
-
const SwitchIndicator =
|
|
33
|
+
const SwitchIndicator = styled.div.attrs(applyDefaultTheme)`
|
|
41
34
|
display: inline-block;
|
|
42
35
|
position: relative;
|
|
43
36
|
${props => props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('gray-200'))}
|
|
44
|
-
height: ${
|
|
37
|
+
height: ${math(`${switchButtonSize} + 2px`)};
|
|
45
38
|
width: 32px;
|
|
46
39
|
border-radius: 20px;
|
|
47
40
|
border: 1px solid;
|
|
48
41
|
${props => props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-300'))}
|
|
49
42
|
transition: background 200ms;
|
|
50
43
|
`;
|
|
51
|
-
const SwitchIndicatorButton =
|
|
44
|
+
const SwitchIndicatorButton = styled.div.attrs(applyDefaultTheme)`
|
|
52
45
|
position: absolute;
|
|
53
46
|
${props => props.theme.themeProp('background', props.theme.getColor('gray-200'), props.theme.getColor('white'))}
|
|
54
47
|
height: ${switchButtonSize};
|
|
@@ -57,7 +50,7 @@ const SwitchIndicatorButton = styled__default["default"].div.attrs(defaultTheme.
|
|
|
57
50
|
box-shadow: ${props => props.theme.getColor('gray-500')} 0 0px 2px 0px;
|
|
58
51
|
transition: left 200ms;
|
|
59
52
|
`;
|
|
60
|
-
const SwitchIndicatorLabelText =
|
|
53
|
+
const SwitchIndicatorLabelText = styled.div.attrs(applyDefaultTheme)`
|
|
61
54
|
padding-left: 10px;
|
|
62
55
|
font-weight: 400;
|
|
63
56
|
font-size: 0.875rem;
|
|
@@ -65,7 +58,7 @@ const SwitchIndicatorLabelText = styled__default["default"].div.attrs(defaultThe
|
|
|
65
58
|
|
|
66
59
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'))};
|
|
67
60
|
`;
|
|
68
|
-
const SwitchLabel =
|
|
61
|
+
const SwitchLabel = styled.label.attrs(applyDefaultTheme)`
|
|
69
62
|
display: inline-flex;
|
|
70
63
|
margin-right: auto;
|
|
71
64
|
cursor: pointer;
|
|
@@ -95,11 +88,11 @@ const SwitchLabel = styled__default["default"].label.attrs(defaultTheme.applyDef
|
|
|
95
88
|
|
|
96
89
|
&:has(input[type='checkbox']:focus-visible) {
|
|
97
90
|
${SwitchIndicatorButton} {
|
|
98
|
-
${props => props.theme.themeProp('outline', `8px solid ${
|
|
91
|
+
${props => props.theme.themeProp('outline', `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.5)}`, `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.3)}`, 1)}
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
94
|
`;
|
|
102
|
-
const Description =
|
|
95
|
+
const Description = styled.div.attrs(applyDefaultTheme)`
|
|
103
96
|
margin: ${props => props.spaciousDescription ? '16px' : '6px'} 0 0 0;
|
|
104
97
|
font-size: 0.75rem;
|
|
105
98
|
line-height: 1.333;
|
|
@@ -107,7 +100,7 @@ const Description = styled__default["default"].div.attrs(defaultTheme.applyDefau
|
|
|
107
100
|
${props => props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
|
|
108
101
|
`;
|
|
109
102
|
|
|
110
|
-
const Switch = React__default
|
|
103
|
+
const Switch = React__default.forwardRef(function Switch({
|
|
111
104
|
name,
|
|
112
105
|
checked,
|
|
113
106
|
defaultChecked,
|
|
@@ -121,15 +114,15 @@ const Switch = React__default["default"].forwardRef(function Switch({
|
|
|
121
114
|
onChange,
|
|
122
115
|
onBlur
|
|
123
116
|
}, forwardedRef) {
|
|
124
|
-
const [uniqueId] =
|
|
125
|
-
return React__default
|
|
117
|
+
const [uniqueId] = useState(nanoid());
|
|
118
|
+
return React__default.createElement(Switch$1, {
|
|
126
119
|
disabled: disabled,
|
|
127
120
|
readOnly: readOnly,
|
|
128
121
|
className: className,
|
|
129
122
|
style: style
|
|
130
|
-
}, React__default
|
|
123
|
+
}, React__default.createElement(SwitchLabel, {
|
|
131
124
|
htmlFor: uniqueId
|
|
132
|
-
}, React__default
|
|
125
|
+
}, React__default.createElement("input", {
|
|
133
126
|
ref: forwardedRef,
|
|
134
127
|
checked: checked,
|
|
135
128
|
defaultChecked: defaultChecked,
|
|
@@ -140,28 +133,28 @@ const Switch = React__default["default"].forwardRef(function Switch({
|
|
|
140
133
|
type: "checkbox",
|
|
141
134
|
onBlur: onBlur,
|
|
142
135
|
onChange: onChange
|
|
143
|
-
}), React__default
|
|
136
|
+
}), React__default.createElement(SwitchIndicator, null, React__default.createElement(SwitchIndicatorButton, null)), typeof label === 'string' && label.length > 0 && React__default.createElement(SwitchIndicatorLabelText, null, label)), typeof description === 'string' && description.length > 0 && React__default.createElement(Description, {
|
|
144
137
|
spaciousDescription: spaciousDescription
|
|
145
138
|
}, description));
|
|
146
139
|
});
|
|
147
140
|
Switch.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
148
|
-
children:
|
|
149
|
-
name:
|
|
150
|
-
checked:
|
|
151
|
-
defaultChecked:
|
|
152
|
-
label:
|
|
153
|
-
disabled:
|
|
154
|
-
readOnly:
|
|
155
|
-
description:
|
|
156
|
-
spaciousDescription:
|
|
157
|
-
className:
|
|
158
|
-
style:
|
|
159
|
-
onChange:
|
|
160
|
-
onBlur:
|
|
141
|
+
children: PropTypes.any,
|
|
142
|
+
name: PropTypes.string.isRequired,
|
|
143
|
+
checked: PropTypes.bool,
|
|
144
|
+
defaultChecked: PropTypes.bool,
|
|
145
|
+
label: PropTypes.string,
|
|
146
|
+
disabled: PropTypes.bool,
|
|
147
|
+
readOnly: PropTypes.bool,
|
|
148
|
+
description: PropTypes.string,
|
|
149
|
+
spaciousDescription: PropTypes.bool,
|
|
150
|
+
className: PropTypes.string,
|
|
151
|
+
style: PropTypes.object,
|
|
152
|
+
onChange: PropTypes.func,
|
|
153
|
+
onBlur: PropTypes.func
|
|
161
154
|
} : {};
|
|
162
155
|
Switch.defaultProps = {
|
|
163
156
|
disabled: false,
|
|
164
157
|
readOnly: false
|
|
165
158
|
};
|
|
166
159
|
|
|
167
|
-
|
|
160
|
+
export { Switch as S };
|
|
@@ -0,0 +1,32 @@
|
|
|
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 from 'styled-components';
|
|
5
|
+
|
|
6
|
+
const Tab$1 = styled.p.attrs(applyDefaultTheme)`
|
|
7
|
+
font-family: ${props => props.theme.primaryFontFamily};
|
|
8
|
+
font-size: 1rem;
|
|
9
|
+
font-weight: 500;
|
|
10
|
+
border-bottom: 1px solid;
|
|
11
|
+
min-height: 35px;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
const Tab = React__default.forwardRef(function Tab({
|
|
15
|
+
children,
|
|
16
|
+
hidden,
|
|
17
|
+
...props
|
|
18
|
+
}, forwardedRef) {
|
|
19
|
+
if (hidden) return null;
|
|
20
|
+
return React__default.createElement(Tab$1, _extends({
|
|
21
|
+
ref: forwardedRef
|
|
22
|
+
}, props), children);
|
|
23
|
+
});
|
|
24
|
+
Tab.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
25
|
+
children: PropTypes.any,
|
|
26
|
+
hidden: PropTypes.bool
|
|
27
|
+
} : {};
|
|
28
|
+
Tab.defaultProps = {
|
|
29
|
+
hidden: false
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { Tab as T };
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-c245b26a.js';
|
|
2
|
+
import { isEmpty, isNil } from 'lodash';
|
|
3
|
+
import { a as applyDefaultTheme, P as PropTypes } from './defaultTheme-1bcc2541.js';
|
|
4
|
+
import React__default, { useState, useRef, useMemo, Children, Fragment } from 'react';
|
|
5
|
+
import { T as Tab } from './Tab-04d435c3.js';
|
|
6
|
+
import styled, { css } from 'styled-components';
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
var lodash = require('lodash');
|
|
5
|
-
var defaultTheme = require('./defaultTheme-d9a7342e.js');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var Tab = require('./Tab-ccbca1f2.js');
|
|
8
|
-
var styled = require('styled-components');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
14
|
-
|
|
15
|
-
const Tabs$1 = styled__default["default"].div.attrs(defaultTheme.applyDefaultTheme)`
|
|
8
|
+
const Tabs$1 = styled.div.attrs(applyDefaultTheme)`
|
|
16
9
|
display: block;
|
|
17
10
|
position: relative;
|
|
18
|
-
${props => props.backgroundColor &&
|
|
11
|
+
${props => props.backgroundColor && css`
|
|
19
12
|
background-color: ${props.backgroundColor};
|
|
20
13
|
`};
|
|
21
14
|
`;
|
|
22
|
-
const TabHeaders =
|
|
15
|
+
const TabHeaders = styled.ul.attrs(applyDefaultTheme)`
|
|
23
16
|
display: flex;
|
|
24
17
|
overflow-x: auto;
|
|
25
18
|
overflow-y: hidden;
|
|
@@ -27,14 +20,14 @@ const TabHeaders = styled__default["default"].ul.attrs(defaultTheme.applyDefault
|
|
|
27
20
|
gap: 24px;
|
|
28
21
|
|
|
29
22
|
margin: 0;
|
|
30
|
-
${props => !props.customPadding &&
|
|
23
|
+
${props => !props.customPadding && css`
|
|
31
24
|
padding: 0;
|
|
32
25
|
`};
|
|
33
|
-
${props => props.customPadding &&
|
|
26
|
+
${props => props.customPadding && css`
|
|
34
27
|
padding: 0 ${props.customPadding};
|
|
35
28
|
`};
|
|
36
29
|
`;
|
|
37
|
-
const TabHeader =
|
|
30
|
+
const TabHeader = styled.li.attrs(applyDefaultTheme)`
|
|
38
31
|
font-family: ${props => props.theme.secondaryFontFamily};
|
|
39
32
|
text-transform: uppercase;
|
|
40
33
|
font-weight: 600;
|
|
@@ -47,7 +40,7 @@ const TabHeader = styled__default["default"].li.attrs(defaultTheme.applyDefaultT
|
|
|
47
40
|
border-color: transparent;
|
|
48
41
|
margin-bottom: 1px;
|
|
49
42
|
|
|
50
|
-
${props => props.active &&
|
|
43
|
+
${props => props.active && css`
|
|
51
44
|
${props => props.theme.themeProp('border-color', props.theme.getColor('gray-400'), props.theme.getColor('gray-700'))}
|
|
52
45
|
`};
|
|
53
46
|
&&:hover:not(:focus) {
|
|
@@ -66,44 +59,44 @@ const TabHeader = styled__default["default"].li.attrs(defaultTheme.applyDefaultT
|
|
|
66
59
|
})};
|
|
67
60
|
}
|
|
68
61
|
`;
|
|
69
|
-
const TabContent =
|
|
62
|
+
const TabContent = styled.div.attrs(applyDefaultTheme)`
|
|
70
63
|
display: block;
|
|
71
64
|
`;
|
|
72
|
-
const TabHeaderBorder =
|
|
65
|
+
const TabHeaderBorder = styled.div.attrs(applyDefaultTheme)`
|
|
73
66
|
border-top: 1px solid;
|
|
74
67
|
|
|
75
68
|
${props => props.theme.themeProp('border-color', props.theme.getColor('gray-600'), '#F0F2F5')};
|
|
76
|
-
${props => !props.customPadding &&
|
|
69
|
+
${props => !props.customPadding && css`
|
|
77
70
|
margin: -2px 0;
|
|
78
71
|
`};
|
|
79
|
-
${props => props.customPadding &&
|
|
72
|
+
${props => props.customPadding && css`
|
|
80
73
|
margin: -2px ${props.customPadding};
|
|
81
74
|
`};
|
|
82
75
|
`;
|
|
83
76
|
|
|
84
|
-
const Tabs = React__default
|
|
77
|
+
const Tabs = React__default.forwardRef(function Tabs({
|
|
85
78
|
children,
|
|
86
79
|
defaultMinHeight = '',
|
|
87
80
|
customPadding = 0,
|
|
88
81
|
onTabClick = () => {},
|
|
89
82
|
...props
|
|
90
83
|
}, forwardedRef) {
|
|
91
|
-
const [activeTab, setActiveTab] =
|
|
92
|
-
const contentRef =
|
|
93
|
-
const tabs =
|
|
84
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
85
|
+
const contentRef = useRef(null);
|
|
86
|
+
const tabs = useMemo(() => {
|
|
94
87
|
const tabs = [];
|
|
95
88
|
function extractChildren(children) {
|
|
96
|
-
|
|
97
|
-
if (
|
|
89
|
+
Children.forEach(children, (child, index) => {
|
|
90
|
+
if (isNil(child)) {
|
|
98
91
|
return null;
|
|
99
92
|
}
|
|
100
|
-
if (child.type ===
|
|
93
|
+
if (child.type === Fragment) {
|
|
101
94
|
extractChildren(child.props?.children);
|
|
102
95
|
}
|
|
103
96
|
if (child.props?.hidden) {
|
|
104
97
|
return null;
|
|
105
98
|
}
|
|
106
|
-
if (child.type === Tab
|
|
99
|
+
if (child.type === Tab) {
|
|
107
100
|
tabs.push({
|
|
108
101
|
key: index,
|
|
109
102
|
trigger: child.props?.trigger,
|
|
@@ -131,36 +124,36 @@ const Tabs = React__default["default"].forwardRef(function Tabs({
|
|
|
131
124
|
});
|
|
132
125
|
}
|
|
133
126
|
};
|
|
134
|
-
return React__default
|
|
127
|
+
return React__default.createElement(Tabs$1, _extends({
|
|
135
128
|
ref: forwardedRef
|
|
136
129
|
}, props, {
|
|
137
130
|
role: "tablist"
|
|
138
|
-
}), React__default
|
|
131
|
+
}), React__default.createElement(TabHeaders, {
|
|
139
132
|
customPadding: customPadding
|
|
140
|
-
}, tabs.map(tab => React__default
|
|
133
|
+
}, tabs.map(tab => React__default.createElement(TabHeader, {
|
|
141
134
|
key: tab.key,
|
|
142
135
|
hidden: tab.hidden,
|
|
143
136
|
active: tab.key === activeTab,
|
|
144
137
|
onClick: () => handleTabClick(tab),
|
|
145
138
|
role: "tab"
|
|
146
|
-
}, tab.trigger))), React__default
|
|
139
|
+
}, tab.trigger))), React__default.createElement(TabHeaderBorder, {
|
|
147
140
|
customPadding: customPadding
|
|
148
|
-
}), React__default
|
|
141
|
+
}), React__default.createElement(TabContent, null, tabs.map(tab => React__default.createElement("div", {
|
|
149
142
|
ref: tab.key === activeTab?.key ? contentRef : null,
|
|
150
143
|
key: tab.key,
|
|
151
144
|
role: "tabpanel",
|
|
152
145
|
hidden: tab.key !== activeTab,
|
|
153
146
|
style: {
|
|
154
|
-
minHeight: !
|
|
147
|
+
minHeight: !isEmpty(defaultMinHeight) ? defaultMinHeight : ''
|
|
155
148
|
}
|
|
156
149
|
}, tab.content))));
|
|
157
150
|
});
|
|
158
151
|
Tabs.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
159
|
-
children:
|
|
160
|
-
backgroundColor:
|
|
161
|
-
defaultMinHeight:
|
|
162
|
-
customPadding:
|
|
163
|
-
onTabClick:
|
|
152
|
+
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
153
|
+
backgroundColor: PropTypes.string,
|
|
154
|
+
defaultMinHeight: PropTypes.string,
|
|
155
|
+
customPadding: PropTypes.string,
|
|
156
|
+
onTabClick: PropTypes.func
|
|
164
157
|
} : {};
|
|
165
158
|
|
|
166
|
-
|
|
159
|
+
export { Tabs as T };
|