@dloizides/ui-layout 1.15.0 → 1.16.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/dist/index.mjs CHANGED
@@ -82,13 +82,29 @@ var styles2 = StyleSheet.create({
82
82
  fontSize: 16
83
83
  }
84
84
  });
85
- var Heading = ({ text, children }) => {
85
+ var DEFAULT_HEADING_LEVEL = 2;
86
+ var Heading = ({
87
+ text,
88
+ children,
89
+ level = DEFAULT_HEADING_LEVEL,
90
+ style,
91
+ testID
92
+ }) => {
86
93
  const { theme } = useUi();
87
94
  const headingStyle = React8.useMemo(
88
- () => [styles2.heading, { color: theme.colors.text }],
89
- [theme.colors.text]
95
+ () => [styles2.heading, { color: theme.colors.text }, style],
96
+ [theme.colors.text, style]
97
+ );
98
+ return /* @__PURE__ */ jsx(
99
+ Text,
100
+ {
101
+ accessibilityRole: "header",
102
+ "aria-level": level,
103
+ style: headingStyle,
104
+ testID: testID ?? LAYOUT_TEST_IDS.headingText,
105
+ children: text ?? children
106
+ }
90
107
  );
91
- return /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: headingStyle, testID: LAYOUT_TEST_IDS.headingText, children: text ?? children });
92
108
  };
93
109
  var DEFAULT_PADDING_H = 10;
94
110
  var DEFAULT_PADDING_V = 4;
@@ -1380,11 +1396,19 @@ var styles13 = StyleSheet.create({
1380
1396
  row: { flexDirection: "row", alignItems: "center", gap: ROW_GAP },
1381
1397
  /**
1382
1398
  * The truncation width comes from this wrapper, not from the row: `TruncatedText` measures its
1383
- * PARENT (see `useAvailableWidth`), and the row also holds the button. `minWidth: 0` is what
1384
- * actually lets a flex child shrink below its content width — without it the row just grows and
1385
- * nothing ever truncates.
1399
+ * PARENT (see `useAvailableWidth`), and the row also holds the copy button.
1400
+ *
1401
+ * `flex: 1` IS LOAD-BEARING — do not weaken it to `flexShrink: 1`. A shrink-only wrapper
1402
+ * SHRINK-WRAPS its content, which makes the measured parent width depend on the very string we
1403
+ * are computing: truncate -> wrapper narrows -> re-measure smaller -> truncate harder. Verified
1404
+ * in Chrome: with `flexShrink: 1` a 506px-wide container and a 306px one both rendered the SAME
1405
+ * 196px string, i.e. the id was cut short with 300px of room going spare. `flex: 1` makes the
1406
+ * wrapper fill the row's leftover width instead, so its size is independent of what we put in
1407
+ * it — the same reason `useAvailableWidth` measures the parent and not the element.
1408
+ *
1409
+ * `minWidth: 0` is what actually permits a flex child to go below its content width.
1386
1410
  */
1387
- valueWrap: { flexShrink: 1, minWidth: 0 },
1411
+ valueWrap: { flex: 1, minWidth: 0 },
1388
1412
  value: { fontSize: VALUE_FONT_SIZE, fontWeight: "600" },
1389
1413
  action: {
1390
1414
  fontSize: ACTION_FONT_SIZE,
@@ -1411,6 +1435,7 @@ function useActionState(status) {
1411
1435
  var CopyableId = ({
1412
1436
  value,
1413
1437
  label,
1438
+ style,
1414
1439
  testID,
1415
1440
  accessibilityLabel,
1416
1441
  writer
@@ -1419,7 +1444,7 @@ var CopyableId = ({
1419
1444
  const { colors } = theme;
1420
1445
  const { status, copy } = useCopyToClipboard(value, writer);
1421
1446
  const action = useActionState(status);
1422
- return /* @__PURE__ */ jsxs(View, { style: styles13.cell, testID, children: [
1447
+ return /* @__PURE__ */ jsxs(View, { style: [styles13.cell, style], testID, children: [
1423
1448
  label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles13.label, { color: colors.textSecondary }], children: label }),
1424
1449
  /* @__PURE__ */ jsxs(View, { style: styles13.row, children: [
1425
1450
  /* @__PURE__ */ jsx(View, { style: styles13.valueWrap, children: /* @__PURE__ */ jsx(