|
| 1 | +// Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | + |
| 3 | +/** |
| 4 | + * @file datePicker.ts |
| 5 | + * @input Nothing; data only |
| 6 | + * @output Exports `datePicker`: the rules UIDatePicker adds to its wheels. The |
| 7 | + * month/year wheels change the date, the AM/PM column follows the hour, a |
| 8 | + * column turns back onto a bound, and a day clamps to its month. |
| 9 | + * @position The date picker domain of the UIKit constants table |
| 10 | + * (motion/uikit), for the date and time touch sheets. Every leaf names its |
| 11 | + * source, which uikit.test.ts checks. |
| 12 | + * |
| 13 | + * SYNC: When modified, update /packages/core/src/motion/MEASUREMENTS.md and |
| 14 | + * /packages/core/src/motion/README.md. |
| 15 | + */ |
| 16 | + |
| 17 | +export const datePicker = { |
| 18 | + calendar: { |
| 19 | + monthYearWheels: { |
| 20 | + /** |
| 21 | + * Turning the month or year wheel changes the picker's date, keeping |
| 22 | + * the day, and fires `valueChanged`. |
| 23 | + * @source measured: UIKit lab, iOS 26.2 simulator, `.date` `.inline`, |
| 24 | + * October 15 → May 15 after the month wheel's fling, with a |
| 25 | + * `valueChanged` carrying May 15, Oct 23 2026 |
| 26 | + */ |
| 27 | + changesDate: true, |
| 28 | + }, |
| 29 | + }, |
| 30 | + wheels: { |
| 31 | + /** |
| 32 | + * In 12-hour time the AM/PM column follows the hour. Turning the hour from |
| 33 | + * 11 to 12 turns the time from AM to PM, and back. From 12 to 1 it keeps |
| 34 | + * the half of the day. |
| 35 | + * @source measured: UIKit lab, iOS 26.2 simulator, `.time` `.wheels`, |
| 36 | + * en_US: 11:58 AM, hour wheel +1 row → `valueChanged` 12:58 PM; then |
| 37 | + * the minute wheel's +4 rows carried the hour from 12 to 1 → 1:02 PM, |
| 38 | + * Oct 23 2026 |
| 39 | + */ |
| 40 | + meridiemFollowsHour: true, |
| 41 | + /** |
| 42 | + * A column that comes to rest past `minimumDate` or `maximumDate` turns |
| 43 | + * back onto the bound. Its `valueChanged` already carries the bound. For |
| 44 | + * example, with bounds 9:00–17:00, the hour of 10:00 dragged to 7 reads |
| 45 | + * 9:00 at rest. The hour column then turns 64 pt, two rows, back to 9. |
| 46 | + * @source measured: UIKit lab, iOS 26.2 simulator, `.time` `.wheels` |
| 47 | + * with bounds 9:00–17:00 and `minuteInterval` 15, per-frame hour |
| 48 | + * offsets after the rest (0.4, 2, 7.4, 16, 26.4, 37.7, 48.3, 56.7, |
| 49 | + * 62, 64 pt at 33 ms steps) and the `valueChanged` time, Oct 23 2026 |
| 50 | + */ |
| 51 | + restPastBound: 'turnToBound', |
| 52 | + /** |
| 53 | + * In `.date` wheels a day the month does not have clamps to the month's |
| 54 | + * last day (January 30, month +1 → February 28). |
| 55 | + * @source measured: UIKit lab, iOS 26.2 simulator, `.date` `.wheels` |
| 56 | + * with bounds Jun 1 2026 – Mar 15 2027, Oct 23 2026 |
| 57 | + */ |
| 58 | + dayClampsToMonth: true, |
| 59 | + }, |
| 60 | +} as const; |
0 commit comments