@homebound/beam 2.417.6 → 2.417.8
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/{chunk-XH44AYND.js → chunk-ZPT2ZR5B.js} +28 -1
- package/dist/chunk-ZPT2ZR5B.js.map +1 -0
- package/dist/index.cjs +286 -152
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +42 -7
- package/dist/index.d.ts +42 -7
- package/dist/index.js +294 -183
- package/dist/index.js.map +1 -1
- package/dist/utils/rtlUtils.cjs.map +1 -1
- package/dist/utils/rtlUtils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-XH44AYND.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -4351,6 +4351,31 @@ var import_react_dom = require("react-dom");
|
|
|
4351
4351
|
var import_react_popper = require("react-popper");
|
|
4352
4352
|
var import_react_stately = require("react-stately");
|
|
4353
4353
|
|
|
4354
|
+
// src/utils/inlineStyles.ts
|
|
4355
|
+
function isInlineStyleValue(value) {
|
|
4356
|
+
return typeof value === "string" || typeof value === "number";
|
|
4357
|
+
}
|
|
4358
|
+
function setInlineStyles(el, styles) {
|
|
4359
|
+
Object.entries(styles).forEach(([prop, value]) => {
|
|
4360
|
+
if (!isInlineStyleValue(value)) return;
|
|
4361
|
+
if (prop.startsWith("--")) {
|
|
4362
|
+
el.style.setProperty(prop, String(value));
|
|
4363
|
+
} else {
|
|
4364
|
+
el.style[prop] = String(value);
|
|
4365
|
+
}
|
|
4366
|
+
});
|
|
4367
|
+
}
|
|
4368
|
+
function clearInlineStyles(el, styles) {
|
|
4369
|
+
Object.entries(styles).forEach(([prop, value]) => {
|
|
4370
|
+
if (!isInlineStyleValue(value)) return;
|
|
4371
|
+
if (prop.startsWith("--")) {
|
|
4372
|
+
el.style.removeProperty(prop);
|
|
4373
|
+
} else {
|
|
4374
|
+
el.style[prop] = "";
|
|
4375
|
+
}
|
|
4376
|
+
});
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4354
4379
|
// src/utils/defaultTestId.ts
|
|
4355
4380
|
var import_change_case = require("change-case");
|
|
4356
4381
|
function defaultTestId(label) {
|
|
@@ -4535,11 +4560,7 @@ var Icon = import_react4.default.memo((props) => {
|
|
|
4535
4560
|
viewBox: "0 0 24 24",
|
|
4536
4561
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4537
4562
|
css: {
|
|
4538
|
-
|
|
4539
|
-
...{
|
|
4540
|
-
"& > path": Css.fill(color).$,
|
|
4541
|
-
"& > rect": Css.fill(color).$
|
|
4542
|
-
},
|
|
4563
|
+
...Css.fill(color).$,
|
|
4543
4564
|
...bgColor && Css.bgColor(bgColor).$,
|
|
4544
4565
|
...xss
|
|
4545
4566
|
},
|
|
@@ -5123,20 +5144,8 @@ var Icons = {
|
|
|
5123
5144
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7.43848 0.0527344C8.92278 0.0527344 10.1259 1.25595 10.126 2.74023C10.126 4.22459 8.78231 5.87619 7.43848 7.66797C6.09464 5.87619 4.75098 4.22459 4.75098 2.74023C4.75107 1.25601 5.95425 0.0528239 7.43848 0.0527344ZM7.4375 1.84473C6.94279 1.84478 6.54203 2.24552 6.54199 2.74023C6.54199 3.23499 6.94276 3.63569 7.4375 3.63574C7.93229 3.63574 8.33301 3.23502 8.33301 2.74023C8.33296 2.24549 7.93226 1.84473 7.4375 1.84473Z" })
|
|
5124
5145
|
] }),
|
|
5125
5146
|
buildings: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5126
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5127
|
-
|
|
5128
|
-
{
|
|
5129
|
-
d: "M14.1787 3.58594V23.6494H0V3.60449L7.08887 0.347656L14.1787 3.58594ZM3.42285 20.2275H5.86719V17.7832H3.42285V20.2275ZM8.31348 17.7832V20.2275H10.7578V17.7832H8.31348ZM3.42285 16.3174H5.86719V13.873H3.42285V16.3174ZM8.31348 16.3174H10.7578V13.873H8.31348V16.3174ZM3.42285 12.4062H5.86719V9.96191H3.42285V12.4062ZM8.31348 12.4062H10.7578V9.96191H8.31348V12.4062ZM3.42285 8.49414H5.86719V6.0498H3.42285V8.49414ZM8.31348 8.49414H10.7578V6.0498H8.31348V8.49414Z",
|
|
5130
|
-
fill: "#8D8D8D"
|
|
5131
|
-
}
|
|
5132
|
-
),
|
|
5133
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5134
|
-
"path",
|
|
5135
|
-
{
|
|
5136
|
-
d: "M22 23.6523H15.6445V8.00684H22V23.6523ZM17.5996 18.7617V21.2061H20.0439V18.7617H17.5996ZM17.5996 17.2959H20.0439V14.8516H17.5996V17.2959ZM17.5996 13.3828H20.0439V10.9385H17.5996V13.3828Z",
|
|
5137
|
-
fill: "#8D8D8D"
|
|
5138
|
-
}
|
|
5139
|
-
)
|
|
5147
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M14.1787 3.58594V23.6494H0V3.60449L7.08887 0.347656L14.1787 3.58594ZM3.42285 20.2275H5.86719V17.7832H3.42285V20.2275ZM8.31348 17.7832V20.2275H10.7578V17.7832H8.31348ZM3.42285 16.3174H5.86719V13.873H3.42285V16.3174ZM8.31348 16.3174H10.7578V13.873H8.31348V16.3174ZM3.42285 12.4062H5.86719V9.96191H3.42285V12.4062ZM8.31348 12.4062H10.7578V9.96191H8.31348V12.4062ZM3.42285 8.49414H5.86719V6.0498H3.42285V8.49414ZM8.31348 8.49414H10.7578V6.0498H8.31348V8.49414Z" }),
|
|
5148
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M22 23.6523H15.6445V8.00684H22V23.6523ZM17.5996 18.7617V21.2061H20.0439V18.7617H17.5996ZM17.5996 17.2959H20.0439V14.8516H17.5996V17.2959ZM17.5996 13.3828H20.0439V10.9385H17.5996V13.3828Z" })
|
|
5140
5149
|
] }),
|
|
5141
5150
|
community: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5142
5151
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6.41018 0.520509C6.61589 0.334405 6.93017 0.334214 7.13576 0.520509L11.1797 4.20899C11.1553 4.22924 11.1302 4.24904 11.1065 4.27051L11.1016 4.27539L7.85549 7.23535V6.22266H5.69045V8.96289C5.69045 9.2644 5.44619 9.51172 5.14846 9.51172H3.52444C3.22683 9.51157 2.98342 9.26431 2.98342 8.96289V5.12598H2.0635C1.81449 5.12598 1.70074 4.8129 1.88479 4.64844L6.41018 0.520509ZM10.5615 8.96289C10.5615 9.2644 10.3183 9.51172 10.0205 9.51172H8.39651C8.24437 9.51169 8.10738 9.44603 8.00881 9.34277L10.5615 7.01465V8.96289Z" }),
|
|
@@ -6824,13 +6833,13 @@ function AvatarButton(props) {
|
|
|
6824
6833
|
menuTriggerProps,
|
|
6825
6834
|
openInNew,
|
|
6826
6835
|
forceFocusStyles = false,
|
|
6827
|
-
|
|
6836
|
+
__storyState,
|
|
6828
6837
|
...avatarProps
|
|
6829
6838
|
} = props;
|
|
6830
6839
|
const isDisabled = !!disabled;
|
|
6831
6840
|
const ariaProps = { onPress, isDisabled, autoFocus, ...menuTriggerProps };
|
|
6832
6841
|
const ref = useGetRef(buttonRef);
|
|
6833
|
-
const { buttonProps, isPressed } = (0, import_react_aria6.useButton)(
|
|
6842
|
+
const { buttonProps, isPressed: isPressedFromEvents } = (0, import_react_aria6.useButton)(
|
|
6834
6843
|
{
|
|
6835
6844
|
...ariaProps,
|
|
6836
6845
|
onPress: typeof onPress === "string" ? noop : onPress,
|
|
@@ -6838,8 +6847,11 @@ function AvatarButton(props) {
|
|
|
6838
6847
|
},
|
|
6839
6848
|
ref
|
|
6840
6849
|
);
|
|
6841
|
-
const { focusProps, isFocusVisible } = (0, import_react_aria6.useFocusRing)(ariaProps);
|
|
6842
|
-
const { hoverProps, isHovered } = (0, import_react_aria6.useHover)(ariaProps);
|
|
6850
|
+
const { focusProps, isFocusVisible: isFocusVisibleFromEvents } = (0, import_react_aria6.useFocusRing)(ariaProps);
|
|
6851
|
+
const { hoverProps, isHovered: isHoveredFromEvents } = (0, import_react_aria6.useHover)(ariaProps);
|
|
6852
|
+
const isHovered = __storyState?.hovered ?? isHoveredFromEvents;
|
|
6853
|
+
const isFocusVisible = __storyState?.focusVisible ?? isFocusVisibleFromEvents;
|
|
6854
|
+
const isPressed = __storyState?.pressed ?? isPressedFromEvents;
|
|
6843
6855
|
const tid = useTestIds(props, avatarProps.name);
|
|
6844
6856
|
const styles = (0, import_react22.useMemo)(
|
|
6845
6857
|
() => ({
|
|
@@ -6862,7 +6874,7 @@ function AvatarButton(props) {
|
|
|
6862
6874
|
};
|
|
6863
6875
|
const content = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
6864
6876
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Avatar, { ...avatarProps, ...tid, disableTooltip: true }),
|
|
6865
|
-
|
|
6877
|
+
isPressed && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { css: pressedOverlayCss })
|
|
6866
6878
|
] });
|
|
6867
6879
|
return maybeTooltip({
|
|
6868
6880
|
// Default the tooltip to the avatar's name, if defined.
|
|
@@ -7525,21 +7537,19 @@ function memoizedTableStyles() {
|
|
|
7525
7537
|
cellCss: {
|
|
7526
7538
|
...Css[cellTypography].gray900.bgWhite.ai(alignItems).pxPx(12).boxShadow(`inset 0 -1px 0 ${"rgba(236, 235, 235, 1)" /* Gray200 */}`).$,
|
|
7527
7539
|
...rowHeight === "flexible" ? Css.pyPx(12).$ : Css.wsnw.hPx(inlineEditing ? 48 : 36).$,
|
|
7528
|
-
...cellHighlight ? { "&:hover": Css.bgGray100.$ } : {}
|
|
7529
|
-
...bordered && { "&:first-child": Css.bl.bcGray200.$, "&:last-child": Css.br.bcGray200.$ }
|
|
7530
|
-
},
|
|
7531
|
-
firstRowCss: {
|
|
7532
|
-
...Css.addIn("& > *:first-of-type", Css.borderRadius("8px 0 0 0 ").$).addIn(
|
|
7533
|
-
"& > *:last-of-type",
|
|
7534
|
-
Css.borderRadius("0 8px 0 0").$
|
|
7535
|
-
).$,
|
|
7536
|
-
...bordered && Css.addIn("& > *", Css.bt.bcGray200.$).$
|
|
7540
|
+
...cellHighlight ? { "&:hover": Css.bgGray100.$ } : {}
|
|
7537
7541
|
},
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7542
|
+
firstCellCss: bordered ? Css.bl.bcGray200.$ : void 0,
|
|
7543
|
+
lastCellCss: bordered ? Css.br.bcGray200.$ : void 0,
|
|
7544
|
+
firstRowCellCss: bordered ? Css.bt.bcGray200.$ : void 0,
|
|
7545
|
+
firstRowFirstCellCss: Css.borderRadius("8px 0 0 0 ").$,
|
|
7546
|
+
firstRowLastCellCss: Css.borderRadius("0 8px 0 0").$,
|
|
7547
|
+
// Keep `betweenRowsCss` on all body rows, but on the final body row
|
|
7548
|
+
// remove the inset shadow and, when bordered, replace it with a true bottom border.
|
|
7549
|
+
lastRowCellCss: bordered ? Css.bsh0.bb.bcGray200.$ : Css.bsh0.$,
|
|
7550
|
+
// Only apply bottom corner radii to the final body-row cells when using `bordered`.
|
|
7551
|
+
lastRowFirstCellCss: bordered ? Css.borderRadius("0 0 0 8px").$ : void 0,
|
|
7552
|
+
lastRowLastCellCss: bordered ? Css.borderRadius("0 0 8px 0").$ : void 0,
|
|
7543
7553
|
presentationSettings: {
|
|
7544
7554
|
borderless: true,
|
|
7545
7555
|
typeScale: "xs",
|
|
@@ -7558,6 +7568,7 @@ function memoizedTableStyles() {
|
|
|
7558
7568
|
var getTableStyles = memoizedTableStyles();
|
|
7559
7569
|
var totalsRowHeight = 40;
|
|
7560
7570
|
var expandableHeaderRowHeight = 40;
|
|
7571
|
+
var tableRowPrintBreakCss = Css.add("pageBreakAfter", "auto").add("pageBreakInside", "avoid").$;
|
|
7561
7572
|
var defaultStyle = getTableStyles({});
|
|
7562
7573
|
var condensedStyle = {
|
|
7563
7574
|
...getTableStyles({ rowHeight: "fixed" }),
|
|
@@ -7826,10 +7837,10 @@ function applyRowFn(column2, row, api, level, expanded, dragData) {
|
|
|
7826
7837
|
var ASC = "ASC";
|
|
7827
7838
|
var DESC = "DESC";
|
|
7828
7839
|
var emptyCell = { content: () => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, {}), value: "" };
|
|
7829
|
-
function getFirstOrLastCellCss(style, columnIndex, columns) {
|
|
7840
|
+
function getFirstOrLastCellCss(style, columnIndex, columns, colspan = 1) {
|
|
7830
7841
|
return {
|
|
7831
7842
|
...columnIndex === 0 ? style.firstCellCss : {},
|
|
7832
|
-
...columnIndex
|
|
7843
|
+
...columnIndex + colspan >= columns.length ? style.lastCellCss : {}
|
|
7833
7844
|
};
|
|
7834
7845
|
}
|
|
7835
7846
|
function isJSX(content) {
|
|
@@ -8220,7 +8231,7 @@ function ColumnResizeHandle({
|
|
|
8220
8231
|
var import_react32 = require("react");
|
|
8221
8232
|
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
8222
8233
|
function KeptGroupRow(props) {
|
|
8223
|
-
const { as, columnSizes, style, row, colSpan } = props;
|
|
8234
|
+
const { as, columnSizes, style, row, colSpan, isLastBodyRow } = props;
|
|
8224
8235
|
const CellTag = as === "table" ? "td" : "div";
|
|
8225
8236
|
const { tableState } = (0, import_react32.useContext)(TableStateContext);
|
|
8226
8237
|
const numHiddenSelectedRows = useComputed(() => tableState.keptRows.length, [tableState]);
|
|
@@ -8229,6 +8240,10 @@ function KeptGroupRow(props) {
|
|
|
8229
8240
|
{
|
|
8230
8241
|
css: {
|
|
8231
8242
|
...style.cellCss,
|
|
8243
|
+
...style.betweenRowsCss,
|
|
8244
|
+
...isLastBodyRow && style.lastRowCellCss,
|
|
8245
|
+
...isLastBodyRow && style.lastRowFirstCellCss,
|
|
8246
|
+
...isLastBodyRow && style.lastRowLastCellCss,
|
|
8232
8247
|
...style.keptGroupRowCss,
|
|
8233
8248
|
...Css.pl0.w(`calc(${columnSizes.join(" + ")})`).$
|
|
8234
8249
|
},
|
|
@@ -8543,6 +8558,9 @@ function RowImpl(props) {
|
|
|
8543
8558
|
cellHighlight,
|
|
8544
8559
|
omitRowHover,
|
|
8545
8560
|
hasExpandableHeader,
|
|
8561
|
+
isFirstHeadRow,
|
|
8562
|
+
isFirstBodyRow,
|
|
8563
|
+
isLastBodyRow,
|
|
8546
8564
|
resizedWidths,
|
|
8547
8565
|
setResizedWidth,
|
|
8548
8566
|
disableColumnResizing = true,
|
|
@@ -8561,6 +8579,8 @@ function RowImpl(props) {
|
|
|
8561
8579
|
const isTotals = row.kind === TOTALS;
|
|
8562
8580
|
const isExpandableHeader = row.kind === EXPANDABLE_HEADER;
|
|
8563
8581
|
const isKeptGroupRow = row.kind === KEPT_GROUP;
|
|
8582
|
+
const isBodyRow = !isHeader && !isTotals && !isExpandableHeader;
|
|
8583
|
+
const isFirstHeadCellRow = isExpandableHeader || !hasExpandableHeader && (isHeader || isTotals);
|
|
8564
8584
|
const rowStyle = rowStyles?.[row.kind];
|
|
8565
8585
|
const RowTag = as === "table" ? "tr" : "div";
|
|
8566
8586
|
const sortOn = tableState.sortConfig?.on;
|
|
@@ -8576,6 +8596,9 @@ function RowImpl(props) {
|
|
|
8576
8596
|
};
|
|
8577
8597
|
const rowCss = {
|
|
8578
8598
|
...!reservedRowKinds.includes(row.kind) && style.nonHeaderRowCss,
|
|
8599
|
+
...isFirstBodyRow && style.firstBodyRowCss,
|
|
8600
|
+
...isFirstHeadRow && style.firstRowCss,
|
|
8601
|
+
...as === "table" && tableRowPrintBreakCss,
|
|
8579
8602
|
// Optionally include the row hover styles, by default they should be turned on.
|
|
8580
8603
|
...showRowHoverColor && {
|
|
8581
8604
|
// Even though backgroundColor is set on the cellCss, the hover target is the row.
|
|
@@ -8588,6 +8611,7 @@ function RowImpl(props) {
|
|
|
8588
8611
|
...levelIndent && Css.mlPx(levelIndent).$,
|
|
8589
8612
|
// For virtual tables use `display: flex` to keep all cells on the same row.
|
|
8590
8613
|
...as === "table" ? {} : Css.relative.df.fg1.fs1.$,
|
|
8614
|
+
...isLastBodyRow && style.lastRowCss,
|
|
8591
8615
|
// Apply `cursorPointer` to the row if it has a link or `onClick` value.
|
|
8592
8616
|
...(rowStyle?.rowLink || rowStyle?.onClick) && { "&:hover": Css.cursorPointer.$ },
|
|
8593
8617
|
...maybeApplyFunction(row, rowStyle?.rowCss),
|
|
@@ -8608,7 +8632,17 @@ function RowImpl(props) {
|
|
|
8608
8632
|
[onDragOver]
|
|
8609
8633
|
);
|
|
8610
8634
|
const onDragOverDebounced = (0, import_use_debounce4.useDebouncedCallback)(dragOverCallback, 100);
|
|
8611
|
-
const RowContent = () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RowTag, { css: rowCss, ...others, "data-gridrow": true, ...getCount(row.id), ref, className: BorderHoverParent, children: isKeptGroupRow ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8635
|
+
const RowContent = () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RowTag, { css: rowCss, ...others, "data-gridrow": true, ...getCount(row.id), ref, className: BorderHoverParent, children: isKeptGroupRow ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8636
|
+
KeptGroupRow,
|
|
8637
|
+
{
|
|
8638
|
+
as,
|
|
8639
|
+
style,
|
|
8640
|
+
columnSizes,
|
|
8641
|
+
row,
|
|
8642
|
+
colSpan: columns.length,
|
|
8643
|
+
isLastBodyRow
|
|
8644
|
+
}
|
|
8645
|
+
) : columns.map((column2, columnIndex) => {
|
|
8612
8646
|
const maybeExpandedColumn = expandColumnHidden ? columns[columnIndex - 1] : column2;
|
|
8613
8647
|
const isExpanded = tableState.isExpandedColumn(maybeExpandedColumn.id);
|
|
8614
8648
|
if (column2.hideOnExpand && isExpanded) {
|
|
@@ -8692,8 +8726,16 @@ function RowImpl(props) {
|
|
|
8692
8726
|
...maybeStickyColumnStyles,
|
|
8693
8727
|
// Apply any static/all-cell styling
|
|
8694
8728
|
...style.cellCss,
|
|
8729
|
+
// Apply between-row cell styling for body rows.
|
|
8730
|
+
...isBodyRow && style.betweenRowsCss,
|
|
8731
|
+
...isFirstHeadCellRow && style.firstRowCellCss,
|
|
8732
|
+
...isLastBodyRow && style.lastRowCellCss,
|
|
8695
8733
|
// Then override with first/last cell styling
|
|
8696
|
-
...getFirstOrLastCellCss(style, columnIndex, columns),
|
|
8734
|
+
...getFirstOrLastCellCss(style, columnIndex, columns, currentColspan),
|
|
8735
|
+
...columnIndex === 0 && isFirstHeadCellRow && style.firstRowFirstCellCss,
|
|
8736
|
+
...columnIndex === columns.length - 1 && isFirstHeadCellRow && style.firstRowLastCellCss,
|
|
8737
|
+
...columnIndex === 0 && isLastBodyRow && style.lastRowFirstCellCss,
|
|
8738
|
+
...columnIndex === columns.length - 1 && isLastBodyRow && style.lastRowLastCellCss,
|
|
8697
8739
|
// Then override with per-cell/per-row justification
|
|
8698
8740
|
...justificationCss,
|
|
8699
8741
|
// Then apply any header-specific override
|
|
@@ -8709,7 +8751,7 @@ function RowImpl(props) {
|
|
|
8709
8751
|
// Only apply if not the last column in the table AND when this column is the last column in the group of expandable column or not expanded AND
|
|
8710
8752
|
...hasExpandableHeader && columnIndex + currentColspan < columns.length && (isHeader || isTotals) && currentExpandedColumnCount === 0 && Css.boxShadow(`inset -1px -1px 0 ${"rgba(236, 235, 235, 1)" /* Gray200 */}`).$,
|
|
8711
8753
|
// Or level-specific styling
|
|
8712
|
-
|
|
8754
|
+
...isBodyRow && levelStyle?.cellCss,
|
|
8713
8755
|
// Level specific styling for the first content column
|
|
8714
8756
|
...applyFirstContentColumnStyles && levelStyle?.firstContentColumn,
|
|
8715
8757
|
// The specific cell's css (if any from GridCellContent)
|
|
@@ -8904,6 +8946,7 @@ function TextFieldBase(props) {
|
|
|
8904
8946
|
},
|
|
8905
8947
|
input: {
|
|
8906
8948
|
...Css.w100.mw0.outline0.fg1.bgTransparent.$,
|
|
8949
|
+
// Keep `addIn` for `::selection` until we finish the StyleX migration.
|
|
8907
8950
|
// Not using Truss's inline `if` statement here because `addIn` properties do not respect the if statement.
|
|
8908
8951
|
...contrast && !inputStylePalette && Css.addIn("&::selection", Css.bgGray800.$).$,
|
|
8909
8952
|
// For "multiline" fields we add top and bottom padding of 7px for compact, or 11px for non-compact, to properly match the height of the single line fields
|
|
@@ -12526,6 +12569,7 @@ function Switch(props) {
|
|
|
12526
12569
|
label,
|
|
12527
12570
|
labelStyle = "inline",
|
|
12528
12571
|
hideLabel = false,
|
|
12572
|
+
__storyState,
|
|
12529
12573
|
...otherProps
|
|
12530
12574
|
} = props;
|
|
12531
12575
|
const isDisabled = !!disabled;
|
|
@@ -12533,8 +12577,10 @@ function Switch(props) {
|
|
|
12533
12577
|
const state = toToggleState(isSelected, onChange);
|
|
12534
12578
|
const ref = (0, import_react63.useRef)(null);
|
|
12535
12579
|
const { inputProps } = (0, import_react_aria35.useSwitch)({ ...ariaProps, "aria-label": label }, state, ref);
|
|
12536
|
-
const { isFocusVisible:
|
|
12537
|
-
const { hoverProps, isHovered } = (0, import_react_aria35.useHover)(ariaProps);
|
|
12580
|
+
const { isFocusVisible: isFocusVisibleFromEvents, focusProps } = (0, import_react_aria35.useFocusRing)(otherProps);
|
|
12581
|
+
const { hoverProps, isHovered: isHoveredFromEvents } = (0, import_react_aria35.useHover)(ariaProps);
|
|
12582
|
+
const isFocusVisible = __storyState?.focusVisible ?? isFocusVisibleFromEvents;
|
|
12583
|
+
const isHovered = __storyState?.hovered ?? isHoveredFromEvents;
|
|
12538
12584
|
const tooltip = resolveTooltip(disabled, props.tooltip);
|
|
12539
12585
|
const tid = useTestIds(otherProps, label);
|
|
12540
12586
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
@@ -12567,7 +12613,7 @@ function Switch(props) {
|
|
|
12567
12613
|
css: {
|
|
12568
12614
|
...Css.wPx(toggleWidth(compact)).hPx(toggleHeight(compact)).bgGray200.br12.relative.transition.$,
|
|
12569
12615
|
...isHovered && switchHoverStyles,
|
|
12570
|
-
...
|
|
12616
|
+
...isFocusVisible && switchFocusStyles,
|
|
12571
12617
|
...isDisabled && Css.bgGray300.$,
|
|
12572
12618
|
...isSelected && Css.bgBlue700.$,
|
|
12573
12619
|
...isSelected && isHovered && switchSelectedHoverStyles
|
|
@@ -12734,7 +12780,7 @@ var import_react_aria38 = require("react-aria");
|
|
|
12734
12780
|
var import_react_stately15 = require("react-stately");
|
|
12735
12781
|
var import_jsx_runtime77 = require("@emotion/react/jsx-runtime");
|
|
12736
12782
|
function ToggleButton(props) {
|
|
12737
|
-
const { selected: isSelected = false, disabled = false, label, onChange, icon, ...otherProps } = props;
|
|
12783
|
+
const { selected: isSelected = false, disabled = false, label, onChange, icon, __storyState, ...otherProps } = props;
|
|
12738
12784
|
const [asyncInProgress, setAsyncInProgress] = (0, import_react66.useState)(false);
|
|
12739
12785
|
const isDisabled = !!disabled || asyncInProgress;
|
|
12740
12786
|
const ariaProps = { "aria-label": label, isSelected, isDisabled, ...otherProps };
|
|
@@ -12751,11 +12797,14 @@ function ToggleButton(props) {
|
|
|
12751
12797
|
});
|
|
12752
12798
|
const labelRef = (0, import_react66.useRef)(null);
|
|
12753
12799
|
const ref = (0, import_react66.useRef)(null);
|
|
12754
|
-
const tid = useTestIds(
|
|
12755
|
-
const { isPressed, pressProps } = (0, import_react_aria38.usePress)({ ref: labelRef, isDisabled });
|
|
12800
|
+
const tid = useTestIds(otherProps, label);
|
|
12801
|
+
const { isPressed: isPressedFromEvents, pressProps } = (0, import_react_aria38.usePress)({ ref: labelRef, isDisabled });
|
|
12756
12802
|
const { inputProps } = (0, import_react_aria38.useSwitch)(ariaProps, state, ref);
|
|
12757
|
-
const { isFocusVisible:
|
|
12758
|
-
const { hoverProps, isHovered } = (0, import_react_aria38.useHover)({ isDisabled });
|
|
12803
|
+
const { isFocusVisible: isFocusVisibleFromEvents, focusProps } = (0, import_react_aria38.useFocusRing)({ ...otherProps, within: true });
|
|
12804
|
+
const { hoverProps, isHovered: isHoveredFromEvents } = (0, import_react_aria38.useHover)({ isDisabled });
|
|
12805
|
+
const isHovered = __storyState?.hovered ?? isHoveredFromEvents;
|
|
12806
|
+
const isPressed = __storyState?.pressed ?? isPressedFromEvents;
|
|
12807
|
+
const isFocusVisible = __storyState?.focusVisible ?? isFocusVisibleFromEvents;
|
|
12759
12808
|
const tooltip = resolveTooltip(disabled);
|
|
12760
12809
|
const labelAttrs = {
|
|
12761
12810
|
...focusProps,
|
|
@@ -12766,7 +12815,7 @@ function ToggleButton(props) {
|
|
|
12766
12815
|
...isHovered && toggleHoverStyles,
|
|
12767
12816
|
...isPressed && togglePressStyles,
|
|
12768
12817
|
...isSelected && !isDisabled && Css.blue700.$,
|
|
12769
|
-
...
|
|
12818
|
+
...isFocusVisible && toggleFocusStyles,
|
|
12770
12819
|
...isDisabled && Css.gray300.cursorNotAllowed.$
|
|
12771
12820
|
},
|
|
12772
12821
|
...tid
|
|
@@ -14138,7 +14187,25 @@ function GridTable(props) {
|
|
|
14138
14187
|
let visibleDataRows2 = [];
|
|
14139
14188
|
const { visibleRows } = tableState;
|
|
14140
14189
|
const hasExpandableHeader = visibleRows.some((rs) => rs.row.id === EXPANDABLE_HEADER);
|
|
14190
|
+
const bodyRowsCount = visibleRows.filter((rs) => ![HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind)).length;
|
|
14191
|
+
const onlyKeptBodyRows = bodyRowsCount > 0 && visibleRows.every(
|
|
14192
|
+
(rs) => (
|
|
14193
|
+
// For our purposes, "body rows" are any non-header / non-totals rows.
|
|
14194
|
+
[HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind) || rs.isKept || rs.kind === KEPT_GROUP
|
|
14195
|
+
)
|
|
14196
|
+
);
|
|
14197
|
+
let bodyRowsSeen = 0;
|
|
14198
|
+
let foundFirstBodyRow = false;
|
|
14199
|
+
let foundFirstHeadRow = false;
|
|
14141
14200
|
visibleRows.forEach((rs) => {
|
|
14201
|
+
const isHeadRow = [HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind);
|
|
14202
|
+
const isFirstHeadRow = isHeadRow && !foundFirstHeadRow;
|
|
14203
|
+
const isBodyRow = ![HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind);
|
|
14204
|
+
const isFirstBodyRow = isBodyRow && !foundFirstBodyRow;
|
|
14205
|
+
if (isHeadRow) foundFirstHeadRow = true;
|
|
14206
|
+
if (isBodyRow) bodyRowsSeen += 1;
|
|
14207
|
+
if (isBodyRow) foundFirstBodyRow = true;
|
|
14208
|
+
const isLastBodyRow = isBodyRow && bodyRowsSeen === bodyRowsCount && !onlyKeptBodyRows;
|
|
14142
14209
|
const row = /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14143
14210
|
Row,
|
|
14144
14211
|
{
|
|
@@ -14157,6 +14224,9 @@ function GridTable(props) {
|
|
|
14157
14224
|
cellHighlight: "cellHighlight" in maybeStyle && maybeStyle.cellHighlight === true,
|
|
14158
14225
|
omitRowHover: "rowHover" in maybeStyle && maybeStyle.rowHover === false,
|
|
14159
14226
|
hasExpandableHeader,
|
|
14227
|
+
isFirstHeadRow,
|
|
14228
|
+
isFirstBodyRow,
|
|
14229
|
+
isLastBodyRow,
|
|
14160
14230
|
resizedWidths,
|
|
14161
14231
|
setResizedWidth: handleColumnResize,
|
|
14162
14232
|
disableColumnResizing,
|
|
@@ -14255,27 +14325,30 @@ function renderDiv(style, id, columns, visibleDataRows, keptSelectedRows, firstR
|
|
|
14255
14325
|
"div",
|
|
14256
14326
|
{
|
|
14257
14327
|
css: {
|
|
14258
|
-
...style.firstRowCss && Css.addIn("& > div:first-of-type", style.firstRowCss).$,
|
|
14259
14328
|
...Css.if(stickyHeader).sticky.topPx(stickyOffset).z(zIndices.stickyHeader).$
|
|
14260
14329
|
},
|
|
14261
14330
|
children: tableHeadRows
|
|
14262
14331
|
}
|
|
14263
14332
|
),
|
|
14264
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14333
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
14334
|
+
keptSelectedRows,
|
|
14335
|
+
firstRowMessage && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14336
|
+
"div",
|
|
14337
|
+
{
|
|
14338
|
+
css: {
|
|
14339
|
+
...keptSelectedRows.length === 0 && style.firstBodyRowCss,
|
|
14340
|
+
...style.firstRowMessageCss,
|
|
14341
|
+
...visibleDataRows.length === 0 && style.lastRowCss,
|
|
14342
|
+
...visibleDataRows.length === 0 && style.lastRowCellCss,
|
|
14343
|
+
...visibleDataRows.length === 0 && style.lastRowFirstCellCss,
|
|
14344
|
+
...visibleDataRows.length === 0 && style.lastRowLastCellCss
|
|
14345
|
+
},
|
|
14346
|
+
"data-gridrow": true,
|
|
14347
|
+
children: firstRowMessage
|
|
14348
|
+
}
|
|
14349
|
+
),
|
|
14350
|
+
visibleDataRows
|
|
14351
|
+
] })
|
|
14279
14352
|
]
|
|
14280
14353
|
}
|
|
14281
14354
|
);
|
|
@@ -14287,10 +14360,6 @@ function renderTable(style, id, columns, visibleDataRows, keptSelectedRows, firs
|
|
|
14287
14360
|
ref: tableContainerRef,
|
|
14288
14361
|
css: {
|
|
14289
14362
|
...Css.w100.add("borderCollapse", "separate").add("borderSpacing", "0").$,
|
|
14290
|
-
...Css.addIn("& tr ", { pageBreakAfter: "auto", pageBreakInside: "avoid" }).$,
|
|
14291
|
-
...Css.addIn("& > tbody > tr > * ", style.betweenRowsCss || {}).addIn("& > tbody > tr:first-of-type", style.firstNonHeaderRowCss || {}).$,
|
|
14292
|
-
...Css.addIn("& > tbody > tr:last-of-type", style.lastRowCss).$,
|
|
14293
|
-
...Css.addIn("& > thead > tr:first-of-type", style.firstRowCss).$,
|
|
14294
14363
|
...style.rootCss,
|
|
14295
14364
|
...style.minWidthPx ? Css.mwPx(style.minWidthPx).$ : {},
|
|
14296
14365
|
...xss
|
|
@@ -14300,7 +14369,30 @@ function renderTable(style, id, columns, visibleDataRows, keptSelectedRows, firs
|
|
|
14300
14369
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("thead", { css: Css.if(stickyHeader).sticky.topPx(stickyOffset).z(zIndices.stickyHeader).$, children: tableHeadRows }),
|
|
14301
14370
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("tbody", { children: [
|
|
14302
14371
|
keptSelectedRows,
|
|
14303
|
-
firstRowMessage && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14372
|
+
firstRowMessage && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14373
|
+
"tr",
|
|
14374
|
+
{
|
|
14375
|
+
css: {
|
|
14376
|
+
...tableRowPrintBreakCss,
|
|
14377
|
+
...keptSelectedRows.length === 0 && style.firstBodyRowCss,
|
|
14378
|
+
...visibleDataRows.length === 0 && style.lastRowCss
|
|
14379
|
+
},
|
|
14380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14381
|
+
"td",
|
|
14382
|
+
{
|
|
14383
|
+
colSpan: columns.length,
|
|
14384
|
+
css: {
|
|
14385
|
+
...style.betweenRowsCss,
|
|
14386
|
+
...style.firstRowMessageCss,
|
|
14387
|
+
...visibleDataRows.length === 0 && style.lastRowCellCss,
|
|
14388
|
+
...visibleDataRows.length === 0 && style.lastRowFirstCellCss,
|
|
14389
|
+
...visibleDataRows.length === 0 && style.lastRowLastCellCss
|
|
14390
|
+
},
|
|
14391
|
+
children: firstRowMessage
|
|
14392
|
+
}
|
|
14393
|
+
)
|
|
14394
|
+
}
|
|
14395
|
+
),
|
|
14304
14396
|
visibleDataRows
|
|
14305
14397
|
] })
|
|
14306
14398
|
]
|
|
@@ -14353,7 +14445,28 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
|
|
|
14353
14445
|
if (index === 0) {
|
|
14354
14446
|
return (
|
|
14355
14447
|
// Ensure the fallback message is the same width as the table
|
|
14356
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14448
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14449
|
+
"div",
|
|
14450
|
+
{
|
|
14451
|
+
css: {
|
|
14452
|
+
...getTableRefWidthStyles(true),
|
|
14453
|
+
...keptSelectedRows.length === 0 && style.firstBodyRowCss,
|
|
14454
|
+
...visibleDataRows.length === 0 && style.lastRowCss
|
|
14455
|
+
},
|
|
14456
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14457
|
+
"div",
|
|
14458
|
+
{
|
|
14459
|
+
css: {
|
|
14460
|
+
...style.firstRowMessageCss,
|
|
14461
|
+
...visibleDataRows.length === 0 && style.lastRowCellCss,
|
|
14462
|
+
...visibleDataRows.length === 0 && style.lastRowFirstCellCss,
|
|
14463
|
+
...visibleDataRows.length === 0 && style.lastRowLastCellCss
|
|
14464
|
+
},
|
|
14465
|
+
children: firstRowMessage
|
|
14466
|
+
}
|
|
14467
|
+
)
|
|
14468
|
+
}
|
|
14469
|
+
)
|
|
14357
14470
|
);
|
|
14358
14471
|
}
|
|
14359
14472
|
index--;
|
|
@@ -14391,20 +14504,12 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
|
|
|
14391
14504
|
var VirtualRoot = (0, import_memoize_one.default)(
|
|
14392
14505
|
(gs, _columns, id, xss) => {
|
|
14393
14506
|
return import_react74.default.forwardRef(function VirtualRoot2({ style, children }, ref) {
|
|
14394
|
-
const isHeader = Object.keys(style || {}).length === 0;
|
|
14395
14507
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14396
14508
|
"div",
|
|
14397
14509
|
{
|
|
14398
14510
|
ref,
|
|
14399
14511
|
style: { ...style, ...{ minWidth: "fit-content" } },
|
|
14400
14512
|
css: {
|
|
14401
|
-
// Add an extra `> div` due to Item + itemContent both having divs
|
|
14402
|
-
...Css.addIn("& > div + div > div > *", gs.betweenRowsCss || {}).$,
|
|
14403
|
-
// Table list styles only
|
|
14404
|
-
...isHeader ? Css.addIn("& > div:first-of-type > *", gs.firstRowCss).$ : {
|
|
14405
|
-
...Css.addIn("& > div:first-of-type", gs.firstNonHeaderRowCss).$,
|
|
14406
|
-
...Css.addIn("& > div:last-of-type > *", gs.lastRowCss).$
|
|
14407
|
-
},
|
|
14408
14513
|
...gs.rootCss,
|
|
14409
14514
|
...gs.minWidthPx ? Css.mwPx(gs.minWidthPx).$ : {},
|
|
14410
14515
|
...xss
|
|
@@ -15917,17 +16022,18 @@ function FormLines(props) {
|
|
|
15917
16022
|
{
|
|
15918
16023
|
css: {
|
|
15919
16024
|
// Note that we're purposefully not using display:flex so that our children's margins will collapse.
|
|
15920
|
-
...Css.w(sizes[width2])
|
|
15921
|
-
// Purposefully use this instead of childGap3 to put margin-bottom on the last line
|
|
15922
|
-
"& > *": Css.mb(gap).$
|
|
16025
|
+
...Css.w(sizes[width2]).$
|
|
15923
16026
|
},
|
|
15924
16027
|
children: import_react86.Children.map(children, (child) => {
|
|
16028
|
+
if (child === null || child === void 0 || typeof child === "boolean") {
|
|
16029
|
+
return child;
|
|
16030
|
+
}
|
|
15925
16031
|
if (child && typeof child === "object" && "type" in child && child.type.isFormHeading) {
|
|
15926
16032
|
const clone = (0, import_react86.cloneElement)(child, { isFirst: firstFormHeading });
|
|
15927
16033
|
firstFormHeading = false;
|
|
15928
|
-
return clone;
|
|
16034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { css: Css.mb(gap).$, children: clone });
|
|
15929
16035
|
} else {
|
|
15930
|
-
return child;
|
|
16036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { css: Css.mb(gap).$, children: child });
|
|
15931
16037
|
}
|
|
15932
16038
|
})
|
|
15933
16039
|
}
|
|
@@ -16101,45 +16207,46 @@ function CompoundField({ children }) {
|
|
|
16101
16207
|
}
|
|
16102
16208
|
const commonStyles = Css.df.aic.fs1.maxwPx(550).bt.bb.bcGray300.$;
|
|
16103
16209
|
const internalProps = { compound: true };
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
children: [
|
|
16113
|
-
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
16114
|
-
"div",
|
|
16115
|
-
{
|
|
16116
|
-
css: {
|
|
16117
|
-
...commonStyles,
|
|
16118
|
-
...Css.bl.borderRadius("4px 0 0 4px").$,
|
|
16119
|
-
"&:focus-within": Css.bcBlue700.$
|
|
16120
|
-
},
|
|
16121
|
-
children: (0, import_react88.cloneElement)(children[0], {
|
|
16122
|
-
internalProps
|
|
16123
|
-
})
|
|
16124
|
-
}
|
|
16125
|
-
),
|
|
16126
|
-
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { css: Css.wPx(1).fn.bgGray300.$ }),
|
|
16127
|
-
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
16128
|
-
"div",
|
|
16129
|
-
{
|
|
16130
|
-
css: {
|
|
16131
|
-
...commonStyles,
|
|
16132
|
-
...Css.fg1.br.borderRadius("0 4px 4px 0").$,
|
|
16133
|
-
"&:focus-within": Css.bcBlue700.$
|
|
16134
|
-
},
|
|
16135
|
-
children: (0, import_react88.cloneElement)(children[1], {
|
|
16136
|
-
internalProps
|
|
16137
|
-
})
|
|
16138
|
-
}
|
|
16139
|
-
)
|
|
16140
|
-
]
|
|
16210
|
+
const [hasFocusWithin, setHasFocusWithin] = (0, import_react88.useState)(false);
|
|
16211
|
+
function onFocusCapture() {
|
|
16212
|
+
setHasFocusWithin(true);
|
|
16213
|
+
}
|
|
16214
|
+
function onBlurCapture(e) {
|
|
16215
|
+
const nextFocusedElement = e.relatedTarget;
|
|
16216
|
+
if (nextFocusedElement instanceof Node && e.currentTarget.contains(nextFocusedElement)) {
|
|
16217
|
+
return;
|
|
16141
16218
|
}
|
|
16142
|
-
|
|
16219
|
+
setHasFocusWithin(false);
|
|
16220
|
+
}
|
|
16221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { css: Css.df.$, onFocusCapture, onBlurCapture, children: [
|
|
16222
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
16223
|
+
"div",
|
|
16224
|
+
{
|
|
16225
|
+
css: {
|
|
16226
|
+
...commonStyles,
|
|
16227
|
+
...Css.bl.borderRadius("4px 0 0 4px").$,
|
|
16228
|
+
"&:focus-within": Css.bcBlue700.$
|
|
16229
|
+
},
|
|
16230
|
+
children: (0, import_react88.cloneElement)(children[0], {
|
|
16231
|
+
internalProps
|
|
16232
|
+
})
|
|
16233
|
+
}
|
|
16234
|
+
),
|
|
16235
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { css: { ...Css.wPx(1).fn.bgGray300.$, ...hasFocusWithin && Css.bgBlue700.$ } }),
|
|
16236
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
16237
|
+
"div",
|
|
16238
|
+
{
|
|
16239
|
+
css: {
|
|
16240
|
+
...commonStyles,
|
|
16241
|
+
...Css.fg1.br.borderRadius("0 4px 4px 0").$,
|
|
16242
|
+
"&:focus-within": Css.bcBlue700.$
|
|
16243
|
+
},
|
|
16244
|
+
children: (0, import_react88.cloneElement)(children[1], {
|
|
16245
|
+
internalProps
|
|
16246
|
+
})
|
|
16247
|
+
}
|
|
16248
|
+
)
|
|
16249
|
+
] });
|
|
16143
16250
|
}
|
|
16144
16251
|
|
|
16145
16252
|
// src/forms/BoundSelectAndTextField.tsx
|
|
@@ -17887,18 +17994,42 @@ function ButtonGroup(props) {
|
|
|
17887
17994
|
const tid = useTestIds(props, "buttonGroup");
|
|
17888
17995
|
return (
|
|
17889
17996
|
// Adding `line-height: 0` prevent inheriting line-heights that might throw off sizing within the button group.
|
|
17890
|
-
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { ...tid, css: Css.df.lh(0).add({ ...sizeStyles2[size] }).$, children: buttons.map(({ disabled: buttonDisabled, ...buttonProps }, i) => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
17997
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { ...tid, css: Css.df.lh(0).add({ ...sizeStyles2[size] }).$, children: buttons.map(({ disabled: buttonDisabled, ...buttonProps }, i) => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
17998
|
+
GroupButton,
|
|
17999
|
+
{
|
|
18000
|
+
...buttonProps,
|
|
18001
|
+
disabled: disabled || buttonDisabled,
|
|
18002
|
+
size,
|
|
18003
|
+
isFirst: i === 0,
|
|
18004
|
+
isLast: i === buttons.length - 1,
|
|
18005
|
+
...tid
|
|
18006
|
+
},
|
|
18007
|
+
i
|
|
18008
|
+
)) })
|
|
17891
18009
|
);
|
|
17892
18010
|
}
|
|
17893
18011
|
function GroupButton(props) {
|
|
17894
|
-
const {
|
|
18012
|
+
const {
|
|
18013
|
+
icon,
|
|
18014
|
+
iconInc,
|
|
18015
|
+
iconColor,
|
|
18016
|
+
text,
|
|
18017
|
+
active,
|
|
18018
|
+
onClick: onPress,
|
|
18019
|
+
disabled,
|
|
18020
|
+
size,
|
|
18021
|
+
tooltip,
|
|
18022
|
+
isFirst,
|
|
18023
|
+
isLast,
|
|
18024
|
+
...otherProps
|
|
18025
|
+
} = props;
|
|
17895
18026
|
const ariaProps = { onPress, isDisabled: !!disabled, ...otherProps };
|
|
17896
18027
|
const ref = (0, import_react106.useRef)(null);
|
|
17897
18028
|
const { buttonProps, isPressed } = (0, import_react_aria47.useButton)(ariaProps, ref);
|
|
17898
18029
|
const { isFocusVisible, focusProps } = (0, import_react_aria47.useFocusRing)();
|
|
17899
18030
|
const { hoverProps, isHovered } = (0, import_react_aria47.useHover)(ariaProps);
|
|
17900
18031
|
const tid = useTestIds(props);
|
|
17901
|
-
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { css: getButtonStyles2(), children: maybeTooltip({
|
|
18032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { css: getButtonStyles2(isFirst, isLast), children: maybeTooltip({
|
|
17902
18033
|
title: resolveTooltip(disabled, tooltip),
|
|
17903
18034
|
placement: "top",
|
|
17904
18035
|
children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
@@ -17929,15 +18060,15 @@ var pressedStyles = Css.bgGray200.$;
|
|
|
17929
18060
|
var activeStyles3 = Css.bgGray300.$;
|
|
17930
18061
|
var hoverStyles3 = Css.bgGray100.$;
|
|
17931
18062
|
var defaultFocusRingStyles2 = Css.relative.z2.bshFocus.$;
|
|
17932
|
-
function getButtonStyles2() {
|
|
18063
|
+
function getButtonStyles2(isFirst, isLast) {
|
|
17933
18064
|
return {
|
|
17934
18065
|
...Css.z1.bgWhite.bcGray300.bw1.ba.gray900.br0.oh.$,
|
|
17935
|
-
// Our first button should have a rounded left border
|
|
17936
|
-
|
|
17937
|
-
// Our last button should have a rounded right border
|
|
17938
|
-
|
|
17939
|
-
// Nudge buttons one pixel to the left so they visually share a border
|
|
17940
|
-
|
|
18066
|
+
// Our first button should have a rounded left border.
|
|
18067
|
+
...isFirst && Css.add("borderRadius", "4px 0 0 4px").$,
|
|
18068
|
+
// Our last button should have a rounded right border.
|
|
18069
|
+
...isLast && Css.add("borderRadius", "0 4px 4px 0").$,
|
|
18070
|
+
// Nudge buttons one pixel to the left so they visually share a border.
|
|
18071
|
+
...!isFirst && Css.mlPx(-1).$
|
|
17941
18072
|
};
|
|
17942
18073
|
}
|
|
17943
18074
|
var sizeStyles2 = {
|
|
@@ -18067,9 +18198,9 @@ function Copy(props) {
|
|
|
18067
18198
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
18068
18199
|
"div",
|
|
18069
18200
|
{
|
|
18201
|
+
className: "beam-copy",
|
|
18070
18202
|
css: {
|
|
18071
|
-
...Css.sm.gray700.mt2.mb3.wPx(480)
|
|
18072
|
-
"& > p": Css.my2.$
|
|
18203
|
+
...Css.sm.gray700.mt2.mb3.wPx(480).$
|
|
18073
18204
|
},
|
|
18074
18205
|
children: props.children
|
|
18075
18206
|
}
|
|
@@ -18102,6 +18233,7 @@ function DnDGrid(props) {
|
|
|
18102
18233
|
const reorderViaKeyboard = (0, import_react110.useRef)(false);
|
|
18103
18234
|
const transformFrom = (0, import_react110.useRef)({ x: 0, y: 0 });
|
|
18104
18235
|
const tid = useTestIds(props, "dndGrid");
|
|
18236
|
+
const activeStyles4 = activeItemStyles ?? Css.bshModal.$;
|
|
18105
18237
|
const getGridItems = (0, import_react110.useCallback)(() => {
|
|
18106
18238
|
return gridEl.current ? Array.from(gridEl.current.querySelectorAll(`[${gridItemIdKey}]`)) : [];
|
|
18107
18239
|
}, []);
|
|
@@ -18111,19 +18243,19 @@ function DnDGrid(props) {
|
|
|
18111
18243
|
const initReorder = (0, import_react110.useCallback)(() => {
|
|
18112
18244
|
if (gridEl.current && dragEl.current) {
|
|
18113
18245
|
initialOrder.current = getGridItemIdOrder();
|
|
18114
|
-
dragEl.current
|
|
18246
|
+
setInlineStyles(dragEl.current, activeStyles4);
|
|
18115
18247
|
}
|
|
18116
|
-
}, [getGridItemIdOrder]);
|
|
18248
|
+
}, [getGridItemIdOrder, activeStyles4]);
|
|
18117
18249
|
const commitReorder = (0, import_react110.useCallback)(() => {
|
|
18118
18250
|
if (gridEl.current && dragEl.current) {
|
|
18119
18251
|
const currentOrder = getGridItemIdOrder();
|
|
18120
18252
|
if (!(0, import_fast_deep_equal2.default)(currentOrder, initialOrder.current)) onReorder(currentOrder);
|
|
18121
|
-
dragEl.current
|
|
18253
|
+
clearInlineStyles(dragEl.current, activeStyles4);
|
|
18122
18254
|
dragEl.current = void 0;
|
|
18123
18255
|
reorderViaKeyboard.current = false;
|
|
18124
18256
|
initialOrder.current = currentOrder;
|
|
18125
18257
|
}
|
|
18126
|
-
}, [onReorder, getGridItemIdOrder]);
|
|
18258
|
+
}, [onReorder, getGridItemIdOrder, activeStyles4]);
|
|
18127
18259
|
const cancelReorder = (0, import_react110.useCallback)(() => {
|
|
18128
18260
|
if (gridEl.current && dragEl.current && initialOrder.current) {
|
|
18129
18261
|
const currentOrder = getGridItemIdOrder();
|
|
@@ -18141,11 +18273,11 @@ function DnDGrid(props) {
|
|
|
18141
18273
|
}
|
|
18142
18274
|
}
|
|
18143
18275
|
}
|
|
18144
|
-
dragEl.current
|
|
18276
|
+
clearInlineStyles(dragEl.current, activeStyles4);
|
|
18145
18277
|
dragEl.current = void 0;
|
|
18146
18278
|
reorderViaKeyboard.current = false;
|
|
18147
18279
|
}
|
|
18148
|
-
}, [getGridItemIdOrder, getGridItems]);
|
|
18280
|
+
}, [getGridItemIdOrder, getGridItems, activeStyles4]);
|
|
18149
18281
|
const onMove = (0, import_react110.useCallback)((e) => {
|
|
18150
18282
|
if (!reorderViaKeyboard.current && dragEl.current && cloneEl.current && gridEl.current) {
|
|
18151
18283
|
const clientX = "clientX" in e ? e.clientX : e.touches[0].clientX;
|
|
@@ -18184,18 +18316,21 @@ function DnDGrid(props) {
|
|
|
18184
18316
|
);
|
|
18185
18317
|
cloneEl.current?.setAttribute(gridCloneKey, "true");
|
|
18186
18318
|
cloneEl.current.removeAttribute("id");
|
|
18187
|
-
cloneEl.current?.classList.remove(activeGridItemClass);
|
|
18188
18319
|
gridEl.current.insertBefore(cloneEl.current, dragEl.current.nextSibling);
|
|
18189
|
-
dragEl.current.
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18320
|
+
dragEl.current.style.pointerEvents = "none";
|
|
18321
|
+
dragEl.current.style.position = "fixed";
|
|
18322
|
+
dragEl.current.style.zIndex = "9999";
|
|
18323
|
+
dragEl.current.style.top = `${top}px`;
|
|
18324
|
+
dragEl.current.style.left = `${left}px`;
|
|
18325
|
+
dragEl.current.style.width = `${rect.width}px`;
|
|
18326
|
+
dragEl.current.style.height = `${rect.height}px`;
|
|
18327
|
+
setInlineStyles(dragEl.current, activeStyles4);
|
|
18193
18328
|
gridEl.current.style.cursor = "grabbing";
|
|
18194
18329
|
gridEl.current.addEventListener("mousemove", onMove);
|
|
18195
18330
|
gridEl.current.addEventListener("touchmove", onMove);
|
|
18196
18331
|
}
|
|
18197
18332
|
},
|
|
18198
|
-
[initReorder, onMove]
|
|
18333
|
+
[initReorder, onMove, activeStyles4]
|
|
18199
18334
|
);
|
|
18200
18335
|
const onDragEnd = (0, import_react110.useCallback)(
|
|
18201
18336
|
(e) => {
|
|
@@ -18269,7 +18404,7 @@ function DnDGrid(props) {
|
|
|
18269
18404
|
{
|
|
18270
18405
|
ref: gridEl,
|
|
18271
18406
|
css: {
|
|
18272
|
-
...Css.ctis.dg
|
|
18407
|
+
...Css.ctis.dg.$,
|
|
18273
18408
|
...gridStyles
|
|
18274
18409
|
},
|
|
18275
18410
|
onTouchStart: onDragStart,
|
|
@@ -18283,7 +18418,6 @@ function DnDGrid(props) {
|
|
|
18283
18418
|
}
|
|
18284
18419
|
var gridItemIdKey = "dndgrid-itemid";
|
|
18285
18420
|
var gridCloneKey = "dndgrid-clone";
|
|
18286
|
-
var activeGridItemClass = "dndgrid-active";
|
|
18287
18421
|
|
|
18288
18422
|
// src/components/DnDGrid/DnDGridItemHandle.tsx
|
|
18289
18423
|
var import_react_aria49 = require("react-aria");
|