Skip to content

Commit 53b5bd4

Browse files
author
Bean.Wei
committed
init astro-ui
0 parents  commit 53b5bd4

38 files changed

+6501
-0
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
charset = utf-8
9+
10+
# 2 space indentation
11+
[*.{vue,astro,ts,tsx,js,mjs,json,y{a,}ml,html,cwl}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.{md,Rmd,rst,mdx}]
16+
trim_trailing_whitespace = false
17+
indent_style = space
18+
indent_size = 2

.gitignore

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
3+
4+
# dependencies
5+
node_modules
6+
/.pnp
7+
.pnp.js
8+
9+
# testing
10+
/coverage
11+
coverage
12+
13+
# production
14+
/build
15+
dist/
16+
17+
# misc
18+
.cache
19+
.DS_Store
20+
.env
21+
.env.local
22+
.env.development.local
23+
.env.test.local
24+
.env.production.local
25+
.env.production
26+
27+
# Logs
28+
logs
29+
*.log
30+
npm-debug.log*
31+
yarn-debug.log*
32+
yarn-error.log*
33+
34+
# debug
35+
npm-debug.log*
36+
yarn-debug.log*
37+
yarn-error.log*
38+
.yarn-integrity
39+
.idea
40+
.now
41+
dist
42+
esm
43+
44+
.vercel
45+
46+
47+
# Astro
48+
.astro/

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore-workspace-root-check=true
2+
shell-emulator=true

.vscode/settings.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"prettier.enable": false,
3+
"editor.formatOnSave": false,
4+
"editor.defaultFormatter": "biomejs.biome",
5+
"editor.codeActionsOnSave": {
6+
"quickfix.biome": "explicit",
7+
"source.organizeImports.biome": "explicit"
8+
},
9+
"tailwindCSS.experimental.classRegex": [
10+
["([\"'`][^\"'`]*.*?[\"'`])", "[\"'`]([^\"'`]*).*?[\"'`]"]
11+
]
12+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Bean Wei <https://github.com/beanwei>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p align="center">
2+
<h1 align="center">astro-ui</h1>
3+
</p>

biome.json

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"formatter": {
7+
"indentStyle": "tab",
8+
"indentWidth": 2,
9+
"lineWidth": 100,
10+
"lineEnding": "lf",
11+
"formatWithErrors": true
12+
},
13+
"linter": {
14+
"enabled": true,
15+
"rules": {
16+
"recommended": true,
17+
"suspicious": {
18+
"noExplicitAny": "off"
19+
}
20+
}
21+
},
22+
"javascript": {
23+
"formatter": {
24+
"trailingCommas": "es5",
25+
"quoteStyle": "single",
26+
"semicolons": "asNeeded"
27+
}
28+
},
29+
"json": {
30+
"parser": {
31+
"allowComments": true,
32+
"allowTrailingCommas": true
33+
},
34+
"formatter": {
35+
"indentStyle": "space",
36+
"trailingCommas": "none"
37+
}
38+
},
39+
"overrides": [
40+
{
41+
"include": ["package.json"],
42+
"json": {
43+
"formatter": {
44+
"lineWidth": 1
45+
}
46+
}
47+
},
48+
{
49+
"include": ["*.astro"],
50+
"linter": {
51+
"rules": {
52+
"style": {
53+
"useConst": "off",
54+
"useImportType": "off"
55+
}
56+
}
57+
}
58+
}
59+
],
60+
"vcs": {
61+
"enabled": true,
62+
"clientKind": "git",
63+
"useIgnoreFile": true
64+
}
65+
}

docs/astro.config.mjs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import starlight from '@astrojs/starlight'
2+
import tailwind from '@astrojs/tailwind'
3+
import { defineConfig } from 'astro/config'
4+
5+
import icon from 'astro-icon'
6+
7+
// https://astro.build/config
8+
export default defineConfig({
9+
integrations: [
10+
starlight({
11+
title: 'AstroUI',
12+
social: {
13+
github: 'https://github.com/beanwei/astro-ui',
14+
},
15+
sidebar: [
16+
{
17+
label: 'Guides',
18+
items: [
19+
{ label: 'Introduction', slug: 'guides/introduction' },
20+
{ label: 'Installation', slug: 'guides/installation' },
21+
],
22+
},
23+
{
24+
label: 'Components',
25+
autogenerate: { directory: 'components' },
26+
},
27+
],
28+
customCss: ['./src/custom.css'],
29+
}),
30+
tailwind({ applyBaseStyles: false }),
31+
icon({
32+
include: {
33+
lucide: ['chevron-right', 'mail-open'],
34+
},
35+
}),
36+
],
37+
})

