@tcn/ui 0.18.0 → 0.18.1
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/AI_USAGE.md +59 -0
- package/CHANGELOG.md +1009 -0
- package/ai-docs/actions.md +43 -0
- package/ai-docs/decorators.md +34 -0
- package/ai-docs/feedback.md +31 -0
- package/ai-docs/form.md +58 -0
- package/ai-docs/inputs.md +71 -0
- package/ai-docs/layouts.md +76 -0
- package/ai-docs/mobile.md +34 -0
- package/ai-docs/navigation.md +48 -0
- package/ai-docs/overlay.md +58 -0
- package/ai-docs/stacks.md +59 -0
- package/ai-docs/surfaces.md +79 -0
- package/ai-docs/themes.md +47 -0
- package/ai-docs/tokens.md +35 -0
- package/ai-docs/typography.md +38 -0
- package/ai-docs/utils.md +51 -0
- package/package.json +6 -2
- package/src/overlay/popper/legacy/popper.stories.tsx +9 -2
package/AI_USAGE.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @tcn/ui — AI Usage Guide
|
|
2
|
+
|
|
3
|
+
**Load this file when:** the project uses `@tcn/ui` and you are building UI — layouts, forms, inputs, surfaces, overlays, navigation, or themed components.
|
|
4
|
+
|
|
5
|
+
> For source files referenced in linked docs, prefix paths with `node_modules/@tcn/ui/` in app projects.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
`@tcn/ui` provides a component library where **surfaces** are the starting point and **layouts** provide structure within them. Themes control all visual appearance.
|
|
12
|
+
|
|
13
|
+
| Concept | Summary |
|
|
14
|
+
|---|---|
|
|
15
|
+
| **Surfaces** | The starting point. `Panel`, `Card`, `Page`, `Modal`, `Drawer`, `Window` are styled containers that wrap a `Scaffold` internally. `Tooltip`, `Popover`, `PopConfirm`, `Alert` are functional surfaces for contextual feedback. Surfaces provide themed visual treatment — borders, shadows, backgrounds. |
|
|
16
|
+
| **Layouts** | Structure inside surfaces. `Scaffold` (vertical), `Rail` (horizontal), `Header`/`Footer`, `Section`, `Columns`/`Rows`, `Grid`, `Responsive`/`Breakpoint`. Use these to build the internal structure of a surface — headers, footers, columns, sections. |
|
|
17
|
+
| **Inputs** | 20+ input types: `Input`, `Select`, `ComboBox`, `DatePicker`, `Checkbox`, `Radio`, `Switch`, `MaskInput`, etc. |
|
|
18
|
+
| **Form** | `Field`, `HField`/`VField`, `FieldSet`, `FieldPresenter`. Compose with inputs. |
|
|
19
|
+
| **Theming** | Swappable stylesheets (Ergo, Windows 98). CSS layers: `tcn-reset` < `tcn-system` < `tcn-theme`. Components expose `tcn-*` classes and `data-*` attributes. |
|
|
20
|
+
| **Stacks** | `VStack`, `HStack`, `ZStack`, `Box` — the atomic primitives underneath layouts and surfaces. Rarely used directly in apps — prefer named layout components for semantic clarity. Use stacks when building custom reusable components. |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Decision Tree — What Are You Building?
|
|
25
|
+
|
|
26
|
+
| Task | Read |
|
|
27
|
+
|---|---|
|
|
28
|
+
| Styled containers — panels, cards, pages, modals, drawers, tooltips, popovers | [ai-docs/surfaces.md](ai-docs/surfaces.md) |
|
|
29
|
+
| Structure within surfaces — headers, footers, sections, columns, rows, grids | [ai-docs/layouts.md](ai-docs/layouts.md) |
|
|
30
|
+
| Form with fields (labels, validation, groups) | [ai-docs/form.md](ai-docs/form.md) |
|
|
31
|
+
| Input components (text, select, date, etc.) | [ai-docs/inputs.md](ai-docs/inputs.md) |
|
|
32
|
+
| Overlays/popups (portals, poppers, menus) | [ai-docs/overlay.md](ai-docs/overlay.md) |
|
|
33
|
+
| Navigation (tabs, links) | [ai-docs/navigation.md](ai-docs/navigation.md) |
|
|
34
|
+
| Buttons and toggles | [ai-docs/actions.md](ai-docs/actions.md) |
|
|
35
|
+
| Loading, progress, lazy rendering | [ai-docs/feedback.md](ai-docs/feedback.md) |
|
|
36
|
+
| Theming, CSS variables, custom styling | [ai-docs/themes.md](ai-docs/themes.md) |
|
|
37
|
+
| Text and headings | [ai-docs/typography.md](ai-docs/typography.md) |
|
|
38
|
+
| Drag and resize behavior | [ai-docs/decorators.md](ai-docs/decorators.md) |
|
|
39
|
+
| Chips, badges, key-value tokens | [ai-docs/tokens.md](ai-docs/tokens.md) |
|
|
40
|
+
| Hooks, calendar, ref utilities | [ai-docs/utils.md](ai-docs/utils.md) |
|
|
41
|
+
| Mobile-specific components | [ai-docs/mobile.md](ai-docs/mobile.md) |
|
|
42
|
+
| Building custom components (VStack, HStack, Box primitives) | [ai-docs/stacks.md](ai-docs/stacks.md) |
|
|
43
|
+
|
|
44
|
+
Only load a topic doc when the current task matches. Do not load all docs preemptively.
|
|
45
|
+
|
|
46
|
+
**Cross-module hints:** Start with a Surface (Panel, Card, Page), then use Layouts (Header, Footer, Section, Columns) to build its internal structure. Form and Inputs are tightly coupled (inputs slot into Field). Overlay powers positioned surfaces like Modal and Drawer. Themes are needed for any custom styling. Stacks are rarely needed directly — use named layout components instead.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Critical Rules
|
|
51
|
+
|
|
52
|
+
- **Surfaces first, then layouts** — start with a surface (Panel, Card, Page), then use layouts (Header, Footer, Section, Columns) for internal structure. Stacks are for building custom components, not app-level UI
|
|
53
|
+
- **Dual class names** — every component gets a CSS module class + a `tcn-` prefixed theme class
|
|
54
|
+
- **Data attributes for state** — use `data-disabled`, `data-hierarchy`, `data-size` etc. (not conditional classes)
|
|
55
|
+
- **Composition over configuration** — use `<Select><Option>` not `<Select options={[...]}>`
|
|
56
|
+
- **onChange convention** — value first, event second
|
|
57
|
+
- **Theme variables for custom components** — import from `theme_variables`, never hardcode colors/spacing
|
|
58
|
+
- **Decorators for behavior** — use `<Resizable>` / `<Draggable>` wrappers, not props on layout components
|
|
59
|
+
- **Mobile uses separate roots** — not responsive breakpoints within desktop components
|