@dloizides/ui-layout 1.26.3 → 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 +23 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -10
- 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",
|
|
@@ -144,11 +147,14 @@ var styles3 = reactNative.StyleSheet.create({
|
|
|
144
147
|
paddingHorizontal: DEFAULT_PADDING_H,
|
|
145
148
|
paddingVertical: DEFAULT_PADDING_V,
|
|
146
149
|
borderRadius: DEFAULT_BORDER_RADIUS,
|
|
147
|
-
alignSelf: "flex-start"
|
|
150
|
+
alignSelf: "flex-start",
|
|
151
|
+
// Never wider than the container: a long label wraps inside the pill instead of being clipped.
|
|
152
|
+
maxWidth: "100%"
|
|
148
153
|
},
|
|
149
154
|
text: {
|
|
150
155
|
fontSize: DEFAULT_FONT_SIZE,
|
|
151
|
-
fontWeight: "600"
|
|
156
|
+
fontWeight: "600",
|
|
157
|
+
flexShrink: 1
|
|
152
158
|
}
|
|
153
159
|
});
|
|
154
160
|
var StatusBadge = ({
|
|
@@ -685,12 +691,18 @@ var InlineMenu = ({
|
|
|
685
691
|
if (IS_WEB2) return reactDom.createPortal(menu, document.body);
|
|
686
692
|
return menu;
|
|
687
693
|
};
|
|
688
|
-
|
|
694
|
+
|
|
695
|
+
// src/responsive.ts
|
|
689
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;
|
|
690
703
|
function resolveDropdownVariant(explicit, width, platformOS) {
|
|
691
704
|
if (explicit !== void 0) return explicit;
|
|
692
|
-
|
|
693
|
-
return isWideWeb ? "menu" /* Menu */ : "modal" /* Modal */;
|
|
705
|
+
return isWideWebViewport(width, platformOS, MENU_BREAKPOINT) ? "menu" /* Menu */ : "modal" /* Modal */;
|
|
694
706
|
}
|
|
695
707
|
function useResolvedDropdownVariant(explicit) {
|
|
696
708
|
const { width } = reactNative.useWindowDimensions();
|
|
@@ -958,11 +970,9 @@ var TabsMenu = ({
|
|
|
958
970
|
}
|
|
959
971
|
);
|
|
960
972
|
};
|
|
961
|
-
var TABS_COLLAPSE_BREAKPOINT =
|
|
962
|
-
var WEB_PLATFORM2 = "web";
|
|
973
|
+
var TABS_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
963
974
|
function shouldCollapseTabs(width, platformOS, breakpoint) {
|
|
964
|
-
|
|
965
|
-
return !isWideWeb;
|
|
975
|
+
return !isWideWebViewport(width, platformOS, breakpoint);
|
|
966
976
|
}
|
|
967
977
|
function useTabsCollapsed(breakpoint) {
|
|
968
978
|
const { width } = reactNative.useWindowDimensions();
|
|
@@ -2094,14 +2104,17 @@ exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
|
2094
2104
|
exports.DropdownVariant = DropdownVariant;
|
|
2095
2105
|
exports.ELLIPSIS = ELLIPSIS;
|
|
2096
2106
|
exports.Heading = Heading;
|
|
2107
|
+
exports.LAYOUT_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
2097
2108
|
exports.LAYOUT_I18N = LAYOUT_I18N;
|
|
2098
2109
|
exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
2110
|
+
exports.MIN_TARGET_PX = MIN_TARGET_PX;
|
|
2099
2111
|
exports.Modal = Modal3;
|
|
2100
2112
|
exports.ModalDropdown = ModalDropdown;
|
|
2101
2113
|
exports.ModalShell = ModalShell;
|
|
2102
2114
|
exports.Section = Section;
|
|
2103
2115
|
exports.SegmentedControl = SegmentedControl;
|
|
2104
2116
|
exports.StatusBadge = StatusBadge;
|
|
2117
|
+
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
2105
2118
|
exports.Tabs = Tabs;
|
|
2106
2119
|
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
2107
2120
|
exports.TruncatedText = TruncatedText;
|
|
@@ -2109,6 +2122,7 @@ exports.UpgradePrompt = UpgradePrompt;
|
|
|
2109
2122
|
exports.copyText = copyText;
|
|
2110
2123
|
exports.formatBuildInfo = formatBuildInfo;
|
|
2111
2124
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2125
|
+
exports.isWideWebViewport = isWideWebViewport;
|
|
2112
2126
|
exports.shortenCommit = shortenCommit;
|
|
2113
2127
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
2114
2128
|
exports.truncateMiddle = truncateMiddle;
|