@dloizides/ui-layout 1.26.4 → 1.28.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.d.mts +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +38 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -858,5 +858,34 @@ declare const LAYOUT_I18N: {
|
|
|
858
858
|
/** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */
|
|
859
859
|
readonly buildInfoHint: "common.buildInfoHint";
|
|
860
860
|
};
|
|
861
|
+
/**
|
|
862
|
+
* Viewport width (px) below which the TYPE ramp drops to its mobile sizes.
|
|
863
|
+
*
|
|
864
|
+
* Typography, not layout. A type scale steps down earlier than a column layout
|
|
865
|
+
* collapses because a 44px display line is unreadable on a phone long before a
|
|
866
|
+
* two-column grid stops fitting. nextgame-web's D1 ramp (`typeStyle`) is the
|
|
867
|
+
* only implementation today; the number lives here so the next one reuses it.
|
|
868
|
+
*/
|
|
869
|
+
declare const TYPE_SCALE_BREAKPOINT = 600;
|
|
870
|
+
/**
|
|
871
|
+
* Viewport width (px) at/above which LAYOUT keeps its wide form: the inline
|
|
872
|
+
* anchored dropdown menu, the horizontal tab row, the persistent nav rail, the
|
|
873
|
+
* inline sidebar search field. Below it each collapses to its phone affordance.
|
|
874
|
+
*
|
|
875
|
+
* This is the value `MENU_BREAKPOINT`, `RAIL_FULL_BREAKPOINT` and
|
|
876
|
+
* `DEFAULT_SEARCH_BREAKPOINT` each hard-coded independently.
|
|
877
|
+
*/
|
|
878
|
+
declare const LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
879
|
+
/**
|
|
880
|
+
* Minimum interactive hit box, in CSS px, on BOTH axes — measured on the box,
|
|
881
|
+
* never on the glyph inside it. WCAG 2.5.5 / mobile-first.md.
|
|
882
|
+
*/
|
|
883
|
+
declare const MIN_TARGET_PX = 44;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* `true` only on a web viewport at/above `breakpoint`. Native always returns
|
|
887
|
+
* `false`, whatever the width.
|
|
888
|
+
*/
|
|
889
|
+
declare function isWideWebViewport(width: number, platformOS: string, breakpoint?: number): boolean;
|
|
861
890
|
|
|
862
|
-
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, BUILD_INFO_PREFIX, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, copyText, formatBuildInfo, formatUrlForDisplay, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap };
|
|
891
|
+
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, BUILD_INFO_PREFIX, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, MIN_TARGET_PX, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, copyText, formatBuildInfo, formatUrlForDisplay, isWideWebViewport, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap };
|
package/dist/index.d.ts
CHANGED
|
@@ -858,5 +858,34 @@ declare const LAYOUT_I18N: {
|
|
|
858
858
|
/** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */
|
|
859
859
|
readonly buildInfoHint: "common.buildInfoHint";
|
|
860
860
|
};
|
|
861
|
+
/**
|
|
862
|
+
* Viewport width (px) below which the TYPE ramp drops to its mobile sizes.
|
|
863
|
+
*
|
|
864
|
+
* Typography, not layout. A type scale steps down earlier than a column layout
|
|
865
|
+
* collapses because a 44px display line is unreadable on a phone long before a
|
|
866
|
+
* two-column grid stops fitting. nextgame-web's D1 ramp (`typeStyle`) is the
|
|
867
|
+
* only implementation today; the number lives here so the next one reuses it.
|
|
868
|
+
*/
|
|
869
|
+
declare const TYPE_SCALE_BREAKPOINT = 600;
|
|
870
|
+
/**
|
|
871
|
+
* Viewport width (px) at/above which LAYOUT keeps its wide form: the inline
|
|
872
|
+
* anchored dropdown menu, the horizontal tab row, the persistent nav rail, the
|
|
873
|
+
* inline sidebar search field. Below it each collapses to its phone affordance.
|
|
874
|
+
*
|
|
875
|
+
* This is the value `MENU_BREAKPOINT`, `RAIL_FULL_BREAKPOINT` and
|
|
876
|
+
* `DEFAULT_SEARCH_BREAKPOINT` each hard-coded independently.
|
|
877
|
+
*/
|
|
878
|
+
declare const LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
879
|
+
/**
|
|
880
|
+
* Minimum interactive hit box, in CSS px, on BOTH axes — measured on the box,
|
|
881
|
+
* never on the glyph inside it. WCAG 2.5.5 / mobile-first.md.
|
|
882
|
+
*/
|
|
883
|
+
declare const MIN_TARGET_PX = 44;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* `true` only on a web viewport at/above `breakpoint`. Native always returns
|
|
887
|
+
* `false`, whatever the width.
|
|
888
|
+
*/
|
|
889
|
+
declare function isWideWebViewport(width: number, platformOS: string, breakpoint?: number): boolean;
|
|
861
890
|
|
|
862
|
-
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, BUILD_INFO_PREFIX, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, copyText, formatBuildInfo, formatUrlForDisplay, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap };
|
|
891
|
+
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, BUILD_INFO_PREFIX, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, MIN_TARGET_PX, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, copyText, formatBuildInfo, formatUrlForDisplay, isWideWebViewport, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap };
|
package/dist/index.js
CHANGED
|
@@ -105,6 +105,9 @@ var LAYOUT_I18N = {
|
|
|
105
105
|
/** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */
|
|
106
106
|
buildInfoHint: "common.buildInfoHint"
|
|
107
107
|
};
|
|
108
|
+
var TYPE_SCALE_BREAKPOINT = 600;
|
|
109
|
+
var LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
110
|
+
var MIN_TARGET_PX = 44;
|
|
108
111
|
var styles2 = reactNative.StyleSheet.create({
|
|
109
112
|
heading: {
|
|
110
113
|
fontWeight: "700",
|
|
@@ -198,6 +201,8 @@ var styles4 = reactNative.StyleSheet.create({
|
|
|
198
201
|
borderWidth: BORDER_WIDTH
|
|
199
202
|
},
|
|
200
203
|
segment: {
|
|
204
|
+
minHeight: MIN_TARGET_PX,
|
|
205
|
+
justifyContent: "center",
|
|
201
206
|
paddingHorizontal: SEGMENT_PAD_H,
|
|
202
207
|
paddingVertical: SEGMENT_PAD_V,
|
|
203
208
|
borderRadius: SEGMENT_RADIUS
|
|
@@ -688,12 +693,18 @@ var InlineMenu = ({
|
|
|
688
693
|
if (IS_WEB2) return reactDom.createPortal(menu, document.body);
|
|
689
694
|
return menu;
|
|
690
695
|
};
|
|
691
|
-
|
|
696
|
+
|
|
697
|
+
// src/responsive.ts
|
|
692
698
|
var WEB_PLATFORM = "web";
|
|
699
|
+
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
700
|
+
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// src/ModalDropdown/resolveDropdownVariant.ts
|
|
704
|
+
var MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
693
705
|
function resolveDropdownVariant(explicit, width, platformOS) {
|
|
694
706
|
if (explicit !== void 0) return explicit;
|
|
695
|
-
|
|
696
|
-
return isWideWeb ? "menu" /* Menu */ : "modal" /* Modal */;
|
|
707
|
+
return isWideWebViewport(width, platformOS, MENU_BREAKPOINT) ? "menu" /* Menu */ : "modal" /* Modal */;
|
|
697
708
|
}
|
|
698
709
|
function useResolvedDropdownVariant(explicit) {
|
|
699
710
|
const { width } = reactNative.useWindowDimensions();
|
|
@@ -961,11 +972,9 @@ var TabsMenu = ({
|
|
|
961
972
|
}
|
|
962
973
|
);
|
|
963
974
|
};
|
|
964
|
-
var TABS_COLLAPSE_BREAKPOINT =
|
|
965
|
-
var WEB_PLATFORM2 = "web";
|
|
975
|
+
var TABS_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
966
976
|
function shouldCollapseTabs(width, platformOS, breakpoint) {
|
|
967
|
-
|
|
968
|
-
return !isWideWeb;
|
|
977
|
+
return !isWideWebViewport(width, platformOS, breakpoint);
|
|
969
978
|
}
|
|
970
979
|
function useTabsCollapsed(breakpoint) {
|
|
971
980
|
const { width } = reactNative.useWindowDimensions();
|
|
@@ -1129,9 +1138,16 @@ var styles9 = reactNative.StyleSheet.create({
|
|
|
1129
1138
|
},
|
|
1130
1139
|
title: { fontSize: TITLE_FONT_SIZE, fontWeight: "700", marginBottom: TITLE_MARGIN_BOTTOM },
|
|
1131
1140
|
message: { fontSize: MESSAGE_FONT_SIZE, marginBottom: MESSAGE_MARGIN_BOTTOM },
|
|
1132
|
-
cta: {
|
|
1141
|
+
cta: {
|
|
1142
|
+
minHeight: MIN_TARGET_PX,
|
|
1143
|
+
paddingVertical: BUTTON_PADDING_V,
|
|
1144
|
+
borderRadius: BUTTON_BORDER_RADIUS,
|
|
1145
|
+
alignItems: "center",
|
|
1146
|
+
justifyContent: "center",
|
|
1147
|
+
marginBottom: CTA_MARGIN_BOTTOM
|
|
1148
|
+
},
|
|
1133
1149
|
ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: "700" },
|
|
1134
|
-
dismiss: { alignItems: "center", paddingVertical: BUTTON_PADDING_V },
|
|
1150
|
+
dismiss: { minHeight: MIN_TARGET_PX, alignItems: "center", justifyContent: "center", paddingVertical: BUTTON_PADDING_V },
|
|
1135
1151
|
dismissText: { fontSize: DISMISS_FONT_SIZE }
|
|
1136
1152
|
});
|
|
1137
1153
|
var UpgradePrompt = ({
|
|
@@ -1561,6 +1577,8 @@ var styles14 = reactNative.StyleSheet.create({
|
|
|
1561
1577
|
flexDirection: "row",
|
|
1562
1578
|
alignItems: "center",
|
|
1563
1579
|
justifyContent: "space-between",
|
|
1580
|
+
// Hit box floor on the pressable header box itself (mobile-first.md); padding alone gave 35px.
|
|
1581
|
+
minHeight: MIN_TARGET_PX,
|
|
1564
1582
|
paddingHorizontal: HEADER_PADDING_H,
|
|
1565
1583
|
paddingVertical: HEADER_PADDING_V
|
|
1566
1584
|
},
|
|
@@ -1938,7 +1956,13 @@ var styles16 = reactNative.StyleSheet.create({
|
|
|
1938
1956
|
fontWeight: "600",
|
|
1939
1957
|
paddingHorizontal: ACTION_PADDING_H,
|
|
1940
1958
|
paddingVertical: ACTION_PADDING_V,
|
|
1941
|
-
borderRadius: ACTION_RADIUS
|
|
1959
|
+
borderRadius: ACTION_RADIUS,
|
|
1960
|
+
// 44x44 hit box on the rendered box (it measured 40x20). `lineHeight` = the floor keeps the
|
|
1961
|
+
// label vertically centred without wrapping the Text in another element.
|
|
1962
|
+
minHeight: MIN_TARGET_PX,
|
|
1963
|
+
minWidth: MIN_TARGET_PX,
|
|
1964
|
+
lineHeight: MIN_TARGET_PX,
|
|
1965
|
+
textAlign: "center"
|
|
1942
1966
|
}
|
|
1943
1967
|
});
|
|
1944
1968
|
var TONE_STEP = "500";
|
|
@@ -2097,14 +2121,17 @@ exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
|
2097
2121
|
exports.DropdownVariant = DropdownVariant;
|
|
2098
2122
|
exports.ELLIPSIS = ELLIPSIS;
|
|
2099
2123
|
exports.Heading = Heading;
|
|
2124
|
+
exports.LAYOUT_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
2100
2125
|
exports.LAYOUT_I18N = LAYOUT_I18N;
|
|
2101
2126
|
exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
2127
|
+
exports.MIN_TARGET_PX = MIN_TARGET_PX;
|
|
2102
2128
|
exports.Modal = Modal3;
|
|
2103
2129
|
exports.ModalDropdown = ModalDropdown;
|
|
2104
2130
|
exports.ModalShell = ModalShell;
|
|
2105
2131
|
exports.Section = Section;
|
|
2106
2132
|
exports.SegmentedControl = SegmentedControl;
|
|
2107
2133
|
exports.StatusBadge = StatusBadge;
|
|
2134
|
+
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
2108
2135
|
exports.Tabs = Tabs;
|
|
2109
2136
|
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
2110
2137
|
exports.TruncatedText = TruncatedText;
|
|
@@ -2112,6 +2139,7 @@ exports.UpgradePrompt = UpgradePrompt;
|
|
|
2112
2139
|
exports.copyText = copyText;
|
|
2113
2140
|
exports.formatBuildInfo = formatBuildInfo;
|
|
2114
2141
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2142
|
+
exports.isWideWebViewport = isWideWebViewport;
|
|
2115
2143
|
exports.shortenCommit = shortenCommit;
|
|
2116
2144
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
2117
2145
|
exports.truncateMiddle = truncateMiddle;
|