@jsenv/navi 0.16.47 → 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,
@@ -23118,20 +23139,22 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
23118
23139
  .navi_group {
23119
23140
  --border-width: 1px;
23120
23141
 
23121
- > * {
23122
- position: relative;
23123
- }
23124
23142
  > *:hover,
23125
23143
  > *[data-hover] {
23144
+ position: relative;
23126
23145
  z-index: 1;
23127
23146
  }
23128
23147
  > *:focus-visible,
23129
23148
  > *[data-focus-visible] {
23149
+ position: relative;
23130
23150
  z-index: 1;
23131
23151
  }
23132
23152
 
23133
- /* Horizontal (default): Cumulative positioning for border overlap */
23153
+ /* Horizontal (default): Cumulative margin for border overlap */
23134
23154
  &:not([data-vertical]) {
23155
+ > *:not(:first-child) {
23156
+ margin-left: calc(var(--border-width) * -1);
23157
+ }
23135
23158
  > *:first-child:not(:only-child) {
23136
23159
  border-top-right-radius: 0 !important;
23137
23160
  border-bottom-right-radius: 0 !important;
@@ -23164,8 +23187,11 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
23164
23187
  }
23165
23188
  }
23166
23189
 
23167
- /* Vertical: Cumulative positioning for border overlap */
23190
+ /* Vertical: Cumulative margin for border overlap */
23168
23191
  &[data-vertical] {
23192
+ > *:not(:first-child) {
23193
+ margin-top: calc(var(--border-width) * -1);
23194
+ }
23169
23195
  > *:first-child:not(:only-child) {
23170
23196
  border-bottom-right-radius: 0 !important;
23171
23197
  border-bottom-left-radius: 0 !important;
@@ -23206,55 +23232,19 @@ const Group = ({
23206
23232
  vertical = row,
23207
23233
  ...props
23208
23234
  }) => {
23209
- const groupRef = useRef(null);
23210
23235
  if (typeof borderWidth === "string") {
23211
23236
  borderWidth = parseFloat(borderWidth);
23212
23237
  }
23213
23238
  const borderWidthCssValue = typeof borderWidth === "number" ? `${borderWidth}px` : borderWidth;
23214
- useLayoutEffect(() => {
23215
- const group = groupRef.current;
23216
- if (!group) {
23217
- return;
23218
- }
23219
- const {
23220
- children
23221
- } = group;
23222
- if (children.length === 0) {
23223
- return;
23224
- }
23225
- let i = 0;
23226
- while (i < children.length) {
23227
- const child = children[i];
23228
- if (i === 0) {
23229
- // First child stays in place
23230
- if (vertical) {
23231
- child.style.top = "";
23232
- } else {
23233
- child.style.left = "";
23234
- }
23235
- } else {
23236
- // Subsequent children get cumulative positioning
23237
- const offset = i * borderWidth * -1;
23238
- if (vertical) {
23239
- child.style.top = borderWidth ? `${offset}px` : "";
23240
- child.style.left = "";
23241
- } else {
23242
- child.style.left = borderWidth ? `${offset}px` : "";
23243
- child.style.top = "";
23244
- }
23245
- }
23246
- i++;
23247
- }
23248
- }, [children, borderWidth, vertical]);
23249
23239
  return jsx(Box, {
23250
- ref: groupRef,
23251
23240
  baseClassName: "navi_group",
23252
23241
  "data-vertical": vertical ? "" : undefined,
23253
23242
  row: row,
23243
+ ...props,
23254
23244
  style: {
23255
- "--border-width": borderWidthCssValue
23245
+ "--border-width": borderWidthCssValue,
23246
+ ...props.style
23256
23247
  },
23257
- ...props,
23258
23248
  children: children
23259
23249
  });
23260
23250
  };