@dloizides/ui-layout 1.26.4 → 1.27.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 +18 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -8
- 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",
|
|
@@ -688,12 +691,18 @@ var InlineMenu = ({
|
|
|
688
691
|
if (IS_WEB2) return reactDom.createPortal(menu, document.body);
|
|
689
692
|
return menu;
|
|
690
693
|
};
|
|
691
|
-
|
|
694
|
+
|
|
695
|
+
// src/responsive.ts
|
|
692
696
|
var WEB_PLATFORM = "web";
|
|
697
|
+
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
698
|
+
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// src/ModalDropdown/resolveDropdownVariant.ts
|
|
702
|
+
var MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
693
703
|
function resolveDropdownVariant(explicit, width, platformOS) {
|
|
694
704
|
if (explicit !== void 0) return explicit;
|
|
695
|
-
|
|
696
|
-
return isWideWeb ? "menu" /* Menu */ : "modal" /* Modal */;
|
|
705
|
+
return isWideWebViewport(width, platformOS, MENU_BREAKPOINT) ? "menu" /* Menu */ : "modal" /* Modal */;
|
|
697
706
|
}
|
|
698
707
|
function useResolvedDropdownVariant(explicit) {
|
|
699
708
|
const { width } = reactNative.useWindowDimensions();
|
|
@@ -961,11 +970,9 @@ var TabsMenu = ({
|
|
|
961
970
|
}
|
|
962
971
|
);
|
|
963
972
|
};
|
|
964
|
-
var TABS_COLLAPSE_BREAKPOINT =
|
|
965
|
-
var WEB_PLATFORM2 = "web";
|
|
973
|
+
var TABS_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
966
974
|
function shouldCollapseTabs(width, platformOS, breakpoint) {
|
|
967
|
-
|
|
968
|
-
return !isWideWeb;
|
|
975
|
+
return !isWideWebViewport(width, platformOS, breakpoint);
|
|
969
976
|
}
|
|
970
977
|
function useTabsCollapsed(breakpoint) {
|
|
971
978
|
const { width } = reactNative.useWindowDimensions();
|
|
@@ -2097,14 +2104,17 @@ exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
|
2097
2104
|
exports.DropdownVariant = DropdownVariant;
|
|
2098
2105
|
exports.ELLIPSIS = ELLIPSIS;
|
|
2099
2106
|
exports.Heading = Heading;
|
|
2107
|
+
exports.LAYOUT_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
2100
2108
|
exports.LAYOUT_I18N = LAYOUT_I18N;
|
|
2101
2109
|
exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
2110
|
+
exports.MIN_TARGET_PX = MIN_TARGET_PX;
|
|
2102
2111
|
exports.Modal = Modal3;
|
|
2103
2112
|
exports.ModalDropdown = ModalDropdown;
|
|
2104
2113
|
exports.ModalShell = ModalShell;
|
|
2105
2114
|
exports.Section = Section;
|
|
2106
2115
|
exports.SegmentedControl = SegmentedControl;
|
|
2107
2116
|
exports.StatusBadge = StatusBadge;
|
|
2117
|
+
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
2108
2118
|
exports.Tabs = Tabs;
|
|
2109
2119
|
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
2110
2120
|
exports.TruncatedText = TruncatedText;
|
|
@@ -2112,6 +2122,7 @@ exports.UpgradePrompt = UpgradePrompt;
|
|
|
2112
2122
|
exports.copyText = copyText;
|
|
2113
2123
|
exports.formatBuildInfo = formatBuildInfo;
|
|
2114
2124
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2125
|
+
exports.isWideWebViewport = isWideWebViewport;
|
|
2115
2126
|
exports.shortenCommit = shortenCommit;
|
|
2116
2127
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
2117
2128
|
exports.truncateMiddle = truncateMiddle;
|