Skip to content

Commit efaf9ed

Browse files
authored
Generate a starter storybook from the docs (#5440)
1 parent 658423e commit efaf9ed

37 files changed

+812
-100
lines changed

.circleci/comment.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ async function run() {
5757
[Publish stats](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/publish-stats/publish.json)
5858
[Size diff since last release](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/publish-stats/size-diff.txt)
5959
[Docs](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/docs/index.html)
60-
[Storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook/index.html)`
60+
[Storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook/index.html)
61+
[RAC Starter Storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/starter-storybook/index.html)`
6162
});
6263
}
6364
} catch (error) {

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ packages/react-aria-components/dist
1010
packages/react-stately/dist
1111
packages/dev/storybook-builder-parcel/preview.js
1212
examples/**
13+
starters/**

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,16 @@ website:
110110
yarn build:docs --public-url /reactspectrum/$$(git rev-parse HEAD)/docs --dist-dir dist/$$(git rev-parse HEAD)/docs
111111

112112
website-production:
113-
node scripts/buildWebsite.js
113+
node scripts/buildWebsite.js $$PUBLIC_URL
114114
cp packages/dev/docs/pages/robots.txt dist/production/docs/robots.txt
115+
$(MAKE) starter
116+
cd starters/docs && zip -r react-aria-starter.zip . -x .gitignore .DS_Store "node_modules/*" "storybook-static/*"
117+
mv starters/docs/react-aria-starter.zip dist/production/docs/react-aria-starter.$$(git rev-parse --short HEAD).zip
115118

116119
check-examples:
117120
node scripts/extractExamples.mjs
118121
yarn tsc --project dist/docs-examples/tsconfig.json
122+
123+
starter:
124+
node scripts/extractStarter.mjs
125+
cd starters/docs && yarn && yarn tsc

packages/@react-aria/example-theme/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"description": "Spectrum UI components in React",
55
"license": "Apache-2.0",
66
"source": "src/index.css",
7-
"dist": "dist/index.css",
7+
"out": "dist/index.css",
88
"main": "dist/index.css",
99
"targets": {
1010
"main": false,
11-
"dist": {
11+
"out": {
1212
"optimize": false
1313
}
1414
},

packages/dev/parcel-transformer-mdx-docs/processCSS.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = async function processCSS(cssCode, asset, options) {
3838
if (path.extname(specifier) === '') {
3939
// Assume this is a package.
4040
specifier += '/src/index.css';
41+
return require.resolve(specifier);
4142
}
4243

4344
let baseDir = process.env.DOCS_ENV === 'production' ? 'docs' : 'packages';

packages/react-aria-components/docs/Breadcrumbs.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import {Breadcrumbs, Breadcrumb, Link} from 'react-aria-components';
6565
margin: 0;
6666
padding: 0;
6767
font-size: 18px;
68+
color: var(--text-color);
6869

6970
.react-aria-Breadcrumb:not(:last-child)::after {
7071
content: '';

packages/react-aria-components/docs/Checkbox.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import {Checkbox} from 'react-aria-components';
6868
align-items: center;
6969
gap: 0.571rem;
7070
font-size: 1.143rem;
71+
color: var(--text-color);
7172
forced-color-adjust: none;
7273

7374
.checkbox {

packages/react-aria-components/docs/CheckboxGroup.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,19 @@ import {CheckboxGroup, Checkbox, Label} from 'react-aria-components';
7272
<details>
7373
<summary style={{fontWeight: 'bold'}}><ChevronRight size="S" /> Show CSS</summary>
7474
```css hidden
75-
@import "@react-aria/example-theme";
7675
@import './Checkbox.mdx' layer(checkbox);
7776
@import './Form.mdx' layer(form);
7877
@import './Button.mdx' layer(button);
7978
```
8079

8180
```css
81+
@import "@react-aria/example-theme";
82+
8283
.react-aria-CheckboxGroup {
8384
display: flex;
8485
flex-direction: column;
8586
gap: 0.571rem;
87+
color: var(--text-color);
8688
}
8789
```
8890

@@ -294,9 +296,11 @@ import {Form, FieldError, Button} from 'react-aria-components';
294296
<summary style={{fontWeight: 'bold'}}><ChevronRight size="S" /> Show CSS</summary>
295297

296298
```css
297-
.react-aria-FieldError {
298-
font-size: 12px;
299-
color: var(--invalid-color);
299+
.react-aria-CheckboxGroup {
300+
.react-aria-FieldError {
301+
font-size: 12px;
302+
color: var(--invalid-color);
303+
}
300304
}
301305
```
302306

packages/react-aria-components/docs/ComboBox.mdx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,13 @@ import {ComboBox, Label, Input, Button, Popover, ListBox, ListBoxItem} from 'rea
8383
@import "@react-aria/example-theme";
8484

8585
.react-aria-ComboBox {
86+
color: var(--text-color);
87+
8688
.react-aria-Input {
8789
margin: 0;
8890
font-size: 1.072rem;
91+
background: var(--field-background);
92+
color: var(--field-text-color);
8993
border: 1px solid var(--border-color);
9094
border-radius: 6px;
9195
padding: 0.286rem 2rem 0.286rem 0.571rem;
@@ -109,11 +113,16 @@ import {ComboBox, Label, Input, Button, Popover, ListBox, ListBoxItem} from 'rea
109113
height: 1.429rem;
110114
padding: 0;
111115
font-size: 0.857rem;
116+
117+
&[data-pressed] {
118+
box-shadow: none;
119+
background: var(--highlight-background);
120+
}
112121
}
113122
}
114123

115124
.react-aria-Popover[data-trigger=ComboBox] {
116-
width: var(--trigger-width);
125+
width: var(--trigger-width);
117126

118127
.react-aria-ListBox {
119128
display: block;

packages/react-aria-components/docs/DateField.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ import {DateField, Label, DateInput, DateSegment} from 'react-aria-components';
6565
```css
6666
@import "@react-aria/example-theme";
6767

68+
.react-aria-DateField {
69+
color: var(--text-color);
70+
}
71+
6872
.react-aria-DateInput {
6973
display: flex;
7074
padding: 4px;
@@ -415,9 +419,11 @@ import {Form, FieldError, Button} from 'react-aria-components';
415419
}
416420
}
417421

418-
.react-aria-FieldError {
419-
font-size: 12px;
420-
color: var(--invalid-color);
422+
.react-aria-DateField {
423+
.react-aria-FieldError {
424+
font-size: 12px;
425+
color: var(--invalid-color);
426+
}
421427
}
422428
```
423429

0 commit comments

Comments
 (0)