@charcuterie/ui 4.30.0 → 4.31.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 +7 -2
- package/docs/README.md +573 -0
- package/docs/building-an-app.md +231 -0
- package/docs/components/Accordion.md +106 -0
- package/docs/components/ActionMenu.md +63 -0
- package/docs/components/ActionTiles.md +233 -0
- package/docs/components/AdaptiveGrid.md +215 -0
- package/docs/components/Alert.md +99 -0
- package/docs/components/AnchorLink.md +23 -0
- package/docs/components/Avatar.md +153 -0
- package/docs/components/Badge.md +81 -0
- package/docs/components/BadgeButton.md +84 -0
- package/docs/components/Board.md +277 -0
- package/docs/components/Breadcrumbs.md +87 -0
- package/docs/components/Button.md +72 -0
- package/docs/components/ButtonLink.md +81 -0
- package/docs/components/Card.md +114 -0
- package/docs/components/CatalogPicker.md +250 -0
- package/docs/components/Chart.md +39 -0
- package/docs/components/Checkbox.md +197 -0
- package/docs/components/ColorPicker.md +99 -0
- package/docs/components/ColorSchemeSwitcher.md +92 -0
- package/docs/components/ColorSchemeToggle.md +98 -0
- package/docs/components/Combobox.md +175 -0
- package/docs/components/CommandPalette.md +120 -0
- package/docs/components/ComparisonChart.md +31 -0
- package/docs/components/CopyButton.md +112 -0
- package/docs/components/DataTable.md +170 -0
- package/docs/components/DatePicker.md +225 -0
- package/docs/components/Dialog.md +134 -0
- package/docs/components/DropRail.md +107 -0
- package/docs/components/EmptyState.md +65 -0
- package/docs/components/Field.md +215 -0
- package/docs/components/FieldGroup.md +45 -0
- package/docs/components/FileDropZone.md +98 -0
- package/docs/components/GroupedList.md +189 -0
- package/docs/components/Header.md +76 -0
- package/docs/components/HtmlEditor-html-editor.md +76 -0
- package/docs/components/HtmlView-html-editor.md +47 -0
- package/docs/components/HtmlView-html-view.md +47 -0
- package/docs/components/IconButton.md +52 -0
- package/docs/components/LaneTimeline.md +254 -0
- package/docs/components/Lightbox.md +101 -0
- package/docs/components/Listbox.md +109 -0
- package/docs/components/LiveStatusIndicator.md +60 -0
- package/docs/components/LogViewer.md +142 -0
- package/docs/components/Main.md +247 -0
- package/docs/components/MarkdownEditor.md +262 -0
- package/docs/components/MarkdownEditorCodeMirror-markdown-editor-codemirror.md +230 -0
- package/docs/components/MarkdownLine.md +187 -0
- package/docs/components/MarkdownView-markdown-editor-codemirror.md +235 -0
- package/docs/components/MediaTile.md +106 -0
- package/docs/components/Menu.md +209 -0
- package/docs/components/MetricCard.md +38 -0
- package/docs/components/Modal.md +89 -0
- package/docs/components/Nav.md +167 -0
- package/docs/components/NavBar.md +190 -0
- package/docs/components/Picker.md +132 -0
- package/docs/components/Popover.md +135 -0
- package/docs/components/PortraitTiles.md +169 -0
- package/docs/components/ProgressBar.md +70 -0
- package/docs/components/ProgressCard.md +65 -0
- package/docs/components/QueryBuilder.md +132 -0
- package/docs/components/RadioGroup.md +165 -0
- package/docs/components/Rail.md +79 -0
- package/docs/components/RangeSlider.md +144 -0
- package/docs/components/ReactRouterAdapter-react-router.md +27 -0
- package/docs/components/ReactRouterLink-react-router.md +23 -0
- package/docs/components/ReorderList.md +143 -0
- package/docs/components/RouterLinkProvider.md +33 -0
- package/docs/components/ScheduleBoard.md +41 -0
- package/docs/components/ScrollMemoryProvider.md +33 -0
- package/docs/components/SearchInput.md +46 -0
- package/docs/components/SegmentedControl.md +98 -0
- package/docs/components/Select.md +169 -0
- package/docs/components/Shell.md +162 -0
- package/docs/components/Skeleton.md +48 -0
- package/docs/components/Slider.md +128 -0
- package/docs/components/SortableTableHeader.md +84 -0
- package/docs/components/Spinner.md +50 -0
- package/docs/components/Stepper.md +121 -0
- package/docs/components/Swatch.md +79 -0
- package/docs/components/Switch.md +80 -0
- package/docs/components/TableColumns.md +29 -0
- package/docs/components/TableViewport.md +42 -0
- package/docs/components/Tabs.md +184 -0
- package/docs/components/TextLink.md +106 -0
- package/docs/components/TimecodeInput.md +222 -0
- package/docs/components/Toast.md +108 -0
- package/docs/components/ToastRegion.md +35 -0
- package/docs/components/Toolbar.md +118 -0
- package/docs/components/Tooltip.md +94 -0
- package/docs/components/UnstyledLink.md +21 -0
- package/docs/components/ValuePairs.md +30 -0
- package/docs/components/VirtualizedGrid.md +204 -0
- package/docs/components/VisuallyHidden.md +39 -0
- package/docs/components/WeekdayIndicator.md +39 -0
- package/docs/hooks/useAdaptiveColumns.md +111 -0
- package/docs/hooks/useCommandPalette.md +40 -0
- package/docs/hooks/useCommandPaletteHotkeys.md +33 -0
- package/docs/hooks/useDeploymentUpdate.md +39 -0
- package/docs/hooks/useLastPresentValue.md +23 -0
- package/docs/hooks/useListMotion.md +65 -0
- package/docs/hooks/useNavLayout.md +59 -0
- package/docs/hooks/usePresence.md +39 -0
- package/docs/hooks/useRouterLink.md +22 -0
- package/docs/hooks/useValueChangeMotion.md +28 -0
- package/package.json +7 -5
- package/skills/charcuterie/SKILL.md +17 -0
- package/skills/charcuterie/references/build-a-screen.md +6 -0
- package/skills/charcuterie/references/create-a-component.md +6 -0
- package/src/AdaptiveGrid/AdaptiveGrid.stories.tsx +1 -1
- package/src/Tabs/Tabs.stories.tsx +1 -1
- package/src/VirtualizedGrid/VirtualizedGrid.stories.tsx +65 -28
- package/src/VirtualizedGrid/VirtualizedGrid.test.tsx +29 -0
- package/src/shell.storyHelpers.tsx +3 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# usePresence
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { usePresence } from "@charcuterie/ui"
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Use this to keep one app-owned element mounted during its exit. Use `useListMotion` for a collection. Pair it with the shipped motion classes and hide exiting content from assistive technology.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { toFadeMotionClass } from "@charcuterie/ui"
|
|
11
|
+
|
|
12
|
+
function Details({ isVisible }: { isVisible: boolean }) {
|
|
13
|
+
const { isMounted, isExiting, presenceRef } = usePresence<HTMLDivElement>(isVisible)
|
|
14
|
+
return isMounted ? (
|
|
15
|
+
<div aria-hidden={isExiting} className={toFadeMotionClass(isExiting)} inert={isExiting} ref={presenceRef}>
|
|
16
|
+
Details
|
|
17
|
+
</div>
|
|
18
|
+
) : null
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Published TypeScript API
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
const usePresence: <Element extends HTMLElement = HTMLElement>(isVisible: boolean) => UsePresenceResult<Element>
|
|
26
|
+
|
|
27
|
+
type UsePresenceResult<Element extends HTMLElement = HTMLElement> = {
|
|
28
|
+
/** Mounted, but closed: make it `inert` and give it the exit class. */
|
|
29
|
+
isExiting: boolean;
|
|
30
|
+
/** Whether to render the element at all. */
|
|
31
|
+
isMounted: boolean;
|
|
32
|
+
/** Attach to the element whose exit animation ends the presence. */
|
|
33
|
+
presenceRef: RefObject<Element | null>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Element extends HTMLElement = HTMLElement
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[Full declarations](../../dist/Motion/usePresence.d.ts)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# useRouterLink
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { useRouterLink } from "@charcuterie/ui"
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Use this when implementing a custom link that must use the current router adapter. Use `TextLink`, `ButtonLink`, or `UnstyledLink` for ordinary application links. Pass an href and visible text and keep the link's native keyboard and modifier-click behavior.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
const Link = useRouterLink()
|
|
11
|
+
return <Link href="/settings">Settings</Link>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Published TypeScript API
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
const useRouterLink: () => RouterLinkComponent
|
|
18
|
+
|
|
19
|
+
type RouterLinkComponent = ComponentType<RouterLinkProps>;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
[Full declarations](../../dist/RouterLink/RouterLinkProvider.d.ts)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# useValueChangeMotion
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { useValueChangeMotion } from "@charcuterie/ui"
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Use this to highlight a changing value. Use `useListMotion` for added, removed, or reordered items. If a value needs to be announced, use a suitable live region independently of the animation.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
function JobTotal({ total }: { total: number }) {
|
|
11
|
+
const motion = useValueChangeMotion(total)
|
|
12
|
+
return <span {...motion}>Total: {total}</span>
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Published TypeScript API
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
const useValueChangeMotion: (value: unknown) => ValueChangeMotionProps
|
|
20
|
+
|
|
21
|
+
type ValueChangeMotionProps = {
|
|
22
|
+
/** The pop class while the pop runs; `undefined` otherwise. */
|
|
23
|
+
className: string | undefined;
|
|
24
|
+
onAnimationEnd: (event: AnimationEvent<HTMLElement>) => void;
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
[Full declarations](../../dist/Motion/useValueChangeMotion.d.ts)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcuterie/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.0",
|
|
4
4
|
"description": "The Charcuterie components. Tokens for look, @charcuterie/logic for state, ARIA that agents can actually drive.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -53,12 +53,14 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
|
+
"docs",
|
|
57
|
+
"skills",
|
|
56
58
|
"dist",
|
|
57
59
|
"src"
|
|
58
60
|
],
|
|
59
61
|
"dependencies": {
|
|
60
|
-
"@charcuterie/logic": "2.
|
|
61
|
-
"@charcuterie/tokens": "1.
|
|
62
|
+
"@charcuterie/logic": "2.13.0",
|
|
63
|
+
"@charcuterie/tokens": "1.11.0",
|
|
62
64
|
"@floating-ui/react": "^0.27.20",
|
|
63
65
|
"@tanstack/react-virtual": "^3.13.12",
|
|
64
66
|
"tailwind-merge": "^3.6.0"
|
|
@@ -130,7 +132,7 @@
|
|
|
130
132
|
}
|
|
131
133
|
},
|
|
132
134
|
"devDependencies": {
|
|
133
|
-
"@charcuterie/storybook-config": "0.4.
|
|
135
|
+
"@charcuterie/storybook-config": "0.4.5",
|
|
134
136
|
"@charcuterie/vitest-config": "^2.0.0",
|
|
135
137
|
"@codemirror/commands": "^6",
|
|
136
138
|
"@codemirror/lang-markdown": "^6",
|
|
@@ -166,7 +168,7 @@
|
|
|
166
168
|
"directory": "packages/ui"
|
|
167
169
|
},
|
|
168
170
|
"scripts": {
|
|
169
|
-
"build": "tsc -p tsconfig.build.json && node scripts/copyStyles.ts",
|
|
171
|
+
"build": "tsc -p tsconfig.build.json && node scripts/copyStyles.ts && node ../../scripts/packageDocs.mjs",
|
|
170
172
|
"test": "vitest",
|
|
171
173
|
"typecheck": "tsc --noEmit"
|
|
172
174
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: charcuterie
|
|
3
|
+
description: Choose and compose Charcuterie React components for app screens, use the installed library APIs, or add a shared component in the Charcuterie repository. Use when an app depends on @charcuterie/ui or the task names Charcuterie.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build with Charcuterie
|
|
7
|
+
|
|
8
|
+
Start with the [installed UI docs](../../docs/README.md). Their API and examples match this package's version. If this skill was copied into an agent's skill directory, open `node_modules/@charcuterie/ui/docs/README.md` from the app instead and follow its links.
|
|
9
|
+
|
|
10
|
+
- For a new screen or an app setup, use the [screen workflow](references/build-a-screen.md).
|
|
11
|
+
- To choose a component, use the [component-choice table](../../docs/building-an-app.md#the-component-choice-table), then read the selected component's page for props and accessible behavior.
|
|
12
|
+
- To add a shared component in the library repository, use the [component authoring workflow](references/create-a-component.md).
|
|
13
|
+
- To work directly with state, read `node_modules/@charcuterie/logic/docs/README.md` if the app installs logic directly. For tokens, start at `node_modules/@charcuterie/tokens/docs/README.md`.
|
|
14
|
+
|
|
15
|
+
Use the package entry named on each component page. Check the installed declaration linked there when you need a type the example does not cover.
|
|
16
|
+
|
|
17
|
+
The app ESLint preset enables the picker rules. Opt into the rest of the component-choice rules with `componentChoice: "all"` and the flex-overflow rules with `flexOverflow: "warn"`. See [app setup](../../docs/building-an-app.md#3-adopt-the-house-lint-config).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Build a screen
|
|
2
|
+
|
|
3
|
+
1. Read the [app setup and component-choice table](../../../docs/building-an-app.md). Match the screen to the existing app's stylesheet, adapter, and lint setup. For a new app, follow the Tailwind source and stylesheet instructions in the guide.
|
|
4
|
+
2. Choose the screen structure with `Shell`, `Header`, `Rail`, and `Main`. Pick links for destinations and buttons for actions. For each form control, decide whether it needs `Field` for a label and error. Use `Picker` for a short options list, `Listbox` for a custom trigger, and `Combobox` for type-to-search. Native `Select` is deprecated.
|
|
5
|
+
3. Read the matching pages in the [UI index](../../../docs/README.md). Apply their naming, focus, keyboard, and dismissal contracts. Keep data and routing decisions in the app. The app supplies icons.
|
|
6
|
+
4. Test the primary task using accessible role and name queries. Test keyboard operation, dismissal and focus return where relevant, and the layout at a narrow container width.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Add a shared component
|
|
2
|
+
|
|
3
|
+
1. Compare the needed behavior with the [component-choice table](../../../docs/building-an-app.md#the-component-choice-table) and the [UI index](../../../docs/README.md). Check sibling components before adding a new public shape.
|
|
4
|
+
2. In a Charcuterie checkout, read the repository's `AGENTS.md`, decision index, and the [UI component checklist](../../../README.md#adding-a-component). Put rendering and ARIA in UI. Use the state kinds in logic where they fit. State-hook options initialize once. Keep tokens independent of UI and logic.
|
|
5
|
+
3. Put the component, Storybook MDX, stories, and tests in the same component directory. Export the component and its public types from the intended entry. Include a short example and explain what the caller must supply for names, focus, keyboard interaction, or announcements. The package build uses that MDX, the story, and the emitted declarations to generate its page.
|
|
6
|
+
4. Exercise the named role and keyboard path with the library test harness. Run the package build, check the generated page, and verify the tarball through the package documentation test.
|
|
@@ -63,7 +63,7 @@ const Item = ({ label }: { label: string }) => (
|
|
|
63
63
|
* the clipping to matter.
|
|
64
64
|
*/}
|
|
65
65
|
<p className="truncate text-content-muted text-sm">
|
|
66
|
-
/mnt/
|
|
66
|
+
/mnt/media/archive/videos/very/long/unbroken/path/that/would/push/a/track/wide
|
|
67
67
|
</p>
|
|
68
68
|
</Card>
|
|
69
69
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { playgroundParameters } from "@charcuterie/storybook-config/story-parameters"
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
-
import { useState } from "react"
|
|
3
|
+
import { type ReactNode, useState } from "react"
|
|
4
4
|
|
|
5
5
|
import { getColumnChoices } from "../AdaptiveGrid/chooseColumns.ts"
|
|
6
6
|
import type { BlockSizeResolver } from "../AdaptiveGrid/useAdaptiveColumns.ts"
|
|
@@ -70,11 +70,32 @@ const Item = ({ label }: { label: string }) => (
|
|
|
70
70
|
* matter.
|
|
71
71
|
*/}
|
|
72
72
|
<p className="truncate text-content-muted text-sm">
|
|
73
|
-
/mnt/
|
|
73
|
+
/mnt/media/archive/videos/very/long/unbroken/path/that/would/push/a/track/wide
|
|
74
74
|
</p>
|
|
75
75
|
</Card>
|
|
76
76
|
)
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Give each long example a scroll window with a height before any rows
|
|
80
|
+
* mount. A max-height alone leaves the virtualizer an empty viewport.
|
|
81
|
+
*/
|
|
82
|
+
const GridExampleWindow = ({
|
|
83
|
+
children,
|
|
84
|
+
label,
|
|
85
|
+
}: {
|
|
86
|
+
children: ReactNode
|
|
87
|
+
label: string
|
|
88
|
+
}) => (
|
|
89
|
+
<section
|
|
90
|
+
aria-label={label}
|
|
91
|
+
className="h-96 overflow-auto"
|
|
92
|
+
// biome-ignore lint/a11y/noNoninteractiveTabindex: Keyboard users need to focus the list's scroll region.
|
|
93
|
+
tabIndex={0}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
</section>
|
|
97
|
+
)
|
|
98
|
+
|
|
78
99
|
const meta = {
|
|
79
100
|
title: "Components/Layout/VirtualizedGrid",
|
|
80
101
|
component: VirtualizedGrid<Bay>,
|
|
@@ -110,6 +131,9 @@ type Story = StoryObj<typeof meta>
|
|
|
110
131
|
*/
|
|
111
132
|
export const Playground: Story = {
|
|
112
133
|
parameters: playgroundParameters,
|
|
134
|
+
// Preserve window scrolling here. VRT captures the browser viewport
|
|
135
|
+
// because the canvas includes the spacer for all 2,000 items.
|
|
136
|
+
tags: ["vrt:viewport"],
|
|
113
137
|
}
|
|
114
138
|
|
|
115
139
|
/**
|
|
@@ -225,12 +249,16 @@ export const AllVariants: Story = {
|
|
|
225
249
|
{panel.label}
|
|
226
250
|
</span>
|
|
227
251
|
|
|
228
|
-
<
|
|
229
|
-
{
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
252
|
+
<GridExampleWindow
|
|
253
|
+
label={`Bays at ${panel.blockSize}px window height`}
|
|
254
|
+
>
|
|
255
|
+
<VirtualizedGrid
|
|
256
|
+
{...gridProps}
|
|
257
|
+
blockSizeResolver={fixedBlockSize(
|
|
258
|
+
panel.blockSize,
|
|
259
|
+
)}
|
|
260
|
+
/>
|
|
261
|
+
</GridExampleWindow>
|
|
234
262
|
</div>
|
|
235
263
|
))}
|
|
236
264
|
</StorySection>
|
|
@@ -265,10 +293,19 @@ export const AllStates: Story = {
|
|
|
265
293
|
{panel.label}
|
|
266
294
|
</span>
|
|
267
295
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
296
|
+
{panel.items === MANY_ITEMS ? (
|
|
297
|
+
<GridExampleWindow label="2,000 bays">
|
|
298
|
+
<VirtualizedGrid
|
|
299
|
+
{...gridProps}
|
|
300
|
+
items={panel.items}
|
|
301
|
+
/>
|
|
302
|
+
</GridExampleWindow>
|
|
303
|
+
) : (
|
|
304
|
+
<VirtualizedGrid
|
|
305
|
+
{...gridProps}
|
|
306
|
+
items={panel.items}
|
|
307
|
+
/>
|
|
308
|
+
)}
|
|
272
309
|
</div>
|
|
273
310
|
))}
|
|
274
311
|
</div>
|
|
@@ -286,12 +323,6 @@ export const Responsive: Story = {
|
|
|
286
323
|
args: {
|
|
287
324
|
blockSizeResolver: fixedBlockSize(600),
|
|
288
325
|
minColumnInlineSize: 160,
|
|
289
|
-
// Every row mounted. This story is about the column count, not
|
|
290
|
-
// the window, and the VRT shot of the whole root is taller than
|
|
291
|
-
// the viewport: the grids re-window while it is taken, so which
|
|
292
|
-
// rows were drawn depended on the runner's timing (release PR
|
|
293
|
-
// #319 drew 13 rows where the baseline drew 5).
|
|
294
|
-
overscanRows: 60,
|
|
295
326
|
},
|
|
296
327
|
render: (gridProps) => (
|
|
297
328
|
<div className="flex flex-wrap items-start gap-6">
|
|
@@ -311,10 +342,14 @@ export const Responsive: Story = {
|
|
|
311
342
|
{panel.label}
|
|
312
343
|
</span>
|
|
313
344
|
|
|
314
|
-
<
|
|
315
|
-
{
|
|
316
|
-
|
|
317
|
-
|
|
345
|
+
<GridExampleWindow
|
|
346
|
+
label={`Bays in a ${panel.label}`}
|
|
347
|
+
>
|
|
348
|
+
<VirtualizedGrid
|
|
349
|
+
{...gridProps}
|
|
350
|
+
items={MANY_ITEMS.slice(0, 60)}
|
|
351
|
+
/>
|
|
352
|
+
</GridExampleWindow>
|
|
318
353
|
</div>
|
|
319
354
|
))}
|
|
320
355
|
</div>
|
|
@@ -345,12 +380,14 @@ export const Interactive: Story = {
|
|
|
345
380
|
selectedValue={choice}
|
|
346
381
|
/>
|
|
347
382
|
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
383
|
+
<GridExampleWindow label="Bays with selectable column count">
|
|
384
|
+
<VirtualizedGrid
|
|
385
|
+
{...gridProps}
|
|
386
|
+
columns={
|
|
387
|
+
choice === "auto" ? undefined : Number(choice)
|
|
388
|
+
}
|
|
389
|
+
/>
|
|
390
|
+
</GridExampleWindow>
|
|
354
391
|
</StorySection>
|
|
355
392
|
)
|
|
356
393
|
},
|
|
@@ -38,6 +38,7 @@ import * as stories from "./VirtualizedGrid.stories.tsx"
|
|
|
38
38
|
|
|
39
39
|
const {
|
|
40
40
|
AllStates,
|
|
41
|
+
AllVariants,
|
|
41
42
|
Playground,
|
|
42
43
|
InHiddenTabPanel,
|
|
43
44
|
InShellScrollRegion,
|
|
@@ -357,6 +358,34 @@ test("a screen reader is told the real length", async () => {
|
|
|
357
358
|
).toBe("1")
|
|
358
359
|
})
|
|
359
360
|
|
|
361
|
+
test("each column variant shows a window of rows", async () => {
|
|
362
|
+
const { canvasElement } = await mountStory(AllVariants)
|
|
363
|
+
|
|
364
|
+
await waitFor(async () => {
|
|
365
|
+
const lists = getLists(canvasElement)
|
|
366
|
+
await expect(lists).toHaveLength(3)
|
|
367
|
+
|
|
368
|
+
for (const list of lists) {
|
|
369
|
+
const scrollRegion = list.closest(
|
|
370
|
+
"section[aria-label]",
|
|
371
|
+
)
|
|
372
|
+
await expect(scrollRegion).not.toBeNull()
|
|
373
|
+
await expect(
|
|
374
|
+
scrollRegion?.clientHeight,
|
|
375
|
+
).toBeGreaterThan(0)
|
|
376
|
+
await expect(scrollRegion?.clientHeight).toBeLessThan(
|
|
377
|
+
500,
|
|
378
|
+
)
|
|
379
|
+
await expect(
|
|
380
|
+
scrollRegion?.scrollHeight,
|
|
381
|
+
).toBeGreaterThan(scrollRegion?.clientHeight ?? 0)
|
|
382
|
+
const cellCount = list.querySelectorAll("li").length
|
|
383
|
+
await expect(cellCount).toBeGreaterThan(0)
|
|
384
|
+
await expect(cellCount).toBeLessThan(100)
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
})
|
|
388
|
+
|
|
360
389
|
test("an empty list reserves no space and mounts no rows", async () => {
|
|
361
390
|
const { canvasElement } = await mountStory(AllStates)
|
|
362
391
|
|
|
@@ -232,7 +232,7 @@ export const ExternalLinkFooter = (): ReactNode => (
|
|
|
232
232
|
export const OverflowingContent = (): ReactNode => (
|
|
233
233
|
<>
|
|
234
234
|
<p className="text-content-secondary text-sm">
|
|
235
|
-
/mnt/
|
|
235
|
+
/mnt/media/archive/videos/Television/Some-Very-Long-Show-Name/Season-01/Some-Very-Long-Show-Name-S01E01-Pilot-2160p-HDR-DTS-HD-MA.mkv
|
|
236
236
|
</p>
|
|
237
237
|
|
|
238
238
|
<section
|
|
@@ -270,8 +270,8 @@ export const OverflowingContent = (): ReactNode => (
|
|
|
270
270
|
<tr>
|
|
271
271
|
{[
|
|
272
272
|
"21:04:11",
|
|
273
|
-
"/mnt/
|
|
274
|
-
"/mnt/
|
|
273
|
+
"/mnt/media/staging/Incoming",
|
|
274
|
+
"/mnt/media/archive/videos/Television",
|
|
275
275
|
"48,912,338,112",
|
|
276
276
|
"612 MB/s",
|
|
277
277
|
"sha256 ok",
|