torch-glare 2.3.0 → 2.4.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/README.md +8 -0
- package/apps/lib/components/ActionButton.tsx +7 -12
- package/apps/lib/components/ActionsGroup.tsx +4 -15
- package/apps/lib/components/AlertDialog.tsx +173 -191
- package/apps/lib/components/Avatar.tsx +13 -16
- package/apps/lib/components/Badge.tsx +7 -3
- package/apps/lib/components/BadgeField.tsx +76 -71
- package/apps/lib/components/Breadcrumb.tsx +49 -85
- package/apps/lib/components/Button.tsx +20 -19
- package/apps/lib/components/ButtonGroup.tsx +31 -41
- package/apps/lib/components/Calendar.tsx +51 -29
- package/apps/lib/components/Card.tsx +2 -13
- package/apps/lib/components/ChartBlockTool.ts +17 -52
- package/apps/lib/components/Checkbox.tsx +9 -16
- package/apps/lib/components/ContextMenu.tsx +110 -106
- package/apps/lib/components/CountBadge.tsx +4 -6
- package/apps/lib/components/DataTable.tsx +196 -216
- package/apps/lib/components/DataViews/DataViewRadio.tsx +10 -8
- package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +21 -55
- package/apps/lib/components/DataViews/DataViewsHeader.tsx +1 -3
- package/apps/lib/components/DataViews/DataViewsLayout.tsx +5 -12
- package/apps/lib/components/DataViews/FilterPanel.tsx +173 -150
- package/apps/lib/components/DataViews/HeaderSearch.tsx +1 -5
- package/apps/lib/components/DataViews/InboxView.tsx +22 -68
- package/apps/lib/components/DataViews/InboxViewCard.tsx +68 -77
- package/apps/lib/components/DataViews/KanbanView.tsx +8 -25
- package/apps/lib/components/DataViews/PanelControls.tsx +3 -13
- package/apps/lib/components/DataViews/SettingsPanel.tsx +83 -89
- package/apps/lib/components/DataViews/TableView.tsx +8 -28
- package/apps/lib/components/DataViews/TreeView.tsx +12 -40
- package/apps/lib/components/DataViews/badgeAdapter.ts +32 -28
- package/apps/lib/components/DataViews/fieldRenderers.tsx +106 -141
- package/apps/lib/components/DataViews/filters/DatePickerRangeFilter.tsx +87 -0
- package/apps/lib/components/DataViews/filters/DateRangePopover.tsx +39 -32
- package/apps/lib/components/DataViews/filters/PresetChips.tsx +15 -15
- package/apps/lib/components/DataViews/filters/RangeSliderWithInputs.tsx +69 -58
- package/apps/lib/components/DataViews/index.ts +26 -26
- package/apps/lib/components/DataViews/tree/TreeDrawer.tsx +12 -16
- package/apps/lib/components/DataViews/tree/TreeSidebar.tsx +28 -31
- package/apps/lib/components/DataViews/types.ts +111 -114
- package/apps/lib/components/DatePicker.tsx +198 -191
- package/apps/lib/components/Dialog.tsx +92 -105
- package/apps/lib/components/Divider.tsx +21 -24
- package/apps/lib/components/Drawer.tsx +79 -139
- package/apps/lib/components/DropdownMenu.tsx +144 -181
- package/apps/lib/components/FieldHint.tsx +4 -11
- package/apps/lib/components/Form.tsx +146 -155
- package/apps/lib/components/FormStepper.tsx +9 -39
- package/apps/lib/components/HeaderBar.tsx +119 -0
- package/apps/lib/components/ImageAttachment.tsx +111 -73
- package/apps/lib/components/InnerLabelField.tsx +20 -16
- package/apps/lib/components/Input.tsx +171 -172
- package/apps/lib/components/InputField.tsx +44 -45
- package/apps/lib/components/InputOTP.tsx +68 -69
- package/apps/lib/components/Label.tsx +31 -35
- package/apps/lib/components/LabelField.tsx +4 -5
- package/apps/lib/components/LabeledCheckBox.tsx +8 -12
- package/apps/lib/components/LabeledRadio.tsx +7 -5
- package/apps/lib/components/LinkButton.tsx +2 -9
- package/apps/lib/components/LoginButton.tsx +4 -9
- package/apps/lib/components/PasswordLevel.tsx +5 -5
- package/apps/lib/components/Popover.tsx +15 -33
- package/apps/lib/components/ProfileMenu.tsx +67 -72
- package/apps/lib/components/Radio.tsx +1 -5
- package/apps/lib/components/RadioCard.tsx +9 -28
- package/apps/lib/components/ScrollArea.tsx +45 -43
- package/apps/lib/components/SearchField.tsx +49 -39
- package/apps/lib/components/SearchableSelect.tsx +46 -52
- package/apps/lib/components/SearchableTable.tsx +199 -219
- package/apps/lib/components/SearchableTree.tsx +469 -0
- package/apps/lib/components/SearchableTreeDialog.tsx +493 -0
- package/apps/lib/components/SectionBlock.tsx +4 -16
- package/apps/lib/components/Select.tsx +53 -80
- package/apps/lib/components/SimpleSelect.tsx +196 -187
- package/apps/lib/components/Skeleton.tsx +9 -12
- package/apps/lib/components/SlideDatePicker.tsx +215 -166
- package/apps/lib/components/SpinLoading.tsx +33 -49
- package/apps/lib/components/Stepper.tsx +13 -56
- package/apps/lib/components/Switch.tsx +8 -10
- package/apps/lib/components/TabFormItem.tsx +3 -12
- package/apps/lib/components/TabSwitch.tsx +7 -34
- package/apps/lib/components/Table.tsx +60 -75
- package/apps/lib/components/TableDnDWrapper.ts +15 -48
- package/apps/lib/components/TextEditor.tsx +93 -104
- package/apps/lib/components/Textarea.tsx +8 -12
- package/apps/lib/components/Timeline.tsx +21 -41
- package/apps/lib/components/Toast.tsx +83 -83
- package/apps/lib/components/Toggle.tsx +112 -114
- package/apps/lib/components/ToggleButton.tsx +1 -1
- package/apps/lib/components/Tooltip.tsx +24 -19
- package/apps/lib/components/TransparentLabel.tsx +61 -62
- package/apps/lib/components/TreeDropDown.tsx +86 -52
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +15 -48
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +16 -21
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +9 -20
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +3 -3
- package/apps/lib/components/TreeFolder/icons.tsx +14 -17
- package/apps/lib/components/TreeFolder/index.ts +15 -8
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +47 -52
- package/apps/lib/components/TreeFolder/types.ts +32 -32
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +117 -123
- package/apps/lib/hooks/useActiveTreeItem.ts +52 -55
- package/apps/lib/hooks/useClickOutside.ts +21 -20
- package/apps/lib/hooks/useDataViewsState.ts +86 -80
- package/apps/lib/hooks/useIsMobile.ts +12 -12
- package/apps/lib/hooks/useResize.ts +54 -65
- package/apps/lib/hooks/useTagSelection.ts +201 -201
- package/apps/lib/layouts/CNLayout.tsx +181 -140
- package/apps/lib/layouts/DataViewCard.tsx +4 -18
- package/apps/lib/layouts/FieldSection.tsx +2 -6
- package/apps/lib/layouts/TreeSubLayout.tsx +24 -38
- package/apps/lib/providers/ThemeProvider.tsx +8 -23
- package/apps/lib/registry.json +1004 -0
- package/apps/lib/tsconfig.json +9 -0
- package/apps/lib/utils/cn.ts +1 -1
- package/apps/lib/utils/dataViews/columnUtils.ts +46 -44
- package/apps/lib/utils/dataViews/fieldUtils.ts +70 -71
- package/apps/lib/utils/dataViews/nestedDataUtils.tsx +129 -122
- package/apps/lib/utils/dataViews/pathUtils.ts +74 -67
- package/apps/lib/utils/dataViews/rangeUtils.ts +121 -112
- package/apps/lib/utils/dataViews/treeUtils.ts +204 -211
- package/apps/lib/utils/dateFormat.ts +64 -54
- package/apps/lib/utils/markdownParser.ts +2 -7
- package/apps/lib/utils/resize.ts +21 -25
- package/apps/lib/utils/types.ts +13 -13
- package/dist/bin/index.js +8 -2
- package/dist/bin/index.js.map +1 -1
- package/dist/src/shared/getAvailableFiles.d.ts.map +1 -1
- package/dist/src/shared/getAvailableFiles.js +6 -1
- package/dist/src/shared/getAvailableFiles.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +7 -0
- package/dist/src/shared/loadRegistry.d.ts.map +1 -0
- package/dist/src/shared/loadRegistry.js +31 -0
- package/dist/src/shared/loadRegistry.js.map +1 -0
- package/dist/src/shared/resolveInstallPlan.d.ts +12 -0
- package/dist/src/shared/resolveInstallPlan.d.ts.map +1 -0
- package/dist/src/shared/resolveInstallPlan.js +39 -0
- package/dist/src/shared/resolveInstallPlan.js.map +1 -0
- package/dist/src/types/main.d.ts +24 -0
- package/dist/src/types/main.d.ts.map +1 -1
- package/docs/README.md +10 -2
- package/docs/components/action-button.md +30 -24
- package/docs/components/actions-group.md +26 -20
- package/docs/components/alert-dialog.md +45 -45
- package/docs/components/avatar.md +6 -2
- package/docs/components/badge-field.md +6 -2
- package/docs/components/badge.md +7 -1
- package/docs/components/breadcrumb.md +15 -40
- package/docs/components/button-group.md +13 -10
- package/docs/components/button.md +58 -33
- package/docs/components/calendar.md +26 -19
- package/docs/components/card.md +19 -16
- package/docs/components/chart-block-tool.md +128 -0
- package/docs/components/checkbox.md +16 -8
- package/docs/components/cn-layout.md +7 -1
- package/docs/components/context-menu.md +47 -24
- package/docs/components/count-badge.md +7 -1
- package/docs/components/data-table.md +45 -33
- package/docs/components/data-views-config-panel.md +18 -14
- package/docs/components/data-views-layout.md +20 -17
- package/docs/components/date-picker.md +30 -23
- package/docs/components/dialog.md +43 -42
- package/docs/components/divider.md +10 -4
- package/docs/components/drawer.md +8 -33
- package/docs/components/dropdown-menu.md +51 -32
- package/docs/components/field-hint.md +37 -25
- package/docs/components/field-section.md +9 -3
- package/docs/components/form-stepper.md +6 -0
- package/docs/components/form.md +17 -20
- package/docs/components/header-bar.md +187 -0
- package/docs/components/image-attachment.md +33 -41
- package/docs/components/inbox-view.md +16 -5
- package/docs/components/inner-label-field.md +34 -24
- package/docs/components/input-field.md +18 -10
- package/docs/components/input-otp.md +14 -11
- package/docs/components/input.md +22 -16
- package/docs/components/kanban-view.md +15 -5
- package/docs/components/label-field.md +32 -22
- package/docs/components/label.md +43 -32
- package/docs/components/labeled-check-box.md +16 -8
- package/docs/components/labeled-radio.md +18 -11
- package/docs/components/link-button.md +7 -1
- package/docs/components/login-button.md +8 -2
- package/docs/components/password-level.md +37 -24
- package/docs/components/popover.md +26 -23
- package/docs/components/profile-menu.md +38 -27
- package/docs/components/radio-card.md +16 -9
- package/docs/components/radio.md +16 -8
- package/docs/components/scroll-area.md +6 -2
- package/docs/components/search-field.md +14 -6
- package/docs/components/searchable-select.md +19 -14
- package/docs/components/searchable-table.md +60 -41
- package/docs/components/searchable-tree-dialog.md +190 -0
- package/docs/components/searchable-tree.md +200 -0
- package/docs/components/section-block.md +130 -4
- package/docs/components/select.md +23 -18
- package/docs/components/simple-select.md +14 -10
- package/docs/components/skeleton.md +43 -33
- package/docs/components/slide-date-picker.md +37 -29
- package/docs/components/spin-loading.md +32 -23
- package/docs/components/stepper.md +6 -0
- package/docs/components/switch.md +14 -6
- package/docs/components/tab-form-item.md +7 -1
- package/docs/components/tab-switch.md +13 -6
- package/docs/components/table-dnd-wrapper.md +105 -0
- package/docs/components/table-view.md +15 -5
- package/docs/components/table.md +28 -28
- package/docs/components/text-editor.md +19 -13
- package/docs/components/textarea.md +15 -7
- package/docs/components/timeline.md +6 -0
- package/docs/components/toast.md +35 -26
- package/docs/components/toggle-button.md +24 -21
- package/docs/components/toggle.md +23 -15
- package/docs/components/tooltip.md +42 -30
- package/docs/components/transparent-label.md +29 -20
- package/docs/components/tree-drop-down.md +31 -23
- package/docs/components/tree-sub-layout.md +6 -2
- package/docs/components/tree-view.md +16 -5
- package/docs/explanation/architecture.md +54 -0
- package/docs/explanation/design-system.md +52 -0
- package/docs/how-to/data-views-from-backend-response.md +7 -4
- package/docs/how-to/guides.md +24 -18
- package/docs/migration/changelog.md +38 -0
- package/docs/reference/cli.md +87 -0
- package/docs/reference/components.md +11 -12
- package/docs/reference/hooks.md +8 -8
- package/docs/reference/providers.md +22 -22
- package/docs/reference/tailwind-plugins.md +2 -2
- package/docs/reference/theme.md +85 -0
- package/docs/reference/types.md +4 -4
- package/docs/reference/utilities.md +19 -26
- package/docs/tutorials/building-first-form.md +20 -13
- package/docs/tutorials/component-composition.md +34 -50
- package/docs/tutorials/getting-started.md +2 -2
- package/docs/tutorials/theming-basics.md +13 -10
- package/package.json +31 -3
- package/dist/src/commands/block.d.ts +0 -5
- package/dist/src/commands/block.d.ts.map +0 -1
- package/dist/src/commands/block.js +0 -255
- package/dist/src/commands/block.js.map +0 -1
- package/dist/src/shared/configureFonts.d.ts +0 -6
- package/dist/src/shared/configureFonts.d.ts.map +0 -1
- package/dist/src/shared/configureFonts.js +0 -106
- package/dist/src/shared/configureFonts.js.map +0 -1
- package/dist/src/shared/configureGlobalCss.d.ts +0 -6
- package/dist/src/shared/configureGlobalCss.d.ts.map +0 -1
- package/dist/src/shared/configureGlobalCss.js +0 -154
- package/dist/src/shared/configureGlobalCss.js.map +0 -1
- package/dist/src/shared/configureTailwind.d.ts +0 -7
- package/dist/src/shared/configureTailwind.d.ts.map +0 -1
- package/dist/src/shared/configureTailwind.js +0 -163
- package/dist/src/shared/configureTailwind.js.map +0 -1
- package/dist/src/shared/detectFramework.d.ts +0 -23
- package/dist/src/shared/detectFramework.d.ts.map +0 -1
- package/dist/src/shared/detectFramework.js +0 -119
- package/dist/src/shared/detectFramework.js.map +0 -1
- package/dist/src/shared/installBaseUtils.d.ts +0 -5
- package/dist/src/shared/installBaseUtils.d.ts.map +0 -1
- package/dist/src/shared/installBaseUtils.js +0 -79
- package/dist/src/shared/installBaseUtils.js.map +0 -1
- package/dist/src/shared/resolveAliases.d.ts +0 -24
- package/dist/src/shared/resolveAliases.d.ts.map +0 -1
- package/dist/src/shared/resolveAliases.js +0 -98
- package/dist/src/shared/resolveAliases.js.map +0 -1
|
@@ -11,13 +11,22 @@ keywords: [transparent-label, text, typography, gradient, fade, truncate]
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
15
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx torch-glare@latest init
|
|
19
|
+
npx torch-glare@latest add TransparentLabel
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`add` also copies any components, hooks, and utilities that `TransparentLabel` depends on.
|
|
15
23
|
|
|
16
24
|
## Import
|
|
17
25
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
21
30
|
```
|
|
22
31
|
|
|
23
32
|
## Quick Examples
|
|
@@ -25,7 +34,7 @@ import type { TransparentLabelProps } from '@torch-ui/components'
|
|
|
25
34
|
### Basic Usage
|
|
26
35
|
|
|
27
36
|
```typescript
|
|
28
|
-
import { TransparentLabel } from
|
|
37
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
29
38
|
|
|
30
39
|
function Example() {
|
|
31
40
|
return (
|
|
@@ -39,7 +48,7 @@ function Example() {
|
|
|
39
48
|
### Different Sizes
|
|
40
49
|
|
|
41
50
|
```typescript
|
|
42
|
-
import { TransparentLabel } from
|
|
51
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
43
52
|
|
|
44
53
|
function Sizes() {
|
|
45
54
|
return (
|
|
@@ -67,7 +76,7 @@ function Sizes() {
|
|
|
67
76
|
### Truncating Long Text
|
|
68
77
|
|
|
69
78
|
```typescript
|
|
70
|
-
import { TransparentLabel } from
|
|
79
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
71
80
|
|
|
72
81
|
function TruncatedText() {
|
|
73
82
|
const longText = "This is a very long text that needs to be truncated gracefully with a fade-out effect instead of showing ellipsis or cutting off abruptly"
|
|
@@ -85,7 +94,7 @@ function TruncatedText() {
|
|
|
85
94
|
### Typography Variants
|
|
86
95
|
|
|
87
96
|
```typescript
|
|
88
|
-
import { TransparentLabel } from
|
|
97
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
89
98
|
|
|
90
99
|
function TypographyShowcase() {
|
|
91
100
|
return (
|
|
@@ -125,8 +134,8 @@ function TypographyShowcase() {
|
|
|
125
134
|
### Card with Fade Effect
|
|
126
135
|
|
|
127
136
|
```typescript
|
|
128
|
-
import { TransparentLabel } from
|
|
129
|
-
import { Card } from
|
|
137
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
138
|
+
import { Card } from "@/components/Card";
|
|
130
139
|
|
|
131
140
|
function ProductCard() {
|
|
132
141
|
return (
|
|
@@ -148,7 +157,7 @@ function ProductCard() {
|
|
|
148
157
|
### List with Truncated Items
|
|
149
158
|
|
|
150
159
|
```typescript
|
|
151
|
-
import { TransparentLabel } from
|
|
160
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
152
161
|
|
|
153
162
|
function TruncatedList() {
|
|
154
163
|
const items = [
|
|
@@ -175,7 +184,7 @@ function TruncatedList() {
|
|
|
175
184
|
### Navigation with Fade
|
|
176
185
|
|
|
177
186
|
```typescript
|
|
178
|
-
import { TransparentLabel } from
|
|
187
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
179
188
|
|
|
180
189
|
function Navigation() {
|
|
181
190
|
const navItems = [
|
|
@@ -207,7 +216,7 @@ function Navigation() {
|
|
|
207
216
|
### Breadcrumbs
|
|
208
217
|
|
|
209
218
|
```typescript
|
|
210
|
-
import { TransparentLabel } from
|
|
219
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
211
220
|
|
|
212
221
|
function Breadcrumbs() {
|
|
213
222
|
const crumbs = [
|
|
@@ -240,7 +249,7 @@ function Breadcrumbs() {
|
|
|
240
249
|
### Table Cell with Fade
|
|
241
250
|
|
|
242
251
|
```typescript
|
|
243
|
-
import { TransparentLabel } from
|
|
252
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
244
253
|
|
|
245
254
|
function DataTable() {
|
|
246
255
|
const data = [
|
|
@@ -287,7 +296,7 @@ function DataTable() {
|
|
|
287
296
|
### Custom Color with Fade
|
|
288
297
|
|
|
289
298
|
```typescript
|
|
290
|
-
import { TransparentLabel } from
|
|
299
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
291
300
|
|
|
292
301
|
function ColoredLabels() {
|
|
293
302
|
return (
|
|
@@ -320,7 +329,7 @@ function ColoredLabels() {
|
|
|
320
329
|
### RTL Support
|
|
321
330
|
|
|
322
331
|
```typescript
|
|
323
|
-
import { TransparentLabel } from
|
|
332
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
324
333
|
|
|
325
334
|
function RTLExample() {
|
|
326
335
|
return (
|
|
@@ -451,7 +460,7 @@ export const TransparentLabel: React.FC<TransparentLabelProps>
|
|
|
451
460
|
### Usage with Types
|
|
452
461
|
|
|
453
462
|
```typescript
|
|
454
|
-
import { TransparentLabel } from
|
|
463
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
455
464
|
import { useState } from 'react'
|
|
456
465
|
|
|
457
466
|
type Size = 'body-medium-regular' | 'body-large-bold' | 'headers-medium-semibold'
|
|
@@ -483,7 +492,7 @@ function TypedExample() {
|
|
|
483
492
|
### Truncated Text Component
|
|
484
493
|
|
|
485
494
|
```typescript
|
|
486
|
-
import { TransparentLabel } from
|
|
495
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
487
496
|
import { useState } from 'react'
|
|
488
497
|
|
|
489
498
|
interface TruncatedTextProps {
|
|
@@ -518,7 +527,7 @@ function TruncatedText({ text, maxWidth = '200px', size = 'body-medium-regular'
|
|
|
518
527
|
### Responsive Typography
|
|
519
528
|
|
|
520
529
|
```typescript
|
|
521
|
-
import { TransparentLabel } from
|
|
530
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
522
531
|
import { useMediaQuery } from '@/hooks/useMediaQuery'
|
|
523
532
|
|
|
524
533
|
function ResponsiveText() {
|
|
@@ -540,7 +549,7 @@ function ResponsiveText() {
|
|
|
540
549
|
|
|
541
550
|
```typescript
|
|
542
551
|
import { render, screen } from '@testing-library/react'
|
|
543
|
-
import { TransparentLabel } from
|
|
552
|
+
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
544
553
|
|
|
545
554
|
describe('TransparentLabel', () => {
|
|
546
555
|
it('renders text content', () => {
|
|
@@ -11,14 +11,22 @@ keywords: [tree, dropdown, navigation, expandable, collapsible, accordion, hiera
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
15
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
16
|
+
|
|
14
17
|
```bash
|
|
15
|
-
|
|
18
|
+
npx torch-glare@latest init
|
|
19
|
+
npx torch-glare@latest add TreeDropDown
|
|
16
20
|
```
|
|
17
21
|
|
|
22
|
+
`add` also copies any components, hooks, and utilities that `TreeDropDown` depends on.
|
|
23
|
+
|
|
18
24
|
## Import
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
22
30
|
```
|
|
23
31
|
|
|
24
32
|
## Quick Examples
|
|
@@ -26,7 +34,7 @@ import { TreeDropDown } from '@torch-ui/components'
|
|
|
26
34
|
### Basic Usage
|
|
27
35
|
|
|
28
36
|
```typescript
|
|
29
|
-
import { TreeDropDown } from
|
|
37
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
30
38
|
|
|
31
39
|
function Example() {
|
|
32
40
|
return (
|
|
@@ -42,7 +50,7 @@ function Example() {
|
|
|
42
50
|
### Nested Tree Structure
|
|
43
51
|
|
|
44
52
|
```typescript
|
|
45
|
-
import { TreeDropDown } from
|
|
53
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
46
54
|
|
|
47
55
|
function FileTree() {
|
|
48
56
|
return (
|
|
@@ -65,7 +73,7 @@ function FileTree() {
|
|
|
65
73
|
### Controlled State
|
|
66
74
|
|
|
67
75
|
```typescript
|
|
68
|
-
import { TreeDropDown } from
|
|
76
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
69
77
|
import { useState } from 'react'
|
|
70
78
|
|
|
71
79
|
function ControlledTree() {
|
|
@@ -92,8 +100,8 @@ function ControlledTree() {
|
|
|
92
100
|
### With Custom Labels
|
|
93
101
|
|
|
94
102
|
```typescript
|
|
95
|
-
import { TreeDropDown } from
|
|
96
|
-
import { Badge } from
|
|
103
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
104
|
+
import { Badge } from "@/components/Badge";
|
|
97
105
|
|
|
98
106
|
function TreeWithBadges() {
|
|
99
107
|
return (
|
|
@@ -101,7 +109,7 @@ function TreeWithBadges() {
|
|
|
101
109
|
treeLabel={
|
|
102
110
|
<div className="flex items-center gap-2">
|
|
103
111
|
<span>Notifications</span>
|
|
104
|
-
<Badge
|
|
112
|
+
<Badge color="redOrange" label="3" size="XS" />
|
|
105
113
|
</div>
|
|
106
114
|
}
|
|
107
115
|
>
|
|
@@ -116,7 +124,7 @@ function TreeWithBadges() {
|
|
|
116
124
|
### Documentation Navigation
|
|
117
125
|
|
|
118
126
|
```typescript
|
|
119
|
-
import { TreeDropDown } from
|
|
127
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
120
128
|
|
|
121
129
|
function DocsNavigation() {
|
|
122
130
|
return (
|
|
@@ -152,7 +160,7 @@ function DocsNavigation() {
|
|
|
152
160
|
### Dark Theme
|
|
153
161
|
|
|
154
162
|
```typescript
|
|
155
|
-
import { TreeDropDown } from
|
|
163
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
156
164
|
|
|
157
165
|
function DarkTree() {
|
|
158
166
|
return (
|
|
@@ -172,7 +180,7 @@ function DarkTree() {
|
|
|
172
180
|
### With Icons
|
|
173
181
|
|
|
174
182
|
```typescript
|
|
175
|
-
import { TreeDropDown } from
|
|
183
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
176
184
|
|
|
177
185
|
function IconTree() {
|
|
178
186
|
return (
|
|
@@ -200,7 +208,7 @@ function IconTree() {
|
|
|
200
208
|
### Multi-Level Navigation
|
|
201
209
|
|
|
202
210
|
```typescript
|
|
203
|
-
import { TreeDropDown } from
|
|
211
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
204
212
|
|
|
205
213
|
function MultiLevelNav() {
|
|
206
214
|
return (
|
|
@@ -227,7 +235,7 @@ function MultiLevelNav() {
|
|
|
227
235
|
### Custom Styling
|
|
228
236
|
|
|
229
237
|
```typescript
|
|
230
|
-
import { TreeDropDown } from
|
|
238
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
231
239
|
|
|
232
240
|
function StyledTree() {
|
|
233
241
|
return (
|
|
@@ -247,7 +255,7 @@ function StyledTree() {
|
|
|
247
255
|
### Initially Expanded
|
|
248
256
|
|
|
249
257
|
```typescript
|
|
250
|
-
import { TreeDropDown } from
|
|
258
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
251
259
|
|
|
252
260
|
function ExpandedByDefault() {
|
|
253
261
|
return (
|
|
@@ -308,7 +316,7 @@ export const TreeDropDown: React.FC<TreeDropDownProps>
|
|
|
308
316
|
### Usage with TypeScript
|
|
309
317
|
|
|
310
318
|
```typescript
|
|
311
|
-
import { TreeDropDown } from
|
|
319
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
312
320
|
import { ReactNode } from 'react'
|
|
313
321
|
|
|
314
322
|
interface TreeItem {
|
|
@@ -337,7 +345,7 @@ function TypedTree({ items }: { items: TreeItem[] }) {
|
|
|
337
345
|
### Recursive Tree Structure
|
|
338
346
|
|
|
339
347
|
```typescript
|
|
340
|
-
import { TreeDropDown } from
|
|
348
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
341
349
|
|
|
342
350
|
interface TreeNode {
|
|
343
351
|
id: string
|
|
@@ -383,7 +391,7 @@ const data: TreeNode[] = [
|
|
|
383
391
|
### Expand/Collapse All
|
|
384
392
|
|
|
385
393
|
```typescript
|
|
386
|
-
import { TreeDropDown } from
|
|
394
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
387
395
|
import { useState } from 'react'
|
|
388
396
|
|
|
389
397
|
function ExpandCollapseAll() {
|
|
@@ -412,7 +420,7 @@ function ExpandCollapseAll() {
|
|
|
412
420
|
### With Active State
|
|
413
421
|
|
|
414
422
|
```typescript
|
|
415
|
-
import { TreeDropDown } from
|
|
423
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
416
424
|
import { useState } from 'react'
|
|
417
425
|
|
|
418
426
|
function NavigationTree() {
|
|
@@ -491,7 +499,7 @@ function NavigationTree() {
|
|
|
491
499
|
|
|
492
500
|
```typescript
|
|
493
501
|
import { render, screen, fireEvent } from '@testing-library/react'
|
|
494
|
-
import { TreeDropDown } from
|
|
502
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
495
503
|
|
|
496
504
|
describe('TreeDropDown', () => {
|
|
497
505
|
it('renders tree label', () => {
|
|
@@ -549,7 +557,7 @@ describe('TreeDropDown', () => {
|
|
|
549
557
|
|
|
550
558
|
```typescript
|
|
551
559
|
import { render, screen, fireEvent } from '@testing-library/react'
|
|
552
|
-
import { TreeDropDown } from
|
|
560
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
553
561
|
|
|
554
562
|
test('nested trees work independently', () => {
|
|
555
563
|
render(
|
|
@@ -593,7 +601,7 @@ test('nested trees work independently', () => {
|
|
|
593
601
|
### Enhanced Accessibility Example
|
|
594
602
|
|
|
595
603
|
```typescript
|
|
596
|
-
import { TreeDropDown } from
|
|
604
|
+
import { TreeDropDown } from "@/components/TreeDropDown";
|
|
597
605
|
import { useState } from 'react'
|
|
598
606
|
|
|
599
607
|
function AccessibleTree() {
|
|
@@ -658,7 +666,7 @@ function AccessibleTree() {
|
|
|
658
666
|
|
|
659
667
|
```diff
|
|
660
668
|
- import { Accordion } from 'other-library'
|
|
661
|
-
+ import { TreeDropDown } from
|
|
669
|
+
+ import { TreeDropDown } from "@/components/TreeDropDown";
|
|
662
670
|
|
|
663
671
|
- <Accordion title="Section">
|
|
664
672
|
+ <TreeDropDown treeLabel="Section">
|
|
@@ -12,11 +12,15 @@ A specialized layout component for Next.js applications that provides hierarchic
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
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
|
+
|
|
15
18
|
```bash
|
|
16
|
-
npx torch-
|
|
19
|
+
npx torch-glare@latest init
|
|
20
|
+
npx torch-glare@latest add TreeSubLayout
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
`add` also copies any components, hooks, and utilities that `TreeSubLayout` depends on.
|
|
20
24
|
|
|
21
25
|
## Imports
|
|
22
26
|
|
|
@@ -11,13 +11,22 @@ keywords: [data-views, tree-view, tree, hierarchy, nested, sidebar, parent-child
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
15
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx torch-glare@latest init
|
|
19
|
+
npx torch-glare@latest add TreeView
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`add` also copies any components, hooks, and utilities that `TreeView` depends on.
|
|
15
23
|
|
|
16
24
|
## Import
|
|
17
25
|
|
|
26
|
+
Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
|
|
27
|
+
|
|
18
28
|
```tsx
|
|
19
|
-
import { TreeView
|
|
20
|
-
import type { TreeViewProps, TreeConfig, FieldConfig } from "torch-glare"
|
|
29
|
+
import { TreeView } from "@/components/TreeView";
|
|
21
30
|
```
|
|
22
31
|
|
|
23
32
|
## When to use it directly
|
|
@@ -54,8 +63,10 @@ const rows = [
|
|
|
54
63
|
## Composable Mode example
|
|
55
64
|
|
|
56
65
|
```tsx
|
|
57
|
-
import { TreeView
|
|
58
|
-
import
|
|
66
|
+
import { TreeView } from "@/components/TreeView";
|
|
67
|
+
import { useDataViewsState } from "@/hooks/useDataViewsState";
|
|
68
|
+
import type { FieldConfig } from "@/components/FieldConfig";
|
|
69
|
+
import type { TreeConfig } from "@/components/TreeConfig";
|
|
59
70
|
|
|
60
71
|
const fields: FieldConfig[] = [
|
|
61
72
|
{ path: "name", type: "text" },
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Architecture
|
|
3
|
+
description: How TORCH Glare is structured — the copy-in distribution model, the CLI, and the registry.
|
|
4
|
+
group: explanation
|
|
5
|
+
keywords: [architecture, copy-in, cli, registry, shadcn]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Architecture
|
|
9
|
+
|
|
10
|
+
## Copy-in distribution
|
|
11
|
+
|
|
12
|
+
TORCH Glare does **not** ship compiled components you import from a package. Instead, the
|
|
13
|
+
published `torch-glare` package contains a CLI plus the raw component source, and
|
|
14
|
+
`npx torch-glare add <Component>` copies that source into your project. This is the same
|
|
15
|
+
model popularized by shadcn/ui.
|
|
16
|
+
|
|
17
|
+
Consequences:
|
|
18
|
+
|
|
19
|
+
- **You own the code.** Copied components live in your repo and can be edited freely.
|
|
20
|
+
- **No runtime package dependency.** You import from your own path (`@/components/…`), not
|
|
21
|
+
from `torch-glare`.
|
|
22
|
+
- **Explicit dependencies.** `add` also copies the component's internal dependencies
|
|
23
|
+
(nested components, hooks, utils) and installs required npm packages such as `@radix-ui/*`.
|
|
24
|
+
|
|
25
|
+
## The registry
|
|
26
|
+
|
|
27
|
+
The dependency graph is described by a generated manifest, `apps/lib/registry.json`. Each
|
|
28
|
+
entry lists a component's npm dependencies and its internal (component/hook/util)
|
|
29
|
+
dependencies. The CLI reads this manifest to resolve the full closure to copy when you run
|
|
30
|
+
`add`, so results are deterministic and testable rather than inferred at install time.
|
|
31
|
+
|
|
32
|
+
The registry is generated from source (`pnpm run registry`) and validated in CI, so it never
|
|
33
|
+
drifts from the actual imports.
|
|
34
|
+
|
|
35
|
+
## Layers
|
|
36
|
+
|
|
37
|
+
| Layer | Location | Role |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| Components | `components/` | UI built with Radix primitives + CVA variants. |
|
|
40
|
+
| Hooks | `hooks/` | Reusable behavior (e.g. `useClickOutside`). |
|
|
41
|
+
| Utils | `utils/` | Helpers like `cn` (class merging) and types. |
|
|
42
|
+
| Providers | `providers/` | Context providers such as `ThemeProvider`. |
|
|
43
|
+
| Layouts | `layouts/` | Composed page/section scaffolds. |
|
|
44
|
+
|
|
45
|
+
## AI-facing docs
|
|
46
|
+
|
|
47
|
+
`llms.txt`, `llms-full.txt`, and `llms-manifest.json` are generated from source
|
|
48
|
+
(`pnpm run llms`) so assistants always get accurate component lists, dependencies, variants,
|
|
49
|
+
and examples. A doc lint (`pnpm run check:ai-docs`) blocks incorrect usage patterns.
|
|
50
|
+
|
|
51
|
+
## See also
|
|
52
|
+
|
|
53
|
+
- [Design system](./design-system.md)
|
|
54
|
+
- [CLI reference](../reference/cli.md)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Design System
|
|
3
|
+
description: The conventions behind TORCH Glare — CVA variants, semantic tokens, sizing, and theming.
|
|
4
|
+
group: explanation
|
|
5
|
+
keywords: [design system, cva, variants, tokens, tailwind, sizing]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Design System
|
|
9
|
+
|
|
10
|
+
TORCH Glare components share a small set of conventions so they compose predictably and
|
|
11
|
+
theme uniformly.
|
|
12
|
+
|
|
13
|
+
## Variants via CVA
|
|
14
|
+
|
|
15
|
+
Component styling is defined with [class-variance-authority](https://cva.style) (`cva`). Each
|
|
16
|
+
component exposes a `variant` and/or `size` prop whose allowed values come directly from its
|
|
17
|
+
`cva` definition. For example, `Button` has variants
|
|
18
|
+
`PrimeStyle, BluSecStyle, YelSecStyle, RedSecStyle, BorderStyle, PrimeContStyle, BluContStyle, RedContStyle`
|
|
19
|
+
and sizes `S, M, L, XL`.
|
|
20
|
+
|
|
21
|
+
Because variant names are the source of truth, docs and the `llms.*` files generate their
|
|
22
|
+
variant lists from these definitions — they can't drift.
|
|
23
|
+
|
|
24
|
+
## Semantic tokens
|
|
25
|
+
|
|
26
|
+
Colors are addressed through semantic CSS variables, not raw hex, so a single component works
|
|
27
|
+
across themes. Names follow a `--{category}-{context}-{component}-{state}` shape, e.g.
|
|
28
|
+
`background-presentation-action-primary` or `content-presentation-state-negative`. Components
|
|
29
|
+
reference these via Tailwind classes like `bg-background-presentation-action-secondary`.
|
|
30
|
+
|
|
31
|
+
## Sizing scale
|
|
32
|
+
|
|
33
|
+
Interactive components use a consistent `S / M / L / XL` scale (some also `XS`). Typography
|
|
34
|
+
components such as `TransparentLabel` instead take a typography-scale `size`
|
|
35
|
+
(e.g. `body-medium-regular`, `headers-large-bold`).
|
|
36
|
+
|
|
37
|
+
## Theming
|
|
38
|
+
|
|
39
|
+
Theme is driven by `data-theme` (`light | dark | default`) and `data-theme-mode`
|
|
40
|
+
(`CSS | TORCH`). Every component accepts a `theme` prop for local overrides; app-wide theming
|
|
41
|
+
uses `ThemeProvider`. See the [theme reference](../reference/theme.md).
|
|
42
|
+
|
|
43
|
+
## Accessibility
|
|
44
|
+
|
|
45
|
+
Interactive components build on Radix UI primitives for keyboard and ARIA behavior. Custom
|
|
46
|
+
controls add the appropriate attributes directly (for example, a loading `Button` sets
|
|
47
|
+
`aria-busy` and exposes its spinner with `role="status"`).
|
|
48
|
+
|
|
49
|
+
## See also
|
|
50
|
+
|
|
51
|
+
- [Architecture](./architecture.md)
|
|
52
|
+
- [Theme reference](../reference/theme.md)
|
|
@@ -14,7 +14,7 @@ back from an API to the props that turn them into a working view.
|
|
|
14
14
|
## TL;DR
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
|
-
import { DataViewsLayout } from "
|
|
17
|
+
import { DataViewsLayout } from "@/components/DataViewsLayout";
|
|
18
18
|
|
|
19
19
|
// the simplest possible case — just pass the array
|
|
20
20
|
<DataViewsLayout title="Records" data={await api.get("/records")} />
|
|
@@ -37,7 +37,7 @@ Add a declarative `fields` map when you want typed rendering (currencies,
|
|
|
37
37
|
badges, dates) and filters:
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
40
|
-
import type { FieldConfig } from "
|
|
40
|
+
import type { FieldConfig } from "@/components/FieldConfig";
|
|
41
41
|
|
|
42
42
|
const fields: FieldConfig[] = [
|
|
43
43
|
{ path: "name", label: "Name", type: "text" },
|
|
@@ -134,7 +134,7 @@ changes. This keeps the URL/server as the source of truth.
|
|
|
134
134
|
|
|
135
135
|
```tsx
|
|
136
136
|
import { useState, useEffect } from "react"
|
|
137
|
-
import type { FilterState } from "
|
|
137
|
+
import type { FilterState } from "@/components/FilterState";
|
|
138
138
|
|
|
139
139
|
function ServerDriven() {
|
|
140
140
|
const [rows, setRows] = useState([])
|
|
@@ -161,7 +161,9 @@ When tabs aren't what you want — e.g. a table beside a kanban — bypass
|
|
|
161
161
|
`DataViewsLayout` and compose the views with `useDataViewsState`.
|
|
162
162
|
|
|
163
163
|
```tsx
|
|
164
|
-
import {
|
|
164
|
+
import { KanbanView } from "@/components/KanbanView";
|
|
165
|
+
import { TableView } from "@/components/TableView";
|
|
166
|
+
import { useDataViewsState } from "@/hooks/useDataViewsState";
|
|
165
167
|
|
|
166
168
|
function SplitScreen({ data, fields }) {
|
|
167
169
|
const state = useDataViewsState({ data, fields })
|
|
@@ -183,6 +185,7 @@ See each view's reference: [TableView](../components/table-view.md) ·
|
|
|
183
185
|
|
|
184
186
|
- **Empty `data`** → all views render their empty state; pass `isLoading` upstream if you fetch async.
|
|
185
187
|
- **Tree tab missing?** No hierarchy was detected. Supply `treeConfig` explicitly or check your `childrenField` / `parentField`.
|
|
188
|
+
- **Unwanted filters?** The panel auto-detects filterable text fields with few unique values (e.g. `id`, `name`). Set `filterable: false` on a field to exclude it. For a field with many options, set `filterVariant: "searchable-select"` to render a searchable dropdown instead of a long checkbox list.
|
|
186
189
|
- **Saved Views don't persist** in tab mode — that's a known limitation documented in [`DataViewsConfigPanel`](../components/data-views-config-panel.md). Use composable mode for real persistence.
|
|
187
190
|
|
|
188
191
|
## Related
|