@jsenv/navi 0.16.48 → 0.16.49

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.
@@ -6090,6 +6090,7 @@ const Box = props => {
6090
6090
  // so this prop is useful only when transition is enabled from "outside" (via CSS)
6091
6091
  preventInitialTransition,
6092
6092
  children,
6093
+ separator,
6093
6094
  ...rest
6094
6095
  } = props;
6095
6096
  const defaultRef = useRef();
@@ -6131,6 +6132,10 @@ const Box = props => {
6131
6132
  } else {
6132
6133
  boxFlow = defaultDisplay;
6133
6134
  }
6135
+ const remainingPropKeySet = new Set(Object.keys(rest));
6136
+ // some props not destructured but that are neither
6137
+ // style props, nor should be forwarded to the child
6138
+ remainingPropKeySet.delete("ref");
6134
6139
  const innerClassName = withPropsClassName(baseClassName, className);
6135
6140
  const selfForwardedProps = {};
6136
6141
  const childForwardedProps = {};
@@ -6320,13 +6325,7 @@ const Box = props => {
6320
6325
  assignStyle(value, key, styleContext, boxStyles, "baseStyle");
6321
6326
  }
6322
6327
  }
6323
- const remainingPropKeyArray = Object.keys(rest);
6324
- for (const propName of remainingPropKeyArray) {
6325
- if (propName === "ref") {
6326
- // some props not destructured but that are neither
6327
- // style props, nor should be forwarded to the child
6328
- continue;
6329
- }
6328
+ for (const propName of remainingPropKeySet) {
6330
6329
  const propValue = rest[propName];
6331
6330
  assignStyle(propValue, propName, styleContext, boxStyles, "prop");
6332
6331
  }
@@ -6395,6 +6394,28 @@ const Box = props => {
6395
6394
  } else {
6396
6395
  innerChildren = children;
6397
6396
  }
6397
+ if (separator) {
6398
+ if (Array.isArray(innerChildren)) {
6399
+ const childCount = innerChildren.length;
6400
+ if (childCount > 1) {
6401
+ const childrenWithSeparators = [];
6402
+ let i = 0;
6403
+ while (true) {
6404
+ const child = innerChildren[i];
6405
+ childrenWithSeparators.push(child);
6406
+ i++;
6407
+ if (i === childCount) {
6408
+ break;
6409
+ }
6410
+ // Support function separators that receive separator index
6411
+ const separatorElement = typeof separator === "function" ? separator(i - 1) // i-1 because i was incremented after pushing child
6412
+ : separator;
6413
+ childrenWithSeparators.push(separatorElement);
6414
+ }
6415
+ innerChildren = childrenWithSeparators;
6416
+ }
6417
+ }
6418
+ }
6398
6419
  return jsx(TagName, {
6399
6420
  ref: ref,
6400
6421
  className: innerClassName,