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

build: upgrade to storybook 6.3 and convert to workspace #1231

Merged
merged 32 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8b508f0
build: upgrade to storybook 6.3 and convert to workspace
nickofthyme Jul 7, 2021
52fd1b6
chore: update and move storybook deps, fix style imports
nickofthyme Jul 7, 2021
b6694ac
fix: cleanup storybook, webpack and dependencies
nickofthyme Jul 14, 2021
fe6da97
refactor: upgrade docs to [email protected], move docs into main directory
nickofthyme Jul 14, 2021
68c5813
refactor: remove storybook-docs and leave docs seperate, fix docs errors
nickofthyme Jul 20, 2021
004b2b0
build: add theme and background options to sb toolbar
nickofthyme Jul 20, 2021
3483608
build: update lint and webpack configs
nickofthyme Jul 20, 2021
adbe4f2
refactor: update stories for sb config changes
nickofthyme Jul 20, 2021
552fa2c
refactor: more story and docs cleanup
nickofthyme Jul 20, 2021
5439e9b
style: cleanup storybook wrapper styles and theme switching
nickofthyme Jul 21, 2021
3fbcb21
fix: remove duplicated imports
nickofthyme Jul 21, 2021
1c4c267
build: update package.json and vrt server config
nickofthyme Jul 21, 2021
4bcd463
Merge branch 'master' into update-storybook
nickofthyme Jul 21, 2021
f7f8389
fix: correct linting errors from merge
nickofthyme Jul 21, 2021
724b76f
refactor: simplify parameters docs.description.story to just markdown
nickofthyme Jul 22, 2021
edca1d3
test: push vrt screenshots to compare diff and fix
nickofthyme Jul 22, 2021
69f9239
fix: hot reloading for pkg/charts/src files
nickofthyme Jul 22, 2021
060dda0
fix: vrt issue with debug setting
nickofthyme Jul 22, 2021
4c98551
fix: revert background color changes, update vrt
nickofthyme Jul 22, 2021
b26cc77
fix: match bg color for existing root selector tests
nickofthyme Jul 22, 2021
6cfb5ba
fix: use theme and bg color from url globals param
nickofthyme Jul 22, 2021
66f6181
test: update old vrt
nickofthyme Jul 22, 2021
1c1e216
WIP
nickofthyme Jul 22, 2021
a644f93
fix: vrt tests failing due to bg color and theme missing
nickofthyme Jul 26, 2021
218ef1d
Merge branch 'master' into update-storybook
nickofthyme Jul 27, 2021
02b5f99
fix: type errors and update package.jsons
nickofthyme Jul 28, 2021
a612367
fix: remaining build errors and hook error
nickofthyme Jul 28, 2021
8646195
fix: prettier and linting issues
nickofthyme Jul 28, 2021
651e7e8
test: update vrt screenshots after merging with master
nickofthyme Jul 28, 2021
3a24c00
Merge branch 'master' into update-storybook
nickofthyme Jul 28, 2021
850ee3c
Merge branch 'master' into update-storybook
nickofthyme Jul 29, 2021
b489fda
build: increase server timeout
nickofthyme Jul 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 15 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,7 @@ module.exports = {
'implicit-arrow-linebreak': 0,
'function-call-argument-newline': ['error', 'consistent'],
'array-bracket-newline': ['error', 'consistent'],
'array-element-newline': [
'error',
{
ArrayExpression: 'consistent',
ArrayPattern: 'consistent',
},
],
'array-element-newline': 0,
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
'object-curly-newline': [
'error',
{
Expand Down Expand Up @@ -208,7 +202,20 @@ module.exports = {
'error',
{
'newlines-between': 'always',
groups: ['builtin', 'external', ['parent', 'sibling', 'index', 'internal']],
groups: ['builtin', 'external', 'unknown', ['parent', 'sibling', 'index', 'internal']],

// seperates internal published packages from external packages
pathGroups: [
{
pattern: '@elastic/charts',
group: 'unknown',
},
{
pattern: '@elastic/charts/**',
group: 'unknown',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
alphabetize: { order: 'asc', caseInsensitive: true }, // todo replace with directory gradient ordering
},
],
Expand Down
2 changes: 1 addition & 1 deletion docs/0-Intro/0-Intro.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from "@storybook/addon-docs/blocks";
import { Meta, Story } from "@storybook/addon-docs";

<Meta title="Introduction/Intro and Consuming Elastic Charts" />

Expand Down
28 changes: 14 additions & 14 deletions docs/0-Intro/1-Overview.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Chart, Datum, Partition, PartitionLayout, Settings } from '../../packages/charts/src';
import { mocks } from '../../packages/charts/src/mocks/hierarchical/index';
import { config } from '../../packages/charts/src/chart_types/partition_chart/layout/config';
import { ShapeTreeNode } from '../../packages/charts/src/chart_types/partition_chart/layout/types/viewmodel_types';
import { Chart, Datum, Partition, PartitionLayout, Settings } from '@elastic/charts';
import { mocks } from '@elastic/charts/src/mocks/hierarchical/index';
import { config } from '@elastic/charts/src/chart_types/partition_chart/layout/config';
import { ShapeTreeNode } from '@elastic/charts/src/chart_types/partition_chart/layout/types/viewmodel_types';
import {
categoricalFillColor,
discreteColor,
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
colorBrewerCategoricalStark9,
countryLookup,
indexInterpolatedFillColor,
Expand All @@ -12,7 +12,7 @@ import {
productLookup,
regionLookup,
} from '../../stories/utils/utils';
import { Meta, Story } from "@storybook/addon-docs/blocks";
import { Meta, Story } from "@storybook/addon-docs";

<Meta title="Introduction/Elastic Charts Overview" />

Expand Down Expand Up @@ -281,7 +281,7 @@ config: {
`textInvertible` will have to be set to true for `textContrast` to be set as well. To see an example of where this applies, please see the Partitions Background story within Stylings. Charts are included below but are static.
If you have `textInvertible` set to true, but do not have `textContrast` set to true, then the red slices, Europe, North America, and Asia, will have white text:

<Chart className="story-chart">
<Chart>
<Settings theme={{background : {color: `rgba(155, 155, 155, 1)`}}} />
<Partition
id="spec_1"
Expand All @@ -294,7 +294,7 @@ If you have `textInvertible` set to true, but do not have `textContrast` set to
nodeLabel: (d) => productLookup[d].name,
shape: {
fillColor: (d) => {
return categoricalFillColor(colorBrewerCategoricalStark9, 0.7)(d.sortIndex);
return discreteColor(colorBrewerCategoricalStark9, 0.7)(d.sortIndex);
},
},
},
Expand All @@ -303,7 +303,7 @@ If you have `textInvertible` set to true, but do not have `textContrast` set to
nodeLabel: (d) => regionLookup[d].regionName,
shape: {
fillColor: (d) => {
return categoricalFillColor(colorBrewerCategoricalStark9, 0.5)(d.parent.sortIndex);
return discreteColor(colorBrewerCategoricalStark9, 0.5)(d.parent.sortIndex);
},
},
},
Expand All @@ -312,7 +312,7 @@ If you have `textInvertible` set to true, but do not have `textContrast` set to
nodeLabel: (d) => countryLookup[d].name,
shape: {
fillColor: (d) => {
return categoricalFillColor(colorBrewerCategoricalStark9, 0.3)(d[MODEL_KEY].parent.sortIndex);
return discreteColor(colorBrewerCategoricalStark9, 0.3)(d[MODEL_KEY].parent.sortIndex);
},
},
},
Expand Down Expand Up @@ -351,7 +351,7 @@ If you have `textInvertible` set to true, but do not have `textContrast` set to

Now if you set the `textContrast` to true as well, these slices also become black in text color:

<Chart className="story-chart">
<Chart>
<Settings theme={{background : {color: `rgba(155, 155, 155, 1)`}}} />
<Partition
id="spec_1"
Expand All @@ -364,7 +364,7 @@ Now if you set the `textContrast` to true as well, these slices also become blac
nodeLabel: (d) => productLookup[d].name,
shape: {
fillColor: (d) => {
return categoricalFillColor(colorBrewerCategoricalStark9, 0.7)(d.sortIndex);
return discreteColor(colorBrewerCategoricalStark9, 0.7)(d.sortIndex);
},
},
},
Expand All @@ -373,7 +373,7 @@ Now if you set the `textContrast` to true as well, these slices also become blac
nodeLabel: (d) => regionLookup[d].regionName,
shape: {
fillColor: (d) => {
return categoricalFillColor(colorBrewerCategoricalStark9, 0.5)(d.parent.sortIndex);
return discreteColor(colorBrewerCategoricalStark9, 0.5)(d.parent.sortIndex);
},
},
},
Expand All @@ -382,7 +382,7 @@ Now if you set the `textContrast` to true as well, these slices also become blac
nodeLabel: (d) => countryLookup[d].name,
shape: {
fillColor: (d) => {
return categoricalFillColor(colorBrewerCategoricalStark9, 0.3)(d[MODEL_KEY].parent.sortIndex);
return discreteColor(colorBrewerCategoricalStark9, 0.3)(d[MODEL_KEY].parent.sortIndex);
},
},
},
Expand Down
22 changes: 11 additions & 11 deletions docs/1-Typesofchart/0-Bar.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Description, Story, Preview } from "@storybook/addon-docs/blocks";
import { Meta, Description, Story, Preview } from "@storybook/addon-docs";
import { boolean, color, number, select } from '@storybook/addon-knobs';
import {
Chart,
Expand All @@ -11,8 +11,8 @@ import {
Position,
timeFormatter,
niceTimeFormatByDay,
} from '../../packages/charts/src';
import { KIBANA_METRICS } from '../../packages/charts/src/utils/data_samples/test_dataset_kibana';
} from '@elastic/charts';
import { KIBANA_METRICS } from '@elastic/charts/src/utils/data_samples/test_dataset_kibana';
import BarSeriesPropsTable from '../2-ChartPropTables/9-BarProps.md';
import BarWAxisPropsTable from '../2-ChartPropTables/10-BarWAxisProps.md';

