@malloy-publisher/sdk 0.9.13 → 0.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RenderedResult-BClN_PG6.cjs.js +154 -0
- package/dist/{RenderedResult-DnBtf-cI.es.js → RenderedResult-YBzVMVH2.es.js} +295 -234
- package/dist/{ServerProvider-BV7IoDMR.es.js → ServerProvider-D7neZcTk.es.js} +283 -265
- package/dist/ServerProvider-e2369oom.cjs.js +1 -0
- package/dist/builder/index.cjs.js +80 -79
- package/dist/builder/index.es.js +7430 -6548
- package/dist/client/api.d.ts +30 -6
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/Dashboard/DashboardGrid.d.ts +49 -1
- package/dist/components/Dashboard/DashboardTile.d.ts +5 -2
- package/dist/components/Dashboard/DashboardView.d.ts +9 -2
- package/dist/components/Dashboard/index.d.ts +1 -1
- package/dist/components/Dashboard/promoteMeasureRow.d.ts +5 -7
- package/dist/components/Dashboard/useStuck.d.ts +18 -12
- package/dist/components/RenderedResult/RenderedResult.d.ts +3 -2
- package/dist/components/RenderedResult/ResultContainer.d.ts +11 -1
- package/dist/components/RenderedResult/ResultPanel.d.ts +5 -1
- package/dist/components/RenderedResult/chartPresentation.d.ts +15 -0
- package/dist/components/RenderedResult/chartShapeProblem.d.ts +55 -0
- package/dist/components/RenderedResult/resultSizing.d.ts +42 -6
- package/dist/components/Report/Report.d.ts +7 -1
- package/dist/components/Report/ReportPage.d.ts +7 -0
- package/dist/components/Report/layoutRules.d.ts +45 -0
- package/dist/components/ReportBuilder/AddTileDialog.d.ts +2 -1
- package/dist/components/ReportBuilder/BuilderGrid.d.ts +14 -1
- package/dist/components/ReportBuilder/ChartPicker.d.ts +4 -2
- package/dist/components/ReportBuilder/EditorSurface.d.ts +17 -1
- package/dist/components/ReportBuilder/ReportEditor.d.ts +18 -0
- package/dist/components/ReportBuilder/TileFrame.d.ts +33 -1
- package/dist/components/ReportBuilder/TileMenu.d.ts +5 -2
- package/dist/components/ReportBuilder/catalog.d.ts +23 -0
- package/dist/components/ReportBuilder/chartLine.d.ts +38 -5
- package/dist/components/ReportBuilder/controls.d.ts +2 -2
- package/dist/components/ReportBuilder/document.d.ts +53 -5
- package/dist/components/ReportBuilder/imports.d.ts +7 -0
- package/dist/components/ReportBuilder/placement.d.ts +75 -0
- package/dist/components/ReportBuilder/preview.d.ts +59 -10
- package/dist/components/ReportBuilder/sortable.d.ts +3 -1
- package/dist/components/ReportBuilder/useTileHeight.d.ts +39 -0
- package/dist/components/ReportBuilder/useTileReorder.d.ts +27 -3
- package/dist/components/ReportBuilder/useTileResize.d.ts +8 -0
- package/dist/index.cjs.js +7 -7
- package/dist/index.es.js +3328 -3287
- package/dist/text/index.es.js +1 -1
- package/dist/{text-entry-72YFLeNk.es.js → text-entry-YKJZbRPo.es.js} +2 -2
- package/dist/theme/resolveTheme.d.ts +15 -0
- package/dist/{useCompiledDocument-B4QF1mIl.es.js → useCompiledDocument-BGk38oaW.es.js} +5097 -4805
- package/dist/useCompiledDocument-D9t5ry_t.cjs.js +142 -0
- package/dist/utils/blankQuoted.d.ts +15 -0
- package/package.json +1 -1
- package/src/components/Dashboard/DashboardGrid.tsx +127 -10
- package/src/components/Dashboard/DashboardTile.tsx +11 -1
- package/src/components/Dashboard/DashboardView.tsx +63 -10
- package/src/components/Dashboard/TileCard.tsx +6 -0
- package/src/components/Dashboard/index.ts +1 -0
- package/src/components/Dashboard/promoteMeasureRow.spec.ts +19 -0
- package/src/components/Dashboard/promoteMeasureRow.ts +15 -36
- package/src/components/Dashboard/tileHeight.spec.ts +72 -0
- package/src/components/Dashboard/useStuck.ts +76 -28
- package/src/components/Package/NewDocumentDialog.spec.tsx +20 -16
- package/src/components/Package/NewDocumentDialog.tsx +10 -11
- package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +167 -2
- package/src/components/RenderedResult/RenderedResult.tsx +21 -6
- package/src/components/RenderedResult/ResultContainer.tsx +60 -7
- package/src/components/RenderedResult/ResultPanel.tsx +21 -1
- package/src/components/RenderedResult/chartPresentation.spec.ts +153 -0
- package/src/components/RenderedResult/chartPresentation.ts +166 -0
- package/src/components/RenderedResult/chartShapeProblem.spec.tsx +245 -0
- package/src/components/RenderedResult/chartShapeProblem.ts +219 -0
- package/src/components/RenderedResult/resultSizing.spec.ts +75 -3
- package/src/components/RenderedResult/resultSizing.ts +65 -11
- package/src/components/Report/Report.spec.tsx +19 -0
- package/src/components/Report/Report.tsx +8 -1
- package/src/components/Report/ReportPage.tsx +13 -1
- package/src/components/Report/layoutRules.spec.ts +43 -3
- package/src/components/Report/layoutRules.ts +70 -0
- package/src/components/Report/tileOverflow.spec.tsx +162 -0
- package/src/components/ReportBuilder/AddTileDialog.spec.tsx +2 -2
- package/src/components/ReportBuilder/AddTileDialog.tsx +11 -6
- package/src/components/ReportBuilder/BuilderBar.tsx +1 -1
- package/src/components/ReportBuilder/BuilderDialogs.tsx +20 -0
- package/src/components/ReportBuilder/BuilderGrid.tsx +126 -20
- package/src/components/ReportBuilder/ChartPicker.spec.ts +91 -4
- package/src/components/ReportBuilder/ChartPicker.tsx +45 -10
- package/src/components/ReportBuilder/DrillDialog.tsx +8 -2
- package/src/components/ReportBuilder/EditorSurface.tsx +110 -28
- package/src/components/ReportBuilder/FilterDialog.tsx +17 -8
- package/src/components/ReportBuilder/FilterStrip.tsx +2 -1
- package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +193 -2
- package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +4 -2
- package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +2 -2
- package/src/components/ReportBuilder/ReportBuilder.spec.tsx +143 -2
- package/src/components/ReportBuilder/ReportBuilder.tsx +73 -19
- package/src/components/ReportBuilder/ReportEditor.fileModel.spec.tsx +178 -0
- package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +3 -5
- package/src/components/ReportBuilder/ReportEditor.queryVersion.spec.tsx +292 -0
- package/src/components/ReportBuilder/ReportEditor.readOnlyTitle.spec.tsx +92 -0
- package/src/components/ReportBuilder/ReportEditor.tsx +35 -0
- package/src/components/ReportBuilder/TileFrame.tsx +251 -6
- package/src/components/ReportBuilder/TileMenu.tsx +259 -20
- package/src/components/ReportBuilder/ViewPicker.tsx +4 -3
- package/src/components/ReportBuilder/addTileToDocument.spec.ts +34 -0
- package/src/components/ReportBuilder/addTileToDocument.ts +26 -1
- package/src/components/ReportBuilder/catalog.aggregate.spec.ts +137 -1
- package/src/components/ReportBuilder/catalog.ts +90 -37
- package/src/components/ReportBuilder/chartLine.spec.ts +42 -5
- package/src/components/ReportBuilder/chartLine.ts +80 -2
- package/src/components/ReportBuilder/controls.ts +4 -3
- package/src/components/ReportBuilder/document.ts +65 -7
- package/src/components/ReportBuilder/emptyStart.spec.ts +1 -1
- package/src/components/ReportBuilder/entryLayout.spec.ts +151 -0
- package/src/components/ReportBuilder/imports.ts +1 -1
- package/src/components/ReportBuilder/invariants.spec.ts +18 -10
- package/src/components/ReportBuilder/layout.ts +3 -0
- package/src/components/ReportBuilder/placement.spec.ts +193 -0
- package/src/components/ReportBuilder/placement.ts +250 -0
- package/src/components/ReportBuilder/preview.shapes.spec.ts +46 -6
- package/src/components/ReportBuilder/preview.spec.ts +151 -11
- package/src/components/ReportBuilder/preview.ts +203 -40
- package/src/components/ReportBuilder/preview.unsaved.compile.spec.ts +190 -0
- package/src/components/ReportBuilder/readDocument.spec.ts +46 -2
- package/src/components/ReportBuilder/readDocument.ts +194 -23
- package/src/components/ReportBuilder/scannerShapes.spec.ts +10 -10
- package/src/components/ReportBuilder/sortable.tsx +4 -0
- package/src/components/ReportBuilder/spliceDocument.chart.spec.ts +1 -1
- package/src/components/ReportBuilder/spliceDocument.color.spec.ts +80 -0
- package/src/components/ReportBuilder/spliceDocument.colspan.spec.ts +78 -0
- package/src/components/ReportBuilder/spliceDocument.spec.ts +110 -18
- package/src/components/ReportBuilder/spliceDocument.ts +139 -52
- package/src/components/ReportBuilder/statementExtent.spec.ts +3 -3
- package/src/components/ReportBuilder/testing/reportGivenOrder.json +42 -0
- package/src/components/ReportBuilder/textTiles.spec.ts +2 -2
- package/src/components/ReportBuilder/tileDisplayTitle.ts +2 -2
- package/src/components/ReportBuilder/useTileEditing.ts +16 -3
- package/src/components/ReportBuilder/useTileHeight.ts +149 -0
- package/src/components/ReportBuilder/useTileReorder.ts +143 -6
- package/src/components/ReportBuilder/useTileResize.ts +16 -1
- package/src/components/given/FilterButton.spec.tsx +27 -11
- package/src/components/given/FilterButton.tsx +19 -6
- package/src/theme/resolveTheme.spec.ts +72 -1
- package/src/theme/resolveTheme.ts +43 -0
- package/src/utils/blankQuoted.spec.ts +50 -0
- package/src/utils/blankQuoted.ts +32 -0
- package/src/utils/malloyText.ts +2 -1
- package/dist/RenderedResult-DtQtNV0d.cjs.js +0 -153
- package/dist/ServerProvider-BIFPCzTD.cjs.js +0 -1
- package/dist/useCompiledDocument-D0OAMejE.cjs.js +0 -142
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
} from "../RemoveBadge";
|
|
17
17
|
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
18
18
|
import type { ResolvedTheme } from "../../theme/types";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
BARE_RING_OFFSET_PX,
|
|
21
|
+
GRID_GAP_PX,
|
|
22
|
+
MAX_TILE_ROWS,
|
|
23
|
+
TILE_ROW_PX,
|
|
24
|
+
} from "../Dashboard/DashboardGrid";
|
|
20
25
|
import {
|
|
21
26
|
TILE_HEADING_CLASS,
|
|
22
27
|
TileCard,
|
|
@@ -27,6 +32,7 @@ import {
|
|
|
27
32
|
import { tileDisplayTitle } from "./tileDisplayTitle";
|
|
28
33
|
import {
|
|
29
34
|
isTextTile,
|
|
35
|
+
tileExpression,
|
|
30
36
|
tileKey,
|
|
31
37
|
tileLabel,
|
|
32
38
|
type DashboardTile,
|
|
@@ -59,6 +65,8 @@ export function TileFrame({
|
|
|
59
65
|
onResizeStart,
|
|
60
66
|
onResizeMove,
|
|
61
67
|
onResizeEnd,
|
|
68
|
+
heightEdge,
|
|
69
|
+
fixed = false,
|
|
62
70
|
children,
|
|
63
71
|
}: {
|
|
64
72
|
tile: DashboardTile;
|
|
@@ -92,14 +100,36 @@ export function TileFrame({
|
|
|
92
100
|
width?: {
|
|
93
101
|
span: number;
|
|
94
102
|
columns: number;
|
|
103
|
+
/** The widest it may go, when that is less than the grid: a placed tile stops at the right edge. */
|
|
104
|
+
max?: number;
|
|
95
105
|
onStep: (to: number) => void;
|
|
96
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* The bottom edge, which sets the height in grid rows: dragged, or focused
|
|
109
|
+
* and stepped with the arrow keys. Delete or a double-click puts the tile
|
|
110
|
+
* back to fitting its content. Absent, the tile has no bottom handle.
|
|
111
|
+
*/
|
|
112
|
+
/** The tile cannot be moved now (the grid is drawn as one column). */
|
|
113
|
+
fixed?: boolean;
|
|
114
|
+
heightEdge?: {
|
|
115
|
+
/** Its rows: the set height, or the drag's preview; absent on auto, as tall as its row. */
|
|
116
|
+
rows: number | undefined;
|
|
117
|
+
/** This edge is being dragged. */
|
|
118
|
+
dragging: boolean;
|
|
119
|
+
/** The fewest rows offered: a chart's floor, or prose's. */
|
|
120
|
+
min: number;
|
|
121
|
+
onStart: (event: PointerEvent<HTMLDivElement>) => void;
|
|
122
|
+
onMove: (event: PointerEvent<HTMLDivElement>) => void;
|
|
123
|
+
onEnd: (event: PointerEvent<HTMLDivElement>) => void;
|
|
124
|
+
/** A keyboard step, or `undefined` to fit the content again. */
|
|
125
|
+
onStep: (to: number | undefined) => void;
|
|
126
|
+
};
|
|
97
127
|
children: ReactNode;
|
|
98
128
|
}) {
|
|
99
129
|
const { theme } = usePublisherTheme();
|
|
100
130
|
const ui = theme.ui;
|
|
101
131
|
return (
|
|
102
|
-
<TileSortable id={tileKey(tile)} index={index}>
|
|
132
|
+
<TileSortable id={tileKey(tile)} index={index} disabled={fixed}>
|
|
103
133
|
{({ ref, handleRef }) => (
|
|
104
134
|
<Box
|
|
105
135
|
ref={ref}
|
|
@@ -130,6 +160,14 @@ export function TileFrame({
|
|
|
130
160
|
// pass the height on rather than shrink to
|
|
131
161
|
// the tile.
|
|
132
162
|
display: "grid",
|
|
163
|
+
// A set height holds the row too, so the tile
|
|
164
|
+
// shrinks to it rather than the row growing to
|
|
165
|
+
// the tile's content.
|
|
166
|
+
...((tile.rowspan !== undefined ||
|
|
167
|
+
tile.row !== undefined) && {
|
|
168
|
+
gridTemplateRows: "minmax(0, 1fr)",
|
|
169
|
+
minHeight: 0,
|
|
170
|
+
}),
|
|
133
171
|
// And the WIDTH the other way: it must
|
|
134
172
|
// follow the grid item down when a tile is
|
|
135
173
|
// narrowed, not stay as wide as the chart
|
|
@@ -279,7 +317,7 @@ export function TileFrame({
|
|
|
279
317
|
? {
|
|
280
318
|
"aria-valuenow": width.span,
|
|
281
319
|
"aria-valuemin": 1,
|
|
282
|
-
"aria-valuemax": width.columns,
|
|
320
|
+
"aria-valuemax": width.max ?? width.columns,
|
|
283
321
|
"aria-valuetext": `${width.span} of ${width.columns} columns`,
|
|
284
322
|
}
|
|
285
323
|
: {})}
|
|
@@ -293,13 +331,18 @@ export function TileFrame({
|
|
|
293
331
|
: event.key === "Home"
|
|
294
332
|
? 1
|
|
295
333
|
: event.key === "End"
|
|
296
|
-
? width.columns
|
|
334
|
+
? (width.max ?? width.columns)
|
|
297
335
|
: undefined;
|
|
298
336
|
if (to === undefined) return;
|
|
299
337
|
// The builder's own arrow-key nudge must not step it again.
|
|
300
338
|
event.preventDefault();
|
|
301
339
|
event.stopPropagation();
|
|
302
|
-
width.onStep(
|
|
340
|
+
width.onStep(
|
|
341
|
+
Math.min(
|
|
342
|
+
Math.max(to, 1),
|
|
343
|
+
width.max ?? width.columns,
|
|
344
|
+
),
|
|
345
|
+
);
|
|
303
346
|
}}
|
|
304
347
|
onPointerDown={onResizeStart}
|
|
305
348
|
onPointerMove={onResizeMove}
|
|
@@ -413,6 +456,14 @@ export function TileFrame({
|
|
|
413
456
|
</Box>
|
|
414
457
|
)}
|
|
415
458
|
|
|
459
|
+
{heightEdge && (
|
|
460
|
+
<HeightEdge
|
|
461
|
+
edge={heightEdge}
|
|
462
|
+
label={tileLabel(tile)}
|
|
463
|
+
selected={selected}
|
|
464
|
+
/>
|
|
465
|
+
)}
|
|
466
|
+
|
|
416
467
|
{onInsertAfter && (
|
|
417
468
|
<IconButton
|
|
418
469
|
className="builder-affordance"
|
|
@@ -584,7 +635,7 @@ export function TilePlaceholder({
|
|
|
584
635
|
variant="caption"
|
|
585
636
|
sx={{ display: "block", color: theme.tileTitle, opacity: 0.7 }}
|
|
586
637
|
>
|
|
587
|
-
{tile.
|
|
638
|
+
{tileExpression(tile).replace("->", "→")}
|
|
588
639
|
</Typography>
|
|
589
640
|
</TileCard>
|
|
590
641
|
);
|
|
@@ -657,6 +708,49 @@ export function GridGuides({ columns }: { columns: number }) {
|
|
|
657
708
|
);
|
|
658
709
|
}
|
|
659
710
|
|
|
711
|
+
/**
|
|
712
|
+
* The rows a height snaps to, drawn while a tile's bottom edge is dragged: a
|
|
713
|
+
* faint band per row across the whole canvas, the way {@link GridGuides}
|
|
714
|
+
* draws the columns a width snaps to. Rows are counted from the dragged
|
|
715
|
+
* tile's top, since tiles flow and the grid has no row lines of its own.
|
|
716
|
+
* Behind the tiles and held inside the grid.
|
|
717
|
+
*/
|
|
718
|
+
export function RowGuides({ top }: { top: number }) {
|
|
719
|
+
const { theme } = usePublisherTheme();
|
|
720
|
+
const step = TILE_ROW_PX + GRID_GAP_PX;
|
|
721
|
+
// From the first whole row above the canvas's top edge to well past its
|
|
722
|
+
// bottom; the container clips what overshoots.
|
|
723
|
+
const first = -Math.ceil(top / step);
|
|
724
|
+
return (
|
|
725
|
+
<Box
|
|
726
|
+
aria-hidden
|
|
727
|
+
sx={{
|
|
728
|
+
position: "absolute",
|
|
729
|
+
inset: 0,
|
|
730
|
+
overflow: "hidden",
|
|
731
|
+
pointerEvents: "none",
|
|
732
|
+
zIndex: 0,
|
|
733
|
+
}}
|
|
734
|
+
>
|
|
735
|
+
{Array.from({ length: -first + 4 * MAX_TILE_ROWS }, (_, n) => (
|
|
736
|
+
<Box
|
|
737
|
+
key={n}
|
|
738
|
+
sx={{
|
|
739
|
+
position: "absolute",
|
|
740
|
+
top: top + (first + n) * step,
|
|
741
|
+
left: 0,
|
|
742
|
+
right: 0,
|
|
743
|
+
height: TILE_ROW_PX,
|
|
744
|
+
bgcolor: theme.accent,
|
|
745
|
+
opacity: 0.06,
|
|
746
|
+
borderRadius: "3px",
|
|
747
|
+
}}
|
|
748
|
+
/>
|
|
749
|
+
))}
|
|
750
|
+
</Box>
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
|
|
660
754
|
/**
|
|
661
755
|
* The tile menu's ⋯, with its dots spread wider than the stock icon's so it
|
|
662
756
|
* reads as three dots rather than a dash at this size.
|
|
@@ -670,3 +764,154 @@ function SpreadDotsIcon() {
|
|
|
670
764
|
</SvgIcon>
|
|
671
765
|
);
|
|
672
766
|
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* A tile's bottom edge: the height handle, laid out like the width handle
|
|
770
|
+
* turned on its side, so the two read as one control.
|
|
771
|
+
*/
|
|
772
|
+
function HeightEdge({
|
|
773
|
+
edge,
|
|
774
|
+
label,
|
|
775
|
+
selected,
|
|
776
|
+
}: {
|
|
777
|
+
edge: NonNullable<Parameters<typeof TileFrame>[0]["heightEdge"]>;
|
|
778
|
+
label: string;
|
|
779
|
+
selected: boolean;
|
|
780
|
+
}) {
|
|
781
|
+
const { theme } = usePublisherTheme();
|
|
782
|
+
const ui = theme.ui;
|
|
783
|
+
const { rows, dragging } = edge;
|
|
784
|
+
const fit = rows === undefined;
|
|
785
|
+
return (
|
|
786
|
+
<Box
|
|
787
|
+
className="builder-affordance"
|
|
788
|
+
{...{ [NO_DRAG]: "" }}
|
|
789
|
+
role="separator"
|
|
790
|
+
tabIndex={0}
|
|
791
|
+
aria-orientation="horizontal"
|
|
792
|
+
aria-label={`Height of ${label}`}
|
|
793
|
+
aria-valuemin={edge.min}
|
|
794
|
+
aria-valuemax={MAX_TILE_ROWS}
|
|
795
|
+
{...(fit ? {} : { "aria-valuenow": rows })}
|
|
796
|
+
aria-valuetext={heightLabel(rows)}
|
|
797
|
+
onKeyDown={(event) => {
|
|
798
|
+
const now = rows ?? edge.min;
|
|
799
|
+
const to =
|
|
800
|
+
event.key === "ArrowDown"
|
|
801
|
+
? now + 1
|
|
802
|
+
: event.key === "ArrowUp"
|
|
803
|
+
? now - 1
|
|
804
|
+
: event.key === "Home"
|
|
805
|
+
? edge.min
|
|
806
|
+
: event.key === "End"
|
|
807
|
+
? MAX_TILE_ROWS
|
|
808
|
+
: event.key === "Delete" || event.key === "Backspace"
|
|
809
|
+
? null
|
|
810
|
+
: undefined;
|
|
811
|
+
if (to === undefined) return;
|
|
812
|
+
// The builder's own arrow-key nudge must not act on it too.
|
|
813
|
+
event.preventDefault();
|
|
814
|
+
event.stopPropagation();
|
|
815
|
+
if (to === null) {
|
|
816
|
+
if (!fit) edge.onStep(undefined);
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const held = Math.min(Math.max(to, edge.min), MAX_TILE_ROWS);
|
|
820
|
+
if (held !== rows) edge.onStep(held);
|
|
821
|
+
}}
|
|
822
|
+
onPointerDown={edge.onStart}
|
|
823
|
+
onPointerMove={edge.onMove}
|
|
824
|
+
onPointerUp={edge.onEnd}
|
|
825
|
+
onPointerCancel={edge.onEnd}
|
|
826
|
+
onClick={(event) => event.stopPropagation()}
|
|
827
|
+
onDoubleClick={(event) => {
|
|
828
|
+
event.stopPropagation();
|
|
829
|
+
if (!fit) edge.onStep(undefined);
|
|
830
|
+
}}
|
|
831
|
+
sx={(mui) => ({
|
|
832
|
+
position: "absolute",
|
|
833
|
+
left: 0,
|
|
834
|
+
right: 0,
|
|
835
|
+
// Straddles the edge, as the width handle does.
|
|
836
|
+
bottom: "-8px",
|
|
837
|
+
height: "16px",
|
|
838
|
+
cursor: "row-resize",
|
|
839
|
+
touchAction: "none",
|
|
840
|
+
zIndex: 2,
|
|
841
|
+
opacity: dragging || selected ? 1 : 0,
|
|
842
|
+
transition: `opacity ${MOTION_FAST}`,
|
|
843
|
+
...reducedMotionSx,
|
|
844
|
+
"&:hover": { opacity: 1 },
|
|
845
|
+
"&:focus-visible": {
|
|
846
|
+
opacity: 1,
|
|
847
|
+
outline: `2px solid ${theme.accent}`,
|
|
848
|
+
outlineOffset: 1,
|
|
849
|
+
borderRadius: "3px",
|
|
850
|
+
},
|
|
851
|
+
"&::before": {
|
|
852
|
+
content: '""',
|
|
853
|
+
position: "absolute",
|
|
854
|
+
top: "50%",
|
|
855
|
+
left: "50%",
|
|
856
|
+
transform: "translate(-50%, -50%)",
|
|
857
|
+
width: "40px",
|
|
858
|
+
height: "12px",
|
|
859
|
+
boxSizing: "border-box",
|
|
860
|
+
borderRadius: ui.radius.control,
|
|
861
|
+
border: `1px solid ${
|
|
862
|
+
dragging ? theme.accent : edgeColor(theme.cardBorder)
|
|
863
|
+
}`,
|
|
864
|
+
bgcolor: mui.palette.background.paper,
|
|
865
|
+
boxShadow:
|
|
866
|
+
"0 1px 2px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.08)",
|
|
867
|
+
transition: `border-color ${MOTION_FAST}`,
|
|
868
|
+
},
|
|
869
|
+
"&::after": {
|
|
870
|
+
content: '""',
|
|
871
|
+
position: "absolute",
|
|
872
|
+
top: "50%",
|
|
873
|
+
left: "50%",
|
|
874
|
+
transform: "translate(-50%, -50%)",
|
|
875
|
+
width: "16px",
|
|
876
|
+
height: "5px",
|
|
877
|
+
borderTop: `1.5px solid ${
|
|
878
|
+
dragging ? theme.accent : mui.palette.text.secondary
|
|
879
|
+
}`,
|
|
880
|
+
borderBottom: `1.5px solid ${
|
|
881
|
+
dragging ? theme.accent : mui.palette.text.secondary
|
|
882
|
+
}`,
|
|
883
|
+
boxSizing: "border-box",
|
|
884
|
+
opacity: dragging ? 1 : 0.7,
|
|
885
|
+
},
|
|
886
|
+
"&:hover::before": { borderColor: theme.accent },
|
|
887
|
+
"&:hover::after": { borderColor: theme.accent, opacity: 1 },
|
|
888
|
+
})}
|
|
889
|
+
>
|
|
890
|
+
{dragging && (
|
|
891
|
+
<Box
|
|
892
|
+
aria-hidden
|
|
893
|
+
sx={(mui) => ({
|
|
894
|
+
position: "absolute",
|
|
895
|
+
left: "50%",
|
|
896
|
+
bottom: "50%",
|
|
897
|
+
transform: "translate(32px, 50%)",
|
|
898
|
+
px: 1,
|
|
899
|
+
py: 0.5,
|
|
900
|
+
borderRadius: ui.radius.control,
|
|
901
|
+
bgcolor: mui.palette.text.primary,
|
|
902
|
+
color: mui.palette.background.paper,
|
|
903
|
+
...ui.type.label,
|
|
904
|
+
whiteSpace: "nowrap",
|
|
905
|
+
pointerEvents: "none",
|
|
906
|
+
})}
|
|
907
|
+
>
|
|
908
|
+
{heightLabel(rows)}
|
|
909
|
+
</Box>
|
|
910
|
+
)}
|
|
911
|
+
</Box>
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/** A height in words, for the drag's label and a screen reader. */
|
|
916
|
+
const heightLabel = (rows: number | undefined) =>
|
|
917
|
+
rows === undefined ? "Auto height" : `${rows} rows tall`;
|