@marimo-team/frontend 0.23.7-dev46 → 0.23.7-dev48
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/assets/{ImperativeModal-p_OvS1Fh.js → ImperativeModal-DEC1mXgV.js} +1 -1
- package/dist/assets/JsonOutput-C3pFF2CF.js +49 -0
- package/dist/assets/{MarimoErrorOutput-_bWlyB_K.js → MarimoErrorOutput-C_s2Utqa.js} +1 -1
- package/dist/assets/{RSPContexts-9byLHdog.js → RSPContexts-Bk1r00gJ.js} +1 -1
- package/dist/assets/{RunButton-CAT9xF1d.js → RunButton-D1IZ1Yr0.js} +1 -1
- package/dist/assets/{add-cell-with-ai-B_HdhOqi.js → add-cell-with-ai-BMODIFpo.js} +1 -1
- package/dist/assets/{add-connection-dialog-DxYv5JcS.js → add-connection-dialog-CET54LB_.js} +1 -1
- package/dist/assets/{agent-panel-BQeq4a1l.js → agent-panel-CQ3d-_-Y.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CFayNoJy.js → ai-model-dropdown-CFx7zgXS.js} +1 -1
- package/dist/assets/{app-config-button-BLQ04fng.js → app-config-button-XMCeCwhm.js} +1 -1
- package/dist/assets/{cell-editor-CnOYqYdb.js → cell-editor-ChUXoGzT.js} +1 -1
- package/dist/assets/{cell-link-Cd3QVqpp.js → cell-link-DqucEHxF.js} +1 -1
- package/dist/assets/{chat-display-DA8j3LUV.js → chat-display-D3hLpbGd.js} +1 -1
- package/dist/assets/{chat-panel-qaOEsJX5.js → chat-panel-y8jUpvvS.js} +1 -1
- package/dist/assets/{chat-ui-DGSriyQN.js → chat-ui-B6oULfnR.js} +1 -1
- package/dist/assets/{column-preview-CxmRjYME.js → column-preview-yyJgA8qB.js} +1 -1
- package/dist/assets/{command-DNivw-AZ.js → command-2NPJCYDa.js} +1 -1
- package/dist/assets/{command-palette-ChVslCnt.js → command-palette-BAjB4vVz.js} +1 -1
- package/dist/assets/{common-lXvJw21V.js → common-Dfc8zq5C.js} +1 -1
- package/dist/assets/{dependency-graph-panel-DZK8NTNn.js → dependency-graph-panel-DIEzM3vx.js} +1 -1
- package/dist/assets/{edit-page-DDLpOq2V.js → edit-page-ChFE412c.js} +3 -3
- package/dist/assets/{error-panel-DiNPW8Np.js → error-panel-C1f6E7YQ.js} +1 -1
- package/dist/assets/{field-CZvDxEdk.js → field-CQGpbXj3.js} +1 -1
- package/dist/assets/{file-explorer-panel-BTmk5lFx.js → file-explorer-panel-DbRXYWME.js} +1 -1
- package/dist/assets/{file-name-input-CHGFbk0w.js → file-name-input-CQVbWhL8.js} +1 -1
- package/dist/assets/{form-BibtO8GQ.js → form-lU-npaWT.js} +1 -1
- package/dist/assets/{gallery-page-C6WBQyoY.js → gallery-page-MrZHjySE.js} +1 -1
- package/dist/assets/{glide-data-editor-CI-WXej-.js → glide-data-editor-4Wql6uq7.js} +1 -1
- package/dist/assets/{home-page-BhqXC2nL.js → home-page-vf_qM8OB.js} +1 -1
- package/dist/assets/{hooks-BldqpRr5.js → hooks-C-k2d7mq.js} +1 -1
- package/dist/assets/index-8ta9aYoc.css +2 -0
- package/dist/assets/{index-BVBNtJoy.js → index-C1NmJ636.js} +5 -5
- package/dist/assets/{input-D56cqSHz.js → input-CVE-gIjt.js} +1 -1
- package/dist/assets/{layout-DhDAND9b.js → layout-CRrGSugp.js} +3 -3
- package/dist/assets/{logs-panel-CSF7Q8UM.js → logs-panel-Dxu-x-VS.js} +1 -1
- package/dist/assets/{name-cell-input-DqqEJ7zu.js → name-cell-input-C3bm2h5H.js} +1 -1
- package/dist/assets/{packages-panel-B1riQC7x.js → packages-panel-DEssvZRX.js} +1 -1
- package/dist/assets/{panels-BoVxeDiN.js → panels-ejKp2vax.js} +1 -1
- package/dist/assets/{reveal-component-DZZvLO0k.js → reveal-component-CQkJIzzu.js} +1 -1
- package/dist/assets/{run-page-hjvocSSX.js → run-page-CPGo2qKb.js} +1 -1
- package/dist/assets/{scratchpad-panel-D-WnXtMg.js → scratchpad-panel-Con3-0Cf.js} +1 -1
- package/dist/assets/{secrets-panel-BUqVupNG.js → secrets-panel-CEh4Wjfn.js} +1 -1
- package/dist/assets/{session-panel-C24jCxzp.js → session-panel-Rx2sxJ8N.js} +1 -1
- package/dist/assets/{snippets-panel-DMxnwpOK.js → snippets-panel-CU32gjAk.js} +1 -1
- package/dist/assets/{tracing-E_STTdun.js → tracing-CckKQ3eq.js} +1 -1
- package/dist/assets/{tracing-panel-ctr2uAgM.js → tracing-panel-ML726M-W.js} +2 -2
- package/dist/assets/{useBoolean-C-u5gJXi.js → useBoolean-DP3412N2.js} +1 -1
- package/dist/assets/{useCellActionButton-NG_lrS7_.js → useCellActionButton-BR00pdte.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-B5aZXbZV.js → useDependencyPanelTab-CjRA2E1n.js} +1 -1
- package/dist/assets/{useNotebookActions-CL_AZZ56.js → useNotebookActions-BNzRfrBI.js} +1 -1
- package/dist/assets/{write-secret-modal-uEncG5lj.js → write-secret-modal-DjVzKit_.js} +1 -1
- package/dist/index.html +13 -13
- package/package.json +1 -1
- package/src/components/data-table/__tests__/column-header.test.ts +3 -1
- package/src/components/data-table/__tests__/column-header.test.tsx +203 -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 +175 -0
- package/src/components/data-table/__tests__/filters.test.ts +112 -36
- package/src/components/data-table/column-header.tsx +210 -157
- package/src/components/data-table/filter-by-values-picker.tsx +70 -9
- package/src/components/data-table/filter-pill-editor.tsx +289 -144
- package/src/components/data-table/filter-pills.tsx +49 -8
- package/src/components/data-table/filters.ts +131 -36
- 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/ui/combobox.tsx +3 -2
- package/src/components/ui/number-field.tsx +2 -0
- package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +24 -24
- package/src/plugins/impl/data-frames/schema.ts +4 -1
- package/dist/assets/JsonOutput-eMDPSllG.js +0 -49
- package/dist/assets/index-BvrSomCy.css +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as Me}from"./chunk-LvLJmgfZ.js";import{d as Q,l as ft,p as xt,u as he}from"./useEvent-D91BmmQi.js";import{t as yt}from"./react-Bj1aDYRI.js";import{D as Se,Dn as kt,Dr as bt,E as wt,Ii as we,Mn as jt,On as gt,Sr as vt,Yr as Ct,Zt as zt,_ as Wt,_r as _t,ct as Mt,h as Ne,kn as St,st as Nt,t as Dt,ut as De,yr as Pt}from"./cells-CJWUXz1v.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,x as It}from"./ai-model-dropdown-
|
|
1
|
+
import{s as Me}from"./chunk-LvLJmgfZ.js";import{d as Q,l as ft,p as xt,u as he}from"./useEvent-D91BmmQi.js";import{t as yt}from"./react-Bj1aDYRI.js";import{D as Se,Dn as kt,Dr as bt,E as wt,Ii as we,Mn as jt,On as gt,Sr as vt,Yr as Ct,Zt as zt,_ as Wt,_r as _t,ct as Mt,h as Ne,kn as St,st as Nt,t as Dt,ut as De,yr as Pt}from"./cells-CJWUXz1v.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,x as It}from"./ai-model-dropdown-CFx7zgXS.js";import{_ as X,d as Pe}from"./useEventListener-DvoEXWke.js";import{y as $t}from"./utils-Wvjk_Y4h.js";import{n as B,t as Ae}from"./constants-DMpttj8Q.js";import{T as me,n as Lt,o as Et,v as Tt,w as Rt}from"./config-DGudsRYK.js";import{n as Ht}from"./switch-CTn-kJzM.js";import{t as Ot}from"./jsx-runtime-BqBOg78p.js";import{o as Ut}from"./alert-dialog-BqFLkbUc.js";import{a as qt,c as Bt,o as Ie,s as Ft}from"./popover-Bz_0Vkyf.js";import{a as Vt,c as Yt,i as Kt,n as Gt,r as Jt,s as Zt,t as Qt}from"./select-DZcFyKFQ.js";import{_t as Xt}from"./JsonOutput-C3pFF2CF.js";import{c as $e,d as je,n as ea,o as ta,r as ge,t as aa}from"./download-DHh51UwN.js";import{t as ve}from"./tooltip-DTV9tlSr.js";import{r as Le,t as G}from"./button-BbCh-29a.js";import{i as oa,r as na,t as Ee}from"./strings-wdPMRf6Z.js";import{r as ee}from"./requests-DIwGYs0l.js";import{t as z}from"./createLucideIcon-D5guW7EU.js";import{F as sa,I as la,L as Te,P as ia,R as ra,a as Re,i as He,u as Oe}from"./layout-CRrGSugp.js";import{t as pe}from"./check-BH35Ndha.js";import{r as da}from"./useCellActionButton-BR00pdte.js";import{t as Ce}from"./copy-BwrPA9zQ.js";import{t as ca}from"./external-link-BTNxSavU.js";import{t as ha}from"./eye-off-BT-KOYV5.js";import{t as ue}from"./file-HTLbeC2b.js";import{t as ma}from"./github-raQvpeuZ.js";import{u as pa}from"./form-lU-npaWT.js";import{n as ua,r as fa,t as xa}from"./youtube-3lRHw8NU.js";import{i as ya,n as Ue}from"./add-connection-dialog-CET54LB_.js";import{t as ka}from"./house-D2ldnAB9.js";import{t as ba}from"./image-BIibSXT6.js";import{t as wa}from"./link-CoJxTwWE.js";import{r as ja}from"./input-CVE-gIjt.js";import{t as ga}from"./settings-SnYErNWQ.js";import{t as va}from"./sparkles-CC9Bko6a.js";import{y as Ca}from"./textarea-WSbqzqT1.js";import{t as za}from"./square-rACnnz-q.js";import{t as F}from"./use-toast-ERM44-k9.js";import{n as qe,t as Wa}from"./paths-SFhaqGlE.js";import{o as _a}from"./session-DGdfs0bJ.js";import{n as te}from"./copy-Ch48HVPK.js";import{r as Ma}from"./useRunCells-DX2yB43w.js";import{a as Be,c as Fe,i as Ve,n as Ye,r as Ke}from"./dialog-DqOQT_n4.js";import{n as ze}from"./ImperativeModal-DEC1mXgV.js";import{r as Sa,t as Ge}from"./share-oorMPghT.js";import{a as Na}from"./cell-link-DqucEHxF.js";import{a as Da}from"./renderShortcut-D7FYCtYQ.js";import{t as Pa}from"./icons-Ol38nIbL.js";import{n as Je}from"./marimo-icons-CUuBQ0ae.js";import{t as Aa}from"./links-Av1BIe0O.js";import{r as Ia,t as Ze}from"./hooks-C-k2d7mq.js";import{t as Qe}from"./types-DZmRsGZN.js";var $a=z("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),La=z("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Xe=z("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),et=z("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),tt=z("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Ea=z("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Ta=z("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Ra=z("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Ha=z("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Oa=z("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),at=z("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Ua=z("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),qa=z("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),ot=z("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),fe=q(),V=Me(yt(),1),a=Me(Ot(),1),Ba=["claude","codex","opencode"];function Fa(){return"uvx marimo@latest"}function Va(t,e,o){let n=o?" --with-token":"",l=`${Fa()} pair prompt --url '${e}'${n}`;switch(t){case"claude":return`claude "$(${l} --claude)"`;case"codex":return`codex "$(${l} --codex)"`;case"opencode":return`opencode --prompt "$(${l} --opencode)"`;default:na(t)}}function nt(t,e){let o=e?`
|
|
2
2
|
|
|
3
3
|
Use this auth token when calling \`execute-code.sh\`: \`execute-code.sh --url '${t}' --token '${e}'\`.`:"";return["Use the /marimo-pair skill to pair-program on a running marimo notebook.","",`Connect to the notebook at: ${t}`,"",`Use \`execute-code.sh --url ${t}\` from the marimo-pair skill to execute code in the notebook.${o}`,"","Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."].join(`
|
|
4
4
|
`)}function st(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var lt="npx skills add marimo-team/marimo-pair",Ya={claude:"Claude",codex:"Codex",opencode:"OpenCode",prompt:"Prompt"};function Ka(){let t=(0,fe.c)(2),[e,o]=(0,V.useState)(null),n,l;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{fetch(Lt("/auth/token").href,{headers:Ht.headers()}).then(Ga).then(d=>o((d==null?void 0:d.token)??null)).catch(()=>o(null))},l=[],t[0]=n,t[1]=l):(n=t[0],l=t[1]),(0,V.useEffect)(n,l),e}function Ga(t){return t.ok?t.json():null}const Ja=t=>{let e=(0,fe.c)(64),{onClose:o}=t,[n,l]=(0,V.useState)("claude"),d=Et(),s=Ka(),i=!!s,r,c,j,k,m,p,h,u,x,f,b,y,g,v,D,P,W,A,C,_;if(e[0]!==n||e[1]!==s||e[2]!==i||e[3]!==d.httpURL){let R=d.httpURL.toString();m=Ye,b="sm:max-w-2xl";let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(Fe,{children:"Pair with an agent"}),e[24]=O):O=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsxs)(Be,{children:[O,(0,a.jsxs)(Ke,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[25]=y):y=e[25],f="flex flex-col gap-4 py-2",k=qt,_=n,e[26]===Symbol.for("react.memo_cache_sentinel")?(h=U=>l(U),e[26]=h):h=e[26];let H;e[27]===Symbol.for("react.memo_cache_sentinel")?(H=["claude","codex","opencode","prompt"],e[27]=H):H=e[27],e[28]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(Ft,{className:"w-full",children:H.map(Za)}),e[28]=u):u=e[28],x=Ba.map(U=>(0,a.jsxs)(Ie,{value:U,className:"mt-4 flex flex-col gap-4",children:[(0,a.jsx)(ae,{index:1,title:"Install the skill",hint:"Run once per machine.",children:(0,a.jsx)(oe,{command:lt})}),(0,a.jsx)(ae,{index:2,title:"Run in your terminal",children:(0,a.jsx)(oe,{command:Va(U,R,i)})}),i&&s&&(0,a.jsx)(ae,{index:3,title:"Paste when prompted for a token",children:(0,a.jsx)(oe,{command:s,display:st(s)})})]},U)),j=Ie,W="prompt",A="mt-4 flex flex-col gap-4",e[29]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsx)(ae,{index:1,title:"Make sure the marimo-pair skill is available to your agent",hint:"Skip if your agent already has it.",children:(0,a.jsx)(oe,{command:lt})}),e[29]=C):C=e[29],c=ae,v=2,D="Copy this prompt into your agent",P=i?"Includes your auth token \u2014 keep it private.":void 0,r=oe,p=nt(R,s),g=nt(R,s?st(s):null),e[0]=n,e[1]=s,e[2]=i,e[3]=d.httpURL,e[4]=r,e[5]=c,e[6]=j,e[7]=k,e[8]=m,e[9]=p,e[10]=h,e[11]=u,e[12]=x,e[13]=f,e[14]=b,e[15]=y,e[16]=g,e[17]=v,e[18]=D,e[19]=P,e[20]=W,e[21]=A,e[22]=C,e[23]=_}else r=e[4],c=e[5],j=e[6],k=e[7],m=e[8],p=e[9],h=e[10],u=e[11],x=e[12],f=e[13],b=e[14],y=e[15],g=e[16],v=e[17],D=e[18],P=e[19],W=e[20],A=e[21],C=e[22],_=e[23];let I;e[30]!==r||e[31]!==p||e[32]!==g?(I=(0,a.jsx)(r,{command:p,display:g,multiline:!0}),e[30]=r,e[31]=p,e[32]=g,e[33]=I):I=e[33];let $;e[34]!==c||e[35]!==I||e[36]!==v||e[37]!==D||e[38]!==P?($=(0,a.jsx)(c,{index:v,title:D,hint:P,children:I}),e[34]=c,e[35]=I,e[36]=v,e[37]=D,e[38]=P,e[39]=$):$=e[39];let L;e[40]!==j||e[41]!==$||e[42]!==W||e[43]!==A||e[44]!==C?(L=(0,a.jsxs)(j,{value:W,className:A,children:[C,$]}),e[40]=j,e[41]=$,e[42]=W,e[43]=A,e[44]=C,e[45]=L):L=e[45];let S;e[46]!==k||e[47]!==h||e[48]!==u||e[49]!==x||e[50]!==L||e[51]!==_?(S=(0,a.jsxs)(k,{value:_,onValueChange:h,children:[u,x,L]}),e[46]=k,e[47]=h,e[48]=u,e[49]=x,e[50]=L,e[51]=_,e[52]=S):S=e[52];let E;e[53]!==f||e[54]!==S?(E=(0,a.jsx)("div",{className:f,children:S}),e[53]=f,e[54]=S,e[55]=E):E=e[55];let N;e[56]===o?N=e[57]:(N=(0,a.jsx)(Ve,{children:(0,a.jsx)(G,{variant:"secondary",onClick:o,children:"Close"})}),e[56]=o,e[57]=N);let T;return e[58]!==m||e[59]!==b||e[60]!==y||e[61]!==E||e[62]!==N?(T=(0,a.jsxs)(m,{className:b,children:[y,E,N]}),e[58]=m,e[59]=b,e[60]=y,e[61]=E,e[62]=N,e[63]=T):T=e[63],T};var ae=t=>{let e=(0,fe.c)(11),{index:o,title:n,hint:l,children:d}=t,s;e[0]!==o||e[1]!==n?(s=(0,a.jsxs)("span",{className:"text-sm font-medium",children:[o,". ",n]}),e[0]=o,e[1]=n,e[2]=s):s=e[2];let i;e[3]===l?i=e[4]:(i=l&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=i);let r;e[5]!==s||e[6]!==i?(r=(0,a.jsxs)("div",{className:"flex items-baseline gap-2",children:[s,i]}),e[5]=s,e[6]=i,e[7]=r):r=e[7];let c;return e[8]!==d||e[9]!==r?(c=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[r,d]}),e[8]=d,e[9]=r,e[10]=c):c=e[10],c},oe=t=>{let e=(0,fe.c)(28),{command:o,display:n,multiline:l}=t,d=l===void 0?!1:l,[s,i]=(0,V.useState)(!1),r;e[0]===o?r=e[1]:(r=Le.stopPropagation(async x=>{x.preventDefault(),await te(o),i(!0),setTimeout(()=>i(!1),2e3)}),e[0]=o,e[1]=r);let c=r;if(d){let x=n??o,f;e[2]===x?f=e[3]:(f=(0,a.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words px-3 py-2 pr-10 font-mono text-xs select-all",children:x}),e[2]=x,e[3]=f);let b;e[4]===s?b=e[5]:(b=s?(0,a.jsx)(pe,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=b);let y;e[6]!==c||e[7]!==b?(y=(0,a.jsx)(G,{onClick:c,size:"xs",variant:"ghost",className:"absolute right-1 top-1",children:b}),e[6]=c,e[7]=b,e[8]=y):y=e[8];let g;e[9]!==s||e[10]!==y?(g=(0,a.jsx)(ve,{content:"Copied!",open:s,children:y}),e[9]=s,e[10]=y,e[11]=g):g=e[11];let v;return e[12]!==f||e[13]!==g?(v=(0,a.jsxs)("div",{className:"relative rounded-md bg-muted",children:[f,g]}),e[12]=f,e[13]=g,e[14]=v):v=e[14],v}let j=n??o,k;e[15]===j?k=e[16]:(k=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:j}),e[15]=j,e[16]=k);let m;e[17]===s?m=e[18]:(m=s?(0,a.jsx)(pe,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[17]=s,e[18]=m);let p;e[19]!==c||e[20]!==m?(p=(0,a.jsx)(G,{onClick:c,size:"xs",variant:"ghost",children:m}),e[19]=c,e[20]=m,e[21]=p):p=e[21];let h;e[22]!==s||e[23]!==p?(h=(0,a.jsx)(ve,{content:"Copied!",open:s,children:p}),e[22]=s,e[23]=p,e[24]=h):h=e[24];let u;return e[25]!==k||e[26]!==h?(u=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[k,h]}),e[25]=k,e[26]=h,e[27]=u):u=e[27],u};function Za(t){return(0,a.jsx)(Bt,{value:t,className:"flex-1",children:Ya[t]},t)}var it=q(),xe="https://static.marimo.app";const Qa=t=>{let e=(0,it.c)(25),{onClose:o}=t,[n,l]=(0,V.useState)(""),{exportAsHTML:d}=ee(),s=`${n}-${Math.random().toString(36).slice(2,6)}`,i=`${xe}/static/${s}`,r;e[0]!==d||e[1]!==o||e[2]!==s?(r=async y=>{y.preventDefault(),o();let g=await d({download:!1,includeCode:!0,files:ia.INSTANCE.filenames()}),v=F({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${xe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:g,path:s})}).catch(()=>{v.dismiss(),F({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:B.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),F({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},e[0]=d,e[1]=o,e[2]=s,e[3]=r):r=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Fe,{children:"Share static notebook"}),e[4]=c):c=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Ke,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:xe,target:"_blank",children:xe}),"."]})]}),e[5]=j):j=e[5];let k;e[6]===Symbol.for("react.memo_cache_sentinel")?(k=y=>{l(y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=k):k=e[6];let m;e[7]===n?m=e[8]:(m=(0,a.jsx)(ja,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:n,placeholder:"Notebook slug",onChange:k,required:!0,autoComplete:"off"}),e[7]=n,e[8]=m);let p;e[9]===i?p=e[10]:(p=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Xa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),e[9]=i,e[10]=p);let h;e[11]!==m||e[12]!==p?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,p]}),e[11]=m,e[12]=p,e[13]=h):h=e[13];let u;e[14]===o?u=e[15]:(u=(0,a.jsx)(G,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:o,children:"Cancel"}),e[14]=o,e[15]=u);let x;e[16]===i?x=e[17]:(x=(0,a.jsx)(G,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await te(i)},children:"Create"}),e[16]=i,e[17]=x);let f;e[18]!==u||e[19]!==x?(f=(0,a.jsxs)(Ve,{children:[u,x]}),e[18]=u,e[19]=x,e[20]=f):f=e[20];let b;return e[21]!==r||e[22]!==f||e[23]!==h?(b=(0,a.jsx)(Ye,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:r,children:[j,h,f]})}),e[21]=r,e[22]=f,e[23]=h,e[24]=b):b=e[24],b};var Xa=t=>{let e=(0,it.c)(8),[o,n]=V.useState(!1),l;e[0]===t.text?l=e[1]:(l=Le.stopPropagation(async c=>{c.preventDefault(),await te(t.text),n(!0),setTimeout(()=>n(!1),2e3)}),e[0]=t.text,e[1]=l);let d=l,s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[2]=s):s=e[2];let i;e[3]===d?i=e[4]:(i=(0,a.jsx)(G,{"data-testid":"copy-static-notebook-url-button",onClick:d,size:"xs",variant:"secondary",children:s}),e[3]=d,e[4]=i);let r;return e[5]!==o||e[6]!==i?(r=(0,a.jsx)(ve,{content:"Copied!",open:o,children:i}),e[5]=o,e[6]=i,e[7]=r):r=e[7],r},eo=q();function to(){let t=document.getElementsByClassName(Ae.outputArea);for(let e of t){let o=e.getBoundingClientRect();if(o.bottom>0&&o.top<window.innerHeight){let n=we.findElement(e);if(!n){X.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:we.parse(n.id)}}}return X.warn("No visible output area found for scroll anchor"),null}function ao(t){if(!t){X.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(we.create(t.cellId));if(!e){X.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Ae.outputArea}`)){X.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function rt(){let t=(0,eo.c)(2),e=Q(De),o;return t[0]===e?o=t[1]:(o=()=>{let n=to();e(l=>({mode:Mt(l.mode),cellAnchor:(n==null?void 0:n.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ao(n)})})},t[0]=e,t[1]=o),o}const dt=xt(!1);var oo=q();const no=()=>{let t=(0,oo.c)(7),{selectedLayout:e}=Re(),{setLayoutView:o}=He();if(me()&&!jt("wasm_layouts"))return null;let n;t[0]===o?n=t[1]:(n=i=>o(i),t[0]=o,t[1]=n);let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Zt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Yt,{placeholder:"Select a view"})}),t[2]=l):l=t[2];let d;t[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(Gt,{children:(0,a.jsxs)(Jt,{children:[(0,a.jsx)(Vt,{children:"View as"}),Qe.map(lo)]})}),t[3]=d):d=t[3];let s;return t[4]!==e||t[5]!==n?(s=(0,a.jsxs)(Qt,{"data-testid":"layout-select",value:e,onValueChange:n,children:[l,d]}),t[4]=e,t[5]=n,t[6]=s):s=t[6],s};function so(t){return(0,a.jsx)(ct(t),{className:"h-4 w-4"})}function ct(t){switch(t){case"vertical":return Ra;case"grid":return fa;case"slides":return at;default:return oa(t),za}}function ht(t){return Ee.startCase(t)}function lo(t){return(0,a.jsx)(Kt,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[so(t),(0,a.jsx)("span",{children:ht(t)})]})},t)}async function io(t){let{filename:e,preset:o,downloadPDF:n}=t;await n({filename:e,webpdf:!1,preset:o,includeInputs:!0,rasterServer:"static"})}var ro=q();function co(t){let e=(0,ro.c)(5),{openPrompt:o,closeModal:n}=ze(),{sendCopy:l}=ee(),d;return e[0]!==n||e[1]!==o||e[2]!==l||e[3]!==t?(d=()=>{if(!t)return null;let s=Wa.guessDeliminator(t);o({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let r=s.join(qe.dirname(t),i);l({source:t,destination:r}).then(()=>{n(),F({title:"Notebook copied",description:"A copy of the notebook has been created."}),Aa(r)})}})},e[0]=n,e[1]=o,e[2]=l,e[3]=t,e[4]=d):d=e[4],d}const ho=()=>{let{updateCellConfig:t}=Se(),{saveCellConfig:e}=ee();return(0,V.useCallback)(async()=>{let o=new zt,n=Ne(),l=n.cellIds.inOrderIds,d={};for(let i of l){if(n.cellData[i]===void 0)continue;let{code:r,config:c}=n.cellData[i];c.hide_code||o.isSupported(r)&&(d[i]={hide_code:!0})}let s=Pe.entries(d);if(s.length!==0){await e({configs:d});for(let[i,r]of s)t({cellId:i,config:r})}},[t])};var mo=q();function mt(){let t=(0,mo.c)(4),{openConfirm:e}=ze(),o=Q(Tt),{sendRestart:n}=ee(),l;return t[0]!==e||t[1]!==n||t[2]!==o?(l=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Ut,{onClick:async()=>{o({state:Rt.CLOSING}),await n(),Sa()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o,t[3]=l):l=t[3],l}var po=q(),J=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function uo(){var We,_e;let t=(0,po.c)(52),e=Na(),{openModal:o,closeModal:n}=ze(),{toggleApplication:l}=kt(),{selectedPanel:d}=gt(),[s]=ft(De),i=he(Nt),r=ho(),[c]=$t(),{updateCellConfig:j,undoDeleteCell:k,clearAllCellOutputs:m,addSetupCellIfDoesntExist:p,collapseAllCells:h,expandAllCells:u}=Se(),x=mt(),f=Ma(),b=co(e),y=Q(dt),g=Q(At),v=Q(It),{exportAsIPYNB:D,exportAsMarkdown:P,readCode:W,saveCellConfig:A,updateCellOutputs:C}=ee(),_=Ia(),I=he(Wt),$=he(Dt),L=he(wt),{selectedLayout:S}=Re(),{setLayoutView:E}=He(),N=rt(),T=((We=c.sharing)==null?void 0:We.html)??!0,R=((_e=c.sharing)==null?void 0:_e.wasm)??!0,O=!me(),H=S==="slides",U=Po,pt=Do,ne;t[0]!==e||t[1]!==_||t[2]!==C?(ne=async w=>{let{preset:M,title:Z}=w;if(!e){ye();return}await $e(Z,async be=>{await Ze({takeScreenshots:()=>_({progress:be}),updateCellOutputs:C}),await io({filename:e,preset:M,downloadPDF:ea})})},t[0]=e,t[1]=_,t[2]=C,t[3]=ne):ne=t[3];let Y=ne,se;t[4]===Y?se=t[5]:(se=async()=>{if(O){await Y({preset:"document",title:"Downloading Document PDF..."});return}let w=new Event("export-beforeprint"),M=new Event("export-afterprint");window.dispatchEvent(w),setTimeout(No,0),setTimeout(()=>window.dispatchEvent(M),0)},t[4]=Y,t[5]=se);let le=se,ie;t[6]!==D||t[7]!==e||t[8]!==_||t[9]!==C?(ie=async()=>{if(!e){ye();return}await $e("Downloading IPYNB...",async w=>{await Ze({takeScreenshots:()=>_({progress:w}),updateCellOutputs:C});let M=await D({download:!1});ge(new Blob([M],{type:"application/x-ipynb+json"}),je.toIPYNB(document.title))})},t[6]=D,t[7]=e,t[8]=_,t[9]=C,t[10]=ie):ie=t[10];let ke=ie,re;t[11]===Symbol.for("react.memo_cache_sentinel")?(re=(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),t[11]=re):re=t[11];let de;t[12]===Symbol.for("react.memo_cache_sentinel")?(de=(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),t[12]=de):de=t[12];let K;t[13]===e?K=t[14]:(K=async()=>{if(!e){ye();return}await Oe({filename:e,includeCode:!0})},t[13]=e,t[14]=K);let ce;return t[15]!==p||t[16]!==$||t[17]!==m||t[18]!==n||t[19]!==h||t[20]!==b||t[21]!==Y||t[22]!==u||t[23]!==P||t[24]!==e||t[25]!==le||t[26]!==ke||t[27]!==I||t[28]!==r||t[29]!==H||t[30]!==i||t[31]!==o||t[32]!==W||t[33]!==x||t[34]!==f||t[35]!==A||t[36]!==S||t[37]!==d||t[38]!==y||t[39]!==v||t[40]!==E||t[41]!==g||t[42]!==T||t[43]!==R||t[44]!==K||t[45]!==l||t[46]!==N||t[47]!==k||t[48]!==L||t[49]!==j||t[50]!==s.mode?(ce=[{icon:re,label:"Download",handle:J,dropdown:[{icon:de,label:"Download as HTML",handle:K},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ye();return}await Oe({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Pa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let w=await P({download:!1});ge(new Blob([w],{type:"text/plain"}),je.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ha,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ke},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let w=await W();ge(new Blob([w.contents],{type:"text/plain"}),je.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Da("global.hideCode",!1)]}),handle:So},H?{divider:!0,icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:J,dropdown:[{icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:le},{icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:pt(!0),hidden:!O,handle:async()=>{await Y({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:le}]},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:me(),handle:async()=>{o((0,a.jsx)(Ja,{onClose:n}))}},{icon:(0,a.jsx)(Ua,{size:14,strokeWidth:1.5}),label:"Share",handle:J,hidden:!T&&!R,dropdown:[{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!T,handle:async()=>{o((0,a.jsx)(Qa,{onClose:n}))}},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!R,handle:async()=>{await te(Ge({code:(await W()).contents})),F({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Create molab notebook",handle:async()=>{let w=Ge({code:(await W()).contents,baseUrl:`${B.molab}/new`});window.open(w,"_blank")}}]},{icon:(0,a.jsx)(Oa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:J,dropdown:St.flatMap(w=>{let{type:M,Icon:Z,hidden:be,additionalKeywords:ut}=w;return be?[]:{label:Ee.startCase(M),rightElement:U(d===M),icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),handle:()=>l(M),additionalKeywords:ut}})},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Present as",handle:J,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}):(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{N()}},...Qe.map((w,M)=>{let Z=ct(w);return{divider:M===0,label:ht(w),icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:S===w&&(0,a.jsx)(pe,{size:14})}),handle:()=>{E(w),s.mode==="edit"&&N()}}})]},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||me(),handle:b},{icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await te((await W()).contents),F({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!I||i,handle:async()=>{let w=Ct(Ne());await A({configs:Pe.fromEntries(w.map(Mo))});for(let M of w)j({cellId:M,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{p({})}},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{o((0,a.jsx)(Ue,{onClose:n}))}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{o((0,a.jsx)(Ue,{defaultTab:"storage",onClose:n}))}},{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:L,hidden:!$||i,handle:()=>{k()}},{icon:(0,a.jsx)(qa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:x,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{f()}},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:r,redundant:!0},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:h,redundant:!0},{icon:(0,a.jsx)($a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:u,redundant:!0},{divider:!0,icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>y(_o)},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(Wo)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>g(zo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Resources",handle:J,dropdown:[{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Co},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"GitHub",handle:vo},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:go},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"YouTube",handle:jo},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Changelog",handle:wo}]},{divider:!0,icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:bo},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ko}].filter(yo).map(fo),t[15]=p,t[16]=$,t[17]=m,t[18]=n,t[19]=h,t[20]=b,t[21]=Y,t[22]=u,t[23]=P,t[24]=e,t[25]=le,t[26]=ke,t[27]=I,t[28]=r,t[29]=H,t[30]=i,t[31]=o,t[32]=W,t[33]=x,t[34]=f,t[35]=A,t[36]=S,t[37]=d,t[38]=y,t[39]=v,t[40]=E,t[41]=g,t[42]=T,t[43]=R,t[44]=K,t[45]=l,t[46]=N,t[47]=k,t[48]=L,t[49]=j,t[50]=s.mode,t[51]=ce):ce=t[51],ce}function fo(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(xo)}:t}function xo(t){return!t.hidden}function yo(t){return!t.hidden}function ko(){let t=_a();window.open(t,"_blank")}function bo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function wo(){window.open(B.releasesPage,"_blank")}function jo(){window.open(B.youtube,"_blank")}function go(){window.open(B.discordLink,"_blank")}function vo(){window.open(B.githubPage,"_blank")}function Co(){window.open(B.docsPage,"_blank")}function zo(t){return!t}function Wo(t){return!t}function _o(t){return!t}function Mo(t){return[t,{disabled:!1}]}async function So(){let t=document.getElementById("App");t&&await ta({element:t,filename:document.title,prepare:aa})}function No(){return window.print()}function Do(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function Po(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(pe,{size:14})})}function ye(){F({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{rt as a,et as c,dt as i,Xe as l,mt as n,ot as o,no as r,tt as s,uo as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as V}from"./chunk-LvLJmgfZ.js";import{t as B}from"./react-Bj1aDYRI.js";import{t as G}from"./compiler-runtime-B3qBwwSJ.js";import{t as H}from"./jsx-runtime-BqBOg78p.js";import{c as I,i as J,n as O,s as Q,t as U}from"./select-DZcFyKFQ.js";import{t as P}from"./label-xHqFtfdz.js";import{t as W}from"./button-BbCh-29a.js";import{r as X}from"./requests-DIwGYs0l.js";import{r as D}from"./input-
|
|
1
|
+
import{s as V}from"./chunk-LvLJmgfZ.js";import{t as B}from"./react-Bj1aDYRI.js";import{t as G}from"./compiler-runtime-B3qBwwSJ.js";import{t as H}from"./jsx-runtime-BqBOg78p.js";import{c as I,i as J,n as O,s as Q,t as U}from"./select-DZcFyKFQ.js";import{t as P}from"./label-xHqFtfdz.js";import{t as W}from"./button-BbCh-29a.js";import{r as X}from"./requests-DIwGYs0l.js";import{r as D}from"./input-CVE-gIjt.js";import{t as E}from"./use-toast-ERM44-k9.js";import{a as Z,c as $,i as ee,n as te,r as re}from"./dialog-DqOQT_n4.js";import{t as ae}from"./links-B8WzCnbo.js";import{r as L}from"./field-CQGpbXj3.js";var oe=G(),T=V(B(),1),t=V(H(),1);function ne(a){return a.toSorted((e,r)=>e.provider==="env"?1:r.provider==="env"?-1:0)}const le=a=>{let e=(0,oe.c)(43),{providerNames:r,onClose:A,onSuccess:F}=a,{writeSecret:Y}=X(),[o,M]=T.useState(""),[l,R]=T.useState(""),[n,z]=T.useState(r[0]),g;e[0]!==o||e[1]!==n||e[2]!==F||e[3]!==l||e[4]!==Y?(g=async i=>{if(i.preventDefault(),!n){E({title:"Error",description:"No location selected for the secret.",variant:"danger"});return}if(!o||!l||!n){E({title:"Error",description:"Please fill in all fields.",variant:"danger"});return}try{await Y({key:o,value:l,provider:"dotenv",name:n}),E({title:"Secret created",description:"The secret has been created successfully."}),F(o)}catch{E({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}},e[0]=o,e[1]=n,e[2]=F,e[3]=l,e[4]=Y,e[5]=g):g=e[5];let q=g,j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=(0,t.jsxs)(Z,{children:[(0,t.jsx)($,{children:"Add Secret"}),(0,t.jsx)(re,{children:"Add a new secret to your environment variables."})]}),e[6]=j):j=e[6];let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=(0,t.jsx)(P,{htmlFor:"key",children:"Key"}),e[7]=y):y=e[7];let S;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=i=>{M(ie(i.target.value))},e[8]=S):S=e[8];let s;e[9]===o?s=e[10]:(s=(0,t.jsxs)("div",{className:"grid gap-2",children:[y,(0,t.jsx)(D,{id:"key",value:o,onChange:S,placeholder:"MY_SECRET_KEY",required:!0})]}),e[9]=o,e[10]=s);let _;e[11]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(P,{htmlFor:"value",children:"Value"}),e[11]=_):_=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=i=>R(i.target.value),e[12]=b):b=e[12];let c;e[13]===l?c=e[14]:(c=(0,t.jsx)(D,{id:"value",type:"password",value:l,onChange:b,required:!0,autoComplete:"off"}),e[13]=l,e[14]=c);let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=se()&&(0,t.jsx)(L,{children:"Note: You are sending this key over http."}),e[15]=C):C=e[15];let d;e[16]===c?d=e[17]:(d=(0,t.jsxs)("div",{className:"grid gap-2",children:[_,c,C]}),e[16]=c,e[17]=d);let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=(0,t.jsx)(P,{htmlFor:"location",children:"Location"}),e[18]=N):N=e[18];let m;e[19]===r.length?m=e[20]:(m=r.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[19]=r.length,e[20]=m);let h;e[21]!==n||e[22]!==r?(h=r.length>0&&(0,t.jsxs)(U,{value:n,onValueChange:i=>z(i),children:[(0,t.jsx)(Q,{children:(0,t.jsx)(I,{placeholder:"Select a provider"})}),(0,t.jsx)(O,{children:r.map(ce)})]}),e[21]=n,e[22]=r,e[23]=h):h=e[23];let k;e[24]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsxs)(L,{children:["You can configure the location by setting the"," ",(0,t.jsx)(ae,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[24]=k):k=e[24];let p;e[25]!==m||e[26]!==h?(p=(0,t.jsxs)("div",{className:"grid gap-2",children:[N,m,h,k]}),e[25]=m,e[26]=h,e[27]=p):p=e[27];let u;e[28]!==d||e[29]!==p||e[30]!==s?(u=(0,t.jsxs)("div",{className:"grid gap-4 py-4",children:[s,d,p]}),e[28]=d,e[29]=p,e[30]=s,e[31]=u):u=e[31];let f;e[32]===A?f=e[33]:(f=(0,t.jsx)(W,{type:"button",variant:"outline",onClick:A,children:"Cancel"}),e[32]=A,e[33]=f);let K=!o||!l||!n,v;e[34]===K?v=e[35]:(v=(0,t.jsx)(W,{type:"submit",disabled:K,children:"Add Secret"}),e[34]=K,e[35]=v);let x;e[36]!==f||e[37]!==v?(x=(0,t.jsxs)(ee,{children:[f,v]}),e[36]=f,e[37]=v,e[38]=x):x=e[38];let w;return e[39]!==q||e[40]!==u||e[41]!==x?(w=(0,t.jsx)(te,{children:(0,t.jsxs)("form",{onSubmit:q,children:[j,u,x]})}),e[39]=q,e[40]=u,e[41]=x,e[42]=w):w=e[42],w};function ie(a){return a.replaceAll(/\W/g,"_")}function se(){return window.location.href.startsWith("http://")}function ce(a){return(0,t.jsx)(J,{value:a,children:a},a)}export{ne as n,le as t};
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-C1NmJ636.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-DdZsAcJe.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
|
|
@@ -145,9 +145,9 @@
|
|
|
145
145
|
<link rel="modulepreload" crossorigin href="./assets/context-C1Tm_47t.js">
|
|
146
146
|
<link rel="modulepreload" crossorigin href="./assets/useNumberFormatter-CW4V-fpE.js">
|
|
147
147
|
<link rel="modulepreload" crossorigin href="./assets/usePress-jH2RfcUG.js">
|
|
148
|
-
<link rel="modulepreload" crossorigin href="./assets/input-
|
|
149
|
-
<link rel="modulepreload" crossorigin href="./assets/ImperativeModal-
|
|
150
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
148
|
+
<link rel="modulepreload" crossorigin href="./assets/input-CVE-gIjt.js">
|
|
149
|
+
<link rel="modulepreload" crossorigin href="./assets/ImperativeModal-DEC1mXgV.js">
|
|
150
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-DqucEHxF.js">
|
|
151
151
|
<link rel="modulepreload" crossorigin href="./assets/multi-map-CUuNtzHt.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/alert-DrHguQlr.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-CG5QYXYk.js">
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
<link rel="modulepreload" crossorigin href="./assets/state-QBvZnVYO.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="./assets/package-B8oXOUM-.js">
|
|
164
164
|
<link rel="modulepreload" crossorigin href="./assets/sparkles-CC9Bko6a.js">
|
|
165
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
165
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-C_s2Utqa.js">
|
|
166
166
|
<link rel="modulepreload" crossorigin href="./assets/spinner-UuZAUjoP.js">
|
|
167
167
|
<link rel="modulepreload" crossorigin href="./assets/html-to-image-CS4X2edG.js">
|
|
168
168
|
<link rel="modulepreload" crossorigin href="./assets/focus-CmJ1iwZ3.js">
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/micromark-factory-space-P--XWZhg.js">
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-DILIU9Rm.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-C_hNGAKl.js">
|
|
174
|
-
<link rel="modulepreload" crossorigin href="./assets/command-
|
|
174
|
+
<link rel="modulepreload" crossorigin href="./assets/command-2NPJCYDa.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/popover-Bz_0Vkyf.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/errors-iwK4b4VF.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/download-DHh51UwN.js">
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-1YLdnr8A.js">
|
|
194
194
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-BJLYnZpG.js">
|
|
195
195
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-CgWOEYeG.js">
|
|
196
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
196
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-C3pFF2CF.js">
|
|
197
197
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-nqk474t8.js">
|
|
198
198
|
<link rel="modulepreload" crossorigin href="./assets/square-function-blYaQso8.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/spec-D1ptWKg6.js">
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-a_9k9BK7.js">
|
|
202
202
|
<link rel="modulepreload" crossorigin href="./assets/tree-actions-D9i3o3Zk.js">
|
|
203
203
|
<link rel="modulepreload" crossorigin href="./assets/components-BxcnsrL3.js">
|
|
204
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
204
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-yyJgA8qB.js">
|
|
205
205
|
<link rel="modulepreload" crossorigin href="./assets/icons-Ol38nIbL.js">
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-DkplF0z9.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/floating-outline-n07aHtSF.js">
|
|
@@ -226,11 +226,11 @@
|
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/label-xHqFtfdz.js">
|
|
227
227
|
<link rel="modulepreload" crossorigin href="./assets/textarea-WSbqzqT1.js">
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DLc784Sj.js">
|
|
229
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
229
|
+
<link rel="modulepreload" crossorigin href="./assets/form-lU-npaWT.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/renderShortcut-D7FYCtYQ.js">
|
|
231
|
-
<link rel="modulepreload" crossorigin href="./assets/field-
|
|
232
|
-
<link rel="modulepreload" crossorigin href="./assets/RSPContexts-
|
|
233
|
-
<link rel="modulepreload" crossorigin href="./assets/useBoolean-
|
|
231
|
+
<link rel="modulepreload" crossorigin href="./assets/field-CQGpbXj3.js">
|
|
232
|
+
<link rel="modulepreload" crossorigin href="./assets/RSPContexts-Bk1r00gJ.js">
|
|
233
|
+
<link rel="modulepreload" crossorigin href="./assets/useBoolean-DP3412N2.js">
|
|
234
234
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-zUHU--0D.js">
|
|
235
235
|
<link rel="modulepreload" crossorigin href="./assets/types-BYwxXaSY.js">
|
|
236
236
|
<link rel="modulepreload" crossorigin href="./assets/semaphore-X3ApuO41.js">
|
|
@@ -249,7 +249,7 @@
|
|
|
249
249
|
<link rel="stylesheet" crossorigin href="./assets/cells-jmgGt1lS.css">
|
|
250
250
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-DdDKmWlR.css">
|
|
251
251
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-B7vuddcd.css">
|
|
252
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
252
|
+
<link rel="stylesheet" crossorigin href="./assets/index-8ta9aYoc.css">
|
|
253
253
|
</head>
|
|
254
254
|
<body>
|
|
255
255
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -49,7 +49,9 @@ describe("seedFromFilter", () => {
|
|
|
49
49
|
values: [],
|
|
50
50
|
operator: "in",
|
|
51
51
|
});
|
|
52
|
-
expect(
|
|
52
|
+
expect(
|
|
53
|
+
seedFromFilter(Filter.number({ operator: "between", min: 0, max: 10 })),
|
|
54
|
+
).toEqual({
|
|
53
55
|
values: [],
|
|
54
56
|
operator: "in",
|
|
55
57
|
});
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import type { Column } from "@tanstack/react-table";
|
|
3
|
+
import { fireEvent, render, screen, within } from "@testing-library/react";
|
|
4
|
+
import { beforeAll, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { NumberFilterMenu, TextFilterMenu } from "../column-header";
|
|
6
|
+
import { Filter } from "../filters";
|
|
7
|
+
|
|
8
|
+
beforeAll(() => {
|
|
9
|
+
global.HTMLElement.prototype.scrollIntoView = () => {
|
|
10
|
+
// jsdom does not implement scrollIntoView; Radix calls it on open.
|
|
11
|
+
};
|
|
12
|
+
// Radix Select gates pointer interactions on hasPointerCapture; jsdom omits it.
|
|
13
|
+
if (!global.HTMLElement.prototype.hasPointerCapture) {
|
|
14
|
+
global.HTMLElement.prototype.hasPointerCapture = () => false;
|
|
15
|
+
}
|
|
16
|
+
if (!global.HTMLElement.prototype.releasePointerCapture) {
|
|
17
|
+
global.HTMLElement.prototype.releasePointerCapture = () => {
|
|
18
|
+
// no-op
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
function mockColumn(initial?: ReturnType<typeof Filter.number>): Column<
|
|
24
|
+
unknown,
|
|
25
|
+
unknown
|
|
26
|
+
> & {
|
|
27
|
+
setFilterValue: ReturnType<typeof vi.fn>;
|
|
28
|
+
} {
|
|
29
|
+
let filterValue = initial;
|
|
30
|
+
const setFilterValue = vi.fn((next) => {
|
|
31
|
+
filterValue = next;
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
id: "age",
|
|
35
|
+
columnDef: { meta: { dataType: "number", filterType: "number" } },
|
|
36
|
+
getFilterValue: () => filterValue,
|
|
37
|
+
setFilterValue,
|
|
38
|
+
} as unknown as Column<unknown, unknown> & {
|
|
39
|
+
setFilterValue: ReturnType<typeof vi.fn>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
describe("NumberFilterMenu", () => {
|
|
44
|
+
it("shows all expected operators in the dropdown", () => {
|
|
45
|
+
const column = mockColumn();
|
|
46
|
+
render(<NumberFilterMenu column={column} />);
|
|
47
|
+
const trigger = screen.getByRole("combobox");
|
|
48
|
+
fireEvent.click(trigger);
|
|
49
|
+
const listbox = screen.getByRole("listbox");
|
|
50
|
+
const labels = within(listbox)
|
|
51
|
+
.getAllByRole("option")
|
|
52
|
+
.map((o) => o.textContent);
|
|
53
|
+
expect(labels).toEqual([
|
|
54
|
+
"Between",
|
|
55
|
+
"Equals",
|
|
56
|
+
"Doesn't equal",
|
|
57
|
+
"Greater than",
|
|
58
|
+
"Greater than or equal",
|
|
59
|
+
"Less than",
|
|
60
|
+
"Less than or equal",
|
|
61
|
+
"Is null",
|
|
62
|
+
"Is not null",
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("between mode disables Apply until both min and max are defined", () => {
|
|
67
|
+
const column = mockColumn();
|
|
68
|
+
render(<NumberFilterMenu column={column} />);
|
|
69
|
+
const apply = screen.getByRole("button", { name: /apply/i });
|
|
70
|
+
expect(apply).toBeDisabled();
|
|
71
|
+
|
|
72
|
+
const min = screen.getByLabelText("min");
|
|
73
|
+
fireEvent.change(min, { target: { value: "1" } });
|
|
74
|
+
fireEvent.blur(min);
|
|
75
|
+
expect(apply).toBeDisabled();
|
|
76
|
+
|
|
77
|
+
const max = screen.getByLabelText("max");
|
|
78
|
+
fireEvent.change(max, { target: { value: "10" } });
|
|
79
|
+
fireEvent.blur(max);
|
|
80
|
+
expect(apply).not.toBeDisabled();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("comparison mode shows a single value field seeded from current filter", () => {
|
|
84
|
+
const column = mockColumn(Filter.number({ operator: ">", value: 18 }));
|
|
85
|
+
render(<NumberFilterMenu column={column} />);
|
|
86
|
+
const value = screen.getByLabelText("value") as HTMLInputElement;
|
|
87
|
+
expect(value).toBeInTheDocument();
|
|
88
|
+
expect(value.value).toBe("18");
|
|
89
|
+
expect(screen.queryByLabelText("min")).not.toBeInTheDocument();
|
|
90
|
+
expect(screen.queryByLabelText("max")).not.toBeInTheDocument();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("selecting a nullish operator hides value inputs and commits on Apply", () => {
|
|
94
|
+
const column = mockColumn();
|
|
95
|
+
render(<NumberFilterMenu column={column} />);
|
|
96
|
+
fireEvent.click(screen.getByRole("combobox"));
|
|
97
|
+
const listbox = screen.getByRole("listbox");
|
|
98
|
+
fireEvent.click(within(listbox).getByText("Is null"));
|
|
99
|
+
expect(column.setFilterValue).not.toHaveBeenCalled();
|
|
100
|
+
expect(screen.queryByLabelText("min")).not.toBeInTheDocument();
|
|
101
|
+
expect(screen.queryByLabelText("max")).not.toBeInTheDocument();
|
|
102
|
+
expect(screen.queryByLabelText("value")).not.toBeInTheDocument();
|
|
103
|
+
fireEvent.click(screen.getByRole("button", { name: /apply/i }));
|
|
104
|
+
expect(column.setFilterValue).toHaveBeenCalledWith(
|
|
105
|
+
Filter.number({ operator: "is_null" }),
|
|
106
|
+
);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
function mockTextColumn(initial?: ReturnType<typeof Filter.text>): Column<
|
|
111
|
+
unknown,
|
|
112
|
+
unknown
|
|
113
|
+
> & {
|
|
114
|
+
setFilterValue: ReturnType<typeof vi.fn>;
|
|
115
|
+
} {
|
|
116
|
+
let filterValue = initial;
|
|
117
|
+
const setFilterValue = vi.fn((next) => {
|
|
118
|
+
filterValue = next;
|
|
119
|
+
});
|
|
120
|
+
return {
|
|
121
|
+
id: "name",
|
|
122
|
+
columnDef: { meta: { dataType: "string", filterType: "text" } },
|
|
123
|
+
getFilterValue: () => filterValue,
|
|
124
|
+
setFilterValue,
|
|
125
|
+
} as unknown as Column<unknown, unknown> & {
|
|
126
|
+
setFilterValue: ReturnType<typeof vi.fn>;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
describe("TextFilterMenu", () => {
|
|
131
|
+
it("shows all 11 text operators in the dropdown", () => {
|
|
132
|
+
const column = mockTextColumn();
|
|
133
|
+
render(<TextFilterMenu column={column} />);
|
|
134
|
+
fireEvent.click(screen.getByRole("combobox"));
|
|
135
|
+
const listbox = screen.getByRole("listbox");
|
|
136
|
+
const labels = within(listbox)
|
|
137
|
+
.getAllByRole("option")
|
|
138
|
+
.map((o) => o.textContent);
|
|
139
|
+
expect(labels).toEqual([
|
|
140
|
+
"Contains",
|
|
141
|
+
"Equals",
|
|
142
|
+
"Doesn't equal",
|
|
143
|
+
"Matches regex",
|
|
144
|
+
"Starts with",
|
|
145
|
+
"Ends with",
|
|
146
|
+
"Is in",
|
|
147
|
+
"Not in",
|
|
148
|
+
"Is empty",
|
|
149
|
+
"Is null",
|
|
150
|
+
"Is not null",
|
|
151
|
+
]);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("single-string operator renders a text input seeded from current filter", () => {
|
|
155
|
+
const column = mockTextColumn(
|
|
156
|
+
Filter.text({ operator: "equals", text: "alice" }),
|
|
157
|
+
);
|
|
158
|
+
render(<TextFilterMenu column={column} />);
|
|
159
|
+
const input = screen.getByPlaceholderText("Text...") as HTMLInputElement;
|
|
160
|
+
expect(input).toBeInTheDocument();
|
|
161
|
+
expect(input.value).toBe("alice");
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it("'in' operator renders the creatable values picker", async () => {
|
|
165
|
+
const column = mockTextColumn(
|
|
166
|
+
Filter.text({ operator: "in", values: ["a", "b"] }),
|
|
167
|
+
);
|
|
168
|
+
const calculateTopKRows = vi.fn(async () => ({
|
|
169
|
+
data: [["a", 1] as [unknown, number]],
|
|
170
|
+
}));
|
|
171
|
+
render(
|
|
172
|
+
<TextFilterMenu column={column} calculateTopKRows={calculateTopKRows} />,
|
|
173
|
+
);
|
|
174
|
+
expect(
|
|
175
|
+
await screen.findByPlaceholderText(/Search or add a value/i),
|
|
176
|
+
).toBeInTheDocument();
|
|
177
|
+
expect(screen.queryByPlaceholderText("Text...")).not.toBeInTheDocument();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("selecting is_empty hides the value UI and commits on Apply", () => {
|
|
181
|
+
const column = mockTextColumn();
|
|
182
|
+
render(<TextFilterMenu column={column} />);
|
|
183
|
+
fireEvent.click(screen.getByRole("combobox"));
|
|
184
|
+
const listbox = screen.getByRole("listbox");
|
|
185
|
+
fireEvent.click(within(listbox).getByText("Is empty"));
|
|
186
|
+
expect(column.setFilterValue).not.toHaveBeenCalled();
|
|
187
|
+
expect(screen.queryByPlaceholderText("Text...")).not.toBeInTheDocument();
|
|
188
|
+
fireEvent.click(screen.getByRole("button", { name: /apply/i }));
|
|
189
|
+
expect(column.setFilterValue).toHaveBeenCalledWith(
|
|
190
|
+
Filter.text({ operator: "is_empty" }),
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it("apply is disabled when scalar text is empty", () => {
|
|
195
|
+
const column = mockTextColumn();
|
|
196
|
+
render(<TextFilterMenu column={column} />);
|
|
197
|
+
expect(screen.getByRole("button", { name: /apply/i })).toBeDisabled();
|
|
198
|
+
fireEvent.change(screen.getByPlaceholderText("Text..."), {
|
|
199
|
+
target: { value: "x" },
|
|
200
|
+
});
|
|
201
|
+
expect(screen.getByRole("button", { name: /apply/i })).not.toBeDisabled();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import type { Column } from "@tanstack/react-table";
|
|
3
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
4
|
+
import { beforeAll, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { FilterByValuesList } from "../filter-by-values-picker";
|
|
6
|
+
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
global.HTMLElement.prototype.scrollIntoView = () => {
|
|
9
|
+
// jsdom does not implement scrollIntoView; cmdk calls it on selection.
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
function mockColumn(): Column<unknown, unknown> {
|
|
14
|
+
return {
|
|
15
|
+
id: "name",
|
|
16
|
+
columnDef: { meta: { dataType: "string" } },
|
|
17
|
+
} as unknown as Column<unknown, unknown>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function calculateTopK() {
|
|
21
|
+
return {
|
|
22
|
+
data: [
|
|
23
|
+
["alice", 3],
|
|
24
|
+
["bob", 1],
|
|
25
|
+
] as Array<[string, number]>,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe("FilterByValuesList — creatable", () => {
|
|
30
|
+
it("shows '+ Add \"X\"' item when creatable and query is non-empty", async () => {
|
|
31
|
+
const onChange = vi.fn();
|
|
32
|
+
render(
|
|
33
|
+
<FilterByValuesList
|
|
34
|
+
column={mockColumn()}
|
|
35
|
+
calculateTopKRows={calculateTopK}
|
|
36
|
+
chosenValues={new Set()}
|
|
37
|
+
onChange={onChange}
|
|
38
|
+
creatable={true}
|
|
39
|
+
/>,
|
|
40
|
+
);
|
|
41
|
+
await screen.findByText("alice");
|
|
42
|
+
const input = screen.getByPlaceholderText(/Search or add/i);
|
|
43
|
+
fireEvent.change(input, { target: { value: "carol" } });
|
|
44
|
+
expect(await screen.findByText(/\+ Add "carol"/)).toBeInTheDocument();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("commits the literal when '+ Add' is selected", async () => {
|
|
48
|
+
const onChange = vi.fn();
|
|
49
|
+
render(
|
|
50
|
+
<FilterByValuesList
|
|
51
|
+
column={mockColumn()}
|
|
52
|
+
calculateTopKRows={calculateTopK}
|
|
53
|
+
chosenValues={new Set()}
|
|
54
|
+
onChange={onChange}
|
|
55
|
+
creatable={true}
|
|
56
|
+
/>,
|
|
57
|
+
);
|
|
58
|
+
await screen.findByText("alice");
|
|
59
|
+
const input = screen.getByPlaceholderText(/Search or add/i);
|
|
60
|
+
fireEvent.change(input, { target: { value: "carol" } });
|
|
61
|
+
fireEvent.click(await screen.findByText(/\+ Add "carol"/));
|
|
62
|
+
expect(onChange).toHaveBeenCalledWith(["carol"]);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("Enter key in creatable mode commits the query as a value", async () => {
|
|
66
|
+
const onChange = vi.fn();
|
|
67
|
+
render(
|
|
68
|
+
<FilterByValuesList
|
|
69
|
+
column={mockColumn()}
|
|
70
|
+
calculateTopKRows={calculateTopK}
|
|
71
|
+
chosenValues={new Set()}
|
|
72
|
+
onChange={onChange}
|
|
73
|
+
creatable={true}
|
|
74
|
+
/>,
|
|
75
|
+
);
|
|
76
|
+
await screen.findByText("alice");
|
|
77
|
+
const input = screen.getByPlaceholderText(/Search or add/i);
|
|
78
|
+
fireEvent.change(input, { target: { value: "dave" } });
|
|
79
|
+
fireEvent.keyDown(input, { key: "Enter" });
|
|
80
|
+
expect(onChange).toHaveBeenCalledWith(["dave"]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("does NOT show '+ Add' when creatable is false", async () => {
|
|
84
|
+
render(
|
|
85
|
+
<FilterByValuesList
|
|
86
|
+
column={mockColumn()}
|
|
87
|
+
calculateTopKRows={calculateTopK}
|
|
88
|
+
chosenValues={new Set()}
|
|
89
|
+
onChange={vi.fn()}
|
|
90
|
+
creatable={false}
|
|
91
|
+
/>,
|
|
92
|
+
);
|
|
93
|
+
await screen.findByText("alice");
|
|
94
|
+
const input = screen.getByPlaceholderText(/Search among/i);
|
|
95
|
+
fireEvent.change(input, { target: { value: "carol" } });
|
|
96
|
+
expect(screen.queryByText(/\+ Add/)).not.toBeInTheDocument();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("renders chosen values that are not in top-K with — count", async () => {
|
|
100
|
+
render(
|
|
101
|
+
<FilterByValuesList
|
|
102
|
+
column={mockColumn()}
|
|
103
|
+
calculateTopKRows={calculateTopK}
|
|
104
|
+
chosenValues={new Set(["zara"])}
|
|
105
|
+
onChange={vi.fn()}
|
|
106
|
+
/>,
|
|
107
|
+
);
|
|
108
|
+
await screen.findByText("alice");
|
|
109
|
+
expect(screen.getByText("zara")).toBeInTheDocument();
|
|
110
|
+
expect(screen.getByText("—")).toBeInTheDocument();
|
|
111
|
+
});
|
|
112
|
+
});
|