@dloizides/ui-layout 1.43.0 → 1.45.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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.44.0
4
+
5
+ MODC-1 "Module C unified console" (AC-UI-1, AC-UI-7), UI-ATOMIC-1 "Reuse first, extract what is new, layer atom / molecule / organism".
6
+
7
+ - `StatusBadge` takes `tone` (`BadgeTone`: neutral, info, success, warning, danger) with the fill from the theme scale main (or deep) step and the ink from `resolveOnBrand`, so text is >= 4.5:1; `color` / `backgroundColor` are now optional and still win when passed. A tone no theme fill can carry falls back to theme text on the elevated surface. ui-tables `StatusTone` is to map onto `BadgeTone`.
8
+ - New atom `CountBadge`: a count pill capped as `max+` (default 99), hidden at zero unless `showZero`, tone from `BadgeTone`. Plain text, no live region; new i18n key `common.countBadgeLabel` (`{{p1}}` = count).
9
+ - New organism `SplitPanes`: two panes side by side or stacked (`SplitLayout` auto / stack / side); side by side each pane has `minWidth: 0` so its text wraps at 360 (TEXT-FIT-1).
10
+
3
11
  ## 1.39.0
4
12
 
5
13
  INVOICE-6 "Ready-to-send invoice emails with contacts and a sent log", UI-COMPOSE-1 "Extract shared UI from the start": extracted from invoice-web.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { RefObject } from 'react';
2
2
  import { StyleProp, ViewStyle, TextStyle, Text, View } from 'react-native';
3
+ import { UiTheme } from '@dloizides/ui-feedback';
3
4
 
