@marimo-team/islands 0.24.3-dev1 → 0.24.3-dev13
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-qIKbwYin.js → ConnectedDataExplorerComponent-C9OF_75w.js} +1 -1
- package/dist/{any-language-editor-CpTnK43-.js → any-language-editor-DmQ7dyCx.js} +1 -1
- package/dist/{chat-ui-DttQ-5Ut.js → chat-ui-CH7Gg-KH.js} +1300 -1300
- package/dist/{common-C7aHdgSC.js → common-DM9Wj-cL.js} +6484 -6276
- package/dist/{error-banner-WDhUzJyg.js → error-banner-CsXbEEjo.js} +160 -160
- package/dist/{formats-CJMVUfb3.js → formats-CslNOKy0.js} +1 -1
- package/dist/{html-to-image-BTYnN4ev.js → html-to-image-B3oyXfx7.js} +10 -9
- package/dist/main.js +257 -243
- package/dist/{mermaid-BsHdQeQf.js → mermaid-Bi23Ibnw.js} +1 -1
- package/dist/{process-output-CsALk6tp.js → process-output-ew3B35of.js} +2 -2
- package/dist/{reveal-component-DsDcTC8C.js → reveal-component-DjEi3rsH.js} +2 -2
- package/dist/{toDate-D-Rx3ux5.js → toDate-CpXBeDq0.js} +3 -2
- package/dist/{vega-component-D-IXRnlx.js → vega-component-ovBXgp91.js} +3 -3
- package/package.json +1 -1
- package/src/__mocks__/requests.ts +7 -2
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +2 -6
- package/src/components/data-table/column-visibility-dropdown.tsx +9 -3
- package/src/components/datasources/components.tsx +4 -2
- package/src/components/editor/chrome/components/feedback-button.tsx +10 -9
- package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +143 -0
- package/src/components/editor/chrome/panels/packages-panel.tsx +145 -51
- package/src/components/editor/code/__tests__/readonly-diff.test.tsx +65 -0
- package/src/components/editor/code/readonly-diff.tsx +1 -1
- package/src/components/editor/file-tree/__tests__/tree-actions.test.tsx +54 -0
- package/src/components/editor/file-tree/tree-actions.tsx +11 -14
- package/src/components/editor/package-alert.tsx +25 -1
- package/src/components/home/components.tsx +17 -0
- package/src/components/pages/gallery-page.tsx +2 -4
- package/src/components/pages/home-page.tsx +2 -4
- package/src/components/terminal/terminal.tsx +4 -4
- package/src/core/cells/pending-delete-service.ts +12 -16
- package/src/core/codemirror/language/__tests__/sql.test.ts +70 -2
- package/src/core/codemirror/language/languages/sql/sql.ts +16 -1
- package/src/core/datasets/__tests__/data-source.test.ts +2 -0
- package/src/core/datasets/data-source-connections.ts +15 -10
- package/src/core/islands/__tests__/parse.test.ts +140 -7
- package/src/core/islands/parse.ts +20 -0
- package/src/core/packages/__tests__/useInstallPackage.test.tsx +47 -1
- package/src/core/packages/toast-components.tsx +26 -0
- package/src/core/packages/useInstallPackage.ts +7 -2
- package/src/core/runtime/__tests__/runtime.test.ts +11 -0
- package/src/core/runtime/runtime.ts +7 -2
- package/src/core/wasm/bridge.ts +1 -0
- package/src/plugins/layout/AccordionPlugin.tsx +7 -2
- package/src/plugins/layout/__test__/AccordionPlugin.test.tsx +66 -0
|
@@ -23,6 +23,7 @@ interface Data {
|
|
|
23
23
|
* Whether to allow multiple tabs to be open.
|
|
24
24
|
*/
|
|
25
25
|
multiple: boolean;
|
|
26
|
+
expanded: string[];
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export class AccordionPlugin implements IStatelessPlugin<Data> {
|
|
@@ -31,6 +32,7 @@ export class AccordionPlugin implements IStatelessPlugin<Data> {
|
|
|
31
32
|
validator = z.object({
|
|
32
33
|
labels: z.array(z.string()),
|
|
33
34
|
multiple: z.boolean(),
|
|
35
|
+
expanded: z.array(z.string()).default([]),
|
|
34
36
|
});
|
|
35
37
|
|
|
36
38
|
render(props: IStatelessPluginProps<Data>): JSX.Element {
|
|
@@ -43,11 +45,14 @@ export class AccordionPlugin implements IStatelessPlugin<Data> {
|
|
|
43
45
|
const AccordionComponent = ({
|
|
44
46
|
labels,
|
|
45
47
|
multiple,
|
|
48
|
+
expanded,
|
|
46
49
|
children,
|
|
47
50
|
}: PropsWithChildren<Data>): JSX.Element => {
|
|
48
|
-
const
|
|
51
|
+
const expansionProps = multiple
|
|
52
|
+
? { type: "multiple" as const, defaultValue: expanded }
|
|
53
|
+
: { type: "single" as const, defaultValue: expanded[0], collapsible: true };
|
|
49
54
|
return (
|
|
50
|
-
<Accordion
|
|
55
|
+
<Accordion {...expansionProps} className="text-muted-foreground">
|
|
51
56
|
{React.Children.map(children, (child, index) => {
|
|
52
57
|
return (
|
|
53
58
|
<AccordionItem key={index} value={index.toString()}>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import { cleanup, fireEvent, render } from "@testing-library/react";
|
|
3
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
4
|
+
import { AccordionPlugin } from "../AccordionPlugin";
|
|
5
|
+
|
|
6
|
+
const plugin = new AccordionPlugin();
|
|
7
|
+
|
|
8
|
+
function renderAccordion(multiple: boolean, expanded?: string[]) {
|
|
9
|
+
return plugin.render({
|
|
10
|
+
host: document.createElement("marimo-accordion"),
|
|
11
|
+
data: plugin.validator.parse({
|
|
12
|
+
labels: ["Summary", "Details"],
|
|
13
|
+
multiple,
|
|
14
|
+
expanded,
|
|
15
|
+
}),
|
|
16
|
+
children: [
|
|
17
|
+
<p key="summary">Overview</p>,
|
|
18
|
+
<p key="details">More information</p>,
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe("AccordionPlugin", () => {
|
|
24
|
+
afterEach(cleanup);
|
|
25
|
+
|
|
26
|
+
it.each([
|
|
27
|
+
{ multiple: false, expanded: undefined, expected: ["false", "false"] },
|
|
28
|
+
{ multiple: true, expanded: [], expected: ["false", "false"] },
|
|
29
|
+
{ multiple: false, expanded: ["0"], expected: ["true", "false"] },
|
|
30
|
+
{ multiple: false, expanded: ["1"], expected: ["false", "true"] },
|
|
31
|
+
{ multiple: true, expanded: ["0", "1"], expected: ["true", "true"] },
|
|
32
|
+
])(
|
|
33
|
+
"sets initial expansion: $multiple, $expanded",
|
|
34
|
+
({ multiple, expanded, expected }) => {
|
|
35
|
+
const { getAllByRole } = render(renderAccordion(multiple, expanded));
|
|
36
|
+
expect(
|
|
37
|
+
getAllByRole("button").map((button) =>
|
|
38
|
+
button.getAttribute("aria-expanded"),
|
|
39
|
+
),
|
|
40
|
+
).toEqual(expected);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
it("lets users collapse and switch the initially expanded item", () => {
|
|
45
|
+
const { getAllByRole, rerender } = render(renderAccordion(false, ["1"]));
|
|
46
|
+
const [summary, details] = getAllByRole("button");
|
|
47
|
+
fireEvent.click(details);
|
|
48
|
+
expect(details.getAttribute("aria-expanded")).toBe("false");
|
|
49
|
+
rerender(renderAccordion(false, ["1"]));
|
|
50
|
+
expect(details.getAttribute("aria-expanded")).toBe("false");
|
|
51
|
+
fireEvent.click(details);
|
|
52
|
+
fireEvent.click(summary);
|
|
53
|
+
expect(
|
|
54
|
+
[summary, details].map((button) => button.getAttribute("aria-expanded")),
|
|
55
|
+
).toEqual(["true", "false"]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("lets users collapse items independently with multiple enabled", () => {
|
|
59
|
+
const { getAllByRole } = render(renderAccordion(true, ["0", "1"]));
|
|
60
|
+
const [summary, details] = getAllByRole("button");
|
|
61
|
+
fireEvent.click(summary);
|
|
62
|
+
expect(
|
|
63
|
+
[summary, details].map((button) => button.getAttribute("aria-expanded")),
|
|
64
|
+
).toEqual(["false", "true"]);
|
|
65
|
+
});
|
|
66
|
+
});
|