@kanso-labs/react-native-kanso-ui 0.8.0 → 0.10.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/badge/index.js +9 -70
- package/dist/badge/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 +45 -23
- package/dist/button/index.js.map +1 -1
- package/dist/button/palettes.d.ts +2 -0
- 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 +1331 -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/badge/index.d.ts +48 -0
- package/dist/components/badge/index.js +122 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/{badge → components/badge}/styles.js +10 -6
- package/dist/components/badge/styles.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +66 -0
- package/dist/components/breadcrumbs/index.js +285 -0
- package/dist/components/breadcrumbs/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/index.d.ts +7 -1
- package/dist/components/checkbox/index.js +183 -138
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +92 -0
- package/dist/components/checkbox-group/index.js +306 -0
- package/dist/components/checkbox-group/index.js.map +1 -0
- package/dist/components/code/index.d.ts +25 -0
- package/dist/components/code/index.js +87 -0
- package/dist/components/code/index.js.map +1 -0
- 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/container/index.d.ts +47 -0
- package/dist/components/container/index.js +85 -0
- package/dist/components/container/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/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 +80 -0
- package/dist/components/fab/index.js +246 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/fab-menu/index.d.ts +120 -0
- package/dist/components/fab-menu/index.js +640 -0
- package/dist/components/fab-menu/index.js.map +1 -0
- package/dist/components/feed/index.d.ts +57 -0
- package/dist/components/feed/index.js +167 -0
- package/dist/components/feed/index.js.map +1 -0
- 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/keycap/index.d.ts +27 -0
- package/dist/components/keycap/index.js +136 -0
- package/dist/components/keycap/index.js.map +1 -0
- 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.js +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/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 +78 -0
- package/dist/components/search-view/index.js +570 -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/separator/index.d.ts +3 -2
- package/dist/components/separator/index.js +29 -26
- package/dist/components/separator/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/supporting-pane/index.d.ts +44 -0
- package/dist/components/supporting-pane/index.js +109 -0
- package/dist/components/supporting-pane/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/text/index.d.ts +1 -1
- package/dist/components/text/index.js +49 -21
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +145 -0
- package/dist/components/text-area/index.js +231 -0
- package/dist/components/text-area/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/toolbar/index.d.ts +53 -0
- package/dist/components/toolbar/index.js +185 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +101 -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/control/group.js +23 -0
- package/dist/control/group.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/fab/index.d.ts +19 -0
- package/dist/fab/index.js +147 -0
- package/dist/fab/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 +350 -153
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +27 -0
- 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 +6 -4
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +92 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +20 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1394 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +51 -6
- package/dist/index.js +47 -4
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +96 -68
- package/dist/modal/index.js.map +1 -1
- package/dist/navigation/index.js +8 -5
- package/dist/navigation/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 +16 -2
- 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/separator/index.js +7 -0
- package/dist/separator/index.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/dist/typography/size.js +14 -0
- package/dist/typography/size.js.map +1 -0
- package/package.json +11 -2
- package/dist/badge/styles.js.map +0 -1
|
@@ -0,0 +1,1137 @@
|
|
|
1
|
+
import { IconStyleContext } from "../../glyphs/icon-style.js";
|
|
2
|
+
import { useTheme } from "../../theme/scope.js";
|
|
3
|
+
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
4
|
+
import { usePressFeedback } from "../../press/index.js";
|
|
5
|
+
import { useTypeRole } from "../../typography/roles.js";
|
|
6
|
+
import { withOpacity } from "../../theme/color.js";
|
|
7
|
+
import { Badge } from "../badge/index.js";
|
|
8
|
+
import { useLinkPress } from "../../router/index.js";
|
|
9
|
+
import { c } from "react/compiler-runtime";
|
|
10
|
+
import { I18nManager, Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
|
|
11
|
+
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from "react-native-reanimated";
|
|
12
|
+
import { Children, createContext, isValidElement, use, useEffect, useId, useRef, useState } from "react";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { useTabListState } from "react-stately/useTabListState";
|
|
15
|
+
//#region src/components/tabs/index.tsx
|
|
16
|
+
const PRIMARY_THICKNESS = 3;
|
|
17
|
+
const SECONDARY_THICKNESS = 2;
|
|
18
|
+
const LEAST_INDICATOR = 24;
|
|
19
|
+
const ICON_SIZE = 24;
|
|
20
|
+
const STACKED_HEIGHT = 64;
|
|
21
|
+
const SCROLLABLE_LEAST = 72;
|
|
22
|
+
const SCROLLABLE_MOST = 264;
|
|
23
|
+
const NO_MEASUREMENTS = /* @__PURE__ */ new Map();
|
|
24
|
+
const NO_HEIGHTS = /* @__PURE__ */ new Map();
|
|
25
|
+
const NO_TABS = [];
|
|
26
|
+
const TabsContext = createContext(null);
|
|
27
|
+
const PanelHeightContext = createContext(null);
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
atLeft: { left: 0 },
|
|
30
|
+
atRight: { right: 0 },
|
|
31
|
+
badge: { flexShrink: 0 },
|
|
32
|
+
besideBar: {
|
|
33
|
+
flexGrow: 1,
|
|
34
|
+
flexShrink: 1,
|
|
35
|
+
minWidth: 0
|
|
36
|
+
},
|
|
37
|
+
clip: { overflow: "hidden" },
|
|
38
|
+
icon: {
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
height: ICON_SIZE,
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
width: ICON_SIZE
|
|
44
|
+
},
|
|
45
|
+
label: {
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
flexDirection: "row",
|
|
48
|
+
flexShrink: 1,
|
|
49
|
+
minWidth: 0
|
|
50
|
+
},
|
|
51
|
+
line: {
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
flexDirection: "row",
|
|
54
|
+
flexShrink: 1,
|
|
55
|
+
minWidth: 0
|
|
56
|
+
},
|
|
57
|
+
listVertical: {
|
|
58
|
+
flexDirection: "column",
|
|
59
|
+
flexShrink: 0
|
|
60
|
+
},
|
|
61
|
+
rootVertical: { flexDirection: "row" },
|
|
62
|
+
row: { flexDirection: "row" },
|
|
63
|
+
scroll: {
|
|
64
|
+
flexGrow: 1,
|
|
65
|
+
flexShrink: 1,
|
|
66
|
+
minWidth: 0
|
|
67
|
+
},
|
|
68
|
+
tabScrollable: {
|
|
69
|
+
flexGrow: 0,
|
|
70
|
+
flexShrink: 0,
|
|
71
|
+
maxWidth: SCROLLABLE_MOST,
|
|
72
|
+
minWidth: SCROLLABLE_LEAST
|
|
73
|
+
},
|
|
74
|
+
tabShared: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
minWidth: 0
|
|
77
|
+
},
|
|
78
|
+
tabStacked: { minHeight: STACKED_HEIGHT },
|
|
79
|
+
tabVertical: { justifyContent: "flex-start" },
|
|
80
|
+
text: {
|
|
81
|
+
flexShrink: 1,
|
|
82
|
+
textAlign: "center"
|
|
83
|
+
},
|
|
84
|
+
textVertical: { textAlign: "auto" }
|
|
85
|
+
});
|
|
86
|
+
const stylesOf = themedStyles(({ colors, sizing, spacing }) => StyleSheet.create({
|
|
87
|
+
divider: {
|
|
88
|
+
backgroundColor: colors.outlineVariant,
|
|
89
|
+
bottom: 0,
|
|
90
|
+
height: 1,
|
|
91
|
+
left: 0,
|
|
92
|
+
pointerEvents: "none",
|
|
93
|
+
position: "absolute",
|
|
94
|
+
right: 0
|
|
95
|
+
},
|
|
96
|
+
dividerVertical: {
|
|
97
|
+
backgroundColor: colors.outlineVariant,
|
|
98
|
+
bottom: 0,
|
|
99
|
+
end: 0,
|
|
100
|
+
pointerEvents: "none",
|
|
101
|
+
position: "absolute",
|
|
102
|
+
top: 0,
|
|
103
|
+
width: 1
|
|
104
|
+
},
|
|
105
|
+
indicator: {
|
|
106
|
+
backgroundColor: colors.primary,
|
|
107
|
+
borderTopLeftRadius: PRIMARY_THICKNESS,
|
|
108
|
+
borderTopRightRadius: PRIMARY_THICKNESS,
|
|
109
|
+
bottom: 0,
|
|
110
|
+
height: PRIMARY_THICKNESS,
|
|
111
|
+
pointerEvents: "none",
|
|
112
|
+
position: "absolute"
|
|
113
|
+
},
|
|
114
|
+
indicatorSecondary: {
|
|
115
|
+
backgroundColor: colors.primary,
|
|
116
|
+
bottom: 0,
|
|
117
|
+
height: SECONDARY_THICKNESS,
|
|
118
|
+
pointerEvents: "none",
|
|
119
|
+
position: "absolute"
|
|
120
|
+
},
|
|
121
|
+
indicatorSecondaryVertical: {
|
|
122
|
+
backgroundColor: colors.primary,
|
|
123
|
+
end: 0,
|
|
124
|
+
pointerEvents: "none",
|
|
125
|
+
position: "absolute",
|
|
126
|
+
top: 0,
|
|
127
|
+
width: SECONDARY_THICKNESS
|
|
128
|
+
},
|
|
129
|
+
indicatorVertical: {
|
|
130
|
+
backgroundColor: colors.primary,
|
|
131
|
+
borderBottomStartRadius: PRIMARY_THICKNESS,
|
|
132
|
+
borderTopStartRadius: PRIMARY_THICKNESS,
|
|
133
|
+
end: 0,
|
|
134
|
+
pointerEvents: "none",
|
|
135
|
+
position: "absolute",
|
|
136
|
+
top: 0,
|
|
137
|
+
width: PRIMARY_THICKNESS
|
|
138
|
+
},
|
|
139
|
+
labelInline: {
|
|
140
|
+
flexDirection: "row-reverse",
|
|
141
|
+
gap: spacing.sm
|
|
142
|
+
},
|
|
143
|
+
labelStacked: {
|
|
144
|
+
flexDirection: "column-reverse",
|
|
145
|
+
gap: spacing.xxs
|
|
146
|
+
},
|
|
147
|
+
lineBadged: { gap: spacing.xs },
|
|
148
|
+
tab: {
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
boxSizing: "border-box",
|
|
151
|
+
flexDirection: "row",
|
|
152
|
+
justifyContent: "center",
|
|
153
|
+
minHeight: sizing.controlMd,
|
|
154
|
+
paddingHorizontal: spacing.lg
|
|
155
|
+
}
|
|
156
|
+
}));
|
|
157
|
+
const ringStyles = StyleSheet.create({ ring: { outlineOffset: -2 } });
|
|
158
|
+
/**
|
|
159
|
+
* A tab bar and the panels it switches between. Pass `selectedKey` with
|
|
160
|
+
* `onSelectionChange` to hold the selection, or `defaultSelectedKey` to let
|
|
161
|
+
* the bar keep its own. Each `Tabs.Tab` names the `Tabs.Panel` it shows
|
|
162
|
+
* through a shared `id`, and a bar may stand alone without panels.
|
|
163
|
+
*
|
|
164
|
+
* ```tsx
|
|
165
|
+
* <Tabs defaultSelectedKey="first">
|
|
166
|
+
* <Tabs.List aria-label="Sections">
|
|
167
|
+
* <Tabs.Tab id="first">First item</Tabs.Tab>
|
|
168
|
+
* <Tabs.Tab id="second">Second item</Tabs.Tab>
|
|
169
|
+
* </Tabs.List>
|
|
170
|
+
* <Tabs.Panel id="first">
|
|
171
|
+
* <Text>Supporting line</Text>
|
|
172
|
+
* </Tabs.Panel>
|
|
173
|
+
* <Tabs.Panel id="second">
|
|
174
|
+
* <Text>Supporting line</Text>
|
|
175
|
+
* </Tabs.Panel>
|
|
176
|
+
* </Tabs>
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* Write the `Tabs.List` among the children of `Tabs`, inside any view or
|
|
180
|
+
* fragment, rather than in a component of the call site's own: the bar is
|
|
181
|
+
* found there, and its tabs are what the selection is built from.
|
|
182
|
+
*
|
|
183
|
+
* `style`, `ref` and `testID` land on the root view, the one a layout
|
|
184
|
+
* positions.
|
|
185
|
+
*/
|
|
186
|
+
function Tabs(t0) {
|
|
187
|
+
const $ = c(28);
|
|
188
|
+
const { children, defaultSelectedKey, disabledKeys, isDisabled, layout: t1, onSelectionChange, orientation: t2, ref, selectedKey, style, testID, variant: t3 } = t0;
|
|
189
|
+
const layout = t1 === void 0 ? "fixed" : t1;
|
|
190
|
+
const orientation = t2 === void 0 ? "horizontal" : t2;
|
|
191
|
+
const variant = t3 === void 0 ? "primary" : t3;
|
|
192
|
+
let t4;
|
|
193
|
+
if ($[0] !== children) {
|
|
194
|
+
t4 = listOf(children);
|
|
195
|
+
$[0] = children;
|
|
196
|
+
$[1] = t4;
|
|
197
|
+
} else t4 = $[1];
|
|
198
|
+
const list = t4;
|
|
199
|
+
const t5 = list?.props.children ?? NO_TABS;
|
|
200
|
+
const t6 = list?.props.items;
|
|
201
|
+
const t7 = selectedKey ?? void 0;
|
|
202
|
+
let t8;
|
|
203
|
+
if ($[2] !== defaultSelectedKey || $[3] !== disabledKeys || $[4] !== isDisabled || $[5] !== onSelectionChange || $[6] !== t5 || $[7] !== t6 || $[8] !== t7) {
|
|
204
|
+
t8 = {
|
|
205
|
+
children: t5,
|
|
206
|
+
defaultSelectedKey,
|
|
207
|
+
disabledKeys,
|
|
208
|
+
isDisabled,
|
|
209
|
+
items: t6,
|
|
210
|
+
onSelectionChange,
|
|
211
|
+
selectedKey: t7
|
|
212
|
+
};
|
|
213
|
+
$[2] = defaultSelectedKey;
|
|
214
|
+
$[3] = disabledKeys;
|
|
215
|
+
$[4] = isDisabled;
|
|
216
|
+
$[5] = onSelectionChange;
|
|
217
|
+
$[6] = t5;
|
|
218
|
+
$[7] = t6;
|
|
219
|
+
$[8] = t7;
|
|
220
|
+
$[9] = t8;
|
|
221
|
+
} else t8 = $[9];
|
|
222
|
+
const state = useTabListState(t8);
|
|
223
|
+
const ids = useId();
|
|
224
|
+
let t9;
|
|
225
|
+
if ($[10] !== ids || $[11] !== layout || $[12] !== list || $[13] !== orientation || $[14] !== state || $[15] !== variant) {
|
|
226
|
+
t9 = contextOf({
|
|
227
|
+
layout,
|
|
228
|
+
orientation,
|
|
229
|
+
variant
|
|
230
|
+
}, list !== void 0, ids, state);
|
|
231
|
+
$[10] = ids;
|
|
232
|
+
$[11] = layout;
|
|
233
|
+
$[12] = list;
|
|
234
|
+
$[13] = orientation;
|
|
235
|
+
$[14] = state;
|
|
236
|
+
$[15] = variant;
|
|
237
|
+
$[16] = t9;
|
|
238
|
+
} else t9 = $[16];
|
|
239
|
+
const context = t9;
|
|
240
|
+
const t10 = orientation === "vertical" ? styles.rootVertical : void 0;
|
|
241
|
+
let t11;
|
|
242
|
+
if ($[17] !== style || $[18] !== t10) {
|
|
243
|
+
t11 = composeStyles(t10, style);
|
|
244
|
+
$[17] = style;
|
|
245
|
+
$[18] = t10;
|
|
246
|
+
$[19] = t11;
|
|
247
|
+
} else t11 = $[19];
|
|
248
|
+
let t12;
|
|
249
|
+
if ($[20] !== children || $[21] !== ref || $[22] !== t11 || $[23] !== testID) {
|
|
250
|
+
t12 = /* @__PURE__ */ jsx(View, {
|
|
251
|
+
ref,
|
|
252
|
+
style: t11,
|
|
253
|
+
testID,
|
|
254
|
+
children
|
|
255
|
+
});
|
|
256
|
+
$[20] = children;
|
|
257
|
+
$[21] = ref;
|
|
258
|
+
$[22] = t11;
|
|
259
|
+
$[23] = testID;
|
|
260
|
+
$[24] = t12;
|
|
261
|
+
} else t12 = $[24];
|
|
262
|
+
let t13;
|
|
263
|
+
if ($[25] !== context || $[26] !== t12) {
|
|
264
|
+
t13 = /* @__PURE__ */ jsx(TabsContext, {
|
|
265
|
+
value: context,
|
|
266
|
+
children: t12
|
|
267
|
+
});
|
|
268
|
+
$[25] = context;
|
|
269
|
+
$[26] = t12;
|
|
270
|
+
$[27] = t13;
|
|
271
|
+
} else t13 = $[27];
|
|
272
|
+
return t13;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* The bar: every tab, drawn from the entries its `Tabs.Tab` children gave
|
|
276
|
+
* the root, with the divider and the indicator. Name it with `aria-label` or
|
|
277
|
+
* `aria-labelledby`.
|
|
278
|
+
*
|
|
279
|
+
* `style`, `ref` and `testID` land on the bar's own view.
|
|
280
|
+
*/
|
|
281
|
+
function TabsList(t0) {
|
|
282
|
+
const $ = c(57);
|
|
283
|
+
const { "aria-label": ariaLabel, "aria-labelledby": labelledBy, ref, style, testID } = t0;
|
|
284
|
+
const { bar, ids, state } = useTabs("Tabs.List", true);
|
|
285
|
+
const theme = useTheme();
|
|
286
|
+
let t1;
|
|
287
|
+
if ($[0] !== theme) {
|
|
288
|
+
t1 = stylesOf(theme);
|
|
289
|
+
$[0] = theme;
|
|
290
|
+
$[1] = t1;
|
|
291
|
+
} else t1 = $[1];
|
|
292
|
+
const own = t1;
|
|
293
|
+
const reduceMotion = useReducedMotion();
|
|
294
|
+
const [measured, setMeasured] = useState(NO_MEASUREMENTS);
|
|
295
|
+
const [viewport, setViewport] = useState(0);
|
|
296
|
+
const scroll = useRef(null);
|
|
297
|
+
const scrolled = useRef(0);
|
|
298
|
+
const revealed = useRef(void 0);
|
|
299
|
+
const vertical = bar.orientation === "vertical";
|
|
300
|
+
const scrollable = bar.layout === "scrollable";
|
|
301
|
+
const { selectedKey } = state;
|
|
302
|
+
let selected;
|
|
303
|
+
let t2;
|
|
304
|
+
if ($[2] !== bar || $[3] !== measured || $[4] !== selectedKey || $[5] !== theme.spacing.xxs) {
|
|
305
|
+
selected = selectedKey === null ? void 0 : measured.get(selectedKey);
|
|
306
|
+
t2 = placementOf(bar, selected, theme.spacing.xxs);
|
|
307
|
+
$[2] = bar;
|
|
308
|
+
$[3] = measured;
|
|
309
|
+
$[4] = selectedKey;
|
|
310
|
+
$[5] = theme.spacing.xxs;
|
|
311
|
+
$[6] = selected;
|
|
312
|
+
$[7] = t2;
|
|
313
|
+
} else {
|
|
314
|
+
selected = $[6];
|
|
315
|
+
t2 = $[7];
|
|
316
|
+
}
|
|
317
|
+
const placement = t2;
|
|
318
|
+
let t3;
|
|
319
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
320
|
+
t3 = (key, part, layout) => {
|
|
321
|
+
setMeasured((previous) => withMeasurement(previous, key, part, layout));
|
|
322
|
+
};
|
|
323
|
+
$[8] = t3;
|
|
324
|
+
} else t3 = $[8];
|
|
325
|
+
const measure = t3;
|
|
326
|
+
let t4;
|
|
327
|
+
if ($[9] !== vertical) {
|
|
328
|
+
t4 = (event) => {
|
|
329
|
+
const { contentOffset } = event.nativeEvent;
|
|
330
|
+
scrolled.current = vertical ? contentOffset.y : contentOffset.x;
|
|
331
|
+
};
|
|
332
|
+
$[9] = vertical;
|
|
333
|
+
$[10] = t4;
|
|
334
|
+
} else t4 = $[10];
|
|
335
|
+
const onScroll = t4;
|
|
336
|
+
let t5;
|
|
337
|
+
if ($[11] !== reduceMotion || $[12] !== scrollable || $[13] !== selected?.tab || $[14] !== selectedKey || $[15] !== vertical || $[16] !== viewport) {
|
|
338
|
+
t5 = () => {
|
|
339
|
+
const tab = selected?.tab;
|
|
340
|
+
if (!scrollable || tab === void 0 || viewport === 0 || revealed.current === selectedKey) return;
|
|
341
|
+
const first = revealed.current === void 0;
|
|
342
|
+
revealed.current = selectedKey;
|
|
343
|
+
const target = revealOffset(scrolled.current, viewport, vertical ? tab.y : tab.x, vertical ? tab.height : tab.width);
|
|
344
|
+
if (target !== void 0) {
|
|
345
|
+
const animated = !first && !reduceMotion;
|
|
346
|
+
scroll.current?.scrollTo(vertical ? {
|
|
347
|
+
animated,
|
|
348
|
+
y: target
|
|
349
|
+
} : {
|
|
350
|
+
animated,
|
|
351
|
+
x: target
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
$[11] = reduceMotion;
|
|
356
|
+
$[12] = scrollable;
|
|
357
|
+
$[13] = selected?.tab;
|
|
358
|
+
$[14] = selectedKey;
|
|
359
|
+
$[15] = vertical;
|
|
360
|
+
$[16] = viewport;
|
|
361
|
+
$[17] = t5;
|
|
362
|
+
} else t5 = $[17];
|
|
363
|
+
let t6;
|
|
364
|
+
if ($[18] !== reduceMotion || $[19] !== scrollable || $[20] !== selected || $[21] !== selectedKey || $[22] !== vertical || $[23] !== viewport) {
|
|
365
|
+
t6 = [
|
|
366
|
+
reduceMotion,
|
|
367
|
+
scrollable,
|
|
368
|
+
selected,
|
|
369
|
+
selectedKey,
|
|
370
|
+
vertical,
|
|
371
|
+
viewport
|
|
372
|
+
];
|
|
373
|
+
$[18] = reduceMotion;
|
|
374
|
+
$[19] = scrollable;
|
|
375
|
+
$[20] = selected;
|
|
376
|
+
$[21] = selectedKey;
|
|
377
|
+
$[22] = vertical;
|
|
378
|
+
$[23] = viewport;
|
|
379
|
+
$[24] = t6;
|
|
380
|
+
} else t6 = $[24];
|
|
381
|
+
useEffect(t5, t6);
|
|
382
|
+
let t7;
|
|
383
|
+
if ($[25] !== state.collection) {
|
|
384
|
+
t7 = [...state.collection];
|
|
385
|
+
$[25] = state.collection;
|
|
386
|
+
$[26] = t7;
|
|
387
|
+
} else t7 = $[26];
|
|
388
|
+
let t8;
|
|
389
|
+
if ($[27] !== bar || $[28] !== ids || $[29] !== state || $[30] !== t7) {
|
|
390
|
+
t8 = t7.map((node) => /* @__PURE__ */ jsx(ListTab, {
|
|
391
|
+
bar,
|
|
392
|
+
ids,
|
|
393
|
+
node,
|
|
394
|
+
onMeasure: measure,
|
|
395
|
+
state
|
|
396
|
+
}, node.key));
|
|
397
|
+
$[27] = bar;
|
|
398
|
+
$[28] = ids;
|
|
399
|
+
$[29] = state;
|
|
400
|
+
$[30] = t7;
|
|
401
|
+
$[31] = t8;
|
|
402
|
+
} else t8 = $[31];
|
|
403
|
+
let t9;
|
|
404
|
+
if ($[32] !== bar || $[33] !== placement || $[34] !== selectedKey) {
|
|
405
|
+
t9 = placement === void 0 ? null : /* @__PURE__ */ jsx(Indicator, {
|
|
406
|
+
bar,
|
|
407
|
+
placement,
|
|
408
|
+
selectedKey
|
|
409
|
+
});
|
|
410
|
+
$[32] = bar;
|
|
411
|
+
$[33] = placement;
|
|
412
|
+
$[34] = selectedKey;
|
|
413
|
+
$[35] = t9;
|
|
414
|
+
} else t9 = $[35];
|
|
415
|
+
let t10;
|
|
416
|
+
if ($[36] !== t8 || $[37] !== t9) {
|
|
417
|
+
t10 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t8, t9] });
|
|
418
|
+
$[36] = t8;
|
|
419
|
+
$[37] = t9;
|
|
420
|
+
$[38] = t10;
|
|
421
|
+
} else t10 = $[38];
|
|
422
|
+
const tabs = t10;
|
|
423
|
+
const t11 = vertical ? styles.listVertical : styles.row;
|
|
424
|
+
let t12;
|
|
425
|
+
if ($[39] !== style || $[40] !== t11) {
|
|
426
|
+
t12 = composeStyles(t11, style);
|
|
427
|
+
$[39] = style;
|
|
428
|
+
$[40] = t11;
|
|
429
|
+
$[41] = t12;
|
|
430
|
+
} else t12 = $[41];
|
|
431
|
+
const t13 = vertical ? own.dividerVertical : own.divider;
|
|
432
|
+
let t14;
|
|
433
|
+
if ($[42] !== t13) {
|
|
434
|
+
t14 = /* @__PURE__ */ jsx(View, { style: t13 });
|
|
435
|
+
$[42] = t13;
|
|
436
|
+
$[43] = t14;
|
|
437
|
+
} else t14 = $[43];
|
|
438
|
+
let t15;
|
|
439
|
+
if ($[44] !== onScroll || $[45] !== scrollable || $[46] !== tabs || $[47] !== vertical) {
|
|
440
|
+
t15 = scrollable ? /* @__PURE__ */ jsx(ScrollView, {
|
|
441
|
+
horizontal: !vertical,
|
|
442
|
+
onLayout: viewportOf(setViewport, vertical),
|
|
443
|
+
onScroll,
|
|
444
|
+
ref: scroll,
|
|
445
|
+
scrollEventThrottle: 16,
|
|
446
|
+
showsHorizontalScrollIndicator: false,
|
|
447
|
+
showsVerticalScrollIndicator: false,
|
|
448
|
+
style: styles.scroll,
|
|
449
|
+
children: tabs
|
|
450
|
+
}) : tabs;
|
|
451
|
+
$[44] = onScroll;
|
|
452
|
+
$[45] = scrollable;
|
|
453
|
+
$[46] = tabs;
|
|
454
|
+
$[47] = vertical;
|
|
455
|
+
$[48] = t15;
|
|
456
|
+
} else t15 = $[48];
|
|
457
|
+
let t16;
|
|
458
|
+
if ($[49] !== ariaLabel || $[50] !== labelledBy || $[51] !== ref || $[52] !== t12 || $[53] !== t14 || $[54] !== t15 || $[55] !== testID) {
|
|
459
|
+
t16 = /* @__PURE__ */ jsxs(View, {
|
|
460
|
+
"aria-label": ariaLabel,
|
|
461
|
+
"aria-labelledby": labelledBy,
|
|
462
|
+
ref,
|
|
463
|
+
role: "tablist",
|
|
464
|
+
style: t12,
|
|
465
|
+
testID,
|
|
466
|
+
children: [t14, t15]
|
|
467
|
+
});
|
|
468
|
+
$[49] = ariaLabel;
|
|
469
|
+
$[50] = labelledBy;
|
|
470
|
+
$[51] = ref;
|
|
471
|
+
$[52] = t12;
|
|
472
|
+
$[53] = t14;
|
|
473
|
+
$[54] = t15;
|
|
474
|
+
$[55] = testID;
|
|
475
|
+
$[56] = t16;
|
|
476
|
+
} else t16 = $[56];
|
|
477
|
+
return t16;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* One tab of a `Tabs.List`, which draws it: the root builds its selection
|
|
481
|
+
* from these, so one renders nothing on its own. Give every tab an `id`,
|
|
482
|
+
* which is the key selection reports and its `Tabs.Panel` shares.
|
|
483
|
+
*/
|
|
484
|
+
function TabsTab(_props) {
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
TabsTab.getCollectionNode = function* getCollectionNode(props) {
|
|
488
|
+
yield {
|
|
489
|
+
"aria-label": props["aria-label"],
|
|
490
|
+
hasChildNodes: false,
|
|
491
|
+
key: props.id,
|
|
492
|
+
props,
|
|
493
|
+
rendered: props.children,
|
|
494
|
+
textValue: props.textValue ?? (typeof props.children === "string" ? props.children : ""),
|
|
495
|
+
type: "item"
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
function badgeFor(badge, icon) {
|
|
499
|
+
if (badge === void 0 || badge === false) return icon ?? null;
|
|
500
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
501
|
+
count: badge === true ? void 0 : badge,
|
|
502
|
+
style: icon === void 0 ? styles.badge : void 0,
|
|
503
|
+
children: icon
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* The colour a tab draws its label and icon in: primary for the active tab
|
|
508
|
+
* of a primary bar and on surface for a secondary one's, on surface for an
|
|
509
|
+
* inactive tab a pointer, a focus or a press engages, on surface variant at
|
|
510
|
+
* rest, and on surface at the disabled content opacity while disabled.
|
|
511
|
+
*/
|
|
512
|
+
function colorOf({ colors, stateLayerOpacity }, variant, { disabled, engaged, selected }) {
|
|
513
|
+
if (disabled) return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent);
|
|
514
|
+
if (selected) return variant === "primary" ? colors.primary : colors.onSurface;
|
|
515
|
+
return engaged ? colors.onSurface : colors.onSurfaceVariant;
|
|
516
|
+
}
|
|
517
|
+
function contextOf(bar, found, ids, state) {
|
|
518
|
+
return {
|
|
519
|
+
bar,
|
|
520
|
+
found,
|
|
521
|
+
ids,
|
|
522
|
+
state
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
function heightOf(report, key) {
|
|
526
|
+
if (report === null) return;
|
|
527
|
+
return (event) => {
|
|
528
|
+
report(key, event.nativeEvent.layout.height);
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function iconStyleOf(color) {
|
|
532
|
+
return {
|
|
533
|
+
color,
|
|
534
|
+
size: ICON_SIZE
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* The active indicator: one view, which moves to the selected tab's place
|
|
539
|
+
* when the selection does, and is put there at once when the bar is only
|
|
540
|
+
* laid out again.
|
|
541
|
+
*/
|
|
542
|
+
function Indicator(t0) {
|
|
543
|
+
const $ = c(12);
|
|
544
|
+
const { bar, placement, selectedKey } = t0;
|
|
545
|
+
const theme = useTheme();
|
|
546
|
+
const { motion } = theme;
|
|
547
|
+
const own = stylesOf(theme);
|
|
548
|
+
const reduceMotion = useReducedMotion();
|
|
549
|
+
const offset = useSharedValue(placement.offset);
|
|
550
|
+
const length = useSharedValue(placement.length);
|
|
551
|
+
const placed = useRef(selectedKey);
|
|
552
|
+
const vertical = bar.orientation === "vertical";
|
|
553
|
+
let t1;
|
|
554
|
+
let t2;
|
|
555
|
+
if ($[0] !== length || $[1] !== motion || $[2] !== offset || $[3] !== placement.length || $[4] !== placement.offset || $[5] !== reduceMotion || $[6] !== selectedKey) {
|
|
556
|
+
t1 = () => {
|
|
557
|
+
const moved = placed.current !== selectedKey;
|
|
558
|
+
placed.current = selectedKey;
|
|
559
|
+
if (!moved || reduceMotion) {
|
|
560
|
+
offset.set(placement.offset);
|
|
561
|
+
length.set(placement.length);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const timing = {
|
|
565
|
+
duration: motion.durationMedium1,
|
|
566
|
+
easing: Easing.bezier(...motion.easingEmphasized)
|
|
567
|
+
};
|
|
568
|
+
offset.set(withTiming(placement.offset, timing));
|
|
569
|
+
length.set(withTiming(placement.length, timing));
|
|
570
|
+
};
|
|
571
|
+
t2 = [
|
|
572
|
+
length,
|
|
573
|
+
motion,
|
|
574
|
+
offset,
|
|
575
|
+
placement.length,
|
|
576
|
+
placement.offset,
|
|
577
|
+
reduceMotion,
|
|
578
|
+
selectedKey
|
|
579
|
+
];
|
|
580
|
+
$[0] = length;
|
|
581
|
+
$[1] = motion;
|
|
582
|
+
$[2] = offset;
|
|
583
|
+
$[3] = placement.length;
|
|
584
|
+
$[4] = placement.offset;
|
|
585
|
+
$[5] = reduceMotion;
|
|
586
|
+
$[6] = selectedKey;
|
|
587
|
+
$[7] = t1;
|
|
588
|
+
$[8] = t2;
|
|
589
|
+
} else {
|
|
590
|
+
t1 = $[7];
|
|
591
|
+
t2 = $[8];
|
|
592
|
+
}
|
|
593
|
+
useEffect(t1, t2);
|
|
594
|
+
const motionStyle = useAnimatedStyle(() => {
|
|
595
|
+
"worklet";
|
|
596
|
+
return vertical ? {
|
|
597
|
+
height: length.get(),
|
|
598
|
+
transform: [{ translateY: offset.get() }]
|
|
599
|
+
} : {
|
|
600
|
+
transform: [{ translateX: offset.get() }],
|
|
601
|
+
width: length.get()
|
|
602
|
+
};
|
|
603
|
+
});
|
|
604
|
+
const t3 = Animated;
|
|
605
|
+
const t4 = composeStyles(indicatorStyleOf(own, bar), vertical ? void 0 : leftEdgeOf(), motionStyle);
|
|
606
|
+
let t5;
|
|
607
|
+
if ($[9] !== t3.View || $[10] !== t4) {
|
|
608
|
+
t5 = /* @__PURE__ */ jsx(t3.View, { style: t4 });
|
|
609
|
+
$[9] = t3.View;
|
|
610
|
+
$[10] = t4;
|
|
611
|
+
$[11] = t5;
|
|
612
|
+
} else t5 = $[11];
|
|
613
|
+
return t5;
|
|
614
|
+
}
|
|
615
|
+
function indicatorStyleOf(own, bar) {
|
|
616
|
+
if (bar.variant === "primary") return bar.orientation === "vertical" ? own.indicatorVertical : own.indicator;
|
|
617
|
+
return bar.orientation === "vertical" ? own.indicatorSecondaryVertical : own.indicatorSecondary;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* The style that puts a horizontal indicator at the bar's left edge, which is
|
|
621
|
+
* where a layout measures a tab's `x` from in either direction, so that the
|
|
622
|
+
* indicator's translation is the tab's own `x`. React Native swaps `left` and
|
|
623
|
+
* `right` under a right-to-left layout unless the app turns that off, so
|
|
624
|
+
* there `right` is the one naming the left edge. React Native Web reports no
|
|
625
|
+
* right-to-left layout here and keeps `left` where CSS has it.
|
|
626
|
+
*/
|
|
627
|
+
function leftEdgeOf() {
|
|
628
|
+
return I18nManager.isRTL && I18nManager.getConstants().doLeftAndRightSwapInRTL ? styles.atRight : styles.atLeft;
|
|
629
|
+
}
|
|
630
|
+
function listOf(children) {
|
|
631
|
+
for (const child of Children.toArray(children)) {
|
|
632
|
+
if (isValidElement(child) && child.type === TabsList) return child;
|
|
633
|
+
if (isValidElement(child) && child.type !== Tabs) {
|
|
634
|
+
const nested = listOf(child.props.children);
|
|
635
|
+
if (nested !== void 0) return nested;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* One tab as the bar draws it, from its entry in the collection: a `tab`
|
|
641
|
+
* that selects itself when pressed, and reports where it and its label lie
|
|
642
|
+
* so the indicator can follow them.
|
|
643
|
+
*/
|
|
644
|
+
function ListTab(t0) {
|
|
645
|
+
const $ = c(57);
|
|
646
|
+
const { bar, ids, node, onMeasure, state } = t0;
|
|
647
|
+
const theme = useTheme();
|
|
648
|
+
const own = stylesOf(theme);
|
|
649
|
+
const role = useTypeRole("titleSmall");
|
|
650
|
+
let ariaLabel;
|
|
651
|
+
let badge;
|
|
652
|
+
let children;
|
|
653
|
+
let href;
|
|
654
|
+
let icon;
|
|
655
|
+
let onBlur;
|
|
656
|
+
let onFocus;
|
|
657
|
+
let onHoverIn;
|
|
658
|
+
let onHoverOut;
|
|
659
|
+
let onLayout;
|
|
660
|
+
let onPress;
|
|
661
|
+
let onPressIn;
|
|
662
|
+
let onPressOut;
|
|
663
|
+
let props;
|
|
664
|
+
let ref;
|
|
665
|
+
let style;
|
|
666
|
+
if ($[0] !== node.props) {
|
|
667
|
+
const { "aria-label": t1, badge: t2, children: t3, href: t4, icon: t5, id: _id, isDisabled: _isDisabled, onBlur: t6, onFocus: t7, onHoverIn: t8, onHoverOut: t9, onLayout: t10, onPress: t11, onPressIn: t12, onPressOut: t13, ref: t14, style: t15, textValue: _textValue, ...t16 } = node.props;
|
|
668
|
+
ariaLabel = t1;
|
|
669
|
+
badge = t2;
|
|
670
|
+
children = t3;
|
|
671
|
+
href = t4;
|
|
672
|
+
icon = t5;
|
|
673
|
+
onBlur = t6;
|
|
674
|
+
onFocus = t7;
|
|
675
|
+
onHoverIn = t8;
|
|
676
|
+
onHoverOut = t9;
|
|
677
|
+
onLayout = t10;
|
|
678
|
+
onPress = t11;
|
|
679
|
+
onPressIn = t12;
|
|
680
|
+
onPressOut = t13;
|
|
681
|
+
ref = t14;
|
|
682
|
+
style = t15;
|
|
683
|
+
props = t16;
|
|
684
|
+
$[0] = node.props;
|
|
685
|
+
$[1] = ariaLabel;
|
|
686
|
+
$[2] = badge;
|
|
687
|
+
$[3] = children;
|
|
688
|
+
$[4] = href;
|
|
689
|
+
$[5] = icon;
|
|
690
|
+
$[6] = onBlur;
|
|
691
|
+
$[7] = onFocus;
|
|
692
|
+
$[8] = onHoverIn;
|
|
693
|
+
$[9] = onHoverOut;
|
|
694
|
+
$[10] = onLayout;
|
|
695
|
+
$[11] = onPress;
|
|
696
|
+
$[12] = onPressIn;
|
|
697
|
+
$[13] = onPressOut;
|
|
698
|
+
$[14] = props;
|
|
699
|
+
$[15] = ref;
|
|
700
|
+
$[16] = style;
|
|
701
|
+
} else {
|
|
702
|
+
ariaLabel = $[1];
|
|
703
|
+
badge = $[2];
|
|
704
|
+
children = $[3];
|
|
705
|
+
href = $[4];
|
|
706
|
+
icon = $[5];
|
|
707
|
+
onBlur = $[6];
|
|
708
|
+
onFocus = $[7];
|
|
709
|
+
onHoverIn = $[8];
|
|
710
|
+
onHoverOut = $[9];
|
|
711
|
+
onLayout = $[10];
|
|
712
|
+
onPress = $[11];
|
|
713
|
+
onPressIn = $[12];
|
|
714
|
+
onPressOut = $[13];
|
|
715
|
+
props = $[14];
|
|
716
|
+
ref = $[15];
|
|
717
|
+
style = $[16];
|
|
718
|
+
}
|
|
719
|
+
const { key } = node;
|
|
720
|
+
const disabled = state.isDisabled || state.selectionManager.isDisabled(key);
|
|
721
|
+
const selected = state.selectedKey === key;
|
|
722
|
+
const { variant } = bar;
|
|
723
|
+
const feedback = usePressFeedback({
|
|
724
|
+
color: variant === "primary" && selected ? theme.colors.primary : theme.colors.onSurface,
|
|
725
|
+
disabled,
|
|
726
|
+
onBlur,
|
|
727
|
+
onFocus,
|
|
728
|
+
onHoverIn,
|
|
729
|
+
onHoverOut,
|
|
730
|
+
onPressIn,
|
|
731
|
+
onPressOut,
|
|
732
|
+
pressedColor: variant === "primary" ? theme.colors.primary : theme.colors.onSurface
|
|
733
|
+
});
|
|
734
|
+
const press = useLinkPress(href, onPress);
|
|
735
|
+
const vertical = bar.orientation === "vertical";
|
|
736
|
+
const hasIcon = icon !== void 0 && icon !== null;
|
|
737
|
+
const stacked = hasIcon && variant === "primary";
|
|
738
|
+
const color = colorOf(theme, variant, {
|
|
739
|
+
disabled,
|
|
740
|
+
engaged: feedback.hovered || feedback.pressed || feedback.ring !== void 0,
|
|
741
|
+
selected
|
|
742
|
+
});
|
|
743
|
+
let t1;
|
|
744
|
+
if ($[17] !== badge || $[18] !== stacked) {
|
|
745
|
+
t1 = stacked ? null : badgeFor(badge);
|
|
746
|
+
$[17] = badge;
|
|
747
|
+
$[18] = stacked;
|
|
748
|
+
$[19] = t1;
|
|
749
|
+
} else t1 = $[19];
|
|
750
|
+
const after = t1;
|
|
751
|
+
const text = /* @__PURE__ */ jsx(Text, {
|
|
752
|
+
numberOfLines: stacked ? 1 : 2,
|
|
753
|
+
style: composeStyles(role, styles.text, vertical ? styles.textVertical : void 0, { color }),
|
|
754
|
+
children
|
|
755
|
+
});
|
|
756
|
+
const T0 = Pressable;
|
|
757
|
+
let t2;
|
|
758
|
+
if ($[20] !== ariaLabel || $[21] !== children) {
|
|
759
|
+
t2 = ariaLabel ?? nameOf(children);
|
|
760
|
+
$[20] = ariaLabel;
|
|
761
|
+
$[21] = children;
|
|
762
|
+
$[22] = t2;
|
|
763
|
+
} else t2 = $[22];
|
|
764
|
+
let t3;
|
|
765
|
+
if ($[23] !== ids || $[24] !== key) {
|
|
766
|
+
t3 = tabIdOf(ids, key);
|
|
767
|
+
$[23] = ids;
|
|
768
|
+
$[24] = key;
|
|
769
|
+
$[25] = t3;
|
|
770
|
+
} else t3 = $[25];
|
|
771
|
+
const t4 = "tab";
|
|
772
|
+
const t5 = feedback.handlers;
|
|
773
|
+
let t6;
|
|
774
|
+
if ($[26] !== key || $[27] !== onLayout || $[28] !== onMeasure) {
|
|
775
|
+
t6 = measureThen(onMeasure, key, "tab", onLayout);
|
|
776
|
+
$[26] = key;
|
|
777
|
+
$[27] = onLayout;
|
|
778
|
+
$[28] = onMeasure;
|
|
779
|
+
$[29] = t6;
|
|
780
|
+
} else t6 = $[29];
|
|
781
|
+
let t7;
|
|
782
|
+
if ($[30] !== key || $[31] !== press || $[32] !== state) {
|
|
783
|
+
t7 = selectThen(state, key, press);
|
|
784
|
+
$[30] = key;
|
|
785
|
+
$[31] = press;
|
|
786
|
+
$[32] = state;
|
|
787
|
+
$[33] = t7;
|
|
788
|
+
} else t7 = $[33];
|
|
789
|
+
const t8 = composeStyles(own.tab, vertical ? styles.tabVertical : tabWidthOf(bar.layout), stacked ? styles.tabStacked : void 0, feedback.ring, feedback.ring === void 0 ? void 0 : ringStyles.ring, style);
|
|
790
|
+
const t9 = feedback.layer;
|
|
791
|
+
const T1 = View;
|
|
792
|
+
let t10;
|
|
793
|
+
if ($[34] !== key || $[35] !== onMeasure) {
|
|
794
|
+
t10 = measureThen(onMeasure, key, "label");
|
|
795
|
+
$[34] = key;
|
|
796
|
+
$[35] = onMeasure;
|
|
797
|
+
$[36] = t10;
|
|
798
|
+
} else t10 = $[36];
|
|
799
|
+
const t11 = composeStyles(styles.label, hasIcon ? stacked ? own.labelStacked : own.labelInline : void 0);
|
|
800
|
+
const t12 = after === null ? text : /* @__PURE__ */ jsxs(View, {
|
|
801
|
+
style: composeStyles(styles.line, own.lineBadged),
|
|
802
|
+
children: [text, after]
|
|
803
|
+
});
|
|
804
|
+
const t13 = hasIcon ? /* @__PURE__ */ jsx(View, {
|
|
805
|
+
style: styles.icon,
|
|
806
|
+
children: /* @__PURE__ */ jsx(IconStyleContext, {
|
|
807
|
+
value: iconStyleOf(color),
|
|
808
|
+
children: stacked ? badgeFor(badge, icon) : icon
|
|
809
|
+
})
|
|
810
|
+
}) : null;
|
|
811
|
+
let t14;
|
|
812
|
+
if ($[37] !== T1 || $[38] !== t10 || $[39] !== t11 || $[40] !== t12 || $[41] !== t13) {
|
|
813
|
+
t14 = /* @__PURE__ */ jsxs(T1, {
|
|
814
|
+
onLayout: t10,
|
|
815
|
+
style: t11,
|
|
816
|
+
children: [t12, t13]
|
|
817
|
+
});
|
|
818
|
+
$[37] = T1;
|
|
819
|
+
$[38] = t10;
|
|
820
|
+
$[39] = t11;
|
|
821
|
+
$[40] = t12;
|
|
822
|
+
$[41] = t13;
|
|
823
|
+
$[42] = t14;
|
|
824
|
+
} else t14 = $[42];
|
|
825
|
+
let t15;
|
|
826
|
+
if ($[43] !== T0 || $[44] !== disabled || $[45] !== feedback.handlers || $[46] !== feedback.layer || $[47] !== props || $[48] !== ref || $[49] !== selected || $[50] !== t14 || $[51] !== t2 || $[52] !== t3 || $[53] !== t6 || $[54] !== t7 || $[55] !== t8) {
|
|
827
|
+
t15 = /* @__PURE__ */ jsxs(T0, {
|
|
828
|
+
"aria-label": t2,
|
|
829
|
+
"aria-selected": selected,
|
|
830
|
+
id: t3,
|
|
831
|
+
ref,
|
|
832
|
+
role: t4,
|
|
833
|
+
...props,
|
|
834
|
+
...t5,
|
|
835
|
+
disabled,
|
|
836
|
+
onLayout: t6,
|
|
837
|
+
onPress: t7,
|
|
838
|
+
style: t8,
|
|
839
|
+
children: [t9, t14]
|
|
840
|
+
});
|
|
841
|
+
$[43] = T0;
|
|
842
|
+
$[44] = disabled;
|
|
843
|
+
$[45] = feedback.handlers;
|
|
844
|
+
$[46] = feedback.layer;
|
|
845
|
+
$[47] = props;
|
|
846
|
+
$[48] = ref;
|
|
847
|
+
$[49] = selected;
|
|
848
|
+
$[50] = t14;
|
|
849
|
+
$[51] = t2;
|
|
850
|
+
$[52] = t3;
|
|
851
|
+
$[53] = t6;
|
|
852
|
+
$[54] = t7;
|
|
853
|
+
$[55] = t8;
|
|
854
|
+
$[56] = t15;
|
|
855
|
+
} else t15 = $[56];
|
|
856
|
+
return t15;
|
|
857
|
+
}
|
|
858
|
+
function measureThen(onMeasure, key, part, onLayout) {
|
|
859
|
+
return (event) => {
|
|
860
|
+
onMeasure(key, part, event.nativeEvent.layout);
|
|
861
|
+
onLayout?.(event);
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
function nameOf(children) {
|
|
865
|
+
return typeof children === "string" ? children : void 0;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Where the indicator lies along the bar, from the selected tab's measured
|
|
869
|
+
* place: under its label on a horizontal primary bar, 2dp short of it at
|
|
870
|
+
* either end and at least 24dp, and along the tab's whole length on a
|
|
871
|
+
* secondary bar. Down a vertical bar the same two, along the tab's height.
|
|
872
|
+
* Nothing until what it follows has been measured.
|
|
873
|
+
*/
|
|
874
|
+
function placementOf({ orientation, variant }, measured, inset) {
|
|
875
|
+
const tab = measured?.tab;
|
|
876
|
+
if (tab === void 0) return;
|
|
877
|
+
if (orientation === "vertical") {
|
|
878
|
+
if (variant === "secondary") return {
|
|
879
|
+
length: tab.height,
|
|
880
|
+
offset: tab.y
|
|
881
|
+
};
|
|
882
|
+
const length = Math.max(LEAST_INDICATOR, tab.height - 2 * inset);
|
|
883
|
+
return {
|
|
884
|
+
length,
|
|
885
|
+
offset: tab.y + (tab.height - length) / 2
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
if (variant === "secondary") return {
|
|
889
|
+
length: tab.width,
|
|
890
|
+
offset: tab.x
|
|
891
|
+
};
|
|
892
|
+
const label = measured?.label;
|
|
893
|
+
if (label === void 0) return;
|
|
894
|
+
const length = Math.max(LEAST_INDICATOR, label.width - 2 * inset);
|
|
895
|
+
return {
|
|
896
|
+
length,
|
|
897
|
+
offset: tab.x + label.x + (label.width - length) / 2
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
function revealOffset(scrolled, viewport, start, size) {
|
|
901
|
+
if (start < scrolled) return start;
|
|
902
|
+
if (start + size > scrolled + viewport) return start + size - viewport;
|
|
903
|
+
}
|
|
904
|
+
function selectThen(state, key, press) {
|
|
905
|
+
return (event) => {
|
|
906
|
+
state.setSelectedKey(key);
|
|
907
|
+
press(event);
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
function tabIdOf(ids, key) {
|
|
911
|
+
return `${ids}-tab-${String(key).replaceAll(/\s+/gu, "")}`;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* The content of one tab, drawn while its tab is selected. Its `id` is the
|
|
915
|
+
* tab's.
|
|
916
|
+
*
|
|
917
|
+
* `style`, `ref` and `testID` land on the panel's own view.
|
|
918
|
+
*/
|
|
919
|
+
function TabsPanel(t0) {
|
|
920
|
+
const $ = c(21);
|
|
921
|
+
const { children, id, ref, style, testID } = t0;
|
|
922
|
+
const { bar, ids, state } = useTabs("Tabs.Panel");
|
|
923
|
+
const report = use(PanelHeightContext);
|
|
924
|
+
const key = id ?? state.selectedKey;
|
|
925
|
+
const shown = key !== null && key === state.selectedKey;
|
|
926
|
+
let t1;
|
|
927
|
+
let t2;
|
|
928
|
+
if ($[0] !== key || $[1] !== report || $[2] !== shown) {
|
|
929
|
+
t1 = () => {
|
|
930
|
+
if (report === null || !shown) return;
|
|
931
|
+
return () => {
|
|
932
|
+
report(key, void 0);
|
|
933
|
+
};
|
|
934
|
+
};
|
|
935
|
+
t2 = [
|
|
936
|
+
key,
|
|
937
|
+
report,
|
|
938
|
+
shown
|
|
939
|
+
];
|
|
940
|
+
$[0] = key;
|
|
941
|
+
$[1] = report;
|
|
942
|
+
$[2] = shown;
|
|
943
|
+
$[3] = t1;
|
|
944
|
+
$[4] = t2;
|
|
945
|
+
} else {
|
|
946
|
+
t1 = $[3];
|
|
947
|
+
t2 = $[4];
|
|
948
|
+
}
|
|
949
|
+
useEffect(t1, t2);
|
|
950
|
+
if (!shown) return null;
|
|
951
|
+
let t3;
|
|
952
|
+
if ($[5] !== ids || $[6] !== key) {
|
|
953
|
+
t3 = tabIdOf(ids, key);
|
|
954
|
+
$[5] = ids;
|
|
955
|
+
$[6] = key;
|
|
956
|
+
$[7] = t3;
|
|
957
|
+
} else t3 = $[7];
|
|
958
|
+
let t4;
|
|
959
|
+
if ($[8] !== key || $[9] !== report) {
|
|
960
|
+
t4 = heightOf(report, key);
|
|
961
|
+
$[8] = key;
|
|
962
|
+
$[9] = report;
|
|
963
|
+
$[10] = t4;
|
|
964
|
+
} else t4 = $[10];
|
|
965
|
+
const t5 = bar.orientation === "vertical" ? styles.besideBar : void 0;
|
|
966
|
+
let t6;
|
|
967
|
+
if ($[11] !== style || $[12] !== t5) {
|
|
968
|
+
t6 = composeStyles(t5, style);
|
|
969
|
+
$[11] = style;
|
|
970
|
+
$[12] = t5;
|
|
971
|
+
$[13] = t6;
|
|
972
|
+
} else t6 = $[13];
|
|
973
|
+
let t7;
|
|
974
|
+
if ($[14] !== children || $[15] !== ref || $[16] !== t3 || $[17] !== t4 || $[18] !== t6 || $[19] !== testID) {
|
|
975
|
+
t7 = /* @__PURE__ */ jsx(View, {
|
|
976
|
+
"aria-labelledby": t3,
|
|
977
|
+
onLayout: t4,
|
|
978
|
+
ref,
|
|
979
|
+
role: "tabpanel",
|
|
980
|
+
style: t6,
|
|
981
|
+
testID,
|
|
982
|
+
children
|
|
983
|
+
});
|
|
984
|
+
$[14] = children;
|
|
985
|
+
$[15] = ref;
|
|
986
|
+
$[16] = t3;
|
|
987
|
+
$[17] = t4;
|
|
988
|
+
$[18] = t6;
|
|
989
|
+
$[19] = testID;
|
|
990
|
+
$[20] = t7;
|
|
991
|
+
} else t7 = $[20];
|
|
992
|
+
return t7;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* An optional box around the panels, which moves its height as one panel
|
|
996
|
+
* gives way to the next, over medium1 on the emphasized curve and at once
|
|
997
|
+
* under reduced motion. Without it the panels still work; the box around
|
|
998
|
+
* them simply jumps from one height to the other.
|
|
999
|
+
*
|
|
1000
|
+
* `style`, `ref` and `testID` land on the box.
|
|
1001
|
+
*/
|
|
1002
|
+
function TabsPanels(t0) {
|
|
1003
|
+
const $ = c(22);
|
|
1004
|
+
const { children, ref, style, testID } = t0;
|
|
1005
|
+
const { bar, state } = useTabs("Tabs.Panels");
|
|
1006
|
+
const { motion } = useTheme();
|
|
1007
|
+
const reduceMotion = useReducedMotion();
|
|
1008
|
+
const [heights, setHeights] = useState(NO_HEIGHTS);
|
|
1009
|
+
const height = useSharedValue(-1);
|
|
1010
|
+
const placed = useRef(void 0);
|
|
1011
|
+
const { selectedKey } = state;
|
|
1012
|
+
let t1;
|
|
1013
|
+
if ($[0] !== heights || $[1] !== selectedKey) {
|
|
1014
|
+
t1 = selectedKey === null ? void 0 : heights.get(selectedKey);
|
|
1015
|
+
$[0] = heights;
|
|
1016
|
+
$[1] = selectedKey;
|
|
1017
|
+
$[2] = t1;
|
|
1018
|
+
} else t1 = $[2];
|
|
1019
|
+
const target = t1;
|
|
1020
|
+
let t2;
|
|
1021
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1022
|
+
t2 = (key, next) => {
|
|
1023
|
+
setHeights((previous) => withHeight(previous, key, next));
|
|
1024
|
+
};
|
|
1025
|
+
$[3] = t2;
|
|
1026
|
+
} else t2 = $[3];
|
|
1027
|
+
const report = t2;
|
|
1028
|
+
let t3;
|
|
1029
|
+
let t4;
|
|
1030
|
+
if ($[4] !== height || $[5] !== motion || $[6] !== reduceMotion || $[7] !== selectedKey || $[8] !== target) {
|
|
1031
|
+
t3 = () => {
|
|
1032
|
+
if (target === void 0) return;
|
|
1033
|
+
const moved = placed.current !== void 0 && placed.current !== selectedKey;
|
|
1034
|
+
placed.current = selectedKey;
|
|
1035
|
+
height.set(moved && !reduceMotion ? withTiming(target, {
|
|
1036
|
+
duration: motion.durationMedium1,
|
|
1037
|
+
easing: Easing.bezier(...motion.easingEmphasized)
|
|
1038
|
+
}) : target);
|
|
1039
|
+
};
|
|
1040
|
+
t4 = [
|
|
1041
|
+
height,
|
|
1042
|
+
motion,
|
|
1043
|
+
reduceMotion,
|
|
1044
|
+
selectedKey,
|
|
1045
|
+
target
|
|
1046
|
+
];
|
|
1047
|
+
$[4] = height;
|
|
1048
|
+
$[5] = motion;
|
|
1049
|
+
$[6] = reduceMotion;
|
|
1050
|
+
$[7] = selectedKey;
|
|
1051
|
+
$[8] = target;
|
|
1052
|
+
$[9] = t3;
|
|
1053
|
+
$[10] = t4;
|
|
1054
|
+
} else {
|
|
1055
|
+
t3 = $[9];
|
|
1056
|
+
t4 = $[10];
|
|
1057
|
+
}
|
|
1058
|
+
useEffect(t3, t4);
|
|
1059
|
+
const box = useAnimatedStyle(() => {
|
|
1060
|
+
"worklet";
|
|
1061
|
+
const measuredHeight = height.get();
|
|
1062
|
+
return measuredHeight < 0 ? {} : { height: measuredHeight };
|
|
1063
|
+
});
|
|
1064
|
+
const t5 = bar.orientation === "vertical" ? styles.besideBar : void 0;
|
|
1065
|
+
let t6;
|
|
1066
|
+
if ($[11] !== box || $[12] !== style || $[13] !== t5) {
|
|
1067
|
+
t6 = composeStyles(styles.clip, t5, box, style);
|
|
1068
|
+
$[11] = box;
|
|
1069
|
+
$[12] = style;
|
|
1070
|
+
$[13] = t5;
|
|
1071
|
+
$[14] = t6;
|
|
1072
|
+
} else t6 = $[14];
|
|
1073
|
+
let t7;
|
|
1074
|
+
if ($[15] !== children) {
|
|
1075
|
+
t7 = /* @__PURE__ */ jsx(View, { children });
|
|
1076
|
+
$[15] = children;
|
|
1077
|
+
$[16] = t7;
|
|
1078
|
+
} else t7 = $[16];
|
|
1079
|
+
let t8;
|
|
1080
|
+
if ($[17] !== ref || $[18] !== t6 || $[19] !== t7 || $[20] !== testID) {
|
|
1081
|
+
t8 = /* @__PURE__ */ jsx(PanelHeightContext, {
|
|
1082
|
+
value: report,
|
|
1083
|
+
children: /* @__PURE__ */ jsx(Animated.View, {
|
|
1084
|
+
ref,
|
|
1085
|
+
style: t6,
|
|
1086
|
+
testID,
|
|
1087
|
+
children: t7
|
|
1088
|
+
})
|
|
1089
|
+
});
|
|
1090
|
+
$[17] = ref;
|
|
1091
|
+
$[18] = t6;
|
|
1092
|
+
$[19] = t7;
|
|
1093
|
+
$[20] = testID;
|
|
1094
|
+
$[21] = t8;
|
|
1095
|
+
} else t8 = $[21];
|
|
1096
|
+
return t8;
|
|
1097
|
+
}
|
|
1098
|
+
function tabWidthOf(layout) {
|
|
1099
|
+
return layout === "scrollable" ? styles.tabScrollable : styles.tabShared;
|
|
1100
|
+
}
|
|
1101
|
+
function useTabs(part, list = false) {
|
|
1102
|
+
const value = use(TabsContext);
|
|
1103
|
+
if (value === null) throw new Error(`${part} is drawn inside Tabs.`);
|
|
1104
|
+
if (list && !value.found) throw new Error("Tabs.List is written among the children of Tabs, inside any view or fragment, rather than in a component of its own.");
|
|
1105
|
+
return value;
|
|
1106
|
+
}
|
|
1107
|
+
function viewportOf(setViewport, vertical) {
|
|
1108
|
+
return (event) => {
|
|
1109
|
+
const { height, width } = event.nativeEvent.layout;
|
|
1110
|
+
setViewport(vertical ? height : width);
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
function withHeight(previous, key, height) {
|
|
1114
|
+
if (previous.get(key) === height) return previous;
|
|
1115
|
+
const next = new Map(previous);
|
|
1116
|
+
if (height === void 0) next.delete(key);
|
|
1117
|
+
else next.set(key, height);
|
|
1118
|
+
return next;
|
|
1119
|
+
}
|
|
1120
|
+
function withMeasurement(previous, key, part, layout) {
|
|
1121
|
+
const known = previous.get(key)?.[part];
|
|
1122
|
+
if (known !== void 0 && known.x === layout.x && known.y === layout.y && known.width === layout.width && known.height === layout.height) return previous;
|
|
1123
|
+
const next = new Map(previous);
|
|
1124
|
+
next.set(key, {
|
|
1125
|
+
...previous.get(key),
|
|
1126
|
+
[part]: layout
|
|
1127
|
+
});
|
|
1128
|
+
return next;
|
|
1129
|
+
}
|
|
1130
|
+
Tabs.List = TabsList;
|
|
1131
|
+
Tabs.Panel = TabsPanel;
|
|
1132
|
+
Tabs.Panels = TabsPanels;
|
|
1133
|
+
Tabs.Tab = TabsTab;
|
|
1134
|
+
//#endregion
|
|
1135
|
+
export { Tabs, TabsList, TabsPanel, TabsPanels, TabsTab };
|
|
1136
|
+
|
|
1137
|
+
//# sourceMappingURL=index.js.map
|