@alexgorbatchev/shadcn 0.0.41 → 0.0.42
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 +1 -1
- package/dist/{chunk-v0va5w5c.js → chunk-4stkzcvt.js} +549 -432
- package/dist/components/DataViewer.d.ts +16 -0
- package/dist/components/json-render/index.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/DataViewer.md +90 -0
- package/llms/setup.md +1 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
type DataViewerProps = Omit<ComponentProps<"section">, "children"> & IDensityProps & {
|
|
4
|
+
/** JSON-compatible data to present. */
|
|
5
|
+
value: unknown;
|
|
6
|
+
/** Accessible name of the view. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Turns a property key into its visible label. Defaults to `formatDataLabel`. */
|
|
9
|
+
formatLabel?: (key: string) => string;
|
|
10
|
+
};
|
|
11
|
+
/** Turns keys such as `track_id`, `playlistIds`, or `original-path` into "Track ID", "Playlist IDs", or "Original path". */
|
|
12
|
+
declare function formatDataLabel(key: string): string;
|
|
13
|
+
/** Presents JSON-compatible data as labelled, nested lists that people can read without knowing JSON. */
|
|
14
|
+
declare function DataViewer({ value, label, formatLabel, density, className, ...props }: DataViewerProps): ReactElement;
|
|
15
|
+
export { DataViewer, formatDataLabel };
|
|
16
|
+
export type { DataViewerProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export { useDropTarget } from "./hooks/useDropTarget.js";
|
|
|
29
29
|
export type { IDragDropItem, IDragSourceOptions, IDragSource, IDropTargetOptions, IDropTarget, } from "./drag-drop/types.js";
|
|
30
30
|
export { EmptyState } from "./components/EmptyState.js";
|
|
31
31
|
export { PageMessage } from "./components/PageMessage.js";
|
|
32
|
+
export { DataViewer, formatDataLabel } from "./components/DataViewer.js";
|
|
33
|
+
export type { DataViewerProps } from "./components/DataViewer.js";
|
|
32
34
|
export { JsonViewer } from "./components/JsonViewer.js";
|
|
33
35
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, } from "./components/AlertDialog.js";
|
|
34
36
|
export { Checkbox } from "./components/Checkbox.js";
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
AccordionContent2,
|
|
7
7
|
EmptyState3,
|
|
8
8
|
PageMessage2,
|
|
9
|
+
formatDataLabel2,
|
|
10
|
+
DataViewer2,
|
|
9
11
|
JsonViewer2,
|
|
10
12
|
AlertDialog2,
|
|
11
13
|
AlertDialogTrigger2,
|
|
@@ -176,7 +178,7 @@ import {
|
|
|
176
178
|
StatusTracker2,
|
|
177
179
|
DashboardLayout2,
|
|
178
180
|
BillingUsage2
|
|
179
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-4stkzcvt.js";
|
|
180
182
|
import {
|
|
181
183
|
Tabs2,
|
|
182
184
|
tabsListVariants2,
|
|
@@ -558,6 +560,7 @@ export {
|
|
|
558
560
|
ContextMenuSubTrigger2 as ContextMenuSubTrigger,
|
|
559
561
|
ContextMenuTrigger2 as ContextMenuTrigger,
|
|
560
562
|
DashboardLayout2 as DashboardLayout,
|
|
563
|
+
DataViewer2 as DataViewer,
|
|
561
564
|
DensityProvider2 as DensityProvider,
|
|
562
565
|
Dialog2 as Dialog,
|
|
563
566
|
DialogClose2 as DialogClose,
|
|
@@ -822,6 +825,7 @@ export {
|
|
|
822
825
|
cn2 as cn,
|
|
823
826
|
collectLayoutViolations2 as collectLayoutViolations,
|
|
824
827
|
createToastManager2 as createToastManager,
|
|
828
|
+
formatDataLabel2 as formatDataLabel,
|
|
825
829
|
markerVariants2 as markerVariants,
|
|
826
830
|
navigationMenuTriggerStyle2 as navigationMenuTriggerStyle,
|
|
827
831
|
tabsListVariants2 as tabsListVariants,
|
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.42",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# DataViewer
|
|
2
|
+
|
|
3
|
+
Story: @alexgorbatchev/shadcn/components/data-display/DataViewer
|
|
4
|
+
Source: src/components/stories/data-display/DataViewer.stories.tsx
|
|
5
|
+
|
|
6
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/DataViewer.stories.tsx)
|
|
7
|
+
|
|
8
|
+
## Public imports
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { DataViewer, formatDataLabel } from "@alexgorbatchev/shadcn";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Default component
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
DataViewer
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Default args
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
{ label: "Result" }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
|
|
29
|
+
|
|
30
|
+
### TrackResult
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
{
|
|
34
|
+
args: {
|
|
35
|
+
value: {
|
|
36
|
+
track_id: 42,
|
|
37
|
+
playlistIds: [3, 12],
|
|
38
|
+
original_path: "/Music/First light.flac",
|
|
39
|
+
timing_cleared: false,
|
|
40
|
+
reanalysis_required: true,
|
|
41
|
+
album: null,
|
|
42
|
+
comment: "",
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### NestedRecords
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
{
|
|
52
|
+
args: {
|
|
53
|
+
value: {
|
|
54
|
+
imported: [
|
|
55
|
+
{ id: "staged-1", track_id: 7 },
|
|
56
|
+
{ id: "staged-2", track_id: 8 },
|
|
57
|
+
],
|
|
58
|
+
failed: [],
|
|
59
|
+
source: { percent: 50, metadata: {} },
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### PlainValue
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
{
|
|
69
|
+
args: { value: "Finished", label: "Status" }
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Empty
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
{
|
|
77
|
+
args: { value: undefined }
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### CustomLabels
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
{
|
|
85
|
+
args: {
|
|
86
|
+
value: { bpm: 128, source_url: "https://example.com/track" },
|
|
87
|
+
formatLabel: (key) => (key === "bpm" ? "Tempo (BPM)" : formatDataLabel(key)),
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
package/llms/setup.md
CHANGED
|
@@ -398,7 +398,7 @@ The preview shows compact individual badges, up to five labels followed by `+N m
|
|
|
398
398
|
|
|
399
399
|
`useDropTarget().feedback` retains the last accepted MIME type, Alt modifier, and drop effect after leaving or dropping. Use this snapshot for hint content that remains visible during an exit animation; use `isOver` to control visibility and active highlighting. New accepted drag events update feedback immediately, including modifier changes. The live `type`, `isAlt`, and `effect` fields still describe the current hover.
|
|
400
400
|
|
|
401
|
-
`EmptyState` composes a title, description, and optional child actions. `JsonViewer` displays a read-only formatted JSON value with configurable `label` and `rows
|
|
401
|
+
`EmptyState` composes a title, description, and optional child actions. `DataViewer` presents JSON-compatible data for people: records become labelled terms, lists of plain values read on one line, lists of records are numbered, booleans read Yes or No, and missing or empty values read None or Empty. Keys become sentence-case labels with common acronyms (`track_id` reads "Track ID"); pass `formatLabel` to name domain keys, falling back to the exported `formatDataLabel`. `JsonViewer` displays a read-only formatted JSON value with configurable `label` and `rows` for people who need the JSON text itself.
|
|
402
402
|
|
|
403
403
|
# Devhost Preview
|
|
404
404
|
|
package/llms.txt
CHANGED
|
@@ -336,6 +336,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
336
336
|
- [DataGridColumnOptions](./llms/components/data-display/DataGridColumnOptions.md)
|
|
337
337
|
- [DataGridFilterSummary](./llms/components/data-display/DataGridFilterSummary.md)
|
|
338
338
|
- [DataGridFilters](./llms/components/data-display/DataGridFilters.md)
|
|
339
|
+
- [DataViewer](./llms/components/data-display/DataViewer.md)
|
|
339
340
|
- [Item](./llms/components/data-display/Item.md)
|
|
340
341
|
- [JsonRender](./llms/components/data-display/JsonRender.md)
|
|
341
342
|
- [JsonViewer](./llms/components/data-display/JsonViewer.md)
|