torch-glare 2.4.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 +1 -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 +97 -96
- package/apps/lib/components/CountBadge.tsx +4 -6
- package/apps/lib/components/DataTable.tsx +196 -216
- package/apps/lib/components/DataViews/DataViewRadio.tsx +1 -6
- package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +13 -47
- 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 +155 -149
- 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 +30 -23
- 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 +104 -115
- package/apps/lib/components/DatePicker.tsx +198 -196
- 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 +131 -171
- 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 +1 -9
- 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 +8 -14
- package/apps/lib/components/SearchableTable.tsx +108 -118
- 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 +18 -25
- package/docs/components/count-badge.md +7 -1
- package/docs/components/data-table.md +45 -33
- package/docs/components/data-views-config-panel.md +15 -11
- package/docs/components/data-views-layout.md +13 -16
- 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 +25 -34
- 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 +6 -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 +18 -13
- package/docs/components/searchable-tree-dialog.md +190 -0
- package/docs/components/searchable-tree.md +200 -0
- package/docs/components/section-block.md +12 -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 +6 -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
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import { useMemo, useState } from "react"
|
|
4
|
-
import { X, GripVertical, ArrowUp, ArrowDown, Minus } from "lucide-react"
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "
|
|
10
|
-
import {
|
|
11
|
-
import { Switch } from "../Switch"
|
|
12
|
-
import { Divider } from "../Divider"
|
|
13
|
-
import { Label } from "../Label"
|
|
14
|
-
import { RadioGroup, Radio } from "../Radio"
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { X, GripVertical, ArrowUp, ArrowDown, Minus } from "lucide-react";
|
|
5
|
+
import type { ViewConfig, ViewType, FieldConfig } from "./types";
|
|
6
|
+
import { Button } from "../Button";
|
|
7
|
+
import { Switch } from "../Switch";
|
|
8
|
+
import { Divider } from "../Divider";
|
|
9
|
+
import { Label } from "../Label";
|
|
10
|
+
import { RadioGroup, Radio } from "../Radio";
|
|
15
11
|
|
|
16
12
|
type SettingsPanelProps = {
|
|
17
|
-
config: ViewConfig
|
|
18
|
-
onConfigChange: (config: Partial<ViewConfig>) => void
|
|
19
|
-
onClose: () => void
|
|
20
|
-
currentView: ViewType
|
|
21
|
-
fields: FieldConfig[]
|
|
22
|
-
}
|
|
13
|
+
config: ViewConfig;
|
|
14
|
+
onConfigChange: (config: Partial<ViewConfig>) => void;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
currentView: ViewType;
|
|
17
|
+
fields: FieldConfig[];
|
|
18
|
+
};
|
|
23
19
|
|
|
24
20
|
export function SettingsPanel({
|
|
25
21
|
config,
|
|
@@ -28,58 +24,49 @@ export function SettingsPanel({
|
|
|
28
24
|
currentView,
|
|
29
25
|
fields,
|
|
30
26
|
}: SettingsPanelProps) {
|
|
31
|
-
const visibleFields = useMemo(
|
|
32
|
-
() => fields.filter((f) => f.type !== "hidden"),
|
|
33
|
-
[fields],
|
|
34
|
-
)
|
|
27
|
+
const visibleFields = useMemo(() => fields.filter((f) => f.type !== "hidden"), [fields]);
|
|
35
28
|
|
|
36
|
-
const groupableFields = useMemo(
|
|
37
|
-
() => fields.filter((f) => f.type === "enum-badge"),
|
|
38
|
-
[fields],
|
|
39
|
-
)
|
|
29
|
+
const groupableFields = useMemo(() => fields.filter((f) => f.type === "enum-badge"), [fields]);
|
|
40
30
|
|
|
41
|
-
const visiblePaths = useMemo(
|
|
42
|
-
() => new Set(visibleFields.map((f) => f.path)),
|
|
43
|
-
[visibleFields],
|
|
44
|
-
)
|
|
31
|
+
const visiblePaths = useMemo(() => new Set(visibleFields.map((f) => f.path)), [visibleFields]);
|
|
45
32
|
const fieldByPath = useMemo(
|
|
46
33
|
() => new Map(visibleFields.map((f) => [f.path, f])),
|
|
47
34
|
[visibleFields],
|
|
48
|
-
)
|
|
35
|
+
);
|
|
49
36
|
const orderedColumns = useMemo(
|
|
50
37
|
() =>
|
|
51
38
|
[...config.tableColumns]
|
|
52
39
|
.filter((c) => visiblePaths.has(c.id))
|
|
53
40
|
.sort((a, b) => a.order - b.order),
|
|
54
41
|
[config.tableColumns, visiblePaths],
|
|
55
|
-
)
|
|
42
|
+
);
|
|
56
43
|
|
|
57
44
|
const toggleColumnVisibility = (path: string) => {
|
|
58
45
|
const next = config.tableColumns.map((c) =>
|
|
59
46
|
c.id === path ? { ...c, visible: !c.visible } : c,
|
|
60
|
-
)
|
|
61
|
-
onConfigChange({ tableColumns: next })
|
|
62
|
-
}
|
|
47
|
+
);
|
|
48
|
+
onConfigChange({ tableColumns: next });
|
|
49
|
+
};
|
|
63
50
|
|
|
64
|
-
const [dragPath, setDragPath] = useState<string | null>(null)
|
|
65
|
-
const [dragOverPath, setDragOverPath] = useState<string | null>(null)
|
|
51
|
+
const [dragPath, setDragPath] = useState<string | null>(null);
|
|
52
|
+
const [dragOverPath, setDragOverPath] = useState<string | null>(null);
|
|
66
53
|
|
|
67
54
|
const reorderColumn = (sourcePath: string, targetPath: string) => {
|
|
68
|
-
if (sourcePath === targetPath) return
|
|
69
|
-
const ids = orderedColumns.map((c) => c.id)
|
|
70
|
-
const from = ids.indexOf(sourcePath)
|
|
71
|
-
const to = ids.indexOf(targetPath)
|
|
72
|
-
if (from === -1 || to === -1) return
|
|
73
|
-
const reordered = [...ids]
|
|
74
|
-
const [moved] = reordered.splice(from, 1)
|
|
75
|
-
reordered.splice(to, 0, moved)
|
|
76
|
-
const orderByPath = new Map(reordered.map((id, i) => [id, i]))
|
|
55
|
+
if (sourcePath === targetPath) return;
|
|
56
|
+
const ids = orderedColumns.map((c) => c.id);
|
|
57
|
+
const from = ids.indexOf(sourcePath);
|
|
58
|
+
const to = ids.indexOf(targetPath);
|
|
59
|
+
if (from === -1 || to === -1) return;
|
|
60
|
+
const reordered = [...ids];
|
|
61
|
+
const [moved] = reordered.splice(from, 1);
|
|
62
|
+
reordered.splice(to, 0, moved);
|
|
63
|
+
const orderByPath = new Map(reordered.map((id, i) => [id, i]));
|
|
77
64
|
const next = config.tableColumns.map((c) => {
|
|
78
|
-
const newOrder = orderByPath.get(c.id)
|
|
79
|
-
return newOrder == null ? c : { ...c, order: newOrder }
|
|
80
|
-
})
|
|
81
|
-
onConfigChange({ tableColumns: next })
|
|
82
|
-
}
|
|
65
|
+
const newOrder = orderByPath.get(c.id);
|
|
66
|
+
return newOrder == null ? c : { ...c, order: newOrder };
|
|
67
|
+
});
|
|
68
|
+
onConfigChange({ tableColumns: next });
|
|
69
|
+
};
|
|
83
70
|
|
|
84
71
|
return (
|
|
85
72
|
<div className="w-80 border-l border-border-presentation-global-primary bg-background-presentation-body-overlay-primary overflow-y-auto">
|
|
@@ -110,44 +97,48 @@ export function SettingsPanel({
|
|
|
110
97
|
{currentView === "table" && (
|
|
111
98
|
<>
|
|
112
99
|
<div className="space-y-3">
|
|
113
|
-
<h3 className="text-sm font-medium text-content-presentation-global-primary">
|
|
100
|
+
<h3 className="text-sm font-medium text-content-presentation-global-primary">
|
|
101
|
+
Table Columns
|
|
102
|
+
</h3>
|
|
114
103
|
<p className="text-xs text-content-presentation-global-tertiary">
|
|
115
104
|
Show or hide columns in table view
|
|
116
105
|
</p>
|
|
117
106
|
{orderedColumns.length === 0 ? (
|
|
118
|
-
<p className="text-xs text-content-presentation-global-tertiary">
|
|
107
|
+
<p className="text-xs text-content-presentation-global-tertiary">
|
|
108
|
+
No fields detected.
|
|
109
|
+
</p>
|
|
119
110
|
) : (
|
|
120
111
|
<div className="space-y-2">
|
|
121
112
|
{orderedColumns.map((col) => {
|
|
122
|
-
const field = fieldByPath.get(col.id)
|
|
123
|
-
const isDragging = dragPath === col.id
|
|
124
|
-
const isDropTarget = dragOverPath === col.id && dragPath !== col.id
|
|
113
|
+
const field = fieldByPath.get(col.id);
|
|
114
|
+
const isDragging = dragPath === col.id;
|
|
115
|
+
const isDropTarget = dragOverPath === col.id && dragPath !== col.id;
|
|
125
116
|
return (
|
|
126
117
|
<div
|
|
127
118
|
key={col.id}
|
|
128
119
|
draggable
|
|
129
120
|
onDragStart={(e) => {
|
|
130
|
-
setDragPath(col.id)
|
|
131
|
-
e.dataTransfer.effectAllowed = "move"
|
|
132
|
-
e.dataTransfer.setData("text/plain", col.id)
|
|
121
|
+
setDragPath(col.id);
|
|
122
|
+
e.dataTransfer.effectAllowed = "move";
|
|
123
|
+
e.dataTransfer.setData("text/plain", col.id);
|
|
133
124
|
}}
|
|
134
125
|
onDragOver={(e) => {
|
|
135
|
-
e.preventDefault()
|
|
136
|
-
e.dataTransfer.dropEffect = "move"
|
|
137
|
-
if (dragOverPath !== col.id) setDragOverPath(col.id)
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
e.dataTransfer.dropEffect = "move";
|
|
128
|
+
if (dragOverPath !== col.id) setDragOverPath(col.id);
|
|
138
129
|
}}
|
|
139
130
|
onDragLeave={() => {
|
|
140
|
-
if (dragOverPath === col.id) setDragOverPath(null)
|
|
131
|
+
if (dragOverPath === col.id) setDragOverPath(null);
|
|
141
132
|
}}
|
|
142
133
|
onDrop={(e) => {
|
|
143
|
-
e.preventDefault()
|
|
144
|
-
if (dragPath) reorderColumn(dragPath, col.id)
|
|
145
|
-
setDragPath(null)
|
|
146
|
-
setDragOverPath(null)
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
if (dragPath) reorderColumn(dragPath, col.id);
|
|
136
|
+
setDragPath(null);
|
|
137
|
+
setDragOverPath(null);
|
|
147
138
|
}}
|
|
148
139
|
onDragEnd={() => {
|
|
149
|
-
setDragPath(null)
|
|
150
|
-
setDragOverPath(null)
|
|
140
|
+
setDragPath(null);
|
|
141
|
+
setDragOverPath(null);
|
|
151
142
|
}}
|
|
152
143
|
className={
|
|
153
144
|
"flex items-center gap-2 rounded-lg border p-2 cursor-grab active:cursor-grabbing transition-colors " +
|
|
@@ -167,7 +158,7 @@ export function SettingsPanel({
|
|
|
167
158
|
onCheckedChange={() => toggleColumnVisibility(col.id)}
|
|
168
159
|
/>
|
|
169
160
|
</div>
|
|
170
|
-
)
|
|
161
|
+
);
|
|
171
162
|
})}
|
|
172
163
|
</div>
|
|
173
164
|
)}
|
|
@@ -179,11 +170,16 @@ export function SettingsPanel({
|
|
|
179
170
|
{currentView === "kanban" && (
|
|
180
171
|
<>
|
|
181
172
|
<div className="space-y-3">
|
|
182
|
-
<h3 className="text-sm font-medium text-content-presentation-global-primary">
|
|
183
|
-
|
|
173
|
+
<h3 className="text-sm font-medium text-content-presentation-global-primary">
|
|
174
|
+
Kanban Grouping
|
|
175
|
+
</h3>
|
|
176
|
+
<p className="text-xs text-content-presentation-global-tertiary">
|
|
177
|
+
Group cards by field
|
|
178
|
+
</p>
|
|
184
179
|
{groupableFields.length === 0 ? (
|
|
185
180
|
<p className="text-xs text-content-presentation-global-tertiary">
|
|
186
|
-
No groupable fields detected. Declare a field with type
|
|
181
|
+
No groupable fields detected. Declare a field with type "enum-badge" to
|
|
182
|
+
enable grouping.
|
|
187
183
|
</p>
|
|
188
184
|
) : (
|
|
189
185
|
<RadioGroup
|
|
@@ -206,7 +202,9 @@ export function SettingsPanel({
|
|
|
206
202
|
{currentView === "inbox" && (
|
|
207
203
|
<>
|
|
208
204
|
<div className="space-y-3">
|
|
209
|
-
<h3 className="text-sm font-medium text-content-presentation-global-primary">
|
|
205
|
+
<h3 className="text-sm font-medium text-content-presentation-global-primary">
|
|
206
|
+
Inbox Layout
|
|
207
|
+
</h3>
|
|
210
208
|
<div className="flex items-center justify-between">
|
|
211
209
|
<Label htmlFor="preview-pane" className="text-sm">
|
|
212
210
|
Show Preview Pane
|
|
@@ -230,21 +228,17 @@ export function SettingsPanel({
|
|
|
230
228
|
</p>
|
|
231
229
|
<div className="space-y-2">
|
|
232
230
|
{orderedColumns.map((col) => {
|
|
233
|
-
const field = fieldByPath.get(col.id)
|
|
234
|
-
const isActive = config.sortBy === col.id
|
|
235
|
-
const dir: "asc" | "desc" | "none" = isActive ? config.sortOrder : "none"
|
|
231
|
+
const field = fieldByPath.get(col.id);
|
|
232
|
+
const isActive = config.sortBy === col.id;
|
|
233
|
+
const dir: "asc" | "desc" | "none" = isActive ? config.sortOrder : "none";
|
|
236
234
|
const setDir = (next: "asc" | "desc" | "none") => {
|
|
237
235
|
if (next === "none") {
|
|
238
|
-
onConfigChange({ sortBy: "" })
|
|
236
|
+
onConfigChange({ sortBy: "" });
|
|
239
237
|
} else {
|
|
240
|
-
onConfigChange({ sortBy: col.id, sortOrder: next })
|
|
238
|
+
onConfigChange({ sortBy: col.id, sortOrder: next });
|
|
241
239
|
}
|
|
242
|
-
}
|
|
243
|
-
const btn = (
|
|
244
|
-
mode: "none" | "asc" | "desc",
|
|
245
|
-
Icon: typeof Minus,
|
|
246
|
-
label: string,
|
|
247
|
-
) => (
|
|
240
|
+
};
|
|
241
|
+
const btn = (mode: "none" | "asc" | "desc", Icon: typeof Minus, label: string) => (
|
|
248
242
|
<button
|
|
249
243
|
type="button"
|
|
250
244
|
aria-label={`${label} ${col.label || col.id}`}
|
|
@@ -259,7 +253,7 @@ export function SettingsPanel({
|
|
|
259
253
|
>
|
|
260
254
|
<Icon className="h-3.5 w-3.5" />
|
|
261
255
|
</button>
|
|
262
|
-
)
|
|
256
|
+
);
|
|
263
257
|
return (
|
|
264
258
|
<div
|
|
265
259
|
key={col.id}
|
|
@@ -274,12 +268,12 @@ export function SettingsPanel({
|
|
|
274
268
|
{btn("desc", ArrowDown, "Sort descending")}
|
|
275
269
|
</div>
|
|
276
270
|
</div>
|
|
277
|
-
)
|
|
271
|
+
);
|
|
278
272
|
})}
|
|
279
273
|
</div>
|
|
280
274
|
</div>
|
|
281
275
|
)}
|
|
282
276
|
</div>
|
|
283
277
|
</div>
|
|
284
|
-
)
|
|
278
|
+
);
|
|
285
279
|
}
|
|
@@ -22,10 +22,7 @@ import {
|
|
|
22
22
|
TableCell,
|
|
23
23
|
TableCheckbox,
|
|
24
24
|
} from "../Table";
|
|
25
|
-
import {
|
|
26
|
-
getByPath,
|
|
27
|
-
matchesFilterValues,
|
|
28
|
-
} from "../../utils/dataViews/pathUtils";
|
|
25
|
+
import { getByPath, matchesFilterValues } from "../../utils/dataViews/pathUtils";
|
|
29
26
|
import { renderField } from "./fieldRenderers";
|
|
30
27
|
import { visibleFields } from "../../utils/dataViews/fieldUtils";
|
|
31
28
|
import { useIsMobile } from "../../hooks/useIsMobile";
|
|
@@ -144,9 +141,7 @@ export function TableView({
|
|
|
144
141
|
<TableHead
|
|
145
142
|
key={field.path}
|
|
146
143
|
size="M"
|
|
147
|
-
sortType={
|
|
148
|
-
sortPath === field.path ? sortDirection : undefined
|
|
149
|
-
}
|
|
144
|
+
sortType={sortPath === field.path ? sortDirection : undefined}
|
|
150
145
|
onSort={() => handleSort(field.path)}
|
|
151
146
|
>
|
|
152
147
|
{field.label}
|
|
@@ -156,7 +151,7 @@ export function TableView({
|
|
|
156
151
|
</TableHeader>
|
|
157
152
|
<TableBody>
|
|
158
153
|
{filteredAndSortedData.map((item, idx) => (
|
|
159
|
-
<TableRow key={item.id ?? idx}>
|
|
154
|
+
<TableRow key={(item.id ?? idx) as string | number}>
|
|
160
155
|
<TableCell isDummy className="w-12">
|
|
161
156
|
<TableCheckbox id={`row-${item.id ?? idx}`} />
|
|
162
157
|
</TableCell>
|
|
@@ -168,11 +163,7 @@ export function TableView({
|
|
|
168
163
|
post-mount column reflow repaints cleanly instead
|
|
169
164
|
of leaving a ghosted/doubled badge frame. */}
|
|
170
165
|
<span className="isolate inline-flex transform-gpu">
|
|
171
|
-
{renderField(
|
|
172
|
-
getByPath(item, field.path),
|
|
173
|
-
field,
|
|
174
|
-
item,
|
|
175
|
-
)}
|
|
166
|
+
{renderField(getByPath(item, field.path), field, item)}
|
|
176
167
|
</span>
|
|
177
168
|
</TableCell>
|
|
178
169
|
))}
|
|
@@ -185,7 +176,7 @@ export function TableView({
|
|
|
185
176
|
<div className="flex-1 overflow-auto">
|
|
186
177
|
<div className="grid gap-3">
|
|
187
178
|
{filteredAndSortedData.map((item, idx) => (
|
|
188
|
-
<Card key={item.id ?? idx} className="overflow-hidden">
|
|
179
|
+
<Card key={(item.id ?? idx) as string | number} className="overflow-hidden">
|
|
189
180
|
<CardHeader className="pb-3">
|
|
190
181
|
<div className="flex items-start justify-between gap-3">
|
|
191
182
|
<div className="flex items-start gap-3 flex-1">
|
|
@@ -193,9 +184,7 @@ export function TableView({
|
|
|
193
184
|
<div className="flex-1">
|
|
194
185
|
{displayFields[0] && (
|
|
195
186
|
<p className="font-medium">
|
|
196
|
-
{String(
|
|
197
|
-
getByPath(item, displayFields[0].path) ?? "",
|
|
198
|
-
)}
|
|
187
|
+
{String(getByPath(item, displayFields[0].path) ?? "")}
|
|
199
188
|
</p>
|
|
200
189
|
)}
|
|
201
190
|
</div>
|
|
@@ -204,20 +193,11 @@ export function TableView({
|
|
|
204
193
|
</CardHeader>
|
|
205
194
|
<CardContent className="space-y-2 pt-0">
|
|
206
195
|
{displayFields.slice(1).map((field) => (
|
|
207
|
-
<div
|
|
208
|
-
key={field.path}
|
|
209
|
-
className="flex items-center justify-between text-sm"
|
|
210
|
-
>
|
|
196
|
+
<div key={field.path} className="flex items-center justify-between text-sm">
|
|
211
197
|
<span className="text-content-presentation-global-tertiary">
|
|
212
198
|
{field.label}:
|
|
213
199
|
</span>
|
|
214
|
-
<span>
|
|
215
|
-
{renderField(
|
|
216
|
-
getByPath(item, field.path),
|
|
217
|
-
field,
|
|
218
|
-
item,
|
|
219
|
-
)}
|
|
220
|
-
</span>
|
|
200
|
+
<span>{renderField(getByPath(item, field.path), field, item)}</span>
|
|
221
201
|
</div>
|
|
222
202
|
))}
|
|
223
203
|
</CardContent>
|
|
@@ -21,10 +21,7 @@ import {
|
|
|
21
21
|
pruneTree,
|
|
22
22
|
type TreeNode,
|
|
23
23
|
} from "../../utils/dataViews/treeUtils";
|
|
24
|
-
import {
|
|
25
|
-
getByPath,
|
|
26
|
-
matchesFilterValues,
|
|
27
|
-
} from "../../utils/dataViews/pathUtils";
|
|
24
|
+
import { getByPath, matchesFilterValues } from "../../utils/dataViews/pathUtils";
|
|
28
25
|
import { visibleFields } from "../../utils/dataViews/fieldUtils";
|
|
29
26
|
import { renderField } from "./fieldRenderers";
|
|
30
27
|
import { useIsMobile } from "../../hooks/useIsMobile";
|
|
@@ -85,22 +82,14 @@ export function TreeView({
|
|
|
85
82
|
return display[0] ?? { path: resolvedTree.idField, type: "text" };
|
|
86
83
|
}, [resolvedTree, fields, display]);
|
|
87
84
|
|
|
88
|
-
const fullForest = useMemo(
|
|
89
|
-
() => buildTree(data, resolvedTree),
|
|
90
|
-
[data, resolvedTree],
|
|
91
|
-
);
|
|
85
|
+
const fullForest = useMemo(() => buildTree(data, resolvedTree), [data, resolvedTree]);
|
|
92
86
|
|
|
93
|
-
const filterEntries = useMemo(
|
|
94
|
-
() => Object.entries(activeFilters),
|
|
95
|
-
[activeFilters],
|
|
96
|
-
);
|
|
87
|
+
const filterEntries = useMemo(() => Object.entries(activeFilters), [activeFilters]);
|
|
97
88
|
|
|
98
89
|
const visibleForest: TreeNode[] = useMemo(() => {
|
|
99
90
|
if (filterEntries.length === 0) return fullForest;
|
|
100
91
|
return pruneTree(fullForest, (record) =>
|
|
101
|
-
filterEntries.every(([path, value]) =>
|
|
102
|
-
matchesFilterValues(record, path, value),
|
|
103
|
-
),
|
|
92
|
+
filterEntries.every(([path, value]) => matchesFilterValues(record, path, value)),
|
|
104
93
|
);
|
|
105
94
|
}, [fullForest, filterEntries]);
|
|
106
95
|
|
|
@@ -112,9 +101,7 @@ export function TreeView({
|
|
|
112
101
|
setExpanded(initialExpansion(fullForest, resolvedTree.defaultExpanded));
|
|
113
102
|
}, [fullForest, resolvedTree.defaultExpanded]);
|
|
114
103
|
|
|
115
|
-
const [selectedId, setSelectedId] = useState<string | null>(
|
|
116
|
-
() => fullForest[0]?.id ?? null,
|
|
117
|
-
);
|
|
104
|
+
const [selectedId, setSelectedId] = useState<string | null>(() => fullForest[0]?.id ?? null);
|
|
118
105
|
|
|
119
106
|
useEffect(() => {
|
|
120
107
|
if (selectedId && !findNodeById(visibleForest, selectedId)) {
|
|
@@ -122,9 +109,7 @@ export function TreeView({
|
|
|
122
109
|
}
|
|
123
110
|
}, [visibleForest, selectedId]);
|
|
124
111
|
|
|
125
|
-
const selectedNode = selectedId
|
|
126
|
-
? findNodeById(visibleForest, selectedId)
|
|
127
|
-
: null;
|
|
112
|
+
const selectedNode = selectedId ? findNodeById(visibleForest, selectedId) : null;
|
|
128
113
|
const recordsForRightPane = useMemo(
|
|
129
114
|
() => (selectedNode ? flatten(selectedNode) : []),
|
|
130
115
|
[selectedNode],
|
|
@@ -153,9 +138,7 @@ export function TreeView({
|
|
|
153
138
|
type RightPaneMode = "table" | "card";
|
|
154
139
|
const [rightPaneMode, setRightPaneMode] = useState<RightPaneMode>(
|
|
155
140
|
// "details" is a deprecated alias of "card".
|
|
156
|
-
treeConfig?.defaultRightPane === "details"
|
|
157
|
-
? "card"
|
|
158
|
-
: (treeConfig?.defaultRightPane ?? "table"),
|
|
141
|
+
treeConfig?.defaultRightPane === "details" ? "card" : (treeConfig?.defaultRightPane ?? "table"),
|
|
159
142
|
);
|
|
160
143
|
|
|
161
144
|
const dndEnabled = treeConfig?.dndEnabled !== false && !!onDataUpdate;
|
|
@@ -222,9 +205,7 @@ export function TreeView({
|
|
|
222
205
|
<div className="flex-1 flex flex-col overflow-hidden rounded-[16px] border border-border-presentation-global-primary bg-background-presentation-form-base">
|
|
223
206
|
<div className="flex items-center justify-between gap-2 px-3 py-2 border-b border-border-presentation-global-primary bg-background-presentation-form-base">
|
|
224
207
|
<div className="flex items-center gap-2 min-w-0">
|
|
225
|
-
{isMobile && (
|
|
226
|
-
<TreeDrawerTrigger onClick={() => setDrawerOpen(true)} />
|
|
227
|
-
)}
|
|
208
|
+
{isMobile && <TreeDrawerTrigger onClick={() => setDrawerOpen(true)} />}
|
|
228
209
|
<span
|
|
229
210
|
style={{ fontFeatureSettings: "'cv05' on" }}
|
|
230
211
|
className="typography-display-medium-medium uppercase text-content-presentation-global-primary truncate"
|
|
@@ -256,9 +237,7 @@ export function TreeView({
|
|
|
256
237
|
const showDivider = idx > 0 && !active && !prevActive;
|
|
257
238
|
return (
|
|
258
239
|
<div key={tab.id} className="flex items-center">
|
|
259
|
-
{showDivider &&
|
|
260
|
-
<div className="mx-[3px] h-3 w-px bg-[#434446]" />
|
|
261
|
-
)}
|
|
240
|
+
{showDivider && <div className="mx-[3px] h-3 w-px bg-[#434446]" />}
|
|
262
241
|
<button
|
|
263
242
|
type="button"
|
|
264
243
|
aria-label={`${tab.label} mode`}
|
|
@@ -300,11 +279,7 @@ export function TreeView({
|
|
|
300
279
|
showFilters={false}
|
|
301
280
|
/>
|
|
302
281
|
) : (
|
|
303
|
-
<CardGrid
|
|
304
|
-
records={recordsForRightPane}
|
|
305
|
-
fields={fields}
|
|
306
|
-
labelField={labelField}
|
|
307
|
-
/>
|
|
282
|
+
<CardGrid records={recordsForRightPane} fields={fields} labelField={labelField} />
|
|
308
283
|
)
|
|
309
284
|
) : (
|
|
310
285
|
<div className="h-full flex items-center justify-center text-sm text-content-presentation-global-tertiary">
|
|
@@ -355,7 +330,7 @@ function CardGrid({
|
|
|
355
330
|
{records.map((record, idx) => {
|
|
356
331
|
const labelValue = getByPath(record, labelField.path);
|
|
357
332
|
return (
|
|
358
|
-
<Card key={record.id ?? idx} className="overflow-hidden">
|
|
333
|
+
<Card key={(record.id ?? idx) as string | number} className="overflow-hidden">
|
|
359
334
|
<CardHeader className="pb-2">
|
|
360
335
|
<div className="text-xs uppercase tracking-wide text-content-presentation-global-tertiary">
|
|
361
336
|
{labelField.label ?? labelField.path}
|
|
@@ -369,10 +344,7 @@ function CardGrid({
|
|
|
369
344
|
const value = getByPath(record, f.path);
|
|
370
345
|
if (value == null) return null;
|
|
371
346
|
return (
|
|
372
|
-
<div
|
|
373
|
-
key={f.path}
|
|
374
|
-
className="flex items-center justify-between gap-3 text-sm"
|
|
375
|
-
>
|
|
347
|
+
<div key={f.path} className="flex items-center justify-between gap-3 text-sm">
|
|
376
348
|
<span className="text-content-presentation-global-tertiary">
|
|
377
349
|
{f.label ?? f.path}
|
|
378
350
|
</span>
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import type { BadgeVariant } from "./types"
|
|
1
|
+
import type { BadgeVariant } from "./types";
|
|
2
2
|
|
|
3
3
|
type TorchBadgeColor =
|
|
4
|
-
| "
|
|
5
|
-
| "slate"
|
|
6
|
-
| "red"
|
|
7
|
-
| "orange"
|
|
8
|
-
| "yellow"
|
|
9
|
-
| "green"
|
|
10
|
-
| "ocean"
|
|
11
|
-
| "blue"
|
|
12
|
-
| "purple"
|
|
13
|
-
| "rose"
|
|
4
|
+
"gray" | "slate" | "red" | "orange" | "yellow" | "green" | "ocean" | "blue" | "purple" | "rose";
|
|
14
5
|
|
|
15
|
-
type TorchBadgeStyle = "solid" | "subtle"
|
|
6
|
+
type TorchBadgeStyle = "solid" | "subtle";
|
|
16
7
|
|
|
17
8
|
export type ResolvedBadgeProps = {
|
|
18
|
-
color: TorchBadgeColor
|
|
19
|
-
badgeStyle: TorchBadgeStyle
|
|
20
|
-
}
|
|
9
|
+
color: TorchBadgeColor;
|
|
10
|
+
badgeStyle: TorchBadgeStyle;
|
|
11
|
+
};
|
|
21
12
|
|
|
22
13
|
/**
|
|
23
14
|
* Map the dataviews BadgeVariant set to torch-glare Badge props.
|
|
@@ -27,19 +18,32 @@ export type ResolvedBadgeProps = {
|
|
|
27
18
|
*/
|
|
28
19
|
export function resolveBadgeVariant(variant?: BadgeVariant): ResolvedBadgeProps {
|
|
29
20
|
switch (variant) {
|
|
30
|
-
case "green":
|
|
31
|
-
|
|
32
|
-
case "
|
|
33
|
-
|
|
34
|
-
case "
|
|
35
|
-
|
|
36
|
-
case "
|
|
37
|
-
|
|
38
|
-
case "
|
|
39
|
-
|
|
40
|
-
case "
|
|
41
|
-
|
|
21
|
+
case "green":
|
|
22
|
+
return { color: "green", badgeStyle: "subtle" };
|
|
23
|
+
case "greenLight":
|
|
24
|
+
return { color: "green", badgeStyle: "subtle" };
|
|
25
|
+
case "cocktailGreen":
|
|
26
|
+
return { color: "green", badgeStyle: "solid" };
|
|
27
|
+
case "yellow":
|
|
28
|
+
return { color: "yellow", badgeStyle: "subtle" };
|
|
29
|
+
case "redOrange":
|
|
30
|
+
return { color: "orange", badgeStyle: "subtle" };
|
|
31
|
+
case "redLight":
|
|
32
|
+
return { color: "red", badgeStyle: "subtle" };
|
|
33
|
+
case "rose":
|
|
34
|
+
return { color: "rose", badgeStyle: "subtle" };
|
|
35
|
+
case "purple":
|
|
36
|
+
return { color: "purple", badgeStyle: "subtle" };
|
|
37
|
+
case "bluePurple":
|
|
38
|
+
return { color: "purple", badgeStyle: "solid" };
|
|
39
|
+
case "blue":
|
|
40
|
+
return { color: "blue", badgeStyle: "subtle" };
|
|
41
|
+
case "navy":
|
|
42
|
+
return { color: "blue", badgeStyle: "solid" };
|
|
43
|
+
case "highlight":
|
|
44
|
+
return { color: "yellow", badgeStyle: "subtle" };
|
|
42
45
|
case "gray":
|
|
43
|
-
default:
|
|
46
|
+
default:
|
|
47
|
+
return { color: "gray", badgeStyle: "subtle" };
|
|
44
48
|
}
|
|
45
49
|
}
|