@cdc/core 4.24.9 → 4.24.11
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/LICENSE +201 -0
- package/assets/icon-combo-chart.svg +1 -0
- package/assets/icon-epi-chart.svg +27 -0
- package/components/AdvancedEditor/AdvancedEditor.tsx +17 -13
- package/components/Alert/components/Alert.tsx +34 -8
- package/components/BlurStrokeText.tsx +44 -0
- package/components/DataTable/DataTable.tsx +62 -36
- package/components/DataTable/DataTableStandAlone.tsx +37 -6
- package/components/DataTable/components/ChartHeader.tsx +31 -26
- package/components/DataTable/components/MapHeader.tsx +19 -10
- package/components/DataTable/components/SortIcon/index.tsx +25 -0
- package/components/DataTable/components/SortIcon/sort-icon.css +21 -0
- package/{styles/_data-table.scss → components/DataTable/data-table.css} +250 -298
- package/components/DataTable/helpers/boxplotCellMatrix.tsx +14 -13
- package/components/DataTable/helpers/customSort.ts +11 -15
- package/components/DataTable/helpers/getChartCellValue.ts +23 -5
- package/components/DataTable/helpers/getDataSeriesColumns.ts +5 -1
- package/components/DataTable/helpers/getNewSortBy.ts +35 -0
- package/components/DataTable/helpers/tests/customSort.test.ts +52 -0
- package/components/DataTable/helpers/tests/getNewSortBy.test.ts +26 -0
- package/components/EditorPanel/ColumnsEditor.tsx +81 -36
- package/components/EditorPanel/DataTableEditor.tsx +149 -43
- package/components/EditorPanel/FieldSetWrapper.tsx +2 -2
- package/components/EditorPanel/Inputs.tsx +68 -20
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +25 -7
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +30 -55
- package/components/{Filters.tsx → Filters/Filters.tsx} +60 -43
- package/components/Filters/helpers/applyQueuedActive.ts +12 -0
- package/components/Filters/helpers/getNestedOptions.ts +29 -0
- package/components/Filters/helpers/handleSorting.ts +18 -0
- package/components/Filters/helpers/tests/applyQueuedActive.test.ts +49 -0
- package/components/Filters/helpers/tests/getNestedOptions.test.ts +93 -0
- package/components/Filters/helpers/tests/handleSorting.test.ts +68 -0
- package/components/Filters/index.ts +5 -0
- package/components/Layout/components/Sidebar/components/sidebar.styles.scss +1 -7
- package/components/Layout/components/Visualization/visualizations.scss +1 -1
- package/components/Legend/Legend.Gradient.tsx +44 -36
- package/components/Loader/Loader.tsx +33 -0
- package/components/Loader/index.ts +1 -0
- package/components/Loader/loader.styles.css +13 -0
- package/components/MultiSelect/MultiSelect.tsx +85 -62
- package/components/MultiSelect/multiselect.styles.css +10 -7
- package/components/NestedDropdown/NestedDropdown.tsx +118 -56
- package/components/NestedDropdown/nestedDropdownHelpers.ts +34 -0
- package/components/NestedDropdown/nesteddropdown.styles.css +22 -13
- package/components/NestedDropdown/tests/nestedDropdownHelpers.test.ts +58 -0
- package/components/Table/Table.tsx +102 -34
- package/components/Table/components/GroupRow.tsx +1 -1
- package/components/_stories/BlurStrokeTest.stories.tsx +27 -0
- package/components/_stories/DataTable.stories.tsx +14 -0
- package/components/_stories/Filters.stories.tsx +57 -0
- package/components/_stories/NestedDropdown.stories.tsx +22 -46
- package/components/_stories/_mocks/DataTable/no-data.json +108 -0
- package/components/_stories/_mocks/nested-dropdown.json +30 -0
- package/components/_stories/styles.scss +0 -1
- package/components/ui/Icon.tsx +19 -6
- package/components/ui/{Tooltip.jsx → Tooltip.tsx} +38 -14
- package/data/colorPalettes.js +107 -10
- package/dist/cove-main.css +6080 -0
- package/dist/cove-main.css.map +1 -0
- package/helpers/DataTransform.ts +2 -1
- package/helpers/addValuesToFilters.ts +8 -3
- package/helpers/cove/{number.js → number.ts} +62 -27
- package/helpers/coveUpdateWorker.ts +6 -7
- package/helpers/fetchRemoteData.js +32 -37
- package/helpers/formatConfigBeforeSave.ts +17 -1
- package/helpers/gatherQueryParams.ts +12 -2
- package/helpers/pivotData.ts +52 -11
- package/helpers/queryStringUtils.ts +6 -0
- package/helpers/tests/gatherQueryParams.test.ts +34 -0
- package/helpers/tests/pivotData.test.ts +50 -0
- package/helpers/useDataVizClasses.ts +42 -20
- package/helpers/ver/4.24.10.ts +47 -0
- package/helpers/ver/4.24.9.ts +0 -3
- package/helpers/ver/tests/4.24.10.test.ts +45 -0
- package/helpers/viewports.ts +9 -0
- package/package.json +7 -3
- package/styles/_button-section.scss +5 -1
- package/styles/_global-variables.scss +20 -2
- package/styles/_global.scss +22 -30
- package/styles/_reset.scss +2 -26
- package/styles/base.scss +0 -1
- package/styles/cove-main.scss +6 -0
- package/styles/filters.scss +6 -26
- package/styles/v2/base/_reset.scss +0 -7
- package/styles/v2/components/editor.scss +0 -4
- package/styles/v2/components/icon.scss +1 -1
- package/styles/v2/components/ui/tooltip.scss +42 -40
- package/styles/v2/layout/_component.scss +0 -6
- package/styles/v2/layout/index.scss +0 -1
- package/types/Axis.ts +4 -0
- package/types/BoxPlot.ts +5 -3
- package/types/Color.ts +1 -1
- package/types/General.ts +1 -0
- package/types/Legend.ts +1 -2
- package/types/MarkupInclude.ts +1 -0
- package/types/Runtime.ts +3 -1
- package/types/Series.ts +8 -1
- package/types/Table.ts +3 -2
- package/types/Visualization.ts +19 -8
- package/types/VizFilter.ts +2 -1
- package/components/DataTable/components/Icons.tsx +0 -10
- package/components/_stories/EditorPanel.stories.tsx +0 -54
- package/components/_stories/Layout.Debug.stories.tsx +0 -91
- package/components/ui/Select.jsx +0 -30
- package/helpers/getGradientLegendWidth.ts +0 -15
|
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react'
|
|
|
2
2
|
|
|
3
3
|
import DataTable from '../DataTable'
|
|
4
4
|
import './styles.scss'
|
|
5
|
+
import NoDataConfig from './_mocks/DataTable/no-data.json'
|
|
5
6
|
import Example_1 from './_mocks/dashboard_no_filter.json'
|
|
6
7
|
import CityStateExample from './_mocks/example-city-state.json'
|
|
7
8
|
import { displayGeoName } from '@cdc/map/src/helpers/displayGeoName'
|
|
@@ -62,6 +63,19 @@ export const Grouped: Story = {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
const noDataData = NoDataConfig.datasets['dev-8931-hide-markup-include.csv'].data
|
|
67
|
+
export const NoData: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
config: NoDataConfig,
|
|
70
|
+
dataConfig: { data: noDataData },
|
|
71
|
+
rawData: noDataData,
|
|
72
|
+
runtimeData: noDataData,
|
|
73
|
+
expandDataTable: true,
|
|
74
|
+
tableTitle: 'No Data Table',
|
|
75
|
+
viewport: 'lg',
|
|
76
|
+
tabbingId: '#asdf'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
65
79
|
export const RowType: Story = {
|
|
66
80
|
args: {
|
|
67
81
|
config: {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import Filters from '../Filters'
|
|
4
|
+
import { VizFilter } from '../../types/VizFilter'
|
|
5
|
+
import { faker } from '@faker-js/faker'
|
|
6
|
+
import _ from 'lodash'
|
|
7
|
+
import { Visualization } from '../../types/Visualization'
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Filters> = {
|
|
10
|
+
title: 'Components/Molecules/Visualization Filters',
|
|
11
|
+
component: Filters
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof Filters>
|
|
15
|
+
|
|
16
|
+
faker.seed(123)
|
|
17
|
+
|
|
18
|
+
const animalData = _.times(7, () => ({ bear: faker.animal.bear(), cat: faker.animal.cat(), cow: faker.animal.cow() }))
|
|
19
|
+
const generateFilters = filterStyle => {
|
|
20
|
+
return ['bear', 'cat', 'cow'].map(columnName => {
|
|
21
|
+
return {
|
|
22
|
+
filterStyle,
|
|
23
|
+
label: columnName.toUpperCase(),
|
|
24
|
+
columnName
|
|
25
|
+
} as VizFilter
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const generateConfig = filterStyle =>
|
|
30
|
+
({
|
|
31
|
+
args: {
|
|
32
|
+
config: {
|
|
33
|
+
filters: generateFilters(filterStyle),
|
|
34
|
+
data: animalData
|
|
35
|
+
} as Visualization,
|
|
36
|
+
filteredData: animalData,
|
|
37
|
+
setFilteredData: () => {},
|
|
38
|
+
setConfig: () => {},
|
|
39
|
+
exclusions: []
|
|
40
|
+
}
|
|
41
|
+
} as Story)
|
|
42
|
+
|
|
43
|
+
export const Dropdown: Story = generateConfig('dropdown')
|
|
44
|
+
|
|
45
|
+
export const DropdownBar: Story = generateConfig('dropdown bar')
|
|
46
|
+
|
|
47
|
+
export const MultiSelect: Story = generateConfig('multi-select')
|
|
48
|
+
|
|
49
|
+
export const NestedDropdown: Story = generateConfig('nested-dropdown')
|
|
50
|
+
|
|
51
|
+
export const Pill: Story = generateConfig('pill')
|
|
52
|
+
|
|
53
|
+
export const Tab: Story = generateConfig('tab')
|
|
54
|
+
|
|
55
|
+
export const TabBar: Story = generateConfig('tab bar')
|
|
56
|
+
|
|
57
|
+
export default meta
|
|
@@ -1,58 +1,34 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
|
|
3
2
|
import NestedDropdown from '../NestedDropdown'
|
|
3
|
+
import nestedDropdownStory from './_mocks/nested-dropdown.json'
|
|
4
|
+
import { useState } from 'react'
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof NestedDropdown> = {
|
|
6
7
|
title: 'Components/Molecules/NestedDropdown',
|
|
7
8
|
component: NestedDropdown
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
const Template = args => {
|
|
12
|
+
const [currentStoryFilter, setCurrentStoryFilter] = useState({
|
|
13
|
+
...nestedDropdownStory
|
|
14
|
+
})
|
|
15
|
+
return (
|
|
16
|
+
<NestedDropdown
|
|
17
|
+
listLabel='Age'
|
|
18
|
+
handleSelectedItems={([group, subGroup]) => {
|
|
19
|
+
setCurrentStoryFilter({
|
|
20
|
+
...currentStoryFilter,
|
|
21
|
+
active: group,
|
|
22
|
+
subGrouping: { ...currentStoryFilter.subGrouping, active: subGroup }
|
|
23
|
+
})
|
|
24
|
+
}}
|
|
25
|
+
currentFilter={currentStoryFilter}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
10
30
|
type Story = StoryObj<typeof NestedDropdown>
|
|
11
31
|
|
|
12
|
-
export const Primary: Story = {
|
|
13
|
-
args: {
|
|
14
|
-
data: [
|
|
15
|
-
{
|
|
16
|
-
country: 'USA',
|
|
17
|
-
region: 'Region1'
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
country: 'USA',
|
|
21
|
-
region: 'Florida'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
country: 'USA',
|
|
25
|
-
region: 'Iowa'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
country: 'Country2',
|
|
29
|
-
region: 'Region1'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
country: 'Country2',
|
|
33
|
-
region: 'Region2'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
country: 'Country2',
|
|
37
|
-
region: 'Region3'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
country: 'Italy',
|
|
41
|
-
region: 'Region1'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
country: 'Italy',
|
|
45
|
-
region: 'Naples'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
country: 'Italy',
|
|
49
|
-
region: 'Region3'
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
tiers: ['country', 'region'],
|
|
53
|
-
listLabel: 'Countries of the World',
|
|
54
|
-
handleSelectedItems: console.log
|
|
55
|
-
}
|
|
56
|
-
}
|
|
32
|
+
export const Primary: Story = Template.bind({})
|
|
57
33
|
|
|
58
34
|
export default meta
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dashboard": {
|
|
3
|
+
"theme": "theme-blue",
|
|
4
|
+
"sharedFilters": []
|
|
5
|
+
},
|
|
6
|
+
"rows": [
|
|
7
|
+
{
|
|
8
|
+
"columns": [
|
|
9
|
+
{
|
|
10
|
+
"width": 12,
|
|
11
|
+
"widget": "table1730380781112"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"uuid": 1730380998726
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"visualizations": {
|
|
18
|
+
"table1730380781112": {
|
|
19
|
+
"filters": [],
|
|
20
|
+
"filterBehavior": "Filter Change",
|
|
21
|
+
"newViz": false,
|
|
22
|
+
"openModal": true,
|
|
23
|
+
"uid": "table1730380781112",
|
|
24
|
+
"type": "table",
|
|
25
|
+
"table": {
|
|
26
|
+
"label": "Data Table",
|
|
27
|
+
"show": true,
|
|
28
|
+
"showDownloadUrl": false,
|
|
29
|
+
"showVertical": true,
|
|
30
|
+
"expanded": true,
|
|
31
|
+
"collapsible": true
|
|
32
|
+
},
|
|
33
|
+
"columns": {
|
|
34
|
+
"additionalColumn1": {
|
|
35
|
+
"label": "New Column",
|
|
36
|
+
"dataTable": true,
|
|
37
|
+
"tooltips": false,
|
|
38
|
+
"prefix": "",
|
|
39
|
+
"suffix": "",
|
|
40
|
+
"forestPlot": false,
|
|
41
|
+
"startingPoint": "0",
|
|
42
|
+
"forestPlotAlignRight": false,
|
|
43
|
+
"roundToPlace": 0,
|
|
44
|
+
"commas": false,
|
|
45
|
+
"showInViz": false,
|
|
46
|
+
"forestPlotStartingPoint": 0
|
|
47
|
+
},
|
|
48
|
+
"Class": {
|
|
49
|
+
"name": "Class",
|
|
50
|
+
"dataTable": false
|
|
51
|
+
},
|
|
52
|
+
"Data_Type": {
|
|
53
|
+
"name": "Data_Type",
|
|
54
|
+
"dataTable": false
|
|
55
|
+
},
|
|
56
|
+
"Question": {
|
|
57
|
+
"name": "Question",
|
|
58
|
+
"dataTable": false
|
|
59
|
+
},
|
|
60
|
+
"Response": {
|
|
61
|
+
"name": "Response",
|
|
62
|
+
"dataTable": false
|
|
63
|
+
},
|
|
64
|
+
"Topic": {
|
|
65
|
+
"name": "Topic",
|
|
66
|
+
"dataTable": false
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"dataFormat": {},
|
|
70
|
+
"visualizationType": "table",
|
|
71
|
+
"dataDescription": {
|
|
72
|
+
"horizontal": false,
|
|
73
|
+
"series": false
|
|
74
|
+
},
|
|
75
|
+
"dataKey": "dev-8931-hide-markup-include.csv"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"table": {
|
|
79
|
+
"label": "Data Table",
|
|
80
|
+
"show": true,
|
|
81
|
+
"showDownloadUrl": false,
|
|
82
|
+
"showDownloadLinkBelow": true,
|
|
83
|
+
"showVertical": true
|
|
84
|
+
},
|
|
85
|
+
"newViz": true,
|
|
86
|
+
"datasets": {
|
|
87
|
+
"dev-8931-hide-markup-include.csv": {
|
|
88
|
+
"data": [],
|
|
89
|
+
"dataFileSize": 10023,
|
|
90
|
+
"dataFileName": "dev-8931-hide-markup-include.csv",
|
|
91
|
+
"dataFileSourceType": "file",
|
|
92
|
+
"dataFileFormat": "CSV",
|
|
93
|
+
"preview": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"isResponsiveTicks": false,
|
|
97
|
+
"type": "dashboard",
|
|
98
|
+
"barThickness": "0.37",
|
|
99
|
+
"xAxis": {
|
|
100
|
+
"type": "categorical",
|
|
101
|
+
"size": 75,
|
|
102
|
+
"maxTickRotation": 45,
|
|
103
|
+
"labelOffset": 0
|
|
104
|
+
},
|
|
105
|
+
"runtime": {},
|
|
106
|
+
"version": "4.24.10",
|
|
107
|
+
"uuid": 1730380778769
|
|
108
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"key": "New Dashboard Filter 1",
|
|
3
|
+
"showDropdown": true,
|
|
4
|
+
"values": ["Age Group", "Age Group 2", "Age Group 3"],
|
|
5
|
+
"orderedValues": ["Age Group", "Age Group 2", "Age Group 3"],
|
|
6
|
+
"type": "datafilter",
|
|
7
|
+
"filterStyle": "nested-dropdown",
|
|
8
|
+
"columnName": "StratficationCategory1",
|
|
9
|
+
"active": "",
|
|
10
|
+
"subGrouping": {
|
|
11
|
+
"columnName": "Stratification1",
|
|
12
|
+
"active": "",
|
|
13
|
+
"valuesLookup": {
|
|
14
|
+
"Age Group": {
|
|
15
|
+
"orderedValues": ["50-64 years", "65 years or older", "Overall"],
|
|
16
|
+
"values": ["50-64 years", "65 years or older", "Overall"]
|
|
17
|
+
},
|
|
18
|
+
"Age Group 2": {
|
|
19
|
+
"orderedValues": ["65 years or older", "Overall"],
|
|
20
|
+
"values": ["65 years or older", "Overall"]
|
|
21
|
+
},
|
|
22
|
+
"Age Group 3": {
|
|
23
|
+
"orderedValues": ["50-64 years", "Overall"],
|
|
24
|
+
"values": ["50-64 years", "Overall"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"usedBy": ["chart1724946676832"],
|
|
29
|
+
"tier": 1
|
|
30
|
+
}
|
package/components/ui/Icon.tsx
CHANGED
|
@@ -88,15 +88,24 @@ type IconProps = {
|
|
|
88
88
|
/* Returns icon data as plain svg */
|
|
89
89
|
base?: boolean
|
|
90
90
|
/* Sets alt text for the icon */
|
|
91
|
-
alt
|
|
91
|
+
alt?: string
|
|
92
92
|
/* Override the width of the icon (scales height proportionally)*/
|
|
93
93
|
size?: number
|
|
94
94
|
/* Override the color of the icon */
|
|
95
95
|
color?: string
|
|
96
|
-
style?:
|
|
96
|
+
style?: object
|
|
97
|
+
className?: string // className attribute will be ignored.
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
const Icon: React.FC<IconProps> = ({
|
|
100
|
+
const Icon: React.FC<IconProps> = ({
|
|
101
|
+
display = '',
|
|
102
|
+
base = undefined,
|
|
103
|
+
alt = '',
|
|
104
|
+
size = undefined,
|
|
105
|
+
color = undefined,
|
|
106
|
+
style = undefined,
|
|
107
|
+
...attributes
|
|
108
|
+
}) => {
|
|
100
109
|
const IconObj = iconHash[display] || null
|
|
101
110
|
|
|
102
111
|
const filteredAttrs = { ...attributes }
|
|
@@ -112,10 +121,14 @@ const Icon: React.FC<IconProps> = ({ display = '', base = undefined, alt = '', s
|
|
|
112
121
|
return (
|
|
113
122
|
<>
|
|
114
123
|
{base ? (
|
|
115
|
-
<IconObj title={alt} />
|
|
124
|
+
<IconObj title={alt || display} />
|
|
116
125
|
) : (
|
|
117
|
-
<span
|
|
118
|
-
|
|
126
|
+
<span
|
|
127
|
+
className={`cove-icon${attributes.className ? ' ' + attributes.className : ''}`}
|
|
128
|
+
style={styles}
|
|
129
|
+
{...filteredAttrs}
|
|
130
|
+
>
|
|
131
|
+
<IconObj title={alt || display} />
|
|
119
132
|
</span>
|
|
120
133
|
)}
|
|
121
134
|
</>
|
|
@@ -2,6 +2,7 @@ import { useId } from 'react'
|
|
|
2
2
|
|
|
3
3
|
// Third Party
|
|
4
4
|
import { Tooltip as ReactTooltip } from 'react-tooltip'
|
|
5
|
+
import type { PlacesType } from 'react-tooltip'
|
|
5
6
|
|
|
6
7
|
// Styles
|
|
7
8
|
import '../../styles/v2/components/ui/tooltip.scss'
|
|
@@ -9,33 +10,56 @@ import '../../styles/v2/components/ui/tooltip.scss'
|
|
|
9
10
|
const TooltipTarget = children => children
|
|
10
11
|
const TooltipContent = children => children
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
type ToolTipProps = {
|
|
14
|
+
place?: PlacesType
|
|
15
|
+
trigger?: 'hover' | 'focus' | 'click'
|
|
16
|
+
float?: boolean
|
|
17
|
+
shadow?: boolean
|
|
18
|
+
border?: boolean
|
|
19
|
+
children: React.ReactElement[]
|
|
20
|
+
style?: React.CSSProperties
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Tooltip: React.FC<ToolTipProps> & { Target; Content } = ({
|
|
24
|
+
place = 'top',
|
|
25
|
+
trigger = 'hover',
|
|
26
|
+
float = false,
|
|
27
|
+
shadow = true,
|
|
28
|
+
border = false,
|
|
29
|
+
children,
|
|
30
|
+
style,
|
|
31
|
+
...attributes
|
|
32
|
+
}) => {
|
|
13
33
|
const tooltipTargetChildren = children.find(el => el.type === TooltipTarget)
|
|
14
34
|
const tooltipContentChildren = children.find(el => el.type === TooltipContent)
|
|
15
35
|
|
|
16
36
|
const uid = 'tooltip-' + useId()
|
|
17
37
|
|
|
18
|
-
const generateTriggerEvent = trigger => {
|
|
19
|
-
const eventList = {
|
|
20
|
-
hover: null,
|
|
21
|
-
focus: 'focus',
|
|
22
|
-
click: 'click focus'
|
|
23
|
-
}
|
|
24
|
-
return eventList[trigger]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
38
|
return (
|
|
28
39
|
<span className='cove-tooltip' style={style} {...attributes}>
|
|
29
|
-
<a
|
|
40
|
+
<a
|
|
41
|
+
id={uid}
|
|
42
|
+
role='dialog'
|
|
43
|
+
tabIndex={0}
|
|
44
|
+
className='cove-tooltip--target'
|
|
45
|
+
data-tooltip-float={float}
|
|
46
|
+
data-tooltip-place={place}
|
|
47
|
+
data-tooltip-isOpen={true}
|
|
48
|
+
>
|
|
30
49
|
{tooltipTargetChildren ? tooltipTargetChildren.props.children : null}
|
|
31
50
|
</a>
|
|
32
|
-
{/* prettier-ignore */}
|
|
33
51
|
<ReactTooltip
|
|
34
52
|
id={uid}
|
|
35
53
|
// ! do not remove the deprecated property, it will break tooltips in the editor.
|
|
36
54
|
anchorId={uid}
|
|
37
|
-
className={
|
|
38
|
-
|
|
55
|
+
className={
|
|
56
|
+
'cove-tooltip__content' +
|
|
57
|
+
(' place-' + place) +
|
|
58
|
+
(!float ? ' cove-tooltip__content--animated' : '') +
|
|
59
|
+
(trigger === 'click' ? ' interactive' : '') +
|
|
60
|
+
(border ? ' cove-tooltip--border' : '') +
|
|
61
|
+
(shadow ? ' has-shadow' : '')
|
|
62
|
+
}
|
|
39
63
|
>
|
|
40
64
|
{tooltipContentChildren ? tooltipContentChildren.props.children : null}
|
|
41
65
|
</ReactTooltip>
|
package/data/colorPalettes.js
CHANGED
|
@@ -3,30 +3,105 @@ import { updatePaletteNames } from '../helpers/updatePaletteNames'
|
|
|
3
3
|
|
|
4
4
|
const colorPalettesMap = {
|
|
5
5
|
yelloworangered: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],
|
|
6
|
-
yelloworangebrown: [
|
|
6
|
+
yelloworangebrown: [
|
|
7
|
+
'#ffffe5',
|
|
8
|
+
'#fff7bc',
|
|
9
|
+
'#fee391',
|
|
10
|
+
'#fec44f',
|
|
11
|
+
'#fe9929',
|
|
12
|
+
'#ec7014',
|
|
13
|
+
'#cc4c02',
|
|
14
|
+
'#993404',
|
|
15
|
+
'#662506'
|
|
16
|
+
],
|
|
7
17
|
pinkpurple: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],
|
|
8
18
|
bluegreen: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],
|
|
9
19
|
orangered: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],
|
|
10
20
|
red: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],
|
|
11
21
|
greenblue: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#267BA6', '#0868ac', '#084081'],
|
|
12
22
|
yellowpurple: ['#FFF0B0', '#F5CC76', '#EDAE4B', '#E3683C', '#BF2A48', '#6D2059', '#8F0C4B', '#310958', '#0E0943'],
|
|
13
|
-
qualitative1: [
|
|
23
|
+
qualitative1: [
|
|
24
|
+
'#a6cee3',
|
|
25
|
+
'#1f78b4',
|
|
26
|
+
'#b2df8a',
|
|
27
|
+
'#33a02c',
|
|
28
|
+
'#fb9a99',
|
|
29
|
+
'#e31a1c',
|
|
30
|
+
'#6a3d9a',
|
|
31
|
+
'#cab2d6',
|
|
32
|
+
'#E31A90',
|
|
33
|
+
'#15017A',
|
|
34
|
+
'#C2C0FC'
|
|
35
|
+
],
|
|
14
36
|
qualitative2: ['#7fc97f', '#beaed4', '#ff9', '#386cb0', '#f0027f', '#bf5b17', '#666', '#fedab8'],
|
|
15
37
|
qualitative3: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666'],
|
|
16
38
|
qualitative4: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ff3', '#a65628', '#f781bf'],
|
|
17
39
|
// qualitative9 doesn't appear to be used anywhere...
|
|
18
40
|
qualitative9: ['#497d0c', '#84BC49', '#88c3ea', '#fcad90', '#f26b4f', '#c31b1f', '#c31b1f'],
|
|
19
|
-
'sequential-blue-2(MPX)': [
|
|
20
|
-
|
|
41
|
+
'sequential-blue-2(MPX)': [
|
|
42
|
+
'#F5FEFF',
|
|
43
|
+
'#E1FBFF',
|
|
44
|
+
'#C0F2FD',
|
|
45
|
+
'#94E2ED',
|
|
46
|
+
'#5EBAD4',
|
|
47
|
+
'#3695BE',
|
|
48
|
+
'#2273A0',
|
|
49
|
+
'#0E5181',
|
|
50
|
+
'#093460'
|
|
51
|
+
],
|
|
52
|
+
'sequential-orange(MPX)': [
|
|
53
|
+
'#FFFDF0',
|
|
54
|
+
'#FFF7DC',
|
|
55
|
+
'#FFE9C2',
|
|
56
|
+
'#FFD097',
|
|
57
|
+
'#F7A866',
|
|
58
|
+
'#EB7723',
|
|
59
|
+
'#B95117',
|
|
60
|
+
'#853209',
|
|
61
|
+
'#661F00'
|
|
62
|
+
],
|
|
63
|
+
colorblindsafe: ['#e69f00', '#56b4e9', '#009e73', '#f0e442', '#0072b2', '#d55e00', '#cc79a7', '#000000', '#7e5803']
|
|
21
64
|
}
|
|
22
65
|
|
|
23
66
|
// * ============= Palettes for Chart project ========== * //
|
|
24
67
|
|
|
25
68
|
const colorPalettes2 = {
|
|
26
|
-
'qualitative-bold': [
|
|
69
|
+
'qualitative-bold': [
|
|
70
|
+
'#377eb8',
|
|
71
|
+
'#ff7f00',
|
|
72
|
+
'#4daf4a',
|
|
73
|
+
'#984ea3',
|
|
74
|
+
'#e41a1c',
|
|
75
|
+
'#ffff33',
|
|
76
|
+
'#a65628',
|
|
77
|
+
'#f781bf',
|
|
78
|
+
'#3399CC'
|
|
79
|
+
],
|
|
27
80
|
|
|
28
|
-
'qualitative-soft': [
|
|
29
|
-
|
|
81
|
+
'qualitative-soft': [
|
|
82
|
+
'#A6CEE3',
|
|
83
|
+
'#1F78B4',
|
|
84
|
+
'#B2DF8A',
|
|
85
|
+
'#33A02C',
|
|
86
|
+
'#FB9A99',
|
|
87
|
+
'#E31A1C',
|
|
88
|
+
'#FDBF6F',
|
|
89
|
+
'#FF7F00',
|
|
90
|
+
'#ACA9EB'
|
|
91
|
+
],
|
|
92
|
+
qualitative1: [
|
|
93
|
+
'#a6cee3',
|
|
94
|
+
'#1f78b4',
|
|
95
|
+
'#b2df8a',
|
|
96
|
+
'#33a02c',
|
|
97
|
+
'#fb9a99',
|
|
98
|
+
'#e31a1c',
|
|
99
|
+
'#6a3d9a',
|
|
100
|
+
'#cab2d6',
|
|
101
|
+
'#E31A90',
|
|
102
|
+
'#15017A',
|
|
103
|
+
'#C2C0FC'
|
|
104
|
+
],
|
|
30
105
|
|
|
31
106
|
qualitative2: ['#7fc97f', '#beaed4', '#ff9', '#386cb0', '#f0027f', '#bf5b17', '#666', '#fedab8'],
|
|
32
107
|
|
|
@@ -37,7 +112,9 @@ const colorPalettes2 = {
|
|
|
37
112
|
'sequential-blue': ['#C6DBEF', '#9ECAE1', '#6BAED6', '#4292C6', '#2171B5', '#084594'],
|
|
38
113
|
'sequential-blue-2-(MPX)': ['#D5F6F9', '#99E2ED', '#5FB6D1', '#3189B0', '#116091', '#0A3E72'],
|
|
39
114
|
'sequential-orange-(MPX)': ['#FFEFCF', '#FFD49C', '#F7A866', '#EB7723', '#B95117', '#862B0B'],
|
|
40
|
-
'sequential-green': ['#C7E9C0', '#A1D99B', '#74C476', '#41AB5D', '#238B45', '#005A32']
|
|
115
|
+
'sequential-green': ['#C7E9C0', '#A1D99B', '#74C476', '#41AB5D', '#238B45', '#005A32'],
|
|
116
|
+
|
|
117
|
+
colorblindsafe: ['#e69f00', '#56b4e9', '#009e73', '#f0e442', '#0072b2', '#d55e00', '#cc79a7', '#000000', '#7e5803']
|
|
41
118
|
}
|
|
42
119
|
// * ============= Palettes for Paired bar Chart ========== * //
|
|
43
120
|
export const colorPalettes3 = {
|
|
@@ -62,9 +139,29 @@ export const colorPalettes3 = {
|
|
|
62
139
|
const sequentialColors = {
|
|
63
140
|
'Sequential Blue': ['#C6DBEF', '#9ECAE1', '#6BAED6', '#4292C6', '#2171B5', '#084594'],
|
|
64
141
|
'Sequential Blue Two': ['#D5F6F9', '#99E2ED', '#5FB6D1', '#3189B0', '#116091', '#0A3E72'],
|
|
65
|
-
'Sequential Blue Three': [
|
|
142
|
+
'Sequential Blue Three': [
|
|
143
|
+
'#F5FEFF',
|
|
144
|
+
'#E1FBFF',
|
|
145
|
+
'#C0F2FD',
|
|
146
|
+
'#94E2ED',
|
|
147
|
+
'#5EBAD4',
|
|
148
|
+
'#3695BE',
|
|
149
|
+
'#2273A0',
|
|
150
|
+
'#0E5181',
|
|
151
|
+
'#093460'
|
|
152
|
+
],
|
|
66
153
|
'Sequential Orange': ['#FFEFCF', '#FFD49C', '#F7A866', '#EB7723', '#B95117', '#862B0B'],
|
|
67
|
-
'Sequential Orange Two': [
|
|
154
|
+
'Sequential Orange Two': [
|
|
155
|
+
'#FFFDF0',
|
|
156
|
+
'#FFF7DC',
|
|
157
|
+
'#FFE9C2',
|
|
158
|
+
'#FFD097',
|
|
159
|
+
'#F7A866',
|
|
160
|
+
'#EB7723',
|
|
161
|
+
'#B95117',
|
|
162
|
+
'#853209',
|
|
163
|
+
'#661F00'
|
|
164
|
+
],
|
|
68
165
|
'Sequential Green': ['#C7E9C0', '#A1D99B', '#74C476', '#41AB5D', '#238B45', '#005A32']
|
|
69
166
|
}
|
|
70
167
|
|