@northslopetech/altitude-ui-references 2.6.4 → 2.7.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/dist/manifest.json +2 -2
- package/dist/references/PdfViewer.md +169 -5
- package/dist/references/Sidebar.md +2 -2
- package/package.json +1 -1
package/dist/manifest.json
CHANGED
|
@@ -16,8 +16,8 @@ import workerUrl from "@northslopetech/altitude-ui/pdf.worker.min.mjs?url";
|
|
|
16
16
|
import { initializePdfWorker } from "@northslopetech/altitude-ui";
|
|
17
17
|
initializePdfWorker(workerUrl);
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const SAMPLE_PDF_URL =
|
|
20
|
+
"https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf";
|
|
21
21
|
|
|
22
22
|
const meta: Meta<PdfViewerProps> = {
|
|
23
23
|
title: "Components/PdfViewer",
|
|
@@ -27,7 +27,7 @@ const meta: Meta<PdfViewerProps> = {
|
|
|
27
27
|
docs: {
|
|
28
28
|
description: {
|
|
29
29
|
component:
|
|
30
|
-
"A PDF document viewer component with multi-page support.
|
|
30
|
+
"A PDF document viewer component with multi-page support. Uses virtualization to render visible pages plus a configurable buffer for efficient large PDF handling. Features automatic width adjustment, loading states, page navigation, zoom controls, and configurable view and scroll behavior.",
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
},
|
|
@@ -49,11 +49,37 @@ const meta: Meta<PdfViewerProps> = {
|
|
|
49
49
|
control: { type: "boolean" },
|
|
50
50
|
description: "Enable text selection (impacts performance)",
|
|
51
51
|
},
|
|
52
|
+
showControls: {
|
|
53
|
+
control: { type: "boolean" },
|
|
54
|
+
description: "Show/hide the controls bar (page navigation and zoom)",
|
|
55
|
+
},
|
|
56
|
+
viewportBuffer: {
|
|
57
|
+
control: { type: "number", min: 0 },
|
|
58
|
+
description:
|
|
59
|
+
"Number of pages to render above and below the viewport for virtualization",
|
|
60
|
+
},
|
|
61
|
+
page: {
|
|
62
|
+
control: { type: "number", min: 1 },
|
|
63
|
+
description: "Current page number (1-indexed) for controlled mode",
|
|
64
|
+
},
|
|
65
|
+
scrollBehavior: {
|
|
66
|
+
control: { type: "select" },
|
|
67
|
+
options: ["smooth", "instant"],
|
|
68
|
+
description:
|
|
69
|
+
"Scroll behavior when navigating to a page (smooth animation or instant jump)",
|
|
70
|
+
},
|
|
71
|
+
viewMode: {
|
|
72
|
+
control: { type: "select" },
|
|
73
|
+
options: ["continuous", "single"],
|
|
74
|
+
description:
|
|
75
|
+
"View mode: continuous (scrollable with virtualization) or single (one page at a time)",
|
|
76
|
+
},
|
|
52
77
|
},
|
|
53
78
|
args: {
|
|
54
79
|
file: SAMPLE_PDF_URL,
|
|
55
80
|
title: "Sample_Document",
|
|
56
81
|
enableTextLayer: false,
|
|
82
|
+
showControls: true,
|
|
57
83
|
},
|
|
58
84
|
};
|
|
59
85
|
|
|
@@ -71,8 +97,9 @@ export const Default: Story = {
|
|
|
71
97
|
PDF Viewer
|
|
72
98
|
</Typography>
|
|
73
99
|
<Typography variant="body-sm" className="text-secondary">
|
|
74
|
-
A PDF viewer that displays
|
|
75
|
-
|
|
100
|
+
A PDF viewer that displays pages with automatic width adjustment,
|
|
101
|
+
smooth scrolling, page navigation, and zoom controls. Uses
|
|
102
|
+
virtualization for efficient rendering of large documents.
|
|
76
103
|
</Typography>
|
|
77
104
|
</div>
|
|
78
105
|
<div style={{ height: "600px" }}>
|
|
@@ -82,6 +109,143 @@ export const Default: Story = {
|
|
|
82
109
|
),
|
|
83
110
|
};
|
|
84
111
|
|
|
112
|
+
export const SinglePageView: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<div className="space-y-8">
|
|
115
|
+
<div className="mb-8">
|
|
116
|
+
<Typography
|
|
117
|
+
variant="label-xs-bold"
|
|
118
|
+
className="inline-block px-4 py-2 mb-6 uppercase bg-dark text-light"
|
|
119
|
+
>
|
|
120
|
+
Single Page View
|
|
121
|
+
</Typography>
|
|
122
|
+
<Typography variant="body-sm" className="text-secondary">
|
|
123
|
+
Displays one page at a time. Use the navigation controls to move
|
|
124
|
+
between pages. No scrolling required.
|
|
125
|
+
</Typography>
|
|
126
|
+
</div>
|
|
127
|
+
<div style={{ height: "600px" }}>
|
|
128
|
+
<PdfViewer
|
|
129
|
+
file={SAMPLE_PDF_URL}
|
|
130
|
+
title="Single Page Mode"
|
|
131
|
+
viewMode="single"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
),
|
|
136
|
+
parameters: {
|
|
137
|
+
controls: { disable: true },
|
|
138
|
+
docs: {
|
|
139
|
+
description: {
|
|
140
|
+
story:
|
|
141
|
+
'Single page view mode (viewMode="single") shows one page at a time. Use the navigation controls to move between pages.',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const ControlledPage: Story = {
|
|
148
|
+
render: () => {
|
|
149
|
+
const [page, setPage] = useState(1);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div className="space-y-8">
|
|
153
|
+
<div className="mb-8">
|
|
154
|
+
<Typography
|
|
155
|
+
variant="label-xs-bold"
|
|
156
|
+
className="inline-block px-4 py-2 mb-6 uppercase bg-dark text-light"
|
|
157
|
+
>
|
|
158
|
+
Controlled Page State
|
|
159
|
+
</Typography>
|
|
160
|
+
<Typography variant="body-sm" className="text-secondary">
|
|
161
|
+
The page state is controlled externally via the `page` prop. Use the
|
|
162
|
+
buttons below to change pages programmatically.
|
|
163
|
+
</Typography>
|
|
164
|
+
</div>
|
|
165
|
+
<div className="mb-4 flex items-center gap-2">
|
|
166
|
+
<button
|
|
167
|
+
onClick={() => setPage(1)}
|
|
168
|
+
disabled={page === 1}
|
|
169
|
+
className="px-3 py-1.5 bg-primary text-light rounded text-sm disabled:opacity-50"
|
|
170
|
+
>
|
|
171
|
+
Page 1
|
|
172
|
+
</button>
|
|
173
|
+
<button
|
|
174
|
+
onClick={() => setPage(7)}
|
|
175
|
+
disabled={page === 7}
|
|
176
|
+
className="px-3 py-1.5 bg-primary text-light rounded text-sm disabled:opacity-50"
|
|
177
|
+
>
|
|
178
|
+
Page 7
|
|
179
|
+
</button>
|
|
180
|
+
<button
|
|
181
|
+
onClick={() => setPage(14)}
|
|
182
|
+
disabled={page === 14}
|
|
183
|
+
className="px-3 py-1.5 bg-primary text-light rounded text-sm disabled:opacity-50"
|
|
184
|
+
>
|
|
185
|
+
Page 14
|
|
186
|
+
</button>
|
|
187
|
+
<Typography variant="body-sm" className="text-secondary ml-4">
|
|
188
|
+
Current: page = {page}
|
|
189
|
+
</Typography>
|
|
190
|
+
</div>
|
|
191
|
+
<div style={{ height: "600px" }}>
|
|
192
|
+
<PdfViewer
|
|
193
|
+
file={SAMPLE_PDF_URL}
|
|
194
|
+
title="Controlled Mode"
|
|
195
|
+
page={page}
|
|
196
|
+
onPageChange={setPage}
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
parameters: {
|
|
203
|
+
controls: { disable: true },
|
|
204
|
+
docs: {
|
|
205
|
+
description: {
|
|
206
|
+
story:
|
|
207
|
+
"Demonstrates controlled mode where the page state is managed externally via the `page` prop. Clicking the buttons smoothly scrolls to the target page. Scrolling or using navigation controls updates the external state via `onPageChange`.",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const SmoothScroll: Story = {
|
|
214
|
+
render: () => (
|
|
215
|
+
<div className="space-y-8">
|
|
216
|
+
<div className="mb-8">
|
|
217
|
+
<Typography
|
|
218
|
+
variant="label-xs-bold"
|
|
219
|
+
className="inline-block px-4 py-2 mb-6 uppercase bg-dark text-light"
|
|
220
|
+
>
|
|
221
|
+
Smooth Scroll Behavior
|
|
222
|
+
</Typography>
|
|
223
|
+
<Typography variant="body-sm" className="text-secondary">
|
|
224
|
+
When navigating via controls, the page smoothly animates instead of
|
|
225
|
+
jumping instantly. Use the page navigation controls to see the
|
|
226
|
+
difference.
|
|
227
|
+
</Typography>
|
|
228
|
+
</div>
|
|
229
|
+
<div style={{ height: "600px" }}>
|
|
230
|
+
<PdfViewer
|
|
231
|
+
file={SAMPLE_PDF_URL}
|
|
232
|
+
title="Smooth Scroll"
|
|
233
|
+
scrollBehavior="smooth"
|
|
234
|
+
/>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
),
|
|
238
|
+
parameters: {
|
|
239
|
+
controls: { disable: true },
|
|
240
|
+
docs: {
|
|
241
|
+
description: {
|
|
242
|
+
story:
|
|
243
|
+
'Uses scrollBehavior="smooth" for animated page transitions instead of instant jumps.',
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
|
|
85
249
|
export const WithCallbacks: Story = {
|
|
86
250
|
render: () => {
|
|
87
251
|
const [action, setAction] = useState<string>("No action yet");
|
|
@@ -45,8 +45,8 @@ const meta: Meta<typeof SidebarProvider> = {
|
|
|
45
45
|
component:
|
|
46
46
|
"A collapsible sidebar navigation component with expanded and icon-only states. Features tooltip support when collapsed, smooth transitions, and flexible content organization.\n\n" +
|
|
47
47
|
"## Related Resources\n\n" +
|
|
48
|
-
"- [AppSidebar Implementation](https://github.com/northslopetech/
|
|
49
|
-
"- [Usage in Application Routes](https://github.com/northslopetech/
|
|
48
|
+
"- [AppSidebar Implementation](https://github.com/northslopetech/ns-cli/blob/main/templates/default/src/components/layout/AppSidebar.tsx) - Full implementation example showing how to compose the Sidebar primitive components into an application-level sidebar component\n" +
|
|
49
|
+
"- [Usage in Application Routes](https://github.com/northslopetech/ns-cli/blob/main/templates/default/src/routes/__root.tsx#L37) - Real-world usage of AppSidebar integrated into a TanStack Router root layout with SidebarProvider",
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
52
|
},
|
package/package.json
CHANGED