torch-glare 2.4.5 → 2.5.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/apps/lib/components/DataViews/{badgeAdapter.ts → badge.ts} +2 -2
- package/apps/lib/components/DataViews/cell.tsx +324 -0
- package/apps/lib/components/DataViews/context.ts +144 -0
- package/apps/lib/components/DataViews/data-views.tsx +383 -0
- package/apps/lib/components/DataViews/filters/children.tsx +98 -0
- package/apps/lib/components/DataViews/filters/custom.tsx +34 -0
- package/apps/lib/components/DataViews/filters/filters.tsx +163 -0
- package/apps/lib/components/DataViews/filters/index.ts +4 -0
- package/apps/lib/components/DataViews/filters/labelled.tsx +20 -0
- package/apps/lib/components/DataViews/filters/presets.tsx +65 -0
- package/apps/lib/components/DataViews/filters/summary.tsx +65 -0
- package/apps/lib/components/DataViews/filters/sync.tsx +35 -0
- package/apps/lib/components/DataViews/filters/values.ts +173 -0
- package/apps/lib/components/DataViews/header.tsx +217 -0
- package/apps/lib/components/DataViews/hooks/index.ts +5 -0
- package/apps/lib/components/DataViews/hooks/useActiveRow.ts +22 -0
- package/apps/lib/components/DataViews/hooks/useControllable.ts +52 -0
- package/apps/lib/components/DataViews/index.ts +74 -26
- package/apps/lib/components/DataViews/panel/columns.tsx +153 -0
- package/apps/lib/components/DataViews/panel/controls.tsx +106 -0
- package/apps/lib/components/DataViews/panel/index.ts +3 -0
- package/apps/lib/components/DataViews/panel/panel.tsx +164 -0
- package/apps/lib/components/DataViews/panel/saved-views.tsx +67 -0
- package/apps/lib/components/DataViews/panel/section.tsx +79 -0
- package/apps/lib/components/DataViews/panel/sort.tsx +42 -0
- package/apps/lib/components/DataViews/panel/tab.tsx +31 -0
- package/apps/lib/components/DataViews/slots.ts +63 -0
- package/apps/lib/components/DataViews/states.tsx +38 -0
- package/apps/lib/components/DataViews/types.ts +485 -178
- package/apps/lib/components/DataViews/views/board-view.tsx +379 -0
- package/apps/lib/components/DataViews/views/card-rows.tsx +36 -0
- package/apps/lib/components/DataViews/views/inbox-view.tsx +257 -0
- package/apps/lib/components/DataViews/views/pane-views.tsx +192 -0
- package/apps/lib/components/DataViews/views/table-view.tsx +426 -0
- package/apps/lib/components/DataViews/views/tree-view.tsx +365 -0
- package/apps/lib/components/FormBuilder/context.ts +20 -6
- package/apps/lib/components/FormBuilder/field-kind.ts +28 -0
- package/apps/lib/components/FormBuilder/fields/DateField.tsx +3 -3
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +7 -6
- package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +7 -6
- package/apps/lib/components/FormBuilder/fields/SelectField.tsx +7 -7
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +1 -1
- package/apps/lib/components/FormBuilder/fields/TextField.tsx +9 -9
- package/apps/lib/components/FormBuilder/form-builder.tsx +55 -3
- package/apps/lib/components/FormBuilder/index.ts +3 -1
- package/apps/lib/components/FormBuilder/types.ts +40 -0
- package/apps/lib/components/TabSwitch.tsx +16 -4
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +6 -3
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +16 -14
- package/apps/lib/components/TreeFolder/index.ts +1 -1
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +70 -207
- package/apps/lib/hooks/useDragDrop.tsx +365 -0
- package/apps/lib/hooks/useInfiniteScroll.ts +108 -0
- package/apps/lib/registry.json +159 -4
- package/apps/lib/tsconfig.tsbuildinfo +1 -1
- package/apps/lib/utils/dataViews/path.ts +67 -0
- package/apps/lib/utils/dataViews/query.ts +73 -0
- package/apps/lib/utils/dataViews/types.ts +187 -0
- package/docs/components/breadcrumb.md +1 -1
- package/docs/components/button-group.md +1 -1
- package/docs/components/button.md +1 -1
- package/docs/components/card.md +1 -1
- package/docs/components/checkbox.md +1 -1
- package/docs/components/data-views/backend-response.md +324 -0
- package/docs/components/data-views/examples/a11y-rtl.md +250 -0
- package/docs/components/data-views/examples/api-orders-route.md +130 -0
- package/docs/components/data-views/examples/fields.md +362 -0
- package/docs/components/data-views/examples/filters.md +308 -0
- package/docs/components/data-views/examples/inbox-routing.md +218 -0
- package/docs/components/data-views/examples/index.md +29 -0
- package/docs/components/data-views/examples/overview.md +244 -0
- package/docs/components/data-views/examples/panel.md +212 -0
- package/docs/components/data-views/examples/scale.md +231 -0
- package/docs/components/data-views/examples/server-side.md +210 -0
- package/docs/components/data-views/examples/state.md +250 -0
- package/docs/components/data-views/examples/tree-custom.md +388 -0
- package/docs/components/data-views/examples/view-registry.md +313 -0
- package/docs/components/data-views/examples/views.md +534 -0
- package/docs/components/data-views/guide.md +405 -0
- package/docs/components/data-views/index.md +1504 -0
- package/docs/components/data-views/migration.md +79 -0
- package/docs/components/date-picker.md +0 -1
- package/docs/components/form-builder.md +3 -2
- package/docs/components/form-renderer.md +2 -1
- package/docs/components/form.md +1 -1
- package/docs/components/input-field.md +1 -1
- package/docs/components/input-otp.md +1 -1
- package/docs/components/input.md +1 -1
- package/docs/components/labeled-check-box.md +1 -1
- package/docs/components/labeled-radio.md +1 -1
- package/docs/components/radio-card.md +1 -1
- package/docs/components/radio.md +1 -1
- package/docs/components/search-field.md +1 -1
- package/docs/components/section-block.md +1 -1
- package/docs/components/select.md +1 -1
- package/docs/components/simple-select.md +1 -1
- package/docs/components/switch.md +1 -1
- package/docs/components/tab-switch.md +1 -1
- package/docs/components/table.md +1 -1
- package/docs/components/text-editor.md +1 -1
- package/docs/components/textarea.md +1 -1
- package/docs/components/toggle-button.md +1 -1
- package/docs/components/toggle.md +1 -1
- package/docs/components/tree-folder.md +110 -0
- package/docs/how-to/forms-with-form-builder.md +2 -2
- package/docs/reference/components.md +16 -6
- package/docs/tutorials/component-composition.md +11 -13
- package/package.json +3 -2
- package/apps/lib/components/DataViews/DataViewRadio.tsx +0 -49
- package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +0 -393
- package/apps/lib/components/DataViews/DataViewsHeader.tsx +0 -207
- package/apps/lib/components/DataViews/DataViewsLayout.tsx +0 -332
- package/apps/lib/components/DataViews/FilterPanel.tsx +0 -493
- package/apps/lib/components/DataViews/HeaderSearch.tsx +0 -93
- package/apps/lib/components/DataViews/InboxView.tsx +0 -463
- package/apps/lib/components/DataViews/InboxViewCard.tsx +0 -127
- package/apps/lib/components/DataViews/KanbanView.tsx +0 -336
- package/apps/lib/components/DataViews/PanelControls.tsx +0 -39
- package/apps/lib/components/DataViews/SettingsPanel.tsx +0 -279
- package/apps/lib/components/DataViews/TableView.tsx +0 -212
- package/apps/lib/components/DataViews/TreeView.tsx +0 -364
- package/apps/lib/components/DataViews/fieldRenderers.tsx +0 -299
- package/apps/lib/components/DataViews/filters/DatePickerRangeFilter.tsx +0 -87
- package/apps/lib/components/DataViews/filters/DateRangePopover.tsx +0 -120
- package/apps/lib/components/DataViews/filters/PresetChips.tsx +0 -45
- package/apps/lib/components/DataViews/filters/RangeSliderWithInputs.tsx +0 -165
- package/apps/lib/components/DataViews/tree/TreeDrawer.tsx +0 -50
- package/apps/lib/components/DataViews/tree/TreeSidebar.tsx +0 -74
- package/apps/lib/hooks/useDataViewsState.ts +0 -175
- package/apps/lib/utils/dataViews/columnUtils.ts +0 -132
- package/apps/lib/utils/dataViews/fieldUtils.ts +0 -197
- package/apps/lib/utils/dataViews/nestedDataUtils.tsx +0 -371
- package/apps/lib/utils/dataViews/pathUtils.ts +0 -139
- package/apps/lib/utils/dataViews/rangeUtils.ts +0 -234
- package/apps/lib/utils/dataViews/treeUtils.ts +0 -396
- package/docs/components/data-views-config-panel.md +0 -208
- package/docs/components/data-views-layout.md +0 -291
- package/docs/components/inbox-view.md +0 -170
- package/docs/components/kanban-view.md +0 -135
- package/docs/components/table-view.md +0 -141
- package/docs/components/tree-view.md +0 -147
- package/docs/how-to/data-views-from-backend-response.md +0 -194
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrating to the DataViews component
|
|
3
|
+
description: The DataViewsLayout family was replaced by one compound DataViews component. What each old part maps to, and what was removed.
|
|
4
|
+
group: migration
|
|
5
|
+
keywords: [migration, data-views, dataviews-layout, kanban-view, table-view, inbox-view, tree-view, config-panel, upgrade, breaking]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Migrating to the DataViews component
|
|
9
|
+
|
|
10
|
+
The `DataViewsLayout` family — a layout component plus one standalone component per view, wired
|
|
11
|
+
together with `useDataViewsState` — was replaced by a single compound component, `DataViews`.
|
|
12
|
+
|
|
13
|
+
If you never used those, there is nothing to do here: they were **folder components that the
|
|
14
|
+
registry never listed**, so `npx torch-glare add KanbanView` was never able to install one. The
|
|
15
|
+
docs described them, the CLI could not deliver them. That mismatch is what this release fixes.
|
|
16
|
+
|
|
17
|
+
## What maps to what
|
|
18
|
+
|
|
19
|
+
| Old | New |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `DataViewsLayout` | `DataViews` |
|
|
22
|
+
| `TableView` | `DataViews.Table` |
|
|
23
|
+
| `KanbanView` | `DataViews.Board` |
|
|
24
|
+
| `InboxView` | `DataViews.Inbox` |
|
|
25
|
+
| `TreeView` | `DataViews.Tree` |
|
|
26
|
+
| `DataViewsConfigPanel` | `DataViews.Panel`, with `Panel.Tab` · `Panel.SavedViews` · `Panel.Columns` · `Panel.Sort` |
|
|
27
|
+
| `useDataViewsState` | the `query` prop + `onQueryChange` |
|
|
28
|
+
|
|
29
|
+
The shape of the change is that a view is no longer *configured*, it is *rendered*. There is no map
|
|
30
|
+
of which views to enable: render `<DataViews.Board/>` and a Board tab appears; wrap it in a
|
|
31
|
+
condition and it disappears, switching away from it if it was the open one.
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
// before — composable mode, wired by hand
|
|
35
|
+
const state = useDataViewsState();
|
|
36
|
+
<DataViewsLayout state={state} views={{ table: true, kanban: true }}>
|
|
37
|
+
<TableView state={state} />
|
|
38
|
+
<KanbanView state={state} groups={groups} />
|
|
39
|
+
</DataViewsLayout>
|
|
40
|
+
|
|
41
|
+
// after
|
|
42
|
+
<DataViews rows={rows} total={total} fields={fields} onQueryChange={setQuery}>
|
|
43
|
+
<DataViews.Header title="Orders">
|
|
44
|
+
<DataViews.ViewSwitch />
|
|
45
|
+
</DataViews.Header>
|
|
46
|
+
<DataViews.Table />
|
|
47
|
+
<DataViews.Board groups={groups} />
|
|
48
|
+
</DataViews>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Also removed
|
|
52
|
+
|
|
53
|
+
Three parts of `DataViews` itself went in the same release.
|
|
54
|
+
|
|
55
|
+
**`DataViews.Pagination`** — rows now load as you scroll. Pass `onLoadMore` and append each page to
|
|
56
|
+
`rows`; whether there is more is derived from `rows.length < total`, so there is no `hasMore` prop.
|
|
57
|
+
See the *Large datasets* section of the [DataViews doc](./index.md).
|
|
58
|
+
|
|
59
|
+
**`DataViews.Empty`** — when there is nothing to show, the view shows nothing: the table keeps its
|
|
60
|
+
header band and has no rows, the board keeps its columns and has no cards. A centred message in
|
|
61
|
+
place of the view threw away the chrome, and it could not tell "no results" apart from "not fetched
|
|
62
|
+
yet" — so the first load of every page announced that nothing matched before anything had been
|
|
63
|
+
asked for.
|
|
64
|
+
|
|
65
|
+
**`DataViews.Loading`** — each view now paints its own skeleton, in its own shape, driven by the
|
|
66
|
+
`loading` prop. A custom view registered with `markView` gets the same thing: read `loading` from
|
|
67
|
+
`useDataViewsData()` and lay out the exported `SkeletonBar` / `skeletonKeys`.
|
|
68
|
+
|
|
69
|
+
## Upgrading a copied component
|
|
70
|
+
|
|
71
|
+
`DataViews` is copy-in like everything else, so upgrading means re-running `add` and re-applying any
|
|
72
|
+
local edits:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx torch-glare@latest add DataViews
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
That copies the folder plus its dependencies — `Table`, `FormBuilder`, `TreeFolder`, the
|
|
79
|
+
`useDragDrop` and `useInfiniteScroll` hooks, and the `dataViews` utilities.
|
|
@@ -855,4 +855,3 @@ function DatePickerWithStore() {
|
|
|
855
855
|
- [SlideDatePicker](./slide-date-picker.md) - Mobile-optimized slide picker
|
|
856
856
|
- [InputField](./input-field.md) - Input field used as default trigger
|
|
857
857
|
- [Popover](./popover.md) - Dropdown container
|
|
858
|
-
- [TimePicker](./time-picker.md) - Standalone time picker
|
|
@@ -81,7 +81,8 @@ Each is a JSX child taking at least `name`, plus `label`, `placeholder`,
|
|
|
81
81
|
| `FormBuilder.Slider` (`min,max,step,range`) | `@radix-ui/react-slider` | `number` / `[number,number]` |
|
|
82
82
|
| `FormBuilder.Color` (`presets`, `alpha`) | `ColorPicker` (full palette: SV area, hue, opacity, eyedropper, HEX/RGB/HSL, presets) | hex `string` (`#rrggbb`, or `#rrggbbaa` when opacity < 100%) |
|
|
83
83
|
| `FormBuilder.Phone` (`defaultCountry`) | `SearchableSelect` + `InputField` | `string` |
|
|
84
|
-
| `FormBuilder.Select`
|
|
84
|
+
| `FormBuilder.Select` (`options`) | `Select` | `string` |
|
|
85
|
+
| `FormBuilder.SearchableSelect` (`options`, async: `onSearchChange`/`onLoadMore`/`hasMore`) | `SearchableSelect` | `string` |
|
|
85
86
|
| `FormBuilder.MultiSelect` / `.Tags` (`options`) | `BadgeField` | `string[]` |
|
|
86
87
|
| `FormBuilder.RadioList` (`options`, each with optional `description`) | boxed radio list | `string` |
|
|
87
88
|
| `FormBuilder.CheckboxGroup` (`options`, each with optional `description`) | boxed checkbox list | `string[]` |
|
|
@@ -99,7 +100,7 @@ Each is a JSX child taking at least `name`, plus `label`, `placeholder`,
|
|
|
99
100
|
| `FormBuilder.Signature` (`penColor`) | canvas pad | PNG data-URL `string` |
|
|
100
101
|
| `FormBuilder.FieldArray` (`children` render fn, `defaultItem`) | RHF `useFieldArray` | `object[]` |
|
|
101
102
|
| `FormBuilder.Table` (`columns`, `selectable`, `reorderable`, `defaultItem`) | editable grid in a `SectionBlock` | `object[]` |
|
|
102
|
-
| `FormBuilder.Custom` (`render
|
|
103
|
+
| `FormBuilder.Custom` (`render`) | your control | anything |
|
|
103
104
|
|
|
104
105
|
`FormBuilder.Password` accepts `strengthMeter` (shows a `PasswordLevel` meter). `FormBuilder.FieldArray`
|
|
105
106
|
renders a repeating list — its `children` is a render fn `(rowName, index, remove) => …` and sub-fields
|
|
@@ -286,4 +286,5 @@ const form = useForm({ resolver, defaultValues })
|
|
|
286
286
|
|
|
287
287
|
> `childrenOutside` is the deprecated former name for `summary`. It still works.
|
|
288
288
|
|
|
289
|
-
`FormRenderer`
|
|
289
|
+
`FormRenderer` forwards `summary` straight into the drawer tray, so you rarely need
|
|
290
|
+
`FormDrawer` directly — reach for it only when you want the drawer without a form.
|
package/docs/components/form.md
CHANGED
package/docs/components/input.md
CHANGED
package/docs/components/radio.md
CHANGED
package/docs/components/table.md
CHANGED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: TreeFolder
|
|
3
|
+
description: Hierarchical tree with connector lines, multi-level expand/collapse, breadcrumb, keyboard navigation and touch-capable drag-and-drop reparenting.
|
|
4
|
+
group: Data Display
|
|
5
|
+
keywords: [tree, folder, hierarchy, file-explorer, expand, collapse, breadcrumb, drag-drop, reparent, nested, navigation]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# TreeFolder
|
|
9
|
+
|
|
10
|
+
> A file-explorer style tree: nested nodes with connector lines, selection that highlights the
|
|
11
|
+
> whole subtree, a breadcrumb of the current path, and drag-and-drop that can reparent a node.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
16
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx torch-glare@latest init
|
|
20
|
+
npx torch-glare@latest add TreeFolder
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`TreeFolder` is a folder component — the CLI copies the whole directory, plus the `useDragDrop`
|
|
24
|
+
hook and the `cn` utility it depends on.
|
|
25
|
+
|
|
26
|
+
## Import
|
|
27
|
+
|
|
28
|
+
Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { TreeFolder } from "@/components/TreeFolder";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
const data = [
|
|
38
|
+
{
|
|
39
|
+
id: "src",
|
|
40
|
+
name: "src",
|
|
41
|
+
children: [
|
|
42
|
+
{ id: "app", name: "app", children: [{ id: "page", name: "page.tsx", children: [] }] },
|
|
43
|
+
{ id: "lib", name: "lib", children: [] },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
<TreeFolder
|
|
49
|
+
data={data}
|
|
50
|
+
defaultExpanded="roots"
|
|
51
|
+
onSelectionChange={(id) => setSelected(id)}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Nodes
|
|
56
|
+
|
|
57
|
+
A node is `{ id, name, children }` plus optional presentation and permission flags:
|
|
58
|
+
|
|
59
|
+
| Field | Meaning |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `id` | stable identity — selection, expansion and drag all key off it |
|
|
62
|
+
| `name` | the label, as text (the row owns its own layout) |
|
|
63
|
+
| `children` | nested nodes; a node with a non-empty array is *internal* (a folder) |
|
|
64
|
+
| `icon` | overrides the resolved icon for this node |
|
|
65
|
+
| `meta` | trailing content on the row — a count, a badge |
|
|
66
|
+
| `disabled` | greyed out and non-interactive |
|
|
67
|
+
| `draggable` / `droppable` | opt this node out of being picked up, or dropped into |
|
|
68
|
+
| `data` | anything of yours; the component never reads it |
|
|
69
|
+
|
|
70
|
+
## Props
|
|
71
|
+
|
|
72
|
+
| Prop | Type | Notes |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| `data` | `TreeFolderNode[]` | the hierarchy |
|
|
75
|
+
| `selectedId` / `defaultSelectedId` | `string \| null` | controlled or uncontrolled selection |
|
|
76
|
+
| `onSelectionChange` | `(id: string \| null) => void` | |
|
|
77
|
+
| `expandedIds` / `defaultExpanded` | `string[]` · `"all" \| "roots" \| "none"` | |
|
|
78
|
+
| `onExpandedChange` | `(ids: string[]) => void` | |
|
|
79
|
+
| `dndEnabled` | `boolean` | turns dragging on |
|
|
80
|
+
| `onMove` | `(args: { dragIds, parentId, index }) => void` | reports the drop; moves nothing |
|
|
81
|
+
| `onDataChange` | `(next: TreeFolderNode[]) => void` | the tree applied the move for you |
|
|
82
|
+
| `iconFor` | resolver | per-node icon from `{ isOpen, isInternal, isSelected }` |
|
|
83
|
+
| `title` · `showHeader` · `showBreadcrumb` · `headerAccessory` | | the chrome above the rows |
|
|
84
|
+
| `highlightAncestors` · `highlightSubtree` | `boolean` | how far a selection tints |
|
|
85
|
+
| `rowHeight` · `indent` · `contentMinWidth` | `number` | 28 and 14 by default |
|
|
86
|
+
| `emptyState` | `ReactNode` | |
|
|
87
|
+
|
|
88
|
+
An imperative handle exposes `selectId`, `expandAll`, `collapseAll` and `scrollToId`.
|
|
89
|
+
|
|
90
|
+
## Dragging
|
|
91
|
+
|
|
92
|
+
Set `dndEnabled` and handle `onMove`. A drop is reported as **which nodes, into which parent, at
|
|
93
|
+
which index** — the tree does not rearrange itself unless you also pass `onDataChange`, which hands
|
|
94
|
+
back an already-moved copy for the uncontrolled case.
|
|
95
|
+
|
|
96
|
+
Where a drop lands depends on where in the row it happens: the top and bottom quarters mean
|
|
97
|
+
*beside* the target (reordering among its siblings), the middle means *inside* it (reparenting). A
|
|
98
|
+
leaf has no inside, so its whole row reads as before-or-after. A node can never be dropped into its
|
|
99
|
+
own descendant — that would detach the branch from the root — and the guard is enforced before
|
|
100
|
+
`onMove` fires.
|
|
101
|
+
|
|
102
|
+
It works with a finger and with the keyboard: hold to pick up and swipe to scroll, or Space, arrows,
|
|
103
|
+
Space. Auto-scroll near the edges is handled for you.
|
|
104
|
+
|
|
105
|
+
## Notes
|
|
106
|
+
|
|
107
|
+
`DataViews.Tree` composes this component — the row height, indent, connector lines, selection band
|
|
108
|
+
and drag grip all come from here, which is why a tree inside DataViews looks like every other tree
|
|
109
|
+
in the product. `renderNode` there returns `{ name, icon, meta }` rather than markup, because this
|
|
110
|
+
component owns the row.
|
|
@@ -153,7 +153,7 @@ Every field, its underlying control, and the value your `onSubmit` receives:
|
|
|
153
153
|
| `.Signature` (`penColor`) | PNG data-URL `string` |
|
|
154
154
|
| `.FieldArray` (`children` render fn, `defaultItem`) | `object[]` |
|
|
155
155
|
| `.Table` (`columns`, `selectable`, `reorderable`, `defaultItem`) | `object[]` — editable grid; top-level child (not in a Section) |
|
|
156
|
-
| `.Custom` (`render
|
|
156
|
+
| `.Custom` (`render`) | anything |
|
|
157
157
|
|
|
158
158
|
See the [FormBuilder](../components/form-builder.md) doc for the full prop tables.
|
|
159
159
|
|
|
@@ -375,7 +375,7 @@ drawer's tray, beside the form:
|
|
|
375
375
|
onOpenChange={setOpen}
|
|
376
376
|
form={form}
|
|
377
377
|
onSubmit={save}
|
|
378
|
-
header={{ title: "New item",
|
|
378
|
+
header={{ title: "New item", label: "New", variant: "new" }}
|
|
379
379
|
summary={
|
|
380
380
|
<FormSummary form={form} title="Item" subtitle="Summary">
|
|
381
381
|
<FormSummary.Group title="Pricing">
|
|
@@ -14,7 +14,7 @@ Complete reference index of all 53 components in the TORCH Glare Components Libr
|
|
|
14
14
|
- [Forms & Inputs (17)](#forms--inputs)
|
|
15
15
|
- [Buttons & Actions (3)](#buttons--actions)
|
|
16
16
|
- [Layout & Containers (7)](#layout--containers)
|
|
17
|
-
- [Data Display (
|
|
17
|
+
- [Data Display (9)](#data-display)
|
|
18
18
|
- [Overlays & Dialogs (7)](#overlays--dialogs)
|
|
19
19
|
- [Date & Time (3)](#date--time)
|
|
20
20
|
- [Feedback & Status (4)](#feedback--status)
|
|
@@ -68,7 +68,7 @@ Selectable checkbox component with multiple states.
|
|
|
68
68
|
### LabeledCheckBox
|
|
69
69
|
Checkbox with integrated label and description.
|
|
70
70
|
|
|
71
|
-
- **File**: [labeled-
|
|
71
|
+
- **File**: [labeled-check-box.md](../components/labeled-check-box.md)
|
|
72
72
|
- **Props**: `label`, `description`, `checked`, `onChange`
|
|
73
73
|
- **Features**: Built-in label, optional description
|
|
74
74
|
- **Use Cases**: Terms acceptance, preferences, options
|
|
@@ -253,6 +253,16 @@ Grouped action buttons.
|
|
|
253
253
|
|
|
254
254
|
## Data Display
|
|
255
255
|
|
|
256
|
+
### DataViews
|
|
257
|
+
One dataset shown as a table, kanban board, inbox or tree, behind a shared header, filters and settings rail.
|
|
258
|
+
|
|
259
|
+
- **File**: [data-views.md](../components/data-views/index.md)
|
|
260
|
+
- **Guide**: [Build a screen with DataViews](../components/data-views/guide.md)
|
|
261
|
+
- **Parts**: `Header` · `ViewSwitch` · `Search` · `Actions` · `PanelToggle` · `Table` · `Board` · `Inbox` · `Tree` (+ `Tree.Table`, `Tree.Cards`, `Tree.Tab`) · `Detail` · `Panel` (+ `Tab`, `Section`, `Columns`, `Sort`, `SavedViews`) · `Filters` (+ `Presets`, `Custom`, `Summary`)
|
|
262
|
+
- **Props**: `rows`, `fields`, `total`, `loading`, `onQueryChange`, `onLoadMore`, `getRowId`, `defaultView`
|
|
263
|
+
- **Features**: Scroll loading, table virtualization past 300 rows, drag and drop on four surfaces (touch + keyboard), filters authored as FormBuilder fields, saved views
|
|
264
|
+
- **Use Cases**: Any list screen where the server owns the query
|
|
265
|
+
|
|
256
266
|
### Badge
|
|
257
267
|
Small status or label indicator.
|
|
258
268
|
|
|
@@ -305,7 +315,7 @@ Advanced table with features.
|
|
|
305
315
|
### TreeDropDown
|
|
306
316
|
Hierarchical dropdown menu.
|
|
307
317
|
|
|
308
|
-
- **File**: [tree-
|
|
318
|
+
- **File**: [tree-drop-down.md](../components/tree-drop-down.md)
|
|
309
319
|
- **Props**: `tree`, `value`, `onChange`
|
|
310
320
|
- **Features**: Nested items, expand/collapse
|
|
311
321
|
- **Use Cases**: Category selection, file trees
|
|
@@ -537,9 +547,9 @@ All components are fully typed with TypeScript. Import types from the library:
|
|
|
537
547
|
|
|
538
548
|
```typescript
|
|
539
549
|
import type { ButtonProps } from "@/components/Button";
|
|
540
|
-
import type { InputProps } from "@/components/
|
|
541
|
-
import type {
|
|
542
|
-
import type { SelectProps } from "@/components/
|
|
550
|
+
import type { InputProps } from "@/components/Input";
|
|
551
|
+
import type { LoginButtonProps } from "@/components/LoginButton";
|
|
552
|
+
import type { SelectProps } from "@/components/Select";
|
|
543
553
|
```
|
|
544
554
|
|
|
545
555
|
---
|
|
@@ -391,8 +391,7 @@ import { useState } from 'react';
|
|
|
391
391
|
import { Button } from "@/components/Button";
|
|
392
392
|
import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/Dialog";
|
|
393
393
|
import { LabelField } from "@/components/LabelField";
|
|
394
|
-
import { Select } from "@/components/Select";
|
|
395
|
-
import { SimpleOption } from "@/components/SimpleOption";
|
|
394
|
+
import { Select, SelectItem } from "@/components/Select";
|
|
396
395
|
import { TextArea } from "@/components/TextArea";
|
|
397
396
|
import { toast } from "@/components/Toast";
|
|
398
397
|
|
|
@@ -460,10 +459,10 @@ export default function CreateProjectModal() {
|
|
|
460
459
|
value={formData.category}
|
|
461
460
|
onValueChange={(value) => setFormData({...formData, category: value})}
|
|
462
461
|
>
|
|
463
|
-
<
|
|
464
|
-
<
|
|
465
|
-
<
|
|
466
|
-
<
|
|
462
|
+
<SelectItem value="web">Web Development</SelectItem>
|
|
463
|
+
<SelectItem value="mobile">Mobile App</SelectItem>
|
|
464
|
+
<SelectItem value="design">Design</SelectItem>
|
|
465
|
+
<SelectItem value="other">Other</SelectItem>
|
|
467
466
|
</Select>
|
|
468
467
|
</div>
|
|
469
468
|
|
|
@@ -500,8 +499,7 @@ import { useState } from 'react';
|
|
|
500
499
|
import { Badge } from "@/components/Badge";
|
|
501
500
|
import { Button } from "@/components/Button";
|
|
502
501
|
import { InputField } from "@/components/InputField";
|
|
503
|
-
import { Select } from "@/components/Select";
|
|
504
|
-
import { SimpleOption } from "@/components/SimpleOption";
|
|
502
|
+
import { Select, SelectItem } from "@/components/Select";
|
|
505
503
|
import { Table } from "@/components/Table";
|
|
506
504
|
|
|
507
505
|
interface TableRow {
|
|
@@ -560,10 +558,10 @@ export default function DataTableWithFilters() {
|
|
|
560
558
|
value={statusFilter}
|
|
561
559
|
onValueChange={setStatusFilter}
|
|
562
560
|
>
|
|
563
|
-
<
|
|
564
|
-
<
|
|
565
|
-
<
|
|
566
|
-
<
|
|
561
|
+
<SelectItem value="all">All Status</SelectItem>
|
|
562
|
+
<SelectItem value="active">Active</SelectItem>
|
|
563
|
+
<SelectItem value="pending">Pending</SelectItem>
|
|
564
|
+
<SelectItem value="inactive">Inactive</SelectItem>
|
|
567
565
|
</Select>
|
|
568
566
|
</div>
|
|
569
567
|
</div>
|
|
@@ -876,7 +874,7 @@ You now understand component composition! Continue learning:
|
|
|
876
874
|
|
|
877
875
|
1. **[Component Documentation](../components/)** - Explore all components
|
|
878
876
|
2. **[Hooks Reference](../reference/hooks.md)** - Custom hooks for common patterns
|
|
879
|
-
3. **[Best Practices Guide](../how-to/
|
|
877
|
+
3. **[Best Practices Guide](../how-to/guides.md)** - Advanced patterns
|
|
880
878
|
|
|
881
879
|
## Additional Resources
|
|
882
880
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "torch-glare",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A copy-in React component library (TypeScript + Radix UI + Tailwind CSS). Its CLI copies component source directly into your project — you own the code.",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -b",
|
|
39
39
|
"registry": "node scripts/bin/generateRegistry/index.js",
|
|
40
|
+
"examples": "node scripts/bin/generateExampleDocs/index.js",
|
|
40
41
|
"docs:fix": "node scripts/bin/fixDocs/index.js",
|
|
41
42
|
"check:ai-docs": "node scripts/bin/checkAiDocs/index.js",
|
|
42
43
|
"typecheck": "pnpm -C apps run typecheck",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"test": "pnpm -C apps run test",
|
|
47
48
|
"mcp:build": "pnpm -C mcp install && pnpm -C mcp run build",
|
|
48
49
|
"prepare": "pnpm -C mcp install && pnpm -C mcp run build",
|
|
49
|
-
"deploy": "pnpm run registry && npx tsc --build --force && npm publish --access public"
|
|
50
|
+
"deploy": "pnpm run registry && pnpm run examples && pnpm run check:ai-docs && npx tsc --build --force && npm publish --access public"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"commander": "^13.1.0",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { type ReactNode } from "react";
|
|
4
|
-
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
5
|
-
import { cn } from "../../utils/cn";
|
|
6
|
-
|
|
7
|
-
export interface DataViewRadioProps {
|
|
8
|
-
value: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
className?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function DataViewRadio({ value, label, children, className }: DataViewRadioProps) {
|
|
15
|
-
return (
|
|
16
|
-
<RadioGroupPrimitive.Item
|
|
17
|
-
value={value}
|
|
18
|
-
className={cn(
|
|
19
|
-
"group flex w-full items-center gap-1.5 py-1 ps-2 h-[32px]",
|
|
20
|
-
"cursor-pointer rounded-[8px] text-left outline-none transition-colors",
|
|
21
|
-
"hover:bg-background-presentation-action-contstyle-hover focus-visible:bg-background-presentation-action-contstyle-hover",
|
|
22
|
-
className,
|
|
23
|
-
)}
|
|
24
|
-
>
|
|
25
|
-
<span
|
|
26
|
-
className={cn(
|
|
27
|
-
"flex h-[14px] w-[14px] shrink-0 items-center justify-center rounded-full",
|
|
28
|
-
// Hardcoded literals so the indicator always renders dark inside the
|
|
29
|
-
// DataView regardless of the host app's data-theme (matches the
|
|
30
|
-
// always-dark panel chrome convention). Unselected ring = the spec
|
|
31
|
-
// CheckBox-Primary border (#626467) + BorderStyle fill
|
|
32
|
-
// (rgba(255,255,255,0.05)); same tokens the shared Checkbox uses.
|
|
33
|
-
"border border-[#626467] bg-white/5 transition-colors",
|
|
34
|
-
"group-data-[state=checked]:border-transparent",
|
|
35
|
-
// #0075FF = the previous selected-fill value (border-presentation-state-focus),
|
|
36
|
-
// now literal so the blue is theme-independent and visually unchanged.
|
|
37
|
-
"group-data-[state=checked]:bg-[#0075FF]",
|
|
38
|
-
)}
|
|
39
|
-
>
|
|
40
|
-
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
41
|
-
<span className="h-[6px] w-[6px] rounded-full bg-white" />
|
|
42
|
-
</RadioGroupPrimitive.Indicator>
|
|
43
|
-
</span>
|
|
44
|
-
<span className="flex-1 typography-body-medium-regular text-content-presentation-global-primary">
|
|
45
|
-
{children ?? label}
|
|
46
|
-
</span>
|
|
47
|
-
</RadioGroupPrimitive.Item>
|
|
48
|
-
);
|
|
49
|
-
}
|