@dloizides/ui-layout 1.36.1 → 1.37.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.37.0
4
+
5
+ INVOICE-FU-9 "INVOICE-5 shared look leftovers", AC-PAGE-1.
6
+
7
+ - New `PageFrame`: lays children out at a fixed page size (`A4_PAGE` 794x1123 by default, `pageSize` configurable) and scales the page down to the container width, never up, so line breaks match the printed page.
8
+ - New `pageScale` / `scaledFrame` helpers for the scale math.
9
+
3
10
  ## 1.34.0
4
11
 
5
12
  INVOICE-3 "Invoice interface over a user-chosen folder": extracted from invoice-web.
package/dist/index.d.mts CHANGED
@@ -119,6 +119,31 @@ declare function isKeyboardOpen(visibleHeight: number, tallestHeight: number): b
119
119
  /** Tracks the Visual Viewport offset and keyboard state; stays at its initial value where the API is absent. */
120
120
  declare function useVisibleViewport(): VisibleViewport;
121
121
 
122
+ interface PageSize {
123
+ width: number;
124
+ height: number;
125
+ }
126
+ interface ScaledFrame {
127
+ scale: number;
128
+ height: number;
129
+ offsetX: number;
130
+ offsetY: number;
131
+ }
132
+ /** A4 at 96 CSS px per inch: 210 x 297 mm. */
133
+ declare const A4_PAGE: PageSize;
134
+ /** The factor that fits a page of `pageWidth` into `containerWidth`, never above 1; 1 while unmeasured. */
135
+ declare const pageScale: (containerWidth: number, pageWidth: number) => number;
136
+ /** The scale, outer height and the offsets that pin a centre-scaled page to the top-left corner. */
137
+ declare const scaledFrame: (containerWidth: number, page: PageSize) => ScaledFrame;
138
+
139
+ interface PageFrameProps {
140
+ children: React.ReactNode;
141
+ pageSize?: PageSize;
142
+ testID?: string;
143
+ }
144
+ /** Lays children out at a fixed page size and scales the page down to the container width, never up. */
145
+ declare const PageFrame: ({ children, pageSize, testID, }: PageFrameProps) => React.ReactElement;
146
+
122
147
  /**
123
148
  * SegmentedControl — a single rounded pill *track* holding N mutually-exclusive segments
124
149
  * (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised surface
@@ -843,6 +868,7 @@ declare const LAYOUT_TEST_IDS: {
843
868
  readonly headingText: "heading-text";
844
869
  readonly statusLabel: "status-label";
845
870
  readonly stickyPreview: "sticky-preview";
871
+ readonly pageFrame: "page-frame";
846
872
  readonly upgradePrompt: "upgrade-prompt";
847
873
  readonly upgradePromptCta: "upgrade-prompt-cta";
848
874
  readonly upgradePromptDismiss: "upgrade-prompt-dismiss";
@@ -1017,4 +1043,4 @@ interface RowLook {
1017
1043
  /** Resolves a row's container style and text colours from its selected style and state. */
1018
1044
  declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
1019
1045
 
1020
- export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, 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, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isWideWebViewport, resolveRowLook, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
1046
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, 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, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, type PageSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
package/dist/index.d.ts CHANGED
@@ -119,6 +119,31 @@ declare function isKeyboardOpen(visibleHeight: number, tallestHeight: number): b
119
119
  /** Tracks the Visual Viewport offset and keyboard state; stays at its initial value where the API is absent. */
120
120
  declare function useVisibleViewport(): VisibleViewport;
121
121
 
122
+ interface PageSize {
123
+ width: number;
124
+ height: number;
125
+ }
126
+ interface ScaledFrame {
127
+ scale: number;
128
+ height: number;
129
+ offsetX: number;
130
+ offsetY: number;
131
+ }
132
+ /** A4 at 96 CSS px per inch: 210 x 297 mm. */
133
+ declare const A4_PAGE: PageSize;
134
+ /** The factor that fits a page of `pageWidth` into `containerWidth`, never above 1; 1 while unmeasured. */
135
+ declare const pageScale: (containerWidth: number, pageWidth: number) => number;
136
+ /** The scale, outer height and the offsets that pin a centre-scaled page to the top-left corner. */
137
+ declare const scaledFrame: (containerWidth: number, page: PageSize) => ScaledFrame;
138
+
139
+ interface PageFrameProps {
140
+ children: React.ReactNode;
141
+ pageSize?: PageSize;
142
+ testID?: string;
143
+ }
144
+ /** Lays children out at a fixed page size and scales the page down to the container width, never up. */
145
+ declare const PageFrame: ({ children, pageSize, testID, }: PageFrameProps) => React.ReactElement;
146
+
122
147
  /**
123
148
  * SegmentedControl — a single rounded pill *track* holding N mutually-exclusive segments
124
149
  * (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised surface
@@ -843,6 +868,7 @@ declare const LAYOUT_TEST_IDS: {
843
868
  readonly headingText: "heading-text";
844
869
  readonly statusLabel: "status-label";
845
870
  readonly stickyPreview: "sticky-preview";
871
+ readonly pageFrame: "page-frame";
846
872
  readonly upgradePrompt: "upgrade-prompt";
847
873
  readonly upgradePromptCta: "upgrade-prompt-cta";
848
874
  readonly upgradePromptDismiss: "upgrade-prompt-dismiss";
@@ -1017,4 +1043,4 @@ interface RowLook {
1017
1043
  /** Resolves a row's container style and text colours from its selected style and state. */
1018
1044
  declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
1019
1045
 
1020
- export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, 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, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isWideWebViewport, resolveRowLook, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
1046
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, 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, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, type PageSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };