@kanso-labs/react-native-kanso-ui 0.9.0 → 0.11.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/README.md +4 -3
- package/dist/autocomplete/index.js +15 -1
- package/dist/autocomplete/index.js.map +1 -1
- package/dist/button/group.d.ts +5 -0
- package/dist/button/group.js +115 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/index.d.ts +4 -1
- package/dist/button/index.js +44 -22
- package/dist/button/index.js.map +1 -1
- package/dist/button/slots.js +2 -1
- package/dist/button/slots.js.map +1 -1
- package/dist/calendar/index.js +351 -182
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +33 -2
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +5 -0
- package/dist/carousel/arrangement.js +123 -0
- package/dist/carousel/arrangement.js.map +1 -0
- package/dist/chequer/index.js +95 -0
- package/dist/chequer/index.js.map +1 -0
- package/dist/collection/index.d.ts +157 -0
- package/dist/collection/index.js +1358 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color-thumb/index.js +56 -0
- package/dist/color-thumb/index.js.map +1 -0
- package/dist/components/button/index.d.ts +4 -2
- package/dist/components/button/index.js +227 -188
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +87 -0
- package/dist/components/button-group/index.js +275 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +11 -3
- package/dist/components/calendar/index.js +60 -45
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +72 -0
- package/dist/components/carousel/index.js +496 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/checkbox-group/index.d.ts +3 -4
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +4 -1
- package/dist/components/chip/index.js +229 -161
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +85 -0
- package/dist/components/color-area/index.js +630 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-field/index.d.ts +144 -0
- package/dist/components/color-field/index.js +516 -0
- package/dist/components/color-field/index.js.map +1 -0
- package/dist/components/color-picker/index.d.ts +74 -0
- package/dist/components/color-picker/index.js +317 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +82 -0
- package/dist/components/color-slider/index.js +456 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +46 -0
- package/dist/components/color-swatch/index.js +127 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +81 -0
- package/dist/components/color-swatch-picker/index.js +287 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/color-wheel/index.d.ts +71 -0
- package/dist/components/color-wheel/index.js +407 -0
- package/dist/components/color-wheel/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +193 -0
- package/dist/components/combo-box/index.js +616 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +120 -0
- package/dist/components/date-field/index.js +111 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +130 -0
- package/dist/components/date-picker/index.js +310 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +139 -0
- package/dist/components/date-range-picker/index.js +421 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/dialog/index.d.ts +5 -5
- package/dist/components/dialog/index.js +5 -5
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +94 -0
- package/dist/components/disclosure/index.js +365 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +61 -0
- package/dist/components/disclosure-group/index.js +100 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/drop-zone/index.d.ts +113 -0
- package/dist/components/drop-zone/index.js +304 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +1 -1
- package/dist/components/fab/index.js +91 -76
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/form/index.d.ts +3 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +4 -2
- package/dist/components/icon-button/index.js +204 -171
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/list/index.d.ts +15 -158
- package/dist/components/list/index.js +21 -1047
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +73 -0
- package/dist/components/list-box/index.js +82 -0
- package/dist/components/list-box/index.js.map +1 -0
- package/dist/components/loading-indicator/index.d.ts +32 -0
- package/dist/components/loading-indicator/index.js +174 -0
- package/dist/components/loading-indicator/index.js.map +1 -0
- package/dist/components/menu/index.d.ts +3 -3
- package/dist/components/menu/index.js +3 -3
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +117 -0
- package/dist/components/navigation-tree/index.js +135 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/number-field/index.js +132 -143
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +69 -0
- package/dist/components/range-calendar/index.js +144 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/search-view/index.d.ts +79 -0
- package/dist/components/search-view/index.js +571 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/select/index.d.ts +152 -0
- package/dist/components/select/index.js +419 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/sheet/index.d.ts +16 -7
- package/dist/components/sheet/index.js +157 -152
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +111 -0
- package/dist/components/slider/index.js +673 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/split-button/index.d.ts +77 -0
- package/dist/components/split-button/index.js +354 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/table/index.d.ts +391 -0
- package/dist/components/table/index.js +1708 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +196 -0
- package/dist/components/tabs/index.js +1137 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +43 -0
- package/dist/components/time-field/index.js +107 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-picker/index.d.ts +65 -0
- package/dist/components/time-picker/index.js +1168 -0
- package/dist/components/time-picker/index.js.map +1 -0
- package/dist/components/token-field/index.d.ts +105 -0
- package/dist/components/token-field/index.js +574 -0
- package/dist/components/token-field/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +102 -0
- package/dist/components/tooltip/index.js +223 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +112 -0
- package/dist/components/tree/index.js +157 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/disclosure/chevron.js +75 -0
- package/dist/disclosure/chevron.js.map +1 -0
- package/dist/disclosure/index.js +7 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/drop/index.d.ts +54 -0
- package/dist/drop/index.js +161 -0
- package/dist/drop/index.js.map +1 -0
- package/dist/field/chevron.js +74 -0
- package/dist/field/chevron.js.map +1 -0
- package/dist/field/index.d.ts +2 -1
- package/dist/field/index.js +359 -154
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +18 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +107 -0
- package/dist/files/index.js.map +1 -0
- package/dist/form/index.d.ts +5 -2
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +128 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +36 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1734 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +37 -3
- package/dist/index.js +36 -3
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +92 -77
- package/dist/modal/index.js.map +1 -1
- package/dist/number/keyboard.js +16 -0
- package/dist/number/keyboard.js.map +1 -0
- package/dist/overlay/anchored.js +68 -38
- package/dist/overlay/anchored.js.map +1 -1
- package/dist/overlay/keyboard.js +57 -0
- package/dist/overlay/keyboard.js.map +1 -0
- package/dist/overlay/panel.js +173 -19
- package/dist/overlay/panel.js.map +1 -1
- package/dist/overlay/placement.js +13 -1
- package/dist/overlay/placement.js.map +1 -1
- package/dist/picker/index.js +322 -0
- package/dist/picker/index.js.map +1 -0
- package/dist/press/index.d.ts +2 -0
- package/dist/press/index.js +102 -100
- package/dist/press/index.js.map +1 -1
- package/dist/row/index.js +77 -69
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +13 -2
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/field.js +277 -0
- package/dist/segments/field.js.map +1 -0
- package/dist/segments/index.js +574 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +24 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/slider/index.js +145 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/swatch/index.js +56 -0
- package/dist/swatch/index.js.map +1 -0
- package/package.json +11 -2
|
@@ -0,0 +1,1168 @@
|
|
|
1
|
+
import { useTheme } from "../../theme/scope.js";
|
|
2
|
+
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
3
|
+
import { usePressFeedback } from "../../press/index.js";
|
|
4
|
+
import { useTypeRole } from "../../typography/roles.js";
|
|
5
|
+
import { messagesFor } from "../../i18n/index.js";
|
|
6
|
+
import { useLocaleOf } from "../../i18n/provider.js";
|
|
7
|
+
import { ClockGlyph, KeyboardGlyph } from "../../glyphs/index.js";
|
|
8
|
+
import { ButtonSlotContext } from "../../button/slots.js";
|
|
9
|
+
import { Button } from "../button/index.js";
|
|
10
|
+
import { IconButton } from "../icon-button/index.js";
|
|
11
|
+
import { usePanelShown, usePanelStyle } from "../../overlay/panel.js";
|
|
12
|
+
import { ModalWindow, NO_INSETS, insetsOf, panelRoleOf, useModalState } from "../../modal/index.js";
|
|
13
|
+
import { roomOf } from "../../picker/index.js";
|
|
14
|
+
import { DateSegments } from "../../segments/index.js";
|
|
15
|
+
import { SegmentedField } from "../../segments/field.js";
|
|
16
|
+
import { c } from "react/compiler-runtime";
|
|
17
|
+
import { Platform, Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
|
|
18
|
+
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
19
|
+
import { SafeAreaInsetsContext } from "react-native-safe-area-context";
|
|
20
|
+
import { createElement, use, useId, useRef, useState } from "react";
|
|
21
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
import Svg, { Circle, Line } from "react-native-svg";
|
|
23
|
+
import { DateFormatter, Time, getLocalTimeZone, toCalendarDateTime, today } from "@internationalized/date";
|
|
24
|
+
import { Gesture, GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
|
|
25
|
+
import { useOverlayTriggerState } from "react-stately/useOverlayTriggerState";
|
|
26
|
+
import { useTimeFieldState } from "react-stately/useTimeFieldState";
|
|
27
|
+
//#region src/components/time-picker/index.tsx
|
|
28
|
+
const DIAL = 256;
|
|
29
|
+
const CENTRE = DIAL / 2;
|
|
30
|
+
const OUTER_RING = 101;
|
|
31
|
+
const INNER_RING = 64;
|
|
32
|
+
const HANDLE = 24;
|
|
33
|
+
const WIDTH = 328;
|
|
34
|
+
const BOX_HEIGHT = 80;
|
|
35
|
+
const COLON = 24;
|
|
36
|
+
const PERIOD_WIDTH = 52;
|
|
37
|
+
const DIAL_GAP = 36;
|
|
38
|
+
const HEADLINE_GAP = 20;
|
|
39
|
+
const CENTRE_DOT = 4;
|
|
40
|
+
const BETWEEN_DOT = 2;
|
|
41
|
+
const SLOP = 10;
|
|
42
|
+
const BOX_PARTS = /* @__PURE__ */ new Set(["hour", "minute"]);
|
|
43
|
+
const UNDESCRIBED = [];
|
|
44
|
+
const stylesOf = themedStyles(({ colors, radii, shadows, sizing, spacing }) => StyleSheet.create({
|
|
45
|
+
actions: {
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
flexDirection: "row",
|
|
48
|
+
gap: spacing.sm,
|
|
49
|
+
justifyContent: "space-between",
|
|
50
|
+
marginTop: spacing.xl
|
|
51
|
+
},
|
|
52
|
+
box: {
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
backgroundColor: colors.surfaceContainerHighest,
|
|
55
|
+
borderRadius: radii.sm,
|
|
56
|
+
height: BOX_HEIGHT,
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
width: sizing.controlXl
|
|
59
|
+
},
|
|
60
|
+
boxInput: { height: sizing.rowMd },
|
|
61
|
+
boxInputFocused: {
|
|
62
|
+
borderColor: colors.primary,
|
|
63
|
+
borderWidth: 2
|
|
64
|
+
},
|
|
65
|
+
boxSelected: { backgroundColor: colors.primaryContainer },
|
|
66
|
+
boxText: {
|
|
67
|
+
color: colors.onSurface,
|
|
68
|
+
fontVariant: ["tabular-nums"]
|
|
69
|
+
},
|
|
70
|
+
boxTextSelected: { color: colors.onPrimaryContainer },
|
|
71
|
+
buttons: {
|
|
72
|
+
flexDirection: "row",
|
|
73
|
+
gap: spacing.sm
|
|
74
|
+
},
|
|
75
|
+
caption: {
|
|
76
|
+
color: colors.onSurfaceVariant,
|
|
77
|
+
width: sizing.controlXl
|
|
78
|
+
},
|
|
79
|
+
captions: {
|
|
80
|
+
flexDirection: "row",
|
|
81
|
+
gap: COLON,
|
|
82
|
+
marginTop: spacing.sm
|
|
83
|
+
},
|
|
84
|
+
colon: {
|
|
85
|
+
color: colors.onSurface,
|
|
86
|
+
textAlign: "center",
|
|
87
|
+
width: COLON
|
|
88
|
+
},
|
|
89
|
+
container: {
|
|
90
|
+
backgroundColor: colors.surfaceContainerHigh,
|
|
91
|
+
borderRadius: radii.xl,
|
|
92
|
+
boxShadow: shadows.elevation3,
|
|
93
|
+
maxHeight: "100%",
|
|
94
|
+
maxWidth: "100%",
|
|
95
|
+
overflow: "hidden",
|
|
96
|
+
transformOrigin: "center",
|
|
97
|
+
width: WIDTH
|
|
98
|
+
},
|
|
99
|
+
content: { padding: spacing.xl },
|
|
100
|
+
dial: {
|
|
101
|
+
alignSelf: "center",
|
|
102
|
+
...Platform.OS === "web" ? void 0 : { direction: "ltr" },
|
|
103
|
+
height: DIAL,
|
|
104
|
+
marginTop: DIAL_GAP,
|
|
105
|
+
width: DIAL
|
|
106
|
+
},
|
|
107
|
+
dialLabel: {
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
height: 48,
|
|
110
|
+
justifyContent: "center",
|
|
111
|
+
position: "absolute",
|
|
112
|
+
width: 48
|
|
113
|
+
},
|
|
114
|
+
dialLabels: {
|
|
115
|
+
...StyleSheet.absoluteFill,
|
|
116
|
+
pointerEvents: "none"
|
|
117
|
+
},
|
|
118
|
+
dialText: { color: colors.onSurface },
|
|
119
|
+
dialTextSelected: { color: colors.onPrimary },
|
|
120
|
+
headline: {
|
|
121
|
+
color: colors.onSurfaceVariant,
|
|
122
|
+
marginBottom: HEADLINE_GAP
|
|
123
|
+
},
|
|
124
|
+
insetRing: { outlineOffset: -2 },
|
|
125
|
+
layout: {
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
bottom: 0,
|
|
128
|
+
justifyContent: "center",
|
|
129
|
+
left: 0,
|
|
130
|
+
pointerEvents: "box-none",
|
|
131
|
+
position: "absolute",
|
|
132
|
+
right: 0,
|
|
133
|
+
top: 0
|
|
134
|
+
},
|
|
135
|
+
notDrawn: { display: "none" },
|
|
136
|
+
period: {
|
|
137
|
+
borderColor: colors.outline,
|
|
138
|
+
borderRadius: radii.sm,
|
|
139
|
+
borderWidth: 1,
|
|
140
|
+
height: BOX_HEIGHT,
|
|
141
|
+
overflow: "hidden",
|
|
142
|
+
width: PERIOD_WIDTH
|
|
143
|
+
},
|
|
144
|
+
periodDivider: {
|
|
145
|
+
borderTopColor: colors.outline,
|
|
146
|
+
borderTopWidth: 1
|
|
147
|
+
},
|
|
148
|
+
periodHalf: {
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
flexBasis: 0,
|
|
151
|
+
flexGrow: 1,
|
|
152
|
+
justifyContent: "center"
|
|
153
|
+
},
|
|
154
|
+
periodInput: { height: sizing.rowMd },
|
|
155
|
+
periodSelected: { backgroundColor: colors.tertiaryContainer },
|
|
156
|
+
periodText: { color: colors.onSurfaceVariant },
|
|
157
|
+
periodTextSelected: { color: colors.onTertiaryContainer },
|
|
158
|
+
row: {
|
|
159
|
+
alignItems: "flex-start",
|
|
160
|
+
flexDirection: "row",
|
|
161
|
+
gap: spacing.md,
|
|
162
|
+
justifyContent: "center"
|
|
163
|
+
}
|
|
164
|
+
}));
|
|
165
|
+
/**
|
|
166
|
+
* A picked time as the field's state takes it, which is always a date and
|
|
167
|
+
* time: a bare time is put on today, and the field takes the date off again
|
|
168
|
+
* on the way out.
|
|
169
|
+
*/
|
|
170
|
+
function asDateTime(time) {
|
|
171
|
+
return "day" in time ? time : toCalendarDateTime(today(getLocalTimeZone()), time);
|
|
172
|
+
}
|
|
173
|
+
function clockOf({ isDisabled, isOpen, label, onPress, ref }) {
|
|
174
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
175
|
+
"aria-expanded": isOpen,
|
|
176
|
+
"aria-label": label,
|
|
177
|
+
isDisabled,
|
|
178
|
+
onPress,
|
|
179
|
+
ref,
|
|
180
|
+
children: /* @__PURE__ */ jsx(ClockGlyph, {})
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function Dial(t0) {
|
|
184
|
+
const $ = c(49);
|
|
185
|
+
const { draft, locale, onPick, onRelease, part, testID, twelveHour } = t0;
|
|
186
|
+
const theme = useTheme();
|
|
187
|
+
const { colors } = theme;
|
|
188
|
+
const styles = stylesOf(theme);
|
|
189
|
+
const role = useTypeRole("bodyLarge");
|
|
190
|
+
let t1;
|
|
191
|
+
if ($[0] !== onPick || $[1] !== onRelease || $[2] !== testID) {
|
|
192
|
+
t1 = {
|
|
193
|
+
onPick,
|
|
194
|
+
onRelease,
|
|
195
|
+
testID
|
|
196
|
+
};
|
|
197
|
+
$[0] = onPick;
|
|
198
|
+
$[1] = onRelease;
|
|
199
|
+
$[2] = testID;
|
|
200
|
+
$[3] = t1;
|
|
201
|
+
} else t1 = $[3];
|
|
202
|
+
const gesture = useDialGesture(t1);
|
|
203
|
+
const labels = labelsFor(part, draft, locale, twelveHour);
|
|
204
|
+
const between = part === "minute" && draft.minute % 5 !== 0;
|
|
205
|
+
let t2;
|
|
206
|
+
if ($[4] !== draft.hour || $[5] !== draft.minute || $[6] !== part || $[7] !== twelveHour) {
|
|
207
|
+
t2 = part === "minute" ? polar(draft.minute / 60, OUTER_RING) : polar(draft.hour % 12 / 12, !twelveHour && draft.hour >= 12 ? INNER_RING : OUTER_RING);
|
|
208
|
+
$[4] = draft.hour;
|
|
209
|
+
$[5] = draft.minute;
|
|
210
|
+
$[6] = part;
|
|
211
|
+
$[7] = twelveHour;
|
|
212
|
+
$[8] = t2;
|
|
213
|
+
} else t2 = $[8];
|
|
214
|
+
const handle = t2;
|
|
215
|
+
const T0 = GestureHandlerRootView;
|
|
216
|
+
const t3 = styles.dial;
|
|
217
|
+
const T1 = GestureDetector;
|
|
218
|
+
const T2 = View;
|
|
219
|
+
const t4 = true;
|
|
220
|
+
const t5 = testID === void 0 ? void 0 : `${testID}-dial`;
|
|
221
|
+
let t6;
|
|
222
|
+
if ($[9] !== colors.surfaceContainerHighest) {
|
|
223
|
+
t6 = /* @__PURE__ */ jsx(Circle, {
|
|
224
|
+
cx: CENTRE,
|
|
225
|
+
cy: CENTRE,
|
|
226
|
+
fill: colors.surfaceContainerHighest,
|
|
227
|
+
r: CENTRE
|
|
228
|
+
});
|
|
229
|
+
$[9] = colors.surfaceContainerHighest;
|
|
230
|
+
$[10] = t6;
|
|
231
|
+
} else t6 = $[10];
|
|
232
|
+
let t7;
|
|
233
|
+
if ($[11] !== colors.primary || $[12] !== handle.x || $[13] !== handle.y) {
|
|
234
|
+
t7 = /* @__PURE__ */ jsx(Line, {
|
|
235
|
+
stroke: colors.primary,
|
|
236
|
+
strokeWidth: 2,
|
|
237
|
+
x1: CENTRE,
|
|
238
|
+
x2: handle.x,
|
|
239
|
+
y1: CENTRE,
|
|
240
|
+
y2: handle.y
|
|
241
|
+
});
|
|
242
|
+
$[11] = colors.primary;
|
|
243
|
+
$[12] = handle.x;
|
|
244
|
+
$[13] = handle.y;
|
|
245
|
+
$[14] = t7;
|
|
246
|
+
} else t7 = $[14];
|
|
247
|
+
let t8;
|
|
248
|
+
if ($[15] !== colors.primary) {
|
|
249
|
+
t8 = /* @__PURE__ */ jsx(Circle, {
|
|
250
|
+
cx: CENTRE,
|
|
251
|
+
cy: CENTRE,
|
|
252
|
+
fill: colors.primary,
|
|
253
|
+
r: CENTRE_DOT
|
|
254
|
+
});
|
|
255
|
+
$[15] = colors.primary;
|
|
256
|
+
$[16] = t8;
|
|
257
|
+
} else t8 = $[16];
|
|
258
|
+
let t9;
|
|
259
|
+
if ($[17] !== colors.primary || $[18] !== handle.x || $[19] !== handle.y) {
|
|
260
|
+
t9 = /* @__PURE__ */ jsx(Circle, {
|
|
261
|
+
cx: handle.x,
|
|
262
|
+
cy: handle.y,
|
|
263
|
+
fill: colors.primary,
|
|
264
|
+
r: HANDLE
|
|
265
|
+
});
|
|
266
|
+
$[17] = colors.primary;
|
|
267
|
+
$[18] = handle.x;
|
|
268
|
+
$[19] = handle.y;
|
|
269
|
+
$[20] = t9;
|
|
270
|
+
} else t9 = $[20];
|
|
271
|
+
let t10;
|
|
272
|
+
if ($[21] !== between || $[22] !== colors.onPrimary || $[23] !== handle.x || $[24] !== handle.y) {
|
|
273
|
+
t10 = between ? /* @__PURE__ */ jsx(Circle, {
|
|
274
|
+
cx: handle.x,
|
|
275
|
+
cy: handle.y,
|
|
276
|
+
fill: colors.onPrimary,
|
|
277
|
+
r: BETWEEN_DOT
|
|
278
|
+
}) : null;
|
|
279
|
+
$[21] = between;
|
|
280
|
+
$[22] = colors.onPrimary;
|
|
281
|
+
$[23] = handle.x;
|
|
282
|
+
$[24] = handle.y;
|
|
283
|
+
$[25] = t10;
|
|
284
|
+
} else t10 = $[25];
|
|
285
|
+
let t11;
|
|
286
|
+
if ($[26] !== t10 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8 || $[30] !== t9) {
|
|
287
|
+
t11 = /* @__PURE__ */ jsxs(Svg, {
|
|
288
|
+
height: DIAL,
|
|
289
|
+
viewBox: `0 0 ${DIAL} ${DIAL}`,
|
|
290
|
+
width: DIAL,
|
|
291
|
+
children: [
|
|
292
|
+
t6,
|
|
293
|
+
t7,
|
|
294
|
+
t8,
|
|
295
|
+
t9,
|
|
296
|
+
t10
|
|
297
|
+
]
|
|
298
|
+
});
|
|
299
|
+
$[26] = t10;
|
|
300
|
+
$[27] = t6;
|
|
301
|
+
$[28] = t7;
|
|
302
|
+
$[29] = t8;
|
|
303
|
+
$[30] = t9;
|
|
304
|
+
$[31] = t11;
|
|
305
|
+
} else t11 = $[31];
|
|
306
|
+
const T3 = View;
|
|
307
|
+
const t12 = styles.dialLabels;
|
|
308
|
+
const t13 = labels.map((label) => /* @__PURE__ */ jsx(View, {
|
|
309
|
+
style: composeStyles(styles.dialLabel, placeOf(label)),
|
|
310
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
311
|
+
style: composeStyles(role, label.isSelected ? styles.dialTextSelected : styles.dialText),
|
|
312
|
+
children: label.text
|
|
313
|
+
})
|
|
314
|
+
}, label.key));
|
|
315
|
+
let t14;
|
|
316
|
+
if ($[32] !== T3 || $[33] !== styles || $[34] !== t13) {
|
|
317
|
+
t14 = /* @__PURE__ */ jsx(T3, {
|
|
318
|
+
style: t12,
|
|
319
|
+
children: t13
|
|
320
|
+
});
|
|
321
|
+
$[32] = T3;
|
|
322
|
+
$[33] = styles;
|
|
323
|
+
$[34] = t13;
|
|
324
|
+
$[35] = t14;
|
|
325
|
+
} else t14 = $[35];
|
|
326
|
+
let t15;
|
|
327
|
+
if ($[36] !== T2 || $[37] !== t11 || $[38] !== t14 || $[39] !== t5) {
|
|
328
|
+
t15 = /* @__PURE__ */ jsxs(T2, {
|
|
329
|
+
"aria-hidden": t4,
|
|
330
|
+
testID: t5,
|
|
331
|
+
children: [t11, t14]
|
|
332
|
+
});
|
|
333
|
+
$[36] = T2;
|
|
334
|
+
$[37] = t11;
|
|
335
|
+
$[38] = t14;
|
|
336
|
+
$[39] = t5;
|
|
337
|
+
$[40] = t15;
|
|
338
|
+
} else t15 = $[40];
|
|
339
|
+
let t16;
|
|
340
|
+
if ($[41] !== T1 || $[42] !== gesture || $[43] !== t15) {
|
|
341
|
+
t16 = /* @__PURE__ */ jsx(T1, {
|
|
342
|
+
gesture,
|
|
343
|
+
children: t15
|
|
344
|
+
});
|
|
345
|
+
$[41] = T1;
|
|
346
|
+
$[42] = gesture;
|
|
347
|
+
$[43] = t15;
|
|
348
|
+
$[44] = t16;
|
|
349
|
+
} else t16 = $[44];
|
|
350
|
+
let t17;
|
|
351
|
+
if ($[45] !== T0 || $[46] !== styles || $[47] !== t16) {
|
|
352
|
+
t17 = /* @__PURE__ */ jsx(T0, {
|
|
353
|
+
style: t3,
|
|
354
|
+
children: t16
|
|
355
|
+
});
|
|
356
|
+
$[45] = T0;
|
|
357
|
+
$[46] = styles;
|
|
358
|
+
$[47] = t16;
|
|
359
|
+
$[48] = t17;
|
|
360
|
+
} else t17 = $[48];
|
|
361
|
+
return t17;
|
|
362
|
+
}
|
|
363
|
+
/** One label, placed a fraction of a turn round a ring. */
|
|
364
|
+
function dialLabel(key, text, isSelected, turn, radius) {
|
|
365
|
+
const { x, y } = polar(turn, radius);
|
|
366
|
+
return {
|
|
367
|
+
isSelected,
|
|
368
|
+
key,
|
|
369
|
+
text,
|
|
370
|
+
x,
|
|
371
|
+
y
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function drawingOf(styles, role, isDial, shown) {
|
|
375
|
+
const selected = (type, isActive) => isDial ? type === shown : isActive;
|
|
376
|
+
return {
|
|
377
|
+
box: (type, isActive) => composeStyles(styles.box, isDial ? void 0 : styles.boxInput, selected(type, isActive) ? styles.boxSelected : void 0, !isDial && isActive ? styles.boxInputFocused : void 0),
|
|
378
|
+
literal: composeStyles(role, styles.colon),
|
|
379
|
+
parts: BOX_PARTS,
|
|
380
|
+
raisesKeyboard: !isDial,
|
|
381
|
+
text: (type, isActive) => composeStyles(role, styles.boxText, selected(type, isActive) ? styles.boxTextSelected : void 0)
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
/** A part's name as the locale writes it, opening with a capital. */
|
|
385
|
+
function fieldName(name, locale) {
|
|
386
|
+
return name.charAt(0).toLocaleUpperCase(locale) + name.slice(1);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* The time the modal opens on: the field's own, else its placeholder, else
|
|
390
|
+
* midnight. A date and time keeps its date, so the field gets back what it
|
|
391
|
+
* holds.
|
|
392
|
+
*/
|
|
393
|
+
function initialTime(field, placeholderValue) {
|
|
394
|
+
const held = field.value;
|
|
395
|
+
if (held !== null && "hour" in held) return held;
|
|
396
|
+
return placeholderValue ?? new Time();
|
|
397
|
+
}
|
|
398
|
+
/** The labels the dial draws for one part, in the locale's digits. */
|
|
399
|
+
function labelsFor(part, time, locale, twelveHour) {
|
|
400
|
+
const steps = Array.from({ length: 12 }, (_, step) => step);
|
|
401
|
+
if (part === "minute") {
|
|
402
|
+
const digits = new Intl.NumberFormat(locale, { minimumIntegerDigits: 2 });
|
|
403
|
+
return steps.map((step) => dialLabel(`m${step}`, digits.format(step * 5), time.minute === step * 5, step / 12, OUTER_RING));
|
|
404
|
+
}
|
|
405
|
+
const hours = new DateFormatter(locale, {
|
|
406
|
+
hour: "numeric",
|
|
407
|
+
hour12: twelveHour
|
|
408
|
+
});
|
|
409
|
+
if (twelveHour) return steps.map((step) => dialLabel(`h${step}`, partOf(hours, step, "hour"), time.hour % 12 === step, step / 12, OUTER_RING));
|
|
410
|
+
return [...steps.map((step) => dialLabel(`h${step}`, partOf(hours, step, "hour"), time.hour === step, step / 12, OUTER_RING)), ...steps.map((step) => dialLabel(`h${step + 12}`, partOf(hours, step + 12, "hour"), time.hour === step + 12, step / 12, INNER_RING))];
|
|
411
|
+
}
|
|
412
|
+
function ModalContent(t0) {
|
|
413
|
+
const $ = c(57);
|
|
414
|
+
const { cancelLabel, confirmLabel, defaultMode, enterTimeLabel, field, fieldLabel, granularity, headlineId, hourCycle, labelId, locale, motion, onClose, placeholderValue, selectTimeLabel, setHeadline, testID } = t0;
|
|
415
|
+
const theme = useTheme();
|
|
416
|
+
const styles = stylesOf(theme);
|
|
417
|
+
const headlineRole = useTypeRole("labelMedium");
|
|
418
|
+
const captionRole = useTypeRole("bodySmall");
|
|
419
|
+
const dialRole = useTypeRole("displayLarge");
|
|
420
|
+
const inputRole = useTypeRole("displayMedium");
|
|
421
|
+
const words = messagesFor(locale).segments;
|
|
422
|
+
let t1;
|
|
423
|
+
if ($[0] !== field || $[1] !== placeholderValue) {
|
|
424
|
+
t1 = () => initialTime(field, placeholderValue);
|
|
425
|
+
$[0] = field;
|
|
426
|
+
$[1] = placeholderValue;
|
|
427
|
+
$[2] = t1;
|
|
428
|
+
} else t1 = $[2];
|
|
429
|
+
const [draft, setDraft] = useState(t1);
|
|
430
|
+
const [mode, setMode] = useState(defaultMode);
|
|
431
|
+
const [part, setPart] = useState("hour");
|
|
432
|
+
const [content, setContent] = useState(0);
|
|
433
|
+
const [room, setRoom] = useState(0);
|
|
434
|
+
const boxes = useRef(null);
|
|
435
|
+
let t2;
|
|
436
|
+
if ($[3] !== hourCycle || $[4] !== locale) {
|
|
437
|
+
t2 = usesTwelveHours(locale, hourCycle);
|
|
438
|
+
$[3] = hourCycle;
|
|
439
|
+
$[4] = locale;
|
|
440
|
+
$[5] = t2;
|
|
441
|
+
} else t2 = $[5];
|
|
442
|
+
const twelveHour = t2;
|
|
443
|
+
const showsMinutes = granularity === "minute";
|
|
444
|
+
const isDial = mode === "dial";
|
|
445
|
+
const isAfternoon = draft.hour >= 12;
|
|
446
|
+
const headline = isDial ? selectTimeLabel : enterTimeLabel;
|
|
447
|
+
const periods = new DateFormatter(locale, {
|
|
448
|
+
hour: "numeric",
|
|
449
|
+
hour12: true
|
|
450
|
+
});
|
|
451
|
+
let t3;
|
|
452
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
453
|
+
t3 = (next) => {
|
|
454
|
+
if (next !== null) setDraft(next);
|
|
455
|
+
};
|
|
456
|
+
$[6] = t3;
|
|
457
|
+
} else t3 = $[6];
|
|
458
|
+
let t4;
|
|
459
|
+
if ($[7] !== draft || $[8] !== granularity || $[9] !== hourCycle || $[10] !== locale) {
|
|
460
|
+
t4 = {
|
|
461
|
+
granularity,
|
|
462
|
+
hideTimeZone: true,
|
|
463
|
+
hourCycle,
|
|
464
|
+
locale,
|
|
465
|
+
onChange: t3,
|
|
466
|
+
shouldForceLeadingZeros: true,
|
|
467
|
+
value: draft
|
|
468
|
+
};
|
|
469
|
+
$[7] = draft;
|
|
470
|
+
$[8] = granularity;
|
|
471
|
+
$[9] = hourCycle;
|
|
472
|
+
$[10] = locale;
|
|
473
|
+
$[11] = t4;
|
|
474
|
+
} else t4 = $[11];
|
|
475
|
+
const state = useTimeFieldState(t4);
|
|
476
|
+
let t5;
|
|
477
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
478
|
+
t5 = (type) => {
|
|
479
|
+
if (type === "hour" || type === "minute") setPart(type);
|
|
480
|
+
};
|
|
481
|
+
$[12] = t5;
|
|
482
|
+
} else t5 = $[12];
|
|
483
|
+
const follow = t5;
|
|
484
|
+
let t6;
|
|
485
|
+
if ($[13] !== part || $[14] !== twelveHour) {
|
|
486
|
+
t6 = (x, y) => {
|
|
487
|
+
const across = x - CENTRE;
|
|
488
|
+
const down = y - CENTRE;
|
|
489
|
+
const turn = (Math.atan2(across, -down) / (2 * Math.PI) + 1) % 1;
|
|
490
|
+
if (part === "minute") {
|
|
491
|
+
setDraft((time) => time.set({ minute: Math.round(turn * 60) % 60 }));
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const step = Math.round(turn * 12) % 12;
|
|
495
|
+
if (twelveHour) {
|
|
496
|
+
setDraft((time_0) => time_0.set({ hour: step + (time_0.hour >= 12 ? 12 : 0) }));
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
const inner = Math.hypot(across, down) < 165 / 2;
|
|
500
|
+
setDraft((time_1) => time_1.set({ hour: inner ? step + 12 : step }));
|
|
501
|
+
};
|
|
502
|
+
$[13] = part;
|
|
503
|
+
$[14] = twelveHour;
|
|
504
|
+
$[15] = t6;
|
|
505
|
+
} else t6 = $[15];
|
|
506
|
+
const pick = t6;
|
|
507
|
+
let t7;
|
|
508
|
+
if ($[16] !== part || $[17] !== showsMinutes) {
|
|
509
|
+
t7 = () => {
|
|
510
|
+
if (part === "hour" && showsMinutes) {
|
|
511
|
+
setPart("minute");
|
|
512
|
+
boxes.current?.focusOn("minute", false);
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
$[16] = part;
|
|
516
|
+
$[17] = showsMinutes;
|
|
517
|
+
$[18] = t7;
|
|
518
|
+
} else t7 = $[18];
|
|
519
|
+
const release = t7;
|
|
520
|
+
let t8;
|
|
521
|
+
if ($[19] !== isDial || $[20] !== part) {
|
|
522
|
+
t8 = () => {
|
|
523
|
+
setMode(isDial ? "input" : "dial");
|
|
524
|
+
boxes.current?.focusOn(part, isDial);
|
|
525
|
+
};
|
|
526
|
+
$[19] = isDial;
|
|
527
|
+
$[20] = part;
|
|
528
|
+
$[21] = t8;
|
|
529
|
+
} else t8 = $[21];
|
|
530
|
+
const switchMode = t8;
|
|
531
|
+
let t9;
|
|
532
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
533
|
+
t9 = (afternoon) => {
|
|
534
|
+
setDraft((time_2) => time_2.set({ hour: time_2.hour % 12 + (afternoon ? 12 : 0) }));
|
|
535
|
+
};
|
|
536
|
+
$[22] = t9;
|
|
537
|
+
} else t9 = $[22];
|
|
538
|
+
const choosePeriod = t9;
|
|
539
|
+
let t10;
|
|
540
|
+
if ($[23] !== draft || $[24] !== field) {
|
|
541
|
+
t10 = () => {
|
|
542
|
+
field.setValue(asDateTime(draft));
|
|
543
|
+
};
|
|
544
|
+
$[23] = draft;
|
|
545
|
+
$[24] = field;
|
|
546
|
+
$[25] = t10;
|
|
547
|
+
} else t10 = $[25];
|
|
548
|
+
const confirm = t10;
|
|
549
|
+
let t11;
|
|
550
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
551
|
+
t11 = (_, height) => {
|
|
552
|
+
setContent(height);
|
|
553
|
+
};
|
|
554
|
+
$[26] = t11;
|
|
555
|
+
} else t11 = $[26];
|
|
556
|
+
const measureContent = t11;
|
|
557
|
+
let t12;
|
|
558
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
559
|
+
t12 = (event) => {
|
|
560
|
+
setRoom(event.nativeEvent.layout.height);
|
|
561
|
+
};
|
|
562
|
+
$[27] = t12;
|
|
563
|
+
} else t12 = $[27];
|
|
564
|
+
const measureRoom = t12;
|
|
565
|
+
let t13;
|
|
566
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
567
|
+
t13 = panelRoleOf("dialog", void 0);
|
|
568
|
+
$[28] = t13;
|
|
569
|
+
} else t13 = $[28];
|
|
570
|
+
let t14;
|
|
571
|
+
if ($[29] !== draft || $[30] !== isDial || $[31] !== locale || $[32] !== part || $[33] !== pick || $[34] !== release || $[35] !== testID || $[36] !== twelveHour) {
|
|
572
|
+
t14 = isDial ? /* @__PURE__ */ jsx(Dial, {
|
|
573
|
+
draft,
|
|
574
|
+
locale,
|
|
575
|
+
onPick: pick,
|
|
576
|
+
onRelease: release,
|
|
577
|
+
part,
|
|
578
|
+
testID,
|
|
579
|
+
twelveHour
|
|
580
|
+
}) : null;
|
|
581
|
+
$[29] = draft;
|
|
582
|
+
$[30] = isDial;
|
|
583
|
+
$[31] = locale;
|
|
584
|
+
$[32] = part;
|
|
585
|
+
$[33] = pick;
|
|
586
|
+
$[34] = release;
|
|
587
|
+
$[35] = testID;
|
|
588
|
+
$[36] = twelveHour;
|
|
589
|
+
$[37] = t14;
|
|
590
|
+
} else t14 = $[37];
|
|
591
|
+
const t15 = isDial ? enterTimeLabel : selectTimeLabel;
|
|
592
|
+
let t16;
|
|
593
|
+
if ($[38] !== isDial) {
|
|
594
|
+
t16 = isDial ? /* @__PURE__ */ jsx(KeyboardGlyph, {}) : /* @__PURE__ */ jsx(ClockGlyph, {});
|
|
595
|
+
$[38] = isDial;
|
|
596
|
+
$[39] = t16;
|
|
597
|
+
} else t16 = $[39];
|
|
598
|
+
let t17;
|
|
599
|
+
if ($[40] !== switchMode || $[41] !== t15 || $[42] !== t16) {
|
|
600
|
+
t17 = /* @__PURE__ */ jsx(IconButton, {
|
|
601
|
+
"aria-label": t15,
|
|
602
|
+
onPress: switchMode,
|
|
603
|
+
children: t16
|
|
604
|
+
});
|
|
605
|
+
$[40] = switchMode;
|
|
606
|
+
$[41] = t15;
|
|
607
|
+
$[42] = t16;
|
|
608
|
+
$[43] = t17;
|
|
609
|
+
} else t17 = $[43];
|
|
610
|
+
let t18;
|
|
611
|
+
if ($[44] !== cancelLabel) {
|
|
612
|
+
t18 = /* @__PURE__ */ jsx(Button, {
|
|
613
|
+
slot: "close",
|
|
614
|
+
variant: "text",
|
|
615
|
+
children: cancelLabel
|
|
616
|
+
});
|
|
617
|
+
$[44] = cancelLabel;
|
|
618
|
+
$[45] = t18;
|
|
619
|
+
} else t18 = $[45];
|
|
620
|
+
let t19;
|
|
621
|
+
if ($[46] !== confirm || $[47] !== confirmLabel) {
|
|
622
|
+
t19 = /* @__PURE__ */ jsx(Button, {
|
|
623
|
+
onPress: confirm,
|
|
624
|
+
slot: "close",
|
|
625
|
+
variant: "text",
|
|
626
|
+
children: confirmLabel
|
|
627
|
+
});
|
|
628
|
+
$[46] = confirm;
|
|
629
|
+
$[47] = confirmLabel;
|
|
630
|
+
$[48] = t19;
|
|
631
|
+
} else t19 = $[48];
|
|
632
|
+
let t20;
|
|
633
|
+
if ($[49] !== styles.buttons || $[50] !== t18 || $[51] !== t19) {
|
|
634
|
+
t20 = /* @__PURE__ */ jsxs(View, {
|
|
635
|
+
style: styles.buttons,
|
|
636
|
+
children: [t18, t19]
|
|
637
|
+
});
|
|
638
|
+
$[49] = styles.buttons;
|
|
639
|
+
$[50] = t18;
|
|
640
|
+
$[51] = t19;
|
|
641
|
+
$[52] = t20;
|
|
642
|
+
} else t20 = $[52];
|
|
643
|
+
let t21;
|
|
644
|
+
if ($[53] !== styles.actions || $[54] !== t17 || $[55] !== t20) {
|
|
645
|
+
t21 = /* @__PURE__ */ jsxs(View, {
|
|
646
|
+
style: styles.actions,
|
|
647
|
+
children: [t17, t20]
|
|
648
|
+
});
|
|
649
|
+
$[53] = styles.actions;
|
|
650
|
+
$[54] = t17;
|
|
651
|
+
$[55] = t20;
|
|
652
|
+
$[56] = t21;
|
|
653
|
+
} else t21 = $[56];
|
|
654
|
+
return /* @__PURE__ */ jsx(Animated.View, {
|
|
655
|
+
...t13,
|
|
656
|
+
"aria-label": Platform.OS === "web" ? void 0 : `${headline}, ${fieldLabel}`,
|
|
657
|
+
onAccessibilityEscape: onClose,
|
|
658
|
+
style: composeStyles(styles.container, motion),
|
|
659
|
+
testID: testID === void 0 ? void 0 : `${testID}-modal`,
|
|
660
|
+
children: /* @__PURE__ */ jsxs(ScrollView, {
|
|
661
|
+
contentContainerStyle: styles.content,
|
|
662
|
+
onContentSizeChange: measureContent,
|
|
663
|
+
onLayout: measureRoom,
|
|
664
|
+
scrollEnabled: content > room,
|
|
665
|
+
children: [
|
|
666
|
+
/* @__PURE__ */ jsx(Text, {
|
|
667
|
+
nativeID: headlineId,
|
|
668
|
+
ref: setHeadline,
|
|
669
|
+
role: "heading",
|
|
670
|
+
style: composeStyles(headlineRole, styles.headline),
|
|
671
|
+
children: headline
|
|
672
|
+
}),
|
|
673
|
+
Platform.OS === "web" ? /* @__PURE__ */ jsx(Text, {
|
|
674
|
+
nativeID: labelId,
|
|
675
|
+
style: styles.notDrawn,
|
|
676
|
+
children: fieldLabel
|
|
677
|
+
}) : null,
|
|
678
|
+
/* @__PURE__ */ jsxs(View, {
|
|
679
|
+
style: styles.row,
|
|
680
|
+
children: [/* @__PURE__ */ jsxs(View, { children: [/* @__PURE__ */ jsx(DateSegments, {
|
|
681
|
+
described: UNDESCRIBED,
|
|
682
|
+
drawing: drawingOf(styles, isDial ? dialRole : inputRole, isDial, part),
|
|
683
|
+
isInvalid: false,
|
|
684
|
+
label: fieldLabel,
|
|
685
|
+
locale,
|
|
686
|
+
onActiveChange: follow,
|
|
687
|
+
ref: boxes,
|
|
688
|
+
state
|
|
689
|
+
}), isDial ? null : /* @__PURE__ */ jsxs(View, {
|
|
690
|
+
"aria-hidden": true,
|
|
691
|
+
style: styles.captions,
|
|
692
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
693
|
+
style: composeStyles(captionRole, styles.caption),
|
|
694
|
+
children: fieldName(words.hour, locale)
|
|
695
|
+
}), showsMinutes ? /* @__PURE__ */ jsx(Text, {
|
|
696
|
+
style: composeStyles(captionRole, styles.caption),
|
|
697
|
+
children: fieldName(words.minute, locale)
|
|
698
|
+
}) : null]
|
|
699
|
+
})] }), twelveHour ? /* @__PURE__ */ jsxs(View, {
|
|
700
|
+
"aria-label": words.dayPeriod,
|
|
701
|
+
role: "radiogroup",
|
|
702
|
+
style: composeStyles(styles.period, isDial ? void 0 : styles.periodInput),
|
|
703
|
+
children: [/* @__PURE__ */ jsx(PeriodHalf, {
|
|
704
|
+
isAfternoon: false,
|
|
705
|
+
isSelected: !isAfternoon,
|
|
706
|
+
onChoose: choosePeriod,
|
|
707
|
+
text: partOf(periods, 9, "dayPeriod")
|
|
708
|
+
}), /* @__PURE__ */ jsx(PeriodHalf, {
|
|
709
|
+
isAfternoon: true,
|
|
710
|
+
isSelected: isAfternoon,
|
|
711
|
+
onChoose: choosePeriod,
|
|
712
|
+
text: partOf(periods, 21, "dayPeriod")
|
|
713
|
+
})]
|
|
714
|
+
}) : null]
|
|
715
|
+
}),
|
|
716
|
+
t14,
|
|
717
|
+
t21
|
|
718
|
+
]
|
|
719
|
+
})
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
/** The part of a formatted time a formatter writes for one hour of the day. */
|
|
723
|
+
function partOf(format, hour, type) {
|
|
724
|
+
return format.formatToParts(new Date(2e3, 0, 1, hour)).find((each) => each.type === type)?.value ?? String(hour);
|
|
725
|
+
}
|
|
726
|
+
function PeriodHalf(t0) {
|
|
727
|
+
const $ = c(17);
|
|
728
|
+
const { isAfternoon, isSelected, onChoose, text } = t0;
|
|
729
|
+
const theme = useTheme();
|
|
730
|
+
const styles = stylesOf(theme);
|
|
731
|
+
const role = useTypeRole("titleMedium");
|
|
732
|
+
const t1 = isSelected ? theme.colors.onTertiaryContainer : theme.colors.onSurfaceVariant;
|
|
733
|
+
let t2;
|
|
734
|
+
if ($[0] !== t1) {
|
|
735
|
+
t2 = { color: t1 };
|
|
736
|
+
$[0] = t1;
|
|
737
|
+
$[1] = t2;
|
|
738
|
+
} else t2 = $[1];
|
|
739
|
+
const feedback = usePressFeedback(t2);
|
|
740
|
+
let t3;
|
|
741
|
+
if ($[2] !== isAfternoon || $[3] !== onChoose) {
|
|
742
|
+
t3 = () => {
|
|
743
|
+
onChoose(isAfternoon);
|
|
744
|
+
};
|
|
745
|
+
$[2] = isAfternoon;
|
|
746
|
+
$[3] = onChoose;
|
|
747
|
+
$[4] = t3;
|
|
748
|
+
} else t3 = $[4];
|
|
749
|
+
const choose = t3;
|
|
750
|
+
const T0 = Pressable;
|
|
751
|
+
const t4 = "radio";
|
|
752
|
+
const t5 = feedback.handlers;
|
|
753
|
+
const t6 = composeStyles(styles.periodHalf, isAfternoon ? styles.periodDivider : void 0, isSelected ? styles.periodSelected : void 0, feedback.ring, feedback.ring === void 0 ? void 0 : styles.insetRing);
|
|
754
|
+
const t7 = feedback.layer;
|
|
755
|
+
const T1 = Text;
|
|
756
|
+
const t8 = composeStyles(role, isSelected ? styles.periodTextSelected : styles.periodText);
|
|
757
|
+
let t9;
|
|
758
|
+
if ($[5] !== T1 || $[6] !== t8 || $[7] !== text) {
|
|
759
|
+
t9 = /* @__PURE__ */ jsx(T1, {
|
|
760
|
+
style: t8,
|
|
761
|
+
children: text
|
|
762
|
+
});
|
|
763
|
+
$[5] = T1;
|
|
764
|
+
$[6] = t8;
|
|
765
|
+
$[7] = text;
|
|
766
|
+
$[8] = t9;
|
|
767
|
+
} else t9 = $[8];
|
|
768
|
+
let t10;
|
|
769
|
+
if ($[9] !== T0 || $[10] !== choose || $[11] !== feedback.handlers || $[12] !== feedback.layer || $[13] !== isSelected || $[14] !== t6 || $[15] !== t9) {
|
|
770
|
+
t10 = /* @__PURE__ */ jsxs(T0, {
|
|
771
|
+
"aria-checked": isSelected,
|
|
772
|
+
role: t4,
|
|
773
|
+
...t5,
|
|
774
|
+
onPress: choose,
|
|
775
|
+
style: t6,
|
|
776
|
+
children: [t7, t9]
|
|
777
|
+
});
|
|
778
|
+
$[9] = T0;
|
|
779
|
+
$[10] = choose;
|
|
780
|
+
$[11] = feedback.handlers;
|
|
781
|
+
$[12] = feedback.layer;
|
|
782
|
+
$[13] = isSelected;
|
|
783
|
+
$[14] = t6;
|
|
784
|
+
$[15] = t9;
|
|
785
|
+
$[16] = t10;
|
|
786
|
+
} else t10 = $[16];
|
|
787
|
+
return t10;
|
|
788
|
+
}
|
|
789
|
+
function placeOf({ x, y }) {
|
|
790
|
+
return {
|
|
791
|
+
left: x - HANDLE,
|
|
792
|
+
top: y - HANDLE
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
/** Where a fraction of a turn clockwise from twelve lands on a ring. */
|
|
796
|
+
function polar(turn, radius) {
|
|
797
|
+
const angle = turn * 2 * Math.PI;
|
|
798
|
+
return {
|
|
799
|
+
x: CENTRE + radius * Math.sin(angle),
|
|
800
|
+
y: CENTRE - radius * Math.cos(angle)
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* A time typed into a field, or picked in a modal behind the clock button at
|
|
805
|
+
* the field's end: on a dial, or typed into the modal's larger boxes. The
|
|
806
|
+
* value is an `@internationalized/date` value, as on web: pass `value` with
|
|
807
|
+
* `onChange` to control it, or `defaultValue` to let it keep its own.
|
|
808
|
+
*
|
|
809
|
+
* ```tsx
|
|
810
|
+
* import { Time } from '@internationalized/date'
|
|
811
|
+
*
|
|
812
|
+
* <TimePicker defaultValue={new Time(9, 30)} label="Label" />
|
|
813
|
+
* ```
|
|
814
|
+
*
|
|
815
|
+
* The field is TimeField's, so `granularity`, `hourCycle`, `minValue` and
|
|
816
|
+
* `maxValue` behave as they do there. The modal sets hours and minutes and
|
|
817
|
+
* keeps the seconds a value already has; a time it writes back is checked
|
|
818
|
+
* against the bounds as a typed one is. Whether it shows a twelve or
|
|
819
|
+
* twenty-four hour clock is the locale's, through the `I18nProvider`, unless
|
|
820
|
+
* `hourCycle` says otherwise.
|
|
821
|
+
*
|
|
822
|
+
* `style`, `ref` and `testID` land on the field as a whole.
|
|
823
|
+
*/
|
|
824
|
+
function TimePicker(t0) {
|
|
825
|
+
const $ = c(62);
|
|
826
|
+
let cancelLabel;
|
|
827
|
+
let confirmLabel;
|
|
828
|
+
let defaultOpen;
|
|
829
|
+
let enterTimeLabel;
|
|
830
|
+
let isOpen;
|
|
831
|
+
let locale;
|
|
832
|
+
let onOpenChange;
|
|
833
|
+
let props;
|
|
834
|
+
let selectTimeLabel;
|
|
835
|
+
let t1;
|
|
836
|
+
let t2;
|
|
837
|
+
let t3;
|
|
838
|
+
let t4;
|
|
839
|
+
if ($[0] !== t0) {
|
|
840
|
+
({cancelLabel, confirmLabel, defaultMode: t1, defaultOpen, enterTimeLabel, isDisabled: t2, isOpen, isReadOnly: t3, isRequired: t4, locale, onOpenChange, selectTimeLabel, ...props} = t0);
|
|
841
|
+
$[0] = t0;
|
|
842
|
+
$[1] = cancelLabel;
|
|
843
|
+
$[2] = confirmLabel;
|
|
844
|
+
$[3] = defaultOpen;
|
|
845
|
+
$[4] = enterTimeLabel;
|
|
846
|
+
$[5] = isOpen;
|
|
847
|
+
$[6] = locale;
|
|
848
|
+
$[7] = onOpenChange;
|
|
849
|
+
$[8] = props;
|
|
850
|
+
$[9] = selectTimeLabel;
|
|
851
|
+
$[10] = t1;
|
|
852
|
+
$[11] = t2;
|
|
853
|
+
$[12] = t3;
|
|
854
|
+
$[13] = t4;
|
|
855
|
+
} else {
|
|
856
|
+
cancelLabel = $[1];
|
|
857
|
+
confirmLabel = $[2];
|
|
858
|
+
defaultOpen = $[3];
|
|
859
|
+
enterTimeLabel = $[4];
|
|
860
|
+
isOpen = $[5];
|
|
861
|
+
locale = $[6];
|
|
862
|
+
onOpenChange = $[7];
|
|
863
|
+
props = $[8];
|
|
864
|
+
selectTimeLabel = $[9];
|
|
865
|
+
t1 = $[10];
|
|
866
|
+
t2 = $[11];
|
|
867
|
+
t3 = $[12];
|
|
868
|
+
t4 = $[13];
|
|
869
|
+
}
|
|
870
|
+
const defaultMode = t1 === void 0 ? "dial" : t1;
|
|
871
|
+
const isDisabled = t2 === void 0 ? false : t2;
|
|
872
|
+
const isReadOnly = t3 === void 0 ? false : t3;
|
|
873
|
+
const isRequired = t4 === void 0 ? false : t4;
|
|
874
|
+
const writtenIn = useLocaleOf(locale);
|
|
875
|
+
let t5;
|
|
876
|
+
if ($[14] !== writtenIn) {
|
|
877
|
+
t5 = messagesFor(writtenIn);
|
|
878
|
+
$[14] = writtenIn;
|
|
879
|
+
$[15] = t5;
|
|
880
|
+
} else t5 = $[15];
|
|
881
|
+
const words = t5;
|
|
882
|
+
const [trigger, setTrigger] = useState(null);
|
|
883
|
+
let t6;
|
|
884
|
+
if ($[16] !== defaultOpen || $[17] !== isOpen || $[18] !== onOpenChange) {
|
|
885
|
+
t6 = {
|
|
886
|
+
defaultOpen,
|
|
887
|
+
isOpen,
|
|
888
|
+
onOpenChange
|
|
889
|
+
};
|
|
890
|
+
$[16] = defaultOpen;
|
|
891
|
+
$[17] = isOpen;
|
|
892
|
+
$[18] = onOpenChange;
|
|
893
|
+
$[19] = t6;
|
|
894
|
+
} else t6 = $[19];
|
|
895
|
+
const state = useOverlayTriggerState(t6);
|
|
896
|
+
let t7;
|
|
897
|
+
if ($[20] !== isDisabled || $[21] !== isReadOnly || $[22] !== isRequired || $[23] !== props || $[24] !== writtenIn) {
|
|
898
|
+
t7 = {
|
|
899
|
+
...props,
|
|
900
|
+
isDisabled,
|
|
901
|
+
isReadOnly,
|
|
902
|
+
isRequired,
|
|
903
|
+
locale: writtenIn
|
|
904
|
+
};
|
|
905
|
+
$[20] = isDisabled;
|
|
906
|
+
$[21] = isReadOnly;
|
|
907
|
+
$[22] = isRequired;
|
|
908
|
+
$[23] = props;
|
|
909
|
+
$[24] = writtenIn;
|
|
910
|
+
$[25] = t7;
|
|
911
|
+
} else t7 = $[25];
|
|
912
|
+
const field = useTimeFieldState(t7);
|
|
913
|
+
const selectTime = selectTimeLabel ?? words.selectTime;
|
|
914
|
+
const { open } = state;
|
|
915
|
+
const t8 = field.realtimeValidation.validationErrors;
|
|
916
|
+
const t9 = field.value === null;
|
|
917
|
+
let t10;
|
|
918
|
+
if ($[26] !== field.timeValue || $[27] !== field.value) {
|
|
919
|
+
t10 = field.value === null ? "" : field.timeValue.toString();
|
|
920
|
+
$[26] = field.timeValue;
|
|
921
|
+
$[27] = field.value;
|
|
922
|
+
$[28] = t10;
|
|
923
|
+
} else t10 = $[28];
|
|
924
|
+
const t11 = isDisabled || isReadOnly;
|
|
925
|
+
const t12 = `${selectTime} ${props.label}`;
|
|
926
|
+
let t13;
|
|
927
|
+
if ($[29] !== open || $[30] !== state.isOpen || $[31] !== t11 || $[32] !== t12) {
|
|
928
|
+
t13 = clockOf({
|
|
929
|
+
isDisabled: t11,
|
|
930
|
+
isOpen: state.isOpen,
|
|
931
|
+
label: t12,
|
|
932
|
+
onPress: open,
|
|
933
|
+
ref: setTrigger
|
|
934
|
+
});
|
|
935
|
+
$[29] = open;
|
|
936
|
+
$[30] = state.isOpen;
|
|
937
|
+
$[31] = t11;
|
|
938
|
+
$[32] = t12;
|
|
939
|
+
$[33] = t13;
|
|
940
|
+
} else t13 = $[33];
|
|
941
|
+
let t14;
|
|
942
|
+
if ($[34] !== field || $[35] !== isDisabled || $[36] !== isReadOnly || $[37] !== isRequired || $[38] !== props || $[39] !== t10 || $[40] !== t13 || $[41] !== t9 || $[42] !== writtenIn) {
|
|
943
|
+
t14 = /* @__PURE__ */ jsx(SegmentedField, {
|
|
944
|
+
...props,
|
|
945
|
+
errors: t8,
|
|
946
|
+
isDisabled,
|
|
947
|
+
isEmpty: t9,
|
|
948
|
+
isReadOnly,
|
|
949
|
+
isRequired,
|
|
950
|
+
locale: writtenIn,
|
|
951
|
+
state: field,
|
|
952
|
+
submitted: t10,
|
|
953
|
+
trailingIcon: t13
|
|
954
|
+
});
|
|
955
|
+
$[34] = field;
|
|
956
|
+
$[35] = isDisabled;
|
|
957
|
+
$[36] = isReadOnly;
|
|
958
|
+
$[37] = isRequired;
|
|
959
|
+
$[38] = props;
|
|
960
|
+
$[39] = t10;
|
|
961
|
+
$[40] = t13;
|
|
962
|
+
$[41] = t9;
|
|
963
|
+
$[42] = writtenIn;
|
|
964
|
+
$[43] = t14;
|
|
965
|
+
} else t14 = $[43];
|
|
966
|
+
const t15 = cancelLabel ?? words.cancel;
|
|
967
|
+
const t16 = confirmLabel ?? words.confirm;
|
|
968
|
+
const t17 = enterTimeLabel ?? words.enterTime;
|
|
969
|
+
const t18 = props.granularity === "hour" ? "hour" : "minute";
|
|
970
|
+
let t19;
|
|
971
|
+
if ($[44] !== defaultMode || $[45] !== field || $[46] !== props.hourCycle || $[47] !== props.label || $[48] !== props.placeholderValue || $[49] !== props.testID || $[50] !== selectTime || $[51] !== state || $[52] !== t15 || $[53] !== t16 || $[54] !== t17 || $[55] !== t18 || $[56] !== trigger || $[57] !== writtenIn) {
|
|
972
|
+
t19 = /* @__PURE__ */ jsx(TimePickerModal, {
|
|
973
|
+
cancelLabel: t15,
|
|
974
|
+
confirmLabel: t16,
|
|
975
|
+
defaultMode,
|
|
976
|
+
enterTimeLabel: t17,
|
|
977
|
+
field,
|
|
978
|
+
fieldLabel: props.label,
|
|
979
|
+
granularity: t18,
|
|
980
|
+
hourCycle: props.hourCycle,
|
|
981
|
+
locale: writtenIn,
|
|
982
|
+
placeholderValue: props.placeholderValue,
|
|
983
|
+
selectTimeLabel: selectTime,
|
|
984
|
+
state,
|
|
985
|
+
testID: props.testID,
|
|
986
|
+
trigger
|
|
987
|
+
});
|
|
988
|
+
$[44] = defaultMode;
|
|
989
|
+
$[45] = field;
|
|
990
|
+
$[46] = props.hourCycle;
|
|
991
|
+
$[47] = props.label;
|
|
992
|
+
$[48] = props.placeholderValue;
|
|
993
|
+
$[49] = props.testID;
|
|
994
|
+
$[50] = selectTime;
|
|
995
|
+
$[51] = state;
|
|
996
|
+
$[52] = t15;
|
|
997
|
+
$[53] = t16;
|
|
998
|
+
$[54] = t17;
|
|
999
|
+
$[55] = t18;
|
|
1000
|
+
$[56] = trigger;
|
|
1001
|
+
$[57] = writtenIn;
|
|
1002
|
+
$[58] = t19;
|
|
1003
|
+
} else t19 = $[58];
|
|
1004
|
+
let t20;
|
|
1005
|
+
if ($[59] !== t14 || $[60] !== t19) {
|
|
1006
|
+
t20 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t14, t19] });
|
|
1007
|
+
$[59] = t14;
|
|
1008
|
+
$[60] = t19;
|
|
1009
|
+
$[61] = t20;
|
|
1010
|
+
} else t20 = $[61];
|
|
1011
|
+
return t20;
|
|
1012
|
+
}
|
|
1013
|
+
function TimePickerModal(t0) {
|
|
1014
|
+
const $ = c(33);
|
|
1015
|
+
let props;
|
|
1016
|
+
let state;
|
|
1017
|
+
let trigger;
|
|
1018
|
+
if ($[0] !== t0) {
|
|
1019
|
+
({state, trigger, ...props} = t0);
|
|
1020
|
+
$[0] = t0;
|
|
1021
|
+
$[1] = props;
|
|
1022
|
+
$[2] = state;
|
|
1023
|
+
$[3] = trigger;
|
|
1024
|
+
} else {
|
|
1025
|
+
props = $[1];
|
|
1026
|
+
state = $[2];
|
|
1027
|
+
trigger = $[3];
|
|
1028
|
+
}
|
|
1029
|
+
const theme = useTheme();
|
|
1030
|
+
const styles = stylesOf(theme);
|
|
1031
|
+
const insets = use(SafeAreaInsetsContext) ?? NO_INSETS;
|
|
1032
|
+
const headlineId = useId();
|
|
1033
|
+
const labelId = useId();
|
|
1034
|
+
const [headline, setHeadline] = useState(null);
|
|
1035
|
+
let t1;
|
|
1036
|
+
if ($[4] !== state.isOpen) {
|
|
1037
|
+
t1 = {
|
|
1038
|
+
count: 0,
|
|
1039
|
+
isOpen: state.isOpen
|
|
1040
|
+
};
|
|
1041
|
+
$[4] = state.isOpen;
|
|
1042
|
+
$[5] = t1;
|
|
1043
|
+
} else t1 = $[5];
|
|
1044
|
+
const [opened, setOpened] = useState(t1);
|
|
1045
|
+
let t2;
|
|
1046
|
+
if ($[6] !== state || $[7] !== trigger) {
|
|
1047
|
+
t2 = {
|
|
1048
|
+
state,
|
|
1049
|
+
trigger
|
|
1050
|
+
};
|
|
1051
|
+
$[6] = state;
|
|
1052
|
+
$[7] = trigger;
|
|
1053
|
+
$[8] = t2;
|
|
1054
|
+
} else t2 = $[8];
|
|
1055
|
+
let t3;
|
|
1056
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1057
|
+
t3 = {};
|
|
1058
|
+
$[9] = t3;
|
|
1059
|
+
} else t3 = $[9];
|
|
1060
|
+
const { close, present, setPresent, slots } = useModalState(t2, t3);
|
|
1061
|
+
const shown = usePanelShown(state.isOpen, true, setPresent);
|
|
1062
|
+
const motion = usePanelStyle(shown);
|
|
1063
|
+
const scrim = useAnimatedStyle(() => {
|
|
1064
|
+
"worklet";
|
|
1065
|
+
return { opacity: shown.get() };
|
|
1066
|
+
});
|
|
1067
|
+
if (opened.isOpen !== state.isOpen) setOpened({
|
|
1068
|
+
count: opened.count + (state.isOpen ? 1 : 0),
|
|
1069
|
+
isOpen: state.isOpen
|
|
1070
|
+
});
|
|
1071
|
+
if (!present) return null;
|
|
1072
|
+
const T0 = ModalWindow;
|
|
1073
|
+
const t4 = false;
|
|
1074
|
+
const t5 = `${headlineId} ${labelId}`;
|
|
1075
|
+
const t6 = state.isOpen ? close : void 0;
|
|
1076
|
+
const T1 = View;
|
|
1077
|
+
const t7 = composeStyles(styles.layout, insetsOf(roomOf(insets, theme.spacing.sm)));
|
|
1078
|
+
let t8;
|
|
1079
|
+
if ($[10] !== close || $[11] !== headlineId || $[12] !== labelId || $[13] !== motion || $[14] !== opened.count || $[15] !== props || $[16] !== setHeadline) {
|
|
1080
|
+
t8 = /* @__PURE__ */ createElement(ModalContent, {
|
|
1081
|
+
...props,
|
|
1082
|
+
headlineId,
|
|
1083
|
+
key: opened.count,
|
|
1084
|
+
labelId,
|
|
1085
|
+
motion,
|
|
1086
|
+
onClose: close,
|
|
1087
|
+
setHeadline
|
|
1088
|
+
});
|
|
1089
|
+
$[10] = close;
|
|
1090
|
+
$[11] = headlineId;
|
|
1091
|
+
$[12] = labelId;
|
|
1092
|
+
$[13] = motion;
|
|
1093
|
+
$[14] = opened.count;
|
|
1094
|
+
$[15] = props;
|
|
1095
|
+
$[16] = setHeadline;
|
|
1096
|
+
$[17] = t8;
|
|
1097
|
+
} else t8 = $[17];
|
|
1098
|
+
let t9;
|
|
1099
|
+
if ($[18] !== slots || $[19] !== t8) {
|
|
1100
|
+
t9 = /* @__PURE__ */ jsx(ButtonSlotContext, {
|
|
1101
|
+
value: slots,
|
|
1102
|
+
children: t8
|
|
1103
|
+
});
|
|
1104
|
+
$[18] = slots;
|
|
1105
|
+
$[19] = t8;
|
|
1106
|
+
$[20] = t9;
|
|
1107
|
+
} else t9 = $[20];
|
|
1108
|
+
let t10;
|
|
1109
|
+
if ($[21] !== T1 || $[22] !== t7 || $[23] !== t9) {
|
|
1110
|
+
t10 = /* @__PURE__ */ jsx(T1, {
|
|
1111
|
+
style: t7,
|
|
1112
|
+
children: t9
|
|
1113
|
+
});
|
|
1114
|
+
$[21] = T1;
|
|
1115
|
+
$[22] = t7;
|
|
1116
|
+
$[23] = t9;
|
|
1117
|
+
$[24] = t10;
|
|
1118
|
+
} else t10 = $[24];
|
|
1119
|
+
let t11;
|
|
1120
|
+
if ($[25] !== T0 || $[26] !== close || $[27] !== headline || $[28] !== scrim || $[29] !== t10 || $[30] !== t5 || $[31] !== t6) {
|
|
1121
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
1122
|
+
isKeyboardDismissDisabled: t4,
|
|
1123
|
+
labelledBy: t5,
|
|
1124
|
+
onClose: close,
|
|
1125
|
+
onScrimPress: t6,
|
|
1126
|
+
scrim,
|
|
1127
|
+
title: headline,
|
|
1128
|
+
children: t10
|
|
1129
|
+
});
|
|
1130
|
+
$[25] = T0;
|
|
1131
|
+
$[26] = close;
|
|
1132
|
+
$[27] = headline;
|
|
1133
|
+
$[28] = scrim;
|
|
1134
|
+
$[29] = t10;
|
|
1135
|
+
$[30] = t5;
|
|
1136
|
+
$[31] = t6;
|
|
1137
|
+
$[32] = t11;
|
|
1138
|
+
} else t11 = $[32];
|
|
1139
|
+
return t11;
|
|
1140
|
+
}
|
|
1141
|
+
function useDialGesture({ onPick, onRelease, testID }) {
|
|
1142
|
+
const pan = Gesture.Pan().runOnJS(true).onStart(({ x, y }) => {
|
|
1143
|
+
onPick(x, y);
|
|
1144
|
+
}).onUpdate(({ x, y }) => {
|
|
1145
|
+
onPick(x, y);
|
|
1146
|
+
}).onEnd(() => {
|
|
1147
|
+
onRelease();
|
|
1148
|
+
});
|
|
1149
|
+
const tap = Gesture.Tap().maxDistance(SLOP).runOnJS(true).onEnd(({ x, y }, success) => {
|
|
1150
|
+
if (success) {
|
|
1151
|
+
onPick(x, y);
|
|
1152
|
+
onRelease();
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
return Gesture.Race(testID === void 0 ? pan : pan.withTestId(`${testID}-dial-pan`), testID === void 0 ? tap : tap.withTestId(`${testID}-dial-tap`));
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Whether the clock has twelve hours. `hourCycle` decides when it is given,
|
|
1159
|
+
* as it does for the segments; otherwise the locale does.
|
|
1160
|
+
*/
|
|
1161
|
+
function usesTwelveHours(locale, hourCycle) {
|
|
1162
|
+
if (hourCycle !== void 0) return hourCycle === 12;
|
|
1163
|
+
return new DateFormatter(locale, { hour: "numeric" }).resolvedOptions().hour12 ?? false;
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1166
|
+
export { TimePicker };
|
|
1167
|
+
|
|
1168
|
+
//# sourceMappingURL=index.js.map
|