Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update elastic charts to 20.0.2 #3792

Merged
merged 13 commits into from
Aug 6, 2020
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@elastic/charts": "^19.6.3",
"@elastic/charts": "^20.0.0",
"@elastic/datemath": "^5.0.2",
"@elastic/eslint-config-kibana": "^0.15.0",
"@svgr/core": "5.0.1",
Expand Down Expand Up @@ -220,5 +220,8 @@
"react": "^16.12",
"react-dom": "^16.12",
"typescript": "^3.7.2"
},
"optionalDependencies": {
"@elastic/charts": "^20.0.0"
}
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved
}
39 changes: 34 additions & 5 deletions src/components/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,41 @@ export type PropsForButton<T, P = {}> = T &
} & P;

/**
* Makes all recursive keys optional
* Replaces all properties on any type as optional, includes nested types
*
* @example
* ```ts
* interface Person {
* name: string;
* age?: number;
* spouse: Person;
* children: Person[];
* }
* type PartialPerson = RecursivePartial<Person>;
* // results in
* interface PartialPerson {
* name?: string;
* age?: number;
* spouse?: RecursivePartial<Person>;
* children?: RecursivePartial<Person>[]
* }
* ```
*/
export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends Array<infer U>
[P in keyof T]?: T[P] extends NonAny[] // checks for nested any[]
? T[P]
: T[P] extends readonly NonAny[] // checks for nested ReadonlyArray<any>
? T[P]
: T[P] extends Array<infer U>
? Array<RecursivePartial<U>>
: T[P] extends object
? RecursivePartial<T[P]>
: T[P]
: T[P] extends ReadonlyArray<infer U> // eslint-disable-line @typescript-eslint/array-type
? ReadonlyArray<RecursivePartial<U>> // eslint-disable-line @typescript-eslint/array-type
: T[P] extends Set<infer V> // checks for Sets
? Set<RecursivePartial<V>>
: T[P] extends Map<infer K, infer V> // checks for Maps
? Map<K, RecursivePartial<V>>
: T[P] extends NonAny // checks for primative values
? T[P]
: RecursivePartial<T[P]> // recurse for all non-array and non-primative values
};
type NonAny = number | boolean | string | symbol | null;
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 13 additions & 7 deletions src/themes/charts/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,33 @@ function createTheme(colors: any): EuiChartThemeType {
histogramPadding: 0.05,
},
axes: {
axisTitleStyle: {
axisTitle: {
fontSize: 12,
fontFamily: fontFamily,
fill: colors.euiColorDarkestShade.rgba,
padding: 10,
padding: {
inner: 10,
outer: 0,
},
},
axisLineStyle: {
axisLine: {
stroke: colors.euiColorChartLines.rgba,
},
tickLabelStyle: {
tickLabel: {
fontSize: 10,
fontFamily: fontFamily,
fill: colors.euiColorDarkShade.rgba,
padding: 8,
padding: {
outer: 8,
inner: 10,
},
},
tickLineStyle: {
tickLine: {
visible: false,
stroke: colors.euiColorChartLines.rgba,
strokeWidth: 1,
},
gridLineStyle: {
gridLine: {
horizontal: {
visible: true,
stroke: colors.euiColorChartLines.rgba,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1275,10 +1275,10 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@elastic/charts@^19.6.3":
version "19.6.3"
resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-19.6.3.tgz#c23a1d7a8e245b1a800a3a4ef5fc4378b0da5e74"
integrity sha512-lB+rOODUKYZvsWCAcCxtAu8UxdZ2yIjZs+cjXwO1SlngY+jo+gc6XoEZG4kAczRPcr6cMdHesZ8LmFr3Enle5Q==
"@elastic/charts@^20.0.0":
version "20.0.2"
resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-20.0.2.tgz#e64bd11b75576e87e794c23b0bca2d0ead83149a"
integrity sha512-qPua1PcnYfSYEU9ql99BWw5NxqHWBkPFAxlqvA+4vaE4IxXR7IWwFHFgyJY9v1qnQrxc+lN2AWdETJbREPC1nA==
dependencies:
"@popperjs/core" "^2.4.0"
chroma-js "^2.1.0"
Expand Down