@jsenv/navi 0.21.4 → 0.21.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.
@@ -18830,10 +18830,6 @@ const css$3 = /* css */`
18830
18830
  .navi_text {
18831
18831
  position: relative;
18832
18832
 
18833
- &[data-has-absolute-child] {
18834
- display: inline-block;
18835
- }
18836
-
18837
18833
  /* There is a chrome specific bug that prevents text-transform: capitalize to be applied in nested DOM structure */
18838
18834
  /* The CSS below ensure capitalize is propagated to the bold clones */
18839
18835
  &[data-capitalize] {
@@ -18865,6 +18861,7 @@ const css$3 = /* css */`
18865
18861
  }
18866
18862
 
18867
18863
  &[data-text-overflow] {
18864
+ min-width: 0;
18868
18865
  flex-wrap: wrap;
18869
18866
  text-overflow: ellipsis;
18870
18867
  overflow: hidden;
@@ -18882,20 +18879,61 @@ const css$3 = /* css */`
18882
18879
  }
18883
18880
  }
18884
18881
  }
18885
- }
18886
18882
 
18887
- .navi_text_skeleton {
18888
- display: inline-block;
18889
- width: 100%;
18890
- height: 1em;
18891
- background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
18892
- background-size: 200% 100%;
18893
- border-radius: 4px;
18883
+ /* When skeleton + overflow ellipsis: skeleton fills available space,
18884
+ no text to clip so disable overflow machinery. */
18885
+ &[data-text-overflow][data-skeleton] {
18886
+ flex-wrap: nowrap;
18887
+ text-overflow: clip;
18888
+ /* overflow:hidden on [data-text-overflow] would clip the absolutely
18889
+ positioned skeleton span — keep it visible */
18890
+ overflow: visible;
18894
18891
 
18895
- &[data-loading] {
18896
- animation: navi_text_skeleton_shimmer 1.2s infinite;
18892
+ .navi_text_overflow_wrapper {
18893
+ display: contents;
18894
+ .navi_text_overflow_text {
18895
+ display: contents;
18896
+
18897
+ max-width: none;
18898
+ text-overflow: clip;
18899
+ overflow: visible;
18900
+ }
18901
+ }
18902
+ }
18903
+
18904
+ &[data-skeleton] {
18905
+ /* Keep layout space — children are hidden, skeleton overlays absolutely */
18906
+ visibility: hidden;
18907
+
18908
+ .navi_text_skeleton {
18909
+ position: absolute;
18910
+ inset: 0;
18911
+ /* top/bottom inset may not perfectly align with text bounds — acceptable */
18912
+ background: linear-gradient(
18913
+ 90deg,
18914
+ #e0e0e0 25%,
18915
+ #f0f0f0 50%,
18916
+ #e0e0e0 75%
18917
+ );
18918
+ background-size: 200% 100%;
18919
+ border-radius: 4px;
18920
+ visibility: visible;
18921
+ }
18922
+
18923
+ &[data-empty] {
18924
+ .navi_text_skeleton {
18925
+ height: 1em;
18926
+ }
18927
+ }
18928
+
18929
+ &[data-loading] {
18930
+ .navi_text_skeleton {
18931
+ animation: navi_text_skeleton_shimmer 1.5s infinite;
18932
+ }
18933
+ }
18897
18934
  }
18898
18935
  }
18936
+
18899
18937
  @keyframes navi_text_skeleton_shimmer {
18900
18938
  0% {
18901
18939
  background-position: 200% 0;
@@ -18905,9 +18943,6 @@ const css$3 = /* css */`
18905
18943
  }
18906
18944
  }
18907
18945
 
18908
- .navi_custom_space {
18909
- }
18910
-
18911
18946
  .navi_text_bold_wrapper {
18912
18947
  position: relative;
18913
18948
  display: inline-block;
@@ -19062,21 +19097,14 @@ const shouldInjectSpacingBetween = (left, right) => {
19062
19097
  const OverflowPinnedElementContext = createContext(null);
19063
19098
  const Text = props => {
19064
19099
  import.meta.css = [css$3, "@jsenv/navi/src/text/text.jsx"];
19065
- const {
19066
- overflowEllipsis,
19067
- loading,
19068
- skeleton,
19069
- ...rest
19070
- } = props;
19071
- if (loading || skeleton) {
19100
+ if (props.loading || props.skeleton) {
19072
19101
  return jsx(TextSkeleton, {
19073
- loading: loading,
19074
- ...rest
19102
+ ...props
19075
19103
  });
19076
19104
  }
19077
- if (overflowEllipsis) {
19105
+ if (props.overflowEllipsis) {
19078
19106
  return jsx(TextOverflow, {
19079
- ...rest
19107
+ ...props
19080
19108
  });
19081
19109
  }
19082
19110
  if (props.overflowPinned) {
@@ -19095,16 +19123,29 @@ const Text = props => {
19095
19123
  };
19096
19124
  const TextSkeleton = ({
19097
19125
  loading,
19126
+ children,
19098
19127
  ...props
19099
19128
  }) => {
19100
- return jsx(Box, {
19129
+ const skeletonSpan = jsx("span", {
19130
+ className: "navi_text_skeleton",
19131
+ "aria-hidden": "true"
19132
+ });
19133
+ // When there are no children we inject an invisible "W" so the element takes
19134
+ // its natural text height (matching current font-size) instead of relying on
19135
+ // min-height which can be off. The W is hidden via CSS visibility:hidden.
19136
+ const hasChildren = children !== null && children !== undefined && children !== false;
19137
+ const innerChildren = hasChildren ? children : jsx("span", {
19138
+ "aria-hidden": "true",
19139
+ children: "W"
19140
+ });
19141
+ return jsx(Text, {
19142
+ "data-skeleton": "",
19143
+ "data-loading": loading ? "" : undefined,
19144
+ "data-empty": !hasChildren ? "" : undefined,
19101
19145
  ...props,
19102
- baseClassName: "navi_text_skeleton",
19103
- "data-loading": loading ? "" : undefined
19104
- // eslint-disable-next-line react/no-children-prop
19105
- ,
19106
-
19107
- children: undefined
19146
+ skeleton: undefined,
19147
+ childrenOutsideFlow: skeletonSpan,
19148
+ children: innerChildren
19108
19149
  });
19109
19150
  };
19110
19151
  const TextOverflow = ({
@@ -19125,7 +19166,8 @@ const TextOverflow = ({
19125
19166
 
19126
19167
  preLine: rest.as === "p",
19127
19168
  ...rest,
19128
- "data-text-overflow": true,
19169
+ overflowEllipsis: undefined,
19170
+ "data-text-overflow": "",
19129
19171
  spacing: "pre",
19130
19172
  children: jsxs("span", {
19131
19173
  className: "navi_text_overflow_wrapper",
@@ -19203,7 +19245,6 @@ const TextBasic = ({
19203
19245
  ...boxProps,
19204
19246
  bold: undefined,
19205
19247
  "data-bold": bold ? "" : undefined,
19206
- "data-has-absolute-child": "",
19207
19248
  children: [jsx("span", {
19208
19249
  className: "navi_text_bold_background",
19209
19250
  "aria-hidden": "true",