@jsenv/navi 0.26.2 → 0.26.3

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.
@@ -6650,14 +6650,7 @@ const CONTENT_PROPS = {
6650
6650
  };
6651
6651
  },
6652
6652
  spacing: (value, { boxFlow }) => {
6653
- if (
6654
- boxFlow === "flex-x" ||
6655
- boxFlow === "flex-y" ||
6656
- boxFlow === "inline-flex-x" ||
6657
- boxFlow === "inline-flex-y" ||
6658
- boxFlow === "grid" ||
6659
- boxFlow === "inline-grid"
6660
- ) {
6653
+ if (isSpacingHandledByFlow(boxFlow)) {
6661
6654
  return {
6662
6655
  gap: resolveSpacingSize(value, "gap"),
6663
6656
  };
@@ -6691,6 +6684,18 @@ const CONTENT_PROPS = {
6691
6684
  return undefined;
6692
6685
  },
6693
6686
  };
6687
+ const flowSpacingHandlerSet = new Set([
6688
+ "flex-x",
6689
+ "flex-y",
6690
+ "inline-flex-x",
6691
+ "inline-flex-y",
6692
+ "grid",
6693
+ "inline-grid",
6694
+ ]);
6695
+ const isSpacingHandledByFlow = (boxFlow) => {
6696
+ return flowSpacingHandlerSet.has(boxFlow);
6697
+ };
6698
+
6694
6699
  const All_PROPS = {
6695
6700
  ...FLOW_PROPS,
6696
6701
  ...OUTER_SPACING_PROPS,
@@ -8286,6 +8291,8 @@ const Box = props => {
8286
8291
  const ref = props.ref || defaultRef;
8287
8292
  const TagName = as;
8288
8293
  const defaultDisplay = getDefaultDisplay(TagName);
8294
+ // Read the parent flow early so we can use it when display="inherit" is requested.
8295
+ const parentBoxFlow = useContext(BoxFlowContext);
8289
8296
  let {
8290
8297
  inline,
8291
8298
  block,
@@ -8353,6 +8360,12 @@ const Box = props => {
8353
8360
  } else {
8354
8361
  boxFlow = defaultDisplay;
8355
8362
  }
8363
+ // When display="inherit" is passed, adopt the parent's flow instead of computing one.
8364
+ // This lets a child Box mirror its parent's flex/grid/block layout without repeating
8365
+ // the same layout props, and is used e.g. by Button's inner content element.
8366
+ if (rest.display === "inherit") {
8367
+ boxFlow = parentBoxFlow;
8368
+ }
8356
8369
  const boxFlowIsDefault = boxFlow === defaultDisplay;
8357
8370
  const remainingPropKeySet = new Set(Object.keys(rest));
8358
8371
  // some props not destructured but that are neither
@@ -8362,7 +8375,6 @@ const Box = props => {
8362
8375
  const selfForwardedProps = {};
8363
8376
  const childForwardedProps = {};
8364
8377
  {
8365
- const parentBoxFlow = useContext(BoxFlowContext);
8366
8378
  const styleDeps = [
8367
8379
  // Layout and alignment props
8368
8380
  parentBoxFlow, boxFlow,
@@ -21177,6 +21189,7 @@ const TextUI = props => {
21177
21189
  childrenOutsideFlow,
21178
21190
  ...rest
21179
21191
  } = props;
21192
+ const parentBoxFlow = useContext(BoxFlowContext);
21180
21193
  const defaultSpace = preventSpaceUnderlines ? FAKE_SPACE : REGULAR_SPACE;
21181
21194
  const resolvedSpacing = spacing ?? defaultSpace;
21182
21195
  const boxProps = {
@@ -21186,7 +21199,7 @@ const TextUI = props => {
21186
21199
  ref,
21187
21200
  "baseClassName": withPropsClassName("navi_text", rest.baseClassName)
21188
21201
  };
21189
- const shouldPreserveSpacing = rest.as === "pre" || rest.flex || rest.grid;
21202
+ const shouldPreserveSpacing = rest.as === "pre" || rest.flex || rest.grid || isSpacingHandledByFlow(parentBoxFlow);
21190
21203
  if (shouldPreserveSpacing) {
21191
21204
  boxProps.spacing = resolvedSpacing;
21192
21205
  } else {
@@ -22842,6 +22855,7 @@ const ButtonUI = props => {
22842
22855
  const renderButtonContent = buttonProps => {
22843
22856
  return jsxs(Text, {
22844
22857
  ...buttonProps,
22858
+ display: "inherit",
22845
22859
  spacing: spacing,
22846
22860
  className: "navi_button_content",
22847
22861
  children: [children, jsx(ButtonShadow, {})]