@lmy54321/design-system 1.1.2 → 1.1.3
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/package.json +3 -3
- package/rules/design-system.mdc +81 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmy54321/design-system",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "A comprehensive React component library and design system based on Tailwind CSS and Motion.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"test": "vitest"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"react": "^18.3.1",
|
|
33
|
-
"react-dom": "^18.3.1",
|
|
32
|
+
"react": "^18.3.1 || ^19.0.0",
|
|
33
|
+
"react-dom": "^18.3.1 || ^19.0.0",
|
|
34
34
|
"tailwindcss": "^4.2.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
package/rules/design-system.mdc
CHANGED
|
@@ -41,6 +41,15 @@ provider:
|
|
|
41
41
|
| `TopToolbar` | 顶部导航栏 |
|
|
42
42
|
| `BottomNavigationBar` | 底部标签栏 |
|
|
43
43
|
|
|
44
|
+
#### BottomNavigationBar 类型定义
|
|
45
|
+
|
|
46
|
+
`BottomNavigationBar` 的 Tab ID 使用 `TabId` 类型,需从组件路径导入:
|
|
47
|
+
```tsx
|
|
48
|
+
import { BottomNavigationBar } from '@lmy54321/design-system'
|
|
49
|
+
// TabId 类型为字面量联合: "home" | "explore" | "plan" | "me"
|
|
50
|
+
type TabId = "home" | "explore" | "plan" | "me";
|
|
51
|
+
```
|
|
52
|
+
|
|
44
53
|
### 容器组件
|
|
45
54
|
| 组件 | 用途 |
|
|
46
55
|
|------|------|
|
|
@@ -287,6 +296,77 @@ import { Dialog, Toast, Btn, SearchBox, IconFont, cn } from '@lmy54321/design-sy
|
|
|
287
296
|
| 拖拽 | ✅ 手势切换 | ❌ 禁用 |
|
|
288
297
|
| 遮罩 | LARGE时60%黑色遮罩 | 无需遮罩 |
|
|
289
298
|
|
|
299
|
+
### BottomNavigationBar 与 DraggablePanel 层级关系(重要)
|
|
300
|
+
|
|
301
|
+
**BottomNavigationBar 必须在 DraggablePanel 之上**,使用 z-index 层级差来实现。以下是正确的 z-index 层级表:
|
|
302
|
+
|
|
303
|
+
| 元素 | z-index | 说明 |
|
|
304
|
+
|------|---------|------|
|
|
305
|
+
| Toast | `z-[2000]` | 最顶层,轻提示 |
|
|
306
|
+
| **BottomNavigationBar** | **`z-[1001]`** | 底部导航栏,**必须在面板之上** |
|
|
307
|
+
| DraggablePanel TopToolbar | `z-[1000]` | 面板内置顶部工具栏 |
|
|
308
|
+
| **DraggablePanel** | **`z-[999]`** | 可拖拽面板主体 |
|
|
309
|
+
| 地图控件 | `z-40` | 地图浮层按钮 |
|
|
310
|
+
|
|
311
|
+
**BottomNavigationBar 的正确用法:**
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
{/* BottomNavigationBar 必须用 absolute 定位 + z-[1001] 压盖在 DraggablePanel 上方 */}
|
|
315
|
+
{panelState !== DRAWER_STATES.FULL && (
|
|
316
|
+
<div className="absolute bottom-[12px] left-1/2 -translate-x-1/2 z-[1001]">
|
|
317
|
+
<BottomNavigationBar activeTab={activeTab} onTabChange={onTabChange} />
|
|
318
|
+
</div>
|
|
319
|
+
)}
|
|
320
|
+
|
|
321
|
+
{/* DraggablePanel 的 z-index 是 z-[999],低于 BottomNavigationBar */}
|
|
322
|
+
<DraggablePanel
|
|
323
|
+
state={panelState}
|
|
324
|
+
onStateChange={setPanelState}
|
|
325
|
+
customSmallHeight={260}
|
|
326
|
+
bottomOffset={8}
|
|
327
|
+
>
|
|
328
|
+
{/* 页卡内容 */}
|
|
329
|
+
</DraggablePanel>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**关键规则:**
|
|
333
|
+
1. `BottomNavigationBar` **不能**放在 `DraggablePanel` 内部,必须作为**同级兄弟元素**
|
|
334
|
+
2. `BottomNavigationBar` 外层容器**必须**设置 `z-[1001]`(高于面板的 `z-[999]`)
|
|
335
|
+
3. 当面板进入 `DRAWER_STATES.FULL` 全屏状态时,**必须隐藏** `BottomNavigationBar`
|
|
336
|
+
4. `BottomNavigationBar` 使用 `absolute bottom-[12px] left-1/2 -translate-x-1/2` 定位在屏幕底部居中
|
|
337
|
+
5. `DraggablePanel` 设置 `bottomOffset={8}` 保持面板底部与屏幕底部的间距
|
|
338
|
+
|
|
339
|
+
**完整的页面骨架结构:**
|
|
340
|
+
|
|
341
|
+
```tsx
|
|
342
|
+
<div className="relative w-full h-[100dvh] overflow-hidden bg-background">
|
|
343
|
+
{/* 底图 */}
|
|
344
|
+
<TencentMap className="absolute inset-0" />
|
|
345
|
+
|
|
346
|
+
{/* 地图控件 z-40 */}
|
|
347
|
+
{/* ... */}
|
|
348
|
+
|
|
349
|
+
{/* BottomNavigationBar — z-[1001],在面板上方 */}
|
|
350
|
+
{panelState !== DRAWER_STATES.FULL && (
|
|
351
|
+
<div className="absolute bottom-[12px] left-1/2 -translate-x-1/2 z-[1001]">
|
|
352
|
+
<BottomNavigationBar activeTab={activeTab} onTabChange={onTabChange} />
|
|
353
|
+
</div>
|
|
354
|
+
)}
|
|
355
|
+
|
|
356
|
+
{/* DraggablePanel — z-[999],在导航栏下方 */}
|
|
357
|
+
<DraggablePanel
|
|
358
|
+
state={panelState}
|
|
359
|
+
onStateChange={setPanelState}
|
|
360
|
+
customSmallHeight={260}
|
|
361
|
+
bottomOffset={8}
|
|
362
|
+
>
|
|
363
|
+
{/* 页卡内容 */}
|
|
364
|
+
</DraggablePanel>
|
|
365
|
+
|
|
366
|
+
{/* Toast — z-[2000],最顶层 */}
|
|
367
|
+
</div>
|
|
368
|
+
```
|
|
369
|
+
|
|
290
370
|
### 严禁行为
|
|
291
371
|
|
|
292
372
|
1. **禁止**在需要底图联动的页面直接使用全屏页卡遮盖底图
|
|
@@ -295,6 +375,7 @@ import { Dialog, Toast, Btn, SearchBox, IconFont, cn } from '@lmy54321/design-sy
|
|
|
295
375
|
4. **禁止**使用渐变背景 `div` 模拟地图底图,必须使用 `TencentMap` 组件
|
|
296
376
|
5. **禁止**将底部操作栏(`BottomActionButtons`/`BottomToolbar`/底部按钮组)放在 `DraggablePanel` 的 `children` 内部,必须通过 `bottomBar` prop 传入以保持吸底
|
|
297
377
|
6. **禁止**在 `DraggablePanel` 的 `children` 内部对 `flex-1` 子项省略 `min-h-0`,否则 `bottomBar` 将被内容推出可视区域
|
|
378
|
+
7. **禁止**将 `BottomNavigationBar` 放在 `DraggablePanel` 内部或使用低于 `z-[1001]` 的层级,否则会被面板遮盖
|
|
298
379
|
|
|
299
380
|
## 瀑布流布局规范
|
|
300
381
|
|