@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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Actions
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/actions/button/base_button/base_button.tsx` | Core button primitive with base props |
|
|
12
|
+
| `src/actions/button/button/button.tsx` | Extended button with hierarchy variants |
|
|
13
|
+
| `src/actions/button/button_group/button_group.tsx` | Groups multiple buttons |
|
|
14
|
+
| `src/actions/toggle/toggle.tsx` | Toggle switch component |
|
|
15
|
+
| `src/actions/types.ts` | Shared action type definitions |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Imports
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { Button, ButtonGroup, Toggle } from '@tcn/ui/actions';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Typing
|
|
28
|
+
|
|
29
|
+
| Interface | Use for |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `ButtonProps` | Full button API (extends BoxProps) |
|
|
32
|
+
| `ButtonGroupProps` | Button group container |
|
|
33
|
+
| `ToggleProps` | Toggle switch |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Reference
|
|
38
|
+
|
|
39
|
+
- `Button` uses `data-hierarchy` for visual variants (primary, secondary, tertiary)
|
|
40
|
+
- `data-disabled`, `data-is-loading` for state-driven theming
|
|
41
|
+
- `ButtonGroup` arranges buttons horizontally with consistent spacing
|
|
42
|
+
- `Toggle` is a stateful on/off switch
|
|
43
|
+
- All components use `forwardRef` and expose `tcn-` class names
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Decorators
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/utils/decorators/draggable/draggable.tsx` | Draggable behavior wrapper |
|
|
12
|
+
| `src/utils/decorators/draggable/drag_handle.tsx` | Drag handle component |
|
|
13
|
+
| `src/utils/decorators/draggable/use_draggable.ts` | Draggable hook |
|
|
14
|
+
| `src/utils/decorators/resizable/` | Resizable behavior wrapper |
|
|
15
|
+
| `src/utils/decorators/DECORATOR_PATTERN.md` | Decorator pattern documentation |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Imports
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { Draggable, DragHandle, Resizable } from '@tcn/ui/utils';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Reference
|
|
28
|
+
|
|
29
|
+
- Decorators inject behavior via `cloneElement` — wrap any component to add drag/resize
|
|
30
|
+
- `<Draggable>` makes its child draggable; `<DragHandle>` restricts drag initiation to a handle area
|
|
31
|
+
- `<Resizable>` adds resize handles to its child
|
|
32
|
+
- Decorators can be stacked: `<Draggable><Resizable><Panel /></Resizable></Draggable>`
|
|
33
|
+
- Do **not** add `enableResize*` style props to layout components — use `<Resizable>` wrapper instead
|
|
34
|
+
- Read `DECORATOR_PATTERN.md` for the full pattern guide and how to create new decorators
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Feedback
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/feedback/loading/loading.tsx` | Loading spinner/skeleton indicator |
|
|
12
|
+
| `src/feedback/progress/progress.tsx` | Circular/radial progress indicator |
|
|
13
|
+
| `src/feedback/progress/progress_bar.tsx` | Horizontal progress bar |
|
|
14
|
+
| `src/feedback/lazy/lazy.tsx` | Lazy loading wrapper with suspense |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Imports
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Loading, Progress, ProgressBar, Lazy } from '@tcn/ui/feedback';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Reference
|
|
27
|
+
|
|
28
|
+
- `Loading` displays a spinner or skeleton while content loads
|
|
29
|
+
- `Progress` shows circular progress (0-100)
|
|
30
|
+
- `ProgressBar` shows horizontal progress (0-100)
|
|
31
|
+
- `Lazy` wraps components for lazy loading with a fallback
|
package/ai-docs/form.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Form
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/form/field/field.tsx` | Base field wrapper |
|
|
12
|
+
| `src/form/field/h_field/h_field.tsx` | Horizontal field layout (label beside input) |
|
|
13
|
+
| `src/form/field/v_field/v_field.tsx` | Vertical field layout (label above input) |
|
|
14
|
+
| `src/form/field/common/field_control/field_control.tsx` | Control area wrapper |
|
|
15
|
+
| `src/form/field/common/status_input/status_input.tsx` | Input with status indicators |
|
|
16
|
+
| `src/form/field/common/field_header.tsx` | Field header (label + description area) |
|
|
17
|
+
| `src/form/field/common/field_label.tsx` | Label element |
|
|
18
|
+
| `src/form/field/common/field_description.tsx` | Helper/description text |
|
|
19
|
+
| `src/form/field/common/field_error.tsx` | Error message display |
|
|
20
|
+
| `src/form/field/field_presenters/field_presenter.tsx` | Generic field state presenter |
|
|
21
|
+
| `src/form/field/field_presenters/options_field_presenter.tsx` | Presenter for option-based fields (select, radio) |
|
|
22
|
+
| `src/form/field_set/field_set.tsx` | Groups related fields |
|
|
23
|
+
| `src/form/field_set/legend.tsx` | Fieldset legend/title |
|
|
24
|
+
| `src/form/form_field.tsx` | High-level form field component |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Imports
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
Field, HField, VField,
|
|
33
|
+
FieldSet, Legend,
|
|
34
|
+
FieldPresenter, OptionsFieldPresenter,
|
|
35
|
+
FormField,
|
|
36
|
+
} from '@tcn/ui/form';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Typing
|
|
42
|
+
|
|
43
|
+
| Interface | Use for |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `FieldProps` | Base field container |
|
|
46
|
+
| `HFieldProps` / `VFieldProps` | Horizontal / vertical field layout |
|
|
47
|
+
| `FieldPresenterProps` | Connecting field state to UI |
|
|
48
|
+
| `OptionsFieldPresenterProps` | Connecting option-based field state to UI |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quick Reference
|
|
53
|
+
|
|
54
|
+
- Form fields are composed from small parts: `Field` > `FieldHeader` + `FieldControl` + `FieldErrorMessage`
|
|
55
|
+
- Use `HField` for horizontal label-input layout, `VField` for vertical
|
|
56
|
+
- `FieldPresenter` and `OptionsFieldPresenter` follow the presenter pattern from `@tcn/state`
|
|
57
|
+
- `FieldSet` + `Legend` group related fields semantically
|
|
58
|
+
- Form and Inputs are tightly coupled — inputs slot into the `FieldControl` area
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Inputs
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/inputs/input/input.tsx` | Text input field |
|
|
12
|
+
| `src/inputs/textarea/textarea.tsx` | Multi-line text input |
|
|
13
|
+
| `src/inputs/checkbox/checkbox.tsx` | Checkbox input |
|
|
14
|
+
| `src/inputs/radio/radio.tsx` | Radio button input |
|
|
15
|
+
| `src/inputs/switch/switch.tsx` | Toggle switch input |
|
|
16
|
+
| `src/inputs/select/select.tsx` | Dropdown select |
|
|
17
|
+
| `src/inputs/combo_box/combo_box.tsx` | Autocomplete dropdown |
|
|
18
|
+
| `src/inputs/multi_combo_box/multi_combo_box.tsx` | Multi-select autocomplete |
|
|
19
|
+
| `src/inputs/multiselect/multiselect.tsx` | Multi-select dropdown |
|
|
20
|
+
| `src/inputs/date_picker/` | Date selection (day, header, body, input, presenter) |
|
|
21
|
+
| `src/inputs/slider/slider.tsx` | Range slider input |
|
|
22
|
+
| `src/inputs/color_input/color_input.tsx` | Color picker input |
|
|
23
|
+
| `src/inputs/color_input/color_picker.tsx` | Color selection interface |
|
|
24
|
+
| `src/inputs/phone_number_input/phone_number_input.tsx` | International phone number |
|
|
25
|
+
| `src/inputs/mask_input/` | Masked text input (character types, cursor, presenter) |
|
|
26
|
+
| `src/inputs/unit_input/unit_input.tsx` | Numeric input with unit selector |
|
|
27
|
+
| `src/inputs/control/control.tsx` | Generic control wrapper |
|
|
28
|
+
| `src/inputs/control_set/control_set.tsx` | Groups related controls |
|
|
29
|
+
| `src/inputs/options/option.tsx` | Individual option item |
|
|
30
|
+
| `src/inputs/select_group/select_group.tsx` | Multi-select group |
|
|
31
|
+
| `src/inputs/select_group/single_select_group.tsx` | Single-select group |
|
|
32
|
+
| `src/inputs/suggestions/` | Suggestion list components |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Imports
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import {
|
|
40
|
+
Input, Textarea, Checkbox, Radio, Switch,
|
|
41
|
+
Select, ComboBox, MultiComboBox, Multiselect,
|
|
42
|
+
DatePicker, SliderInput, ColorInput,
|
|
43
|
+
PhoneNumberInput, MaskInput, UnitInput,
|
|
44
|
+
Control, ControlSet, Option,
|
|
45
|
+
} from '@tcn/ui/inputs';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Typing
|
|
51
|
+
|
|
52
|
+
| Interface | Use for |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `InputProps` | Text input |
|
|
55
|
+
| `SelectProps` | Dropdown select |
|
|
56
|
+
| `ComboBoxProps` | Autocomplete select |
|
|
57
|
+
| `OptionProps` | Individual option in select/combo |
|
|
58
|
+
| `DatePickerProps` | Date picker |
|
|
59
|
+
| `MaskInputProps` | Masked input |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Quick Reference
|
|
64
|
+
|
|
65
|
+
- `onChange` passes value first, event second (not raw React events)
|
|
66
|
+
- Options use composition: `<Select><Option value="a">A</Option></Select>`
|
|
67
|
+
- `ComboBox` and `MultiComboBox` support type-ahead filtering
|
|
68
|
+
- `MaskInput` supports 6 character types for formatted input (phone, SSN, etc.)
|
|
69
|
+
- `DatePicker` is a complex component with sub-components (day, header, body, input)
|
|
70
|
+
- Inputs are tightly coupled with Form — they slot into `FieldControl`
|
|
71
|
+
- All inputs use `data-disabled`, `data-size` for theme-driven state styling
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Layouts
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/layouts/containers/scaffold.tsx` | Vertical page scaffold (VStack-based) |
|
|
12
|
+
| `src/layouts/containers/rail.tsx` | Horizontal rail layout (HStack-based) |
|
|
13
|
+
| `src/layouts/containers/columns/columns.tsx` | Equal-width column grid |
|
|
14
|
+
| `src/layouts/containers/columns/column.tsx` | Single column in grid |
|
|
15
|
+
| `src/layouts/containers/rows/rows.tsx` | Row flex container |
|
|
16
|
+
| `src/layouts/containers/rows/row.tsx` | Single row |
|
|
17
|
+
| `src/layouts/header/header.tsx` | Page/section header bar |
|
|
18
|
+
| `src/layouts/footer/footer.tsx` | Page/section footer bar |
|
|
19
|
+
| `src/layouts/bar/bar.tsx` | Generic horizontal bar |
|
|
20
|
+
| `src/layouts/utility_bar/utility_bar.tsx` | Utility action bar |
|
|
21
|
+
| `src/layouts/containers/utility_strip/utility_strip.tsx` | Compact utility action strip |
|
|
22
|
+
| `src/layouts/section/section.tsx` | Content section with heading |
|
|
23
|
+
| `src/layouts/section/heading.tsx` | Section heading |
|
|
24
|
+
| `src/layouts/section/detail.tsx` | Section detail text |
|
|
25
|
+
| `src/layouts/divider/divider.tsx` | Visual divider |
|
|
26
|
+
| `src/layouts/grid/grid.tsx` | CSS grid layout |
|
|
27
|
+
| `src/layouts/list/list.tsx` | Ordered/unordered list |
|
|
28
|
+
| `src/layouts/list/item.tsx` | List item |
|
|
29
|
+
| `src/layouts/table/table.tsx` | Semantic table (TTable, THead, TBody, TFoot, TR, TH, TD) |
|
|
30
|
+
| `src/layouts/responsive/responsive.tsx` | Container-query responsive wrapper |
|
|
31
|
+
| `src/layouts/responsive/breakpoint.tsx` | Breakpoint-based rendering |
|
|
32
|
+
| `src/layouts/sidebar_start/sidebar_start.tsx` | Left sidebar |
|
|
33
|
+
| `src/layouts/sidebar_end/sidebar_end.tsx` | Right sidebar |
|
|
34
|
+
| `src/layouts/group/group.tsx` | Visual grouping container |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Imports
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import {
|
|
42
|
+
Scaffold, Rail, Header, Footer, Bar, UtilityBar,
|
|
43
|
+
Section, Heading, Detail, Divider,
|
|
44
|
+
Columns, Column, Rows, Row,
|
|
45
|
+
Grid, List, Item,
|
|
46
|
+
Responsive, Breakpoint,
|
|
47
|
+
SidebarStart, SidebarEnd,
|
|
48
|
+
} from '@tcn/ui/layouts';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Typing
|
|
54
|
+
|
|
55
|
+
| Interface | Use for |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `ScaffoldProps` | Vertical page structure (extends VStackProps) |
|
|
58
|
+
| `RailProps` | Horizontal layout (extends HStackProps) |
|
|
59
|
+
| `ColumnsProps` / `ColumnProps` | Equal-width column grids |
|
|
60
|
+
| `RowsProps` / `RowProps` | Row-based flex layouts |
|
|
61
|
+
| `ResponsiveProps` | Container-query responsive wrapper |
|
|
62
|
+
| `BreakpointProps` | Viewport-based conditional rendering |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Quick Reference
|
|
67
|
+
|
|
68
|
+
- Layouts provide **structure inside surfaces** — start with a surface (Panel, Card, Page), then use layouts for its internal structure
|
|
69
|
+
- Standard pattern: `<Panel>` → `<Header>` + `<Scaffold>` (body) + `<Footer>`
|
|
70
|
+
- `Scaffold` is the vertical layout container; `Rail` is the horizontal layout container
|
|
71
|
+
- `Header` and `Footer` are horizontal bars at top/bottom; the `Scaffold` body fills remaining space
|
|
72
|
+
- `Section` > `Heading` + content for semantic grouping within a body
|
|
73
|
+
- `Columns` creates equal-width columns; `Rows` creates stacked rows
|
|
74
|
+
- `Responsive` uses container queries; `Breakpoint` uses viewport queries
|
|
75
|
+
- All layout components are thin compositions of stacks — they expose stack props
|
|
76
|
+
- Use `<Resizable>` decorator wrapper for resizable regions, not layout props
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Mobile
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/mobile/viewport/` | MobileViewport — visual viewport tracking wrapper |
|
|
12
|
+
| `src/mobile/portal/` | MobilePortal — portal for mobile overlays |
|
|
13
|
+
| `src/mobile/actions/` | Mobile action components (FloatingActionButton, MobileButton) |
|
|
14
|
+
| `src/mobile/inputs/date_picker/` | Mobile date picker variant |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Imports
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// Mobile components are exported from the root entry point
|
|
22
|
+
import { MobileViewport, MobilePortal } from '@tcn/ui';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Reference
|
|
28
|
+
|
|
29
|
+
- Mobile uses **separate roots**, not responsive leaves — phone and tablet get their own component trees
|
|
30
|
+
- `MobileViewport` tracks the visual viewport (handles keyboard, address bar) and provides context
|
|
31
|
+
- `MobilePortal` renders overlays within the mobile viewport context
|
|
32
|
+
- Mobile inputs (e.g., date picker) are full-viewport experiences, not inline dropdowns
|
|
33
|
+
- Phone vs tablet: phone uses single-column with bottom navigation; tablet uses sidebar layouts
|
|
34
|
+
- Mobile components do not have a separate entry point — import from `@tcn/ui`
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Navigation
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/navigation/tabs/state/context.tsx` | Stateful tabs context (Tabs, useTabs) |
|
|
12
|
+
| `src/navigation/tabs/state/tab.tsx` | Individual tab item |
|
|
13
|
+
| `src/navigation/tabs/state/nav_bar.tsx` | Tabs navigation bar |
|
|
14
|
+
| `src/navigation/tabs/state/link/tab_link.tsx` | Tab with routing integration |
|
|
15
|
+
| `src/navigation/tabs/primitives/tabs_bar.tsx` | Unstyled tabs bar primitive |
|
|
16
|
+
| `src/navigation/tabs/primitives/tabs_list.tsx` | Tabs list primitive (TabsList, TabItem) |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Imports
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// Stateful tabs (managed selection state)
|
|
24
|
+
import { Tabs, Tab, TabsNavbar, TabLink, useTabs } from '@tcn/ui/navigation';
|
|
25
|
+
|
|
26
|
+
// Primitive tabs (bring your own state)
|
|
27
|
+
import { TabsBar, TabsList, TabItem } from '@tcn/ui/navigation';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Typing
|
|
33
|
+
|
|
34
|
+
| Interface | Use for |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `TabsProps` | Stateful tabs container |
|
|
37
|
+
| `TabProps` | Individual tab |
|
|
38
|
+
| `TabLinkProps` | Tab with route navigation |
|
|
39
|
+
| `TabsBarProps` | Primitive tabs bar |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Quick Reference
|
|
44
|
+
|
|
45
|
+
- Two APIs: **stateful** (Tabs/Tab — manages selection) and **primitive** (TabsBar/TabsList — bring your own state)
|
|
46
|
+
- Stateful tabs use `useTabs` hook for programmatic control
|
|
47
|
+
- `TabLink` integrates with routing for URL-driven tab navigation
|
|
48
|
+
- Primitive tabs are unstyled and fully controlled
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Overlay
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/overlay/portal/portal.tsx` | React portal — renders children outside DOM hierarchy |
|
|
12
|
+
| `src/overlay/frame/frame.tsx` | Overlay frame/backdrop container |
|
|
13
|
+
| `src/overlay/menu/menu.tsx` | Dropdown menu |
|
|
14
|
+
| `src/overlay/context_menu/context_menu.tsx` | Right-click context menu |
|
|
15
|
+
| `src/overlay/tethered/tethered.tsx` | Position element relative to trigger |
|
|
16
|
+
| `src/overlay/tethered/element_tethered.tsx` | Element-anchored tethering |
|
|
17
|
+
| `src/overlay/tethered/types.ts` | Tether position type definitions |
|
|
18
|
+
| `src/overlay/popper/base/base_popper.tsx` | Base popper positioning engine |
|
|
19
|
+
| `src/overlay/popper/base/dismissal_decorator.tsx` | Click-outside dismissal |
|
|
20
|
+
| `src/overlay/popper/preview_popper.tsx` | Preview/tooltip popper |
|
|
21
|
+
| `src/overlay/popper/context_popper.tsx` | Context menu popper |
|
|
22
|
+
| `src/overlay/popper/element_popper.tsx` | Element-anchored popper |
|
|
23
|
+
| `src/overlay/popper/legacy/popper.tsx` | Legacy popper API |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Imports
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import {
|
|
31
|
+
Portal, Frame, Menu, ContextMenu,
|
|
32
|
+
Tethered, ElementTethered,
|
|
33
|
+
BasePopper, PreviewPopper, ContextPopper, ElementPopper,
|
|
34
|
+
} from '@tcn/ui/overlay';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Typing
|
|
40
|
+
|
|
41
|
+
| Interface | Use for |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `PortalProps` | Portal container |
|
|
44
|
+
| `MenuProps` | Dropdown menu |
|
|
45
|
+
| `TetheredProps` | Positioned overlay |
|
|
46
|
+
| `BasePopperProps` | Base popper |
|
|
47
|
+
| `HorizontalTether` / `VerticalTether` | Tether position enums |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Quick Reference
|
|
52
|
+
|
|
53
|
+
- `Portal` renders into a DOM node outside the React tree (for z-index isolation)
|
|
54
|
+
- `Tethered` / `ElementTethered` position an overlay relative to a trigger element
|
|
55
|
+
- `BasePopper` is the low-level positioning engine; use `PreviewPopper`, `ContextPopper`, or `ElementPopper` for specific patterns
|
|
56
|
+
- `Menu` and `ContextMenu` compose Popper + list for dropdown/right-click menus
|
|
57
|
+
- `Frame` provides a backdrop/overlay container
|
|
58
|
+
- Overlay often composes with Surface components (Modal, Drawer, Popover use Portal + Popper internally)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Stacks
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/stacks/v_stack.tsx` | Vertical flexbox stack |
|
|
12
|
+
| `src/stacks/h_stack.tsx` | Horizontal flexbox stack |
|
|
13
|
+
| `src/stacks/z_stack.tsx` | Z-axis layering stack |
|
|
14
|
+
| `src/stacks/box/box.tsx` | Base box container (non-directional) |
|
|
15
|
+
| `src/stacks/box/types.ts` | Box type definitions |
|
|
16
|
+
| `src/stacks/spacer.tsx` | Flexible spacer between items |
|
|
17
|
+
| `src/stacks/v_collapsible_box.tsx` | Collapsible vertical container |
|
|
18
|
+
| `src/stacks/h_collapsible_box.tsx` | Collapsible horizontal container |
|
|
19
|
+
| `src/stacks/types/` | Alignment, sizing, and common type definitions |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Imports
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import {
|
|
27
|
+
VStack, HStack, ZStack, Box, Spacer,
|
|
28
|
+
VCollapsibleBox, HCollapsibleBox,
|
|
29
|
+
} from '@tcn/ui/stacks';
|
|
30
|
+
|
|
31
|
+
// Type imports
|
|
32
|
+
import type { Alignment, As } from '@tcn/ui/stacks';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Typing
|
|
38
|
+
|
|
39
|
+
| Interface | Use for |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `VStackProps<E>` | Vertical stack (generic over HTML element) |
|
|
42
|
+
| `HStackProps<E>` | Horizontal stack |
|
|
43
|
+
| `ZStackProps<E>` | Z-axis layering stack |
|
|
44
|
+
| `BoxProps<E>` | Base box |
|
|
45
|
+
| `Alignment` | Alignment values for hAlign/vAlign |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Reference
|
|
50
|
+
|
|
51
|
+
- Stacks are the **atomic primitives** underneath layouts and surfaces — most apps should use named layout components (Scaffold, Rail, Header, Section) and surfaces (Panel, Card, Page) instead
|
|
52
|
+
- **Use stacks when building custom reusable components**, not for app-level UI composition
|
|
53
|
+
- Common props: `hAlign`, `vAlign`, `width`, `height`, `gap`, `growWeight`, `shrinkWeight`, `padding`, `margin`
|
|
54
|
+
- Sizing accepts: `'default' | 'flex' | 'auto' | 'fill' | string | number`
|
|
55
|
+
- `VStack` = vertical flex, `HStack` = horizontal flex, `ZStack` = absolute positioning layers
|
|
56
|
+
- `Box` is a non-directional container (no flex direction)
|
|
57
|
+
- `Spacer` fills available space between siblings
|
|
58
|
+
- Polymorphic `as` prop changes the rendered HTML element
|
|
59
|
+
- All stacks use `forwardRef` with generic element type
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Surfaces
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
Surfaces are the **starting point** for building UI. They are styled containers that provide themed visual treatment (borders, shadows, backgrounds). Use layouts inside surfaces to build their internal structure — headers, footers, sections, columns.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Surface Categories
|
|
10
|
+
|
|
11
|
+
**Container surfaces** — wrap a `Scaffold` internally, designed for complex layout composition:
|
|
12
|
+
- `Panel`, `Card`, `Page`, `Aside` — inline containers for content regions
|
|
13
|
+
- `Modal`, `Window`, `Drawer` — overlay containers (positioned/animated, but still Scaffold-based inside)
|
|
14
|
+
|
|
15
|
+
**Functional surfaces** — styled overlays for contextual feedback, simpler internal structure:
|
|
16
|
+
- `Tooltip` — hover-triggered label overlay
|
|
17
|
+
- `Popover` — floating content overlay
|
|
18
|
+
- `PopConfirm` — confirmation overlay anchored to an element
|
|
19
|
+
- `Alert`, `Confirm` — notification/confirmation dialogs
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Source Files
|
|
24
|
+
|
|
25
|
+
| File | Purpose |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `src/surfaces/panel/panel.tsx` | Panel — primary content container (wraps Scaffold) |
|
|
28
|
+
| `src/surfaces/card/card.tsx` | Card — secondary content container (wraps Scaffold) |
|
|
29
|
+
| `src/surfaces/page/page.tsx` | Page — full page surface (wraps Scaffold) |
|
|
30
|
+
| `src/surfaces/aside/aside.tsx` | Aside — sidebar surface (wraps Scaffold) |
|
|
31
|
+
| `src/surfaces/modal/modal.tsx` | Modal — overlay dialog (Frame + Scaffold) |
|
|
32
|
+
| `src/surfaces/window/window.tsx` | Window — draggable/resizable overlay (Frame + Scaffold) |
|
|
33
|
+
| `src/surfaces/drawer/drawer.tsx` | Drawer — slide-out panel (Slide + Scaffold) |
|
|
34
|
+
| `src/surfaces/tooltip/tooltip.tsx` | Tooltip — hover label overlay |
|
|
35
|
+
| `src/surfaces/popover/popover.tsx` | Popover — floating content overlay |
|
|
36
|
+
| `src/surfaces/pop_confirm/pop_confirm.tsx` | PopConfirm — anchored confirmation overlay |
|
|
37
|
+
| `src/surfaces/alert/alert.tsx` | Alert — notification dialog |
|
|
38
|
+
| `src/surfaces/confirm/confirm.tsx` | Confirm — confirmation dialog |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Imports
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import {
|
|
46
|
+
Panel, Card, Page, Aside,
|
|
47
|
+
Modal, Window, Drawer,
|
|
48
|
+
Tooltip, Popover, PopConfirm,
|
|
49
|
+
Alert, Confirm,
|
|
50
|
+
} from '@tcn/ui/surfaces';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Typing
|
|
56
|
+
|
|
57
|
+
| Interface | Use for |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `PanelProps` | Panel container |
|
|
60
|
+
| `CardProps` | Card container |
|
|
61
|
+
| `PageProps` | Full page surface |
|
|
62
|
+
| `AsideProps` | Sidebar surface |
|
|
63
|
+
| `ModalProps` | Modal dialog |
|
|
64
|
+
| `DrawerProps` | Slide-out drawer |
|
|
65
|
+
| `WindowProps` | Draggable window |
|
|
66
|
+
| `TooltipProps` | Tooltip overlay |
|
|
67
|
+
| `PopoverProps` | Floating popover |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Quick Reference
|
|
72
|
+
|
|
73
|
+
- **Start with a surface**, then use layouts for internal structure (see [layouts.md](layouts.md))
|
|
74
|
+
- Container surfaces (Panel, Card, Page) wrap Scaffold — use `Header`, `Footer`, `Section`, `Columns` inside them
|
|
75
|
+
- The standard pattern: `<Panel>` → `<Header>` + `<Scaffold>` (body) + `<Footer>`
|
|
76
|
+
- Overlay surfaces (Modal, Drawer, Window) follow the same internal layout pattern, just positioned differently
|
|
77
|
+
- `Alert` uses `data-severity` for themed severity levels (info, warning, error)
|
|
78
|
+
- `Window` supports drag and resize via Frame (compose with decorators for additional behavior)
|
|
79
|
+
- All surfaces expose `tcn-` class names — themes control all visual appearance contextually
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Themes
|
|
2
|
+
|
|
3
|
+
> **Scaffold placeholder.** Read the source files below for full implementation details. This document will be expanded with usage patterns and examples.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Source Files
|
|
8
|
+
|
|
9
|
+
| File | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `src/themes/theme.tsx` | Theme provider component |
|
|
12
|
+
| `src/themes/theme_variables.ts` | CSS custom property definitions (colors, spacing, font, status) |
|
|
13
|
+
| `src/themes/build_stylesheet.ts` | Theme stylesheet builder utility |
|
|
14
|
+
| `src/themes/stylesheets/reset.ts` | CSS reset export |
|
|
15
|
+
| `src/themes/stylesheets/reset.css` | Browser reset stylesheet |
|
|
16
|
+
| `src/themes/themes/ergo/ergo_theme.ts` | Ergo theme (default) |
|
|
17
|
+
| `src/themes/themes/ergo/ergo_theme.css` | Ergo theme stylesheet |
|
|
18
|
+
| `src/themes/themes/ergo/parts/` | Ergo theme parts (actions, base, form, inputs, navigation) |
|
|
19
|
+
| `src/themes/themes/ergo/tokens/` | Ergo tokens (system_tokens.css, theme_tokens.css) |
|
|
20
|
+
| `src/themes/themes/windows_98/windows_98_theme.ts` | Windows 98 retro theme |
|
|
21
|
+
| `src/themes/themes/windows_98/windows_98.css` | Windows 98 stylesheet |
|
|
22
|
+
| `src/css/layers.css` | CSS cascade layer definitions |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Imports
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// Theme system
|
|
30
|
+
import { theme, theme_variables, reset } from '@tcn/ui/themes';
|
|
31
|
+
|
|
32
|
+
// Specific themes
|
|
33
|
+
import { ergo_theme } from '@tcn/ui/themes/ergo';
|
|
34
|
+
import { windows_98_theme } from '@tcn/ui/themes/windows98';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Quick Reference
|
|
40
|
+
|
|
41
|
+
- Components are **theme-agnostic** — the same JSX renders differently depending on which theme stylesheet is active
|
|
42
|
+
- Three CSS cascade layers enforce precedence: `tcn-reset` < `tcn-system` (`:where()`) < `tcn-theme`
|
|
43
|
+
- Themes target `tcn-*` class names and `data-*` attributes in the `tcn-theme` layer
|
|
44
|
+
- `theme_variables` provides CSS custom properties: colors, spacing, font, status, `--scalar`
|
|
45
|
+
- The `--scalar` variable enables proportional scaling across all components
|
|
46
|
+
- **Custom components** should use `theme_variables` instead of hardcoded values
|
|
47
|
+
- Contextual theming: a `Button` inside a `UtilityBar` inside a `Panel` can have a unique appearance — all controlled by the theme
|