@galaxy-io/dls 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/styles.css +1 -1
- package/dist/table/InfiniteSpreadsheet.js +1 -1
- package/dist/table/TableCore.js +63 -13
- package/dist/theme/ThemeSwitcher.d.ts +16 -0
- package/dist/theme/ThemeSwitcher.js +23 -3
- package/dist/theme/tokens/light.js +4 -4
- package/dist/tokens.css +4 -4
- package/dist/widget/Widget.d.ts +8 -1
- package/dist/widget/Widget.js +12 -4
- package/package.json +1 -1
|
@@ -754,7 +754,7 @@ var InfiniteSpreadsheetInner = forwardRef(function InfiniteSpreadsheet(props, re
|
|
|
754
754
|
}), showAddRow && isMounted && /* @__PURE__ */ jsx(AddRow, {
|
|
755
755
|
role: "row",
|
|
756
756
|
"aria-rowindex": rowCount + 2,
|
|
757
|
-
className: "gx-TableCore-VIRTUAL_ROW_CSS-
|
|
757
|
+
className: "gx-TableCore-VIRTUAL_ROW_CSS-v1emgwoo",
|
|
758
758
|
style: startStyle(totalSize),
|
|
759
759
|
children: /* @__PURE__ */ jsx(AddRowCell, {
|
|
760
760
|
role: "gridcell",
|
package/dist/table/TableCore.js
CHANGED
|
@@ -289,26 +289,71 @@ var ROW_SELECTED_CSS = "gx-TableCore-ROW_SELECTED_CSS-r1g7lrfg";
|
|
|
289
289
|
var ROW_ACTIVE_CSS = "gx-TableCore-ROW_ACTIVE_CSS-r10dstoh";
|
|
290
290
|
/** @internal The last row, or a row whose panel is open: no bottom hairline. */
|
|
291
291
|
var ROW_NO_BORDER_CSS = "gx-TableCore-ROW_NO_BORDER_CSS-rpsswqs";
|
|
292
|
+
/**
|
|
293
|
+
* The rows end above the bottom of the scroll box (a full-height table with a few rows): the last
|
|
294
|
+
* row keeps its hairline, so the list reads as finished instead of floating in empty space. Set by
|
|
295
|
+
* `useRowsEndAboveBottom`; it outranks `ROW_NO_BORDER_CSS` and the panel rule by specificity, and
|
|
296
|
+
* sits inside each row's fixed height, so nothing moves when it toggles.
|
|
297
|
+
*/
|
|
298
|
+
var ROWS_END_ABOVE_BOTTOM_CSS = "gx-TableCore-ROWS_END_ABOVE_BOTTOM_CSS-rwbqwrq";
|
|
299
|
+
/**
|
|
300
|
+
* Whether the table's rows end above the bottom of its scroll box. The last row drops its hairline
|
|
301
|
+
* only when it lands on the box's bottom edge, where the container's frame (or a scrolled table's
|
|
302
|
+
* end) already draws the line; above the edge, the hairline closes the list. Watches the scroll box
|
|
303
|
+
* and every row group, so rows loading, expanding or the box resizing re-measure it.
|
|
304
|
+
*/
|
|
305
|
+
function useRowsEndAboveBottom(scrollRef, tableRef, isEnabled, bodyKey) {
|
|
306
|
+
const [isAbove, setIsAbove] = useState(false);
|
|
307
|
+
useIsomorphicLayoutEffect(() => {
|
|
308
|
+
const scroll = scrollRef.current;
|
|
309
|
+
const table = tableRef.current;
|
|
310
|
+
if (!isEnabled || scroll === null || table === null) {
|
|
311
|
+
setIsAbove(false);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const measure = () => {
|
|
315
|
+
const rows = table.querySelectorAll(":scope > tbody > tr");
|
|
316
|
+
const last = rows[rows.length - 1];
|
|
317
|
+
if (last === void 0) {
|
|
318
|
+
setIsAbove(false);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
setIsAbove(last.getBoundingClientRect().bottom - scroll.getBoundingClientRect().top + scroll.scrollTop < scroll.clientHeight - 1);
|
|
322
|
+
};
|
|
323
|
+
measure();
|
|
324
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
325
|
+
const observer = new ResizeObserver(measure);
|
|
326
|
+
observer.observe(scroll);
|
|
327
|
+
for (const body of Array.from(table.tBodies)) observer.observe(body);
|
|
328
|
+
return () => observer.disconnect();
|
|
329
|
+
}, [
|
|
330
|
+
scrollRef,
|
|
331
|
+
tableRef,
|
|
332
|
+
isEnabled,
|
|
333
|
+
bodyKey
|
|
334
|
+
]);
|
|
335
|
+
return isAbove;
|
|
336
|
+
}
|
|
292
337
|
/** The last expanded panel: no bottom hairline. */
|
|
293
|
-
var EXPANDED_LAST_CSS = "gx-TableCore-EXPANDED_LAST_CSS-
|
|
338
|
+
var EXPANDED_LAST_CSS = "gx-TableCore-EXPANDED_LAST_CSS-e1jxalmm";
|
|
294
339
|
/** The dragged header while reordering. 0.5 is a state, not a color token. */
|
|
295
|
-
var HEADER_DRAGGING_CSS = "gx-TableCore-HEADER_DRAGGING_CSS-
|
|
340
|
+
var HEADER_DRAGGING_CSS = "gx-TableCore-HEADER_DRAGGING_CSS-h1fx3qlj";
|
|
296
341
|
/** The label wrapper grows when a trailing control (column actions) follows it. */
|
|
297
|
-
var LABEL_GROW_CSS = "gx-TableCore-LABEL_GROW_CSS-
|
|
298
|
-
var DROP_START_CSS = "gx-TableCore-DROP_START_CSS-
|
|
299
|
-
var DROP_END_CSS = "gx-TableCore-DROP_END_CSS-
|
|
342
|
+
var LABEL_GROW_CSS = "gx-TableCore-LABEL_GROW_CSS-l2nd1ne";
|
|
343
|
+
var DROP_START_CSS = "gx-TableCore-DROP_START_CSS-darqcf0";
|
|
344
|
+
var DROP_END_CSS = "gx-TableCore-DROP_END_CSS-d132cb1v";
|
|
300
345
|
/** Shows on hover, while dragged and on keyboard focus; straddles the column edge. */
|
|
301
|
-
var COLUMN_RESIZE_HANDLE_CSS = "gx-TableCore-COLUMN_RESIZE_HANDLE_CSS-
|
|
346
|
+
var COLUMN_RESIZE_HANDLE_CSS = "gx-TableCore-COLUMN_RESIZE_HANDLE_CSS-c1vn45v6";
|
|
302
347
|
/** Hovering a header cell reveals its resize handle. */
|
|
303
|
-
var HEADER_HOVER_CSS = "gx-TableCore-HEADER_HOVER_CSS-
|
|
348
|
+
var HEADER_HOVER_CSS = "gx-TableCore-HEADER_HOVER_CSS-h14za3v2";
|
|
304
349
|
/** The expand caret button: a square of its rung. */
|
|
305
|
-
var EXPAND_BUTTON_CSS = "gx-TableCore-EXPAND_BUTTON_CSS-
|
|
350
|
+
var EXPAND_BUTTON_CSS = "gx-TableCore-EXPAND_BUTTON_CSS-e1w0t3ir";
|
|
306
351
|
/** @internal A virtual body: as tall as every row, which are positioned inside it. */
|
|
307
|
-
var VIRTUAL_BODY_CSS = "gx-TableCore-VIRTUAL_BODY_CSS-
|
|
352
|
+
var VIRTUAL_BODY_CSS = "gx-TableCore-VIRTUAL_BODY_CSS-vb9km4t";
|
|
308
353
|
/** @internal A virtual row, placed at `--gx-table-row-start`. */
|
|
309
|
-
var VIRTUAL_ROW_CSS = "gx-TableCore-VIRTUAL_ROW_CSS-
|
|
354
|
+
var VIRTUAL_ROW_CSS = "gx-TableCore-VIRTUAL_ROW_CSS-v1emgwoo";
|
|
310
355
|
/** @internal Default cells and footer strings: shrink to truncate. */
|
|
311
|
-
var CELL_TEXT_CSS = "gx-TableCore-CELL_TEXT_CSS-
|
|
356
|
+
var CELL_TEXT_CSS = "gx-TableCore-CELL_TEXT_CSS-cw38cm1";
|
|
312
357
|
/** "Oct 3, 2026": the DateInput default. */
|
|
313
358
|
var DATE_FORMAT_OPTIONS = { dateStyle: "medium" };
|
|
314
359
|
/** @internal The default cell renderer: one truncating line of formatted text. */
|
|
@@ -744,6 +789,9 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
744
789
|
const colCount = leadingCount + visibleColumns.length + (hasTrailingColumn ? 1 : 0);
|
|
745
790
|
const surface = useTableSurface(ownRootRef);
|
|
746
791
|
const { width: viewportWidth } = useElementClientSize(scrollRef);
|
|
792
|
+
const tableRef = useRef(null);
|
|
793
|
+
const hasFooterRow = columnLayout.visibleColumns.some(({ column }) => column.footer !== void 0 && column.footer !== null);
|
|
794
|
+
const doRowsEndAboveBottom = useRowsEndAboveBottom(scrollRef, tableRef, !hasFooterRow && (rowCount > 0 || isLoading), `${rowCount}:${isLoading}:${error ?? ""}`);
|
|
747
795
|
const sentinelRef = useInfiniteScrollSentinel({
|
|
748
796
|
scrollRef,
|
|
749
797
|
onEndReached,
|
|
@@ -872,7 +920,7 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
872
920
|
if (drag.beforeId === null && ids.at(-1) === columnId) return "end";
|
|
873
921
|
return null;
|
|
874
922
|
};
|
|
875
|
-
const hasFooter =
|
|
923
|
+
const hasFooter = hasFooterRow;
|
|
876
924
|
const footerRowIndex = ariaRowCount;
|
|
877
925
|
const variables = { ...columnLayout.variables };
|
|
878
926
|
if (viewportWidth !== void 0) variables["--gx-table-viewport-width"] = `${viewportWidth}px`;
|
|
@@ -948,6 +996,8 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
948
996
|
children: [/* @__PURE__ */ jsxs(Scroll, {
|
|
949
997
|
ref: scrollRef,
|
|
950
998
|
children: [/* @__PURE__ */ jsxs(TableElement, {
|
|
999
|
+
ref: tableRef,
|
|
1000
|
+
className: cx(doRowsEndAboveBottom && ROWS_END_ABOVE_BOTTOM_CSS),
|
|
951
1001
|
...tableAria,
|
|
952
1002
|
role,
|
|
953
1003
|
...ariaLabel === void 0 ? {} : { "aria-label": ariaLabel },
|
|
@@ -1043,7 +1093,7 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
1043
1093
|
size: metrics.textSize,
|
|
1044
1094
|
weight: TextWeight.MEDIUM,
|
|
1045
1095
|
lineClamp: 1,
|
|
1046
|
-
className: "gx-TableCore-CELL_TEXT_CSS-
|
|
1096
|
+
className: "gx-TableCore-CELL_TEXT_CSS-cw38cm1",
|
|
1047
1097
|
children: column.footer
|
|
1048
1098
|
}) : column.footer
|
|
1049
1099
|
}, column.id)),
|
|
@@ -12,12 +12,28 @@ export declare enum ThemeSwitcherSize {
|
|
|
12
12
|
/** 40px control. */
|
|
13
13
|
X_LARGE = "X_LARGE"
|
|
14
14
|
}
|
|
15
|
+
/** Surface set; ThemeSwitcher passes the step to ToggleInput. */
|
|
16
|
+
export declare enum ThemeSwitcherVariant {
|
|
17
|
+
/** `background.base`. */
|
|
18
|
+
BASE = "BASE",
|
|
19
|
+
/** `background.primary`. The default. */
|
|
20
|
+
PRIMARY = "PRIMARY",
|
|
21
|
+
/** `background.secondary`. */
|
|
22
|
+
SECONDARY = "SECONDARY",
|
|
23
|
+
/** `background.tertiary`. */
|
|
24
|
+
TERTIARY = "TERTIARY"
|
|
25
|
+
}
|
|
15
26
|
export interface ThemeSwitcherProps extends AriaAttributes {
|
|
16
27
|
/**
|
|
17
28
|
* Control rung: 20 / 24 / 32 / 36 / 40px tall.
|
|
18
29
|
* @default ThemeSwitcherSize.MEDIUM
|
|
19
30
|
*/
|
|
20
31
|
size?: ThemeSwitcherSize;
|
|
32
|
+
/**
|
|
33
|
+
* Track fill, one surface step.
|
|
34
|
+
* @default ThemeSwitcherVariant.PRIMARY
|
|
35
|
+
*/
|
|
36
|
+
variant?: ThemeSwitcherVariant;
|
|
21
37
|
/**
|
|
22
38
|
* Show only the icons; each segment's name moves to its `aria-label` and tooltip. For tight spots such as a sidebar footer or a user menu.
|
|
23
39
|
* @default false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GalaxyTheme } from "./enums.js";
|
|
2
2
|
import { useGalaxyTheme } from "./useGalaxyTheme.js";
|
|
3
|
-
import ToggleInput, { ToggleInputSize } from "../inputs/ToggleInput.js";
|
|
3
|
+
import ToggleInput, { ToggleInputSize, ToggleInputVariant } from "../inputs/ToggleInput.js";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { MonitorIcon, MoonIcon, SunIcon } from "@phosphor-icons/react";
|
|
@@ -29,6 +29,18 @@ var ThemeSwitcherSize = /* @__PURE__ */ function(ThemeSwitcherSize) {
|
|
|
29
29
|
ThemeSwitcherSize["X_LARGE"] = "X_LARGE";
|
|
30
30
|
return ThemeSwitcherSize;
|
|
31
31
|
}({});
|
|
32
|
+
/** Surface set; ThemeSwitcher passes the step to ToggleInput. */
|
|
33
|
+
var ThemeSwitcherVariant = /* @__PURE__ */ function(ThemeSwitcherVariant) {
|
|
34
|
+
/** `background.base`. */
|
|
35
|
+
ThemeSwitcherVariant["BASE"] = "BASE";
|
|
36
|
+
/** `background.primary`. The default. */
|
|
37
|
+
ThemeSwitcherVariant["PRIMARY"] = "PRIMARY";
|
|
38
|
+
/** `background.secondary`. */
|
|
39
|
+
ThemeSwitcherVariant["SECONDARY"] = "SECONDARY";
|
|
40
|
+
/** `background.tertiary`. */
|
|
41
|
+
ThemeSwitcherVariant["TERTIARY"] = "TERTIARY";
|
|
42
|
+
return ThemeSwitcherVariant;
|
|
43
|
+
}({});
|
|
32
44
|
/** The three built-in themes, in the 1.x order, each with its glyph. */
|
|
33
45
|
var THEME_SWITCHER_OPTIONS = [
|
|
34
46
|
{
|
|
@@ -73,8 +85,15 @@ var THEME_SWITCHER_SIZE_TO_TOGGLE_INPUT_SIZE_MAP = {
|
|
|
73
85
|
["LARGE"]: ToggleInputSize.LARGE,
|
|
74
86
|
["X_LARGE"]: ToggleInputSize.X_LARGE
|
|
75
87
|
};
|
|
88
|
+
/** ThemeSwitcher's surface step is ToggleInput's surface step. */
|
|
89
|
+
var THEME_SWITCHER_VARIANT_TO_TOGGLE_INPUT_VARIANT_MAP = {
|
|
90
|
+
["BASE"]: ToggleInputVariant.BASE,
|
|
91
|
+
["PRIMARY"]: ToggleInputVariant.PRIMARY,
|
|
92
|
+
["SECONDARY"]: ToggleInputVariant.SECONDARY,
|
|
93
|
+
["TERTIARY"]: ToggleInputVariant.TERTIARY
|
|
94
|
+
};
|
|
76
95
|
/** The System / Dark / Light control, bound to the nearest `GalaxyProvider`. */
|
|
77
|
-
var ThemeSwitcher = forwardRef(function ThemeSwitcher({ size = "MEDIUM", isIconOnly = false, label, ariaLabel = "Theme", fillWidth = false, className, style, ...rest }, ref) {
|
|
96
|
+
var ThemeSwitcher = forwardRef(function ThemeSwitcher({ size = "MEDIUM", variant = "PRIMARY", isIconOnly = false, label, ariaLabel = "Theme", fillWidth = false, className, style, ...rest }, ref) {
|
|
78
97
|
const { selectedTheme, setTheme } = useGalaxyTheme();
|
|
79
98
|
return /* @__PURE__ */ jsx(ToggleInput, {
|
|
80
99
|
ref,
|
|
@@ -82,6 +101,7 @@ var ThemeSwitcher = forwardRef(function ThemeSwitcher({ size = "MEDIUM", isIconO
|
|
|
82
101
|
value: selectedTheme,
|
|
83
102
|
onChange: setTheme,
|
|
84
103
|
size: THEME_SWITCHER_SIZE_TO_TOGGLE_INPUT_SIZE_MAP[size],
|
|
104
|
+
variant: THEME_SWITCHER_VARIANT_TO_TOGGLE_INPUT_VARIANT_MAP[variant],
|
|
85
105
|
...label === void 0 ? { ariaLabel } : { label },
|
|
86
106
|
fillWidth,
|
|
87
107
|
...rest,
|
|
@@ -91,4 +111,4 @@ var ThemeSwitcher = forwardRef(function ThemeSwitcher({ size = "MEDIUM", isIconO
|
|
|
91
111
|
});
|
|
92
112
|
ThemeSwitcher.displayName = "ThemeSwitcher";
|
|
93
113
|
//#endregion
|
|
94
|
-
export { ThemeSwitcherSize, ThemeSwitcher as default };
|
|
114
|
+
export { ThemeSwitcherSize, ThemeSwitcherVariant, ThemeSwitcher as default };
|
|
@@ -30,12 +30,12 @@ var LIGHT_THEME = {
|
|
|
30
30
|
background: {
|
|
31
31
|
base: "#ffffff",
|
|
32
32
|
primary: "#fafafb",
|
|
33
|
-
secondary: "#
|
|
34
|
-
tertiary: "#
|
|
33
|
+
secondary: "#f3f3f4",
|
|
34
|
+
tertiary: "#efeff0",
|
|
35
35
|
hovered: "#f5f5f5",
|
|
36
36
|
pressed: "#eeeeee",
|
|
37
37
|
selected: "#e2e2e2",
|
|
38
|
-
disabled: "#
|
|
38
|
+
disabled: "#f3f3f4",
|
|
39
39
|
success: "#ecfcf0",
|
|
40
40
|
warning: "#fff8eb",
|
|
41
41
|
error: "#fff2f2",
|
|
@@ -119,7 +119,7 @@ var LIGHT_THEME = {
|
|
|
119
119
|
pressed: "#494949"
|
|
120
120
|
},
|
|
121
121
|
neutral: {
|
|
122
|
-
background: "#
|
|
122
|
+
background: "#f3f3f4",
|
|
123
123
|
text: "#101010",
|
|
124
124
|
hovered: "#e5e5e6",
|
|
125
125
|
pressed: "#dcdcdd"
|
package/dist/tokens.css
CHANGED
|
@@ -386,12 +386,12 @@
|
|
|
386
386
|
[data-gx-theme="light"] {
|
|
387
387
|
--gx-color-background-base: #ffffff;
|
|
388
388
|
--gx-color-background-primary: #fafafb;
|
|
389
|
-
--gx-color-background-secondary: #
|
|
390
|
-
--gx-color-background-tertiary: #
|
|
389
|
+
--gx-color-background-secondary: #f3f3f4;
|
|
390
|
+
--gx-color-background-tertiary: #efeff0;
|
|
391
391
|
--gx-color-background-hovered: #f5f5f5;
|
|
392
392
|
--gx-color-background-pressed: #eeeeee;
|
|
393
393
|
--gx-color-background-selected: #e2e2e2;
|
|
394
|
-
--gx-color-background-disabled: #
|
|
394
|
+
--gx-color-background-disabled: #f3f3f4;
|
|
395
395
|
--gx-color-background-success: #ecfcf0;
|
|
396
396
|
--gx-color-background-warning: #fff8eb;
|
|
397
397
|
--gx-color-background-error: #fff2f2;
|
|
@@ -466,7 +466,7 @@
|
|
|
466
466
|
--gx-color-solid-primary-text: #ffffff;
|
|
467
467
|
--gx-color-solid-primary-hovered: #2d2d2d;
|
|
468
468
|
--gx-color-solid-primary-pressed: #494949;
|
|
469
|
-
--gx-color-solid-neutral-background: #
|
|
469
|
+
--gx-color-solid-neutral-background: #f3f3f4;
|
|
470
470
|
--gx-color-solid-neutral-text: #101010;
|
|
471
471
|
--gx-color-solid-neutral-hovered: #e5e5e6;
|
|
472
472
|
--gx-color-solid-neutral-pressed: #dcdcdd;
|
package/dist/widget/Widget.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Icon as PhosphorIcon } from "@phosphor-icons/react";
|
|
2
2
|
import { type AriaAttributes, type CSSProperties, type MouseEvent, type ReactNode } from "react";
|
|
3
|
+
import type { Space } from "../theme/enums.js";
|
|
3
4
|
/** Card fill (Constitution V-A surface set). */
|
|
4
5
|
export declare enum WidgetVariant {
|
|
5
6
|
/** `background.base`. */
|
|
@@ -40,7 +41,7 @@ export interface WidgetGroupContextValue {
|
|
|
40
41
|
export declare const WidgetGroupContext: import("react").Context<WidgetGroupContextValue | null>;
|
|
41
42
|
/** Every Widget prop except the two coupled pairs (`isInteractive` / `onClick`, `isCollapsible` / `header`). */
|
|
42
43
|
interface WidgetBaseProps extends AriaAttributes {
|
|
43
|
-
/** The body: a column with the size's inset (none with `isFlush`) and gap
|
|
44
|
+
/** The body: a column with the size's inset (none with `isFlush`) and `gap`. */
|
|
44
45
|
children?: ReactNode;
|
|
45
46
|
/**
|
|
46
47
|
* Surface fill of the card.
|
|
@@ -52,6 +53,12 @@ interface WidgetBaseProps extends AriaAttributes {
|
|
|
52
53
|
* @default WidgetSize.MEDIUM
|
|
53
54
|
*/
|
|
54
55
|
size?: WidgetSize;
|
|
56
|
+
/**
|
|
57
|
+
* Space between the body's children, from the space scale. `0` stacks them edge to edge (a
|
|
58
|
+
* flush chart over a table).
|
|
59
|
+
* @default the size's gap: 8 / 12 / 16
|
|
60
|
+
*/
|
|
61
|
+
gap?: Space;
|
|
55
62
|
/**
|
|
56
63
|
* The header row's title. A string renders as a medium `Text` at the size's step; a node renders
|
|
57
64
|
* as-is and must not contain controls (put them in `actions`). Omit it for a body-only card.
|
package/dist/widget/Widget.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Text, { TextSize, TextVariant, TextWeight } from "../text/Text.js";
|
|
2
2
|
import { useControlledOpenState } from "../hooks/useControlledOpenState.js";
|
|
3
|
+
import { gapToCss } from "../utils/css.js";
|
|
3
4
|
import Divider from "../layout/Divider.js";
|
|
4
5
|
import Icon, { IconVariant } from "../icons/Icon.js";
|
|
5
6
|
import IconSlot from "../icons/internal/IconSlot.js";
|
|
@@ -113,7 +114,7 @@ var Panel = /*#__PURE__*/ styled("section")({
|
|
|
113
114
|
class: "gx-Widget-Panel-p1u3h98q",
|
|
114
115
|
propsAsIs: false
|
|
115
116
|
});
|
|
116
|
-
/** The body region: a column of the children
|
|
117
|
+
/** The body region: a column of the children, spaced by `--gx-widget-gap`. */
|
|
117
118
|
var Body = /*#__PURE__*/ styled("div")({
|
|
118
119
|
name: "Body",
|
|
119
120
|
class: "gx-Widget-Body-b1t0k6w8",
|
|
@@ -143,12 +144,18 @@ var WIDGET_SIZE_TO_ROW_CSS_MAP = {
|
|
|
143
144
|
["MEDIUM"]: "gx-Widget-MEDIUM-m14youd7",
|
|
144
145
|
["LARGE"]: "gx-Widget-LARGE-lmk1xrm"
|
|
145
146
|
};
|
|
146
|
-
/** Body inset
|
|
147
|
+
/** Body inset. */
|
|
147
148
|
var WIDGET_SIZE_TO_BODY_CSS_MAP = {
|
|
148
149
|
["SMALL"]: "gx-Widget-SMALL-s1qcxaeu",
|
|
149
150
|
["MEDIUM"]: "gx-Widget-MEDIUM-m1niqf43",
|
|
150
151
|
["LARGE"]: "gx-Widget-LARGE-l1wi0lfv"
|
|
151
152
|
};
|
|
153
|
+
/** The body gap when `gap` is unset: the same step as the inset. */
|
|
154
|
+
var WIDGET_SIZE_TO_GAP_MAP = {
|
|
155
|
+
["SMALL"]: 8,
|
|
156
|
+
["MEDIUM"]: 12,
|
|
157
|
+
["LARGE"]: 16
|
|
158
|
+
};
|
|
152
159
|
var WIDGET_SIZE_TO_TEXT_SIZE_MAP = {
|
|
153
160
|
["SMALL"]: TextSize.BODY_SM,
|
|
154
161
|
["MEDIUM"]: TextSize.BODY_MD,
|
|
@@ -181,7 +188,7 @@ var INTERACTIVE_CSS = "gx-Widget-INTERACTIVE_CSS-i11hrzgx";
|
|
|
181
188
|
var DISABLED_CSS = "gx-Widget-DISABLED_CSS-d27d11a";
|
|
182
189
|
/** Chosen: a `text.primary` hairline, also on hover (declared after the hover states, so it wins). */
|
|
183
190
|
var SELECTED_CSS = "gx-Widget-SELECTED_CSS-s13jeom8";
|
|
184
|
-
/** `isFlush`: no body inset (
|
|
191
|
+
/** `isFlush`: no body inset (`gap` stays); the body clips its content inside the corners it shares. */
|
|
185
192
|
var FLUSH_CSS = "gx-Widget-FLUSH_CSS-f18mgbxd";
|
|
186
193
|
/** A flush body with no header row above it rounds the card's top corners. */
|
|
187
194
|
var FLUSH_TOP_CORNERS_CSS = "gx-Widget-FLUSH_TOP_CORNERS_CSS-f1djym4t";
|
|
@@ -217,7 +224,7 @@ var headerColors = (isOpen, isDisabled) => match({
|
|
|
217
224
|
/** Whether a slot has something to render. */
|
|
218
225
|
var hasContent = (node) => node !== void 0 && node !== null && node !== false;
|
|
219
226
|
/** A card: a bordered surface with an optional (collapsible) header, actions, footer and states. */
|
|
220
|
-
var Widget = forwardRef(function Widget({ children, variant = "PRIMARY", size = "MEDIUM", header, subheader, icon, actions, footer, isFlush = false, isCollapsible = false, hasCaret = true, isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, isDisabled = false, isLoading = false, isSelected, isInteractive = false, onClick, ariaLabel, id, className, style, ...rest }, ref) {
|
|
227
|
+
var Widget = forwardRef(function Widget({ children, variant = "PRIMARY", size = "MEDIUM", gap, header, subheader, icon, actions, footer, isFlush = false, isCollapsible = false, hasCaret = true, isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, isDisabled = false, isLoading = false, isSelected, isInteractive = false, onClick, ariaLabel, id, className, style, ...rest }, ref) {
|
|
221
228
|
const baseId = useId();
|
|
222
229
|
const rootId = id ?? baseId;
|
|
223
230
|
const titleId = `${baseId}-title`;
|
|
@@ -259,6 +266,7 @@ var Widget = forwardRef(function Widget({ children, variant = "PRIMARY", size =
|
|
|
259
266
|
hasHeaderRow && /* @__PURE__ */ jsx(Divider, {}),
|
|
260
267
|
/* @__PURE__ */ jsx(Body, {
|
|
261
268
|
id: bodyId,
|
|
269
|
+
style: { "--gx-widget-gap": gapToCss(gap ?? WIDGET_SIZE_TO_GAP_MAP[size]) },
|
|
262
270
|
className: cx(WIDGET_SIZE_TO_BODY_CSS_MAP[size], isFlush && FLUSH_CSS, isFlush && !hasHeaderRow && FLUSH_TOP_CORNERS_CSS, isFlush && !hasFooter && FLUSH_BOTTOM_CORNERS_CSS),
|
|
263
271
|
children: isLoading ? /* @__PURE__ */ jsx(Loading, { children: /* @__PURE__ */ jsx(Spinner, {
|
|
264
272
|
variant: SpinnerVariant.SECONDARY,
|