@dloizides/ui-layout 1.60.2 → 1.62.0

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
@@ -258,6 +258,13 @@ var ScreenColumn = ({ children, narrow = false }) => {
258
258
  return /* @__PURE__ */ jsx(View, { style: styles3.outer, children: /* @__PURE__ */ jsx(View, { style: [styles3.column, isWide ? styles3.desktop : styles3.mobile, narrow ? styles3.narrow : styles3.wide], children }) });
259
259
  };
260
260
 
261
+ // src/StatusBadge/BadgeSize.ts
262
+ var BadgeSize = /* @__PURE__ */ ((BadgeSize2) => {
263
+ BadgeSize2["Regular"] = "regular";
264
+ BadgeSize2["Compact"] = "compact";
265
+ return BadgeSize2;
266
+ })(BadgeSize || {});
267
+
261
268
  // src/StatusBadge/BadgeTone.ts
262
269
  var BadgeTone = /* @__PURE__ */ ((BadgeTone2) => {
263
270
  BadgeTone2["Neutral"] = "neutral";
@@ -341,6 +348,10 @@ var DEFAULT_PADDING_V = 4;
341
348
  var DEFAULT_BORDER_RADIUS = 12;
342
349
  var DEFAULT_FONT_SIZE = 12;
343
350
  var ICON_GAP = 4;
351
+ var COMPACT_PADDING_H = 8;
352
+ var COMPACT_PADDING_V = 1;
353
+ var COMPACT_RADIUS = 999;
354
+ var COMPACT_LINE_HEIGHT = 17;
344
355
  var styles4 = StyleSheet.create({
345
356
  badge: {
346
357
  paddingHorizontal: DEFAULT_PADDING_H,
@@ -359,6 +370,14 @@ var styles4 = StyleSheet.create({
359
370
  borderWidth: 1,
360
371
  borderStyle: "dashed"
361
372
  },
373
+ badgeCompact: {
374
+ paddingHorizontal: COMPACT_PADDING_H,
375
+ paddingVertical: COMPACT_PADDING_V,
376
+ borderRadius: COMPACT_RADIUS
377
+ },
378
+ textCompact: {
379
+ lineHeight: COMPACT_LINE_HEIGHT
380
+ },
362
381
  text: {
363
382
  fontSize: DEFAULT_FONT_SIZE,
364
383
  fontWeight: "600",
@@ -372,6 +391,7 @@ var StatusBadge = ({
372
391
  backgroundColor: rawBackground,
373
392
  icon,
374
393
  dashed = false,
394
+ size = "regular" /* Regular */,
375
395
  testID = LAYOUT_TEST_IDS.statusLabel,
376
396
  accessibilityLabel,
377
397
  accessibilityHint
@@ -387,16 +407,17 @@ var StatusBadge = ({
387
407
  const dashedColor = useMemo(() => ({ borderColor: color }), [color]);
388
408
  const dynamicText = useMemo(() => ({ color }), [color]);
389
409
  const hasIcon = icon !== void 0 && icon !== null;
410
+ const compact = size === "compact" /* Compact */;
390
411
  return /* @__PURE__ */ jsxs(
391
412
  View,
392
413
  {
393
414
  accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint),
394
415
  accessibilityLabel: accessibilityLabel ?? label,
395
- style: [styles4.badge, hasIcon && styles4.badgeWithIcon, dynamicBadge, dashed && styles4.badgeDashed, dashed && dashedColor],
416
+ style: [styles4.badge, compact && styles4.badgeCompact, hasIcon && styles4.badgeWithIcon, dynamicBadge, dashed && styles4.badgeDashed, dashed && dashedColor],
396
417
  testID,
397
418
  children: [
398
419
  hasIcon ? /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: icon }) : null,
399
- /* @__PURE__ */ jsx(Text, { style: [styles4.text, dynamicText], children: label })
420
+ /* @__PURE__ */ jsx(Text, { style: [styles4.text, compact && styles4.textCompact, dynamicText], children: label })
400
421
  ]
401
422
  }
402
423
  );
@@ -3427,16 +3448,17 @@ var SECTION_INDEX_WIDTH = 200;
3427
3448
  var ACTIVE_BAR = 3;
3428
3449
  var TRANSPARENT3 = "transparent";
3429
3450
  var DENSE_TARGET_PX = 24;
3451
+ var DENSE_LINE = 19;
3430
3452
  var styles30 = StyleSheet.create({
3431
3453
  root: { flexShrink: 0, gap: 2, alignSelf: "flex-start" },
3432
3454
  heading: { fontSize: 12, fontWeight: "700", letterSpacing: 0.6, textTransform: "uppercase", paddingHorizontal: 10, paddingBottom: 6 },
3433
3455
  item: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: 10, borderLeftWidth: ACTIVE_BAR, borderRadius: 6 },
3434
3456
  label: { fontSize: 14 },
3435
3457
  labelActive: { fontWeight: "700" },
3436
- denseRoot: { gap: 0 },
3437
- denseHeading: { fontSize: 11, fontWeight: "600", paddingBottom: 10 },
3438
- denseItem: { minHeight: DENSE_TARGET_PX, paddingVertical: 7, paddingHorizontal: 7 },
3439
- denseLabel: { fontSize: 13, lineHeight: 19 },
3458
+ denseRoot: { gap: 2 },
3459
+ denseHeading: { fontSize: 11, fontWeight: "600", letterSpacing: 0.66, lineHeight: 16, paddingBottom: 6 },
3460
+ denseItem: { minHeight: DENSE_TARGET_PX, paddingVertical: 6, paddingLeft: 7, paddingRight: 10, borderRadius: 7 },
3461
+ denseLabel: { fontSize: 13, lineHeight: DENSE_LINE },
3440
3462
  denseLabelActive: { fontWeight: "600" }
3441
3463
  });
3442
3464
  function ariaCurrent(active) {
@@ -3485,12 +3507,17 @@ function scrollToSection(anchorId) {
3485
3507
  }
3486
3508
  var COMFORTABLE_GAP = 12;
3487
3509
  var DENSE_GAP = 8;
3488
- var DENSE_WIDE_GAP = 14;
3510
+ var DENSE_WIDE_GAP = 16;
3489
3511
  var WEB_STICKY = { position: "sticky", top: 0 };
3512
+ var NO_STACK = Number.POSITIVE_INFINITY;
3490
3513
  var styles31 = StyleSheet.create({
3491
3514
  wide: { flexDirection: "row", alignItems: "flex-start", gap: 20 },
3492
3515
  column: { flex: 1, minWidth: 0 }
3493
3516
  });
3517
+ function toFold(breakpoint) {
3518
+ return typeof breakpoint === "number" ? { wide: breakpoint, stackFrom: NO_STACK } : breakpoint;
3519
+ }
3520
+ var SectionColumn = ({ sections, testID, style }) => /* @__PURE__ */ jsx(View, { style, testID: `${testID}-column`, children: sections.map((entry) => /* @__PURE__ */ jsx(View, { nativeID: sectionAnchorId(testID, entry.key), testID: sectionAnchorId(testID, entry.key), children: entry.content }, entry.key)) });
3494
3521
  var SectionIndexLayout = ({
3495
3522
  sections,
3496
3523
  indexHeading,
@@ -3505,12 +3532,15 @@ var SectionIndexLayout = ({
3505
3532
  activeColor,
3506
3533
  testID = "section-index"
3507
3534
  }) => {
3508
- const wide = useIsWideViewport(breakpoint);
3535
+ const fold = toFold(breakpoint);
3536
+ const wide = useIsWideViewport(fold.wide);
3537
+ const stacked = useIsWideViewport(fold.stackFrom);
3509
3538
  const [picked, setPicked] = useState(void 0);
3510
3539
  const activeKey = resolveActiveKey(sections, picked ?? (wide ? initialKey : collapsedKey ?? initialKey));
3511
3540
  const dense = density === "dense" /* Dense */;
3512
3541
  const gap = { gap: dense ? DENSE_GAP : COMFORTABLE_GAP };
3513
3542
  if (sections.length < 2) return /* @__PURE__ */ jsx(View, { testID, children: sections[0]?.content });
3543
+ if (!wide && stacked) return /* @__PURE__ */ jsx(View, { testID, children: /* @__PURE__ */ jsx(SectionColumn, { sections, style: gap, testID }) });
3514
3544
  if (!wide) {
3515
3545
  const active = sections.find((entry) => entry.key === activeKey);
3516
3546
  return /* @__PURE__ */ jsxs(View, { style: gap, testID, children: [
@@ -3538,7 +3568,7 @@ var SectionIndexLayout = ({
3538
3568
  const sticky = stickyIndex && Platform.OS === "web" ? WEB_STICKY : null;
3539
3569
  return /* @__PURE__ */ jsxs(View, { style: [styles31.wide, dense && { gap: DENSE_WIDE_GAP }], testID, children: [
3540
3570
  /* @__PURE__ */ jsx(View, { style: sticky, children: /* @__PURE__ */ jsx(SectionIndex, { activeColor, activeKey, dense, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
3541
- /* @__PURE__ */ jsx(View, { style: [styles31.column, gap], children: sections.map((entry) => /* @__PURE__ */ jsx(View, { nativeID: sectionAnchorId(testID, entry.key), testID: sectionAnchorId(testID, entry.key), children: entry.content }, entry.key)) })
3571
+ /* @__PURE__ */ jsx(SectionColumn, { sections, style: StyleSheet.flatten([styles31.column, gap]), testID })
3542
3572
  ] });
3543
3573
  };
3544
3574
 
@@ -4155,6 +4185,6 @@ var ListDetailLayout = ({
4155
4185
  return /* @__PURE__ */ jsx(SplitPanes, { end: null, layout: "stack" /* Stack */, start: panes.detail ? detail : list, testID });
4156
4186
  };
4157
4187
 
4158
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyControl, CopyRowEmphasis, CopyStatus, CopyValueRow, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayBadgeFill, DayCard, DayCardLayout, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, IdChip, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, ListDetailPane, ListRow, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, ModalShell, PageFrame, PageHead, RecordActionButton, RecordHeader, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SegmentedVariant, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyActionBar, StickyPreview, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TabsVariant, TextKind, Timeline, ToggleSection, TotalsStrip, TotalsTone, TransferSlip, TruncatedText, UnderlineTabs, UpgradePrompt, WidgetCard, copyActionLabel, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveListDetailPanes, resolveRowLook, resolveTintColors, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
4188
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeSize, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyControl, CopyRowEmphasis, CopyStatus, CopyValueRow, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayBadgeFill, DayCard, DayCardLayout, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, IdChip, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, ListDetailPane, ListRow, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, ModalShell, PageFrame, PageHead, RecordActionButton, RecordHeader, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SegmentedVariant, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyActionBar, StickyPreview, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TabsVariant, TextKind, Timeline, ToggleSection, TotalsStrip, TotalsTone, TransferSlip, TruncatedText, UnderlineTabs, UpgradePrompt, WidgetCard, copyActionLabel, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveListDetailPanes, resolveRowLook, resolveTintColors, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
4159
4189
  //# sourceMappingURL=index.mjs.map
4160
4190
  //# sourceMappingURL=index.mjs.map