@dloizides/ui-layout 1.12.0 → 1.12.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.12.1
4
+
5
+ - **Fix (`TruncatedText` did not actually middle-truncate).** 1.12.0 measured its available
6
+ width with `onLayout` **on the `<Text>` itself, which never fires under RN-web**. The width
7
+ stayed 0, the character budget stayed 0, and the component silently fell back to rendering
8
+ the full string — i.e. to exactly the tail-only CSS ellipsis it exists to replace. It
9
+ compiled, typechecked and passed all its unit tests throughout, because the truncation
10
+ helpers are pure and were never the broken part; only a browser could see it. Measured in
11
+ Chrome at a 120px container: text rendered `timesofindia.indiatimes.com/city/delhi/delhi-…`
12
+ with **no `…` character present** — CSS clipping, not middle truncation.
13
+
14
+ The width is now measured on a wrapping `<View>`, which does fire `onLayout`. The overflow
15
+ guarantee was never affected (the element stayed inside its parent in both versions); what
16
+ was lost was the informative half of the behaviour.
17
+
3
18
  ## 1.12.0
4
19
 
5
20
  - **New: `TruncatedText`** — a single-line text/link that middle-truncates to fit its container
package/dist/index.d.mts CHANGED
@@ -285,6 +285,12 @@ declare const AccordionItem: ({ id, title, right, children, defaultOpen: _defaul
285
285
  * estimate can be wrong for an unusual glyph mix. So `numberOfLines={1}` is ALSO applied,
286
286
  * as a hard backstop: if the estimate ever runs long, CSS clamps it. Overflow is then
287
287
  * impossible by construction rather than by tuning.
288
+ * 4. `onLayout` on the `<Text>` itself. It does not fire under RN-web, so the measured width
289
+ * stayed 0, the character budget stayed 0, and the component silently degraded to exactly
290
+ * the tail-only CSS truncation of (1) — compiling, typechecking and passing its unit tests
291
+ * the whole time, because the helpers are pure and were never the broken part. The width is
292
+ * measured on a wrapping `<View>`, which does fire, and the result was confirmed in a
293
+ * browser rather than inferred.
288
294
  *
289
295
  * The full, untruncated value always stays reachable: as the accessible name (`aria-label`)
290
296
  * and, on web, as the native tooltip.
package/dist/index.d.ts CHANGED
@@ -285,6 +285,12 @@ declare const AccordionItem: ({ id, title, right, children, defaultOpen: _defaul
285
285
  * estimate can be wrong for an unusual glyph mix. So `numberOfLines={1}` is ALSO applied,
286
286
  * as a hard backstop: if the estimate ever runs long, CSS clamps it. Overflow is then
287
287
  * impossible by construction rather than by tuning.
288
+ * 4. `onLayout` on the `<Text>` itself. It does not fire under RN-web, so the measured width
289
+ * stayed 0, the character budget stayed 0, and the component silently degraded to exactly
290
+ * the tail-only CSS truncation of (1) — compiling, typechecking and passing its unit tests
291
+ * the whole time, because the helpers are pure and were never the broken part. The width is
292
+ * measured on a wrapping `<View>`, which does fire, and the result was confirmed in a
293
+ * browser rather than inferred.
288
294
  *
289
295
  * The full, untruncated value always stays reachable: as the accessible name (`aria-label`)
290
296
  * and, on web, as the native tooltip.
package/dist/index.js CHANGED
@@ -1246,13 +1246,12 @@ var TruncatedText = ({
1246
1246
  const budget = charBudget(width, fontSize);
1247
1247
  return budget === UNMEASURED ? source : truncateMiddle(source, budget);
1248
1248
  }, [value, isUrl, width, fontSize]);
1249
- return /* @__PURE__ */ jsxRuntime.jsx(
1249
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles12.fill, onLayout, children: /* @__PURE__ */ jsxRuntime.jsx(
1250
1250
  reactNative.Text,
1251
1251
  {
1252
1252
  ref: attachTooltip,
1253
- onLayout,
1254
1253
  numberOfLines: 1,
1255
- style: [styles12.base, styles12.fill, style],
1254
+ style: [styles12.base, style],
1256
1255
  testID,
1257
1256
  accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
1258
1257
  accessibilityLabel,
@@ -1261,7 +1260,7 @@ var TruncatedText = ({
1261
1260
  ...reactNative.Platform.OS === "web" && href !== void 0 ? { href } : {},
1262
1261
  children: display
1263
1262
  }
1264
- );
1263
+ ) });
1265
1264
  };
1266
1265
 
1267
1266
  exports.Accordion = Accordion;