efficient-shell 12.18.0 → 12.20.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-U6V2IAOZ.js → Browser-Z7NIFAGY.js} +14 -14
- package/dist/Calculator-OUPD7SZV.js +29 -0
- package/dist/{CurrencyConverter-34AMD4W7.js → CurrencyConverter-CNGYEKE3.js} +9 -9
- package/dist/Files-KOUPCFRC.js +141 -0
- package/dist/{Notepad-F3Z4ZFVY.js → Notepad-Y37G5PTB.js} +9 -9
- package/dist/{PdfViewer-F2TCC5UD.js → PdfViewer-UY5SRC63.js} +1 -1
- package/dist/{PomodoroTimer-6WR3UOOM.js → PomodoroTimer-I53C5QYM.js} +65 -65
- package/dist/{Preview-HSW3BKA5.js → Preview-GB33WBQY.js} +24 -24
- package/dist/{Sidebar-ADAIERCI.js → Sidebar-BKNCPUOE.js} +37 -37
- package/dist/{Stock-UAGSFAKY.js → Stock-JY3PJI2M.js} +2 -2
- package/dist/{Weather-G2VGEQX2.js → Weather-POQXLYFA.js} +17 -17
- package/dist/{WorldClock-43KK7OTT.js → WorldClock-FUJOPJ5G.js} +6 -6
- package/dist/ai/index.d.ts +117 -3
- package/dist/ai/index.js +95 -75
- 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-MFJHLC5M.js → chunk-34EBBZFK.js} +1 -1
- package/dist/{chunk-T3JSUBIF.js → chunk-34TQBJ7I.js} +1 -1
- package/dist/{chunk-EEAY7FJW.js → chunk-3CKYFCX4.js} +18 -18
- package/dist/{chunk-FQHPGREQ.js → chunk-3E3LR2PM.js} +12 -12
- package/dist/{chunk-KSMEWOCE.js → chunk-3J3FBYIZ.js} +1 -1
- package/dist/{chunk-JAVTQART.js → chunk-3JL4TCA7.js} +1 -1
- package/dist/{chunk-DVYBJOD3.js → chunk-436PJFHC.js} +10 -10
- package/dist/{chunk-DCNSQGHJ.js → chunk-4ZLFAXOC.js} +11 -11
- package/dist/{chunk-24LO6OH4.js → chunk-4ZRGMK7Y.js} +1 -1
- package/dist/{chunk-7ARBBWPQ.js → chunk-6FZ5JTBY.js} +2 -2
- package/dist/{chunk-7X2P6IH3.js → chunk-6GWYFUME.js} +5 -5
- package/dist/{chunk-ZKGUBIBT.js → chunk-6RK6R3RY.js} +1 -1
- package/dist/{chunk-XJW65EIG.js → chunk-7LTU5TJD.js} +1 -1
- package/dist/{chunk-XKJGJNY2.js → chunk-B4GRHE44.js} +3 -3
- package/dist/{chunk-4KXATGI3.js → chunk-BDGYRQQE.js} +5 -5
- package/dist/{chunk-ZE7OVMDM.js → chunk-BM2QIV64.js} +22 -22
- package/dist/{chunk-QPYVCG74.js → chunk-CCK2UWQ5.js} +10 -10
- package/dist/{chunk-WQ4YKWN2.js → chunk-CJHYOHMU.js} +1 -1
- package/dist/chunk-D2WJAF62.js +4 -0
- package/dist/{chunk-6TIJH2M6.js → chunk-DCCYUCBM.js} +1 -1
- package/dist/{chunk-Y6E7IRK2.js → chunk-DK5SXOXJ.js} +1 -1
- package/dist/{chunk-Z62RBVEJ.js → chunk-DTSOYFQE.js} +1 -1
- package/dist/chunk-EEGTFJUQ.js +28 -0
- package/dist/{chunk-4BKJ6A5H.js → chunk-F4XGUOVL.js} +4 -4
- package/dist/{chunk-I76W4ZNU.js → chunk-FBUFB536.js} +4 -4
- package/dist/{chunk-RMDVKQJE.js → chunk-FE5DH5OM.js} +2 -2
- package/dist/{chunk-LQVQX5B2.js → chunk-FQ4IRBMA.js} +1 -1
- package/dist/{chunk-W7DYKTHE.js → chunk-FTMCNC66.js} +1 -1
- package/dist/{chunk-LNZMA4PB.js → chunk-GEZM6ARD.js} +1 -1
- package/dist/{chunk-RAOM3WIQ.js → chunk-GLRRX4AL.js} +1 -1
- package/dist/chunk-HMT3MES3.js +27 -0
- package/dist/{chunk-3A6FYWFQ.js → chunk-HOEHV2J5.js} +1 -1
- package/dist/{chunk-5MH5N76F.js → chunk-I7JU4IU3.js} +4 -4
- package/dist/{chunk-MBCUICY3.js → chunk-ILDPJ26Y.js} +1 -1
- package/dist/{chunk-XG5ER6GJ.js → chunk-JGRDG7CB.js} +5 -5
- package/dist/{chunk-HYPYNVQQ.js → chunk-JN5NUZ6D.js} +1 -1
- package/dist/{chunk-VYRVSTI6.js → chunk-KBI3T6UC.js} +9 -9
- package/dist/{chunk-UULBPDAH.js → chunk-KP2JYXEU.js} +8 -8
- package/dist/{chunk-GJLN4NRB.js → chunk-L2Y6FZTA.js} +6 -6
- package/dist/chunk-L4QGZ26E.js +1 -0
- package/dist/{chunk-H4ABSQS6.js → chunk-L543DFHF.js} +1 -1
- package/dist/chunk-LCEQIFPK.js +3 -0
- package/dist/{chunk-2DQHXJPM.js → chunk-LPPJNZQ6.js} +3 -3
- package/dist/{chunk-NKP5WCEA.js → chunk-MFEPLP7Y.js} +6 -6
- package/dist/{chunk-WYGUHCJ2.js → chunk-N32LNPPP.js} +8 -8
- package/dist/{chunk-YU52WMSH.js → chunk-N3R6N7LG.js} +1 -1
- package/dist/{chunk-ZQT3GNRU.js → chunk-NAN2IW2H.js} +2 -2
- package/dist/{chunk-ZTRKM3B5.js → chunk-OG53D3R5.js} +9 -9
- package/dist/{chunk-OFYNPYY2.js → chunk-OGWQABFP.js} +1 -1
- package/dist/{chunk-EDX55XGV.js → chunk-OLCRYT3N.js} +8 -8
- package/dist/chunk-OQ6TECLX.js +6 -0
- package/dist/{chunk-DQMRPTGY.js → chunk-P54AD2EM.js} +3 -3
- package/dist/{chunk-J2YURAQY.js → chunk-QG37GJP2.js} +6 -6
- package/dist/{chunk-42XSMAIK.js → chunk-QI4235JY.js} +1 -1
- package/dist/{chunk-JTGRLXZN.js → chunk-QMSINDXL.js} +1 -1
- package/dist/{chunk-H32UNWVU.js → chunk-QPSJYSET.js} +5 -5
- package/dist/{chunk-35CKKH2S.js → chunk-QTXXHKAV.js} +1 -1
- package/dist/{chunk-HJF4UZOA.js → chunk-QZCLHKCI.js} +8 -8
- package/dist/{chunk-3ZQT26GZ.js → chunk-R62JKPYY.js} +1 -1
- package/dist/{chunk-5DQE6RQJ.js → chunk-RKXCB5ZJ.js} +1 -1
- package/dist/{chunk-6A26HUVK.js → chunk-RY7JCGLI.js} +1 -1
- package/dist/{chunk-GOEHP2XM.js → chunk-S7MNRAYS.js} +4 -4
- package/dist/{chunk-YVHEKEHJ.js → chunk-SET3R227.js} +1 -1
- package/dist/chunk-SFULX4E3.js +7 -0
- package/dist/{chunk-YK64FFLW.js → chunk-SSNTJ3M4.js} +4 -4
- package/dist/{chunk-3FNBUOZK.js → chunk-SY66VJAI.js} +1 -1
- package/dist/{chunk-4I4WZHMV.js → chunk-T2TZBTSM.js} +1 -1
- package/dist/{chunk-ZICGXJUB.js → chunk-THLXDI76.js} +8 -8
- package/dist/{chunk-MJVFIH3J.js → chunk-TKUJUQK4.js} +9 -9
- package/dist/chunk-TM4CRQ3W.js +19 -0
- package/dist/chunk-UP4HLGMZ.js +9 -0
- package/dist/{chunk-WLUJQLXG.js → chunk-UR2ECNBB.js} +1 -1
- package/dist/{chunk-OVD3ECM7.js → chunk-VLMBXPRM.js} +1 -1
- package/dist/{chunk-MRLXGLNZ.js → chunk-VQ4X3OBR.js} +1 -1
- package/dist/chunk-WLX24TG6.js +14 -0
- package/dist/{chunk-PDA77NNC.js → chunk-X34ZBXIU.js} +3 -3
- package/dist/{chunk-TKPUYQ3Q.js → chunk-XQNZJNEJ.js} +73 -73
- package/dist/{chunk-JOAKKXTL.js → chunk-XZXFUZIK.js} +3 -2
- package/dist/{chunk-56XKHWNL.js → chunk-Y523KUQC.js} +1 -1
- package/dist/{chunk-ILIPEY3D.js → chunk-YI6SYUAK.js} +1 -1
- package/dist/{chunk-B2KQ3T7Q.js → chunk-YIUWX2IU.js} +6 -6
- package/dist/{chunk-PJE75B66.js → chunk-YRY64DQV.js} +1 -1
- package/dist/{chunk-I3TVRNUT.js → chunk-Z3CTYK3U.js} +1 -1
- package/dist/{chunk-YTZFWV2W.js → chunk-ZLKEPDJE.js} +1 -1
- package/dist/chunk-ZQ24H5UO.js +13 -0
- package/dist/data/EntityList.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/format/index.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 +493 -493
- package/dist/map/index.js +2 -2
- 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/SettingRow.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/Calculator-4VBPCGRP.js +0 -29
- package/dist/Files-V67UDEO6.js +0 -141
- package/dist/chunk-25QDSYH5.js +0 -13
- package/dist/chunk-3PSLQJWR.js +0 -1
- package/dist/chunk-5QYKF7NK.js +0 -27
- package/dist/chunk-L7MWAC2P.js +0 -6
- package/dist/chunk-PMBCQWJW.js +0 -4
- package/dist/chunk-PZSVISYY.js +0 -28
- package/dist/chunk-QBWMWK2W.js +0 -7
- package/dist/chunk-RMKC5POE.js +0 -3
- package/dist/chunk-S3OCHYGE.js +0 -14
- package/dist/chunk-VJXPT53M.js +0 -19
- package/dist/chunk-YFUY3VDW.js +0 -9
- /package/dist/{chunk-2VFSYSDS.js → chunk-5WK56FA3.js} +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import{Calendar as e}from"./chunk-
|
|
2
|
-
/* @__PURE__ */D("button",{type:"button",onClick:()=>le("Custom"),className:Je("Custom"),children:
|
|
3
|
-
/* @__PURE__ */D(e,{mode:"range",min:
|
|
4
|
-
return
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
1
|
+
import{Calendar as e}from"./chunk-CCK2UWQ5.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-6RK6R3RY.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-XZXFUZIK.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 C}from"react";import{createPortal as M}from"react-dom";import{jsxs as W,Fragment as j,jsx as D}from"react/jsx-runtime";var $=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],Y=t;function F(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 S(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 L({from:t,to:n,onChange:m,formatDisplay:Y,clearable:L,required:R=!1,name:J,id:U,"aria-labelledby":B,"aria-label":I,weekStartsOn:T,placeholder:A,fullWidth:E=!1,min:G,max:K,disabled:Z=!1,allowOpenEnd:q=!1}){const X=v().dateRange,P=y(),Q=Y??(P?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}}(P):H),z=A??X.placeholder,V=L??!R,[_,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,Ce]=w(!1);g(()=>{const e=!!U&&(de.current?.labels?.length??0)>0;e!==Ne&&Ce(e)});const Me=!!I||!!B||Ne,We=/* @__PURE__ */new Date,[je,De]=w(()=>t?t.slice(0,7):S(We,G,K)),$e=$.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(F(e,We),G,K)),Ye=e=>e?Q(e):"";C(()=>{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()}},[_]),C(()=>{Z&&ee(!1)},[Z]);const Fe=()=>{m("",""),ee(!1)},Se=V&&!Z&&Boolean(t||n),He=t&&n?`${Ye(t)} — ${Ye(n)}`:t?X.fromOnly(Ye(t)):n?X.toOnly(Ye(n)):"",Oe=d(P),Le=e=>{const t=r(e);return t?Oe.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},Re=t&&n?X.range(Le(t),Le(n)):t?X.fromOnly(Le(t)):n?X.toOnly(Le(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"),Ue=/* @__PURE__ */W(j,{children:[$e.map(e=>/* @__PURE__ */D("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=F(e,We);re(t.from),ae(t.to),le(e),De(t.from.slice(0,7))})(e),className:Je(e),"aria-label":fe?X[e]:void 0,children:fe?ye?X[e]:X[`${e}Short`]:X[e]},e)),
|
|
2
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>le("Custom"),className:Je("Custom"),children:X.custom})]}),Be=(e,t)=>q?/* @__PURE__ */D("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__ */D("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Ie=e=>q&&ie===e?" ring-1 ring-blue-400":"",Te=
|
|
3
|
+
/* @__PURE__ */D(e,{mode:"range",min:G,max:K,value:te||null,endValue:ne||null,month:je,onMonthChange:De,onSelect:e=>{le("Custom"),q?"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:T,"aria-label":X.dialog});/* @__PURE__ */
|
|
4
|
+
return W("div",{className:"relative"+(E?" w-full":""),ref:ce,children:[
|
|
5
|
+
/* @__PURE__ */W("div",{className:`relative ${E?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 ${Se?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}${Z?" cursor-not-allowed opacity-60":""}`,children:[
|
|
6
|
+
/* @__PURE__ */W("button",{ref:de,type:"button",onClick:()=>{Z||(re(t),ae(n),le(null),se(t&&!n?"to":"from"),De(t?t.slice(0,7):S(We,G,K)),ee(!0))},"aria-haspopup":"dialog","aria-expanded":_,id:U,disabled:Z||void 0,"aria-label":I,"aria-labelledby":B,"aria-describedby":[Me?he:void 0,R?pe:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":_?ue:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(E?" min-w-0 flex-1 justify-start":""),children:[
|
|
7
7
|
/* @__PURE__ */D(u,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
|
|
8
|
-
/* @__PURE__ */D("span",{className:"truncate",children:
|
|
9
|
-
/* @__PURE__ */D("input",{type:"hidden",name:J.from,value:t,disabled:
|
|
10
|
-
/* @__PURE__ */D("input",{type:"hidden",name:J.to,value:n,disabled:
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */D("span",{className:"text-xs font-medium text-gray-500",children:
|
|
14
|
-
/* @__PURE__ */D("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"}${
|
|
15
|
-
/* @__PURE__ */D("span",{className:"text-xs font-medium text-gray-500",children:
|
|
16
|
-
/* @__PURE__ */D("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"}${
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */D("div",{className:"w-full",children:
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */D("div",{className:"w-64",children:
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */D("button",{type:"button",onClick:()=>ee(!1),className:b({variant:"secondary"}),children:
|
|
23
|
-
/* @__PURE__ */D("button",{type:"button",onClick:()=>{m(te,ne),ee(!1)},disabled:
|
|
8
|
+
/* @__PURE__ */D("span",{className:"truncate",children:He||z})]}),Se&&/* @__PURE__ */D(o,{children:/* @__PURE__ */D(l,{action:{label:X.clearRange,icon:/* @__PURE__ */D(u,{name:"close"}),onClick:Fe}})})]}),Me&&/* @__PURE__ */D("span",{id:he,className:"sr-only",children:Re}),R&&/* @__PURE__ */D("span",{id:pe,className:"sr-only",children:X.required}),J&&/* @__PURE__ */W(j,{children:[
|
|
9
|
+
/* @__PURE__ */D("input",{type:"hidden",name:J.from,value:t,disabled:Z||void 0}),
|
|
10
|
+
/* @__PURE__ */D("input",{type:"hidden",name:J.to,value:n,disabled:Z||void 0})]}),_&&M(
|
|
11
|
+
/* @__PURE__ */W("div",{ref:me,id:ue,role:"dialog","aria-label":X.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__ */W("div",{className:fe?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[Be("from",/* @__PURE__ */W(j,{children:[
|
|
13
|
+
/* @__PURE__ */D("span",{className:"text-xs font-medium text-gray-500",children:X.from}),
|
|
14
|
+
/* @__PURE__ */D("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"}${Ie("from")}`,children:te?Ye(te):X.start})]})),!fe&&/* @__PURE__ */D("span",{className:"text-gray-300",children:"—"}),Be("to",/* @__PURE__ */W(j,{children:[
|
|
15
|
+
/* @__PURE__ */D("span",{className:"text-xs font-medium text-gray-500",children:X.to}),
|
|
16
|
+
/* @__PURE__ */D("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"}${Ie("to")}`,children:ne?Ye(ne):X.end})]}))]}),fe?/* @__PURE__ */W(j,{children:[$e.length>0&&/* @__PURE__ */W("div",{className:"mb-3 @container",children:[!ye&&/* @__PURE__ */D("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:X.lastHeading}),
|
|
17
|
+
/* @__PURE__ */W("div",{ref:ve,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Ue,$e.map(e=>/* @__PURE__ */D("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:X[e]},e))]})]}),
|
|
18
|
+
/* @__PURE__ */D("div",{className:"w-full",children:Te})]}):
|
|
19
|
+
/* @__PURE__ */W("div",{ref:xe,className:"flex w-max gap-4",children:[
|
|
20
|
+
/* @__PURE__ */D("div",{className:"w-64",children:Te}),$e.length>0&&/* @__PURE__ */D("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Ue})]}),
|
|
21
|
+
/* @__PURE__ */W("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[V&&/* @__PURE__ */D("button",{type:"button",onClick:Fe,className:b({variant:"ghost"}),children:X.clear}),
|
|
22
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>ee(!1),className:b({variant:"secondary"}),children:X.cancel}),
|
|
23
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>{m(te,ne),ee(!1)},disabled:q?!te&&!ne:!te||!ne,className:b({variant:"primary"}),children:X.apply})]})]}),document.body)]})}export{L as DateRangePicker,F 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-XZXFUZIK.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:C,quickJump:S=!0,markedDates:J,readOnly:K=!1,"aria-label":q,className:H=""}){const P=g(()=>new Set(J??[]),[J]),W=e(w),I=i(v,null),O=e(I),U=s().calendar,X=c(),$=n(X),E=i(()=>o(X),0),L=C??E,Z=()=>{if(!O)return null;const e=t(O);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||(W?t(W):Z())),R=F??B??Z(),T=null===R?null:function(e,t){return a(e)??t}(R,O),[V,z]=u(()=>w??I),Q=d(null),_=d(!1),[ee,te]=u("days"),re=g(()=>T?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))}(T,L):[],[R,L]),ae=e=>!!Y&&e<Y||!!k&&e>k,ne=V??I,oe=re.some(e=>r(e)===ne),le=T?re.find(e=>e.getMonth()===T.getMonth())??re[0]:null,ie=oe&&ne?ne:le?r(le):"";if(h(()=>{_.current&&(_.current=!1,Q.current?.querySelector('[data-active="true"]')?.focus())},[ie,R]),!T)/* @__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(T.getFullYear()+12*e,T.getMonth(),1):"months"===ee?new Date(T.getFullYear()+e,T.getMonth(),1):x(T,e),ce=e=>{const r=t(e);void 0===F&&G(r),A?.(r)},ge=q??$.monthYear(T.getFullYear(),T.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:S?/* @__PURE__ */m(b,{children:["years"!==ee&&/* @__PURE__ */f("button",{type:"button","aria-label"
|
|
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":K?i:void 0,children:K?/* @__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===
|
|
7
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":"years"===ee?U.previousYears:"months"===ee?U.previousYear:U.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:S?/* @__PURE__ */m(b,{children:["years"!==ee&&/* @__PURE__ */f("button",{type:"button","aria-label":U.chooseMonth($.months[T.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:$.months[T.getMonth()]}),
|
|
9
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":U.chooseYear(T.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:T.getFullYear()})]}):/* @__PURE__ */f("span",{children:$.monthYear(T.getFullYear(),T.getMonth())})}),
|
|
10
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":"years"===ee?U.nextYears:"months"===ee?U.nextYear:U.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":U.monthPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:$.monthsShort.map((e,t)=>/* @__PURE__ */f("button",{type:"button","aria-pressed":t===T.getMonth(),onClick:()=>{ce(new Date(T.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===T.getMonth()?"bg-blue-600 font-semibold text-white":O&&t===O.getMonth()&&T.getFullYear()===O.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":U.yearPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Array.from({length:12},(e,t)=>{return r=T.getFullYear(),12*Math.floor(r/12)+t;var r}).map(e=>/* @__PURE__ */f("button",{type:"button","aria-pressed":e===T.getFullYear(),onClick:()=>{ce(new Date(e,T.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===T.getFullYear()?"bg-blue-600 font-semibold text-white":e===O?.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:Q,role:"grid","aria-label":ge,className:"space-y-1","aria-readonly":K||void 0,onKeyDown:a=>{const n=e(ie)??O??T,o={ArrowLeft:()=>p(n,-1),ArrowRight:()=>p(n,1),ArrowUp:()=>p(n,-7),ArrowDown:()=>p(n,7),Home:()=>p(n,-(n.getDay()-L+7)%7),End:()=>p(n,6-(n.getDay()-L+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,z(r(l)),void(t(l)!==R&&ce(l));var l;"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),K||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+L)%7).map(e=>
|
|
13
|
+
/* @__PURE__ */f("div",{role:"columnheader","aria-label":$.weekdays[e],className:"py-1",children:/* @__PURE__ */f("abbr",{title:$.weekdays[e],className:"no-underline",children:$.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()!==T.getMonth(),n=t===w||"range"===D&&t===M,o=(e=>!("range"!==D||!w||!M)&&e>w&&e<M)(t),l=ae(t),i=$.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!==I||n?"":"font-semibold text-blue-600"].filter(Boolean).join(" "),c=P.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":K?i:void 0,children:K?/* @__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===I?"date":void 0,onClick:()=>{z(t),N(t)},className:s(!0),children:[e.getDate(),c]})},t)})},t))]})]})}export{w as Calendar};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{GROUP_COLORS as e,BADGE_PILL as o}from"./chunk-JMGDGNM7.js";import{Icon as i}from"./chunk-
|
|
1
|
+
import{GROUP_COLORS as e,BADGE_PILL as o}from"./chunk-JMGDGNM7.js";import{Icon as i}from"./chunk-XZXFUZIK.js";import{OneLineLabel as r}from"./chunk-G67CJAQ2.js";import{useShellStrings as s}from"./chunk-JSHMIMAJ.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";function l({colorClass:l,tone:c,children:a,size:m="sm",capitalize:p=!1,closable:u=!1,onClose:f,closeLabel:h,className:x=""}){const d=l??e[c??"neutral"],y="xs"===m?"px-2 py-0.5 text-3xs":"md"===m?"px-3 py-0.5 text-xs":"px-2 py-0.5 text-xs",b=p?"capitalize":"",g=s().badge,j=h??("string"==typeof a?g.removeItem(a):g.remove),k="xs"===m?"h-2.5 w-2.5":"h-3 w-3";/* @__PURE__ */
|
|
2
2
|
return t("span",{className:[o,"font-medium",y,b,d,x].filter(Boolean).join(" "),children:[
|
|
3
3
|
/* @__PURE__ */n(r,{children:a}),u&&/* @__PURE__ */n("button",{type:"button",onClick:f,"aria-label":j,className:"-mr-0.5 ml-1 inline-flex shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",children:/* @__PURE__ */n(i,{name:"close",look:"mini",className:k,"aria-hidden":"true"})})]})}export{l as ColoredBadge};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{useOverlayTarget as e,usePopupAnchor as r,usePanelPosition as i,usePopupLevel as t,usePopupLevelBindings as a,windowScrimStyle as o,OverlayLayerProvider as l,scrimHasCorners as n,popupLayerStyle as s}from"./chunk-RIG5FEVS.js";import{useDiscardGuard as d}from"./chunk-5WK56FA3.js";import{dialogA11y as c}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as m}from"./chunk-7QSDPSXP.js";import{useFocusTrap as u,useScrollLock as p}from"./chunk-DWGYC7OD.js";import{Icon as f}from"./chunk-XZXFUZIK.js";import{useHydrated as h}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as v}from"./chunk-TWVUQUUD.js";import{useShellStrings as x}from"./chunk-JSHMIMAJ.js";import{useRef as b,useId as y,useState as g,useEffect as k}from"react";import{createPortal as w}from"react-dom";import{jsxs as j,Fragment as N,jsx as $}from"react/jsx-runtime";var C="bg-black/30 backdrop-blur-sm",W={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl","2xl":"max-w-6xl"};function D({open:D,onClose:F,title:I,description:S,role:U="dialog",children:A,footer:G,blocking:J=!1,size:T="md",aside:V=!1,dirty:X=!1,initialFocus:Z,"aria-label":E,"aria-labelledby":H,"aria-describedby":K,className:M=""}){const P=b(null),Q=y(),Y=y(),z=!J,B=y(),L=x().dialog,O=e(h()),[R,q]=g(null),_=d({open:D,dirty:X,onClose:F,title:I,layer:R}),ee=b(null),re=r(D&&null!==O,ee),ie=i(re,P),te=t(D&&null!==O,ee),ae=a(te,R),oe=o(te),le=null!==te.host;if(m(D),u(P,D&&null!==O,Z,ae),p(D),k(()=>{if(D)return v(()=>!ae.current?.(document.activeElement)&&(J||_(),!0),()=>P.current)},[D,J,_,ae]),!D||!O)return null;/* @__PURE__ */
|
|
2
|
+
return j(N,{children:[/* @__PURE__ */$("span",{ref:ee,hidden:!0,"data-popup-anchor":""}),w(
|
|
3
|
+
/* @__PURE__ */$(l,{value:R,children:/* @__PURE__ */j("div",{ref:q,className:"fixed inset-0"+(V?" pointer-events-none opacity-0":le?" pointer-events-none":""),style:s(te),role:"presentation","data-overlay-layer":"","data-aside":V?"":void 0,children:[!le&&/* @__PURE__ */$("div",{className:`fixed inset-0 ${C}`,"aria-hidden":"true","data-popup-scrim":"system"}),oe&&/* @__PURE__ */$("div",{className:`fixed ${C}${V?"":" pointer-events-auto"}${n(te)?" rounded-(--radius-window)":""}`,style:oe,onClick:J?void 0:_,"aria-hidden":"true","data-popup-scrim":"window"}),
|
|
4
|
+
/* @__PURE__ */$("div",{className:re?"fixed inset-0":"fixed inset-0 flex items-center justify-center p-4",onClick:J||le?void 0:e=>{e.target===e.currentTarget&&_()},children:/* @__PURE__ */j("div",{ref:P,"data-popup-panel":"",style:re?{left:ie?.left??0,top:ie?.top??0,visibility:ie?void 0:"hidden"}:void 0,...c({role:U,modal:!0,titleId:I?B:void 0,labelledBy:H,label:E}),"aria-describedby":K??(S?Y:A?Q:void 0),className:`${re?"absolute max-h-[calc(100%-2rem)] w-[calc(100%-2rem)]":"relative max-h-full w-full"} ${W[T]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl${le&&!V?" pointer-events-auto":""} ${M}`.trim(),children:[I&&/* @__PURE__ */$("h2",{id:B,className:(z?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:I}),S&&/* @__PURE__ */$("p",{id:Y,className:((I?"mt-1":z?"pr-8":"")+" text-sm text-gray-500").trim(),children:S}),A&&/* @__PURE__ */$("div",{id:Q,className:"mt-2 text-sm text-gray-600",children:A}),G&&/* @__PURE__ */$("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:G}),z&&/* @__PURE__ */$("button",{type:"button",onClick:_,"aria-label":L.close,className:"absolute right-3 top-3 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__ */$(f,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]})}),O)]})}export{D as Dialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{layoutFlow as e}from"./chunk-FAERBT6Y.js";import{Button_default as t}from"./chunk-EVYD6UFQ.js";import{Icon as n}from"./chunk-
|
|
1
|
+
import{layoutFlow as e}from"./chunk-FAERBT6Y.js";import{Button_default as t}from"./chunk-EVYD6UFQ.js";import{Icon as n}from"./chunk-XZXFUZIK.js";import{CHART_INK as r,STATUS_VARS as o,SERIES_VARS as i}from"./chunk-TZFACUMR.js";import{useMemo as l,useRef as a,useId as c}from"react";import{jsxs as d,jsx as s}from"react/jsx-runtime";var h={downloadPng:"Download PNG",downloadSvg:"Download SVG",toPdf:"Add to the PDF"},m={label:"var(--ink-strong)",note:r.label,line:r.label},f={step:i[0],decision:o.warning,start:r.muted,end:r.muted};function u(e,t){return`${(e.title??"flowchart").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"flowchart"}.${t}`}function g(e){const t=new Map(e.nodes.map(e=>[e.id,e.label]));return e.edges.map(e=>`${t.get(e.from)} to ${t.get(e.to)}${e.label?` (${e.label})`:""}`).join("; ")}function w({node:e}){const t=f[e.kind],n=e.x+e.width/2,r=e.y+e.height/2,o=e.note?[...e.lines,e.note]:e.lines,i=r-15*(o.length-1)/2,l="decision"===e.kind?/* @__PURE__ */s("polygon",{points:`${n},${e.y} ${e.x+e.width},${r} ${n},${e.y+e.height} ${e.x},${r}`}):/* @__PURE__ */s("rect",{x:e.x,y:e.y,width:e.width,height:e.height,rx:"step"===e.kind?4:e.height/2});/* @__PURE__ */
|
|
2
2
|
return d("g",{fill:t,fillOpacity:.14,stroke:t,strokeWidth:1,children:[l,o.map((t,r)=>{const l=void 0!==e.note&&r===o.length-1;/* @__PURE__ */
|
|
3
3
|
return s("text",{x:n,y:i+15*r,textAnchor:"middle",dominantBaseline:"central",fontSize:l?11:12.5,fontWeight:l?400:600,fill:l?m.note:m.label,fillOpacity:1,stroke:"none",children:t},r)})]})}function p(e){const t=e.cloneNode(!0),n=[e,...Array.from(e.querySelectorAll("*"))],r=[t,...Array.from(t.querySelectorAll("*"))],o=e.ownerDocument.defaultView;n.forEach((e,t)=>{for(const n of["fill","stroke"]){const i=e.getAttribute(n);i&&i.includes("var(")&&o&&r[t].setAttribute(n,o.getComputedStyle(e).getPropertyValue(n)||i)}});const i=o?.getComputedStyle(e).getPropertyValue("--viz-surface").trim();if(i){const n=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("width","100%"),n.setAttribute("height","100%"),n.setAttribute("fill",i),t.insertBefore(n,t.firstChild)}return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("font-family","system-ui, -apple-system, Segoe UI, sans-serif"),(new XMLSerializer).serializeToString(t)}function b(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function y({spec:r,labels:o,onToPdf:i,bare:f=!1,className:y}){const k={...h,...o},v=l(()=>e(r),[r]),x=a(null),$=r.title??"Flowchart",A=`flow-arrow-${c().replace(/:/g,"")}`;/* @__PURE__ */
|
|
4
4
|
return d("figure",{className:`my-2 ${y??""}`,children:[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Icon as e}from"./chunk-
|
|
1
|
+
import{Icon as e}from"./chunk-XZXFUZIK.js";import{useShellStrings as r}from"./chunk-JSHMIMAJ.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";var s={success:"success",error:"error",warning:"warning",info:"info",404:"info",403:"warning",500:"error"},c={success:"text-green-600 bg-green-100",error:"text-red-600 bg-red-100",warning:"text-amber-600 bg-amber-100",info:"text-blue-600 bg-blue-100"},a={404:e=>e.notFound,403:e=>e.noAccess,500:e=>e.serverError};function i({tone:r}){const t={className:"h-6 w-6",strokeWidth:1.5,"aria-hidden":!0};switch(r){case"success":/* @__PURE__ */
|
|
2
2
|
return n(e,{name:"check",...t});case"error":/* @__PURE__ */
|
|
3
3
|
return n(e,{name:"close",...t});case"warning":/* @__PURE__ */
|
|
4
4
|
return n(e,{name:"error",...t});default:/* @__PURE__ */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{UnitMenu as e}from"./chunk-
|
|
1
|
+
import{UnitMenu as e}from"./chunk-SET3R227.js";import{InputNumber_default as a,stepRounding as t}from"./chunk-FE5DH5OM.js";import{IconButton_default as i}from"./chunk-SV5RRBVA.js";import{Icon as r}from"./chunk-XZXFUZIK.js";import{Tooltip as n}from"./chunk-SOZCWT6I.js";import{jsx as o,jsxs as d,Fragment as l}from"react/jsx-runtime";var s="h-3.5 w-3.5",m={padding:{top:/* @__PURE__ */o(r,{name:"padding-top","aria-hidden":"true",className:s}),right:/* @__PURE__ */o(r,{name:"padding-right","aria-hidden":"true",className:s}),bottom:/* @__PURE__ */o(r,{name:"padding-bottom","aria-hidden":"true",className:s}),left:/* @__PURE__ */o(r,{name:"padding-left","aria-hidden":"true",className:s}),vertical:/* @__PURE__ */o(r,{name:"padding-y","aria-hidden":"true",className:s}),horizontal:/* @__PURE__ */o(r,{name:"padding-left-right","aria-hidden":"true",className:s})},crop:{top:/* @__PURE__ */o(r,{name:"crop-top","aria-hidden":"true",className:s}),right:/* @__PURE__ */o(r,{name:"crop-right","aria-hidden":"true",className:s}),bottom:/* @__PURE__ */o(r,{name:"crop-bottom","aria-hidden":"true",className:s}),left:/* @__PURE__ */o(r,{name:"crop-left","aria-hidden":"true",className:s}),vertical:/* @__PURE__ */o(r,{name:"crop-y","aria-hidden":"true",className:s}),horizontal:/* @__PURE__ */o(r,{name:"crop-left-right","aria-hidden":"true",className:s})}},c=/* @__PURE__ */o(r,{name:"sides-each","aria-hidden":"true",className:"h-4 w-4"});var h=(e,a,t)=>null===e[t]?a[t]:String(e[t]);function p(e,a){const t=t=>h(e,a,t);return t("left")!==t("right")||t("top")!==t("bottom")}function u({label:i,value:r,onChange:n,each:s,placeholder:c,words:p,min:u=0,max:g=200,step:f=4,readOnly:b,glyphs:N="padding",units:v}){const x=m[N],C=(i,d,l)=>{const s=function(e,a){const t=a.map(a=>e[a]);return t.every(e=>e===t[0])?t[0]:"mixed"}(r,i),m=i.map(e=>h(r,c,e)),N="mixed"!==s&&m.every(e=>e===m[0])?m[0]:"–";/* @__PURE__ */
|
|
2
2
|
return o("div",{"data-side":i.join("-"),className:"min-w-0",children:/* @__PURE__ */o(a,{value:"mixed"===s?null:s,onChange:e=>((e,a)=>{const t={...r};for(const i of e)t[i]=a;n(t)})(i,e),min:u,max:g,step:f,snap:!0,...t(f),steppers:"compact",readOnly:b,placeholder:N,prefix:l,suffix:p.unit,suffixControl:v&&/* @__PURE__ */o(e,{value:p.unit,options:v.options,onChange:v.onChange,label:v.label,disabled:b}),"aria-label":d})})};/* @__PURE__ */
|
|
3
3
|
return o("div",{role:"group","aria-label":i,"data-sides":s?"each":"pairs",className:"grid min-w-0 grid-cols-2 gap-2",children:/* @__PURE__ */d(l,s?{children:[C(["left"],p.sides.left,x.left),C(["top"],p.sides.top,x.top),C(["right"],p.sides.right,x.right),C(["bottom"],p.sides.bottom,x.bottom)]}:{children:[C(["left","right"],p.horizontal,x.horizontal),C(["top","bottom"],p.vertical,x.vertical)]})})}function g({each:e,onChange:a,label:t,disabled:r}){/* @__PURE__ */
|
|
4
4
|
return o(n,{content:t,children:/* @__PURE__ */o(i,{size:"md","aria-label":t,"aria-pressed":e,disabled:r,onClick:()=>a(!e),children:c})})}export{g as SidesEachToggle,u as SidesInput,p as sidesStartEach};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-OLCRYT3N.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{EmptyState as i}from"./chunk-T2TZBTSM.js";import{ImageLightbox as r}from"./chunk-436PJFHC.js";import{DescriptionList as t}from"./chunk-SACUSHVN.js";import{Drawer as o}from"./chunk-UP4HLGMZ.js";import{Breadcrumbs as d}from"./chunk-QMSINDXL.js";import{useGridSelection as s}from"./chunk-VLKDWKVR.js";import{useMarquee as c}from"./chunk-OLFYNMTD.js";import{ROOT_KEY as u,mediaLibraryMenu as m}from"./chunk-VQ4X3OBR.js";import{useMediaMoveItems as h}from"./chunk-NOGSS432.js";import{RenameField as p}from"./chunk-GEZM6ARD.js";import{NativeSelect as f}from"./chunk-TM4CRQ3W.js";import{MediaUploadGrid as g}from"./chunk-OG53D3R5.js";import{MediaUsedInList as v}from"./chunk-FQ4IRBMA.js";import{Segmented as k}from"./chunk-HNIIDDLJ.js";import{copyToClipboard as y}from"./chunk-Y7KDCC6E.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as x}from"./chunk-6FZ5JTBY.js";import{Banner as C}from"./chunk-N3R6N7LG.js";import{Input_default as N}from"./chunk-6RK6R3RY.js";import{DropdownMenu as I}from"./chunk-SFULX4E3.js";import{IconButton_default as D}from"./chunk-SV5RRBVA.js";import{useFileIntake as S,FileIntakeAlert as j}from"./chunk-V4XR4MOS.js";import{ColoredBadge as z}from"./chunk-CJHYOHMU.js";import{Button_default as T}from"./chunk-EVYD6UFQ.js";import{Icon as F}from"./chunk-XZXFUZIK.js";import{Tooltip as O}from"./chunk-SOZCWT6I.js";import{buttonClasses as L}from"./chunk-UQYNPYF4.js";import{usePlotWidth as M}from"./chunk-MAFUXCPZ.js";import{useShellStrings as R}from"./chunk-JSHMIMAJ.js";import{useRef as A,useMemo as E,useCallback as P,useState as U,useEffect as B}from"react";import{jsxs as K,Fragment as H,jsx as J}from"react/jsx-runtime";var V="application/x-efficient-media-files",G="application/x-efficient-media-folder",Y="application/x-efficient-media-file";function Z(e){if(!e||!Array.from(e.types).includes(Y))return null;try{const n=JSON.parse(e.getData(Y));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 Q={type:"all",use:"any",sort:"newest"},X={lock:/* @__PURE__ */J(F,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */J(F,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */J(F,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */J(F,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */J(F,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */J(F,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */J(F,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */J(F,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */J(F,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */J(F,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */J(F,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */J(F,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */J(F,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */J(F,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */J(F,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */J(F,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},$={link:/* @__PURE__ */J(F,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */J(F,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */J(F,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */J(F,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function W(F){const{mode:Z="manage",layout:W="auto",location:q,onLocationChange:_,folders:ee,products:ne,allFilesCount:le,trashCount:ae,files:ie,query:re,onQueryChange:te,filters:oe=Q,onFiltersChange:de,extraFilters:se,view:ce="grid",onViewChange:ue,selectedIds:me,onSelectionChange:he,usedIn:pe,denied:fe={},accept:ge="image/*,video/*",maxSizeBytes:ve,busy:ke,progress:ye,onUpload:be,onNewFolder:we,onRename:xe,onMove:Ce,onTrash:Ne,onDeleteFolder:Ie,onRestore:De,onDeleteForever:Se,onEmptyTrash:je,onReplace:ze,onCropEdit:Te,onOpenInDesign:Fe,onChoose:Oe,onCancel:Le,pickNote:Me,onDragOut:Re,className:Ae=""}=F,Ee=R().mediaLibrary,Pe=R().media,Ue="pick"===Z,Be=!Ue,Ke=A(null),He=M(Ke,"phone"===W?343:1200),Je="phone"===W||"auto"===W&&He<640,Ve=E(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,a)=>{for(const i of e){const e=[...a,i];n.set(i.id,{node:i,path:e}),i.children&&l(i.children,e)}};return l(e,[]),n}(ne),[ne]),Ge=E(()=>new Map(ee.map(e=>[e.id,e])),[ee]),Ye=E(()=>{const e=/* @__PURE__ */new Map;for(const n of ee){const l=n.parentId&&Ge.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[ee,Ge]),Ze=P(e=>{const n=[];for(let l=e?Ge.get(e):void 0;l&&(n.unshift(l),!(n.length>ee.length));l=l.parentId?Ge.get(l.parentId):void 0);return n},[Ge,ee.length]),Qe=P((e,n)=>Ze(e).some(e=>e.id===n),[Ze]),[Xe,$e]=U(()=>/* @__PURE__ */new Set(["@files"])),We=e=>$e(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),qe=P(e=>{$e(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),_e="files"===(en=q).place?`files:${en.folderId??""}`:"products"===en.place?`products:${en.nodeId??""}`:"trash";var en;B(()=>{if("files"===q.place)qe(["@files",...Ze(q.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===q.place){const e=q.nodeId?Ve.get(q.nodeId)?.path??[]:[];qe(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[_e]);const nn="products"===q.place,ln="trash"===q.place,an="files"===q.place,rn=an?q.folderId:null,tn=nn&&q.nodeId?Ve.get(q.nodeId)?.path[0]:void 0,on=e=>e?.sharedFrom?`${Ee.readOnly} ${Ee.editedAtHq(e.sharedFrom)}`:Ee.readOnly,dn=E(()=>ie.map(e=>e.id),[ie]),sn=E(()=>new Map(ie.map(e=>[e.id,e])),[ie]),cn=s(dn),un=E(()=>dn.filter(e=>cn.selected.has(e)),[dn,cn.selected]),mn=1===un.length?sn.get(un[0]):void 0,hn=A(!0);B(()=>{hn.current?hn.current=!1:cn.clear()},[_e]);const pn=me?.join("\0");B(()=>{me&&cn.setSelection(me)},[pn]);const fn=A(pn??""),gn=un.join("\0");B(()=>{fn.current!==gn&&(fn.current=gn,he?.(un))},[gn]);const vn=(e,n={})=>{Ue?cn.select(e):cn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[kn,yn]=U(null),bn=e=>{const n=kn;if(yn(null),!n||null==e)return;e!==("folder"===n.kind?Ge.get(n.id)?.name:sn.get(n.id)?.name)&&xe?.(n,e)},wn=async e=>{if(!we)return;const n=await we(e);qe(["@files",...e?[e]:[]]),"string"==typeof n&&yn({kind:"folder",id:n})},xn=P(e=>{const n=[],l=n=>{if("files"===e.kind)return n===rn&&an?Ee.alreadyHere:void 0;const l=Ge.get(e.id);return n===e.id||n&&Qe(n,e.id)?Ee.notIntoItself:(l?.parentId??null)===n?Ee.folderAlreadyHere:void 0};n.push({key:u,label:Ee.allFiles,disabledReason:l(null)});const a=(e,i)=>{for(const r of Ye.get(e)??[])n.push({key:r.id,label:r.name,depth:i,disabledReason:l(r.id)}),a(r.id,i+1)};return a(null,1),n},[Ye,Ge,an,Qe,rn,Ee]),Cn=P(e=>{const n=new Set(e.map(e=>sn.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[sn]),[Nn,In]=U(null),Dn={words:Ee,media:Pe,denied:fe,moveTargets:xn,kindOf:Cn,urlOf:e=>sn.get(e)?.url,newSubfolder:we&&Be?e=>{wn(e)}:void 0,rename:xe&&Be?e=>{"file"!==e.kind||cn.isSelected(e.id)||cn.select(e.id),yn(e)}:void 0,move:Ce&&Be?Ce:void 0,trash:Ne&&Be?Ne:void 0,deleteFolder:Ie&&Be?Ie:void 0,folderNotEmpty:e=>!!Ge.get(e)?.notEmpty,replace:ze&&Be?ze:void 0,copyUrl:e=>{const n=sn.get(e)?.url;n&&y(Ee.urlLabel,n)},openInDesign:Fe,restore:De,deleteForever:Se},Sn=e=>m(e,Dn),jn=w(),zn=(e,n)=>{Ue||(cn.isSelected(e)||cn.select(e),jn.open(n,(e=>{const n=cn.isSelected(e)?un:[e];return nn?{kind:"render",id:e}:ln?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[Tn,Fn]=U(null),[On,Ln]=U(null),[Mn,Rn]=U(null);B(()=>{if(!On&&!Tn)return;const e=()=>{Ln(null),Fn(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[On,Tn]);const An=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),En=(e,n)=>!(!Ce||fe.move||Ue)&&(!!An(e,V)||!(!An(e,G)||!Mn)&&(n!==Mn&&!(n&&Qe(n,Mn)))),Pn=(e,n)=>({onDragEnter:l=>{En(l,n)&&(l.preventDefault(),Fn(e))},onDragOver:l=>{En(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",Tn!==e&&Fn(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Fn(n=>n===e?null:n)},onDrop:e=>{if(En(e,n))if(e.preventDefault(),Fn(null),An(e,V)){let l;try{l=JSON.parse(e.dataTransfer.getData(V))}catch{l=null}Array.isArray(l)&&l.length&&Ce({kind:"files",ids:l.map(String)},n)}else Mn&&(Ce({kind:"folder",id:Mn},n),Rn(null))}}),Un=e=>{const n=e=>An(e,V)||An(e,G)||An(e,"Files");return{onDragEnter:l=>{n(l)&&Ln(e)},onDragOver:l=>{n(l)&&On!==e&&Ln(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Ln(n=>n===e?null:n)}}},Bn=(e,n,l)=>/* @__PURE__ */J(O,{side:"right",content:On===e?Ee.noDropProducts:on(l),open:On===e||!On&&void 0,children:/* @__PURE__ */J("span",{children:n})}),Kn=e=>({onContextMenu:n=>{jn.open(n,e)}}),Hn=(e,a,i)=>e.map(e=>{const r=`p:${e.id}`,t=i??e,o=Xe.has(r),d=e.children?.length?e.children:null;/* @__PURE__ */
|
|
2
|
+
return K("div",{role:"none",className:"contents",children:[
|
|
3
|
+
/* @__PURE__ */J(n,{label:Bn(r,e.name,t),level:a,icon:d&&o?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ee.fileCount(e.count):void 0,selected:nn&&q.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>We(r):void 0,onSelect:()=>_({place:"products",nodeId:e.id}),rowProps:{"data-media-row":r,...Un(r),...Be?Kn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */J(l,{children:Hn(d,a+1,t)})]},e.id)}),Jn=(e,a)=>(Ye.get(e)??[]).map(e=>{const i=Ye.get(e.id),r=Xe.has(e.id),t="folder"===kn?.kind&&kn.id===e.id,o=Sn({kind:"folder",id:e.id});/* @__PURE__ */
|
|
4
|
+
return K("div",{role:"none",className:"contents",children:[
|
|
5
|
+
/* @__PURE__ */J(n,{label:e.name,level:a,icon:i&&r?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ee.fileCount(e.count):void 0,selected:t||an&&q.folderId===e.id,expanded:i?r:void 0,onToggle:i?()=>We(e.id):void 0,onSelect:()=>_({place:"files",folderId:e.id}),drop:Tn===e.id?"into":void 0,dragging:Mn===e.id,draggable:Be&&!!Ce&&!fe.move,rename:t?/* @__PURE__ */J(p,{value:e.name,label:Ee.folderName,onDone:bn}):void 0,actions:Be&&o.length?/* @__PURE__ */J(I,{align:"end","aria-label":Ee.folderActions,trigger:X.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Pn(e.id,e.id),...Be?Kn({kind:"folder",id:e.id}):{},...Be&&Ce&&!fe.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(G,e.id),Rn(e.id)},onDragEnd:()=>{Rn(null),Fn(null)}}:{}}}),i&&r&&/* @__PURE__ */J(l,{children:Jn(e.id,a+1)})]},e.id)}),Vn=Xe.has("@files"),Gn=Xe.has("@products"),Yn=/* @__PURE__ */K(e,{"aria-label":Ee.folders,children:[ne&&/* @__PURE__ */K(H,{children:[
|
|
6
|
+
/* @__PURE__ */J(n,{label:Bn("@products",Ee.products),level:1,icon:X.lock,badge:{label:Ee.readOnlyBadge,tone:"neutral"},expanded:ne.length?Gn:void 0,onToggle:()=>We("@products"),selected:nn&&null==q.nodeId,onSelect:()=>_({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Un("@products")}}),Gn&&ne.length>0&&/* @__PURE__ */J(l,{children:Hn(ne,2)})]}),
|
|
7
|
+
/* @__PURE__ */J(n,{label:Ee.allFiles,level:1,icon:Vn?X.folderOpen:X.folder,count:le,countLabel:null!=le?Ee.fileCount(le):void 0,expanded:Ye.get(null)?.length?Vn:void 0,onToggle:()=>We("@files"),selected:an&&null==q.folderId,onSelect:()=>_({place:"files",folderId:null}),drop:"@files"===Tn?"into":void 0,rowProps:{"data-media-row":"@files",...Pn("@files",null)}}),Vn&&(Ye.get(null)?.length??0)>0&&/* @__PURE__ */J(l,{children:Jn(null,2)}),Be&&/* @__PURE__ */J(n,{label:Ee.trash,level:1,icon:X.trash,count:ae,countLabel:null!=ae?Ee.fileCount(ae):void 0,selected:ln,onSelect:()=>_({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Zn=(()=>{if(ln)return[{label:Ee.trash}];if(nn){const e=q.nodeId?Ve.get(q.nodeId)?.path??[]:[];return[{label:Ee.products,onClick:e.length?()=>_({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>_({place:"products",nodeId:n.id}):void 0}))]}const e=Ze(rn);return[{label:Ee.allFiles,onClick:e.length?()=>_({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>_({place:"files",folderId:n.id}):void 0}))]})(),Qn=nn?Ee.readOnly:fe.upload,Xn=!!be&&!ln&&!Qn,$n=S({accept:ge,maxSizeBytes:ve,multiple:!0,disabled:!Xn,onAccept:e=>be?.(e,rn)}),Wn=nn?Ee.noProductFolder:fe.newFolder,qn=e=>e?{"aria-disabled":!0,disabledReason:e}:{},_n=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[Be&&we&&!ln&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.folderPlus,onClick:()=>{wn(rn)},...qn(Wn),children:Ee.newFolder}),be&&!ln&&/* @__PURE__ */J(T,{variant:"primary",size:"sm",leftIcon:X.upload,onClick:()=>$n.open(),...qn(Qn),children:Ee.upload}),Be&&ln&&je&&ie.length>0&&/* @__PURE__ */J(T,{variant:"danger",size:"sm",onClick:je,...qn(fe.deleteForever),children:Ee.emptyTrash})]}),el=(e,n,l,a,i)=>/* @__PURE__ */J("div",{style:{width:Je?void 0:i,flex:Je?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */J(f,{size:"sm","aria-label":e,value:n,onChange:a,options:l})},e),nl=e=>n=>de?.({...oe,[e]:n}),ll=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[te&&/* @__PURE__ */J("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */J(N,{size:"sm",type:"search",leftIcon:X.search,placeholder:nn?Ee.searchProducts:Ee.search,"aria-label":nn?Ee.searchProducts:Ee.search,value:re??"",onChange:e=>te(e.target.value)})}),de&&el(Ee.mediaType,oe.type,[{value:"all",label:Ee.allTypes},{value:"image",label:Ee.images},{value:"video",label:Ee.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],nl("type"),130),de&&!nn&&!ln&&el(Ee.use,oe.use,[{value:"any",label:Ee.anyUse},{value:"email",label:Ee.emailOnly},{value:"website",label:Ee.websiteOnly},{value:"unused",label:Ee.notUsed}],nl("use"),130),de&&Be&&el(Ee.sort,oe.sort,[{value:"newest",label:Ee.newest},{value:"name",label:Ee.byName},{value:"size",label:Ee.bySize}],nl("sort"),110),se?.map(e=>el(e.label,e.value,e.options,e.onChange,120)),ue&&/* @__PURE__ */J(k,{size:"sm",label:Ee.view,value:ce,onChange:ue,options:[{value:"grid",label:Ee.grid,icon:X.grid},{value:"list",label:Ee.list,icon:X.list}]})]}),al=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ee.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:$.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ee.used(e.usedCount),count:e.usedCount,icon:$.link,tone:"active"}),e.email&&n.push({key:"e",label:Ee.email,icon:$.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ee.private,icon:$.lock,tone:"neutral"}),n},il=e=>al(e).map(e=>/* @__PURE__ */J(z,{tone:e.tone,size:"xs",children:e.label},e.key)),rl=Be&&an&&!!Ce&&!fe.move,tl=!!Re&&!ln,ol=e=>!tl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),dl=ie.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:al(e),dragData:rl?JSON.stringify(cn.isSelected(e.id)?un:[e.id]):ol(e),...rl&&ol(e)?{dragAlso:{[Y]:ol(e)}}:{}})),sl=Je?Math.max(72,Math.floor((He-24-16-1)/3)):112,cl=A(null),ul=c({containerRef:cl,enabled:Be&&!Je&&ie.length>0,selected:cn.selected,setSelection:e=>cn.setSelection(e),clearSelection:cn.clear}),ml=e=>{if(Ue){const n=sn.get(e);return void(!n||n.private||n.pickDisabledReason||Oe?.(n))}const n=dn.indexOf(e);n>=0&&In(n)},hl=ie.length?null:re?/* @__PURE__ */J(i,{variant:"dashed",title:Ee.noMatches}):nn?/* @__PURE__ */J(i,{variant:"dashed",title:Ee.emptyProducts,description:on(tn)}):ln?/* @__PURE__ */J(i,{variant:"dashed",title:Ee.trashEmpty}):!Xn||Ue?/* @__PURE__ */J(i,{variant:"dashed",title:Ee.emptyFolder}):null,pl="list"===ce&&ie.length>0,fl=hl??(pl?/* @__PURE__ */J("ul",{role:"listbox","aria-multiselectable":Be||void 0,"aria-label":Ee.folders,className:"flex flex-col gap-1",children:ie.map(e=>/* @__PURE__ */K("li",{role:"option","aria-selected":cn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>vn(e.id,n),onDoubleClick:()=>ml(e.id),onContextMenu:n=>zn(e.id,n),draggable:!!ol(e)||void 0,onDragStart:ol(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(Y,ol(e)),Re("start")}:void 0,onDragEnd:ol(e)?e=>Re("none"===e.dataTransfer.dropEffect?"cancelled":"dropped"):void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),vn(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)] "+(cn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
|
|
8
|
+
/* @__PURE__ */J("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
|
|
9
|
+
/* @__PURE__ */J("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
|
|
10
|
+
/* @__PURE__ */J("span",{className:"flex shrink-0 items-center gap-1",children:il(e)}),e.sizeLabel&&/* @__PURE__ */J("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */J(g,{items:dl,readOnly:!Xn||Ue,onFiles:Xn&&!Ue?e=>be(e,rn):void 0,accept:ge,maxSizeBytes:ve,busy:ke,progress:ye,fit:"contain",thumbSize:sl,dragType:rl?V:tl?Y:void 0,onDragOutChange:tl?e=>Re(e):void 0,selected:cn.selected,onItemClick:vn,onItemDoubleClick:ml,onItemContextMenu:Be?zn:void 0,menuOnMedia:Be})),gl=h({count:un.length,kind:Cn(un),targets:xn({kind:"files",ids:un}),onPick:e=>Ce?.({kind:"files",ids:un},e.key===u?null:e.key)}),vl=L({variant:"secondary",size:"sm"}),kl=/* @__PURE__ */J(I,{align:"start",triggerClassName:vl,trigger:/* @__PURE__ */K(H,{children:[X.folder,Ee.moveTo]}),items:gl,disabled:!!fe.move}),yl=Be&&un.length>1&&!nn?/* @__PURE__ */K("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
|
|
11
|
+
/* @__PURE__ */J(b,{checked:un.length===ie.length,indeterminate:un.length<ie.length,onChange:e=>e?cn.selectAll():cn.clear(),label:Ee.selected(un.length)}),/* @__PURE__ */K(H,ln?{children:[De&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.undo,onClick:()=>De(un),...qn(fe.restore),children:Ee.restore}),Se&&/* @__PURE__ */J(T,{variant:"secondary-danger",size:"sm",onClick:()=>Se(un),...qn(fe.deleteForever),children:Ee.deleteForever})]}:{children:[Ce&&kl,xe&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.edit,disabled:!0,children:Ee.rename}),Ne&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.trash,onClick:()=>Ne({kind:"files",ids:un}),...qn(fe.trash),children:Ee.moveFilesToTrash(un.length)})]}),
|
|
12
|
+
/* @__PURE__ */J(T,{variant:"ghost",size:"sm",onClick:cn.clear,children:Ee.clearSelection})]}):null,bl=e=>{const n=[],l=(e,l,a)=>{null!=a&&""!==a&&n.push({key:e,label:l,value:a})},a="file"===kn?.kind&&kn.id===e.id;l("name",Ee.name,a?/* @__PURE__ */J(p,{value:e.name,label:Ee.fileName,onDone:bn}):e.name),l("type",Ee.type,e.typeLabel),l("size",Ee.size,e.sizeLabel),l("resolution",Ee.resolution,e.resolution),nn?(l("design",Ee.design,e.design),l("finish",Ee.finish,e.finish),l("angle",Ee.angleLug,e.angleLug),l("owner",Ee.owner,e.owner)):(l("added",Ee.addedBy,e.addedBy),l("folder",Ee.folder,e.folderPath)),l("used",Ee.usedIn,null!=e.usedCount?Ee.places(e.usedCount):void 0);const i=m({kind:"files",ids:[e.id]},Dn).find(e=>"submenu"===e.type);/* @__PURE__ */
|
|
13
|
+
return K("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
|
|
14
|
+
/* @__PURE__ */J("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),nn&&/* @__PURE__ */J(C,{tone:"neutral",title:Ee.readOnlyBadge,children:on(tn)}),
|
|
15
|
+
/* @__PURE__ */J(t,{size:"sm",columns:1,items:n}),!ln&&/* @__PURE__ */K("div",{className:"flex gap-2",children:[
|
|
16
|
+
/* @__PURE__ */J("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */J(N,{size:"sm",readOnly:!0,value:e.url,"aria-label":Ee.fileUrl,onFocus:e=>e.currentTarget.select()})}),
|
|
17
|
+
/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.copy,onClick:()=>Dn.copyUrl(e.id),children:Ee.copyUrl})]}),an&&Be&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[ze&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.swap,onClick:()=>ze(e.id),...qn(fe.replace),children:Ee.replace}),Te&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.crop,onClick:()=>Te(e.id),children:Ee.cropEdit}),Ce&&"submenu"===i?.type&&/* @__PURE__ */J(I,{align:"start",triggerClassName:vl,trigger:/* @__PURE__ */K(H,{children:[X.folder,Ee.moveTo]}),items:i.items,disabled:!!fe.move}),xe&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.edit,onClick:()=>yn({kind:"file",id:e.id}),...qn(fe.rename),children:Ee.rename}),Ne&&/* @__PURE__ */J(D,{"aria-label":Ee.moveToTrash,size:"sm",onClick:()=>Ne({kind:"files",ids:[e.id]}),disabledReason:fe.trash,"aria-disabled":!!fe.trash||void 0,children:X.trash})]}),ln&&Be&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[De&&/* @__PURE__ */J(T,{variant:"primary",size:"sm",leftIcon:X.undo,onClick:()=>De([e.id]),...qn(fe.restore),children:Ee.restore}),Se&&/* @__PURE__ */J(T,{variant:"danger",size:"sm",onClick:()=>Se([e.id]),...qn(fe.deleteForever),children:Ee.deleteForever})]}),nn&&Fe&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",leftIcon:X.external,onClick:()=>Fe({kind:"render",id:e.id}),children:Ee.openInDesign}),pe&&/* @__PURE__ */J(v,{items:pe})]})},wl=mn?mn.private?Ee.privateNoPick:mn.pickDisabledReason:void 0,xl=Ue?/* @__PURE__ */K("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__ */J("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:mn?Ee.oneChosen(mn.name):Ee.noneChosen}),
|
|
19
|
+
/* @__PURE__ */K("div",{className:"flex gap-2",children:[Le&&/* @__PURE__ */J(T,{variant:"secondary",size:"sm",onClick:Le,children:Ee.cancel}),
|
|
20
|
+
/* @__PURE__ */J(T,{variant:"primary",size:"sm",disabled:!mn,...qn(wl),onClick:()=>{mn&&!wl&&Oe?.(mn)},children:Ee.chooseImage})]})]}):null,Cl=Be&&!!mn,Nl=/* @__PURE__ */K("div",{className:"flex min-w-0 flex-col gap-3",children:[Me&&/* @__PURE__ */J(C,{tone:"neutral",children:Me}),
|
|
21
|
+
/* @__PURE__ */K("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
|
|
22
|
+
/* @__PURE__ */J(d,{items:Zn}),_n]}),ll,yl,
|
|
23
|
+
/* @__PURE__ */K("div",{ref:cl,className:"relative",onPointerDown:ul.onPointerDown,onKeyDown:e=>{Be&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),cn.selectAll()):"Escape"===e.key&&cn.size&&cn.clear()},children:[fl,
|
|
24
|
+
/* @__PURE__ */J(a,{rect:ul.rect})]}),Xn&&/* @__PURE__ */J("input",{...$n.inputProps}),
|
|
25
|
+
/* @__PURE__ */J(j,{rejections:$n.rejections})]});/* @__PURE__ */
|
|
26
|
+
return K("div",{ref:Ke,"data-media-library":"","data-layout":Je?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Ae}`.trim(),children:[/* @__PURE__ */K("div",Je?{className:"flex flex-col gap-3 p-3",children:[Yn,Nl]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
|
|
27
|
+
/* @__PURE__ */J("div",{className:"shrink-0 overflow-y-auto border-r border-line p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Yn}),
|
|
28
|
+
/* @__PURE__ */J("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:Nl}),Cl&&/* @__PURE__ */J("div",{className:"shrink-0 overflow-y-auto border-l border-line p-3",style:{width:300},children:bl(mn)})]}),xl,Je&&/* @__PURE__ */J(o,{open:Cl,onClose:cn.clear,side:"bottom",title:mn?.name,children:mn&&bl(mn)}),jn.state&&/* @__PURE__ */J(x,{...jn.props,items:Sn(jn.state.data)}),null!=Nn&&ie.length>0&&/* @__PURE__ */J(r,{images:ie.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(Nn,ie.length-1),onClose:()=>In(null)})]})}export{V as MEDIA_FILES_DRAG_TYPE,Y as MEDIA_FILE_DRAG_TYPE,G as MEDIA_FOLDER_DRAG_TYPE,W as MediaLibrary,Z as readMediaFileDrag};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{CountBadge as e}from"./chunk-OM6VWUAZ.js";import{
|
|
1
|
+
import{CountBadge as e}from"./chunk-OM6VWUAZ.js";import{isShown as i}from"./chunk-HCP7WOAL.js";import{SettingRowNameContext as n,SettingAutoContext as a}from"./chunk-2NMW66P5.js";import{useShellStrings as t}from"./chunk-JSHMIMAJ.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:A,className:M=""}){const W=t();if(!i(j,P,A))return null;const I="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:W.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
|
|
2
2
|
/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex",children:/* @__PURE__ */s(e,{dot:!0,tone:"accent"})}),
|
|
3
|
-
/* @__PURE__ */s("span",{className:"sr-only",children:W.settingView.edited})]}):null,T=null!=f&&!1!==f;if("compact"===k){const e=m(u),
|
|
4
|
-
/* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),I]}),y=e=>/* @__PURE__ */s(
|
|
3
|
+
/* @__PURE__ */s("span",{className:"sr-only",children:W.settingView.edited})]}):null,T=null!=f&&!1!==f;if("compact"===k){const e=m(u),i=m(h);if(!e&&!i)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),M&&c.push(M);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
|
|
4
|
+
/* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),I]}),y=e=>/* @__PURE__ */s(n.Provider,{value:t,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
|
|
5
5
|
return r("div",{className:c.join(" "),children:[
|
|
6
|
-
/* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),T&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),
|
|
6
|
+
/* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),T&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),i&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const V=c,F=void 0!==u||void 0===N&&null==h,H=null==u||""===u,J=y?"text-gray-500":"text-gray-800",O=H?"text-gray-400":y?"text-gray-500":"text-gray-900",S=`${V.text} font-medium ${J}`,q=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:S,children:l}):/* @__PURE__ */s("span",{id:g,className:S,children:l}),z=/* @__PURE__ */s(n.Provider,{value:g,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:H?b:u})}),B=[$?"border-t border-line-subtle first:border-t-0":"",V.pad,M].filter(Boolean).join(" "),C=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${V.bodyTop} border-t border-line-subtle ${V.bodyPad}`,children:N});/* @__PURE__ */
|
|
7
7
|
return r("div",T?{className:B,children:[
|
|
8
8
|
/* @__PURE__ */r("div",{"data-setting-line":"",className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-2",children:[
|
|
9
9
|
/* @__PURE__ */s("div",{className:"flex-1 basis-0",children:/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${J}`,children:[null!=o&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:o}),q,I]})}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{InputNumber_default as e}from"./chunk-
|
|
2
|
-
return f(z.Provider,{value:r,children:e})}function k({value:o,onChange:a,min:w,max:F,step:k=1,shiftStep:N,precision:M,inputMin:
|
|
3
|
-
/* @__PURE__ */f("input",{id:
|
|
1
|
+
import{InputNumber_default as e}from"./chunk-FE5DH5OM.js";import{useSettingAuto as t}from"./chunk-2NMW66P5.js";import{Tooltip as n}from"./chunk-SOZCWT6I.js";import{useBrowserLayoutEffect as i}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-JSHMIMAJ.js";import{createContext as o,useState as l,useMemo as a,useId as d,useRef as s,useContext as u,useEffect as c}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=(e,t,n)=>Math.min(n,Math.max(t,e));function h(e){const t=String(e),n=/e-(\d+)$/.exec(t);return n?Number(n[1]):t.split(".")[1]?.length??0}var x={sm:{left:10,plain:8,unit:40,text:"text-xs"},md:{left:14,plain:12,unit:40,text:"text-sm"}},v={"--rosh-slider-gap":"var(--space-12)","--rosh-slider-floor":"4rem"},b={position:"absolute",left:0,top:0,width:"max-content",height:0,overflow:"hidden",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre"},g={display:"block",width:"max-content"},w=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;function y(e){return Math.max(1,...e.map(e=>[...e??""].reduce((e,t)=>e+(w.test(t)?2:1),0)))}function S(e,t,n,i){return Number(m(e,t,n).toFixed(i))}var z=o(null);function F({children:e}){const[t,n]=l({}),i=a(()=>(e,t)=>n(n=>{if(null===t){if(!(e in n))return n;const t={...n};return delete t[e],t}return n[e]===t?n:{...n,[e]:t}}),[]),r=a(()=>{const e=Object.values(t);return{set:i,width:e.length?`max(${e.join(", ")})`:null}},[t,i]);/* @__PURE__ */
|
|
2
|
+
return f(z.Provider,{value:r,children:e})}function k({value:o,onChange:a,min:w,max:F,step:k=1,shiftStep:N,precision:M,inputMin:j,inputMax:L,suffix:R,showInput:$=!0,emptyLabel:C,placeholderValue:E,stepFrom:O,label:W,"aria-labelledby":H,valueText:K,id:A,disabled:B,size:D="md",boxSize:q="sm",className:V="",auto:I}){const J=r(),T=d(),P=t(),U=I??P,Z=d(),G=A??T,Q=M??h(k),X=j??w,Y=L??F,_=void 0!==C||void 0!==E,ee=O??E,te=m(o??E??w,w,F),ne=[w.toFixed(Q),F.toFixed(Q),o?.toFixed(Q),C,E?.toFixed(Q)],ie=null!=o?o.toFixed(Q):C||(null!=E?E.toFixed(Q):void 0),re=s(null),oe=s(null),[le,ae]=l(null),de=s(null),se=Boolean(R);i(()=>{if(!$)return;const e=()=>{const e=re.current?.querySelector("input"),t=oe.current;if(!e||!t)return;const n=getComputedStyle(e),i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,t)=>e+(parseFloat(n[t])||0),0);if(i<=0)return;Object.assign(t.style,{fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontVariantNumeric:n.fontVariantNumeric,letterSpacing:n.letterSpacing});const r=Math.ceil(t.getBoundingClientRect().width);if(r<=0)return;const o=t.querySelector("[data-shown]"),l=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),a=!!o&&o.getBoundingClientRect().width>l+.5,d=de.current;if(de.current={box:d?.box??{frame:i,fontSize:n.fontSize,text:r,cut:a},room:l},d&&d.box.frame===i&&d.box.fontSize===n.fontSize&&d.box.text===r&&d.box.cut===a)return;const s={frame:i,fontSize:n.fontSize,text:r,cut:a};de.current={box:s,room:l},ae(s)};e(),window.addEventListener("resize",e);const t="undefined"!=typeof document?document.fonts:void 0;t?.addEventListener?.("loadingdone",e);let n=null;if("undefined"!=typeof ResizeObserver){n=new ResizeObserver(()=>e());const t=re.current?.querySelector("input");t&&n.observe(t),oe.current&&n.observe(oe.current)}return()=>{window.removeEventListener("resize",e),t?.removeEventListener?.("loadingdone",e),n?.disconnect()}},[se,$,q]),i(()=>{const e=de.current;if(!e)return;const t=e.box.text<=e.room+.5?null:oe.current?.querySelector("[data-shown]"),n=!!t&&t.getBoundingClientRect().width>e.room+.5;if(n===e.box.cut)return;const i={...e.box,cut:n};de.current={box:i,room:e.room},ae(i)},[ie]);const ue=e=>K?K(e):"string"==typeof R?`${e.toFixed(Q)} ${R}`:void 0,ce=null==o?C??(null!=E?ue(E)??String(E):void 0):ue(o),fe=x[q],pe=ne.filter(e=>Boolean(e)),me=void 0===ie?-1:pe.indexOf(ie),he=le?`${le.text+le.frame+2}px`:`calc(${y(ne)}ch + ${fe.left+(se?fe.unit:fe.plain)+2}px)`,xe=u(z),ve=d(),be=xe?.set;return i(()=>{be&&be(ve,$?he:null)},[be,ve,he,$]),c(()=>()=>be?.(ve,null),[be,ve]),/* @__PURE__ */p("div",{"data-slider":"",className:`flex w-full min-w-0 items-center gap-(--rosh-slider-gap) ${V}`.trim(),style:v,children:[
|
|
3
|
+
/* @__PURE__ */f("input",{id:G,type:"range",min:w,max:F,step:k,value:te,disabled:B,"aria-label":H?void 0:W,"aria-labelledby":H,"aria-valuetext":ce,"aria-describedby":U?Z:void 0,onKeyDown:e=>{const t="ArrowUp"===e.key||"ArrowRight"===e.key?1:"ArrowDown"===e.key||"ArrowLeft"===e.key?-1:0;if(!t||e.altKey||e.ctrlKey||e.metaKey)return;const n=e.shiftKey&&null!=N;if(!n&&!(null==o&&null!=ee))return;e.preventDefault();a(S((o??ee??te)+t*(n?N??k:k),w,F,Q))},onChange:e=>a(S(Number(e.target.value),w,F,Q)),className:"min-w-(--rosh-slider-floor) flex-1 cursor-pointer accent-blue-600 disabled:cursor-not-allowed disabled:opacity-60 "+("sm"===D?"h-1":"h-1.5")}),$&&
|
|
4
4
|
/* @__PURE__ */f(n,{content:le?.cut?ie:null,className:"relative flex min-w-0 max-w-[calc(100%-var(--rosh-slider-floor)-var(--rosh-slider-gap))] shrink-0",describe:!1,children:/* @__PURE__ */p("div",{ref:re,"data-slider-box":"",className:`relative min-w-0 max-w-full shrink-0 ${fe.text}`,style:{position:"relative",width:xe?.width??he,...le?{fontSize:le.fontSize}:{}},children:[
|
|
5
5
|
/* @__PURE__ */f("span",{ref:oe,"data-slider-sizer":"","aria-hidden":"true",style:b,children:pe.map((e,t)=>/* @__PURE__ */f("span",{"data-shown":t===me?"":void 0,style:g,children:e},t))}),
|
|
6
|
-
/* @__PURE__ */f(e,{value:o,onChange:e=>{null!=e?e<X||e>Y||a(e):_&&a(null)},min:X,max:Y,step:k,shiftStep:N,stepFrom:ee,precision:
|
|
6
|
+
/* @__PURE__ */f(e,{value:o,onChange:e=>{null!=e?e<X||e>Y||a(e):_&&a(null)},min:X,max:Y,step:k,shiftStep:N,stepFrom:ee,precision:Q,snap:!0,allowEmpty:_,suffix:R,disabled:B,placeholder:C??(null!=E?E.toFixed(Q):void 0),size:q,auto:U,"aria-label":W?J.slider.value(W):void 0,"aria-labelledby":W?void 0:H})]})}),U&&/* @__PURE__ */f("span",{id:Z,hidden:!0,children:J.settingView.auto})]})}export{k as Slider,F as SliderGroup,S as settleSliderValue,y as sliderBoxChars,h as stepDecimals};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{useSettingAuto as e}from"./chunk-2NMW66P5.js";import{IconButton_default as r}from"./chunk-SV5RRBVA.js";import{inputClasses as t}from"./chunk-AYZY3YNC.js";import{Icon as n}from"./chunk-
|
|
2
|
-
return m("div",{className:"relative","data-number-box":"",style:S||
|
|
1
|
+
import{useSettingAuto as e}from"./chunk-2NMW66P5.js";import{IconButton_default as r}from"./chunk-SV5RRBVA.js";import{inputClasses as t}from"./chunk-AYZY3YNC.js";import{Icon as n}from"./chunk-XZXFUZIK.js";import{useBrowserLayoutEffect as o}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as i}from"./chunk-TWVUQUUD.js";import{useShellStrings as a}from"./chunk-JSHMIMAJ.js";import{forwardRef as l,useId as c,useState as s,useRef as u,useCallback as d,useEffect as p}from"react";import{jsx as f,jsxs as m,Fragment as v}from"react/jsx-runtime";function h(e){const r=String(e),t=/e-(\d+)$/.exec(r);return t?Number(t[1]):r.split(".")[1]?.length??0}function b(e){return 0===h(e)?{precision:0}:{snap:!0}}var x=(e,r)=>null==e?"":null!=r?e.toFixed(r):String(e),g={compact:{right:"var(--space-16)",least:"var(--space-32)"},steppers:{right:"calc(var(--space-40) + var(--space-20))",least:"calc(var(--space-48) * 2)"},plain:{right:"var(--space-8)",least:"var(--space-40)"}};function y(e){const r=u(null),[t,n]=s(0);return o(()=>{const e=r.current;if(!e)return;const t=()=>n(Math.ceil(e.getBoundingClientRect().width));if(t(),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[e]),[r,t]}function w(e,r,t){if(!r)return e;const n=e.trimEnd();for(let e=r.length;e>(t?0:r.length-1);e--)if(n.endsWith(r.slice(0,e)))return n.slice(0,-e).trimEnd();return e}function k({dir:e,compact:t,label:o,disabled:i,onStep:a}){const l=u(a);l.current=a;const c=u({}),s=d(()=>{const e=c.current;void 0!==e.wait&&clearTimeout(e.wait),void 0!==e.every&&clearInterval(e.every),e.off?.(),c.current={}},[]);p(()=>s,[s]),p(()=>{i&&s()},[i,s]);const m=/* @__PURE__ */f(n,{name:e>0?"chevron-up":"chevron-down","aria-hidden":"true",focusable:"false",className:t?"h-2.5 w-2.5":"h-3.5 w-3.5",strokeWidth:t?2.6:2}),v={tabIndex:-1,"aria-label":o,disabled:i,onPointerDown:e=>{if(0!==e.button||i)return;e.preventDefault(),s();const r=e.shiftKey;l.current(r);const t=e.currentTarget.ownerDocument.defaultView??window;t.addEventListener("pointerup",s),c.current={off:()=>t.removeEventListener("pointerup",s),wait:setTimeout(()=>{c.current.every=setInterval(()=>l.current(r),60)},400)}},onPointerLeave:s,onPointerCancel:s,onClick:e=>{0===e.detail&&l.current(e.shiftKey)}};return t?/* @__PURE__ */f("button",{type:"button",...v,className:"flex min-h-0 flex-1 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40",children:m}):/* @__PURE__ */f(r,{size:"sm",...v,children:m})}var N=l(function({value:r,onChange:n,min:o,max:l,precision:b,step:N,shiftStep:j,disabled:E,readOnly:B,invalid:D,placeholder:C,size:M,prefix:S,suffix:$,suffixControl:F,id:K,name:O,className:U="",onBlur:P,onFocus:R,steppers:T,stepFrom:W,snap:z=!1,allowEmpty:A=!0,appearance:I="box",display:L,reportWhileTyping:V=!0,onRevert:Y,"aria-label":J,"aria-labelledby":X,"aria-describedby":Z,auto:H,...Q},q){const G="bare"===I,_=e(),ee=H??_,re=c(),te="string"==typeof $&&""!==$.trim()?$.trim():void 0,ne=e=>function(e,r,t=!1){let n=w(e.trim(),r,t);if(n=n.replace(",","."),""===n||"-"===n||"."===n||"-."===n)return null;const o=Number(n);return Number.isFinite(o)?o:null}(e,te,Boolean(F)),oe=Boolean($||F),ie=Object.fromEntries(Object.entries(Q).filter(([e])=>e.startsWith("data-"))),ae=a(),[le,ce]=s(()=>x(r,b)),se=u(le);se.current=le;const ue=u(null),de=d(e=>{ue.current=e,"function"==typeof q?q(e):q&&(q.current=e)},[q]),pe=u(r),fe=u(r);fe.current=r;const me=Boolean(E||B),ve=T??!1,he="compact"===ve,[be,xe]=y(S),[ge,ye]=y(Boolean(F)),we=he?g.compact:ve?g.steppers:g.plain;p(()=>{ne(se.current)!==r&&ce(x(r,b))},[r,b]);const ke=e=>{if(me)return;let r=(ne(se.current)??W??(C?ne(C):null)??0)+e;null!=o&&r<o&&(r=o),null!=l&&r>l&&(r=l);const t=b??String(N??1).split(".")[1]?.length??0;r=Number(r.toFixed(t));const i=x(r,b);se.current=i,ce(i),n(r),Me()},Ne=u(ke);Ne.current=ke;const je=u({unit:N??1,big:j??10*(N??1),locked:me});je.current={unit:N??1,big:j??10*(N??1),locked:me},p(()=>{const e=ue.current;if(!e)return;const r=r=>{const{unit:t,big:n,locked:o}=je.current;if(o||e.ownerDocument.activeElement!==e)return;const i=r.deltaY||r.deltaX;i&&(r.preventDefault(),Ne.current((i<0?1:-1)*(r.shiftKey?n:t)))};return e.addEventListener("wheel",r,{passive:!1}),()=>e.removeEventListener("wheel",r)},[]);const[Ee,Be]=s(!1),[De,Ce]=s(0),Me=()=>{G&&Ce(e=>e+1)};p(()=>{G&&Ee&&document.activeElement===ue.current&&ue.current?.select()},[G,Ee,De]);const Se=u(!1);p(()=>{if(Ee&&!me)return i(e=>{if("Escape"!==e.key||document.activeElement!==ue.current)return!1;const r=pe.current;if(ne(se.current)===r)return!1;const t=x(r,b);return se.current=t,ce(t),fe.current!==r&&(Y??n)(r),Me(),!0})},[Ee,me,b,n,Y]);const $e=()=>{const e=ne(se.current);if(null==e){if(!A){const e=x(fe.current,b);return se.current=e,ce(e),fe.current}return se.current="",ce(""),null!==fe.current&&n(null),null}let r=e;const t=b??(z?Math.max(h(N??1),h(o??0)):void 0);z&&(r=function(e,r,t){const n=(e-t)/r;return t+Math.round(n+1e-9*Math.sign(e))*r}(r,N??1,o??0)),null!=o&&r<o&&(r=o),null!=l&&r>l&&(r=l),null!=t&&(r=Number(r.toFixed(t)));const i=x(r,b);return se.current=i,ce(i),r===e&&r===fe.current||n(r),r},Fe=/* @__PURE__ */f("input",{ref:de,id:K,"data-number-input":"",name:O,type:"text",inputMode:0===b?"numeric":"decimal",value:!Ee&&L?L(r):le,disabled:E,readOnly:B,placeholder:C,step:N,role:"spinbutton","aria-valuenow":r??void 0,"aria-valuemin":o,"aria-valuemax":l,"aria-valuetext":null==r?C||void 0:`${x(r,b)}${G&&te?te:""}`,"aria-describedby":[Z,ee?re:void 0].filter(Boolean).join(" ")||void 0,"data-appearance":G?"bare":void 0,...ie,autoComplete:G?"off":void 0,spellCheck:!G&&void 0,"aria-invalid":D||void 0,"aria-label":J,"aria-labelledby":X,onChange:e=>(e=>{if(B)return;const r=w(e,te,Boolean(F));if(""!==r&&!/^-?\d*[.,]?\d*$/.test(r))return;if(ce(e),!V)return;const t=ne(e);(null!==t||A)&&n(t)})(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!me)return pe.current=$e(),void Me();const r=N??1,t=j??10*r,n="ArrowUp"===e.key?e.shiftKey?t:r:"ArrowDown"===e.key?-(e.shiftKey?t:r):"PageUp"===e.key?10*r:"PageDown"===e.key?10*-r:null;null===n||me||(e.preventDefault(),ke(n))},onFocus:()=>{pe.current=fe.current,Be(!0),Se.current=!0,R?.()},onMouseUp:G?e=>{Se.current&&(Se.current=!1,e.preventDefault())}:void 0,onBlur:()=>{Be(!1),Se.current=!1,$e(),P?.()},className:G?["block min-w-0 m-0 rounded-(--radius-control) border-0 p-0 text-center tabular-nums","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",Ee?"bg-surface":"bg-transparent",me?"cursor-default":"cursor-text",U].filter(Boolean).join(" "):t({invalid:D,size:M,readOnly:B,auto:ee,className:[S?"pl-[max(var(--space-24),calc(var(--space-control-x-sm)+var(--rosh-number-prefix-width)+var(--space-icon-gap-sm)))]":"",F?"pr-(--rosh-number-suffix-room)":he?oe?"pr-10":"pr-6":ve?oe?"pr-24":"pr-16":oe?"pr-10":"","text-left tabular-nums",F&&!Ee?"text-ellipsis":"",U].filter(Boolean).join(" ")})}),Ke=ee?/* @__PURE__ */f("span",{id:re,hidden:!0,children:ae.settingView.auto}):null;if(G||!S&&!oe&&!ve)return Ke?/* @__PURE__ */m(v,{children:[Fe,Ke]}):Fe;const Oe=ne(le);/* @__PURE__ */
|
|
2
|
+
return m("div",{className:"relative","data-number-box":"",style:S||F?{...S?{"--rosh-number-prefix-width":`${xe}px`}:{},...F?{"--rosh-number-suffix-room":`max(${we.least}, calc(${we.right} + ${ye}px))`}:{}}:void 0,children:[S&&/* @__PURE__ */f("span",{ref:be,className:"pointer-events-none absolute left-(--space-control-x-sm) top-1/2 -translate-y-1/2 whitespace-nowrap text-sm text-ink-faint",children:S}),Fe,Ke,F?/* @__PURE__ */f("span",{ref:ge,className:"absolute top-1/2 flex -translate-y-1/2",style:{right:we.right},children:F}):$&&/* @__PURE__ */f("span",{className:`pointer-events-none absolute ${he?"right-6":ve?"right-16":"right-3"} top-1/2 -translate-y-1/2 text-xs text-ink-faint`,children:$}),ve&&(()=>{const e=/* @__PURE__ */f(k,{dir:-1,compact:he,label:ae.number.decrease,disabled:me||null!=o&&null!=Oe&&Oe<=o,onStep:e=>Ne.current(-(e?j??10*(N??1):N??1))}),r=/* @__PURE__ */f(k,{dir:1,compact:he,label:ae.number.increase,disabled:me||null!=l&&null!=Oe&&Oe>=l,onStep:e=>Ne.current(e?j??10*(N??1):N??1)});/* @__PURE__ */
|
|
3
3
|
return m("span",he?{"data-steppers":"compact",className:"absolute inset-y-px right-px flex w-4 flex-col overflow-hidden rounded-r-(--radius-control)",children:[r,e]}:{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5",children:[e,r]})})()]})});export{N as InputNumber_default,b as stepRounding};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ColoredBadge as e}from"./chunk-
|
|
1
|
+
import{ColoredBadge as e}from"./chunk-CJHYOHMU.js";import{Button_default as n}from"./chunk-EVYD6UFQ.js";import{useShellStrings as i}from"./chunk-JSHMIMAJ.js";import{useId as t}from"react";import{jsx as m,jsxs as a}from"react/jsx-runtime";function s({items:s,heading:l,emptyText:r,className:c=""}){const o=i().media,d=t();return s.length?/* @__PURE__ */a("div",{className:c||void 0,children:[
|
|
2
2
|
/* @__PURE__ */m("p",{id:d,className:"text-xs font-medium text-ink-faint",children:l??o.usedIn(s.length)}),
|
|
3
3
|
/* @__PURE__ */m("ul",{"aria-labelledby":d,className:"mt-2 flex flex-col gap-1",children:s.map(i=>/* @__PURE__ */a("li",{className:"flex min-w-0 items-center gap-2 text-sm",children:[null!=i.kind&&/* @__PURE__ */m(e,{size:"xs",className:"flex-none",children:i.kind}),i.onOpen?/* @__PURE__ */m(n,{variant:"link",size:"sm",onClick:i.onOpen,className:"min-w-0 text-left",children:i.name}):/* @__PURE__ */m("span",{className:"min-w-0 break-words text-ink",children:i.name})]},i.key))})]}):/* @__PURE__ */m("p",{className:`text-sm text-ink-faint ${c}`.trim(),children:r??o.notUsed})}export{s as MediaUsedInList};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PopupMenuDivider as e,PopupMenuLabel as t,menuTextRowStyle as i,PopupSubmenu as l,itemLook as a,MenuCheckMark as n}from"./chunk-
|
|
1
|
+
import{PopupMenuDivider as e,PopupMenuLabel as t,menuTextRowStyle as i,PopupSubmenu as l,itemLook as a,MenuCheckMark as n}from"./chunk-THLXDI76.js";import{jsx as r,jsxs as d}from"react/jsx-runtime";var s=e=>!!e&&"label"!==e.type&&"status"!==e.type&&"divider"!==e.type&&!e.disabled,o=(e,t)=>`${e}-status-${t}`;function c(e,t){return e.flatMap((e,i)=>"status"===e.type?[o(t,i)]:[]).join(" ")||void 0}var b={minHeight:"var(--space-32)",paddingTop:0,paddingBottom:0,paddingLeft:"var(--space-12)",paddingRight:"var(--space-12)"};function u(s,c){const{menuId:y,choose:m,toggle:p,followLink:h,rowProps:k=()=>({}),linkAs:f}=c,g=f??"a",v=(s,f)=>{if("divider"===s.type)/* @__PURE__ */
|
|
2
2
|
return r("div",{role:"separator",children:/* @__PURE__ */r(e,{})},s.key);if("label"===s.type)/* @__PURE__ */
|
|
3
3
|
return r("div",{id:`${y}-label-${f}`,children:/* @__PURE__ */r(t,{children:s.label})},s.key);if("status"===s.type)/* @__PURE__ */
|
|
4
4
|
return r("div",{id:o(y,f),className:"text-xs",style:i(),children:s.label},s.key);if("submenu"===s.type)/* @__PURE__ */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Input_default as e}from"./chunk-
|
|
1
|
+
import{Input_default as e}from"./chunk-6RK6R3RY.js";import{useState as r,useRef as t}from"react";import{jsx as o}from"react/jsx-runtime";function n({value:n,label:a,onDone:u}){const[l,c]=r(n),i=t(!1),p=e=>{i.current||(i.current=!0,u(e))};/* @__PURE__ */
|
|
2
2
|
return o(e,{size:"sm",autoFocus:!0,"aria-label":a,value:l,onChange:e=>c(e.target.value),onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key?(e.preventDefault(),p(l.trim()||n)):"Escape"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(l.trim()||n),onClick:e=>e.stopPropagation()})}export{n as RenameField};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Icon as t}from"./chunk-
|
|
1
|
+
import{Icon as t}from"./chunk-XZXFUZIK.js";import{jsxs as n,jsx as e}from"react/jsx-runtime";var r=t=>Array.isArray(t.options);function o(t){const n=[];for(const e of t)r(e)?n.push(...e.options):n.push(e);return n}function i(t,n){const e=[];for(const o of t){if(!r(o)){n(o)&&e.push(o);continue}const t=o.options.filter(n);t.length&&e.push({...o,options:t})}return e}function s(t,o,i,s=""){const a=[];let c=0;return t.forEach((t,u)=>{if(!r(t))return a.push(o(t,c)),void(c+=1);const l=`${i}-group-${u}`,p=c;c+=t.options.length,a.push(
|
|
2
2
|
/* @__PURE__ */n("div",{role:"group","aria-labelledby":l,children:[
|
|
3
3
|
/* @__PURE__ */e("div",{id:l,role:"presentation","data-option-group-heading":"",className:`truncate px-3 pb-1 pt-2 text-xs font-semibold text-gray-500 ${s}`.trim(),children:t.label}),t.options.map((t,n)=>o(t,p+n))]},l))}),a}function a({selected:n}){/* @__PURE__ */
|
|
4
4
|
return e(t,{name:"check","aria-hidden":"true",className:"h-4 w-4 shrink-0 "+(n?"":"invisible"),strokeWidth:2.5})}function c(t,n){return t.label.toLowerCase().includes(n)||(t.sublabel?.toLowerCase().includes(n)??!1)}function u({children:t,grows:n=!1}){/* @__PURE__ */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{Dialog as e}from"./chunk-D2WJAF62.js";import{Icon as t}from"./chunk-XZXFUZIK.js";import{buttonClasses as r}from"./chunk-UQYNPYF4.js";import{useShellStrings as n,splitAround as o}from"./chunk-JSHMIMAJ.js";import{createContext as l,useContext as i,useState as s,useRef as a,useCallback as c,useEffect as u}from"react";import{jsxs as d,jsx as m,Fragment as h}from"react/jsx-runtime";var f=l(()=>Promise.resolve(!1)),b=()=>i(f),g=()=>Promise.resolve(!1),p=e=>g(e),v=()=>Promise.resolve(!1),y=e=>v(e),x=()=>Promise.resolve(null),N=e=>x(e),k={danger:{icon:"text-red-600 bg-red-100",button:r({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:r({variant:"warning"})},info:{icon:"text-blue-600 bg-accent-tint-strong",button:r({variant:"primary"})}},w=r({variant:"secondary"}),C=r({variant:"primary"}),L="w-full rounded-md border border-line-strong h-8 px-3 text-sm";function P(){/* @__PURE__ */
|
|
2
|
+
return m(t,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function F(){/* @__PURE__ */
|
|
3
|
+
return m(t,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function j({children:t}){const[r,l]=s(!1),[i,b]=s({message:""}),[p,y]=s(0),N=a(),j=a(null),E=a(0),T=a([]),W=a(null),$=a(null),D=c(e=>{j.current=e.id,N.current=e.resolve,y(e.id),b(e.options),l(!0)},[]),J=c(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const r={id:++E.current,options:t,resolve:e};null===j.current?D(r):T.current.push(r)})},[D]),[K,A]=s(!1),[I,M]=s({message:""}),[U,X]=s(""),Y=a(),Z=c(e=>(M(e),X(""),A(!0),new Promise(e=>{Y.current=e})),[]),[H,Q]=s(!1),[S,V]=s({}),[q,z]=s(""),B=a(),G=c(e=>{const t="string"==typeof e?{message:e}:e;return V(t),z(t.defaultValue??""),Q(!0),new Promise(e=>{B.current=e})},[]);u(()=>{g=J,v=Z,x=G},[J,Z,G]);const O=(e,t)=>{if(j.current!==e)return;const r=N.current,n=T.current.shift();n?D(n):(j.current=null,N.current=void 0,l(!1)),r?.(t)},R=e=>{A(!1),X(""),Y.current?.(e)},_=e=>{if(e){const e=q.trim();if(!e&&!S.allowEmpty)return Q(!1),void B.current?.(null);Q(!1),B.current?.(e)}else Q(!1),B.current?.(null)},ee=i.variant||(i.confirmLabel?.toLowerCase().includes("delete")||i.message.toLowerCase().includes("delete")?"danger":"info"),te=k[ee],re=k["warning"===I.variant?"warning":"danger"],ne=I.confirmWord,oe=null==ne||U===ne,le=n().dialog,[ie,se]=o(le.typeToConfirm);/* @__PURE__ */
|
|
4
|
+
return d(f.Provider,{value:J,children:[t,
|
|
5
|
+
/* @__PURE__ */m(e,{open:r,onClose:()=>O(p,!1),initialFocus:W,footer:/* @__PURE__ */d(h,{children:[
|
|
6
|
+
/* @__PURE__ */m("button",{ref:W,type:"button",onClick:()=>O(p,!1),className:w,children:i.cancelLabel||le.cancel}),
|
|
7
|
+
/* @__PURE__ */m("button",{type:"button",onClick:()=>O(p,!0),className:te.button,children:i.confirmLabel||le.ok})]}),children:/* @__PURE__ */d("div",{className:"flex gap-4",children:[
|
|
8
|
+
/* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */m(P,{})}),
|
|
9
|
+
/* @__PURE__ */d("div",{className:"flex-1",children:[
|
|
10
|
+
/* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900",children:i.title||le.confirmTitle}),
|
|
11
|
+
/* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:i.message})]})]})}),
|
|
12
|
+
/* @__PURE__ */d(e,{open:K,onClose:()=>R(!1),initialFocus:null!=ne?void 0:$,footer:/* @__PURE__ */d(h,{children:[
|
|
13
|
+
/* @__PURE__ */m("button",{ref:$,type:"button",onClick:()=>R(!1),className:w,children:I.cancelLabel||le.destructiveCancel}),
|
|
14
|
+
/* @__PURE__ */m("button",{type:"button",onClick:()=>R(!0),disabled:!oe,className:re.button,children:ne??I.confirmLabel??le.destructiveConfirm})]}),children:[
|
|
15
|
+
/* @__PURE__ */m("button",{type:"button",onClick:()=>R(!1),"aria-label":le.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */m(F,{})}),
|
|
16
|
+
/* @__PURE__ */d("div",{className:"flex gap-4",children:[
|
|
17
|
+
/* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${re.icon}`,children:/* @__PURE__ */m(P,{})}),
|
|
18
|
+
/* @__PURE__ */d("div",{className:"flex-1",children:[
|
|
19
|
+
/* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:I.title||le.destructiveTitle}),
|
|
20
|
+
/* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:I.message}),null!=ne&&/* @__PURE__ */d(h,{children:[
|
|
21
|
+
/* @__PURE__ */d("p",{className:"mt-3 text-sm text-gray-700",children:[ie,
|
|
22
|
+
/* @__PURE__ */m("kbd",{className:"rounded border border-line-strong bg-surface-sunken px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:ne}),se]}),
|
|
23
|
+
/* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:U,onChange:e=>X(e.target.value),onKeyDown:e=>{"Enter"===e.key&&U===ne&&R(!0)},placeholder:ne,className:`mt-2 ${L} focus:border-red-500`})]})]})]})]}),
|
|
24
|
+
/* @__PURE__ */d(e,{open:H,onClose:()=>_(!1),title:S.title||le.promptTitle,footer:/* @__PURE__ */d(h,{children:[
|
|
25
|
+
/* @__PURE__ */m("button",{type:"button",onClick:()=>_(!1),className:w,children:S.cancelLabel||le.cancel}),
|
|
26
|
+
/* @__PURE__ */m("button",{type:"button",onClick:()=>_(!0),disabled:!S.allowEmpty&&!q.trim(),className:C,children:S.confirmLabel||le.ok})]}),children:[S.message&&/* @__PURE__ */m("p",{className:"text-sm text-gray-600",children:S.message}),
|
|
27
|
+
/* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:q,onChange:e=>z(e.target.value),onKeyDown:e=>{"Enter"===e.key?_(!0):"Escape"===e.key&&_(!1)},onFocus:e=>e.target.select(),placeholder:S.placeholder,className:`mt-3 ${L} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{j as ConfirmProvider,p as confirm,y as confirmDestructive,N as prompt,b as useConfirm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{SidebarLayout as e}from"./chunk-
|
|
1
|
+
import{SidebarLayout as e}from"./chunk-JGRDG7CB.js";import{Avatar as t}from"./chunk-WESNFWM4.js";import{ItemCount as r}from"./chunk-MWTCGJAI.js";import{Button_default as a}from"./chunk-EVYD6UFQ.js";import{useState as i}from"react";import{jsx as l,jsxs as n}from"react/jsx-runtime";var s=[{id:"inbox",label:"Inbox",count:12},{id:"starred",label:"Starred",count:3},{id:"sent",label:"Sent"},{id:"drafts",label:"Drafts",count:1},{id:"archive",label:"Archive"},{id:"trash",label:"Trash"}],d=[{id:1,from:"Marco Reyes",subject:"Q3 roadmap review",preview:"Sharing the deck ahead of Thursday — let me know what you think before the review.",time:"9:14",unread:!0},{id:2,from:"Priya Patel",subject:"Design handoff",preview:"The Figma file is ready for engineering. I exported every icon at 1x and 2x.",time:"8:02",unread:!0},{id:3,from:"GitHub",subject:"[acme/web] PR #482 merged",preview:"Your pull request was merged into main by the release bot after all checks passed.",time:"Yest"},{id:4,from:"Sara Lind",subject:"Lunch Friday?",preview:"A few of us are heading to the new place on 5th at noon if you want to join.",time:"Yest"}];function c(){const[c,o]=i(1),m=d.find(e=>e.id===c)??d[0];/* @__PURE__ */
|
|
2
2
|
return l("div",{className:"h-full",children:/* @__PURE__ */l(e,{side:"left",defaultWidth:200,sidebar:/* @__PURE__ */n("div",{className:"flex h-full flex-col p-2",children:[
|
|
3
3
|
/* @__PURE__ */l(a,{block:!0,className:"mb-2",children:"Compose"}),s.map((e,t)=>/* @__PURE__ */n("button",{className:"flex items-center justify-between rounded-md px-3 py-2 text-left text-sm "+(0===t?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
|
|
4
4
|
/* @__PURE__ */l("span",{children:e.label}),null!=e.count&&/* @__PURE__ */l(r,{count:e.count,active:0===t})]},e.id))]}),children:/* @__PURE__ */n("div",{className:"flex h-full",children:[
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Icon as e}from"./chunk-
|
|
1
|
+
import{Icon as e}from"./chunk-XZXFUZIK.js";import{Tooltip as t}from"./chunk-SOZCWT6I.js";import{useShellStrings as n}from"./chunk-JSHMIMAJ.js";import{useId as i}from"react";import{jsx as a,jsxs as r}from"react/jsx-runtime";var l=['input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled]):not(.es-default-reset)",'[tabindex]:not([tabindex="-1"])'].join(", "),s=e=>l.split(", ").map(t=>`${e} ${t}`).join(", ");function o({label:o,onReset:d,changed:c=!0,view:u="desktop",detail:b,name:p,tip:m,defaultAction:h,disabled:f,className:k}){const j=n().settingView,y=i(),N=["es-default-reset"];if(c&&N.push("is-changed"),k&&N.push(k),!c&&h)return N.push("is-pressable"),/* @__PURE__ */a(t,{content:h.title,children:/* @__PURE__ */a("button",{type:"button",className:N.join(" "),"aria-label":h.title,disabled:f,onClick:h.onPress,children:h.icon})});if(!c)/* @__PURE__ */return a("span",{className:N.join(" "),"aria-hidden":"true"});const x="desktop"===u,S=p??(x?j.resetName(o):j.inheritName(o)),T=b?j.backTo(b):x?j.backToDefault:j.backToAuto,g=m??(b?j.tip(S,T):S);
|
|
2
2
|
/* @__PURE__ */
|
|
3
|
-
return r(t,{content:
|
|
4
|
-
/* @__PURE__ */a("button",{type:"button",className:N.join(" "),"aria-label":
|
|
5
|
-
/* @__PURE__ */a("span",{id:y,hidden:!0,children:
|
|
3
|
+
return r(t,{content:g,describe:!1,children:[
|
|
4
|
+
/* @__PURE__ */a("button",{type:"button",className:N.join(" "),"aria-label":S,"aria-describedby":y,disabled:f,onClick:e=>{d(),function(e){const t=e.currentTarget,n=t.closest(".es-field");let i=n?.querySelector(s(".es-field-ctl"))??n?.querySelector(s(".es-field-head"))??null,a=n?null:t.parentElement;for(let e=0;!i&&a&&e<4;e+=1,a=a.parentElement)i=[...a.querySelectorAll(l)].find(e=>e!==t&&!e.closest('[aria-hidden="true"]'))??null;i?.focus()}(e)},children:/* @__PURE__ */a(e,{name:"revert",size:15,"aria-hidden":"true"})}),
|
|
5
|
+
/* @__PURE__ */a("span",{id:y,hidden:!0,children:T})]})}export{o as SettingReset};
|