Expand All @@ -22,7 +22,7 @@ import BarWAxisPropsTable from '../2-ChartPropTables/10-BarWAxisProps.md';

[source](https://datavizproject.com/data-type/bar-chart/)

<Chart className={'story-chart'}>
<Chart>
<BarSeries
id={'bars1'}
name={'Simple bar series'}
Expand All @@ -46,7 +46,7 @@ Below is a very basic bar chart from Elastic Charts. A bar chart is a chart with
Bar charts provide a visual presentation of categorical data. Categorical data is a grouping of data into discrete groups, such as months of the year, age group, shoe sizes, and animals. These categories are usually qualitative. Bars on the chart may be arranged in any order.

``` js
<Chart className={'story-chart'}>
<Chart>
<BarSeries
id={'bars1'}
name={'Simple bar series'}
Expand Down Expand Up @@ -75,7 +75,7 @@ Additonal prop tables for the following bar charts can be found in `Chart Refere

This chart now includes x and y axes. These axes can be `linear`, `ordinal` or `time`.

<Chart className={'story-chart'}>
<Chart>
<Settings theme={LIGHT_THEME} />
<Axis id={'bottom'} position={Position.Bottom} title={'Bottom axis'} showOverlappingTicks={true} />
<Axis
Expand Down Expand Up @@ -105,7 +105,7 @@ This chart now includes x and y axes. These axes can be `linear`, `ordinal` or `
<details>

```js
<Chart className={'story-chart'}>
<Chart>
<Settings theme={LIGHT_THEME} />
<Axis id={'bottom'} position={Position.Bottom} title={'Bottom axis'} showOverlappingTicks={true} />
<Axis
Expand Down Expand Up @@ -135,7 +135,7 @@ This chart now includes x and y axes. These axes can be `linear`, `ordinal` or `

And below is an example of an `ordinal` x axis bar chart

<Chart className={'story-chart'}>
<Chart>
<Axis id={'bottom'} position={Position.Bottom} title={'Bottom axis'} showOverlappingTicks={true} />
<Axis
id={'left2'}
Expand All @@ -162,7 +162,7 @@ And below is an example of an `ordinal` x axis bar chart

```js

<Chart className={'story-chart'}>
<Chart>
<Axis id={'bottom'} position={Position.Bottom} title={'Bottom axis'} showOverlappingTicks={true} />
<Axis
id={'left2'}
Expand Down Expand Up @@ -190,7 +190,7 @@ And below is an example of an `ordinal` x axis bar chart
</details>

Here is an example of a `time` x axis
<Chart className={'story-chart'}>
<Chart>
<Settings debug={boolean('debug', false)} />
<Axis
id={'bottom'}
Expand Down Expand Up @@ -219,7 +219,7 @@ Here is an example of a `time` x axis
<details>

```js
<Chart className={'story-chart'}>
<Chart>
<Settings debug={boolean('debug', false)} />
<Axis
id={'bottom'}
Expand Down
14 changes: 7 additions & 7 deletions docs/1-Typesofchart/1-Area.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from "@storybook/addon-docs/blocks";
import { Meta, Story } from "@storybook/addon-docs";
import {
AreaSeries,
Axis,
Expand All @@ -10,8 +10,8 @@ import {
ScaleType,
Settings,
timeFormatter,
} from '../../packages/charts/src';
import { KIBANA_METRICS } from '../../packages/charts/src/utils/data_samples/test_dataset_kibana';
} from '@elastic/charts';
import { KIBANA_METRICS } from '@elastic/charts/src/utils/data_samples/test_dataset_kibana';

<Meta title="Types of charts/Area Charts/Basic and with axes" />

Expand All @@ -23,7 +23,7 @@ Area charts often used to show overall trends over time rather than specific val

[source](https://datavizproject.com/data-type/area-chart/)

<Chart className={'story-chart'}>
<Chart>
<AreaSeries
id={'areas1'}
xScaleType={ScaleType.Time}
Expand All @@ -41,7 +41,7 @@ The code snippet for the area chart above is found in the details section below.
<details>

```js
<Chart className={'story-chart'}>
<Chart>
<AreaSeries
id={'areas1'}
xScaleType={ScaleType.Time}
Expand All @@ -56,7 +56,7 @@ The code snippet for the area chart above is found in the details section below.

Here is the same chart including axes

<Chart className={'story-chart'}>
<Chart>
<Axis
id={'bottom'}
title={'timestamp per 1 minute'}
Expand Down Expand Up @@ -91,7 +91,7 @@ To only have an area chart without axes, do not include the `<Axis/>` components
<details>

```js
<Chart className={'story-chart'}>
<Chart>
<Axis
id={'bottom'}
title={'timestamp per 1 minute'}
Expand Down
14 changes: 7 additions & 7 deletions docs/1-Typesofchart/2-Line.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
ScaleType,
Settings,
timeFormatter,
} from '../../packages/charts/src';
import { KIBANA_METRICS } from '../../packages/charts/src/utils/data_samples/test_dataset_kibana';
import { TSVB_DATASET } from '../../packages/charts/src/utils/data_samples/test_dataset_tsvb';
} from '@elastic/charts';
import { KIBANA_METRICS } from '@elastic/charts/src/utils/data_samples/test_dataset_kibana';
import { TSVB_DATASET } from '@elastic/charts/src/utils/data_samples/test_dataset_tsvb';

<Meta title="Types of charts/Line Charts/Basic and with axes" />

Expand All @@ -23,7 +23,7 @@ A line chart is similar to the spline graph, but the spline graph draws a curved

[source](https://datavizproject.com/data-type/line-chart/)

<Chart className={'story-chart'}>
<Chart>
<LineSeries
id={'lines1'}
xScaleType={ScaleType.Time}
Expand All @@ -40,7 +40,7 @@ The data is generated from kibana metrics data
<details>

```js
<Chart className={'story-chart'}>
<Chart>
<LineSeries
id={'lines1'}
xScaleType={ScaleType.Time}
Expand All @@ -55,7 +55,7 @@ The data is generated from kibana metrics data

Here is a `linear x axis` line chart

<Chart className={'story-chart'}>
<Chart>
<Axis
id={'bottom'}
position={Position.Bottom}
Expand Down Expand Up @@ -89,7 +89,7 @@ Notice how the `<Axis position={Position.Left}/>` includes a tickFormat prop to
<details>

```js
<Chart className={'story-chart'}>
<Chart>

<Axis
id={'bottom'}
Expand Down
Loading