@homebound/beam 4.35.0 → 4.36.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/index.cjs +942 -842
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +319 -220
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11272,6 +11272,22 @@ function ProposedValue(props) {
|
|
|
11272
11272
|
}), ...tid.proposed, children: proposed })
|
|
11273
11273
|
] });
|
|
11274
11274
|
}
|
|
11275
|
+
function OriginalValue(props) {
|
|
11276
|
+
const {
|
|
11277
|
+
originalValue,
|
|
11278
|
+
...others
|
|
11279
|
+
} = props;
|
|
11280
|
+
return /* @__PURE__ */ jsx38("div", { ...trussProps23({
|
|
11281
|
+
color: ["color_var", {
|
|
11282
|
+
"--color": "var(--b-text-helper)"
|
|
11283
|
+
}],
|
|
11284
|
+
fontWeight: "fw4",
|
|
11285
|
+
fontSize: "fz_12px",
|
|
11286
|
+
lineHeight: "lh_16px",
|
|
11287
|
+
marginTop: "mt_4px",
|
|
11288
|
+
textDecoration: "tdlt"
|
|
11289
|
+
}), ...others, children: originalValue });
|
|
11290
|
+
}
|
|
11275
11291
|
|
|
11276
11292
|
// src/components/Table/components/Row.css.ts
|
|
11277
11293
|
var css = {
|
|
@@ -11298,9 +11314,8 @@ function getFieldWidth(fullWidth) {
|
|
|
11298
11314
|
return fullWidth ? "100%" : "550px";
|
|
11299
11315
|
}
|
|
11300
11316
|
|
|
11301
|
-
// src/inputs/
|
|
11302
|
-
import {
|
|
11303
|
-
import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
11317
|
+
// src/inputs/fieldChrome.ts
|
|
11318
|
+
import { maybeCssVar as maybeCssVar17 } from "@homebound/truss/runtime";
|
|
11304
11319
|
var __maybeInc10 = (inc) => {
|
|
11305
11320
|
return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
|
|
11306
11321
|
};
|
|
@@ -11361,6 +11376,221 @@ var __typography4 = {
|
|
|
11361
11376
|
lineHeight: "lh_32px"
|
|
11362
11377
|
}
|
|
11363
11378
|
};
|
|
11379
|
+
var fieldHeight = 40;
|
|
11380
|
+
var compactFieldHeight = 32;
|
|
11381
|
+
function getFieldChrome(options) {
|
|
11382
|
+
const {
|
|
11383
|
+
typeScale,
|
|
11384
|
+
labelStyle,
|
|
11385
|
+
labelLeftFieldWidth = "50%",
|
|
11386
|
+
compact,
|
|
11387
|
+
borderless,
|
|
11388
|
+
borderOnHover,
|
|
11389
|
+
fullWidth,
|
|
11390
|
+
visuallyDisabled,
|
|
11391
|
+
isHovered,
|
|
11392
|
+
compound = false,
|
|
11393
|
+
multiline = false,
|
|
11394
|
+
showProposal = false,
|
|
11395
|
+
inputStylePalette
|
|
11396
|
+
} = options;
|
|
11397
|
+
const maybeSmaller = compound ? 2 : 0;
|
|
11398
|
+
const [bgColor, hoverBgColor, disabledBgColor] = fieldBackgrounds({
|
|
11399
|
+
showProposal,
|
|
11400
|
+
inputStylePalette,
|
|
11401
|
+
borderOnHover,
|
|
11402
|
+
borderless,
|
|
11403
|
+
compound
|
|
11404
|
+
});
|
|
11405
|
+
const fixedHeight = {
|
|
11406
|
+
height: ["h_var", {
|
|
11407
|
+
"--height": `${fieldHeight - maybeSmaller}px`
|
|
11408
|
+
}],
|
|
11409
|
+
...compact ? {
|
|
11410
|
+
height: ["h_var", {
|
|
11411
|
+
"--height": `${compactFieldHeight - maybeSmaller}px`
|
|
11412
|
+
}]
|
|
11413
|
+
} : {}
|
|
11414
|
+
};
|
|
11415
|
+
const minHeight = {
|
|
11416
|
+
minHeight: ["mh_var", {
|
|
11417
|
+
"--minHeight": `${fieldHeight - maybeSmaller}px`
|
|
11418
|
+
}],
|
|
11419
|
+
...compact ? {
|
|
11420
|
+
minHeight: ["mh_var", {
|
|
11421
|
+
"--minHeight": `${compactFieldHeight - maybeSmaller}px`
|
|
11422
|
+
}]
|
|
11423
|
+
} : {}
|
|
11424
|
+
};
|
|
11425
|
+
return {
|
|
11426
|
+
container: {
|
|
11427
|
+
display: "df",
|
|
11428
|
+
flexDirection: "fdc",
|
|
11429
|
+
width: "w100",
|
|
11430
|
+
maxWidth: ["maxw_var", {
|
|
11431
|
+
"--maxWidth": maybeCssVar17(getFieldWidth(fullWidth))
|
|
11432
|
+
}],
|
|
11433
|
+
position: "relative",
|
|
11434
|
+
...labelStyle === "left" ? {
|
|
11435
|
+
maxWidth: "maxw100",
|
|
11436
|
+
flexDirection: "fdr",
|
|
11437
|
+
gap: "g_2",
|
|
11438
|
+
justifyContent: "jcsb",
|
|
11439
|
+
alignItems: "aic"
|
|
11440
|
+
} : {}
|
|
11441
|
+
},
|
|
11442
|
+
control: {
|
|
11443
|
+
...{
|
|
11444
|
+
...__typography4[typeScale] ?? {},
|
|
11445
|
+
display: "df",
|
|
11446
|
+
alignItems: "aic",
|
|
11447
|
+
borderRadius: "br8",
|
|
11448
|
+
paddingLeft: ["px_var", {
|
|
11449
|
+
"--paddingLeft": `${textFieldBasePadding}px`
|
|
11450
|
+
}],
|
|
11451
|
+
paddingRight: ["px_var", {
|
|
11452
|
+
"--paddingRight": `${textFieldBasePadding}px`
|
|
11453
|
+
}],
|
|
11454
|
+
width: "w100",
|
|
11455
|
+
backgroundColor: ["bgColor_var", {
|
|
11456
|
+
"--backgroundColor": maybeCssVar17(bgColor)
|
|
11457
|
+
}],
|
|
11458
|
+
color: ["color_var", {
|
|
11459
|
+
"--color": "var(--b-on-surface)"
|
|
11460
|
+
}],
|
|
11461
|
+
...labelStyle === "left" ? {
|
|
11462
|
+
width: ["w_var", {
|
|
11463
|
+
"--width": maybeCssVar17(__maybeInc10(labelLeftFieldWidth))
|
|
11464
|
+
}]
|
|
11465
|
+
} : {}
|
|
11466
|
+
},
|
|
11467
|
+
// Borderless fields sit next to plain text in tables. Grow by the horizontal padding and pull
|
|
11468
|
+
// back left so the text lines up. Compound fields own their own width.
|
|
11469
|
+
...borderless && !compound ? {
|
|
11470
|
+
borderColor: "bcTransparent",
|
|
11471
|
+
width: "w_calc_100_16px",
|
|
11472
|
+
marginLeft: "ml_neg1"
|
|
11473
|
+
} : {
|
|
11474
|
+
borderColor: ["bc_var", {
|
|
11475
|
+
"--borderColor": "var(--b-field-border-default)"
|
|
11476
|
+
}]
|
|
11477
|
+
},
|
|
11478
|
+
...!compound ? {
|
|
11479
|
+
borderStyle: "bss",
|
|
11480
|
+
borderWidth: "bw1"
|
|
11481
|
+
} : {},
|
|
11482
|
+
...borderOnHover ? {
|
|
11483
|
+
borderRadius: "br4",
|
|
11484
|
+
borderStyle: "bss",
|
|
11485
|
+
borderWidth: "bw1",
|
|
11486
|
+
borderColor: "bcTransparent",
|
|
11487
|
+
transition: "tsn_border_color_200ms"
|
|
11488
|
+
} : {},
|
|
11489
|
+
...borderOnHover && isHovered ? {
|
|
11490
|
+
backgroundColor: ["bgColor_var", {
|
|
11491
|
+
"--backgroundColor": maybeCssVar17(hoverBgColor)
|
|
11492
|
+
}],
|
|
11493
|
+
borderStyle: "bss",
|
|
11494
|
+
borderWidth: "bw1",
|
|
11495
|
+
borderColor: "bcBlue300"
|
|
11496
|
+
} : {},
|
|
11497
|
+
...multiline ? minHeight : fixedHeight
|
|
11498
|
+
},
|
|
11499
|
+
readOnly: {
|
|
11500
|
+
...{
|
|
11501
|
+
...__typography4[typeScale] ?? {},
|
|
11502
|
+
display: "df",
|
|
11503
|
+
alignItems: "aic",
|
|
11504
|
+
width: "w100",
|
|
11505
|
+
color: ["color_var", {
|
|
11506
|
+
"--color": "var(--b-on-surface)"
|
|
11507
|
+
}],
|
|
11508
|
+
...labelStyle === "left" ? {
|
|
11509
|
+
width: ["w_var", {
|
|
11510
|
+
"--width": maybeCssVar17(__maybeInc10(labelLeftFieldWidth))
|
|
11511
|
+
}]
|
|
11512
|
+
} : {}
|
|
11513
|
+
},
|
|
11514
|
+
// Hidden labels mean a table cell. Min-height matches an editable field so the row lines up.
|
|
11515
|
+
...labelStyle === "hidden" ? minHeight : {}
|
|
11516
|
+
},
|
|
11517
|
+
hover: {
|
|
11518
|
+
backgroundColor: ["bgColor_var", {
|
|
11519
|
+
"--backgroundColor": maybeCssVar17(hoverBgColor)
|
|
11520
|
+
}],
|
|
11521
|
+
borderColor: ["bc_var", {
|
|
11522
|
+
"--borderColor": "var(--b-field-border-hover)"
|
|
11523
|
+
}]
|
|
11524
|
+
},
|
|
11525
|
+
focus: {
|
|
11526
|
+
borderColor: ["bc_var", {
|
|
11527
|
+
"--borderColor": "var(--b-field-border-focus)"
|
|
11528
|
+
}],
|
|
11529
|
+
backgroundColor: ["bgColor_var", {
|
|
11530
|
+
"--backgroundColor": maybeCssVar17(hoverBgColor)
|
|
11531
|
+
}],
|
|
11532
|
+
...borderOnHover ? {
|
|
11533
|
+
borderColor: ["bc_var", {
|
|
11534
|
+
"--borderColor": "var(--b-field-border-focus)"
|
|
11535
|
+
}]
|
|
11536
|
+
} : {}
|
|
11537
|
+
},
|
|
11538
|
+
disabled: visuallyDisabled ? {
|
|
11539
|
+
cursor: "cur_not_allowed",
|
|
11540
|
+
color: ["color_var", {
|
|
11541
|
+
"--color": "var(--b-field-text-disabled)"
|
|
11542
|
+
}],
|
|
11543
|
+
backgroundColor: ["bgColor_var", {
|
|
11544
|
+
"--backgroundColor": maybeCssVar17(disabledBgColor)
|
|
11545
|
+
}]
|
|
11546
|
+
} : {
|
|
11547
|
+
cursor: "cur_not_allowed"
|
|
11548
|
+
},
|
|
11549
|
+
error: {
|
|
11550
|
+
borderColor: ["bc_var", {
|
|
11551
|
+
"--borderColor": "var(--b-field-border-error)"
|
|
11552
|
+
}]
|
|
11553
|
+
}
|
|
11554
|
+
};
|
|
11555
|
+
}
|
|
11556
|
+
function selectedValueCss(labelStyle, readOnly) {
|
|
11557
|
+
return labelStyle !== "inline" && !readOnly ? {
|
|
11558
|
+
fontWeight: "fw5"
|
|
11559
|
+
} : void 0;
|
|
11560
|
+
}
|
|
11561
|
+
var textFieldBasePadding = increment(1);
|
|
11562
|
+
function fieldBackgrounds(options) {
|
|
11563
|
+
const {
|
|
11564
|
+
showProposal,
|
|
11565
|
+
inputStylePalette,
|
|
11566
|
+
borderOnHover,
|
|
11567
|
+
borderless,
|
|
11568
|
+
compound
|
|
11569
|
+
} = options;
|
|
11570
|
+
if (showProposal) return ["--b-ai-field-bg" /* AiFieldBg */, "rgba(237, 233, 254, 1)" /* Purple100 */, "--b-field-bg-disabled" /* FieldBgDisabled */];
|
|
11571
|
+
if (inputStylePalette) return inputStylePaletteBackgrounds(inputStylePalette);
|
|
11572
|
+
if (borderOnHover) return ["rgba(0,0,0,0)" /* Transparent */, "rgba(219, 234, 254, 1)" /* Blue100 */, "rgba(247, 245, 245, 1)" /* Gray100 */];
|
|
11573
|
+
if (borderless && !compound) return ["rgba(247, 245, 245, 1)" /* Gray100 */, "rgba(236, 235, 235, 1)" /* Gray200 */, "rgba(236, 235, 235, 1)" /* Gray200 */];
|
|
11574
|
+
return ["--b-field-bg-default" /* FieldBgDefault */, "--b-field-bg-hover" /* FieldBgHover */, "--b-field-bg-disabled" /* FieldBgDisabled */];
|
|
11575
|
+
}
|
|
11576
|
+
function inputStylePaletteBackgrounds(inputStylePalette) {
|
|
11577
|
+
switch (inputStylePalette) {
|
|
11578
|
+
case "success":
|
|
11579
|
+
return ["rgba(236, 253, 245, 1)" /* Green50 */, "rgba(209, 250, 229, 1)" /* Green100 */, "rgba(236, 253, 245, 1)" /* Green50 */];
|
|
11580
|
+
case "caution":
|
|
11581
|
+
return ["rgba(254, 252, 232, 1)" /* Yellow50 */, "rgba(254, 249, 195, 1)" /* Yellow100 */, "rgba(254, 252, 232, 1)" /* Yellow50 */];
|
|
11582
|
+
case "warning":
|
|
11583
|
+
return ["rgba(254, 242, 242, 1)" /* Red50 */, "rgba(254, 226, 226, 1)" /* Red100 */, "rgba(254, 242, 242, 1)" /* Red50 */];
|
|
11584
|
+
case "info":
|
|
11585
|
+
return ["rgba(239, 246, 255, 1)" /* Blue50 */, "rgba(219, 234, 254, 1)" /* Blue100 */, "rgba(239, 246, 255, 1)" /* Blue50 */];
|
|
11586
|
+
default:
|
|
11587
|
+
return ["rgba(255, 255, 255, 1)" /* White */, "rgba(247, 245, 245, 1)" /* Gray100 */, "rgba(247, 245, 245, 1)" /* Gray100 */];
|
|
11588
|
+
}
|
|
11589
|
+
}
|
|
11590
|
+
|
|
11591
|
+
// src/inputs/TextFieldBase.tsx
|
|
11592
|
+
import { trussProps as trussProps24, mergeProps as mergeProps_13 } from "@homebound/truss/runtime";
|
|
11593
|
+
import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
11364
11594
|
function TextFieldBase(props) {
|
|
11365
11595
|
const {
|
|
11366
11596
|
fieldProps,
|
|
@@ -11430,147 +11660,30 @@ function TextFieldBase(props) {
|
|
|
11430
11660
|
onFocusWithinChange: setIsFocused
|
|
11431
11661
|
});
|
|
11432
11662
|
const fieldRef = useGetRef(inputRef);
|
|
11433
|
-
const maybeSmaller = compound ? 2 : 0;
|
|
11434
|
-
const fieldHeight = 40;
|
|
11435
|
-
const compactFieldHeight = 32;
|
|
11436
11663
|
const showProposal = proposedValue !== void 0;
|
|
11437
11664
|
const showOriginal = originalValue !== void 0 && originalValue !== "";
|
|
11438
11665
|
const originalBelow = showOriginal && !inputProps.readOnly && !compound ? originalValue : void 0;
|
|
11439
11666
|
const showErrorAndHelper = alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly;
|
|
11440
|
-
const
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11667
|
+
const fieldChrome = getFieldChrome({
|
|
11668
|
+
typeScale,
|
|
11669
|
+
labelStyle,
|
|
11670
|
+
labelLeftFieldWidth,
|
|
11671
|
+
compact,
|
|
11672
|
+
borderless,
|
|
11673
|
+
borderOnHover,
|
|
11674
|
+
fullWidth,
|
|
11675
|
+
visuallyDisabled,
|
|
11676
|
+
isHovered,
|
|
11677
|
+
compound,
|
|
11678
|
+
multiline,
|
|
11679
|
+
showProposal,
|
|
11680
|
+
inputStylePalette
|
|
11681
|
+
});
|
|
11445
11682
|
const fieldStyles = {
|
|
11446
|
-
container:
|
|
11447
|
-
|
|
11448
|
-
display: "df",
|
|
11449
|
-
flexDirection: "fdc",
|
|
11450
|
-
width: "w100",
|
|
11451
|
-
maxWidth: ["maxw_var", {
|
|
11452
|
-
"--maxWidth": maybeCssVar17(fieldMaxWidth)
|
|
11453
|
-
}],
|
|
11454
|
-
position: "relative",
|
|
11455
|
-
...labelStyle === "left" ? {
|
|
11456
|
-
maxWidth: "maxw100",
|
|
11457
|
-
flexDirection: "fdr",
|
|
11458
|
-
gap: "g_2",
|
|
11459
|
-
justifyContent: "jcsb",
|
|
11460
|
-
alignItems: "aic"
|
|
11461
|
-
} : {}
|
|
11462
|
-
}
|
|
11463
|
-
},
|
|
11464
|
-
inputWrapper: {
|
|
11465
|
-
...{
|
|
11466
|
-
...__typography4[typeScale] ?? {},
|
|
11467
|
-
display: "df",
|
|
11468
|
-
alignItems: "aic",
|
|
11469
|
-
borderRadius: "br8",
|
|
11470
|
-
paddingLeft: ["px_var", {
|
|
11471
|
-
"--paddingLeft": `${textFieldBasePadding}px`
|
|
11472
|
-
}],
|
|
11473
|
-
paddingRight: ["px_var", {
|
|
11474
|
-
"--paddingRight": `${textFieldBasePadding}px`
|
|
11475
|
-
}],
|
|
11476
|
-
width: "w100",
|
|
11477
|
-
backgroundColor: ["bgColor_var", {
|
|
11478
|
-
"--backgroundColor": maybeCssVar17(bgColor)
|
|
11479
|
-
}],
|
|
11480
|
-
color: ["color_var", {
|
|
11481
|
-
"--color": "var(--b-on-surface)"
|
|
11482
|
-
}],
|
|
11483
|
-
...labelStyle === "left" ? {
|
|
11484
|
-
width: ["w_var", {
|
|
11485
|
-
"--width": maybeCssVar17(__maybeInc10(labelLeftFieldWidth))
|
|
11486
|
-
}]
|
|
11487
|
-
} : {}
|
|
11488
|
-
},
|
|
11489
|
-
// When borderless then perceived vertical alignments are misaligned. As there is no longer a border, then the field looks oddly indented.
|
|
11490
|
-
// This typically happens in tables when a column has a mix of static text (i.e. "roll up" rows and table headers) and input fields.
|
|
11491
|
-
// To remedy this perceived misalignment then we increase the width by the horizontal padding applied (16px), and set a negative margin left margin to re-center the field.
|
|
11492
|
-
// Note: Do not modify width and position of 'compound' fields.
|
|
11493
|
-
...borderless && !compound ? {
|
|
11494
|
-
borderColor: "bcTransparent",
|
|
11495
|
-
width: "w_calc_100_16px",
|
|
11496
|
-
marginLeft: "ml_neg1"
|
|
11497
|
-
} : {
|
|
11498
|
-
borderColor: ["bc_var", {
|
|
11499
|
-
"--borderColor": "var(--b-field-border-default)"
|
|
11500
|
-
}]
|
|
11501
|
-
},
|
|
11502
|
-
// Do not add borders to compound fields. A compound field is responsible for drawing its own borders
|
|
11503
|
-
...!compound ? {
|
|
11504
|
-
borderStyle: "bss",
|
|
11505
|
-
borderWidth: "bw1"
|
|
11506
|
-
} : {},
|
|
11507
|
-
...borderOnHover && {
|
|
11508
|
-
borderRadius: "br4",
|
|
11509
|
-
borderStyle: "bss",
|
|
11510
|
-
borderWidth: "bw1",
|
|
11511
|
-
borderColor: "bcTransparent",
|
|
11512
|
-
transition: "tsn_border_color_200ms"
|
|
11513
|
-
},
|
|
11514
|
-
...borderOnHover && {
|
|
11515
|
-
...isHovered ? {
|
|
11516
|
-
backgroundColor: ["bgColor_var", {
|
|
11517
|
-
"--backgroundColor": maybeCssVar17(hoverBgColor)
|
|
11518
|
-
}],
|
|
11519
|
-
borderStyle: "bss",
|
|
11520
|
-
borderWidth: "bw1",
|
|
11521
|
-
borderColor: "bcBlue300"
|
|
11522
|
-
} : {}
|
|
11523
|
-
},
|
|
11524
|
-
// When multiline is true, then we want to allow the field to grow to the height of the content, but not shrink below the minHeight
|
|
11525
|
-
// Otherwise, set fixed heights values accordingly.
|
|
11526
|
-
...multiline ? {
|
|
11527
|
-
minHeight: ["mh_var", {
|
|
11528
|
-
"--minHeight": `${fieldHeight - maybeSmaller}px`
|
|
11529
|
-
}],
|
|
11530
|
-
...compact ? {
|
|
11531
|
-
minHeight: ["mh_var", {
|
|
11532
|
-
"--minHeight": `${compactFieldHeight - maybeSmaller}px`
|
|
11533
|
-
}]
|
|
11534
|
-
} : {}
|
|
11535
|
-
} : {
|
|
11536
|
-
height: ["h_var", {
|
|
11537
|
-
"--height": `${fieldHeight - maybeSmaller}px`
|
|
11538
|
-
}],
|
|
11539
|
-
...compact ? {
|
|
11540
|
-
height: ["h_var", {
|
|
11541
|
-
"--height": `${compactFieldHeight - maybeSmaller}px`
|
|
11542
|
-
}]
|
|
11543
|
-
} : {}
|
|
11544
|
-
}
|
|
11545
|
-
},
|
|
11683
|
+
container: fieldChrome.container,
|
|
11684
|
+
inputWrapper: fieldChrome.control,
|
|
11546
11685
|
// Border-hover-on-row styling is handled by Row.css.ts (imported above as a side-effect)
|
|
11547
|
-
inputWrapperReadOnly:
|
|
11548
|
-
...{
|
|
11549
|
-
...__typography4[typeScale] ?? {},
|
|
11550
|
-
display: "df",
|
|
11551
|
-
alignItems: "aic",
|
|
11552
|
-
width: "w100",
|
|
11553
|
-
color: ["color_var", {
|
|
11554
|
-
"--color": "var(--b-on-surface)"
|
|
11555
|
-
}],
|
|
11556
|
-
...labelStyle === "left" ? {
|
|
11557
|
-
width: ["w_var", {
|
|
11558
|
-
"--width": maybeCssVar17(__maybeInc10(labelLeftFieldWidth))
|
|
11559
|
-
}]
|
|
11560
|
-
} : {}
|
|
11561
|
-
},
|
|
11562
|
-
// If we are hiding the label, then we are typically in a table. Keep the `mh` in this case to ensure editable and non-editable fields in a single table row line up properly
|
|
11563
|
-
...labelStyle === "hidden" && {
|
|
11564
|
-
minHeight: ["mh_var", {
|
|
11565
|
-
"--minHeight": `${fieldHeight - maybeSmaller}px`
|
|
11566
|
-
}],
|
|
11567
|
-
...compact ? {
|
|
11568
|
-
minHeight: ["mh_var", {
|
|
11569
|
-
"--minHeight": `${compactFieldHeight - maybeSmaller}px`
|
|
11570
|
-
}]
|
|
11571
|
-
} : {}
|
|
11572
|
-
}
|
|
11573
|
-
},
|
|
11686
|
+
inputWrapperReadOnly: fieldChrome.readOnly,
|
|
11574
11687
|
input: {
|
|
11575
11688
|
...{
|
|
11576
11689
|
width: "w100",
|
|
@@ -11606,43 +11719,10 @@ function TextFieldBase(props) {
|
|
|
11606
11719
|
}]
|
|
11607
11720
|
} : {}
|
|
11608
11721
|
},
|
|
11609
|
-
hover:
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
borderColor: ["bc_var", {
|
|
11614
|
-
"--borderColor": "var(--b-field-border-hover)"
|
|
11615
|
-
}]
|
|
11616
|
-
},
|
|
11617
|
-
focus: {
|
|
11618
|
-
borderColor: ["bc_var", {
|
|
11619
|
-
"--borderColor": "var(--b-field-border-focus)"
|
|
11620
|
-
}],
|
|
11621
|
-
backgroundColor: ["bgColor_var", {
|
|
11622
|
-
"--backgroundColor": maybeCssVar17(hoverBgColor)
|
|
11623
|
-
}],
|
|
11624
|
-
...borderOnHover ? {
|
|
11625
|
-
borderColor: ["bc_var", {
|
|
11626
|
-
"--borderColor": "var(--b-field-border-focus)"
|
|
11627
|
-
}]
|
|
11628
|
-
} : {}
|
|
11629
|
-
},
|
|
11630
|
-
disabled: visuallyDisabled ? {
|
|
11631
|
-
cursor: "cur_not_allowed",
|
|
11632
|
-
color: ["color_var", {
|
|
11633
|
-
"--color": "var(--b-field-text-disabled)"
|
|
11634
|
-
}],
|
|
11635
|
-
backgroundColor: ["bgColor_var", {
|
|
11636
|
-
"--backgroundColor": maybeCssVar17(disabledBgColor)
|
|
11637
|
-
}]
|
|
11638
|
-
} : {
|
|
11639
|
-
cursor: "cur_not_allowed"
|
|
11640
|
-
},
|
|
11641
|
-
error: {
|
|
11642
|
-
borderColor: ["bc_var", {
|
|
11643
|
-
"--borderColor": "var(--b-field-border-error)"
|
|
11644
|
-
}]
|
|
11645
|
-
}
|
|
11722
|
+
hover: fieldChrome.hover,
|
|
11723
|
+
focus: fieldChrome.focus,
|
|
11724
|
+
disabled: fieldChrome.disabled,
|
|
11725
|
+
error: fieldChrome.error
|
|
11646
11726
|
};
|
|
11647
11727
|
function onDomChange(e) {
|
|
11648
11728
|
maybeCall(onUserEdit);
|
|
@@ -11829,37 +11909,6 @@ function TextFieldBase(props) {
|
|
|
11829
11909
|
] })
|
|
11830
11910
|
] });
|
|
11831
11911
|
}
|
|
11832
|
-
function OriginalValue(props) {
|
|
11833
|
-
const {
|
|
11834
|
-
originalValue,
|
|
11835
|
-
...others
|
|
11836
|
-
} = props;
|
|
11837
|
-
return /* @__PURE__ */ jsx39("div", { ...trussProps24({
|
|
11838
|
-
color: ["color_var", {
|
|
11839
|
-
"--color": "var(--b-text-helper)"
|
|
11840
|
-
}],
|
|
11841
|
-
fontWeight: "fw4",
|
|
11842
|
-
fontSize: "fz_12px",
|
|
11843
|
-
lineHeight: "lh_16px",
|
|
11844
|
-
marginTop: "mt_4px",
|
|
11845
|
-
textDecoration: "tdlt"
|
|
11846
|
-
}), ...others, children: originalValue });
|
|
11847
|
-
}
|
|
11848
|
-
function getInputStylePalette(inputStylePalette) {
|
|
11849
|
-
switch (inputStylePalette) {
|
|
11850
|
-
case "success":
|
|
11851
|
-
return ["rgba(236, 253, 245, 1)" /* Green50 */, "rgba(209, 250, 229, 1)" /* Green100 */, "rgba(236, 253, 245, 1)" /* Green50 */];
|
|
11852
|
-
case "caution":
|
|
11853
|
-
return ["rgba(254, 252, 232, 1)" /* Yellow50 */, "rgba(254, 249, 195, 1)" /* Yellow100 */, "rgba(254, 252, 232, 1)" /* Yellow50 */];
|
|
11854
|
-
case "warning":
|
|
11855
|
-
return ["rgba(254, 242, 242, 1)" /* Red50 */, "rgba(254, 226, 226, 1)" /* Red100 */, "rgba(254, 242, 242, 1)" /* Red50 */];
|
|
11856
|
-
case "info":
|
|
11857
|
-
return ["rgba(239, 246, 255, 1)" /* Blue50 */, "rgba(219, 234, 254, 1)" /* Blue100 */, "rgba(239, 246, 255, 1)" /* Blue50 */];
|
|
11858
|
-
default:
|
|
11859
|
-
return ["rgba(255, 255, 255, 1)" /* White */, "rgba(247, 245, 245, 1)" /* Gray100 */, "rgba(247, 245, 245, 1)" /* Gray100 */];
|
|
11860
|
-
}
|
|
11861
|
-
}
|
|
11862
|
-
var textFieldBasePadding = increment(1);
|
|
11863
11912
|
var textFieldBaseMultilineTopPadding = 11;
|
|
11864
11913
|
|
|
11865
11914
|
// src/inputs/internal/MenuSearchField.tsx
|
|
@@ -12705,6 +12754,16 @@ var iconStyles = {
|
|
|
12705
12754
|
// src/components/internal/Popover.tsx
|
|
12706
12755
|
import "react";
|
|
12707
12756
|
import { DismissButton, OverlayContainer, useOverlay } from "react-aria";
|
|
12757
|
+
|
|
12758
|
+
// src/components/internal/shouldDismissOverlay.ts
|
|
12759
|
+
function shouldDismissOverlay(el, trigger) {
|
|
12760
|
+
if (el.closest(".tribute-container") || el.closest("[role='alert']")) return false;
|
|
12761
|
+
const dialog = el.closest("[role='dialog']");
|
|
12762
|
+
if (dialog && !dialog.contains(trigger)) return false;
|
|
12763
|
+
return true;
|
|
12764
|
+
}
|
|
12765
|
+
|
|
12766
|
+
// src/components/internal/Popover.tsx
|
|
12708
12767
|
import { jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
12709
12768
|
function Popover(props) {
|
|
12710
12769
|
const { triggerRef, popoverRef, positionProps, children, onClose, isOpen: isOpen2, ...others } = props;
|
|
@@ -12715,12 +12774,8 @@ function Popover(props) {
|
|
|
12715
12774
|
isOpen: isOpen2,
|
|
12716
12775
|
isDismissable: true,
|
|
12717
12776
|
shouldCloseOnInteractOutside: (e) => {
|
|
12718
|
-
if (triggerRef.current?.contains(e))
|
|
12719
|
-
|
|
12720
|
-
}
|
|
12721
|
-
const dialog = e.closest("[role='dialog']");
|
|
12722
|
-
const isDialogOnTop = !!dialog && !dialog.contains(triggerRef.current);
|
|
12723
|
-
return !(e.closest(".tribute-container") || isDialogOnTop || e.closest("[role='alert']"));
|
|
12777
|
+
if (triggerRef.current?.contains(e)) return true;
|
|
12778
|
+
return shouldDismissOverlay(e, triggerRef.current);
|
|
12724
12779
|
},
|
|
12725
12780
|
...others
|
|
12726
12781
|
},
|
|
@@ -17433,7 +17488,8 @@ function ConfirmCloseModal(props) {
|
|
|
17433
17488
|
title = "Are you sure you want to leave?",
|
|
17434
17489
|
message = "Any changes you've made so far will be lost.",
|
|
17435
17490
|
discardText = "Discard Changes",
|
|
17436
|
-
continueText = "Continue Editing"
|
|
17491
|
+
continueText = "Continue Editing",
|
|
17492
|
+
isDestructive = false
|
|
17437
17493
|
} = props;
|
|
17438
17494
|
const { modalState } = useBeamContext();
|
|
17439
17495
|
function closeModal() {
|
|
@@ -17458,6 +17514,7 @@ function ConfirmCloseModal(props) {
|
|
|
17458
17514
|
Button,
|
|
17459
17515
|
{
|
|
17460
17516
|
label: continueText,
|
|
17517
|
+
variant: isDestructive ? "danger" : "primary",
|
|
17461
17518
|
onClick: () => {
|
|
17462
17519
|
onContinue?.();
|
|
17463
17520
|
closeModal();
|
|
@@ -19780,9 +19837,7 @@ function ComboBoxInput(props) {
|
|
|
19780
19837
|
inputWrapRef,
|
|
19781
19838
|
value: inputProps.value
|
|
19782
19839
|
});
|
|
19783
|
-
return /* @__PURE__ */ jsx116(TextFieldBase, { ...otherProps, ...multilineProps, unfocusedPlaceholder: showChipSelection && /* @__PURE__ */ jsx116(Chips, { compact: otherProps.compact, values: chipLabels, wrap: allowWrap }), inputRef, inputWrapRef, errorMsg, xss: otherProps.labelStyle
|
|
19784
|
-
fontWeight: "fw5"
|
|
19785
|
-
} : void 0, startAdornment: showNumSelection && /* @__PURE__ */ jsx116(Tooltip, { title: /* @__PURE__ */ jsx116(SelectedOptionBullets, { labels: chipLabels }), children: /* @__PURE__ */ jsx116(CountBadge, { count: selectedChipCount, "data-testid": "selectedOptionsCount" }) }) || showFieldDecoration && fieldDecoration(selectedOptions[0]), endAdornment: !inputProps.readOnly && /* @__PURE__ */ jsx116("button", { ...buttonProps, disabled: inputProps.disabled, ref: buttonRef, ...trussProps75({
|
|
19840
|
+
return /* @__PURE__ */ jsx116(TextFieldBase, { ...otherProps, ...multilineProps, unfocusedPlaceholder: showChipSelection && /* @__PURE__ */ jsx116(Chips, { compact: otherProps.compact, values: chipLabels, wrap: allowWrap }), inputRef, inputWrapRef, errorMsg, xss: selectedValueCss(otherProps.labelStyle, inputProps.readOnly), startAdornment: showNumSelection && /* @__PURE__ */ jsx116(Tooltip, { title: /* @__PURE__ */ jsx116(SelectedOptionBullets, { labels: chipLabels }), children: /* @__PURE__ */ jsx116(CountBadge, { count: selectedChipCount, "data-testid": "selectedOptionsCount" }) }) || showFieldDecoration && fieldDecoration(selectedOptions[0]), endAdornment: !inputProps.readOnly && /* @__PURE__ */ jsx116("button", { ...buttonProps, disabled: inputProps.disabled, ref: buttonRef, ...trussProps75({
|
|
19786
19841
|
...{
|
|
19787
19842
|
borderRadius: "br4",
|
|
19788
19843
|
outline: "ol_0",
|
|
@@ -31430,7 +31485,7 @@ import { useEffect as useEffect41, useRef as useRef77 } from "react";
|
|
|
31430
31485
|
import { useBlocker } from "react-router-dom";
|
|
31431
31486
|
import { jsx as jsx255 } from "react/jsx-runtime";
|
|
31432
31487
|
function useUnsavedChangesGuard(options) {
|
|
31433
|
-
const { isDirty, allowNavigation, onCancel } = options;
|
|
31488
|
+
const { isDirty, allowNavigation, onCancel, destructiveAction } = options;
|
|
31434
31489
|
const { openModal } = useModal();
|
|
31435
31490
|
const isDirtyRef = useRef77(isDirty);
|
|
31436
31491
|
isDirtyRef.current = isDirty;
|
|
@@ -31467,8 +31522,39 @@ function useUnsavedChangesGuard(options) {
|
|
|
31467
31522
|
content: /* @__PURE__ */ jsx255(ConfirmCloseModal, { onClose: () => confirmCancel(e) })
|
|
31468
31523
|
});
|
|
31469
31524
|
};
|
|
31525
|
+
const onDestructiveActionClick = destructiveAction ? (e) => {
|
|
31526
|
+
const {
|
|
31527
|
+
label = "Remove",
|
|
31528
|
+
confirmTitle = "Are you sure?",
|
|
31529
|
+
confirmMessage = "This can't be undone.",
|
|
31530
|
+
onConfirm
|
|
31531
|
+
} = destructiveAction;
|
|
31532
|
+
openModal({
|
|
31533
|
+
allowClosing: false,
|
|
31534
|
+
content: /* @__PURE__ */ jsx255(
|
|
31535
|
+
ConfirmCloseModal,
|
|
31536
|
+
{
|
|
31537
|
+
title: confirmTitle,
|
|
31538
|
+
message: confirmMessage,
|
|
31539
|
+
discardText: "Cancel",
|
|
31540
|
+
onClose: () => {
|
|
31541
|
+
},
|
|
31542
|
+
continueText: label,
|
|
31543
|
+
isDestructive: true,
|
|
31544
|
+
onContinue: async () => {
|
|
31545
|
+
allowCancelNavigationRef.current = true;
|
|
31546
|
+
try {
|
|
31547
|
+
await onConfirm(e);
|
|
31548
|
+
} finally {
|
|
31549
|
+
allowCancelNavigationRef.current = false;
|
|
31550
|
+
}
|
|
31551
|
+
}
|
|
31552
|
+
}
|
|
31553
|
+
)
|
|
31554
|
+
});
|
|
31555
|
+
} : void 0;
|
|
31470
31556
|
const navigationBlocker = blocker.state === "blocked" ? { proceed: () => blocker.proceed?.(), cancelNavigation: () => blocker.reset?.() } : void 0;
|
|
31471
|
-
return { onCancelClick, navigationBlocker };
|
|
31557
|
+
return { onCancelClick, onDestructiveActionClick, navigationBlocker };
|
|
31472
31558
|
}
|
|
31473
31559
|
function UnsavedChangesNavigationModal(props) {
|
|
31474
31560
|
const { proceed, cancelNavigation } = props;
|
|
@@ -31489,6 +31575,7 @@ function WorkflowActions(props) {
|
|
|
31489
31575
|
const {
|
|
31490
31576
|
onCancel,
|
|
31491
31577
|
onSaveAndExit,
|
|
31578
|
+
destructiveAction,
|
|
31492
31579
|
completeLabel,
|
|
31493
31580
|
onComplete,
|
|
31494
31581
|
primaryDisabled,
|
|
@@ -31507,6 +31594,7 @@ function WorkflowActions(props) {
|
|
|
31507
31594
|
/* @__PURE__ */ jsxs137("div", { className: "df aic g_1", children: [
|
|
31508
31595
|
/* @__PURE__ */ jsx256(Button, { label: "Cancel", variant: "quaternary", onClick: onCancel }),
|
|
31509
31596
|
onSaveAndExit && /* @__PURE__ */ jsx256(Button, { label: "Save & Exit", variant: "secondary", onClick: onSaveAndExit }),
|
|
31597
|
+
destructiveAction && /* @__PURE__ */ jsx256(Button, { label: destructiveAction.label ?? "Remove", variant: "danger", onClick: destructiveAction.onConfirm }),
|
|
31510
31598
|
isLastStep ? /* @__PURE__ */ jsx256(Button, { label: completeLabel, variant: primaryVariant, onClick: onComplete, disabled: primaryDisabled }) : /* @__PURE__ */ jsx256(Button, { label: "Continue", variant: primaryVariant, onClick: async () => {
|
|
31511
31599
|
await onContinue?.();
|
|
31512
31600
|
}, disabled: primaryDisabled })
|
|
@@ -31532,6 +31620,7 @@ function WorkflowPageLayout(props) {
|
|
|
31532
31620
|
documentTitleSuffix,
|
|
31533
31621
|
breadcrumbs,
|
|
31534
31622
|
onCancel,
|
|
31623
|
+
destructiveAction,
|
|
31535
31624
|
rightPaneTriggers,
|
|
31536
31625
|
banner: bannerProp,
|
|
31537
31626
|
...actionProps
|
|
@@ -31546,13 +31635,18 @@ function WorkflowPageLayout(props) {
|
|
|
31546
31635
|
} = useBreakpoint();
|
|
31547
31636
|
const {
|
|
31548
31637
|
onCancelClick,
|
|
31638
|
+
onDestructiveActionClick,
|
|
31549
31639
|
navigationBlocker
|
|
31550
31640
|
} = useUnsavedChangesGuard({
|
|
31551
31641
|
isDirty,
|
|
31552
31642
|
allowNavigation,
|
|
31553
|
-
onCancel
|
|
31643
|
+
onCancel,
|
|
31644
|
+
destructiveAction
|
|
31554
31645
|
});
|
|
31555
|
-
const actions = /* @__PURE__ */ jsx257(WorkflowActions, { ...actionProps, aiMode, onCancel: onCancelClick
|
|
31646
|
+
const actions = /* @__PURE__ */ jsx257(WorkflowActions, { ...actionProps, aiMode, onCancel: onCancelClick, destructiveAction: destructiveAction && {
|
|
31647
|
+
...destructiveAction,
|
|
31648
|
+
onConfirm: onDestructiveActionClick
|
|
31649
|
+
} });
|
|
31556
31650
|
const triggers = rightPaneTriggers ?? [];
|
|
31557
31651
|
const pageTriggers = triggers.length > 0 ? /* @__PURE__ */ jsx257(WorkflowPageRightPaneTriggers, { triggers }) : void 0;
|
|
31558
31652
|
const headerMetricsRef = useRef78(null);
|
|
@@ -31670,6 +31764,7 @@ function FocusedFormLayout(props) {
|
|
|
31670
31764
|
completeLabel,
|
|
31671
31765
|
onComplete,
|
|
31672
31766
|
onSaveAndExit,
|
|
31767
|
+
destructiveAction,
|
|
31673
31768
|
primaryDisabled,
|
|
31674
31769
|
isDirty,
|
|
31675
31770
|
allowNavigation,
|
|
@@ -31691,6 +31786,7 @@ function FocusedFormLayout(props) {
|
|
|
31691
31786
|
allowNavigation,
|
|
31692
31787
|
onCancel,
|
|
31693
31788
|
onSaveAndExit,
|
|
31789
|
+
destructiveAction,
|
|
31694
31790
|
completeLabel,
|
|
31695
31791
|
onComplete,
|
|
31696
31792
|
primaryDisabled,
|
|
@@ -31711,6 +31807,7 @@ function StepperLayout(props) {
|
|
|
31711
31807
|
completeLabel,
|
|
31712
31808
|
onComplete,
|
|
31713
31809
|
onSaveAndExit,
|
|
31810
|
+
destructiveAction,
|
|
31714
31811
|
isDirty,
|
|
31715
31812
|
allowNavigation,
|
|
31716
31813
|
aiMode,
|
|
@@ -31748,6 +31845,7 @@ function StepperLayout(props) {
|
|
|
31748
31845
|
},
|
|
31749
31846
|
onCancel,
|
|
31750
31847
|
onSaveAndExit,
|
|
31848
|
+
destructiveAction,
|
|
31751
31849
|
completeLabel,
|
|
31752
31850
|
onComplete,
|
|
31753
31851
|
primaryDisabled: activeStep?.primaryDisabled,
|
|
@@ -32313,6 +32411,7 @@ export {
|
|
|
32313
32411
|
NavbarLayout,
|
|
32314
32412
|
NumberField,
|
|
32315
32413
|
OpenModal,
|
|
32414
|
+
OriginalValue,
|
|
32316
32415
|
PageBanner,
|
|
32317
32416
|
PageHeaderLayout,
|
|
32318
32417
|
Pagination,
|