@inshorts/glint-ui 0.5.4 → 0.6.1
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 +3 -1
- package/dist/alert.cjs +96 -0
- package/dist/alert.cjs.map +1 -0
- package/dist/alert.d.cts +29 -0
- package/dist/alert.d.ts +29 -0
- package/dist/alert.js +10 -0
- package/dist/alert.js.map +1 -0
- package/dist/autocomplete.cjs +578 -0
- package/dist/autocomplete.cjs.map +1 -0
- package/dist/autocomplete.d.cts +56 -0
- package/dist/autocomplete.d.ts +56 -0
- package/dist/autocomplete.js +11 -0
- package/dist/autocomplete.js.map +1 -0
- package/dist/badge.cjs +89 -0
- package/dist/badge.cjs.map +1 -0
- package/dist/badge.d.cts +25 -0
- package/dist/badge.d.ts +25 -0
- package/dist/badge.js +10 -0
- package/dist/badge.js.map +1 -0
- package/dist/breadcrumb.cjs +88 -0
- package/dist/breadcrumb.cjs.map +1 -0
- package/dist/breadcrumb.d.cts +14 -0
- package/dist/breadcrumb.d.ts +14 -0
- package/dist/breadcrumb.js +8 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button.cjs +143 -0
- package/dist/button.cjs.map +1 -0
- package/dist/button.d.cts +34 -0
- package/dist/button.d.ts +34 -0
- package/dist/button.js +9 -0
- package/dist/button.js.map +1 -0
- package/dist/card.cjs +111 -0
- package/dist/card.cjs.map +1 -0
- package/dist/card.d.cts +15 -0
- package/dist/card.d.ts +15 -0
- package/dist/card.js +18 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.cjs +66 -0
- package/dist/checkbox.cjs.map +1 -0
- package/{src/checkbox.tsx → dist/checkbox.d.cts} +5 -22
- package/dist/checkbox.d.ts +25 -0
- package/dist/checkbox.js +10 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chunk-5MEOZHJA.js +513 -0
- package/dist/chunk-5MEOZHJA.js.map +1 -0
- package/dist/chunk-67ACNS42.js +29 -0
- package/dist/chunk-67ACNS42.js.map +1 -0
- package/dist/chunk-A6GRLKOO.js +85 -0
- package/dist/chunk-A6GRLKOO.js.map +1 -0
- package/dist/chunk-DS3QYIKL.js +90 -0
- package/dist/chunk-DS3QYIKL.js.map +1 -0
- package/dist/chunk-EWSBFU54.js +53 -0
- package/dist/chunk-EWSBFU54.js.map +1 -0
- package/dist/chunk-G4ZQUSAJ.js +38 -0
- package/dist/chunk-G4ZQUSAJ.js.map +1 -0
- package/dist/chunk-GMCUXEFI.js +67 -0
- package/dist/chunk-GMCUXEFI.js.map +1 -0
- package/dist/chunk-HBBOR43A.js +85 -0
- package/dist/chunk-HBBOR43A.js.map +1 -0
- package/dist/chunk-HCA5ODCD.js +11 -0
- package/dist/chunk-HCA5ODCD.js.map +1 -0
- package/dist/chunk-HYRJYUPI.js +26 -0
- package/dist/chunk-HYRJYUPI.js.map +1 -0
- package/dist/chunk-IRCTGJQB.js +26 -0
- package/dist/chunk-IRCTGJQB.js.map +1 -0
- package/dist/chunk-ISPICB4W.js +70 -0
- package/dist/chunk-ISPICB4W.js.map +1 -0
- package/dist/chunk-JDE5XYPT.js +30 -0
- package/dist/chunk-JDE5XYPT.js.map +1 -0
- package/dist/chunk-JSJEEKR3.js +59 -0
- package/dist/chunk-JSJEEKR3.js.map +1 -0
- package/dist/chunk-KR3BCFP7.js +85 -0
- package/dist/chunk-KR3BCFP7.js.map +1 -0
- package/dist/chunk-MLRSOTFI.js +81 -0
- package/dist/chunk-MLRSOTFI.js.map +1 -0
- package/dist/chunk-MQT5RAQV.js +202 -0
- package/dist/chunk-MQT5RAQV.js.map +1 -0
- package/dist/chunk-MUPW2TFJ.js +102 -0
- package/dist/chunk-MUPW2TFJ.js.map +1 -0
- package/dist/chunk-OUYT6SPU.js +76 -0
- package/dist/chunk-OUYT6SPU.js.map +1 -0
- package/dist/chunk-PM2VE7DJ.js +100 -0
- package/dist/chunk-PM2VE7DJ.js.map +1 -0
- package/dist/chunk-PPYR3O3L.js +44 -0
- package/dist/chunk-PPYR3O3L.js.map +1 -0
- package/dist/chunk-PUTC52SI.js +98 -0
- package/dist/chunk-PUTC52SI.js.map +1 -0
- package/dist/chunk-PWAKTEXF.js +18 -0
- package/dist/chunk-PWAKTEXF.js.map +1 -0
- package/dist/chunk-QTFWORA7.js +26 -0
- package/dist/chunk-QTFWORA7.js.map +1 -0
- package/dist/chunk-RUPL2H6V.js +49 -0
- package/dist/chunk-RUPL2H6V.js.map +1 -0
- package/dist/chunk-S7PVZAPL.js +28 -0
- package/dist/chunk-S7PVZAPL.js.map +1 -0
- package/dist/chunk-SQDV2AKJ.js +49 -0
- package/dist/chunk-SQDV2AKJ.js.map +1 -0
- package/dist/chunk-T2KXVH3O.js +297 -0
- package/dist/chunk-T2KXVH3O.js.map +1 -0
- package/dist/chunk-T4WCCHJQ.js +29 -0
- package/dist/chunk-T4WCCHJQ.js.map +1 -0
- package/dist/chunk-UC3ZIQPE.js +93 -0
- package/dist/chunk-UC3ZIQPE.js.map +1 -0
- package/dist/chunk-UE7JY7VR.js +28 -0
- package/dist/chunk-UE7JY7VR.js.map +1 -0
- package/dist/chunk-Y5WCT6XN.js +93 -0
- package/dist/chunk-Y5WCT6XN.js.map +1 -0
- package/dist/chunk-YDICVETX.js +151 -0
- package/dist/chunk-YDICVETX.js.map +1 -0
- package/dist/chunk-ZFSQVMLJ.js +126 -0
- package/dist/chunk-ZFSQVMLJ.js.map +1 -0
- package/dist/chunk-ZHATD73Y.js +46 -0
- package/dist/chunk-ZHATD73Y.js.map +1 -0
- package/dist/chunk-ZLAA4DGG.js +111 -0
- package/dist/chunk-ZLAA4DGG.js.map +1 -0
- package/dist/chunk-ZP252OJZ.js +56 -0
- package/dist/chunk-ZP252OJZ.js.map +1 -0
- package/dist/clipboard.cjs +125 -0
- package/dist/clipboard.cjs.map +1 -0
- package/dist/clipboard.d.cts +52 -0
- package/dist/clipboard.d.ts +52 -0
- package/dist/clipboard.js +23 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/collapsible.cjs +94 -0
- package/dist/collapsible.cjs.map +1 -0
- package/dist/collapsible.d.cts +21 -0
- package/dist/collapsible.d.ts +21 -0
- package/dist/collapsible.js +9 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/confirm-dialog.cjs +369 -0
- package/dist/confirm-dialog.cjs.map +1 -0
- package/dist/confirm-dialog.d.cts +16 -0
- package/dist/confirm-dialog.d.ts +16 -0
- package/dist/confirm-dialog.js +13 -0
- package/dist/confirm-dialog.js.map +1 -0
- package/dist/copy-button.cjs +102 -0
- package/dist/copy-button.cjs.map +1 -0
- package/dist/copy-button.d.cts +18 -0
- package/dist/copy-button.d.ts +18 -0
- package/dist/copy-button.js +10 -0
- package/dist/copy-button.js.map +1 -0
- package/dist/data-table.cjs +140 -0
- package/dist/data-table.cjs.map +1 -0
- package/dist/data-table.d.cts +81 -0
- package/dist/data-table.d.ts +81 -0
- package/dist/data-table.js +8 -0
- package/dist/data-table.js.map +1 -0
- package/dist/date-range-picker/dateRange.cjs +138 -0
- package/dist/date-range-picker/dateRange.cjs.map +1 -0
- package/dist/date-range-picker/dateRange.d.cts +57 -0
- package/dist/date-range-picker/dateRange.d.ts +57 -0
- package/dist/date-range-picker/dateRange.js +31 -0
- package/dist/date-range-picker/dateRange.js.map +1 -0
- package/dist/date-range-picker/index.cjs +375 -0
- package/dist/date-range-picker/index.cjs.map +1 -0
- package/dist/date-range-picker/index.d.cts +18 -0
- package/dist/date-range-picker/index.d.ts +18 -0
- package/dist/date-range-picker/index.js +10 -0
- package/dist/date-range-picker/index.js.map +1 -0
- package/dist/dialogLayer.cjs +121 -0
- package/dist/dialogLayer.cjs.map +1 -0
- package/dist/dialogLayer.d.cts +11 -0
- package/dist/dialogLayer.d.ts +11 -0
- package/dist/dialogLayer.js +8 -0
- package/dist/dialogLayer.js.map +1 -0
- package/dist/feature-access-gate.cjs +160 -0
- package/dist/feature-access-gate.cjs.map +1 -0
- package/dist/feature-access-gate.d.cts +14 -0
- package/dist/feature-access-gate.d.ts +14 -0
- package/dist/feature-access-gate.js +11 -0
- package/dist/feature-access-gate.js.map +1 -0
- package/dist/field.cjs +58 -0
- package/dist/field.cjs.map +1 -0
- package/dist/field.d.cts +23 -0
- package/dist/field.d.ts +23 -0
- package/dist/field.js +8 -0
- package/dist/field.js.map +1 -0
- package/dist/image-uploader.cjs +293 -0
- package/dist/image-uploader.cjs.map +1 -0
- package/dist/image-uploader.d.cts +34 -0
- package/dist/image-uploader.d.ts +34 -0
- package/dist/image-uploader.js +12 -0
- package/dist/image-uploader.js.map +1 -0
- package/dist/index.cjs +3008 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +232 -0
- package/dist/index.js.map +1 -0
- package/dist/input.cjs +58 -0
- package/dist/input.cjs.map +1 -0
- package/dist/input.d.cts +7 -0
- package/dist/input.d.ts +7 -0
- package/dist/input.js +10 -0
- package/dist/input.js.map +1 -0
- package/dist/label.cjs +67 -0
- package/dist/label.cjs.map +1 -0
- package/dist/label.d.cts +7 -0
- package/dist/label.d.ts +7 -0
- package/dist/label.js +9 -0
- package/dist/label.js.map +1 -0
- package/dist/modal.cjs +212 -0
- package/dist/modal.cjs.map +1 -0
- package/dist/modal.d.cts +39 -0
- package/dist/modal.d.ts +39 -0
- package/dist/modal.js +12 -0
- package/dist/modal.js.map +1 -0
- package/dist/page-header.cjs +78 -0
- package/dist/page-header.cjs.map +1 -0
- package/dist/page-header.d.cts +35 -0
- package/dist/page-header.d.ts +35 -0
- package/dist/page-header.js +8 -0
- package/dist/page-header.js.map +1 -0
- package/dist/pagination.cjs +237 -0
- package/dist/pagination.cjs.map +1 -0
- package/dist/pagination.d.cts +15 -0
- package/dist/pagination.d.ts +15 -0
- package/dist/pagination.js +11 -0
- package/dist/pagination.js.map +1 -0
- package/dist/panel-brand-mark.cjs +59 -0
- package/dist/panel-brand-mark.cjs.map +1 -0
- package/dist/panel-brand-mark.d.cts +13 -0
- package/dist/panel-brand-mark.d.ts +13 -0
- package/dist/panel-brand-mark.js +8 -0
- package/dist/panel-brand-mark.js.map +1 -0
- package/dist/panel-sign-in.cjs +256 -0
- package/dist/panel-sign-in.cjs.map +1 -0
- package/dist/panel-sign-in.d.cts +31 -0
- package/dist/panel-sign-in.d.ts +31 -0
- package/dist/panel-sign-in.js +14 -0
- package/dist/panel-sign-in.js.map +1 -0
- package/dist/segmented-control.cjs +122 -0
- package/dist/segmented-control.cjs.map +1 -0
- package/dist/segmented-control.d.cts +58 -0
- package/dist/segmented-control.d.ts +58 -0
- package/dist/segmented-control.js +9 -0
- package/dist/segmented-control.js.map +1 -0
- package/dist/select.cjs +648 -0
- package/dist/select.cjs.map +1 -0
- package/dist/select.d.cts +30 -0
- package/dist/select.d.ts +30 -0
- package/dist/select.js +12 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.cjs +70 -0
- package/dist/separator.cjs.map +1 -0
- package/dist/separator.d.cts +13 -0
- package/dist/separator.d.ts +13 -0
- package/dist/separator.js +9 -0
- package/dist/separator.js.map +1 -0
- package/dist/side-drawer.cjs +321 -0
- package/dist/side-drawer.cjs.map +1 -0
- package/dist/side-drawer.d.cts +21 -0
- package/dist/side-drawer.d.ts +21 -0
- package/dist/side-drawer.js +13 -0
- package/dist/side-drawer.js.map +1 -0
- package/dist/spinner.cjs +57 -0
- package/dist/spinner.cjs.map +1 -0
- package/{src/spinner.tsx → dist/spinner.d.cts} +11 -22
- package/dist/spinner.d.ts +27 -0
- package/dist/spinner.js +8 -0
- package/dist/spinner.js.map +1 -0
- package/dist/spreadsheet-grid.cjs +238 -0
- package/dist/spreadsheet-grid.cjs.map +1 -0
- package/dist/spreadsheet-grid.d.cts +48 -0
- package/dist/spreadsheet-grid.d.ts +48 -0
- package/dist/spreadsheet-grid.js +8 -0
- package/dist/spreadsheet-grid.js.map +1 -0
- package/dist/state-panel.cjs +86 -0
- package/dist/state-panel.cjs.map +1 -0
- package/dist/state-panel.d.cts +23 -0
- package/dist/state-panel.d.ts +23 -0
- package/dist/state-panel.js +9 -0
- package/dist/state-panel.js.map +1 -0
- package/dist/switch.cjs +87 -0
- package/dist/switch.cjs.map +1 -0
- package/dist/switch.d.cts +13 -0
- package/dist/switch.d.ts +13 -0
- package/dist/switch.js +9 -0
- package/dist/switch.js.map +1 -0
- package/dist/table.cjs +139 -0
- package/dist/table.cjs.map +1 -0
- package/dist/table.d.cts +16 -0
- package/dist/table.d.ts +16 -0
- package/dist/table.js +22 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.cjs +168 -0
- package/dist/tabs.cjs.map +1 -0
- package/dist/tabs.d.cts +59 -0
- package/dist/tabs.d.ts +59 -0
- package/dist/tabs.js +11 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.cjs +66 -0
- package/dist/textarea.cjs.map +1 -0
- package/dist/textarea.d.cts +18 -0
- package/dist/textarea.d.ts +18 -0
- package/dist/textarea.js +10 -0
- package/dist/textarea.js.map +1 -0
- package/dist/utils.cjs +35 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +5 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +7 -0
- package/dist/utils.js.map +1 -0
- package/package.json +391 -14
- package/src/alert.tsx +0 -74
- package/src/autocomplete.tsx +0 -666
- package/src/badge.tsx +0 -60
- package/src/breadcrumb.tsx +0 -71
- package/src/button.tsx +0 -113
- package/src/card.tsx +0 -79
- package/src/clipboard.ts +0 -144
- package/src/collapsible.tsx +0 -63
- package/src/confirm-dialog.tsx +0 -84
- package/src/copy-button.tsx +0 -58
- package/src/data-table.tsx +0 -190
- package/src/date-range-picker/dateRange.ts +0 -142
- package/src/date-range-picker/index.tsx +0 -366
- package/src/dialogLayer.ts +0 -142
- package/src/feature-access-gate.tsx +0 -38
- package/src/field.tsx +0 -56
- package/src/image-uploader.tsx +0 -181
- package/src/index.ts +0 -37
- package/src/input.tsx +0 -16
- package/src/label.tsx +0 -23
- package/src/modal.tsx +0 -117
- package/src/page-header.tsx +0 -75
- package/src/pagination.tsx +0 -116
- package/src/panel-brand-mark.tsx +0 -32
- package/src/panel-sign-in.tsx +0 -134
- package/src/segmented-control.tsx +0 -155
- package/src/select.tsx +0 -105
- package/src/separator.tsx +0 -32
- package/src/side-drawer.tsx +0 -87
- package/src/spreadsheet-grid.tsx +0 -264
- package/src/state-panel.tsx +0 -46
- package/src/switch.tsx +0 -47
- package/src/table.tsx +0 -110
- package/src/tabs.tsx +0 -201
- package/src/textarea.tsx +0 -32
- package/src/utils.ts +0 -6
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/clipboard.ts
|
|
21
|
+
var clipboard_exports = {};
|
|
22
|
+
__export(clipboard_exports, {
|
|
23
|
+
CSV_DELIMITER: () => CSV_DELIMITER,
|
|
24
|
+
TSV_DELIMITER: () => TSV_DELIMITER,
|
|
25
|
+
buildRangeText: () => buildRangeText,
|
|
26
|
+
countCells: () => countCells,
|
|
27
|
+
describeRange: () => describeRange,
|
|
28
|
+
escapeCell: () => escapeCell,
|
|
29
|
+
fullRange: () => fullRange,
|
|
30
|
+
normalizeRange: () => normalizeRange,
|
|
31
|
+
writeToClipboard: () => writeToClipboard
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(clipboard_exports);
|
|
34
|
+
var TSV_DELIMITER = " ";
|
|
35
|
+
var CSV_DELIMITER = ",";
|
|
36
|
+
function normalizeRange(anchor, focus) {
|
|
37
|
+
if (!anchor || !focus) return null;
|
|
38
|
+
return {
|
|
39
|
+
r1: Math.min(anchor.r, focus.r),
|
|
40
|
+
r2: Math.max(anchor.r, focus.r),
|
|
41
|
+
c1: Math.min(anchor.c, focus.c),
|
|
42
|
+
c2: Math.max(anchor.c, focus.c)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function escapeCell(raw, delimiter) {
|
|
46
|
+
const value = raw == null ? "" : String(raw);
|
|
47
|
+
if (value.includes(delimiter) || value.includes("\n") || value.includes("\r") || value.includes('"')) {
|
|
48
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function buildRangeText(range, columns, rows, delimiter, includeHeaders) {
|
|
53
|
+
if (!range) return "";
|
|
54
|
+
const lines = [];
|
|
55
|
+
if (includeHeaders) {
|
|
56
|
+
const header = [];
|
|
57
|
+
for (let c = range.c1; c <= range.c2; c++) {
|
|
58
|
+
header.push(escapeCell(columns[c]?.title, delimiter));
|
|
59
|
+
}
|
|
60
|
+
lines.push(header.join(delimiter));
|
|
61
|
+
}
|
|
62
|
+
for (let r = range.r1; r <= range.r2; r++) {
|
|
63
|
+
const line = [];
|
|
64
|
+
const row = rows[r];
|
|
65
|
+
for (let c = range.c1; c <= range.c2; c++) {
|
|
66
|
+
const column = columns[c];
|
|
67
|
+
line.push(
|
|
68
|
+
escapeCell(
|
|
69
|
+
column && row !== void 0 ? column.value(row) : "",
|
|
70
|
+
delimiter
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
lines.push(line.join(delimiter));
|
|
75
|
+
}
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
function fullRange(columns, rows) {
|
|
79
|
+
if (!rows.length || !columns.length) return null;
|
|
80
|
+
return { r1: 0, r2: rows.length - 1, c1: 0, c2: columns.length - 1 };
|
|
81
|
+
}
|
|
82
|
+
function describeRange(range) {
|
|
83
|
+
if (!range) return "No selection";
|
|
84
|
+
const rowCount = range.r2 - range.r1 + 1;
|
|
85
|
+
const colCount = range.c2 - range.c1 + 1;
|
|
86
|
+
if (rowCount === 1 && colCount === 1) return "1 cell selected";
|
|
87
|
+
return `${rowCount} \xD7 ${colCount} selected`;
|
|
88
|
+
}
|
|
89
|
+
function countCells(range) {
|
|
90
|
+
return {
|
|
91
|
+
rows: range.r2 - range.r1 + 1,
|
|
92
|
+
columns: range.c2 - range.c1 + 1
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async function writeToClipboard(text) {
|
|
96
|
+
if (navigator.clipboard?.writeText) {
|
|
97
|
+
return navigator.clipboard.writeText(text);
|
|
98
|
+
}
|
|
99
|
+
const textarea = document.createElement("textarea");
|
|
100
|
+
textarea.value = text;
|
|
101
|
+
textarea.style.position = "fixed";
|
|
102
|
+
textarea.style.top = "-1000px";
|
|
103
|
+
document.body.appendChild(textarea);
|
|
104
|
+
textarea.select();
|
|
105
|
+
try {
|
|
106
|
+
if (!document.execCommand("copy")) {
|
|
107
|
+
throw new Error("Could not write to the clipboard");
|
|
108
|
+
}
|
|
109
|
+
} finally {
|
|
110
|
+
document.body.removeChild(textarea);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
CSV_DELIMITER,
|
|
116
|
+
TSV_DELIMITER,
|
|
117
|
+
buildRangeText,
|
|
118
|
+
countCells,
|
|
119
|
+
describeRange,
|
|
120
|
+
escapeCell,
|
|
121
|
+
fullRange,
|
|
122
|
+
normalizeRange,
|
|
123
|
+
writeToClipboard
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=clipboard.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/clipboard.ts"],"sourcesContent":["/**\n * Range maths and clipboard text for the card table's spreadsheet selection.\n *\n * Ported from video-shorts-panel `app/src/common/components/ExcelTable.jsx`.\n * Kept free of React and the DOM (except `writeToClipboard`) so the escaping\n * and range rules are unit-testable.\n */\n\nexport type CellRef = { r: number; c: number };\n\nexport type CellRange = { r1: number; r2: number; c1: number; c2: number };\n\n/** Tab for the clipboard (Excel/Sheets split on it), comma for a .csv file. */\nexport const TSV_DELIMITER = \"\\t\";\nexport const CSV_DELIMITER = \",\";\n\n/**\n * Anchor and focus can be dragged in any direction, so the range is whichever\n * corners they happen to be — normalize to top-left / bottom-right.\n */\nexport function normalizeRange(\n anchor: CellRef | null | undefined,\n focus: CellRef | null | undefined,\n): CellRange | null {\n if (!anchor || !focus) return null;\n return {\n r1: Math.min(anchor.r, focus.r),\n r2: Math.max(anchor.r, focus.r),\n c1: Math.min(anchor.c, focus.c),\n c2: Math.max(anchor.c, focus.c),\n };\n}\n\n/**\n * A cell needs quoting once it carries the delimiters themselves — the same\n * rule Excel uses when it parses the clipboard. Without it, a title containing\n * a tab or a newline silently becomes extra columns or rows on paste.\n */\nexport function escapeCell(raw: unknown, delimiter: string): string {\n const value = raw == null ? \"\" : String(raw);\n if (\n value.includes(delimiter) ||\n value.includes(\"\\n\") ||\n value.includes(\"\\r\") ||\n value.includes('\"')\n ) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n}\n\nexport type TextColumn<Row> = {\n title: string;\n value: (row: Row) => string;\n};\n\n/** Renders a range as delimited text, optionally with a header line. */\nexport function buildRangeText<Row>(\n range: CellRange | null,\n columns: TextColumn<Row>[],\n rows: Row[],\n delimiter: string,\n includeHeaders: boolean,\n): string {\n if (!range) return \"\";\n const lines: string[] = [];\n\n if (includeHeaders) {\n const header: string[] = [];\n for (let c = range.c1; c <= range.c2; c++) {\n header.push(escapeCell(columns[c]?.title, delimiter));\n }\n lines.push(header.join(delimiter));\n }\n\n for (let r = range.r1; r <= range.r2; r++) {\n const line: string[] = [];\n const row = rows[r];\n for (let c = range.c1; c <= range.c2; c++) {\n const column = columns[c];\n line.push(\n escapeCell(\n column && row !== undefined ? column.value(row) : \"\",\n delimiter,\n ),\n );\n }\n lines.push(line.join(delimiter));\n }\n\n return lines.join(\"\\n\");\n}\n\n/** The whole grid, or null when there is nothing to select. */\nexport function fullRange<Row>(\n columns: TextColumn<Row>[],\n rows: Row[],\n): CellRange | null {\n if (!rows.length || !columns.length) return null;\n return { r1: 0, r2: rows.length - 1, c1: 0, c2: columns.length - 1 };\n}\n\n/** \"3 × 2 selected\" — what the toolbar reports back to the user. */\nexport function describeRange(range: CellRange | null): string {\n if (!range) return \"No selection\";\n const rowCount = range.r2 - range.r1 + 1;\n const colCount = range.c2 - range.c1 + 1;\n if (rowCount === 1 && colCount === 1) return \"1 cell selected\";\n return `${rowCount} × ${colCount} selected`;\n}\n\nexport function countCells(range: CellRange): {\n rows: number;\n columns: number;\n} {\n return {\n rows: range.r2 - range.r1 + 1,\n columns: range.c2 - range.c1 + 1,\n };\n}\n\n/**\n * `navigator.clipboard` is unavailable on http origins and older browsers, so\n * fall back to a hidden textarea + execCommand rather than failing the copy.\n */\nexport async function writeToClipboard(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n return navigator.clipboard.writeText(text);\n }\n\n const textarea = document.createElement(\"textarea\");\n textarea.value = text;\n textarea.style.position = \"fixed\";\n textarea.style.top = \"-1000px\";\n document.body.appendChild(textarea);\n textarea.select();\n try {\n if (!document.execCommand(\"copy\")) {\n throw new Error(\"Could not write to the clipboard\");\n }\n } finally {\n document.body.removeChild(textarea);\n }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Range maths and clipboard text for the card table's spreadsheet selection.
|
|
3
|
+
*
|
|
4
|
+
* Ported from video-shorts-panel `app/src/common/components/ExcelTable.jsx`.
|
|
5
|
+
* Kept free of React and the DOM (except `writeToClipboard`) so the escaping
|
|
6
|
+
* and range rules are unit-testable.
|
|
7
|
+
*/
|
|
8
|
+
type CellRef = {
|
|
9
|
+
r: number;
|
|
10
|
+
c: number;
|
|
11
|
+
};
|
|
12
|
+
type CellRange = {
|
|
13
|
+
r1: number;
|
|
14
|
+
r2: number;
|
|
15
|
+
c1: number;
|
|
16
|
+
c2: number;
|
|
17
|
+
};
|
|
18
|
+
/** Tab for the clipboard (Excel/Sheets split on it), comma for a .csv file. */
|
|
19
|
+
declare const TSV_DELIMITER = "\t";
|
|
20
|
+
declare const CSV_DELIMITER = ",";
|
|
21
|
+
/**
|
|
22
|
+
* Anchor and focus can be dragged in any direction, so the range is whichever
|
|
23
|
+
* corners they happen to be — normalize to top-left / bottom-right.
|
|
24
|
+
*/
|
|
25
|
+
declare function normalizeRange(anchor: CellRef | null | undefined, focus: CellRef | null | undefined): CellRange | null;
|
|
26
|
+
/**
|
|
27
|
+
* A cell needs quoting once it carries the delimiters themselves — the same
|
|
28
|
+
* rule Excel uses when it parses the clipboard. Without it, a title containing
|
|
29
|
+
* a tab or a newline silently becomes extra columns or rows on paste.
|
|
30
|
+
*/
|
|
31
|
+
declare function escapeCell(raw: unknown, delimiter: string): string;
|
|
32
|
+
type TextColumn<Row> = {
|
|
33
|
+
title: string;
|
|
34
|
+
value: (row: Row) => string;
|
|
35
|
+
};
|
|
36
|
+
/** Renders a range as delimited text, optionally with a header line. */
|
|
37
|
+
declare function buildRangeText<Row>(range: CellRange | null, columns: TextColumn<Row>[], rows: Row[], delimiter: string, includeHeaders: boolean): string;
|
|
38
|
+
/** The whole grid, or null when there is nothing to select. */
|
|
39
|
+
declare function fullRange<Row>(columns: TextColumn<Row>[], rows: Row[]): CellRange | null;
|
|
40
|
+
/** "3 × 2 selected" — what the toolbar reports back to the user. */
|
|
41
|
+
declare function describeRange(range: CellRange | null): string;
|
|
42
|
+
declare function countCells(range: CellRange): {
|
|
43
|
+
rows: number;
|
|
44
|
+
columns: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* `navigator.clipboard` is unavailable on http origins and older browsers, so
|
|
48
|
+
* fall back to a hidden textarea + execCommand rather than failing the copy.
|
|
49
|
+
*/
|
|
50
|
+
declare function writeToClipboard(text: string): Promise<void>;
|
|
51
|
+
|
|
52
|
+
export { CSV_DELIMITER, type CellRange, type CellRef, TSV_DELIMITER, type TextColumn, buildRangeText, countCells, describeRange, escapeCell, fullRange, normalizeRange, writeToClipboard };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Range maths and clipboard text for the card table's spreadsheet selection.
|
|
3
|
+
*
|
|
4
|
+
* Ported from video-shorts-panel `app/src/common/components/ExcelTable.jsx`.
|
|
5
|
+
* Kept free of React and the DOM (except `writeToClipboard`) so the escaping
|
|
6
|
+
* and range rules are unit-testable.
|
|
7
|
+
*/
|
|
8
|
+
type CellRef = {
|
|
9
|
+
r: number;
|
|
10
|
+
c: number;
|
|
11
|
+
};
|
|
12
|
+
type CellRange = {
|
|
13
|
+
r1: number;
|
|
14
|
+
r2: number;
|
|
15
|
+
c1: number;
|
|
16
|
+
c2: number;
|
|
17
|
+
};
|
|
18
|
+
/** Tab for the clipboard (Excel/Sheets split on it), comma for a .csv file. */
|
|
19
|
+
declare const TSV_DELIMITER = "\t";
|
|
20
|
+
declare const CSV_DELIMITER = ",";
|
|
21
|
+
/**
|
|
22
|
+
* Anchor and focus can be dragged in any direction, so the range is whichever
|
|
23
|
+
* corners they happen to be — normalize to top-left / bottom-right.
|
|
24
|
+
*/
|
|
25
|
+
declare function normalizeRange(anchor: CellRef | null | undefined, focus: CellRef | null | undefined): CellRange | null;
|
|
26
|
+
/**
|
|
27
|
+
* A cell needs quoting once it carries the delimiters themselves — the same
|
|
28
|
+
* rule Excel uses when it parses the clipboard. Without it, a title containing
|
|
29
|
+
* a tab or a newline silently becomes extra columns or rows on paste.
|
|
30
|
+
*/
|
|
31
|
+
declare function escapeCell(raw: unknown, delimiter: string): string;
|
|
32
|
+
type TextColumn<Row> = {
|
|
33
|
+
title: string;
|
|
34
|
+
value: (row: Row) => string;
|
|
35
|
+
};
|
|
36
|
+
/** Renders a range as delimited text, optionally with a header line. */
|
|
37
|
+
declare function buildRangeText<Row>(range: CellRange | null, columns: TextColumn<Row>[], rows: Row[], delimiter: string, includeHeaders: boolean): string;
|
|
38
|
+
/** The whole grid, or null when there is nothing to select. */
|
|
39
|
+
declare function fullRange<Row>(columns: TextColumn<Row>[], rows: Row[]): CellRange | null;
|
|
40
|
+
/** "3 × 2 selected" — what the toolbar reports back to the user. */
|
|
41
|
+
declare function describeRange(range: CellRange | null): string;
|
|
42
|
+
declare function countCells(range: CellRange): {
|
|
43
|
+
rows: number;
|
|
44
|
+
columns: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* `navigator.clipboard` is unavailable on http origins and older browsers, so
|
|
48
|
+
* fall back to a hidden textarea + execCommand rather than failing the copy.
|
|
49
|
+
*/
|
|
50
|
+
declare function writeToClipboard(text: string): Promise<void>;
|
|
51
|
+
|
|
52
|
+
export { CSV_DELIMITER, type CellRange, type CellRef, TSV_DELIMITER, type TextColumn, buildRangeText, countCells, describeRange, escapeCell, fullRange, normalizeRange, writeToClipboard };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CSV_DELIMITER,
|
|
3
|
+
TSV_DELIMITER,
|
|
4
|
+
buildRangeText,
|
|
5
|
+
countCells,
|
|
6
|
+
describeRange,
|
|
7
|
+
escapeCell,
|
|
8
|
+
fullRange,
|
|
9
|
+
normalizeRange,
|
|
10
|
+
writeToClipboard
|
|
11
|
+
} from "./chunk-Y5WCT6XN.js";
|
|
12
|
+
export {
|
|
13
|
+
CSV_DELIMITER,
|
|
14
|
+
TSV_DELIMITER,
|
|
15
|
+
buildRangeText,
|
|
16
|
+
countCells,
|
|
17
|
+
describeRange,
|
|
18
|
+
escapeCell,
|
|
19
|
+
fullRange,
|
|
20
|
+
normalizeRange,
|
|
21
|
+
writeToClipboard
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=clipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
"use client";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// src/collapsible.tsx
|
|
33
|
+
var collapsible_exports = {};
|
|
34
|
+
__export(collapsible_exports, {
|
|
35
|
+
CollapsibleSection: () => CollapsibleSection
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(collapsible_exports);
|
|
38
|
+
var import_lucide_react = require("lucide-react");
|
|
39
|
+
var React = __toESM(require("react"), 1);
|
|
40
|
+
|
|
41
|
+
// src/utils.ts
|
|
42
|
+
var import_clsx = require("clsx");
|
|
43
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
44
|
+
function cn(...inputs) {
|
|
45
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/collapsible.tsx
|
|
49
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
+
function CollapsibleSection({
|
|
51
|
+
title,
|
|
52
|
+
icon,
|
|
53
|
+
defaultOpen = true,
|
|
54
|
+
right,
|
|
55
|
+
className,
|
|
56
|
+
children
|
|
57
|
+
}) {
|
|
58
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
59
|
+
const bodyId = React.useId();
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: cn("border-border rounded-lg border", className), children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
type: "button",
|
|
65
|
+
"aria-expanded": open,
|
|
66
|
+
"aria-controls": bodyId,
|
|
67
|
+
onClick: () => setOpen((current) => !current),
|
|
68
|
+
className: "hover:bg-muted/50 flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm font-semibold transition",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
import_lucide_react.ChevronDown,
|
|
72
|
+
{
|
|
73
|
+
size: 14,
|
|
74
|
+
"aria-hidden": true,
|
|
75
|
+
className: cn(
|
|
76
|
+
"shrink-0 transition-transform",
|
|
77
|
+
open ? "" : "-rotate-90"
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
icon,
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "flex-1", children: title }),
|
|
83
|
+
right
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: bodyId, hidden: !open, className: "space-y-3 px-3 pt-1 pb-3", children })
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
CollapsibleSection
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=collapsible.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/collapsible.tsx","../src/utils.ts"],"sourcesContent":["\"use client\";\n\nimport { ChevronDown } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { cn } from \"./utils\";\n\n/**\n * A titled section that folds away.\n *\n * For sidebar panels that are long but not always in use — the body stays\n * mounted so its state (a loaded list, a half-filled filter) survives being\n * collapsed, rather than being thrown away and refetched on the way back.\n */\nexport function CollapsibleSection({\n title,\n icon,\n defaultOpen = true,\n right,\n className,\n children,\n}: {\n title: string;\n /** Optional leading glyph, shown between the chevron and the title. */\n icon?: React.ReactNode;\n defaultOpen?: boolean;\n /** Optional trailing content in the header, e.g. a count. */\n right?: React.ReactNode;\n className?: string;\n children: React.ReactNode;\n}) {\n const [open, setOpen] = React.useState(defaultOpen);\n const bodyId = React.useId();\n\n return (\n <div className={cn(\"border-border rounded-lg border\", className)}>\n <button\n type=\"button\"\n aria-expanded={open}\n aria-controls={bodyId}\n onClick={() => setOpen((current) => !current)}\n className=\"hover:bg-muted/50 flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm font-semibold transition\"\n >\n <ChevronDown\n size={14}\n aria-hidden\n className={cn(\n \"shrink-0 transition-transform\",\n open ? \"\" : \"-rotate-90\",\n )}\n />\n {icon}\n <span className=\"flex-1\">{title}</span>\n {right}\n </button>\n {/* Hidden rather than unmounted, so collapsing does not discard the\n panel's state or refetch what it had already loaded. */}\n <div id={bodyId} hidden={!open} className=\"space-y-3 px-3 pt-1 pb-3\">\n {children}\n </div>\n </div>\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA4B;AAC5B,YAAuB;;;ACHvB,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;AD+BM;AAtBC,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AACF,GASG;AACD,QAAM,CAAC,MAAM,OAAO,IAAU,eAAS,WAAW;AAClD,QAAM,SAAe,YAAM;AAE3B,SACE,6CAAC,SAAI,WAAW,GAAG,mCAAmC,SAAS,GAC7D;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,iBAAe;AAAA,QACf,SAAS,MAAM,QAAQ,CAAC,YAAY,CAAC,OAAO;AAAA,QAC5C,WAAU;AAAA,QAEV;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAM;AAAA,cACN,eAAW;AAAA,cACX,WAAW;AAAA,gBACT;AAAA,gBACA,OAAO,KAAK;AAAA,cACd;AAAA;AAAA,UACF;AAAA,UACC;AAAA,UACD,4CAAC,UAAK,WAAU,UAAU,iBAAM;AAAA,UAC/B;AAAA;AAAA;AAAA,IACH;AAAA,IAGA,4CAAC,SAAI,IAAI,QAAQ,QAAQ,CAAC,MAAM,WAAU,4BACvC,UACH;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A titled section that folds away.
|
|
5
|
+
*
|
|
6
|
+
* For sidebar panels that are long but not always in use — the body stays
|
|
7
|
+
* mounted so its state (a loaded list, a half-filled filter) survives being
|
|
8
|
+
* collapsed, rather than being thrown away and refetched on the way back.
|
|
9
|
+
*/
|
|
10
|
+
declare function CollapsibleSection({ title, icon, defaultOpen, right, className, children, }: {
|
|
11
|
+
title: string;
|
|
12
|
+
/** Optional leading glyph, shown between the chevron and the title. */
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
defaultOpen?: boolean;
|
|
15
|
+
/** Optional trailing content in the header, e.g. a count. */
|
|
16
|
+
right?: React.ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { CollapsibleSection };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A titled section that folds away.
|
|
5
|
+
*
|
|
6
|
+
* For sidebar panels that are long but not always in use — the body stays
|
|
7
|
+
* mounted so its state (a loaded list, a half-filled filter) survives being
|
|
8
|
+
* collapsed, rather than being thrown away and refetched on the way back.
|
|
9
|
+
*/
|
|
10
|
+
declare function CollapsibleSection({ title, icon, defaultOpen, right, className, children, }: {
|
|
11
|
+
title: string;
|
|
12
|
+
/** Optional leading glyph, shown between the chevron and the title. */
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
defaultOpen?: boolean;
|
|
15
|
+
/** Optional trailing content in the header, e.g. a count. */
|
|
16
|
+
right?: React.ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { CollapsibleSection };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|