@terreno/ui 58.0.0-beta.3 → 58.0.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 +166 -0
- package/dist/Common.d.ts +5 -0
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +2 -2
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeActionSheet.d.ts.map +1 -1
- package/dist/DateTimeActionSheet.js +13 -23
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/timePickerLayout.d.ts +17 -0
- package/dist/timePickerLayout.d.ts.map +1 -0
- package/dist/timePickerLayout.js +16 -0
- package/dist/timePickerLayout.js.map +1 -0
- package/package.json +3 -11
- package/src/Common.ts +5 -0
- package/src/DataTable.tsx +2 -1
- package/src/DateTimeActionSheet.tsx +17 -43
- package/src/bunSetup.ts +2 -6
- package/src/timePickerLayout.test.ts +29 -0
- package/src/timePickerLayout.ts +33 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// UIPickerView only lays out correctly at its natural heights (~162/180/216pt). A forced
|
|
2
|
+
// 104pt wheel looks fine on the simulator, but on physical devices it can place its labels in
|
|
3
|
+
// the snapped natural-height space while clipping to 104pt, so every label lands outside the
|
|
4
|
+
// clip and the wheel shows empty rows. Android's picker is a dropdown and keeps the compact
|
|
5
|
+
// height.
|
|
6
|
+
const IOS_TIME_PICKER_HEIGHT = 216;
|
|
7
|
+
const COMPACT_TIME_PICKER_HEIGHT = 104;
|
|
8
|
+
|
|
9
|
+
export interface TimePickerLayout {
|
|
10
|
+
height: number;
|
|
11
|
+
/** Set on every platform: an item with no color uses the system label color, which is
|
|
12
|
+
* white on a dark-mode iPhone even when the sheet follows a light app theme. */
|
|
13
|
+
itemColor: string;
|
|
14
|
+
/** iOS-only `itemStyle`; omitted on Android, where it breaks some spinner versions. */
|
|
15
|
+
itemStyle: {fontSize?: number; height: number} | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const getTimePickerLayout = ({
|
|
19
|
+
os,
|
|
20
|
+
textColor,
|
|
21
|
+
fontSize,
|
|
22
|
+
}: {
|
|
23
|
+
os: string;
|
|
24
|
+
textColor: string;
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
}): TimePickerLayout => {
|
|
27
|
+
const height = os === "ios" ? IOS_TIME_PICKER_HEIGHT : COMPACT_TIME_PICKER_HEIGHT;
|
|
28
|
+
return {
|
|
29
|
+
height,
|
|
30
|
+
itemColor: textColor,
|
|
31
|
+
itemStyle: os === "ios" ? {...(fontSize ? {fontSize} : {}), height} : undefined,
|
|
32
|
+
};
|
|
33
|
+
};
|