@homebound/beam 3.31.2 → 3.33.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 CHANGED
@@ -12102,7 +12102,8 @@ function TreeOption(props) {
12102
12102
  const {
12103
12103
  item,
12104
12104
  state,
12105
- allowCollapsing = true
12105
+ allowCollapsing = true,
12106
+ disabledReason
12106
12107
  } = props;
12107
12108
  const leveledOption = item.value;
12108
12109
  if (!leveledOption) return null;
@@ -12159,43 +12160,47 @@ function TreeOption(props) {
12159
12160
  }]
12160
12161
  }
12161
12162
  };
12162
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("li", { ...hoverProps, onClick: (e) => {
12163
- if (!isGroup) return;
12164
- e.preventDefault();
12165
- e.stopPropagation();
12166
- toggleCollapsed();
12167
- }, ...(0, import_runtime37.trussProps)({
12168
- ...{
12169
- display: "df",
12170
- alignItems: "aic",
12171
- justifyContent: "jcsb",
12172
- gap: "gap1",
12173
- paddingLeft: ["pl_var", {
12174
- "--paddingLeft": `${16 + level * 8}px`
12175
- }],
12176
- minHeight: "mh_42px",
12177
- outline: "outline0",
12178
- cursor: "cursorPointer",
12179
- fontWeight: "fw4",
12180
- fontSize: "fz_14px",
12181
- lineHeight: "lh_20px"
12182
- },
12183
- ...listItemStyles.item,
12184
- ...isHovered && (!isDisabled || isGroup) ? listItemStyles.hover : {},
12185
- ...isFocused && !isGroup ? listItemStyles.focus : {},
12186
- ...isDisabled && !isGroup ? listItemStyles.disabled : {}
12187
- }), children: [
12188
- allowCollapsing && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "w_18px fs0 df aic", children: canCollapse && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { onClick: (e) => {
12163
+ return maybeTooltip({
12164
+ title: !isGroup ? disabledReason : void 0,
12165
+ placement: "right",
12166
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("li", { ...hoverProps, onClick: (e) => {
12167
+ if (!isGroup) return;
12189
12168
  e.preventDefault();
12190
12169
  e.stopPropagation();
12191
12170
  toggleCollapsed();
12192
- return false;
12193
- }, className: "br4 h_16px w_16px bgTransparent h_bgGray300", ...tid[`collapseToggle_${item.key}`], children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Icon, { icon: collapsedKeys.includes(item.key) ? "triangleRight" : "triangleDown", inc: 2 }) }) }),
12194
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "df aic gap1 h100 fg1 pt1 pb1 pr2", ref, ...optionProps, "data-label": item.textValue, children: [
12195
- !isGroup && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StyledCheckbox, { isDisabled, isSelected, isIndeterminate, ...tid[item.key.toString()] }),
12196
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "pl1", children: item.rendered })
12171
+ }, ...(0, import_runtime37.trussProps)({
12172
+ ...{
12173
+ display: "df",
12174
+ alignItems: "aic",
12175
+ justifyContent: "jcsb",
12176
+ gap: "gap1",
12177
+ paddingLeft: ["pl_var", {
12178
+ "--paddingLeft": `${16 + level * 8}px`
12179
+ }],
12180
+ minHeight: "mh_42px",
12181
+ outline: "outline0",
12182
+ cursor: "cursorPointer",
12183
+ fontWeight: "fw4",
12184
+ fontSize: "fz_14px",
12185
+ lineHeight: "lh_20px"
12186
+ },
12187
+ ...listItemStyles.item,
12188
+ ...isHovered && (!isDisabled || isGroup) ? listItemStyles.hover : {},
12189
+ ...isFocused && !isGroup ? listItemStyles.focus : {},
12190
+ ...isDisabled && !isGroup ? listItemStyles.disabled : {}
12191
+ }), children: [
12192
+ allowCollapsing && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "w_18px fs0 df aic", children: canCollapse && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { onClick: (e) => {
12193
+ e.preventDefault();
12194
+ e.stopPropagation();
12195
+ toggleCollapsed();
12196
+ return false;
12197
+ }, className: "br4 h_16px w_16px bgTransparent h_bgGray300", ...tid[`collapseToggle_${item.key}`], children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Icon, { icon: collapsedKeys.includes(item.key) ? "triangleRight" : "triangleDown", inc: 2 }) }) }),
12198
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "df aic gap1 h100 fg1 pt1 pb1 pr2", ref, ...optionProps, "data-label": item.textValue, children: [
12199
+ !isGroup && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StyledCheckbox, { isDisabled, isSelected, isIndeterminate, ...tid[item.key.toString()] }),
12200
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "pl1", children: item.rendered })
12201
+ ] })
12197
12202
  ] })
12198
- ] });
12203
+ });
12199
12204
  }
