@dloizides/ui-layout 1.48.0 → 1.49.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 +3 -0
- package/dist/index.d.mts +84 -1
- package/dist/index.d.ts +84 -1
- package/dist/index.js +192 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +186 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3480,6 +3480,191 @@ var Timeline = ({ entries, accessibilityLabel, accessibilityHint, testID }) => {
|
|
|
3480
3480
|
)) });
|
|
3481
3481
|
};
|
|
3482
3482
|
|
|
3483
|
-
|
|
3483
|
+
// src/RecordHeader/recordHeaderLayout.ts
|
|
3484
|
+
function isRecordHeaderCompact(width, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
3485
|
+
return width < breakpoint;
|
|
3486
|
+
}
|
|
3487
|
+
var GAP2 = 8;
|
|
3488
|
+
var WIDE_GAP = 16;
|
|
3489
|
+
var styles35 = StyleSheet.create({
|
|
3490
|
+
actions: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: GAP2, justifyContent: "flex-end" },
|
|
3491
|
+
compactActions: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: GAP2 },
|
|
3492
|
+
identity: { flex: 1, gap: GAP2, minWidth: 0 },
|
|
3493
|
+
root: { gap: GAP2 },
|
|
3494
|
+
top: { alignItems: "flex-start", flexDirection: "row", gap: WIDE_GAP }
|
|
3495
|
+
});
|
|
3496
|
+
var RecordHeader = ({ breadcrumb, title, meta, actions, collapseBelow, testID }) => {
|
|
3497
|
+
const compact = isRecordHeaderCompact(useWindowDimensions().width, collapseBelow);
|
|
3498
|
+
const actionRow = actions === void 0 ? null : /* @__PURE__ */ jsx(View, { style: compact ? styles35.compactActions : styles35.actions, children: actions });
|
|
3499
|
+
return /* @__PURE__ */ jsx(View, { style: styles35.root, testID, children: /* @__PURE__ */ jsxs(View, { style: compact ? styles35.root : styles35.top, children: [
|
|
3500
|
+
/* @__PURE__ */ jsxs(View, { style: styles35.identity, children: [
|
|
3501
|
+
breadcrumb,
|
|
3502
|
+
title,
|
|
3503
|
+
meta
|
|
3504
|
+
] }),
|
|
3505
|
+
actionRow
|
|
3506
|
+
] }) });
|
|
3507
|
+
};
|
|
3508
|
+
var FONT_SIZE = 13;
|
|
3509
|
+
var GAP3 = 6;
|
|
3510
|
+
var SEPARATOR = "\u203A";
|
|
3511
|
+
var BACK = "\u2039";
|
|
3512
|
+
var styles36 = StyleSheet.create({
|
|
3513
|
+
link: { justifyContent: "center", minHeight: MIN_TARGET_PX },
|
|
3514
|
+
row: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: GAP3 },
|
|
3515
|
+
text: { fontSize: FONT_SIZE, fontWeight: "500" }
|
|
3516
|
+
});
|
|
3517
|
+
var Breadcrumb = ({ items, accessibilityLabel, testID }) => {
|
|
3518
|
+
const { theme } = useUi();
|
|
3519
|
+
const muted = { color: theme.colors.textSecondary };
|
|
3520
|
+
return /* @__PURE__ */ jsxs(View, { "aria-label": accessibilityLabel, style: styles36.row, testID, children: [
|
|
3521
|
+
/* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [styles36.text, muted], children: BACK }),
|
|
3522
|
+
items.map((item, index) => /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
3523
|
+
index > 0 ? /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [styles36.text, muted], children: SEPARATOR }) : null,
|
|
3524
|
+
item.onPress === void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles36.text, muted], testID: item.testID, children: item.label }) : /* @__PURE__ */ jsx(Pressable, { accessibilityHint: item.accessibilityHint, accessibilityLabel: item.label, accessibilityRole: "link", style: styles36.link, testID: item.testID, onPress: item.onPress, children: /* @__PURE__ */ jsx(Text, { style: [styles36.text, { color: theme.colors.text }], children: item.label }) })
|
|
3525
|
+
] }, item.key))
|
|
3526
|
+
] });
|
|
3527
|
+
};
|
|
3528
|
+
var RADIUS = 8;
|
|
3529
|
+
var PAD_H2 = 12;
|
|
3530
|
+
var GAP4 = 6;
|
|
3531
|
+
var FONT_SIZE2 = 13;
|
|
3532
|
+
var DISABLED_OPACITY2 = 0.55;
|
|
3533
|
+
var styles37 = StyleSheet.create({
|
|
3534
|
+
base: { alignItems: "center", borderRadius: RADIUS, borderWidth: 1, flexDirection: "row", gap: GAP4, justifyContent: "center", minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, paddingHorizontal: PAD_H2 },
|
|
3535
|
+
disabled: { borderStyle: "dashed", opacity: DISABLED_OPACITY2 },
|
|
3536
|
+
text: { fontSize: FONT_SIZE2, fontWeight: "600" }
|
|
3537
|
+
});
|
|
3538
|
+
function hasTitle(node) {
|
|
3539
|
+
return typeof node === "object" && node !== null && "setAttribute" in node;
|
|
3540
|
+
}
|
|
3541
|
+
var RecordActionButton = ({ label, hint, testID, icon, onPress, iconOnly = false, disabledReason }) => {
|
|
3542
|
+
const { theme } = useUi();
|
|
3543
|
+
const ref = useRef(null);
|
|
3544
|
+
const disabled = onPress === void 0;
|
|
3545
|
+
const title = disabled ? disabledReason : void 0;
|
|
3546
|
+
useEffect(() => {
|
|
3547
|
+
const node = ref.current;
|
|
3548
|
+
if (Platform.OS === "web" && title !== void 0 && hasTitle(node)) node.setAttribute("title", title);
|
|
3549
|
+
}, [title]);
|
|
3550
|
+
const showLabel = !iconOnly || icon === void 0;
|
|
3551
|
+
return /* @__PURE__ */ jsxs(
|
|
3552
|
+
Pressable,
|
|
3553
|
+
{
|
|
3554
|
+
ref,
|
|
3555
|
+
accessibilityHint: title ?? hint,
|
|
3556
|
+
accessibilityLabel: label,
|
|
3557
|
+
accessibilityRole: "button",
|
|
3558
|
+
accessibilityState: { disabled },
|
|
3559
|
+
disabled,
|
|
3560
|
+
style: [styles37.base, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }, disabled && styles37.disabled],
|
|
3561
|
+
testID,
|
|
3562
|
+
onPress,
|
|
3563
|
+
children: [
|
|
3564
|
+
icon === void 0 ? null : /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: icon }),
|
|
3565
|
+
showLabel ? /* @__PURE__ */ jsx(Text, { style: [styles37.text, { color: theme.colors.text }], children: label }) : null
|
|
3566
|
+
]
|
|
3567
|
+
}
|
|
3568
|
+
);
|
|
3569
|
+
};
|
|
3570
|
+
var RADIUS2 = 6;
|
|
3571
|
+
var PAD_H3 = 10;
|
|
3572
|
+
var GAP5 = 6;
|
|
3573
|
+
var FONT_SIZE3 = 12;
|
|
3574
|
+
var COPY_GLYPH = "\u29C9";
|
|
3575
|
+
var COPIED_GLYPH = "\u2713";
|
|
3576
|
+
var MONO = Platform.select({ web: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", default: "monospace" });
|
|
3577
|
+
var styles38 = StyleSheet.create({
|
|
3578
|
+
chip: { alignItems: "center", alignSelf: "flex-start", borderRadius: RADIUS2, borderWidth: 1, flexDirection: "row", gap: GAP5, maxWidth: "100%", minHeight: MIN_TARGET_PX, paddingHorizontal: PAD_H3 },
|
|
3579
|
+
text: { flexShrink: 1, fontFamily: MONO, fontSize: FONT_SIZE3 }
|
|
3580
|
+
});
|
|
3581
|
+
var IdChip = ({ label, value, testID, accessibilityLabel, accessibilityHint, display, valueTestID, writer }) => {
|
|
3582
|
+
const { theme } = useUi();
|
|
3583
|
+
const copyable = value !== null && value !== "";
|
|
3584
|
+
const { status, copy } = useCopyToClipboard(value ?? "", writer);
|
|
3585
|
+
const ink = { color: theme.colors.text };
|
|
3586
|
+
return /* @__PURE__ */ jsxs(
|
|
3587
|
+
Pressable,
|
|
3588
|
+
{
|
|
3589
|
+
accessibilityHint,
|
|
3590
|
+
accessibilityLabel,
|
|
3591
|
+
accessibilityRole: "button",
|
|
3592
|
+
accessibilityState: { disabled: !copyable },
|
|
3593
|
+
disabled: !copyable,
|
|
3594
|
+
style: [styles38.chip, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }],
|
|
3595
|
+
testID,
|
|
3596
|
+
onPress: copyable ? copy : void 0,
|
|
3597
|
+
children: [
|
|
3598
|
+
/* @__PURE__ */ jsx(Text, { style: [styles38.text, { color: theme.colors.textSecondary }], children: label }),
|
|
3599
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles38.text, ink], testID: valueTestID, children: display ?? value }),
|
|
3600
|
+
copyable ? /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [styles38.text, ink], testID: `${testID}-glyph`, children: status === "copied" /* Copied */ ? COPIED_GLYPH : COPY_GLYPH }) : null
|
|
3601
|
+
]
|
|
3602
|
+
}
|
|
3603
|
+
);
|
|
3604
|
+
};
|
|
3605
|
+
var UNDERLINE = 3;
|
|
3606
|
+
var PAD_H4 = 12;
|
|
3607
|
+
var GAP6 = 6;
|
|
3608
|
+
var FONT_SIZE4 = 14;
|
|
3609
|
+
var COUNT_FONT = 12;
|
|
3610
|
+
var COUNT_MIN = 22;
|
|
3611
|
+
var COUNT_PAD = 6;
|
|
3612
|
+
var PILL = 999;
|
|
3613
|
+
var DEFAULT_UNDERLINE_STEP = "700";
|
|
3614
|
+
var styles39 = StyleSheet.create({
|
|
3615
|
+
count: { borderRadius: PILL, fontSize: COUNT_FONT, fontWeight: "700", minWidth: COUNT_MIN, paddingHorizontal: COUNT_PAD, textAlign: "center" },
|
|
3616
|
+
label: { fontSize: FONT_SIZE4, fontWeight: "600" },
|
|
3617
|
+
strip: { borderBottomWidth: 1, width: "100%" },
|
|
3618
|
+
tab: { alignItems: "center", borderBottomWidth: UNDERLINE, flexDirection: "row", gap: GAP6, justifyContent: "center", minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, paddingHorizontal: PAD_H4 }
|
|
3619
|
+
});
|
|
3620
|
+
var UnderlineTabs = ({ tabs, activeKey, onChange, accessibilityLabel, underlineColor, testID }) => {
|
|
3621
|
+
const { theme } = useUi();
|
|
3622
|
+
const underline = underlineColor ?? theme.palette.primary[DEFAULT_UNDERLINE_STEP];
|
|
3623
|
+
return /* @__PURE__ */ jsx(View, { style: [styles39.strip, { borderBottomColor: theme.colors.border }], testID, children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, accessibilityRole: "tablist", "aria-label": accessibilityLabel, showsHorizontalScrollIndicator: false, children: tabs.map((tab) => {
|
|
3624
|
+
const selected = tab.key === activeKey;
|
|
3625
|
+
return /* @__PURE__ */ jsxs(
|
|
3626
|
+
Pressable,
|
|
3627
|
+
{
|
|
3628
|
+
accessibilityHint: tab.accessibilityHint,
|
|
3629
|
+
accessibilityLabel: tab.label,
|
|
3630
|
+
accessibilityRole: "tab",
|
|
3631
|
+
accessibilityState: { selected },
|
|
3632
|
+
"aria-selected": selected,
|
|
3633
|
+
style: [styles39.tab, { borderBottomColor: selected ? underline : "transparent" }],
|
|
3634
|
+
testID: tab.testID,
|
|
3635
|
+
onPress: () => onChange(tab.key),
|
|
3636
|
+
children: [
|
|
3637
|
+
/* @__PURE__ */ jsx(Text, { style: [styles39.label, { color: selected ? theme.colors.text : theme.colors.textSecondary }], children: tab.label }),
|
|
3638
|
+
tab.count === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles39.count, { backgroundColor: theme.colors.border, color: theme.colors.text }], children: String(tab.count) })
|
|
3639
|
+
]
|
|
3640
|
+
},
|
|
3641
|
+
tab.key
|
|
3642
|
+
);
|
|
3643
|
+
}) }) });
|
|
3644
|
+
};
|
|
3645
|
+
var RADIUS3 = 12;
|
|
3646
|
+
var PAD = 16;
|
|
3647
|
+
var GAP7 = 8;
|
|
3648
|
+
var TITLE_FONT = 15;
|
|
3649
|
+
var styles40 = StyleSheet.create({
|
|
3650
|
+
card: { borderRadius: RADIUS3, borderWidth: 1, gap: GAP7, minWidth: 0, padding: PAD },
|
|
3651
|
+
footer: { borderRadius: GAP7, borderWidth: 1, gap: GAP7, padding: PAD / 2 + GAP7 / 2 },
|
|
3652
|
+
head: { alignItems: "center", flexDirection: "row", gap: GAP7 },
|
|
3653
|
+
title: { flex: 1, fontSize: TITLE_FONT, fontWeight: "700" }
|
|
3654
|
+
});
|
|
3655
|
+
var WidgetCard = ({ title, children, icon, headerRight, footer, testID }) => {
|
|
3656
|
+
const { theme } = useUi();
|
|
3657
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles40.card, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }], testID, children: [
|
|
3658
|
+
/* @__PURE__ */ jsxs(View, { style: styles40.head, children: [
|
|
3659
|
+
icon === void 0 ? null : /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: icon }),
|
|
3660
|
+
/* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles40.title, { color: theme.colors.text }], children: title }),
|
|
3661
|
+
headerRight
|
|
3662
|
+
] }),
|
|
3663
|
+
children,
|
|
3664
|
+
footer === void 0 ? null : /* @__PURE__ */ jsx(View, { style: [styles40.footer, { backgroundColor: theme.colors.background, borderColor: theme.colors.border }], children: footer })
|
|
3665
|
+
] });
|
|
3666
|
+
};
|
|
3667
|
+
|
|
3668
|
+
export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyStatus, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayCard, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, IdChip, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, ModalShell, PageFrame, RecordActionButton, RecordHeader, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyPreview, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TextKind, Timeline, ToggleSection, TruncatedText, UnderlineTabs, UpgradePrompt, WidgetCard, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveRowLook, resolveToneColors, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
|
3484
3669
|
//# sourceMappingURL=index.mjs.map
|
|
3485
3670
|
//# sourceMappingURL=index.mjs.map
|