@cdc/core 4.25.3 → 4.25.5-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/assets/icon-close.svg +1 -1
- package/components/DataTable/DataTable.tsx +18 -13
- package/components/DataTable/components/CellAnchor.tsx +1 -1
- package/components/DataTable/components/ChartHeader.tsx +2 -1
- package/components/DataTable/components/MapHeader.tsx +1 -0
- package/components/DataTable/helpers/chartCellMatrix.tsx +2 -1
- package/components/DataTable/helpers/mapCellMatrix.tsx +17 -7
- package/components/DownloadButton.tsx +17 -2
- package/components/EditorPanel/DataTableEditor.tsx +1 -1
- package/components/EditorPanel/Inputs.tsx +12 -4
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +2 -1
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +3 -1
- package/components/Filters/Filters.tsx +168 -429
- package/components/Filters/components/Dropdown.tsx +39 -0
- package/components/Filters/components/Tabs.tsx +82 -0
- package/components/Filters/helpers/getChangedFilters.ts +31 -0
- package/components/Filters/helpers/getNestedOptions.ts +2 -2
- package/components/Filters/helpers/getNewRuntime.ts +35 -0
- package/components/Filters/helpers/handleSorting.ts +2 -2
- package/components/Filters/helpers/tests/getChangedFilters.test.ts +92 -0
- package/components/Filters/helpers/tests/getNestedOptions.test.ts +31 -0
- package/components/Filters/helpers/tests/getNewRuntime.test.ts +82 -0
- package/components/Filters/index.ts +1 -1
- package/components/Layout/components/Visualization/index.tsx +3 -3
- package/components/Legend/Legend.Gradient.tsx +66 -23
- package/components/MultiSelect/multiselect.styles.css +2 -0
- package/components/NestedDropdown/NestedDropdown.tsx +2 -2
- package/components/RichTooltip/RichTooltip.tsx +37 -0
- package/components/RichTooltip/richTooltip.css +16 -0
- package/components/Table/Table.tsx +142 -142
- package/components/Table/components/Row.tsx +1 -1
- package/components/Table/table.styles.css +10 -0
- package/components/_stories/DataTable.stories.tsx +9 -2
- package/components/_stories/Table.stories.tsx +1 -1
- package/components/_stories/styles.scss +0 -4
- package/components/ui/Accordion.jsx +8 -1
- package/components/ui/Title/index.tsx +4 -1
- package/components/ui/Title/{Title.scss → title.styles.css} +0 -2
- package/components/ui/_stories/Colors.stories.mdx +220 -0
- package/components/ui/_stories/IconGallery.stories.mdx +14 -0
- package/components/ui/_stories/Title.stories.tsx +29 -4
- package/components/ui/accordion.styles.css +3 -0
- package/data/colorPalettes.js +0 -1
- package/dist/cove-main.css +3 -8
- package/dist/cove-main.css.map +1 -1
- package/helpers/constants.ts +6 -0
- package/helpers/cove/accessibility.ts +7 -8
- package/helpers/coveUpdateWorker.ts +5 -1
- package/helpers/filterOrderOptions.ts +17 -0
- package/helpers/isNumber.ts +20 -0
- package/helpers/isRightAlignedTableValue.js +1 -1
- package/helpers/pivotData.ts +16 -11
- package/helpers/tests/pivotData.test.ts +74 -0
- package/helpers/ver/4.25.3.ts +25 -2
- package/helpers/ver/4.25.4.ts +33 -0
- package/helpers/ver/tests/4.25.4.test.ts +24 -0
- package/helpers/viewports.ts +4 -0
- package/package.json +2 -3
- package/styles/_global-variables.scss +3 -0
- package/styles/_reset.scss +0 -6
- package/styles/v2/main.scss +0 -5
- package/types/General.ts +1 -0
- package/types/Legend.ts +1 -0
- package/LICENSE +0 -201
- package/components/ui/_stories/Colors.stories.tsx +0 -92
- package/components/ui/_stories/Icon.stories.tsx +0 -29
- package/helpers/cove/fontSettings.ts +0 -2
- package/helpers/isNumber.js +0 -24
- package/helpers/isNumberLog.js +0 -18
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.tooltip-link {
|
|
2
|
+
text-decoration: underline;
|
|
3
|
+
text-decoration-color: var(--cool-gray-90);
|
|
4
|
+
text-decoration-style: dotted;
|
|
5
|
+
text-decoration-thickness: 2px;
|
|
6
|
+
text-underline-offset: 0.25rem;
|
|
7
|
+
position: relative;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
color: var(--cool-gray-90);
|
|
10
|
+
font-family: var(--app-font-main);
|
|
11
|
+
font-size: 0.833rem !important;
|
|
12
|
+
}
|
|
13
|
+
.tooltip-link:hover {
|
|
14
|
+
text-decoration-color: #009ec1;
|
|
15
|
+
color: var(--cool-gray-90);
|
|
16
|
+
}
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
import { ReactNode } from 'react'
|
|
2
|
-
import Row from './components/Row'
|
|
3
|
-
import GroupRow from './components/GroupRow'
|
|
4
|
-
import { CellMatrix } from './types/CellMatrix'
|
|
5
|
-
import { RowType } from './types/RowType'
|
|
6
|
-
import { PreliminaryDataItem } from '@cdc/chart/src/types/ChartConfig'
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
type TableProps = {
|
|
10
|
-
childrenMatrix: CellMatrix | Map<string, CellMatrix>
|
|
11
|
-
noData?: boolean
|
|
12
|
-
tableName: string
|
|
13
|
-
caption: string
|
|
14
|
-
stickyHeader?: boolean
|
|
15
|
-
headContent: ReactNode
|
|
16
|
-
tableOptions: {
|
|
17
|
-
className: string
|
|
18
|
-
'aria-live'?: 'off' | 'assertive' | 'polite'
|
|
19
|
-
hidden?: boolean
|
|
20
|
-
'aria-rowcount'?: number
|
|
21
|
-
cellMinWidth?: number
|
|
22
|
-
}
|
|
23
|
-
wrapColumns?: boolean
|
|
24
|
-
hasRowType?: boolean // if it has row type then the first column is the row type which will explain how to render the row
|
|
25
|
-
viewport: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
26
|
-
preliminaryData?: PreliminaryDataItem[]
|
|
27
|
-
rightAlignedCols: object
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type Position = 'sticky'
|
|
31
|
-
|
|
32
|
-
const Table = ({
|
|
33
|
-
childrenMatrix,
|
|
34
|
-
noData,
|
|
35
|
-
tableName,
|
|
36
|
-
caption,
|
|
37
|
-
stickyHeader,
|
|
38
|
-
headContent,
|
|
39
|
-
tableOptions,
|
|
40
|
-
wrapColumns,
|
|
41
|
-
hasRowType,
|
|
42
|
-
viewport,
|
|
43
|
-
preliminaryData,
|
|
44
|
-
rightAlignedCols
|
|
45
|
-
}: TableProps) => {
|
|
46
|
-
const headStyle = stickyHeader ? { position: 'sticky' as Position, top: 0, zIndex: 2 } : {}
|
|
47
|
-
const isGroupedMatrix = !Array.isArray(childrenMatrix)
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<table {...tableOptions}>
|
|
51
|
-
<caption className='visually-hidden'>{caption}</caption>
|
|
52
|
-
{noData ? (
|
|
53
|
-
<tr>
|
|
54
|
-
<td className='py-5 text-center'>No Data</td>
|
|
55
|
-
</tr>
|
|
56
|
-
) : (
|
|
57
|
-
<>
|
|
58
|
-
<thead style={headStyle}>{headContent}</thead>
|
|
59
|
-
<tbody>
|
|
60
|
-
{isGroupedMatrix
|
|
61
|
-
? Array.from(childrenMatrix.keys()).flatMap(groupName => {
|
|
62
|
-
let colSpan = 0
|
|
63
|
-
const rows = childrenMatrix.get(groupName).map((row, i) => {
|
|
64
|
-
colSpan = row.length
|
|
65
|
-
const key = `${tableName}-${groupName}-row-${i}`
|
|
66
|
-
return (
|
|
67
|
-
<Row
|
|
68
|
-
preliminaryData={preliminaryData}
|
|
69
|
-
key={key}
|
|
70
|
-
rowKey={key}
|
|
71
|
-
childRow={row}
|
|
72
|
-
wrapColumns={wrapColumns}
|
|
73
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
74
|
-
viewport={viewport}
|
|
75
|
-
rightAlignedCols={rightAlignedCols}
|
|
76
|
-
/>
|
|
77
|
-
)
|
|
78
|
-
})
|
|
79
|
-
return [<GroupRow label={groupName} colSpan={colSpan} key={`${tableName}-${groupName}`} />, ...rows]
|
|
80
|
-
})
|
|
81
|
-
: childrenMatrix.map((childRow, i) => {
|
|
82
|
-
let childRowCopy = [...childRow]
|
|
83
|
-
let rowType = undefined
|
|
84
|
-
if (hasRowType) rowType = childRowCopy.shift()
|
|
85
|
-
const key = `${tableName}-row-${i}`
|
|
86
|
-
if (rowType === undefined) {
|
|
87
|
-
return (
|
|
88
|
-
<Row
|
|
89
|
-
preliminaryData={preliminaryData}
|
|
90
|
-
key={key}
|
|
91
|
-
rowKey={key}
|
|
92
|
-
childRow={childRow}
|
|
93
|
-
wrapColumns={wrapColumns}
|
|
94
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
95
|
-
viewport={viewport}
|
|
96
|
-
rightAlignedCols={rightAlignedCols}
|
|
97
|
-
/>
|
|
98
|
-
)
|
|
99
|
-
} else {
|
|
100
|
-
switch (rowType) {
|
|
101
|
-
case RowType.row_group:
|
|
102
|
-
return <GroupRow label={childRowCopy[0]} colSpan={childRowCopy.length} key={key} />
|
|
103
|
-
case RowType.total:
|
|
104
|
-
return (
|
|
105
|
-
<Row
|
|
106
|
-
preliminaryData={preliminaryData}
|
|
107
|
-
key={key}
|
|
108
|
-
rowKey={key}
|
|
109
|
-
childRow={childRowCopy}
|
|
110
|
-
isTotal={true}
|
|
111
|
-
wrapColumns={wrapColumns}
|
|
112
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
113
|
-
viewport={viewport}
|
|
114
|
-
rightAlignedCols={rightAlignedCols}
|
|
115
|
-
/>
|
|
116
|
-
)
|
|
117
|
-
case RowType.row_group_total:
|
|
118
|
-
return <GroupRow label={childRowCopy[0]} colSpan={1} key={key} data={childRowCopy.slice(1)} />
|
|
119
|
-
default:
|
|
120
|
-
return (
|
|
121
|
-
<Row
|
|
122
|
-
preliminaryData={preliminaryData}
|
|
123
|
-
key={key}
|
|
124
|
-
rowKey={key}
|
|
125
|
-
childRow={childRowCopy}
|
|
126
|
-
wrapColumns={wrapColumns}
|
|
127
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
128
|
-
viewport={viewport}
|
|
129
|
-
rightAlignedCols={rightAlignedCols}
|
|
130
|
-
/>
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
})}
|
|
135
|
-
</tbody>
|
|
136
|
-
</>
|
|
137
|
-
)}
|
|
138
|
-
</table>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export default Table
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
import Row from './components/Row'
|
|
3
|
+
import GroupRow from './components/GroupRow'
|
|
4
|
+
import { CellMatrix } from './types/CellMatrix'
|
|
5
|
+
import { RowType } from './types/RowType'
|
|
6
|
+
import { PreliminaryDataItem } from '@cdc/chart/src/types/ChartConfig'
|
|
7
|
+
import './table.styles.css'
|
|
8
|
+
|
|
9
|
+
type TableProps = {
|
|
10
|
+
childrenMatrix: CellMatrix | Map<string, CellMatrix>
|
|
11
|
+
noData?: boolean
|
|
12
|
+
tableName: string
|
|
13
|
+
caption: string
|
|
14
|
+
stickyHeader?: boolean
|
|
15
|
+
headContent: ReactNode
|
|
16
|
+
tableOptions: {
|
|
17
|
+
className: string
|
|
18
|
+
'aria-live'?: 'off' | 'assertive' | 'polite'
|
|
19
|
+
hidden?: boolean
|
|
20
|
+
'aria-rowcount'?: number
|
|
21
|
+
cellMinWidth?: number
|
|
22
|
+
}
|
|
23
|
+
wrapColumns?: boolean
|
|
24
|
+
hasRowType?: boolean // if it has row type then the first column is the row type which will explain how to render the row
|
|
25
|
+
viewport: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
26
|
+
preliminaryData?: PreliminaryDataItem[]
|
|
27
|
+
rightAlignedCols: object
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type Position = 'sticky'
|
|
31
|
+
|
|
32
|
+
const Table = ({
|
|
33
|
+
childrenMatrix,
|
|
34
|
+
noData,
|
|
35
|
+
tableName,
|
|
36
|
+
caption,
|
|
37
|
+
stickyHeader,
|
|
38
|
+
headContent,
|
|
39
|
+
tableOptions,
|
|
40
|
+
wrapColumns,
|
|
41
|
+
hasRowType,
|
|
42
|
+
viewport,
|
|
43
|
+
preliminaryData,
|
|
44
|
+
rightAlignedCols
|
|
45
|
+
}: TableProps) => {
|
|
46
|
+
const headStyle = stickyHeader ? { position: 'sticky' as Position, top: 0, zIndex: 2 } : {}
|
|
47
|
+
const isGroupedMatrix = !Array.isArray(childrenMatrix)
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<table {...tableOptions}>
|
|
51
|
+
<caption className='visually-hidden'>{caption}</caption>
|
|
52
|
+
{noData ? (
|
|
53
|
+
<tr>
|
|
54
|
+
<td className='py-5 text-center'>No Data</td>
|
|
55
|
+
</tr>
|
|
56
|
+
) : (
|
|
57
|
+
<>
|
|
58
|
+
<thead style={headStyle}>{headContent}</thead>
|
|
59
|
+
<tbody>
|
|
60
|
+
{isGroupedMatrix
|
|
61
|
+
? Array.from(childrenMatrix.keys()).flatMap(groupName => {
|
|
62
|
+
let colSpan = 0
|
|
63
|
+
const rows = childrenMatrix.get(groupName).map((row, i) => {
|
|
64
|
+
colSpan = row.length
|
|
65
|
+
const key = `${tableName}-${groupName}-row-${i}`
|
|
66
|
+
return (
|
|
67
|
+
<Row
|
|
68
|
+
preliminaryData={preliminaryData}
|
|
69
|
+
key={key}
|
|
70
|
+
rowKey={key}
|
|
71
|
+
childRow={row}
|
|
72
|
+
wrapColumns={wrapColumns}
|
|
73
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
74
|
+
viewport={viewport}
|
|
75
|
+
rightAlignedCols={rightAlignedCols}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
})
|
|
79
|
+
return [<GroupRow label={groupName} colSpan={colSpan} key={`${tableName}-${groupName}`} />, ...rows]
|
|
80
|
+
})
|
|
81
|
+
: childrenMatrix.map((childRow, i) => {
|
|
82
|
+
let childRowCopy = [...childRow]
|
|
83
|
+
let rowType = undefined
|
|
84
|
+
if (hasRowType) rowType = childRowCopy.shift()
|
|
85
|
+
const key = `${tableName}-row-${i}`
|
|
86
|
+
if (rowType === undefined) {
|
|
87
|
+
return (
|
|
88
|
+
<Row
|
|
89
|
+
preliminaryData={preliminaryData}
|
|
90
|
+
key={key}
|
|
91
|
+
rowKey={key}
|
|
92
|
+
childRow={childRow}
|
|
93
|
+
wrapColumns={wrapColumns}
|
|
94
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
95
|
+
viewport={viewport}
|
|
96
|
+
rightAlignedCols={rightAlignedCols}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
} else {
|
|
100
|
+
switch (rowType) {
|
|
101
|
+
case RowType.row_group:
|
|
102
|
+
return <GroupRow label={childRowCopy[0]} colSpan={childRowCopy.length} key={key} />
|
|
103
|
+
case RowType.total:
|
|
104
|
+
return (
|
|
105
|
+
<Row
|
|
106
|
+
preliminaryData={preliminaryData}
|
|
107
|
+
key={key}
|
|
108
|
+
rowKey={key}
|
|
109
|
+
childRow={childRowCopy}
|
|
110
|
+
isTotal={true}
|
|
111
|
+
wrapColumns={wrapColumns}
|
|
112
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
113
|
+
viewport={viewport}
|
|
114
|
+
rightAlignedCols={rightAlignedCols}
|
|
115
|
+
/>
|
|
116
|
+
)
|
|
117
|
+
case RowType.row_group_total:
|
|
118
|
+
return <GroupRow label={childRowCopy[0]} colSpan={1} key={key} data={childRowCopy.slice(1)} />
|
|
119
|
+
default:
|
|
120
|
+
return (
|
|
121
|
+
<Row
|
|
122
|
+
preliminaryData={preliminaryData}
|
|
123
|
+
key={key}
|
|
124
|
+
rowKey={key}
|
|
125
|
+
childRow={childRowCopy}
|
|
126
|
+
wrapColumns={wrapColumns}
|
|
127
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
128
|
+
viewport={viewport}
|
|
129
|
+
rightAlignedCols={rightAlignedCols}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})}
|
|
135
|
+
</tbody>
|
|
136
|
+
</>
|
|
137
|
+
)}
|
|
138
|
+
</table>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export default Table
|
|
@@ -43,7 +43,7 @@ const Row: FC<RowProps> = props => {
|
|
|
43
43
|
<Cell
|
|
44
44
|
ariaLabel={style?.color ? 'suppressed data' : ''}
|
|
45
45
|
key={rowKey + '__' + i}
|
|
46
|
-
style={{ whiteSpace, minWidth, textAlign, ...style }}
|
|
46
|
+
style={{ whiteSpace, minWidth, textAlign, textOverflow: 'ellipsis', ...style }}
|
|
47
47
|
isBold={isTotal}
|
|
48
48
|
>
|
|
49
49
|
{child}
|
|
@@ -8,6 +8,7 @@ import CityStateExample from './_mocks/example-city-state.json'
|
|
|
8
8
|
import { displayGeoName } from '@cdc/map/src/helpers/displayGeoName'
|
|
9
9
|
import rowTypeData from './_mocks/row_type.json'
|
|
10
10
|
import { TableConfig } from '../DataTable/types/TableConfig'
|
|
11
|
+
import ConfigContext from '@cdc/map/src/context'
|
|
11
12
|
|
|
12
13
|
const meta: Meta<typeof DataTable> = {
|
|
13
14
|
title: 'Components/Organisms/DataTable',
|
|
@@ -36,7 +37,6 @@ export const Primary: Story = {
|
|
|
36
37
|
export const CityState: Story = {
|
|
37
38
|
args: {
|
|
38
39
|
config: CityStateExample,
|
|
39
|
-
dataConfig: CityStateExample,
|
|
40
40
|
rawData: CityStateExample.data,
|
|
41
41
|
runtimeData: CityStateExample.data,
|
|
42
42
|
expandDataTable: true,
|
|
@@ -46,7 +46,14 @@ export const CityState: Story = {
|
|
|
46
46
|
columns: CityStateExample.columns,
|
|
47
47
|
applyLegendToRow: () => ['#000'],
|
|
48
48
|
displayGeoName
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
decorators: [
|
|
51
|
+
Story => (
|
|
52
|
+
<ConfigContext.Provider value={{ config: CityStateExample }}>
|
|
53
|
+
<Story />
|
|
54
|
+
</ConfigContext.Provider>
|
|
55
|
+
)
|
|
56
|
+
]
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
export const Grouped: Story = {
|
|
@@ -37,7 +37,7 @@ function createGroupMatrix(): Record<string, ReactNode[][]> {
|
|
|
37
37
|
return { group_1: [base, base], group_2: [base, base] }
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const Grouped: Story = {
|
|
41
41
|
args: {
|
|
42
42
|
childrenMatrix: createGroupMatrix(),
|
|
43
43
|
tableName: 'COVE Table',
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React, { Children } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Accordion as AccordionComponent,
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionItemHeading,
|
|
6
|
+
AccordionItemPanel,
|
|
7
|
+
AccordionItemButton
|
|
8
|
+
} from 'react-accessible-accordion'
|
|
3
9
|
import PropTypes from 'prop-types'
|
|
4
10
|
|
|
5
11
|
import Icon from './Icon'
|
|
6
12
|
import Tooltip from './Tooltip'
|
|
7
13
|
|
|
8
14
|
import '../../styles/v2/components/accordion.scss'
|
|
15
|
+
import './accordion.styles.css'
|
|
9
16
|
|
|
10
17
|
//Define the "slots" to be populated by subcomponents
|
|
11
18
|
const AccordionSection = children => children
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import parse from 'html-react-parser'
|
|
3
|
-
import './
|
|
3
|
+
import './title.styles.css'
|
|
4
|
+
import { Visualization } from '../../../types/Visualization'
|
|
4
5
|
|
|
5
6
|
type HeaderProps = {
|
|
6
7
|
title?: string
|
|
@@ -10,6 +11,8 @@ type HeaderProps = {
|
|
|
10
11
|
style?: React.CSSProperties
|
|
11
12
|
showTitle?: boolean
|
|
12
13
|
ariaLevel?: number
|
|
14
|
+
config: Visualization
|
|
15
|
+
theme?: string
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
const Title = (props: HeaderProps) => {
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
margin-bottom: 0 !important;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// THEMES
|
|
47
46
|
&.theme-purple {
|
|
48
47
|
background: #712177;
|
|
49
48
|
border-bottom-color: #b890bb;
|
|
@@ -94,7 +93,6 @@
|
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
// fix sparkline bottom margin gap
|
|
98
96
|
.type-sparkline.type-chart .cove-component__header {
|
|
99
97
|
margin: 0px !important;
|
|
100
98
|
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { Meta, ColorPalette, ColorItem } from '@storybook/blocks'
|
|
2
|
+
import colorPalettes from '@cdc/core/data/colorPalettes'
|
|
3
|
+
|
|
4
|
+
export const orderedPalettes = Object.keys(colorPalettes)
|
|
5
|
+
.sort()
|
|
6
|
+
.reduce((acc, key) => {
|
|
7
|
+
acc[key] = colorPalettes[key]
|
|
8
|
+
return acc
|
|
9
|
+
}, {})
|
|
10
|
+
|
|
11
|
+
export const paletteFriendlyNames = {
|
|
12
|
+
'yelloworangered': 'Yellow Orange Red',
|
|
13
|
+
'yelloworangebrown': 'Yellow Orange Brown',
|
|
14
|
+
'pinkpurple': 'Pink Purple',
|
|
15
|
+
'bluegreen': 'Blue Green',
|
|
16
|
+
'orangered': 'Orange Red',
|
|
17
|
+
'red': 'Red Scale',
|
|
18
|
+
'greenblue': 'Green Blue',
|
|
19
|
+
'yellowpurple': 'Yellow Purple',
|
|
20
|
+
'qualitative-bold': 'Bold Multi-Color',
|
|
21
|
+
'qualitative-soft': 'Soft Multi-Color',
|
|
22
|
+
'qualitative1': 'Multi-Color Set 1',
|
|
23
|
+
'qualitative2': 'Multi-Color Set 2',
|
|
24
|
+
'qualitative3': 'Multi-Color Set 3',
|
|
25
|
+
'qualitative4': 'Multi-Color Set 4',
|
|
26
|
+
'sequential-blue': 'Blue Sequential',
|
|
27
|
+
'sequential-blue-2-(MPX)': 'Blue Sequential Alt',
|
|
28
|
+
'sequential-blue-2(MPX)': 'Blue Sequential Alt',
|
|
29
|
+
'sequential-orange-(MPX)': 'Orange Sequential',
|
|
30
|
+
'sequential-orange(MPX)': 'Orange Sequential',
|
|
31
|
+
'sequential-green': 'Green Sequential',
|
|
32
|
+
'Sequential Blue': 'Blue Sequential',
|
|
33
|
+
'Sequential Blue Two': 'Blue Sequential Alt',
|
|
34
|
+
'Sequential Blue Three': 'Blue Sequential Extended',
|
|
35
|
+
'Sequential Orange': 'Orange Sequential',
|
|
36
|
+
'Sequential Orange Two': 'Orange Sequential Extended',
|
|
37
|
+
'Sequential Green': 'Green Sequential',
|
|
38
|
+
'monochrome-1': 'Blue Mono',
|
|
39
|
+
'monochrome-2': 'Purple Mono',
|
|
40
|
+
'monochrome-3': 'Lavender Mono',
|
|
41
|
+
'monochrome-4': 'Violet Mono',
|
|
42
|
+
'monochrome-5': 'Brown Mono',
|
|
43
|
+
'cool-1': 'Cool Green Blue',
|
|
44
|
+
'cool-2': 'Cool Blue Green',
|
|
45
|
+
'cool-3': 'Cool Purple Blue',
|
|
46
|
+
'cool-4': 'Cool Green Purple',
|
|
47
|
+
'cool-5': 'Cool Blue Purple',
|
|
48
|
+
'warm-1': 'Warm Red Peach',
|
|
49
|
+
'complementary-1': 'Blue Gold',
|
|
50
|
+
'complementary-2': 'Blue Orange',
|
|
51
|
+
'complementary-3': 'Purple Orange',
|
|
52
|
+
'complementary-4': 'Purple Gold',
|
|
53
|
+
'complementary-5': 'Pink Teal',
|
|
54
|
+
'colorblindsafe': 'Colorblind Safe',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const getPaletteName = (paletteName) => {
|
|
58
|
+
const isReversed = paletteName.endsWith('reverse');
|
|
59
|
+
const baseName = isReversed ? paletteName.slice(0, -7) : paletteName; // Remove 'reverse' suffix
|
|
60
|
+
const normalizedKey = baseName
|
|
61
|
+
.toLowerCase()
|
|
62
|
+
.replace(/\s+/g, '-')
|
|
63
|
+
.replace(/-/g, ' ')
|
|
64
|
+
.replace(/\(mpx\)/gi, ' (MonkeyPox)');
|
|
65
|
+
const friendlyName = paletteFriendlyNames[normalizedKey] || baseName
|
|
66
|
+
.replace(/-/g, ' ')
|
|
67
|
+
.replace(/\(mpx\)/gi, ' (MonkeyPox)');
|
|
68
|
+
|
|
69
|
+
const capitalizeWords = (str) => str.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
70
|
+
const formattedName = capitalizeWords(friendlyName);
|
|
71
|
+
|
|
72
|
+
return isReversed ? `${formattedName} (Reversed)` : formattedName;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
<Meta title="Design Systems/Colors" />
|
|
76
|
+
|
|
77
|
+
# Visualization Color Palettes
|
|
78
|
+
The color palettes are predefined sets of colors organized into categories like sequential, qualitative, and complementary groups. These groups are designed with visual clarity in mind to ensure a cohesive and effective representation of data. The palettes are listed alphabetically, with reversed versions placed directly next to their original counterparts to maintain consistency across the application. In the codebase, these palettes are dynamically applied to generate and display color schemes in various UI components, such as charts and visualizations.
|
|
79
|
+
|
|
80
|
+
<ColorPalette>
|
|
81
|
+
{Object.entries(orderedPalettes).map(([paletteName, colors]) => {
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<ColorItem
|
|
86
|
+
key={paletteName}
|
|
87
|
+
title={getPaletteName(paletteName)}
|
|
88
|
+
colors={colors}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
)}
|
|
92
|
+
</ColorPalette>
|
|
93
|
+
|
|
94
|
+
# CDC Specific & Additional Colors
|
|
95
|
+
These are additional color palettes that can be used for various UI components. When using these consult CDC Level documentation.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
<ColorPalette>
|
|
99
|
+
{[
|
|
100
|
+
{
|
|
101
|
+
title: 'Blue',
|
|
102
|
+
colors: {
|
|
103
|
+
Primary: '#005eaa',
|
|
104
|
+
Secondary: '#88c3ea',
|
|
105
|
+
Tertiary: '#c0e9ff',
|
|
106
|
+
Quaternary: '#edf9ff'
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
title: 'Purple',
|
|
111
|
+
colors: {
|
|
112
|
+
Primary: '#712177',
|
|
113
|
+
Secondary: '#b890bb',
|
|
114
|
+
Tertiary: '#e3d3e4',
|
|
115
|
+
Quaternary: '#f7f2f7'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: 'Brown',
|
|
120
|
+
colors: {
|
|
121
|
+
Primary: '#705043',
|
|
122
|
+
Secondary: '#ad907b',
|
|
123
|
+
Tertiary: '#d7ccc8',
|
|
124
|
+
Quaternary: '#f2ebe8'
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
title: 'Teal',
|
|
129
|
+
colors: {
|
|
130
|
+
Primary: '#00695c',
|
|
131
|
+
Secondary: '#4ebaaa',
|
|
132
|
+
Tertiary: '#ceece7',
|
|
133
|
+
Quaternary: '#ebf7f5'
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: 'Pink',
|
|
138
|
+
colors: {
|
|
139
|
+
Primary: '#af4448',
|
|
140
|
+
Secondary: '#e57373',
|
|
141
|
+
Tertiary: '#ffc2c2',
|
|
142
|
+
Quaternary: '#ffe7e7'
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
title: 'Orange',
|
|
147
|
+
colors: {
|
|
148
|
+
Primary: '#bb4d00',
|
|
149
|
+
Secondary: '#ffad42',
|
|
150
|
+
Tertiary: '#ffe97d',
|
|
151
|
+
Quaternary: '#fff4cf'
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: 'Slate',
|
|
156
|
+
colors: {
|
|
157
|
+
Primary: '#29434e',
|
|
158
|
+
Secondary: '#7e9ba5',
|
|
159
|
+
Tertiary: '#b6c6d2',
|
|
160
|
+
Quaternary: '#e2e8ed'
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
title: 'Indigo',
|
|
165
|
+
colors: {
|
|
166
|
+
Primary: '#26418f',
|
|
167
|
+
Secondary: '#92a6dd',
|
|
168
|
+
Tertiary: '#dee8ff',
|
|
169
|
+
Quaternary: '#f2f6ff'
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
title: 'Cyan',
|
|
174
|
+
colors: {
|
|
175
|
+
Primary: '#006778',
|
|
176
|
+
Secondary: '#65b0bd',
|
|
177
|
+
Tertiary: '#cce5e9',
|
|
178
|
+
Quaternary: '#ebf5f6'
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
title: 'Green',
|
|
183
|
+
colors: {
|
|
184
|
+
Primary: '#4b830d',
|
|
185
|
+
Secondary: '#84bc49',
|
|
186
|
+
Tertiary: '#dcedc8',
|
|
187
|
+
Quaternary: '#f1f8e9'
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
title: 'Amber',
|
|
192
|
+
colors: {
|
|
193
|
+
Primary: '#fbab18',
|
|
194
|
+
Secondary: '#ffd54f',
|
|
195
|
+
Tertiary: '#ffecb3',
|
|
196
|
+
Quaternary: '#fff7e1'
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
title: 'Grayscale',
|
|
201
|
+
colors: {
|
|
202
|
+
'Base Color': '#333',
|
|
203
|
+
'Lightest Gray': '#f2f2f2',
|
|
204
|
+
'Light Gray': '#c7c7c7',
|
|
205
|
+
'Medium Gray': '#565656',
|
|
206
|
+
'Dark Gray': '#333',
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
title: 'White',
|
|
211
|
+
colors: ['#FFF']
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
title: 'Red',
|
|
215
|
+
colors: ['#d8000c']
|
|
216
|
+
}
|
|
217
|
+
].map(({ title, colors }) => (
|
|
218
|
+
<ColorItem key={title} title={title} colors={colors} subtitle={'test'} />
|
|
219
|
+
))}
|
|
220
|
+
</ColorPalette>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, IconGallery, IconItem } from '@storybook/blocks';
|
|
2
|
+
import Icon, { ICON_TYPES } from '../Icon'
|
|
3
|
+
|
|
4
|
+
<Meta title="Design Systems/Iconography" />
|
|
5
|
+
|
|
6
|
+
# Iconography
|
|
7
|
+
|
|
8
|
+
<IconGallery>
|
|
9
|
+
{ICON_TYPES.map((name) => (
|
|
10
|
+
<IconItem name={name}>
|
|
11
|
+
<Icon display={name} />
|
|
12
|
+
</IconItem>
|
|
13
|
+
))}
|
|
14
|
+
</IconGallery>
|