@ex-grid/sheet-mantine 0.0.0-stage → 0.2.0-beta.3
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/LICENSE +21 -0
- package/README.md +43 -2
- package/dist/index.d.ts +44 -0
- package/dist/index.js +752 -0
- package/dist/index.js.map +7 -0
- package/package.json +39 -4
- package/styles.css +182 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AkiraMisawa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ex-grid/sheet-mantine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ExSheet for Mantine: the design-system Wrapper that draws ExSheet for React's Chrome, the Sheet Toolbar, Format Cells and the Sheet Tabs among it, with Mantine's components and maps its Visual Tokens onto a Mantine theme.
|
|
4
|
+
|
|
5
|
+
It is one of the packages of the ExGrid family: Excel-like grids, sheets, pivot tables and charts for reading
|
|
6
|
+
money and risk numbers, published to npm under `@ex-grid` and to NuGet for Blazor, at one shared version.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @ex-grid/sheet-mantine @mantine/core @mantine/hooks react react-dom
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`@mantine/core`, `@mantine/hooks`, `react` and `react-dom` are peer dependencies: your application provides them, at the versions `package.json` names.
|
|
15
|
+
|
|
16
|
+
It depends on exactly the version of `@ex-grid/mantine`, `@ex-grid/sheet`, `@ex-grid/sheet-engine` and `@ex-grid/sheet-react` it was built with, so upgrade the family's packages together.
|
|
17
|
+
|
|
18
|
+
What it draws reads these stylesheets. Import them once in your application, after the design system's own:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import '@ex-grid/core/styles.css';
|
|
22
|
+
import '@ex-grid/sheet/styles.css';
|
|
23
|
+
import '@ex-grid/sheet-mantine/styles.css';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Documentation
|
|
27
|
+
|
|
28
|
+
[ExSheet on the documentation site](https://akiramisawa.github.io/ex-grid/exsheet), read for React with the switch at the top, and every
|
|
29
|
+
version's [Release Notes](https://akiramisawa.github.io/ex-grid/release-notes).
|
|
30
|
+
|
|
31
|
+
> **The API may still change.** While the version is `0.x`, it may change from one version to the next; each
|
|
32
|
+
> version's Release Notes say what changed. A prerelease, a version with a suffix such as `-rc.1`, passed every
|
|
33
|
+
> test layer in CI on the commit it was built from. A version without a suffix is published only once the
|
|
34
|
+
> project's [Definition of Done](https://github.com/AkiraMisawa/ex-grid/blob/main/docs/definition-of-done.md) is
|
|
35
|
+
> signed off on it.
|
|
36
|
+
|
|
37
|
+
## Requirements
|
|
38
|
+
|
|
39
|
+
- **Chrome or Edge.** They are the supported browsers; Safari and Firefox are out of scope.
|
|
40
|
+
- **React 19.2.0 or a later 19.x.**
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExSheet for Mantine (ADR-0390): the design-system Wrapper that draws ExSheet for React's Chrome, the Sheet Toolbar,
|
|
3
|
+
* Format Cells and the Sheet Tabs among it, with Mantine's components, over ExGrid's Mantine Wrapper for the grid the
|
|
4
|
+
* Sheet is drawn by.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { CSSProperties } from 'react';
|
|
10
|
+
import type { ExSheetChrome } from '@ex-grid/sheet-react';
|
|
11
|
+
import { ExSheetProps } from '@ex-grid/sheet-react';
|
|
12
|
+
import { MantineRadius } from '@mantine/core';
|
|
13
|
+
import { MantineShadow } from '@mantine/core';
|
|
14
|
+
import { ReactElement } from 'react';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An Excel-like sheet with formulas drawn with Mantine: the Chrome slots a `chrome` prop leaves are Mantine's, the
|
|
18
|
+
* Sheet Toolbar, Format Cells and the Sheet Tabs among them, and the colours follow the theme and its scheme with no
|
|
19
|
+
* render. Needs Mantine's MantineProvider above it, and `@ex-grid/mantine/styles.css` and
|
|
20
|
+
* `@ex-grid/sheet-mantine/styles.css` loaded after Mantine's styles.
|
|
21
|
+
*/
|
|
22
|
+
export declare function MantineExSheet(props: MantineExSheetProps): ReactElement;
|
|
23
|
+
|
|
24
|
+
/** A MantineExSheet's props: an ExSheet's, and the Paper's words Mantine draws it with. */
|
|
25
|
+
export declare type MantineExSheetProps = ExSheetProps & {
|
|
26
|
+
/** The Paper's border, Mantine's `withBorder`. */
|
|
27
|
+
readonly withBorder?: boolean;
|
|
28
|
+
/** The Paper's corner radius, a theme radius or a CSS length; `0` sets the Sheet square in its Paper. */
|
|
29
|
+
readonly radius?: MantineRadius;
|
|
30
|
+
/** The Paper's shadow. */
|
|
31
|
+
readonly shadow?: MantineShadow;
|
|
32
|
+
/** A class for the Paper. */
|
|
33
|
+
readonly className?: string;
|
|
34
|
+
/** A style for the Paper. */
|
|
35
|
+
readonly style?: CSSProperties;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Every Chrome slot of a Sheet drawn in Mantine's components: ExGrid's Mantine Chrome for the grid's, and the Sheet's
|
|
39
|
+
* own. What {@link MantineExSheet} hands its Sheet. A Consumer that frames an ExSheet itself spreads it into the Sheet's
|
|
40
|
+
* `chrome`, inside an element of the classes `mantine-ex-grid mantine-ex-sheet` and a `MantineSizeContext`, as
|
|
41
|
+
* MantineExSheet draws them. */
|
|
42
|
+
export declare const mantineSheetChrome: ExSheetChrome;
|
|
43
|
+
|
|
44
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
// src/mantine-ex-sheet.ts
|
|
2
|
+
import { createElement as createElement4, useMemo } from "react";
|
|
3
|
+
import { Paper } from "@mantine/core";
|
|
4
|
+
import { MantineSizeContext as MantineSizeContext4, mantineSizeOf } from "@ex-grid/mantine";
|
|
5
|
+
import { ExSheet } from "@ex-grid/sheet-react";
|
|
6
|
+
|
|
7
|
+
// src/chrome.ts
|
|
8
|
+
import { createElement as createElement3, useContext as useContext3 } from "react";
|
|
9
|
+
import { Text as Text2 } from "@mantine/core";
|
|
10
|
+
import { MantineSizeContext as MantineSizeContext3, mantineChrome } from "@ex-grid/mantine";
|
|
11
|
+
|
|
12
|
+
// src/format-cells.ts
|
|
13
|
+
import { createElement, useContext, useState } from "react";
|
|
14
|
+
import { Button, Checkbox, Fieldset, NativeSelect, Radio, Tabs, Text, TextInput } from "@mantine/core";
|
|
15
|
+
import { MantineSizeContext } from "@ex-grid/mantine";
|
|
16
|
+
import {
|
|
17
|
+
formatCellsLineStroke,
|
|
18
|
+
formatCellsOffer,
|
|
19
|
+
isDisabledCategory
|
|
20
|
+
} from "@ex-grid/sheet";
|
|
21
|
+
import { useFormatCells } from "@ex-grid/sheet-react";
|
|
22
|
+
function paintOf(colour) {
|
|
23
|
+
return colour.isAutomatic ? "currentColor" : colour.toString();
|
|
24
|
+
}
|
|
25
|
+
function DraftField({ label, value, typed, size, type = "text", className, error, ...field }) {
|
|
26
|
+
const [typing, setTyping] = useState(void 0);
|
|
27
|
+
return createElement(TextInput, {
|
|
28
|
+
...field,
|
|
29
|
+
label,
|
|
30
|
+
size,
|
|
31
|
+
type,
|
|
32
|
+
className,
|
|
33
|
+
error,
|
|
34
|
+
spellCheck: false,
|
|
35
|
+
value: typing ?? value(),
|
|
36
|
+
onFocus: (event) => {
|
|
37
|
+
setTyping(event.currentTarget.value);
|
|
38
|
+
},
|
|
39
|
+
onChange: (event) => {
|
|
40
|
+
const text = event.currentTarget.value;
|
|
41
|
+
setTyping(text);
|
|
42
|
+
typed(text);
|
|
43
|
+
},
|
|
44
|
+
onBlur: (event) => {
|
|
45
|
+
if (event.currentTarget.checkValidity()) setTyping(void 0);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function codeList(name, legend, codes, chosen, choose, size, className) {
|
|
50
|
+
return createElement(
|
|
51
|
+
Fieldset,
|
|
52
|
+
{ key: name, legend, variant: "unstyled", className },
|
|
53
|
+
...codes.map((code, index) => createElement(Radio, {
|
|
54
|
+
key: index,
|
|
55
|
+
name,
|
|
56
|
+
size,
|
|
57
|
+
checked: chosen(index, code),
|
|
58
|
+
onChange: () => {
|
|
59
|
+
choose(index, code);
|
|
60
|
+
},
|
|
61
|
+
label: createElement("code", null, code)
|
|
62
|
+
}))
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function NumberTab({ draft, words, size, set, id }) {
|
|
66
|
+
const { category } = draft;
|
|
67
|
+
const options = [];
|
|
68
|
+
if (category === "general") options.push(createElement(Text, { key: "hint", size }, words.formatCellsLabel("generalHint")));
|
|
69
|
+
else if (category === "text") options.push(createElement(Text, { key: "hint", size }, words.formatCellsLabel("textHint")));
|
|
70
|
+
if (draft.takesDecimalPlaces) {
|
|
71
|
+
options.push(createElement(DraftField, {
|
|
72
|
+
key: `places-${category}`,
|
|
73
|
+
label: words.formatCellsLabel("decimalPlaces"),
|
|
74
|
+
size,
|
|
75
|
+
type: "number",
|
|
76
|
+
min: 0,
|
|
77
|
+
max: 30,
|
|
78
|
+
required: true,
|
|
79
|
+
className: "mantine-ex-sheet-format-cells-places",
|
|
80
|
+
value: () => String(draft.decimalPlaces),
|
|
81
|
+
typed: (text) => {
|
|
82
|
+
const value = Number(text);
|
|
83
|
+
if (text.trim() !== "" && Number.isInteger(value) && value >= 0 && value <= 30) set((each) => {
|
|
84
|
+
each.setDecimalPlaces(value);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
if (category === "number") {
|
|
90
|
+
options.push(createElement(Checkbox, {
|
|
91
|
+
key: "separator",
|
|
92
|
+
size,
|
|
93
|
+
label: words.formatCellsLabel("thousandsSeparator"),
|
|
94
|
+
checked: draft.thousandsSeparator,
|
|
95
|
+
onChange: (event) => {
|
|
96
|
+
const { checked } = event.currentTarget;
|
|
97
|
+
set((each) => {
|
|
98
|
+
each.setThousandsSeparator(checked);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
if (category === "currency") options.push(createElement(Text, { key: "symbol", size }, words.currencySymbolShown(draft.currencySymbol)));
|
|
104
|
+
if (draft.negativeNumbers.length > 0) {
|
|
105
|
+
options.push(codeList(
|
|
106
|
+
`${id}-negative`,
|
|
107
|
+
words.formatCellsLabel("negativeNumbers"),
|
|
108
|
+
draft.negativeNumbers,
|
|
109
|
+
(index) => draft.negativeNumber === index,
|
|
110
|
+
(index) => {
|
|
111
|
+
set((each) => {
|
|
112
|
+
each.setNegativeNumber(index);
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
size,
|
|
116
|
+
"mantine-ex-sheet-format-cells-list"
|
|
117
|
+
));
|
|
118
|
+
}
|
|
119
|
+
if (category === "custom") {
|
|
120
|
+
const why = draft.numberFormatRefusal;
|
|
121
|
+
options.push(createElement(DraftField, {
|
|
122
|
+
key: "code",
|
|
123
|
+
label: words.formatCellsLabel("type"),
|
|
124
|
+
size,
|
|
125
|
+
className: "mantine-ex-sheet-format-cells-code",
|
|
126
|
+
value: () => draft.typeCode,
|
|
127
|
+
typed: (text) => {
|
|
128
|
+
set((each) => {
|
|
129
|
+
each.setType(text);
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
error: why === void 0 ? void 0 : words.formatCellsRefusal(why)
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
if (draft.types.length > 0) {
|
|
136
|
+
options.push(codeList(
|
|
137
|
+
`${id}-type`,
|
|
138
|
+
words.formatCellsLabel(category === "custom" ? "codes" : "type"),
|
|
139
|
+
draft.types,
|
|
140
|
+
(_, code) => draft.typeCode === code,
|
|
141
|
+
(_, code) => {
|
|
142
|
+
set((each) => {
|
|
143
|
+
each.setType(code);
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
size,
|
|
147
|
+
"mantine-ex-sheet-format-cells-list mantine-ex-sheet-format-cells-types"
|
|
148
|
+
));
|
|
149
|
+
}
|
|
150
|
+
return createElement(
|
|
151
|
+
"div",
|
|
152
|
+
{ className: "mantine-ex-sheet-format-cells-columns" },
|
|
153
|
+
createElement(
|
|
154
|
+
Fieldset,
|
|
155
|
+
{ legend: words.formatCellsLabel("category"), variant: "unstyled", className: "mantine-ex-sheet-format-cells-list" },
|
|
156
|
+
...formatCellsOffer.categories.flatMap(({ category: each, enabled }) => {
|
|
157
|
+
const reasonId = `${id}-reason-${each}`;
|
|
158
|
+
const radio = createElement(Radio, {
|
|
159
|
+
key: each,
|
|
160
|
+
name: `${id}-category`,
|
|
161
|
+
size,
|
|
162
|
+
label: words.categoryName(each),
|
|
163
|
+
checked: draft.category === each,
|
|
164
|
+
disabled: !enabled,
|
|
165
|
+
"aria-describedby": isDisabledCategory(each) ? reasonId : void 0,
|
|
166
|
+
onChange: () => {
|
|
167
|
+
set((one) => {
|
|
168
|
+
one.selectCategory(each);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return isDisabledCategory(each) ? [radio, createElement(Text, { key: `${each}-reason`, id: reasonId, size: "xs", c: "dimmed", className: "mantine-ex-sheet-format-cells-reason" }, words.categoryDisabled(each))] : [radio];
|
|
173
|
+
})
|
|
174
|
+
),
|
|
175
|
+
createElement("div", { className: "mantine-ex-sheet-format-cells-options" }, ...options)
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
function AlignmentTab({ draft, words, size, set }) {
|
|
179
|
+
return createElement(NativeSelect, {
|
|
180
|
+
label: words.formatCellsLabel("horizontal"),
|
|
181
|
+
size,
|
|
182
|
+
className: "mantine-ex-sheet-format-cells-dropdown",
|
|
183
|
+
value: draft.alignment,
|
|
184
|
+
data: formatCellsOffer.alignments.map((alignment) => ({ value: alignment, label: words.alignmentName(alignment) })),
|
|
185
|
+
onChange: (event) => {
|
|
186
|
+
const { value } = event.currentTarget;
|
|
187
|
+
const alignment = formatCellsOffer.alignments.find((each) => each === value);
|
|
188
|
+
if (alignment === void 0) throw new RangeError(`'${value}' is not an alignment Format Cells offers (ADR-0071).`);
|
|
189
|
+
set((each) => {
|
|
190
|
+
each.setAlignment(alignment);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function Palette({ draft, words, size, set, target, id }) {
|
|
196
|
+
const name = `${id}-palette-${target}`;
|
|
197
|
+
const isFill = target === "fill";
|
|
198
|
+
const chosen = draft.colourOf(target);
|
|
199
|
+
const swatches = (row, key) => createElement(
|
|
200
|
+
"div",
|
|
201
|
+
{ key, className: "mantine-ex-sheet-swatches" },
|
|
202
|
+
...row.map((swatch, index) => {
|
|
203
|
+
const swatchName = words.swatchName(swatch);
|
|
204
|
+
const paint = paintOf(swatch.colour);
|
|
205
|
+
return createElement("input", {
|
|
206
|
+
key: index,
|
|
207
|
+
type: "radio",
|
|
208
|
+
name,
|
|
209
|
+
className: "mantine-ex-sheet-swatch",
|
|
210
|
+
"aria-label": swatchName,
|
|
211
|
+
title: swatchName,
|
|
212
|
+
"data-rgb": paint,
|
|
213
|
+
style: { backgroundColor: paint },
|
|
214
|
+
checked: chosen !== void 0 && !chosen.isAutomatic && chosen.equals(swatch.colour),
|
|
215
|
+
onChange: () => {
|
|
216
|
+
set((each) => {
|
|
217
|
+
each.setColour(target, swatch.colour);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
return createElement(
|
|
224
|
+
"div",
|
|
225
|
+
{
|
|
226
|
+
role: "radiogroup",
|
|
227
|
+
"aria-label": words.formatCellsLabel(isFill ? "backgroundColour" : "colour"),
|
|
228
|
+
className: "mantine-ex-sheet-palette"
|
|
229
|
+
},
|
|
230
|
+
createElement(Radio, {
|
|
231
|
+
key: "first",
|
|
232
|
+
name,
|
|
233
|
+
size,
|
|
234
|
+
label: words.formatCellsLabel(isFill ? "noColour" : "automatic"),
|
|
235
|
+
checked: isFill ? chosen === void 0 : chosen?.isAutomatic === true,
|
|
236
|
+
onChange: () => {
|
|
237
|
+
set((each) => {
|
|
238
|
+
each.setColour(target, void 0);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}),
|
|
242
|
+
swatches(formatCellsOffer.themeColours.flat(), "theme"),
|
|
243
|
+
swatches(formatCellsOffer.standardColours, "standard"),
|
|
244
|
+
createElement(DraftField, {
|
|
245
|
+
key: `hex-${target}`,
|
|
246
|
+
label: words.formatCellsLabel("moreColours"),
|
|
247
|
+
size,
|
|
248
|
+
placeholder: "#RRGGBB",
|
|
249
|
+
maxLength: 7,
|
|
250
|
+
"data-target": target,
|
|
251
|
+
className: "mantine-ex-sheet-more-colours",
|
|
252
|
+
value: () => draft.colourText(target),
|
|
253
|
+
typed: (text) => {
|
|
254
|
+
set((each) => {
|
|
255
|
+
each.setColourText(target, text);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
})
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function FontTab(props) {
|
|
262
|
+
const { draft, words, size, set, id } = props;
|
|
263
|
+
return createElement(
|
|
264
|
+
"div",
|
|
265
|
+
null,
|
|
266
|
+
createElement(
|
|
267
|
+
"div",
|
|
268
|
+
{ className: "mantine-ex-sheet-format-cells-columns" },
|
|
269
|
+
createElement(
|
|
270
|
+
Fieldset,
|
|
271
|
+
{ legend: words.formatCellsLabel("fontStyle"), variant: "unstyled", className: "mantine-ex-sheet-format-cells-list" },
|
|
272
|
+
...formatCellsOffer.fontStyles.map((style) => createElement(Radio, {
|
|
273
|
+
key: style,
|
|
274
|
+
name: `${id}-font-style`,
|
|
275
|
+
size,
|
|
276
|
+
label: words.fontStyleName(style),
|
|
277
|
+
checked: draft.fontStyle === style,
|
|
278
|
+
onChange: () => {
|
|
279
|
+
set((each) => {
|
|
280
|
+
each.setFontStyle(style);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}))
|
|
284
|
+
),
|
|
285
|
+
createElement(
|
|
286
|
+
"div",
|
|
287
|
+
{ className: "mantine-ex-sheet-format-cells-options" },
|
|
288
|
+
createElement(NativeSelect, {
|
|
289
|
+
label: words.formatCellsLabel("underline"),
|
|
290
|
+
size,
|
|
291
|
+
className: "mantine-ex-sheet-format-cells-dropdown",
|
|
292
|
+
value: draft.underline ? "single" : "none",
|
|
293
|
+
data: [{ value: "none", label: words.formatCellsLabel("underlineNone") }, { value: "single", label: words.formatCellsLabel("underlineSingle") }],
|
|
294
|
+
onChange: (event) => {
|
|
295
|
+
const single = event.currentTarget.value === "single";
|
|
296
|
+
set((each) => {
|
|
297
|
+
each.setUnderline(single);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}),
|
|
301
|
+
createElement(Checkbox, {
|
|
302
|
+
size,
|
|
303
|
+
label: words.formatCellsLabel("strikethrough"),
|
|
304
|
+
checked: draft.strikethrough,
|
|
305
|
+
onChange: (event) => {
|
|
306
|
+
const { checked } = event.currentTarget;
|
|
307
|
+
set((each) => {
|
|
308
|
+
each.setStrikethrough(checked);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}),
|
|
312
|
+
// Excel's Normal font (ADR-0071, 2026-10-02): checking it sets every part of the Font to its default; it
|
|
313
|
+
// shows checked while they are, so unchecking it changes nothing.
|
|
314
|
+
createElement(Checkbox, {
|
|
315
|
+
size,
|
|
316
|
+
label: words.formatCellsLabel("normalFont"),
|
|
317
|
+
checked: draft.isNormalFont,
|
|
318
|
+
onChange: (event) => {
|
|
319
|
+
if (event.currentTarget.checked) set((each) => {
|
|
320
|
+
each.setNormalFont();
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
)
|
|
325
|
+
),
|
|
326
|
+
createElement(Fieldset, { legend: words.formatCellsLabel("colour"), variant: "unstyled" }, createElement(Palette, { ...props, target: "font" }))
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
function sampleLine(y, width, dashes) {
|
|
330
|
+
return createElement("line", { key: y, x1: 0, y1: y, x2: 56, y2: y, stroke: "currentColor", strokeWidth: width, strokeDasharray: dashes });
|
|
331
|
+
}
|
|
332
|
+
function lineSample(style) {
|
|
333
|
+
const { width, dashes } = formatCellsLineStroke(style);
|
|
334
|
+
const lines = style === "none" ? [] : style === "double" ? [sampleLine(2.5, width, void 0), sampleLine(5.5, width, void 0)] : [sampleLine(4, width, dashes)];
|
|
335
|
+
return createElement("svg", { className: "mantine-ex-sheet-format-cells-line", width: 56, height: 8, "aria-hidden": true }, ...lines);
|
|
336
|
+
}
|
|
337
|
+
function preview(draft, label) {
|
|
338
|
+
const edges = [
|
|
339
|
+
["top", 4, 4, 116, 4],
|
|
340
|
+
["bottom", 4, 68, 116, 68],
|
|
341
|
+
["left", 4, 4, 4, 68],
|
|
342
|
+
["right", 116, 4, 116, 68]
|
|
343
|
+
];
|
|
344
|
+
if (draft.hasInsideHorizontal) edges.push(["insideHorizontal", 4, 36, 116, 36]);
|
|
345
|
+
if (draft.hasInsideVertical) edges.push(["insideVertical", 60, 4, 60, 68]);
|
|
346
|
+
const lines = edges.flatMap(([edge, x1, y1, x2, y2]) => {
|
|
347
|
+
const line = draft.edgeLine(edge);
|
|
348
|
+
if (line?.isNone === true) return [];
|
|
349
|
+
if (line === void 0) {
|
|
350
|
+
return [createElement("line", { key: edge, x1, y1, x2, y2, "data-edge": edge, className: "mantine-ex-sheet-format-cells-differs", stroke: "#808080", strokeWidth: 1, strokeDasharray: "1 2" })];
|
|
351
|
+
}
|
|
352
|
+
const { width, dashes } = formatCellsLineStroke(line.style);
|
|
353
|
+
return [createElement("line", { key: edge, x1, y1, x2, y2, "data-edge": edge, stroke: paintOf(line.colour), strokeWidth: width, strokeDasharray: dashes })];
|
|
354
|
+
});
|
|
355
|
+
return createElement("svg", { className: "mantine-ex-sheet-format-cells-preview", width: 120, height: 72, viewBox: "0 0 120 72", role: "img", "aria-label": label }, ...lines);
|
|
356
|
+
}
|
|
357
|
+
function BorderTab(props) {
|
|
358
|
+
const { draft, words, size, set, id } = props;
|
|
359
|
+
const pressedOf = (edge) => {
|
|
360
|
+
const line = draft.edgeLine(edge);
|
|
361
|
+
if (line === void 0) return "mixed";
|
|
362
|
+
return line.isNone ? "false" : "true";
|
|
363
|
+
};
|
|
364
|
+
return createElement(
|
|
365
|
+
"div",
|
|
366
|
+
null,
|
|
367
|
+
createElement(
|
|
368
|
+
"div",
|
|
369
|
+
{ className: "mantine-ex-sheet-format-cells-columns" },
|
|
370
|
+
createElement(
|
|
371
|
+
Fieldset,
|
|
372
|
+
{ legend: words.formatCellsLabel("lineStyle"), variant: "unstyled" },
|
|
373
|
+
createElement(
|
|
374
|
+
"div",
|
|
375
|
+
{ className: "mantine-ex-sheet-format-cells-columns" },
|
|
376
|
+
...formatCellsOffer.lineStyleColumns.map((column, at) => createElement(
|
|
377
|
+
"div",
|
|
378
|
+
{ key: at, className: "mantine-ex-sheet-format-cells-line-column" },
|
|
379
|
+
...column.map((style) => createElement(Radio, {
|
|
380
|
+
key: style,
|
|
381
|
+
name: `${id}-line-style`,
|
|
382
|
+
size,
|
|
383
|
+
"aria-label": words.lineStyleName(style),
|
|
384
|
+
title: words.lineStyleName(style),
|
|
385
|
+
label: lineSample(style),
|
|
386
|
+
checked: draft.lineStyle === style,
|
|
387
|
+
onChange: () => {
|
|
388
|
+
set((each) => {
|
|
389
|
+
each.setLineStyle(style);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}))
|
|
393
|
+
))
|
|
394
|
+
)
|
|
395
|
+
),
|
|
396
|
+
createElement(
|
|
397
|
+
"div",
|
|
398
|
+
{ className: "mantine-ex-sheet-format-cells-options" },
|
|
399
|
+
createElement(
|
|
400
|
+
"div",
|
|
401
|
+
{ role: "group", "aria-label": words.formatCellsLabel("presets"), className: "mantine-ex-sheet-format-cells-buttons" },
|
|
402
|
+
...formatCellsOffer.presets.map((preset) => createElement(Button, {
|
|
403
|
+
key: preset,
|
|
404
|
+
type: "button",
|
|
405
|
+
size,
|
|
406
|
+
variant: "default",
|
|
407
|
+
disabled: !draft.canApply(preset),
|
|
408
|
+
onClick: () => {
|
|
409
|
+
set((each) => {
|
|
410
|
+
each.applyPreset(preset);
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}, words.presetName(preset)))
|
|
414
|
+
),
|
|
415
|
+
createElement(
|
|
416
|
+
"div",
|
|
417
|
+
{ role: "group", "aria-label": words.formatCellsLabel("border"), className: "mantine-ex-sheet-format-cells-buttons" },
|
|
418
|
+
...formatCellsOffer.edges.map((edge) => {
|
|
419
|
+
const pressed = pressedOf(edge);
|
|
420
|
+
const named = { "data-edge": edge };
|
|
421
|
+
return createElement(Button, {
|
|
422
|
+
key: edge,
|
|
423
|
+
type: "button",
|
|
424
|
+
size,
|
|
425
|
+
variant: pressed === "true" ? "filled" : pressed === "mixed" ? "light" : "default",
|
|
426
|
+
disabled: !draft.canSet(edge),
|
|
427
|
+
"aria-pressed": pressed,
|
|
428
|
+
...named,
|
|
429
|
+
onClick: () => {
|
|
430
|
+
set((each) => {
|
|
431
|
+
each.toggleEdge(edge);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}, words.edgeName(edge));
|
|
435
|
+
})
|
|
436
|
+
),
|
|
437
|
+
preview(draft, words.formatCellsLabel("preview"))
|
|
438
|
+
)
|
|
439
|
+
),
|
|
440
|
+
createElement(Fieldset, { legend: words.formatCellsLabel("colour"), variant: "unstyled" }, createElement(Palette, { ...props, target: "border" }))
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
function FillTab(props) {
|
|
444
|
+
return createElement(Fieldset, { legend: props.words.formatCellsLabel("backgroundColour"), variant: "unstyled" }, createElement(Palette, { ...props, target: "fill" }));
|
|
445
|
+
}
|
|
446
|
+
function tabContents(tab, props) {
|
|
447
|
+
switch (tab) {
|
|
448
|
+
case "number":
|
|
449
|
+
return createElement(NumberTab, props);
|
|
450
|
+
case "alignment":
|
|
451
|
+
return createElement(AlignmentTab, props);
|
|
452
|
+
case "font":
|
|
453
|
+
return createElement(FontTab, props);
|
|
454
|
+
case "border":
|
|
455
|
+
return createElement(BorderTab, props);
|
|
456
|
+
case "fill":
|
|
457
|
+
return createElement(FillTab, props);
|
|
458
|
+
default:
|
|
459
|
+
throw new RangeError(`Unknown Format Cells tab '${String(tab)}' (ADR-0071).`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
var openings = 0;
|
|
463
|
+
function MantineFormatCells({ context }) {
|
|
464
|
+
const { tab, showTab, tabControl, set, refusal, submit, cancel } = useFormatCells(context);
|
|
465
|
+
const size = useContext(MantineSizeContext);
|
|
466
|
+
const [id] = useState(() => {
|
|
467
|
+
openings += 1;
|
|
468
|
+
return `mantine-ex-sheet-format-cells-${String(openings)}`;
|
|
469
|
+
});
|
|
470
|
+
const { draft, words } = context;
|
|
471
|
+
return createElement(
|
|
472
|
+
"form",
|
|
473
|
+
{ className: "mantine-ex-sheet-format-cells", onSubmit: submit, noValidate: true },
|
|
474
|
+
createElement(
|
|
475
|
+
Tabs,
|
|
476
|
+
{
|
|
477
|
+
value: tab,
|
|
478
|
+
keepMounted: true,
|
|
479
|
+
onChange: (value) => {
|
|
480
|
+
const shown = formatCellsOffer.tabs.find((each) => each === value);
|
|
481
|
+
if (shown === void 0) throw new RangeError(`'${String(value)}' is not a tab of Format Cells (ADR-0071).`);
|
|
482
|
+
showTab(shown);
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
createElement(Tabs.List, {
|
|
486
|
+
"aria-label": words.formatCellsLabel("tabs"),
|
|
487
|
+
children: formatCellsOffer.tabs.map((each) => createElement(Tabs.Tab, {
|
|
488
|
+
key: each,
|
|
489
|
+
value: each,
|
|
490
|
+
...each === tab ? { ref: tabControl } : {}
|
|
491
|
+
}, words.tabName(each)))
|
|
492
|
+
}),
|
|
493
|
+
...formatCellsOffer.tabs.map((each) => createElement(Tabs.Panel, {
|
|
494
|
+
key: each,
|
|
495
|
+
value: each,
|
|
496
|
+
className: "mantine-ex-sheet-format-cells-panel",
|
|
497
|
+
children: createElement("div", { "data-ex-tab": each }, tabContents(each, { draft, words, size, set, id }))
|
|
498
|
+
}))
|
|
499
|
+
),
|
|
500
|
+
refusal === void 0 ? null : createElement(Text, { role: "alert", c: "red", size, className: "mantine-ex-sheet-format-cells-refusal" }, refusal),
|
|
501
|
+
createElement(
|
|
502
|
+
"div",
|
|
503
|
+
{ className: "mantine-ex-sheet-format-cells-actions" },
|
|
504
|
+
createElement(Button, { type: "submit", size }, words.formatCellsLabel("ok")),
|
|
505
|
+
createElement(Button, { type: "button", size, variant: "default", onClick: cancel }, words.formatCellsLabel("cancel"))
|
|
506
|
+
)
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// src/toolbar-item.ts
|
|
511
|
+
import { createElement as createElement2, useCallback, useContext as useContext2, useRef } from "react";
|
|
512
|
+
import { ActionIcon, Button as Button2, Popover } from "@mantine/core";
|
|
513
|
+
import { MantineSizeContext as MantineSizeContext2 } from "@ex-grid/mantine";
|
|
514
|
+
import { sheetToolbarPictures } from "@ex-grid/sheet";
|
|
515
|
+
import { useToolbarItem } from "@ex-grid/sheet-react";
|
|
516
|
+
function picture(icon, className = "mantine-ex-sheet-toolbar-icon") {
|
|
517
|
+
return createElement2("svg", {
|
|
518
|
+
className,
|
|
519
|
+
viewBox: "0 0 16 16",
|
|
520
|
+
"aria-hidden": true,
|
|
521
|
+
focusable: false,
|
|
522
|
+
fill: "none",
|
|
523
|
+
stroke: "currentColor",
|
|
524
|
+
strokeLinecap: "round",
|
|
525
|
+
strokeLinejoin: "round",
|
|
526
|
+
dangerouslySetInnerHTML: { __html: sheetToolbarPictures[icon] }
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
function caret() {
|
|
530
|
+
return createElement2("svg", {
|
|
531
|
+
className: "mantine-ex-sheet-toolbar-caret",
|
|
532
|
+
viewBox: "0 0 16 16",
|
|
533
|
+
"aria-hidden": true,
|
|
534
|
+
focusable: false,
|
|
535
|
+
fill: "none",
|
|
536
|
+
stroke: "currentColor",
|
|
537
|
+
strokeWidth: 1.5,
|
|
538
|
+
strokeLinecap: "round",
|
|
539
|
+
strokeLinejoin: "round"
|
|
540
|
+
}, createElement2("path", { d: "M4.5 6.5 8 10l3.5-3.5" }));
|
|
541
|
+
}
|
|
542
|
+
function OwnContent({ mount }) {
|
|
543
|
+
const taken = useRef(void 0);
|
|
544
|
+
const ref = useCallback((element) => {
|
|
545
|
+
taken.current?.();
|
|
546
|
+
taken.current = element === null ? void 0 : mount(element);
|
|
547
|
+
}, [mount]);
|
|
548
|
+
return createElement2("span", { ref, className: "mantine-ex-sheet-toolbar-content" });
|
|
549
|
+
}
|
|
550
|
+
function ChoiceList({ item, size }) {
|
|
551
|
+
const { view, list, choice: props } = item;
|
|
552
|
+
const option = (index) => {
|
|
553
|
+
const choice = view.choices[index];
|
|
554
|
+
if (choice === void 0) throw new RangeError(`The list of ${view.name} has no choice ${String(index)} (ADR-0100).`);
|
|
555
|
+
const common = { key: index, ...props(index) };
|
|
556
|
+
if (choice.swatch !== void 0) {
|
|
557
|
+
return createElement2("button", {
|
|
558
|
+
...common,
|
|
559
|
+
type: "button",
|
|
560
|
+
"aria-label": choice.label,
|
|
561
|
+
className: "mantine-ex-sheet-swatch",
|
|
562
|
+
style: { backgroundColor: choice.swatch }
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
return createElement2(Button2, {
|
|
566
|
+
...common,
|
|
567
|
+
type: "button",
|
|
568
|
+
variant: choice.selected ? "light" : "subtle",
|
|
569
|
+
...choice.selected ? {} : { color: "gray" },
|
|
570
|
+
size,
|
|
571
|
+
fullWidth: true,
|
|
572
|
+
justify: "flex-start",
|
|
573
|
+
className: "mantine-ex-sheet-choice",
|
|
574
|
+
...choice.disabledReason === void 0 ? {} : { "data-disabled": true }
|
|
575
|
+
}, choice.label);
|
|
576
|
+
};
|
|
577
|
+
const rows = item.rows.map((row, at) => typeof row === "number" ? option(row) : createElement2("div", { key: `s${String(at)}`, className: "mantine-ex-sheet-swatches", role: "none" }, ...row.map(option)));
|
|
578
|
+
return createElement2("div", { ...list, className: "mantine-ex-sheet-choices" }, ...rows);
|
|
579
|
+
}
|
|
580
|
+
function MantineToolbarItem({ context }) {
|
|
581
|
+
const item = useToolbarItem(context);
|
|
582
|
+
const { view, open, control, toggleList } = item;
|
|
583
|
+
const size = useContext2(MantineSizeContext2);
|
|
584
|
+
const face = view.content !== void 0 ? createElement2(OwnContent, { mount: view.content }) : view.icon !== void 0 ? picture(view.icon) : view.text ?? view.name;
|
|
585
|
+
let drawn;
|
|
586
|
+
switch (context.kind) {
|
|
587
|
+
case "toggle":
|
|
588
|
+
drawn = createElement2(ActionIcon, {
|
|
589
|
+
...control,
|
|
590
|
+
type: "button",
|
|
591
|
+
size,
|
|
592
|
+
variant: view.pressed ? "filled" : "subtle",
|
|
593
|
+
...view.pressed ? {} : { color: "gray" },
|
|
594
|
+
"aria-label": view.name,
|
|
595
|
+
"aria-pressed": view.pressed,
|
|
596
|
+
onClick: () => {
|
|
597
|
+
context.invoke();
|
|
598
|
+
}
|
|
599
|
+
}, face);
|
|
600
|
+
break;
|
|
601
|
+
case "menu":
|
|
602
|
+
drawn = createElement2(Button2, {
|
|
603
|
+
...control,
|
|
604
|
+
type: "button",
|
|
605
|
+
size,
|
|
606
|
+
variant: "subtle",
|
|
607
|
+
color: "gray",
|
|
608
|
+
"aria-label": view.name,
|
|
609
|
+
"aria-haspopup": "menu",
|
|
610
|
+
"aria-expanded": open,
|
|
611
|
+
rightSection: caret(),
|
|
612
|
+
className: "mantine-ex-sheet-toolbar-menu",
|
|
613
|
+
onClick: toggleList
|
|
614
|
+
}, view.text ?? view.name);
|
|
615
|
+
break;
|
|
616
|
+
case "split":
|
|
617
|
+
drawn = createElement2(
|
|
618
|
+
"span",
|
|
619
|
+
{ className: "mantine-ex-sheet-toolbar-split", role: "group", "aria-label": view.name },
|
|
620
|
+
createElement2(ActionIcon, {
|
|
621
|
+
...control,
|
|
622
|
+
type: "button",
|
|
623
|
+
size,
|
|
624
|
+
variant: "subtle",
|
|
625
|
+
color: "gray",
|
|
626
|
+
"aria-label": view.name,
|
|
627
|
+
className: "mantine-ex-sheet-toolbar-face",
|
|
628
|
+
style: view.swatch === void 0 ? void 0 : { "--mantine-ex-sheet-swatch": view.swatch },
|
|
629
|
+
onClick: () => {
|
|
630
|
+
context.invoke();
|
|
631
|
+
}
|
|
632
|
+
}, face),
|
|
633
|
+
createElement2(ActionIcon, {
|
|
634
|
+
...control,
|
|
635
|
+
type: "button",
|
|
636
|
+
size,
|
|
637
|
+
variant: "subtle",
|
|
638
|
+
color: "gray",
|
|
639
|
+
"aria-label": view.moreName ?? view.name,
|
|
640
|
+
"aria-haspopup": "menu",
|
|
641
|
+
"aria-expanded": open,
|
|
642
|
+
className: "mantine-ex-sheet-toolbar-arrow",
|
|
643
|
+
onClick: toggleList
|
|
644
|
+
}, caret())
|
|
645
|
+
);
|
|
646
|
+
break;
|
|
647
|
+
case "button":
|
|
648
|
+
drawn = view.content === void 0 && view.icon !== void 0 ? createElement2(ActionIcon, {
|
|
649
|
+
...control,
|
|
650
|
+
type: "button",
|
|
651
|
+
size,
|
|
652
|
+
variant: "subtle",
|
|
653
|
+
color: "gray",
|
|
654
|
+
"aria-label": view.name,
|
|
655
|
+
onClick: () => {
|
|
656
|
+
context.invoke();
|
|
657
|
+
}
|
|
658
|
+
}, face) : createElement2(Button2, {
|
|
659
|
+
...control,
|
|
660
|
+
type: "button",
|
|
661
|
+
size,
|
|
662
|
+
variant: "subtle",
|
|
663
|
+
color: "gray",
|
|
664
|
+
"aria-label": view.name,
|
|
665
|
+
onClick: () => {
|
|
666
|
+
context.invoke();
|
|
667
|
+
}
|
|
668
|
+
}, face);
|
|
669
|
+
break;
|
|
670
|
+
default:
|
|
671
|
+
throw new RangeError(`Unknown Toolbar Item kind '${String(context.kind)}' (ADR-0100).`);
|
|
672
|
+
}
|
|
673
|
+
const classes = ["mantine-ex-sheet-toolbar-item"];
|
|
674
|
+
if (view.active) classes.push("mantine-ex-sheet-toolbar-active");
|
|
675
|
+
const body = !item.hasList ? drawn : createElement2(Popover, {
|
|
676
|
+
// A press outside is useToolbarItem's to hear, so Mantine's own is off.
|
|
677
|
+
opened: open,
|
|
678
|
+
closeOnClickOutside: false,
|
|
679
|
+
withinPortal: false,
|
|
680
|
+
floatingStrategy: "fixed",
|
|
681
|
+
position: "bottom-start",
|
|
682
|
+
offset: 2,
|
|
683
|
+
trapFocus: false,
|
|
684
|
+
returnFocus: false,
|
|
685
|
+
closeOnEscape: false,
|
|
686
|
+
withRoles: false,
|
|
687
|
+
shadow: "md",
|
|
688
|
+
transitionProps: { duration: 0 }
|
|
689
|
+
}, createElement2(Popover.Target, null, drawn), createElement2(
|
|
690
|
+
Popover.Dropdown,
|
|
691
|
+
{ className: "mantine-ex-sheet-toolbar-list" },
|
|
692
|
+
createElement2(ChoiceList, { item, size })
|
|
693
|
+
));
|
|
694
|
+
return createElement2("span", { ref: item.item, className: classes.join(" ") }, body);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// src/chrome.ts
|
|
698
|
+
function MantineSheetTab({ context }) {
|
|
699
|
+
const size = useContext3(MantineSizeContext3);
|
|
700
|
+
return createElement3(Text2, {
|
|
701
|
+
span: true,
|
|
702
|
+
size,
|
|
703
|
+
className: "mantine-ex-sheet-tab-face",
|
|
704
|
+
...context.selected ? { fw: 600, c: "var(--mantine-primary-color-filled)" } : {}
|
|
705
|
+
}, context.name);
|
|
706
|
+
}
|
|
707
|
+
function MantineSheetTabAdd() {
|
|
708
|
+
return createElement3("svg", {
|
|
709
|
+
className: "mantine-ex-sheet-tab-add-face",
|
|
710
|
+
viewBox: "0 0 16 16",
|
|
711
|
+
"aria-hidden": true,
|
|
712
|
+
focusable: false,
|
|
713
|
+
fill: "none",
|
|
714
|
+
stroke: "currentColor",
|
|
715
|
+
strokeWidth: 1.5,
|
|
716
|
+
strokeLinecap: "round"
|
|
717
|
+
}, createElement3("path", { d: "M8 3v10M3 8h10" }));
|
|
718
|
+
}
|
|
719
|
+
var mantineSheetChrome = Object.freeze({
|
|
720
|
+
...mantineChrome,
|
|
721
|
+
toolbarItem: (context) => createElement3(MantineToolbarItem, { context }),
|
|
722
|
+
formatCells: (context) => createElement3(MantineFormatCells, { context }),
|
|
723
|
+
sheetTab: (context) => createElement3(MantineSheetTab, { context }),
|
|
724
|
+
sheetTabAdd: () => createElement3(MantineSheetTabAdd)
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
// src/mantine-ex-sheet.ts
|
|
728
|
+
function MantineExSheet(props) {
|
|
729
|
+
const { withBorder, radius, shadow, className, style, chrome, ...sheet } = props;
|
|
730
|
+
const density = sheet.density ?? "compact";
|
|
731
|
+
const merged = useMemo(() => chrome === void 0 ? mantineSheetChrome : { ...mantineSheetChrome, ...chrome }, [chrome]);
|
|
732
|
+
const classes = ["mantine-ex-grid", "mantine-ex-sheet"];
|
|
733
|
+
if (radius === 0) classes.push("mantine-ex-grid-square");
|
|
734
|
+
if (sheet.viewportWidth === "stretch") classes.push("mantine-ex-grid-stretch");
|
|
735
|
+
if (className !== void 0) classes.push(className);
|
|
736
|
+
return createElement4(Paper, {
|
|
737
|
+
className: classes.join(" "),
|
|
738
|
+
...style === void 0 ? {} : { style },
|
|
739
|
+
...withBorder === void 0 ? {} : { withBorder },
|
|
740
|
+
...radius === void 0 ? {} : { radius },
|
|
741
|
+
...shadow === void 0 ? {} : { shadow }
|
|
742
|
+
}, createElement4(
|
|
743
|
+
MantineSizeContext4.Provider,
|
|
744
|
+
{ value: mantineSizeOf(density) },
|
|
745
|
+
createElement4(ExSheet, { ...sheet, chrome: merged })
|
|
746
|
+
));
|
|
747
|
+
}
|
|
748
|
+
export {
|
|
749
|
+
MantineExSheet,
|
|
750
|
+
mantineSheetChrome
|
|
751
|
+
};
|
|
752
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/mantine-ex-sheet.ts", "../src/chrome.ts", "../src/format-cells.ts", "../src/toolbar-item.ts"],
|
|
4
|
+
"sourcesContent": ["// MantineExSheet (ADR-0390, ADR-0030): ExSheet for React inside Mantine's Paper, its Chrome drawn in Mantine's\n// components and its Visual Tokens mapped onto the Mantine theme by the Wrappers' stylesheets, ExGrid's and the\n// Sheet's. It owns no geometry, no DOM inside the Sheet's element and no state. The cells keep the Sheet's own font,\n// whose widths its columns are measured in characters by (ADR-0027): a Sheet's look is its document's, so Mantine's\n// font is the Chrome's, never the cells'.\n\nimport { createElement, useMemo, type CSSProperties, type ReactElement } from 'react';\nimport { Paper, type MantineRadius, type MantineShadow } from '@mantine/core';\nimport { MantineSizeContext, mantineSizeOf } from '@ex-grid/mantine';\nimport { ExSheet, type ExSheetProps } from '@ex-grid/sheet-react';\nimport { mantineSheetChrome } from './chrome';\n\n/** A MantineExSheet's props: an ExSheet's, and the Paper's words Mantine draws it with. */\nexport type MantineExSheetProps = ExSheetProps & {\n /** The Paper's border, Mantine's `withBorder`. */\n readonly withBorder?: boolean;\n /** The Paper's corner radius, a theme radius or a CSS length; `0` sets the Sheet square in its Paper. */\n readonly radius?: MantineRadius;\n /** The Paper's shadow. */\n readonly shadow?: MantineShadow;\n /** A class for the Paper. */\n readonly className?: string;\n /** A style for the Paper. */\n readonly style?: CSSProperties;\n};\n\n/**\n * An Excel-like sheet with formulas drawn with Mantine: the Chrome slots a `chrome` prop leaves are Mantine's, the\n * Sheet Toolbar, Format Cells and the Sheet Tabs among them, and the colours follow the theme and its scheme with no\n * render. Needs Mantine's MantineProvider above it, and `@ex-grid/mantine/styles.css` and\n * `@ex-grid/sheet-mantine/styles.css` loaded after Mantine's styles.\n */\nexport function MantineExSheet(props: MantineExSheetProps): ReactElement {\n const { withBorder, radius, shadow, className, style, chrome, ...sheet } = props;\n const density = sheet.density ?? 'compact'; // oxlint-disable-line ex-grid/no-stand-in-default -- ADR-0028: an untouched Sheet is compact\n // The Consumer's slots win over the Wrapper's; one merge per chrome handed, so a render function handed again\n // keeps its mount (ADR-0390).\n const merged = useMemo(() => (chrome === undefined ? mantineSheetChrome : { ...mantineSheetChrome, ...chrome }), [chrome]);\n const classes = ['mantine-ex-grid', 'mantine-ex-sheet'];\n if (radius === 0) classes.push('mantine-ex-grid-square');\n // A Stretch Sheet follows its container's width (ADR-0045), so the Paper round it does too.\n if (sheet.viewportWidth === 'stretch') classes.push('mantine-ex-grid-stretch');\n if (className !== undefined) classes.push(className);\n return createElement(Paper<'div'>, {\n className: classes.join(' '),\n ...(style === undefined ? {} : { style }),\n ...(withBorder === undefined ? {} : { withBorder }),\n ...(radius === undefined ? {} : { radius }),\n ...(shadow === undefined ? {} : { shadow }),\n }, createElement(MantineSizeContext.Provider, { value: mantineSizeOf(density) },\n createElement(ExSheet, { ...sheet, chrome: merged })));\n}\n", "// The Mantine Chrome for a Sheet (ADR-0390 section 3): ExGrid's Mantine Chrome in the slots the Sheet hands its grid,\n// and Mantine's components in the Sheet's own: each Toolbar Item, Format Cells, and the Sheet Tabs' faces. What each\n// shows and means is the Sheet's, reached through its slots' contexts and ExSheet for React's hooks.\n\nimport { createElement, useContext, type ReactElement } from 'react';\nimport { Text } from '@mantine/core';\nimport { MantineSizeContext, mantineChrome } from '@ex-grid/mantine';\nimport type { SheetFormatCellsSlotContext, SheetTabSlotContext, SheetToolbarItemSlotContext } from '@ex-grid/sheet';\nimport type { ExSheetChrome } from '@ex-grid/sheet-react';\nimport { MantineFormatCells } from './format-cells';\nimport { MantineToolbarItem } from './toolbar-item';\n\n/** A Sheet Tab's face: the Sheet's name in Mantine's text, in the theme's primary on the Sheet shown. The tab around\n * it, which takes the keyboard and hears the press, is the Sheet's. */\nfunction MantineSheetTab({ context }: { readonly context: SheetTabSlotContext }): ReactElement {\n const size = useContext(MantineSizeContext);\n return createElement(Text<'span'>, {\n span: true, size, className: 'mantine-ex-sheet-tab-face', ...(context.selected ? { fw: 600, c: 'var(--mantine-primary-color-filled)' } : {}),\n }, context.name);\n}\n\n/** The + button's face: a plus drawn in the text's colour. */\nfunction MantineSheetTabAdd(): ReactElement {\n return createElement('svg', {\n className: 'mantine-ex-sheet-tab-add-face', viewBox: '0 0 16 16', 'aria-hidden': true, focusable: false, fill: 'none', stroke: 'currentColor',\n strokeWidth: 1.5, strokeLinecap: 'round',\n }, createElement('path', { d: 'M8 3v10M3 8h10' }));\n}\n\n/** Every Chrome slot of a Sheet drawn in Mantine's components: ExGrid's Mantine Chrome for the grid's, and the Sheet's\n * own. What {@link MantineExSheet} hands its Sheet. A Consumer that frames an ExSheet itself spreads it into the Sheet's\n * `chrome`, inside an element of the classes `mantine-ex-grid mantine-ex-sheet` and a `MantineSizeContext`, as\n * MantineExSheet draws them. */\nexport const mantineSheetChrome: ExSheetChrome = Object.freeze({\n ...mantineChrome,\n toolbarItem: (context: SheetToolbarItemSlotContext) => createElement(MantineToolbarItem, { context }),\n formatCells: (context: SheetFormatCellsSlotContext) => createElement(MantineFormatCells, { context }),\n sheetTab: (context: SheetTabSlotContext) => createElement(MantineSheetTab, { context }),\n sheetTabAdd: () => createElement(MantineSheetTabAdd),\n});\n", "// Format Cells in Mantine's components (ADR-0071, ADR-0390): Mantine's Tabs, Fieldsets, Radios, Checkboxes,\n// NativeSelects, TextInputs and Buttons, inside the grid's popover frame, where the built-in Format Cells stands. What\n// it offers is `formatCellsOffer`'s, every choice is set through the Sheet's draft, and OK is the Sheet's, so the same\n// choices set the same Cell Format under either Chrome. The palette's swatches are buttons painted in the document's\n// colours, which no Mantine control draws; the colour is the user's choice of data, written inline, never a token.\n//\n// A field typed into shows what is typed while it holds the keyboard, and the draft's text once it is left, so a\n// choice never writes over typing (ADR-0240 section 1); one the draft did not take stays as typed, and OK refuses it.\n\nimport { createElement, useContext, useState, type ReactElement, type ReactNode } from 'react';\nimport { Button, Checkbox, Fieldset, NativeSelect, Radio, Tabs, Text, TextInput, type MantineSize } from '@mantine/core';\nimport { MantineSizeContext } from '@ex-grid/mantine';\nimport {\n formatCellsLineStroke, formatCellsOffer, isDisabledCategory, type ColourTarget, type FormatCellsDraft, type FormatCellsTab, type PaletteSwatch,\n type SheetFormatCellsSlotContext, type SheetWords,\n} from '@ex-grid/sheet';\nimport { useFormatCells } from '@ex-grid/sheet-react';\nimport type { BorderLineStyle, CellColour } from '@ex-grid/sheet-engine';\n\n/** What every tab is drawn with. */\ninterface TabProps {\n readonly draft: FormatCellsDraft;\n readonly words: SheetWords;\n readonly size: MantineSize;\n readonly set: (choose: (draft: FormatCellsDraft) => void) => void;\n}\n\n/** A colour as a swatch and a preview paint it: Automatic is the Ink of the text around it. */\nfunction paintOf(colour: CellColour): string {\n return colour.isAutomatic ? 'currentColor' : colour.toString();\n}\n\n/** A field typed into: what is typed while it is, the draft's text otherwise; `valid` says whether a text left in it\n * is one the draft took, which it then shows as the draft has it. */\nfunction DraftField({ label, value, typed, size, type = 'text', className, error, ...field }: {\n readonly label: string; readonly value: () => string; readonly typed: (text: string) => void; readonly size: MantineSize;\n readonly type?: 'text' | 'number'; readonly className: string; readonly error?: ReactNode; readonly min?: number; readonly max?: number;\n readonly required?: boolean; readonly placeholder?: string; readonly maxLength?: number; readonly 'data-target'?: string;\n}): ReactElement {\n const [typing, setTyping] = useState<string | undefined>(undefined);\n return createElement(TextInput, {\n ...field, label, size, type, className, error, spellCheck: false, value: typing ?? value(),\n onFocus: event => { setTyping(event.currentTarget.value); },\n onChange: event => {\n const text = event.currentTarget.value;\n setTyping(text);\n typed(text);\n },\n onBlur: event => { if (event.currentTarget.checkValidity()) setTyping(undefined); },\n });\n}\n\n/** A list of codes to choose one of: a Negative Numbers list or a category's Types. */\nfunction codeList(name: string, legend: string, codes: readonly string[], chosen: (index: number, code: string) => boolean,\n choose: (index: number, code: string) => void, size: MantineSize, className: string): ReactElement {\n return createElement(Fieldset, { key: name, legend, variant: 'unstyled', className },\n ...codes.map((code, index) => createElement(Radio, {\n key: index, name, size, checked: chosen(index, code), onChange: () => { choose(index, code); },\n label: createElement('code', null, code),\n })));\n}\n\nfunction NumberTab({ draft, words, size, set, id }: TabProps & { readonly id: string }): ReactElement {\n const { category } = draft;\n const options: ReactNode[] = [];\n if (category === 'general') options.push(createElement(Text<'p'>, { key: 'hint', size }, words.formatCellsLabel('generalHint')));\n else if (category === 'text') options.push(createElement(Text<'p'>, { key: 'hint', size }, words.formatCellsLabel('textHint')));\n if (draft.takesDecimalPlaces) {\n options.push(createElement(DraftField, {\n key: `places-${category}`, label: words.formatCellsLabel('decimalPlaces'), size, type: 'number', min: 0, max: 30, required: true,\n className: 'mantine-ex-sheet-format-cells-places', value: () => String(draft.decimalPlaces),\n typed: (text: string) => {\n const value = Number(text);\n // Only a whole number of places Excel takes is set; anything else leaves the field invalid, which OK refuses.\n if (text.trim() !== '' && Number.isInteger(value) && value >= 0 && value <= 30) set(each => { each.setDecimalPlaces(value); });\n },\n }));\n }\n if (category === 'number') {\n options.push(createElement(Checkbox, {\n key: 'separator', size, label: words.formatCellsLabel('thousandsSeparator'), checked: draft.thousandsSeparator,\n onChange: event => { const { checked } = event.currentTarget; set(each => { each.setThousandsSeparator(checked); }); },\n }));\n }\n if (category === 'currency') options.push(createElement(Text<'p'>, { key: 'symbol', size }, words.currencySymbolShown(draft.currencySymbol)));\n if (draft.negativeNumbers.length > 0) {\n options.push(codeList(`${id}-negative`, words.formatCellsLabel('negativeNumbers'), draft.negativeNumbers, index => draft.negativeNumber === index,\n index => { set(each => { each.setNegativeNumber(index); }); }, size, 'mantine-ex-sheet-format-cells-list'));\n }\n if (category === 'custom') {\n const why = draft.numberFormatRefusal;\n options.push(createElement(DraftField, {\n key: 'code', label: words.formatCellsLabel('type'), size, className: 'mantine-ex-sheet-format-cells-code', value: () => draft.typeCode,\n typed: (text: string) => { set(each => { each.setType(text); }); }, error: why === undefined ? undefined : words.formatCellsRefusal(why),\n }));\n }\n if (draft.types.length > 0) {\n options.push(codeList(`${id}-type`, words.formatCellsLabel(category === 'custom' ? 'codes' : 'type'), draft.types, (_, code) => draft.typeCode === code,\n (_, code) => { set(each => { each.setType(code); }); }, size, 'mantine-ex-sheet-format-cells-list mantine-ex-sheet-format-cells-types'));\n }\n return createElement('div', { className: 'mantine-ex-sheet-format-cells-columns' },\n createElement(Fieldset, { legend: words.formatCellsLabel('category'), variant: 'unstyled', className: 'mantine-ex-sheet-format-cells-list' },\n ...formatCellsOffer.categories.flatMap(({ category: each, enabled }) => {\n const reasonId = `${id}-reason-${each}`;\n const radio = createElement(Radio, {\n key: each, name: `${id}-category`, size, label: words.categoryName(each), checked: draft.category === each, disabled: !enabled,\n 'aria-describedby': isDisabledCategory(each) ? reasonId : undefined, onChange: () => { set(one => { one.selectCategory(each); }); },\n });\n return isDisabledCategory(each)\n ? [radio, createElement(Text<'p'>, { key: `${each}-reason`, id: reasonId, size: 'xs', c: 'dimmed', className: 'mantine-ex-sheet-format-cells-reason' }, words.categoryDisabled(each))]\n : [radio];\n })),\n createElement('div', { className: 'mantine-ex-sheet-format-cells-options' }, ...options));\n}\n\nfunction AlignmentTab({ draft, words, size, set }: TabProps): ReactElement {\n return createElement(NativeSelect, {\n label: words.formatCellsLabel('horizontal'), size, className: 'mantine-ex-sheet-format-cells-dropdown', value: draft.alignment,\n data: formatCellsOffer.alignments.map(alignment => ({ value: alignment, label: words.alignmentName(alignment) })),\n onChange: event => {\n const { value } = event.currentTarget;\n const alignment = formatCellsOffer.alignments.find(each => each === value);\n if (alignment === undefined) throw new RangeError(`'${value}' is not an alignment Format Cells offers (ADR-0071).`);\n set(each => { each.setAlignment(alignment); });\n },\n });\n}\n\n/** Case 23's palette as one group of radio buttons: Automatic or No Colour first, the theme's sixty and the ten\n * standard colours, each named as Excel names it, and More Colours, which takes a hex value. */\nfunction Palette({ draft, words, size, set, target, id }: TabProps & { readonly target: ColourTarget; readonly id: string }): ReactElement {\n const name = `${id}-palette-${target}`;\n const isFill = target === 'fill';\n const chosen = draft.colourOf(target);\n const swatches = (row: readonly PaletteSwatch[], key: string): ReactElement => createElement('div', { key, className: 'mantine-ex-sheet-swatches' },\n ...row.map((swatch, index) => {\n const swatchName = words.swatchName(swatch);\n const paint = paintOf(swatch.colour);\n return createElement('input', {\n key: index, type: 'radio', name, className: 'mantine-ex-sheet-swatch', 'aria-label': swatchName, title: swatchName, 'data-rgb': paint,\n style: { backgroundColor: paint }, checked: chosen !== undefined && !chosen.isAutomatic && chosen.equals(swatch.colour),\n onChange: () => { set(each => { each.setColour(target, swatch.colour); }); },\n });\n }));\n return createElement('div', {\n role: 'radiogroup', 'aria-label': words.formatCellsLabel(isFill ? 'backgroundColour' : 'colour'), className: 'mantine-ex-sheet-palette',\n },\n createElement(Radio, {\n key: 'first', name, size, label: words.formatCellsLabel(isFill ? 'noColour' : 'automatic'),\n checked: isFill ? chosen === undefined : chosen?.isAutomatic === true, onChange: () => { set(each => { each.setColour(target, undefined); }); },\n }),\n swatches(formatCellsOffer.themeColours.flat(), 'theme'),\n swatches(formatCellsOffer.standardColours, 'standard'),\n createElement(DraftField, {\n key: `hex-${target}`, label: words.formatCellsLabel('moreColours'), size, placeholder: '#RRGGBB', maxLength: 7, 'data-target': target,\n className: 'mantine-ex-sheet-more-colours', value: () => draft.colourText(target), typed: (text: string) => { set(each => { each.setColourText(target, text); }); },\n }));\n}\n\nfunction FontTab(props: TabProps & { readonly id: string }): ReactElement {\n const { draft, words, size, set, id } = props;\n return createElement('div', null,\n createElement('div', { className: 'mantine-ex-sheet-format-cells-columns' },\n createElement(Fieldset, { legend: words.formatCellsLabel('fontStyle'), variant: 'unstyled', className: 'mantine-ex-sheet-format-cells-list' },\n ...formatCellsOffer.fontStyles.map(style => createElement(Radio, {\n key: style, name: `${id}-font-style`, size, label: words.fontStyleName(style), checked: draft.fontStyle === style,\n onChange: () => { set(each => { each.setFontStyle(style); }); },\n }))),\n createElement('div', { className: 'mantine-ex-sheet-format-cells-options' },\n createElement(NativeSelect, {\n label: words.formatCellsLabel('underline'), size, className: 'mantine-ex-sheet-format-cells-dropdown', value: draft.underline ? 'single' : 'none',\n data: [{ value: 'none', label: words.formatCellsLabel('underlineNone') }, { value: 'single', label: words.formatCellsLabel('underlineSingle') }],\n onChange: event => { const single = event.currentTarget.value === 'single'; set(each => { each.setUnderline(single); }); },\n }),\n createElement(Checkbox, {\n size, label: words.formatCellsLabel('strikethrough'), checked: draft.strikethrough,\n onChange: event => { const { checked } = event.currentTarget; set(each => { each.setStrikethrough(checked); }); },\n }),\n // Excel's Normal font (ADR-0071, 2026-10-02): checking it sets every part of the Font to its default; it\n // shows checked while they are, so unchecking it changes nothing.\n createElement(Checkbox, {\n size, label: words.formatCellsLabel('normalFont'), checked: draft.isNormalFont,\n onChange: event => { if (event.currentTarget.checked) set(each => { each.setNormalFont(); }); },\n }))),\n createElement(Fieldset, { legend: words.formatCellsLabel('colour'), variant: 'unstyled' }, createElement(Palette, { ...props, target: 'font' })));\n}\n\n/** One stroke of a line style's sample, `y` down it. */\nfunction sampleLine(y: number, width: string, dashes: string | undefined): ReactElement {\n return createElement('line', { key: y, x1: 0, y1: y, x2: 56, y2: y, stroke: 'currentColor', strokeWidth: width, strokeDasharray: dashes });\n}\n\n/** A line style's sample: a stroke and its dashes. */\nfunction lineSample(style: BorderLineStyle): ReactElement {\n const { width, dashes } = formatCellsLineStroke(style);\n const lines = style === 'none' ? [] : style === 'double' ? [sampleLine(2.5, width, undefined), sampleLine(5.5, width, undefined)] : [sampleLine(4, width, dashes)];\n return createElement('svg', { className: 'mantine-ex-sheet-format-cells-line', width: 56, height: 8, 'aria-hidden': true }, ...lines);\n}\n\n/** The preview: the range's edges as they will be, and an edge whose cells' sides differ as a grey dotted line. */\nfunction preview(draft: FormatCellsDraft, label: string): ReactElement {\n const edges: [Parameters<FormatCellsDraft['edgeLine']>[0], number, number, number, number][] = [\n ['top', 4, 4, 116, 4], ['bottom', 4, 68, 116, 68], ['left', 4, 4, 4, 68], ['right', 116, 4, 116, 68],\n ];\n if (draft.hasInsideHorizontal) edges.push(['insideHorizontal', 4, 36, 116, 36]);\n if (draft.hasInsideVertical) edges.push(['insideVertical', 60, 4, 60, 68]);\n const lines = edges.flatMap(([edge, x1, y1, x2, y2]) => {\n const line = draft.edgeLine(edge);\n if (line?.isNone === true) return [];\n if (line === undefined) {\n return [createElement('line', { key: edge, x1, y1, x2, y2, 'data-edge': edge, className: 'mantine-ex-sheet-format-cells-differs', stroke: '#808080', strokeWidth: 1, strokeDasharray: '1 2' })];\n }\n const { width, dashes } = formatCellsLineStroke(line.style);\n return [createElement('line', { key: edge, x1, y1, x2, y2, 'data-edge': edge, stroke: paintOf(line.colour), strokeWidth: width, strokeDasharray: dashes })];\n });\n return createElement('svg', { className: 'mantine-ex-sheet-format-cells-preview', width: 120, height: 72, viewBox: '0 0 120 72', role: 'img', 'aria-label': label }, ...lines);\n}\n\nfunction BorderTab(props: TabProps & { readonly id: string }): ReactElement {\n const { draft, words, size, set, id } = props;\n const pressedOf = (edge: Parameters<FormatCellsDraft['edgeLine']>[0]): 'true' | 'false' | 'mixed' => {\n const line = draft.edgeLine(edge);\n if (line === undefined) return 'mixed';\n return line.isNone ? 'false' : 'true';\n };\n return createElement('div', null,\n createElement('div', { className: 'mantine-ex-sheet-format-cells-columns' },\n createElement(Fieldset, { legend: words.formatCellsLabel('lineStyle'), variant: 'unstyled' },\n createElement('div', { className: 'mantine-ex-sheet-format-cells-columns' },\n ...formatCellsOffer.lineStyleColumns.map((column, at) => createElement('div', { key: at, className: 'mantine-ex-sheet-format-cells-line-column' },\n ...column.map(style => createElement(Radio, {\n key: style, name: `${id}-line-style`, size, 'aria-label': words.lineStyleName(style), title: words.lineStyleName(style),\n label: lineSample(style), checked: draft.lineStyle === style, onChange: () => { set(each => { each.setLineStyle(style); }); },\n })))))),\n createElement('div', { className: 'mantine-ex-sheet-format-cells-options' },\n createElement('div', { role: 'group', 'aria-label': words.formatCellsLabel('presets'), className: 'mantine-ex-sheet-format-cells-buttons' },\n ...formatCellsOffer.presets.map(preset => createElement(Button<'button'>, {\n key: preset, type: 'button', size, variant: 'default', disabled: !draft.canApply(preset),\n onClick: () => { set(each => { each.applyPreset(preset); }); },\n }, words.presetName(preset)))),\n createElement('div', { role: 'group', 'aria-label': words.formatCellsLabel('border'), className: 'mantine-ex-sheet-format-cells-buttons' },\n ...formatCellsOffer.edges.map(edge => {\n const pressed = pressedOf(edge);\n const named = { 'data-edge': edge };\n return createElement(Button<'button'>, {\n key: edge, type: 'button', size, variant: pressed === 'true' ? 'filled' : pressed === 'mixed' ? 'light' : 'default',\n disabled: !draft.canSet(edge), 'aria-pressed': pressed, ...named, onClick: () => { set(each => { each.toggleEdge(edge); }); },\n }, words.edgeName(edge));\n })),\n preview(draft, words.formatCellsLabel('preview')))),\n createElement(Fieldset, { legend: words.formatCellsLabel('colour'), variant: 'unstyled' }, createElement(Palette, { ...props, target: 'border' })));\n}\n\nfunction FillTab(props: TabProps & { readonly id: string }): ReactElement {\n return createElement(Fieldset, { legend: props.words.formatCellsLabel('backgroundColour'), variant: 'unstyled' }, createElement(Palette, { ...props, target: 'fill' }));\n}\n\nfunction tabContents(tab: FormatCellsTab, props: TabProps & { readonly id: string }): ReactElement {\n switch (tab) {\n case 'number': return createElement(NumberTab, props);\n case 'alignment': return createElement(AlignmentTab, props);\n case 'font': return createElement(FontTab, props);\n case 'border': return createElement(BorderTab, props);\n case 'fill': return createElement(FillTab, props);\n default: throw new RangeError(`Unknown Format Cells tab '${String(tab satisfies never)}' (ADR-0071).`);\n }\n}\n\n// Unique on the page, for the radio groups' names: two Sheets' Format Cells each have their own.\nlet openings = 0;\n\n/** Format Cells in Mantine's components, over the Sheet's draft. */\nexport function MantineFormatCells({ context }: { readonly context: SheetFormatCellsSlotContext }): ReactElement {\n const { tab, showTab, tabControl, set, refusal, submit, cancel } = useFormatCells(context);\n const size = useContext(MantineSizeContext);\n const [id] = useState(() => { openings += 1; return `mantine-ex-sheet-format-cells-${String(openings)}`; });\n const { draft, words } = context;\n // OK checks its fields first, on every tab, since each tab stays drawn while another is shown (useFormatCells).\n return createElement('form', { className: 'mantine-ex-sheet-format-cells', onSubmit: submit, noValidate: true },\n createElement(Tabs, {\n value: tab, keepMounted: true,\n onChange: (value: string | null) => {\n const shown = formatCellsOffer.tabs.find(each => each === value);\n if (shown === undefined) throw new RangeError(`'${String(value)}' is not a tab of Format Cells (ADR-0071).`);\n showTab(shown);\n },\n },\n createElement(Tabs.List, {\n 'aria-label': words.formatCellsLabel('tabs'),\n children: formatCellsOffer.tabs.map(each => createElement(Tabs.Tab, {\n key: each, value: each, ...(each === tab ? { ref: tabControl } : {}),\n }, words.tabName(each))),\n }),\n // Every tab stays drawn, its fields as typed: a field left invalid is still refused by OK from another tab.\n ...formatCellsOffer.tabs.map(each => createElement(Tabs.Panel, {\n key: each, value: each, className: 'mantine-ex-sheet-format-cells-panel',\n children: createElement('div', { 'data-ex-tab': each }, tabContents(each, { draft, words, size, set, id })),\n }))),\n refusal === undefined ? null : createElement(Text<'p'>, { role: 'alert', c: 'red', size, className: 'mantine-ex-sheet-format-cells-refusal' }, refusal),\n createElement('div', { className: 'mantine-ex-sheet-format-cells-actions' },\n createElement(Button<'button'>, { type: 'submit', size }, words.formatCellsLabel('ok')),\n createElement(Button<'button'>, { type: 'button', size, variant: 'default', onClick: cancel }, words.formatCellsLabel('cancel'))));\n}\n", "// A Toolbar Item of the Sheet Toolbar in Mantine's components (ADR-0100, ADR-0390): a toggle as an ActionIcon filled\n// in the theme's primary while the Focus cell has what it sets, a menu as a subtle Button that opens its list, a split\n// control as the face's ActionIcon beside an arrow's, and a Consumer's button as a subtle Button or ActionIcon. What\n// an item means, its list's opening and closing and the list's keys are ExSheet for React's `useToolbarItem`'s; this\n// draws them. The list is Mantine's Popover, kept inside the Sheet (no portal) so the Sheet hears its keys, and fixed\n// to the viewport so the toolbar's clipping does not cut it.\n\nimport { createElement, useCallback, useContext, useRef, type ReactElement } from 'react';\nimport { ActionIcon, Button, Popover, type MantineSize } from '@mantine/core';\nimport { MantineSizeContext } from '@ex-grid/mantine';\nimport { sheetToolbarPictures, type SheetToolbarIcon, type SheetToolbarItemSlotContext } from '@ex-grid/sheet';\nimport { useToolbarItem, type ToolbarItemHandles } from '@ex-grid/sheet-react';\n\n/** A picture of the built-in Chrome's, in the text's colour. */\nfunction picture(icon: SheetToolbarIcon, className = 'mantine-ex-sheet-toolbar-icon'): ReactElement {\n return createElement('svg', {\n className, viewBox: '0 0 16 16', 'aria-hidden': true, focusable: false, fill: 'none', stroke: 'currentColor',\n strokeLinecap: 'round', strokeLinejoin: 'round', dangerouslySetInnerHTML: { __html: sheetToolbarPictures[icon] },\n });\n}\n\n/** The arrow a list opens from. */\nfunction caret(): ReactElement {\n return createElement('svg', {\n className: 'mantine-ex-sheet-toolbar-caret', viewBox: '0 0 16 16', 'aria-hidden': true, focusable: false, fill: 'none',\n stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round',\n }, createElement('path', { d: 'M4.5 6.5 8 10l3.5-3.5' }));\n}\n\n/** A Consumer's own content, mounted into the element its callback ref is handed and taken away with it. */\nfunction OwnContent({ mount }: { readonly mount: (element: HTMLElement) => () => void }): ReactElement {\n const taken = useRef<(() => void) | undefined>(undefined);\n const ref = useCallback((element: HTMLSpanElement | null) => {\n taken.current?.();\n taken.current = element === null ? undefined : mount(element);\n }, [mount]);\n return createElement('span', { ref, className: 'mantine-ex-sheet-toolbar-content' });\n}\n\n/** An item's list: its choices, words and swatches as the Sheet hands them, in the theme's look. */\nfunction ChoiceList({ item, size }: { readonly item: ToolbarItemHandles; readonly size: MantineSize }): ReactElement {\n const { view, list, choice: props } = item;\n const option = (index: number): ReactElement => {\n const choice = view.choices[index];\n if (choice === undefined) throw new RangeError(`The list of ${view.name} has no choice ${String(index)} (ADR-0100).`);\n const common = { key: index, ...props(index) };\n if (choice.swatch !== undefined) {\n return createElement('button', {\n ...common, type: 'button', 'aria-label': choice.label, className: 'mantine-ex-sheet-swatch', style: { backgroundColor: choice.swatch },\n });\n }\n return createElement(Button<'button'>, {\n ...common, type: 'button', variant: choice.selected ? 'light' : 'subtle', ...(choice.selected ? {} : { color: 'gray' }), size, fullWidth: true,\n justify: 'flex-start', className: 'mantine-ex-sheet-choice', ...(choice.disabledReason === undefined ? {} : { 'data-disabled': true }),\n }, choice.label);\n };\n // The choices one to a row and the swatches ten across, in the Sheet's order, as the list's keys move among them.\n const rows = item.rows.map((row, at) => (typeof row === 'number'\n ? option(row)\n : createElement('div', { key: `s${String(at)}`, className: 'mantine-ex-sheet-swatches', role: 'none' }, ...row.map(option))));\n return createElement('div', { ...list, className: 'mantine-ex-sheet-choices' }, ...rows);\n}\n\n/** A Toolbar Item in Mantine's components, its list included. */\nexport function MantineToolbarItem({ context }: { readonly context: SheetToolbarItemSlotContext }): ReactElement {\n const item = useToolbarItem(context);\n const { view, open, control, toggleList } = item;\n const size = useContext(MantineSizeContext);\n const face = view.content !== undefined\n ? createElement(OwnContent, { mount: view.content })\n : view.icon !== undefined ? picture(view.icon) : (view.text ?? view.name);\n let drawn: ReactElement;\n switch (context.kind) {\n case 'toggle':\n drawn = createElement(ActionIcon<'button'>, {\n ...control, type: 'button', size, variant: view.pressed ? 'filled' : 'subtle', ...(view.pressed ? {} : { color: 'gray' }),\n 'aria-label': view.name, 'aria-pressed': view.pressed, onClick: () => { context.invoke(); },\n }, face);\n break;\n case 'menu':\n drawn = createElement(Button<'button'>, {\n ...control, type: 'button', size, variant: 'subtle', color: 'gray', 'aria-label': view.name, 'aria-haspopup': 'menu',\n 'aria-expanded': open, rightSection: caret(), className: 'mantine-ex-sheet-toolbar-menu', onClick: toggleList,\n }, view.text ?? view.name);\n break;\n case 'split':\n drawn = createElement('span', { className: 'mantine-ex-sheet-toolbar-split', role: 'group', 'aria-label': view.name },\n createElement(ActionIcon<'button'>, {\n ...control, type: 'button', size, variant: 'subtle', color: 'gray', 'aria-label': view.name, className: 'mantine-ex-sheet-toolbar-face',\n style: view.swatch === undefined ? undefined : { '--mantine-ex-sheet-swatch': view.swatch }, onClick: () => { context.invoke(); },\n }, face),\n createElement(ActionIcon<'button'>, {\n ...control, type: 'button', size, variant: 'subtle', color: 'gray', 'aria-label': view.moreName ?? view.name,\n 'aria-haspopup': 'menu', 'aria-expanded': open, className: 'mantine-ex-sheet-toolbar-arrow', onClick: toggleList,\n }, caret()));\n break;\n case 'button':\n drawn = view.content === undefined && view.icon !== undefined\n ? createElement(ActionIcon<'button'>, {\n ...control, type: 'button', size, variant: 'subtle', color: 'gray', 'aria-label': view.name, onClick: () => { context.invoke(); },\n }, face)\n : createElement(Button<'button'>, {\n ...control, type: 'button', size, variant: 'subtle', color: 'gray', 'aria-label': view.name, onClick: () => { context.invoke(); },\n }, face);\n break;\n default:\n throw new RangeError(`Unknown Toolbar Item kind '${String(context.kind satisfies never)}' (ADR-0100).`);\n }\n const classes = ['mantine-ex-sheet-toolbar-item'];\n if (view.active) classes.push('mantine-ex-sheet-toolbar-active');\n const body = !item.hasList ? drawn : createElement(Popover, {\n // A press outside is useToolbarItem's to hear, so Mantine's own is off.\n opened: open, closeOnClickOutside: false, withinPortal: false, floatingStrategy: 'fixed', position: 'bottom-start', offset: 2,\n trapFocus: false, returnFocus: false, closeOnEscape: false, withRoles: false, shadow: 'md', transitionProps: { duration: 0 },\n }, createElement(Popover.Target, null, drawn), createElement(Popover.Dropdown, { className: 'mantine-ex-sheet-toolbar-list' },\n createElement(ChoiceList, { item, size })));\n return createElement('span', { ref: item.item, className: classes.join(' ') }, body);\n}\n"],
|
|
5
|
+
"mappings": ";AAMA,SAAS,iBAAAA,gBAAe,eAAsD;AAC9E,SAAS,aAAqD;AAC9D,SAAS,sBAAAC,qBAAoB,qBAAqB;AAClD,SAAS,eAAkC;;;ACL3C,SAAS,iBAAAC,gBAAe,cAAAC,mBAAqC;AAC7D,SAAS,QAAAC,aAAY;AACrB,SAAS,sBAAAC,qBAAoB,qBAAqB;;;ACGlD,SAAS,eAAe,YAAY,gBAAmD;AACvF,SAAS,QAAQ,UAAU,UAAU,cAAc,OAAO,MAAM,MAAM,iBAAmC;AACzG,SAAS,0BAA0B;AACnC;AAAA,EACI;AAAA,EAAuB;AAAA,EAAkB;AAAA,OAEtC;AACP,SAAS,sBAAsB;AAY/B,SAAS,QAAQ,QAA4B;AACzC,SAAO,OAAO,cAAc,iBAAiB,OAAO,SAAS;AACjE;AAIA,SAAS,WAAW,EAAE,OAAO,OAAO,OAAO,MAAM,OAAO,QAAQ,WAAW,OAAO,GAAG,M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WAAW;AAAA,IACjD,GAAI,WAAW,SAAY,CAAC,IAAI,EAAE,OAAO;AAAA,IACzC,GAAI,WAAW,SAAY,CAAC,IAAI,EAAE,OAAO;AAAA,EAC7C,GAAGA;AAAA,IAAcC,oBAAmB;AAAA,IAAU,EAAE,OAAO,cAAc,OAAO,EAAE;AAAA,IAC1ED,eAAc,SAAS,EAAE,GAAG,OAAO,QAAQ,OAAO,CAAC;AAAA,EAAC,CAAC;AAC7D;",
|
|
6
|
+
"names": ["createElement", "MantineSizeContext", "createElement", "useContext", "Text", "MantineSizeContext", "createElement", "useContext", "Button", "MantineSizeContext", "useContext", "MantineSizeContext", "createElement", "Text", "createElement", "MantineSizeContext"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ex-grid/sheet-mantine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0-beta.3",
|
|
4
|
+
"description": "ExSheet for Mantine: the design-system Wrapper that draws ExSheet for React's Chrome, the Sheet Toolbar, Format Cells and the Sheet Tabs among it, with Mantine's components and maps its Visual Tokens onto a Mantine theme.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/AkiraMisawa/ex-grid.git",
|
|
9
|
+
"directory": "packages/sheet-mantine"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://akiramisawa.github.io/ex-grid/",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"*.css"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./styles.css": "./styles.css"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist/index.js",
|
|
25
|
+
"dist/index.js.map",
|
|
26
|
+
"dist/index.d.ts",
|
|
27
|
+
"styles.css"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@ex-grid/mantine": "0.2.0-beta.3",
|
|
31
|
+
"@ex-grid/sheet": "0.2.0-beta.3",
|
|
32
|
+
"@ex-grid/sheet-engine": "0.2.0-beta.3",
|
|
33
|
+
"@ex-grid/sheet-react": "0.2.0-beta.3"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@mantine/core": "^9.7.0",
|
|
37
|
+
"@mantine/hooks": "^9.7.0",
|
|
38
|
+
"react": "^19.2.0",
|
|
39
|
+
"react-dom": "^19.2.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/styles.css
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/* @ex-grid/sheet-mantine — the Sheet Wrapper's stylesheet (ADR-0390 section 5, ADR-0030), loaded after Mantine's and
|
|
2
|
+
@ex-grid/mantine's. The grid's tokens are @ex-grid/mantine's, under the Paper's .mantine-ex-grid; these rules dress
|
|
3
|
+
the Sheet's own Chrome, the Sheet Toolbar, the Sheet Tabs and Format Cells, in Mantine's variables, and lay out the
|
|
4
|
+
Wrapper's own elements. They set no geometry the Sheet or the grid computes with: the toolbar's rows and the tabs'
|
|
5
|
+
band keep the heights the Sheet writes inline (ADR-0028). The Paper and the Ink, what the cells lie on, stay the
|
|
6
|
+
Sheet's in every scheme, never Mantine's body (ADR-0071). Every rule is scoped under .mantine-ex-sheet, so it
|
|
7
|
+
outranks ex-sheet.css's bare-class defaults whatever order the two load in. */
|
|
8
|
+
|
|
9
|
+
/* The Sheet's Chrome is set in Mantine's font: only the cells keep the Sheet's own, whose widths its columns are
|
|
10
|
+
counted in (ADR-0027). */
|
|
11
|
+
.mantine-ex-sheet .ex-sheet-toolbar,
|
|
12
|
+
.mantine-ex-sheet .ex-sheet-tab-area {
|
|
13
|
+
font-family: var(--mantine-font-family);
|
|
14
|
+
font-size: var(--mantine-font-size-sm);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* The Sheet Toolbar (ADR-0100): Mantine's controls inside the Sheet's band, whose rows stay the Sheet's. The item the
|
|
18
|
+
band's keyboard stands on is outlined in the theme's primary, as Mantine outlines a focused control. */
|
|
19
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-item {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
height: 100%;
|
|
24
|
+
border-radius: var(--mantine-radius-sm);
|
|
25
|
+
}
|
|
26
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-active {
|
|
27
|
+
outline: 2px solid var(--mantine-ex-strong, var(--mantine-primary-color-filled));
|
|
28
|
+
outline-offset: -1px;
|
|
29
|
+
}
|
|
30
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-icon,
|
|
31
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-caret {
|
|
32
|
+
width: 16px;
|
|
33
|
+
height: 16px;
|
|
34
|
+
}
|
|
35
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-split {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-arrow {
|
|
40
|
+
min-width: 0;
|
|
41
|
+
width: auto;
|
|
42
|
+
padding: 0 1px;
|
|
43
|
+
}
|
|
44
|
+
/* A colour control's face shows the colour it sets beneath its picture, as Excel's does: the colour is the user's,
|
|
45
|
+
written inline. */
|
|
46
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-face {
|
|
47
|
+
box-shadow: inset 0 -3px 0 var(--mantine-ex-sheet-swatch, transparent);
|
|
48
|
+
}
|
|
49
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-menu .mantine-Button-label {
|
|
50
|
+
font-weight: 400;
|
|
51
|
+
}
|
|
52
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-content {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* A Toolbar Item's list, Mantine's Popover dropdown: the choices one to a row and the swatches ten across, as Excel's
|
|
58
|
+
palette lays them out. */
|
|
59
|
+
.mantine-ex-sheet .mantine-ex-sheet-toolbar-list {
|
|
60
|
+
padding: 4px;
|
|
61
|
+
}
|
|
62
|
+
.mantine-ex-sheet .mantine-ex-sheet-choices {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
gap: 2px;
|
|
66
|
+
min-width: 10em;
|
|
67
|
+
max-height: 60vh;
|
|
68
|
+
overflow-y: auto;
|
|
69
|
+
}
|
|
70
|
+
.mantine-ex-sheet .mantine-ex-sheet-choice {
|
|
71
|
+
font-weight: 400;
|
|
72
|
+
}
|
|
73
|
+
.mantine-ex-sheet .mantine-ex-sheet-choice[data-disabled] {
|
|
74
|
+
color: var(--mantine-color-dimmed);
|
|
75
|
+
cursor: default;
|
|
76
|
+
}
|
|
77
|
+
.mantine-ex-sheet .mantine-ex-sheet-swatches {
|
|
78
|
+
display: grid;
|
|
79
|
+
grid-template-columns: repeat(10, 18px);
|
|
80
|
+
gap: 4px;
|
|
81
|
+
padding: 4px 6px;
|
|
82
|
+
}
|
|
83
|
+
.mantine-ex-sheet .mantine-ex-sheet-swatch {
|
|
84
|
+
appearance: none;
|
|
85
|
+
width: 18px;
|
|
86
|
+
height: 18px;
|
|
87
|
+
margin: 0;
|
|
88
|
+
padding: 0;
|
|
89
|
+
border: 1px solid var(--mantine-ex-rule, var(--mantine-color-default-border));
|
|
90
|
+
border-radius: var(--mantine-radius-xs);
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
}
|
|
93
|
+
.mantine-ex-sheet .mantine-ex-sheet-swatch[aria-checked="true"],
|
|
94
|
+
.mantine-ex-sheet .mantine-ex-sheet-swatch:checked {
|
|
95
|
+
outline: 2px solid var(--mantine-ex-strong, var(--mantine-primary-color-filled));
|
|
96
|
+
outline-offset: 1px;
|
|
97
|
+
}
|
|
98
|
+
.mantine-ex-sheet .mantine-ex-sheet-swatch:focus-visible {
|
|
99
|
+
outline: 2px solid var(--mantine-ex-strong, var(--mantine-primary-color-filled));
|
|
100
|
+
outline-offset: 3px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* The Sheet Tabs (ADR-0331 §4): the selected tab's rule in the theme's primary, its face in Mantine's text. The tabs
|
|
104
|
+
themselves, their band and their keyboard, are the Sheet's. */
|
|
105
|
+
.mantine-ex-sheet .ex-sheet-tab[aria-selected="true"] {
|
|
106
|
+
border-bottom-color: var(--mantine-ex-strong, var(--mantine-primary-color-filled));
|
|
107
|
+
}
|
|
108
|
+
.mantine-ex-sheet .ex-sheet-tab-face {
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
}
|
|
112
|
+
.mantine-ex-sheet .mantine-ex-sheet-tab-add-face {
|
|
113
|
+
width: 14px;
|
|
114
|
+
height: 14px;
|
|
115
|
+
vertical-align: middle;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Format Cells (ADR-0071) inside the grid's popover frame, whose place and bound stay the grid's (ADR-0040). */
|
|
119
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
gap: 8px;
|
|
123
|
+
padding: 8px;
|
|
124
|
+
min-width: 28em;
|
|
125
|
+
}
|
|
126
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-panel {
|
|
127
|
+
min-height: 18em;
|
|
128
|
+
padding-top: 8px;
|
|
129
|
+
}
|
|
130
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-columns {
|
|
131
|
+
display: flex;
|
|
132
|
+
gap: 16px;
|
|
133
|
+
align-items: flex-start;
|
|
134
|
+
}
|
|
135
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-options {
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
gap: 6px;
|
|
139
|
+
flex: 1 1 auto;
|
|
140
|
+
min-width: 0;
|
|
141
|
+
}
|
|
142
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-list .mantine-Fieldset-legend + *,
|
|
143
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-list,
|
|
144
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-line-column {
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
gap: 4px;
|
|
148
|
+
}
|
|
149
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-reason {
|
|
150
|
+
margin: 0 0 4px 2em;
|
|
151
|
+
}
|
|
152
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-types {
|
|
153
|
+
max-height: 12em;
|
|
154
|
+
overflow-y: auto;
|
|
155
|
+
}
|
|
156
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-dropdown,
|
|
157
|
+
.mantine-ex-sheet .mantine-ex-sheet-more-colours {
|
|
158
|
+
max-width: 16em;
|
|
159
|
+
}
|
|
160
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-buttons {
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-wrap: wrap;
|
|
163
|
+
gap: 4px;
|
|
164
|
+
}
|
|
165
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-preview {
|
|
166
|
+
border: 1px solid var(--mantine-color-default-border);
|
|
167
|
+
color: var(--mantine-color-text);
|
|
168
|
+
}
|
|
169
|
+
.mantine-ex-sheet .mantine-ex-sheet-palette {
|
|
170
|
+
display: flex;
|
|
171
|
+
flex-direction: column;
|
|
172
|
+
gap: 6px;
|
|
173
|
+
margin-top: 8px;
|
|
174
|
+
}
|
|
175
|
+
.mantine-ex-sheet .mantine-ex-sheet-palette .mantine-ex-sheet-swatches {
|
|
176
|
+
padding: 0;
|
|
177
|
+
}
|
|
178
|
+
.mantine-ex-sheet .mantine-ex-sheet-format-cells-actions {
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: flex-end;
|
|
181
|
+
gap: 8px;
|
|
182
|
+
}
|