Skip to content

Commit cd91f8a

Browse files
authored
Tailwind CSS starter kit (#5666)
1 parent d994fb1 commit cd91f8a

File tree

123 files changed

+1412
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1412
-506
lines changed

.circleci/comment.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ 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)
61-
[RAC Starter Storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/starter-storybook/index.html)`
60+
[Storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook/index.html)`
6261
});
6362
}
6463
} catch (error) {

Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ website:
113113
website-production:
114114
node scripts/buildWebsite.js $$PUBLIC_URL
115115
cp packages/dev/docs/pages/robots.txt dist/production/docs/robots.txt
116-
$(MAKE) starter
117-
cd starters/docs && zip -r react-aria-starter.zip . -x .gitignore .DS_Store "node_modules/*" "storybook-static/*"
118-
mv starters/docs/react-aria-starter.zip dist/production/docs/react-aria-starter.$$(git rev-parse --short HEAD).zip
116+
$(MAKE) starter-zip
117+
$(MAKE) tailwind-starter
119118

120119
check-examples:
121120
node scripts/extractExamples.mjs
@@ -124,3 +123,18 @@ check-examples:
124123
starter:
125124
node scripts/extractStarter.mjs
126125
cd starters/docs && yarn && yarn tsc
126+
127+
starter-zip: starter
128+
cp LICENSE starters/docs/.
129+
cd starters/docs && zip -r react-aria-starter.zip . -x .gitignore .DS_Store "node_modules/*" "storybook-static/*"
130+
mv starters/docs/react-aria-starter.zip dist/production/docs/react-aria-starter.$$(git rev-parse --short HEAD).zip
131+
cd starters/docs && yarn build-storybook
132+
mv starters/docs/storybook-static dist/production/docs/react-aria-starter
133+
134+
tailwind-starter:
135+
cp LICENSE starters/tailwind/.
136+
cd starters/tailwind && yarn && yarn tsc
137+
cd starters/tailwind && zip -r react-aria-tailwind-starter.zip . -x .gitignore .DS_Store "node_modules/*" "storybook-static/*"
138+
mv starters/tailwind/react-aria-tailwind-starter.zip dist/production/docs/react-aria-tailwind-starter.$$(git rev-parse --short HEAD).zip
139+
cd starters/tailwind && yarn build-storybook
140+
mv starters/tailwind/storybook-static dist/production/docs/react-aria-tailwind-starter

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
"sinon": "^7.3.1",
169169
"storybook-dark-mode": "^1.1.1-canary.120.3843.0",
170170
"tailwind-variants": "^0.1.18",
171-
"tailwindcss": "^3.2.2",
171+
"tailwindcss": "^3.4.0",
172172
"tailwindcss-animate": "^1.0.7",
173173
"tempy": "^0.5.0",
174174
"typescript": "5.2.2",

packages/dev/docs/pages/react-aria/getting-started.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export default Layout;
1212

1313
import ChevronRight from '@spectrum-icons/workflow/ChevronRight';
1414
import styles from '@react-spectrum/docs/src/docs.css';
15-
import {ResourceCard} from '@react-spectrum/docs/src/ResourceCard';
16-
import {spawnSync} from 'child_process';
15+
import {StarterKits} from '@react-spectrum/docs/src/StarterKits';
1716

1817
---
1918
category: Introduction
@@ -220,14 +219,11 @@ This is a quick way to get started, but you can also create your own custom clas
220219

221220
Check out our [styling guide](styling.html) to learn more about styling, states, render props, working with Tailwind CSS, and animation.
222221

223-
## Starter kit
222+
## Starter kits
224223

225-
To help kick-start your project, we offer a starter kit that includes example implementations of all React Aria components, along with styles from the docs. It also comes with a pre-configured [Storybook](https://storybook.js.org/) that you can experiment with, or use as a starting point for your own component library.
224+
To help kick-start your project, we offer starter kits that include example implementations of all React Aria components with various styling solutions. All components are fully styled, including support for dark mode, high contrast mode, and all UI states. Each starter comes with a pre-configured [Storybook](https://storybook.js.org/) that you can experiment with, or use as a starting point for your own component library.
226225

227-
<ResourceCard
228-
type="Storybook"
229-
url={`../react-aria-starter.${process.env.GIT_HASH || spawnSync('git', ['rev-parse', '--short', 'HEAD']).stdout.toString().trim()}.zip`}
230-
style={{marginTop: 36}} />
226+
<StarterKits />
231227

232228
## Hooks
233229

packages/dev/docs/pages/react-aria/home.global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@layer utilities {
1818
.focus-ring {
19-
@apply outline outline-0 outline-blue-600 focus-visible:outline-2;
19+
@apply outline outline-0 outline-blue-600 dark:outline-blue-500 focus-visible:outline-2;
2020
}
2121
}
2222

packages/dev/docs/pages/react-aria/home/A11y.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export function A11y() {
207207
), document.body)}
208208
<Select className="group flex flex-col gap-1" selectedKey={selectedKey} onSelectionChange={cursorRect ? undefined : setSelectedKey} isOpen={isOpen} onOpenChange={cursorRect ? undefined : setOpen}>
209209
<Label>Permissions</Label>
210-
<Button className="flex items-center text-start gap-4 w-full cursor-default border border-black/10 dark:border-white/10 shadow-[inset_0_1px_0_0_rgba(255,255,255,0.1)] dark:shadow-none rounded-lg pl-3 pr-2 py-2 min-w-[150px] transition bg-gray-50 hover:bg-gray-100 pressed:bg-gray-200 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:pressed:bg-zinc-500 group-invalid:border-red-600 disabled:text-gray-200 dark:disabled:text-zinc-600 outline-none focus-visible:outline-blue-600 outline-offset-2">
210+
<Button className="flex items-center text-start gap-4 w-full cursor-default border border-black/10 dark:border-white/10 shadow-[inset_0_1px_0_0_rgba(255,255,255,0.1)] dark:shadow-none rounded-lg pl-3 pr-2 py-2 min-w-[150px] transition bg-gray-50 hover:bg-gray-100 pressed:bg-gray-200 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:pressed:bg-zinc-500 group-invalid:border-red-600 disabled:text-gray-200 dark:disabled:text-zinc-600 outline-none focus-visible:outline-blue-600 dark:focus-visible:outline-blue-500 outline-offset-2">
211211
<SelectValue className="flex-1 text-sm text-gray-800 dark:text-zinc-300 placeholder-shown:italic" />
212212
<ChevronDown className="w-4 h-4 text-gray-600 dark:text-zinc-400" />
213213
</Button>

packages/dev/docs/pages/react-aria/home/Styles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function Styles() {
113113
</Window>
114114
<Window toolbar={<AddressBar>https://your-app.com</AddressBar>}>
115115
<div className="flex-1 flex items-center justify-center bg-gray-50 dark:bg-zinc-800 py-20">
116-
<Button className="bg-blue-600 text-white pressed:bg-blue-700 border border-white/10 rounded-lg px-4 py-2 cursor-default outline outline-0 focus-visible:outline-2 outline-blue-600 outline-offset-2">
116+
<Button className="bg-blue-600 text-white pressed:bg-blue-700 border border-white/10 rounded-lg px-4 py-2 cursor-default outline outline-0 focus-visible:outline-2 outline-blue-600 dark:outline-blue-500 outline-offset-2">
117117
Initiate launch sequence…
118118
</Button>
119119
</div>

packages/dev/docs/pages/react-aria/home/SwitchAnimation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function SwitchAnimation() {
5656
isSelected={isSelected}
5757
onChange={isAnimating ? undefined : setSelected}
5858
className="group inline-flex touch-none">
59-
<span className="[--bg:theme(colors.slate.300)] dark:[--bg:theme(colors.zinc.600)] forced-colors:![--bg:ButtonFace] bg-[--bg] [--bg-selected:theme(colors.green.500)] forced-colors:![--bg-selected:Highlight] group-selected:bg-[--bg-selected] group-focus-visible:outline outline-2 outline-blue-600 forced-colors:outline-[Highlight] outline-offset-2 mr-4 h-10 w-16 rounded-full border border-black/[5%] dark:border-white/10 p-[3px] transition duration-200" style={{animation: isAnimating ? 'switch-background-animation 12s ease-in-out 500ms' : null}}>
59+
<span className="[--bg:theme(colors.slate.300)] dark:[--bg:theme(colors.zinc.600)] forced-colors:![--bg:ButtonFace] bg-[--bg] [--bg-selected:theme(colors.green.500)] forced-colors:![--bg-selected:Highlight] group-selected:bg-[--bg-selected] group-focus-visible:outline outline-2 outline-blue-600 dark:outline-blue-500 forced-colors:outline-[Highlight] outline-offset-2 mr-4 h-10 w-16 rounded-full border border-black/[5%] dark:border-white/10 p-[3px] transition duration-200" style={{animation: isAnimating ? 'switch-background-animation 12s ease-in-out 500ms' : null}}>
6060
<span className="group-selected:ml-6 group-selected:group-pressed:ml-4 group-pressed:w-10 block h-8 w-8 origin-right rounded-full bg-white forced-colors:bg-[ButtonText] forced-colors:group-selected:bg-[HighlightText] border border-transparent shadow transition-all duration-200" style={{animation: isAnimating ? 'switch-animation 12s ease-in-out 500ms' : null, contain: 'layout'}} />
6161
</span>
6262
</Switch>

packages/dev/docs/pages/react-aria/home/components.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function Arrow({href, children, textX, x1, x2, points, y, marker = 'marke
7171
? <polyline points={points} {...markerProps} className="stroke-slate-800 dark:stroke-white fill-none" />
7272
: <line x1={x1} y1={y} x2={x2} y2={y} {...markerProps} className="stroke-slate-800 dark:stroke-white" />
7373
}
74-
<a href={href} target="_blank" className="pointer-events-auto outline-none rounded-sm focus:outline-blue-600 outline-offset-2"><text x={textX} y={y + 3} className="text-xs fill-slate-900 dark:fill-white underline">{children}</text></a>
74+
<a href={href} target="_blank" className="pointer-events-auto outline-none rounded-sm focus:outline-blue-600 dark:focus:outline-blue-500 outline-offset-2"><text x={textX} y={y + 3} className="text-xs fill-slate-900 dark:fill-white underline">{children}</text></a>
7575
</>
7676
);
7777
}

packages/dev/docs/pages/react-aria/tailwind.config.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* OF ANY KIND, either express or implied. See the License for the specific language
1010
* governing permissions and limitations under the License.
1111
*/
12-
const plugin = require('tailwindcss/plugin');
1312

1413
/** @type {import('tailwindcss').Config} */
1514
module.exports = {
@@ -25,15 +24,6 @@ module.exports = {
2524
},
2625
plugins: [
2726
require('tailwindcss-react-aria-components'),
28-
require('tailwindcss-animate'),
29-
plugin(({addVariant, addUtilities}) => {
30-
// https://github.com/tailwindlabs/tailwindcss/pull/11694
31-
addVariant('forced-colors', '@media (forced-colors: active)');
32-
// https://github.com/tailwindlabs/tailwindcss/pull/11931
33-
addUtilities({
34-
'.forced-color-adjust-auto': {'forced-color-adjust': 'auto'},
35-
'.forced-color-adjust-none': {'forced-color-adjust': 'none'}
36-
});
37-
})
27+
require('tailwindcss-animate')
3828
]
3929
};

0 commit comments

Comments
 (0)