@kanso-labs/react-native-kanso-ui 0.5.0 → 0.7.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 -1
- package/dist/badge/index.js +74 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/badge/styles.js +51 -0
- package/dist/badge/styles.js.map +1 -0
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/pending.js +1 -1
- package/dist/button/slots.d.ts +2 -2
- package/dist/calendar/index.js +1182 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/calendar/styles.js +120 -0
- package/dist/calendar/styles.js.map +1 -0
- package/dist/chip/index.js +2 -2
- package/dist/components/app-bar/index.d.ts +111 -0
- package/dist/components/app-bar/index.js +341 -0
- package/dist/components/app-bar/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +2 -2
- package/dist/components/calendar/index.d.ts +51 -0
- package/dist/components/calendar/index.js +82 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +3 -3
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip-group/index.d.ts +1 -1
- package/dist/components/chip-group/index.js +4 -4
- package/dist/components/copy-field/index.d.ts +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/currency/index.d.ts +1 -1
- package/dist/components/currency/index.js +1 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/index.js +2 -2
- package/dist/components/icon-button/index.d.ts +1 -1
- package/dist/components/icon-button/index.js +2 -2
- package/dist/components/link/index.d.ts +1 -1
- package/dist/components/link/index.js +3 -3
- package/dist/components/list/index.d.ts +1 -1
- package/dist/components/list/index.js +5 -5
- package/dist/components/list-detail/index.d.ts +56 -0
- package/dist/components/list-detail/index.js +169 -0
- package/dist/components/list-detail/index.js.map +1 -0
- package/dist/components/list-item/index.d.ts +1 -1
- package/dist/components/list-item/index.js +1 -1
- package/dist/components/menu/index.d.ts +1 -1
- package/dist/components/menu/index.js +7 -7
- package/dist/components/meter/index.d.ts +1 -1
- package/dist/components/meter/index.js +1 -1
- package/dist/components/navigation-bar/index.d.ts +164 -0
- package/dist/components/navigation-bar/index.js +470 -0
- package/dist/components/navigation-bar/index.js.map +1 -0
- package/dist/components/navigation-rail/index.d.ts +68 -0
- package/dist/components/navigation-rail/index.js +294 -0
- package/dist/components/navigation-rail/index.js.map +1 -0
- package/dist/components/number-field/index.d.ts +1 -1
- package/dist/components/number-field/index.js +5 -5
- package/dist/components/popover/index.d.ts +1 -1
- package/dist/components/popover/index.js +3 -3
- package/dist/components/product-icon/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.js +3 -3
- package/dist/components/radio-group/index.d.ts +1 -1
- package/dist/components/radio-group/index.js +3 -3
- package/dist/components/search-field/index.d.ts +1 -1
- package/dist/components/search-field/index.js +5 -5
- package/dist/components/segmented-button/index.d.ts +1 -1
- package/dist/components/segmented-button/index.js +5 -5
- package/dist/components/separator/index.d.ts +1 -1
- package/dist/components/separator/index.js +1 -1
- package/dist/components/sheet/index.d.ts +1 -1
- package/dist/components/sheet/index.js +3 -3
- package/dist/components/snackbar/index.d.ts +1 -1
- package/dist/components/snackbar/index.js +4 -4
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js +4 -4
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/text-field/index.d.ts +1 -1
- package/dist/components/text-field/index.js +1 -1
- package/dist/control/checkbox-box.js +2 -2
- package/dist/control/index.js +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js +4 -4
- package/dist/form/index.d.ts +1 -1
- package/dist/glyphs/index.js +21 -3
- package/dist/glyphs/index.js.map +1 -1
- package/dist/hooks/useAppBarScroll.d.ts +56 -0
- package/dist/hooks/useAppBarScroll.js +87 -0
- package/dist/hooks/useAppBarScroll.js.map +1 -0
- package/dist/i18n/messages.js +374 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +10 -4
- package/dist/indicator/index.d.ts +2 -2
- package/dist/indicator/index.js +3 -3
- package/dist/indicator/motion.js +1 -1
- package/dist/mark/index.d.ts +1 -1
- package/dist/mark/index.js +2 -2
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +2 -2
- package/dist/navigation/index.d.ts +36 -0
- package/dist/navigation/index.js +454 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/styles.js +83 -0
- package/dist/navigation/styles.js.map +1 -0
- package/dist/overlay/anchored.d.ts +2 -2
- package/dist/overlay/anchored.js +1 -1
- package/dist/overlay/host.d.ts +2 -2
- package/dist/overlay/host.js +1 -1
- package/dist/overlay/panel.js +2 -2
- package/dist/press/index.js +75 -69
- package/dist/press/index.js.map +1 -1
- package/dist/router/index.js +1 -1
- package/dist/row/index.js +1 -1
- package/dist/theme/scope.js +1 -1
- package/dist/theme-scope.d.ts +1 -1
- package/dist/theme-scope.js +1 -1
- package/dist/typography/fonts.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { IconStyleContext } from "../glyphs/icon-style.js";
|
|
2
|
+
import { useTheme } from "../theme/scope.js";
|
|
3
|
+
import { composeStyles } from "../theme/styles.js";
|
|
4
|
+
import { hitSlop, usePressFeedback } from "../press/index.js";
|
|
5
|
+
import { useTypeRole } from "../typography/roles.js";
|
|
6
|
+
import { withOpacity } from "../theme/color.js";
|
|
7
|
+
import { useLinkPress } from "../router/index.js";
|
|
8
|
+
import { Badge } from "../badge/index.js";
|
|
9
|
+
import { INDICATOR, styles, stylesOf } from "./styles.js";
|
|
10
|
+
import { c } from "react/compiler-runtime";
|
|
11
|
+
import { Pressable, Text, View } from "react-native";
|
|
12
|
+
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from "react-native-reanimated";
|
|
13
|
+
import { createContext, use, useEffect } from "react";
|
|
14
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
//#region src/navigation/index.tsx
|
|
16
|
+
const GROWN_FROM = .4;
|
|
17
|
+
const FADE_SHARE = .2;
|
|
18
|
+
const ICON_SIZE = 24;
|
|
19
|
+
const BESIDE = {
|
|
20
|
+
collapsed: false,
|
|
21
|
+
expanded: true,
|
|
22
|
+
horizontal: true,
|
|
23
|
+
vertical: false
|
|
24
|
+
};
|
|
25
|
+
const NavigationContext = createContext({
|
|
26
|
+
form: "vertical",
|
|
27
|
+
measuring: false
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* The active indicator's fill, which grows from its centre while its
|
|
31
|
+
* destination is current and shrinks back once it is not.
|
|
32
|
+
*/
|
|
33
|
+
function ActiveIndicator(t0) {
|
|
34
|
+
const $ = c(12);
|
|
35
|
+
const { selected } = t0;
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
const { colors, motion } = theme;
|
|
38
|
+
const reduceMotion = useReducedMotion();
|
|
39
|
+
const progress = useSharedValue(selected ? 1 : 0);
|
|
40
|
+
let t1;
|
|
41
|
+
let t2;
|
|
42
|
+
if ($[0] !== motion || $[1] !== progress || $[2] !== reduceMotion || $[3] !== selected) {
|
|
43
|
+
t1 = () => {
|
|
44
|
+
const target = selected ? 1 : 0;
|
|
45
|
+
progress.set(reduceMotion ? target : withTiming(target, {
|
|
46
|
+
duration: motion.durationLong2,
|
|
47
|
+
easing: Easing.bezier(...motion.easingEmphasized)
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
t2 = [
|
|
51
|
+
motion,
|
|
52
|
+
progress,
|
|
53
|
+
reduceMotion,
|
|
54
|
+
selected
|
|
55
|
+
];
|
|
56
|
+
$[0] = motion;
|
|
57
|
+
$[1] = progress;
|
|
58
|
+
$[2] = reduceMotion;
|
|
59
|
+
$[3] = selected;
|
|
60
|
+
$[4] = t1;
|
|
61
|
+
$[5] = t2;
|
|
62
|
+
} else {
|
|
63
|
+
t1 = $[4];
|
|
64
|
+
t2 = $[5];
|
|
65
|
+
}
|
|
66
|
+
useEffect(t1, t2);
|
|
67
|
+
const motionStyle = useAnimatedStyle(() => {
|
|
68
|
+
"worklet";
|
|
69
|
+
const grown = progress.get();
|
|
70
|
+
return {
|
|
71
|
+
opacity: Math.min(1, grown / FADE_SHARE),
|
|
72
|
+
transform: [{ scaleX: GROWN_FROM + .6 * grown }]
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
let t3;
|
|
76
|
+
if ($[6] !== colors.secondaryContainer || $[7] !== motionStyle || $[8] !== theme) {
|
|
77
|
+
t3 = composeStyles(styles.fill, stylesOf(theme).pill, { backgroundColor: colors.secondaryContainer }, motionStyle);
|
|
78
|
+
$[6] = colors.secondaryContainer;
|
|
79
|
+
$[7] = motionStyle;
|
|
80
|
+
$[8] = theme;
|
|
81
|
+
$[9] = t3;
|
|
82
|
+
} else t3 = $[9];
|
|
83
|
+
let t4;
|
|
84
|
+
if ($[10] !== t3) {
|
|
85
|
+
t4 = /* @__PURE__ */ jsx(Animated.View, { style: t3 });
|
|
86
|
+
$[10] = t3;
|
|
87
|
+
$[11] = t4;
|
|
88
|
+
} else t4 = $[11];
|
|
89
|
+
return t4;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* What a destination draws over its indicator: the icon and its badge, and
|
|
93
|
+
* where the label is beside the icon the label before them in the tree,
|
|
94
|
+
* which the pill's reversed row draws after them.
|
|
95
|
+
*/
|
|
96
|
+
function DestinationContent(t0) {
|
|
97
|
+
const $ = c(20);
|
|
98
|
+
const { badge, form, icon, isDisabled, label, selected } = t0;
|
|
99
|
+
const theme = useTheme();
|
|
100
|
+
const beside = BESIDE[form];
|
|
101
|
+
let t1;
|
|
102
|
+
if ($[0] !== beside || $[1] !== form || $[2] !== isDisabled || $[3] !== label || $[4] !== selected) {
|
|
103
|
+
t1 = beside ? /* @__PURE__ */ jsx(Label, {
|
|
104
|
+
form,
|
|
105
|
+
isDisabled,
|
|
106
|
+
selected,
|
|
107
|
+
children: label
|
|
108
|
+
}) : null;
|
|
109
|
+
$[0] = beside;
|
|
110
|
+
$[1] = form;
|
|
111
|
+
$[2] = isDisabled;
|
|
112
|
+
$[3] = label;
|
|
113
|
+
$[4] = selected;
|
|
114
|
+
$[5] = t1;
|
|
115
|
+
} else t1 = $[5];
|
|
116
|
+
let t2;
|
|
117
|
+
if ($[6] !== isDisabled || $[7] !== selected || $[8] !== theme) {
|
|
118
|
+
t2 = iconStyleOf(iconColorOf(theme, isDisabled, selected));
|
|
119
|
+
$[6] = isDisabled;
|
|
120
|
+
$[7] = selected;
|
|
121
|
+
$[8] = theme;
|
|
122
|
+
$[9] = t2;
|
|
123
|
+
} else t2 = $[9];
|
|
124
|
+
let t3;
|
|
125
|
+
if ($[10] !== badge || $[11] !== beside || $[12] !== icon) {
|
|
126
|
+
t3 = badge === void 0 || badge === false ? icon : /* @__PURE__ */ jsx(Badge, {
|
|
127
|
+
count: badge === true ? void 0 : badge,
|
|
128
|
+
inFlow: beside,
|
|
129
|
+
children: icon
|
|
130
|
+
});
|
|
131
|
+
$[10] = badge;
|
|
132
|
+
$[11] = beside;
|
|
133
|
+
$[12] = icon;
|
|
134
|
+
$[13] = t3;
|
|
135
|
+
} else t3 = $[13];
|
|
136
|
+
let t4;
|
|
137
|
+
if ($[14] !== t2 || $[15] !== t3) {
|
|
138
|
+
t4 = /* @__PURE__ */ jsx(View, {
|
|
139
|
+
style: styles.icon,
|
|
140
|
+
children: /* @__PURE__ */ jsx(IconStyleContext, {
|
|
141
|
+
value: t2,
|
|
142
|
+
children: t3
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
$[14] = t2;
|
|
146
|
+
$[15] = t3;
|
|
147
|
+
$[16] = t4;
|
|
148
|
+
} else t4 = $[16];
|
|
149
|
+
let t5;
|
|
150
|
+
if ($[17] !== t1 || $[18] !== t4) {
|
|
151
|
+
t5 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t1, t4] });
|
|
152
|
+
$[17] = t1;
|
|
153
|
+
$[18] = t4;
|
|
154
|
+
$[19] = t5;
|
|
155
|
+
} else t5 = $[19];
|
|
156
|
+
return t5;
|
|
157
|
+
}
|
|
158
|
+
/** The colour a destination draws its icon in. */
|
|
159
|
+
function iconColorOf({ colors, stateLayerOpacity }, isDisabled, selected) {
|
|
160
|
+
if (isDisabled) return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent);
|
|
161
|
+
return selected ? colors.onSecondaryContainer : colors.onSurfaceVariant;
|
|
162
|
+
}
|
|
163
|
+
function iconStyleOf(color) {
|
|
164
|
+
return {
|
|
165
|
+
color,
|
|
166
|
+
size: ICON_SIZE
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A destination's label, on one line: in label large in an expanded rail,
|
|
171
|
+
* and in label medium everywhere else.
|
|
172
|
+
*/
|
|
173
|
+
function Label(t0) {
|
|
174
|
+
const $ = c(9);
|
|
175
|
+
const { children, form, isDisabled, selected } = t0;
|
|
176
|
+
const theme = useTheme();
|
|
177
|
+
const role = useTypeRole(form === "expanded" ? "labelLarge" : "labelMedium");
|
|
178
|
+
let t1;
|
|
179
|
+
if ($[0] !== form || $[1] !== isDisabled || $[2] !== role || $[3] !== selected || $[4] !== theme) {
|
|
180
|
+
t1 = composeStyles(role, styles.label, { color: labelColorOf(theme, form, isDisabled, selected) });
|
|
181
|
+
$[0] = form;
|
|
182
|
+
$[1] = isDisabled;
|
|
183
|
+
$[2] = role;
|
|
184
|
+
$[3] = selected;
|
|
185
|
+
$[4] = theme;
|
|
186
|
+
$[5] = t1;
|
|
187
|
+
} else t1 = $[5];
|
|
188
|
+
let t2;
|
|
189
|
+
if ($[6] !== children || $[7] !== t1) {
|
|
190
|
+
t2 = /* @__PURE__ */ jsx(Text, {
|
|
191
|
+
numberOfLines: 1,
|
|
192
|
+
style: t1,
|
|
193
|
+
children
|
|
194
|
+
});
|
|
195
|
+
$[6] = children;
|
|
196
|
+
$[7] = t1;
|
|
197
|
+
$[8] = t2;
|
|
198
|
+
} else t2 = $[8];
|
|
199
|
+
return t2;
|
|
200
|
+
}
|
|
201
|
+
/** The colour a destination draws its label in, which its form decides. */
|
|
202
|
+
function labelColorOf(theme, form, isDisabled, selected) {
|
|
203
|
+
return selected && !isDisabled && !BESIDE[form] ? theme.colors.secondary : iconColorOf(theme, isDisabled, selected);
|
|
204
|
+
}
|
|
205
|
+
function nameOf(children) {
|
|
206
|
+
return typeof children === "string" ? children : void 0;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* One destination, in the form the bar around it asks for: an icon and a
|
|
210
|
+
* label, and the active indicator behind the icon while it is current. A
|
|
211
|
+
* `tab` reporting whether it is selected.
|
|
212
|
+
*/
|
|
213
|
+
function NavigationDestination(t0) {
|
|
214
|
+
const $ = c(55);
|
|
215
|
+
let ariaLabel;
|
|
216
|
+
let badge;
|
|
217
|
+
let children;
|
|
218
|
+
let icon;
|
|
219
|
+
let onBlur;
|
|
220
|
+
let onFocus;
|
|
221
|
+
let onHoverIn;
|
|
222
|
+
let onHoverOut;
|
|
223
|
+
let onPressIn;
|
|
224
|
+
let onPressOut;
|
|
225
|
+
let props;
|
|
226
|
+
let selected;
|
|
227
|
+
let style;
|
|
228
|
+
let t1;
|
|
229
|
+
if ($[0] !== t0) {
|
|
230
|
+
({"aria-label": ariaLabel, badge, children, icon, isDisabled: t1, onBlur, onFocus, onHoverIn, onHoverOut, onPressIn, onPressOut, selected, style, ...props} = t0);
|
|
231
|
+
$[0] = t0;
|
|
232
|
+
$[1] = ariaLabel;
|
|
233
|
+
$[2] = badge;
|
|
234
|
+
$[3] = children;
|
|
235
|
+
$[4] = icon;
|
|
236
|
+
$[5] = onBlur;
|
|
237
|
+
$[6] = onFocus;
|
|
238
|
+
$[7] = onHoverIn;
|
|
239
|
+
$[8] = onHoverOut;
|
|
240
|
+
$[9] = onPressIn;
|
|
241
|
+
$[10] = onPressOut;
|
|
242
|
+
$[11] = props;
|
|
243
|
+
$[12] = selected;
|
|
244
|
+
$[13] = style;
|
|
245
|
+
$[14] = t1;
|
|
246
|
+
} else {
|
|
247
|
+
ariaLabel = $[1];
|
|
248
|
+
badge = $[2];
|
|
249
|
+
children = $[3];
|
|
250
|
+
icon = $[4];
|
|
251
|
+
onBlur = $[5];
|
|
252
|
+
onFocus = $[6];
|
|
253
|
+
onHoverIn = $[7];
|
|
254
|
+
onHoverOut = $[8];
|
|
255
|
+
onPressIn = $[9];
|
|
256
|
+
onPressOut = $[10];
|
|
257
|
+
props = $[11];
|
|
258
|
+
selected = $[12];
|
|
259
|
+
style = $[13];
|
|
260
|
+
t1 = $[14];
|
|
261
|
+
}
|
|
262
|
+
const isDisabled = t1 === void 0 ? false : t1;
|
|
263
|
+
const theme = useTheme();
|
|
264
|
+
const { form, measuring } = use(NavigationContext);
|
|
265
|
+
const own = stylesOf(theme);
|
|
266
|
+
const beside = BESIDE[form];
|
|
267
|
+
const feedback = usePressFeedback({
|
|
268
|
+
area: beside ? void 0 : INDICATOR,
|
|
269
|
+
color: theme.colors.onSecondaryContainer,
|
|
270
|
+
corners: own.pill,
|
|
271
|
+
disabled: isDisabled,
|
|
272
|
+
onBlur,
|
|
273
|
+
onFocus,
|
|
274
|
+
onHoverIn,
|
|
275
|
+
onHoverOut,
|
|
276
|
+
onPressIn,
|
|
277
|
+
onPressOut
|
|
278
|
+
});
|
|
279
|
+
let t2;
|
|
280
|
+
if ($[15] !== badge || $[16] !== children || $[17] !== form || $[18] !== icon || $[19] !== isDisabled || $[20] !== selected) {
|
|
281
|
+
t2 = /* @__PURE__ */ jsx(DestinationContent, {
|
|
282
|
+
badge,
|
|
283
|
+
form,
|
|
284
|
+
icon,
|
|
285
|
+
isDisabled,
|
|
286
|
+
label: children,
|
|
287
|
+
selected
|
|
288
|
+
});
|
|
289
|
+
$[15] = badge;
|
|
290
|
+
$[16] = children;
|
|
291
|
+
$[17] = form;
|
|
292
|
+
$[18] = icon;
|
|
293
|
+
$[19] = isDisabled;
|
|
294
|
+
$[20] = selected;
|
|
295
|
+
$[21] = t2;
|
|
296
|
+
} else t2 = $[21];
|
|
297
|
+
const content = t2;
|
|
298
|
+
if (measuring) return /* @__PURE__ */ jsx(View, {
|
|
299
|
+
style: own.horizontal,
|
|
300
|
+
children: content
|
|
301
|
+
});
|
|
302
|
+
if (beside) {
|
|
303
|
+
let t3;
|
|
304
|
+
if ($[22] !== ariaLabel || $[23] !== children) {
|
|
305
|
+
t3 = ariaLabel ?? nameOf(children);
|
|
306
|
+
$[22] = ariaLabel;
|
|
307
|
+
$[23] = children;
|
|
308
|
+
$[24] = t3;
|
|
309
|
+
} else t3 = $[24];
|
|
310
|
+
let t4;
|
|
311
|
+
if ($[25] !== form) {
|
|
312
|
+
t4 = form === "horizontal" ? hitSlop(40) : void 0;
|
|
313
|
+
$[25] = form;
|
|
314
|
+
$[26] = t4;
|
|
315
|
+
} else t4 = $[26];
|
|
316
|
+
let t5;
|
|
317
|
+
if ($[27] !== selected) {
|
|
318
|
+
t5 = /* @__PURE__ */ jsx(ActiveIndicator, { selected });
|
|
319
|
+
$[27] = selected;
|
|
320
|
+
$[28] = t5;
|
|
321
|
+
} else t5 = $[28];
|
|
322
|
+
return /* @__PURE__ */ jsxs(Pressable, {
|
|
323
|
+
"aria-label": t3,
|
|
324
|
+
"aria-selected": selected,
|
|
325
|
+
hitSlop: t4,
|
|
326
|
+
role: "tab",
|
|
327
|
+
...props,
|
|
328
|
+
...feedback.handlers,
|
|
329
|
+
disabled: isDisabled,
|
|
330
|
+
style: composeStyles(own[form], feedback.ring, style),
|
|
331
|
+
children: [
|
|
332
|
+
t5,
|
|
333
|
+
feedback.layer,
|
|
334
|
+
content
|
|
335
|
+
]
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
const T0 = Pressable;
|
|
339
|
+
let t3;
|
|
340
|
+
if ($[29] !== ariaLabel || $[30] !== children) {
|
|
341
|
+
t3 = ariaLabel ?? nameOf(children);
|
|
342
|
+
$[29] = ariaLabel;
|
|
343
|
+
$[30] = children;
|
|
344
|
+
$[31] = t3;
|
|
345
|
+
} else t3 = $[31];
|
|
346
|
+
const t4 = "tab";
|
|
347
|
+
const t5 = feedback.handlers;
|
|
348
|
+
const t6 = composeStyles(own[form], style);
|
|
349
|
+
let t7;
|
|
350
|
+
if ($[32] !== children || $[33] !== form || $[34] !== isDisabled || $[35] !== selected) {
|
|
351
|
+
t7 = /* @__PURE__ */ jsx(Label, {
|
|
352
|
+
form,
|
|
353
|
+
isDisabled,
|
|
354
|
+
selected,
|
|
355
|
+
children
|
|
356
|
+
});
|
|
357
|
+
$[32] = children;
|
|
358
|
+
$[33] = form;
|
|
359
|
+
$[34] = isDisabled;
|
|
360
|
+
$[35] = selected;
|
|
361
|
+
$[36] = t7;
|
|
362
|
+
} else t7 = $[36];
|
|
363
|
+
const T1 = View;
|
|
364
|
+
const t8 = composeStyles(own.indicator, feedback.ring);
|
|
365
|
+
let t9;
|
|
366
|
+
if ($[37] !== selected) {
|
|
367
|
+
t9 = /* @__PURE__ */ jsx(ActiveIndicator, { selected });
|
|
368
|
+
$[37] = selected;
|
|
369
|
+
$[38] = t9;
|
|
370
|
+
} else t9 = $[38];
|
|
371
|
+
let t10;
|
|
372
|
+
if ($[39] !== T1 || $[40] !== content || $[41] !== feedback.layer || $[42] !== t8 || $[43] !== t9) {
|
|
373
|
+
t10 = /* @__PURE__ */ jsxs(T1, {
|
|
374
|
+
style: t8,
|
|
375
|
+
children: [
|
|
376
|
+
t9,
|
|
377
|
+
feedback.layer,
|
|
378
|
+
content
|
|
379
|
+
]
|
|
380
|
+
});
|
|
381
|
+
$[39] = T1;
|
|
382
|
+
$[40] = content;
|
|
383
|
+
$[41] = feedback.layer;
|
|
384
|
+
$[42] = t8;
|
|
385
|
+
$[43] = t9;
|
|
386
|
+
$[44] = t10;
|
|
387
|
+
} else t10 = $[44];
|
|
388
|
+
let t11;
|
|
389
|
+
if ($[45] !== T0 || $[46] !== feedback.handlers || $[47] !== isDisabled || $[48] !== props || $[49] !== selected || $[50] !== t10 || $[51] !== t3 || $[52] !== t6 || $[53] !== t7) {
|
|
390
|
+
t11 = /* @__PURE__ */ jsxs(T0, {
|
|
391
|
+
"aria-label": t3,
|
|
392
|
+
"aria-selected": selected,
|
|
393
|
+
role: t4,
|
|
394
|
+
...props,
|
|
395
|
+
...t5,
|
|
396
|
+
disabled: isDisabled,
|
|
397
|
+
style: t6,
|
|
398
|
+
children: [t7, t10]
|
|
399
|
+
});
|
|
400
|
+
$[45] = T0;
|
|
401
|
+
$[46] = feedback.handlers;
|
|
402
|
+
$[47] = isDisabled;
|
|
403
|
+
$[48] = props;
|
|
404
|
+
$[49] = selected;
|
|
405
|
+
$[50] = t10;
|
|
406
|
+
$[51] = t3;
|
|
407
|
+
$[52] = t6;
|
|
408
|
+
$[53] = t7;
|
|
409
|
+
$[54] = t11;
|
|
410
|
+
} else t11 = $[54];
|
|
411
|
+
return t11;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* A destination that goes to its `href` through the app's router, selected
|
|
415
|
+
* while the `selectedRoute` around it is that `href`: the item of a bar and
|
|
416
|
+
* of a rail alike.
|
|
417
|
+
*/
|
|
418
|
+
function NavigationItem(t0) {
|
|
419
|
+
const $ = c(8);
|
|
420
|
+
let href;
|
|
421
|
+
let onPress;
|
|
422
|
+
let props;
|
|
423
|
+
if ($[0] !== t0) {
|
|
424
|
+
({href, onPress, ...props} = t0);
|
|
425
|
+
$[0] = t0;
|
|
426
|
+
$[1] = href;
|
|
427
|
+
$[2] = onPress;
|
|
428
|
+
$[3] = props;
|
|
429
|
+
} else {
|
|
430
|
+
href = $[1];
|
|
431
|
+
onPress = $[2];
|
|
432
|
+
props = $[3];
|
|
433
|
+
}
|
|
434
|
+
const { selectedRoute } = use(NavigationContext);
|
|
435
|
+
const press = useLinkPress(href, onPress);
|
|
436
|
+
const t1 = selectedRoute !== void 0 && href === selectedRoute;
|
|
437
|
+
let t2;
|
|
438
|
+
if ($[4] !== press || $[5] !== props || $[6] !== t1) {
|
|
439
|
+
t2 = /* @__PURE__ */ jsx(NavigationDestination, {
|
|
440
|
+
...props,
|
|
441
|
+
onPress: press,
|
|
442
|
+
selected: t1
|
|
443
|
+
});
|
|
444
|
+
$[4] = press;
|
|
445
|
+
$[5] = props;
|
|
446
|
+
$[6] = t1;
|
|
447
|
+
$[7] = t2;
|
|
448
|
+
} else t2 = $[7];
|
|
449
|
+
return t2;
|
|
450
|
+
}
|
|
451
|
+
//#endregion
|
|
452
|
+
export { NavigationContext, NavigationDestination, NavigationItem, iconColorOf, labelColorOf };
|
|
453
|
+
|
|
454
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","ColorValue","PressableProps","StyleProp","TextStyle","ViewStyle","AnimatedStyle","createContext","use","useEffect","Text","NativeText","Pressable","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","IconStyle","ResolvedTheme","Badge","IconStyleContext","hitSlop","usePressFeedback","useLinkPress","withOpacity","useTheme","composeStyles","useTypeRole","INDICATOR","PILL_HEIGHT","styles","stylesOf","NavigationContextValue","form","NavigationForm","measuring","selectedRoute","NavigationDestinationProps","Omit","badge","children","icon","isDisabled","ref","style","NavigationItemProps","href","GROWN_FROM","FADE_SHARE","ICON_SIZE","BESIDE","Readonly","Record","collapsed","expanded","horizontal","vertical","NavigationContext","ActiveIndicator","t0","$","_c","selected","theme","colors","motion","reduceMotion","progress","t1","t2","target","set","duration","durationLong2","easing","bezier","easingEmphasized","motionStyle","grown","get","opacity","Math","min","transform","scaleX","t3","secondaryContainer","fill","pill","backgroundColor","t4","DestinationContent","label","beside","iconStyleOf","iconColorOf","undefined","t5","stateLayerOpacity","onSurface","disabledContent","onSecondaryContainer","onSurfaceVariant","color","size","Label","role","labelColorOf","secondary","nameOf","NavigationDestination","ariaLabel","onBlur","onFocus","onHoverIn","onHoverOut","onPressIn","onPressOut","props","own","feedback","area","corners","disabled","content","handlers","ring","layer","T0","t6","t7","T1","t8","indicator","t9","t10","t11","NavigationItem","onPress","press","_c","NativeText"],"sources":["../../src/navigation/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n ColorValue,\n PressableProps,\n StyleProp,\n TextStyle,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\n\nimport { createContext, use, useEffect } from 'react'\nimport { Text as NativeText, Pressable, View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\n\nimport type { IconStyle } from '../glyphs/icon-style'\nimport type { ResolvedTheme } from '../theme/scope'\n\nimport { Badge } from '../badge'\nimport { IconStyleContext } from '../glyphs/icon-style'\nimport { hitSlop, usePressFeedback } from '../press'\nimport { useLinkPress } from '../router'\nimport { withOpacity } from '../theme/color'\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { useTypeRole } from '../typography/roles'\nimport { INDICATOR, PILL_HEIGHT, styles, stylesOf } from './styles'\n\n// The destination NavigationBar and NavigationRail both draw, in the four\n// forms their pages give it, as kanso-ui's src/navigation draws it. Apart\n// from either component, so the two cannot drift.\n//\n// A vertical destination puts its icon in the page's 56dp by 32dp active\n// indicator with the label 4dp under it, in label medium: the bar in a\n// compact window, sharing its width with the others, and the collapsed rail,\n// as wide as the rail. A horizontal one is a pill holding the icon and the\n// label side by side, 16dp in at either end: the bar from the medium window\n// size class at 40dp with 4dp between the two in label medium, and the\n// expanded rail at 56dp with 8dp between them in label large. Which form a\n// destination draws is its bar's or its rail's to say, through the context\n// it hands them.\n//\n// The current destination's indicator is the secondary container, with its\n// icon in on secondary container and, under the indicator, its label in\n// secondary; every other is on surface variant. A label set inside the pill,\n// as a horizontal destination sets it, takes on secondary container instead,\n// as on web: secondary over secondary container is not a pair a scheme is\n// held to, and on secondary container is.\n//\n// **The indicator grows** when its destination becomes current, and shrinks\n// back when another does: from 40% of its width to the whole of it from its\n// centre over `durationLong2` on the emphasized curve, fading in over the\n// first fifth of that, as Material's Android components draw it. Web draws it\n// at once. Under reduced motion it does here too.\n//\n// The state layer, the ripple and the focus ring are src/press's, in on\n// secondary container, drawn on the pill: the indicator in a vertical\n// destination, which its ripple grows from the centre of wherever it is\n// pressed, and the whole destination in a horizontal one. The bar's 40dp\n// pill's press reaches 4dp above and below it, to the 48dp target; a\n// vertical destination is the bar's full height already, and the other two\n// forms are 56dp and 64dp tall. A disabled one draws its icon\n// and label on surface at the disabled content opacity, with no layer.\n//\n// A destination is a `tab`, reporting whether it is the selected one, and is\n// named by its label, or by `aria-label` where that is given: the badge on\n// its icon is hidden from a screen reader, so what it says belongs there.\n//\n// **The label comes first in the tree and is drawn after the icon**, through\n// a reversed column or row, so the text inside a destination starts with its\n// name. A badge's count is text, hidden from a screen reader but still\n// written inside the destination under React Native Web, and first in the\n// tree it put the count ahead of the name: a destination named \"Second item,\n// 3 new\" read \"3 Second item\", which is not what a speech-input user would\n// say, and is what axe's label-in-name check fails. src/badge sets the count\n// apart from the label with a space for the same reason.\n\n/** What a bar hands each of its destinations. */\ntype NavigationContextValue = {\n readonly form: NavigationForm\n /**\n * Whether the destinations are being drawn off screen to measure the\n * horizontal form, which draws each one's content and nothing else.\n */\n readonly measuring: boolean\n /** The route of the current destination, matched against an `href`. */\n readonly selectedRoute?: string | undefined\n}\n\ntype NavigationDestinationProps = Omit<\n PressableProps,\n 'children' | 'disabled' | 'style'\n> & {\n /**\n * A badge on the icon: `true` for the badges page's small dot, a number\n * for the large badge holding it. The badge is hidden from a screen\n * reader, so say what it says in the destination's `aria-label` too:\n * \"First item, 3 new\".\n */\n readonly badge?: boolean | number | undefined\n /** The destination's name, drawn as its label. */\n readonly children?: ReactNode\n /**\n * The destination's icon, at the page's 24dp, which the destination hands\n * its colour and size through `useIconStyle()`.\n */\n readonly icon?: ReactNode\n /**\n * Draws the destination disabled, and it takes no press.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\n/**\n * Which form a destination draws: the bar's `vertical` and `horizontal`,\n * and the rail's `collapsed` and `expanded`. The label is under the icon in\n * the first and the third, and beside it in the other two.\n */\ntype NavigationForm = 'collapsed' | 'expanded' | 'horizontal' | 'vertical'\n\ntype NavigationItemProps = NavigationDestinationProps & {\n /**\n * Where the destination goes, through the app's router, and what the\n * `selectedRoute` around it is matched against.\n */\n readonly href: string\n}\n\n// The indicator's width when it starts to grow, as a share of its whole\n// width, and the share of the move it fades in over.\nconst GROWN_FROM = 0.4\nconst FADE_SHARE = 0.2\n\nconst ICON_SIZE = 24\n\n// Whether a form sets the label beside the icon rather than under it.\nconst BESIDE: Readonly<Record<NavigationForm, boolean>> = {\n collapsed: false,\n expanded: true,\n horizontal: true,\n vertical: false,\n}\n\nconst NavigationContext = createContext<NavigationContextValue>({\n form: 'vertical',\n measuring: false,\n})\n\n/**\n * The active indicator's fill, which grows from its centre while its\n * destination is current and shrinks back once it is not.\n */\nfunction ActiveIndicator({ selected }: { readonly selected: boolean }) {\n const theme = useTheme()\n const { colors, motion } = theme\n const reduceMotion = useReducedMotion()\n const progress = useSharedValue(selected ? 1 : 0)\n\n useEffect(() => {\n const target = selected ? 1 : 0\n\n progress.set(\n reduceMotion\n ? target\n : withTiming(target, {\n duration: motion.durationLong2,\n easing: Easing.bezier(...motion.easingEmphasized),\n }),\n )\n }, [motion, progress, reduceMotion, selected])\n\n const motionStyle = useAnimatedStyle(() => {\n 'worklet'\n const grown = progress.get()\n\n return {\n opacity: Math.min(1, grown / FADE_SHARE),\n transform: [{ scaleX: GROWN_FROM + (1 - GROWN_FROM) * grown }],\n }\n })\n\n return (\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.fill,\n stylesOf(theme).pill,\n { backgroundColor: colors.secondaryContainer },\n motionStyle,\n )}\n />\n )\n}\n\n/**\n * What a destination draws over its indicator: the icon and its badge, and\n * where the label is beside the icon the label before them in the tree,\n * which the pill's reversed row draws after them.\n */\nfunction DestinationContent({\n badge,\n form,\n icon,\n isDisabled,\n label,\n selected,\n}: {\n readonly badge: boolean | number | undefined\n readonly form: NavigationForm\n readonly icon: ReactNode\n readonly isDisabled: boolean\n readonly label: ReactNode\n readonly selected: boolean\n}) {\n const theme = useTheme()\n const beside = BESIDE[form]\n\n return (\n <>\n {beside ? (\n <Label form={form} isDisabled={isDisabled} selected={selected}>\n {label}\n </Label>\n ) : null}\n <View style={styles.icon}>\n <IconStyleContext\n value={iconStyleOf(iconColorOf(theme, isDisabled, selected))}\n >\n {badge === undefined || badge === false ? (\n icon\n ) : (\n <Badge count={badge === true ? undefined : badge} inFlow={beside}>\n {icon}\n </Badge>\n )}\n </IconStyleContext>\n </View>\n </>\n )\n}\n\n/** The colour a destination draws its icon in. */\nfunction iconColorOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n isDisabled: boolean,\n selected: boolean,\n): string {\n if (isDisabled) {\n return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n }\n return selected ? colors.onSecondaryContainer : colors.onSurfaceVariant\n}\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's jsx-no-new-object-as-prop is after; the React Compiler\n// memoises the result on its inputs.\nfunction iconStyleOf(color: ColorValue): IconStyle {\n return { color, size: ICON_SIZE }\n}\n\n/**\n * A destination's label, on one line: in label large in an expanded rail,\n * and in label medium everywhere else.\n */\nfunction Label({\n children,\n form,\n isDisabled,\n selected,\n}: {\n readonly children: ReactNode\n readonly form: NavigationForm\n readonly isDisabled: boolean\n readonly selected: boolean\n}) {\n const theme = useTheme()\n const role = useTypeRole(form === 'expanded' ? 'labelLarge' : 'labelMedium')\n\n return (\n <NativeText\n numberOfLines={1}\n style={composeStyles<TextStyle>(role, styles.label, {\n color: labelColorOf(theme, form, isDisabled, selected),\n })}\n >\n {children}\n </NativeText>\n )\n}\n\n/** The colour a destination draws its label in, which its form decides. */\nfunction labelColorOf(\n theme: ResolvedTheme,\n form: NavigationForm,\n isDisabled: boolean,\n selected: boolean,\n): string {\n return selected && !isDisabled && !BESIDE[form]\n ? theme.colors.secondary\n : iconColorOf(theme, isDisabled, selected)\n}\n\n// A label that is a string names its destination; anything else leaves the\n// name to `aria-label`.\nfunction nameOf(children: ReactNode): string | undefined {\n return typeof children === 'string' ? children : undefined\n}\n\n/**\n * One destination, in the form the bar around it asks for: an icon and a\n * label, and the active indicator behind the icon while it is current. A\n * `tab` reporting whether it is selected.\n */\nfunction NavigationDestination({\n 'aria-label': ariaLabel,\n badge,\n children,\n icon,\n isDisabled = false,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n selected,\n style,\n ...props\n}: NavigationDestinationProps & { readonly selected: boolean }) {\n const theme = useTheme()\n const { form, measuring } = use(NavigationContext)\n const own = stylesOf(theme)\n const beside = BESIDE[form]\n const feedback = usePressFeedback({\n area: beside ? undefined : INDICATOR,\n color: theme.colors.onSecondaryContainer,\n corners: own.pill,\n disabled: isDisabled,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n })\n const content = (\n <DestinationContent\n badge={badge}\n form={form}\n icon={icon}\n isDisabled={isDisabled}\n label={children}\n selected={selected}\n />\n )\n\n if (measuring) {\n return <View style={own.horizontal}>{content}</View>\n }\n\n if (beside) {\n return (\n <Pressable\n aria-label={ariaLabel ?? nameOf(children)}\n aria-selected={selected}\n hitSlop={form === 'horizontal' ? hitSlop(PILL_HEIGHT) : undefined}\n role=\"tab\"\n {...props}\n {...feedback.handlers}\n disabled={isDisabled}\n style={composeStyles<ViewStyle>(own[form], feedback.ring, style)}\n >\n <ActiveIndicator selected={selected} />\n {feedback.layer}\n {content}\n </Pressable>\n )\n }\n\n return (\n <Pressable\n aria-label={ariaLabel ?? nameOf(children)}\n aria-selected={selected}\n role=\"tab\"\n {...props}\n {...feedback.handlers}\n disabled={isDisabled}\n style={composeStyles<ViewStyle>(own[form], style)}\n >\n <Label form={form} isDisabled={isDisabled} selected={selected}>\n {children}\n </Label>\n <View style={composeStyles<ViewStyle>(own.indicator, feedback.ring)}>\n <ActiveIndicator selected={selected} />\n {feedback.layer}\n {content}\n </View>\n </Pressable>\n )\n}\n\n/**\n * A destination that goes to its `href` through the app's router, selected\n * while the `selectedRoute` around it is that `href`: the item of a bar and\n * of a rail alike.\n */\nfunction NavigationItem({ href, onPress, ...props }: NavigationItemProps) {\n const { selectedRoute } = use(NavigationContext)\n const press = useLinkPress(href, onPress)\n\n return (\n <NavigationDestination\n {...props}\n onPress={press}\n selected={selectedRoute !== undefined && href === selectedRoute}\n />\n )\n}\n\nexport type {\n NavigationContextValue,\n NavigationDestinationProps,\n NavigationForm,\n NavigationItemProps,\n}\n\nexport {\n iconColorOf,\n labelColorOf,\n NavigationContext,\n NavigationDestination,\n NavigationItem,\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0IA,MAAMoD,aAAa;AACnB,MAAMC,aAAa;AAEnB,MAAMC,YAAY;AAGlB,MAAMC,SAAoD;CACxDG,WAAW;CACXC,UAAU;CACVC,YAAY;CACZC,UAAU;AACZ;AAEA,MAAMC,oBAAoBrD,cAAsC;CAC9D6B,MAAM;CACNE,WAAW;AACb,CAAC;;;;;AAMD,SAAAuB,gBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAyB,MAAA,EAAAC,aAAAH;CACvB,MAAAI,QAActC,SAAS;CACvB,MAAA,EAAAuC,QAAAC,WAA2BF;CAC3B,MAAAG,eAAqB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AtE,KAAAhC,kBAAkB4D,KAAAA,KAAalD,SAASV;CAAa,IAAAiC;CAAA,IAAAT,EAAA,OAAA+E,SAAA/E,EAAA,OAAA0D,SAAA1D,EAAA,OAAAQ,IAAA;EAHjEC,KAAA,oBAAC,uBAAD;GAAsB,GAChBiD;GACKqB,SAAAA;GACC,UAAAvE;EAAqD,CAAA;EAC/DR,EAAA,KAAA+E;EAAA/E,EAAA,KAAA0D;EAAA1D,EAAA,KAAAQ;EAAAR,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAJFS;AAIE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { themedStyles } from "../theme/styles.js";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
//#region src/navigation/styles.ts
|
|
4
|
+
const INDICATOR = {
|
|
5
|
+
height: 32,
|
|
6
|
+
width: 56
|
|
7
|
+
};
|
|
8
|
+
const EXPANDED_PILL_HEIGHT = 56;
|
|
9
|
+
const VERTICAL_PADDING = 6;
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
fill: {
|
|
12
|
+
bottom: 0,
|
|
13
|
+
end: 0,
|
|
14
|
+
position: "absolute",
|
|
15
|
+
start: 0,
|
|
16
|
+
top: 0
|
|
17
|
+
},
|
|
18
|
+
icon: {
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
justifyContent: "center"
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
flexShrink: 1,
|
|
25
|
+
maxWidth: "100%"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const stylesOf = themedStyles(({ radii, spacing }) => StyleSheet.create({
|
|
29
|
+
collapsed: {
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
alignSelf: "stretch",
|
|
32
|
+
flexDirection: "column-reverse",
|
|
33
|
+
flexShrink: 0,
|
|
34
|
+
gap: spacing.xs,
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
paddingHorizontal: spacing.xs,
|
|
37
|
+
paddingVertical: VERTICAL_PADDING
|
|
38
|
+
},
|
|
39
|
+
expanded: {
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
alignSelf: "flex-start",
|
|
42
|
+
borderRadius: radii.pill,
|
|
43
|
+
flexDirection: "row-reverse",
|
|
44
|
+
flexShrink: 0,
|
|
45
|
+
gap: spacing.sm,
|
|
46
|
+
maxWidth: "100%",
|
|
47
|
+
minHeight: EXPANDED_PILL_HEIGHT,
|
|
48
|
+
paddingHorizontal: spacing.lg
|
|
49
|
+
},
|
|
50
|
+
horizontal: {
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
borderRadius: radii.pill,
|
|
53
|
+
flexDirection: "row-reverse",
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
gap: spacing.xs,
|
|
56
|
+
justifyContent: "center",
|
|
57
|
+
minHeight: 40,
|
|
58
|
+
paddingHorizontal: spacing.lg
|
|
59
|
+
},
|
|
60
|
+
indicator: {
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
borderRadius: radii.pill,
|
|
63
|
+
flexShrink: 0,
|
|
64
|
+
height: INDICATOR.height,
|
|
65
|
+
justifyContent: "center",
|
|
66
|
+
width: INDICATOR.width
|
|
67
|
+
},
|
|
68
|
+
pill: { borderRadius: radii.pill },
|
|
69
|
+
vertical: {
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
flexBasis: 0,
|
|
72
|
+
flexDirection: "column-reverse",
|
|
73
|
+
flexGrow: 1,
|
|
74
|
+
gap: spacing.xs,
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
minWidth: 0,
|
|
77
|
+
paddingVertical: VERTICAL_PADDING
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
//#endregion
|
|
81
|
+
export { INDICATOR, styles, stylesOf };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":["StyleSheet","themedStyles","INDICATOR","height","width","const","PILL_HEIGHT","EXPANDED_PILL_HEIGHT","VERTICAL_PADDING","styles","create","fill","bottom","end","position","start","top","icon","alignItems","flexShrink","justifyContent","label","maxWidth","stylesOf","radii","spacing","collapsed","alignSelf","flexDirection","gap","xs","paddingHorizontal","paddingVertical","expanded","borderRadius","pill","sm","minHeight","lg","horizontal","indicator","vertical","flexBasis","flexGrow","minWidth"],"sources":["../../src/navigation/styles.ts"],"sourcesContent":["import { StyleSheet } from 'react-native'\n\nimport { themedStyles } from '../theme/styles'\n\n// The page's active indicator in a vertical destination: 56dp by 32dp, the\n// icon centred in it.\nconst INDICATOR = { height: 32, width: 56 } as const\n\n// A horizontal destination's pill, the page's 40dp, which its press reaches\n// past to the 48dp target, and an expanded rail's, the rail page's 56dp.\nconst PILL_HEIGHT = 40\nconst EXPANDED_PILL_HEIGHT = 56\n\n// A vertical destination's padding above the indicator and below the label,\n// which puts the two in the bar's 64dp: 6, 32, 4 and 16, then 6.\nconst VERTICAL_PADDING = 6\n\nconst styles = StyleSheet.create({\n // The active indicator's fill, behind the icon in a vertical or collapsed\n // destination and behind the whole pill in a horizontal or expanded one.\n fill: {\n bottom: 0,\n end: 0,\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // An icon, and the badge on it, never squeezed by a long label.\n icon: {\n alignItems: 'center',\n flexShrink: 0,\n justifyContent: 'center',\n },\n // The label never wraps: a destination's name is a word or two, and one\n // broken over two lines would push its neighbours apart. Cut short with an\n // ellipsis where the destination is narrower than it.\n label: {\n flexShrink: 1,\n maxWidth: '100%',\n },\n})\n\nconst stylesOf = themedStyles(({ radii, spacing }) =>\n StyleSheet.create({\n // A collapsed rail's destination: the indicator with the label 4dp under\n // it, as wide as the rail and 4dp in from either edge, which leaves a\n // label 88dp of the rail's 96. It keeps its 64dp in a rail too short for\n // every destination, which scrolls them instead. Reversed, since the\n // label comes first in the tree.\n collapsed: {\n alignItems: 'center',\n alignSelf: 'stretch',\n flexDirection: 'column-reverse',\n flexShrink: 0,\n gap: spacing.xs,\n justifyContent: 'center',\n paddingHorizontal: spacing.xs,\n paddingVertical: VERTICAL_PADDING,\n },\n // An expanded rail's destination: the rail page's 56dp pill, holding the\n // icon and the label side by side, 16dp in at either end and 8dp between\n // the two, as wide as what it holds and no wider than the rail. A height\n // that is a minimum, so a larger text size grows the pill rather than\n // cutting its label. Reversed, since the label comes first in the tree.\n expanded: {\n alignItems: 'center',\n alignSelf: 'flex-start',\n borderRadius: radii.pill,\n flexDirection: 'row-reverse',\n flexShrink: 0,\n gap: spacing.sm,\n maxWidth: '100%',\n minHeight: EXPANDED_PILL_HEIGHT,\n paddingHorizontal: spacing.lg,\n },\n // A horizontal destination: the pill, holding the icon and the label side\n // by side, 16dp in at either end and 4dp between the two, as wide as what\n // it holds. Reversed, since the label comes first in the tree.\n horizontal: {\n alignItems: 'center',\n borderRadius: radii.pill,\n flexDirection: 'row-reverse',\n flexShrink: 0,\n gap: spacing.xs,\n justifyContent: 'center',\n minHeight: PILL_HEIGHT,\n paddingHorizontal: spacing.lg,\n },\n // The active indicator of a vertical destination, which draws the layers\n // and the ring as well as the fill.\n indicator: {\n alignItems: 'center',\n borderRadius: radii.pill,\n flexShrink: 0,\n height: INDICATOR.height,\n justifyContent: 'center',\n width: INDICATOR.width,\n },\n // The fill's corners, the pill's.\n pill: {\n borderRadius: radii.pill,\n },\n // A vertical destination: the indicator with the label 4dp under it,\n // sharing the bar's width with the others. Its press is the whole of\n // that share, so it needs no reach of its own. Reversed, since the label\n // comes first in the tree.\n vertical: {\n alignItems: 'center',\n flexBasis: 0,\n flexDirection: 'column-reverse',\n flexGrow: 1,\n gap: spacing.xs,\n justifyContent: 'center',\n minWidth: 0,\n paddingVertical: VERTICAL_PADDING,\n },\n }),\n)\n\nexport { INDICATOR, PILL_HEIGHT, styles, stylesOf }\n"],"mappings":";;;AAMA,MAAME,YAAY;CAAEC,QAAQ;CAAIC,OAAO;AAAG;AAK1C,MAAMG,uBAAuB;AAI7B,MAAMC,mBAAmB;AAEzB,MAAMC,SAAST,WAAWU,OAAO;CAG/BC,MAAM;EACJC,QAAQ;EACRC,KAAK;EACLC,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAEAC,MAAM;EACJC,YAAY;EACZC,YAAY;EACZC,gBAAgB;CAClB;CAIAC,OAAO;EACLF,YAAY;EACZG,UAAU;CACZ;AACF,CAAC;AAED,MAAMC,WAAWtB,cAAc,EAAEuB,OAAOC,cACtCzB,WAAWU,OAAO;CAMhBgB,WAAW;EACTR,YAAY;EACZS,WAAW;EACXC,eAAe;EACfT,YAAY;EACZU,KAAKJ,QAAQK;EACbV,gBAAgB;EAChBW,mBAAmBN,QAAQK;EAC3BE,iBAAiBxB;CACnB;CAMAyB,UAAU;EACRf,YAAY;EACZS,WAAW;EACXO,cAAcV,MAAMW;EACpBP,eAAe;EACfT,YAAY;EACZU,KAAKJ,QAAQW;EACbd,UAAU;EACVe,WAAW9B;EACXwB,mBAAmBN,QAAQa;CAC7B;CAIAC,YAAY;EACVrB,YAAY;EACZgB,cAAcV,MAAMW;EACpBP,eAAe;EACfT,YAAY;EACZU,KAAKJ,QAAQK;EACbV,gBAAgB;EAChBiB,WAAAA;EACAN,mBAAmBN,QAAQa;CAC7B;CAGAE,WAAW;EACTtB,YAAY;EACZgB,cAAcV,MAAMW;EACpBhB,YAAY;EACZhB,QAAQD,UAAUC;EAClBiB,gBAAgB;EAChBhB,OAAOF,UAAUE;CACnB;CAEA+B,MAAM,EACJD,cAAcV,MAAMW,KACtB;CAKAM,UAAU;EACRvB,YAAY;EACZwB,WAAW;EACXd,eAAe;EACfe,UAAU;EACVd,KAAKJ,QAAQK;EACbV,gBAAgB;EAChBwB,UAAU;EACVZ,iBAAiBxB;CACnB;AACF,CAAC,CACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { HostInstance, LayoutChangeEvent, ViewStyle } from "react-native";
|
|
2
|
+
import { RefObject } from "react";
|
package/dist/overlay/anchored.js
CHANGED
|
@@ -2,9 +2,9 @@ import { useTheme } from "../theme/scope.js";
|
|
|
2
2
|
import { OverlayHostContext } from "./host.js";
|
|
3
3
|
import { boundsOf, place } from "./placement.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { use, useEffect, useState } from "react";
|
|
6
5
|
import { Dimensions, I18nManager, useWindowDimensions } from "react-native";
|
|
7
6
|
import { SafeAreaInsetsContext } from "react-native-safe-area-context";
|
|
7
|
+
import { use, useEffect, useState } from "react";
|
|
8
8
|
//#region src/overlay/anchored.ts
|
|
9
9
|
const HIDDEN = {
|
|
10
10
|
left: 0,
|
package/dist/overlay/host.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
import { ComponentRef, ReactNode } from "react";
|
package/dist/overlay/host.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ScopeContext, useScope } from "../theme/scope.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
3
4
|
import { createContext, use, useId, useLayoutEffect, useState, useSyncExternalStore } from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { StyleSheet, View } from "react-native";
|
|
6
6
|
//#region src/overlay/host.tsx
|
|
7
7
|
const OverlayHostContext = createContext(null);
|
|
8
8
|
const styles = StyleSheet.create({ fill: {
|
package/dist/overlay/panel.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useTheme } from "../theme/scope.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
3
|
import { AccessibilityInfo, BackHandler, Platform, Pressable, StyleSheet } from "react-native";
|
|
6
4
|
import { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from "react-native-reanimated";
|
|
5
|
+
import { useEffect, useRef } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/overlay/panel.tsx
|
|
8
8
|
const SCALE_FROM = .95;
|
|
9
9
|
/** The edge a panel grows from, the one facing its anchor. */
|