efficient-shell 8.23.0 → 8.24.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/README.md +20 -0
- package/dist/{Browser-6DBCKZYW.js → Browser-NYGNSRS3.js} +14 -14
- package/dist/Calculator-EN6VDDRG.js +29 -0
- package/dist/{CurrencyConverter-BX5HDEX6.js → CurrencyConverter-ET6QOMC6.js} +8 -8
- package/dist/{Documents-YPOCP5OP.js → Documents-76QU7XPF.js} +15 -15
- package/dist/Files-WBRBACPC.js +87 -0
- package/dist/{Notepad-MOWWMSOT.js → Notepad-G4EQGYQB.js} +10 -10
- package/dist/{PomodoroTimer-LBFYGZHA.js → PomodoroTimer-R3SOUADN.js} +33 -33
- package/dist/{Preview-OUCMOCOE.js → Preview-UMQ6DJIP.js} +21 -21
- package/dist/{Sidebar-OIWVKYUU.js → Sidebar-YB4OVUG5.js} +34 -34
- package/dist/{Spreadsheet-GC7GNZ7C.js → Spreadsheet-EFCVA5SM.js} +11 -11
- package/dist/{Stock-5TKATE4I.js → Stock-T2VMQMOG.js} +3 -3
- package/dist/{Weather-NQJCUUUN.js → Weather-UKIN7EGC.js} +17 -17
- package/dist/{WorldClock-QYZF2JCO.js → WorldClock-GWQIZZML.js} +4 -4
- package/dist/ai/index.d.ts +8 -0
- package/dist/ai/index.js +37 -37
- 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/SpecChart.d.ts +15 -0
- package/dist/charts/SpecChart.js +1 -0
- package/dist/charts/chartSpec.d.ts +48 -0
- package/dist/charts/chartSpec.js +1 -0
- package/dist/{chunk-OFOLUFNB.js → chunk-2NMT3Y5H.js} +7 -7
- package/dist/chunk-4DAN4Q6P.js +21 -0
- package/dist/{chunk-JWIKHVF4.js → chunk-ATX4N3L4.js} +9 -9
- package/dist/{chunk-WSODT2L5.js → chunk-AX7KPMDV.js} +2 -2
- package/dist/{chunk-53ROHXAV.js → chunk-B55IXYDR.js} +2 -2
- package/dist/chunk-CR7T435F.js +1 -0
- package/dist/{chunk-XFBXKKOB.js → chunk-CUT7PAXL.js} +1 -1
- package/dist/{chunk-BMZSMXE6.js → chunk-EZGY6CFN.js} +1 -1
- package/dist/{chunk-3GHBY2FP.js → chunk-G433MKIN.js} +9 -9
- package/dist/chunk-JXZIBQ4V.js +29 -0
- package/dist/{chunk-ZSRRV44J.js → chunk-KAWMOFSI.js} +1 -1
- package/dist/chunk-KBGC53FI.js +1 -0
- package/dist/{chunk-ECWSWLQR.js → chunk-KPTC2JPT.js} +1 -1
- package/dist/{chunk-WGSK7HEY.js → chunk-KWMMIOHD.js} +7 -7
- package/dist/{chunk-FLQIF7HC.js → chunk-KZEQJVBO.js} +3 -3
- package/dist/{chunk-UQZWPA5M.js → chunk-L4EH3ZYS.js} +3 -3
- package/dist/{chunk-GQACKEKW.js → chunk-MSQB2OE2.js} +2 -2
- package/dist/{chunk-4YUCXIRP.js → chunk-NFR4QZL2.js} +5 -5
- package/dist/{chunk-NVE6L27I.js → chunk-OS4CR7EE.js} +7 -7
- package/dist/{chunk-O6JX6RDX.js → chunk-PJCVNFWM.js} +7 -7
- package/dist/{chunk-3PNKI44X.js → chunk-QZXJHRFI.js} +6 -6
- package/dist/chunk-RNJ3MNO5.js +1 -0
- package/dist/{chunk-SXORVKIZ.js → chunk-RUHFXBDS.js} +3 -3
- package/dist/{chunk-SG2MTCA2.js → chunk-S4DCWKIY.js} +45 -45
- package/dist/chunk-TFMC2WAS.js +7 -0
- package/dist/{chunk-KKSW5IZ7.js → chunk-TFMOGKW2.js} +10 -10
- package/dist/{chunk-3XQGEILM.js → chunk-TS2Q55PK.js} +1 -1
- package/dist/{chunk-64FIE4SX.js → chunk-VUCJ53H4.js} +8 -8
- package/dist/{chunk-JNDBRSYZ.js → chunk-VX6V3B3N.js} +3 -3
- package/dist/chunk-WDXJWC3Y.js +7 -0
- package/dist/{chunk-R6DGLGB3.js → chunk-WJRBDHXD.js} +10 -10
- package/dist/{chunk-OVVXSAGE.js → chunk-X7XJBK2E.js} +4 -4
- package/dist/chunk-XEKPJGVZ.js +1 -0
- package/dist/{chunk-BY2OWWKC.js → chunk-XWLWG4HS.js} +2 -2
- package/dist/{chunk-5FTHHLJH.js → chunk-YGZMD6TZ.js} +14 -14
- package/dist/{chunk-GIM2422N.js → chunk-YRWRA7MW.js} +1 -1
- package/dist/{chunk-EJUR35JG.js → chunk-ZF3QKPTL.js} +1 -1
- package/dist/data/DataTable.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/ComposerAttachments.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/LinkPicker.d.ts +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/SplitButton.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient-meanings.d.ts +9 -9
- package/dist/icons/efficient-meanings.js +1 -1
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/sets.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +218 -218
- package/dist/page-tabs/index.js +4 -4
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/DropdownMenu.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.d.ts +18 -2
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/shell/TransferProgress.js +1 -1
- package/dist/shell/Tree.d.ts +2 -2
- package/dist/shell/Tree.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.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/templates/GalleryTemplate.js +1 -1
- package/dist/ui/index.d.ts +3 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-WZIBSVDK.js +0 -29
- package/dist/Files-33ONRECZ.js +0 -87
- package/dist/chunk-255BENW2.js +0 -7
- package/dist/chunk-3EKWDVBV.js +0 -29
- package/dist/chunk-B5VOHZCD.js +0 -1
- package/dist/chunk-HXJZ46JT.js +0 -1
- package/dist/chunk-N3GETPME.js +0 -1
- package/dist/chunk-UKB2I3UK.js +0 -21
- /package/dist/{chunk-276AUQNN.js → chunk-A5ALFLWZ.js} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ChartSpec } from './chartSpec.js';
|
|
3
|
+
|
|
4
|
+
interface SpecChartProps {
|
|
5
|
+
spec: ChartSpec;
|
|
6
|
+
/** Plot height in pixels. A chat bubble wants a short chart. */
|
|
7
|
+
height?: number;
|
|
8
|
+
/** Overrides the measured width. For SSR and specs. */
|
|
9
|
+
width?: number;
|
|
10
|
+
animate?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function SpecChart({ spec, height, width, animate, className }: SpecChartProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { type SpecChartProps, SpecChart as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{SpecChart as default}from"../chunk-TFMC2WAS.js";import"../chunk-X2S2XDZI.js";import"../chunk-5OTS2G3M.js";import"../chunk-36BRD5J3.js";import"../chunk-OSA24YH6.js";import"../chunk-CK2YOGUS.js";import"../chunk-BRHIRE4D.js";import"../chunk-VFC6QUEN.js";import"../chunk-W5M6P4DZ.js";import"../chunk-465RRWBY.js";import"../chunk-Y4MI6NRI.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-EYKUKN32.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A chart described as data — what the assistant writes inside a ` ```chart `
|
|
3
|
+
* fence so a trend question ("sales by month for the last three months") is
|
|
4
|
+
* answered with a picture as well as the figures.
|
|
5
|
+
*
|
|
6
|
+
* ```chart
|
|
7
|
+
* {"type": "bar", "title": "Sales by month", "currency": "AUD",
|
|
8
|
+
* "x": ["Aug", "Sep", "Oct"],
|
|
9
|
+
* "series": [{"name": "Sales", "values": [41200.5, 38950, 45010.25]}]}
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* The spec is written by a model, so this reader is strict and total: anything
|
|
13
|
+
* it cannot read in full returns `null` and the caller shows the fence as the
|
|
14
|
+
* code block it would otherwise have been. It never throws, and it never
|
|
15
|
+
* draws half a chart — a series one value short is a malformed spec, not a
|
|
16
|
+
* shorter line, because a chart that quietly drops a month answers a different
|
|
17
|
+
* question from the one asked.
|
|
18
|
+
*
|
|
19
|
+
* Deliberately small: a line or a bar, shared x labels, a few series, one
|
|
20
|
+
* unit. Anything wider (a second axis, a pie) is a table in prose instead.
|
|
21
|
+
*/
|
|
22
|
+
/** How many buckets and series a spec may carry. Past these it is a table. */
|
|
23
|
+
declare const CHART_SPEC_LIMITS: {
|
|
24
|
+
readonly points: 60;
|
|
25
|
+
readonly series: 8;
|
|
26
|
+
readonly label: 80;
|
|
27
|
+
};
|
|
28
|
+
interface ChartSpecSeries {
|
|
29
|
+
name: string;
|
|
30
|
+
/** One per x label; `null` is a gap (no figure for that bucket). */
|
|
31
|
+
values: (number | null)[];
|
|
32
|
+
}
|
|
33
|
+
interface ChartSpec {
|
|
34
|
+
type: 'line' | 'bar';
|
|
35
|
+
title?: string;
|
|
36
|
+
x: string[];
|
|
37
|
+
series: ChartSpecSeries[];
|
|
38
|
+
/** ISO 4217 code: values are money in this currency. Wins over `unit`. */
|
|
39
|
+
currency?: string;
|
|
40
|
+
/** A unit written after each value ("pcs", "kg", "%"). */
|
|
41
|
+
unit?: string;
|
|
42
|
+
/** Bars only: stack the series instead of grouping them. */
|
|
43
|
+
stacked?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** The spec in a ` ```chart ` fence, or `null` when it is not one in full. */
|
|
46
|
+
declare function parseChartSpec(source: string): ChartSpec | null;
|
|
47
|
+
|
|
48
|
+
export { CHART_SPEC_LIMITS, type ChartSpec, type ChartSpecSeries, parseChartSpec };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{CHART_SPEC_LIMITS,parseChartSpec}from"../chunk-CR7T435F.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{Checkbox_default as e}from"./chunk-CGZBDI6C.js";import{Pagination as t}from"./chunk-M5P6A7KS.js";import{
|
|
1
|
+
import{Checkbox_default as e}from"./chunk-CGZBDI6C.js";import{Pagination as t}from"./chunk-M5P6A7KS.js";import{SpinnerRing as r}from"./chunk-Q5MD3VY6.js";import{TH_ONE_LINE as o,OneLineLabel as n}from"./chunk-6KO5VTL7.js";import{useBrowserLayoutEffect as l}from"./chunk-D65T4H6J.js";import{useShellStrings as s}from"./chunk-E6UCGCOC.js";import{useState as a,useRef as i}from"react";import{jsxs as c,Fragment as d,jsx as h}from"react/jsx-runtime";function u(e){const t={};if(!e)return t;for(const[r,o]of Object.entries(e))!r.startsWith("data-")||"string"!=typeof o&&"number"!=typeof o&&"boolean"!=typeof o||(t[r]=o);return t}var m=e=>Array.isArray(e.columns),g=e=>"wide"===e.only?"rosh-dt-only-wide":"stacked"===e.only?"rosh-dt-only-stacked":"",f="rosh-dt-row-link rosh-focus-ring underline-offset-4 hover:underline",p={sm:"px-2 py-2",md:"px-3 py-2"},y={left:"text-left",right:"text-right",center:"text-center"};function b({direction:e}){/* @__PURE__ */
|
|
2
2
|
return c("span",{className:"ml-1 inline-flex flex-col leading-none","aria-hidden":"true",children:[
|
|
3
3
|
/* @__PURE__ */h("svg",{className:"h-2 w-2 "+("asc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */h("path",{d:"M4 0L8 5H0z"})}),
|
|
4
|
-
/* @__PURE__ */h("svg",{className:"h-2 w-2 "+("desc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */h("path",{d:"M4 5L0 0h8z"})})]})}function w(e,t=!1){const r=t?"":" whitespace-nowrap";return e.code?`font-mono${r}`:e.numeric?`tabular-nums${r}`:""}function x({columns:x,data:v,rowKey:k,sort:N=null,onSortChange:C,pagination:j,caption:M,loading:B=!1,bordered:S=!1,size:$="md",minWidth:z,rowClassName:H,onRow:T,rowHref:I,onRowPress:O,linkAs:A,emptyText:D,selection:L,footer:P,virtualized:E,stackOnNarrow:F=!1,stackBelow:K,className:R=""}){const W=s(),G=D??W.table.empty,V=(e,t)=>"function"==typeof k?k(e,t):String(e[k]),J=F&&!E,Q=J?x:x.flatMap(e=>{if(!m(e))return"stacked"===e.only?[]:[e];const t=e.columns.filter(e=>"stacked"!==e.only);return t.length?[{...e,columns:t}]:[]}),U=e=>J?{role:e}:{},Y=(e,t)=>(t??("string"==typeof e||"number"==typeof e?String(e):"")).trim()||void 0,[Z,q]=a(0),X=E?.overscan??6,_=E?e=>{const t=Math.max(0,Math.floor(e.currentTarget.scrollTop/E.rowHeight)-X);q(e=>e===t?e:t)}:void 0,ee=E?Math.ceil(E.height/E.rowHeight)+2*X:v.length,te=E?Math.min(Z,Math.max(0,v.length-ee)):0,re=Math.min(v.length,te+ee),oe=E?te*E.rowHeight:0,ne=E?(v.length-re)*E.rowHeight:0,le=i(null),[se,ae]=a(0);l(()=>{if(!E)return;const e=le.current?.offsetHeight??0;ae(t=>t===e?t:e)});const ie=e=>e.sortField??e.key,ce=e=>N&&N.field===ie(e)?N.direction:null,de=Q.flatMap(e=>m(e)?e.columns:[e]),he=Q.some(m),ue=/* @__PURE__ */new Map;if(J)for(const e of Q)if(m(e))for(const t of e.columns)ue.set(t,Y(e.title,e.label));const me=e=>{const t=Y(e.title,e.label),r=ue.get(e);return t&&r?`${r} · ${t}`:t},ge=new Set(L?.selected??[]),fe=L?v.map((e,t)=>V(e,t)):[],pe=fe.length>0&&fe.every(e=>ge.has(e)),ye=fe.some(e=>ge.has(e)),be=L?36:0,we=de.length+(L?1:0),xe=de.some(e=>"left"===e.fixed),ve=J&&!L&&de.some(e=>e.cardCorner),ke=A??"a",Ne=`${p[$]} ${"sm"===$?"text-xs":"text-sm"}`,Ce=(e,t)=>e.ellipsis?/* @__PURE__ */h("span",{className:"block w-0 min-w-full",children:t}):t,je=(e,t,
|
|
5
|
-
return h("th",{scope:"col",...U("columnheader"),rowSpan:
|
|
6
|
-
/* @__PURE__ */h(
|
|
7
|
-
/* @__PURE__ */h(b,{direction:s})]}):/* @__PURE__ */h(
|
|
4
|
+
/* @__PURE__ */h("svg",{className:"h-2 w-2 "+("desc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */h("path",{d:"M4 5L0 0h8z"})})]})}function w(e,t=!1){const r=t?"":" whitespace-nowrap";return e.code?`font-mono${r}`:e.numeric?`tabular-nums${r}`:""}function x({columns:x,data:v,rowKey:k,sort:N=null,onSortChange:C,pagination:j,caption:M,loading:B=!1,bordered:S=!1,size:$="md",minWidth:z,rowClassName:H,onRow:T,rowHref:I,onRowPress:O,linkAs:A,emptyText:D,selection:L,footer:P,virtualized:E,stackOnNarrow:F=!1,stackBelow:K,className:R=""}){const W=s(),G=D??W.table.empty,V=(e,t)=>"function"==typeof k?k(e,t):String(e[k]),J=F&&!E,Q=J?x:x.flatMap(e=>{if(!m(e))return"stacked"===e.only?[]:[e];const t=e.columns.filter(e=>"stacked"!==e.only);return t.length?[{...e,columns:t}]:[]}),U=e=>J?{role:e}:{},Y=(e,t)=>(t??("string"==typeof e||"number"==typeof e?String(e):"")).trim()||void 0,[Z,q]=a(0),X=E?.overscan??6,_=E?e=>{const t=Math.max(0,Math.floor(e.currentTarget.scrollTop/E.rowHeight)-X);q(e=>e===t?e:t)}:void 0,ee=E?Math.ceil(E.height/E.rowHeight)+2*X:v.length,te=E?Math.min(Z,Math.max(0,v.length-ee)):0,re=Math.min(v.length,te+ee),oe=E?te*E.rowHeight:0,ne=E?(v.length-re)*E.rowHeight:0,le=i(null),[se,ae]=a(0);l(()=>{if(!E)return;const e=le.current?.offsetHeight??0;ae(t=>t===e?t:e)});const ie=e=>e.sortField??e.key,ce=e=>N&&N.field===ie(e)?N.direction:null,de=Q.flatMap(e=>m(e)?e.columns:[e]),he=Q.some(m),ue=/* @__PURE__ */new Map;if(J)for(const e of Q)if(m(e))for(const t of e.columns)ue.set(t,Y(e.title,e.label));const me=e=>{const t=Y(e.title,e.label),r=ue.get(e);return t&&r?`${r} · ${t}`:t},ge=new Set(L?.selected??[]),fe=L?v.map((e,t)=>V(e,t)):[],pe=fe.length>0&&fe.every(e=>ge.has(e)),ye=fe.some(e=>ge.has(e)),be=L?36:0,we=de.length+(L?1:0),xe=de.some(e=>"left"===e.fixed),ve=J&&!L&&de.some(e=>e.cardCorner),ke=A??"a",Ne=`${p[$]} ${"sm"===$?"text-xs":"text-sm"}`,Ce=(e,t)=>e.ellipsis?/* @__PURE__ */h("span",{className:"block w-0 min-w-full",children:t}):t,je=(e,t,r,l=0)=>{const s=ce(e),a=y[e.align??(e.numeric?"right":"left")],i="left"===e.fixed,d=!(!e.sortable||!C);/* @__PURE__ */
|
|
5
|
+
return h("th",{scope:"col",...U("columnheader"),rowSpan:r>1?r:void 0,"aria-sort":"asc"===s?"ascending":"desc"===s?"descending":d?"none":void 0,style:{width:e.width,...i?{left:(Be[t]??0)+be}:{},...E?{top:l}:{}},className:[Ne,a,o,"font-semibold uppercase tracking-wide text-gray-500","sm"===$?"text-2xs":"text-xs",i?E?"sticky z-20 bg-gray-50":"sticky z-10 bg-gray-50":E?"sticky z-10 bg-gray-50":"",J&&d?"rosh-dt-sort":"",J?g(e):"",e.headerClassName??""].filter(Boolean).join(" "),children:Ce(e,d?/* @__PURE__ */c("button",{type:"button",onClick:()=>(e=>{if(!C)return;const t=ie(e),r=ce(e),o=e.sortFirst??"asc";C(null===r?{field:t,direction:o}:r===o?{field:t,direction:"asc"===o?"desc":"asc"}:null)})(e),"data-group":J?ue.get(e):void 0,className:`inline-flex max-w-full items-center font-semibold uppercase tracking-wide hover:text-gray-700 ${a}`,children:[
|
|
6
|
+
/* @__PURE__ */h(n,{children:e.title}),
|
|
7
|
+
/* @__PURE__ */h(b,{direction:s})]}):/* @__PURE__ */h(n,{children:e.title}))},e.key)};let Me=0;const Be=de.map(e=>{if("left"!==e.fixed)return null;const t=Me;return Me+=e.width??0,t}),Se=/* @__PURE__ */c(d,{children:[
|
|
8
8
|
/* @__PURE__ */c("div",{onScroll:_,style:E?{maxHeight:E.height}:void 0,className:`relative overflow-x-auto ${E?"overflow-y-auto":""} ${S?"rounded-lg border border-gray-200":""}${J?" rosh-dt-scroll":""}`.trim(),children:[B&&
|
|
9
9
|
/* @__PURE__ */c("div",{className:"absolute inset-0 z-20 flex items-start justify-center bg-white/60 pt-8",role:"status","aria-live":"polite",children:[
|
|
10
|
-
/* @__PURE__ */h(
|
|
10
|
+
/* @__PURE__ */h(r,{className:"h-6 w-6"}),
|
|
11
11
|
/* @__PURE__ */h("span",{className:"sr-only",children:W.table.loading})]}),
|
|
12
12
|
/* @__PURE__ */c("table",{...U("table"),className:(J?"rosh-dt-table ":"")+"w-full border-collapse tabular-nums",style:z?{minWidth:z}:void 0,children:[M&&/* @__PURE__ */h("caption",{className:"sr-only",children:M}),
|
|
13
13
|
/* @__PURE__ */c("thead",{...U("rowgroup"),className:J?"rosh-dt-head":void 0,children:[
|
|
14
|
-
/* @__PURE__ */c("tr",{ref:le,...U("row"),className:"border-b border-gray-200 bg-gray-50",children:[L&&/* @__PURE__ */h("th",{scope:"col",...U("columnheader"),rowSpan:he?2:void 0,style:{width:36,...E?{top:0}:{}},className:[Ne,
|
|
14
|
+
/* @__PURE__ */c("tr",{ref:le,...U("row"),className:"border-b border-gray-200 bg-gray-50",children:[L&&/* @__PURE__ */h("th",{scope:"col",...U("columnheader"),rowSpan:he?2:void 0,style:{width:36,...E?{top:0}:{}},className:[Ne,o,xe||E?"sticky z-20 bg-gray-50":"",xe?"left-0":"",J?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */h(e,{"aria-label":W.table.selectAll,checked:pe,indeterminate:ye&&!pe,onChange:()=>{if(!L)return;const e=new Set(fe);L.onChange(pe?L.selected.filter(t=>!e.has(t)):[...L.selected,...fe.filter(e=>!ge.has(e))])}})}),Q.map((e,t)=>m(e)?/* @__PURE__ */h("th",{scope:"colgroup",...U("columnheader"),colSpan:e.columns.length,style:E?{top:0}:void 0,className:[Ne,"text-center",o,"font-semibold uppercase tracking-wide text-gray-500","sm"===$?"text-2xs":"text-xs","border-b border-gray-200",E?"sticky z-10 bg-gray-50":"",e.headerClassName??""].filter(Boolean).join(" "),children:/* @__PURE__ */h(n,{children:e.title})},e.key??`group-${t}`):je(e,de.indexOf(e),he?2:1))]}),he&&/* @__PURE__ */h("tr",{...U("row"),className:"border-b border-gray-200 bg-gray-50",children:Q.flatMap(e=>m(e)?e.columns:[]).map(e=>je(e,de.indexOf(e),1,se))})]}),
|
|
15
15
|
/* @__PURE__ */h("tbody",{...U("rowgroup"),className:J?"rosh-dt-body":void 0,children:0!==v.length||B?/* @__PURE__ */c(d,{children:[oe>0&&/* @__PURE__ */h("tr",{"aria-hidden":"true",children:/* @__PURE__ */h("td",{colSpan:we,style:{height:oe,padding:0,border:0}})}),v.slice(te,re).map((t,r)=>{const o=te+r,n=T?.(t,o),l=!!n?.current,s=I?.(t,o),a=void 0===s&&O?()=>O(t,o):void 0,i=void 0!==s||void 0!==a;let d=!1;const m=(e,t)=>{if(d=!0,!i)return e;const r=[f,a?"cursor-pointer text-left":"",t?.className??""].filter(Boolean).join(" "),o=l?"true":void 0;return void 0!==s?/* @__PURE__ */h(ke,{href:s,className:r,"aria-current":o,children:e}):/* @__PURE__ */h("button",{type:"button",onClick:a,className:r,"aria-current":o,children:e})},p=de.map(e=>e.render?e.render(t,o,m):e.dataIndex?t[e.dataIndex]:null);if(i&&!d){const e=de.findIndex(e=>"stacked"!==e.only&&!e.cardCorner),t=de.findIndex(e=>"wide"!==e.only&&!e.cardCorner);for(const r of/* @__PURE__ */new Set([e,t]))r>=0&&(p[r]=m(p[r]))}const b=e=>e?t=>{t.currentTarget.contains(t.relatedTarget)||e()}:void 0;/* @__PURE__ */
|
|
16
16
|
return c("tr",{...u(n),...U("row"),style:E?{height:E.rowHeight}:void 0,onClick:n?.onClick,onMouseEnter:n?.onMouseEnter,onMouseLeave:n?.onMouseLeave,onFocus:b(n?.onFocus),onBlur:b(n?.onBlur),"aria-current":l&&!i?"true":void 0,...n?.onClick?{tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick?.()))}}:{},className:[J?L?"rosh-dt-row rosh-dt-row-select":"rosh-dt-row":"",J&&ve?"rosh-dt-row-corner":"","border-b border-gray-100 last:border-b-0",n?.onClick?"cursor-pointer hover:bg-gray-50 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",i?"rosh-dt-linked hover:bg-gray-50":"",l?"rosh-dt-current":"",H?.(t,o)??"",n?.className??""].filter(Boolean).join(" "),children:[L&&(()=>{const r=V(t,o);/* @__PURE__ */
|
|
17
17
|
return h("td",{...U("cell"),style:{width:36},onClick:e=>e.stopPropagation(),className:[Ne,xe?"sticky left-0 z-10 bg-white":"",J?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */h(e,{"aria-label":W.table.selectRow,checked:ge.has(r),onChange:()=>(e=>{L&&L.onChange(ge.has(e)?L.selected.filter(t=>t!==e):[...L.selected,e])})(r)})})})(),de.map((e,t)=>{const r="left"===e.fixed,o=p[t],n=ve&&!!e.cardCorner,l=J&&!n&&"wide"!==e.only;/* @__PURE__ */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{isSafeLinkHref as e}from"./chunk-PJPK2ADX.js";import{Icon as t}from"./chunk-KIBL6M3T.js";import{useShellStrings as r}from"./chunk-E6UCGCOC.js";import{jsx as n,jsxs as l}from"react/jsx-runtime";var s=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,a=t=>e(t.trim());function c(e){const t=[];let r,c=0,o=0;for(s.lastIndex=0;null!==(r=s.exec(e));)r.index>c&&t.push(e.slice(c,r.index)),void 0!==r[1]?t.push(
|
|
2
|
+
/* @__PURE__ */l("span",{className:"text-gray-400",children:["[",r[1],"]"]},o++)):void 0!==r[3]?t.push(
|
|
3
|
+
/* @__PURE__ */n("a",{href:a(r[4])?r[4]:void 0,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:r[3]},o++)):void 0!==r[5]?t.push(
|
|
4
|
+
/* @__PURE__ */n("strong",{className:"font-semibold text-gray-900",children:r[5]},o++)):void 0!==r[6]?t.push(
|
|
5
|
+
/* @__PURE__ */n("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},o++)):void 0!==r[7]&&t.push(/* @__PURE__ */n("em",{children:r[7]},o++)),c=s.lastIndex;return c<e.length&&t.push(e.slice(c)),t}function o({alt:e}){const s=e.replace(/^screenshot:\s*/i,""),a=r().markdown;/* @__PURE__ */
|
|
6
|
+
return l("div",{className:"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-3 text-gray-500",children:[
|
|
7
|
+
/* @__PURE__ */n(t,{name:"camera",look:"mini",className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),
|
|
8
|
+
/* @__PURE__ */l("span",{className:"text-xs",children:[
|
|
9
|
+
/* @__PURE__ */n("span",{className:"font-medium text-gray-600",children:`${a.screenshot} — `}),s]})]})}function i(e,t){const r=[];for(const n of e){const e=t.exec(n);e?r.push(e[1]):r.length&&(r[r.length-1]+=" "+n.trim())}return r}var d=e=>e.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(e=>e.trim());function u(e){return e.length>=2&&e[0].includes("|")&&/^\s*\|?[\s:|-]*-[\s:|-]*\|?\s*$/.test(e[1])&&e[1].includes("-")}function m(e,t){const r=e.split("\n"),s=r[0],a=/^(#{2,4})\s+(.*)$/.exec(s);if(a&&1===r.length){const e=a[1].length;/* @__PURE__ */
|
|
10
|
+
return n(`h${e}`,{className:2===e?"mt-2 text-sm font-semibold uppercase tracking-wide text-gray-500":3===e?"mt-1 text-base font-semibold text-gray-900":"mt-1 text-sm font-semibold text-gray-900",children:c(a[2])},t)}if(1===r.length&&/^---+$/.test(s))/* @__PURE__ */
|
|
11
|
+
return n("hr",{className:"border-gray-200"},t);if(u(r))return function(e,t){const r=d(e[0]),s=e.slice(2).map(d);/* @__PURE__ */
|
|
12
|
+
return n("div",{className:"my-1 overflow-x-auto rounded-lg border border-gray-200",children:/* @__PURE__ */l("table",{className:"w-full border-collapse text-sm",children:[
|
|
13
|
+
/* @__PURE__ */n("thead",{children:/* @__PURE__ */n("tr",{className:"bg-gray-50",children:r.map((e,t)=>/* @__PURE__ */n("th",{className:"border-b border-gray-200 px-3 py-2 text-left font-semibold text-gray-700",children:c(e)},t))})}),
|
|
14
|
+
/* @__PURE__ */n("tbody",{children:s.map((e,t)=>/* @__PURE__ */n("tr",{className:"even:bg-gray-50/50",children:e.map((e,t)=>/* @__PURE__ */n("td",{className:"border-t border-gray-100 px-3 h-8 align-top text-gray-700",children:c(e)},t))},t))})]})},t)}(r,t);if(/^>\s?/.test(s)){const e=r.map(e=>e.replace(/^>\s?/,"")).join(" ");/* @__PURE__ */
|
|
15
|
+
return n("div",{className:"my-1 rounded-r-lg border-l-4 border-blue-300 bg-blue-50/60 px-3 py-2 text-gray-700",children:c(e)},t)}const m=/^!\[([^\]]*)\]\(([^)]+)\)$/.exec(s);if(m&&1===r.length)/* @__PURE__ */
|
|
16
|
+
return n(o,{alt:m[1]},t);if(/^[-*]\s+/.test(s)){const e=i(r,/^[-*]\s+(.*)$/);/* @__PURE__ */
|
|
17
|
+
return n("ul",{className:"list-disc space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */n("li",{children:c(e)},t))},t)}const h=/^(\d+)\.\s+/.exec(s);if(h){const e=i(r,/^\d+\.\s+(.*)$/);/* @__PURE__ */
|
|
18
|
+
return n("ol",{start:Number(h[1]),className:"list-decimal space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */n("li",{className:"pl-1",children:c(e)},t))},t)}/* @__PURE__ */
|
|
19
|
+
return n("p",{children:c(r.join(" "))},t)}var h=/^( {0,3})(`{3,}|~{3,})[ \t]*(.*?)[ \t]*$/,p=/^[-*]\s+/,g=/^\d+\.\s+/,x=/^#{2,4}\s+/;function f(e){const t=e.split("\n"),r=[];let n=null;for(let e=0;e<t.length;e+=1){const l=t[e];let s=null;x.test(l)?s="heading":"table"!==n&&u(t.slice(e,e+2))?s="table":"bullet"!==n&&p.test(l)?s="bullet":"ordered"!==n&&g.test(l)&&("text"!==n||/^1\./.test(l))?s="ordered":"table"!==n||l.includes("|")?"heading"===n&&(s="text"):s="text",null!==s||null===n?(r.push([l]),n=s??"text"):r[r.length-1].push(l)}return r.map(e=>e.join("\n"))}function b(e){const t=e.replace(/\r\n/g,"\n").split("\n"),r=[];let n=[];const l=()=>{for(const e of n.join("\n").split(/\n{2,}/))for(const t of f(e.replace(/\s+$/,"")))""!==t.trim()&&r.push({text:t});n=[]};for(let e=0;e<t.length;e+=1){const s=h.exec(t[e]);if(!(null!==s&&!("`"===s[2][0]&&s[3].includes("`")))){n.push(t[e]);continue}l();const[,a,c,o]=s,i=[];let d=!1;for(e+=1;e<t.length;e+=1){const r=h.exec(t[e]);if(null!==r&&r[2][0]===c[0]&&r[2].length>=c.length&&""===r[3]){d=!0;break}i.push(a?t[e].replace(new RegExp(`^ {0,${a.length}}`),""):t[e])}r.push({fence:{lang:o.split(/[ \t]/)[0],code:i.join("\n"),closed:d}})}return l(),r}function y(e,t,r){if(r){let l=null;try{l=r(e)}catch{l=null}if(null!=l)/* @__PURE__ */return n("div",{children:l},t)}return function({lang:e,code:t},r){/* @__PURE__ */
|
|
20
|
+
return n("pre",{"data-language":e||void 0,className:"my-1 overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 p-3 font-mono text-xs text-gray-800",children:/* @__PURE__ */n("code",{children:t})},r)}(e,t)}function N({children:e,className:t,renderFence:r}){/* @__PURE__ */
|
|
21
|
+
return n("div",{className:`space-y-3 text-sm leading-relaxed text-gray-700 ${t??""}`.trim(),children:b(e??"").map((e,t)=>"fence"in e?y(e.fence,t,r):m(e.text,t))})}export{N as Markdown};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{Markdown as e}from"./chunk-
|
|
1
|
+
import{Markdown as e}from"./chunk-4DAN4Q6P.js";import{PLACEHOLDER_INK as t}from"./chunk-JFSYWEHD.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{LoadingSpinner as l}from"./chunk-Q5MD3VY6.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useState as s,useMemo as n}from"react";import{jsxs as o,jsx as i,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */i(r,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:y,emptyMessage:f}){const b=a(),[v,N]=s(""),[w,k]=s(null),[C,j]=s({}),M=v.trim().toLowerCase(),L=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let r=e.get(t.category);r||(r={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,r)),r.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,r)=>(t.get(e.key)??1/0)-(t.get(r.key)??1/0))},[h,p]),_=e=>!M||e.title.toLowerCase().includes(M)||e.body.toLowerCase().includes(M)||e.category_label.toLowerCase().includes(M),E=n(()=>L.map(e=>({...e,docs:e.docs.filter(_)})).filter(e=>e.docs.length>0),[L,M]),A=n(()=>E.flatMap(e=>e.docs),[E]),B=(w?A.find(e=>e.slug===w):void 0)??A[0]??null,D=e=>!!M||(C[e]??e===B?.category);/* @__PURE__ */
|
|
2
2
|
return o("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
|
|
3
3
|
/* @__PURE__ */o("aside",{className:"w-64 shrink-0 flex flex-col bg-white rounded-lg shadow overflow-hidden",children:[
|
|
4
4
|
/* @__PURE__ */o("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
5
5
|
/* @__PURE__ */i("h2",{className:"text-sm font-semibold text-gray-900",children:b.help.title}),u&&g&&/* @__PURE__ */i("button",{type:"button",onClick:g,className:"text-xs text-blue-600 hover:underline",children:b.help.newArticle})]}),
|
|
6
6
|
/* @__PURE__ */i("div",{className:"px-3 py-2 border-b border-gray-100 shrink-0",children:/* @__PURE__ */o("div",{className:"relative",children:[
|
|
7
7
|
/* @__PURE__ */i(r,{name:"search",look:"mini",className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 ${t}`,"aria-hidden":"true"}),
|
|
8
|
-
/* @__PURE__ */i("input",{type:"text",value:v,onChange:e=>
|
|
9
|
-
/* @__PURE__ */i("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */i(l,{size:"sm",padding:"py-6",label:b.help.loading}):0===
|
|
8
|
+
/* @__PURE__ */i("input",{type:"text",value:v,onChange:e=>N(e.target.value),placeholder:b.help.searchPlaceholder,className:"w-full rounded-md border border-gray-300 bg-white h-8 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})}),
|
|
9
|
+
/* @__PURE__ */i("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */i(l,{size:"sm",padding:"py-6",label:b.help.loading}):0===E.length?/* @__PURE__ */i("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:M?b.help.noResults:f??b.help.empty}):E.map(e=>{const t=D(e.key);/* @__PURE__ */
|
|
10
10
|
return o("div",{className:"py-0.5",children:[
|
|
11
|
-
/* @__PURE__ */o("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!
|
|
11
|
+
/* @__PURE__ */o("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!D(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600",children:[
|
|
12
12
|
/* @__PURE__ */i(d,{open:t}),
|
|
13
|
-
/* @__PURE__ */i("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=
|
|
13
|
+
/* @__PURE__ */i("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=B?.slug===e.slug;/* @__PURE__ */
|
|
14
14
|
return o("button",{type:"button",onClick:()=>k(e.slug),className:"w-full text-left pl-8 pr-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 transition-colors "+(t?"bg-blue-50 text-blue-700 font-medium":"text-gray-700 hover:bg-gray-50"),children:[
|
|
15
15
|
/* @__PURE__ */i("span",{className:"truncate",children:e.title}),!1===e.is_published&&/* @__PURE__ */i("span",{className:"ml-auto shrink-0 text-2xs text-amber-600",children:b.help.draft})]},e.slug)})]},e.key)})})]}),
|
|
16
|
-
/* @__PURE__ */i("main",{className:"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col",children:
|
|
16
|
+
/* @__PURE__ */i("main",{className:"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col",children:B?/* @__PURE__ */o(c,{children:[
|
|
17
17
|
/* @__PURE__ */o("div",{className:"flex items-start justify-between gap-4 px-5 py-3 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
18
18
|
/* @__PURE__ */o("div",{className:"min-w-0",children:[
|
|
19
|
-
/* @__PURE__ */i("h1",{className:"text-lg font-semibold text-gray-900 truncate",children:
|
|
20
|
-
/* @__PURE__ */o("p",{className:"text-xs text-gray-500 mt-0.5",children:[
|
|
21
|
-
/* @__PURE__ */i("div",{className:"flex-1 overflow-auto px-5 py-4",children:y?y(
|
|
19
|
+
/* @__PURE__ */i("h1",{className:"text-lg font-semibold text-gray-900 truncate",children:B.title}),
|
|
20
|
+
/* @__PURE__ */o("p",{className:"text-xs text-gray-500 mt-0.5",children:[B.category_label,!1===B.is_published&&/* @__PURE__ */o("span",{className:"ml-2 text-amber-600",children:["· ",b.help.draft]})]})]}),u&&x&&/* @__PURE__ */i("button",{type:"button",onClick:()=>x(B),className:"shrink-0 text-sm text-blue-600 hover:underline",children:b.help.edit})]}),
|
|
21
|
+
/* @__PURE__ */i("div",{className:"flex-1 overflow-auto px-5 py-4",children:y?y(B):B.body?/* @__PURE__ */i(e,{children:B.body}):/* @__PURE__ */i("p",{className:"text-sm text-gray-500 italic",children:b.help.noBody})})]}):/* @__PURE__ */i("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:m?/* @__PURE__ */i(l,{size:"sm",padding:"",label:b.help.loading}):/* @__PURE__ */i("p",{className:"text-sm text-gray-500",children:b.help.pickArticle})})})]})}export{h as HelpCenter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{renderMenuEntries as e,menuStatusIds as t}from"./chunk-
|
|
2
|
-
return p(n,{portal:!0,minWidth:x,style:
|
|
1
|
+
import{renderMenuEntries as e,menuStatusIds as t}from"./chunk-B55IXYDR.js";import{PopupMenu as n,MenuSemanticsContext as r}from"./chunk-PJCVNFWM.js";import{leavesContextMenuAlone as o}from"./chunk-5QFPTDQF.js";import{placeAtPoint as i,popupBounds as l}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as c}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as u}from"./chunk-TWVUQUUD.js";import{useRef as s,useId as a,useState as d,useEffect as m,useCallback as f}from"react";import{jsx as p,jsxs as v}from"react/jsx-runtime";function h(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(e=>!e.closest("[data-popup-submenu-panel]")):[]}function w({at:o,onClose:w,items:y,linkAs:g,children:k,owner:E,"aria-label":b,minWidth:x=180,className:D="",autoFocus:H=!0}){const L=s(null),j=a(),[A,S]=d(null),C=s(w);C.current=w,c(()=>{const e=L.current?.closest("[data-popup-menu-tree]");if(!e)return;const t={width:e.offsetWidth,height:e.offsetHeight},n=i({point:o,menu:t,bounds:l(E??null)});S(e=>e&&e.left===n.left&&e.top===n.top&&e.maxHeight===n.maxHeight?e:{left:n.left,top:n.top,maxHeight:n.maxHeight,scroll:t.height>n.maxHeight})},[o.x,o.y,E]);const U=s(null),W=s(!1);m(()=>(U.current=document.activeElement,()=>{const e=document.activeElement;e&&e!==document.body&&!L.current?.contains(e)||U.current?.focus?.({preventScroll:!0})}),[]),m(()=>{A&&!W.current&&H&&(W.current=!0,h(L.current)[0]?.focus({preventScroll:!0}))},[A,H]),m(()=>{if(H)return;const e=e=>{if(L.current?.contains(document.activeElement))return;const t=h(L.current),n="ArrowDown"===e.key||"Home"===e.key?t[0]:"ArrowUp"===e.key||"End"===e.key?t[t.length-1]:void 0;n&&(e.preventDefault(),n.focus({preventScroll:!0}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[H]),m(()=>u(e=>"Escape"===e.key&&(C.current(),!0),()=>L.current),[]),m(()=>{const e=()=>C.current();return window.addEventListener("resize",e),window.addEventListener("blur",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("blur",e),window.removeEventListener("scroll",e,!0)}},[]);const F=f(e=>{if(e.target.closest("[data-popup-submenu-panel]"))return;if("Tab"===e.key)return e.preventDefault(),void C.current();const t=h(L.current);if(0===t.length)return;const n=t.indexOf(document.activeElement),r="ArrowDown"===e.key?(n+1)%t.length:"ArrowUp"===e.key?n<=0?t.length-1:n-1:"Home"===e.key?0:"End"===e.key?t.length-1:-1;r<0||(e.preventDefault(),t[r].focus())},[]),T=A?{left:A.left,top:A.top,maxHeight:A.maxHeight,...A.scroll?{overflowY:"auto"}:{}}:{left:o.x,top:o.y,visibility:"hidden"};/* @__PURE__ */
|
|
2
|
+
return p(n,{portal:!0,minWidth:x,style:T,onClose:w,className:D,children:/* @__PURE__ */p(r.Provider,{value:!0,children:/* @__PURE__ */v("div",{ref:L,id:j,role:"menu","aria-label":b,"aria-describedby":y?t(y,j):void 0,"data-context-menu":"",onKeyDown:F,children:[y&&e(y,{menuId:j,choose:e=>{e.disabled||(C.current(),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>C.current(),linkAs:g}),k]})})})}function y(){const[e,t]=d(null),n=f(()=>t(null),[]),r=f((e,n)=>{const r="nativeEvent"in e?e.nativeEvent:e;if(o(r))return!1;e.preventDefault();const i=e.target instanceof Element?e.target:null;let{clientX:l,clientY:c}=e;if(0===l&&0===c&&i){const e=i.getBoundingClientRect();l=e.left,c=e.bottom}return t({x:l,y:c,data:n,owner:i}),!0},[]),i=f(e=>{r(e,void 0)},[r]);return{open:r,onContextMenu:i,close:n,state:e,props:{at:{x:e?.x??0,y:e?.y??0},owner:e?.owner??null,onClose:n}}}export{w as ContextMenu,y as useContextMenu};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PopupMenuDivider as e,PopupMenuLabel as l,menuTextRowStyle as t,PopupSubmenu as i,itemLook as a,MenuCheckMark as r}from"./chunk-
|
|
1
|
+
import{PopupMenuDivider as e,PopupMenuLabel as l,menuTextRowStyle as t,PopupSubmenu as i,itemLook as a,MenuCheckMark as r}from"./chunk-PJCVNFWM.js";import{jsx as n,jsxs as s}from"react/jsx-runtime";var d=e=>!!e&&"label"!==e.type&&"status"!==e.type&&"divider"!==e.type&&!e.disabled,c=(e,l)=>`${e}-status-${l}`;function o(e,l){return e.flatMap((e,t)=>"status"===e.type?[c(l,t)]:[]).join(" ")||void 0}function u(d,o){const{menuId:y,choose:b,toggle:h,followLink:p,rowProps:m=()=>({}),linkAs:k}=o,f=k??"a",v=(d,k)=>{if("divider"===d.type)/* @__PURE__ */
|
|
2
2
|
return n("div",{role:"separator",children:/* @__PURE__ */n(e,{})},d.key);if("label"===d.type)/* @__PURE__ */
|
|
3
3
|
return n("div",{id:`${y}-label-${k}`,children:/* @__PURE__ */n(l,{children:d.label})},d.key);if("status"===d.type)/* @__PURE__ */
|
|
4
4
|
return n("div",{id:c(y,k),className:"text-xs",style:t(),children:d.label},d.key);if("submenu"===d.type)/* @__PURE__ */
|
|
@@ -7,4 +7,4 @@ return s("button",{type:"button",role:"menuitemcheckbox","aria-checked":d.checke
|
|
|
7
7
|
/* @__PURE__ */n(r,{kind:"checkbox",checked:d.checked}),d.icon,d.label]},d.key)}if("radio"===d.type){const e=a(!1,d.disabled,"");/* @__PURE__ */
|
|
8
8
|
return s("button",{type:"button",role:"menuitemradio","aria-checked":d.checked,disabled:d.disabled,className:e.className,style:e.style,onClick:()=>b(d),...m(k,d),children:[
|
|
9
9
|
/* @__PURE__ */n(r,{kind:"radio",checked:d.checked}),d.icon,d.label]},d.key)}if((e=>"link"===e.type||void 0===e.type&&"string"==typeof e.href)(d)){const e=a(!1,d.disabled,"no-underline "+(d.current?"font-medium":""));return d.disabled?/* @__PURE__ */s("a",{role:"menuitem","aria-disabled":"true",className:e.className,style:e.style,...m(k,d),children:[d.icon,d.label]},d.key):/* @__PURE__ */s(f,{href:d.href,role:"menuitem","aria-current":d.current?"page":void 0,className:e.className,style:e.style,onClick:p,...m(k,d),children:[d.icon,d.label]},d.key)}const v=a(d.danger,d.disabled,"");/* @__PURE__ */
|
|
10
|
-
return s("button",{type:"button",role:"menuitem",disabled:d.disabled,className:v.className,style:v.style,onClick:()=>b(d),...m(k,d),children:[d.icon,d.label]},d.key)},
|
|
10
|
+
return s("button",{type:"button",role:"menuitem",disabled:d.disabled,className:v.className,style:v.style,onClick:()=>b(d),...m(k,d),children:[d.icon,d.label]},d.key)},N=[];for(let e=0;e<d.length;){const l=d[e];if("radio"!==l.type&&"checkbox"!==l.type){N.push(v(l,e)),e+=1;continue}const t=l.type,i=e,a=[];for(;e<d.length&&d[e].type===t;)a.push(v(d[e],e)),e+=1;const r="label"===d[i-1]?.type?`${y}-label-${i-1}`:void 0;N.push(/* @__PURE__ */n("div",{role:"group","aria-labelledby":r,children:a},`group:${l.key}`))}return N}export{d as isFocusableEntry,o as menuStatusIds,u as renderMenuEntries};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={points:60,series:8,label:80},r=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),t=r=>"string"==typeof r&&""!==r.trim()&&r.length<=e.label?r.trim():void 0;function n(e){return null===e?null:"number"==typeof e?Number.isFinite(e)?e:void 0:"string"==typeof e&&/^-?\d+(\.\d+)?$/.test(e.trim())?Number(e):void 0}function u(e,u){if(!r(e))return null;const l=t(e.name);if(!l||!Array.isArray(e.values)||e.values.length!==u)return null;const s=[];for(const r of e.values){const e=n(r);if(void 0===e)return null;s.push(e)}return{name:l,values:s}}function l(n){let l;try{l=JSON.parse(n)}catch{return null}if(!r(l))return null;if("line"!==l.type&&"bar"!==l.type)return null;if(!Array.isArray(l.x)||0===l.x.length||l.x.length>e.points)return null;const s=[];for(const e of l.x){const r="number"==typeof e&&Number.isFinite(e)?String(e):t(e);if(void 0===r)return null;s.push(r)}if(!Array.isArray(l.series)||0===l.series.length||l.series.length>e.series)return null;const i=[];for(const e of l.series){const r=u(e,s.length);if(!r)return null;i.push(r)}if(i.every(e=>e.values.every(e=>null===e)))return null;const o={type:l.type,x:s,series:i},c=t(l.title);c&&(o.title=c),"string"==typeof l.currency&&/^[A-Za-z]{3}$/.test(l.currency)&&(o.currency=l.currency.toUpperCase());const y=t(l.unit);return y&&!o.currency&&(o.unit=y),"bar"===l.type&&!0===l.stacked&&i.length>1&&(o.stacked=!0),o}export{e as CHART_SPEC_LIMITS,l as parseChartSpec};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{DropdownMenu as e}from"./chunk-
|
|
1
|
+
import{DropdownMenu as e}from"./chunk-WDXJWC3Y.js";import{jsxs as t,jsx as a,Fragment as i}from"react/jsx-runtime";var r="relative inline-flex items-center gap-2 px-3 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40",n="text-blue-600",s="text-gray-600 hover:text-gray-900";function l({item:e,active:r,caret:n}){/* @__PURE__ */
|
|
2
2
|
return t(i,{children:[e.icon&&/* @__PURE__ */a("span",{className:"h-4 w-4 shrink-0",children:e.icon}),
|
|
3
3
|
/* @__PURE__ */a("span",{className:"whitespace-nowrap",children:e.label}),null!=e.badge&&/* @__PURE__ */a("span",{className:"ml-0.5 inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-gray-100 px-2 text-2xs font-semibold leading-5 text-gray-600",children:e.badge}),n&&/* @__PURE__ */a("span",{className:"-ml-1 text-xs","aria-hidden":!0,children:"▾"}),r&&/* @__PURE__ */a("span",{className:"absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-blue-600","aria-hidden":!0})]})}function c({items:i,activeKey:c,onSelect:m,brand:d,actions:o,linkAs:u,className:b}){/* @__PURE__ */
|
|
4
4
|
return t("div",{className:`flex h-12 shrink-0 items-stretch gap-1 border-b border-gray-200 bg-white px-3 ${b??""}`,children:[d&&/* @__PURE__ */a("div",{className:"mr-1 flex items-center gap-2 pr-3 font-semibold text-gray-900",children:d}),
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ColoredBadge as e}from"./chunk-
|
|
1
|
+
import{ColoredBadge as e}from"./chunk-XWLWG4HS.js";import{Button_default as n}from"./chunk-4IU5BSVE.js";import{useShellStrings as t}from"./chunk-E6UCGCOC.js";import{useId as a}from"react";import{jsx as m,jsxs as i}from"react/jsx-runtime";function s({items:s,heading:l,emptyText:r,className:c=""}){const o=t().media,d=a();return s.length?/* @__PURE__ */i("div",{className:c||void 0,children:[
|
|
2
2
|
/* @__PURE__ */m("p",{id:d,className:"text-xs font-medium text-gray-500",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(t=>/* @__PURE__ */i("li",{className:"flex min-w-0 items-center gap-2 text-sm",children:[null!=t.kind&&/* @__PURE__ */m(e,{size:"xs",className:"flex-none",children:t.kind}),t.onOpen?/* @__PURE__ */m(n,{variant:"link",size:"sm",onClick:t.onOpen,className:"min-w-0 text-left",children:t.name}):/* @__PURE__ */m("span",{className:"min-w-0 break-words text-gray-700",children:t.name})]},t.key))})]}):/* @__PURE__ */m("p",{className:`text-sm text-gray-500 ${c}`.trim(),children:r??o.notUsed})}export{s as MediaUsedInList};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{MOVE_KEYS as e,MoveGrip as r,MoveHint as t,moveFromKey as a}from"./chunk-3PGK3VFS.js";import{GROUP_COLORS as n}from"./chunk-D323R2FT.js";import{
|
|
1
|
+
import{MOVE_KEYS as e,MoveGrip as r,MoveHint as t,moveFromKey as a}from"./chunk-3PGK3VFS.js";import{GROUP_COLORS as n}from"./chunk-D323R2FT.js";import{Icon as o}from"./chunk-KIBL6M3T.js";import{OneLineLabel as i}from"./chunk-6KO5VTL7.js";import{Tooltip as s}from"./chunk-22S6LG6D.js";import{useBrowserLayoutEffect as l}from"./chunk-D65T4H6J.js";import{useShellStrings as c}from"./chunk-E6UCGCOC.js";import{useRef as d,useCallback as u,useId as p,isValidElement as m}from"react";import{jsx as g,jsxs as h}from"react/jsx-runtime";var f='[role="treeitem"]';function b(e){return[...e.querySelectorAll(f)].filter(r=>{for(let t=r.parentElement?.closest('[role="group"]');t&&e.contains(t);t=t.parentElement?.closest('[role="group"]')??null)if(t.hasAttribute("hidden"))return!1;return!0})}function y({"aria-label":e,"aria-labelledby":r,children:t,className:a="",rootProps:n}){const o=d(null);l(()=>{const e=o.current;if(!e)return;const r=[...e.querySelectorAll(f)];if(0===r.length)return;const t=r.find(e=>e===document.activeElement)??r.find(e=>"true"===e.getAttribute("aria-selected"))??b(e)[0]??r[0];for(const e of r)e.tabIndex=e===t?0:-1});const i=u(e=>{n?.onKeyDown?.(e);const r=o.current,t=e.target.closest?.(f);if(!r||!t||e.target!==t||e.defaultPrevented)return;if(e.altKey||e.ctrlKey||e.metaKey)return;const a=b(r),i=a.indexOf(t),s=Number(t.getAttribute("aria-level")??"1"),l=t=>{e.preventDefault(),function(e,r){if(r){for(const t of e.querySelectorAll(f))t.tabIndex=t===r?0:-1;r.focus()}}(r,t)};switch(e.key){case"ArrowDown":l(a[i+1]);break;case"ArrowUp":l(a[i-1]);break;case"Home":l(a[0]);break;case"End":l(a[a.length-1]);break;case"ArrowRight":if("true"===t.getAttribute("aria-expanded")){const r=a[i+1];r&&Number(r.getAttribute("aria-level")??"1")>s?l(r):e.preventDefault()}break;case"ArrowLeft":if("true"!==t.getAttribute("aria-expanded"))for(let e=i-1;e>=0;e--)if(Number(a[e].getAttribute("aria-level")??"1")<s){l(a[e]);break}}},[n]);/* @__PURE__ */
|
|
2
2
|
return g("div",{...n,ref:o,role:"tree","aria-label":r?void 0:e,"aria-labelledby":r,onKeyDown:i,className:`flex flex-col gap-1 ${a}`.trim(),children:t})}function v({children:e,hidden:r,className:t=""}){/* @__PURE__ */
|
|
3
|
-
return g("div",{role:"group",hidden:r,className:`ml-4 flex flex-col gap-1 border-l border-gray-200 pl-2 ${t}`.trim(),children:e})}var x=["inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-2","text-2xs font-medium normal-case tabular-nums tracking-normal"].join(" "),k=`${x} bg-[color:color-mix(in_srgb,var(--ink-faint)_12%,transparent)] text-gray-600`;function w(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&!m(e)&&"label"in e}function N(e){if(null==e||!1===e)return null;const r=Array.isArray(e)&&e.length>0&&e.every(w)?e:w(e)?[e]:null;return r?r.map((e,r)=>/* @__PURE__ */g("span",{"data-tree-count":"","data-tone":e.tone,className:e.tone?`${x} ${n[e.tone]}`:k,children:e.label},r)):/* @__PURE__ */g("span",{"data-tree-count":"",className:k,children:e})}function A({children:e,count:r,expanded:t,onToggle:a}){const n=void 0!==t,
|
|
4
|
-
/* @__PURE__ */g("span",{"data-tree-label-text":"",className:"flex min-w-0 flex-1 text-left",children:/* @__PURE__ */g(
|
|
5
|
-
/* @__PURE__ */g("span",{"aria-hidden":"true","data-tree-caret":"",className:"flex h-4 w-4 shrink-0 items-center justify-center",children:j(!!t)}),
|
|
6
|
-
/* @__PURE__ */g("span",{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
|
|
7
|
-
return h("div",{...I,role:"treeitem","aria-level":
|
|
3
|
+
return g("div",{role:"group",hidden:r,className:`ml-4 flex flex-col gap-1 border-l border-gray-200 pl-2 ${t}`.trim(),children:e})}var x=["inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-2","text-2xs font-medium normal-case tabular-nums tracking-normal"].join(" "),k=`${x} bg-[color:color-mix(in_srgb,var(--ink-faint)_12%,transparent)] text-gray-600`;function w(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&!m(e)&&"label"in e}function N(e){if(null==e||!1===e)return null;const r=Array.isArray(e)&&e.length>0&&e.every(w)?e:w(e)?[e]:null;return r?r.map((e,r)=>/* @__PURE__ */g("span",{"data-tree-count":"","data-tone":e.tone,className:e.tone?`${x} ${n[e.tone]}`:k,children:e.label},r)):/* @__PURE__ */g("span",{"data-tree-count":"",className:k,children:e})}function A({children:e,count:r,expanded:t,onToggle:a}){const n=void 0!==t,o=
|
|
4
|
+
/* @__PURE__ */g("span",{"data-tree-label-text":"",className:"flex min-w-0 flex-1 text-left",children:/* @__PURE__ */g(i,{children:e})}),s=null!=r&&!1!==r&&/* @__PURE__ */g("span",{"data-tree-count":"",className:k,children:r}),l="text-xs font-semibold uppercase tracking-wide text-gray-500";return n?/* @__PURE__ */g("div",{role:"presentation",className:"pb-1 pt-3",children:/* @__PURE__ */h("button",{type:"button","aria-expanded":t,onClick:a,className:["flex w-full items-center gap-2 rounded-md px-2 hover:text-gray-900","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",l].join(" "),children:[
|
|
5
|
+
/* @__PURE__ */g("span",{"aria-hidden":"true","data-tree-caret":"",className:"flex h-4 w-4 shrink-0 items-center justify-center",children:j(!!t)}),o,s]})}):/* @__PURE__ */h("div",{role:"presentation",className:`flex items-center gap-2 px-2 pb-1 pt-3 ${l}`,children:[
|
|
6
|
+
/* @__PURE__ */g("span",{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),o,s]})}var j=e=>/* @__PURE__ */g(o,{name:"chevron-right","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3 transition-transform "+(e?"rotate-90":"")}),D={backgroundColor:"inherit",maskImage:"linear-gradient(to right, transparent, black 12px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 12px)"};function C({label:n,level:o=1,icon:s,preview:l,selected:c=!1,tone:d,expanded:u,onToggle:m,onSelect:f,muted:b=!1,badge:y,actions:v,actionsPinned:x=!1,actionsOverlay:k=!0,rename:w,drop:A,dragging:C=!1,draggable:P=!1,dragHint:$,onMove:K,rowProps:I,className:T=""}){const E=void 0!==u,S=p(),H=[I?.["aria-describedby"],K?S:void 0].filter(Boolean).join(" ")||void 0,L="shared"===d?"text-[color:var(--status-success-soft-ink)]":null,O=c?L?`bg-[var(--status-success-soft)] ${L}`:"bg-blue-50 text-blue-700":"into"===A?`bg-blue-50 ${L??"text-gray-900"}`:`${L??"text-gray-700"} hover:bg-gray-100`;/* @__PURE__ */
|
|
7
|
+
return h("div",{...I,role:"treeitem","aria-level":o,"aria-selected":c,"aria-expanded":E?u:void 0,"data-tone":d,tabIndex:c?0:-1,"aria-keyshortcuts":I?.["aria-keyshortcuts"]??(K?e:void 0),"aria-describedby":H,"data-drop":A,"data-draggable":P||void 0,onKeyDown:e=>{if(I?.onKeyDown?.(e),e.target!==e.currentTarget||e.defaultPrevented)return;const r=a(e);r&&K?(e.preventDefault(),K(r)):"Enter"!==e.key&&" "!==e.key||!f?("ArrowRight"===e.key&&E&&!u&&m||"ArrowLeft"===e.key&&E&&u&&m)&&(e.preventDefault(),m()):(e.preventDefault(),f())},onClick:e=>{I?.onClick?.(e),e.defaultPrevented||f?.()},className:["group/treerow relative flex h-8 shrink-0 select-none items-center gap-2 rounded-md px-2 text-sm",P?"cursor-grab active:cursor-grabbing":"cursor-pointer","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",O,"into"===A?"ring-2 ring-inset ring-[color:var(--rosh-drop-ring)]":"",C?"opacity-40":"",T].filter(Boolean).join(" "),children:["before"===A&&/* @__PURE__ */g("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -top-0.5 h-0.5 rounded-full bg-blue-500"}),"after"===A&&/* @__PURE__ */g("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -bottom-0.5 h-0.5 rounded-full bg-blue-500"}),P&&
|
|
8
8
|
/* @__PURE__ */g(r,{marker:"tree",hint:$,dragging:C,revealClassName:"group-hover/treerow:opacity-100"}),
|
|
9
9
|
/* @__PURE__ */g("span",E?{"aria-hidden":"true","data-tree-caret":"",onClick:e=>{e.stopPropagation(),m?.()},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-gray-500 hover:bg-gray-200 hover:text-gray-900",children:j(!!u)}:{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),null!=s&&/* @__PURE__ */g("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0 items-center justify-center "+(b?"text-gray-400":""),children:s}),
|
|
10
10
|
/* @__PURE__ */h("span",{className:"relative flex min-w-0 flex-1 items-center gap-2",children:[w??
|
|
11
|
-
/* @__PURE__ */g("span",{className:`flex min-w-0 ${c?"font-semibold":"font-medium"} ${b?"text-gray-400 line-through":""}`,children:/* @__PURE__ */h(
|
|
11
|
+
/* @__PURE__ */g("span",{className:`flex min-w-0 ${c?"font-semibold":"font-medium"} ${b?"text-gray-400 line-through":""}`,children:/* @__PURE__ */h(i,{children:[n,null!=l&&/* @__PURE__ */g("span",{className:"ml-2 font-normal text-gray-500",children:l})]})}),N(y),null!=v&&!k&&/* @__PURE__ */g("span",{"data-tree-actions":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),className:"ml-auto flex shrink-0 items-center gap-0.5 transition-opacity "+(x||b?"opacity-100":"opacity-0 group-hover/treerow:opacity-100 group-focus-within/treerow:opacity-100"),children:v})]}),null!=v&&k&&
|
|
12
12
|
/* @__PURE__ */h("span",{"data-tree-actions":"","data-tree-actions-overlay":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),style:D,className:"absolute inset-y-0 right-0 grid rounded-r-md transition-opacity "+(x||b||c?"opacity-100":"pointer-events-none opacity-0 group-hover/treerow:pointer-events-auto group-hover/treerow:opacity-100 group-focus-within/treerow:pointer-events-auto group-focus-within/treerow:opacity-100"),children:[
|
|
13
13
|
/* @__PURE__ */g("span",{"aria-hidden":"true","data-tree-actions-scrim":"",className:"col-start-1 row-start-1",style:{background:"var(--rosh-tree-ground, var(--surface))"}}),
|
|
14
14
|
/* @__PURE__ */g("span",{"aria-hidden":"true",className:"col-start-1 row-start-1",style:{backgroundColor:"inherit"}}),
|
|
15
15
|
/* @__PURE__ */g("span",{className:"col-start-1 row-start-1 flex items-center gap-0.5 pl-4 pr-2",children:v})]}),K&&/* @__PURE__ */g(t,{id:S})]})}function P({onAdd:e,label:r,drop:t=!1,slotProps:a}){const n=c().tree,o=t?n.dropHere:r??n.empty,i="flex min-h-8 w-full items-center gap-2 rounded-md border border-dashed px-3 text-sm "+(t?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 text-gray-500");/* @__PURE__ */
|
|
16
16
|
return g("div",{...a,role:"presentation","data-drop":t||void 0,children:e?/* @__PURE__ */h("button",{type:"button",onClick:e,className:`${i} text-left hover:bg-gray-100 hover:text-gray-900 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]`,children:[
|
|
17
|
-
/* @__PURE__ */g("span",{"aria-hidden":"true",children:"+"}),o]}):/* @__PURE__ */g("span",{className:i,children:o})})}function $({onInsert:e,label:r,drop:t=!1,seamProps:a}){const n=c().tree,
|
|
17
|
+
/* @__PURE__ */g("span",{"aria-hidden":"true",children:"+"}),o]}):/* @__PURE__ */g("span",{className:i,children:o})})}function $({onInsert:e,label:r,drop:t=!1,seamProps:a}){const n=c().tree,i=r??n.insertHere,l=t?"opacity-100":e?"opacity-0 group-hover/seam:opacity-100 group-focus-within/seam:opacity-100":"opacity-0";/* @__PURE__ */
|
|
18
18
|
return h("div",{...a,role:"presentation","data-tree-seam":"","data-drop":t||void 0,className:`group/seam relative z-10 -my-1 h-1 shrink-0 ${a?.className??""}`.trim(),children:[
|
|
19
19
|
/* @__PURE__ */g("span",{"aria-hidden":"true",className:"absolute inset-x-0 -bottom-1 -top-1"}),
|
|
20
|
-
/* @__PURE__ */g("span",{"aria-hidden":"true","data-tree-seam-line":"",className:`pointer-events-none absolute inset-x-2 top-1/2 h-0.5 -translate-y-1/2 rounded-full bg-blue-500 transition-opacity ${l}`}),e&&/* @__PURE__ */g(s,{content:
|
|
20
|
+
/* @__PURE__ */g("span",{"aria-hidden":"true","data-tree-seam-line":"",className:`pointer-events-none absolute inset-x-2 top-1/2 h-0.5 -translate-y-1/2 rounded-full bg-blue-500 transition-opacity ${l}`}),e&&/* @__PURE__ */g(s,{content:i,className:"absolute left-1/2 top-1/2 inline-flex -translate-x-1/2 -translate-y-1/2",children:/* @__PURE__ */g("button",{type:"button","aria-label":i,onClick:e,className:"flex h-5 w-5 items-center justify-center rounded-full bg-blue-600 text-white transition rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(t?"scale-75 opacity-0":"scale-75 opacity-0 group-hover/seam:scale-100 group-hover/seam:opacity-100 focus-visible:scale-100 focus-visible:opacity-100"),children:/* @__PURE__ */g(o,{name:"add","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3"})})})]})}export{y as Tree,P as TreeEmptySlot,v as TreeGroup,A as TreeGroupLabel,C as TreeRow,$ as TreeSeam};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{Tree as e,TreeRow as l,TreeGroup as n}from"./chunk-G433MKIN.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{ImageLightbox as r}from"./chunk-RGBX3EVC.js";import{DescriptionList as i}from"./chunk-SACUSHVN.js";import{Drawer as t}from"./chunk-YW2DH6YQ.js";import{EmptyState as o}from"./chunk-KDZUWQEG.js";import{Breadcrumbs as d}from"./chunk-WJ3XSJ6B.js";import{useContextMenu as s,ContextMenu as c}from"./chunk-AX7KPMDV.js";import{useGridSelection as m}from"./chunk-VLKDWKVR.js";import{useMarquee as u}from"./chunk-OLFYNMTD.js";import{ROOT_KEY as h,mediaLibraryMenu as p}from"./chunk-7CFH6Y4T.js";import{useMediaMoveItems as f}from"./chunk-DFDDRKIJ.js";import{DropdownMenu as g}from"./chunk-WDXJWC3Y.js";import{copyToClipboard as v}from"./chunk-5PY4H4ZJ.js";import{NativeSelect as y}from"./chunk-VTVOQS5L.js";import{MediaUploadGrid as k}from"./chunk-OS4CR7EE.js";import{MediaUsedInList as b}from"./chunk-EZGY6CFN.js";import{Input_default as w}from"./chunk-UNEJ2ABD.js";import{useFileIntake as x,FileIntakeAlert as C}from"./chunk-YDYDR72S.js";import{Segmented as N}from"./chunk-N6DTTOB6.js";import{Checkbox_default as I}from"./chunk-CGZBDI6C.js";import{Banner as D}from"./chunk-WTY3SXO7.js";import{IconButton_default as S}from"./chunk-4CANQ3B3.js";import{ColoredBadge as j}from"./chunk-XWLWG4HS.js";import{Button_default as z}from"./chunk-4IU5BSVE.js";import{buttonClasses as T}from"./chunk-K7U4RWXJ.js";import{Icon as F}from"./chunk-KIBL6M3T.js";import{Tooltip as O}from"./chunk-22S6LG6D.js";import{usePlotWidth as E}from"./chunk-MAFUXCPZ.js";import{useShellStrings as P}from"./chunk-E6UCGCOC.js";import{useRef as L,useMemo as A,useCallback as M,useState as B,useEffect as K}from"react";import{jsxs as R,Fragment as U,jsx as W}from"react/jsx-runtime";var G="application/x-efficient-media-files",V="application/x-efficient-media-folder",Y={type:"all",use:"any",sort:"newest"},J={lock:/* @__PURE__ */W(F,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */W(F,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */W(F,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */W(F,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */W(F,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */W(F,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */W(F,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */W(F,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */W(F,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */W(F,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */W(F,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */W(F,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */W(F,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */W(F,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */W(F,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */W(F,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},H={link:/* @__PURE__ */W(F,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */W(F,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */W(F,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */W(F,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function X({value:e,label:l,onDone:n}){const[a,r]=B(e),i=L(!1),t=e=>{i.current||(i.current=!0,n(e))};/* @__PURE__ */
|
|
2
|
+
return W(w,{size:"sm",autoFocus:!0,"aria-label":l,value:a,onChange:e=>r(e.target.value),onFocus:e=>e.currentTarget.select(),onKeyDown:l=>{l.stopPropagation(),"Enter"===l.key?(l.preventDefault(),t(a.trim()||e)):"Escape"===l.key&&(l.preventDefault(),t(null))},onBlur:()=>t(a.trim()||e),onClick:e=>e.stopPropagation()})}function $(F){const{mode:$="manage",layout:Q="auto",location:Z,onLocationChange:q,folders:_,products:ee,allFilesCount:le,trashCount:ne,files:ae,query:re,onQueryChange:ie,filters:te=Y,onFiltersChange:oe,extraFilters:de,view:se="grid",onViewChange:ce,selectedIds:me,onSelectionChange:ue,usedIn:he,denied:pe={},accept:fe="image/*,video/*",maxSizeBytes:ge,busy:ve,progress:ye,onUpload:ke,onNewFolder:be,onRename:we,onMove:xe,onTrash:Ce,onDeleteFolder:Ne,onRestore:Ie,onDeleteForever:De,onEmptyTrash:Se,onReplace:je,onCropEdit:ze,onOpenInDesign:Te,onChoose:Fe,onCancel:Oe,pickNote:Ee,className:Pe=""}=F,Le=P().mediaLibrary,Ae=P().media,Me="pick"===$,Be=!Me,Ke=L(null),Re=E(Ke,"phone"===Q?343:1200),Ue="phone"===Q||"auto"===Q&&Re<640,We=A(()=>function(e=[]){const l=/* @__PURE__ */new Map,n=(e,a)=>{for(const r of e){const e=[...a,r];l.set(r.id,{node:r,path:e}),r.children&&n(r.children,e)}};return n(e,[]),l}(ee),[ee]),Ge=A(()=>new Map(_.map(e=>[e.id,e])),[_]),Ve=A(()=>{const e=/* @__PURE__ */new Map;for(const l of _){const n=l.parentId&&Ge.has(l.parentId)?l.parentId:null;e.set(n,[...e.get(n)??[],l])}return e},[_,Ge]),Ye=M(e=>{const l=[];for(let n=e?Ge.get(e):void 0;n&&(l.unshift(n),!(l.length>_.length));n=n.parentId?Ge.get(n.parentId):void 0);return l},[Ge,_.length]),Je=M((e,l)=>Ye(e).some(e=>e.id===l),[Ye]),[He,Xe]=B(()=>/* @__PURE__ */new Set(["@files"])),$e=e=>Xe(l=>{const n=new Set(l);return n.has(e)?n.delete(e):n.add(e),n}),Qe=M(e=>{Xe(l=>e.every(e=>l.has(e))?l:/* @__PURE__ */new Set([...l,...e]))},[]),Ze="files"===(qe=Z).place?`files:${qe.folderId??""}`:"products"===qe.place?`products:${qe.nodeId??""}`:"trash";var qe;K(()=>{if("files"===Z.place)Qe(["@files",...Ye(Z.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===Z.place){const e=Z.nodeId?We.get(Z.nodeId)?.path??[]:[];Qe(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[Ze]);const _e="products"===Z.place,el="trash"===Z.place,ll="files"===Z.place,nl=ll?Z.folderId:null,al=_e&&Z.nodeId?We.get(Z.nodeId)?.path[0]:void 0,rl=e=>e?.sharedFrom?`${Le.readOnly} ${Le.editedAtHq(e.sharedFrom)}`:Le.readOnly,il=A(()=>ae.map(e=>e.id),[ae]),tl=A(()=>new Map(ae.map(e=>[e.id,e])),[ae]),ol=m(il),dl=A(()=>il.filter(e=>ol.selected.has(e)),[il,ol.selected]),sl=1===dl.length?tl.get(dl[0]):void 0,cl=L(!0);K(()=>{cl.current?cl.current=!1:ol.clear()},[Ze]);const ml=me?.join("\0");K(()=>{me&&ol.setSelection(me)},[ml]);const ul=L(ml??""),hl=dl.join("\0");K(()=>{ul.current!==hl&&(ul.current=hl,ue?.(dl))},[hl]);const pl=(e,l={})=>{Me?ol.select(e):ol.select(e,{ctrl:!(!l.ctrlKey&&!l.metaKey),shift:!!l.shiftKey})},[fl,gl]=B(null),vl=e=>{const l=fl;if(gl(null),!l||null==e)return;e!==("folder"===l.kind?Ge.get(l.id)?.name:tl.get(l.id)?.name)&&we?.(l,e)},yl=async e=>{if(!be)return;const l=await be(e);Qe(["@files",...e?[e]:[]]),"string"==typeof l&&gl({kind:"folder",id:l})},kl=M(e=>{const l=[],n=l=>{if("files"===e.kind)return l===nl&&ll?Le.alreadyHere:void 0;const n=Ge.get(e.id);return l===e.id||l&&Je(l,e.id)?Le.notIntoItself:(n?.parentId??null)===l?Le.folderAlreadyHere:void 0};l.push({key:h,label:Le.allFiles,disabledReason:n(null)});const a=(e,r)=>{for(const i of Ve.get(e)??[])l.push({key:i.id,label:i.name,depth:r,disabledReason:n(i.id)}),a(i.id,r+1)};return a(null,1),l},[Ve,Ge,ll,Je,nl,Le]),bl=M(e=>{const l=new Set(e.map(e=>tl.get(e)?.kind??"image"));return 1===l.size?[...l][0]:"file"},[tl]),[wl,xl]=B(null),Cl={words:Le,media:Ae,denied:pe,moveTargets:kl,kindOf:bl,urlOf:e=>tl.get(e)?.url,newSubfolder:be&&Be?e=>{yl(e)}:void 0,rename:we&&Be?e=>{"file"!==e.kind||ol.isSelected(e.id)||ol.select(e.id),gl(e)}:void 0,move:xe&&Be?xe:void 0,trash:Ce&&Be?Ce:void 0,deleteFolder:Ne&&Be?Ne:void 0,folderNotEmpty:e=>!!Ge.get(e)?.notEmpty,replace:je&&Be?je:void 0,copyUrl:e=>{const l=tl.get(e)?.url;l&&v(Le.urlLabel,l)},openInDesign:Te,restore:Ie,deleteForever:De},Nl=e=>p(e,Cl),Il=s(),Dl=(e,l)=>{Me||(ol.isSelected(e)||ol.select(e),Il.open(l,(e=>{const l=ol.isSelected(e)?dl:[e];return _e?{kind:"render",id:e}:el?{kind:"trashed",ids:l}:{kind:"files",ids:l}})(e)))},[Sl,jl]=B(null),[zl,Tl]=B(null),[Fl,Ol]=B(null);K(()=>{if(!zl&&!Sl)return;const e=()=>{Tl(null),jl(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[zl,Sl]);const El=(e,l)=>Array.from(e.dataTransfer?.types??[]).includes(l),Pl=(e,l)=>!(!xe||pe.move||Me)&&(!!El(e,G)||!(!El(e,V)||!Fl)&&(l!==Fl&&!(l&&Je(l,Fl)))),Ll=(e,l)=>({onDragEnter:n=>{Pl(n,l)&&(n.preventDefault(),jl(e))},onDragOver:n=>{Pl(n,l)&&(n.preventDefault(),n.dataTransfer.dropEffect="move",Sl!==e&&jl(e))},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||jl(l=>l===e?null:l)},onDrop:e=>{if(Pl(e,l))if(e.preventDefault(),jl(null),El(e,G)){let n;try{n=JSON.parse(e.dataTransfer.getData(G))}catch{n=null}Array.isArray(n)&&n.length&&xe({kind:"files",ids:n.map(String)},l)}else Fl&&(xe({kind:"folder",id:Fl},l),Ol(null))}}),Al=e=>{const l=e=>El(e,G)||El(e,V)||El(e,"Files");return{onDragEnter:n=>{l(n)&&Tl(e)},onDragOver:n=>{l(n)&&zl!==e&&Tl(e)},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||Tl(l=>l===e?null:l)}}},Ml=(e,l,n)=>/* @__PURE__ */W(O,{side:"right",content:zl===e?Le.noDropProducts:rl(n),open:zl===e||!zl&&void 0,children:/* @__PURE__ */W("span",{children:l})}),Bl=e=>({onContextMenu:l=>{Il.open(l,e)}}),Kl=(e,a,r)=>e.map(e=>{const i=`p:${e.id}`,t=r??e,o=He.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
|
|
3
|
+
return R("div",{role:"none",className:"contents",children:[
|
|
4
|
+
/* @__PURE__ */W(l,{label:Ml(i,e.name,t),level:a,icon:d&&o?J.folderOpen:J.folder,badge:null!=e.count?e.count:void 0,selected:_e&&Z.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>$e(i):void 0,onSelect:()=>q({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Al(i),...Be?Bl({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */W(n,{children:Kl(d,a+1,t)})]},e.id)}),Rl=(e,a)=>(Ve.get(e)??[]).map(e=>{const r=Ve.get(e.id),i=He.has(e.id),t="folder"===fl?.kind&&fl.id===e.id,o=Nl({kind:"folder",id:e.id});/* @__PURE__ */
|
|
5
|
+
return R("div",{role:"none",className:"contents",children:[
|
|
6
|
+
/* @__PURE__ */W(l,{label:e.name,level:a,icon:r&&i?J.folderOpen:J.folder,badge:null!=e.count?e.count:void 0,selected:t||ll&&Z.folderId===e.id,expanded:r?i:void 0,onToggle:r?()=>$e(e.id):void 0,onSelect:()=>q({place:"files",folderId:e.id}),drop:Sl===e.id?"into":void 0,dragging:Fl===e.id,draggable:Be&&!!xe&&!pe.move,rename:t?/* @__PURE__ */W(X,{value:e.name,label:Le.folderName,onDone:vl}):void 0,actions:Be&&o.length?/* @__PURE__ */W(g,{align:"end","aria-label":Le.folderActions,trigger:J.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Ll(e.id,e.id),...Be?Bl({kind:"folder",id:e.id}):{},...Be&&xe&&!pe.move?{draggable:!0,onDragStart:l=>{l.dataTransfer.effectAllowed="move",l.dataTransfer.setData(V,e.id),Ol(e.id)},onDragEnd:()=>{Ol(null),jl(null)}}:{}}}),r&&i&&/* @__PURE__ */W(n,{children:Rl(e.id,a+1)})]},e.id)}),Ul=He.has("@files"),Wl=He.has("@products"),Gl=/* @__PURE__ */R(e,{"aria-label":Le.folders,children:[ee&&/* @__PURE__ */R(U,{children:[
|
|
7
|
+
/* @__PURE__ */W(l,{label:Ml("@products",Le.products),level:1,icon:J.lock,badge:{label:Le.readOnlyBadge,tone:"neutral"},expanded:ee.length?Wl:void 0,onToggle:()=>$e("@products"),selected:_e&&null==Z.nodeId,onSelect:()=>q({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Al("@products")}}),Wl&&ee.length>0&&/* @__PURE__ */W(n,{children:Kl(ee,2)})]}),
|
|
8
|
+
/* @__PURE__ */W(l,{label:Le.allFiles,level:1,icon:Ul?J.folderOpen:J.folder,badge:null!=le?le:void 0,expanded:Ve.get(null)?.length?Ul:void 0,onToggle:()=>$e("@files"),selected:ll&&null==Z.folderId,onSelect:()=>q({place:"files",folderId:null}),drop:"@files"===Sl?"into":void 0,rowProps:{"data-media-row":"@files",...Ll("@files",null)}}),Ul&&(Ve.get(null)?.length??0)>0&&/* @__PURE__ */W(n,{children:Rl(null,2)}),Be&&/* @__PURE__ */W(l,{label:Le.trash,level:1,icon:J.trash,badge:null!=ne?ne:void 0,selected:el,onSelect:()=>q({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Vl=(()=>{if(el)return[{label:Le.trash}];if(_e){const e=Z.nodeId?We.get(Z.nodeId)?.path??[]:[];return[{label:Le.products,onClick:e.length?()=>q({place:"products",nodeId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"products",nodeId:l.id}):void 0}))]}const e=Ye(nl);return[{label:Le.allFiles,onClick:e.length?()=>q({place:"files",folderId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"files",folderId:l.id}):void 0}))]})(),Yl=_e?Le.readOnly:pe.upload,Jl=!!ke&&!el&&!Yl,Hl=x({accept:fe,maxSizeBytes:ge,multiple:!0,disabled:!Jl,onAccept:e=>ke?.(e,nl)}),Xl=_e?Le.noProductFolder:pe.newFolder,$l=e=>e?{"aria-disabled":!0,disabledReason:e}:{},Ql=/* @__PURE__ */R("div",{className:"flex flex-wrap items-center gap-2",children:[Be&&be&&!el&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.folderPlus,onClick:()=>{yl(nl)},...$l(Xl),children:Le.newFolder}),ke&&!el&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:J.upload,onClick:()=>Hl.open(),...$l(Yl),children:Le.upload}),Be&&el&&Se&&ae.length>0&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:Se,...$l(pe.deleteForever),children:Le.emptyTrash})]}),Zl=(e,l,n,a,r)=>/* @__PURE__ */W("div",{style:{width:Ue?void 0:r,flex:Ue?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */W(y,{size:"sm","aria-label":e,value:l,onChange:a,options:n})},e),ql=e=>l=>oe?.({...te,[e]:l}),_l=/* @__PURE__ */R("div",{className:"flex flex-wrap items-center gap-2",children:[ie&&/* @__PURE__ */W("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */W(w,{size:"sm",type:"search",leftIcon:J.search,placeholder:_e?Le.searchProducts:Le.search,"aria-label":_e?Le.searchProducts:Le.search,value:re??"",onChange:e=>ie(e.target.value)})}),oe&&Zl(Le.mediaType,te.type,[{value:"all",label:Le.allTypes},{value:"image",label:Le.images},{value:"video",label:Le.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],ql("type"),130),oe&&!_e&&!el&&Zl(Le.use,te.use,[{value:"any",label:Le.anyUse},{value:"email",label:Le.emailOnly},{value:"website",label:Le.websiteOnly},{value:"unused",label:Le.notUsed}],ql("use"),130),oe&&Be&&Zl(Le.sort,te.sort,[{value:"newest",label:Le.newest},{value:"name",label:Le.byName},{value:"size",label:Le.bySize}],ql("sort"),110),de?.map(e=>Zl(e.label,e.value,e.options,e.onChange,120)),ce&&/* @__PURE__ */W(N,{size:"sm",label:Le.view,value:se,onChange:ce,options:[{value:"grid",label:Le.grid,icon:J.grid},{value:"list",label:Le.list,icon:J.list}]})]}),en=e=>{const l=[];return null!=e.trashedDaysAgo&&l.push({key:"t",label:Le.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:H.clock,tone:"neutral"}),e.usedCount&&l.push({key:"u",label:Le.used(e.usedCount),count:e.usedCount,icon:H.link,tone:"active"}),e.email&&l.push({key:"e",label:Le.email,icon:H.email,tone:"queued"}),e.private&&l.push({key:"p",label:Le.private,icon:H.lock,tone:"neutral"}),l},ln=e=>en(e).map(e=>/* @__PURE__ */W(j,{tone:e.tone,size:"xs",children:e.label},e.key)),nn=Be&&ll&&!!xe&&!pe.move,an=ae.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:en(e),dragData:nn?JSON.stringify(ol.isSelected(e.id)?dl:[e.id]):void 0})),rn=Ue?Math.max(72,Math.floor((Re-24-16-1)/3)):112,tn=L(null),on=u({containerRef:tn,enabled:Be&&!Ue&&ae.length>0,selected:ol.selected,setSelection:e=>ol.setSelection(e),clearSelection:ol.clear}),dn=e=>{if(Me){const l=tl.get(e);return void(!l||l.private||l.pickDisabledReason||Fe?.(l))}const l=il.indexOf(e);l>=0&&xl(l)},sn=ae.length?null:re?/* @__PURE__ */W(o,{variant:"dashed",title:Le.noMatches}):_e?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyProducts,description:rl(al)}):el?/* @__PURE__ */W(o,{variant:"dashed",title:Le.trashEmpty}):!Jl||Me?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyFolder}):null,cn="list"===se&&ae.length>0,mn=sn??(cn?/* @__PURE__ */W("ul",{role:"listbox","aria-multiselectable":Be||void 0,"aria-label":Le.folders,className:"flex flex-col gap-1",children:ae.map(e=>/* @__PURE__ */R("li",{role:"option","aria-selected":ol.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:l=>pl(e.id,l),onDoubleClick:()=>dn(e.id),onContextMenu:l=>Dl(e.id,l),onKeyDown:l=>{"Enter"!==l.key&&" "!==l.key||(l.preventDefault(),pl(e.id,l))},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)] "+(ol.isSelected(e.id)?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
|
|
9
|
+
/* @__PURE__ */W("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
|
|
10
|
+
/* @__PURE__ */W("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
|
|
11
|
+
/* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:ln(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-gray-500",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(k,{items:an,readOnly:!Jl||Me,onFiles:Jl&&!Me?e=>ke(e,nl):void 0,accept:fe,maxSizeBytes:ge,busy:ve,progress:ye,fit:"contain",thumbSize:rn,dragType:nn?G:void 0,selected:ol.selected,onItemClick:pl,onItemDoubleClick:dn,onItemContextMenu:Be?Dl:void 0,menuOnMedia:Be})),un=f({count:dl.length,kind:bl(dl),targets:kl({kind:"files",ids:dl}),onPick:e=>xe?.({kind:"files",ids:dl},e.key===h?null:e.key)}),hn=T({variant:"secondary",size:"sm"}),pn=/* @__PURE__ */W(g,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */R(U,{children:[J.folder,Le.moveTo]}),items:un,disabled:!!pe.move}),fn=Be&&dl.length>1&&!_e?/* @__PURE__ */R("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-gray-200 px-3 py-2",children:[
|
|
12
|
+
/* @__PURE__ */W(I,{checked:dl.length===ae.length,indeterminate:dl.length<ae.length,onChange:e=>e?ol.selectAll():ol.clear(),label:Le.selected(dl.length)}),/* @__PURE__ */R(U,el?{children:[Ie&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.undo,onClick:()=>Ie(dl),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"secondary-danger",size:"sm",onClick:()=>De(dl),...$l(pe.deleteForever),children:Le.deleteForever})]}:{children:[xe&&pn,we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.edit,disabled:!0,children:Le.rename}),Ce&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.trash,onClick:()=>Ce({kind:"files",ids:dl}),...$l(pe.trash),children:Le.moveFilesToTrash(dl.length)})]}),
|
|
13
|
+
/* @__PURE__ */W(z,{variant:"ghost",size:"sm",onClick:ol.clear,children:Le.clearSelection})]}):null,gn=e=>{const l=[],n=(e,n,a)=>{null!=a&&""!==a&&l.push({key:e,label:n,value:a})},a="file"===fl?.kind&&fl.id===e.id;n("name",Le.name,a?/* @__PURE__ */W(X,{value:e.name,label:Le.fileName,onDone:vl}):e.name),n("type",Le.type,e.typeLabel),n("size",Le.size,e.sizeLabel),n("resolution",Le.resolution,e.resolution),_e?(n("design",Le.design,e.design),n("finish",Le.finish,e.finish),n("angle",Le.angleLug,e.angleLug),n("owner",Le.owner,e.owner)):(n("added",Le.addedBy,e.addedBy),n("folder",Le.folder,e.folderPath)),n("used",Le.usedIn,null!=e.usedCount?Le.places(e.usedCount):void 0);const r=p({kind:"files",ids:[e.id]},Cl).find(e=>"submenu"===e.type);/* @__PURE__ */
|
|
14
|
+
return R("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
|
|
15
|
+
/* @__PURE__ */W("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),_e&&/* @__PURE__ */W(D,{tone:"neutral",title:Le.readOnlyBadge,children:rl(al)}),
|
|
16
|
+
/* @__PURE__ */W(i,{size:"sm",columns:1,items:l}),!el&&/* @__PURE__ */R("div",{className:"flex gap-2",children:[
|
|
17
|
+
/* @__PURE__ */W("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */W(w,{size:"sm",readOnly:!0,value:e.url,"aria-label":Le.fileUrl,onFocus:e=>e.currentTarget.select()})}),
|
|
18
|
+
/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.copy,onClick:()=>Cl.copyUrl(e.id),children:Le.copyUrl})]}),ll&&Be&&/* @__PURE__ */R("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.swap,onClick:()=>je(e.id),...$l(pe.replace),children:Le.replace}),ze&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.crop,onClick:()=>ze(e.id),children:Le.cropEdit}),xe&&"submenu"===r?.type&&/* @__PURE__ */W(g,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */R(U,{children:[J.folder,Le.moveTo]}),items:r.items,disabled:!!pe.move}),we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.edit,onClick:()=>gl({kind:"file",id:e.id}),...$l(pe.rename),children:Le.rename}),Ce&&/* @__PURE__ */W(S,{"aria-label":Le.moveToTrash,size:"sm",onClick:()=>Ce({kind:"files",ids:[e.id]}),disabledReason:pe.trash,"aria-disabled":!!pe.trash||void 0,children:J.trash})]}),el&&Be&&/* @__PURE__ */R("div",{className:"flex flex-wrap gap-2",children:[Ie&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:J.undo,onClick:()=>Ie([e.id]),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:()=>De([e.id]),...$l(pe.deleteForever),children:Le.deleteForever})]}),_e&&Te&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:J.external,onClick:()=>Te({kind:"render",id:e.id}),children:Le.openInDesign}),he&&/* @__PURE__ */W(b,{items:he})]})},vn=sl?sl.private?Le.privateNoPick:sl.pickDisabledReason:void 0,yn=Me?/* @__PURE__ */R("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-gray-200 px-3 py-2",children:[
|
|
19
|
+
/* @__PURE__ */W("span",{className:"min-w-0 truncate text-sm text-gray-500",children:sl?Le.oneChosen(sl.name):Le.noneChosen}),
|
|
20
|
+
/* @__PURE__ */R("div",{className:"flex gap-2",children:[Oe&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",onClick:Oe,children:Le.cancel}),
|
|
21
|
+
/* @__PURE__ */W(z,{variant:"primary",size:"sm",disabled:!sl,...$l(vn),onClick:()=>{sl&&!vn&&Fe?.(sl)},children:Le.chooseImage})]})]}):null,kn=Be&&!!sl,bn=/* @__PURE__ */R("div",{className:"flex min-w-0 flex-col gap-3",children:[Ee&&/* @__PURE__ */W(D,{tone:"neutral",children:Ee}),
|
|
22
|
+
/* @__PURE__ */R("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
|
|
23
|
+
/* @__PURE__ */W(d,{items:Vl}),Ql]}),_l,fn,
|
|
24
|
+
/* @__PURE__ */R("div",{ref:tn,className:"relative",onPointerDown:on.onPointerDown,onKeyDown:e=>{Be&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),ol.selectAll()):"Escape"===e.key&&ol.size&&ol.clear()},children:[mn,
|
|
25
|
+
/* @__PURE__ */W(a,{rect:on.rect})]}),Jl&&/* @__PURE__ */W("input",{...Hl.inputProps}),
|
|
26
|
+
/* @__PURE__ */W(C,{rejections:Hl.rejections})]});/* @__PURE__ */
|
|
27
|
+
return R("div",{ref:Ke,"data-media-library":"","data-layout":Ue?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Pe}`.trim(),children:[/* @__PURE__ */R("div",Ue?{className:"flex flex-col gap-3 p-3",children:[Gl,bn]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
|
|
28
|
+
/* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-r border-gray-200 p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Gl}),
|
|
29
|
+
/* @__PURE__ */W("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:bn}),kn&&/* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-l border-gray-200 p-3",style:{width:300},children:gn(sl)})]}),yn,Ue&&/* @__PURE__ */W(t,{open:kn,onClose:ol.clear,side:"bottom",title:sl?.name,children:sl&&gn(sl)}),Il.state&&/* @__PURE__ */W(c,{...Il.props,items:Nl(Il.state.data)}),null!=wl&&ae.length>0&&/* @__PURE__ */W(r,{images:ae.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(wl,ae.length-1),onClose:()=>xl(null)})]})}export{G as MEDIA_FILES_DRAG_TYPE,V as MEDIA_FOLDER_DRAG_TYPE,$ as MediaLibrary};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{SidebarLayout as e}from"./chunk-
|
|
1
|
+
import{SidebarLayout as e}from"./chunk-TFMOGKW2.js";import{Avatar as t}from"./chunk-MMFJBWJC.js";import{Input_default as a}from"./chunk-UNEJ2ABD.js";import{Button_default as i}from"./chunk-4IU5BSVE.js";import{useState as s}from"react";import{jsx as l,jsxs as n}from"react/jsx-runtime";var r=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],m=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
|
|
2
2
|
return l("div",{className:"h-full",children:/* @__PURE__ */l(e,{side:"left",defaultWidth:260,sidebar:/* @__PURE__ */l("div",{className:"h-full overflow-auto",children:r.map(e=>/* @__PURE__ */n("button",{onClick:()=>o(e.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 "+(e.id===d?"bg-blue-50/50":""),children:[
|
|
3
3
|
/* @__PURE__ */l(t,{name:e.name,status:e.status}),
|
|
4
4
|
/* @__PURE__ */n("div",{className:"min-w-0 flex-1",children:[
|