|
| 1 | +// Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | + |
| 3 | +/** |
| 4 | + * @file pageControl.ts |
| 5 | + * @input Nothing; data only |
| 6 | + * @output Exports `pageControl`: UIPageControl's measured geometry, its |
| 7 | + * default indicator alphas and its tap rule |
| 8 | + * @position The page-control domain of the UIKit constants table |
| 9 | + * (motion/uikit); read by the lab PageControl |
| 10 | + * |
| 11 | + * Every value was read from a stock UIPageControl (default style, default |
| 12 | + * tint) on the iOS 26.2 simulator, iPhone 17 Pro: its frames, |
| 13 | + * `intrinsicContentSize`, `size(forNumberOfPages:)`, the indicator images' |
| 14 | + * rendered pixels, and `valueChanged` under HID touches. Geometry is in |
| 15 | + * points. |
| 16 | + * |
| 17 | + * Every leaf carries one or more `@source`; uikit.test.ts enforces it. |
| 18 | + * |
| 19 | + * SYNC: When modified, update: |
| 20 | + * - /packages/lab/src/PageControl/pageControlModel.ts |
| 21 | + * - /packages/core/src/motion/README.md (domain list) |
| 22 | + */ |
| 23 | + |
| 24 | +/** |
| 25 | + * UIPageControl on iOS 26. |
| 26 | + * @experimental |
| 27 | + */ |
| 28 | +export const pageControl = { |
| 29 | + /** |
| 30 | + * Diameter of one page indicator. |
| 31 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, a |
| 32 | + * 5-page control: indicator dots 9.67 pt (2026-10-23) |
| 33 | + */ |
| 34 | + indicatorSize: 9.67, |
| 35 | + /** |
| 36 | + * Space between neighbouring indicators. |
| 37 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, a |
| 38 | + * 5-page control: the indicator strip is 80.3 pt wide, 5 × 9.67 + 4 × 8 |
| 39 | + * (2026-10-23) |
| 40 | + */ |
| 41 | + indicatorSpacing: 8, |
| 42 | + /** |
| 43 | + * Space between the strip and the control's leading and trailing edges. |
| 44 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, a |
| 45 | + * 5-page control 108.3 pt wide around an 80.3 pt strip (2026-10-23) |
| 46 | + */ |
| 47 | + horizontalPadding: 14, |
| 48 | + /** |
| 49 | + * The control's height. |
| 50 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, |
| 51 | + * intrinsicContentSize 108.3 × 25.67 at 5 pages and 161.3 × 25.67 at 50 |
| 52 | + * (2026-10-23) |
| 53 | + */ |
| 54 | + height: 25.67, |
| 55 | + /** |
| 56 | + * The control is never wider than this, however many pages: past it the |
| 57 | + * indicators scroll in a window (size(forNumberOfPages: 50) is 903.3 pt). |
| 58 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, |
| 59 | + * intrinsicContentSize capped at 161.3 pt wide at 50 pages (2026-10-23) |
| 60 | + */ |
| 61 | + maxWidth: 161.3, |
| 62 | + /** |
| 63 | + * Opacity of the current page's indicator, of the indicator colour. |
| 64 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, the |
| 65 | + * default tint renders the current indicator white α 1 in light and dark |
| 66 | + * (#FFFFFF over black) (2026-10-23) |
| 67 | + */ |
| 68 | + currentIndicatorAlpha: 1, |
| 69 | + /** |
| 70 | + * Opacity of every other page's indicator, of the indicator colour. |
| 71 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, the |
| 72 | + * default tint renders the other indicators white α 0.45 in light and |
| 73 | + * dark (#737373 over black) (2026-10-23) |
| 74 | + */ |
| 75 | + otherIndicatorAlpha: 0.45, |
| 76 | + /** |
| 77 | + * A tap on the trailing side of the current page's indicator moves one |
| 78 | + * page forward, on the leading side one back; the change is reported when |
| 79 | + * the finger lifts. |
| 80 | + * @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, HID taps |
| 81 | + * on a 5-page control: valueChanged at the lift, about 70–90 ms after the |
| 82 | + * touch, one page per tap (2026-10-23) |
| 83 | + */ |
| 84 | + tapStep: 1, |
| 85 | +} as const; |
0 commit comments