12200
12205
  function hasSelectedChildren(childOption, state, getOptionValue) {
12201
12206
  if (childOption.children && childOption.children.length > 0) {
@@ -12293,7 +12298,8 @@ function VirtualizedOptions(props) {
12293
12298
  {
12294
12299
  item,
12295
12300
  state,
12296
- allowCollapsing
12301
+ allowCollapsing,
12302
+ disabledReason: disabledOptionsWithReasons[item.key]
12297
12303
  },
12298
12304
  item.key
12299
12305
  );
@@ -12874,7 +12880,7 @@ function TreeSelectFieldBase(props) {
12874
12880
  onClose: () => state.toggle(),
12875
12881
  isOpen: state.isOpen,
12876
12882
  minWidth: 320,
12877
- children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ListBox, { ...listBoxProps, positionProps, state, listBoxRef, selectedOptions: fieldState.selectedChipOptions, getOptionLabel, getOptionValue: (o) => valueToKey(getOptionValue(o)), horizontalLayout: labelStyle === "left", loading: fieldState.optionsLoading, allowCollapsing: fieldState.allowCollapsing, isTree: true })
12883
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ListBox, { ...listBoxProps, positionProps, state, listBoxRef, selectedOptions: fieldState.selectedChipOptions, getOptionLabel, getOptionValue: (o) => valueToKey(getOptionValue(o)), horizontalLayout: labelStyle === "left", loading: fieldState.optionsLoading, allowCollapsing: fieldState.allowCollapsing, disabledOptionsWithReasons, isTree: true })
12878
12884
  }
12879
12885
  )
12880
12886
  ] });
@@ -22305,10 +22311,11 @@ function EnvironmentBanner(props) {
22305
22311
  const {
22306
22312
  env,
22307
22313
  impersonating,
22314
+ showProdWarning = false,
22308
22315
  ...others
22309
22316
  } = props;
22310
22317
  const tid = useTestIds(others, "environmentBanner");
22311
- if (!shouldShowEnvironmentBanner(env, impersonating)) {
22318
+ if (!shouldShowEnvironmentBanner(env, impersonating, showProdWarning)) {
22312
22319
  return null;
22313
22320
  }
22314
22321
  const {
@@ -22316,7 +22323,7 @@ function EnvironmentBanner(props) {
22316
22323
  badgeLabel,
22317
22324
  message,
22318
22325
  tooltip
22319
- } = getEnvironmentBannerConfig(env, impersonating);
22326
+ } = getEnvironmentBannerConfig(env, impersonating, showProdWarning);
22320
22327
  const bgColorVar = maybeCssVar(bgColor);
22321
22328
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { ...(0, import_runtime90.trussProps)({
22322
22329
  flexShrink: "fs0",
@@ -22359,7 +22366,7 @@ function EnvironmentBanner(props) {
22359
22366
  ] })
22360
22367
  ] }),
22361
22368
  impersonating != null && /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("span", { className: "df aic gap2 fw6 fz_12px lh_16px white fs0", ...tid.impersonating, children: [
22362
- env !== "prod" && /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("span", { children: [
22369
+ (env !== "prod" || showProdWarning) && /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("span", { children: [
22363
22370
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "dn mdandup_dib", children: "Impersonating \xA0" }),
22364
22371
  impersonating.name
22365
22372
  ] }),
@@ -22368,10 +22375,10 @@ function EnvironmentBanner(props) {
22368
22375
  ] })
22369
22376
  ] });
22370
22377
  }
22371
- function shouldShowEnvironmentBanner(env, impersonating) {
22372
- return env === "dev" || env === "qa" || env === "local-prod" || env === "prod" && isDefined(impersonating);
22378
+ function shouldShowEnvironmentBanner(env, impersonating, showProdWarning) {
22379
+ return env === "dev" || env === "qa" || env === "local-prod" || env === "prod" && (isDefined(impersonating) || showProdWarning);
22373
22380
  }
22374
- function getEnvironmentBannerConfig(env, impersonating) {
22381
+ function getEnvironmentBannerConfig(env, impersonating, showProdWarning) {
22375
22382
  switch (env) {
22376
22383
  case "dev":
22377
22384
  return {
@@ -22387,9 +22394,16 @@ function getEnvironmentBannerConfig(env, impersonating) {
22387
22394
  message: "You are in the QA Environment",
22388
22395
  tooltip: "You are in the QA Environment. Any changes here will not be reflected in live production data."
22389
22396
  };
22390
- // Prod env banner should only be displayed when impersonating
22397
+ // Prod banner shows when impersonating or when `showProdWarning` is set. The prod warning takes precedence:
22398
+ // it reuses the red local-prod fill for "live prod data" urgency, while impersonation (if any) still shows
22399
+ // on the right. Impersonation alone keeps its own prod fill and copy.
22391
22400
  case "prod":
22392
- return {
22401
+ return showProdWarning ? {
22402
+ bgColor: "--b-env-brand-local-prod" /* EnvBrandLocalProd */,
22403
+ badgeLabel: "PROD",
22404
+ message: "You are in the Production Environment",
22405
+ tooltip: "You are in the Production Environment. Any changes here WILL be reflected in live production data."
22406
+ } : {
22393
22407
  bgColor: "--b-env-brand-prod" /* EnvBrandProd */,
22394
22408
  badgeLabel: "PROD",
22395
22409
  message: `You are impersonating ${impersonating?.name}`,
@@ -24612,7 +24626,7 @@ function EnvironmentBannerLayout(props) {
24612
24626
  children
24613
24627
  } = props;
24614
24628
  const tid = useTestIds(props, "environmentBannerLayout");
24615
- const showBanner = environmentBanner != null && shouldShowEnvironmentBanner(environmentBanner.env, environmentBanner.impersonating);
24629
+ const showBanner = environmentBanner != null && shouldShowEnvironmentBanner(environmentBanner.env, environmentBanner.impersonating, environmentBanner.showProdWarning ?? false);
24616
24630
  const bannerHeightPx = showBanner ? environmentBannerSizePx : 0;
24617
24631
  const style = {
24618
24632
  [beamEnvironmentBannerLayoutHeightVar]: `${bannerHeightPx}px`