@marimo-team/islands 0.23.7-dev9 → 0.23.7
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/{ConnectedDataExplorerComponent-DnRhpPMJ.js → ConnectedDataExplorerComponent-2lBNiUv6.js} +13 -13
- package/dist/{ErrorBoundary-Da4UeYxT.js → ErrorBoundary-D3wrPNma.js} +1 -1
- package/dist/{any-language-editor-DDubl8YH.js → any-language-editor-VWs_7v27.js} +5 -5
- package/dist/assets/__vite-browser-external-CAdMKBac.js +1 -0
- package/dist/assets/worker-CpBbwbQo.js +73 -0
- package/dist/{button-CA5pI2YF.js → button-Dj4BTre0.js} +5 -0
- package/dist/{capabilities-6laDasij.js → capabilities-C9rrYCzf.js} +1 -1
- package/dist/{chat-ui-BmWZZ3mE.js → chat-ui-D3XBept8.js} +625 -233
- package/dist/{check-CFM2mVDr.js → check-BcUIXnUT.js} +1 -1
- package/dist/{code-visibility-CRHzv49w.js → code-visibility-sKGUbHmr.js} +11480 -1992
- package/dist/{copy-TGGAUEWp.js → copy-DLf4aN7I.js} +2 -2
- package/dist/{dist-ESg7xyoD.js → dist-D3ZI9nhS.js} +2 -2
- package/dist/{error-banner-DnBPzEWg.js → error-banner-CVkfBUT3.js} +2 -2
- package/dist/{esm-Dd1z1auZ.js → esm-CWp0KQeK.js} +1 -1
- package/dist/{extends-CzJgxo2J.js → extends-vAi97cpa.js} +4 -4
- package/dist/{formats-CgaK7Gmx.js → formats-Dsy9kkZu.js} +3 -3
- package/dist/{glide-data-editor-B-3A3G02.js → glide-data-editor-DucgdjRo.js} +9 -9
- package/dist/{html-to-image-BwZL1Pkk.js → html-to-image-CpggM7u1.js} +2667 -2408
- package/dist/{input-BAOe64zx.js → input-D4kjoQUB.js} +8 -6
- package/dist/{label-BCWi-Oqu.js → label-BLqV33b1.js} +2 -2
- package/dist/{loader-BvW0-YWZ.js → loader-Dr8Qem8p.js} +1 -1
- package/dist/main.js +1697 -10282
- package/dist/{mermaid-cXSZ1pfD.js → mermaid-DO-Daq7u.js} +5 -5
- package/dist/{process-output-lpVrk7d5.js → process-output-X8TR20AK.js} +3 -3
- package/dist/reveal-component-BBAxPTso.js +7447 -0
- package/dist/{spec-DSIuqd3f.js → spec-hVaaZsY5.js} +4 -4
- package/dist/{strings-B_FOH6eV.js → strings-BiIhGaI8.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/{swiper-component-BHs0PWwp.js → swiper-component-DlD2GU2g.js} +2 -2
- package/dist/{toDate-CHtl9vts.js → toDate-CIpC_34u.js} +33 -20
- package/dist/{tooltip-B0mtKTXm.js → tooltip-DRaMBu06.js} +3 -3
- package/dist/{types-DBtDeUKD.js → types-Dzuoc3LN.js} +1 -1
- package/dist/{useAsyncData-B6hCGywC.js → useAsyncData-C56Khv_R.js} +1 -1
- package/dist/{useDateFormatter-B3mCQMP3.js → useDateFormatter-B_9k85Ex.js} +2 -2
- package/dist/{useDeepCompareMemoize-CmwDuYUH.js → useDeepCompareMemoize-Dt98v2ua.js} +1 -1
- package/dist/{useIframeCapabilities-DbdLoEDm.js → useIframeCapabilities-BkYHTrss.js} +1 -1
- package/dist/{useLifecycle-CjMjllqy.js → useLifecycle-BF6-z62y.js} +3 -3
- package/dist/{useTheme-CByZUW0p.js → useTheme-DykuNHR2.js} +2 -2
- package/dist/{vega-component-C2BYPkfd.js → vega-component-cSdqoAxe.js} +10 -10
- package/dist/{zod-BxdsqRPd.js → zod-BWkcDORu.js} +1 -1
- package/package.json +3 -3
- package/src/components/chat/chat-components.tsx +47 -0
- package/src/components/chat/chat-display.tsx +41 -7
- package/src/components/chat/chat-panel.tsx +37 -10
- package/src/components/chat/chat-utils.ts +42 -20
- package/src/components/chat/reasoning-accordion.tsx +14 -3
- package/src/components/chat/tool-call/shared.ts +13 -0
- package/src/components/chat/tool-call/tool-approval-card.tsx +62 -0
- package/src/components/chat/tool-call/tool-args.tsx +26 -0
- package/src/components/chat/tool-call/tool-call-view.tsx +99 -0
- package/src/components/chat/tool-call/tool-error-card.tsx +81 -0
- package/src/components/chat/tool-call/tool-history-row.tsx +153 -0
- package/src/components/chat/tool-call/tool-result.tsx +101 -0
- package/src/components/data-table/__tests__/column-header.test.ts +3 -1
- package/src/components/data-table/__tests__/column-header.test.tsx +308 -0
- package/src/components/data-table/__tests__/filter-by-values-picker.test.tsx +112 -0
- package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +261 -0
- package/src/components/data-table/__tests__/filters.test.ts +196 -49
- package/src/components/data-table/charts/components/form-fields.tsx +1 -0
- package/src/components/data-table/column-header.tsx +349 -170
- package/src/components/data-table/date-filter-inputs.tsx +325 -0
- package/src/components/data-table/filter-by-values-picker.tsx +70 -9
- package/src/components/data-table/filter-pill-editor.tsx +410 -156
- package/src/components/data-table/filter-pills.tsx +69 -54
- package/src/components/data-table/filters.ts +218 -101
- package/src/components/data-table/header-items.tsx +8 -1
- package/src/components/data-table/operator-labels.ts +25 -0
- package/src/components/data-table/regex-input.tsx +61 -0
- package/src/components/dependency-graph/minimap-content.tsx +14 -3
- package/src/components/editor/actions/pair-with-agent-modal.tsx +140 -49
- package/src/components/editor/actions/useNotebookActions.tsx +3 -1
- package/src/components/editor/app-container.tsx +7 -1
- package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +10 -2
- package/src/components/editor/chrome/wrapper/app-chrome.tsx +1 -0
- package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
- package/src/components/editor/chrome/wrapper/footer.tsx +4 -1
- package/src/components/editor/chrome/wrapper/panels.tsx +4 -1
- package/src/components/editor/chrome/wrapper/sidebar.tsx +4 -1
- package/src/components/editor/controls/Controls.tsx +11 -3
- package/src/components/editor/file-tree/file-explorer.tsx +12 -2
- package/src/components/editor/header/__tests__/status.test.tsx +108 -0
- package/src/components/editor/header/status.tsx +44 -10
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +106 -0
- package/src/components/editor/navigation/__tests__/navigation.test.ts +70 -0
- package/src/components/editor/navigation/clipboard.ts +99 -25
- package/src/components/editor/navigation/navigation.ts +15 -1
- package/src/components/editor/notebook-cell.tsx +5 -0
- package/src/components/editor/output/console/ConsoleOutput.tsx +23 -5
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +114 -0
- package/src/components/editor/renderers/slides-layout/__tests__/compute-slide-cells.test.ts +5 -4
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +55 -15
- package/src/components/editor/renderers/slides-layout/plugin.tsx +8 -25
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +19 -6
- package/src/components/editor/renderers/slides-layout/types.ts +40 -31
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -0
- package/src/components/home/components.tsx +6 -0
- package/src/components/pages/run-page.tsx +4 -1
- package/src/components/scratchpad/scratchpad.tsx +1 -0
- package/src/components/slides/__tests__/slide-notes.test.ts +131 -0
- package/src/components/slides/reveal-component.tsx +252 -147
- package/src/components/slides/slide-notes-editor.tsx +127 -0
- package/src/components/slides/slide-notes.ts +64 -0
- package/src/components/slides/slides.css +14 -0
- package/src/components/ui/combobox.tsx +24 -5
- package/src/components/ui/number-field.tsx +2 -0
- package/src/core/ai/tools/__tests__/registry.test.ts +10 -12
- package/src/core/ai/tools/registry.ts +9 -5
- package/src/core/cells/__tests__/cells.test.ts +187 -0
- package/src/core/cells/__tests__/pending-cut-service.test.tsx +123 -0
- package/src/core/cells/cells.ts +102 -17
- package/src/core/cells/document-changes.ts +6 -1
- package/src/core/cells/pending-cut-service.ts +55 -0
- package/src/core/cells/utils.ts +11 -0
- package/src/core/codemirror/cells/extensions.ts +10 -0
- package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +152 -0
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +99 -0
- package/src/core/codemirror/go-to-definition/commands.ts +382 -22
- package/src/core/codemirror/go-to-definition/utils.ts +23 -5
- package/src/core/edit-app.tsx +3 -2
- package/src/core/hotkeys/hotkeys.ts +5 -0
- package/src/core/islands/worker/worker.tsx +3 -2
- package/src/core/run-app.tsx +2 -1
- package/src/core/runtime/__tests__/runtime.test.ts +38 -17
- package/src/core/runtime/runtime.ts +57 -34
- package/src/core/wasm/__tests__/utils.test.ts +34 -0
- package/src/core/wasm/utils.ts +14 -0
- package/src/core/wasm/worker/bootstrap.ts +3 -2
- package/src/core/wasm/worker/worker.ts +3 -2
- package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +156 -0
- package/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts +101 -0
- package/src/core/websocket/transports/__tests__/ws.test.ts +125 -0
- package/src/core/websocket/transports/basic.ts +1 -1
- package/src/core/websocket/transports/ws.ts +96 -0
- package/src/core/websocket/useMarimoKernelConnection.tsx +133 -54
- package/src/core/websocket/useWebSocket.tsx +3 -15
- package/src/css/app/Cell.css +10 -0
- package/src/plugins/core/__test__/sanitize.test.ts +30 -0
- package/src/plugins/impl/DropdownPlugin.tsx +12 -1
- package/src/plugins/impl/MultiselectPlugin.tsx +4 -0
- package/src/plugins/impl/SearchableSelect.tsx +11 -1
- package/src/plugins/impl/TabsPlugin.tsx +35 -7
- package/src/plugins/impl/__tests__/DropdownPlugin.test.tsx +56 -0
- package/src/plugins/impl/__tests__/TabsPlugin.test.tsx +154 -0
- package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +48 -36
- package/src/plugins/impl/data-frames/schema.ts +4 -1
- package/src/plugins/layout/DownloadPlugin.tsx +9 -7
- package/src/utils/__tests__/id-tree.test.ts +71 -0
- package/src/utils/download.ts +4 -2
- package/src/utils/id-tree.tsx +89 -0
- package/dist/assets/__vite-browser-external-rrUYDKRl.js +0 -1
- package/dist/assets/worker-Bfy15ViQ.js +0 -73
- package/dist/reveal-component-C97Ceb7e.js +0 -4863
- package/src/components/chat/tool-call-accordion.tsx +0 -247
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
TabsList,
|
|
8
8
|
TabsTrigger,
|
|
9
9
|
} from "../../components/ui/tabs";
|
|
10
|
+
import { cn } from "../../utils/cn";
|
|
10
11
|
import { renderHTML } from "../core/RenderHTML";
|
|
11
12
|
import type { IPlugin, IPluginProps } from "../types";
|
|
12
13
|
import { Labeled } from "./common/labeled";
|
|
@@ -17,6 +18,7 @@ interface Data {
|
|
|
17
18
|
*/
|
|
18
19
|
tabs: string[];
|
|
19
20
|
label: string | null;
|
|
21
|
+
orientation: "horizontal" | "vertical";
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
// Selected tab index
|
|
@@ -28,6 +30,7 @@ export class TabsPlugin implements IPlugin<T, Data> {
|
|
|
28
30
|
validator = z.object({
|
|
29
31
|
tabs: z.array(z.string()),
|
|
30
32
|
label: z.string().nullable(),
|
|
33
|
+
orientation: z.enum(["horizontal", "vertical"]).default("horizontal"),
|
|
31
34
|
});
|
|
32
35
|
|
|
33
36
|
render(props: IPluginProps<T, Data>): JSX.Element {
|
|
@@ -51,6 +54,7 @@ interface TabComponentProps extends Data {
|
|
|
51
54
|
const TabComponent = ({
|
|
52
55
|
tabs,
|
|
53
56
|
label,
|
|
57
|
+
orientation,
|
|
54
58
|
value,
|
|
55
59
|
setValue,
|
|
56
60
|
children,
|
|
@@ -70,19 +74,43 @@ const TabComponent = ({
|
|
|
70
74
|
setInternalValue(value);
|
|
71
75
|
}
|
|
72
76
|
|
|
77
|
+
const isVertical = orientation === "vertical";
|
|
78
|
+
const childArray =
|
|
79
|
+
children == null ? [] : Array.isArray(children) ? children : [children];
|
|
80
|
+
|
|
73
81
|
return (
|
|
74
|
-
<Labeled label={label} align="top">
|
|
75
|
-
<Tabs
|
|
76
|
-
|
|
82
|
+
<Labeled label={label} align="top" fullWidth={true}>
|
|
83
|
+
<Tabs
|
|
84
|
+
value={internalValue}
|
|
85
|
+
onValueChange={handleChange}
|
|
86
|
+
orientation={orientation}
|
|
87
|
+
className={cn(isVertical && "flex flex-row gap-3")}
|
|
88
|
+
>
|
|
89
|
+
<TabsList
|
|
90
|
+
className={cn(
|
|
91
|
+
"scrollbar-thin",
|
|
92
|
+
isVertical
|
|
93
|
+
? "flex flex-col items-stretch justify-start h-auto max-h-none shrink-0 min-w-[10rem] overflow-y-auto"
|
|
94
|
+
: "max-w-full overflow-x-auto justify-start",
|
|
95
|
+
)}
|
|
96
|
+
>
|
|
77
97
|
{tabs.map((tab, index) => (
|
|
78
|
-
<TabsTrigger
|
|
98
|
+
<TabsTrigger
|
|
99
|
+
key={index}
|
|
100
|
+
value={index.toString()}
|
|
101
|
+
className={cn(isVertical && "w-full justify-start")}
|
|
102
|
+
>
|
|
79
103
|
{renderHTML({ html: tab })}
|
|
80
104
|
</TabsTrigger>
|
|
81
105
|
))}
|
|
82
106
|
</TabsList>
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
107
|
+
<div className={cn(isVertical && "flex-1 min-w-0")}>
|
|
108
|
+
{childArray.map((child, index) => (
|
|
109
|
+
<TabsContent key={index} value={index.toString()}>
|
|
110
|
+
{child}
|
|
111
|
+
</TabsContent>
|
|
112
|
+
))}
|
|
113
|
+
</div>
|
|
86
114
|
</Tabs>
|
|
87
115
|
</Labeled>
|
|
88
116
|
);
|
|
@@ -36,6 +36,7 @@ describe("DropdownPlugin", () => {
|
|
|
36
36
|
fullWidth: false,
|
|
37
37
|
searchable: true,
|
|
38
38
|
initialValue: [],
|
|
39
|
+
disabled: false,
|
|
39
40
|
},
|
|
40
41
|
value: [],
|
|
41
42
|
setValue: vi.fn(),
|
|
@@ -48,6 +49,58 @@ describe("DropdownPlugin", () => {
|
|
|
48
49
|
).toBeInTheDocument();
|
|
49
50
|
});
|
|
50
51
|
|
|
52
|
+
it("renders disabled native select when disabled is true", () => {
|
|
53
|
+
const plugin = new DropdownPlugin();
|
|
54
|
+
const host = document.createElement("div");
|
|
55
|
+
const props: IPluginProps<
|
|
56
|
+
string[],
|
|
57
|
+
z.infer<(typeof plugin)["validator"]>
|
|
58
|
+
> = {
|
|
59
|
+
data: {
|
|
60
|
+
label: "Test Label",
|
|
61
|
+
options: ["Option 1", "Option 2"],
|
|
62
|
+
allowSelectNone: false,
|
|
63
|
+
fullWidth: false,
|
|
64
|
+
searchable: false,
|
|
65
|
+
disabled: true,
|
|
66
|
+
initialValue: [],
|
|
67
|
+
},
|
|
68
|
+
value: [],
|
|
69
|
+
setValue: vi.fn(),
|
|
70
|
+
host,
|
|
71
|
+
functions: {},
|
|
72
|
+
};
|
|
73
|
+
render(plugin.render(props));
|
|
74
|
+
expect(screen.getByTestId("marimo-plugin-dropdown")).toBeDisabled();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("renders disabled searchable combobox with aria-disabled", () => {
|
|
78
|
+
const plugin = new DropdownPlugin();
|
|
79
|
+
const host = document.createElement("div");
|
|
80
|
+
const props: IPluginProps<
|
|
81
|
+
string[],
|
|
82
|
+
z.infer<(typeof plugin)["validator"]>
|
|
83
|
+
> = {
|
|
84
|
+
data: {
|
|
85
|
+
label: "Test Label",
|
|
86
|
+
options: ["Option 1", "Option 2"],
|
|
87
|
+
allowSelectNone: false,
|
|
88
|
+
fullWidth: false,
|
|
89
|
+
searchable: true,
|
|
90
|
+
disabled: true,
|
|
91
|
+
initialValue: [],
|
|
92
|
+
},
|
|
93
|
+
value: [],
|
|
94
|
+
setValue: vi.fn(),
|
|
95
|
+
host,
|
|
96
|
+
functions: {},
|
|
97
|
+
};
|
|
98
|
+
render(plugin.render(props));
|
|
99
|
+
const trigger = screen.getByTestId("marimo-plugin-searchable-dropdown")
|
|
100
|
+
.firstChild as HTMLElement;
|
|
101
|
+
expect(trigger).toHaveAttribute("aria-disabled", "true");
|
|
102
|
+
});
|
|
103
|
+
|
|
51
104
|
it("renders default dropdown when searchable is false", () => {
|
|
52
105
|
const plugin = new DropdownPlugin();
|
|
53
106
|
const host = document.createElement("div");
|
|
@@ -62,6 +115,7 @@ describe("DropdownPlugin", () => {
|
|
|
62
115
|
fullWidth: false,
|
|
63
116
|
searchable: false,
|
|
64
117
|
initialValue: [],
|
|
118
|
+
disabled: false,
|
|
65
119
|
},
|
|
66
120
|
value: [],
|
|
67
121
|
setValue: vi.fn(),
|
|
@@ -87,6 +141,7 @@ describe("DropdownPlugin", () => {
|
|
|
87
141
|
fullWidth: false,
|
|
88
142
|
searchable: true,
|
|
89
143
|
initialValue: [],
|
|
144
|
+
disabled: false,
|
|
90
145
|
},
|
|
91
146
|
value: [],
|
|
92
147
|
setValue,
|
|
@@ -129,6 +184,7 @@ describe("DropdownPlugin", () => {
|
|
|
129
184
|
fullWidth: false,
|
|
130
185
|
searchable: true,
|
|
131
186
|
initialValue: [],
|
|
187
|
+
disabled: false,
|
|
132
188
|
},
|
|
133
189
|
value: ["Apple"],
|
|
134
190
|
setValue,
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
4
|
+
import { beforeAll, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
import { initialModeAtom } from "@/core/mode";
|
|
7
|
+
import { store } from "@/core/state/jotai";
|
|
8
|
+
import type { IPluginProps } from "../../types";
|
|
9
|
+
import { TabsPlugin } from "../TabsPlugin";
|
|
10
|
+
|
|
11
|
+
describe("TabsPlugin", () => {
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
store.set(initialModeAtom, "edit");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const renderPlugin = (
|
|
17
|
+
data: z.input<TabsPlugin["validator"]>,
|
|
18
|
+
initialValue = "0",
|
|
19
|
+
) => {
|
|
20
|
+
const plugin = new TabsPlugin();
|
|
21
|
+
const host = document.createElement("div");
|
|
22
|
+
const setValue = vi.fn();
|
|
23
|
+
const children = [
|
|
24
|
+
<span key="0">Content 0</span>,
|
|
25
|
+
<span key="1">Content 1</span>,
|
|
26
|
+
<span key="2">Content 2</span>,
|
|
27
|
+
];
|
|
28
|
+
const makeProps = (
|
|
29
|
+
value: string,
|
|
30
|
+
): IPluginProps<string, z.infer<TabsPlugin["validator"]>> => ({
|
|
31
|
+
data: plugin.validator.parse(data),
|
|
32
|
+
value,
|
|
33
|
+
setValue,
|
|
34
|
+
host,
|
|
35
|
+
functions: {},
|
|
36
|
+
children,
|
|
37
|
+
});
|
|
38
|
+
const result = render(plugin.render(makeProps(initialValue)));
|
|
39
|
+
return {
|
|
40
|
+
...result,
|
|
41
|
+
setValue,
|
|
42
|
+
rerenderWithValue: (newValue: string) =>
|
|
43
|
+
result.rerender(plugin.render(makeProps(newValue))),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
it("renders all tab triggers", () => {
|
|
48
|
+
renderPlugin({
|
|
49
|
+
tabs: ["First", "Second", "Third"],
|
|
50
|
+
label: null,
|
|
51
|
+
});
|
|
52
|
+
expect(screen.getByRole("tab", { name: "First" })).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByRole("tab", { name: "Second" })).toBeInTheDocument();
|
|
54
|
+
expect(screen.getByRole("tab", { name: "Third" })).toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("supports vertical orientation", () => {
|
|
58
|
+
renderPlugin({
|
|
59
|
+
tabs: ["First", "Second"],
|
|
60
|
+
label: null,
|
|
61
|
+
orientation: "vertical",
|
|
62
|
+
});
|
|
63
|
+
const tablist = screen.getByRole("tablist");
|
|
64
|
+
expect(tablist).toHaveAttribute("data-orientation", "vertical");
|
|
65
|
+
expect(tablist.className).toMatch(/flex-col/);
|
|
66
|
+
// Horizontal scroll classes should not be applied in vertical mode.
|
|
67
|
+
expect(tablist.className).not.toMatch(/overflow-x-auto/);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("falls back to horizontal when orientation is omitted (back-compat)", () => {
|
|
71
|
+
// Older Python kernels won't send `orientation` — make sure the validator
|
|
72
|
+
// defaults it so the frontend keeps working.
|
|
73
|
+
const plugin = new TabsPlugin();
|
|
74
|
+
const parsed = plugin.validator.parse({
|
|
75
|
+
tabs: ["First"],
|
|
76
|
+
label: null,
|
|
77
|
+
});
|
|
78
|
+
expect(parsed.orientation).toBe("horizontal");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("selects the tab matching the initial value", () => {
|
|
82
|
+
renderPlugin({ tabs: ["First", "Second", "Third"], label: null }, "1");
|
|
83
|
+
const tabs = screen.getAllByRole("tab");
|
|
84
|
+
expect(tabs[0]).toHaveAttribute("data-state", "inactive");
|
|
85
|
+
expect(tabs[1]).toHaveAttribute("data-state", "active");
|
|
86
|
+
expect(tabs[2]).toHaveAttribute("data-state", "inactive");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("defaults to the first tab when value is empty", () => {
|
|
90
|
+
renderPlugin({ tabs: ["First", "Second"], label: null }, "");
|
|
91
|
+
const tabs = screen.getAllByRole("tab");
|
|
92
|
+
expect(tabs[0]).toHaveAttribute("data-state", "active");
|
|
93
|
+
expect(tabs[1]).toHaveAttribute("data-state", "inactive");
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("calls setValue with the clicked tab's index", () => {
|
|
97
|
+
const { setValue } = renderPlugin({
|
|
98
|
+
tabs: ["First", "Second", "Third"],
|
|
99
|
+
label: null,
|
|
100
|
+
});
|
|
101
|
+
// Radix Tabs' trigger reacts to mousedown (left button), not click —
|
|
102
|
+
// see https://github.com/radix-ui/primitives/blob/main/packages/react/tabs/src/Tabs.tsx
|
|
103
|
+
fireEvent.mouseDown(screen.getByRole("tab", { name: "Third" }), {
|
|
104
|
+
button: 0,
|
|
105
|
+
});
|
|
106
|
+
expect(setValue).toHaveBeenCalledWith("2");
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("syncs selection when value is updated externally", () => {
|
|
110
|
+
const { rerenderWithValue } = renderPlugin(
|
|
111
|
+
{ tabs: ["First", "Second", "Third"], label: null },
|
|
112
|
+
"0",
|
|
113
|
+
);
|
|
114
|
+
expect(screen.getAllByRole("tab")[0]).toHaveAttribute(
|
|
115
|
+
"data-state",
|
|
116
|
+
"active",
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
rerenderWithValue("2");
|
|
120
|
+
const tabs = screen.getAllByRole("tab");
|
|
121
|
+
expect(tabs[0]).toHaveAttribute("data-state", "inactive");
|
|
122
|
+
expect(tabs[2]).toHaveAttribute("data-state", "active");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("renders HTML in tab labels via renderHTML", () => {
|
|
126
|
+
renderPlugin({
|
|
127
|
+
tabs: ["<strong>Bold</strong>", "Plain"],
|
|
128
|
+
label: null,
|
|
129
|
+
});
|
|
130
|
+
const boldTab = screen.getByRole("tab", { name: "Bold" });
|
|
131
|
+
// The label markup is preserved (not escaped as text), so the trigger
|
|
132
|
+
// contains a real <strong> element.
|
|
133
|
+
expect(boldTab.querySelector("strong")).not.toBeNull();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("renders no tabpanels when tabs and children are empty", () => {
|
|
137
|
+
// When the Python side passes `tabs={}`, slotted HTML is empty and the
|
|
138
|
+
// resulting React children are null/undefined. We should render zero
|
|
139
|
+
// `TabsContent`s — not a stray one paired to a non-existent trigger.
|
|
140
|
+
const plugin = new TabsPlugin();
|
|
141
|
+
const host = document.createElement("div");
|
|
142
|
+
const props: IPluginProps<string, z.infer<TabsPlugin["validator"]>> = {
|
|
143
|
+
data: plugin.validator.parse({ tabs: [], label: null }),
|
|
144
|
+
value: "",
|
|
145
|
+
setValue: vi.fn(),
|
|
146
|
+
host,
|
|
147
|
+
functions: {},
|
|
148
|
+
children: null,
|
|
149
|
+
};
|
|
150
|
+
render(plugin.render(props));
|
|
151
|
+
expect(screen.queryAllByRole("tab")).toHaveLength(0);
|
|
152
|
+
expect(screen.queryAllByRole("tabpanel")).toHaveLength(0);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -27,11 +27,12 @@ exports[`renderZodSchema > should render a form aggregate 1`] = `
|
|
|
27
27
|
aria-invalid="false"
|
|
28
28
|
class="relative"
|
|
29
29
|
>
|
|
30
|
-
<
|
|
30
|
+
<button
|
|
31
31
|
aria-controls="radix-_r_27_"
|
|
32
|
+
aria-disabled="false"
|
|
32
33
|
aria-expanded="false"
|
|
33
34
|
aria-haspopup="dialog"
|
|
34
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
35
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
35
36
|
data-state="closed"
|
|
36
37
|
id="_r_26_-form-item"
|
|
37
38
|
type="button"
|
|
@@ -58,7 +59,7 @@ exports[`renderZodSchema > should render a form aggregate 1`] = `
|
|
|
58
59
|
d="m6 9 6 6 6-6"
|
|
59
60
|
/>
|
|
60
61
|
</svg>
|
|
61
|
-
</
|
|
62
|
+
</button>
|
|
62
63
|
<div
|
|
63
64
|
class="flex flex-col gap-1 items-start"
|
|
64
65
|
/>
|
|
@@ -82,11 +83,12 @@ exports[`renderZodSchema > should render a form aggregate 1`] = `
|
|
|
82
83
|
aria-invalid="false"
|
|
83
84
|
class="relative"
|
|
84
85
|
>
|
|
85
|
-
<
|
|
86
|
+
<button
|
|
86
87
|
aria-controls="radix-_r_29_"
|
|
88
|
+
aria-disabled="false"
|
|
87
89
|
aria-expanded="false"
|
|
88
90
|
aria-haspopup="dialog"
|
|
89
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
91
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
90
92
|
data-state="closed"
|
|
91
93
|
id="_r_28_-form-item"
|
|
92
94
|
type="button"
|
|
@@ -113,7 +115,7 @@ exports[`renderZodSchema > should render a form aggregate 1`] = `
|
|
|
113
115
|
d="m6 9 6 6 6-6"
|
|
114
116
|
/>
|
|
115
117
|
</svg>
|
|
116
|
-
</
|
|
118
|
+
</button>
|
|
117
119
|
<div
|
|
118
120
|
class="flex flex-col gap-1 items-start"
|
|
119
121
|
/>
|
|
@@ -399,11 +401,12 @@ exports[`renderZodSchema > should render a form explode_columns 1`] = `
|
|
|
399
401
|
aria-invalid="false"
|
|
400
402
|
class="relative"
|
|
401
403
|
>
|
|
402
|
-
<
|
|
404
|
+
<button
|
|
403
405
|
aria-controls="radix-_r_2p_"
|
|
406
|
+
aria-disabled="false"
|
|
404
407
|
aria-expanded="false"
|
|
405
408
|
aria-haspopup="dialog"
|
|
406
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
409
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
407
410
|
data-state="closed"
|
|
408
411
|
id="_r_2o_-form-item"
|
|
409
412
|
type="button"
|
|
@@ -430,7 +433,7 @@ exports[`renderZodSchema > should render a form explode_columns 1`] = `
|
|
|
430
433
|
d="m6 9 6 6 6-6"
|
|
431
434
|
/>
|
|
432
435
|
</svg>
|
|
433
|
-
</
|
|
436
|
+
</button>
|
|
434
437
|
<div
|
|
435
438
|
class="flex flex-col gap-1 items-start"
|
|
436
439
|
/>
|
|
@@ -596,11 +599,12 @@ exports[`renderZodSchema > should render a form group_by 1`] = `
|
|
|
596
599
|
aria-invalid="false"
|
|
597
600
|
class="relative"
|
|
598
601
|
>
|
|
599
|
-
<
|
|
602
|
+
<button
|
|
600
603
|
aria-controls="radix-_r_1p_"
|
|
604
|
+
aria-disabled="false"
|
|
601
605
|
aria-expanded="false"
|
|
602
606
|
aria-haspopup="dialog"
|
|
603
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
607
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
604
608
|
data-state="closed"
|
|
605
609
|
id="_r_1o_-form-item"
|
|
606
610
|
type="button"
|
|
@@ -627,7 +631,7 @@ exports[`renderZodSchema > should render a form group_by 1`] = `
|
|
|
627
631
|
d="m6 9 6 6 6-6"
|
|
628
632
|
/>
|
|
629
633
|
</svg>
|
|
630
|
-
</
|
|
634
|
+
</button>
|
|
631
635
|
<div
|
|
632
636
|
class="flex flex-col gap-1 items-start"
|
|
633
637
|
/>
|
|
@@ -651,11 +655,12 @@ exports[`renderZodSchema > should render a form group_by 1`] = `
|
|
|
651
655
|
aria-invalid="false"
|
|
652
656
|
class="relative"
|
|
653
657
|
>
|
|
654
|
-
<
|
|
658
|
+
<button
|
|
655
659
|
aria-controls="radix-_r_1r_"
|
|
660
|
+
aria-disabled="false"
|
|
656
661
|
aria-expanded="false"
|
|
657
662
|
aria-haspopup="dialog"
|
|
658
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
663
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
659
664
|
data-state="closed"
|
|
660
665
|
id="_r_1q_-form-item"
|
|
661
666
|
type="button"
|
|
@@ -682,7 +687,7 @@ exports[`renderZodSchema > should render a form group_by 1`] = `
|
|
|
682
687
|
d="m6 9 6 6 6-6"
|
|
683
688
|
/>
|
|
684
689
|
</svg>
|
|
685
|
-
</
|
|
690
|
+
</button>
|
|
686
691
|
<div
|
|
687
692
|
class="flex flex-col gap-1 items-start"
|
|
688
693
|
/>
|
|
@@ -798,11 +803,12 @@ exports[`renderZodSchema > should render a form pivot 1`] = `
|
|
|
798
803
|
aria-invalid="false"
|
|
799
804
|
class="relative"
|
|
800
805
|
>
|
|
801
|
-
<
|
|
806
|
+
<button
|
|
802
807
|
aria-controls="radix-_r_3b_"
|
|
808
|
+
aria-disabled="false"
|
|
803
809
|
aria-expanded="false"
|
|
804
810
|
aria-haspopup="dialog"
|
|
805
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
811
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
806
812
|
data-state="closed"
|
|
807
813
|
id="_r_3a_-form-item"
|
|
808
814
|
type="button"
|
|
@@ -829,7 +835,7 @@ exports[`renderZodSchema > should render a form pivot 1`] = `
|
|
|
829
835
|
d="m6 9 6 6 6-6"
|
|
830
836
|
/>
|
|
831
837
|
</svg>
|
|
832
|
-
</
|
|
838
|
+
</button>
|
|
833
839
|
<div
|
|
834
840
|
class="flex flex-col gap-1 items-start"
|
|
835
841
|
/>
|
|
@@ -853,11 +859,12 @@ exports[`renderZodSchema > should render a form pivot 1`] = `
|
|
|
853
859
|
aria-invalid="false"
|
|
854
860
|
class="relative"
|
|
855
861
|
>
|
|
856
|
-
<
|
|
862
|
+
<button
|
|
857
863
|
aria-controls="radix-_r_3d_"
|
|
864
|
+
aria-disabled="false"
|
|
858
865
|
aria-expanded="false"
|
|
859
866
|
aria-haspopup="dialog"
|
|
860
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
867
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
861
868
|
data-state="closed"
|
|
862
869
|
id="_r_3c_-form-item"
|
|
863
870
|
type="button"
|
|
@@ -884,7 +891,7 @@ exports[`renderZodSchema > should render a form pivot 1`] = `
|
|
|
884
891
|
d="m6 9 6 6 6-6"
|
|
885
892
|
/>
|
|
886
893
|
</svg>
|
|
887
|
-
</
|
|
894
|
+
</button>
|
|
888
895
|
<div
|
|
889
896
|
class="flex flex-col gap-1 items-start"
|
|
890
897
|
/>
|
|
@@ -908,11 +915,12 @@ exports[`renderZodSchema > should render a form pivot 1`] = `
|
|
|
908
915
|
aria-invalid="false"
|
|
909
916
|
class="relative"
|
|
910
917
|
>
|
|
911
|
-
<
|
|
918
|
+
<button
|
|
912
919
|
aria-controls="radix-_r_3f_"
|
|
920
|
+
aria-disabled="false"
|
|
913
921
|
aria-expanded="false"
|
|
914
922
|
aria-haspopup="dialog"
|
|
915
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
923
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
916
924
|
data-state="closed"
|
|
917
925
|
id="_r_3e_-form-item"
|
|
918
926
|
type="button"
|
|
@@ -939,7 +947,7 @@ exports[`renderZodSchema > should render a form pivot 1`] = `
|
|
|
939
947
|
d="m6 9 6 6 6-6"
|
|
940
948
|
/>
|
|
941
949
|
</svg>
|
|
942
|
-
</
|
|
950
|
+
</button>
|
|
943
951
|
<div
|
|
944
952
|
class="flex flex-col gap-1 items-start"
|
|
945
953
|
/>
|
|
@@ -1298,11 +1306,12 @@ exports[`renderZodSchema > should render a form select_columns 1`] = `
|
|
|
1298
1306
|
aria-invalid="false"
|
|
1299
1307
|
class="relative"
|
|
1300
1308
|
>
|
|
1301
|
-
<
|
|
1309
|
+
<button
|
|
1302
1310
|
aria-controls="radix-_r_4_"
|
|
1311
|
+
aria-disabled="false"
|
|
1303
1312
|
aria-expanded="false"
|
|
1304
1313
|
aria-haspopup="dialog"
|
|
1305
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
1314
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
1306
1315
|
data-state="closed"
|
|
1307
1316
|
id="_r_3_-form-item"
|
|
1308
1317
|
type="button"
|
|
@@ -1329,7 +1338,7 @@ exports[`renderZodSchema > should render a form select_columns 1`] = `
|
|
|
1329
1338
|
d="m6 9 6 6 6-6"
|
|
1330
1339
|
/>
|
|
1331
1340
|
</svg>
|
|
1332
|
-
</
|
|
1341
|
+
</button>
|
|
1333
1342
|
<div
|
|
1334
1343
|
class="flex flex-col gap-1 items-start"
|
|
1335
1344
|
/>
|
|
@@ -1581,11 +1590,12 @@ exports[`renderZodSchema > should render a form unique 1`] = `
|
|
|
1581
1590
|
aria-invalid="false"
|
|
1582
1591
|
class="relative"
|
|
1583
1592
|
>
|
|
1584
|
-
<
|
|
1593
|
+
<button
|
|
1585
1594
|
aria-controls="radix-_r_32_"
|
|
1595
|
+
aria-disabled="false"
|
|
1586
1596
|
aria-expanded="false"
|
|
1587
1597
|
aria-haspopup="dialog"
|
|
1588
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
1598
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
1589
1599
|
data-state="closed"
|
|
1590
1600
|
id="_r_31_-form-item"
|
|
1591
1601
|
type="button"
|
|
@@ -1612,7 +1622,7 @@ exports[`renderZodSchema > should render a form unique 1`] = `
|
|
|
1612
1622
|
d="m6 9 6 6 6-6"
|
|
1613
1623
|
/>
|
|
1614
1624
|
</svg>
|
|
1615
|
-
</
|
|
1625
|
+
</button>
|
|
1616
1626
|
<div
|
|
1617
1627
|
class="flex flex-col gap-1 items-start"
|
|
1618
1628
|
/>
|
|
@@ -1740,11 +1750,12 @@ exports[`renders custom forms column_id_array 1`] = `
|
|
|
1740
1750
|
aria-invalid="false"
|
|
1741
1751
|
class="relative"
|
|
1742
1752
|
>
|
|
1743
|
-
<
|
|
1753
|
+
<button
|
|
1744
1754
|
aria-controls="radix-_r_41_"
|
|
1755
|
+
aria-disabled="false"
|
|
1745
1756
|
aria-expanded="false"
|
|
1746
1757
|
aria-haspopup="dialog"
|
|
1747
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
1758
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
1748
1759
|
data-state="closed"
|
|
1749
1760
|
id="_r_40_-form-item"
|
|
1750
1761
|
type="button"
|
|
@@ -1771,7 +1782,7 @@ exports[`renders custom forms column_id_array 1`] = `
|
|
|
1771
1782
|
d="m6 9 6 6 6-6"
|
|
1772
1783
|
/>
|
|
1773
1784
|
</svg>
|
|
1774
|
-
</
|
|
1785
|
+
</button>
|
|
1775
1786
|
<div
|
|
1776
1787
|
class="flex flex-col gap-1 items-start"
|
|
1777
1788
|
/>
|
|
@@ -1790,11 +1801,12 @@ exports[`renders custom forms column_id_dot_array 1`] = `
|
|
|
1790
1801
|
aria-invalid="false"
|
|
1791
1802
|
class="relative"
|
|
1792
1803
|
>
|
|
1793
|
-
<
|
|
1804
|
+
<button
|
|
1794
1805
|
aria-controls="radix-_r_43_"
|
|
1806
|
+
aria-disabled="false"
|
|
1795
1807
|
aria-expanded="false"
|
|
1796
1808
|
aria-haspopup="dialog"
|
|
1797
|
-
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid
|
|
1809
|
+
class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"
|
|
1798
1810
|
data-state="closed"
|
|
1799
1811
|
id="_r_42_-form-item"
|
|
1800
1812
|
type="button"
|
|
@@ -1821,7 +1833,7 @@ exports[`renders custom forms column_id_dot_array 1`] = `
|
|
|
1821
1833
|
d="m6 9 6 6 6-6"
|
|
1822
1834
|
/>
|
|
1823
1835
|
</svg>
|
|
1824
|
-
</
|
|
1836
|
+
</button>
|
|
1825
1837
|
<div
|
|
1826
1838
|
class="flex flex-col gap-1 items-start"
|
|
1827
1839
|
/>
|
|
@@ -80,7 +80,10 @@ export const FilterConditionSchema = z
|
|
|
80
80
|
.enum(Object.keys(ALL_OPERATORS) as [OperatorType, ...OperatorType[]])
|
|
81
81
|
.describe(FieldOptions.of({ label: " " })),
|
|
82
82
|
type: z.literal("condition").default("condition"),
|
|
83
|
-
value: z
|
|
83
|
+
value: z
|
|
84
|
+
.any()
|
|
85
|
+
.optional()
|
|
86
|
+
.describe(FieldOptions.of({ label: "Value" })),
|
|
84
87
|
negate: z.boolean().default(false),
|
|
85
88
|
})
|
|
86
89
|
.describe(FieldOptions.of({ direction: "row", special: "column_filter" }));
|
|
@@ -80,22 +80,26 @@ const DownloadButton = ({
|
|
|
80
80
|
const [isLoading, setIsLoading] = useState(false);
|
|
81
81
|
|
|
82
82
|
const handleClick = async (e: React.MouseEvent) => {
|
|
83
|
-
if (
|
|
83
|
+
if (data.disabled) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
e.stopPropagation();
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
|
|
91
|
+
if (!data.lazy) {
|
|
92
|
+
downloadByURL(data.data, data.filename ?? undefined);
|
|
88
93
|
return;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
e.preventDefault();
|
|
92
96
|
setIsLoading(true);
|
|
93
97
|
|
|
94
98
|
try {
|
|
95
99
|
const loadedData = await load({});
|
|
96
100
|
downloadByURL(
|
|
97
101
|
loadedData.data,
|
|
98
|
-
loadedData.filename
|
|
102
|
+
loadedData.filename ?? data.filename ?? undefined,
|
|
99
103
|
);
|
|
100
104
|
} catch (error) {
|
|
101
105
|
toast({
|
|
@@ -114,9 +118,7 @@ const DownloadButton = ({
|
|
|
114
118
|
return (
|
|
115
119
|
<a
|
|
116
120
|
href={data.data}
|
|
117
|
-
download={data.filename
|
|
118
|
-
target="_blank"
|
|
119
|
-
rel="noopener noreferrer"
|
|
121
|
+
download={data.filename ?? ""}
|
|
120
122
|
onClick={handleClick}
|
|
121
123
|
className={buttonVariants({
|
|
122
124
|
variant: "secondary",
|