@oxy.so/bloom 4.16.1 → 4.18.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/docs/adoption-matrix.mdx +15 -15
- package/docs/app-shell.mdx +3 -2
- package/docs/breadcrumb.mdx +11 -0
- package/docs/button-group.mdx +2 -1
- package/docs/button.mdx +24 -0
- package/docs/cart-panel.mdx +4 -2
- package/docs/checkout-summary.mdx +4 -0
- package/docs/chip.mdx +14 -1
- package/docs/dialog.mdx +5 -4
- package/docs/icons.mdx +53 -0
- package/docs/loading.mdx +11 -0
- package/docs/page-header.mdx +7 -0
- package/docs/price-breakdown.mdx +17 -0
- package/docs/rating.mdx +22 -0
- package/docs/stepper.mdx +25 -0
- package/docs/tabs.mdx +6 -0
- package/lib/commonjs/app-shell/AppShellEngine.js +9 -5
- package/lib/commonjs/app-shell/AppShellEngine.js.map +1 -1
- package/lib/commonjs/breadcrumb/Breadcrumb.js +36 -6
- package/lib/commonjs/breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/commonjs/button/Button.js +7 -4
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/button/Button.web.js +21 -2
- package/lib/commonjs/button/Button.web.js.map +1 -1
- package/lib/commonjs/button-group/ButtonGroup.js +7 -4
- package/lib/commonjs/button-group/ButtonGroup.js.map +1 -1
- package/lib/commonjs/cart-panel/CartLine.js +32 -10
- package/lib/commonjs/cart-panel/CartLine.js.map +1 -1
- package/lib/commonjs/cart-panel/CartPanel.js +3 -0
- package/lib/commonjs/cart-panel/CartPanel.js.map +1 -1
- package/lib/commonjs/cart-panel/shared.js +2 -0
- package/lib/commonjs/cart-panel/shared.js.map +1 -1
- package/lib/commonjs/checkout-summary/CheckoutConfirm.js +11 -1
- package/lib/commonjs/checkout-summary/CheckoutConfirm.js.map +1 -1
- package/lib/commonjs/chip/Chip.js +3 -1
- package/lib/commonjs/chip/Chip.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +15 -6
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +11 -5
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/placement.js +18 -1
- package/lib/commonjs/dialog/placement.js.map +1 -1
- package/lib/commonjs/icons/index.js +8 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/icons/render-icon.js +63 -0
- package/lib/commonjs/icons/render-icon.js.map +1 -0
- package/lib/commonjs/loading/Loading.js +7 -3
- package/lib/commonjs/loading/Loading.js.map +1 -1
- package/lib/commonjs/loading/Loading.web.js +7 -3
- package/lib/commonjs/loading/Loading.web.js.map +1 -1
- package/lib/commonjs/loading/LoadingBase.js +49 -2
- package/lib/commonjs/loading/LoadingBase.js.map +1 -1
- package/lib/commonjs/page-header/PageHeader.js +6 -1
- package/lib/commonjs/page-header/PageHeader.js.map +1 -1
- package/lib/commonjs/price-breakdown/PriceSummary.js +11 -1
- package/lib/commonjs/price-breakdown/PriceSummary.js.map +1 -1
- package/lib/commonjs/price-breakdown/PriceSummaryLine.js +13 -1
- package/lib/commonjs/price-breakdown/PriceSummaryLine.js.map +1 -1
- package/lib/commonjs/rating/Rating.js +90 -4
- package/lib/commonjs/rating/Rating.js.map +1 -1
- package/lib/commonjs/stepper/Stepper.js +18 -5
- package/lib/commonjs/stepper/Stepper.js.map +1 -1
- package/lib/commonjs/tabs/Tabs.js +8 -1
- package/lib/commonjs/tabs/Tabs.js.map +1 -1
- package/lib/module/app-shell/AppShellEngine.js +9 -5
- package/lib/module/app-shell/AppShellEngine.js.map +1 -1
- package/lib/module/breadcrumb/Breadcrumb.js +36 -6
- package/lib/module/breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/module/button/Button.js +7 -4
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/button/Button.web.js +21 -2
- package/lib/module/button/Button.web.js.map +1 -1
- package/lib/module/button-group/ButtonGroup.js +7 -4
- package/lib/module/button-group/ButtonGroup.js.map +1 -1
- package/lib/module/cart-panel/CartLine.js +32 -10
- package/lib/module/cart-panel/CartLine.js.map +1 -1
- package/lib/module/cart-panel/CartPanel.js +3 -0
- package/lib/module/cart-panel/CartPanel.js.map +1 -1
- package/lib/module/cart-panel/shared.js +2 -0
- package/lib/module/cart-panel/shared.js.map +1 -1
- package/lib/module/checkout-summary/CheckoutConfirm.js +11 -1
- package/lib/module/checkout-summary/CheckoutConfirm.js.map +1 -1
- package/lib/module/chip/Chip.js +3 -1
- package/lib/module/chip/Chip.js.map +1 -1
- package/lib/module/dialog/Dialog.js +16 -7
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +12 -6
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/placement.js +17 -1
- package/lib/module/dialog/placement.js.map +1 -1
- package/lib/module/icons/index.js +1 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/icons/render-icon.js +59 -0
- package/lib/module/icons/render-icon.js.map +1 -0
- package/lib/module/loading/Loading.js +8 -4
- package/lib/module/loading/Loading.js.map +1 -1
- package/lib/module/loading/Loading.web.js +8 -4
- package/lib/module/loading/Loading.web.js.map +1 -1
- package/lib/module/loading/LoadingBase.js +49 -3
- package/lib/module/loading/LoadingBase.js.map +1 -1
- package/lib/module/page-header/PageHeader.js +6 -1
- package/lib/module/page-header/PageHeader.js.map +1 -1
- package/lib/module/price-breakdown/PriceSummary.js +11 -1
- package/lib/module/price-breakdown/PriceSummary.js.map +1 -1
- package/lib/module/price-breakdown/PriceSummaryLine.js +13 -1
- package/lib/module/price-breakdown/PriceSummaryLine.js.map +1 -1
- package/lib/module/rating/Rating.js +89 -4
- package/lib/module/rating/Rating.js.map +1 -1
- package/lib/module/stepper/Stepper.js +18 -5
- package/lib/module/stepper/Stepper.js.map +1 -1
- package/lib/module/tabs/Tabs.js +8 -1
- package/lib/module/tabs/Tabs.js.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShellEngine.d.ts.map +1 -1
- package/lib/typescript/commonjs/breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/lib/typescript/commonjs/breadcrumb/types.d.ts +7 -0
- package/lib/typescript/commonjs/breadcrumb/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/types.d.ts +10 -0
- package/lib/typescript/commonjs/button/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/button-group/ButtonGroup.d.ts.map +1 -1
- package/lib/typescript/commonjs/button-group/types.d.ts +9 -0
- package/lib/typescript/commonjs/button-group/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/cart-panel/CartLine.d.ts +10 -5
- package/lib/typescript/commonjs/cart-panel/CartLine.d.ts.map +1 -1
- package/lib/typescript/commonjs/cart-panel/CartPanel.d.ts +1 -1
- package/lib/typescript/commonjs/cart-panel/CartPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/cart-panel/shared.d.ts +1 -1
- package/lib/typescript/commonjs/cart-panel/shared.d.ts.map +1 -1
- package/lib/typescript/commonjs/cart-panel/types.d.ts +18 -0
- package/lib/typescript/commonjs/cart-panel/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkout-summary/CheckoutConfirm.d.ts +4 -1
- package/lib/typescript/commonjs/checkout-summary/CheckoutConfirm.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkout-summary/types.d.ts +6 -0
- package/lib/typescript/commonjs/checkout-summary/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/commonjs/chip/types.d.ts +8 -6
- package/lib/typescript/commonjs/chip/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/placement.d.ts +13 -2
- package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +3 -2
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/index.d.ts +2 -0
- package/lib/typescript/commonjs/icons/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/render-icon.d.ts +55 -0
- package/lib/typescript/commonjs/icons/render-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/loading/Loading.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/Loading.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/LoadingBase.d.ts +18 -0
- package/lib/typescript/commonjs/loading/LoadingBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/types.d.ts +11 -0
- package/lib/typescript/commonjs/loading/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/price-breakdown/PriceSummary.d.ts.map +1 -1
- package/lib/typescript/commonjs/price-breakdown/PriceSummaryLine.d.ts +3 -1
- package/lib/typescript/commonjs/price-breakdown/PriceSummaryLine.d.ts.map +1 -1
- package/lib/typescript/commonjs/price-breakdown/types.d.ts +12 -0
- package/lib/typescript/commonjs/price-breakdown/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/rating/Rating.d.ts +3 -1
- package/lib/typescript/commonjs/rating/Rating.d.ts.map +1 -1
- package/lib/typescript/commonjs/rating/index.d.ts +1 -1
- package/lib/typescript/commonjs/rating/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/rating/types.d.ts +20 -0
- package/lib/typescript/commonjs/rating/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/stepper/Stepper.d.ts +1 -1
- package/lib/typescript/commonjs/stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/commonjs/stepper/types.d.ts +9 -0
- package/lib/typescript/commonjs/stepper/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShellEngine.d.ts.map +1 -1
- package/lib/typescript/module/breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/lib/typescript/module/breadcrumb/types.d.ts +7 -0
- package/lib/typescript/module/breadcrumb/types.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/module/button/types.d.ts +10 -0
- package/lib/typescript/module/button/types.d.ts.map +1 -1
- package/lib/typescript/module/button-group/ButtonGroup.d.ts.map +1 -1
- package/lib/typescript/module/button-group/types.d.ts +9 -0
- package/lib/typescript/module/button-group/types.d.ts.map +1 -1
- package/lib/typescript/module/cart-panel/CartLine.d.ts +10 -5
- package/lib/typescript/module/cart-panel/CartLine.d.ts.map +1 -1
- package/lib/typescript/module/cart-panel/CartPanel.d.ts +1 -1
- package/lib/typescript/module/cart-panel/CartPanel.d.ts.map +1 -1
- package/lib/typescript/module/cart-panel/shared.d.ts +1 -1
- package/lib/typescript/module/cart-panel/shared.d.ts.map +1 -1
- package/lib/typescript/module/cart-panel/types.d.ts +18 -0
- package/lib/typescript/module/cart-panel/types.d.ts.map +1 -1
- package/lib/typescript/module/checkout-summary/CheckoutConfirm.d.ts +4 -1
- package/lib/typescript/module/checkout-summary/CheckoutConfirm.d.ts.map +1 -1
- package/lib/typescript/module/checkout-summary/types.d.ts +6 -0
- package/lib/typescript/module/checkout-summary/types.d.ts.map +1 -1
- package/lib/typescript/module/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/module/chip/types.d.ts +8 -6
- package/lib/typescript/module/chip/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/placement.d.ts +13 -2
- package/lib/typescript/module/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +3 -2
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/icons/index.d.ts +2 -0
- package/lib/typescript/module/icons/index.d.ts.map +1 -1
- package/lib/typescript/module/icons/render-icon.d.ts +55 -0
- package/lib/typescript/module/icons/render-icon.d.ts.map +1 -0
- package/lib/typescript/module/loading/Loading.d.ts.map +1 -1
- package/lib/typescript/module/loading/Loading.web.d.ts.map +1 -1
- package/lib/typescript/module/loading/LoadingBase.d.ts +18 -0
- package/lib/typescript/module/loading/LoadingBase.d.ts.map +1 -1
- package/lib/typescript/module/loading/types.d.ts +11 -0
- package/lib/typescript/module/loading/types.d.ts.map +1 -1
- package/lib/typescript/module/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/module/price-breakdown/PriceSummary.d.ts.map +1 -1
- package/lib/typescript/module/price-breakdown/PriceSummaryLine.d.ts +3 -1
- package/lib/typescript/module/price-breakdown/PriceSummaryLine.d.ts.map +1 -1
- package/lib/typescript/module/price-breakdown/types.d.ts +12 -0
- package/lib/typescript/module/price-breakdown/types.d.ts.map +1 -1
- package/lib/typescript/module/rating/Rating.d.ts +3 -1
- package/lib/typescript/module/rating/Rating.d.ts.map +1 -1
- package/lib/typescript/module/rating/index.d.ts +1 -1
- package/lib/typescript/module/rating/index.d.ts.map +1 -1
- package/lib/typescript/module/rating/types.d.ts +20 -0
- package/lib/typescript/module/rating/types.d.ts.map +1 -1
- package/lib/typescript/module/stepper/Stepper.d.ts +1 -1
- package/lib/typescript/module/stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/module/stepper/types.d.ts +9 -0
- package/lib/typescript/module/stepper/types.d.ts.map +1 -1
- package/lib/typescript/module/tabs/Tabs.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app-shell/AppShellEngine.tsx +9 -5
- package/src/breadcrumb/Breadcrumb.tsx +29 -4
- package/src/breadcrumb/types.ts +7 -0
- package/src/button/Button.tsx +15 -6
- package/src/button/Button.web.tsx +30 -3
- package/src/button/types.ts +10 -0
- package/src/button-group/ButtonGroup.tsx +15 -6
- package/src/button-group/types.ts +9 -0
- package/src/cart-panel/CartLine.tsx +30 -7
- package/src/cart-panel/CartPanel.tsx +3 -0
- package/src/cart-panel/shared.ts +11 -1
- package/src/cart-panel/types.ts +18 -0
- package/src/checkout-summary/CheckoutConfirm.tsx +9 -0
- package/src/checkout-summary/types.ts +6 -0
- package/src/chip/Chip.tsx +3 -1
- package/src/chip/types.ts +8 -6
- package/src/dialog/Dialog.tsx +19 -8
- package/src/dialog/Dialog.web.tsx +15 -7
- package/src/dialog/placement.ts +19 -2
- package/src/dialog/types.ts +3 -2
- package/src/icons/index.ts +2 -0
- package/src/icons/render-icon.tsx +65 -0
- package/src/loading/Loading.tsx +6 -2
- package/src/loading/Loading.web.tsx +6 -2
- package/src/loading/LoadingBase.tsx +55 -5
- package/src/loading/types.ts +11 -0
- package/src/page-header/PageHeader.tsx +6 -1
- package/src/price-breakdown/PriceSummary.tsx +10 -0
- package/src/price-breakdown/PriceSummaryLine.tsx +12 -0
- package/src/price-breakdown/types.ts +12 -0
- package/src/rating/Rating.tsx +87 -3
- package/src/rating/index.ts +1 -0
- package/src/rating/types.ts +21 -0
- package/src/stepper/Stepper.tsx +18 -5
- package/src/stepper/types.ts +9 -0
- package/src/tabs/Tabs.tsx +3 -0
|
@@ -89,6 +89,12 @@ export interface CheckoutConfirmProps {
|
|
|
89
89
|
* press commits to and the press are one decision.
|
|
90
90
|
*/
|
|
91
91
|
amount?: string;
|
|
92
|
+
/**
|
|
93
|
+
* A second, PRE-FORMATTED rendering of `amount` — the buyer's currency beside
|
|
94
|
+
* the shop's, `"≈ 12,00 €"` — drawn de-emphasised, centred under the button.
|
|
95
|
+
* Named like `PriceLine.secondaryAmount`; drawn as given, nothing converts.
|
|
96
|
+
*/
|
|
97
|
+
secondaryAmount?: string;
|
|
92
98
|
/**
|
|
93
99
|
* The terms line under the button — a string, or a node with links in it.
|
|
94
100
|
* `null` draws none.
|
package/src/chip/Chip.tsx
CHANGED
|
@@ -242,8 +242,10 @@ const ChipComponent = forwardRef<View, ChipProps>(function ChipComponent(
|
|
|
242
242
|
// WHICH attribute is a property of the ROLE, not a preference — a `radio`
|
|
243
243
|
// carries `aria-checked` and a `tab` `aria-selected`; `aria-pressed` on
|
|
244
244
|
// either is invalid, and `aria-selected` on a `button` is too.
|
|
245
|
+
// A `checkbox` (a multi-select filter chip) reads `aria-checked` like a
|
|
246
|
+
// `radio`; what differs is that its group allows several at once.
|
|
245
247
|
const stateProps =
|
|
246
|
-
role === 'radio'
|
|
248
|
+
role === 'radio' || role === 'checkbox'
|
|
247
249
|
? { accessibilityState: { checked: selected, disabled }, 'aria-checked': selected }
|
|
248
250
|
: role === 'tab'
|
|
249
251
|
? { accessibilityState: { selected, disabled }, 'aria-selected': selected }
|
package/src/chip/types.ts
CHANGED
|
@@ -26,10 +26,11 @@ export type ChipHue = 'lime' | 'rose' | 'yellow' | 'cyan' | 'blue' | 'purple' |
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* What a pressable chip IS, which decides the state ARIA reads it by:
|
|
29
|
-
* a toggle `button` (`aria-pressed`), a `
|
|
30
|
-
* (`aria-checked`),
|
|
29
|
+
* a toggle `button` (`aria-pressed`), a `checkbox` in a multi-select filter
|
|
30
|
+
* group (`aria-checked`), a `radio` in a radiogroup (`aria-checked`), or a
|
|
31
|
+
* `tab` in a tablist (`aria-selected`).
|
|
31
32
|
*/
|
|
32
|
-
export type ChipRole = 'button' | 'radio' | 'tab';
|
|
33
|
+
export type ChipRole = 'button' | 'checkbox' | 'radio' | 'tab';
|
|
33
34
|
|
|
34
35
|
export interface ChipProps {
|
|
35
36
|
appearance?: BloomAppearance;
|
|
@@ -84,9 +85,10 @@ export interface ChipProps {
|
|
|
84
85
|
selected?: boolean;
|
|
85
86
|
/**
|
|
86
87
|
* What a pressable chip is to assistive technology. Default `button`
|
|
87
|
-
* (`aria-pressed`). Use `
|
|
88
|
-
* `
|
|
89
|
-
* `aria-pressed`
|
|
88
|
+
* (`aria-pressed`). Use `checkbox` for a multi-select filter chip (in a
|
|
89
|
+
* `group`), `radio` inside a `radiogroup` and `tab` inside a `tablist` — the
|
|
90
|
+
* state attribute follows the role, and a `radio` announcing `aria-pressed`
|
|
91
|
+
* is invalid.
|
|
90
92
|
*/
|
|
91
93
|
role?: ChipRole;
|
|
92
94
|
/** Whether the chip is disabled. */
|
package/src/dialog/Dialog.tsx
CHANGED
|
@@ -28,6 +28,7 @@ import Animated, {
|
|
|
28
28
|
import { BottomSheet, type BottomSheetRef } from '../bottom-sheet';
|
|
29
29
|
import { Backdrop, OverlayRoot } from '../overlay';
|
|
30
30
|
import { useTheme } from '../theme/use-theme';
|
|
31
|
+
import { useIsRtl } from '../hooks/use-is-rtl';
|
|
31
32
|
import { bloomShadowStyle } from '../design-tokens/shadows';
|
|
32
33
|
import { StyledView } from '../styles/styled-primitives';
|
|
33
34
|
import { SurfaceLevelProvider } from '../styles/surface-levels';
|
|
@@ -51,6 +52,8 @@ import {
|
|
|
51
52
|
PANEL_RADIUS,
|
|
52
53
|
SIDE_SHEET_MIN_GUTTER,
|
|
53
54
|
useResolvedPlacement,
|
|
55
|
+
physicalDialogSide,
|
|
56
|
+
type DialogSidePlacement,
|
|
54
57
|
} from './placement';
|
|
55
58
|
import type {
|
|
56
59
|
DialogAction,
|
|
@@ -137,9 +140,9 @@ function CenteredOrSideDialog({
|
|
|
137
140
|
containerClassName,
|
|
138
141
|
label,
|
|
139
142
|
children,
|
|
140
|
-
}: Omit<DialogProps, 'placement'> & { placement: 'center' |
|
|
143
|
+
}: Omit<DialogProps, 'placement'> & { placement: 'center' | DialogSidePlacement }) {
|
|
141
144
|
const isControlled = controlledOpen !== undefined;
|
|
142
|
-
const isSide = placement
|
|
145
|
+
const isSide = placement !== 'center';
|
|
143
146
|
const headerController = useDialogHeaderController();
|
|
144
147
|
const scrollableResolved = scrollable ?? true;
|
|
145
148
|
const { height: viewportHeight } = useWindowDimensions();
|
|
@@ -422,7 +425,7 @@ function SideSheet({
|
|
|
422
425
|
}: {
|
|
423
426
|
open: boolean;
|
|
424
427
|
onDismiss: () => void;
|
|
425
|
-
side:
|
|
428
|
+
side: DialogSidePlacement;
|
|
426
429
|
width: number;
|
|
427
430
|
inset?: DialogInset;
|
|
428
431
|
dismissOnBackdrop: boolean;
|
|
@@ -453,8 +456,16 @@ function SideSheet({
|
|
|
453
456
|
const insetBottom = inset?.bottom ?? 0;
|
|
454
457
|
const insetLeft = inset?.left ?? 0;
|
|
455
458
|
const insetRight = inset?.right ?? 0;
|
|
456
|
-
|
|
457
|
-
|
|
459
|
+
// `start`/`end` resolve to the physical edge they land on for everything a
|
|
460
|
+
// layout engine does not mirror: the slide sign, and which `inset` applies.
|
|
461
|
+
const rtl = useIsRtl();
|
|
462
|
+
const edge = physicalDialogSide(side, rtl);
|
|
463
|
+
// The POSITION of a logical placement is a logical key, resolved by Yoga
|
|
464
|
+
// against `I18nManager` — a physical `left`/`right` here would be swapped by
|
|
465
|
+
// React Native's default `swapLeftAndRightInRTL` and land on the wrong edge.
|
|
466
|
+
const anchorKey = side === 'start' ? 'insetInlineStart' : side === 'end' ? 'insetInlineEnd' : side;
|
|
467
|
+
const anchorInset = edge === 'left' ? insetLeft : insetRight;
|
|
468
|
+
const oppositeInset = edge === 'left' ? insetRight : insetLeft;
|
|
458
469
|
|
|
459
470
|
const sideWidth = useMemo(() => {
|
|
460
471
|
const available = viewportWidth - anchorInset - oppositeInset - SIDE_SHEET_MIN_GUTTER;
|
|
@@ -491,7 +502,7 @@ function SideSheet({
|
|
|
491
502
|
if (dismissOnBackdrop) onDismiss();
|
|
492
503
|
}, [dismissOnBackdrop, onDismiss]);
|
|
493
504
|
|
|
494
|
-
const hiddenSign =
|
|
505
|
+
const hiddenSign = edge === 'left' ? -1 : 1;
|
|
495
506
|
const panelAnimatedStyle = useAnimatedStyle(() => {
|
|
496
507
|
const hidden = 1 - progress.value;
|
|
497
508
|
return {
|
|
@@ -513,11 +524,11 @@ function SideSheet({
|
|
|
513
524
|
({
|
|
514
525
|
top: insetTop,
|
|
515
526
|
bottom: insetBottom,
|
|
516
|
-
[
|
|
527
|
+
[anchorKey]: anchorInset,
|
|
517
528
|
width: sideWidth,
|
|
518
529
|
borderRadius: PANEL_RADIUS,
|
|
519
530
|
}),
|
|
520
|
-
[insetTop, insetBottom,
|
|
531
|
+
[insetTop, insetBottom, anchorKey, anchorInset, sideWidth],
|
|
521
532
|
);
|
|
522
533
|
|
|
523
534
|
if (!mounted) return null;
|
|
@@ -45,6 +45,7 @@ import { Z_INDEX } from '../styles/z-index';
|
|
|
45
45
|
import { WEB_POSITION_FIXED, type WebCssStyle } from '../styles/web-view-style';
|
|
46
46
|
import { bloomShadowStyle } from '../design-tokens/shadows';
|
|
47
47
|
import { useTheme } from '../theme/use-theme';
|
|
48
|
+
import { useIsRtl } from '../hooks/use-is-rtl';
|
|
48
49
|
import { Context, useDialogContext, useDialogControl } from './context';
|
|
49
50
|
import { DialogBody } from './DialogContent';
|
|
50
51
|
import { DialogBottomSheet } from './DialogBottomSheet';
|
|
@@ -69,6 +70,8 @@ import {
|
|
|
69
70
|
PANEL_RADIUS,
|
|
70
71
|
SIDE_SHEET_MIN_GUTTER,
|
|
71
72
|
useResolvedPlacement,
|
|
73
|
+
physicalDialogSide,
|
|
74
|
+
type DialogSidePlacement,
|
|
72
75
|
} from './placement';
|
|
73
76
|
import type {
|
|
74
77
|
DialogAction,
|
|
@@ -196,7 +199,7 @@ function CenterOrSideDialog({
|
|
|
196
199
|
containerClassName,
|
|
197
200
|
label,
|
|
198
201
|
children,
|
|
199
|
-
}: Omit<DialogProps, 'placement'> & { placement: 'center' |
|
|
202
|
+
}: Omit<DialogProps, 'placement'> & { placement: 'center' | DialogSidePlacement }) {
|
|
200
203
|
// Inject the required @keyframes on mount (before the panel ever appears —
|
|
201
204
|
// this component renders once with `isOpen=false` prior to opening, so the
|
|
202
205
|
// stylesheet is present by the time the animated surface mounts).
|
|
@@ -647,7 +650,7 @@ function SheetSurface({
|
|
|
647
650
|
actions?: DialogAction[];
|
|
648
651
|
header?: DialogProps['header'];
|
|
649
652
|
scrollable?: boolean;
|
|
650
|
-
placement:
|
|
653
|
+
placement: DialogSidePlacement;
|
|
651
654
|
shown: boolean;
|
|
652
655
|
width: number;
|
|
653
656
|
inset?: DialogInset;
|
|
@@ -666,6 +669,7 @@ function SheetSurface({
|
|
|
666
669
|
const descriptionId = useId();
|
|
667
670
|
const headerController = useDialogHeaderController();
|
|
668
671
|
const { width: viewportWidth } = useWindowDimensions();
|
|
672
|
+
const rtl = useIsRtl();
|
|
669
673
|
|
|
670
674
|
// Defer the entry transition by a frame so the start state paints before the
|
|
671
675
|
// browser animates to `shown`. `entered` is false on the first committed
|
|
@@ -707,22 +711,26 @@ function SheetSurface({
|
|
|
707
711
|
const insetBottom = inset?.bottom ?? 0;
|
|
708
712
|
const insetLeft = inset?.left ?? 0;
|
|
709
713
|
const insetRight = inset?.right ?? 0;
|
|
710
|
-
|
|
711
|
-
|
|
714
|
+
// `start`/`end` land on a physical edge read from `useIsRtl()`. The drawer
|
|
715
|
+
// is portaled outside any `dir` context, so react-native-web would resolve
|
|
716
|
+
// a logical key left-to-right; the physical edge is the one that is right.
|
|
717
|
+
const edge = physicalDialogSide(placement, rtl);
|
|
718
|
+
const anchorInset = edge === 'left' ? insetLeft : insetRight;
|
|
719
|
+
const oppositeInset = edge === 'left' ? insetRight : insetLeft;
|
|
712
720
|
const available = viewportWidth - anchorInset - oppositeInset - SIDE_SHEET_MIN_GUTTER;
|
|
713
721
|
const cappedWidth = Math.max(0, Math.min(width, available));
|
|
714
|
-
const hiddenSign =
|
|
722
|
+
const hiddenSign = edge === 'left' ? '-100%' : '100%';
|
|
715
723
|
|
|
716
724
|
return {
|
|
717
725
|
top: insetTop,
|
|
718
726
|
bottom: insetBottom,
|
|
719
|
-
[
|
|
727
|
+
[edge]: anchorInset,
|
|
720
728
|
width: cappedWidth,
|
|
721
729
|
borderRadius: PANEL_RADIUS,
|
|
722
730
|
transform: [{ translateX: visible ? 0 : hiddenSign }],
|
|
723
731
|
opacity: visible ? 1 : 0,
|
|
724
732
|
};
|
|
725
|
-
}, [visible, placement, width, inset, viewportWidth]);
|
|
733
|
+
}, [visible, placement, rtl, width, inset, viewportWidth]);
|
|
726
734
|
|
|
727
735
|
const handleBackdropPress = useCallback(() => {
|
|
728
736
|
if (dismissOnBackdrop) onDismiss();
|
package/src/dialog/placement.ts
CHANGED
|
@@ -7,10 +7,27 @@ import { BREAKPOINTS } from '../styles/breakpoints';
|
|
|
7
7
|
* Anchor a `<Dialog>` can render against.
|
|
8
8
|
*
|
|
9
9
|
* - `'center'` — the default centered modal card (current behavior).
|
|
10
|
-
* - `'left'` / `'right'` — an anchored side-sheet / drawer.
|
|
10
|
+
* - `'left'` / `'right'` — an anchored side-sheet / drawer on that PHYSICAL edge.
|
|
11
|
+
* - `'start'` / `'end'` — the same drawer on the LOGICAL edge: `start` is the
|
|
12
|
+
* left in a left-to-right layout and the right in a right-to-left one, and it
|
|
13
|
+
* slides in from that edge. Resolved with `useIsRtl()`.
|
|
11
14
|
* - `'bottom'` — a bottom-sheet (drag handle, slide-up).
|
|
12
15
|
*/
|
|
13
|
-
export type DialogPlacement = 'center' | 'left' | 'right' | 'bottom';
|
|
16
|
+
export type DialogPlacement = 'center' | 'left' | 'right' | 'start' | 'end' | 'bottom';
|
|
17
|
+
|
|
18
|
+
/** The four side-sheet placements, physical and logical. */
|
|
19
|
+
export type DialogSidePlacement = 'left' | 'right' | 'start' | 'end';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The PHYSICAL edge a side placement lands on. `left`/`right` are themselves;
|
|
23
|
+
* `start` is `left` left-to-right and `right` right-to-left, `end` the reverse.
|
|
24
|
+
* The panel's `translateX` sign, which no layout engine mirrors, follows this.
|
|
25
|
+
*/
|
|
26
|
+
export function physicalDialogSide(side: DialogSidePlacement, rtl: boolean): 'left' | 'right' {
|
|
27
|
+
if (side === 'start') return rtl ? 'right' : 'left';
|
|
28
|
+
if (side === 'end') return rtl ? 'left' : 'right';
|
|
29
|
+
return side;
|
|
30
|
+
}
|
|
14
31
|
|
|
15
32
|
/**
|
|
16
33
|
* A `<Dialog>` placement that may vary by viewport width.
|
package/src/dialog/types.ts
CHANGED
|
@@ -256,8 +256,9 @@ export type DialogProps = React.PropsWithChildren<{
|
|
|
256
256
|
actions?: DialogAction[];
|
|
257
257
|
/**
|
|
258
258
|
* Surface anchor. Defaults to `'center'` (the centered modal — current
|
|
259
|
-
* behavior). `'left'`/`'right'` render an anchored side-sheet
|
|
260
|
-
*
|
|
259
|
+
* behavior). `'left'`/`'right'` render an anchored side-sheet on that
|
|
260
|
+
* physical edge; `'start'`/`'end'` on the logical edge (mirrored, with its
|
|
261
|
+
* slide-in, in a right-to-left layout); `'bottom'` a bottom-sheet. A responsive map resolves by viewport width, e.g.
|
|
261
262
|
* `{ base: 'bottom', md: 'left' }` (drawer on wide, sheet on narrow).
|
|
262
263
|
*/
|
|
263
264
|
placement?: ResponsiveDialogPlacement;
|
package/src/icons/index.ts
CHANGED
|
@@ -4,5 +4,7 @@
|
|
|
4
4
|
// rewrites an app's imports.
|
|
5
5
|
export type { IconStyle, Props } from './shared';
|
|
6
6
|
export type { BloomIconComponent } from './icon-component';
|
|
7
|
+
export type { BloomIconPaint, BloomIconRenderer } from './render-icon';
|
|
8
|
+
export { resolveIconSlot } from './render-icon';
|
|
7
9
|
export { sizes, useCommonSVGProps } from './shared';
|
|
8
10
|
export * from './remix';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a Bloom component tells an icon slot to draw: the box, and the colour of
|
|
5
|
+
* the glyph in the CURRENT state (rest, hover, pressed, disabled, checked).
|
|
6
|
+
*
|
|
7
|
+
* `color` carries the same value the component would have passed as `fill`. It
|
|
8
|
+
* is spelled `color` because this object is handed to CALLER code, and an app's
|
|
9
|
+
* own icon set almost always names it that.
|
|
10
|
+
*/
|
|
11
|
+
export interface BloomIconPaint {
|
|
12
|
+
size: number;
|
|
13
|
+
color: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A caller-owned glyph that still follows the control's state.
|
|
18
|
+
*
|
|
19
|
+
* Bloom's own icon slots take a {@link BloomIconComponent} and tint it by
|
|
20
|
+
* passing `fill`. An app whose icons paint from a `color` prop — which most app
|
|
21
|
+
* icon sets do — cannot be handed to one of those slots directly: the props
|
|
22
|
+
* have nothing in common, so it does not typecheck, and were it cast it would
|
|
23
|
+
* render at its default size in its default colour, silently.
|
|
24
|
+
*
|
|
25
|
+
* Passing `color` alongside `fill` is not the fix, and deliberately so:
|
|
26
|
+
* `frosted-icon-button/shared.ts` records why — "the prop is not ours to
|
|
27
|
+
* claim", because components use `color` for semantic variants (`color="danger"`).
|
|
28
|
+
*
|
|
29
|
+
* Nor can the function form share the existing prop. A component is a function
|
|
30
|
+
* too, so a slot accepting both could not tell an app's ADAPTER component —
|
|
31
|
+
* `({ width, fill }) => <Glyph size={width} color={fill} />`, which works today
|
|
32
|
+
* and is the documented way to do this — from a paint callback. It would break
|
|
33
|
+
* exactly the callers who already did the right thing. Hence its own prop.
|
|
34
|
+
*
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <ButtonGroupItem
|
|
37
|
+
* iconOnly
|
|
38
|
+
* renderLeadingIcon={({ size, color }) => <AppSearchIcon size={size} color={color} />}
|
|
39
|
+
* accessibilityLabel="Search"
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* This is `GlyphButton`'s `children?: ReactNode | ((foreground: string) => ReactNode)`
|
|
44
|
+
* generalised to the slots that take an icon rather than a child — including
|
|
45
|
+
* its precedence rule: where a family offers both, the renderer wins over the
|
|
46
|
+
* icon component.
|
|
47
|
+
*/
|
|
48
|
+
export type BloomIconRenderer = (paint: BloomIconPaint) => ReactNode;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolve an icon slot that offers both forms.
|
|
52
|
+
*
|
|
53
|
+
* `render` wins when present, matching `GlyphButton`, where the caller-painted
|
|
54
|
+
* glyph wins over `icon`. Returns `null` when neither is set, so a call site
|
|
55
|
+
* stays a single expression.
|
|
56
|
+
*/
|
|
57
|
+
export function resolveIconSlot(
|
|
58
|
+
render: BloomIconRenderer | undefined,
|
|
59
|
+
size: number,
|
|
60
|
+
color: string,
|
|
61
|
+
fallback: () => ReactNode,
|
|
62
|
+
): ReactNode {
|
|
63
|
+
if (render) return render({ size, color });
|
|
64
|
+
return fallback();
|
|
65
|
+
}
|
package/src/loading/Loading.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import { resolveBloomColors } from '../appearance/colors';
|
|
|
18
18
|
import { useBloomAppearance } from '../appearance';
|
|
19
19
|
import { animation } from '../styles/tokens';
|
|
20
20
|
import { useTheme } from '../theme/use-theme';
|
|
21
|
-
import { bindLoading, SIZE_CONFIG, styles } from './LoadingBase';
|
|
21
|
+
import { bindLoading, LoadingRoot, SIZE_CONFIG, styles } from './LoadingBase';
|
|
22
22
|
import { SpinnerIcon } from './SpinnerIcon';
|
|
23
23
|
import type { TopLoadingProps } from './types';
|
|
24
24
|
|
|
@@ -31,6 +31,7 @@ const TopLoading: React.FC<TopLoadingProps> = ({
|
|
|
31
31
|
iconSize,
|
|
32
32
|
heightOffset = 0,
|
|
33
33
|
spinnerIcon,
|
|
34
|
+
accessibilityLabel,
|
|
34
35
|
testID,
|
|
35
36
|
}) => {
|
|
36
37
|
const theme = useTheme();
|
|
@@ -69,7 +70,10 @@ const TopLoading: React.FC<TopLoadingProps> = ({
|
|
|
69
70
|
return (
|
|
70
71
|
<Animated.View style={[styles.topContainer, containerAnimated]} testID={testID}>
|
|
71
72
|
<Animated.View style={[styles.topLoadingView, { height: targetHeight }, innerAnimated, style]}>
|
|
72
|
-
{
|
|
73
|
+
{/* Named only while it is showing: a collapsed bar is not a wait. */}
|
|
74
|
+
<LoadingRoot accessibilityLabel={showLoading ? accessibilityLabel : undefined}>
|
|
75
|
+
{spinnerIcon ?? <SpinnerIcon size={effectiveIconSize} color={spinnerColor} />}
|
|
76
|
+
</LoadingRoot>
|
|
73
77
|
</Animated.View>
|
|
74
78
|
</Animated.View>
|
|
75
79
|
);
|
|
@@ -16,7 +16,7 @@ import { useBloomAppearance } from '../appearance';
|
|
|
16
16
|
import { animation } from '../styles/tokens';
|
|
17
17
|
import type { WebCssStyle } from '../styles/web-view-style';
|
|
18
18
|
import { useTheme } from '../theme/use-theme';
|
|
19
|
-
import { bindLoading, SIZE_CONFIG, styles } from './LoadingBase';
|
|
19
|
+
import { bindLoading, LoadingRoot, SIZE_CONFIG, styles } from './LoadingBase';
|
|
20
20
|
import { SpinnerIcon } from './SpinnerIcon.web';
|
|
21
21
|
import type { TopLoadingProps } from './types';
|
|
22
22
|
|
|
@@ -41,6 +41,7 @@ const TopLoading: React.FC<TopLoadingProps> = ({
|
|
|
41
41
|
iconSize,
|
|
42
42
|
heightOffset = 0,
|
|
43
43
|
spinnerIcon,
|
|
44
|
+
accessibilityLabel,
|
|
44
45
|
testID,
|
|
45
46
|
}) => {
|
|
46
47
|
const theme = useTheme();
|
|
@@ -84,7 +85,10 @@ const TopLoading: React.FC<TopLoadingProps> = ({
|
|
|
84
85
|
style,
|
|
85
86
|
]}
|
|
86
87
|
>
|
|
87
|
-
{
|
|
88
|
+
{/* Named only while it is showing: a collapsed bar is not a wait. */}
|
|
89
|
+
<LoadingRoot accessibilityLabel={showLoading ? accessibilityLabel : undefined}>
|
|
90
|
+
{spinnerIcon ?? <SpinnerIcon size={effectiveIconSize} color={spinnerColor} />}
|
|
91
|
+
</LoadingRoot>
|
|
88
92
|
</View>
|
|
89
93
|
</View>
|
|
90
94
|
);
|
|
@@ -23,7 +23,7 @@ import { normalizeBloomSize } from '../appearance/legacy';
|
|
|
23
23
|
import { resolveBloomColors } from '../appearance/colors';
|
|
24
24
|
import { useBloomAppearance } from '../appearance';
|
|
25
25
|
import React, { memo } from 'react';
|
|
26
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
26
|
+
import { View, Text, StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
|
|
27
27
|
|
|
28
28
|
import { useTheme } from '../theme/use-theme';
|
|
29
29
|
import type {
|
|
@@ -41,6 +41,54 @@ export const SIZE_CONFIG = {
|
|
|
41
41
|
lg: { spinner: 44, text: 16 },
|
|
42
42
|
} as const;
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* The indicator's root: an indeterminate, NAMED `progressbar` when the caller
|
|
46
|
+
* gave `accessibilityLabel`, a plain view (today's behaviour) when not.
|
|
47
|
+
*
|
|
48
|
+
* Flat `aria-*` because react-native-web drops `accessibilityState` /
|
|
49
|
+
* `accessibilityValue`; React Native folds them back. `aria-valuenow` is
|
|
50
|
+
* deliberately absent (`undefined`): that is what makes a progressbar
|
|
51
|
+
* INDETERMINATE in ARIA, and a spinner has no amount done to report. The role
|
|
52
|
+
* is a literal on its own branch so `aria-state-source-census.test.ts` can read
|
|
53
|
+
* it; a computed role would be invisible to it.
|
|
54
|
+
*/
|
|
55
|
+
export function LoadingRoot({
|
|
56
|
+
accessibilityLabel,
|
|
57
|
+
style,
|
|
58
|
+
testID,
|
|
59
|
+
children,
|
|
60
|
+
}: {
|
|
61
|
+
accessibilityLabel?: string;
|
|
62
|
+
style?: StyleProp<ViewStyle>;
|
|
63
|
+
testID?: string;
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
}) {
|
|
66
|
+
if (accessibilityLabel) {
|
|
67
|
+
return (
|
|
68
|
+
<View
|
|
69
|
+
role="progressbar"
|
|
70
|
+
accessible
|
|
71
|
+
accessibilityLabel={accessibilityLabel}
|
|
72
|
+
aria-valuemin={0}
|
|
73
|
+
aria-valuemax={100}
|
|
74
|
+
aria-valuenow={undefined}
|
|
75
|
+
aria-busy
|
|
76
|
+
style={style}
|
|
77
|
+
testID={testID}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</View>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
// Nothing to carry (the `top` variant's inner slot): no extra node at all.
|
|
84
|
+
if (style === undefined && testID === undefined) return <>{children}</>;
|
|
85
|
+
return (
|
|
86
|
+
<View style={style} testID={testID}>
|
|
87
|
+
{children}
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
44
92
|
/** The two platform pieces a fork supplies. */
|
|
45
93
|
export interface LoadingPlatform {
|
|
46
94
|
/** Forked: react-native-svg on native, a DOM `<svg>` on web. */
|
|
@@ -61,6 +109,7 @@ export function bindLoading({ SpinnerIcon, TopLoading }: LoadingPlatform) {
|
|
|
61
109
|
showText = true,
|
|
62
110
|
iconSize,
|
|
63
111
|
spinnerIcon,
|
|
112
|
+
accessibilityLabel,
|
|
64
113
|
testID,
|
|
65
114
|
}) => {
|
|
66
115
|
const theme = useTheme();
|
|
@@ -71,7 +120,7 @@ export function bindLoading({ SpinnerIcon, TopLoading }: LoadingPlatform) {
|
|
|
71
120
|
const textColor = color ?? theme.colors.textSecondary;
|
|
72
121
|
|
|
73
122
|
return (
|
|
74
|
-
<
|
|
123
|
+
<LoadingRoot accessibilityLabel={accessibilityLabel} style={[styles.container, style]} testID={testID}>
|
|
75
124
|
{spinnerIcon ?? <SpinnerIcon size={effectiveIconSize} color={spinnerColor} className={className} />}
|
|
76
125
|
{showText && text && (
|
|
77
126
|
<Text
|
|
@@ -84,7 +133,7 @@ export function bindLoading({ SpinnerIcon, TopLoading }: LoadingPlatform) {
|
|
|
84
133
|
{text}
|
|
85
134
|
</Text>
|
|
86
135
|
)}
|
|
87
|
-
</
|
|
136
|
+
</LoadingRoot>
|
|
88
137
|
);
|
|
89
138
|
};
|
|
90
139
|
|
|
@@ -96,6 +145,7 @@ export function bindLoading({ SpinnerIcon, TopLoading }: LoadingPlatform) {
|
|
|
96
145
|
style,
|
|
97
146
|
textStyle,
|
|
98
147
|
spinnerIcon,
|
|
148
|
+
accessibilityLabel,
|
|
99
149
|
testID,
|
|
100
150
|
}) => {
|
|
101
151
|
const theme = useTheme();
|
|
@@ -105,7 +155,7 @@ export function bindLoading({ SpinnerIcon, TopLoading }: LoadingPlatform) {
|
|
|
105
155
|
const textColor = theme.colors.textSecondary;
|
|
106
156
|
|
|
107
157
|
return (
|
|
108
|
-
<
|
|
158
|
+
<LoadingRoot accessibilityLabel={accessibilityLabel} style={[styles.inlineContainer, style]} testID={testID}>
|
|
109
159
|
{spinnerIcon ?? <SpinnerIcon size={sizeConfig.spinner} color={spinnerColor} />}
|
|
110
160
|
{text && (
|
|
111
161
|
<Text
|
|
@@ -117,7 +167,7 @@ export function bindLoading({ SpinnerIcon, TopLoading }: LoadingPlatform) {
|
|
|
117
167
|
{text}
|
|
118
168
|
</Text>
|
|
119
169
|
)}
|
|
120
|
-
</
|
|
170
|
+
</LoadingRoot>
|
|
121
171
|
);
|
|
122
172
|
};
|
|
123
173
|
|
package/src/loading/types.ts
CHANGED
|
@@ -20,6 +20,17 @@ interface BaseLoadingProps {
|
|
|
20
20
|
style?: ViewStyle;
|
|
21
21
|
/** Whether loading is active (for animated variants) */
|
|
22
22
|
showLoading?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Names the indicator and makes it an indeterminate `progressbar` to
|
|
25
|
+
* assistive technology (`role="progressbar"` with `aria-label` and
|
|
26
|
+
* `aria-busy` on web; the same role, label and busy state natively). A
|
|
27
|
+
* spinner draws no words, so nothing else can say what is loading.
|
|
28
|
+
*
|
|
29
|
+
* Opt-in: without it the indicator carries no role, as before — which is
|
|
30
|
+
* right when it sits INSIDE a named progressbar already (an upload overlay),
|
|
31
|
+
* where a second one would announce the same wait twice.
|
|
32
|
+
*/
|
|
33
|
+
accessibilityLabel?: string;
|
|
23
34
|
testID?: string;
|
|
24
35
|
}
|
|
25
36
|
|
|
@@ -416,7 +416,12 @@ function PageHeaderComponent({
|
|
|
416
416
|
style={[
|
|
417
417
|
styles.container,
|
|
418
418
|
{ paddingTop: padTop },
|
|
419
|
-
overlay ? [styles.overlay, {
|
|
419
|
+
overlay ? [styles.overlay, {
|
|
420
|
+
zIndex: Z_INDEX.floating,
|
|
421
|
+
// Android's native scroll surfaces also participate in elevation.
|
|
422
|
+
// Keep this local chrome above its sibling list without a portal.
|
|
423
|
+
...(!isWeb ? { elevation: Z_INDEX.floating } : {}),
|
|
424
|
+
}] : null,
|
|
420
425
|
containerWeb,
|
|
421
426
|
placement === 'overlap' ? { marginBottom: -height, zIndex: Z_INDEX.floating } : null,
|
|
422
427
|
style,
|
|
@@ -82,6 +82,7 @@ function PriceSummaryComponent({
|
|
|
82
82
|
label={line.label}
|
|
83
83
|
sublabel={line.sublabel}
|
|
84
84
|
amount={line.amount}
|
|
85
|
+
secondaryAmount={line.secondaryAmount}
|
|
85
86
|
tone={line.tone}
|
|
86
87
|
state={line.state}
|
|
87
88
|
info={line.info}
|
|
@@ -137,6 +138,15 @@ function PriceSummaryComponent({
|
|
|
137
138
|
>
|
|
138
139
|
{total.amount ?? pendingPlaceholder}
|
|
139
140
|
</Text>
|
|
141
|
+
{total.secondaryAmount ? (
|
|
142
|
+
<Text
|
|
143
|
+
variant="body-2-regular"
|
|
144
|
+
testID={testID ? `${testID}-total-secondary-amount` : undefined}
|
|
145
|
+
style={{ color: paint.textSecondary, fontVariant: ['tabular-nums'], textAlign: 'right' }}
|
|
146
|
+
>
|
|
147
|
+
{total.secondaryAmount}
|
|
148
|
+
</Text>
|
|
149
|
+
) : null}
|
|
140
150
|
{totalCaveat ? (
|
|
141
151
|
<Text
|
|
142
152
|
variant="caption-1-regular"
|
|
@@ -27,6 +27,8 @@ import type { PriceSummaryLineProps } from './types';
|
|
|
27
27
|
* state "Estimated" / "Pending" in caption-1 under the amount, so the
|
|
28
28
|
* caveat travels with the NUMBER rather than with the label; the
|
|
29
29
|
* row keeps its own reading order for a screen reader
|
|
30
|
+
* secondary `secondaryAmount` (a second currency) in body-2-regular
|
|
31
|
+
* secondary under the amount, tabular, right-aligned
|
|
30
32
|
* info a 32 round glyph after the label, opening a `Popover`
|
|
31
33
|
* height 32 minimum, whether or not the line has the info affordance
|
|
32
34
|
*
|
|
@@ -38,6 +40,7 @@ function PriceSummaryLineComponent({
|
|
|
38
40
|
label,
|
|
39
41
|
sublabel,
|
|
40
42
|
amount,
|
|
43
|
+
secondaryAmount,
|
|
41
44
|
tone = 'default',
|
|
42
45
|
state = 'final',
|
|
43
46
|
info,
|
|
@@ -120,6 +123,15 @@ function PriceSummaryLineComponent({
|
|
|
120
123
|
>
|
|
121
124
|
{amount ?? pendingPlaceholder}
|
|
122
125
|
</Text>
|
|
126
|
+
{secondaryAmount ? (
|
|
127
|
+
<Text
|
|
128
|
+
variant="body-2-regular"
|
|
129
|
+
testID={testID ? `${testID}-secondary-amount` : undefined}
|
|
130
|
+
style={{ color: paint.textSecondary, fontVariant: ['tabular-nums'], textAlign: 'right' }}
|
|
131
|
+
>
|
|
132
|
+
{secondaryAmount}
|
|
133
|
+
</Text>
|
|
134
|
+
) : null}
|
|
123
135
|
{caveat ? (
|
|
124
136
|
<Text
|
|
125
137
|
variant="caption-1-regular"
|
|
@@ -32,6 +32,12 @@ export interface PriceLine {
|
|
|
32
32
|
* app owns currency, locale and the minus sign. Omit it for a `pending` line.
|
|
33
33
|
*/
|
|
34
34
|
amount?: string;
|
|
35
|
+
/**
|
|
36
|
+
* A second, PRE-FORMATTED rendering of the same amount, drawn de-emphasised
|
|
37
|
+
* under it — the buyer's currency beside the shop's: `"≈ 12,00 €"`. Like
|
|
38
|
+
* `ListingPriceLine.secondary`, it is drawn as given; nothing converts.
|
|
39
|
+
*/
|
|
40
|
+
secondaryAmount?: string;
|
|
35
41
|
/** Default `default`. */
|
|
36
42
|
tone?: PriceLineTone;
|
|
37
43
|
/** Default `final`. */
|
|
@@ -54,6 +60,12 @@ export interface PriceTotal {
|
|
|
54
60
|
label: string;
|
|
55
61
|
/** PRE-FORMATTED, like every other amount here. */
|
|
56
62
|
amount?: string;
|
|
63
|
+
/**
|
|
64
|
+
* A second, PRE-FORMATTED rendering of the same amount, drawn de-emphasised
|
|
65
|
+
* under it — the buyer's currency beside the shop's: `"≈ 12,00 €"`. Like
|
|
66
|
+
* `ListingPriceLine.secondary`, it is drawn as given; nothing converts.
|
|
67
|
+
*/
|
|
68
|
+
secondaryAmount?: string;
|
|
57
69
|
/** A quieter line under the total — "Includes taxes". */
|
|
58
70
|
note?: string;
|
|
59
71
|
/** Default `final`. */
|