@homebound/beam 3.0.3 → 3.0.5

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.js CHANGED
@@ -20,8 +20,7 @@ import {
20
20
  } from "./chunk-ZPT2ZR5B.js";
21
21
 
22
22
  // src/Css.ts
23
- import { trussProps } from "@homebound/truss/runtime";
24
- import { RuntimeStyle, useRuntimeStyle } from "@homebound/truss/runtime";
23
+ import { trussProps, useRuntimeStyle as _useRuntimeStyle } from "@homebound/truss/runtime";
25
24
  var CssBuilder = class _CssBuilder {
26
25
  constructor(opts) {
27
26
  this.opts = opts;
@@ -3877,12 +3876,20 @@ var CssBuilder = class _CssBuilder {
3877
3876
  return this;
3878
3877
  }
3879
3878
  const newRules = typeof propOrStyles === "string" ? { [propOrStyles]: value } : propOrStyles;
3879
+ if (typeof propOrStyles !== "string" && newRules.$css) {
3880
+ throw new Error("add() received a Css expression \u2014 use with() to compose Css expressions");
3881
+ }
3880
3882
  const rules = this.selector ? { ...this.rules, [this.selector]: { ...this.rules[this.selector], ...newRules } } : { ...this.rules, ...newRules };
3881
3883
  return this.newCss({ rules });
3882
3884
  }
3883
- /** Inline a partial style hash, skipping any undefined values. */
3884
- addCss(props) {
3885
- return this.add(omitUndefinedValues(props));
3885
+ with(cssProp) {
3886
+ if (!this.enabled) {
3887
+ return this;
3888
+ }
3889
+ const { $css, ...rest } = cssProp;
3890
+ const filtered = omitUndefinedValues(rest);
3891
+ const rules = this.selector ? { ...this.rules, [this.selector]: { ...this.rules[this.selector], ...filtered } } : { ...this.rules, ...filtered };
3892
+ return this.newCss({ rules });
3886
3893
  }
3887
3894
  /** Marker for the build-time transform to append a raw className. */
3888
3895
  className(className) {
@@ -4016,6 +4023,16 @@ var Css = new CssBuilder({
4016
4023
  elseApplied: false,
4017
4024
  runtimeError: void 0
4018
4025
  });
4026
+ var RuntimeCss = new CssBuilder({
4027
+ rules: {},
4028
+ enabled: true,
4029
+ selector: void 0,
4030
+ elseApplied: false,
4031
+ runtimeError: void 0
4032
+ });
4033
+ function useRuntimeStyle(css2) {
4034
+ _useRuntimeStyle(css2);
4035
+ }
4019
4036
  var Breakpoints = /* @__PURE__ */ ((Breakpoints2) => {
4020
4037
  Breakpoints2["print"] = "@media print";
4021
4038
  Breakpoints2["sm"] = "@media screen and (max-width: 599px)";
@@ -4868,7 +4885,7 @@ function Chips(props) {
4868
4885
  whiteSpace: "whiteSpace_normal"
4869
4886
  },
4870
4887
  ...wrap !== false ? {
4871
- flexWrap: "flexWrap_wrap"
4888
+ flexWrap: "fww"
4872
4889
  } : {},
4873
4890
  ...xss
4874
4891
  }), children: values.map((value, i) => {
@@ -11363,7 +11380,7 @@ function ComboBoxInput(props) {
11363
11380
  });
11364
11381
  return /* @__PURE__ */ jsx55(TextFieldBase, { ...otherProps, ...multilineProps, unfocusedPlaceholder: showChipSelection && /* @__PURE__ */ jsx55(Chips, { compact: otherProps.compact, values: chipLabels, wrap: allowWrap }), inputRef, inputWrapRef, errorMsg, contrast, xss: otherProps.labelStyle !== "inline" && !inputProps.readOnly ? {
11365
11382
  fontWeight: "fw5"
11366
- } : {}, startAdornment: showNumSelection && /* @__PURE__ */ jsx55(Tooltip, { title: /* @__PURE__ */ jsx55(SelectedOptionBullets, { labels: chipLabels }), children: /* @__PURE__ */ jsx55(CountBadge, { count: isTree ? selectedOptionsLabels?.length ?? 0 : state.selectionManager.selectedKeys.size, "data-testid": "selectedOptionsCount" }) }) || showFieldDecoration && fieldDecoration(selectedOptions[0]), endAdornment: !inputProps.readOnly && /* @__PURE__ */ jsx55("button", { ...buttonProps, disabled: inputProps.disabled, ref: buttonRef, ...trussProps38({
11383
+ } : void 0, startAdornment: showNumSelection && /* @__PURE__ */ jsx55(Tooltip, { title: /* @__PURE__ */ jsx55(SelectedOptionBullets, { labels: chipLabels }), children: /* @__PURE__ */ jsx55(CountBadge, { count: isTree ? selectedOptionsLabels?.length ?? 0 : state.selectionManager.selectedKeys.size, "data-testid": "selectedOptionsCount" }) }) || showFieldDecoration && fieldDecoration(selectedOptions[0]), endAdornment: !inputProps.readOnly && /* @__PURE__ */ jsx55("button", { ...buttonProps, disabled: inputProps.disabled, ref: buttonRef, ...trussProps38({
11367
11384
  ...{
11368
11385
  borderRadius: "br4",
11369
11386
  outline: "outline0",
@@ -12574,6 +12591,7 @@ function NumberField(props) {
12574
12591
  wip: false
12575
12592
  });
12576
12593
  const lastSentRef = useRef27(void 0);
12594
+ const focusValueRef = useRef27(void 0);
12577
12595
  const [, forceRender] = useState23(0);
12578
12596
  const propValue = value === void 0 ? Number.NaN : value / factor;
12579
12597
  if (valueRef.current.wip && !Object.is(valueRef.current.value, propValue)) {
@@ -12589,7 +12607,7 @@ function NumberField(props) {
12589
12607
  // // This is called on blur with the final/committed value.
12590
12608
  onChange: (value2) => {
12591
12609
  const formatted = formatValue(value2, factor, numFractionDigits, numIntegerDigits, positiveOnly);
12592
- if (formatted !== lastSentRef.current) return;
12610
+ if (formatted !== lastSentRef.current && formatted === focusValueRef.current) return;
12593
12611
  onChange(formatted);
12594
12612
  },
12595
12613
  onFocus: () => {
@@ -12598,6 +12616,7 @@ function NumberField(props) {
12598
12616
  value: value === void 0 ? Number.NaN : value / factor
12599
12617
  };
12600
12618
  lastSentRef.current = value;
12619
+ focusValueRef.current = value;
12601
12620
  },
12602
12621
  onBlur: () => {
12603
12622
  valueRef.current = {
@@ -21523,7 +21542,7 @@ export {
21523
21542
  RightPaneProvider,
21524
21543
  RightSidebar,
21525
21544
  Row,
21526
- RuntimeStyle,
21545
+ RuntimeCss,
21527
21546
  ScrollShadows,
21528
21547
  ScrollableContent,
21529
21548
  ScrollableParent,