@cdc/core 4.22.10 → 4.23.1
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/README.md +1 -1
- package/components/AdvancedEditor.js +52 -67
- package/components/ErrorBoundary.jsx +10 -11
- package/components/GlobalContext.jsx +2 -6
- package/components/LegendCircle.jsx +3 -4
- package/components/Loading.jsx +14 -12
- package/components/Waiting.jsx +14 -5
- package/components/elements/Button.jsx +34 -45
- package/components/elements/Card.jsx +1 -1
- package/components/inputs/InputCheckbox.jsx +32 -35
- package/components/inputs/InputGroup.jsx +38 -17
- package/components/inputs/InputSelect.jsx +27 -23
- package/components/inputs/InputText.jsx +9 -25
- package/components/inputs/InputToggle.jsx +29 -33
- package/components/managers/DataDesigner.jsx +87 -64
- package/components/ui/Accordion.jsx +18 -30
- package/components/ui/Icon.jsx +34 -35
- package/components/ui/LoadSpin.jsx +6 -11
- package/components/ui/Modal.jsx +40 -44
- package/components/ui/Overlay.jsx +12 -23
- package/components/ui/OverlayFrame.jsx +1 -5
- package/components/ui/Tooltip.jsx +8 -28
- package/data/colorPalettes.js +29 -266
- package/data/dataDesignerTables.js +107 -107
- package/data/themes.js +13 -13
- package/helpers/CoveMediaControls.js +139 -0
- package/helpers/DataTransform.js +92 -92
- package/helpers/cacheBustingString.js +3 -3
- package/helpers/events.js +5 -6
- package/helpers/fetchRemoteData.js +33 -33
- package/helpers/getViewport.js +15 -15
- package/helpers/numberFromString.js +7 -7
- package/helpers/updatePaletteNames.js +15 -17
- package/helpers/useDataVizClasses.js +38 -35
- package/helpers/validateFipsCodeLength.js +41 -56
- package/package.json +4 -2
- package/styles/_button-section.scss +35 -0
- package/styles/_data-table.scss +39 -27
- package/styles/_global.scss +29 -24
- package/styles/_mixins.scss +12 -12
- package/styles/_reset.scss +85 -16
- package/styles/_variables.scss +5 -5
- package/styles/base.scss +100 -48
- package/styles/heading-colors.scss +6 -2
- package/styles/loading.scss +62 -60
- package/styles/v2/base/_file-selector.scss +2 -2
- package/styles/v2/base/_general.scss +1 -1
- package/styles/v2/base/_reset.scss +2 -2
- package/styles/v2/base/index.scss +4 -4
- package/styles/v2/components/accordion.scss +13 -13
- package/styles/v2/components/button.scss +3 -3
- package/styles/v2/components/card.scss +1 -1
- package/styles/v2/components/data-designer.scss +7 -6
- package/styles/v2/components/editor.scss +52 -51
- package/styles/v2/components/guidance-block.scss +6 -6
- package/styles/v2/components/input/_input-check-radio.scss +7 -7
- package/styles/v2/components/input/_input-group.scss +2 -2
- package/styles/v2/components/input/_input-slider.scss +2 -3
- package/styles/v2/components/input/index.scss +6 -6
- package/styles/v2/components/loadspin.scss +1 -1
- package/styles/v2/components/modal.scss +2 -2
- package/styles/v2/components/overlay.scss +4 -4
- package/styles/v2/layout/_alert.scss +8 -8
- package/styles/v2/layout/_component.scss +1 -1
- package/styles/v2/layout/_data-table.scss +12 -11
- package/styles/v2/layout/_progression.scss +8 -6
- package/styles/v2/layout/index.scss +5 -5
- package/styles/v2/main.scss +7 -7
- package/styles/v2/themes/_color-definitions.scss +77 -24
- package/styles/v2/themes/index.scss +1 -1
- package/styles/v2/utils/_animations.scss +2 -2
- package/styles/v2/utils/_breakpoints.scss +53 -12
- package/styles/v2/utils/_variables.scss +5 -5
- package/styles/v2/utils/index.scss +8 -8
- package/styles/waiting.scss +22 -23
|
@@ -3,38 +3,23 @@ import { useDebounce } from 'use-debounce'
|
|
|
3
3
|
|
|
4
4
|
import '../../styles/v2/components/input/index.scss'
|
|
5
5
|
|
|
6
|
-
const InputText = memo((
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
section = null,
|
|
10
|
-
subsection = null,
|
|
11
|
-
fieldName,
|
|
12
|
-
updateField,
|
|
13
|
-
value: stateValue,
|
|
14
|
-
type = 'input',
|
|
15
|
-
tooltip,
|
|
16
|
-
placeholder,
|
|
17
|
-
i = null, min = null, max = null,
|
|
18
|
-
className, ...attributes
|
|
19
|
-
}
|
|
20
|
-
) => {
|
|
21
|
-
|
|
22
|
-
const [ value, setValue ] = useState(stateValue)
|
|
23
|
-
const [ debouncedValue ] = useDebounce(value, 500)
|
|
6
|
+
const InputText = memo(({ label, section = null, subsection = null, fieldName, updateField, value: stateValue, type = 'input', tooltip, placeholder, i = null, min = null, max = null, className, ...attributes }) => {
|
|
7
|
+
const [value, setValue] = useState(stateValue)
|
|
8
|
+
const [debouncedValue] = useDebounce(value, 500)
|
|
24
9
|
|
|
25
10
|
useEffect(() => {
|
|
26
11
|
if ('string' === typeof debouncedValue && stateValue !== debouncedValue && updateField) {
|
|
27
12
|
updateField(section, subsection, fieldName, debouncedValue, i)
|
|
28
13
|
}
|
|
29
|
-
}, [
|
|
14
|
+
}, [debouncedValue, section, subsection, fieldName, i, stateValue, updateField])
|
|
30
15
|
|
|
31
16
|
let name = subsection ? `${section}-${subsection}-${fieldName}` : `${section}-${subsection}-${fieldName}`
|
|
32
17
|
|
|
33
|
-
const onChange =
|
|
18
|
+
const onChange = e => {
|
|
34
19
|
if ('number' !== type || min === null) {
|
|
35
20
|
setValue(e.target.value)
|
|
36
21
|
} else {
|
|
37
|
-
if (!e.target.value || (parseFloat(min) <= parseFloat(e.target.value) & parseFloat(max) >= parseFloat(e.target.value))) {
|
|
22
|
+
if (!e.target.value || (parseFloat(min) <= parseFloat(e.target.value)) & (parseFloat(max) >= parseFloat(e.target.value))) {
|
|
38
23
|
setValue(e.target.value)
|
|
39
24
|
} else {
|
|
40
25
|
setValue(min.toString())
|
|
@@ -52,13 +37,12 @@ const InputText = memo((
|
|
|
52
37
|
...attributes
|
|
53
38
|
}
|
|
54
39
|
|
|
55
|
-
let formElement = 'textarea' === type
|
|
56
|
-
? (<textarea {...inputAttrs}/>)
|
|
57
|
-
: (<input {...inputAttrs}/>)
|
|
40
|
+
let formElement = 'textarea' === type ? <textarea {...inputAttrs} /> : <input {...inputAttrs} />
|
|
58
41
|
|
|
59
42
|
return (
|
|
60
43
|
<>
|
|
61
|
-
{label && <label className=
|
|
44
|
+
{label && <label className='cove-input__label'>{label}</label>}
|
|
45
|
+
{tooltip}
|
|
62
46
|
{formElement}
|
|
63
47
|
</>
|
|
64
48
|
)
|
|
@@ -3,41 +3,37 @@ import PropTypes from 'prop-types'
|
|
|
3
3
|
|
|
4
4
|
import '../../styles/v2/components/input/index.scss'
|
|
5
5
|
|
|
6
|
-
const InputSlider = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
value: stateValue,
|
|
6
|
+
const InputSlider = ({
|
|
7
|
+
label,
|
|
8
|
+
sliderType = 'flat',
|
|
9
|
+
size = 'medium',
|
|
10
|
+
activeColor = null,
|
|
11
|
+
section = null,
|
|
12
|
+
subsection = null,
|
|
13
|
+
fieldName,
|
|
14
|
+
updateField,
|
|
15
|
+
value: stateValue,
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const [
|
|
17
|
+
i = null,
|
|
18
|
+
min = null,
|
|
19
|
+
max = null,
|
|
20
|
+
...attributes
|
|
21
|
+
}) => {
|
|
22
|
+
const [value, setValue] = useState(stateValue)
|
|
24
23
|
|
|
25
24
|
let name = () => {
|
|
26
25
|
let str = ''
|
|
27
|
-
if (section)
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
str += subsection + '-'
|
|
31
|
-
if (fieldName)
|
|
32
|
-
str += fieldName
|
|
26
|
+
if (section) str += section + '-'
|
|
27
|
+
if (subsection) str += subsection + '-'
|
|
28
|
+
if (fieldName) str += fieldName
|
|
33
29
|
return str
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
const sliderTypeClass = () => {
|
|
37
33
|
const typeArr = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
flat: ' slider--flat',
|
|
35
|
+
block: ' slider--block',
|
|
36
|
+
pill: ' slider--pill',
|
|
41
37
|
'3d': ' slider--3d'
|
|
42
38
|
}
|
|
43
39
|
return typeArr[sliderType] || ''
|
|
@@ -47,21 +43,21 @@ const InputSlider = (
|
|
|
47
43
|
if (stateValue !== undefined && stateValue !== value) {
|
|
48
44
|
setValue(stateValue)
|
|
49
45
|
}
|
|
50
|
-
}, [
|
|
46
|
+
}, [stateValue])
|
|
51
47
|
|
|
52
48
|
useEffect(() => {
|
|
53
49
|
if (stateValue !== undefined && stateValue !== value && updateField) {
|
|
54
50
|
updateField(section, subsection, fieldName, value, i)
|
|
55
51
|
}
|
|
56
|
-
}, [
|
|
52
|
+
}, [value])
|
|
57
53
|
|
|
58
54
|
return (
|
|
59
|
-
<div className=
|
|
55
|
+
<div className='input-group'>
|
|
60
56
|
{label && <label>{label}</label>}
|
|
61
|
-
<div className={'cove-input__slider' + (size === 'small' ? '--small' : size === 'large' ? '--large' : '') +
|
|
62
|
-
<div className=
|
|
63
|
-
<div className=
|
|
64
|
-
<input className=
|
|
57
|
+
<div className={'cove-input__slider' + (size === 'small' ? '--small' : size === 'large' ? '--large' : '') + sliderTypeClass() + (value ? ' active' : '')} onClick={() => setValue(!value)}>
|
|
58
|
+
<div className='cove-input__slider-button' />
|
|
59
|
+
<div className='cove-input__slider-track' style={value && activeColor ? { backgroundColor: activeColor } : null} />
|
|
60
|
+
<input className='cove-input--hidden' type='checkbox' name={name()} checked={value || false} readOnly />
|
|
65
61
|
</div>
|
|
66
62
|
</div>
|
|
67
63
|
)
|
|
@@ -6,39 +6,42 @@ import Card from '../elements/Card'
|
|
|
6
6
|
import { DATA_TABLE_VERTICAL, DATA_TABLE_HORIZONTAL, DATA_TABLE_SINGLE_ROW, DATA_TABLE_MULTI_ROW } from '../../data/dataDesignerTables'
|
|
7
7
|
import '../../styles/v2/components/data-designer.scss'
|
|
8
8
|
|
|
9
|
-
const DataDesigner =
|
|
10
|
-
const { configureData, updateDescriptionProp, visualizationKey, dataKey } = props
|
|
9
|
+
const DataDesigner = props => {
|
|
10
|
+
const { configureData, updateDescriptionProp, visualizationKey, dataKey } = props
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
|
-
<div className=
|
|
14
|
-
<div className=
|
|
15
|
-
<div className=
|
|
16
|
-
<div className=
|
|
17
|
-
<div className=
|
|
18
|
-
<div className=
|
|
13
|
+
<div className='cove-data-designer__container'>
|
|
14
|
+
<div className='mb-2'>
|
|
15
|
+
<div className='cove-heading--3 fw-bold mb-1'>Describe Data</div>
|
|
16
|
+
<div className='cove-heading--3 fw-normal mb-1'>Data Orientation</div>
|
|
17
|
+
<div className='grid grid-gap-2 mb-4'>
|
|
18
|
+
<div className='column'>
|
|
19
19
|
<button
|
|
20
20
|
className={'cove-data-designer__button' + (configureData.dataDescription && configureData.dataDescription.horizontal === false ? ' active' : '')}
|
|
21
21
|
onClick={() => {
|
|
22
22
|
updateDescriptionProp(visualizationKey, dataKey, 'horizontal', false)
|
|
23
|
-
}}
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
24
25
|
<Card>
|
|
25
|
-
<strong className=
|
|
26
|
-
<p className=
|
|
27
|
-
single <em>column</em>.
|
|
26
|
+
<strong className='cove-heading--3'>Vertical</strong>
|
|
27
|
+
<p className='mb-1'>
|
|
28
|
+
Values for map geography or chart date/category axis are contained in a single <em>column</em>.
|
|
28
29
|
</p>
|
|
29
30
|
{DATA_TABLE_VERTICAL}
|
|
30
31
|
</Card>
|
|
31
32
|
</button>
|
|
32
33
|
</div>
|
|
33
|
-
<div className=
|
|
34
|
+
<div className='column'>
|
|
34
35
|
<button
|
|
35
36
|
className={'cove-data-designer__button' + (configureData.dataDescription && configureData.dataDescription.horizontal === true ? ' active' : '')}
|
|
36
37
|
onClick={() => {
|
|
37
38
|
updateDescriptionProp(visualizationKey, dataKey, 'horizontal', true)
|
|
38
|
-
}}
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
39
41
|
<Card>
|
|
40
|
-
<strong className=
|
|
41
|
-
<p className=
|
|
42
|
+
<strong className='cove-heading--3'>Horizontal</strong>
|
|
43
|
+
<p className='mb-1'>
|
|
44
|
+
Values for map geography or chart date/category axis are contained in a single <em>row</em>
|
|
42
45
|
</p>
|
|
43
46
|
{DATA_TABLE_HORIZONTAL}
|
|
44
47
|
</Card>
|
|
@@ -48,13 +51,13 @@ const DataDesigner = (props) => {
|
|
|
48
51
|
</div>
|
|
49
52
|
{configureData.dataDescription && (
|
|
50
53
|
<>
|
|
51
|
-
<div className=
|
|
52
|
-
<div className=
|
|
54
|
+
<div className='mb-2'>
|
|
55
|
+
<div className='mb-1'>Are there multiple series represented in your data?</div>
|
|
53
56
|
<div>
|
|
54
57
|
<Button
|
|
55
58
|
style={{ backgroundColor: '#00345d' }}
|
|
56
59
|
hoverStyle={{ backgroundColor: '#015daa' }}
|
|
57
|
-
className=
|
|
60
|
+
className='mr-1'
|
|
58
61
|
onClick={() => {
|
|
59
62
|
updateDescriptionProp(visualizationKey, dataKey, 'series', true)
|
|
60
63
|
}}
|
|
@@ -75,45 +78,52 @@ const DataDesigner = (props) => {
|
|
|
75
78
|
</div>
|
|
76
79
|
</div>
|
|
77
80
|
{configureData.dataDescription.horizontal === true && configureData.dataDescription.series === true && (
|
|
78
|
-
<div className=
|
|
79
|
-
<div className=
|
|
80
|
-
<select
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
{
|
|
81
|
+
<div className='mb-2'>
|
|
82
|
+
<div className='mb-1'>Which property in the dataset represents which series the row is describing?</div>
|
|
83
|
+
<select
|
|
84
|
+
onChange={e => {
|
|
85
|
+
updateDescriptionProp(visualizationKey, dataKey, 'seriesKey', e.target.value)
|
|
86
|
+
}}
|
|
87
|
+
defaultValue={configureData.dataDescription.seriesKey}
|
|
88
|
+
>
|
|
89
|
+
<option value=''>Choose an option</option>
|
|
90
|
+
{Object.keys(configureData.data[0]).map((value, index) => (
|
|
91
|
+
<option value={value} key={index}>
|
|
92
|
+
{value}
|
|
93
|
+
</option>
|
|
94
|
+
))}
|
|
85
95
|
</select>
|
|
86
96
|
</div>
|
|
87
97
|
)}
|
|
88
98
|
{configureData.dataDescription.horizontal === false && configureData.dataDescription.series === true && (
|
|
89
99
|
<>
|
|
90
|
-
<div className=
|
|
91
|
-
<div className=
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<div className="grid grid-gap-2 mb-4">
|
|
95
|
-
<div className="column">
|
|
100
|
+
<div className='mb-2'>
|
|
101
|
+
<div className='mb-1'>Are the series values in your data represented in a single row, or across multiple rows?</div>
|
|
102
|
+
<div className='grid grid-gap-2 mb-4'>
|
|
103
|
+
<div className='column'>
|
|
96
104
|
<button
|
|
97
105
|
className={'cove-data-designer__button' + (configureData.dataDescription.singleRow === true ? ' active' : '')}
|
|
98
106
|
onClick={() => {
|
|
99
|
-
|
|
100
|
-
}}
|
|
107
|
+
updateDescriptionProp(visualizationKey, dataKey, 'singleRow', true)
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
101
110
|
<Card>
|
|
102
|
-
<strong className=
|
|
103
|
-
<p className=
|
|
111
|
+
<strong className='cove-heading--3'>Single Row</strong>
|
|
112
|
+
<p className='mb-1'>Each row contains the data for an individual series in itself.</p>
|
|
104
113
|
{DATA_TABLE_SINGLE_ROW}
|
|
105
114
|
</Card>
|
|
106
115
|
</button>
|
|
107
116
|
</div>
|
|
108
|
-
<div className=
|
|
117
|
+
<div className='column'>
|
|
109
118
|
<button
|
|
110
119
|
className={'cove-data-designer__button' + (configureData.dataDescription.singleRow === false ? ' active' : '')}
|
|
111
120
|
onClick={() => {
|
|
112
121
|
updateDescriptionProp(visualizationKey, dataKey, 'singleRow', false)
|
|
113
|
-
}}
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
114
124
|
<Card>
|
|
115
|
-
<strong className=
|
|
116
|
-
<p className=
|
|
125
|
+
<strong className='cove-heading--3'>Multiple Rows</strong>
|
|
126
|
+
<p className='mb-1'>Each series data is broken out into multiple rows.</p>
|
|
117
127
|
{DATA_TABLE_MULTI_ROW}
|
|
118
128
|
</Card>
|
|
119
129
|
</button>
|
|
@@ -122,36 +132,51 @@ const DataDesigner = (props) => {
|
|
|
122
132
|
</div>
|
|
123
133
|
{configureData.dataDescription.singleRow === false && (
|
|
124
134
|
<>
|
|
125
|
-
<div className=
|
|
126
|
-
<div className=
|
|
127
|
-
<select
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
<div className='mb-2'>
|
|
136
|
+
<div className='mb-1'>Which property in the dataset represents which series the row is describing?</div>
|
|
137
|
+
<select
|
|
138
|
+
onChange={e => {
|
|
139
|
+
updateDescriptionProp(visualizationKey, dataKey, 'seriesKey', e.target.value)
|
|
140
|
+
}}
|
|
141
|
+
defaultValue={configureData.dataDescription.seriesKey}
|
|
142
|
+
>
|
|
143
|
+
<option value=''>Choose an option</option>
|
|
131
144
|
{Object.keys(configureData.data[0]).map((value, index) => (
|
|
132
|
-
<option value={value} key={index}>
|
|
145
|
+
<option value={value} key={index}>
|
|
146
|
+
{value}
|
|
147
|
+
</option>
|
|
133
148
|
))}
|
|
134
149
|
</select>
|
|
135
150
|
</div>
|
|
136
|
-
<div className=
|
|
137
|
-
<div className=
|
|
138
|
-
<select
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
151
|
+
<div className='mb-2'>
|
|
152
|
+
<div className='mb-1'>Which property in the dataset represents the values for the category/date axis or map geography?</div>
|
|
153
|
+
<select
|
|
154
|
+
onChange={e => {
|
|
155
|
+
updateDescriptionProp(visualizationKey, dataKey, 'xKey', e.target.value)
|
|
156
|
+
}}
|
|
157
|
+
defaultValue={configureData.dataDescription.xKey}
|
|
158
|
+
>
|
|
159
|
+
<option value=''>Choose an option</option>
|
|
142
160
|
{Object.keys(configureData.data[0]).map((value, index) => (
|
|
143
|
-
<option value={value} key={index}>
|
|
161
|
+
<option value={value} key={index}>
|
|
162
|
+
{value}
|
|
163
|
+
</option>
|
|
144
164
|
))}
|
|
145
165
|
</select>
|
|
146
166
|
</div>
|
|
147
|
-
<div className=
|
|
148
|
-
<div className=
|
|
149
|
-
<select
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
167
|
+
<div className='mb-2'>
|
|
168
|
+
<div className='mb-1'>Which property in the dataset represents the numeric value?</div>
|
|
169
|
+
<select
|
|
170
|
+
onChange={e => {
|
|
171
|
+
updateDescriptionProp(visualizationKey, dataKey, 'valueKey', e.target.value)
|
|
172
|
+
}}
|
|
173
|
+
defaultValue={configureData.dataDescription.valueKey}
|
|
174
|
+
>
|
|
175
|
+
<option value=''>Choose an option</option>
|
|
153
176
|
{Object.keys(configureData.data[0]).map((value, index) => (
|
|
154
|
-
<option value={value} key={index}>
|
|
177
|
+
<option value={value} key={index}>
|
|
178
|
+
{value}
|
|
179
|
+
</option>
|
|
155
180
|
))}
|
|
156
181
|
</select>
|
|
157
182
|
</div>
|
|
@@ -161,9 +186,7 @@ const DataDesigner = (props) => {
|
|
|
161
186
|
)}
|
|
162
187
|
</>
|
|
163
188
|
)}
|
|
164
|
-
{configureData.dataDescription && configureData.formattedData &&
|
|
165
|
-
<div>Data configured successfully</div>
|
|
166
|
-
)}
|
|
189
|
+
{configureData.dataDescription && configureData.formattedData && <div>Data configured successfully</div>}
|
|
167
190
|
</div>
|
|
168
191
|
)
|
|
169
192
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import React, { Children } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Accordion as AccordionComponent,
|
|
4
|
-
AccordionItem,
|
|
5
|
-
AccordionItemHeading,
|
|
6
|
-
AccordionItemPanel,
|
|
7
|
-
AccordionItemButton,
|
|
8
|
-
} from 'react-accessible-accordion'
|
|
2
|
+
import { Accordion as AccordionComponent, AccordionItem, AccordionItemHeading, AccordionItemPanel, AccordionItemButton } from 'react-accessible-accordion'
|
|
9
3
|
import PropTypes from 'prop-types'
|
|
10
4
|
|
|
11
5
|
import Icon from './Icon'
|
|
@@ -16,37 +10,31 @@ import '../../styles/v2/components/accordion.scss'
|
|
|
16
10
|
//Define the "slots" to be populated by subcomponents
|
|
17
11
|
const AccordionSection = () => null
|
|
18
12
|
|
|
19
|
-
const Accordion = ({children}) => {
|
|
13
|
+
const Accordion = ({ children }) => {
|
|
20
14
|
const childNodes = Children.toArray(children)
|
|
21
15
|
const accordionSections = childNodes.filter(child => child?.type === AccordionSection)
|
|
22
16
|
|
|
23
17
|
return (
|
|
24
18
|
<AccordionComponent allowZeroExpanded={true}>
|
|
25
|
-
{accordionSections &&
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
? (
|
|
32
|
-
<Tooltip position=
|
|
19
|
+
{accordionSections &&
|
|
20
|
+
accordionSections.map((section, index) => (
|
|
21
|
+
<AccordionItem className='cove-accordion__item' key={index}>
|
|
22
|
+
<AccordionItemHeading className='cove-accordion__heading'>
|
|
23
|
+
<AccordionItemButton className='cove-accordion__button'>
|
|
24
|
+
{section.props.title}
|
|
25
|
+
{section.props.tooltipText ? (
|
|
26
|
+
<Tooltip position='bottom'>
|
|
33
27
|
<Tooltip.Target>
|
|
34
|
-
<Icon display=
|
|
28
|
+
<Icon display='question' size={14} />
|
|
35
29
|
</Tooltip.Target>
|
|
36
|
-
<Tooltip.Content>
|
|
37
|
-
{section.props.tooltipText}
|
|
38
|
-
</Tooltip.Content>
|
|
30
|
+
<Tooltip.Content>{section.props.tooltipText}</Tooltip.Content>
|
|
39
31
|
</Tooltip>
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</
|
|
44
|
-
</
|
|
45
|
-
|
|
46
|
-
{section.props.children}
|
|
47
|
-
</AccordionItemPanel>
|
|
48
|
-
</AccordionItem>
|
|
49
|
-
))}
|
|
32
|
+
) : null}
|
|
33
|
+
</AccordionItemButton>
|
|
34
|
+
</AccordionItemHeading>
|
|
35
|
+
<AccordionItemPanel className='cove-accordion__panel'>{section.props.children}</AccordionItemPanel>
|
|
36
|
+
</AccordionItem>
|
|
37
|
+
))}
|
|
50
38
|
</AccordionComponent>
|
|
51
39
|
)
|
|
52
40
|
}
|
package/components/ui/Icon.jsx
CHANGED
|
@@ -32,33 +32,33 @@ import iconText from '../../assets/filtered-text.svg'
|
|
|
32
32
|
import '../../styles/v2/components/icon.scss'
|
|
33
33
|
|
|
34
34
|
const iconHash = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
'filtered-text':iconText
|
|
35
|
+
caretUp: iconCaretUp,
|
|
36
|
+
caretDown: iconCaretDown,
|
|
37
|
+
caretFilledUp: iconCaretFilledUp,
|
|
38
|
+
caretFilledDown: iconCaretFilledDown,
|
|
39
|
+
chartBar: iconChartBar,
|
|
40
|
+
chartLine: iconChartLine,
|
|
41
|
+
chartPie: iconChartPie,
|
|
42
|
+
close: iconClose,
|
|
43
|
+
code: iconCode,
|
|
44
|
+
databite: iconDataBite,
|
|
45
|
+
edit: iconEdit,
|
|
46
|
+
fileUpload: iconFileUpload,
|
|
47
|
+
filterBars: iconFilterBars,
|
|
48
|
+
grid: iconGrid,
|
|
49
|
+
info: iconInfo,
|
|
50
|
+
link: iconLink,
|
|
51
|
+
mapAl: iconMapAl,
|
|
52
|
+
mapUsa: iconMapUsa,
|
|
53
|
+
mapWorld: iconMapWorld,
|
|
54
|
+
move: iconMove,
|
|
55
|
+
question: iconQuestion,
|
|
56
|
+
upload: iconUpload,
|
|
57
|
+
warningCircle: iconWarningCircle,
|
|
58
|
+
warningTriangle: iconWarningTriangle,
|
|
59
|
+
gear: iconGear,
|
|
60
|
+
tools: iconTools,
|
|
61
|
+
'filtered-text': iconText
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
const Icon = ({ display = null, base, alt = '', size, color, style, ...attributes }) => {
|
|
@@ -75,14 +75,13 @@ const Icon = ({ display = null, base, alt = '', size, color, style, ...attribute
|
|
|
75
75
|
|
|
76
76
|
return (
|
|
77
77
|
<>
|
|
78
|
-
{base
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
78
|
+
{base ? (
|
|
79
|
+
<IconObj title={alt} />
|
|
80
|
+
) : (
|
|
81
|
+
<span className={`cove-icon${attributes.className ? ' ' + attributes.className : ''}`} style={styles} {...filteredAttrs}>
|
|
82
|
+
<IconObj title={alt} />
|
|
83
|
+
</span>
|
|
84
|
+
)}
|
|
86
85
|
</>
|
|
87
86
|
)
|
|
88
87
|
}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import '../../styles/v2/components/loadspin.scss'
|
|
3
3
|
|
|
4
|
-
const LoadSpin = ({
|
|
5
|
-
color = '#fff',
|
|
6
|
-
opacity = 100,
|
|
7
|
-
size = 100,
|
|
8
|
-
className
|
|
9
|
-
}) => {
|
|
4
|
+
const LoadSpin = ({ color = '#fff', opacity = 100, size = 100, className }) => {
|
|
10
5
|
const n = 8
|
|
11
6
|
return (
|
|
12
7
|
<>
|
|
13
|
-
<div className={`cove-loadspin${className ? ' ' + className : ''}`} style={{width: size, height: size}}>
|
|
14
|
-
<div className=
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
}
|
|
8
|
+
<div className={`cove-loadspin${className ? ' ' + className : ''}`} style={{ width: size, height: size }}>
|
|
9
|
+
<div className='cove-loadspin__roller' style={{ opacity: opacity / 100, transform: `scale(${size / 80})` }}>
|
|
10
|
+
{[...Array(n)].map((elem, index) => (
|
|
11
|
+
<div key={index} style={{ backgroundColor: color }} />
|
|
12
|
+
))}
|
|
18
13
|
</div>
|
|
19
14
|
</div>
|
|
20
15
|
</>
|