@alexgorbatchev/shadcn 0.0.80 → 0.0.82
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/dist/{chunk-qq7brjez.js → chunk-kh4ecqqe.js} +379 -239
- package/dist/components/ReviewList.d.ts +26 -0
- package/dist/components/json-render/index.js +1 -1
- package/dist/components/resizable/index.js +29 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ReviewList.md +52 -0
- package/llms/components/layout/SplitView.md +23 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
export interface IReviewListRow {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Whether the plan includes this row's change. */
|
|
5
|
+
isIncluded: boolean;
|
|
6
|
+
/** The checkbox's accessible name, such as "Include Undertow Signal by Fenwick Rao". */
|
|
7
|
+
checkboxLabel: string;
|
|
8
|
+
/** The row's description, its first cell after the checkbox. */
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
/** Further cells with their own controls, which ← and → reach; give those controls `tabIndex={-1}`. */
|
|
11
|
+
cells?: readonly ReactNode[];
|
|
12
|
+
}
|
|
13
|
+
interface IReviewListProps {
|
|
14
|
+
label: string;
|
|
15
|
+
rows: readonly IReviewListRow[];
|
|
16
|
+
/** Sets the inclusion of these rows; a range or Mod+A changes several at once. */
|
|
17
|
+
onIncludedChange: (ids: readonly string[], isIncluded: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A plan's review rows, where a tick means "include this change". It is one tab stop with a cursor: ↑/↓, Home and End
|
|
21
|
+
* move between rows and ← and → between a row's cells. A click only moves the cursor, so a stray click never changes
|
|
22
|
+
* what the plan includes; the checkbox, Mod+click, X and Shift+Space toggle a row, Shift+click sets the range from the
|
|
23
|
+
* anchor row to the anchor's state, and Mod+A includes every row. Space is left to the page, such as a player.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ReviewList({ label, rows, onIncludedChange }: IReviewListProps): ReactElement;
|
|
26
|
+
export {};
|
|
@@ -92,13 +92,26 @@ function SplitView({
|
|
|
92
92
|
const isHydrated = useSyncExternalStore(subscribeToHydration, () => true, () => false);
|
|
93
93
|
const [slots] = useState(createSlots);
|
|
94
94
|
const portalSlots = isHydrated ? slots : null;
|
|
95
|
+
const storedSize = layout.defaultLayout?.sidebar;
|
|
96
|
+
const openSize = useRef(storedSize !== undefined && storedSize > 0 ? `${storedSize}%` : defaultSidebarSize);
|
|
97
|
+
const wasShownOpen = useRef(false);
|
|
98
|
+
const pendingOpenSize = useRef(null);
|
|
95
99
|
useEffect(() => {
|
|
96
|
-
|
|
100
|
+
const panel = sidebarRef.current;
|
|
101
|
+
if (!isWide || !panel)
|
|
102
|
+
return;
|
|
103
|
+
if (sidebarOpen) {
|
|
104
|
+
if (panel.isCollapsed()) {
|
|
105
|
+
pendingOpenSize.current = openSize.current;
|
|
106
|
+
panel.expand();
|
|
107
|
+
}
|
|
108
|
+
wasShownOpen.current = true;
|
|
97
109
|
return;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
}
|
|
111
|
+
if (wasShownOpen.current && !panel.isCollapsed())
|
|
112
|
+
openSize.current = `${panel.getSize().asPercentage}%`;
|
|
113
|
+
wasShownOpen.current = false;
|
|
114
|
+
panel.collapse();
|
|
102
115
|
}, [isWide, sidebarOpen, sidebarRef]);
|
|
103
116
|
const unexpandedSize = useRef(null);
|
|
104
117
|
useEffect(() => {
|
|
@@ -134,8 +147,18 @@ function SplitView({
|
|
|
134
147
|
const sidebarPanel = /* @__PURE__ */ jsx(ResizablePanel2, {
|
|
135
148
|
id: "sidebar",
|
|
136
149
|
panelRef: sidebarRef,
|
|
137
|
-
collapsible:
|
|
150
|
+
collapsible: true,
|
|
138
151
|
collapsedSize: 0,
|
|
152
|
+
onResize: (size) => {
|
|
153
|
+
if (!sidebarOpen)
|
|
154
|
+
return;
|
|
155
|
+
const pending = pendingOpenSize.current;
|
|
156
|
+
if (pending !== null && size.inPixels > 0) {
|
|
157
|
+
pendingOpenSize.current = null;
|
|
158
|
+
sidebarRef.current?.resize(pending);
|
|
159
|
+
} else if (pending === null && size.inPixels === 0)
|
|
160
|
+
sidebarRef.current?.resize(minSidebarSize);
|
|
161
|
+
},
|
|
139
162
|
defaultSize: defaultSidebarSize,
|
|
140
163
|
minSize: minSidebarSize,
|
|
141
164
|
maxSize: maxSidebarSize,
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupActio
|
|
|
91
91
|
export { useSidebar } from "./hooks/useSidebar.js";
|
|
92
92
|
export { InlineEdit } from "./components/InlineEdit.js";
|
|
93
93
|
export { StarRating } from "./components/StarRating.js";
|
|
94
|
+
export { ReviewList, type IReviewListRow } from "./components/ReviewList.js";
|
|
94
95
|
export { ConfirmationDialog } from "./components/ConfirmationDialog.js";
|
|
95
96
|
export { ImagePicker } from "./components/ImagePicker.js";
|
|
96
97
|
export type { SidebarStyle, SidebarPartState, SidebarMenuButtonState, SidebarMenuSubButtonState, } from "./sidebar/types.js";
|
package/dist/index.js
CHANGED
|
@@ -139,6 +139,7 @@ import {
|
|
|
139
139
|
AttachmentGroup2,
|
|
140
140
|
InlineEdit2,
|
|
141
141
|
StarRating2,
|
|
142
|
+
ReviewList2,
|
|
142
143
|
ConfirmationDialog2,
|
|
143
144
|
ImagePicker2,
|
|
144
145
|
Meter2,
|
|
@@ -173,7 +174,7 @@ import {
|
|
|
173
174
|
StatusTracker2,
|
|
174
175
|
DashboardLayout2,
|
|
175
176
|
BillingUsage2
|
|
176
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-kh4ecqqe.js";
|
|
177
178
|
import {
|
|
178
179
|
Combobox2,
|
|
179
180
|
ComboboxValue2,
|
|
@@ -750,6 +751,7 @@ export {
|
|
|
750
751
|
ProgressValue2 as ProgressValue,
|
|
751
752
|
RadioGroup2 as RadioGroup,
|
|
752
753
|
RadioGroupItem2 as RadioGroupItem,
|
|
754
|
+
ReviewList2 as ReviewList,
|
|
753
755
|
ScrollArea2 as ScrollArea,
|
|
754
756
|
ScrollBar2 as ScrollBar,
|
|
755
757
|
ScrollGuard2 as ScrollGuard,
|
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.82",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ReviewList
|
|
2
|
+
|
|
3
|
+
Story: @alexgorbatchev/shadcn/components/data-display/ReviewList
|
|
4
|
+
Source: src/components/stories/data-display/ReviewList.stories.tsx
|
|
5
|
+
|
|
6
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/ReviewList.stories.tsx)
|
|
7
|
+
|
|
8
|
+
## Public imports
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { ReviewList, type IReviewListRow, Button } from "@alexgorbatchev/shadcn";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Supporting imports
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { useState, type ReactElement } from "react";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Default component
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
ReviewList
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Default args
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
{ label: "Tracks", rows: [], onIncludedChange: () => undefined }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Default render
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
() => <ReviewListExample />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
### PointerGestures
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
{}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### KeyboardGestures
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
{}
|
|
52
|
+
```
|
|
@@ -197,3 +197,26 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
```
|
|
200
|
+
|
|
201
|
+
### DockOpensAtDefaultWidth
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
{
|
|
205
|
+
render: function Example(args) {
|
|
206
|
+
const key = useId();
|
|
207
|
+
const [open, setOpen] = useState(false);
|
|
208
|
+
const [isWideFrame, setWideFrame] = useState(false);
|
|
209
|
+
return (<div className="flex flex-col gap-2">
|
|
210
|
+
<div className="flex gap-2">
|
|
211
|
+
<Button onClick={() => setWideFrame(true)}>Widen workspace</Button>
|
|
212
|
+
<Button onClick={() => setOpen(!open)}>{open ? "Close dock" : "Open dock"}</Button>
|
|
213
|
+
</div>
|
|
214
|
+
<div className={isWideFrame ? "h-80 w-[1000px]" : "h-80 w-[300px]"}>
|
|
215
|
+
<SplitView {...args} storageKey={key} sidebarLabel="Dock" resizeLabel="Resize dock" sidebarPosition="end" sidebarOpen={open} defaultSidebarSize={400} minSidebarSize={320} maxSidebarSize="60%" layout="fill" sidebar={<h2>Review</h2>}>
|
|
216
|
+
<p>Workspace</p>
|
|
217
|
+
</SplitView>
|
|
218
|
+
</div>
|
|
219
|
+
</div>);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
package/llms.txt
CHANGED
|
@@ -348,6 +348,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
348
348
|
- [JsonViewer](./llms/components/data-display/JsonViewer.md)
|
|
349
349
|
- [Kbd](./llms/components/data-display/Kbd.md)
|
|
350
350
|
- [Meter](./llms/components/data-display/Meter.md)
|
|
351
|
+
- [ReviewList](./llms/components/data-display/ReviewList.md)
|
|
351
352
|
- [Sparkline](./llms/components/data-display/Sparkline.md)
|
|
352
353
|
- [StatCard](./llms/components/data-display/StatCard.md)
|
|
353
354
|
- [StatusTracker](./llms/components/data-display/StatusTracker.md)
|