@jsenv/navi 0.29.377 → 0.29.378

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.
@@ -44197,6 +44197,10 @@ time.navi_text {
44197
44197
  border-radius: inherit;
44198
44198
  }
44199
44199
 
44200
+ &[data-text-clamp] {
44201
+ min-width: 0;
44202
+ }
44203
+
44200
44204
  &[data-text-overflow] {
44201
44205
  text-overflow: ellipsis;
44202
44206
  overflow-wrap: normal;
@@ -44570,6 +44574,10 @@ const shouldInjectSpacingBetween = (left, right) => {
44570
44574
  * n lines. This is the only prop to use for that — `Box`'s `lineClamp` /
44571
44575
  * `overflowEllipsis` are raw CSS mappings meant for elements that are not a
44572
44576
  * `Text`, and `lineClamp={1}` is never the single-line truncation you want.
44577
+ * Either value states the `white-space` it needs — one line does not wrap,
44578
+ * n lines may — so it holds inside a single-line ancestor too (a `Picker`'s
44579
+ * value, a `Time`); an explicit `noWrap`/`pre`/`preLine` on this `Text`
44580
+ * still wins.
44573
44581
  * Truncation only happens if the element may become narrower than its
44574
44582
  * content: `maxLines` sets `min-width: 0` here, but each `Box` between this
44575
44583
  * one and the element that carries the width must set it too.
@@ -44632,6 +44640,25 @@ const shouldInjectSpacingBetween = (left, right) => {
44632
44640
  * internally for overlays such as the skeleton container.
44633
44641
  */
44634
44642
  const Text = props => {
44643
+ if (props.maxLines > 1) {
44644
+ props = {
44645
+ ...props,
44646
+ "data-text-clamp": ""
44647
+ };
44648
+ if (!saysWhiteSpace(props)) {
44649
+ // n lines means "you may wrap". white-space is inherited, so left unsaid
44650
+ // a single-line ancestor (a Picker's value, a Time) leaves the clamp one
44651
+ // line to cut, and the text runs past its box. Same tag rule as
44652
+ // TextOverflow: a paragraph keeps its line breaks.
44653
+ props = props.as === "p" ? {
44654
+ ...props,
44655
+ preLine: true
44656
+ } : {
44657
+ ...props,
44658
+ noWrap: false
44659
+ };
44660
+ }
44661
+ }
44635
44662
  if (props.loading || props.skeleton) {
44636
44663
  return jsx(TextSkeleton, {
44637
44664
  ...props
@@ -44843,6 +44870,14 @@ const TextOverflow = ({
44843
44870
  children: children
44844
44871
  });
44845
44872
  };
44873
+ const saysWhiteSpace = ({
44874
+ noWrap,
44875
+ pre,
44876
+ preWrap,
44877
+ preLine
44878
+ }) => {
44879
+ return noWrap !== undefined || pre !== undefined || preWrap !== undefined || preLine !== undefined;
44880
+ };
44846
44881
  const TextWithSelectRange = ({
44847
44882
  ref,
44848
44883
  selectRange,
@@ -58815,9 +58850,11 @@ const TimeRelative = ({
58815
58850
  });
58816
58851
  };
58817
58852
  const TimeText = props => {
58853
+ // A date stays on one line, unless the caller grants it several.
58854
+ const noWrap = props.maxLines > 1 ? undefined : true;
58818
58855
  return jsx(Text, {
58819
58856
  as: "time",
58820
- noWrap: true,
58857
+ noWrap: noWrap,
58821
58858
  ...props
58822
58859
  });
58823
58860
  };
@@ -76071,13 +76108,7 @@ const renderDayDefault = (day, {
76071
76108
  type: "date",
76072
76109
  format: format,
76073
76110
  dayLabel: true,
76074
- lang: lang
76075
- // A Time keeps its date on one line by default; here a day too long for
76076
- // the box is meant to wrap, so that is undone — except for maxLines={1},
76077
- // which IS one line and cuts it itself (see Text's own TextOverflow):
76078
- // saying "you may wrap" there would undo the truncation instead.
76079
- ,
76080
- noWrap: maxLines === 1 || maxLines === "1" ? undefined : false,
76111
+ lang: lang,
76081
76112
  maxLines: maxLines,
76082
76113
  children: day
76083
76114
  });