aicde-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -0
- package/README.md +87 -2
- package/dist/index.cjs +3163 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +973 -0
- package/dist/index.d.ts +973 -0
- package/dist/index.js +3051 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +1710 -0
- package/package.json +75 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AICDE
|
|
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.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
The MIT license above covers the source code only. The AICDE name and
|
|
26
|
+
logo are brand assets of AICDE and are not licensed under it.
|
|
27
|
+
AICDE 名稱與 logo 為 AICDE 的品牌識別,不在上述 MIT 授權範圍內。
|
package/README.md
CHANGED
|
@@ -1,3 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# aicde-ui(React)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AICDE 風格的 React 元件庫。樣式沿用網站的 `aicde-ui.css`,元件只負責結構、狀態與無障礙屬性。
|
|
4
|
+
|
|
5
|
+
元件文件與範例:https://zhijian090195.github.io/library/
|
|
6
|
+
|
|
7
|
+
## 安裝
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install aicde-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
字型(建議,放在 `<head>` 或你的全域 CSS):
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Noto+Sans+TC:wght@400;500;700&family=JetBrains+Mono:wght@500;700&family=Noto+Serif+TC:wght@700&display=swap" rel="stylesheet">
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 使用
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Button, Tabs, Toaster, toast } from 'aicde-ui';
|
|
23
|
+
import 'aicde-ui/style.css';
|
|
24
|
+
|
|
25
|
+
export default function App() {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<Button variant="primary" onClick={() => toast('已儲存', { type: 'success' })}>儲存</Button>
|
|
29
|
+
<Toaster />
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
需要 React 18 以上。`toast()` 和 `notify()` 要在畫面上放一個 `<Toaster />` 才看得到。`Button` 不指定 `variant` 時是外框按鈕。所有元件都標了 `"use client"`,可以直接在 Next.js App Router 裡使用。
|
|
36
|
+
|
|
37
|
+
## 主題
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<ThemeProvider theme="riso" mode="dark">…</ThemeProvider>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`theme`:
|
|
44
|
+
|
|
45
|
+
| 值 | 風格 |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `default`(預設) | 紙雕分層,AICDE 原色:有厚度的紙片、按下壓到底、卡片後疊兩張彩紙 |
|
|
48
|
+
| `clean` | 無裝飾的簡潔版 |
|
|
49
|
+
| `paper` | 暖米色紙雕 |
|
|
50
|
+
| `ink` | 混合媒材手繪:墨線、不規則圓角、紙膠帶 |
|
|
51
|
+
| `soft` | 柔光立體:膠囊、光澤、霧面玻璃 |
|
|
52
|
+
| `riso` | 網點絲印:半色調、套色錯位 |
|
|
53
|
+
| `brutal` | 新粗野:粗線、直角、等寬字 |
|
|
54
|
+
| `stitch` | 手縫布藝:車縫虛線、鈕扣開關 |
|
|
55
|
+
| `ticket` | 水彩票根:打孔缺口、撕線、水彩暈染 |
|
|
56
|
+
| `block` | 啞光積木:倒角、厚底 |
|
|
57
|
+
| `blueprint` | 藍圖線稿:方格、裁切角標、紅筆標註 |
|
|
58
|
+
| `clinical` | 醫療:主要色用深藍、珊瑚只留給警示;44px 點擊範圍、清楚的 focus |
|
|
59
|
+
| `cute` | 可愛:大圓角、粉嫩色、貼紙描邊、彈跳動畫 |
|
|
60
|
+
| `finance` | 金融:高密度、4px 圓角、等寬數字、細線分隔 |
|
|
61
|
+
| `editorial` | 編輯:襯線標題、髮絲線、小型大寫,雜誌感 |
|
|
62
|
+
|
|
63
|
+
`mode`:`light`/`dark`/`system`。不用 React 時,在 `<html>` 加 `data-theme-style="ink"` 也一樣。
|
|
64
|
+
|
|
65
|
+
## 元件
|
|
66
|
+
|
|
67
|
+
| 分類 | 元件 |
|
|
68
|
+
|---|---|
|
|
69
|
+
| 通用 | Button、Divider、FloatButton、BackTop、ThemeProvider |
|
|
70
|
+
| 導覽 | Tabs、Pagination、Dropdown、Breadcrumb、Steps、Menu、CommandPalette、ContextMenu |
|
|
71
|
+
| 回饋 | Modal、Drawer、toast()/notify()+`<Toaster/>`、Alert、Progress、Skeleton、Spinner、Popover、Result、Banner |
|
|
72
|
+
| 輸入、資料展示 | 見 `src/groups/entry.ts`、`src/groups/display.ts` |
|
|
73
|
+
|
|
74
|
+
有狀態的元件都同時支援受控(`value`/`open`/`activeKey`)與非受控(`default*`)用法。
|
|
75
|
+
|
|
76
|
+
## 指令
|
|
77
|
+
|
|
78
|
+
| 指令 | 用途 |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `npm run build` | tsup 輸出 ESM/CJS/型別,並複製 CSS 到 `dist/style.css` |
|
|
81
|
+
| `npm run typecheck` | TypeScript 型別檢查 |
|
|
82
|
+
| `npm run smoke` | 用 SSR 把每個元件 renderToString 一次,有 console.error 就失敗 |
|
|
83
|
+
|
|
84
|
+
## 授權
|
|
85
|
+
|
|
86
|
+
MIT
|
|
87
|
+
|
|
88
|
+
AICDE 名稱與 logo 不在 MIT 授權範圍內。
|