efficient-shell 12.27.0 → 12.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Browser-6YRO47YI.js → Browser-PC45PVTN.js} +16 -16
- package/dist/{Calculator-LSDVIJVQ.js → Calculator-5TRNFPY4.js} +21 -21
- package/dist/{CurrencyConverter-G5IYUCN7.js → CurrencyConverter-BB4QWNER.js} +6 -6
- package/dist/Files-BKEREVQK.js +141 -0
- package/dist/{Notepad-EHISTRGJ.js → Notepad-BLUA2254.js} +8 -8
- package/dist/{PdfViewer-UY5SRC63.js → PdfViewer-4YLDY4JY.js} +1 -1
- package/dist/{PomodoroTimer-SFTPXEDV.js → PomodoroTimer-KIJKDHVO.js} +6 -6
- package/dist/{Preview-L4RT7TBC.js → Preview-JVL2N5GN.js} +13 -13
- package/dist/Sidebar-SAGLPIOC.js +44 -0
- package/dist/{Stock-YCPMLYPR.js → Stock-JQEJMIMG.js} +3 -3
- package/dist/{Weather-TLFNIPDG.js → Weather-FAQX55XL.js} +16 -16
- package/dist/{WorldClock-66IRFS2W.js → WorldClock-YSZNGEL2.js} +6 -6
- package/dist/ai/index.d.ts +155 -6
- package/dist/ai/index.js +116 -98
- package/dist/ai.css +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/FlowChart.js +1 -1
- package/dist/{chunk-34TQBJ7I.js → chunk-2OUAPOLK.js} +1 -1
- package/dist/chunk-2SGOKMUU.js +13 -0
- package/dist/{chunk-3CKYFCX4.js → chunk-34L5SRM7.js} +17 -17
- package/dist/chunk-3DSGJIC7.js +7 -0
- package/dist/{chunk-CALBDO7B.js → chunk-3FBXJO77.js} +1 -1
- package/dist/{chunk-DK5SXOXJ.js → chunk-47UH3D4B.js} +1 -1
- package/dist/{chunk-7LTU5TJD.js → chunk-4EFIUJ7X.js} +1 -1
- package/dist/{chunk-AQCUGTOR.js → chunk-56XCGOX5.js} +6 -6
- package/dist/{chunk-LBKKKZ4M.js → chunk-63IGYBCQ.js} +2 -2
- package/dist/chunk-64J7TYJ3.js +4 -0
- package/dist/{chunk-3JL4TCA7.js → chunk-6KOMF6WL.js} +1 -1
- package/dist/{chunk-RY7JCGLI.js → chunk-6Q7L32LL.js} +1 -1
- package/dist/{chunk-VLMBXPRM.js → chunk-7GJIIBJD.js} +1 -1
- package/dist/{chunk-DCCYUCBM.js → chunk-7NO4IENQ.js} +1 -1
- package/dist/{chunk-I7JU4IU3.js → chunk-7TNZ3DTT.js} +2 -2
- package/dist/{chunk-KP2JYXEU.js → chunk-AFWLCXQD.js} +9 -9
- package/dist/{chunk-34EBBZFK.js → chunk-AMIMNRYU.js} +1 -1
- package/dist/chunk-ASDYAASN.js +3 -0
- package/dist/{chunk-N3R6N7LG.js → chunk-ATZ262BR.js} +1 -1
- package/dist/{chunk-KZRZYLN7.js → chunk-BC4FE77W.js} +49 -49
- package/dist/chunk-BFRGDRFK.js +23 -0
- package/dist/{chunk-CCK2UWQ5.js → chunk-BKYRHQK2.js} +10 -10
- package/dist/{chunk-X34ZBXIU.js → chunk-BT2YPDQL.js} +3 -3
- package/dist/{chunk-YW3UKSON.js → chunk-CON5NRCO.js} +2 -2
- package/dist/{chunk-4ZRGMK7Y.js → chunk-DIHHV6T6.js} +1 -1
- package/dist/{chunk-N32LNPPP.js → chunk-EATV7FMU.js} +8 -8
- package/dist/{chunk-JN5NUZ6D.js → chunk-EWVE5XG6.js} +1 -1
- package/dist/chunk-FFUTSMF5.js +28 -0
- package/dist/{chunk-THLXDI76.js → chunk-GOAFMGUI.js} +10 -10
- package/dist/{chunk-MEN4B6NP.js → chunk-H2CPT6K3.js} +10 -10
- package/dist/{chunk-3J3FBYIZ.js → chunk-HLE4LTRU.js} +1 -1
- package/dist/{chunk-Y523KUQC.js → chunk-HNEI2RKX.js} +1 -1
- package/dist/{chunk-Z3CTYK3U.js → chunk-HSUTZCRT.js} +1 -1
- package/dist/{chunk-UR2ECNBB.js → chunk-HVYXJLAV.js} +1 -1
- package/dist/chunk-IATKDC52.js +9 -0
- package/dist/{chunk-G2Y5I5OR.js → chunk-IB3LLQZC.js} +1 -1
- package/dist/{chunk-XZXFUZIK.js → chunk-ISVODSRP.js} +6 -3
- package/dist/chunk-JJ2OXUK7.js +14 -0
- package/dist/{chunk-QMSINDXL.js → chunk-JLRF6FN7.js} +1 -1
- package/dist/{chunk-BZHP645G.js → chunk-K5PDLRYH.js} +8 -8
- package/dist/{chunk-GLRRX4AL.js → chunk-K5YT5PMJ.js} +1 -1
- package/dist/{chunk-SY66VJAI.js → chunk-KTO427N3.js} +1 -1
- package/dist/{chunk-6GWYFUME.js → chunk-LAO6GLBY.js} +6 -6
- package/dist/{chunk-KZHVKSNF.js → chunk-LL4KF43W.js} +1 -1
- package/dist/{chunk-FQ4IRBMA.js → chunk-MKNDDB6U.js} +1 -1
- package/dist/{chunk-4ZLFAXOC.js → chunk-MTYEY7HT.js} +11 -11
- package/dist/{chunk-ILDPJ26Y.js → chunk-N2FX4O3H.js} +1 -1
- package/dist/{chunk-WBGJ4XB7.js → chunk-N5RV73CI.js} +4 -4
- package/dist/{chunk-CJHYOHMU.js → chunk-NN32QUCE.js} +1 -1
- package/dist/{chunk-KBI3T6UC.js → chunk-O4YKOS74.js} +1 -1
- package/dist/{chunk-VQ4X3OBR.js → chunk-OMFYTCBI.js} +1 -1
- package/dist/{chunk-YRY64DQV.js → chunk-OXRQIWRT.js} +1 -1
- package/dist/{chunk-6RK6R3RY.js → chunk-PT4GMPUB.js} +1 -1
- package/dist/{chunk-PLPMCE44.js → chunk-QB2GJNGB.js} +9 -9
- package/dist/{chunk-GEZM6ARD.js → chunk-QIPO4EVJ.js} +1 -1
- package/dist/{chunk-6FZ5JTBY.js → chunk-QMBMK6PP.js} +2 -2
- package/dist/{chunk-TOVEZAIM.js → chunk-QOYKBINM.js} +1 -1
- package/dist/{chunk-63TCQAGE.js → chunk-RVVQDBV7.js} +5 -5
- package/dist/{chunk-OM42AUMS.js → chunk-S6AN76R3.js} +1 -1
- package/dist/{chunk-B4GRHE44.js → chunk-SS3CROPR.js} +3 -3
- package/dist/{chunk-676TKVDM.js → chunk-TDXRG43I.js} +1 -1
- package/dist/{chunk-T2TZBTSM.js → chunk-TKIYZE7V.js} +1 -1
- package/dist/{chunk-FD6DJRD4.js → chunk-UEFIUTOU.js} +1 -1
- package/dist/chunk-UFM4YBZ7.js +1 -0
- package/dist/{chunk-436PJFHC.js → chunk-UH5ZGWSA.js} +10 -10
- package/dist/{chunk-FTMCNC66.js → chunk-UZFFSZFI.js} +1 -1
- package/dist/{chunk-3E3LR2PM.js → chunk-V3XS6BTJ.js} +13 -13
- package/dist/{chunk-YIUWX2IU.js → chunk-VLBIM33E.js} +5 -5
- package/dist/{chunk-QZCLHKCI.js → chunk-VLKJN6HX.js} +10 -10
- package/dist/{chunk-QG37GJP2.js → chunk-WBAWJIVM.js} +4 -4
- package/dist/{chunk-QPSJYSET.js → chunk-WKYNPGFB.js} +5 -5
- package/dist/{chunk-JGRDG7CB.js → chunk-WN3JHPJI.js} +6 -6
- package/dist/{chunk-XHZVUO6F.js → chunk-WX2Q76WC.js} +6 -6
- package/dist/{chunk-DMEP2SCP.js → chunk-X5MUSNKH.js} +3 -3
- package/dist/{chunk-YI6SYUAK.js → chunk-XAEI36TW.js} +1 -1
- package/dist/{chunk-H6WXTJOT.js → chunk-XAF5ZI7H.js} +1 -1
- package/dist/{chunk-TM4CRQ3W.js → chunk-XMY2HKVD.js} +15 -15
- package/dist/{chunk-SSNTJ3M4.js → chunk-XSVQ5V7L.js} +9 -9
- package/dist/chunk-Y4FWTYZS.js +6 -0
- package/dist/{chunk-HMT3MES3.js → chunk-YWNHK6Z5.js} +18 -18
- package/dist/{chunk-LPPJNZQ6.js → chunk-YYGJJ6EI.js} +1 -1
- package/dist/{chunk-R62JKPYY.js → chunk-Z2Z653OO.js} +1 -1
- package/dist/{chunk-L543DFHF.js → chunk-ZBJ7FTA5.js} +1 -1
- package/dist/{chunk-OLCRYT3N.js → chunk-ZGCCV4WE.js} +10 -10
- package/dist/data/EntityList.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Calendar.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/Input.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/RenameField.js +1 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/UnitMenu.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/mediaLibraryMenu.js +1 -1
- package/dist/forms/textAlign.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.js +494 -494
- package/dist/map/index.js +5 -5
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/Banner.js +1 -1
- package/dist/shell/Breadcrumbs.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/EmptyState.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/PageHeader.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/Result.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/StepChain.js +1 -1
- package/dist/shell/Stepper.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/shell/discardGuard.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Files-K7H7WHRS.js +0 -141
- package/dist/Sidebar-BKNCPUOE.js +0 -44
- package/dist/chunk-BM2QIV64.js +0 -23
- package/dist/chunk-D2WJAF62.js +0 -4
- package/dist/chunk-INADSWOF.js +0 -28
- package/dist/chunk-LCEQIFPK.js +0 -3
- package/dist/chunk-OQ6TECLX.js +0 -6
- package/dist/chunk-SFULX4E3.js +0 -7
- package/dist/chunk-TUPPFC74.js +0 -14
- package/dist/chunk-UP4HLGMZ.js +0 -9
- package/dist/chunk-VABHQDN5.js +0 -1
- package/dist/chunk-ZQ24H5UO.js +0 -13
- /package/dist/{chunk-5WK56FA3.js → chunk-TGLUENXE.js} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{Calendar as e}from"./chunk-BKYRHQK2.js";import{toDateKey as t,fromDateKey as r,toMonthKey as n}from"./chunk-2HMNOLKX.js";import{END_ACTIONS_PAD as a,InputEndActionSlot as o,InputEndActionButton as l}from"./chunk-PT4GMPUB.js";import{FILTER_ON as i,FILTER_ON_INK as s,FILTER_OFF as c}from"./chunk-AYZY3YNC.js";import{calendarNames as d}from"./chunk-Y3JW2GW5.js";import{pad2 as m}from"./chunk-LF27WIN2.js";import{Icon as u}from"./chunk-ISVODSRP.js";import{onOverlayOpen as h}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as p}from"./chunk-62LW225J.js";import{useDropdownPosition as f}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as g}from"./chunk-D65T4H6J.js";import{buttonClasses as b}from"./chunk-UQYNPYF4.js";import{glassStyle as x}from"./chunk-5FYDNH4Y.js";import{useShellStrings as v,useShellLocale as y}from"./chunk-JSHMIMAJ.js";import{useState as w,useRef as k,useId as N,useEffect as M}from"react";import{createPortal as C}from"react-dom";import{jsxs as j,Fragment as D,jsx as W}from"react/jsx-runtime";var $=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],Y=t;function S(e,r){const n=r.getFullYear(),a=r.getMonth(),o=new Date(n,a,r.getDate()),l=new Date(n,a,0),i=e=>new Date(n,a-e,1);switch(e){case"last2Weeks":return{from:t(new Date(n,a,r.getDate()-14)),to:t(o)};case"lastMonth":return{from:t(i(1)),to:t(l)};case"last3Months":return{from:t(i(3)),to:t(l)};case"last6Months":return{from:t(i(6)),to:t(l)};case"last12Months":return{from:t(i(12)),to:t(l)}}}function F(e,t,r){const a=n(e);return t&&a<t.slice(0,7)?t.slice(0,7):r&&a>r.slice(0,7)?r.slice(0,7):a}function H(e){const t=r(e);return t?`${m(t.getDate())}/${m(t.getMonth()+1)}/${t.getFullYear()}`:e}var O=/* @__PURE__ */new Map;function B({from:t,to:n,onChange:m,formatDisplay:Y,clearable:B,required:L=!1,name:J,id:R,"aria-labelledby":T,"aria-label":G,weekStartsOn:I,placeholder:P,fullWidth:U=!1,min:A,max:E,disabled:q=!1,allowOpenEnd:K=!1}){const Q=v().dateRange,V=y(),Z=Y??(V?function(e){let t=O.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),O.set(e,t));const n=t;return e=>{const t=r(e);return t?n.format(new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))):e}}(V):H),z=P??Q.placeholder,X=B??!L,[_,ee]=w(!1),[te,re]=w(t),[ne,ae]=w(n),[oe,le]=w(null),[ie,se]=w("from"),ce=k(null),de=k(null),me=k(null),ue=N(),he=N(),pe=N(),[fe,ge]=w(!1),be=f(ce,_,{preferredMaxWidth:520,preferredMaxHeight:fe?720:560,popupRef:me}),xe=k(null),ve=k(null),[ye,we]=w(!0);g(()=>{const e=ve.current;if(!_||!fe||!e)return;const t=getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length||1,r=parseFloat(getComputedStyle(e).columnGap)||0,n=(e.clientWidth-r*(t-1))/t,a=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=n+.5;a!==ye&&we(a)});const ke=k(null);g(()=>{const e=me.current;if(!_||!be||!e)return;const t=getComputedStyle(e),r=be.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(fe)null!==ke.current&&ke.current<=r&&ge(!1);else{const e=xe.current?.offsetWidth??0;if(0===e)return;ke.current=e,e>r+.5&&ge(!0)}});const[Ne,Me]=w(!1);g(()=>{const e=!!R&&(de.current?.labels?.length??0)>0;e!==Ne&&Me(e)});const Ce=!!G||!!T||Ne,je=/* @__PURE__ */new Date,[De,We]=w(()=>t?t.slice(0,7):F(je,A,E)),$e=$.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(S(e,je),A,E)),Ye=e=>e?Z(e):"";M(()=>{if(!_)return;const e=e=>{const t=e.target;ce.current?.contains(t)||me.current?.contains(t)||ee(!1)};document.addEventListener("mousedown",e);const t=h(()=>ee(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[_]),M(()=>{q&&ee(!1)},[q]);const Se=()=>{m("",""),ee(!1)},Fe=X&&!q&&Boolean(t||n),He=t&&n?`${Ye(t)} — ${Ye(n)}`:t?Q.fromOnly(Ye(t)):n?Q.toOnly(Ye(n)):"",Oe=d(V),Be=e=>{const t=r(e);return t?Oe.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},Le=t&&n?Q.range(Be(t),Be(n)):t?Q.fromOnly(Be(t)):n?Q.toOnly(Be(n)):z,Je=e=>fe?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(oe===e?"border-blue-300 bg-accent-tint text-blue-700 font-medium":"border-line text-ink hover:bg-row-hover"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(oe===e?"bg-accent-tint text-blue-700 font-medium":"text-ink hover:bg-row-hover"),Re=/* @__PURE__ */j(D,{children:[$e.map(e=>/* @__PURE__ */W("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=S(e,je);re(t.from),ae(t.to),le(e),We(t.from.slice(0,7))})(e),className:Je(e),"aria-label":fe?Q[e]:void 0,children:fe?ye?Q[e]:Q[`${e}Short`]:Q[e]},e)),
|
|
2
|
+
/* @__PURE__ */W("button",{type:"button",onClick:()=>le("Custom"),className:Je("Custom"),children:Q.custom})]}),Te=(e,t)=>K?/* @__PURE__ */W("button",{type:"button","data-range-end":e,"aria-pressed":ie===e,onClick:()=>se(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */W("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Ge=e=>K&&ie===e?" ring-1 ring-blue-400":"",Ie=
|
|
3
|
+
/* @__PURE__ */W(e,{mode:"range",min:A,max:E,value:te||null,endValue:ne||null,month:De,onMonthChange:We,onSelect:e=>{le("Custom"),K?"from"===ie?(ne&&e>ne?(re(ne),ae(e)):re(e),se("to")):te&&e<te?(ae(te),re(e)):ae(e):!te||te&&ne?(re(e),ae("")):e<te?(ae(te),re(e)):ae(e)},weekStartsOn:I,"aria-label":Q.dialog});/* @__PURE__ */
|
|
4
|
+
return j("div",{className:"relative"+(U?" w-full":""),ref:ce,children:[
|
|
5
|
+
/* @__PURE__ */j("div",{className:`relative ${U?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 ${Fe?a[1]:""} text-sm focus-within:border-blue-500 has-focus-visible:ring-1 has-focus-visible:ring-[color:var(--rosh-focus-ring-deep)] ${t||n?`${i} ${s}`:c}${q?" cursor-not-allowed opacity-60":""}`,children:[
|
|
6
|
+
/* @__PURE__ */j("button",{ref:de,type:"button",onClick:()=>{q||(re(t),ae(n),le(null),se(t&&!n?"to":"from"),We(t?t.slice(0,7):F(je,A,E)),ee(!0))},"aria-haspopup":"dialog","aria-expanded":_,id:R,disabled:q||void 0,"aria-label":G,"aria-labelledby":T,"aria-describedby":[Ce?he:void 0,L?pe:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":_?ue:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(U?" min-w-0 flex-1 justify-start":""),children:[
|
|
7
|
+
/* @__PURE__ */W(u,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
|
|
8
|
+
/* @__PURE__ */W("span",{className:"truncate",children:He||z})]}),Fe&&/* @__PURE__ */W(o,{children:/* @__PURE__ */W(l,{action:{label:Q.clearRange,icon:/* @__PURE__ */W(u,{name:"close"}),onClick:Se}})})]}),Ce&&/* @__PURE__ */W("span",{id:he,className:"sr-only",children:Le}),L&&/* @__PURE__ */W("span",{id:pe,className:"sr-only",children:Q.required}),J&&/* @__PURE__ */j(D,{children:[
|
|
9
|
+
/* @__PURE__ */W("input",{type:"hidden",name:J.from,value:t,disabled:q||void 0}),
|
|
10
|
+
/* @__PURE__ */W("input",{type:"hidden",name:J.to,value:n,disabled:q||void 0})]}),_&&C(
|
|
11
|
+
/* @__PURE__ */j("div",{ref:me,id:ue,role:"dialog","aria-label":Q.dialog,"data-layout":fe?"stacked":"side",className:"fixed rounded-(--radius-popup) p-4",style:{zIndex:p.popup,left:be?.left,right:be?.right,top:be?.top,bottom:be?.bottom,width:fe&&be?be.maxWidth:"max-content",maxWidth:be?.maxWidth,maxHeight:be?.maxHeight,overflowY:"auto",visibility:be?void 0:"hidden",...x()},children:[
|
|
12
|
+
/* @__PURE__ */j("div",{className:fe?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[Te("from",/* @__PURE__ */j(D,{children:[
|
|
13
|
+
/* @__PURE__ */W("span",{className:"text-xs font-medium text-gray-500",children:Q.from}),
|
|
14
|
+
/* @__PURE__ */W("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${te?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ge("from")}`,children:te?Ye(te):Q.start})]})),!fe&&/* @__PURE__ */W("span",{className:"text-gray-300",children:"—"}),Te("to",/* @__PURE__ */j(D,{children:[
|
|
15
|
+
/* @__PURE__ */W("span",{className:"text-xs font-medium text-gray-500",children:Q.to}),
|
|
16
|
+
/* @__PURE__ */W("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${ne?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ge("to")}`,children:ne?Ye(ne):Q.end})]}))]}),fe?/* @__PURE__ */j(D,{children:[$e.length>0&&/* @__PURE__ */j("div",{className:"mb-3 @container",children:[!ye&&/* @__PURE__ */W("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:Q.lastHeading}),
|
|
17
|
+
/* @__PURE__ */j("div",{ref:ve,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Re,$e.map(e=>/* @__PURE__ */W("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:Q[e]},e))]})]}),
|
|
18
|
+
/* @__PURE__ */W("div",{className:"w-full",children:Ie})]}):
|
|
19
|
+
/* @__PURE__ */j("div",{ref:xe,className:"flex w-max gap-4",children:[
|
|
20
|
+
/* @__PURE__ */W("div",{className:"w-64",children:Ie}),$e.length>0&&/* @__PURE__ */W("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Re})]}),
|
|
21
|
+
/* @__PURE__ */j("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[X&&/* @__PURE__ */W("button",{type:"button",onClick:Se,className:b({variant:"ghost"}),children:Q.clear}),
|
|
22
|
+
/* @__PURE__ */W("button",{type:"button",onClick:()=>ee(!1),className:b({variant:"secondary"}),children:Q.cancel}),
|
|
23
|
+
/* @__PURE__ */W("button",{type:"button",onClick:()=>{m(te,ne),ee(!1)},disabled:K?!te&&!ne:!te||!ne,className:b({variant:"primary"}),children:Q.apply})]})]}),document.body)]})}export{B as DateRangePicker,S as presetRange,Y as toISODate};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{fromDateKey as e,toMonthKey as t,toDateKey as r,fromMonthKey as a}from"./chunk-2HMNOLKX.js";import{calendarNames as n,firstDayOfWeek as o}from"./chunk-Y3JW2GW5.js";import{Icon as l}from"./chunk-
|
|
1
|
+
import{fromDateKey as e,toMonthKey as t,toDateKey as r,fromMonthKey as a}from"./chunk-2HMNOLKX.js";import{calendarNames as n,firstDayOfWeek as o}from"./chunk-Y3JW2GW5.js";import{Icon as l}from"./chunk-ISVODSRP.js";import{useBrowserValue as i}from"./chunk-D65T4H6J.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-JSHMIMAJ.js";import{useMemo as g,useState as u,useRef as d,useEffect as h}from"react";import{jsxs as m,jsx as f,Fragment as b}from"react/jsx-runtime";var y="grid grid-cols-[repeat(7,minmax(0,40px))] sm:grid-cols-[repeat(7,minmax(0,32px))] justify-center gap-1";var v=()=>r(/* @__PURE__ */new Date);var p=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),x=(e,t)=>{const r=new Date(e.getFullYear(),e.getMonth()+t,1),a=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();return new Date(r.getFullYear(),r.getMonth(),Math.min(e.getDate(),a))};function w({value:w,endValue:M,mode:D="single",onSelect:N,min:Y,max:k,month:F,defaultMonth:j,onMonthChange:A,weekStartsOn:S,quickJump:C=!0,markedDates:J,readOnly:P=!1,"aria-label":q,className:H=""}){const K=g(()=>new Set(J??[]),[J]),O=e(w),W=i(v,null),I=e(W),$=s().calendar,E=c(),L=n(E),R=i(()=>o(E),0),U=S??R,V=()=>{if(!I)return null;const e=t(I);return Y&&e<Y.slice(0,7)?Y.slice(0,7):k&&e>k.slice(0,7)?k.slice(0,7):e},[B,G]=u(()=>j||(O?t(O):V())),T=F??B??V(),X=null===T?null:function(e,t){return a(e)??t}(T,I),[z,Q]=u(()=>w??W),Z=d(null),_=d(!1),[ee,te]=u("days"),re=g(()=>X?function(e,t){const r=new Date(e.getFullYear(),e.getMonth(),1),a=(r.getDay()-t+7)%7,n=new Date(r.getFullYear(),r.getMonth(),1-a);return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),n.getDate()+t))}(X,U):[],[T,U]),ae=e=>!!Y&&e<Y||!!k&&e>k,ne=z??W,oe=re.some(e=>r(e)===ne),le=X?re.find(e=>e.getMonth()===X.getMonth())??re[0]:null,ie=oe&&ne?ne:le?r(le):"";if(h(()=>{_.current&&(_.current=!1,Z.current?.querySelector('[data-active="true"]')?.focus())},[ie,T]),!X)/* @__PURE__ */
|
|
2
2
|
return m("div",{className:H,"aria-hidden":"true","data-calendar-pending":"",children:[
|
|
3
3
|
/* @__PURE__ */f("div",{className:"mb-2 h-6"}),
|
|
4
|
-
/* @__PURE__ */f("div",{className:"space-y-1",children:Array.from({length:7},(e,t)=>/* @__PURE__ */f("div",0===t?{className:"py-1 text-xs",children:" "}:{className:y,children:/* @__PURE__ */f("span",{className:"aspect-square"})},t))})]});const se=e=>"years"===ee?new Date(
|
|
4
|
+
/* @__PURE__ */f("div",{className:"space-y-1",children:Array.from({length:7},(e,t)=>/* @__PURE__ */f("div",0===t?{className:"py-1 text-xs",children:" "}:{className:y,children:/* @__PURE__ */f("span",{className:"aspect-square"})},t))})]});const se=e=>"years"===ee?new Date(X.getFullYear()+12*e,X.getMonth(),1):"months"===ee?new Date(X.getFullYear()+e,X.getMonth(),1):x(X,e),ce=e=>{const r=t(e);void 0===F&&G(r),A?.(r)},ge=q??L.monthYear(X.getFullYear(),X.getMonth());/* @__PURE__ */
|
|
5
5
|
return m("div",{className:H,children:[
|
|
6
6
|
/* @__PURE__ */m("div",{className:"mb-2 flex items-center justify-between px-1",children:[
|
|
7
|
-
/* @__PURE__ */f("button",{type:"button","aria-label":"years"===ee
|
|
8
|
-
/* @__PURE__ */f("div",{"aria-live":"polite",className:"flex items-center gap-1 text-sm font-semibold text-gray-800",children:
|
|
9
|
-
/* @__PURE__ */f("button",{type:"button","aria-label"
|
|
10
|
-
/* @__PURE__ */f("button",{type:"button","aria-label":"years"===ee
|
|
11
|
-
/* @__PURE__ */m("div",{ref:
|
|
12
|
-
/* @__PURE__ */f("div",{role:"row",className:`${y} text-center text-xs font-medium text-ink-faint`,children:Array.from({length:7},(e,t)=>(t+
|
|
13
|
-
/* @__PURE__ */f("div",{role:"columnheader","aria-label"
|
|
14
|
-
return f("div",{role:"gridcell","aria-selected":n,"aria-label":
|
|
7
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":"years"===ee?$.previousYears:"months"===ee?$.previousYear:$.previousMonth,onClick:()=>ce(se(-1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */f(l,{name:"chevron-left",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})}),
|
|
8
|
+
/* @__PURE__ */f("div",{"aria-live":"polite",className:"flex items-center gap-1 text-sm font-semibold text-gray-800",children:C?/* @__PURE__ */m(b,{children:["years"!==ee&&/* @__PURE__ */f("button",{type:"button","aria-label":$.chooseMonth(L.months[X.getMonth()]),onClick:()=>te(e=>"months"===e?"days":"months"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:L.months[X.getMonth()]}),
|
|
9
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":$.chooseYear(X.getFullYear()),onClick:()=>te(e=>"years"===e?"days":"years"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:X.getFullYear()})]}):/* @__PURE__ */f("span",{children:L.monthYear(X.getFullYear(),X.getMonth())})}),
|
|
10
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":"years"===ee?$.nextYears:"months"===ee?$.nextYear:$.nextMonth,onClick:()=>ce(se(1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */f(l,{name:"chevron-right",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})})]}),"months"===ee&&/* @__PURE__ */f("div",{role:"group","aria-label":$.monthPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:L.monthsShort.map((e,t)=>/* @__PURE__ */f("button",{type:"button","aria-pressed":t===X.getMonth(),onClick:()=>{ce(new Date(X.getFullYear(),t,1)),te("days")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",t===X.getMonth()?"bg-blue-600 font-semibold text-white":I&&t===I.getMonth()&&X.getFullYear()===I.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),"years"===ee&&/* @__PURE__ */f("div",{role:"group","aria-label":$.yearPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Array.from({length:12},(e,t)=>{return r=X.getFullYear(),12*Math.floor(r/12)+t;var r}).map(e=>/* @__PURE__ */f("button",{type:"button","aria-pressed":e===X.getFullYear(),onClick:()=>{ce(new Date(e,X.getMonth(),1)),te("months")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",e===X.getFullYear()?"bg-blue-600 font-semibold text-white":e===I?.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),
|
|
11
|
+
/* @__PURE__ */m("div",{ref:Z,role:"grid","aria-label":ge,className:"space-y-1","aria-readonly":P||void 0,onKeyDown:a=>{const n=e(ie)??I??X,o={ArrowLeft:()=>p(n,-1),ArrowRight:()=>p(n,1),ArrowUp:()=>p(n,-7),ArrowDown:()=>p(n,7),Home:()=>p(n,-(n.getDay()-U+7)%7),End:()=>p(n,6-(n.getDay()-U+7)%7),PageUp:()=>x(n,a.shiftKey?-12:-1),PageDown:()=>x(n,a.shiftKey?12:1)};if(o[a.key])return a.preventDefault(),l=o[a.key](),_.current=!0,Q(r(l)),void(t(l)!==T&&ce(l));var l;"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),P||ae(ie)||N(ie))},hidden:"days"!==ee,children:[
|
|
12
|
+
/* @__PURE__ */f("div",{role:"row",className:`${y} text-center text-xs font-medium text-ink-faint`,children:Array.from({length:7},(e,t)=>(t+U)%7).map(e=>
|
|
13
|
+
/* @__PURE__ */f("div",{role:"columnheader","aria-label":L.weekdays[e],className:"py-1",children:/* @__PURE__ */f("abbr",{title:L.weekdays[e],className:"no-underline",children:L.weekdaysShort[e]})},e))}),Array.from({length:6},(e,t)=>/* @__PURE__ */f("div",{role:"row",className:`${y} text-center text-sm`,children:re.slice(7*t,7*t+7).map(e=>{const t=r(e),a=e.getMonth()!==X.getMonth(),n=t===w||"range"===D&&t===M,o=(e=>!("range"!==D||!w||!M)&&e>w&&e<M)(t),l=ae(t),i=L.longDate(e.getFullYear(),e.getMonth(),e.getDate()),s=e=>["relative w-full aspect-square rounded-md transition-colors",e?"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",l?"cursor-not-allowed text-gray-300":n?"bg-accent-fill font-semibold text-on-accent":o?"bg-accent-tint-strong text-blue-800":a?"text-ink-faint"+(e?" hover:bg-gray-100":""):"text-ink"+(e?" hover:bg-gray-100":""),t!==W||n?"":"font-semibold text-blue-600"].filter(Boolean).join(" "),c=K.has(t)&&/* @__PURE__ */f("span",{"data-marked":"","aria-hidden":"true",className:"absolute bottom-1 left-1/2 h-1 w-1 -translate-x-1/2 rounded-full "+(n?"bg-surface":a?"bg-gray-400":"bg-blue-500")});/* @__PURE__ */
|
|
14
|
+
return f("div",{role:"gridcell","aria-selected":n,"aria-label":P?i:void 0,children:P?/* @__PURE__ */m("span",{"aria-hidden":"true",className:`grid place-items-center ${s(!1)}`,children:[e.getDate(),c]}):/* @__PURE__ */m("button",{type:"button","data-active":t===ie,tabIndex:t===ie?0:-1,disabled:l,"aria-label":i,"aria-current":t===W?"date":void 0,onClick:()=>{Q(t),N(t)},className:s(!0),children:[e.getDate(),c]})},t)})},t))]})]})}export{w as Calendar};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Popover as e}from"./chunk-64RHGJXK.js";import{IconButton_default as r}from"./chunk-SV5RRBVA.js";import{Icon as n}from"./chunk-
|
|
2
|
-
return l(e,{className:N,disabled:x,triggerLabel:M?A.button(h,y(M)):h,"aria-label":h,initialFocus:
|
|
1
|
+
import{Popover as e}from"./chunk-64RHGJXK.js";import{IconButton_default as r}from"./chunk-SV5RRBVA.js";import{Icon as n}from"./chunk-ISVODSRP.js";import{Tooltip as t}from"./chunk-SOZCWT6I.js";import{useShellStrings as a}from"./chunk-JSHMIMAJ.js";import{useRef as i}from"react";import{jsx as l,jsxs as o,Fragment as s}from"react/jsx-runtime";var c={ArrowLeft:[0,-1],ArrowRight:[0,1],ArrowUp:[-1,0],ArrowDown:[1,0]};function u({value:u,onChange:m,options:d,label:h,emptyValue:p,columns:f=5,cell:v,header:g,onPreview:w,tooltips:b=!0,disabled:x=!1,className:N=""}){const k=a(),A=k.iconPicker,j=k.iconNames,y=e=>e.label??j[e.value]??e.value,C=i([]),I=Math.max(0,d.findIndex(e=>e.value===u)),M=d[I],R=M?.value===p,S=i(null);/* @__PURE__ */
|
|
2
|
+
return l(e,{className:N,disabled:x,triggerLabel:M?A.button(h,y(M)):h,"aria-label":h,initialFocus:S,panelClassName:"!p-2",trigger:/* @__PURE__ */o("span",{className:"inline-flex items-center gap-2",children:[/* @__PURE__ */l("span",R||!M?{className:"text-sm",children:M?y(M):""}:{"aria-hidden":"true",className:"inline-flex [&_svg]:h-4 [&_svg]:w-4",children:M.icon}),
|
|
3
3
|
/* @__PURE__ */l(n,{name:"chevron-down",className:"h-4 w-4"})]}),children:({close:e})=>/* @__PURE__ */o(s,{children:["function"==typeof g?g({close:e}):g,
|
|
4
|
-
/* @__PURE__ */l("div",{role:"listbox","aria-label":h,className:"grid gap-1",style:{gridTemplateColumns:`repeat(${f}, ${v?.width??"2rem"})`},children:d.map((n,a)=>{const i=n.value===u,o=/* @__PURE__ */l(r,{ref:e=>{C.current[a]=e,a===I&&(
|
|
4
|
+
/* @__PURE__ */l("div",{role:"listbox","aria-label":h,className:"grid gap-1",style:{gridTemplateColumns:`repeat(${f}, ${v?.width??"2rem"})`},children:d.map((n,a)=>{const i=n.value===u,o=/* @__PURE__ */l(r,{ref:e=>{C.current[a]=e,a===I&&(S.current=e)},role:"option","aria-selected":i,"aria-label":y(n),pressed:i,tabIndex:a===I?0:-1,onKeyDown:e=>((e,r)=>{const n=c[r.key];if(!n)return;r.preventDefault();const t=Math.floor(e/f)+n[0],a=e%f+n[1];if(t<0||a<0||a>=f)return;const i=t*f+a;if(!(i>=d.length)){for(const[e,r]of C.current.entries())r?.setAttribute("tabindex",e===i?"0":"-1");C.current[i]?.focus()}})(a,e),onClick:()=>{m(n.value),e()},onMouseEnter:w?e=>w(n.value,e.currentTarget):void 0,style:v?{width:v.width,height:v.height}:void 0,children:/* @__PURE__ */l("span",{"aria-hidden":"true",className:v?"inline-flex":"inline-flex [&_svg]:h-4 [&_svg]:w-4",children:n.icon})},n.value);return b?/* @__PURE__ */l(t,{content:y(n),children:o},n.value):o})})]})})}export{u as IconPicker};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{IconPicker as e}from"./chunk-
|
|
2
|
-
return i("div",{role:"group","aria-label":a,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[g?c?/* @__PURE__ */i(s,{children:[
|
|
1
|
+
import{IconPicker as e}from"./chunk-BT2YPDQL.js";import{ColorPicker as t}from"./chunk-H2CPT6K3.js";import{InputNumber_default as r,stepRounding as l}from"./chunk-63IGYBCQ.js";import{BORDER_LINE_STYLES as o}from"./chunk-NOMWJTN2.js";import{Icon as a}from"./chunk-ISVODSRP.js";import{jsxs as i,Fragment as s,jsx as n}from"react/jsx-runtime";var d=["top","right","bottom","left"];function m(e){const t=e??{},r="number"==typeof t.width?t.width:0;return Object.fromEntries(d.map(e=>[e,"number"==typeof t[e]?t[e]:r]))}function h(e,t){const r=e??{},l=m(t),o=d.some(e=>"number"==typeof r[e]),a=d.map(e=>"number"==typeof r[e]?r[e]:"number"==typeof r.width?r.width:o?0:l[e]);return!a.every(e=>e===a[0])}var c="h-3.5 w-3.5",u={all:/* @__PURE__ */n(a,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */n(a,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */n(a,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */n(a,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */n(a,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */n(a,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */n(a,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */n(a,{name:"line-dotted","aria-hidden":"true",className:c})};function f({label:a,value:m,onChange:h,each:c,placeholder:f,presets:b,words:w,widths:g=!0,styles:y=!0,min:v=0,max:N=20,step:x=1,readOnly:j,units:S}){const k=e=>"number"==typeof m[e]?m[e]:null,C=(e,t)=>{const r={...m};if("number"==typeof m.width)for(const e of d)null===k(e)&&(r[e]=m.width);r[e]=t,delete r.width,h(r)},O=(e,t,o,a,i,s)=>/* @__PURE__ */n("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */n(r,{value:a,onChange:s,min:v,max:N,step:x,...l(x),steppers:"compact",readOnly:j,placeholder:i,prefix:o,suffix:w.unit,units:S,"aria-label":t})}),I=d.map(k),P="number"==typeof m.width?m.width:I.every(e=>null!==e&&e===I[0])?I[0]:null,T=null===P&&I.some(e=>null!==e),B=d.every(e=>f.sides[e]===f.sides.top)?String(f.sides.top):"–",D=e=>k(e)??("number"==typeof m.width?m.width:null),H=m.style??f.style;/* @__PURE__ */
|
|
2
|
+
return i("div",{role:"group","aria-label":a,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[g?c?/* @__PURE__ */i(s,{children:[O("left",w.sides.left,u.left,D("left"),String(f.sides.left),e=>C("left",e)),O("top",w.sides.top,u.top,D("top"),String(f.sides.top),e=>C("top",e)),O("right",w.sides.right,u.right,D("right"),String(f.sides.right),e=>C("right",e)),O("bottom",w.sides.bottom,u.bottom,D("bottom"),String(f.sides.bottom),e=>C("bottom",e))]}):O("all",w.width,u.all,P,T?"–":B,e=>{const t={...m,width:e};for(const e of d)delete t[e];h(t)}):null,y&&/* @__PURE__ */n("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */n(e,{label:w.style,value:H,disabled:j,onChange:e=>{j||h({...m,style:e})},options:o.map(e=>({value:e,label:w.styles[e],icon:p[e]}))})}),
|
|
3
3
|
/* @__PURE__ */n("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */n(t,{value:m.color??"",onChange:e=>{j||h({...m,color:e})},label:w.color,presets:b,fallback:f.color,showHexInput:!0,size:"md",disabled:j})})]})}export{f as BorderInput,m as borderSides,h as borderStartEach};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useShellLanguage as e}from"./chunk-7ZJRBFHA.js";import{RadioGroup as a}from"./chunk-32VV2J22.js";import{Select_default as n}from"./chunk-
|
|
1
|
+
import{useShellLanguage as e}from"./chunk-7ZJRBFHA.js";import{RadioGroup as a}from"./chunk-32VV2J22.js";import{Select_default as n}from"./chunk-XMY2HKVD.js";import{Icon as t}from"./chunk-ISVODSRP.js";import{useShellStrings as l}from"./chunk-JSHMIMAJ.js";import{jsxs as s,jsx as i}from"react/jsx-runtime";function r(e){const a=Math.max(0,...e.map(e=>[...e].reduce((e,a)=>e+((a.codePointAt(0)??0)>=11904?1:.62),0)));return Math.round(10*(a+3.5))/10}function m({size:a="sm",className:m=""}){const{language:o,languages:c,setLanguage:g}=e(),u=l().language;return c.length<2?null:/* @__PURE__ */s("span",{className:`inline-flex items-center gap-2 text-ink-faint ${m}`.trim(),children:[
|
|
2
2
|
/* @__PURE__ */i(t,{name:"globe","aria-hidden":!0,className:"h-4 w-4 shrink-0"}),
|
|
3
3
|
/* @__PURE__ */i("span",{className:"block",style:{width:`${r(c.map(e=>e.name))}em`},children:/* @__PURE__ */i(n,{size:a,touchSize:a,"aria-label":u.title,value:o,onChange:e=>{g(e)},options:c.map(({tag:e,name:a})=>({value:e,label:a,lang:e}))})})]})}function o({description:n,className:t=""}){const{language:r,languages:m,setLanguage:o}=e(),c=l().language;return m.length<2?null:/* @__PURE__ */s("div",{className:`space-y-4 ${t}`.trim(),children:[
|
|
4
4
|
/* @__PURE__ */s("div",{children:[
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{Calendar as e}from"./chunk-
|
|
2
|
-
return x("input",{ref:
|
|
1
|
+
import{Calendar as e}from"./chunk-BKYRHQK2.js";import{fromDateKey as t,toDateKey as r}from"./chunk-2HMNOLKX.js";import{inputClasses as a,PLACEHOLDER_INK as n}from"./chunk-AYZY3YNC.js";import{calendarNames as i}from"./chunk-Y3JW2GW5.js";import{Icon as o}from"./chunk-ISVODSRP.js";import{onOverlayOpen as l}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as s}from"./chunk-62LW225J.js";import{useDropdownPosition as d}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as u}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as c}from"./chunk-TWVUQUUD.js";import{useShellStrings as m,useShellLocale as b}from"./chunk-JSHMIMAJ.js";import{forwardRef as f,useState as p,useRef as h,useId as v,useEffect as g}from"react";import{createPortal as y}from"react-dom";import{jsx as x,jsxs as N}from"react/jsx-runtime";var k=/^\d{4}-\d{2}-\d{2}$/,j=/^(aria|data)-/,w=/* @__PURE__ */new Set(["aria-invalid","aria-required"]);function D(e){if(null==e||""===e)return"";if(e instanceof Date)return Number.isNaN(e.getTime())?"":r(e);if(k.test(e))return e;const t=new Date(e);return Number.isNaN(t.getTime())?"":r(t)}function S(e,r){const a=t(e);return a?r.longDate(a.getFullYear(),a.getMonth(),a.getDate()):""}var B=f(function({value:f,onChange:k,min:B,max:F,invalid:W,size:C,native:I,weekStartsOn:J,className:O="","aria-label":Y,"aria-describedby":$,"aria-labelledby":q,id:E,name:L,disabled:M,placeholder:z,required:H,clearable:T,form:U,title:G,tabIndex:K,autoFocus:P,onFocus:R,onBlur:A,...Q},V){const X=T??!H,Z=D(f),_=D(B),ee=D(F),te=m().datePicker,re=b(),ae=i(re),[ne,ie]=p(!1),oe=h(null),le=h(null),se=h(null),de=v(),ue=v(),ce=v(),me=d(le,ne,{popupRef:se}),[be,fe]=p(!1);u(()=>{const e=!!E&&(le.current?.labels?.length??0)>0;e!==be&&fe(e)});const pe=!Y&&(!!q||be);if(g(()=>{if(!ne)return;const e=e=>{const t=e.target;oe.current?.contains(t)||se.current?.contains(t)||ie(!1)};document.addEventListener("pointerdown",e,!0);const t=l(()=>ie(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[ne]),g(()=>{if(ne)return c(e=>"Escape"===e.key&&(ie(!1),le.current?.focus(),!0),()=>se.current)},[ne]),I)/* @__PURE__ */
|
|
2
|
+
return x("input",{ref:V,type:"date",lang:re,id:E,name:L,disabled:M,"aria-label":Y,"aria-describedby":$,"aria-invalid":W||void 0,value:Z,min:_||void 0,max:ee||void 0,onChange:e=>k?.(t(e.target.value)),className:a({invalid:W,size:C,className:O}),"aria-labelledby":q,required:H,form:U,title:G,tabIndex:K,autoFocus:P,onFocus:R,onBlur:A,...Q});const he=Object.fromEntries(Object.entries(Q).filter(([e])=>j.test(e)&&!w.has(e))),ve=Q["aria-required"],ge=!!H||!0===ve||"true"===ve,ye=[pe?ue:void 0,ge?ce:void 0,$].filter(Boolean).join(" ")||void 0,xe=r(/* @__PURE__ */new Date),Ne=(!_||xe>=_)&&(!ee||xe<=ee),ke=z??te.placeholder;/* @__PURE__ */
|
|
3
3
|
return N("div",{ref:oe,className:"relative",children:[
|
|
4
|
-
/* @__PURE__ */x("input",{ref:
|
|
5
|
-
/* @__PURE__ */N("button",{ref:le,type:"button",...he,id:
|
|
6
|
-
/* @__PURE__ */x("span",{className:
|
|
7
|
-
/* @__PURE__ */x(o,{name:"date",className:`h-4 w-4 shrink-0 ${n}`,strokeWidth:"1.75","aria-hidden":"true"})]}),pe&&/* @__PURE__ */x("span",{id:ue,className:"sr-only",children:
|
|
8
|
-
/* @__PURE__ */N("div",{ref:se,id:de,role:"dialog","aria-label"
|
|
9
|
-
/* @__PURE__ */x(e,{value:
|
|
4
|
+
/* @__PURE__ */x("input",{ref:V,type:"hidden",name:L,form:U,value:Z}),
|
|
5
|
+
/* @__PURE__ */N("button",{ref:le,type:"button",...he,id:E,disabled:M,title:G,tabIndex:K,autoFocus:P,onFocus:R,onBlur:A,"aria-haspopup":"dialog","aria-expanded":ne,"aria-controls":ne?de:void 0,"aria-labelledby":q,"aria-describedby":ye,"aria-label":Y?`${Y}${Z?`, ${S(Z,ae)}`:""}`:void 0,onClick:()=>ie(e=>!e),className:`${a({invalid:W,size:C,className:O})} flex items-center justify-between text-left`,children:[
|
|
6
|
+
/* @__PURE__ */x("span",{className:Z?"text-ink-strongest":n,children:Z?S(Z,ae):ke}),
|
|
7
|
+
/* @__PURE__ */x(o,{name:"date",className:`h-4 w-4 shrink-0 ${n}`,strokeWidth:"1.75","aria-hidden":"true"})]}),pe&&/* @__PURE__ */x("span",{id:ue,className:"sr-only",children:Z?S(Z,ae):ke}),ge&&/* @__PURE__ */x("span",{id:ce,className:"sr-only",children:te.required}),ne&&y(
|
|
8
|
+
/* @__PURE__ */N("div",{ref:se,id:de,role:"dialog","aria-label":Y??te.dialog,className:"fixed w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-lg",style:{zIndex:s.popup,left:me?.left,right:me?.right,top:me?.top,bottom:me?.bottom,maxWidth:me?.maxWidth,visibility:me?void 0:"hidden"},children:[
|
|
9
|
+
/* @__PURE__ */x(e,{value:Z||null,min:_||null,max:ee||null,weekStartsOn:J,onSelect:e=>{ie(!1),le.current?.focus(),k?.(t(e))}}),(X||Ne)&&/* @__PURE__ */N("div",{className:"mt-2 flex justify-between border-t border-gray-100 pt-2",children:[X&&/* @__PURE__ */x("button",{type:"button",onClick:()=>{ie(!1),le.current?.focus(),k?.(null)},className:"rounded-(--radius-control) px-2 py-1 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-700",children:te.clear}),Ne&&/* @__PURE__ */x("button",{type:"button",onClick:()=>{ie(!1),le.current?.focus(),k?.(/* @__PURE__ */new Date)},className:"ml-auto rounded-(--radius-control) px-2 py-1 text-sm font-medium text-blue-600 hover:bg-blue-50",children:te.today})]})]}),document.body)]})});export{B as DatePicker_default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Card as e}from"./chunk-CEIIQRK5.js";import{Select_default as l}from"./chunk-
|
|
1
|
+
import{Card as e}from"./chunk-CEIIQRK5.js";import{Select_default as l}from"./chunk-XMY2HKVD.js";import{FormField as a}from"./chunk-6KBDNYRW.js";import{Checkbox_default as r}from"./chunk-CGZBDI6C.js";import{Banner as i}from"./chunk-ATZ262BR.js";import{Input_default as c}from"./chunk-PT4GMPUB.js";import{Button_default as s}from"./chunk-EVYD6UFQ.js";import{useState as d}from"react";import{jsx as n,jsxs as t}from"react/jsx-runtime";var h=[{name:"Mechanical keyboard",qty:1,price:129},{name:"USB-C cable (2m)",qty:2,price:12},{name:"Laptop stand",qty:1,price:48}];function m(){const[m,o]=d(!0),[p,u]=d("us"),y=h.reduce((e,l)=>e+l.qty*l.price,0),g=y+9;/* @__PURE__ */
|
|
2
2
|
return n("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */t("div",{className:"mx-auto max-w-5xl space-y-5",children:[
|
|
3
3
|
/* @__PURE__ */n("h1",{className:"text-xl font-semibold text-gray-900",children:"Checkout"}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-ZGCCV4WE.js";import{MarqueeBox as r}from"./chunk-IC72MGON.js";import{EmptyState as a}from"./chunk-TKIYZE7V.js";import{ImageLightbox as i}from"./chunk-UH5ZGWSA.js";import{DescriptionList as t}from"./chunk-SACUSHVN.js";import{Drawer as o}from"./chunk-IATKDC52.js";import{Breadcrumbs as d}from"./chunk-JLRF6FN7.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-OMFYTCBI.js";import{useMediaMoveItems as u}from"./chunk-NOGSS432.js";import{RenameField as m}from"./chunk-QIPO4EVJ.js";import{NativeSelect as p}from"./chunk-XMY2HKVD.js";import{MediaUploadGrid as h}from"./chunk-QB2GJNGB.js";import{MediaUsedInList as f}from"./chunk-MKNDDB6U.js";import{Segmented as g}from"./chunk-HNIIDDLJ.js";import{useGridSelection as v}from"./chunk-VLKDWKVR.js";import{useMarquee as k}from"./chunk-OLFYNMTD.js";import{copyToClipboard as y}from"./chunk-Y7KDCC6E.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as C}from"./chunk-QMBMK6PP.js";import{Banner as x}from"./chunk-ATZ262BR.js";import{Input_default as N}from"./chunk-PT4GMPUB.js";import{DropdownMenu as I}from"./chunk-3DSGJIC7.js";import{IconButton_default as D}from"./chunk-SV5RRBVA.js";import{useFileIntake as S,FileIntakeAlert as j}from"./chunk-V4XR4MOS.js";import{setModalDragAside as z,modalIdHolding as T}from"./chunk-EIFNESXS.js";import{ColoredBadge as F}from"./chunk-NN32QUCE.js";import{Button_default as L}from"./chunk-EVYD6UFQ.js";import{Icon as O}from"./chunk-ISVODSRP.js";import{Tooltip as E}from"./chunk-SOZCWT6I.js";import{buttonClasses as P}from"./chunk-UQYNPYF4.js";import{usePlotWidth as M}from"./chunk-MAFUXCPZ.js";import{useShellStrings as A}from"./chunk-JSHMIMAJ.js";import{useRef as R,useMemo as U,useCallback as B,useState as K,useEffect as V}from"react";import{jsxs as G,Fragment as J,jsx as H}from"react/jsx-runtime";var Y="application/x-efficient-media-files",Q="application/x-efficient-media-folder",W="application/x-efficient-media-file";function Z(e){if(!e||!Array.from(e.types).includes(W))return null;try{const n=JSON.parse(e.getData(W));if(n&&"string"==typeof n.id&&"string"==typeof n.url&&"string"==typeof n.name&&("image"===n.kind||"video"===n.kind))return{id:n.id,url:n.url,kind:n.kind,name:n.name}}catch{}return null}var $={type:"all",use:"any",sort:"newest"},q={lock:/* @__PURE__ */H(O,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */H(O,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */H(O,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */H(O,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */H(O,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */H(O,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */H(O,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */H(O,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */H(O,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */H(O,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */H(O,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */H(O,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */H(O,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */H(O,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */H(O,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */H(O,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},X={link:/* @__PURE__ */H(O,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */H(O,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */H(O,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */H(O,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(O){const{mode:Z="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=$,onFiltersChange:ce,extraFilters:ue,view:me="grid",onViewChange:pe,selectedIds:he,onSelectionChange:fe,usedIn:ge,denied:ve={},accept:ke="image/*,video/*",maxSizeBytes:ye,busy:be,progress:we,onUpload:Ce,onNewFolder:xe,onRename:Ne,onMove:Ie,onTrash:De,onDeleteFolder:Se,onRestore:je,onDeleteForever:ze,onEmptyTrash:Te,onReplace:Fe,onCropEdit:Le,onOpenInDesign:Oe,onChoose:Ee,onCancel:Pe,pickNote:Me,onDragOut:Ae,className:Re=""}=O,Ue=A().mediaLibrary,Be=A().media,Ke="pick"===Z,Ve=!Ke,Ge=R(null),Je=M(Ge,"phone"===_?343:1200),He="phone"===_||"auto"===_&&Je<640,Ye=U(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,r)=>{for(const a of e){const e=[...r,a];n.set(a.id,{node:a,path:e}),a.children&&l(a.children,e)}};return l(e,[]),n}(re),[re]),Qe=U(()=>new Map(le.map(e=>[e.id,e])),[le]),We=U(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&Qe.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,Qe]),Ze=B(e=>{const n=[];for(let l=e?Qe.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?Qe.get(l.parentId):void 0);return n},[Qe,le.length]),$e=B((e,n)=>Ze(e).some(e=>e.id===n),[Ze]),[qe,Xe]=K(()=>/* @__PURE__ */new Set(["@files"])),_e=e=>Xe(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),en=B(e=>{Xe(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),nn="files"===(ln=ee).place?`files:${ln.folderId??""}`:"products"===ln.place?`products:${ln.nodeId??""}`:"trash";var ln;V(()=>{if("files"===ee.place)en(["@files",...Ze(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?Ye.get(ee.nodeId)?.path??[]:[];en(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[nn]);const rn="products"===ee.place,an="trash"===ee.place,tn="files"===ee.place,on=tn?ee.folderId:null,dn=rn&&ee.nodeId?Ye.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Ue.readOnly} ${Ue.editedAtHq(e.sharedFrom)}`:Ue.readOnly,cn=U(()=>te.map(e=>e.id),[te]),un=U(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=v(cn),pn=U(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=R(!0);V(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");V(()=>{he&&mn.setSelection(he)},[gn]);const vn=R(gn??""),kn=pn.join("\0");V(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Ke?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=K(null),Cn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?Qe.get(n.id)?.name:un.get(n.id)?.name)&&Ne?.(n,e)},xn=async e=>{if(!xe)return;const n=await xe(e);en(["@files",...e?[e]:[]]),"string"==typeof n&&wn({kind:"folder",id:n})},Nn=B(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Ue.alreadyHere:void 0;const l=Qe.get(e.id);return n===e.id||n&&$e(n,e.id)?Ue.notIntoItself:(l?.parentId??null)===n?Ue.folderAlreadyHere:void 0};n.push({key:s,label:Ue.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of We.get(e)??[])n.push({key:i.id,label:i.name,depth:a,disabledReason:l(i.id)}),r(i.id,a+1)};return r(null,1),n},[We,Qe,tn,$e,on,Ue]),In=B(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=K(null),jn={words:Ue,media:Be,denied:ve,moveTargets:Nn,kindOf:In,urlOf:e=>un.get(e)?.url,newSubfolder:xe&&Ve?e=>{xn(e)}:void 0,rename:Ne&&Ve?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ie&&Ve?Ie:void 0,trash:De&&Ve?De:void 0,deleteFolder:Se&&Ve?Se:void 0,folderNotEmpty:e=>!!Qe.get(e)?.notEmpty,replace:Fe&&Ve?Fe:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&y(Ue.urlLabel,n)},openInDesign:Oe,restore:je,deleteForever:ze},zn=e=>c(e,jn),Tn=w(),Fn=(e,n)=>{Ke||(mn.isSelected(e)||mn.select(e),Tn.open(n,(e=>{const n=mn.isSelected(e)?pn:[e];return rn?{kind:"render",id:e}:an?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[Ln,On]=K(null),[En,Pn]=K(null),[Mn,An]=K(null);V(()=>{if(!En&&!Ln)return;const e=()=>{Pn(null),On(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[En,Ln]);const Rn=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Un=(e,n)=>!(!Ie||ve.move||Ke)&&(!!Rn(e,Y)||!(!Rn(e,Q)||!Mn)&&(n!==Mn&&!(n&&$e(n,Mn)))),Bn=(e,n)=>({onDragEnter:l=>{Un(l,n)&&(l.preventDefault(),On(e))},onDragOver:l=>{Un(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",Ln!==e&&On(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||On(n=>n===e?null:n)},onDrop:e=>{if(Un(e,n))if(e.preventDefault(),On(null),Rn(e,Y)){let l;try{l=JSON.parse(e.dataTransfer.getData(Y))}catch{l=null}Array.isArray(l)&&l.length&&Ie({kind:"files",ids:l.map(String)},n)}else Mn&&(Ie({kind:"folder",id:Mn},n),An(null))}}),Kn=e=>{const n=e=>Rn(e,Y)||Rn(e,Q)||Rn(e,"Files");return{onDragEnter:l=>{n(l)&&Pn(e)},onDragOver:l=>{n(l)&&En!==e&&Pn(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Pn(n=>n===e?null:n)}}},Vn=(e,n,l)=>/* @__PURE__ */H(E,{side:"right",content:En===e?Ue.noDropProducts:sn(l),open:En===e||!En&&void 0,children:/* @__PURE__ */H("span",{children:n})}),Gn=e=>({onContextMenu:n=>{Tn.open(n,e)}}),Jn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=qe.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
|
|
2
|
+
return G("div",{role:"none",className:"contents",children:[
|
|
3
|
+
/* @__PURE__ */H(n,{label:Vn(i,e.name,t),level:r,icon:d&&o?q.folderOpen:q.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:rn&&ee.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>_e(i):void 0,onSelect:()=>ne({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Kn(i),...Ve?Gn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */H(l,{children:Jn(d,r+1,t)})]},e.id)}),Hn=(e,r)=>(We.get(e)??[]).map(e=>{const a=We.get(e.id),i=qe.has(e.id),t="folder"===bn?.kind&&bn.id===e.id,o=zn({kind:"folder",id:e.id});/* @__PURE__ */
|
|
4
|
+
return G("div",{role:"none",className:"contents",children:[
|
|
5
|
+
/* @__PURE__ */H(n,{label:e.name,level:r,icon:a&&i?q.folderOpen:q.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:t||tn&&ee.folderId===e.id,expanded:a?i:void 0,onToggle:a?()=>_e(e.id):void 0,onSelect:()=>ne({place:"files",folderId:e.id}),drop:Ln===e.id?"into":void 0,dragging:Mn===e.id,draggable:Ve&&!!Ie&&!ve.move,rename:t?/* @__PURE__ */H(m,{value:e.name,label:Ue.folderName,onDone:Cn}):void 0,actions:Ve&&o.length?/* @__PURE__ */H(I,{align:"end","aria-label":Ue.folderActions,trigger:q.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Bn(e.id,e.id),...Ve?Gn({kind:"folder",id:e.id}):{},...Ve&&Ie&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(Q,e.id),An(e.id)},onDragEnd:()=>{An(null),On(null)}}:{}}}),a&&i&&/* @__PURE__ */H(l,{children:Hn(e.id,r+1)})]},e.id)}),Yn=qe.has("@files"),Qn=qe.has("@products"),Wn=/* @__PURE__ */G(e,{"aria-label":Ue.folders,children:[re&&/* @__PURE__ */G(J,{children:[
|
|
6
|
+
/* @__PURE__ */H(n,{label:Vn("@products",Ue.products),level:1,icon:q.lock,badge:{label:Ue.readOnlyBadge,tone:"neutral"},expanded:re.length?Qn:void 0,onToggle:()=>_e("@products"),selected:rn&&null==ee.nodeId,onSelect:()=>ne({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Kn("@products")}}),Qn&&re.length>0&&/* @__PURE__ */H(l,{children:Jn(re,2)})]}),
|
|
7
|
+
/* @__PURE__ */H(n,{label:Ue.allFiles,level:1,icon:Yn?q.folderOpen:q.folder,count:ae,countLabel:null!=ae?Ue.fileCount(ae):void 0,expanded:We.get(null)?.length?Yn:void 0,onToggle:()=>_e("@files"),selected:tn&&null==ee.folderId,onSelect:()=>ne({place:"files",folderId:null}),drop:"@files"===Ln?"into":void 0,rowProps:{"data-media-row":"@files",...Bn("@files",null)}}),Yn&&(We.get(null)?.length??0)>0&&/* @__PURE__ */H(l,{children:Hn(null,2)}),Ve&&/* @__PURE__ */H(n,{label:Ue.trash,level:1,icon:q.trash,count:ie,countLabel:null!=ie?Ue.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Zn=(()=>{if(an)return[{label:Ue.trash}];if(rn){const e=ee.nodeId?Ye.get(ee.nodeId)?.path??[]:[];return[{label:Ue.products,onClick:e.length?()=>ne({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"products",nodeId:n.id}):void 0}))]}const e=Ze(on);return[{label:Ue.allFiles,onClick:e.length?()=>ne({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"files",folderId:n.id}):void 0}))]})(),$n=rn?Ue.readOnly:ve.upload,qn=!!Ce&&!an&&!$n,Xn=S({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!qn,onAccept:e=>Ce?.(e,on)}),_n=rn?Ue.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */G("div",{className:"flex flex-wrap items-center gap-2",children:[Ve&&xe&&!an&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.folderPlus,onClick:()=>{xn(on)},...el(_n),children:Ue.newFolder}),Ce&&!an&&/* @__PURE__ */H(L,{variant:"primary",size:"sm",leftIcon:q.upload,onClick:()=>Xn.open(),...el($n),children:Ue.upload}),Ve&&an&&Te&&te.length>0&&/* @__PURE__ */H(L,{variant:"danger",size:"sm",onClick:Te,...el(ve.deleteForever),children:Ue.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */H("div",{style:{width:He?void 0:a,flex:He?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */H(p,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */G("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */H("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */H(N,{size:"sm",type:"search",leftIcon:q.search,placeholder:rn?Ue.searchProducts:Ue.search,"aria-label":rn?Ue.searchProducts:Ue.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Ue.mediaType,se.type,[{value:"all",label:Ue.allTypes},{value:"image",label:Ue.images},{value:"video",label:Ue.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Ue.use,se.use,[{value:"any",label:Ue.anyUse},{value:"email",label:Ue.emailOnly},{value:"website",label:Ue.websiteOnly},{value:"unused",label:Ue.notUsed}],rl("use"),130),ce&&Ve&&ll(Ue.sort,se.sort,[{value:"newest",label:Ue.newest},{value:"name",label:Ue.byName},{value:"size",label:Ue.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */H(g,{size:"sm",label:Ue.view,value:me,onChange:pe,options:[{value:"grid",label:Ue.grid,icon:q.grid},{value:"list",label:Ue.list,icon:q.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ue.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:X.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ue.used(e.usedCount),count:e.usedCount,icon:X.link,tone:"active"}),e.email&&n.push({key:"e",label:Ue.email,icon:X.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ue.private,icon:X.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */H(F,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=Ve&&tn&&!!Ie&&!ve.move,dl=!!Ae&&!an,sl=R(""),cl=R(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=R(Ae);ml.current=Ae;const pl=B(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),z(sl.current,!1),e&&ml.current?.(e))},[]),hl=B(e=>{pl(ul());const n=Ge.current?.ownerDocument;if(!n)return;sl.current=T(Ge.current);const l=Ge.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&z(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,z(sl.current,!1)}},t=e=>{const n=e.dataTransfer?.dropEffect;pl(n&&"none"!==n?"dropped":a()?ul():"cancelled")},o=()=>{a()&&pl(ul())},d=["pointermove","pointerdown","mousemove","mousedown"];n.addEventListener("dragover",r,!0),n.addEventListener("drop",i,!0),n.addEventListener("dragend",t,!0);for(const e of d)n.addEventListener(e,o,!0);cl.current={dropped:!1,stop:()=>{n.removeEventListener("dragover",r,!0),n.removeEventListener("drop",i,!0),n.removeEventListener("dragend",t,!0);for(const e of d)n.removeEventListener(e,o,!0)}}},[pl]);V(()=>()=>pl(ul()),[pl]);const fl=(e,n,l)=>{if("start"!==e)return;const r=un.get(n);r&&gl(r)&&(hl(l??null),Ae(e))},gl=e=>!dl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),vl=te.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:il(e),dragData:ol?JSON.stringify(mn.isSelected(e.id)?pn:[e.id]):gl(e),...ol&&gl(e)?{dragAlso:{[W]:gl(e)}}:{}})),kl=He?Math.max(72,Math.floor((Je-24-16-1)/3)):112,yl=R(null),bl=k({containerRef:yl,enabled:Ve&&!He&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Ke){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Ee?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},Cl=te.length?null:oe?/* @__PURE__ */H(a,{variant:"dashed",title:Ue.noMatches}):rn?/* @__PURE__ */H(a,{variant:"dashed",title:Ue.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */H(a,{variant:"dashed",title:Ue.trashEmpty}):!qn||Ke?/* @__PURE__ */H(a,{variant:"dashed",title:Ue.emptyFolder}):null,xl="list"===me&&te.length>0,Nl=Cl??(xl?/* @__PURE__ */H("ul",{role:"listbox","aria-multiselectable":Ve||void 0,"aria-label":Ue.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */G("li",{role:"option","aria-selected":mn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>yn(e.id,n),onDoubleClick:()=>wl(e.id),onContextMenu:n=>Fn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(W,gl(e)),fl("start",e.id,n.currentTarget)}:void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),yn(e.id,n))},className:"flex h-12 cursor-pointer items-center gap-3 rounded-md px-2 text-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(mn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
|
|
8
|
+
/* @__PURE__ */H("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
|
|
9
|
+
/* @__PURE__ */H("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
|
|
10
|
+
/* @__PURE__ */H("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */H("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */H(h,{items:vl,readOnly:!qn||Ke,onFiles:qn&&!Ke?e=>Ce(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?Y:dl?W:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:Ve?Fn:void 0,menuOnMedia:Ve})),Il=u({count:pn.length,kind:In(pn),targets:Nn({kind:"files",ids:pn}),onPick:e=>Ie?.({kind:"files",ids:pn},e.key===s?null:e.key)}),Dl=P({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */H(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */G(J,{children:[q.folder,Ue.moveTo]}),items:Il,disabled:!!ve.move}),jl=Ve&&pn.length>1&&!rn?/* @__PURE__ */G("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
|
|
11
|
+
/* @__PURE__ */H(b,{checked:pn.length===te.length,indeterminate:pn.length<te.length,onChange:e=>e?mn.selectAll():mn.clear(),label:Ue.selected(pn.length)}),/* @__PURE__ */G(J,an?{children:[je&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.undo,onClick:()=>je(pn),...el(ve.restore),children:Ue.restore}),ze&&/* @__PURE__ */H(L,{variant:"secondary-danger",size:"sm",onClick:()=>ze(pn),...el(ve.deleteForever),children:Ue.deleteForever})]}:{children:[Ie&&Sl,Ne&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.edit,disabled:!0,children:Ue.rename}),De&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.trash,onClick:()=>De({kind:"files",ids:pn}),...el(ve.trash),children:Ue.moveFilesToTrash(pn.length)})]}),
|
|
12
|
+
/* @__PURE__ */H(L,{variant:"ghost",size:"sm",onClick:mn.clear,children:Ue.clearSelection})]}):null,zl=e=>{const n=[],l=(e,l,r)=>{null!=r&&""!==r&&n.push({key:e,label:l,value:r})},r="file"===bn?.kind&&bn.id===e.id;l("name",Ue.name,r?/* @__PURE__ */H(m,{value:e.name,label:Ue.fileName,onDone:Cn}):e.name),l("type",Ue.type,e.typeLabel),l("size",Ue.size,e.sizeLabel),l("resolution",Ue.resolution,e.resolution),rn?(l("design",Ue.design,e.design),l("finish",Ue.finish,e.finish),l("angle",Ue.angleLug,e.angleLug),l("owner",Ue.owner,e.owner)):(l("added",Ue.addedBy,e.addedBy),l("folder",Ue.folder,e.folderPath)),l("used",Ue.usedIn,null!=e.usedCount?Ue.places(e.usedCount):void 0);const a=c({kind:"files",ids:[e.id]},jn).find(e=>"submenu"===e.type);/* @__PURE__ */
|
|
13
|
+
return G("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
|
|
14
|
+
/* @__PURE__ */H("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),rn&&/* @__PURE__ */H(x,{tone:"neutral",title:Ue.readOnlyBadge,children:sn(dn)}),
|
|
15
|
+
/* @__PURE__ */H(t,{size:"sm",columns:1,items:n}),!an&&/* @__PURE__ */G("div",{className:"flex gap-2",children:[
|
|
16
|
+
/* @__PURE__ */H("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */H(N,{size:"sm",readOnly:!0,value:e.url,"aria-label":Ue.fileUrl,onFocus:e=>e.currentTarget.select()})}),
|
|
17
|
+
/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.copy,onClick:()=>jn.copyUrl(e.id),children:Ue.copyUrl})]}),tn&&Ve&&/* @__PURE__ */G("div",{className:"flex flex-wrap gap-2",children:[Fe&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.swap,onClick:()=>Fe(e.id),...el(ve.replace),children:Ue.replace}),Le&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.crop,onClick:()=>Le(e.id),children:Ue.cropEdit}),Ie&&"submenu"===a?.type&&/* @__PURE__ */H(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */G(J,{children:[q.folder,Ue.moveTo]}),items:a.items,disabled:!!ve.move}),Ne&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Ue.rename}),De&&/* @__PURE__ */H(D,{"aria-label":Ue.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:q.trash})]}),an&&Ve&&/* @__PURE__ */G("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */H(L,{variant:"primary",size:"sm",leftIcon:q.undo,onClick:()=>je([e.id]),...el(ve.restore),children:Ue.restore}),ze&&/* @__PURE__ */H(L,{variant:"danger",size:"sm",onClick:()=>ze([e.id]),...el(ve.deleteForever),children:Ue.deleteForever})]}),rn&&Oe&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",leftIcon:q.external,onClick:()=>Oe({kind:"render",id:e.id}),children:Ue.openInDesign}),ge&&/* @__PURE__ */H(f,{items:ge})]})},Tl=hn?hn.private?Ue.privateNoPick:hn.pickDisabledReason:void 0,Fl=Ke?/* @__PURE__ */G("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-3 py-2",children:[
|
|
18
|
+
/* @__PURE__ */H("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:hn?Ue.oneChosen(hn.name):Ue.noneChosen}),
|
|
19
|
+
/* @__PURE__ */G("div",{className:"flex gap-2",children:[Pe&&/* @__PURE__ */H(L,{variant:"secondary",size:"sm",onClick:Pe,children:Ue.cancel}),
|
|
20
|
+
/* @__PURE__ */H(L,{variant:"primary",size:"sm",disabled:!hn,...el(Tl),onClick:()=>{hn&&!Tl&&Ee?.(hn)},children:Ue.chooseImage})]})]}):null,Ll=Ve&&!!hn,Ol=/* @__PURE__ */G("div",{className:"flex min-w-0 flex-col gap-3",children:[Me&&/* @__PURE__ */H(x,{tone:"neutral",children:Me}),
|
|
21
|
+
/* @__PURE__ */G("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
|
|
22
|
+
/* @__PURE__ */H(d,{items:Zn}),nl]}),al,jl,
|
|
23
|
+
/* @__PURE__ */G("div",{ref:yl,className:"relative",onPointerDown:bl.onPointerDown,onKeyDown:e=>{Ve&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),mn.selectAll()):"Escape"===e.key&&mn.size&&mn.clear()},children:[Nl,
|
|
24
|
+
/* @__PURE__ */H(r,{rect:bl.rect})]}),qn&&/* @__PURE__ */H("input",{...Xn.inputProps}),
|
|
25
|
+
/* @__PURE__ */H(j,{rejections:Xn.rejections})]});/* @__PURE__ */
|
|
26
|
+
return G("div",{ref:Ge,"data-media-library":"","data-layout":He?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Re}`.trim(),children:[/* @__PURE__ */G("div",He?{className:"flex flex-col gap-3 p-3",children:[Wn,Ol]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
|
|
27
|
+
/* @__PURE__ */H("div",{className:"shrink-0 overflow-y-auto border-r border-line p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Wn}),
|
|
28
|
+
/* @__PURE__ */H("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:Ol}),Ll&&/* @__PURE__ */H("div",{className:"shrink-0 overflow-y-auto border-l border-line p-3",style:{width:300},children:zl(hn)})]}),Fl,He&&/* @__PURE__ */H(o,{open:Ll,onClose:mn.clear,side:"bottom",title:hn?.name,children:hn&&zl(hn)}),Tn.state&&/* @__PURE__ */H(C,{...Tn.props,items:zn(Tn.state.data)}),null!=Dn&&te.length>0&&/* @__PURE__ */H(i,{images:te.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(Dn,te.length-1),onClose:()=>Sn(null)})]})}export{Y as MEDIA_FILES_DRAG_TYPE,W as MEDIA_FILE_DRAG_TYPE,Q as MEDIA_FOLDER_DRAG_TYPE,_ as MediaLibrary,Z as readMediaFileDrag};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{optionNoteClass as e}from"./chunk-URHGHXDN.js";import{keepsNativeMenu as t}from"./chunk-5QFPTDQF.js";import{Icon as n}from"./chunk-
|
|
2
|
-
return k("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&
|
|
1
|
+
import{optionNoteClass as e}from"./chunk-URHGHXDN.js";import{keepsNativeMenu as t}from"./chunk-5QFPTDQF.js";import{Icon as n}from"./chunk-ISVODSRP.js";import{onOverlayOpen as r}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as o}from"./chunk-62LW225J.js";import{useHydrated as i,useBrowserLayoutEffect as a}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as l}from"./chunk-TWVUQUUD.js";import{glassStyle as c,GLASS_DIVIDER as s}from"./chunk-5FYDNH4Y.js";import{createContext as d,forwardRef as u,useContext as p,useId as m,useRef as h,useState as f,useEffect as g,useMemo as y,useCallback as b}from"react";import{createPortal as w}from"react-dom";import{jsxs as x,jsx as k,Fragment as v}from"react/jsx-runtime";function N(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function C(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function E(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function T(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),a=e-i/2;return a<n?n:a+i>r?Math.max(n,r-i):a}function M(e,t,n,r,o,i=!1,a=8){const l=t+o,c=e-o-n,s=c>=a;return i&&s?{left:c,flipped:!0}:l+n<=r-a?{left:l,flipped:!1}:s?{left:c,flipped:!0}:i?{left:a,flipped:!0}:{left:Math.max(a,r-a-n),flipped:!1}}function W(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var $=d(null),D=d(!1);function L({children:e,style:n,className:a="",onClose:s,minWidth:d=180,portal:u=!1}){const p=h(null),b=m(),[x,v]=f([]),E=h();g(()=>()=>clearTimeout(E.current),[]);const T=i(),M=y(()=>{const e=()=>clearTimeout(E.current);return{id:b,depth:0,path:x,open:(t,n)=>{e(),v(e=>N(e,t,n))},scheduleClose:t=>{e(),E.current=setTimeout(()=>v(e=>C(e,t)),200)},closeBelow:t=>{e(),v(e=>C(e,t))},cancelClose:e,closeTree:()=>{e(),v([]),s?.()},root:p}},[b,x,s]);g(()=>{if(!s)return;const e=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${b}"]`)||p.current&&!p.current.contains(e.target)&&s()},t=e=>{"Escape"===e.key&&s()};window.addEventListener("pointerdown",e),window.addEventListener("keydown",t);const n=r(s),o=l(()=>!1,()=>p.current);return()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t),n(),o()}},[s,b]),g(()=>{const e=p.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const D=W(),L=/(^|[\s:])!?z-/.test(a),j=/* @__PURE__ */k("div",{ref:p,"data-popup-menu-tree":b,className:`fixed rounded-(--radius-popup) ${"tight"===D?"py-1":"large"===D?"py-2":"py-1"} ${a}`,onContextMenu:e=>{t(e.target)||e.preventDefault()},style:{...L?{}:{zIndex:o.menu},minWidth:d,animation:"popup-in 0.12s ease-out",...c(),...n},children:/* @__PURE__ */k($.Provider,{value:M,children:e})});return u?T?w(j,document.body):null:j}function j(e,t,n,r=!1,o="kit"){const i=W(),a="tight"===i?"0.25rem":"large"===i?"0.6rem":0;return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${"none"===o?"":e?"text-red-600 not-disabled:not-aria-disabled:hover:bg-red-50":r?"bg-accent-tint text-blue-700":"text-ink not-disabled:not-aria-disabled:hover:bg-accent-tint not-disabled:not-aria-disabled:hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:a,paddingBottom:a,..."normal"===i?{minHeight:"calc(var(--row-height-menu, 2.25rem) + 2 * (var(--menu-padding-y, 0.5rem) - 0.5rem))"}:{}}}}var B=/* @__PURE__ */k(n,{name:"check","aria-hidden":!0,className:"h-4 w-4",strokeWidth:2});function H({kind:e,checked:t}){/* @__PURE__ */
|
|
2
|
+
return k("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&B}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&B})}var P=u(function({onClick:t,children:n,className:r="",danger:o,disabled:i,role:a,checked:l,icon:c,description:s,tabIndex:d,id:u,onMouseEnter:h},f){const g=p($),y=m(),b=null!=s&&!1!==s,w=`${u??y}-label`,N=`${u??y}-note`,C=p(D),E=j(o,i,r),T=void 0===l?null:"menuitemradio"===a?"radio":"checkbox";/* @__PURE__ */
|
|
3
3
|
return x("button",{ref:f,id:u,role:"radio"===T?"menuitemradio":"checkbox"===T?"menuitemcheckbox":a??(C?"menuitem":void 0),"aria-checked":T?l:void 0,"aria-labelledby":b?w:void 0,"aria-describedby":b?N:void 0,tabIndex:d,onClick:()=>{t?.(),g&&g.depth>0&&"checkbox"!==T&&g.closeTree()},onMouseEnter:()=>{g?.scheduleClose(g.depth),h?.()},disabled:i,className:E.className,style:E.style,children:[T&&/* @__PURE__ */k(H,{kind:T,checked:!!l}),b?
|
|
4
4
|
/* @__PURE__ */x("span",{className:"block min-w-0 flex-1 py-2",children:[
|
|
5
|
-
/* @__PURE__ */x("span",{className:"flex items-center gap-2",children:[null!=c&&/* @__PURE__ */k(
|
|
5
|
+
/* @__PURE__ */x("span",{className:"flex items-center gap-2",children:[null!=c&&/* @__PURE__ */k(R,{children:c}),
|
|
6
6
|
/* @__PURE__ */k("span",{id:w,className:"min-w-0",children:n})]}),
|
|
7
|
-
/* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:e(),style:null!=c?{paddingLeft:"1.5rem"}:void 0,children:s})]}):/* @__PURE__ */x(v,{children:[null!=c&&/* @__PURE__ */k(
|
|
8
|
-
return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var
|
|
7
|
+
/* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:e(),style:null!=c?{paddingLeft:"1.5rem"}:void 0,children:s})]}):/* @__PURE__ */x(v,{children:[null!=c&&/* @__PURE__ */k(R,{children:c}),n]})]})});function R({children:e}){/* @__PURE__ */
|
|
8
|
+
return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var A=/* @__PURE__ */k(n,{name:"chevron-right","aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto",strokeWidth:2});function F(e){let t=o.menu;for(let n=e;n&&n!==document.body;n=n.parentElement){const e=parseInt(getComputedStyle(n).zIndex,10);Number.isNaN(e)||(t=e)}return t}function S(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function I({label:e,icon:n,children:r,disabled:o,className:i="",minWidth:s=180,maxHeight:d,rowProps:u}){const f=p($),N=m(),C=h(null),E=h(null),D=h(),L=h(!1),B=`${N}-menu`;g(()=>()=>clearTimeout(D.current),[]);const H=f?.depth??0,P=f?.path[H],R=!!P&&P.key===N&&!o,I=b(e=>{if(!f||o||!C.current)return;clearTimeout(D.current),L.current=e;const t=C.current.getBoundingClientRect(),n=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,i=H>0&&(f.path[H-1]?.flipped??!1),a=M(r.left,r.right,s,window.innerWidth,4,i);f.open(H,{key:N,y:t.top,...a})},[f,o,H,N,s]),z=e=>{f?.closeBelow(H),C.current?.focus()};g(()=>{if(R)return l(e=>"Escape"===e.key&&(!(f&&f.path.length>H+1)&&(z(),!0)),()=>E.current)}),a(()=>{if(!R||!P)return;const e=()=>{const e=E.current;if(!e||!C.current)return;const t=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??C.current.getBoundingClientRect(),r=H>0&&(f?.path[H-1]?.flipped??!1),o=e.offsetWidth||s,i=M(n.left,n.right,o,window.innerWidth,4,r,8),a=e.offsetHeight,l=T(C.current.getBoundingClientRect().top+a/2,a,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${l}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),g(()=>{R&&L.current&&(L.current=!1,S(E.current)[0]?.focus())},[R]);const U=y(()=>f&&{...f,depth:H+1},[f,H]);if(!f)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const q=j(!1,o,i,R),Q=W();/* @__PURE__ */
|
|
9
9
|
return x(v,{children:[
|
|
10
|
-
/* @__PURE__ */x("button",{ref:C,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":
|
|
11
|
-
/* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:e}),
|
|
12
|
-
/* @__PURE__ */k("div",{ref:E,id:
|
|
10
|
+
/* @__PURE__ */x("button",{ref:C,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":R,"aria-controls":R?B:void 0,disabled:o,"data-popup-submenu-row":!0,className:q.className,style:q.style,onClick:e=>{const t=0===e.detail;R?t&&S(E.current)[0]?.focus():I(t)},...u,onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),I(!0))},onMouseEnter:()=>{u?.onMouseEnter?.(),o||(f.cancelClose(),R?f.closeBelow(H+1):(clearTimeout(D.current),D.current=setTimeout(()=>I(!1),120)))},onMouseLeave:()=>{clearTimeout(D.current),f.scheduleClose(H)},children:[n,
|
|
11
|
+
/* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:e}),A]}),R&&w(
|
|
12
|
+
/* @__PURE__ */k("div",{ref:E,id:B,role:"menu","data-popup-menu-tree":f.id,"data-popup-submenu-panel":!0,className:"fixed rounded-(--radius-popup) overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===Q?"py-1":"large"===Q?"py-2":"py-1"),style:{left:P.left,top:P.y,minWidth:s,maxHeight:void 0===d?"calc(100vh - 16px)":`min(${"number"==typeof d?`${d}px`:d}, calc(100vh - 16px))`,zIndex:F(f.root.current)+H+1,animation:(P.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...c()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=S(E.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),z())},onMouseEnter:()=>{f.cancelClose(),clearTimeout(D.current)},onMouseLeave:()=>f.scheduleClose(H+1),onContextMenu:e=>{t(e.target)||e.preventDefault()},children:/* @__PURE__ */k($.Provider,{value:U,children:r})}),document.body)]})}function z(){const e=W();/* @__PURE__ */
|
|
13
13
|
return k("div",{className:`border-t ${s} ${"tight"===e?"my-0.5":"large"===e?"my-2":"my-1"} mx-3`})}function U(){const e=W(),t="tight"===e?"0.125rem":"large"===e?"0.375rem":"0.25rem";return{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:t,paddingBottom:t}}function q({children:e}){/* @__PURE__ */
|
|
14
|
-
return k("div",{className:"text-xs font-medium uppercase tracking-wide",style:U(),children:e})}function
|
|
15
|
-
return k("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */k("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{H as MenuCheckMark,
|
|
14
|
+
return k("div",{className:"text-xs font-medium uppercase tracking-wide",style:U(),children:e})}function Q({d:e,className:t="h-4 w-4"}){/* @__PURE__ */
|
|
15
|
+
return k("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */k("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{H as MenuCheckMark,Q as MenuIcon,D as MenuSemanticsContext,L as PopupMenu,z as PopupMenuDivider,P as PopupMenuItem,q as PopupMenuLabel,I as PopupSubmenu,T as clampMenuTop,C as closeMenuBelow,j as itemLook,M as menuPanelLeft,U as menuTextRowStyle,N as openMenuLevel,E as resolveMenuLevels};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{Popover as e}from"./chunk-64RHGJXK.js";import{InputNumber_default as r}from"./chunk-
|
|
2
|
-
return v("button",{ref:l,type:o,"aria-pressed":a,className:N({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(e)})})}),z=(e,r,a)=>Math.min(a,Math.max(r,e)),D=e=>"string"==typeof e?{value:e}:e;function I(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:z(e.s+o[0],0,1),v:z(e.v+o[1],0,1)}:null}function
|
|
3
|
-
return w("div",{id:
|
|
1
|
+
import{Popover as e}from"./chunk-64RHGJXK.js";import{InputNumber_default as r}from"./chunk-63IGYBCQ.js";import{parseHexColor as a,hexToHsv as n,hsvToHex as o,hexReadout as t,HUE_GRADIENT as l,HEX_MAX_LENGTH as i,svFromPoint as s,hueFromPoint as c}from"./chunk-S6OB6HJB.js";import{inputClasses as u}from"./chunk-AYZY3YNC.js";import{Tooltip as d}from"./chunk-SOZCWT6I.js";import{useShellStrings as h}from"./chunk-JSHMIMAJ.js";import{forwardRef as g,useState as p,useRef as b,useEffect as m,useId as f}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var x={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},y={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function k(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function C(e,r){if(!e)return y;const a=k(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`}}function N({size:e="md",selected:r=!1,className:a=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",r?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",x[e],a].filter(Boolean).join(" ")}var $=g(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
|
|
2
|
+
return v("button",{ref:l,type:o,"aria-pressed":a,className:N({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(e)})})}),z=(e,r,a)=>Math.min(a,Math.max(r,e)),D=e=>"string"==typeof e?{value:e}:e;function I(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:z(e.s+o[0],0,1),v:z(e.v+o[1],0,1)}:null}function A(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,359);case"ArrowRight":case"ArrowUp":return z(e+n,0,359);case"PageDown":return z(e-10,0,359);case"PageUp":return z(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var M={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function P(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,100);case"ArrowRight":case"ArrowUp":return z(e+n,0,100);case"PageDown":return z(e-10,0,100);case"PageUp":return z(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function S({value:e,onChange:r,label:i,presets:u,clearable:g=!1,fallback:f,dragWrites:x="live",disabled:N=!1,opacity:z,onOpacityChange:S,onClose:j,id:K,className:T=""}){const R=h().color,H=k(z),U=e=>{const r=k(e);N||r===H||S?.(r)},L=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:H},Y=a(f??""),[E,J]=p(()=>n(e||Y||"")),W=b(e);m(()=>{e!==W.current&&(W.current=e,e?J(n(e)):Y&&J(n(Y)))},[e]);const X=a=>{N||a===e||(W.current=a,r(a))},q=e=>{const r=a(e);r&&(J(n(r)),X(r))},G=e=>{J(e),X(o(e))},[Z,F]=p(!1),Q=b(E);Q.current=E;const V=e=>({onPointerDown:r=>{if(N||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,Q.current);"end"===x?(F(!0),J(a)):G(a)},onPointerMove:r=>{if(N||!(1&r.buttons))return;const a=e(r,Q.current);"end"===x?J(a):G(a)},onPointerUp:r=>{"end"===x&&Z&&(F(!1),G(e(r,Q.current)))}}),_=V((e,r)=>({...r,...s(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),ee=V((e,r)=>({...r,h:c(e.clientX,e.currentTarget.getBoundingClientRect())})),re=Z?o(E):e,ae=e=>`${Math.round(100*e)}%`,ne=(u??[]).map(D),oe=a(e),te=re||Y||"";/* @__PURE__ */
|
|
3
|
+
return w("div",{id:K,className:`flex w-56 flex-col gap-3 ${N?"opacity-60":""} ${T}`.trim(),onKeyDown:e=>{"Escape"===e.key&&j&&(e.preventDefault(),e.stopPropagation(),j())},children:[(ne.length>0||g)&&/* @__PURE__ */w("div",{role:"group","aria-label":R.presets,className:"flex flex-wrap gap-2",children:[g&&/* @__PURE__ */v(d,{content:R.clear,children:/* @__PURE__ */v($,{color:"",size:"sm","aria-label":R.clear,selected:""===e,disabled:N,onClick:()=>{N||""===e||(W.current="",r(""))}})}),ne.map(e=>{const r=a(e.value),n=e.label?`${e.label} · ${t(r??e.value)}`:t(r??e.value);/* @__PURE__ */
|
|
4
4
|
return v(d,{content:n,children:/* @__PURE__ */v($,{color:r??e.value,size:"sm","aria-label":n,selected:null!==r&&r===oe,disabled:N,onClick:()=>q(e.value)})},`${e.label??""}:${e.value}`)})]}),
|
|
5
|
-
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":R.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*
|
|
6
|
-
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":R.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(
|
|
5
|
+
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":R.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*E.v),"aria-valuetext":R.squareValue(Math.round(100*E.s),Math.round(100*E.v)),"aria-disabled":N||void 0,"data-color-square":"",onKeyDown:e=>{if(N)return;const r=I(E,e.key,e.shiftKey);r&&(e.preventDefault(),G(r))},..._,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:o({h:E.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:ae(E.s),top:ae(1-E.v),...M}})}),
|
|
6
|
+
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":R.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(E.h),"aria-orientation":"horizontal","aria-disabled":N||void 0,"data-color-hue":"",onKeyDown:e=>{if(N)return;const r=A(E.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),G({...E,h:r}))},...ee,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:l},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:E.h/360*100+"%",background:o({h:E.h,s:1,v:1}),...M}})}),S&&/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":R.opacity(i),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":H,"aria-valuetext":`${H}%`,"aria-orientation":"horizontal","aria-disabled":N||void 0,"data-color-opacity":"",onKeyDown:e=>{if(N)return;const r=P(H,e.key,e.shiftKey);null!==r&&(e.preventDefault(),U(r))},onPointerDown:e=>{N||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),U(L(e)))},onPointerMove:e=>{!N&&1&e.buttons&&U(L(e))},className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:`linear-gradient(to right, transparent, ${te||"black"}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:`${H}%`,...C(te||"black",H),...M}})}),
|
|
7
7
|
/* @__PURE__ */w("div",{className:"flex items-center gap-2",children:[
|
|
8
|
-
/* @__PURE__ */v("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-line-strong",style:C(te,
|
|
9
|
-
/* @__PURE__ */v(B,{value:re,placeholder:!e&&
|
|
8
|
+
/* @__PURE__ */v("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-line-strong",style:C(te,S?H:null)}),
|
|
9
|
+
/* @__PURE__ */v(B,{value:re,placeholder:!e&&Y?t(Y):void 0,onChange:q,label:R.hex(i),disabled:N}),S&&/* @__PURE__ */v(O,{value:H,onChange:U,label:R.opacity(i),disabled:N})]})]})}var j={sm:"w-[calc(7ch+1rem+4px)] min-w-[calc(7ch+1rem+4px)]",md:"w-[calc(7ch+1.5rem+4px)] min-w-[calc(7ch+1.5rem+4px)]",lg:"w-[calc(7ch+2rem+4px)] min-w-[calc(7ch+2rem+4px)]"},K={sm:"h-6",md:"h-8",lg:"h-10"},T=["block w-[calc(7ch+0.5rem+4px)] min-w-[calc(7ch+0.5rem+4px)] flex-none rounded-(--radius-control)","border border-transparent bg-transparent px-1 text-2xs font-mono uppercase","text-ink-strong placeholder:text-[color:var(--ink-placeholder)] hover:border-gray-300","focus:border-blue-400 focus:bg-(--surface) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)]","disabled:cursor-not-allowed disabled:opacity-60"].join(" ");function B({value:e,onChange:r,label:n,placeholder:o,disabled:l,id:s,size:c="md",look:d="box",className:h=""}){const[g,b]=p(null),m="text"===d?`${T} ${K[c]} ${h}`.trim():u({size:c,className:`${j[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
|
|
10
10
|
return v("input",{id:s,type:"text",value:g??(e?t(e):""),"aria-label":n,placeholder:o,maxLength:i,spellCheck:!1,autoComplete:"off",disabled:l,onChange:n=>{b(n.target.value);const o=a(n.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),b(null))},onBlur:()=>b(null),"data-hex-look":d,className:m})}function O({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
|
|
11
|
-
return v("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */v(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function R({value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:g=!1,opacity:p,onOpacityChange:b,size:m="md",align:x="start",open:y,onOpenChange:$,className:z=""}){const D=h().color,I=k(p),
|
|
11
|
+
return v("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */v(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function R({value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:g=!1,opacity:p,onOpacityChange:b,size:m="md",align:x="start",open:y,onOpenChange:$,className:z=""}){const D=h().color,I=k(p),A=f(),M=a(s??""),P=r||M||"",j=r?t(r):M?t(M):D.none;
|
|
12
12
|
/* @__PURE__ */
|
|
13
13
|
return w("div",{className:`inline-flex items-center ${b?"flex-wrap justify-end gap-1":g?"gap-1":"gap-2"} ${z}`.trim(),children:[
|
|
14
|
-
/* @__PURE__ */v(e,{id:d,trigger:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(
|
|
15
|
-
/* @__PURE__ */v(B,{value:r,placeholder:!r&&
|
|
14
|
+
/* @__PURE__ */v(e,{id:d,trigger:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(P,b?I:null)}),triggerLabel:D.swatch(o,j),triggerClassName:N({size:m}),"aria-label":D.panel(o),align:x,open:y,onOpenChange:$,disabled:u,children:/* @__PURE__ */v(S,{id:A,value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),g&&
|
|
15
|
+
/* @__PURE__ */v(B,{value:r,placeholder:!r&&M?t(M):void 0,onChange:e=>{u||e===r||n(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */v(O,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{R as ColorPicker,S as ColorPickerPanel,$ as ColorSwatch,B as HexInput,y as NO_COLOR_FILL,k as clampOpacity,C as colorFill,N as colorSwatchClasses,A as stepHue,P as stepOpacity,I as stepSquare};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Banner as e}from"./chunk-
|
|
1
|
+
import{Banner as e}from"./chunk-ATZ262BR.js";import{Button_default as t}from"./chunk-EVYD6UFQ.js";import{useShellStrings as n}from"./chunk-JSHMIMAJ.js";import{useState as r,useEffect as i}from"react";import{jsx as o,jsxs as a}from"react/jsx-runtime";var s=6e4;function c({currentVersion:e,versionUrl:t="/version.json",pollMs:n=6e4}){const[o,a]=r(null);return i(()=>{if(!e||null!==o)return;let r=!1;const i=async()=>{if("undefined"==typeof document||"hidden"!==document.visibilityState)try{const n=t.includes("?")?"&":"?",i=await fetch(`${t}${n}t=${Date.now()}`,{cache:"no-store"});if(!i.ok)return;const o=await i.json(),s=o&&"object"==typeof o&&"string"==typeof o.version?o.version:null;!r&&s&&s!==e&&a(s)}catch{}};i();const s=setInterval(()=>{i()},n),c=()=>{"visible"===document.visibilityState&&i()};return document.addEventListener("visibilitychange",c),()=>{r=!0,clearInterval(s),document.removeEventListener("visibilitychange",c)}},[e,t,n,o]),o}function l({currentVersion:r,versionUrl:i,pollMs:s,message:l,onRefresh:m,className:u=""}){const d=c({currentVersion:r,versionUrl:i,pollMs:s}),p=n();if(null===d)return null;const f=m??(()=>window.location.reload());/* @__PURE__ */
|
|
2
2
|
return o("div",{"data-app-update-banner":"",className:`fixed left-1/2 top-3 z-(--z-toast) w-max max-w-[calc(100vw-1.5rem)] -translate-x-1/2 ${u}`.trim(),children:/* @__PURE__ */a(e,{tone:"warning",className:"shadow-lg",action:/* @__PURE__ */o(t,{type:"button",variant:"primary",size:"md",onClick:f,children:p.update.refreshNow}),children:[
|
|
3
3
|
/* @__PURE__ */o("span",{className:"font-medium",children:l??p.update.available}),
|
|
4
4
|
/* @__PURE__ */a("span",{className:"ml-2 whitespace-nowrap font-mono text-xs text-gray-500",children:[r," → ",d]})]})})}export{s as APP_UPDATE_POLL_MS,l as AppUpdateBanner,c as useAppUpdate};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Icon as e}from"./chunk-
|
|
1
|
+
import{Icon as e}from"./chunk-ISVODSRP.js";import{DEFAULT_SHELL_STRINGS as t}from"./chunk-JSHMIMAJ.js";import{jsx as r}from"react/jsx-runtime";var n=["left","center","right","justify"],a={left:"align-left",center:"align-center",right:"align-right",justify:"align-justify"};function i(t){switch(t){case"left":/* @__PURE__ */
|
|
2
2
|
return r(e,{name:"align-left"});case"center":/* @__PURE__ */
|
|
3
3
|
return r(e,{name:"align-center"});case"right":/* @__PURE__ */
|
|
4
4
|
return r(e,{name:"align-right"});case"justify":/* @__PURE__ */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{IconButton_default as e}from"./chunk-SV5RRBVA.js";import{CloseGlyph as t}from"./chunk-
|
|
1
|
+
import{IconButton_default as e}from"./chunk-SV5RRBVA.js";import{CloseGlyph as t}from"./chunk-7GJIIBJD.js";import{humanSize as n,useFileIntake as r,FileIntakeAlert as a}from"./chunk-V4XR4MOS.js";import{Button_default as s}from"./chunk-EVYD6UFQ.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{useShellStrings as c}from"./chunk-JSHMIMAJ.js";import{useRef as l,useEffect as o}from"react";import{jsx as d,jsxs as u}from"react/jsx-runtime";function m({className:e="h-4 w-4"}){/* @__PURE__ */
|
|
2
2
|
return d(i,{name:"attach",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function p({className:e="h-4 w-4"}){/* @__PURE__ */
|
|
3
3
|
return d(i,{name:"page",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function h({intake:e,dropLabel:t,className:n="",children:r}){const a=c().files;/* @__PURE__ */
|
|
4
4
|
return u("div",{...e.zoneProps,...e.pasteProps,className:`relative ${n}`,children:[r,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Icon as e}from"./chunk-
|
|
1
|
+
import{Icon as e}from"./chunk-ISVODSRP.js";import{useShellStrings as t}from"./chunk-JSHMIMAJ.js";import{useState as r,useRef as o,useEffect as c,useCallback as i}from"react";import{jsx as n}from"react/jsx-runtime";function a(e){const[t,n]=r(!1),a=o(void 0);c(()=>()=>clearTimeout(a.current),[]);return{copied:t,copy:i(t=>{t?.stopPropagation(),navigator.clipboard?.writeText(e).then(()=>{n(!0),clearTimeout(a.current),a.current=setTimeout(()=>n(!1),1500)},()=>{})},[e])}}function u({copied:t,className:r="w-4 h-4"}){/* @__PURE__ */
|
|
2
2
|
return n(e,t?{name:"check",className:`${r} text-green-600`,"aria-hidden":"true"}:{name:"copy",className:r,"aria-hidden":"true"})}function m({text:e}){const{copied:r,copy:o}=a(e),c=t().copy;/* @__PURE__ */
|
|
3
3
|
return n("button",{onClick:o,title:r?c.copiedValue:c.copyValue(e),className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:/* @__PURE__ */n(u,{copied:r})})}export{m as CopyButton,u as CopyGlyph,a as useCopyText};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{useOverlayTarget as e,usePopupAnchor as t,usePopupLevel as r,usePopupLevelBindings as i,windowScrimStyle as o,OverlayLayerProvider as n,scrimHasCorners as l,popupLayerStyle as s}from"./chunk-RIG5FEVS.js";import{useDiscardGuard as a}from"./chunk-TGLUENXE.js";import{dialogA11y as d}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as c}from"./chunk-7QSDPSXP.js";import{useFocusTrap as m,useScrollLock as h}from"./chunk-DWGYC7OD.js";import{Icon as u}from"./chunk-ISVODSRP.js";import{useHydrated as p}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as f}from"./chunk-TWVUQUUD.js";import{useShellStrings as b}from"./chunk-JSHMIMAJ.js";import{useRef as g,useId as x,useState as y,useEffect as v}from"react";import{createPortal as w}from"react-dom";import{jsxs as k,Fragment as N,jsx as j}from"react/jsx-runtime";var C={sm:"sm:w-[320px]",md:"sm:w-[448px]",lg:"sm:w-[640px]"},D={right:"inset-y-0 right-0",left:"inset-y-0 left-0",bottom:"inset-x-0 bottom-0"};function S(e,t){const r=window.innerHeight-(t.top+t.height);if("bottom"===e)return{left:t.left,width:t.width,bottom:r};const i={top:t.top,height:t.height};return"left"===e?{...i,left:t.left}:{...i,right:window.innerWidth-(t.left+t.width)}}function W({onClose:e}){const t=b().dialog;/* @__PURE__ */
|
|
2
|
+
return j("button",{type:"button",onClick:e,"aria-label":t.close,className:"rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */j(u,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})}function E({open:u,onClose:b,side:E="right",size:G="md",title:H,description:I,footer:U,children:V,blocking:J=!1,dirty:P=!1,initialFocus:T,"aria-label":z,"aria-labelledby":A,"aria-describedby":B,className:F=""}){const L=g(null),M=x(),O=x(),Q=x(),R=e(p()),[X,Y]=y(null),Z=a({open:u,dirty:P,onClose:b,title:H,layer:X}),$=g(null),q=t(u&&null!==R,$),K=r(u&&null!==R,$),_=i(K,X),ee=o(K),te=null!==K.host;if(c(u),m(L,u&&null!==R,T,_),h(u),v(()=>{if(u)return f(()=>!_.current?.(document.activeElement)&&(J||Z(),!0),()=>L.current)},[u,J,Z,_]),!u||!R)return null;const re="bottom"===E,ie={...re?{maxHeight:"85vh"}:{},...q?S(E,q):{}};/* @__PURE__ */
|
|
3
|
+
return k(N,{children:[/* @__PURE__ */j("span",{ref:$,hidden:!0,"data-popup-anchor":""}),w(
|
|
4
|
+
/* @__PURE__ */j(n,{value:X,children:/* @__PURE__ */k("div",{ref:Y,className:te?"fixed inset-0 pointer-events-none":"fixed inset-0",style:s(K),role:"presentation","data-overlay-layer":"",children:[
|
|
5
|
+
/* @__PURE__ */j("div",{className:"fixed bg-black/30 backdrop-blur-sm "+(te?"pointer-events-auto"+(l(K)?" rounded-(--radius-window)":""):"inset-0"),style:ee??void 0,hidden:te&&!ee,onClick:J?void 0:Z,"aria-hidden":"true","data-popup-scrim":te?"window":"system"}),
|
|
6
|
+
/* @__PURE__ */k("div",{ref:L,...d({modal:!0,titleId:H?Q:void 0,labelledBy:A,label:z}),"aria-describedby":B??(I?O:V?M:void 0),"data-drawer-side":E,"data-popup-panel":"",style:ie,className:["fixed flex flex-col bg-white shadow-xl",te?"pointer-events-auto":"",re?"":`w-full max-w-full ${C[G]}`,q?"":D[E],re?"rounded-t-xl":"",F].filter(Boolean).join(" "),children:[H?/* @__PURE__ */k("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3",children:[
|
|
7
|
+
/* @__PURE__ */k("div",{className:"min-w-0",children:[
|
|
8
|
+
/* @__PURE__ */j("h2",{id:Q,className:"text-base font-semibold text-gray-900",children:H}),I&&/* @__PURE__ */j("p",{id:O,className:"mt-0.5 text-sm text-gray-500",children:I})]}),!J&&/* @__PURE__ */j(W,{onClose:Z})]}):!J&&/* @__PURE__ */j("div",{className:"absolute right-2 top-2 z-10",children:/* @__PURE__ */j(W,{onClose:Z})}),
|
|
9
|
+
/* @__PURE__ */k("div",{id:M,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[I&&!H&&/* @__PURE__ */j("p",{id:O,className:("mb-3 text-sm text-gray-500 "+(J?"":"pr-8")).trim(),children:I}),V]}),U&&/* @__PURE__ */j("div",{className:"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3",children:U})]})]})}),R)]})}export{E as Drawer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{InputNumber_default as a,stepRounding as e}from"./chunk-
|
|
1
|
+
import{InputNumber_default as a,stepRounding as e}from"./chunk-63IGYBCQ.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{jsxs as n,jsx as i}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={x:/* @__PURE__ */i(r,{name:"nudge-x","aria-hidden":"true",className:l}),y:/* @__PURE__ */i(r,{name:"nudge-y","aria-hidden":"true",className:l})};function m({label:r,value:l,onChange:m,words:t,placeholder:d,min:o=-200,max:c=200,step:u=1,readOnly:p,units:h}){const x=r=>/* @__PURE__ */i("div",{"data-axis":r,className:"min-w-0",children:/* @__PURE__ */i(a,{value:l[r],onChange:a=>m({...l,[r]:a}),min:o,max:c,step:u,...e(u),steppers:"compact",readOnly:p,placeholder:d[r],prefix:s[r],suffix:t.unit,units:h,"aria-label":t[r]})});/* @__PURE__ */
|
|
2
2
|
return n("div",{role:"group","aria-label":r,className:"grid min-w-0 grid-cols-2 gap-2",children:[x("x"),x("y")]})}export{m as PositionInput};
|