torch-glare 2.5.5 → 2.6.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/README.md +4 -3
- package/dist/bin/index.js +9 -24
- package/dist/bin/index.js.map +1 -1
- package/dist/src/commands/add.d.ts +2 -2
- package/dist/src/commands/add.d.ts.map +1 -1
- package/dist/src/commands/add.js +4 -70
- package/dist/src/commands/add.js.map +1 -1
- package/dist/src/commands/hook.d.ts +5 -4
- package/dist/src/commands/hook.d.ts.map +1 -1
- package/dist/src/commands/hook.js +7 -75
- package/dist/src/commands/hook.js.map +1 -1
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/layout.d.ts +5 -4
- package/dist/src/commands/layout.d.ts.map +1 -1
- package/dist/src/commands/layout.js +7 -75
- package/dist/src/commands/layout.js.map +1 -1
- package/dist/src/commands/provider.d.ts +5 -4
- package/dist/src/commands/provider.d.ts.map +1 -1
- package/dist/src/commands/provider.js +7 -75
- package/dist/src/commands/provider.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +78 -43
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/utils.d.ts +5 -4
- package/dist/src/commands/utils.d.ts.map +1 -1
- package/dist/src/commands/utils.js +7 -80
- package/dist/src/commands/utils.js.map +1 -1
- package/dist/src/shared/addFromRegistry.d.ts +16 -0
- package/dist/src/shared/addFromRegistry.d.ts.map +1 -0
- package/dist/src/shared/addFromRegistry.js +88 -0
- package/dist/src/shared/addFromRegistry.js.map +1 -0
- package/dist/src/shared/getInstallCommand.d.ts.map +1 -1
- package/dist/src/shared/getInstallCommand.js +5 -0
- package/dist/src/shared/getInstallCommand.js.map +1 -1
- package/dist/src/shared/installDependencies.d.ts +0 -10
- package/dist/src/shared/installDependencies.d.ts.map +1 -1
- package/dist/src/shared/installDependencies.js +0 -17
- package/dist/src/shared/installDependencies.js.map +1 -1
- package/dist/src/shared/installFromPlan.d.ts +7 -5
- package/dist/src/shared/installFromPlan.d.ts.map +1 -1
- package/dist/src/shared/installFromPlan.js +103 -36
- package/dist/src/shared/installFromPlan.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +12 -3
- package/dist/src/shared/loadRegistry.d.ts.map +1 -1
- package/dist/src/shared/loadRegistry.js +19 -20
- package/dist/src/shared/loadRegistry.js.map +1 -1
- package/dist/src/shared/registryClient.d.ts +19 -0
- package/dist/src/shared/registryClient.d.ts.map +1 -0
- package/dist/src/shared/registryClient.js +128 -0
- package/dist/src/shared/registryClient.js.map +1 -0
- package/dist/src/shared/resolveEntry.d.ts +10 -7
- package/dist/src/shared/resolveEntry.d.ts.map +1 -1
- package/dist/src/shared/resolveEntry.js +18 -13
- package/dist/src/shared/resolveEntry.js.map +1 -1
- package/dist/src/shared/suggestOtherCommand.d.ts +7 -1
- package/dist/src/shared/suggestOtherCommand.d.ts.map +1 -1
- package/dist/src/shared/suggestOtherCommand.js +29 -23
- package/dist/src/shared/suggestOtherCommand.js.map +1 -1
- package/dist/src/types/main.d.ts +31 -2
- package/dist/src/types/main.d.ts.map +1 -1
- package/package.json +6 -11
- package/apps/lib/components/ActionButton.tsx +0 -93
- package/apps/lib/components/ActionsGroup.tsx +0 -27
- package/apps/lib/components/AlertDialog.tsx +0 -204
- package/apps/lib/components/Avatar.tsx +0 -46
- package/apps/lib/components/Badge.tsx +0 -250
- package/apps/lib/components/BadgeField.tsx +0 -338
- package/apps/lib/components/Breadcrumb.tsx +0 -280
- package/apps/lib/components/Button.tsx +0 -317
- package/apps/lib/components/ButtonGroup.tsx +0 -190
- package/apps/lib/components/Calendar.tsx +0 -115
- package/apps/lib/components/Card.tsx +0 -95
- package/apps/lib/components/Checkbox.tsx +0 -42
- package/apps/lib/components/ColorPicker.tsx +0 -441
- package/apps/lib/components/ConclusionHeader.tsx +0 -148
- package/apps/lib/components/ContextMenu.tsx +0 -571
- package/apps/lib/components/CountBadge.tsx +0 -52
- package/apps/lib/components/DataTable.tsx +0 -213
- package/apps/lib/components/DataViews/badge.ts +0 -49
- package/apps/lib/components/DataViews/cell.tsx +0 -324
- package/apps/lib/components/DataViews/context.ts +0 -144
- package/apps/lib/components/DataViews/data-views.tsx +0 -383
- package/apps/lib/components/DataViews/filters/children.tsx +0 -98
- package/apps/lib/components/DataViews/filters/custom.tsx +0 -34
- package/apps/lib/components/DataViews/filters/filters.tsx +0 -157
- package/apps/lib/components/DataViews/filters/index.ts +0 -4
- package/apps/lib/components/DataViews/filters/labelled.tsx +0 -20
- package/apps/lib/components/DataViews/filters/presets.tsx +0 -65
- package/apps/lib/components/DataViews/filters/sync.tsx +0 -35
- package/apps/lib/components/DataViews/filters/values.ts +0 -173
- package/apps/lib/components/DataViews/header.tsx +0 -220
- package/apps/lib/components/DataViews/hooks/index.ts +0 -5
- package/apps/lib/components/DataViews/hooks/useActiveRow.ts +0 -22
- package/apps/lib/components/DataViews/hooks/useControllable.ts +0 -52
- package/apps/lib/components/DataViews/index.ts +0 -84
- package/apps/lib/components/DataViews/panel/columns.tsx +0 -153
- package/apps/lib/components/DataViews/panel/controls.tsx +0 -106
- package/apps/lib/components/DataViews/panel/index.ts +0 -3
- package/apps/lib/components/DataViews/panel/panel.tsx +0 -164
- package/apps/lib/components/DataViews/panel/saved-views.tsx +0 -67
- package/apps/lib/components/DataViews/panel/section.tsx +0 -81
- package/apps/lib/components/DataViews/panel/sort.tsx +0 -42
- package/apps/lib/components/DataViews/panel/tab.tsx +0 -31
- package/apps/lib/components/DataViews/slots.ts +0 -63
- package/apps/lib/components/DataViews/states.tsx +0 -38
- package/apps/lib/components/DataViews/types.ts +0 -510
- package/apps/lib/components/DataViews/views/board-view.tsx +0 -381
- package/apps/lib/components/DataViews/views/card-rows.tsx +0 -36
- package/apps/lib/components/DataViews/views/inbox-view.tsx +0 -260
- package/apps/lib/components/DataViews/views/pane-views.tsx +0 -196
- package/apps/lib/components/DataViews/views/table-view.tsx +0 -493
- package/apps/lib/components/DataViews/views/tree-view.tsx +0 -367
- package/apps/lib/components/DatePicker.tsx +0 -232
- package/apps/lib/components/Dialog.tsx +0 -116
- package/apps/lib/components/Divider.tsx +0 -28
- package/apps/lib/components/Drawer.tsx +0 -420
- package/apps/lib/components/DropdownMenu.tsx +0 -540
- package/apps/lib/components/FieldHint.tsx +0 -69
- package/apps/lib/components/Form.tsx +0 -182
- package/apps/lib/components/FormBuilder/context.ts +0 -73
- package/apps/lib/components/FormBuilder/field-kind.ts +0 -28
- package/apps/lib/components/FormBuilder/fields/ChoiceFields.tsx +0 -60
- package/apps/lib/components/FormBuilder/fields/ColorField.tsx +0 -59
- package/apps/lib/components/FormBuilder/fields/CustomField.tsx +0 -11
- package/apps/lib/components/FormBuilder/fields/DateField.tsx +0 -32
- package/apps/lib/components/FormBuilder/fields/FieldArray.tsx +0 -74
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +0 -163
- package/apps/lib/components/FormBuilder/fields/FileField.tsx +0 -39
- package/apps/lib/components/FormBuilder/fields/OptionListFields.tsx +0 -132
- package/apps/lib/components/FormBuilder/fields/OtpField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +0 -109
- package/apps/lib/components/FormBuilder/fields/RichTextEditorField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/SelectField.tsx +0 -91
- package/apps/lib/components/FormBuilder/fields/SignatureField.tsx +0 -157
- package/apps/lib/components/FormBuilder/fields/SliderField.tsx +0 -67
- package/apps/lib/components/FormBuilder/fields/SwitchBoxField.tsx +0 -41
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +0 -336
- package/apps/lib/components/FormBuilder/fields/TextField.tsx +0 -213
- package/apps/lib/components/FormBuilder/fields/TreeSelectField.tsx +0 -43
- package/apps/lib/components/FormBuilder/fields/countries.ts +0 -303
- package/apps/lib/components/FormBuilder/fields/index.ts +0 -25
- package/apps/lib/components/FormBuilder/form-builder.tsx +0 -198
- package/apps/lib/components/FormBuilder/index.ts +0 -31
- package/apps/lib/components/FormBuilder/numberFormat.ts +0 -16
- package/apps/lib/components/FormBuilder/submit.tsx +0 -47
- package/apps/lib/components/FormBuilder/types.ts +0 -311
- package/apps/lib/components/FormRenderer/FormDrawer.tsx +0 -128
- package/apps/lib/components/FormRenderer/detail.tsx +0 -207
- package/apps/lib/components/FormRenderer/form-renderer.tsx +0 -297
- package/apps/lib/components/FormRenderer/header.tsx +0 -88
- package/apps/lib/components/FormRenderer/index.ts +0 -15
- package/apps/lib/components/FormRenderer/section.tsx +0 -39
- package/apps/lib/components/FormRenderer/stepper.tsx +0 -339
- package/apps/lib/components/FormRenderer/types.ts +0 -78
- package/apps/lib/components/FormSummary.tsx +0 -282
- package/apps/lib/components/HeaderBar.tsx +0 -117
- package/apps/lib/components/ImageAttachment.tsx +0 -209
- package/apps/lib/components/InnerLabelField.tsx +0 -154
- package/apps/lib/components/Input.tsx +0 -224
- package/apps/lib/components/InputField.tsx +0 -147
- package/apps/lib/components/InputOTP.tsx +0 -84
- package/apps/lib/components/Label.tsx +0 -129
- package/apps/lib/components/LabelField.tsx +0 -76
- package/apps/lib/components/LabeledCheckBox.tsx +0 -51
- package/apps/lib/components/LabeledRadio.tsx +0 -51
- package/apps/lib/components/LinkButton.tsx +0 -94
- package/apps/lib/components/LoginButton.tsx +0 -51
- package/apps/lib/components/PasswordLevel.tsx +0 -58
- package/apps/lib/components/Popover.tsx +0 -312
- package/apps/lib/components/ProfileMenu.tsx +0 -85
- package/apps/lib/components/Radio.tsx +0 -59
- package/apps/lib/components/RadioCard.tsx +0 -50
- package/apps/lib/components/ScrollArea.tsx +0 -54
- package/apps/lib/components/SearchField.tsx +0 -62
- package/apps/lib/components/SearchableSelect.tsx +0 -318
- package/apps/lib/components/SearchableTable.tsx +0 -344
- package/apps/lib/components/SearchableTree.tsx +0 -485
- package/apps/lib/components/SearchableTreeDialog.tsx +0 -502
- package/apps/lib/components/SectionBlock.tsx +0 -147
- package/apps/lib/components/Select.tsx +0 -347
- package/apps/lib/components/SimpleSelect.tsx +0 -225
- package/apps/lib/components/Skeleton.tsx +0 -12
- package/apps/lib/components/SlideDatePicker.tsx +0 -253
- package/apps/lib/components/SpinLoading.tsx +0 -174
- package/apps/lib/components/Stepper.tsx +0 -480
- package/apps/lib/components/Switch.tsx +0 -82
- package/apps/lib/components/TabFormItem.tsx +0 -153
- package/apps/lib/components/TabSwitch.tsx +0 -172
- package/apps/lib/components/Table.tsx +0 -610
- package/apps/lib/components/TextEditor/ChartBlockTool.ts +0 -676
- package/apps/lib/components/TextEditor/RichTextField.tsx +0 -46
- package/apps/lib/components/TextEditor/TableDnDWrapper.ts +0 -462
- package/apps/lib/components/TextEditor/TextEditor.tsx +0 -1164
- package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +0 -429
- package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +0 -70
- package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +0 -50
- package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +0 -48
- package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +0 -98
- package/apps/lib/components/TextEditor/editorjs.d.ts +0 -60
- package/apps/lib/components/TextEditor/index.ts +0 -7
- package/apps/lib/components/TextEditor/markdownParser.ts +0 -346
- package/apps/lib/components/Textarea.tsx +0 -117
- package/apps/lib/components/Timeline.tsx +0 -263
- package/apps/lib/components/Toast.tsx +0 -87
- package/apps/lib/components/Toggle.tsx +0 -125
- package/apps/lib/components/ToggleButton.tsx +0 -140
- package/apps/lib/components/Tooltip.tsx +0 -116
- package/apps/lib/components/TransparentLabel.tsx +0 -71
- package/apps/lib/components/TreeDropDown.tsx +0 -115
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +0 -380
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +0 -75
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +0 -354
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +0 -60
- package/apps/lib/components/TreeFolder/icons.tsx +0 -60
- package/apps/lib/components/TreeFolder/index.ts +0 -24
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +0 -109
- package/apps/lib/components/TreeFolder/types.ts +0 -77
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +0 -118
- package/apps/lib/hooks/useActiveTreeItem.ts +0 -58
- package/apps/lib/hooks/useClickOutside.ts +0 -27
- package/apps/lib/hooks/useDragDrop.tsx +0 -365
- package/apps/lib/hooks/useInfiniteScroll.ts +0 -108
- package/apps/lib/hooks/useIsMobile.ts +0 -21
- package/apps/lib/hooks/useResize.ts +0 -67
- package/apps/lib/hooks/useTagSelection.ts +0 -214
- package/apps/lib/layouts/CNLayout.tsx +0 -372
- package/apps/lib/layouts/DataViewCard.tsx +0 -62
- package/apps/lib/layouts/FieldSection.tsx +0 -91
- package/apps/lib/layouts/TreeSubLayout.tsx +0 -173
- package/apps/lib/providers/ThemeProvider.tsx +0 -84
- package/apps/lib/registry.json +0 -1201
- package/apps/lib/tsconfig.json +0 -9
- package/apps/lib/tsconfig.tsbuildinfo +0 -1
- package/apps/lib/utils/cn.ts +0 -6
- package/apps/lib/utils/color.ts +0 -175
- package/apps/lib/utils/dataViews/path.ts +0 -67
- package/apps/lib/utils/dataViews/query.ts +0 -73
- package/apps/lib/utils/dataViews/types.ts +0 -187
- package/apps/lib/utils/dateFormat.ts +0 -108
- package/apps/lib/utils/resize.ts +0 -31
- package/apps/lib/utils/types.ts +0 -16
- package/docs/BLOCKS.md +0 -129
- package/docs/CHANGELOG-1.1.16.md +0 -108
- package/docs/Cover.png +0 -0
- package/docs/README.md +0 -215
- package/docs/components/action-button.md +0 -638
- package/docs/components/actions-group.md +0 -708
- package/docs/components/alert-dialog.md +0 -920
- package/docs/components/avatar.md +0 -709
- package/docs/components/badge-field.md +0 -712
- package/docs/components/badge.md +0 -301
- package/docs/components/breadcrumb.md +0 -930
- package/docs/components/button-group.md +0 -650
- package/docs/components/button.md +0 -639
- package/docs/components/calendar.md +0 -555
- package/docs/components/card.md +0 -622
- package/docs/components/chart-block-tool.md +0 -129
- package/docs/components/checkbox.md +0 -699
- package/docs/components/cn-layout.md +0 -854
- package/docs/components/color-picker.md +0 -101
- package/docs/components/conclusion-header.md +0 -80
- package/docs/components/context-menu.md +0 -483
- package/docs/components/count-badge.md +0 -560
- package/docs/components/data-table.md +0 -854
- package/docs/components/data-views/backend-response.md +0 -324
- package/docs/components/data-views/examples/a11y-rtl.md +0 -250
- package/docs/components/data-views/examples/api-orders-route.md +0 -130
- package/docs/components/data-views/examples/fields.md +0 -362
- package/docs/components/data-views/examples/filters.md +0 -307
- package/docs/components/data-views/examples/inbox-routing.md +0 -218
- package/docs/components/data-views/examples/index.md +0 -29
- package/docs/components/data-views/examples/overview.md +0 -244
- package/docs/components/data-views/examples/panel.md +0 -212
- package/docs/components/data-views/examples/scale.md +0 -231
- package/docs/components/data-views/examples/server-side.md +0 -210
- package/docs/components/data-views/examples/state.md +0 -250
- package/docs/components/data-views/examples/tree-custom.md +0 -388
- package/docs/components/data-views/examples/view-registry.md +0 -313
- package/docs/components/data-views/examples/views.md +0 -534
- package/docs/components/data-views/guide.md +0 -405
- package/docs/components/data-views/index.md +0 -1495
- package/docs/components/data-views/migration.md +0 -79
- package/docs/components/date-picker.md +0 -857
- package/docs/components/dialog.md +0 -929
- package/docs/components/divider.md +0 -766
- package/docs/components/drawer.md +0 -654
- package/docs/components/dropdown-menu.md +0 -668
- package/docs/components/field-hint.md +0 -898
- package/docs/components/field-section.md +0 -781
- package/docs/components/form-builder.md +0 -276
- package/docs/components/form-renderer.md +0 -326
- package/docs/components/form-summary.md +0 -138
- package/docs/components/form.md +0 -785
- package/docs/components/header-bar.md +0 -188
- package/docs/components/image-attachment.md +0 -906
- package/docs/components/inner-label-field.md +0 -819
- package/docs/components/input-field.md +0 -623
- package/docs/components/input-otp.md +0 -756
- package/docs/components/input.md +0 -634
- package/docs/components/label-field.md +0 -770
- package/docs/components/label.md +0 -761
- package/docs/components/labeled-check-box.md +0 -642
- package/docs/components/labeled-radio.md +0 -796
- package/docs/components/link-button.md +0 -685
- package/docs/components/login-button.md +0 -872
- package/docs/components/password-level.md +0 -803
- package/docs/components/popover.md +0 -649
- package/docs/components/profile-menu.md +0 -656
- package/docs/components/radio-card.md +0 -801
- package/docs/components/radio.md +0 -735
- package/docs/components/scroll-area.md +0 -691
- package/docs/components/search-field.md +0 -702
- package/docs/components/searchable-select.md +0 -368
- package/docs/components/searchable-table.md +0 -438
- package/docs/components/searchable-tree-dialog.md +0 -190
- package/docs/components/searchable-tree.md +0 -200
- package/docs/components/section-block.md +0 -477
- package/docs/components/select.md +0 -709
- package/docs/components/simple-select.md +0 -741
- package/docs/components/skeleton.md +0 -706
- package/docs/components/slide-date-picker.md +0 -837
- package/docs/components/spin-loading.md +0 -696
- package/docs/components/stepper.md +0 -316
- package/docs/components/switch.md +0 -770
- package/docs/components/tab-form-item.md +0 -773
- package/docs/components/tab-switch.md +0 -170
- package/docs/components/table-dnd-wrapper.md +0 -107
- package/docs/components/table.md +0 -1088
- package/docs/components/text-editor.md +0 -735
- package/docs/components/textarea.md +0 -681
- package/docs/components/timeline.md +0 -254
- package/docs/components/toast.md +0 -773
- package/docs/components/toggle-button.md +0 -643
- package/docs/components/toggle.md +0 -882
- package/docs/components/tooltip.md +0 -513
- package/docs/components/transparent-label.md +0 -721
- package/docs/components/tree-drop-down.md +0 -740
- package/docs/components/tree-folder.md +0 -110
- package/docs/components/tree-sub-layout.md +0 -707
- package/docs/explanation/architecture.md +0 -54
- package/docs/explanation/design-system.md +0 -52
- package/docs/how-to/form-and-list-recipes.md +0 -386
- package/docs/how-to/forms-with-form-builder.md +0 -472
- package/docs/how-to/guides.md +0 -1027
- package/docs/migration/changelog.md +0 -54
- package/docs/migration/form-builder-2.5.2.md +0 -113
- package/docs/reference/cli.md +0 -112
- package/docs/reference/components.md +0 -572
- package/docs/reference/hooks.md +0 -1500
- package/docs/reference/providers.md +0 -866
- package/docs/reference/tailwind-plugins.md +0 -942
- package/docs/reference/theme.md +0 -85
- package/docs/reference/types.md +0 -1016
- package/docs/reference/utilities.md +0 -704
- package/docs/tutorials/building-first-form.md +0 -846
- package/docs/tutorials/component-composition.md +0 -882
- package/docs/tutorials/getting-started.md +0 -302
- package/docs/tutorials/theming-basics.md +0 -785
|
@@ -1,707 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: TreeSubLayout
|
|
3
|
-
description: Next.js layout component with hierarchical tree navigation for documentation and multi-level content.
|
|
4
|
-
component: true
|
|
5
|
-
group: Layout & Containers
|
|
6
|
-
keywords: [layout, tree, navigation, hierarchy, docs, sidebar, nextjs]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# TreeSubLayout
|
|
10
|
-
|
|
11
|
-
A specialized layout component for Next.js applications that provides hierarchical tree navigation with automatic active state tracking. Perfect for documentation sites, knowledge bases, and multi-level content structures.
|
|
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 TreeSubLayout
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
`add` also copies any components, hooks, and utilities that `TreeSubLayout` depends on.
|
|
24
|
-
|
|
25
|
-
## Imports
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
import TreeSubLayout, { HeaderPage } from '@/layouts/TreeSubLayout'
|
|
29
|
-
import type { PathConfig } from '@/layouts/TreeSubLayout'
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Basic Usage
|
|
33
|
-
|
|
34
|
-
```tsx
|
|
35
|
-
import TreeSubLayout from '@/layouts/TreeSubLayout'
|
|
36
|
-
|
|
37
|
-
const treeData = {
|
|
38
|
-
'/docs': {
|
|
39
|
-
pageHeader: 'Documentation',
|
|
40
|
-
subTitle: 'Getting Started',
|
|
41
|
-
TabsTree: [
|
|
42
|
-
{
|
|
43
|
-
id: 'introduction',
|
|
44
|
-
title: 'Introduction',
|
|
45
|
-
subTree: [
|
|
46
|
-
{ id: 'overview', title: 'Overview' },
|
|
47
|
-
{ id: 'installation', title: 'Installation' },
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: 'components',
|
|
52
|
-
title: 'Components',
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export default function DocsLayout({ children }) {
|
|
59
|
-
return (
|
|
60
|
-
<TreeSubLayout treeData={treeData}>
|
|
61
|
-
{children}
|
|
62
|
-
</TreeSubLayout>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Examples
|
|
68
|
-
|
|
69
|
-
### Documentation Site
|
|
70
|
-
|
|
71
|
-
Complete documentation layout with multiple sections.
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
const docsConfig = {
|
|
75
|
-
'/docs': {
|
|
76
|
-
pageHeader: 'Documentation',
|
|
77
|
-
subTitle: 'v2.0',
|
|
78
|
-
TabsTree: [
|
|
79
|
-
{
|
|
80
|
-
id: 'getting-started',
|
|
81
|
-
title: 'Getting Started',
|
|
82
|
-
subTree: [
|
|
83
|
-
{ id: 'introduction', title: 'Introduction' },
|
|
84
|
-
{ id: 'installation', title: 'Installation' },
|
|
85
|
-
{ id: 'quick-start', title: 'Quick Start' },
|
|
86
|
-
{ id: 'configuration', title: 'Configuration' },
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: 'core-concepts',
|
|
91
|
-
title: 'Core Concepts',
|
|
92
|
-
subTree: [
|
|
93
|
-
{ id: 'components', title: 'Components' },
|
|
94
|
-
{ id: 'styling', title: 'Styling' },
|
|
95
|
-
{ id: 'theming', title: 'Theming' },
|
|
96
|
-
{ id: 'accessibility', title: 'Accessibility' },
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
id: 'components-list',
|
|
101
|
-
title: 'Components',
|
|
102
|
-
subTree: [
|
|
103
|
-
{ id: 'button', title: 'Button' },
|
|
104
|
-
{ id: 'input', title: 'Input' },
|
|
105
|
-
{ id: 'select', title: 'Select' },
|
|
106
|
-
{ id: 'checkbox', title: 'Checkbox' },
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: 'api',
|
|
111
|
-
title: 'API Reference',
|
|
112
|
-
subTree: [
|
|
113
|
-
{ id: 'hooks', title: 'Hooks' },
|
|
114
|
-
{ id: 'utilities', title: 'Utilities' },
|
|
115
|
-
{ id: 'types', title: 'Types' },
|
|
116
|
-
]
|
|
117
|
-
},
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export default function DocsLayout({ children }) {
|
|
123
|
-
return (
|
|
124
|
-
<TreeSubLayout treeData={docsConfig}>
|
|
125
|
-
{children}
|
|
126
|
-
</TreeSubLayout>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Knowledge Base
|
|
132
|
-
|
|
133
|
-
Knowledge base with categorized articles.
|
|
134
|
-
|
|
135
|
-
```tsx
|
|
136
|
-
const kbConfig = {
|
|
137
|
-
'/help': {
|
|
138
|
-
pageHeader: 'Help Center',
|
|
139
|
-
subTitle: 'Find answers to common questions',
|
|
140
|
-
TabsTree: [
|
|
141
|
-
{
|
|
142
|
-
id: 'account',
|
|
143
|
-
title: 'Account & Billing',
|
|
144
|
-
subTree: [
|
|
145
|
-
{ id: 'create-account', title: 'Creating an Account' },
|
|
146
|
-
{ id: 'reset-password', title: 'Reset Password' },
|
|
147
|
-
{ id: 'billing', title: 'Billing Information' },
|
|
148
|
-
{ id: 'cancel', title: 'Cancel Subscription' },
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
id: 'features',
|
|
153
|
-
title: 'Features',
|
|
154
|
-
subTree: [
|
|
155
|
-
{ id: 'dashboard', title: 'Using the Dashboard' },
|
|
156
|
-
{ id: 'reports', title: 'Generate Reports' },
|
|
157
|
-
{ id: 'export', title: 'Export Data' },
|
|
158
|
-
{ id: 'integrations', title: 'Integrations' },
|
|
159
|
-
]
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
id: 'troubleshooting',
|
|
163
|
-
title: 'Troubleshooting',
|
|
164
|
-
subTree: [
|
|
165
|
-
{ id: 'login-issues', title: 'Login Issues' },
|
|
166
|
-
{ id: 'slow-performance', title: 'Slow Performance' },
|
|
167
|
-
{ id: 'error-messages', title: 'Error Messages' },
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: 'contact',
|
|
172
|
-
title: 'Contact Support',
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### API Documentation
|
|
180
|
-
|
|
181
|
-
API reference with endpoints organized by category.
|
|
182
|
-
|
|
183
|
-
```tsx
|
|
184
|
-
const apiConfig = {
|
|
185
|
-
'/api-docs': {
|
|
186
|
-
pageHeader: 'API Documentation',
|
|
187
|
-
subTitle: 'REST API v1',
|
|
188
|
-
TabsTree: [
|
|
189
|
-
{
|
|
190
|
-
id: 'authentication',
|
|
191
|
-
title: 'Authentication',
|
|
192
|
-
subTree: [
|
|
193
|
-
{ id: 'auth-login', title: 'Login' },
|
|
194
|
-
{ id: 'auth-logout', title: 'Logout' },
|
|
195
|
-
{ id: 'auth-refresh', title: 'Refresh Token' },
|
|
196
|
-
{ id: 'auth-verify', title: 'Verify Token' },
|
|
197
|
-
]
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
id: 'users',
|
|
201
|
-
title: 'Users',
|
|
202
|
-
subTree: [
|
|
203
|
-
{ id: 'users-list', title: 'List Users' },
|
|
204
|
-
{ id: 'users-get', title: 'Get User' },
|
|
205
|
-
{ id: 'users-create', title: 'Create User' },
|
|
206
|
-
{ id: 'users-update', title: 'Update User' },
|
|
207
|
-
{ id: 'users-delete', title: 'Delete User' },
|
|
208
|
-
]
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
id: 'projects',
|
|
212
|
-
title: 'Projects',
|
|
213
|
-
subTree: [
|
|
214
|
-
{ id: 'projects-list', title: 'List Projects' },
|
|
215
|
-
{ id: 'projects-get', title: 'Get Project' },
|
|
216
|
-
{ id: 'projects-create', title: 'Create Project' },
|
|
217
|
-
{ id: 'projects-update', title: 'Update Project' },
|
|
218
|
-
{ id: 'projects-delete', title: 'Delete Project' },
|
|
219
|
-
]
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
id: 'webhooks',
|
|
223
|
-
title: 'Webhooks',
|
|
224
|
-
subTree: [
|
|
225
|
-
{ id: 'webhooks-list', title: 'List Webhooks' },
|
|
226
|
-
{ id: 'webhooks-create', title: 'Create Webhook' },
|
|
227
|
-
{ id: 'webhooks-test', title: 'Test Webhook' },
|
|
228
|
-
]
|
|
229
|
-
},
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Product Guide
|
|
236
|
-
|
|
237
|
-
Product user guide with step-by-step instructions.
|
|
238
|
-
|
|
239
|
-
```tsx
|
|
240
|
-
const guideConfig = {
|
|
241
|
-
'/guide': {
|
|
242
|
-
pageHeader: 'User Guide',
|
|
243
|
-
subTitle: 'Learn how to use our platform',
|
|
244
|
-
TabsTree: [
|
|
245
|
-
{
|
|
246
|
-
id: 'setup',
|
|
247
|
-
title: '1. Setup',
|
|
248
|
-
subTree: [
|
|
249
|
-
{ id: 'workspace', title: 'Create Workspace' },
|
|
250
|
-
{ id: 'invite-team', title: 'Invite Team Members' },
|
|
251
|
-
{ id: 'configure', title: 'Configure Settings' },
|
|
252
|
-
]
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
id: 'projects',
|
|
256
|
-
title: '2. Projects',
|
|
257
|
-
subTree: [
|
|
258
|
-
{ id: 'create-project', title: 'Create Your First Project' },
|
|
259
|
-
{ id: 'add-tasks', title: 'Add Tasks' },
|
|
260
|
-
{ id: 'assign', title: 'Assign Team Members' },
|
|
261
|
-
{ id: 'track-progress', title: 'Track Progress' },
|
|
262
|
-
]
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
id: 'collaboration',
|
|
266
|
-
title: '3. Collaboration',
|
|
267
|
-
subTree: [
|
|
268
|
-
{ id: 'comments', title: 'Leave Comments' },
|
|
269
|
-
{ id: 'share-files', title: 'Share Files' },
|
|
270
|
-
{ id: 'notifications', title: 'Manage Notifications' },
|
|
271
|
-
]
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
id: 'advanced',
|
|
275
|
-
title: '4. Advanced Features',
|
|
276
|
-
subTree: [
|
|
277
|
-
{ id: 'automation', title: 'Automation' },
|
|
278
|
-
{ id: 'custom-fields', title: 'Custom Fields' },
|
|
279
|
-
{ id: 'templates', title: 'Templates' },
|
|
280
|
-
]
|
|
281
|
-
},
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Multi-Path Configuration
|
|
288
|
-
|
|
289
|
-
Handle multiple paths with different navigation.
|
|
290
|
-
|
|
291
|
-
```tsx
|
|
292
|
-
const multiPathConfig = {
|
|
293
|
-
'/docs/components': {
|
|
294
|
-
pageHeader: 'Components',
|
|
295
|
-
subTitle: 'UI Component Library',
|
|
296
|
-
TabsTree: [
|
|
297
|
-
{
|
|
298
|
-
id: 'buttons',
|
|
299
|
-
title: 'Buttons',
|
|
300
|
-
subTree: [
|
|
301
|
-
{ id: 'button', title: 'Button' },
|
|
302
|
-
{ id: 'action-button', title: 'ActionButton' },
|
|
303
|
-
{ id: 'link-button', title: 'LinkButton' },
|
|
304
|
-
]
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
id: 'forms',
|
|
308
|
-
title: 'Forms',
|
|
309
|
-
subTree: [
|
|
310
|
-
{ id: 'input', title: 'Input' },
|
|
311
|
-
{ id: 'select', title: 'Select' },
|
|
312
|
-
{ id: 'checkbox', title: 'Checkbox' },
|
|
313
|
-
]
|
|
314
|
-
},
|
|
315
|
-
]
|
|
316
|
-
},
|
|
317
|
-
'/docs/hooks': {
|
|
318
|
-
pageHeader: 'Hooks',
|
|
319
|
-
subTitle: 'React Hooks',
|
|
320
|
-
TabsTree: [
|
|
321
|
-
{
|
|
322
|
-
id: 'state-management',
|
|
323
|
-
title: 'State Management',
|
|
324
|
-
subTree: [
|
|
325
|
-
{ id: 'use-state', title: 'useState' },
|
|
326
|
-
{ id: 'use-reducer', title: 'useReducer' },
|
|
327
|
-
]
|
|
328
|
-
},
|
|
329
|
-
]
|
|
330
|
-
},
|
|
331
|
-
'/docs/utilities': {
|
|
332
|
-
pageHeader: 'Utilities',
|
|
333
|
-
subTitle: 'Helper Functions',
|
|
334
|
-
TabsTree: [
|
|
335
|
-
{
|
|
336
|
-
id: 'styling',
|
|
337
|
-
title: 'Styling',
|
|
338
|
-
subTree: [
|
|
339
|
-
{ id: 'cn', title: 'cn()' },
|
|
340
|
-
{ id: 'cva', title: 'cva()' },
|
|
341
|
-
]
|
|
342
|
-
},
|
|
343
|
-
]
|
|
344
|
-
},
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### With Custom Header
|
|
349
|
-
|
|
350
|
-
Use HeaderPage component separately.
|
|
351
|
-
|
|
352
|
-
```tsx
|
|
353
|
-
import { HeaderPage } from '@/layouts/TreeSubLayout'
|
|
354
|
-
|
|
355
|
-
export function CustomHeader() {
|
|
356
|
-
return (
|
|
357
|
-
<HeaderPage
|
|
358
|
-
title="Dashboard"
|
|
359
|
-
subTitle="Analytics Overview"
|
|
360
|
-
type="space-between"
|
|
361
|
-
>
|
|
362
|
-
<div className="flex gap-2">
|
|
363
|
-
<Button size="S">Export</Button>
|
|
364
|
-
<Button size="S" variant="PrimeStyle">
|
|
365
|
-
Share
|
|
366
|
-
</Button>
|
|
367
|
-
</div>
|
|
368
|
-
</HeaderPage>
|
|
369
|
-
)
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
### Changelog Layout
|
|
374
|
-
|
|
375
|
-
Organized changelog with version sections.
|
|
376
|
-
|
|
377
|
-
```tsx
|
|
378
|
-
const changelogConfig = {
|
|
379
|
-
'/changelog': {
|
|
380
|
-
pageHeader: 'Changelog',
|
|
381
|
-
subTitle: 'What\'s New',
|
|
382
|
-
TabsTree: [
|
|
383
|
-
{
|
|
384
|
-
id: 'v2',
|
|
385
|
-
title: 'Version 2.x',
|
|
386
|
-
subTree: [
|
|
387
|
-
{ id: 'v2-2-0', title: 'v2.2.0 - Current' },
|
|
388
|
-
{ id: 'v2-1-0', title: 'v2.1.0' },
|
|
389
|
-
{ id: 'v2-0-0', title: 'v2.0.0' },
|
|
390
|
-
]
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
id: 'v1',
|
|
394
|
-
title: 'Version 1.x',
|
|
395
|
-
subTree: [
|
|
396
|
-
{ id: 'v1-9-0', title: 'v1.9.0' },
|
|
397
|
-
{ id: 'v1-8-0', title: 'v1.8.0' },
|
|
398
|
-
{ id: 'v1-7-0', title: 'v1.7.0' },
|
|
399
|
-
]
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
id: 'archive',
|
|
403
|
-
title: 'Archive',
|
|
404
|
-
}
|
|
405
|
-
]
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Settings Pages
|
|
411
|
-
|
|
412
|
-
Hierarchical settings navigation.
|
|
413
|
-
|
|
414
|
-
```tsx
|
|
415
|
-
const settingsConfig = {
|
|
416
|
-
'/settings': {
|
|
417
|
-
pageHeader: 'Settings',
|
|
418
|
-
subTitle: 'Manage your account',
|
|
419
|
-
TabsTree: [
|
|
420
|
-
{
|
|
421
|
-
id: 'profile',
|
|
422
|
-
title: 'Profile',
|
|
423
|
-
subTree: [
|
|
424
|
-
{ id: 'personal-info', title: 'Personal Information' },
|
|
425
|
-
{ id: 'avatar', title: 'Avatar & Display' },
|
|
426
|
-
{ id: 'language', title: 'Language & Region' },
|
|
427
|
-
]
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
id: 'security',
|
|
431
|
-
title: 'Security',
|
|
432
|
-
subTree: [
|
|
433
|
-
{ id: 'password', title: 'Change Password' },
|
|
434
|
-
{ id: 'two-factor', title: 'Two-Factor Auth' },
|
|
435
|
-
{ id: 'sessions', title: 'Active Sessions' },
|
|
436
|
-
{ id: 'api-keys', title: 'API Keys' },
|
|
437
|
-
]
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
id: 'notifications',
|
|
441
|
-
title: 'Notifications',
|
|
442
|
-
subTree: [
|
|
443
|
-
{ id: 'email-prefs', title: 'Email Preferences' },
|
|
444
|
-
{ id: 'push-prefs', title: 'Push Notifications' },
|
|
445
|
-
{ id: 'digest', title: 'Daily Digest' },
|
|
446
|
-
]
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
id: 'billing',
|
|
450
|
-
title: 'Billing',
|
|
451
|
-
subTree: [
|
|
452
|
-
{ id: 'subscription', title: 'Subscription' },
|
|
453
|
-
{ id: 'payment-methods', title: 'Payment Methods' },
|
|
454
|
-
{ id: 'invoices', title: 'Invoices' },
|
|
455
|
-
]
|
|
456
|
-
},
|
|
457
|
-
]
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
## API Reference
|
|
463
|
-
|
|
464
|
-
### TreeSubLayout Props
|
|
465
|
-
|
|
466
|
-
| Prop | Type | Default | Description |
|
|
467
|
-
|------|------|---------|-------------|
|
|
468
|
-
| children | `ReactNode` | - | Page content |
|
|
469
|
-
| treeData | `PathConfig` | - | Navigation structure configuration |
|
|
470
|
-
|
|
471
|
-
### PathConfig Type
|
|
472
|
-
|
|
473
|
-
```typescript
|
|
474
|
-
type PathConfig = {
|
|
475
|
-
[pathname: string]: {
|
|
476
|
-
pageHeader: string
|
|
477
|
-
subTitle?: string
|
|
478
|
-
TabsTree: TreeItem[]
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
interface TreeItem {
|
|
483
|
-
id: string
|
|
484
|
-
title: string
|
|
485
|
-
subTree?: TreeItem[]
|
|
486
|
-
}
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
### HeaderPage Props
|
|
490
|
-
|
|
491
|
-
| Prop | Type | Default | Description |
|
|
492
|
-
|------|------|---------|-------------|
|
|
493
|
-
| title | `string` | - | Page title |
|
|
494
|
-
| subTitle | `string` | - | Subtitle text |
|
|
495
|
-
| children | `ReactNode` | - | Additional header content |
|
|
496
|
-
| type | `'start' \| 'space-between'` | `'start'` | Header layout type |
|
|
497
|
-
| className | `string` | - | Additional CSS classes |
|
|
498
|
-
|
|
499
|
-
## Styling
|
|
500
|
-
|
|
501
|
-
### Layout Structure
|
|
502
|
-
|
|
503
|
-
- **Main Container**: Full height with overflow hidden
|
|
504
|
-
- **Content Area**: Scrollable with light blue background tint
|
|
505
|
-
- **Sidebar Width**: 300px on xl breakpoints
|
|
506
|
-
- **Responsive**: Sidebar hidden on mobile, visible on xl+
|
|
507
|
-
|
|
508
|
-
### Navigation Tree
|
|
509
|
-
|
|
510
|
-
- **Indentation**: 4px left padding for subtree items
|
|
511
|
-
- **Divider**: 1px line between parent and children
|
|
512
|
-
- **Active States**: Highlighted active items and parents
|
|
513
|
-
- **Vertical Line**: Visual hierarchy indicator for subtrees
|
|
514
|
-
|
|
515
|
-
### Header Styling
|
|
516
|
-
|
|
517
|
-
- **Gradient Background**: Blue sparkle gradient on mobile
|
|
518
|
-
- **Height**: 52px mobile, 60px desktop
|
|
519
|
-
- **Typography**: Display large on mobile, medium on desktop
|
|
520
|
-
- **Uppercase**: Desktop titles are uppercase
|
|
521
|
-
|
|
522
|
-
## TypeScript Types
|
|
523
|
-
|
|
524
|
-
```typescript
|
|
525
|
-
interface TreeItem {
|
|
526
|
-
id: string
|
|
527
|
-
title: string
|
|
528
|
-
subTree?: TreeItem[]
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
type PathConfig = {
|
|
532
|
-
[key: string]: {
|
|
533
|
-
pageHeader: string
|
|
534
|
-
subTitle?: string
|
|
535
|
-
TabsTree: TreeItem[]
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
interface TreeSubLayoutProps {
|
|
540
|
-
children: React.ReactNode
|
|
541
|
-
treeData: PathConfig
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
interface HeaderPageProps {
|
|
545
|
-
title: string
|
|
546
|
-
subTitle?: string
|
|
547
|
-
children?: React.ReactNode
|
|
548
|
-
type?: 'space-between' | 'start'
|
|
549
|
-
className?: string
|
|
550
|
-
}
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
## Common Patterns
|
|
554
|
-
|
|
555
|
-
### Dynamic Tree Generation
|
|
556
|
-
|
|
557
|
-
```tsx
|
|
558
|
-
function generateTreeFromData(data) {
|
|
559
|
-
return data.reduce((acc, category) => ({
|
|
560
|
-
...acc,
|
|
561
|
-
[`/${category.slug}`]: {
|
|
562
|
-
pageHeader: category.name,
|
|
563
|
-
TabsTree: category.items.map(item => ({
|
|
564
|
-
id: item.id,
|
|
565
|
-
title: item.title,
|
|
566
|
-
subTree: item.children?.map(child => ({
|
|
567
|
-
id: child.id,
|
|
568
|
-
title: child.title
|
|
569
|
-
}))
|
|
570
|
-
}))
|
|
571
|
-
}
|
|
572
|
-
}), {})
|
|
573
|
-
}
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
### With Search
|
|
577
|
-
|
|
578
|
-
```tsx
|
|
579
|
-
function SearchableTree({ treeData }) {
|
|
580
|
-
const [searchQuery, setSearchQuery] = useState('')
|
|
581
|
-
|
|
582
|
-
const filteredTree = useMemo(() => {
|
|
583
|
-
if (!searchQuery) return treeData
|
|
584
|
-
|
|
585
|
-
// Filter tree items based on search
|
|
586
|
-
return filterTreeData(treeData, searchQuery)
|
|
587
|
-
}, [treeData, searchQuery])
|
|
588
|
-
|
|
589
|
-
return (
|
|
590
|
-
<TreeSubLayout treeData={filteredTree}>
|
|
591
|
-
<input
|
|
592
|
-
type="search"
|
|
593
|
-
value={searchQuery}
|
|
594
|
-
onChange={(e) => setSearchQuery(e.target.value)}
|
|
595
|
-
placeholder="Search documentation..."
|
|
596
|
-
/>
|
|
597
|
-
{/* Content */}
|
|
598
|
-
</TreeSubLayout>
|
|
599
|
-
)
|
|
600
|
-
}
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
## Testing
|
|
604
|
-
|
|
605
|
-
```typescript
|
|
606
|
-
import { render, screen } from '@testing-library/react'
|
|
607
|
-
import TreeSubLayout from '@/layouts/TreeSubLayout'
|
|
608
|
-
|
|
609
|
-
// Mock Next.js hooks
|
|
610
|
-
jest.mock('next/navigation', () => ({
|
|
611
|
-
usePathname: () => '/docs'
|
|
612
|
-
}))
|
|
613
|
-
|
|
614
|
-
describe('TreeSubLayout', () => {
|
|
615
|
-
const mockTreeData = {
|
|
616
|
-
'/docs': {
|
|
617
|
-
pageHeader: 'Documentation',
|
|
618
|
-
TabsTree: [
|
|
619
|
-
{
|
|
620
|
-
id: 'intro',
|
|
621
|
-
title: 'Introduction',
|
|
622
|
-
subTree: [
|
|
623
|
-
{ id: 'overview', title: 'Overview' }
|
|
624
|
-
]
|
|
625
|
-
}
|
|
626
|
-
]
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
it('renders page header', () => {
|
|
631
|
-
render(
|
|
632
|
-
<TreeSubLayout treeData={mockTreeData}>
|
|
633
|
-
Content
|
|
634
|
-
</TreeSubLayout>
|
|
635
|
-
)
|
|
636
|
-
|
|
637
|
-
expect(screen.getByText('Documentation')).toBeInTheDocument()
|
|
638
|
-
})
|
|
639
|
-
|
|
640
|
-
it('renders tree navigation', () => {
|
|
641
|
-
render(
|
|
642
|
-
<TreeSubLayout treeData={mockTreeData}>
|
|
643
|
-
Content
|
|
644
|
-
</TreeSubLayout>
|
|
645
|
-
)
|
|
646
|
-
|
|
647
|
-
expect(screen.getByText('Introduction')).toBeInTheDocument()
|
|
648
|
-
expect(screen.getByText('Overview')).toBeInTheDocument()
|
|
649
|
-
})
|
|
650
|
-
|
|
651
|
-
it('renders children content', () => {
|
|
652
|
-
render(
|
|
653
|
-
<TreeSubLayout treeData={mockTreeData}>
|
|
654
|
-
<div>Page Content</div>
|
|
655
|
-
</TreeSubLayout>
|
|
656
|
-
)
|
|
657
|
-
|
|
658
|
-
expect(screen.getByText('Page Content')).toBeInTheDocument()
|
|
659
|
-
})
|
|
660
|
-
})
|
|
661
|
-
```
|
|
662
|
-
|
|
663
|
-
## Accessibility
|
|
664
|
-
|
|
665
|
-
- **Semantic HTML**: Uses nav elements for navigation
|
|
666
|
-
- **Hash Navigation**: Anchor links for smooth scrolling
|
|
667
|
-
- **Keyboard Navigation**: Full keyboard support via TabFormItem
|
|
668
|
-
- **Active State**: Clear visual indication of current location
|
|
669
|
-
- **Screen Reader Support**: Proper heading hierarchy
|
|
670
|
-
- **Focus Management**: Proper focus indicators
|
|
671
|
-
|
|
672
|
-
## Performance
|
|
673
|
-
|
|
674
|
-
- **Active State Hook**: Optimized with useActiveTreeItem hook
|
|
675
|
-
- **Scroll Performance**: Hardware-accelerated scrolling
|
|
676
|
-
- **Hidden Scrollbars**: Custom scrollbar styling
|
|
677
|
-
- **Responsive Loading**: Sidebar only renders on xl breakpoints
|
|
678
|
-
|
|
679
|
-
## Migration Guide
|
|
680
|
-
|
|
681
|
-
### From Custom Sidebar
|
|
682
|
-
|
|
683
|
-
```tsx
|
|
684
|
-
// Before: Custom sidebar implementation
|
|
685
|
-
<div className="flex">
|
|
686
|
-
<nav>
|
|
687
|
-
{/* Custom navigation */}
|
|
688
|
-
</nav>
|
|
689
|
-
<main>{children}</main>
|
|
690
|
-
</div>
|
|
691
|
-
|
|
692
|
-
// After: TreeSubLayout
|
|
693
|
-
<TreeSubLayout treeData={config}>
|
|
694
|
-
{children}
|
|
695
|
-
</TreeSubLayout>
|
|
696
|
-
```
|
|
697
|
-
|
|
698
|
-
## Best Practices
|
|
699
|
-
|
|
700
|
-
1. **Consistent Structure**: Keep tree depth to 2 levels maximum
|
|
701
|
-
2. **Clear Titles**: Use descriptive, concise titles
|
|
702
|
-
3. **Logical Grouping**: Group related content under parent items
|
|
703
|
-
4. **Path Matching**: Ensure pathname keys match actual routes
|
|
704
|
-
5. **Mobile UX**: Consider mobile navigation alternatives
|
|
705
|
-
6. **Active States**: Let useActiveTreeItem handle active states
|
|
706
|
-
7. **Performance**: Avoid deeply nested trees (max 2-3 levels)
|
|
707
|
-
8. **Accessibility**: Ensure all links are keyboard accessible
|