docs/package.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"type": "module",
3+
"scripts": {
4+
"dev": "astro dev",
5+
"start": "astro dev",
6+
"build": "astro build",
7+
"preview": "astro preview",
8+
"astro": "astro"
9+
},
10+
"dependencies": {
11+
"@astrojs/starlight": "^0.29.2",
12+
"@astrojs/starlight-tailwind": "^2.0.3",
13+
"@astrojs/tailwind": "^5.1.2",
14+
"@beanwei/astro-ui": "workspace:*",
15+
"@iconify-json/lucide": "^1.2.15",
16+
"astro": "^4.16.13",
17+
"astro-icon": "^1.1.2",
18+
"tailwindcss": "^3.4.15",
19+
"tailwindcss-animate": "^1.0.7",
20+
"tailwindcss-scoped-preflight": "^3.4.9",
21+
"vite-plugin-simple-scope": "^2.0.2"
22+
}
23+
}

docs/public/favicon.svg

+1
Loading

docs/src/assets/houston.webp

96.2 KB
Binary file not shown.

docs/src/components/Preview.astro

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
import { TabItem, Tabs } from '@astrojs/starlight/components'
3+
4+
// https://github.com/withastro/roadmap/discussions/827
5+
---
6+
7+
<Tabs>
8+
<TabItem label="Preview">
9+
<div class="not-content ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 relative rounded-md border p-10 flex flex-wrap gap-4">
10+
<slot name="preview" />
11+
</div>
12+
</TabItem>
13+
<TabItem label="Code">
14+
<slot />
15+
</TabItem>
16+
</Tabs>

docs/src/content/config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineCollection } from 'astro:content'
2+
import { docsSchema } from '@astrojs/starlight/schema'
3+
4+
export const collections = {
5+
docs: defineCollection({ schema: docsSchema() }),
6+
}
+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
title: Button
3+
description: button
4+
---
5+
6+
import Preview from '~/components/Preview.astro'
7+
import { Button } from '@beanwei/astro-ui'
8+
import { Icon } from 'astro-icon/components'
9+
10+
## Import
11+
12+
```tsx
13+
import { Button } from '@beanwei/astro-ui'
14+
```
15+
16+
## Usage
17+
18+
<Preview>
19+
<Fragment slot="preview">
20+
<Button>Primary</Button>
21+
<Button variant="secondary">Secondary</Button>
22+
<Button variant="destructive">Destructive</Button>
23+
<Button variant="outline">Outline</Button>
24+
<Button variant="ghost">Ghost</Button>
25+
<Button variant="link">Link</Button>
26+
</Fragment>
27+
```tsx
28+
---
29+
import { Button } from '@beanwei/astro-ui'
30+
---
31+
32+
<Button>Primary</Button>
33+
<Button variant="secondary">Secondary</Button>
34+
<Button variant="destructive">Destructive</Button>
35+
<Button variant="outline">Outline</Button>
36+
<Button variant="ghost">Ghost</Button>
37+
<Button variant="link">Link</Button>
38+
```
39+
</Preview>
40+
41+
42+
### Icon
43+
44+
<Preview>
45+
<Fragment slot="preview">
46+
<Button variant="outline" size="icon">
47+
<Icon name="lucide:chevron-right" />
48+
</Button>
49+
<Button>
50+
<Icon name="lucide:mail-open" />
51+
Login with Email
52+
</Button>
53+
</Fragment>
54+
```tsx
55+
---
56+
import { Button } from '@beanwei/astro-ui'
57+
import { Icon } from 'astro-icon/components'
58+
---
59+
60+
<Button variant="outline" size="icon">
61+
<Icon name="lucide:chevron-right" />
62+
</Button>
63+
<Button>
64+
<Icon name="lucide:mail-open" />
65+
Login with Email
66+
</Button>
67+
```
68+
</Preview>
69+
70+
71+
### Loading
72+
73+
<Preview>
74+
<Fragment slot="preview">
75+
<Button data-state="loading" disabled>
76+
Please wait
77+
</Button>
78+
</Fragment>
79+
```tsx
80+
---
81+
import { Button } from '@beanwei/astro-ui'
82+
---
83+
84+
<Button data-state="loading" disabled>
85+
Please wait
86+
</Button>
87+
```
88+
</Preview>
89+
90+
91+
### As Child
92+
93+
<Preview>
94+
<Fragment slot="preview">
95+
<Button asChild>
96+
<a href="/">Home</a>
97+
</Button>
98+
</Fragment>
99+
```tsx
100+
---
101+
import { Button } from '@beanwei/astro-ui'
102+
---
103+
104+
<Button asChild>
105+
<a href="/">Home</a>
106+
</Button>
107+
```
108+
</Preview>

0 commit comments

Comments
 (0)