4
5
  declare enum SectionVariant {
5
6
  Panel = "panel",
@@ -81,22 +82,74 @@ interface HeadingProps {
81
82
  }
82
83
  declare const Heading: ({ text, children, level, style, testID, }: HeadingProps) => React.ReactElement;
83
84
 
85
+ declare const enum BadgeTone {
86
+ Neutral = "neutral",
87
+ Info = "info",
88
+ Success = "success",
89
+ Warning = "warning",
90
+ Danger = "danger"
91
+ }
92
+
84
93
  /**
85
- * StatusBadge — unified status pill. Colours are passed in; domain adapters map their
86
- * enums to label/color/backgroundColor.
94
+ * StatusBadge — unified status pill. Colour comes from `tone` (theme scales); raw
95
+ * `color`/`backgroundColor` still win, for existing callers.
87
96
  */
88
97
 
89
98
  interface StatusBadgeProps {
90
99
  label: string;
91
- color: string;
92
- backgroundColor: string;
100
+ tone?: BadgeTone;
101
+ color?: string;
102
+ backgroundColor?: string;
93
103
  icon?: React.ReactNode;
94
104
  dashed?: boolean;
95
105
  testID?: string;
96
106
  accessibilityLabel?: string;
97
107
  accessibilityHint?: string;
98
108
  }
99
- declare const StatusBadge: ({ label, color, backgroundColor, icon, dashed, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
109
+ declare const StatusBadge: ({ label, tone, color: rawColor, backgroundColor: rawBackground, icon, dashed, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
110
+
111
+ interface ToneColors {
112
+ color: string;
113
+ backgroundColor: string;
114
+ }
115
+ /** Fill and ink (>= 4.5:1 on the fill) for a tone; a tone no theme fill can carry falls back to neutral. */
116
+ declare function resolveToneColors(theme: UiTheme, tone: BadgeTone): ToneColors;
117
+
118
+ interface CountBadgeProps {
119
+ count: number;
120
+ max?: number;
121
+ tone?: BadgeTone;
122
+ showZero?: boolean;
123
+ testID?: string;
124
+ accessibilityLabel?: string;
125
+ }
126
+ /** A small count pill (unread, open items); hidden at zero unless `showZero`. */
127
+ declare const CountBadge: ({ count, max, tone, showZero, testID, accessibilityLabel, }: CountBadgeProps) => React.ReactElement | null;
128
+
129
+ /** The text a count badge shows: a whole non-negative count, capped as `max+`. */
130
+ declare function formatCount(count: number, max: number): string;
131
+
132
+ declare const enum SplitLayout {
133
+ Auto = "auto",
134
+ Stack = "stack",
135
+ Side = "side"
136
+ }
137
+
138
+ interface SplitPanesProps {
139
+ start: React.ReactNode;
140
+ end: React.ReactNode;
141
+ layout?: SplitLayout;
142
+ startWeight?: number;
143
+ endWeight?: number;
144
+ gap?: number;
145
+ breakpoint?: number;
146
+ testID?: string;
147
+ }
148
+ /** Two panes; the default Auto stacks below `breakpoint` (phones), pass Side to keep them side by side at 360. */
149
+ declare const SplitPanes: ({ start, end, layout, startWeight, endWeight, gap, breakpoint, testID, }: SplitPanesProps) => React.ReactElement;
150
+
151
+ /** Whether the panes sit side by side: always for Side, never for Stack, from `breakpoint` up for Auto. */
152
+ declare function isSplitSideBySide(layout: SplitLayout, width: number, breakpoint: number): boolean;
100
153
 
101
154
  interface StickyPreviewProps {
102
155
  full: React.ReactNode;
@@ -565,8 +618,12 @@ interface ConfirmDialogProps {
565
618
  initialFocus?: ConfirmDialogFocus;
566
619
  /** Base testID. Default `confirm-dialog`. Confirm is `${testID}-confirm`, Cancel `${testID}-cancel`. */
567
620
  testID?: string;
621
+ /** testID of the Confirm button. Default `${testID}-confirm`. */
622
+ confirmTestID?: string;
623
+ /** testID of the Cancel button. Default `${testID}-cancel`. */
624
+ cancelTestID?: string;
568
625
  }
569
- declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, initialFocus, testID, }: ConfirmDialogProps) => React.ReactElement;
626
+ declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, initialFocus, testID, confirmTestID, cancelTestID, }: ConfirmDialogProps) => React.ReactElement;
570
627
 
571
628
  interface FormDialogProps {
572
629
  visible: boolean;
@@ -922,6 +979,8 @@ declare function useIsWideViewport(breakpoint?: number): boolean;
922
979
  declare const LAYOUT_TEST_IDS: {
923
980
  readonly headingText: "heading-text";
924
981
  readonly statusLabel: "status-label";
982
+ readonly countBadge: "count-badge";
983
+ readonly splitPanes: "split-panes";
925
984
  readonly stickyPreview: "sticky-preview";
926
985
  readonly pageFrame: "page-frame";
927
986
  readonly upgradePrompt: "upgrade-prompt";
@@ -976,6 +1035,7 @@ declare const LAYOUT_I18N: {
976
1035
  readonly accordionToggleHint: "common.accordionToggleHint";
977
1036
  /** Default accessible hint on a `StatusBadge` when the caller supplies none. */
978
1037
  readonly statusBadgeHint: "common.statusBadgeHint";
1038
+ readonly countBadgeLabel: "common.countBadgeLabel";
979
1039
  /** `ModalShell`: accessible name of the dialog when its title is not a plain string. */
980
1040
  readonly dialog: "common.dialog";
981
1041
  /** `ModalShell`: accessible hint on the close button. */
@@ -1115,4 +1175,4 @@ interface RowLook {
1115
1175
  /** Resolves a row's container style and text colours from its selected style and state. */
1116
1176
  declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
1117
1177
 
1118
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, 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, SideSheet, type SideSheetProps, 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, isModalFooterStacked, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
1178
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, CountBadge, type CountBadgeProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, 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, SideSheet, type SideSheetProps, SplitLayout, SplitPanes, type SplitPanesProps, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, type ToneColors, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isSplitSideBySide, isWideWebViewport, pageScale, resolveRowLook, resolveToneColors, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { RefObject } from 'react';
2
2
  import { StyleProp, ViewStyle, TextStyle, Text, View } from 'react-native';
3
+ import { UiTheme } from '@dloizides/ui-feedback';
3
4
 
4
5
  declare enum SectionVariant {
5
6
  Panel = "panel",
@@ -81,22 +82,74 @@ interface HeadingProps {
81
82
  }
82
83
  declare const Heading: ({ text, children, level, style, testID, }: HeadingProps) => React.ReactElement;
83
84
 
85
+ declare const enum BadgeTone {
86
+ Neutral = "neutral",
87
+ Info = "info",
88
+ Success = "success",
89
+ Warning = "warning",
90
+ Danger = "danger"
91
+ }
92
+
84
93
  /**
85
- * StatusBadge — unified status pill. Colours are passed in; domain adapters map their
86
- * enums to label/color/backgroundColor.
94
+ * StatusBadge — unified status pill. Colour comes from `tone` (theme scales); raw
95
+ * `color`/`backgroundColor` still win, for existing callers.
87
96
  */
88
97
 
89
98
  interface StatusBadgeProps {
90
99
  label: string;
91
- color: string;
92
- backgroundColor: string;
100
+ tone?: BadgeTone;
101
+ color?: string;
102
+ backgroundColor?: string;
93
103
  icon?: React.ReactNode;
94
104
  dashed?: boolean;
95
105
  testID?: string;
96
106
  accessibilityLabel?: string;
97
107
  accessibilityHint?: string;
98
108
  }
99
- declare const StatusBadge: ({ label, color, backgroundColor, icon, dashed, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
109
+ declare const StatusBadge: ({ label, tone, color: rawColor, backgroundColor: rawBackground, icon, dashed, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
110
+
111
+ interface ToneColors {
112
+ color: string;
113
+ backgroundColor: string;
114
+ }
115
+ /** Fill and ink (>= 4.5:1 on the fill) for a tone; a tone no theme fill can carry falls back to neutral. */
116
+ declare function resolveToneColors(theme: UiTheme, tone: BadgeTone): ToneColors;
117
+
118
+ interface CountBadgeProps {
119
+ count: number;
120
+ max?: number;
121
+ tone?: BadgeTone;
122
+ showZero?: boolean;
123
+ testID?: string;
124
+ accessibilityLabel?: string;
125
+ }
126
+ /** A small count pill (unread, open items); hidden at zero unless `showZero`. */
127
+ declare const CountBadge: ({ count, max, tone, showZero, testID, accessibilityLabel, }: CountBadgeProps) => React.ReactElement | null;
128
+
129
+ /** The text a count badge shows: a whole non-negative count, capped as `max+`. */
130
+ declare function formatCount(count: number, max: number): string;
131
+
132
+ declare const enum SplitLayout {
133
+ Auto = "auto",
134
+ Stack = "stack",
135
+ Side = "side"
136
+ }
137
+
138
+ interface SplitPanesProps {
139
+ start: React.ReactNode;
140
+ end: React.ReactNode;
141
+ layout?: SplitLayout;
142
+ startWeight?: number;
143
+ endWeight?: number;
144
+ gap?: number;
145
+ breakpoint?: number;
146
+ testID?: string;
147
+ }
148
+ /** Two panes; the default Auto stacks below `breakpoint` (phones), pass Side to keep them side by side at 360. */
149
+ declare const SplitPanes: ({ start, end, layout, startWeight, endWeight, gap, breakpoint, testID, }: SplitPanesProps) => React.ReactElement;
150
+
151
+ /** Whether the panes sit side by side: always for Side, never for Stack, from `breakpoint` up for Auto. */
152
+ declare function isSplitSideBySide(layout: SplitLayout, width: number, breakpoint: number): boolean;
100
153
 
101
154
  interface StickyPreviewProps {
102
155
  full: React.ReactNode;
@@ -565,8 +618,12 @@ interface ConfirmDialogProps {
565
618
  initialFocus?: ConfirmDialogFocus;
566
619
  /** Base testID. Default `confirm-dialog`. Confirm is `${testID}-confirm`, Cancel `${testID}-cancel`. */
567
620
  testID?: string;
621
+ /** testID of the Confirm button. Default `${testID}-confirm`. */
622
+ confirmTestID?: string;
623
+ /** testID of the Cancel button. Default `${testID}-cancel`. */
624
+ cancelTestID?: string;
568
625
  }
569
- declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, initialFocus, testID, }: ConfirmDialogProps) => React.ReactElement;
626
+ declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, initialFocus, testID, confirmTestID, cancelTestID, }: ConfirmDialogProps) => React.ReactElement;
570
627
 
571
628
  interface FormDialogProps {
572
629
  visible: boolean;
@@ -922,6 +979,8 @@ declare function useIsWideViewport(breakpoint?: number): boolean;
922
979
  declare const LAYOUT_TEST_IDS: {
923
980
  readonly headingText: "heading-text";
924
981
  readonly statusLabel: "status-label";
982
+ readonly countBadge: "count-badge";
983
+ readonly splitPanes: "split-panes";
925
984
  readonly stickyPreview: "sticky-preview";
926
985
  readonly pageFrame: "page-frame";
927
986
  readonly upgradePrompt: "upgrade-prompt";
@@ -976,6 +1035,7 @@ declare const LAYOUT_I18N: {
976
1035
  readonly accordionToggleHint: "common.accordionToggleHint";
977
1036
  /** Default accessible hint on a `StatusBadge` when the caller supplies none. */
978
1037
  readonly statusBadgeHint: "common.statusBadgeHint";
1038
+ readonly countBadgeLabel: "common.countBadgeLabel";
979
1039
  /** `ModalShell`: accessible name of the dialog when its title is not a plain string. */
980
1040
  readonly dialog: "common.dialog";
981
1041
  /** `ModalShell`: accessible hint on the close button. */
@@ -1115,4 +1175,4 @@ interface RowLook {
1115
1175
  /** Resolves a row's container style and text colours from its selected style and state. */
1116
1176
  declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
1117
1177
 
1118
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, 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, SideSheet, type SideSheetProps, 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, isModalFooterStacked, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
1178
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, CountBadge, type CountBadgeProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, 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, SideSheet, type SideSheetProps, SplitLayout, SplitPanes, type SplitPanesProps, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, type ToneColors, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isSplitSideBySide, isWideWebViewport, pageScale, resolveRowLook, resolveToneColors, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };