@multiplatform.one/table 7.88.2 → 7.88.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/table",
|
|
3
|
-
"version": "7.88.
|
|
3
|
+
"version": "7.88.4",
|
|
4
4
|
"description": "Advanced table components with filtering, pagination, sorting, and URL state management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-platform",
|
|
@@ -84,13 +84,13 @@
|
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@multiplatform.one/components": "^7.88.
|
|
88
|
-
"@multiplatform.one/forms": "^7.88.
|
|
89
|
-
"@multiplatform.one/platform": "^7.88.
|
|
90
|
-
"@multiplatform.one/rich-text": "^7.88.
|
|
91
|
-
"@multiplatform.one/router": "^7.88.
|
|
92
|
-
"@multiplatform.one/table-primitives": "^7.88.
|
|
93
|
-
"@multiplatform.one/theme": "^7.88.
|
|
87
|
+
"@multiplatform.one/components": "^7.88.4",
|
|
88
|
+
"@multiplatform.one/forms": "^7.88.4",
|
|
89
|
+
"@multiplatform.one/platform": "^7.88.4",
|
|
90
|
+
"@multiplatform.one/rich-text": "^7.88.4",
|
|
91
|
+
"@multiplatform.one/router": "^7.88.4",
|
|
92
|
+
"@multiplatform.one/table-primitives": "^7.88.4",
|
|
93
|
+
"@multiplatform.one/theme": "^7.88.4",
|
|
94
94
|
"@phosphor-icons/react": "^2.1.10",
|
|
95
95
|
"@shopify/flash-list": "^2.3.1",
|
|
96
96
|
"@tamagui/roving-focus": "2.7.6",
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"tamagui": "2.7.6"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@multiplatform.one/config": "7.88.
|
|
104
|
-
"@multiplatform.one/router": "7.88.
|
|
105
|
-
"@multiplatform.one/storybook": "7.88.
|
|
106
|
-
"@multiplatform.one/test-utils": "7.88.
|
|
103
|
+
"@multiplatform.one/config": "7.88.4",
|
|
104
|
+
"@multiplatform.one/router": "7.88.4",
|
|
105
|
+
"@multiplatform.one/storybook": "7.88.4",
|
|
106
|
+
"@multiplatform.one/test-utils": "7.88.4",
|
|
107
107
|
"@tamagui/build": "2.7.6",
|
|
108
108
|
"@testing-library/react": "^16.3.3",
|
|
109
109
|
"@types/react-dom": "^19.2.3",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FZ-9212: a DataTable whose pager is the page's bottom accessory, inside an
|
|
3
|
+
* AppShell whose every tab carries a native glyph. On an iOS 26+ binary that
|
|
4
|
+
* draws react-native-screens' tabs, TabHost hands that pager to
|
|
5
|
+
* UITabBarController's bottom accessory (FZ-7995). Here, on web, the MPO
|
|
6
|
+
* TabBar takes it instead, so the same story proves both arms.
|
|
7
|
+
*/
|
|
8
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
9
|
+
import { cleanup, fireEvent, screen } from "@testing-library/react";
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { loadCsf } from "storybook/internal/csf-tools";
|
|
13
|
+
import type { ReactElement } from "react";
|
|
14
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
15
|
+
import storyMeta, { PagerInNativeTabs, destinations, rows } from "./DataTableNativeTabs.stories";
|
|
16
|
+
|
|
17
|
+
vi.mock("@multiplatform.one/theme", async (importOriginal) => ({
|
|
18
|
+
...(await importOriginal<typeof import("@multiplatform.one/theme")>()),
|
|
19
|
+
useLayoutSizeClass: () => "compact",
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
afterEach(cleanup);
|
|
23
|
+
|
|
24
|
+
function story() {
|
|
25
|
+
const render = PagerInNativeTabs.render as () => ReactElement;
|
|
26
|
+
return renderWithProviders(render());
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe("DataTable pager inside native tabs (FZ-9212)", () => {
|
|
30
|
+
it("is a Kitchen Sink story that fills its stage", () => {
|
|
31
|
+
expect(storyMeta.title).toBe("Table/DataTableNativeTabs");
|
|
32
|
+
expect(PagerInNativeTabs.parameters?.nativeGallery).toEqual({ scroll: false });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("indexes one story, not the fixtures it exports for this spec", () => {
|
|
36
|
+
const csf = loadCsf(
|
|
37
|
+
readFileSync(join(import.meta.dirname, "DataTableNativeTabs.stories.tsx"), "utf8"),
|
|
38
|
+
{ makeTitle: (title) => title ?? "", fileName: "DataTableNativeTabs.stories.tsx" },
|
|
39
|
+
).parse();
|
|
40
|
+
expect(csf.indexInputs.map((input) => input.exportName)).toEqual(["PagerInNativeTabs"]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("gives every tab a native glyph, so TabHost can draw the system tab bar", () => {
|
|
44
|
+
const tabs = destinations.filter((item) => (item.placement ?? "tab") === "tab");
|
|
45
|
+
expect(tabs.length).toBeGreaterThanOrEqual(3);
|
|
46
|
+
for (const tab of tabs) expect(tab.nativeIcon?.sfSymbol).toMatch(/\S/);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("has rows for more than one page", () => {
|
|
50
|
+
expect(rows.length).toBeGreaterThan(20);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("hands the table's pager to the tab bar's accessory", () => {
|
|
54
|
+
story();
|
|
55
|
+
const accessory = screen.getByTestId("tab-bar-accessory");
|
|
56
|
+
const pager = accessory.querySelector("[data-table-phone-pager='true']");
|
|
57
|
+
expect(pager).not.toBeNull();
|
|
58
|
+
expect(pager!.querySelectorAll("[data-pagination-dot]").length).toBeGreaterThanOrEqual(2);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("pages the table from the accessory", () => {
|
|
62
|
+
story();
|
|
63
|
+
expect(screen.getByText("Move 1")).toBeTruthy();
|
|
64
|
+
expect(screen.queryByText("Move 11")).toBeNull();
|
|
65
|
+
const accessory = screen.getByTestId("tab-bar-accessory");
|
|
66
|
+
fireEvent.click(
|
|
67
|
+
accessory.querySelector("[aria-label='Go to next page'], [aria-label='Next page']")!,
|
|
68
|
+
);
|
|
69
|
+
expect(screen.getByText("Move 11")).toBeTruthy();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A DataTable's pager inside native tabs (FZ-9212, for FZ-7995's proof).
|
|
3
|
+
*
|
|
4
|
+
* Every tab carries a native glyph, so on an iOS 26+ binary that draws
|
|
5
|
+
* react-native-screens' tabs, TabHost hands the page's bottom accessory, the
|
|
6
|
+
* table's pager, to UITabBarController's own bottom accessory. Web and every
|
|
7
|
+
* other platform keep the MPO TabBar, which docks the pager under its capsule.
|
|
8
|
+
* Thirty rows at ten a page give the pager three pages.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
AppShell,
|
|
13
|
+
type AppShellDestination,
|
|
14
|
+
PageHeader,
|
|
15
|
+
Screen,
|
|
16
|
+
} from "@multiplatform.one/components";
|
|
17
|
+
import {
|
|
18
|
+
HouseIcon,
|
|
19
|
+
LightningIcon,
|
|
20
|
+
SparkleIcon,
|
|
21
|
+
SquaresFourIcon,
|
|
22
|
+
StackIcon,
|
|
23
|
+
} from "@phosphor-icons/react";
|
|
24
|
+
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
25
|
+
import { useState } from "react";
|
|
26
|
+
import type { DataTableColumn } from "../../types";
|
|
27
|
+
import { DataTable } from "./index";
|
|
28
|
+
|
|
29
|
+
type Move = { id: number; name: string; type: string; power: number };
|
|
30
|
+
|
|
31
|
+
const types = ["normal", "fire", "water", "grass", "psychic"];
|
|
32
|
+
|
|
33
|
+
export const rows: Move[] = Array.from({ length: 30 }, (_, i) => ({
|
|
34
|
+
id: i + 1,
|
|
35
|
+
name: `Move ${i + 1}`,
|
|
36
|
+
type: types[i % types.length]!,
|
|
37
|
+
power: 20 + ((i * 15) % 100),
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
const columns: DataTableColumn<Move>[] = [
|
|
41
|
+
{ accessorKey: "name", header: "Name" },
|
|
42
|
+
{ accessorKey: "type", header: "Type" },
|
|
43
|
+
{ accessorKey: "power", header: "Power" },
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
export const destinations: AppShellDestination[] = [
|
|
47
|
+
{ key: "/", label: "Home", icon: HouseIcon, nativeIcon: { sfSymbol: "house" } },
|
|
48
|
+
{ key: "/pokemon", label: "Pokemon", icon: SparkleIcon, nativeIcon: { sfSymbol: "sparkles" } },
|
|
49
|
+
{ key: "/moves", label: "Moves", icon: LightningIcon, nativeIcon: { sfSymbol: "bolt" } },
|
|
50
|
+
{
|
|
51
|
+
key: "/backoffice",
|
|
52
|
+
label: "Backoffice",
|
|
53
|
+
icon: SquaresFourIcon,
|
|
54
|
+
nativeIcon: { sfSymbol: "square.grid.2x2", sfSymbolSelected: "square.grid.2x2.fill" },
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
function Demo() {
|
|
59
|
+
const [path, setPath] = useState("/moves");
|
|
60
|
+
return (
|
|
61
|
+
<AppShell
|
|
62
|
+
destinations={destinations}
|
|
63
|
+
path={path}
|
|
64
|
+
onNavigate={setPath}
|
|
65
|
+
onBack={setPath}
|
|
66
|
+
title="multiplatform.one"
|
|
67
|
+
logo={<StackIcon weight="bold" />}
|
|
68
|
+
>
|
|
69
|
+
<Screen>
|
|
70
|
+
<PageHeader title="Moves" subtitle={`${rows.length} moves`} divider={false} />
|
|
71
|
+
<DataTable
|
|
72
|
+
data={rows}
|
|
73
|
+
columns={columns}
|
|
74
|
+
enablePagination
|
|
75
|
+
initialState={{ pagination: { pageIndex: 0, pageSize: 10 } }}
|
|
76
|
+
readOnly
|
|
77
|
+
/>
|
|
78
|
+
</Screen>
|
|
79
|
+
</AppShell>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const meta: Meta = {
|
|
84
|
+
title: "Table/DataTableNativeTabs",
|
|
85
|
+
excludeStories: ["rows", "destinations"],
|
|
86
|
+
parameters: { layout: "fullscreen", status: { type: "beta" } },
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default meta;
|
|
90
|
+
type Story = StoryObj;
|
|
91
|
+
|
|
92
|
+
/** The pager as the system tab bar's bottom accessory on iOS 26+, the docked strip elsewhere. */
|
|
93
|
+
export const PagerInNativeTabs: Story = {
|
|
94
|
+
name: "Pager in native tabs",
|
|
95
|
+
parameters: {
|
|
96
|
+
viewport: { defaultViewport: "mobile1" },
|
|
97
|
+
pageShell: true,
|
|
98
|
+
nativeGallery: { scroll: false },
|
|
99
|
+
},
|
|
100
|
+
render: () => <Demo />,
|
|
101
|
+
};
|