@cdc/core 4.24.9 → 4.24.10
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/BlurStrokeText.tsx +44 -0
- package/components/DataTable/DataTable.tsx +51 -35
- 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} +268 -298
- package/components/DataTable/helpers/customSort.ts +11 -15
- 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/DataTableEditor.tsx +132 -26
- package/components/EditorPanel/Inputs.tsx +42 -4
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +25 -7
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +1 -1
- package/components/{Filters.tsx → Filters/Filters.tsx} +48 -39
- 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 -3
- package/components/Legend/Legend.Gradient.tsx +2 -9
- package/components/Loader/Loader.tsx +33 -0
- package/components/Loader/index.ts +1 -0
- package/components/Loader/loader.styles.css +13 -0
- package/components/NestedDropdown/NestedDropdown.tsx +90 -48
- package/components/NestedDropdown/nestedDropdownHelpers.ts +34 -0
- package/components/NestedDropdown/nesteddropdown.styles.css +7 -0
- package/components/NestedDropdown/tests/nestedDropdownHelpers.test.ts +58 -0
- package/components/Table/components/GroupRow.tsx +1 -1
- package/components/_stories/BlurStrokeTest.stories.tsx +27 -0
- package/components/_stories/NestedDropdown.stories.tsx +22 -46
- package/components/_stories/_mocks/nested-dropdown.json +30 -0
- package/components/_stories/styles.scss +0 -1
- package/components/ui/{Tooltip.jsx → Tooltip.tsx} +38 -14
- package/data/colorPalettes.js +107 -10
- package/dist/cove-main.css +6114 -0
- package/dist/cove-main.css.map +1 -0
- package/helpers/addValuesToFilters.ts +8 -3
- package/helpers/cove/number.js +46 -25
- package/helpers/coveUpdateWorker.ts +6 -7
- package/helpers/formatConfigBeforeSave.ts +16 -1
- package/helpers/gatherQueryParams.ts +12 -2
- package/helpers/pivotData.ts +52 -11
- package/helpers/tests/gatherQueryParams.test.ts +34 -0
- package/helpers/tests/pivotData.test.ts +50 -0
- 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 +4 -0
- package/styles/_global-variables.scss +19 -1
- package/styles/_global.scss +1 -8
- package/styles/_reset.scss +2 -15
- package/styles/base.scss +0 -1
- package/styles/cove-main.scss +6 -0
- package/styles/filters.scss +6 -4
- 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 +2 -0
- package/types/General.ts +1 -0
- package/types/Table.ts +2 -1
- package/types/Visualization.ts +13 -1
- 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
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { DataTableProps } from '../DataTable'
|
|
2
|
-
import { DownIcon, UpIcon } from './Icons'
|
|
3
2
|
import ScreenReaderText from '../../elements/ScreenReaderText'
|
|
3
|
+
import { SortIcon } from './SortIcon'
|
|
4
|
+
import { getNewSortBy } from '../helpers/getNewSortBy'
|
|
4
5
|
|
|
5
6
|
type MapHeaderProps = DataTableProps & {
|
|
6
7
|
sortBy: { column; asc }
|
|
7
8
|
setSortBy: Function
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
const ColumnHeadingText = ({
|
|
11
|
+
const ColumnHeadingText = ({ text, config }) => {
|
|
11
12
|
let notApplicableText = 'Not Applicable'
|
|
12
13
|
if (text === '__series__' && config.table.indexLabel) return `${config.table.indexLabel} `
|
|
13
|
-
if (text === '__series__' && !config.table.indexLabel)
|
|
14
|
+
if (text === '__series__' && !config.table.indexLabel)
|
|
15
|
+
return <ScreenReaderText as='span'>{notApplicableText}</ScreenReaderText>
|
|
14
16
|
return text
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -21,7 +23,7 @@ const MapHeader = ({ columns, config, indexTitle, sortBy, setSortBy }: MapHeader
|
|
|
21
23
|
.filter(column => columns[column].dataTable === true && columns[column].name)
|
|
22
24
|
.map((column, index) => {
|
|
23
25
|
let text
|
|
24
|
-
if (column !== 'geo') {
|
|
26
|
+
if (column && column !== 'geo') {
|
|
25
27
|
text = columns[column].label ? columns[column].label : columns[column].name
|
|
26
28
|
} else {
|
|
27
29
|
text = config.type === 'map' ? indexTitle : config.xAxis?.dataKey
|
|
@@ -29,7 +31,8 @@ const MapHeader = ({ columns, config, indexTitle, sortBy, setSortBy }: MapHeader
|
|
|
29
31
|
if (config.type === 'map' && (text === undefined || text === '')) {
|
|
30
32
|
text = 'Location'
|
|
31
33
|
}
|
|
32
|
-
|
|
34
|
+
const newSortBy = getNewSortBy(sortBy, column, index)
|
|
35
|
+
const sortByAsc = sortBy.column === column ? sortBy.asc : undefined
|
|
33
36
|
return (
|
|
34
37
|
<th
|
|
35
38
|
key={`col-header-${column}__${index}`}
|
|
@@ -38,19 +41,25 @@ const MapHeader = ({ columns, config, indexTitle, sortBy, setSortBy }: MapHeader
|
|
|
38
41
|
role='columnheader'
|
|
39
42
|
scope='col'
|
|
40
43
|
onClick={() => {
|
|
41
|
-
setSortBy(
|
|
44
|
+
setSortBy(newSortBy)
|
|
42
45
|
}}
|
|
43
46
|
onKeyDown={e => {
|
|
44
47
|
if (e.keyCode === 13) {
|
|
45
|
-
setSortBy(
|
|
48
|
+
setSortBy(newSortBy)
|
|
46
49
|
}
|
|
47
50
|
}}
|
|
48
51
|
className={sortBy.column === column ? (sortBy.asc ? 'sort sort-asc' : 'sort sort-desc') : 'sort'}
|
|
49
|
-
{...(sortBy.column === column
|
|
52
|
+
{...(sortBy.column === column
|
|
53
|
+
? sortBy.asc
|
|
54
|
+
? { 'aria-sort': 'ascending' }
|
|
55
|
+
: { 'aria-sort': 'descending' }
|
|
56
|
+
: null)}
|
|
50
57
|
>
|
|
51
58
|
<ColumnHeadingText text={text} config={config} column={column} />
|
|
52
|
-
|
|
53
|
-
<span className='cdcdataviz-sr-only'>{`Sort by ${text} in ${
|
|
59
|
+
<SortIcon ascending={sortByAsc} />
|
|
60
|
+
<span className='cdcdataviz-sr-only'>{`Sort by ${text} in ${
|
|
61
|
+
sortBy.column === column ? (!sortBy.asc ? 'descending' : 'ascending') : 'descending'
|
|
62
|
+
} order`}</span>
|
|
54
63
|
</th>
|
|
55
64
|
)
|
|
56
65
|
})}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import './sort-icon.css'
|
|
2
|
+
|
|
3
|
+
const UpIcon = ({ active }) => (
|
|
4
|
+
<svg className={'up' + (active ? ' active' : '')} xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 5'>
|
|
5
|
+
<path d='M0 5l5-5 5 5z' />
|
|
6
|
+
</svg>
|
|
7
|
+
)
|
|
8
|
+
const DownIcon = ({ active }) => (
|
|
9
|
+
<svg className={'down' + (active ? ' active' : '')} xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 5'>
|
|
10
|
+
<path d='M0 0l5 5 5-5z' />
|
|
11
|
+
</svg>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
type SortIconProps = {
|
|
15
|
+
ascending?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const SortIcon: React.FC<SortIconProps> = ({ ascending }) => {
|
|
19
|
+
return (
|
|
20
|
+
<span role='button' className={'sort-icon'}>
|
|
21
|
+
<UpIcon active={ascending === true} />
|
|
22
|
+
<DownIcon active={ascending === false} />
|
|
23
|
+
</span>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* format the white triangle sort icon in data table headers */
|
|
2
|
+
.sort-icon {
|
|
3
|
+
fill: white;
|
|
4
|
+
position: relative;
|
|
5
|
+
margin: 0 0.5rem !important;
|
|
6
|
+
:is(svg) {
|
|
7
|
+
position: absolute;
|
|
8
|
+
fill: rgba(255, 255, 255, 0.5);
|
|
9
|
+
&.active {
|
|
10
|
+
fill: white;
|
|
11
|
+
}
|
|
12
|
+
width: 1rem;
|
|
13
|
+
height: 1rem;
|
|
14
|
+
}
|
|
15
|
+
.up {
|
|
16
|
+
bottom: 0.5rem;
|
|
17
|
+
}
|
|
18
|
+
.down {
|
|
19
|
+
top: 0.5rem;
|
|
20
|
+
}
|
|
21
|
+
}
|