@sheetxl/studio-mui 0.8.0-beta.6 → 0.8.0-beta.7
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/browser/cjs/{Bi26L7L89ZK_y5Pk.cjs → 2tG9HJLr-WjsOCP3.cjs} +1 -1
- package/browser/cjs/4_Zy3pR6YXkzISoK.cjs +1 -0
- package/browser/cjs/BcBrhEv9acaTxPkO.cjs +13 -0
- package/browser/cjs/{BlNKpwiG-Q7eIi5t.cjs → Clzu4HOXk3QSlzUD.cjs} +3 -3
- package/browser/cjs/{BQMCM3iFn4MNWAkB.cjs → HuPFsmz7kyZVo3c7.cjs} +1 -1
- package/browser/cjs/index.cjs +1 -1
- package/browser/esm/{CKemMJZNIPnJ0dUE.mjs → 0Rpk1T56LoSnDrmq.mjs} +2 -2
- package/browser/esm/{C5swGBbBLdDzg_bm.mjs → 3L04oqyfyjRxhmzg.mjs} +2 -2
- package/browser/esm/{CyQk62MFBCep2ZZs.mjs → 7gisHVXYgcPxWH8-.mjs} +2 -2
- package/browser/esm/{BofZe0q9bsHQr0Xd.mjs → B57WM1X24rsvTF_o.mjs} +1 -1
- package/browser/esm/{BybBaLxSKyGAsxqO.mjs → B7k8enrhC2Rvqhn1.mjs} +3 -3
- package/browser/esm/{BPzT8gL3SgD0CG7V.mjs → BK4OEmeaw-kC-vAN.mjs} +1302 -1302
- package/browser/esm/{2_WF-hy6x4dXfEzW.mjs → BWAIbfQZ6h5xVLdB.mjs} +1 -1
- package/browser/esm/{aGoWX29-zbUaPh2U.mjs → B_PhUn6yySwXt2wo.mjs} +2 -2
- package/browser/esm/{D-JQOjmAh6Gk6wVM.mjs → C36WT3I3aIR8y7I6.mjs} +2 -2
- package/browser/esm/{BlWsO6M15Ii13NrV.mjs → CH7ZfljN7ru0Y9Wg.mjs} +2 -2
- package/browser/esm/{CsNOEAKuHLfckItX.mjs → CpTqhDZotYaKGbLl.mjs} +1 -1
- package/browser/esm/{D3b3dWTjvFd1Kj5g.mjs → D3BwGfI_IEjay0dA.mjs} +1 -1
- package/browser/esm/{BFxtcKJBbfjtMft-.mjs → D7HOLngE_1FYF6y6.mjs} +3 -3
- package/browser/esm/{D8FEKUKVxH32duMx.mjs → D88iVsgfDG9k-qf_.mjs} +3 -3
- package/browser/esm/{61ip_C1X9ls4svw6.mjs → DErAKw-lIK3RY8m-.mjs} +1 -1
- package/browser/esm/{Dzym1WSjYb_mnVkJ.mjs → DNhLiDpvz3lAR190.mjs} +2 -2
- package/browser/esm/{JYRkZ4iKzbWnNhEs.mjs → DR95Rgl8ItgWla8V.mjs} +2 -2
- package/browser/esm/{p62JxLmjmWD2MQq1.mjs → DvYZOxsaTNeBKuFq.mjs} +98 -97
- package/browser/esm/{27jPjqdDLWn5qbQ8.mjs → DyNZEBlugP-x15kP.mjs} +3 -3
- package/browser/esm/{BGdZT1Ka4ohDCZpW.mjs → DzWcb3yuPXS0E4_P.mjs} +3 -3
- package/browser/esm/{DTLKzrZGPkkNlncN.mjs → WftYXVWvPKx99H0H.mjs} +2 -2
- package/browser/esm/{DRUKu2I27bidfyvH.mjs → eoNyVUe5ZEpHwJ7k.mjs} +1 -1
- package/browser/esm/{FK7vqizwRujDsqL2.mjs → hFLn30a6N1fEy7fz.mjs} +2159 -1562
- package/browser/esm/index.mjs +56 -56
- package/browser/esm/{6EK3JgWrKYfqzAfV.mjs → jkFhDHWwKoyTSSDL.mjs} +1 -1
- package/licenses/dependencies.txt +79 -79
- package/node/esm/{CE6ZU2MVb3_-FzIk.mjs → BTI9exTFHEYzVjw9.mjs} +1 -1
- package/node/esm/{DDVJs9oOFXR3RfSi.mjs → BbXHuDHRHOW_6Sbs.mjs} +1 -1
- package/node/esm/{CtoRlEz1GwA88zTu.mjs → BlD3bHo8AAxK7O1j.mjs} +1 -1
- package/node/esm/{uIRinWE0OCKJvsGN.mjs → CbpkRpNbQYYOJbxH.mjs} +3 -3
- package/node/esm/{K6LEXUZkuqoEn5yJ.mjs → Ccrq9TNkiiSHKw-m.mjs} +1 -1
- package/node/esm/{qu70N1tsIwi7LmT6.mjs → CpteKzMPi39jxmYL.mjs} +1 -1
- package/node/esm/{D3xcuMwJvLJhlPNV.mjs → Cul_Vgip2OE8yFBQ.mjs} +1 -1
- package/node/esm/{CksPMsHwUSCpFnpS.mjs → DA2gosTk8L-FUVI5.mjs} +1058 -1058
- package/node/esm/{3J2-TRYWEsvnTDnO.mjs → DP23-d6_VRFro0_D.mjs} +103 -102
- package/node/esm/{CKOhL08sVy1N_Uza.mjs → DQtpY5kX99aMHygs.mjs} +1 -1
- package/node/esm/{Dc4t_AYLdTAnPOIT.mjs → DifZAchLTKOmWpkv.mjs} +1 -1
- package/node/esm/{JUUre9pYia7feetw.mjs → Dvvg1Yo2e7OGd8sv.mjs} +1 -1
- package/node/esm/{B2QOYsl1YmcwknsP.mjs → YKY4d8_Ckc8nPQqI.mjs} +1 -1
- package/node/esm/index.mjs +3123 -2526
- package/node/esm/{CzERDnu2VbNTjJgI.mjs → lH1iFsECniBRMubb.mjs} +2 -2
- package/node/esm/{ObY_iULY2ezBYD3q.mjs → v0BFuYjhq2G8zDRe.mjs} +1 -1
- package/package.json +9 -9
- package/resources/locales/de/ui.msg.json +19 -0
- package/resources/locales/en/ui.msg.json +19 -0
- package/types/src/comments/CommentCard.d.ts +41 -0
- package/types/src/comments/CommentsPlugin.d.ts +6 -0
- package/types/src/comments/CommentsTaskPane.d.ts +23 -0
- package/types/src/comments/index.d.ts +4 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/studio/useStudioApp.d.ts +2 -2
- package/types/src/template/useTemplateCatalog.d.ts +5 -5
- package/types/src/workbook/DefaultRenderers.d.ts +3 -1
- package/types/src/workbook/WorkbookElement.d.ts +1 -1
- package/browser/cjs/iFPhqab5w95hHEsT.cjs +0 -1
- package/browser/cjs/xCAd86Y_REa3Xs1o.cjs +0 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.7
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { a as e, i as t, n as l, r as a } from "./
|
|
7
|
+
import { a as e, i as t, n as l, r as a } from "./DP23-d6_VRFro0_D.mjs";
|
|
8
8
|
import { useTranslator as i } from "@sheetxl/utils-react";
|
|
9
9
|
import { useCallback as o, useMemo as n, useState as p } from "react";
|
|
10
10
|
import { InternalWindow as s } from "@sheetxl/utils-mui";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.7
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/studio-mui",
|
|
3
3
|
"description": "Studio - Spreadsheet UI built with SheetXL SDK using React & MUI.",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
4
|
+
"version": "0.8.0-beta.7",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
53
53
|
"@dnd-kit/sortable": "^10.0.0",
|
|
54
54
|
"@dnd-kit/utilities": "^3.2.2",
|
|
55
|
-
"@sheetxl/grid-react": "^0.8.0-beta.
|
|
56
|
-
"@sheetxl/io": "^0.8.0-beta.
|
|
57
|
-
"@sheetxl/react": "^0.8.0-beta.
|
|
58
|
-
"@sheetxl/scripting-react": "^0.8.0-beta.
|
|
59
|
-
"@sheetxl/sdk": "^0.8.0-beta.
|
|
60
|
-
"@sheetxl/utils": "^0.8.0-beta.
|
|
61
|
-
"@sheetxl/utils-mui": "^0.8.0-beta.
|
|
62
|
-
"@sheetxl/utils-react": "^0.8.0-beta.
|
|
55
|
+
"@sheetxl/grid-react": "^0.8.0-beta.7",
|
|
56
|
+
"@sheetxl/io": "^0.8.0-beta.7",
|
|
57
|
+
"@sheetxl/react": "^0.8.0-beta.7",
|
|
58
|
+
"@sheetxl/scripting-react": "^0.8.0-beta.7",
|
|
59
|
+
"@sheetxl/sdk": "^0.8.0-beta.7",
|
|
60
|
+
"@sheetxl/utils": "^0.8.0-beta.7",
|
|
61
|
+
"@sheetxl/utils-mui": "^0.8.0-beta.7",
|
|
62
|
+
"@sheetxl/utils-react": "^0.8.0-beta.7",
|
|
63
63
|
"clsx": "^2.1.1",
|
|
64
64
|
"csstype": "^3.2.3",
|
|
65
65
|
"file-saver": "^2.0.5",
|
|
@@ -73,6 +73,25 @@
|
|
|
73
73
|
"command.saveAsFormat.compact": "als {format}",
|
|
74
74
|
"command.saveAsFormat.label": "Als {format} speichern",
|
|
75
75
|
"command.saveAsFormat.workbook": "Als {format} speichern",
|
|
76
|
+
"comment.cancel": "Abbrechen",
|
|
77
|
+
"comment.delete": "Löschen",
|
|
78
|
+
"comment.edit": "Bearbeiten",
|
|
79
|
+
"comment.filter.all": "Alle",
|
|
80
|
+
"comment.filter.open": "Offen",
|
|
81
|
+
"comment.filter.resolved": "Erledigt",
|
|
82
|
+
"comment.more": "Weitere Aktionen",
|
|
83
|
+
"comment.new": "Neuer Kommentar",
|
|
84
|
+
"comment.noMatches": "Keine passenden Kommentare.",
|
|
85
|
+
"comment.none": "Auf diesem Blatt gibt es keine Kommentare.",
|
|
86
|
+
"comment.placeholder": "Unterhaltung beginnen",
|
|
87
|
+
"comment.post": "Posten",
|
|
88
|
+
"comment.reopen": "Erneut öffnen",
|
|
89
|
+
"comment.reply": "Antworten",
|
|
90
|
+
"comment.resolve": "Unterhaltung als erledigt markieren",
|
|
91
|
+
"comment.resolved": "Erledigt",
|
|
92
|
+
"comment.save": "Speichern",
|
|
93
|
+
"comment.title": "Kommentare",
|
|
94
|
+
"comment.unknownAuthor": "Unbekannt",
|
|
76
95
|
"condition.above": "Über",
|
|
77
96
|
"condition.and": "und",
|
|
78
97
|
"condition.below": "Unter",
|
|
@@ -73,6 +73,25 @@
|
|
|
73
73
|
"command.saveAsFormat.compact": "as {format}",
|
|
74
74
|
"command.saveAsFormat.label": "Save as {format}",
|
|
75
75
|
"command.saveAsFormat.workbook": "Save as {format}",
|
|
76
|
+
"comment.cancel": "Cancel",
|
|
77
|
+
"comment.delete": "Delete",
|
|
78
|
+
"comment.edit": "Edit",
|
|
79
|
+
"comment.filter.all": "All",
|
|
80
|
+
"comment.filter.open": "Open",
|
|
81
|
+
"comment.filter.resolved": "Resolved",
|
|
82
|
+
"comment.more": "More actions",
|
|
83
|
+
"comment.new": "New Comment",
|
|
84
|
+
"comment.noMatches": "No comments match.",
|
|
85
|
+
"comment.none": "There are no comments on this sheet.",
|
|
86
|
+
"comment.placeholder": "Start a conversation",
|
|
87
|
+
"comment.post": "Post",
|
|
88
|
+
"comment.reopen": "Reopen",
|
|
89
|
+
"comment.reply": "Reply",
|
|
90
|
+
"comment.resolve": "Resolve thread",
|
|
91
|
+
"comment.resolved": "Resolved",
|
|
92
|
+
"comment.save": "Save",
|
|
93
|
+
"comment.title": "Comments",
|
|
94
|
+
"comment.unknownAuthor": "Unknown",
|
|
76
95
|
"condition.above": "Above",
|
|
77
96
|
"condition.and": "and",
|
|
78
97
|
"condition.below": "Below",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CellCoords } from '@sheetxl/utils';
|
|
3
|
+
import { IComment, ISheet } from '@sheetxl/sdk';
|
|
4
|
+
export interface CommentCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
5
|
+
/** The sheet the card's cell is on. */
|
|
6
|
+
sheet: ISheet;
|
|
7
|
+
/** The cell the card belongs to. */
|
|
8
|
+
coords: CellCoords;
|
|
9
|
+
/** The thread, or `null` for a draft: nothing is written until it is posted. */
|
|
10
|
+
comment: IComment | null;
|
|
11
|
+
/**
|
|
12
|
+
* A new value each time the card's text should take the caret: the draft's field, or the reply
|
|
13
|
+
* box of a thread. `0` or omitted for never.
|
|
14
|
+
*/
|
|
15
|
+
focusRequest?: number;
|
|
16
|
+
/** Marks the card as the one for the selected cell. */
|
|
17
|
+
highlighted?: boolean;
|
|
18
|
+
/** Draws the card raised, for one that floats over the grid. */
|
|
19
|
+
elevated?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A click on the card's surface, anywhere that is not a control. Omit when there is nothing to
|
|
22
|
+
* select.
|
|
23
|
+
*/
|
|
24
|
+
onSelect?: () => void;
|
|
25
|
+
/** The draft was cancelled. */
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
/** The draft was posted, as this comment. */
|
|
28
|
+
onPosted?: (comment: IComment) => void;
|
|
29
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One threaded comment as a card: each entry's initials, author, time and text, the replies, a
|
|
33
|
+
* reply box, and a menu to edit, resolve or delete. With no comment it is a draft, a field that
|
|
34
|
+
* writes nothing until it is posted.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* The same card is listed in the comments task pane and floats beside a cell. Editing an entry's
|
|
38
|
+
* text drops its mentions, as `IComment.setContent` says.
|
|
39
|
+
*/
|
|
40
|
+
export declare const CommentCard: React.MemoExoticComponent<(props: CommentCardProps) => React.JSX.Element>;
|
|
41
|
+
//# sourceMappingURL=CommentCard.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
3
|
+
import { CommentsPaneArgs, TaskPaneProps } from '@sheetxl/react';
|
|
4
|
+
/** Which threads the pane lists. */
|
|
5
|
+
export type CommentsFilter = 'all' | 'open' | 'resolved';
|
|
6
|
+
/** Persistence key for the filter the pane was last left on. */
|
|
7
|
+
export declare const COMMENTS_FILTER_KEY = "comments.filter";
|
|
8
|
+
export interface CommentsTaskPaneProps extends TaskPaneProps<IWorkbook, CommentsPaneArgs> {
|
|
9
|
+
/** The filter the pane opens with when none has been chosen before. @defaultValue `'all'` */
|
|
10
|
+
defaultFilter?: CommentsFilter;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* **Comments** — every threaded comment on the active sheet, in cell order, each as a
|
|
14
|
+
* {@link CommentCard}.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Clicking a card selects its cell, and selecting a cell scrolls to its card and marks it. A new
|
|
18
|
+
* comment is a draft card on the selected cell that writes nothing until it is posted. Notes are
|
|
19
|
+
* not listed: a note is edited in its box on the sheet.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CommentsTaskPane: React.MemoExoticComponent<(props: CommentsTaskPaneProps) => React.JSX.Element | null>;
|
|
22
|
+
export default CommentsTaskPane;
|
|
23
|
+
//# sourceMappingURL=CommentsTaskPane.d.ts.map
|
package/types/src/index.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ export interface StudioAppOptions extends WindowChromeOptions {
|
|
|
20
20
|
startWith?: 'welcome';
|
|
21
21
|
/**
|
|
22
22
|
* The template catalog the welcome and "Choose a template" dialogs show: a URL serving
|
|
23
|
-
* `workbook
|
|
24
|
-
* @defaultValue the latest published `@sheetxl/workbook
|
|
23
|
+
* `templates-workbook/contents.json`. Use it to pin a version or to serve your own templates.
|
|
24
|
+
* @defaultValue the latest published `@sheetxl/templates-workbook`
|
|
25
25
|
*/
|
|
26
26
|
templatePath?: string;
|
|
27
27
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ResourceIndex } from '@sheetxl/utils';
|
|
2
2
|
/**
|
|
3
|
-
* Where the template catalog is read from when no `templatePath` is given: the
|
|
4
|
-
* `@sheetxl/workbook
|
|
3
|
+
* Where the template catalog is read from when no `templatePath` is given: the published
|
|
4
|
+
* `@sheetxl/templates-workbook` for this build's release channel.
|
|
5
5
|
*/
|
|
6
|
-
export declare const DEFAULT_TEMPLATE_PATH
|
|
6
|
+
export declare const DEFAULT_TEMPLATE_PATH: string;
|
|
7
7
|
/** A group of templates. Each category is a folder in the catalog. */
|
|
8
8
|
export interface TemplateCategory {
|
|
9
9
|
/** The folder name. Entries refer to their category by this id. */
|
|
@@ -42,8 +42,8 @@ export interface TemplateCatalog {
|
|
|
42
42
|
}
|
|
43
43
|
export interface TemplateCatalogOptions {
|
|
44
44
|
/**
|
|
45
|
-
* The catalog to read: a URL that serves `workbook
|
|
46
|
-
* version (`https://unpkg.com/@sheetxl/workbook
|
|
45
|
+
* The catalog to read: a URL that serves `templates-workbook/contents.json`. Use it to pin a
|
|
46
|
+
* version (`https://unpkg.com/@sheetxl/templates-workbook@1.4.0/dist`) or to serve your own.
|
|
47
47
|
* @defaultValue {@link DEFAULT_TEMPLATE_PATH}
|
|
48
48
|
*/
|
|
49
49
|
path?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { SheetElementProps, SheetTabProps } from '@sheetxl/react';
|
|
2
|
+
import { SheetElementProps, SheetTabProps, CommentCardRenderProps } from '@sheetxl/react';
|
|
3
3
|
import { AnimatedLoadingPanelProps, StackTraceErrorPanelProps } from '@sheetxl/utils-mui';
|
|
4
4
|
import { FormulaBarProps } from '../formulaBar';
|
|
5
5
|
import { ColumnMenuProps } from '../filter';
|
|
@@ -9,6 +9,8 @@ import { SheetsAllMenuProps, SheetTabMenuProps } from '../sheet';
|
|
|
9
9
|
import { WorkbookStripProps } from './WorkbookStrip';
|
|
10
10
|
import { WorkbookContextMenuProps } from './WorkbookContextMenu';
|
|
11
11
|
import { FillMenuProps } from './FillMenu';
|
|
12
|
+
/** The card of a threaded comment as it floats beside its cell. */
|
|
13
|
+
export declare const renderCommentCard: (props: CommentCardRenderProps) => React.ReactElement;
|
|
12
14
|
export declare const renderMovableContextMenu: (props: MovableContextMenuProps) => React.ReactElement;
|
|
13
15
|
export declare const renderFillMenu: (props: FillMenuProps) => React.ReactElement;
|
|
14
16
|
export declare const renderWorkbookContextMenu: (props: WorkbookContextMenuProps) => React.ReactElement;
|
|
@@ -3,7 +3,7 @@ import { WorkbookElementProps, IWorkbookElement } from '@sheetxl/react';
|
|
|
3
3
|
* The MUI workbook element.
|
|
4
4
|
*
|
|
5
5
|
* A thin wrapper around the chromeless `WorkbookElement` from `@sheetxl/react`: it supplies the grid's
|
|
6
|
-
* own MUI popups (tabs, context/column/movable menus, loading) via the render seams. Theming flows
|
|
6
|
+
* own MUI popups (tabs, context/column/movable menus, comment cards, loading) via the render seams. Theming flows
|
|
7
7
|
* through the injected `--sxl-*` token matrix (from the studio root) — no theme bridge is needed here;
|
|
8
8
|
* the grid self-sources its light/dark scheme from the shared appearance preference. The surrounding
|
|
9
9
|
* chrome (toolbar, formula bar, status bar) is composed by the Studio layer, not here.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./Bo9Kx3L_XQkGPBJ5.cjs"),t=require("./CPcBvw4ZPwHVTUZF.cjs");let n=require("@sheetxl/react"),r=require("@sheetxl/utils-react"),i=require("react");i=e.n(i,1);let a=require("@sheetxl/utils-mui"),o=require("react/jsx-runtime"),s=require("@mui/material"),c=require("@sheetxl/utils");var l=`8 / 5`,u=e=>{let{entry:t}=e,r=((0,n.useGridColorScheme)()===`dark`?t.thumbnailDarkUrl:void 0)??t.thumbnailUrl;return(0,o.jsx)(d,{src:r},r)},d=e=>{let{src:t}=e,[n,a]=(0,i.useState)(t?`loading`:`failed`);return(0,o.jsx)(s.Box,{className:`template-thumbnail`,sx:{position:`relative`,width:`100%`,aspectRatio:l,overflow:`hidden`,borderRadius:1,border:e=>`1px solid ${e.palette.divider}`,background:e=>e.palette.background.paper,transition:`border-color 150ms, box-shadow 150ms`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:n===`failed`?(0,o.jsx)(r.DynamicIcon,{iconKey:`FileNew`,style:{fontSize:`2.5rem`,opacity:.4}}):(0,o.jsx)(`img`,{src:t,alt:``,loading:`lazy`,draggable:!1,onLoad:()=>a(`loaded`),onError:()=>a(`failed`),style:{width:`100%`,height:`100%`,objectFit:`cover`,objectPosition:`top left`,opacity:+(n===`loaded`),transition:`opacity 150ms ease-out`}})})},f=e=>{let{entry:t,category:n,onSelect:r}=e;return(0,o.jsxs)(s.ButtonBase,{className:`template-tile`,disableRipple:!0,onClick:r,"aria-label":n?`${t.title}, ${n.title}`:t.title,title:t.description,sx:{display:`flex`,flexDirection:`column`,alignItems:`stretch`,textAlign:`left`,gap:.75,padding:1,borderRadius:1,"&:hover .template-thumbnail, &.Mui-focusVisible .template-thumbnail":{borderColor:e=>e.palette.primary.main,boxShadow:3},"&.Mui-focusVisible":{outline:e=>`2px solid ${e.palette.primary.main}`,outlineOffset:`-2px`}},children:[(0,o.jsx)(u,{entry:t}),(0,o.jsxs)(s.Box,{sx:{minWidth:0},children:[(0,o.jsx)(s.Typography,{variant:`subtitle2`,component:`div`,noWrap:!0,children:t.title}),n?(0,o.jsx)(s.Typography,{variant:`caption`,component:`div`,noWrap:!0,sx:{color:`text.secondary`},children:n.title}):null]})]})},p=()=>(0,o.jsxs)(s.Box,{sx:{padding:1,display:`flex`,flexDirection:`column`,gap:.75},children:[(0,o.jsx)(s.Skeleton,{variant:`rectangular`,sx:{width:`100%`,height:`auto`,aspectRatio:l,borderRadius:1}}),(0,o.jsx)(s.Skeleton,{variant:`text`,width:`60%`}),(0,o.jsx)(s.Skeleton,{variant:`text`,width:`35%`})]}),m=(0,i.memo)((0,i.forwardRef)((e,n)=>{let{catalog:a,onSelect:c,filter:l,groupBy:u,renderTile:d,tileMinWidth:m=180,emptyLabel:h,visibleRows:g,sx:_=r.ReactUtils.EmptyCssProperties,style:v,className:y,onKeyDown:b,...x}=e,S=(0,r.useTranslator)(),C=(0,i.useRef)(null),[w,T]=(0,i.useState)(0),E=(0,i.useRef)(null);E.current=()=>{let e=C.current?.querySelector(`.template-grid`)?.firstElementChild,t=(e?.offsetHeight?e:e?.firstElementChild)?.getBoundingClientRect().height;t&&T(t)},(0,i.useLayoutEffect)(()=>{g&&E.current?.()}),(0,i.useEffect)(()=>{let e=C.current;if(!g||!e)return;let t=new ResizeObserver(()=>E.current?.());return t.observe(e),()=>t.disconnect()},[g]);let D=(0,i.useMemo)(()=>new Map(a.categories.map(e=>[e.id,e])),[a.categories]),O=(0,i.useMemo)(()=>{let e=l?a.entries.filter(l):a.entries;if(!u)return[{key:null,entries:e}];let t=new Map;for(let e of a.categories)t.set(e.id,[]);for(let n of e){let e=u(n),r=t.get(e);r||t.set(e,r=[]),r.push(n)}return[...t].filter(([,e])=>e.length>0).map(([e,t])=>({key:e,title:D.get(e)?.title??e,entries:t}))},[a.entries,a.categories,D,l,u]),k={display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(${m}px, 1fr))`,gap:`8px`},A;return A=a.status===`loading`?(0,o.jsx)(s.Box,{className:`template-grid`,sx:k,"aria-busy":`true`,"aria-label":S(`template.loading`),children:Array.from({length:6},(e,t)=>(0,o.jsx)(p,{},t))}):a.status===`error`?(0,o.jsxs)(s.Box,{sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1,padding:4,textAlign:`center`},children:[(0,o.jsx)(s.Typography,{variant:`body2`,sx:{color:`text.secondary`},children:S(`template.loadFailed`)}),(0,o.jsx)(s.Button,{variant:`outlined`,size:`small`,onClick:a.retry,children:S(`template.retry`)})]}):O.every(e=>e.entries.length===0)?(0,o.jsx)(s.Typography,{variant:`body2`,sx:{color:`text.secondary`,padding:4,textAlign:`center`},children:h??S(`template.empty`)}):O.map(e=>(0,o.jsxs)(s.Box,{role:`group`,"aria-label":e.title,children:[e.title?(0,o.jsx)(s.Typography,{variant:`overline`,component:`div`,sx:{color:`text.secondary`,paddingX:1},children:e.title}):null,(0,o.jsx)(s.Box,{className:`template-grid`,sx:k,children:e.entries.map(e=>{let t={category:D.get(e.category),onSelect:()=>c?.(e)};return d?(0,o.jsx)(s.Box,{sx:{display:`contents`},children:d(e,t)},e.id):(0,o.jsx)(f,{entry:e,...t},e.id)})})]},e.key??``)),(0,o.jsx)(s.Box,{ref:n,className:t.t(y,`template-panel`),sx:_,style:g&&w?{boxSizing:`content-box`,scrollbarGutter:`stable`,height:`${Math.ceil(g*w+8*(g-1))}px`,minHeight:`${Math.ceil(w)}px`,...v}:v,...x,children:(0,o.jsx)(s.Box,{ref:C,onKeyDown:e=>{if(b?.(e),e.defaultPrevented)return;let t=C.current;if(!t)return;let n=Array.from(t.querySelectorAll(`.template-tile`)),r=n.indexOf(document.activeElement);if(r<0)return;let i=n[r].offsetTop,a=n.findIndex(e=>e.offsetTop===i&&e.parentElement===n[r].parentElement),o=0;for(;n[a+o]?.offsetTop===i;)o++;let s=r;switch(e.key){case`ArrowRight`:s=r+1;break;case`ArrowLeft`:s=r-1;break;case`ArrowDown`:s=r+Math.max(1,o);break;case`ArrowUp`:s=r-Math.max(1,o);break;case`Home`:s=0;break;case`End`:s=n.length-1;break;default:return}s=Math.max(0,Math.min(n.length-1,s)),e.preventDefault(),n[s].focus()},children:A})})}));m.displayName=`TemplatePanel`;var h=(e,t,n)=>{let r=t.trim().toLowerCase();return!r||[e.title,e.description,n?.title,...e.tags??[]].some(e=>e?.toLowerCase().includes(r))},g=e=>{let{value:t,onChange:n,sx:i}=e,c=(0,r.useTranslator)();return(0,o.jsx)(s.TextField,{size:`small`,value:t,placeholder:c(`template.search`),onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&t&&(e.stopPropagation(),n(``))},sx:i,slotProps:{input:{sx:{backgroundColor:`background.paper`},startAdornment:(0,o.jsx)(s.InputAdornment,{position:`start`,children:(0,o.jsx)(r.DynamicIcon,{iconKey:`Find`})}),endAdornment:t?(0,o.jsx)(s.InputAdornment,{position:`end`,children:(0,o.jsx)(a.ExhibitIconButton,{"aria-label":c(`template.clearSearch`),propsTooltip:{label:c(`template.clearSearch`)},onMouseDown:e=>{e.button===0&&e.preventDefault()},onClick:()=>n(``),icon:(0,o.jsx)(r.DynamicIcon,{iconKey:`Close`}),size:`small`})}):void 0},htmlInput:{spellCheck:!1,autoComplete:`off`,"aria-label":c(`template.search`)}}})},_=`https://unpkg.com/@sheetxl/workbook-templates/dist`,v=`workbook-templates`,y=e=>e.replace(/\.[^/.]+$/,``).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase()),b=(e,t)=>{let n=`${e}${e.endsWith(`/`)?``:`/`}${v}/${t}`;return typeof document>`u`?n:new URL(n,document.baseURI).href},x=e=>typeof e==`string`&&e?e:void 0,S=new Map,C=(e=_)=>{let t=S.get(e);return t||(t=(async()=>{let t=(await(0,c.listResources)(`templates`,v,e)).find(e=>e.meta?.schema!==void 0);if(!t)throw Error(`No template catalog found at '${e}'.`);return Math.floor(Number(t.meta?.schema))===1?((e,t)=>{let n=Array.isArray(e.meta?.categories)?e.meta.categories:[],r=[],i=new Set;for(let e of n){let t=x(e?.id);t&&!i.has(t)&&(i.add(t),r.push({id:t,title:x(e.title)??y(t),description:x(e.description),icon:x(e.icon)}))}let a=[];for(let n of e.entries){let e=n.path,o=e.split(`/`);if(o.length!==2||!/\.(?:xlsx|sxl|csv)$/i.test(e))continue;let s=x(n.category)??o[0];i.has(s)||(i.add(s),r.push({id:s,title:y(s)}));let c=x(n.thumbnail),l=x(n.thumbnailDark);a.push({id:e,title:x(n.title)??y(o[1]),category:s,description:x(n.description),tags:Array.isArray(n.tags)?n.tags.filter(e=>typeof e==`string`):void 0,thumbnailUrl:c?b(t,c):void 0,thumbnailDarkUrl:l?b(t,l):void 0,sourceUrl:b(t,e)})}return{categories:r,entries:a}})(t,e):(console.warn(`Template catalog at '${e}' has schema ${t.meta?.schema}; expected 1.`),{categories:[],entries:[]})})(),S.set(e,t),t.catch(()=>{S.delete(e)})),t},w=(e={})=>{let{path:t=_}=e,[n,r]=(0,i.useState)(0),[a,o]=(0,i.useState)({status:`loading`,categories:[],entries:[]});return(0,i.useEffect)(()=>{let e=!1;return o(e=>e.status===`loading`?e:{status:`loading`,categories:[],entries:[]}),C(t).then(t=>{e||o({status:`ready`,...t})},t=>{e||o({status:`error`,categories:[],entries:[],error:t})}),()=>{e=!0}},[t,n]),{...a,retry:(0,i.useCallback)(()=>{r(e=>e+1)},[])}};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return C}});
|