pivotkit-react 0.0.0-stage → 0.1.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +300 -0
  2. package/LICENSE +21 -0
  3. package/README.md +327 -2
  4. package/dist/chunks/chunk-C32TYSHG.js +441 -0
  5. package/dist/chunks/chunk-ILHFIV2P.js +784 -0
  6. package/dist/chunks/chunk-KKJO36W5.js +1833 -0
  7. package/dist/chunks/chunk-XYP47DJ3.js +123 -0
  8. package/dist/echarts.js +262 -0
  9. package/dist/index.js +3390 -0
  10. package/dist/labels.js +12 -0
  11. package/dist/menus.js +1085 -0
  12. package/dist/styles.css +2447 -0
  13. package/package.json +70 -4
  14. package/types/PivotReport.d.ts +20 -0
  15. package/types/all-labels.d.ts +5 -0
  16. package/types/chart-decorate.d.ts +16 -0
  17. package/types/chart-options.d.ts +23 -0
  18. package/types/chart-summary.d.ts +12 -0
  19. package/types/chart-tooltip.d.ts +38 -0
  20. package/types/chart-types.d.ts +152 -0
  21. package/types/chart.d.ts +39 -0
  22. package/types/chip-menus.d.ts +32 -0
  23. package/types/clear-input.d.ts +20 -0
  24. package/types/dnd-moves.d.ts +45 -0
  25. package/types/dnd.d.ts +101 -0
  26. package/types/dom.d.ts +52 -0
  27. package/types/drill-export.d.ts +42 -0
  28. package/types/drill-panel.d.ts +39 -0
  29. package/types/drill.d.ts +62 -0
  30. package/types/echarts.d.ts +4 -0
  31. package/types/export-run.d.ts +59 -0
  32. package/types/field-info.d.ts +34 -0
  33. package/types/fields.d.ts +32 -0
  34. package/types/files.d.ts +27 -0
  35. package/types/filter.d.ts +21 -0
  36. package/types/icons.d.ts +76 -0
  37. package/types/index.d.ts +536 -0
  38. package/types/info.d.ts +34 -0
  39. package/types/iso.d.ts +2 -0
  40. package/types/labels.d.ts +721 -0
  41. package/types/lazy-menus.d.ts +16 -0
  42. package/types/menu-labels.d.ts +255 -0
  43. package/types/menus.d.ts +7 -0
  44. package/types/names.d.ts +80 -0
  45. package/types/numbers.d.ts +13 -0
  46. package/types/overflow.d.ts +59 -0
  47. package/types/place.d.ts +43 -0
  48. package/types/popover.d.ts +89 -0
  49. package/types/rove.d.ts +20 -0
  50. package/types/section.d.ts +42 -0
  51. package/types/share.d.ts +123 -0
  52. package/types/skeleton.d.ts +9 -0
  53. package/types/storage.d.ts +24 -0
  54. package/types/table.d.ts +23 -0
  55. package/types/templates.d.ts +40 -0
  56. package/types/theme.d.ts +24 -0
  57. package/types/tip-list.d.ts +20 -0
  58. package/types/tips.d.ts +298 -0
  59. package/types/toasts.d.ts +26 -0
  60. package/types/toolbar-panels.d.ts +90 -0
  61. package/types/toolbar.d.ts +5 -0
  62. package/types/use-big-result.d.ts +29 -0
  63. package/types/use-export.d.ts +7 -0
  64. package/types/use-theme.d.ts +11 -0
  65. package/types/use-view-history.d.ts +34 -0
  66. package/types/version.d.ts +2 -0
  67. package/types/view-history.d.ts +89 -0
  68. package/types/view-ops.d.ts +344 -0
  69. package/types/view-store.d.ts +52 -0
  70. package/types/virtual.d.ts +44 -0
  71. package/types/zones.d.ts +42 -0
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ /** The menus' panels, imported once; a failed import is forgotten, so the next call tries again. */
3
+ export declare function loadMenus(): Promise<typeof import("./menus.js")>;
4
+ /** The menus' module at once when it is loaded, else null. */
5
+ export declare const menusNow: () => typeof import("./menus.js") | null;
6
+ /**
7
+ * One panel of menus.js with its props.
8
+ * @param {{ name: "AxisMenu" | "ValueMenu" | "ChartTypePanel" | "OptionsPanel" | "ViewsPanel" | "ExportPanel" | "LoadCheck" | "FilterPopover" | "DrillPanel", loadingText?: string, props: Record<string, any> }} props
9
+ * `loadingText`: shown while loading; without it nothing is (a popover or panel of its own).
10
+ * `props.labels` gives the texts of a failed load
11
+ */
12
+ export declare function MenuPanel({ name, loadingText, props }: {
13
+ name: "AxisMenu" | "ValueMenu" | "ChartTypePanel" | "OptionsPanel" | "ViewsPanel" | "ExportPanel" | "LoadCheck" | "FilterPopover" | "DrillPanel";
14
+ loadingText?: string;
15
+ props: Record<string, any>;
16
+ }): React.JSX.Element;
@@ -0,0 +1,255 @@
1
+ export type MenuTexts = typeof en;
2
+ /** @typedef {typeof en} MenuTexts */
3
+ export declare const en: {
4
+ aboutSetting: string;
5
+ settingInfo: {
6
+ grandTotalRow: string;
7
+ grandTotalColumn: string;
8
+ rowSubtotals: string;
9
+ colSubtotals: string;
10
+ along: string;
11
+ showAs: string;
12
+ exportXlsx: string;
13
+ exportCsv: string;
14
+ copyTable: string;
15
+ copyDataJson: string;
16
+ drillCopy: string;
17
+ drillJson: string;
18
+ groupLabels: string;
19
+ labelPosition: string;
20
+ sharedView: string;
21
+ };
22
+ moveLeft: string;
23
+ moveRight: string;
24
+ remove: string;
25
+ chartAutoNow: string;
26
+ sharedViews: string;
27
+ myViews: string;
28
+ noViews: string;
29
+ publishView: string;
30
+ publishConfirm: string;
31
+ publishAction: string;
32
+ storeNote: string;
33
+ storeFull: string;
34
+ storeTooLarge: string;
35
+ storeRefused: string;
36
+ storeChanged: string;
37
+ toastSaved: string;
38
+ toastDeleted: string;
39
+ toastPublished: string;
40
+ toastSaveFailed: string;
41
+ toastDeleteFailed: string;
42
+ toastPublishFailed: string;
43
+ toastSaveRejected: string;
44
+ toastDeleteRejected: string;
45
+ toastPublishRejected: string;
46
+ deleteView: string;
47
+ deleteConfirm: string;
48
+ deleteAction: string;
49
+ saveView: string;
50
+ viewName: string;
51
+ save: string;
52
+ cancel: string;
53
+ expandAll: string;
54
+ collapseAll: string;
55
+ aggregation: string;
56
+ moreStatistics: string;
57
+ showAsNone: string;
58
+ moreCalculations: string;
59
+ showAsNames: {
60
+ percentOfGrandTotal: string;
61
+ percentOfRowTotal: string;
62
+ percentOfColumnTotal: string;
63
+ percentOfParentRow: string;
64
+ percentOfParentColumn: string;
65
+ differenceFromPrevious: string;
66
+ percentDifferenceFromPrevious: string;
67
+ runningTotal: string;
68
+ percentRunningTotal: string;
69
+ rankAscending: string;
70
+ rankDescending: string;
71
+ };
72
+ along: string;
73
+ format: string;
74
+ formatAuto: string;
75
+ formats: {
76
+ number: string;
77
+ "number:0": string;
78
+ "number:2": string;
79
+ integer: string;
80
+ currency: string;
81
+ percent: string;
82
+ compact: string;
83
+ bytes: string;
84
+ "duration:h": string;
85
+ "duration:s": string;
86
+ };
87
+ conditional: string;
88
+ conditionalNone: string;
89
+ colorScale: string;
90
+ dataBar: string;
91
+ rename: string;
92
+ sortOldest: string;
93
+ sortNewest: string;
94
+ groupBy: string;
95
+ groupNone: string;
96
+ groupTimeline: string;
97
+ groupCyclic: string;
98
+ unitHints: {
99
+ year: string;
100
+ yearQuarter: string;
101
+ yearMonth: string;
102
+ yearWeek: string;
103
+ day: string;
104
+ quarter: string;
105
+ month: string;
106
+ week: string;
107
+ weekday: string;
108
+ hour: string;
109
+ bin: string;
110
+ };
111
+ bins: string;
112
+ binSize: string;
113
+ binStart: string;
114
+ binStartFar: string;
115
+ apply: string;
116
+ removeSetting: string;
117
+ topN: string;
118
+ topCount: string;
119
+ bottom: string;
120
+ topBy: string;
121
+ searchValues: string;
122
+ selectAll: string;
123
+ selectNone: string;
124
+ onlyThis: string;
125
+ valuesShown: string;
126
+ conditionNumber: string;
127
+ conditionNone: string;
128
+ conditionValue: string;
129
+ selected: string;
130
+ exportDownload: string;
131
+ exportCopy: string;
132
+ exportXlsx: string;
133
+ exportCsv: string;
134
+ exportPng: string;
135
+ exportPngNeedsChart: string;
136
+ copyTable: string;
137
+ copyDataJson: string;
138
+ toastTableCopied: string;
139
+ toastDataCopied: string;
140
+ toastCopyBlocked: string;
141
+ drillTitle: string;
142
+ drillCount: {
143
+ one: string;
144
+ other: string;
145
+ };
146
+ drillShown: string;
147
+ drillCopy: string;
148
+ drillJson: string;
149
+ drillCsv: string;
150
+ drillXlsx: string;
151
+ drillPart: string;
152
+ drillCopied: string;
153
+ drillCopiedJson: string;
154
+ drillExported: string;
155
+ drillExportNote: string;
156
+ showTips: string;
157
+ showSettingInfo: string;
158
+ resetTips: string;
159
+ help: string;
160
+ shortcutsTitle: string;
161
+ keys: {
162
+ Mod: string;
163
+ Shift: string;
164
+ "Arrow keys": string;
165
+ Enter: string;
166
+ Space: string;
167
+ Escape: string;
168
+ F10: string;
169
+ };
170
+ valueLabels: string;
171
+ valueLabelNames: {
172
+ auto: string;
173
+ off: string;
174
+ value: string;
175
+ percent: string;
176
+ both: string;
177
+ };
178
+ legend: string;
179
+ legendNames: {
180
+ auto: string;
181
+ bottom: string;
182
+ right: string;
183
+ off: string;
184
+ };
185
+ chartTitle: string;
186
+ chartTitleNone: string;
187
+ smoothLines: string;
188
+ labelPosition: string;
189
+ labelPositionNames: {
190
+ outside: string;
191
+ inside: string;
192
+ };
193
+ axisLabels: string;
194
+ axisLabelNames: {
195
+ auto: string;
196
+ all: string;
197
+ nth: string;
198
+ };
199
+ groupLabels: string;
200
+ groupLabelNames: {
201
+ auto: string;
202
+ on: string;
203
+ off: string;
204
+ };
205
+ defaultName: string;
206
+ share: string;
207
+ copyLink: string;
208
+ copyJson: string;
209
+ downloadView: string;
210
+ sharePrivacy: string;
211
+ loadView: string;
212
+ loadViewHint: string;
213
+ loadViewText: string;
214
+ chooseFile: string;
215
+ load: string;
216
+ loadCheckTitle: string;
217
+ loadAnyway: string;
218
+ switchAndLoad: string;
219
+ switchStartsFresh: string;
220
+ numberInvalid: string;
221
+ countInvalid: string;
222
+ sizeInvalid: string;
223
+ valueFilter: string;
224
+ valueFilterBy: string;
225
+ valueFilterOp: string;
226
+ valueFilterNumber: string;
227
+ valueFilterTo: string;
228
+ valueOps: {
229
+ "=": string;
230
+ "!=": string;
231
+ ">": string;
232
+ ">=": string;
233
+ "<": string;
234
+ "<=": string;
235
+ between: string;
236
+ notBetween: string;
237
+ };
238
+ removeFilter: string;
239
+ valuesFilterHint: string;
240
+ moreFormats: string;
241
+ };
242
+ /** @type {MenuTexts} */
243
+ export declare const de: MenuTexts;
244
+ /** @type {Readonly<{ en: MenuTexts, de: MenuTexts }>} */
245
+ export declare const MENU_LABELS: Readonly<{
246
+ en: MenuTexts;
247
+ de: MenuTexts;
248
+ }>;
249
+ /**
250
+ * The report's labels with the menus' texts of their language (English for a language of a host's
251
+ * own), a host's own texts for them applied.
252
+ * @param {import("./labels.js").UiLabels} labels
253
+ * @returns {import("./labels.js").UiLabels}
254
+ */
255
+ export declare function menuLabels(labels: import("./labels.js").UiLabels): import("./labels.js").UiLabels;
@@ -0,0 +1,7 @@
1
+ export { AxisMenu, ValueMenu } from "./chip-menus.jsx";
2
+ export { ChartTypePanel, ExportPanel, LoadCheck, OptionsPanel, ViewsPanel } from "./toolbar-panels.jsx";
3
+ export { FilterPopover } from "./filter.jsx";
4
+ export { DrillPanel } from "./drill-panel.jsx";
5
+ export { menuLabels } from "./menu-labels.js";
6
+ export { storedViews } from "./view-store.js";
7
+ export { prepareExporters, runExport } from "./export-run.js";
@@ -0,0 +1,80 @@
1
+ /** "Sum of Revenue", "% of grand total of Revenue", or the value's own name. */
2
+ export declare function valueLabel(spec: any, labels: any): any;
3
+ /**
4
+ * The name of a measure a sort, a top N or a value condition goes by ({ field, agg }): the name of the
5
+ * view's value for it ("Sum of Revenue", or the name the user gave it), without a "show as"
6
+ * calculation, since the raw result is what is compared.
7
+ * @param {any} view
8
+ * @param {{ field: string | null, agg: string } | null | undefined} ref
9
+ * @param {import("./labels.js").UiLabels} labels
10
+ */
11
+ export declare function refLabel(view: any, ref: {
12
+ field: string | null;
13
+ agg: string;
14
+ } | null | undefined, labels: import("./labels.js").UiLabels): any;
15
+ /**
16
+ * A value condition in short: "Sum of Revenue > 1,000", "Sum of Revenue between 5 and 8".
17
+ * @param {any} view
18
+ * @param {{ by?: { field: string | null, agg: string }, op: string, value: number, value2?: number }} f a `value` filter
19
+ * @param {import("./labels.js").UiLabels} labels
20
+ * @param {string} locale
21
+ */
22
+ export declare function valueConditionText(view: any, f: {
23
+ by?: {
24
+ field: string | null;
25
+ agg: string;
26
+ };
27
+ op: string;
28
+ value: number;
29
+ value2?: number;
30
+ }, labels: import("./labels.js").UiLabels, locale: string): string;
31
+ /** The name of a derived field for a grouping, in the labels' language: "Date by month", "Amount (by 100)". */
32
+ export declare function groupingName(source: any, unit: any, labels: any, size: any): string;
33
+ /** The zone a click on a field of the field list puts it in: numbers to Values, the rest to Rows. */
34
+ export declare const quickZone: (type: any) => "rows" | "values";
35
+ /**
36
+ * What a click on a field of the field list does, from its type and the zones it is in: "add" it to
37
+ * its quick zone (a number is added to Values once more each time), "move" it there from Columns or
38
+ * Filters (a field is on one axis only), or nothing when it is on that axis already. `name` is the
39
+ * button's accessible name (the field and where it is), `description` the action in words.
40
+ * @param {string} field
41
+ * @param {string} type
42
+ * @param {string[]} zones the zones the field is in
43
+ * @param {import("./labels.js").UiLabels} labels
44
+ * @returns {{ zone: string, kind: "add" | "move" | null, name: string, description: string }}
45
+ */
46
+ export declare function fieldAction(field: string, type: string, zones: string[], labels: import("./labels.js").UiLabels): {
47
+ zone: string;
48
+ kind: "add" | "move" | null;
49
+ name: string;
50
+ description: string;
51
+ };
52
+ /**
53
+ * The zones in one line, for the compact layout: "Rows: Team · Columns: Priority · Values: Count of
54
+ * Ticket"; zones without a field are left out.
55
+ * @param {Record<string, Array<{ text: string }>>} entries the chips of each zone (zoneEntries)
56
+ * @param {import("./labels.js").UiLabels} labels
57
+ * @returns {Array<{ zone: string, title: string, fields: string }>} empty when no field is placed
58
+ */
59
+ export declare function layoutSummary(entries: Record<string, Array<{
60
+ text: string;
61
+ }>>, labels: import("./labels.js").UiLabels): Array<{
62
+ zone: string;
63
+ title: string;
64
+ fields: string;
65
+ }>;
66
+ /**
67
+ * What the filter of a field keeps, for its menu: "Filter: 15 of 45", "Filter: contains “abc”",
68
+ * "Filter: Sum of Revenue > 1,000"; null without a filter.
69
+ * @param {any} view
70
+ * @param {string} field
71
+ * @param {{ summary: { shown: number, total: number } | null } | null | undefined} state the chip's state (zones.jsx)
72
+ * @param {import("./labels.js").UiLabels} labels
73
+ * @param {string} locale
74
+ */
75
+ export declare function filterText(view: any, field: string, state: {
76
+ summary: {
77
+ shown: number;
78
+ total: number;
79
+ } | null;
80
+ } | null | undefined, labels: import("./labels.js").UiLabels, locale: string): string | null;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A number typed in the report's locale, or null when the text is empty or not a number.
3
+ * @param {string} text
4
+ * @param {string} locale
5
+ * @returns {number | null}
6
+ */
7
+ export declare function parseNumber(text: string, locale: string): number | null;
8
+ /**
9
+ * A number as a form shows it for editing: the locale's decimal mark, no grouping, all its decimals.
10
+ * @param {number | null | undefined} n
11
+ * @param {string} locale
12
+ */
13
+ export declare function numberText(n: number | null | undefined, locale: string): string;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The buttons that move into "More" when the toolbar is too narrow, first to go first: a fixed
3
+ * priority. The order never depends on a button's own state (Layout open or folded), so a click never
4
+ * moves it. Redo is not in the list: it stays next to Undo, which always stays.
5
+ */
6
+ export declare const OVERFLOW_ORDER: readonly string[];
7
+ /**
8
+ * The room (em of the toolbar's font) each part of the toolbar takes with the longest text of the
9
+ * built-in languages, the gap after it included. How many buttons move into "More" follows from the
10
+ * toolbar's width and these numbers, not from the texts shown: at the same width the same buttons
11
+ * show in every language. (A host's own longer labels still fit: useOverflow measures as well.)
12
+ */
13
+ export declare const TOOLBAR_ROOM: Readonly<{
14
+ fields: 6.4;
15
+ display: 15.3;
16
+ chartType: 12.9;
17
+ sep: 1;
18
+ undo: 8.75;
19
+ redo: 9.15;
20
+ reset: 9.65;
21
+ layout: 8.4;
22
+ options: 8.75;
23
+ views: 9.1;
24
+ export: 7.5;
25
+ more: 7.2;
26
+ }>;
27
+ /**
28
+ * Every text each part of the toolbar can show, from several label sets (the built-in languages and
29
+ * the report's own): a list of texts per part; for `display` (Table | Chart) the pairs.
30
+ * @param {ReadonlyArray<any>} sets labels objects
31
+ * @returns {Record<string, string[]> & { display: string[][] }}
32
+ */
33
+ export declare function toolbarTexts(sets: ReadonlyArray<any>): Record<string, string[]> & {
34
+ display: string[][];
35
+ };
36
+ /**
37
+ * The room (px) each part takes with its widest text: what a button has around its text (`chrome`:
38
+ * a text button's, a menu button's, Table | Chart's; measured from those on screen) plus the widest
39
+ * text (`measure`, in the toolbar's font) plus the gap after it. `sep`: the separator with its margins.
40
+ * @param {ReturnType<typeof toolbarTexts>} texts
41
+ * @param {(text: string, kind: "button" | "display") => number} measure
42
+ * @param {{ text: number, menu: number, display: number, sep: number, gap: number }} chrome
43
+ * @returns {Record<string, number>}
44
+ */
45
+ export declare function toolbarRoom(texts: ReturnType<typeof toolbarTexts>, measure: (text: string, kind: "button" | "display") => number, chrome: {
46
+ text: number;
47
+ menu: number;
48
+ display: number;
49
+ sep: number;
50
+ gap: number;
51
+ }): Record<string, number>;
52
+ /**
53
+ * How many entries of OVERFLOW_ORDER go into "More" in a toolbar `width` wide: the fewest with
54
+ * which the rest fits.
55
+ * @param {number} width in the unit of `room` (em for TOOLBAR_ROOM, px for toolbarRoom)
56
+ * @param {boolean} narrow the report is narrow: the Fields button is there too
57
+ * @param {Readonly<Record<string, number>>} [room]
58
+ */
59
+ export declare function overflowLevel(width: number, narrow: boolean, room?: Readonly<Record<string, number>>): number;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @param {{ top: number, bottom: number, left: number, right: number }} anchor getBoundingClientRect()
3
+ * @param {{ width: number, height: number }} size the popover's size
4
+ * @param {{ width: number, height: number }} viewport
5
+ * @param {"start" | "end"} [align] which edge of the anchor the popover lines up with
6
+ * @param {{ fill?: boolean }} [options]
7
+ * @returns {{ top: number, left: number, maxHeight: number, side: "below" | "above" }}
8
+ */
9
+ export declare function placePopover(anchor: {
10
+ top: number;
11
+ bottom: number;
12
+ left: number;
13
+ right: number;
14
+ }, size: {
15
+ width: number;
16
+ height: number;
17
+ }, viewport: {
18
+ width: number;
19
+ height: number;
20
+ }, align?: "start" | "end", { fill }?: {
21
+ fill?: boolean;
22
+ }): {
23
+ top: number;
24
+ left: number;
25
+ maxHeight: number;
26
+ side: "below" | "above";
27
+ };
28
+ /**
29
+ * A place in viewport coordinates as the top and left of a fixed element whose containing block
30
+ * starts at `origin` (the viewport rect of a fixed probe at 0, 0: { top: 0, left: 0 } without a
31
+ * transformed ancestor).
32
+ * @template {{ top: number, left: number }} T
33
+ * @param {T} place
34
+ * @param {{ top: number, left: number }} origin
35
+ * @returns {T}
36
+ */
37
+ export declare function fromOrigin<T extends {
38
+ top: number;
39
+ left: number;
40
+ }>(place: T, origin: {
41
+ top: number;
42
+ left: number;
43
+ }): T;
@@ -0,0 +1,89 @@
1
+ import React from "react";
2
+ /** The layer element and the size class of the report ("wide", "medium", "narrow"). */
3
+ export declare const LayerContext: React.Context<{
4
+ layer: HTMLElement | null;
5
+ size: string;
6
+ }>;
7
+ /**
8
+ * Whether a wheel turn inside a popover may scroll something there: an element on its way from the
9
+ * target up to the popover that scrolls in that direction and is not at its end. Else the popover
10
+ * keeps it (preventDefault), so the table or the page behind never scrolls.
11
+ * @param {EventTarget[]} path the event's composed path
12
+ * @param {Element} popover
13
+ * @param {number} dx
14
+ * @param {number} dy
15
+ */
16
+ export declare function wheelScrollsInside(path: EventTarget[], popover: Element, dx: number, dy: number): boolean;
17
+ /**
18
+ * @param {{ open: boolean, anchor: React.RefObject<HTMLElement>, onClose: () => void, label?: string,
19
+ * role?: "menu" | "dialog" | "tooltip", align?: "start" | "end", className?: string, id?: string,
20
+ * passive?: boolean, fill?: boolean, onPointerEnter?: (e: React.PointerEvent) => void, onPointerLeave?: (e: React.PointerEvent) => void,
21
+ * children: React.ReactNode }} props
22
+ * `fill`: a popover with a scrolling middle and a foot that stays in view (the filter, a chip menu)
23
+ * may cover its anchor when it fits on neither side (place.js)
24
+ * `passive`: shown on hover or focus of its button (a description): the focus stays where it is,
25
+ * never a bottom sheet
26
+ */
27
+ export declare function Popover({ open, anchor, onClose, label, role, align, className, id, passive, fill, onPointerEnter, onPointerLeave, children }: {
28
+ open: boolean;
29
+ anchor: React.RefObject<HTMLElement>;
30
+ onClose: () => void;
31
+ label?: string;
32
+ role?: "menu" | "dialog" | "tooltip";
33
+ align?: "start" | "end";
34
+ className?: string;
35
+ id?: string;
36
+ passive?: boolean;
37
+ fill?: boolean;
38
+ onPointerEnter?: (e: React.PointerEvent) => void;
39
+ onPointerLeave?: (e: React.PointerEvent) => void;
40
+ children: React.ReactNode;
41
+ }): React.ReactPortal | null;
42
+ /**
43
+ * A button that opens a popover. `children` is a function of `close`.
44
+ * @param {{ label: string, icon?: string, text?: React.ReactNode, showText?: boolean, className?: string,
45
+ * role?: "menu" | "dialog", align?: "start" | "end", popoverClass?: string, disabled?: boolean,
46
+ * title?: string, children: (close: () => void) => React.ReactNode, testId?: string, name?: string,
47
+ * buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean }} props
48
+ * `tabIndex`: -1 where a list moves the focus itself (the field list)
49
+ */
50
+ export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill }: {
51
+ label: string;
52
+ icon?: string;
53
+ text?: React.ReactNode;
54
+ showText?: boolean;
55
+ className?: string;
56
+ role?: "menu" | "dialog";
57
+ align?: "start" | "end";
58
+ popoverClass?: string;
59
+ disabled?: boolean;
60
+ title?: string;
61
+ children: (close: () => void) => React.ReactNode;
62
+ testId?: string;
63
+ name?: string;
64
+ buttonRef?: React.RefObject<HTMLButtonElement>;
65
+ tabIndex?: number;
66
+ slot?: string;
67
+ fill?: boolean;
68
+ }): React.JSX.Element;
69
+ /**
70
+ * One option of a menu or of a chip's settings: one line. `hint` is a short second line that belongs
71
+ * to the option (a date unit's example); `reason` says why a disabled option does nothing and shows
72
+ * only while it is disabled (it is state, not an explanation: those go into an "i").
73
+ * @param {{ onSelect: () => void, icon?: string, checked?: boolean, children: React.ReactNode, hint?: React.ReactNode,
74
+ * reason?: React.ReactNode, inMenu?: boolean, disabled?: boolean, danger?: boolean, tone?: "accent", testId?: string }} props
75
+ * `tone`: "accent" for an option that says what is set (a filter)
76
+ */
77
+ export declare function Option({ onSelect, icon, checked, children, hint, reason, inMenu, disabled, danger, tone, testId }: {
78
+ onSelect: () => void;
79
+ icon?: string;
80
+ checked?: boolean;
81
+ children: React.ReactNode;
82
+ hint?: React.ReactNode;
83
+ reason?: React.ReactNode;
84
+ inMenu?: boolean;
85
+ disabled?: boolean;
86
+ danger?: boolean;
87
+ tone?: "accent";
88
+ testId?: string;
89
+ }): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ /** The controls of a field in the list, left to right. */
2
+ export declare const SLOTS: readonly string[];
3
+ /**
4
+ * The control a key moves the focus to from the focused one, or null for a key the list leaves alone.
5
+ * Up and down keep the column (the menu stays the menu); a row without it takes its name.
6
+ * @param {string} key KeyboardEvent.key
7
+ * @param {{ row: number, slot: string }} at the focused control
8
+ * @param {number} rows the fields shown
9
+ * @param {(row: number) => readonly string[]} slotsOf the controls a row has, in SLOTS order
10
+ * @returns {{ row: number, slot: string } | null}
11
+ */
12
+ export declare function roveTarget(key: string, at: {
13
+ row: number;
14
+ slot: string;
15
+ }, rows: number, slotsOf: (row: number) => readonly string[]): {
16
+ row: number;
17
+ slot: string;
18
+ } | null;
19
+ /** The key that opens the menu of the field in focus: Shift+F10 or the context menu key. */
20
+ export declare const opensMenu: (e: any) => any;
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ export type Help = {
3
+ /**
4
+ * the "i" of the settings are shown
5
+ */
6
+ explain: boolean;
7
+ /**
8
+ * whether a section is open
9
+ */
10
+ isOpen: (id: string) => boolean;
11
+ setOpen: (id: string, open: boolean) => void;
12
+ labels: import("./labels.js").UiLabels | null;
13
+ };
14
+ /**
15
+ * @typedef {object} Help
16
+ * @property {boolean} explain the "i" of the settings are shown
17
+ * @property {(id: string) => boolean} isOpen whether a section is open
18
+ * @property {(id: string, open: boolean) => void} setOpen
19
+ * @property {import("./labels.js").UiLabels | null} labels
20
+ */
21
+ /** @type {React.Context<Help>} */
22
+ export declare const HelpContext: React.Context<Help>;
23
+ /**
24
+ * The "i" next to a setting: its explanation (labels.settingInfo[id], loaded with the menus) on
25
+ * hover, focus or tap. Nothing while "Show explanations" is off or the text is missing.
26
+ * @param {{ id: string, name: string }} props `name`: the setting's name, for the button's name
27
+ */
28
+ export declare function SettingInfo({ id, name }: {
29
+ id: string;
30
+ name: string;
31
+ }): React.JSX.Element | null;
32
+ /**
33
+ * A titled group of options. With an `id` of SECTIONS (tips.js) its title is a button that folds it;
34
+ * `info` is the id of an explanation shown as an "i" next to the title.
35
+ * @param {{ title: React.ReactNode, children: React.ReactNode, id?: string, info?: string }} props
36
+ */
37
+ export declare function Section({ title, children, id, info }: {
38
+ title: React.ReactNode;
39
+ children: React.ReactNode;
40
+ id?: string;
41
+ info?: string;
42
+ }): React.JSX.Element;