@dbcdk/react-components 0.0.194 → 0.0.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -10
- package/dist/client.cjs +486 -614
- package/dist/client.d.ts +176 -102
- package/dist/client.js +102 -102
- package/dist/components/color-scheme-button/ColorSchemeButton.cjs +7 -4
- package/dist/components/color-scheme-button/ColorSchemeButton.d.ts +7 -3
- package/dist/components/color-scheme-button/ColorSchemeButton.js +7 -4
- package/dist/components/forms/text-area/Textarea.cjs +2 -1
- package/dist/components/forms/text-area/Textarea.d.ts +1 -0
- package/dist/components/forms/text-area/Textarea.js +2 -1
- package/dist/components/highlighted-text/HighlightedText.cjs +6 -3
- package/dist/components/highlighted-text/HighlightedText.js +7 -4
- package/dist/components/json-viewer/JsonNode.cjs +27 -67
- package/dist/components/json-viewer/JsonNode.d.ts +10 -0
- package/dist/components/json-viewer/JsonNode.js +28 -68
- package/dist/components/json-viewer/JsonRow.cjs +85 -0
- package/dist/components/json-viewer/JsonRow.d.ts +5 -0
- package/dist/components/json-viewer/JsonRow.js +79 -0
- package/dist/components/json-viewer/JsonViewer.cjs +36 -256
- package/dist/components/json-viewer/JsonViewer.js +37 -253
- package/dist/components/json-viewer/JsonViewerShell.cjs +208 -0
- package/dist/components/json-viewer/JsonViewerShell.d.ts +25 -0
- package/dist/components/json-viewer/JsonViewerShell.js +202 -0
- package/dist/components/json-viewer/TanstackJsonViewer.cjs +127 -0
- package/dist/components/json-viewer/TanstackJsonViewer.d.ts +17 -0
- package/dist/components/json-viewer/TanstackJsonViewer.js +121 -0
- package/dist/components/json-viewer/types.d.ts +27 -0
- package/dist/components/json-viewer/useJsonViewerState.cjs +111 -0
- package/dist/components/json-viewer/useJsonViewerState.d.ts +42 -0
- package/dist/components/json-viewer/useJsonViewerState.js +108 -0
- package/dist/components/json-viewer/utils.cjs +36 -0
- package/dist/components/json-viewer/utils.d.ts +21 -1
- package/dist/components/json-viewer/utils.js +35 -1
- package/dist/components/lightbox/Lightbox.cjs +2 -2
- package/dist/components/lightbox/Lightbox.d.ts +1 -1
- package/dist/components/lightbox/Lightbox.js +1 -1
- package/dist/components/line-viewer/LineViewer.cjs +2 -3
- package/dist/components/line-viewer/LineViewer.js +2 -3
- package/dist/components/line-viewer/tokenizeLineFormat.cjs +37 -17
- package/dist/components/line-viewer/tokenizeLineFormat.d.ts +5 -4
- package/dist/components/line-viewer/tokenizeLineFormat.js +37 -17
- package/dist/components/menu/Menu.cjs +3 -23
- package/dist/components/menu/Menu.js +3 -23
- package/dist/components/menu/Menu.module.css +4 -3
- package/dist/components/metric-tile/MetricTile.cjs +3 -2
- package/dist/components/metric-tile/MetricTile.js +2 -1
- package/dist/components/overlay/tooltip/Tooltip.cjs +7 -2
- package/dist/components/overlay/tooltip/Tooltip.d.ts +7 -1
- package/dist/components/overlay/tooltip/Tooltip.js +7 -2
- package/dist/components/overlay/tooltip/useTooltipTrigger.cjs +7 -1
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +7 -1
- package/dist/components/page-layout/PageLayout.module.css +1 -1
- package/dist/components/table/Table.cjs +45 -16
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +47 -18
- package/dist/components/table/Table.module.css +135 -7
- package/dist/components/table/Table.types.d.ts +47 -1
- package/dist/components/table/TanstackTable.cjs +30 -2
- package/dist/components/table/TanstackTable.js +31 -3
- package/dist/components/table/components/TableBody.d.ts +1 -2
- package/dist/components/table/components/TableHeader.cjs +6 -4
- package/dist/components/table/components/TableHeader.d.ts +2 -1
- package/dist/components/table/components/TableHeader.js +6 -4
- package/dist/components/table/components/TableHeaderCell.cjs +5 -4
- package/dist/components/table/components/TableHeaderCell.d.ts +3 -1
- package/dist/components/table/components/TableHeaderCell.js +5 -4
- package/dist/components/table/components/TableRow.cjs +1 -1
- package/dist/components/table/components/TableRow.d.ts +1 -2
- package/dist/components/table/components/TableRow.js +1 -1
- package/dist/components/table/components/TableSkeletonBody.cjs +30 -0
- package/dist/components/table/components/TableSkeletonBody.d.ts +13 -0
- package/dist/components/table/components/TableSkeletonBody.js +24 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.cjs +28 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.d.ts +11 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.js +26 -0
- package/dist/components/table/components/table-settings/TableSettings.cjs +82 -32
- package/dist/components/table/components/table-settings/TableSettings.d.ts +14 -6
- package/dist/components/table/components/table-settings/TableSettings.js +84 -34
- package/dist/components/table/table.utils.cjs +2 -0
- package/dist/components/table/table.utils.d.ts +6 -0
- package/dist/components/table/table.utils.js +2 -1
- package/dist/components/table/tableSettings.utils.cjs +29 -0
- package/dist/components/table/tableSettings.utils.d.ts +9 -0
- package/dist/components/table/tableSettings.utils.js +24 -0
- package/dist/components/table/tanstackTable.utils.cjs +18 -0
- package/dist/components/table/tanstackTable.utils.js +19 -1
- package/dist/components/theme-button/ThemeButton.cjs +9 -4
- package/dist/components/theme-button/ThemeButton.d.ts +4 -2
- package/dist/components/theme-button/ThemeButton.js +9 -4
- package/dist/components/theme-script/ThemeScript.cjs +10 -4
- package/dist/components/theme-script/ThemeScript.d.ts +9 -1
- package/dist/components/theme-script/ThemeScript.js +10 -4
- package/dist/components/xml-viewer/XmlViewer.cjs +2 -3
- package/dist/components/xml-viewer/XmlViewer.js +2 -3
- package/dist/hooks/useColorScheme.cjs +18 -14
- package/dist/hooks/useColorScheme.d.ts +11 -1
- package/dist/hooks/useColorScheme.js +19 -15
- package/dist/hooks/useGetActiveTheme.cjs +4 -3
- package/dist/hooks/useGetActiveTheme.d.ts +7 -1
- package/dist/hooks/useGetActiveTheme.js +4 -3
- package/dist/hooks/useTableData.cjs +11 -7
- package/dist/hooks/useTableData.d.ts +8 -2
- package/dist/hooks/useTableData.js +11 -7
- package/dist/hooks/useTableSettings.cjs +25 -9
- package/dist/hooks/useTableSettings.d.ts +9 -6
- package/dist/hooks/useTableSettings.js +25 -9
- package/dist/hooks/useTheme.d.ts +6 -0
- package/dist/styles/styles.css +7 -3
- package/dist/styles/themes/dbc/colors.css +1 -1
- package/dist/styles.css +1 -476
- package/dist/tanstack-virtual.cjs +12 -0
- package/dist/tanstack-virtual.d.ts +1 -0
- package/dist/tanstack-virtual.js +1 -0
- package/package.json +13 -1
|
@@ -1,34 +1,51 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const FIELD_LINE_PATTERN = /^(\
|
|
3
|
+
const FIELD_LINE_PATTERN = /^(\d{3})(\s+)(?:((?!\*)\S+)(\s+))?(\*[\s\S]*)$/;
|
|
4
4
|
const SUBFIELD_PATTERN = /\*(\S)([^*]*)/g;
|
|
5
|
+
function tokenizeSubfields(text) {
|
|
6
|
+
const tokens = [];
|
|
7
|
+
SUBFIELD_PATTERN.lastIndex = 0;
|
|
8
|
+
let match;
|
|
9
|
+
let lastIndex = 0;
|
|
10
|
+
while (match = SUBFIELD_PATTERN.exec(text)) {
|
|
11
|
+
if (match.index > lastIndex) {
|
|
12
|
+
tokens.push({ type: "text", value: text.slice(lastIndex, match.index) });
|
|
13
|
+
}
|
|
14
|
+
tokens.push({ type: "subfieldMarker", value: "*" });
|
|
15
|
+
tokens.push({ type: "subfieldCode", value: match[1] });
|
|
16
|
+
tokens.push({ type: "value", value: match[2] });
|
|
17
|
+
lastIndex = SUBFIELD_PATTERN.lastIndex;
|
|
18
|
+
}
|
|
19
|
+
if (lastIndex < text.length) {
|
|
20
|
+
tokens.push({ type: "text", value: text.slice(lastIndex) });
|
|
21
|
+
}
|
|
22
|
+
return tokens;
|
|
23
|
+
}
|
|
24
|
+
function tokenizeContinuationLine(line, continuesValue) {
|
|
25
|
+
const tokens = tokenizeSubfields(line);
|
|
26
|
+
if (!continuesValue) return tokens;
|
|
27
|
+
return tokens.map((token) => token.type === "text" ? { ...token, type: "value" } : token);
|
|
28
|
+
}
|
|
5
29
|
function tokenizeFieldLine(line) {
|
|
6
30
|
const match = FIELD_LINE_PATTERN.exec(line);
|
|
7
|
-
if (!match) return
|
|
31
|
+
if (!match) return tokenizeContinuationLine(line, false);
|
|
8
32
|
const [, tag, gap1, indicator, gap2, rest] = match;
|
|
9
33
|
const tokens = [
|
|
10
34
|
{ type: "tag", value: tag },
|
|
11
|
-
{ type: "whitespace", value: gap1 }
|
|
12
|
-
{ type: "indicator", value: indicator },
|
|
13
|
-
{ type: "whitespace", value: gap2 }
|
|
35
|
+
{ type: "whitespace", value: gap1 }
|
|
14
36
|
];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
while (match2 = SUBFIELD_PATTERN.exec(rest)) {
|
|
19
|
-
tokens.push({ type: "subfieldMarker", value: "*" });
|
|
20
|
-
tokens.push({ type: "subfieldCode", value: match2[1] });
|
|
21
|
-
tokens.push({ type: "value", value: match2[2] });
|
|
22
|
-
lastIndex = SUBFIELD_PATTERN.lastIndex;
|
|
23
|
-
}
|
|
24
|
-
if (lastIndex < rest.length) {
|
|
25
|
-
tokens.push({ type: "text", value: rest.slice(lastIndex) });
|
|
37
|
+
if (indicator !== void 0) {
|
|
38
|
+
tokens.push({ type: "indicator", value: indicator });
|
|
39
|
+
tokens.push({ type: "whitespace", value: gap2 });
|
|
26
40
|
}
|
|
41
|
+
tokens.push(...tokenizeSubfields(rest));
|
|
27
42
|
return tokens;
|
|
28
43
|
}
|
|
29
44
|
function tokenizeLineFormat(source) {
|
|
45
|
+
var _a;
|
|
30
46
|
const tokens = [];
|
|
31
47
|
const chunks = source.split(/(\n)/);
|
|
48
|
+
let continuesValue = false;
|
|
32
49
|
for (const chunk of chunks) {
|
|
33
50
|
if (chunk === "") continue;
|
|
34
51
|
if (chunk === "\n") {
|
|
@@ -42,9 +59,12 @@ function tokenizeLineFormat(source) {
|
|
|
42
59
|
if (leading) tokens.push({ type: "text", value: leading });
|
|
43
60
|
tokens.push({ type: "terminator", value: "$" });
|
|
44
61
|
if (trailing) tokens.push({ type: "text", value: trailing });
|
|
62
|
+
continuesValue = false;
|
|
45
63
|
continue;
|
|
46
64
|
}
|
|
47
|
-
|
|
65
|
+
const lineTokens = FIELD_LINE_PATTERN.test(chunk) ? tokenizeFieldLine(chunk) : tokenizeContinuationLine(chunk, continuesValue);
|
|
66
|
+
tokens.push(...lineTokens);
|
|
67
|
+
continuesValue = ((_a = lineTokens[lineTokens.length - 1]) == null ? void 0 : _a.type) === "value";
|
|
48
68
|
}
|
|
49
69
|
return tokens;
|
|
50
70
|
}
|
|
@@ -4,11 +4,12 @@ export interface LineToken {
|
|
|
4
4
|
value: string;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Tokenizes a MARC-style "line format" record (field tag,
|
|
8
|
-
* `*code value` subfields, terminated by a lone `$`) for syntax
|
|
7
|
+
* Tokenizes a MARC-style "line format" record (field tag, optional
|
|
8
|
+
* indicators, `*code value` subfields, terminated by a lone `$`) for syntax
|
|
9
9
|
* highlighting without imposing a strict grammar. Preserves the source
|
|
10
10
|
* exactly - concatenating every token's `value` reproduces the input - so a
|
|
11
|
-
* wrapped continuation
|
|
12
|
-
* text instead of breaking the
|
|
11
|
+
* wrapped continuation after a subfield value retains value styling, while a
|
|
12
|
+
* standalone malformed line displays as plain text instead of breaking the
|
|
13
|
+
* tokenizer.
|
|
13
14
|
*/
|
|
14
15
|
export declare function tokenizeLineFormat(source: string): LineToken[];
|
|
@@ -1,32 +1,49 @@
|
|
|
1
|
-
const FIELD_LINE_PATTERN = /^(\
|
|
1
|
+
const FIELD_LINE_PATTERN = /^(\d{3})(\s+)(?:((?!\*)\S+)(\s+))?(\*[\s\S]*)$/;
|
|
2
2
|
const SUBFIELD_PATTERN = /\*(\S)([^*]*)/g;
|
|
3
|
+
function tokenizeSubfields(text) {
|
|
4
|
+
const tokens = [];
|
|
5
|
+
SUBFIELD_PATTERN.lastIndex = 0;
|
|
6
|
+
let match;
|
|
7
|
+
let lastIndex = 0;
|
|
8
|
+
while (match = SUBFIELD_PATTERN.exec(text)) {
|
|
9
|
+
if (match.index > lastIndex) {
|
|
10
|
+
tokens.push({ type: "text", value: text.slice(lastIndex, match.index) });
|
|
11
|
+
}
|
|
12
|
+
tokens.push({ type: "subfieldMarker", value: "*" });
|
|
13
|
+
tokens.push({ type: "subfieldCode", value: match[1] });
|
|
14
|
+
tokens.push({ type: "value", value: match[2] });
|
|
15
|
+
lastIndex = SUBFIELD_PATTERN.lastIndex;
|
|
16
|
+
}
|
|
17
|
+
if (lastIndex < text.length) {
|
|
18
|
+
tokens.push({ type: "text", value: text.slice(lastIndex) });
|
|
19
|
+
}
|
|
20
|
+
return tokens;
|
|
21
|
+
}
|
|
22
|
+
function tokenizeContinuationLine(line, continuesValue) {
|
|
23
|
+
const tokens = tokenizeSubfields(line);
|
|
24
|
+
if (!continuesValue) return tokens;
|
|
25
|
+
return tokens.map((token) => token.type === "text" ? { ...token, type: "value" } : token);
|
|
26
|
+
}
|
|
3
27
|
function tokenizeFieldLine(line) {
|
|
4
28
|
const match = FIELD_LINE_PATTERN.exec(line);
|
|
5
|
-
if (!match) return
|
|
29
|
+
if (!match) return tokenizeContinuationLine(line, false);
|
|
6
30
|
const [, tag, gap1, indicator, gap2, rest] = match;
|
|
7
31
|
const tokens = [
|
|
8
32
|
{ type: "tag", value: tag },
|
|
9
|
-
{ type: "whitespace", value: gap1 }
|
|
10
|
-
{ type: "indicator", value: indicator },
|
|
11
|
-
{ type: "whitespace", value: gap2 }
|
|
33
|
+
{ type: "whitespace", value: gap1 }
|
|
12
34
|
];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
while (match2 = SUBFIELD_PATTERN.exec(rest)) {
|
|
17
|
-
tokens.push({ type: "subfieldMarker", value: "*" });
|
|
18
|
-
tokens.push({ type: "subfieldCode", value: match2[1] });
|
|
19
|
-
tokens.push({ type: "value", value: match2[2] });
|
|
20
|
-
lastIndex = SUBFIELD_PATTERN.lastIndex;
|
|
21
|
-
}
|
|
22
|
-
if (lastIndex < rest.length) {
|
|
23
|
-
tokens.push({ type: "text", value: rest.slice(lastIndex) });
|
|
35
|
+
if (indicator !== void 0) {
|
|
36
|
+
tokens.push({ type: "indicator", value: indicator });
|
|
37
|
+
tokens.push({ type: "whitespace", value: gap2 });
|
|
24
38
|
}
|
|
39
|
+
tokens.push(...tokenizeSubfields(rest));
|
|
25
40
|
return tokens;
|
|
26
41
|
}
|
|
27
42
|
function tokenizeLineFormat(source) {
|
|
43
|
+
var _a;
|
|
28
44
|
const tokens = [];
|
|
29
45
|
const chunks = source.split(/(\n)/);
|
|
46
|
+
let continuesValue = false;
|
|
30
47
|
for (const chunk of chunks) {
|
|
31
48
|
if (chunk === "") continue;
|
|
32
49
|
if (chunk === "\n") {
|
|
@@ -40,9 +57,12 @@ function tokenizeLineFormat(source) {
|
|
|
40
57
|
if (leading) tokens.push({ type: "text", value: leading });
|
|
41
58
|
tokens.push({ type: "terminator", value: "$" });
|
|
42
59
|
if (trailing) tokens.push({ type: "text", value: trailing });
|
|
60
|
+
continuesValue = false;
|
|
43
61
|
continue;
|
|
44
62
|
}
|
|
45
|
-
|
|
63
|
+
const lineTokens = FIELD_LINE_PATTERN.test(chunk) ? tokenizeFieldLine(chunk) : tokenizeContinuationLine(chunk, continuesValue);
|
|
64
|
+
tokens.push(...lineTokens);
|
|
65
|
+
continuesValue = ((_a = lineTokens[lineTokens.length - 1]) == null ? void 0 : _a.type) === "value";
|
|
46
66
|
}
|
|
47
67
|
return tokens;
|
|
48
68
|
}
|
|
@@ -192,13 +192,7 @@ const MenuCheckItem = React__namespace.forwardRef(
|
|
|
192
192
|
className,
|
|
193
193
|
...liProps
|
|
194
194
|
}, ref) => {
|
|
195
|
-
const
|
|
196
|
-
const interactiveClass = [
|
|
197
|
-
styles__default.default.interactiveChild,
|
|
198
|
-
styles__default.default.item,
|
|
199
|
-
active ? styles__default.default.active : "",
|
|
200
|
-
isSelected ? styles__default.default.selected : ""
|
|
201
|
-
].filter(Boolean).join(" ");
|
|
195
|
+
const interactiveClass = [styles__default.default.interactiveChild, styles__default.default.item, active ? styles__default.default.active : ""].filter(Boolean).join(" ");
|
|
202
196
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
203
197
|
"li",
|
|
204
198
|
{
|
|
@@ -212,7 +206,6 @@ const MenuCheckItem = React__namespace.forwardRef(
|
|
|
212
206
|
ref: interactiveRef,
|
|
213
207
|
role: interactiveProps == null ? void 0 : interactiveProps.role,
|
|
214
208
|
tabIndex: -1,
|
|
215
|
-
"aria-selected": isSelected || void 0,
|
|
216
209
|
"aria-disabled": disabled || void 0,
|
|
217
210
|
className: interactiveClass,
|
|
218
211
|
...interactiveProps,
|
|
@@ -265,12 +258,7 @@ const MenuRadioItem = React__namespace.forwardRef(
|
|
|
265
258
|
...liProps
|
|
266
259
|
}, ref) => {
|
|
267
260
|
var _a, _b;
|
|
268
|
-
const interactiveClass = [
|
|
269
|
-
styles__default.default.interactiveChild,
|
|
270
|
-
styles__default.default.item,
|
|
271
|
-
active ? styles__default.default.active : "",
|
|
272
|
-
checked ? styles__default.default.selected : ""
|
|
273
|
-
].filter(Boolean).join(" ");
|
|
261
|
+
const interactiveClass = [styles__default.default.interactiveChild, styles__default.default.item, active ? styles__default.default.active : ""].filter(Boolean).join(" ");
|
|
274
262
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
275
263
|
"li",
|
|
276
264
|
{
|
|
@@ -285,7 +273,6 @@ const MenuRadioItem = React__namespace.forwardRef(
|
|
|
285
273
|
role: (_a = interactiveProps == null ? void 0 : interactiveProps.role) != null ? _a : "menuitemradio",
|
|
286
274
|
tabIndex: (_b = interactiveProps == null ? void 0 : interactiveProps.tabIndex) != null ? _b : 0,
|
|
287
275
|
"aria-checked": checked || void 0,
|
|
288
|
-
"aria-selected": checked || void 0,
|
|
289
276
|
"aria-disabled": disabled || void 0,
|
|
290
277
|
className: interactiveClass,
|
|
291
278
|
...interactiveProps,
|
|
@@ -343,13 +330,7 @@ const MenuSwitchItem = React__namespace.forwardRef(
|
|
|
343
330
|
className,
|
|
344
331
|
...liProps
|
|
345
332
|
}, ref) => {
|
|
346
|
-
const
|
|
347
|
-
const interactiveClass = [
|
|
348
|
-
styles__default.default.interactiveChild,
|
|
349
|
-
styles__default.default.item,
|
|
350
|
-
active ? styles__default.default.active : "",
|
|
351
|
-
isSelected ? styles__default.default.selected : ""
|
|
352
|
-
].filter(Boolean).join(" ");
|
|
333
|
+
const interactiveClass = [styles__default.default.interactiveChild, styles__default.default.item, active ? styles__default.default.active : ""].filter(Boolean).join(" ");
|
|
353
334
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
354
335
|
"li",
|
|
355
336
|
{
|
|
@@ -363,7 +344,6 @@ const MenuSwitchItem = React__namespace.forwardRef(
|
|
|
363
344
|
ref: interactiveRef,
|
|
364
345
|
role: interactiveProps == null ? void 0 : interactiveProps.role,
|
|
365
346
|
tabIndex: -1,
|
|
366
|
-
"aria-selected": isSelected || void 0,
|
|
367
347
|
"aria-disabled": disabled || void 0,
|
|
368
348
|
className: interactiveClass,
|
|
369
349
|
...interactiveProps,
|
|
@@ -167,13 +167,7 @@ const MenuCheckItem = React.forwardRef(
|
|
|
167
167
|
className,
|
|
168
168
|
...liProps
|
|
169
169
|
}, ref) => {
|
|
170
|
-
const
|
|
171
|
-
const interactiveClass = [
|
|
172
|
-
styles.interactiveChild,
|
|
173
|
-
styles.item,
|
|
174
|
-
active ? styles.active : "",
|
|
175
|
-
isSelected ? styles.selected : ""
|
|
176
|
-
].filter(Boolean).join(" ");
|
|
170
|
+
const interactiveClass = [styles.interactiveChild, styles.item, active ? styles.active : ""].filter(Boolean).join(" ");
|
|
177
171
|
return /* @__PURE__ */ jsx(
|
|
178
172
|
"li",
|
|
179
173
|
{
|
|
@@ -187,7 +181,6 @@ const MenuCheckItem = React.forwardRef(
|
|
|
187
181
|
ref: interactiveRef,
|
|
188
182
|
role: interactiveProps == null ? void 0 : interactiveProps.role,
|
|
189
183
|
tabIndex: -1,
|
|
190
|
-
"aria-selected": isSelected || void 0,
|
|
191
184
|
"aria-disabled": disabled || void 0,
|
|
192
185
|
className: interactiveClass,
|
|
193
186
|
...interactiveProps,
|
|
@@ -240,12 +233,7 @@ const MenuRadioItem = React.forwardRef(
|
|
|
240
233
|
...liProps
|
|
241
234
|
}, ref) => {
|
|
242
235
|
var _a, _b;
|
|
243
|
-
const interactiveClass = [
|
|
244
|
-
styles.interactiveChild,
|
|
245
|
-
styles.item,
|
|
246
|
-
active ? styles.active : "",
|
|
247
|
-
checked ? styles.selected : ""
|
|
248
|
-
].filter(Boolean).join(" ");
|
|
236
|
+
const interactiveClass = [styles.interactiveChild, styles.item, active ? styles.active : ""].filter(Boolean).join(" ");
|
|
249
237
|
return /* @__PURE__ */ jsx(
|
|
250
238
|
"li",
|
|
251
239
|
{
|
|
@@ -260,7 +248,6 @@ const MenuRadioItem = React.forwardRef(
|
|
|
260
248
|
role: (_a = interactiveProps == null ? void 0 : interactiveProps.role) != null ? _a : "menuitemradio",
|
|
261
249
|
tabIndex: (_b = interactiveProps == null ? void 0 : interactiveProps.tabIndex) != null ? _b : 0,
|
|
262
250
|
"aria-checked": checked || void 0,
|
|
263
|
-
"aria-selected": checked || void 0,
|
|
264
251
|
"aria-disabled": disabled || void 0,
|
|
265
252
|
className: interactiveClass,
|
|
266
253
|
...interactiveProps,
|
|
@@ -318,13 +305,7 @@ const MenuSwitchItem = React.forwardRef(
|
|
|
318
305
|
className,
|
|
319
306
|
...liProps
|
|
320
307
|
}, ref) => {
|
|
321
|
-
const
|
|
322
|
-
const interactiveClass = [
|
|
323
|
-
styles.interactiveChild,
|
|
324
|
-
styles.item,
|
|
325
|
-
active ? styles.active : "",
|
|
326
|
-
isSelected ? styles.selected : ""
|
|
327
|
-
].filter(Boolean).join(" ");
|
|
308
|
+
const interactiveClass = [styles.interactiveChild, styles.item, active ? styles.active : ""].filter(Boolean).join(" ");
|
|
328
309
|
return /* @__PURE__ */ jsx(
|
|
329
310
|
"li",
|
|
330
311
|
{
|
|
@@ -338,7 +319,6 @@ const MenuSwitchItem = React.forwardRef(
|
|
|
338
319
|
ref: interactiveRef,
|
|
339
320
|
role: interactiveProps == null ? void 0 : interactiveProps.role,
|
|
340
321
|
tabIndex: -1,
|
|
341
|
-
"aria-selected": isSelected || void 0,
|
|
342
322
|
"aria-disabled": disabled || void 0,
|
|
343
323
|
className: interactiveClass,
|
|
344
324
|
...interactiveProps,
|
|
@@ -184,9 +184,10 @@
|
|
|
184
184
|
background-color: var(--color-bg-selected-hover);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
/* Checked (legacy support; kept in case any interactive element still uses aria-checked)
|
|
188
|
-
.
|
|
189
|
-
|
|
187
|
+
/* Checked (legacy support; kept in case any interactive element still uses aria-checked).
|
|
188
|
+
Menu.CheckItem/RadioItem/SwitchItem wrappers (.interactiveChild) are excluded on purpose:
|
|
189
|
+
their control already shows the checked state. */
|
|
190
|
+
.interactive[aria-checked='true'] {
|
|
190
191
|
background-color: var(--color-bg-selected);
|
|
191
192
|
color: var(--color-fg-default);
|
|
192
193
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
var react = require('react');
|
|
5
|
-
var
|
|
6
|
+
var Tooltip = require('../../components/overlay/tooltip/Tooltip');
|
|
6
7
|
var styles = require('./MetricTile.module.css');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -88,7 +89,7 @@ const MetricTileBase = ({
|
|
|
88
89
|
onClick == null ? void 0 : onClick();
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
92
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: tooltip, placement: "bottom", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
92
93
|
"span",
|
|
93
94
|
{
|
|
94
95
|
className: styles__default.default.tile,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import { Children, isValidElement } from 'react';
|
|
3
|
-
import { Tooltip } from '../../
|
|
4
|
+
import { Tooltip } from '../../components/overlay/tooltip/Tooltip';
|
|
4
5
|
import styles from './MetricTile.module.css';
|
|
5
6
|
|
|
6
7
|
function toSize(v) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -26,7 +27,9 @@ function Tooltip({
|
|
|
26
27
|
open,
|
|
27
28
|
offset = 8,
|
|
28
29
|
delayOpenMs,
|
|
29
|
-
delayCloseMs
|
|
30
|
+
delayCloseMs,
|
|
31
|
+
focusOpenMode,
|
|
32
|
+
closeOnPointerDown
|
|
30
33
|
}) {
|
|
31
34
|
var _a;
|
|
32
35
|
const { triggerProps } = useTooltipTrigger.useTooltipTrigger({
|
|
@@ -35,7 +38,9 @@ function Tooltip({
|
|
|
35
38
|
offset,
|
|
36
39
|
open,
|
|
37
40
|
delayOpenMs,
|
|
38
|
-
delayCloseMs
|
|
41
|
+
delayCloseMs,
|
|
42
|
+
focusOpenMode,
|
|
43
|
+
closeOnPointerDown
|
|
39
44
|
});
|
|
40
45
|
if (!content) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
41
46
|
const child = children;
|
|
@@ -8,5 +8,11 @@ export interface TooltipProps {
|
|
|
8
8
|
offset?: number;
|
|
9
9
|
delayOpenMs?: number;
|
|
10
10
|
delayCloseMs?: number;
|
|
11
|
+
/**
|
|
12
|
+
* When the tooltip should open on focus: only for keyboard focus (default),
|
|
13
|
+
* for any focus (e.g. clicking into an input), or never.
|
|
14
|
+
*/
|
|
15
|
+
focusOpenMode?: 'focus-visible' | 'any' | 'off';
|
|
16
|
+
closeOnPointerDown?: boolean;
|
|
11
17
|
}
|
|
12
|
-
export declare function Tooltip({ children, content, placement, open, offset, delayOpenMs, delayCloseMs, }: TooltipProps): ReactElement;
|
|
18
|
+
export declare function Tooltip({ children, content, placement, open, offset, delayOpenMs, delayCloseMs, focusOpenMode, closeOnPointerDown, }: TooltipProps): ReactElement;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
3
|
import { cloneElement } from 'react';
|
|
3
4
|
import { useTooltipTrigger } from './useTooltipTrigger';
|
|
@@ -24,7 +25,9 @@ function Tooltip({
|
|
|
24
25
|
open,
|
|
25
26
|
offset = 8,
|
|
26
27
|
delayOpenMs,
|
|
27
|
-
delayCloseMs
|
|
28
|
+
delayCloseMs,
|
|
29
|
+
focusOpenMode,
|
|
30
|
+
closeOnPointerDown
|
|
28
31
|
}) {
|
|
29
32
|
var _a;
|
|
30
33
|
const { triggerProps } = useTooltipTrigger({
|
|
@@ -33,7 +36,9 @@ function Tooltip({
|
|
|
33
36
|
offset,
|
|
34
37
|
open,
|
|
35
38
|
delayOpenMs,
|
|
36
|
-
delayCloseMs
|
|
39
|
+
delayCloseMs,
|
|
40
|
+
focusOpenMode,
|
|
41
|
+
closeOnPointerDown
|
|
37
42
|
});
|
|
38
43
|
if (!content) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
39
44
|
const child = children;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var react = require('react');
|
|
@@ -24,6 +25,7 @@ function useTooltipTrigger(options) {
|
|
|
24
25
|
const isOpen = isControlled ? !!open : uncontrolledOpen;
|
|
25
26
|
const openTimer = react.useRef(null);
|
|
26
27
|
const closeTimer = react.useRef(null);
|
|
28
|
+
const openedByFocusRef = react.useRef(false);
|
|
27
29
|
const clearTimers = () => {
|
|
28
30
|
if (openTimer.current) window.clearTimeout(openTimer.current);
|
|
29
31
|
if (closeTimer.current) window.clearTimeout(closeTimer.current);
|
|
@@ -79,6 +81,7 @@ function useTooltipTrigger(options) {
|
|
|
79
81
|
const onPointerLeave = () => {
|
|
80
82
|
clearTimers();
|
|
81
83
|
if (isControlled) return;
|
|
84
|
+
if (openedByFocusRef.current) return;
|
|
82
85
|
closeTimer.current = window.setTimeout(() => setOpen(false), delayCloseMs);
|
|
83
86
|
};
|
|
84
87
|
const onPointerDown = () => {
|
|
@@ -89,12 +92,15 @@ function useTooltipTrigger(options) {
|
|
|
89
92
|
clearTimers();
|
|
90
93
|
if (focusOpenMode === "off") return;
|
|
91
94
|
const shouldOpen = focusOpenMode === "any" || e.currentTarget.matches(":focus-visible");
|
|
92
|
-
if (!
|
|
95
|
+
if (!shouldOpen) return;
|
|
96
|
+
openedByFocusRef.current = true;
|
|
97
|
+
if (!isControlled) {
|
|
93
98
|
openTimer.current = window.setTimeout(() => setOpen(true), delayOpenMs);
|
|
94
99
|
}
|
|
95
100
|
};
|
|
96
101
|
const onBlur = () => {
|
|
97
102
|
clearTimers();
|
|
103
|
+
openedByFocusRef.current = false;
|
|
98
104
|
if (!isControlled) setOpen(false);
|
|
99
105
|
};
|
|
100
106
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { useContext, useId, useRef, useState, useCallback, useEffect } from 'react';
|
|
2
3
|
import { TooltipContext } from './TooltipProvider';
|
|
3
4
|
|
|
@@ -22,6 +23,7 @@ function useTooltipTrigger(options) {
|
|
|
22
23
|
const isOpen = isControlled ? !!open : uncontrolledOpen;
|
|
23
24
|
const openTimer = useRef(null);
|
|
24
25
|
const closeTimer = useRef(null);
|
|
26
|
+
const openedByFocusRef = useRef(false);
|
|
25
27
|
const clearTimers = () => {
|
|
26
28
|
if (openTimer.current) window.clearTimeout(openTimer.current);
|
|
27
29
|
if (closeTimer.current) window.clearTimeout(closeTimer.current);
|
|
@@ -77,6 +79,7 @@ function useTooltipTrigger(options) {
|
|
|
77
79
|
const onPointerLeave = () => {
|
|
78
80
|
clearTimers();
|
|
79
81
|
if (isControlled) return;
|
|
82
|
+
if (openedByFocusRef.current) return;
|
|
80
83
|
closeTimer.current = window.setTimeout(() => setOpen(false), delayCloseMs);
|
|
81
84
|
};
|
|
82
85
|
const onPointerDown = () => {
|
|
@@ -87,12 +90,15 @@ function useTooltipTrigger(options) {
|
|
|
87
90
|
clearTimers();
|
|
88
91
|
if (focusOpenMode === "off") return;
|
|
89
92
|
const shouldOpen = focusOpenMode === "any" || e.currentTarget.matches(":focus-visible");
|
|
90
|
-
if (!
|
|
93
|
+
if (!shouldOpen) return;
|
|
94
|
+
openedByFocusRef.current = true;
|
|
95
|
+
if (!isControlled) {
|
|
91
96
|
openTimer.current = window.setTimeout(() => setOpen(true), delayOpenMs);
|
|
92
97
|
}
|
|
93
98
|
};
|
|
94
99
|
const onBlur = () => {
|
|
95
100
|
clearTimers();
|
|
101
|
+
openedByFocusRef.current = false;
|
|
96
102
|
if (!isControlled) setOpen(false);
|
|
97
103
|
};
|
|
98
104
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* When PageLayout owns scrolling, the body shouldn't reserve scrollbar gutter space.
|
|
2
2
|
This prevents the right-side gap that body { overflow-y: scroll } would otherwise create. */
|
|
3
|
-
:global(body):has([data-contain-scrolling]) {
|
|
3
|
+
:global(body):has(.root[data-contain-scrolling]) {
|
|
4
4
|
overflow: hidden;
|
|
5
5
|
}
|
|
6
6
|
|