@kanso-labs/react-native-kanso-ui 0.6.0 → 0.8.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 +37 -0
- package/dist/badge/index.js +25 -23
- package/dist/badge/index.js.map +1 -1
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.js.map +1 -1
- package/dist/button/pending.js +17 -21
- package/dist/button/pending.js.map +1 -1
- 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/components/autocomplete/index.js +28 -26
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +51 -0
- package/dist/components/calendar/index.js +121 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/chip-group/index.d.ts +4 -3
- package/dist/components/chip-group/index.js +47 -45
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +5 -5
- package/dist/components/copy-field/index.js +30 -28
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +2 -2
- package/dist/components/currency/index.js +3 -1
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/list/index.d.ts +6 -5
- package/dist/components/list/index.js +97 -106
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +4 -3
- package/dist/components/menu/index.js +33 -40
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +2 -1
- package/dist/components/meter/index.js +9 -7
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-bar/index.d.ts +3 -9
- package/dist/components/navigation-bar/index.js +10 -34
- package/dist/components/navigation-bar/index.js.map +1 -1
- 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 +7 -3
- package/dist/components/number-field/index.js +214 -192
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/product-icon/index.d.ts +2 -2
- package/dist/components/product-icon/index.js +2 -2
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +2 -1
- package/dist/components/progress-indicator/index.js +15 -13
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +3 -3
- package/dist/components/search-field/index.js +105 -104
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +2 -2
- package/dist/components/sheet/index.js +22 -26
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +3 -3
- package/dist/components/snackbar/index.js +36 -34
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +58 -0
- package/dist/components/tag/index.js +205 -0
- package/dist/components/tag/index.js.map +1 -0
- package/dist/components/text-field/index.d.ts +6 -3
- package/dist/components/text-field/index.js +3 -0
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/field/index.js +39 -36
- package/dist/field/index.js.map +1 -1
- package/dist/glyphs/index.js +19 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +12 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +741 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/i18n/provider.d.ts +53 -0
- package/dist/i18n/provider.js +96 -0
- package/dist/i18n/provider.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -2
- package/dist/indicator/index.js +1 -2
- package/dist/indicator/index.js.map +1 -1
- package/dist/mark/index.js +77 -117
- package/dist/mark/index.js.map +1 -1
- package/dist/mark/initials.js.map +1 -1
- package/dist/navigation/index.d.ts +8 -1
- package/dist/navigation/index.js +113 -64
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js +22 -0
- package/dist/navigation/styles.js.map +1 -1
- package/dist/number/count.js +15 -0
- package/dist/number/count.js.map +1 -0
- package/dist/number/locale.js.map +1 -1
- package/dist/overlay/host.js +30 -21
- package/dist/overlay/host.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","Ref","StyleProp","ViewProps","ViewStyle","StyleSheet","View","IndicatorTone","IndicatorLabels","IndicatorLine","readingOf","useEased","useIndicatorColors","useMeasuredWidth","DETERMINATE_EASING","stylesOf","indicatorStylesOf","useTheme","composeStyles","MeterProps","Omit","formatOptions","Intl","NumberFormatOptions","label","locale","maxValue","minValue","ref","showValue","style","tone","MeterTone","value","valueLabel","styles","create","line","alignSelf","Extract","Meter","t0","$","_c","ariaLabel","props","t1","t2","t3","t4","t5","undefined","theme","colors","t6","reading","t7","motion","durationMedium1","duration","easing","shown","percentage","onLayout","width","t8","t9","t10","text","t11","root","t12","t13","t14","t15","t16","_c","indicatorStylesOf"],"sources":["../../../src/components/meter/index.tsx"],"sourcesContent":["import type { ComponentRef, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\n\nimport { StyleSheet, View } from 'react-native'\n\nimport type { IndicatorTone } from '../../indicator'\n\nimport {\n IndicatorLabels,\n IndicatorLine,\n readingOf,\n useEased,\n useIndicatorColors,\n useMeasuredWidth,\n} from '../../indicator'\nimport {\n DETERMINATE_EASING,\n stylesOf as indicatorStylesOf,\n} from '../../indicator/styles'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// A meter is the progress indicators page's line, drawn for a measurement\n// rather than for a task, as on web: the same three parts at the same 4dp,\n// the same label row above them, and the same motion when the number changes.\n// All of that is `src/indicator`, shared with ProgressIndicator, so what is\n// here is the two things that make it a meter rather than a progress bar.\n//\n// The first is the role. The root says `meter` rather than `progressbar`, as\n// React Aria's `Meter` does on web, and a screen reader says the two\n// differently: one is how full something is, the other how far along\n// something is. That is also why a meter has no indeterminate state: a\n// measurement whose value is unknown is not a measurement.\n//\n// The second is `tone`. The page draws one colour pair, which is right for a\n// task, since progress does not become good or bad on its way to done. A\n// measurement does, so `negative` and `positive` recolour the active\n// indicator and the stop indicator and leave the track alone. A column of\n// meters then reads as one scale with bars of different colours. Which tone a\n// value deserves is the call site's to decide: nothing here reads the number\n// and picks one.\n//\n// The value is shown by default, where a progress indicator hides it. A meter\n// is the number, and `formatOptions` is what makes it read as a percentage,\n// bytes or a plain count, in `locale`.\n\ntype MeterProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * How the value reads.\n * @default { style: 'percent' }\n */\n readonly formatOptions?: Intl.NumberFormatOptions\n /**\n * What is being measured, shown above the line. A screen reader reads it as\n * the meter's name; a meter whose surroundings name it takes `aria-label`\n * instead and leaves this out.\n */\n readonly label?: string\n /**\n * The BCP 47 locale the value is written in. Defaults to the device's.\n */\n readonly locale?: string\n /**\n * The top of the scale.\n * @default 100\n */\n readonly maxValue?: number\n /**\n * The bottom of the scale.\n * @default 0\n */\n readonly minValue?: number\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * Whether the value is shown beside the label.\n * @default true\n */\n readonly showValue?: boolean\n readonly style?: StyleProp<ViewStyle>\n /**\n * Which colours the measurement is drawn in. `primary` states without\n * ranking; `negative` and `positive` say the value is bad or good, and\n * recolour the active indicator and the stop indicator, leaving the track in\n * its secondary container so a column of meters still shares one track.\n * @default 'primary'\n */\n readonly tone?: MeterTone\n /**\n * The measurement, between `minValue` and `maxValue`.\n * @default 0\n */\n readonly value?: number\n /** The value as words, in place of the number `formatOptions` writes. */\n readonly valueLabel?: string\n}\n\nconst styles = StyleSheet.create({\n // The row the line is drawn across, measured for the width it is drawn to.\n line: {\n alignSelf: 'stretch',\n },\n})\n\n// The three of the shared line's four tones a meter draws. The fourth,\n// `inherit`, is for an indicator inside something that carries its own\n// colour, which is a pending button rather than a measurement.\ntype MeterTone = Extract<IndicatorTone, 'negative' | 'positive' | 'primary'>\n\n/**\n * How full something is, on a scale it names: disk used, storage left, a\n * rating out of five. Pass `value` between `minValue` and `maxValue`, and\n * `formatOptions` to say how the number reads, in `locale`. For how far along\n * a task is, reach for ProgressIndicator instead: a meter has no indeterminate\n * state, because a measurement always has a value.\n *\n * ```tsx\n * <Meter label=\"Label\" tone=\"negative\" value={94} />\n * ```\n *\n * A screen reader hears it as a meter named by its label, with its value as\n * `formatOptions` writes it. `style`, `ref` and `testID` land on the meter as\n * a whole, which is the view a layout positions.\n */\nfunction Meter({\n 'aria-label': ariaLabel,\n formatOptions,\n label,\n locale,\n maxValue = 100,\n minValue = 0,\n showValue = true,\n style,\n tone = 'primary',\n value = 0,\n valueLabel,\n ...props\n}: MeterProps) {\n const theme = useTheme()\n const colors = useIndicatorColors(tone)\n const reading = readingOf({\n formatOptions,\n locale,\n maxValue,\n minValue,\n value,\n valueLabel,\n })\n const shown = useEased(reading.percentage, {\n duration: theme.motion.durationMedium1,\n easing: DETERMINATE_EASING,\n })\n const { onLayout, width } = useMeasuredWidth()\n\n return (\n <View\n accessible\n aria-label={label ?? ariaLabel}\n aria-valuemax={maxValue}\n aria-valuemin={minValue}\n aria-valuenow={reading.value}\n aria-valuetext={reading.text}\n role=\"meter\"\n {...props}\n style={composeStyles<ViewStyle>(indicatorStylesOf(theme).root, style)}\n >\n <IndicatorLabels\n label={label}\n value={showValue ? reading.text : undefined}\n />\n <View onLayout={onLayout} style={styles.line}>\n <IndicatorLine colors={colors} percentage={shown} width={width} />\n </View>\n </View>\n )\n}\n\nexport { Meter }\nexport type { MeterProps, MeterTone }\n"],"mappings":";;;;;;;;AAgGA,MAAMmC,SAAS9B,WAAW+B,OAAO,EAE/BC,MAAM,EACJC,WAAW,UACb,EACF,CAAC;;;;;;;;;;;;;;;;AAsBD,SAAAE,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAvB;CAAA,IAAAG;CAAA,IA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;EAAAvB,EAAA,MAAAiC;CAAA,OAAAA,MAAAjC,EAAA;CAAA,OAlBPiC;AAkBO"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","Ref","StyleProp","ViewProps","ViewStyle","StyleSheet","View","IndicatorTone","useLocaleOf","IndicatorLabels","IndicatorLine","readingOf","useEased","useIndicatorColors","useMeasuredWidth","DETERMINATE_EASING","stylesOf","indicatorStylesOf","useTheme","composeStyles","MeterProps","Omit","formatOptions","Intl","NumberFormatOptions","label","locale","maxValue","minValue","ref","showValue","style","tone","MeterTone","value","valueLabel","styles","create","line","alignSelf","Extract","Meter","t0","$","_c","ariaLabel","props","t1","t2","t3","t4","t5","undefined","theme","colors","writtenIn","t6","reading","t7","motion","durationMedium1","duration","easing","shown","percentage","onLayout","width","t8","t9","t10","text","t11","root","t12","t13","t14","t15","t16","_c","indicatorStylesOf"],"sources":["../../../src/components/meter/index.tsx"],"sourcesContent":["import type { ComponentRef, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\n\nimport { StyleSheet, View } from 'react-native'\n\nimport type { IndicatorTone } from '../../indicator'\n\nimport { useLocaleOf } from '../../i18n/provider'\nimport {\n IndicatorLabels,\n IndicatorLine,\n readingOf,\n useEased,\n useIndicatorColors,\n useMeasuredWidth,\n} from '../../indicator'\nimport {\n DETERMINATE_EASING,\n stylesOf as indicatorStylesOf,\n} from '../../indicator/styles'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// A meter is the progress indicators page's line, drawn for a measurement\n// rather than for a task, as on web: the same three parts at the same 4dp,\n// the same label row above them, and the same motion when the number changes.\n// All of that is `src/indicator`, shared with ProgressIndicator, so what is\n// here is the two things that make it a meter rather than a progress bar.\n//\n// The first is the role. The root says `meter` rather than `progressbar`, as\n// React Aria's `Meter` does on web, and a screen reader says the two\n// differently: one is how full something is, the other how far along\n// something is. That is also why a meter has no indeterminate state: a\n// measurement whose value is unknown is not a measurement.\n//\n// The second is `tone`. The page draws one colour pair, which is right for a\n// task, since progress does not become good or bad on its way to done. A\n// measurement does, so `negative` and `positive` recolour the active\n// indicator and the stop indicator and leave the track alone. A column of\n// meters then reads as one scale with bars of different colours. Which tone a\n// value deserves is the call site's to decide: nothing here reads the number\n// and picks one.\n//\n// The value is shown by default, where a progress indicator hides it. A meter\n// is the number, and `formatOptions` is what makes it read as a percentage,\n// bytes or a plain count, in `locale`.\n\ntype MeterProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * How the value reads.\n * @default { style: 'percent' }\n */\n readonly formatOptions?: Intl.NumberFormatOptions\n /**\n * What is being measured, shown above the line. A screen reader reads it as\n * the meter's name; a meter whose surroundings name it takes `aria-label`\n * instead and leaves this out.\n */\n readonly label?: string\n /**\n * The BCP 47 locale the value is written in. Defaults to the\n * `I18nProvider`'s, or the device's outside one.\n */\n readonly locale?: string\n /**\n * The top of the scale.\n * @default 100\n */\n readonly maxValue?: number\n /**\n * The bottom of the scale.\n * @default 0\n */\n readonly minValue?: number\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * Whether the value is shown beside the label.\n * @default true\n */\n readonly showValue?: boolean\n readonly style?: StyleProp<ViewStyle>\n /**\n * Which colours the measurement is drawn in. `primary` states without\n * ranking; `negative` and `positive` say the value is bad or good, and\n * recolour the active indicator and the stop indicator, leaving the track in\n * its secondary container so a column of meters still shares one track.\n * @default 'primary'\n */\n readonly tone?: MeterTone\n /**\n * The measurement, between `minValue` and `maxValue`.\n * @default 0\n */\n readonly value?: number\n /** The value as words, in place of the number `formatOptions` writes. */\n readonly valueLabel?: string\n}\n\nconst styles = StyleSheet.create({\n // The row the line is drawn across, measured for the width it is drawn to.\n line: {\n alignSelf: 'stretch',\n },\n})\n\n// The three of the shared line's four tones a meter draws. The fourth,\n// `inherit`, is for an indicator inside something that carries its own\n// colour, which is a pending button rather than a measurement.\ntype MeterTone = Extract<IndicatorTone, 'negative' | 'positive' | 'primary'>\n\n/**\n * How full something is, on a scale it names: disk used, storage left, a\n * rating out of five. Pass `value` between `minValue` and `maxValue`, and\n * `formatOptions` to say how the number reads, in `locale`. For how far along\n * a task is, reach for ProgressIndicator instead: a meter has no indeterminate\n * state, because a measurement always has a value.\n *\n * ```tsx\n * <Meter label=\"Label\" tone=\"negative\" value={94} />\n * ```\n *\n * A screen reader hears it as a meter named by its label, with its value as\n * `formatOptions` writes it. `style`, `ref` and `testID` land on the meter as\n * a whole, which is the view a layout positions.\n */\nfunction Meter({\n 'aria-label': ariaLabel,\n formatOptions,\n label,\n locale,\n maxValue = 100,\n minValue = 0,\n showValue = true,\n style,\n tone = 'primary',\n value = 0,\n valueLabel,\n ...props\n}: MeterProps) {\n const theme = useTheme()\n const colors = useIndicatorColors(tone)\n const writtenIn = useLocaleOf(locale)\n const reading = readingOf({\n formatOptions,\n locale: writtenIn,\n maxValue,\n minValue,\n value,\n valueLabel,\n })\n const shown = useEased(reading.percentage, {\n duration: theme.motion.durationMedium1,\n easing: DETERMINATE_EASING,\n })\n const { onLayout, width } = useMeasuredWidth()\n\n return (\n <View\n accessible\n aria-label={label ?? ariaLabel}\n aria-valuemax={maxValue}\n aria-valuemin={minValue}\n aria-valuenow={reading.value}\n aria-valuetext={reading.text}\n role=\"meter\"\n {...props}\n style={composeStyles<ViewStyle>(indicatorStylesOf(theme).root, style)}\n >\n <IndicatorLabels\n label={label}\n value={showValue ? reading.text : undefined}\n />\n <View onLayout={onLayout} style={styles.line}>\n <IndicatorLine colors={colors} percentage={shown} width={width} />\n </View>\n </View>\n )\n}\n\nexport { Meter }\nexport type { MeterProps, MeterTone }\n"],"mappings":";;;;;;;;;AAkGA,MAAMoC,SAAS/B,WAAWgC,OAAO,EAE/BC,MAAM,EACJC,WAAW,UACb,EACF,CAAC;;;;;;;;;;;;;;;;AAsBD,SAAAE,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAvB;CAAA,IAAAG;CAAA,IAAAC;CAAA,IAAAo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AAiC;EAAAjC,EAAA,MAAAwB;EAAAxB,EAAA,MAAAkC;CAAA,OAAAA,MAAAlC,EAAA;CAAA,OAlBPkC;AAkBO"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavigationItemProps } from "../../navigation/index.js";
|
|
2
2
|
import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
3
3
|
import { ComponentRef, ReactNode, Ref } from "react";
|
|
4
4
|
//#region src/components/navigation-bar/index.d.ts
|
|
5
|
-
type NavigationBarItemProps =
|
|
6
|
-
/**
|
|
7
|
-
* Where the destination goes, through the app's router, and what the
|
|
8
|
-
* bar's `selectedRoute` is matched against.
|
|
9
|
-
*/
|
|
10
|
-
readonly href: string;
|
|
11
|
-
};
|
|
5
|
+
type NavigationBarItemProps = NavigationItemProps;
|
|
12
6
|
type NavigationBarProps = Omit<ViewProps, 'children' | 'style'> & {
|
|
13
7
|
/** The destinations, each a `NavigationBar.Item`. */
|
|
14
8
|
readonly children?: ReactNode;
|
|
@@ -143,7 +137,7 @@ declare namespace NavigationBar {
|
|
|
143
137
|
*
|
|
144
138
|
* `style`, `ref` and `testID` land on the destination's `Pressable`.
|
|
145
139
|
*/
|
|
146
|
-
declare function NavigationBarItem(
|
|
140
|
+
declare function NavigationBarItem(props: NavigationBarItemProps): import("react").JSX.Element;
|
|
147
141
|
/**
|
|
148
142
|
* A navigation bar drawing a tab navigator's routes, for the `tabBar` prop of
|
|
149
143
|
* React Navigation's bottom tabs and of Expo Router's `Tabs` alike.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useTheme } from "../../theme/scope.js";
|
|
2
2
|
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
3
|
-
import { useLinkPress } from "../../router/index.js";
|
|
4
3
|
import { useWindowSizeClass } from "../../hooks/useWindowSizeClass.js";
|
|
5
|
-
import { NavigationContext, NavigationDestination, iconColorOf, labelColorOf } from "../../navigation/index.js";
|
|
4
|
+
import { NavigationContext, NavigationDestination, NavigationItem, iconColorOf, labelColorOf } from "../../navigation/index.js";
|
|
6
5
|
import { c } from "react/compiler-runtime";
|
|
7
6
|
import { StyleSheet, View } from "react-native";
|
|
8
7
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -261,38 +260,15 @@ function NavigationBar(t0) {
|
|
|
261
260
|
*
|
|
262
261
|
* `style`, `ref` and `testID` land on the destination's `Pressable`.
|
|
263
262
|
*/
|
|
264
|
-
function NavigationBarItem(
|
|
265
|
-
const $ = c(
|
|
266
|
-
let
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
$[2] = onPress;
|
|
274
|
-
$[3] = props;
|
|
275
|
-
} else {
|
|
276
|
-
href = $[1];
|
|
277
|
-
onPress = $[2];
|
|
278
|
-
props = $[3];
|
|
279
|
-
}
|
|
280
|
-
const { selectedRoute } = use(NavigationContext);
|
|
281
|
-
const press = useLinkPress(href, onPress);
|
|
282
|
-
const t1 = selectedRoute !== void 0 && href === selectedRoute;
|
|
283
|
-
let t2;
|
|
284
|
-
if ($[4] !== press || $[5] !== props || $[6] !== t1) {
|
|
285
|
-
t2 = /* @__PURE__ */ jsx(NavigationDestination, {
|
|
286
|
-
...props,
|
|
287
|
-
onPress: press,
|
|
288
|
-
selected: t1
|
|
289
|
-
});
|
|
290
|
-
$[4] = press;
|
|
291
|
-
$[5] = props;
|
|
292
|
-
$[6] = t1;
|
|
293
|
-
$[7] = t2;
|
|
294
|
-
} else t2 = $[7];
|
|
295
|
-
return t2;
|
|
263
|
+
function NavigationBarItem(props) {
|
|
264
|
+
const $ = c(2);
|
|
265
|
+
let t0;
|
|
266
|
+
if ($[0] !== props) {
|
|
267
|
+
t0 = /* @__PURE__ */ jsx(NavigationItem, { ...props });
|
|
268
|
+
$[0] = props;
|
|
269
|
+
$[1] = t0;
|
|
270
|
+
} else t0 = $[1];
|
|
271
|
+
return t0;
|
|
296
272
|
}
|
|
297
273
|
/**
|
|
298
274
|
* A navigation bar drawing a tab navigator's routes, for the `tabBar` prop of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","LayoutChangeEvent","StyleProp","ViewProps","ViewStyle","Edge","use","useMemo","useState","StyleSheet","View","SafeAreaView","NavigationDestinationProps","useWindowSizeClass","iconColorOf","labelColorOf","NavigationContext","NavigationDestination","useLinkPress","useTheme","composeStyles","themedStyles","NavigationBarItemProps","href","NavigationBarProps","Omit","children","ref","selectedRoute","style","NavigationTabBarProps","TabNavigatorProps","descriptors","Readonly","Partial","Record","options","TabOptions","insets","state","index","routes","TabRoute","TabActions","emit","event","TabEvent","go","route","TabEmitter","canPreventDefault","target","type","emitter","navigateToTab","routeKey","navigation","navigate","name","params","tabBarAccessibilityLabel","tabBarBadge","tabBarButtonTestID","tabBarIcon","props","color","focused","size","tabBarLabel","position","title","key","MEASURING_ROOM","ICON_SIZE","NO_OPTIONS","DIGITS","EDGES","styles","create","measurer","height","overflow","pointerEvents","start","top","width","room","alignItems","vertical","stylesOf","colors","spacing","bar","backgroundColor","surfaceContainer","horizontal","gap","sm","measured","flexDirection","row","justifyContent","minHeight","actionsOf","undefined","badgeOf","badge","test","Number","longPressThen","actions","NavigationBar","t0","$","_c","theme","own","sizeClass","setRoom","needed","setNeeded","wide","t1","const","t2","form","measuring","context","t3","T0","t4","t5","T1","T2","t7","Symbol","for","widthThen","t8","t9","t10","t11","t6","t12","t13","NavigationBarItem","onPress","press","NavigationTabBar","_insets","map","pressThen","prevented","defaultPrevented","TabDestination","onLongPress","setWidth","nativeEvent","layout","Item","_c"],"sources":["../../../src/components/navigation-bar/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n LayoutChangeEvent,\n StyleProp,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { Edge } from 'react-native-safe-area-context'\n\nimport { use, useMemo, useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { SafeAreaView } from 'react-native-safe-area-context'\n\nimport type { NavigationDestinationProps } from '../../navigation'\n\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport {\n iconColorOf,\n labelColorOf,\n NavigationContext,\n NavigationDestination,\n} from '../../navigation'\nimport { useLinkPress } from '../../router'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// kanso-ui's NavigationBar, the navigation bar page's flexible bar: three to\n// five destinations across the bottom of a compact window, on the surface\n// container, 64dp tall. In a compact window each destination is vertical and\n// the destinations share the bar's width equally; from the medium window\n// size class each is the page's horizontal pill, as wide as what it holds,\n// and the group sits centred with the spare width at the bar's ends, 8dp\n// between two pills. The destinations are src/navigation's, which holds the\n// two forms' values.\n//\n// The 8dp between two horizontal pills is the library's own, as on web. The\n// page puts each pill in an item of a fixed width it does not give, and with\n// no space at all the pills met edge to edge.\n//\n// **A bar too narrow for its horizontal form keeps the vertical one.** A\n// horizontal destination is as wide as its icon, its label and 16dp either\n// side, so five of them need far more than the 600dp the medium class starts\n// at, and drawn anyway every label would be cut short the moment the window\n// crossed into it. So from that class the bar draws its destinations a\n// second time, off screen in the horizontal form at their own widths, and\n// draws that form only while the bar is at least as wide as they are. Web\n// measures the labels it cuts short instead, which native has no way to ask.\n// The horizontal form is drawn until the first measurement arrives, so a bar\n// that fits never draws the other form for a frame.\n//\n// The bar paints its surface to the screen's bottom edge, under the home\n// indicator, and keeps its destinations inside the safe area: a\n// `SafeAreaView` pads it by the home indicator and a landscape notch\n// wherever the bar meets them, and by nothing where it does not.\n//\n// The bar is a `tablist` and each destination a `tab`, which is how both\n// platforms' own tab bars are announced. Web's is a landmark of links with\n// the current one marked as the page, which native has no counterpart for.\n// A destination still goes to its `href` through the app's router, see\n// `RouterProvider`. `NavigationTabBar` draws the bar for React Navigation's\n// bottom tabs and Expo Router's tabs instead.\n\ntype NavigationBarItemProps = NavigationDestinationProps & {\n /**\n * Where the destination goes, through the app's router, and what the\n * bar's `selectedRoute` is matched against.\n */\n readonly href: string\n}\n\ntype NavigationBarProps = Omit<ViewProps, 'children' | 'style'> & {\n /** The destinations, each a `NavigationBar.Item`. */\n readonly children?: ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * The route of the current destination, matched against each\n * destination's `href`. The match is the selected tab, and draws the\n * active indicator.\n */\n readonly selectedRoute?: string | undefined\n readonly style?: StyleProp<ViewStyle>\n}\n\n/** The routes a tab navigator hands its tab bar, as both navigators do. */\ntype NavigationTabBarProps = Omit<\n NavigationBarProps,\n 'children' | 'selectedRoute'\n> &\n TabNavigatorProps & {\n /** Each route's options, by the route's key. */\n readonly descriptors: Readonly<\n Partial<Record<string, { readonly options: TabOptions }>>\n >\n /**\n * The insets the navigator measured, which the bar measures for itself\n * instead.\n */\n readonly insets?: unknown\n /** The navigator's routes, and which of them is focused. */\n readonly state: {\n readonly index: number\n readonly routes: readonly TabRoute[]\n }\n }\n\n/** What a tab bar's press tells the navigator, and how it moves to a tab. */\ntype TabActions = {\n readonly emit: (event: TabEvent) => unknown\n readonly go: (route: TabRoute) => void\n}\n\n/**\n * What hears a tab bar's events: React Navigation's `navigation` and Expo\n * Router's `emitter` alike.\n */\ntype TabEmitter = {\n emit(event: TabEvent): unknown\n}\n\n/** The events a tab bar reports, as both navigators name them. */\ntype TabEvent =\n | {\n readonly canPreventDefault: true\n readonly target: string\n readonly type: 'tabPress'\n }\n | { readonly target: string; readonly type: 'tabLongPress' }\n\n/**\n * How a tab bar moves to a tab: through React Navigation's `navigation`, or\n * through Expo Router's `navigateToTab`.\n */\ntype TabNavigatorProps =\n | {\n readonly emitter: TabEmitter\n readonly navigateToTab: (routeKey: string) => void\n readonly navigation?: never\n }\n | {\n readonly emitter?: never\n readonly navigateToTab?: never\n readonly navigation: TabEmitter & {\n navigate(name: string, params?: object): void\n }\n }\n\n/**\n * A tab's options the bar reads, as React Navigation's bottom tabs and Expo\n * Router's tabs both hand them to a tab bar. Options they take that are not\n * listed here are left to them.\n */\ntype TabOptions = {\n /** The tab's name for a screen reader, where it differs from its label. */\n readonly tabBarAccessibilityLabel?: string | undefined\n /**\n * The badge on the tab's icon. A number, or a string of digits, is the\n * large badge's count; any other string is the small dot, since a badge\n * draws a count and nothing else.\n */\n readonly tabBarBadge?: number | string | undefined\n readonly tabBarButtonTestID?: string | undefined\n /** The tab's icon, drawn at the size and in the colour it is handed. */\n readonly tabBarIcon?:\n | ((props: {\n readonly color: string\n readonly focused: boolean\n readonly size: number\n }) => ReactNode)\n | undefined\n /** The tab's label, in place of its title. */\n readonly tabBarLabel?:\n | ((props: {\n readonly children: string\n readonly color: string\n readonly focused: boolean\n readonly position: 'below-icon' | 'beside-icon'\n }) => ReactNode)\n | string\n | undefined\n readonly title?: string | undefined\n}\n\ntype TabRoute = {\n readonly key: string\n readonly name: string\n readonly params?: object | undefined\n}\n\n// Where the destinations are drawn off screen to be measured. Wider than any\n// bar, so each one is measured at its own width rather than squeezed.\nconst MEASURING_ROOM = 10_000\n\n// The size a tab's icon is drawn at, the page's.\nconst ICON_SIZE = 24\n\n// A route its navigator handed no options for.\nconst NO_OPTIONS: TabOptions = {}\n\n// A string of digits, which a badge draws as a count.\nconst DIGITS = /^\\d+$/u\n\n// The bar's sides as well as its bottom, so a landscape notch is cleared too.\n// The top is the screen's.\nconst EDGES: readonly Edge[] = ['bottom', 'left', 'right']\n\nconst styles = StyleSheet.create({\n // Holds the destinations measured off screen. It has no size and clips what\n // it holds, so they are laid out and never drawn, and take no touches.\n measurer: {\n height: 0,\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n start: 0,\n top: 0,\n width: 0,\n },\n // The room the destinations are measured in, with the row of them at its\n // start, at the row's own width.\n room: {\n alignItems: 'flex-start',\n width: MEASURING_ROOM,\n },\n // The vertical form: each destination its share of the bar's height.\n vertical: {\n alignItems: 'stretch',\n },\n})\n\nconst stylesOf = themedStyles(({ colors, spacing }) =>\n StyleSheet.create({\n bar: {\n backgroundColor: colors.surfaceContainer,\n },\n // The horizontal form: the pills centred, 8dp apart.\n horizontal: {\n alignItems: 'center',\n gap: spacing.sm,\n },\n // The destinations, measured in the horizontal form.\n measured: {\n flexDirection: 'row',\n gap: spacing.sm,\n },\n // The page's 64dp, a minimum rather than a height, so a larger text size\n // the device asks for grows the bar rather than cutting the labels off.\n row: {\n flexDirection: 'row',\n justifyContent: 'center',\n minHeight: 64,\n },\n }),\n)\n\n/**\n * What the bar tells the navigator and how it moves, from whichever of the\n * two navigators drew it.\n */\nfunction actionsOf(\n emitter: TabEmitter | undefined,\n navigateToTab: ((routeKey: string) => void) | undefined,\n navigation: TabNavigatorProps['navigation'],\n): TabActions {\n if (navigation !== undefined) {\n return {\n emit: (event) => navigation.emit(event),\n go: (route) => {\n navigation.navigate(route.name, route.params)\n },\n }\n }\n return {\n emit: (event) => emitter?.emit(event),\n go: (route) => {\n navigateToTab?.(route.key)\n },\n }\n}\n\n/**\n * The badge a tab's `tabBarBadge` draws: the count of a number or a string of\n * digits, and the small dot for any other string.\n */\nfunction badgeOf(\n badge: number | string | undefined,\n): boolean | number | undefined {\n if (typeof badge === 'number') {\n return badge\n }\n if (badge === undefined || badge === '') {\n return undefined\n }\n return DIGITS.test(badge) ? Number(badge) : true\n}\n\n/**\n * Reports a long press on a tab. Built by a call rather than written inline\n * at the prop, for the reason `widthThen` gives.\n */\nfunction longPressThen(actions: TabActions, route: TabRoute) {\n return () => {\n actions.emit({ target: route.key, type: 'tabLongPress' })\n }\n}\n\n/**\n * The bar of three to five top-level destinations a compact window keeps at\n * its bottom edge. Each destination goes to its `href` through the app's\n * router, see `RouterProvider`.\n *\n * ```tsx\n * <NavigationBar selectedRoute=\"/first\">\n * <NavigationBar.Item href=\"/first\" icon={<FirstIcon />}>\n * First item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/second\" icon={<SecondIcon />}>\n * Second item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/third\" icon={<ThirdIcon />}>\n * Third item\n * </NavigationBar.Item>\n * </NavigationBar>\n * ```\n *\n * Draw it below the screen's content, at the bottom of the window: it paints\n * its surface to the bottom edge and keeps its destinations clear of the home\n * indicator itself. From the medium window size class each destination puts\n * its label beside its icon, where the bar is wide enough for every label.\n *\n * `style`, `ref` and `testID` land on the bar's own view, which is announced\n * as a tab list.\n */\nfunction NavigationBar({\n children,\n selectedRoute,\n style,\n ...props\n}: NavigationBarProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const sizeClass = useWindowSizeClass()\n // The width the destinations have, and the width the horizontal form\n // takes, while each is known.\n const [room, setRoom] = useState<number | undefined>(undefined)\n const [needed, setNeeded] = useState<number | undefined>(undefined)\n\n const wide = sizeClass !== 'compact'\n const horizontal =\n wide && (room === undefined || needed === undefined || needed <= room)\n const context = useMemo(\n () => ({\n form: horizontal ? ('horizontal' as const) : ('vertical' as const),\n measuring: false,\n selectedRoute,\n }),\n [horizontal, selectedRoute],\n )\n const measuring = useMemo(\n () => ({ form: 'horizontal' as const, measuring: true, selectedRoute }),\n [selectedRoute],\n )\n\n return (\n <View\n role=\"tablist\"\n {...props}\n style={composeStyles<ViewStyle>(own.bar, style)}\n >\n <SafeAreaView edges={EDGES}>\n <View\n onLayout={widthThen(setRoom)}\n style={composeStyles<ViewStyle>(\n own.row,\n horizontal ? own.horizontal : styles.vertical,\n )}\n >\n <NavigationContext value={context}>{children}</NavigationContext>\n </View>\n </SafeAreaView>\n {wide ? (\n <View aria-hidden style={styles.measurer}>\n <View style={styles.room}>\n <View onLayout={widthThen(setNeeded)} style={own.measured}>\n <NavigationContext value={measuring}>\n {children}\n </NavigationContext>\n </View>\n </View>\n </View>\n ) : null}\n </View>\n )\n}\n\n/**\n * One destination of a navigation bar: an icon, a label and, while it is the\n * current one, the active indicator behind the icon. Pressing it calls\n * `onPress`, then goes to its `href`. Renders nothing of its own outside a\n * `NavigationBar`, whose `selectedRoute` says whether it is selected.\n *\n * `style`, `ref` and `testID` land on the destination's `Pressable`.\n */\nfunction NavigationBarItem({\n href,\n onPress,\n ...props\n}: NavigationBarItemProps) {\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\n/**\n * A navigation bar drawing a tab navigator's routes, for the `tabBar` prop of\n * React Navigation's bottom tabs and of Expo Router's `Tabs` alike.\n *\n * ```tsx\n * <Tabs tabBar={(props) => <NavigationTabBar {...props} />}>\n * <Tabs.Screen name=\"index\" options={{ tabBarIcon: () => <FirstIcon />, title: 'First item' }} />\n * </Tabs>\n * ```\n *\n * Each route is a destination, labelled by its `tabBarLabel` or its title,\n * with the icon `tabBarIcon` draws and the badge `tabBarBadge` asks for, and\n * the focused route is the selected one. Pressing a destination reports\n * `tabPress` to the navigator and moves to its route unless a listener\n * prevents it, and a long press reports `tabLongPress`, as the navigators'\n * own tab bars do.\n *\n * `style`, `ref` and `testID` land on the bar's own view, as on a\n * `NavigationBar`.\n */\nfunction NavigationTabBar({\n descriptors,\n emitter,\n insets: _insets,\n navigateToTab,\n navigation,\n state,\n ...props\n}: NavigationTabBarProps) {\n const actions = actionsOf(emitter, navigateToTab, navigation)\n const focused = state.routes[state.index]?.key\n\n return (\n <NavigationBar {...props}>\n {state.routes.map((route) => (\n <TabDestination\n focused={route.key === focused}\n key={route.key}\n onLongPress={longPressThen(actions, route)}\n onPress={pressThen(actions, route, route.key === focused)}\n options={descriptors[route.key]?.options ?? NO_OPTIONS}\n route={route}\n />\n ))}\n </NavigationBar>\n )\n}\n\n/**\n * Moves to a tab once the navigator has heard the press, unless a listener\n * prevented it or the tab is already focused. Built by a call rather than\n * written inline at the prop, for the reason `widthThen` gives.\n */\nfunction pressThen(actions: TabActions, route: TabRoute, focused: boolean) {\n return () => {\n const event = actions.emit({\n canPreventDefault: true,\n target: route.key,\n type: 'tabPress',\n })\n\n if (!focused && !prevented(event)) {\n actions.go(route)\n }\n }\n}\n\n// Whether a listener prevented an event, as the navigator reports it.\nfunction prevented(event: unknown) {\n return (\n typeof event === 'object' &&\n event !== null &&\n 'defaultPrevented' in event &&\n event.defaultPrevented === true\n )\n}\n\n/**\n * One route's destination. Its colours are the destination's own for the\n * form the bar draws, which is why it reads them inside the bar rather than\n * the bar computing them for it.\n */\nfunction TabDestination({\n focused,\n onLongPress,\n onPress,\n options,\n route,\n}: {\n readonly focused: boolean\n readonly onLongPress: () => void\n readonly onPress: () => void\n readonly options: TabOptions\n readonly route: TabRoute\n}) {\n const theme = useTheme()\n const { form } = use(NavigationContext)\n const { tabBarLabel } = options\n const title =\n typeof tabBarLabel === 'string'\n ? tabBarLabel\n : (options.title ?? route.name)\n\n return (\n <NavigationDestination\n aria-label={options.tabBarAccessibilityLabel ?? title}\n badge={badgeOf(options.tabBarBadge)}\n icon={options.tabBarIcon?.({\n color: iconColorOf(theme, false, focused),\n focused,\n size: ICON_SIZE,\n })}\n onLongPress={onLongPress}\n onPress={onPress}\n selected={focused}\n testID={options.tabBarButtonTestID}\n >\n {typeof tabBarLabel === 'function'\n ? tabBarLabel({\n children: title,\n color: labelColorOf(theme, form, false, focused),\n focused,\n position: form === 'horizontal' ? 'beside-icon' : 'below-icon',\n })\n : title}\n </NavigationDestination>\n )\n}\n\n/**\n * Records a view's width, as React Native lays it out. Built by a call\n * rather than written inline at the prop, which is what react-perf's\n * jsx-no-new-function-as-prop is after; the React Compiler memoises the\n * result on its inputs.\n */\nfunction widthThen(setWidth: (width: number) => void) {\n return (event: LayoutChangeEvent) => {\n setWidth(event.nativeEvent.layout.width)\n }\n}\n\nNavigationBar.Item = NavigationBarItem\n\nexport type {\n NavigationBarItemProps,\n NavigationBarProps,\n NavigationTabBarProps,\n}\n\nexport { NavigationBar, NavigationBarItem, NavigationTabBar }\n"],"mappings":";;;;;;;;;;;AA8LA,MAAM0E,iBAAiB;AAGvB,MAAMC,YAAY;AAGlB,MAAMC,aAAyB,CAAC;AAGhC,MAAMC,SA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B,SAASM,UAAUmB,UAAmC;CACpD,QAAQ/G,UAA6B;EACnC+G,SAAS/G,MAAMgH,YAAYC,OAAOzE,KAAK;CACzC;AACF;AAEA0B,cAAcgD,OAAOd"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","LayoutChangeEvent","StyleProp","ViewProps","ViewStyle","Edge","use","useMemo","useState","StyleSheet","View","SafeAreaView","NavigationItemProps","useWindowSizeClass","iconColorOf","labelColorOf","NavigationContext","NavigationDestination","NavigationItem","useTheme","composeStyles","themedStyles","NavigationBarItemProps","NavigationBarProps","Omit","children","ref","selectedRoute","style","NavigationTabBarProps","TabNavigatorProps","descriptors","Readonly","Partial","Record","options","TabOptions","insets","state","index","routes","TabRoute","TabActions","emit","event","TabEvent","go","route","TabEmitter","canPreventDefault","target","type","emitter","navigateToTab","routeKey","navigation","navigate","name","params","tabBarAccessibilityLabel","tabBarBadge","tabBarButtonTestID","tabBarIcon","props","color","focused","size","tabBarLabel","position","title","key","MEASURING_ROOM","ICON_SIZE","NO_OPTIONS","DIGITS","EDGES","styles","create","measurer","height","overflow","pointerEvents","start","top","width","room","alignItems","vertical","stylesOf","colors","spacing","bar","backgroundColor","surfaceContainer","horizontal","gap","sm","measured","flexDirection","row","justifyContent","minHeight","actionsOf","undefined","badgeOf","badge","test","Number","longPressThen","actions","NavigationBar","t0","$","_c","theme","own","sizeClass","setRoom","needed","setNeeded","wide","t1","const","t2","form","measuring","context","t3","T0","t4","t5","T1","T2","t7","Symbol","for","widthThen","t8","t9","t10","t11","t6","t12","t13","NavigationBarItem","NavigationTabBar","_insets","map","pressThen","prevented","defaultPrevented","TabDestination","onLongPress","onPress","setWidth","nativeEvent","layout","Item","_c"],"sources":["../../../src/components/navigation-bar/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n LayoutChangeEvent,\n StyleProp,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { Edge } from 'react-native-safe-area-context'\n\nimport { use, useMemo, useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { SafeAreaView } from 'react-native-safe-area-context'\n\nimport type { NavigationItemProps } from '../../navigation'\n\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport {\n iconColorOf,\n labelColorOf,\n NavigationContext,\n NavigationDestination,\n NavigationItem,\n} from '../../navigation'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// kanso-ui's NavigationBar, the navigation bar page's flexible bar: three to\n// five destinations across the bottom of a compact window, on the surface\n// container, 64dp tall. In a compact window each destination is vertical and\n// the destinations share the bar's width equally; from the medium window\n// size class each is the page's horizontal pill, as wide as what it holds,\n// and the group sits centred with the spare width at the bar's ends, 8dp\n// between two pills. The destinations are src/navigation's, which holds the\n// two forms' values.\n//\n// The 8dp between two horizontal pills is the library's own, as on web. The\n// page puts each pill in an item of a fixed width it does not give, and with\n// no space at all the pills met edge to edge.\n//\n// **A bar too narrow for its horizontal form keeps the vertical one.** A\n// horizontal destination is as wide as its icon, its label and 16dp either\n// side, so five of them need far more than the 600dp the medium class starts\n// at, and drawn anyway every label would be cut short the moment the window\n// crossed into it. So from that class the bar draws its destinations a\n// second time, off screen in the horizontal form at their own widths, and\n// draws that form only while the bar is at least as wide as they are. Web\n// measures the labels it cuts short instead, which native has no way to ask.\n// The horizontal form is drawn until the first measurement arrives, so a bar\n// that fits never draws the other form for a frame.\n//\n// The bar paints its surface to the screen's bottom edge, under the home\n// indicator, and keeps its destinations inside the safe area: a\n// `SafeAreaView` pads it by the home indicator and a landscape notch\n// wherever the bar meets them, and by nothing where it does not.\n//\n// The bar is a `tablist` and each destination a `tab`, which is how both\n// platforms' own tab bars are announced. Web's is a landmark of links with\n// the current one marked as the page, which native has no counterpart for.\n// A destination still goes to its `href` through the app's router, see\n// `RouterProvider`. `NavigationTabBar` draws the bar for React Navigation's\n// bottom tabs and Expo Router's tabs instead.\n\ntype NavigationBarItemProps = NavigationItemProps\n\ntype NavigationBarProps = Omit<ViewProps, 'children' | 'style'> & {\n /** The destinations, each a `NavigationBar.Item`. */\n readonly children?: ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * The route of the current destination, matched against each\n * destination's `href`. The match is the selected tab, and draws the\n * active indicator.\n */\n readonly selectedRoute?: string | undefined\n readonly style?: StyleProp<ViewStyle>\n}\n\n/** The routes a tab navigator hands its tab bar, as both navigators do. */\ntype NavigationTabBarProps = Omit<\n NavigationBarProps,\n 'children' | 'selectedRoute'\n> &\n TabNavigatorProps & {\n /** Each route's options, by the route's key. */\n readonly descriptors: Readonly<\n Partial<Record<string, { readonly options: TabOptions }>>\n >\n /**\n * The insets the navigator measured, which the bar measures for itself\n * instead.\n */\n readonly insets?: unknown\n /** The navigator's routes, and which of them is focused. */\n readonly state: {\n readonly index: number\n readonly routes: readonly TabRoute[]\n }\n }\n\n/** What a tab bar's press tells the navigator, and how it moves to a tab. */\ntype TabActions = {\n readonly emit: (event: TabEvent) => unknown\n readonly go: (route: TabRoute) => void\n}\n\n/**\n * What hears a tab bar's events: React Navigation's `navigation` and Expo\n * Router's `emitter` alike.\n */\ntype TabEmitter = {\n emit(event: TabEvent): unknown\n}\n\n/** The events a tab bar reports, as both navigators name them. */\ntype TabEvent =\n | {\n readonly canPreventDefault: true\n readonly target: string\n readonly type: 'tabPress'\n }\n | { readonly target: string; readonly type: 'tabLongPress' }\n\n/**\n * How a tab bar moves to a tab: through React Navigation's `navigation`, or\n * through Expo Router's `navigateToTab`.\n */\ntype TabNavigatorProps =\n | {\n readonly emitter: TabEmitter\n readonly navigateToTab: (routeKey: string) => void\n readonly navigation?: never\n }\n | {\n readonly emitter?: never\n readonly navigateToTab?: never\n readonly navigation: TabEmitter & {\n navigate(name: string, params?: object): void\n }\n }\n\n/**\n * A tab's options the bar reads, as React Navigation's bottom tabs and Expo\n * Router's tabs both hand them to a tab bar. Options they take that are not\n * listed here are left to them.\n */\ntype TabOptions = {\n /** The tab's name for a screen reader, where it differs from its label. */\n readonly tabBarAccessibilityLabel?: string | undefined\n /**\n * The badge on the tab's icon. A number, or a string of digits, is the\n * large badge's count; any other string is the small dot, since a badge\n * draws a count and nothing else.\n */\n readonly tabBarBadge?: number | string | undefined\n readonly tabBarButtonTestID?: string | undefined\n /** The tab's icon, drawn at the size and in the colour it is handed. */\n readonly tabBarIcon?:\n | ((props: {\n readonly color: string\n readonly focused: boolean\n readonly size: number\n }) => ReactNode)\n | undefined\n /** The tab's label, in place of its title. */\n readonly tabBarLabel?:\n | ((props: {\n readonly children: string\n readonly color: string\n readonly focused: boolean\n readonly position: 'below-icon' | 'beside-icon'\n }) => ReactNode)\n | string\n | undefined\n readonly title?: string | undefined\n}\n\ntype TabRoute = {\n readonly key: string\n readonly name: string\n readonly params?: object | undefined\n}\n\n// Where the destinations are drawn off screen to be measured. Wider than any\n// bar, so each one is measured at its own width rather than squeezed.\nconst MEASURING_ROOM = 10_000\n\n// The size a tab's icon is drawn at, the page's.\nconst ICON_SIZE = 24\n\n// A route its navigator handed no options for.\nconst NO_OPTIONS: TabOptions = {}\n\n// A string of digits, which a badge draws as a count.\nconst DIGITS = /^\\d+$/u\n\n// The bar's sides as well as its bottom, so a landscape notch is cleared too.\n// The top is the screen's.\nconst EDGES: readonly Edge[] = ['bottom', 'left', 'right']\n\nconst styles = StyleSheet.create({\n // Holds the destinations measured off screen. It has no size and clips what\n // it holds, so they are laid out and never drawn, and take no touches.\n measurer: {\n height: 0,\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n start: 0,\n top: 0,\n width: 0,\n },\n // The room the destinations are measured in, with the row of them at its\n // start, at the row's own width.\n room: {\n alignItems: 'flex-start',\n width: MEASURING_ROOM,\n },\n // The vertical form: each destination its share of the bar's height.\n vertical: {\n alignItems: 'stretch',\n },\n})\n\nconst stylesOf = themedStyles(({ colors, spacing }) =>\n StyleSheet.create({\n bar: {\n backgroundColor: colors.surfaceContainer,\n },\n // The horizontal form: the pills centred, 8dp apart.\n horizontal: {\n alignItems: 'center',\n gap: spacing.sm,\n },\n // The destinations, measured in the horizontal form.\n measured: {\n flexDirection: 'row',\n gap: spacing.sm,\n },\n // The page's 64dp, a minimum rather than a height, so a larger text size\n // the device asks for grows the bar rather than cutting the labels off.\n row: {\n flexDirection: 'row',\n justifyContent: 'center',\n minHeight: 64,\n },\n }),\n)\n\n/**\n * What the bar tells the navigator and how it moves, from whichever of the\n * two navigators drew it.\n */\nfunction actionsOf(\n emitter: TabEmitter | undefined,\n navigateToTab: ((routeKey: string) => void) | undefined,\n navigation: TabNavigatorProps['navigation'],\n): TabActions {\n if (navigation !== undefined) {\n return {\n emit: (event) => navigation.emit(event),\n go: (route) => {\n navigation.navigate(route.name, route.params)\n },\n }\n }\n return {\n emit: (event) => emitter?.emit(event),\n go: (route) => {\n navigateToTab?.(route.key)\n },\n }\n}\n\n/**\n * The badge a tab's `tabBarBadge` draws: the count of a number or a string of\n * digits, and the small dot for any other string.\n */\nfunction badgeOf(\n badge: number | string | undefined,\n): boolean | number | undefined {\n if (typeof badge === 'number') {\n return badge\n }\n if (badge === undefined || badge === '') {\n return undefined\n }\n return DIGITS.test(badge) ? Number(badge) : true\n}\n\n/**\n * Reports a long press on a tab. Built by a call rather than written inline\n * at the prop, for the reason `widthThen` gives.\n */\nfunction longPressThen(actions: TabActions, route: TabRoute) {\n return () => {\n actions.emit({ target: route.key, type: 'tabLongPress' })\n }\n}\n\n/**\n * The bar of three to five top-level destinations a compact window keeps at\n * its bottom edge. Each destination goes to its `href` through the app's\n * router, see `RouterProvider`.\n *\n * ```tsx\n * <NavigationBar selectedRoute=\"/first\">\n * <NavigationBar.Item href=\"/first\" icon={<FirstIcon />}>\n * First item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/second\" icon={<SecondIcon />}>\n * Second item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/third\" icon={<ThirdIcon />}>\n * Third item\n * </NavigationBar.Item>\n * </NavigationBar>\n * ```\n *\n * Draw it below the screen's content, at the bottom of the window: it paints\n * its surface to the bottom edge and keeps its destinations clear of the home\n * indicator itself. From the medium window size class each destination puts\n * its label beside its icon, where the bar is wide enough for every label.\n *\n * `style`, `ref` and `testID` land on the bar's own view, which is announced\n * as a tab list.\n */\nfunction NavigationBar({\n children,\n selectedRoute,\n style,\n ...props\n}: NavigationBarProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const sizeClass = useWindowSizeClass()\n // The width the destinations have, and the width the horizontal form\n // takes, while each is known.\n const [room, setRoom] = useState<number | undefined>(undefined)\n const [needed, setNeeded] = useState<number | undefined>(undefined)\n\n const wide = sizeClass !== 'compact'\n const horizontal =\n wide && (room === undefined || needed === undefined || needed <= room)\n const context = useMemo(\n () => ({\n form: horizontal ? ('horizontal' as const) : ('vertical' as const),\n measuring: false,\n selectedRoute,\n }),\n [horizontal, selectedRoute],\n )\n const measuring = useMemo(\n () => ({ form: 'horizontal' as const, measuring: true, selectedRoute }),\n [selectedRoute],\n )\n\n return (\n <View\n role=\"tablist\"\n {...props}\n style={composeStyles<ViewStyle>(own.bar, style)}\n >\n <SafeAreaView edges={EDGES}>\n <View\n onLayout={widthThen(setRoom)}\n style={composeStyles<ViewStyle>(\n own.row,\n horizontal ? own.horizontal : styles.vertical,\n )}\n >\n <NavigationContext value={context}>{children}</NavigationContext>\n </View>\n </SafeAreaView>\n {wide ? (\n <View aria-hidden style={styles.measurer}>\n <View style={styles.room}>\n <View onLayout={widthThen(setNeeded)} style={own.measured}>\n <NavigationContext value={measuring}>\n {children}\n </NavigationContext>\n </View>\n </View>\n </View>\n ) : null}\n </View>\n )\n}\n\n/**\n * One destination of a navigation bar: an icon, a label and, while it is the\n * current one, the active indicator behind the icon. Pressing it calls\n * `onPress`, then goes to its `href`. Renders nothing of its own outside a\n * `NavigationBar`, whose `selectedRoute` says whether it is selected.\n *\n * `style`, `ref` and `testID` land on the destination's `Pressable`.\n */\nfunction NavigationBarItem(props: NavigationBarItemProps) {\n return <NavigationItem {...props} />\n}\n\n/**\n * A navigation bar drawing a tab navigator's routes, for the `tabBar` prop of\n * React Navigation's bottom tabs and of Expo Router's `Tabs` alike.\n *\n * ```tsx\n * <Tabs tabBar={(props) => <NavigationTabBar {...props} />}>\n * <Tabs.Screen name=\"index\" options={{ tabBarIcon: () => <FirstIcon />, title: 'First item' }} />\n * </Tabs>\n * ```\n *\n * Each route is a destination, labelled by its `tabBarLabel` or its title,\n * with the icon `tabBarIcon` draws and the badge `tabBarBadge` asks for, and\n * the focused route is the selected one. Pressing a destination reports\n * `tabPress` to the navigator and moves to its route unless a listener\n * prevents it, and a long press reports `tabLongPress`, as the navigators'\n * own tab bars do.\n *\n * `style`, `ref` and `testID` land on the bar's own view, as on a\n * `NavigationBar`.\n */\nfunction NavigationTabBar({\n descriptors,\n emitter,\n insets: _insets,\n navigateToTab,\n navigation,\n state,\n ...props\n}: NavigationTabBarProps) {\n const actions = actionsOf(emitter, navigateToTab, navigation)\n const focused = state.routes[state.index]?.key\n\n return (\n <NavigationBar {...props}>\n {state.routes.map((route) => (\n <TabDestination\n focused={route.key === focused}\n key={route.key}\n onLongPress={longPressThen(actions, route)}\n onPress={pressThen(actions, route, route.key === focused)}\n options={descriptors[route.key]?.options ?? NO_OPTIONS}\n route={route}\n />\n ))}\n </NavigationBar>\n )\n}\n\n/**\n * Moves to a tab once the navigator has heard the press, unless a listener\n * prevented it or the tab is already focused. Built by a call rather than\n * written inline at the prop, for the reason `widthThen` gives.\n */\nfunction pressThen(actions: TabActions, route: TabRoute, focused: boolean) {\n return () => {\n const event = actions.emit({\n canPreventDefault: true,\n target: route.key,\n type: 'tabPress',\n })\n\n if (!focused && !prevented(event)) {\n actions.go(route)\n }\n }\n}\n\n// Whether a listener prevented an event, as the navigator reports it.\nfunction prevented(event: unknown) {\n return (\n typeof event === 'object' &&\n event !== null &&\n 'defaultPrevented' in event &&\n event.defaultPrevented === true\n )\n}\n\n/**\n * One route's destination. Its colours are the destination's own for the\n * form the bar draws, which is why it reads them inside the bar rather than\n * the bar computing them for it.\n */\nfunction TabDestination({\n focused,\n onLongPress,\n onPress,\n options,\n route,\n}: {\n readonly focused: boolean\n readonly onLongPress: () => void\n readonly onPress: () => void\n readonly options: TabOptions\n readonly route: TabRoute\n}) {\n const theme = useTheme()\n const { form } = use(NavigationContext)\n const { tabBarLabel } = options\n const title =\n typeof tabBarLabel === 'string'\n ? tabBarLabel\n : (options.title ?? route.name)\n\n return (\n <NavigationDestination\n aria-label={options.tabBarAccessibilityLabel ?? title}\n badge={badgeOf(options.tabBarBadge)}\n icon={options.tabBarIcon?.({\n color: iconColorOf(theme, false, focused),\n focused,\n size: ICON_SIZE,\n })}\n onLongPress={onLongPress}\n onPress={onPress}\n selected={focused}\n testID={options.tabBarButtonTestID}\n >\n {typeof tabBarLabel === 'function'\n ? tabBarLabel({\n children: title,\n color: labelColorOf(theme, form, false, focused),\n focused,\n position: form === 'horizontal' ? 'beside-icon' : 'below-icon',\n })\n : title}\n </NavigationDestination>\n )\n}\n\n/**\n * Records a view's width, as React Native lays it out. Built by a call\n * rather than written inline at the prop, which is what react-perf's\n * jsx-no-new-function-as-prop is after; the React Compiler memoises the\n * result on its inputs.\n */\nfunction widthThen(setWidth: (width: number) => void) {\n return (event: LayoutChangeEvent) => {\n setWidth(event.nativeEvent.layout.width)\n }\n}\n\nNavigationBar.Item = NavigationBarItem\n\nexport type {\n NavigationBarItemProps,\n NavigationBarProps,\n NavigationTabBarProps,\n}\n\nexport { NavigationBar, NavigationBarItem, NavigationTabBar }\n"],"mappings":";;;;;;;;;;AAwLA,MAAMyE,iBAAiB;AAGvB,MAAMC,YAAY;AAGlB,MAAMC,aAAyB,CAAC;AAGhC,MAAMC,SAAS;AAIf,MAAMC,QAAyB;CAAC;CAAU;CAAQ;AAAO;AAEzD,MAAMC,SAASnE,WAAWoE,OAAO;CAG/BC,UAAU;EACRC,QAAQ;EACRC,UAAU;EACVC,eAAe;EACfb,UAAU;EACVc,OAAO;EACPC,KAAK;E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AA,QAAAS,MAAAT,EAAA,QAAAW,MAAAX,EAAA,QAAAe,MAAAf,EAAA,QAAAiB,IAAA;EApBXC,KAAA,oBAAC,uBAAD;GACc,cAAAT;GACL,OAAAE;GACD,MAAAI;GAKOyB;GACJC;GACCxF,UAAAA;GACF,QAAA9B,QAAO0B;GAEdoE,UAAAA;EAbmB,CAAA;EAqBEjB,EAAA,MAAA/C;EAAA+C,EAAA,MAAAwC;EAAAxC,EAAA,MAAAyC;EAAAzC,EAAA,MAAA7E,QAAA0B;EAAAmD,EAAA,MAAAS;EAAAT,EAAA,MAAAW;EAAAX,EAAA,MAAAe;EAAAf,EAAA,MAAAiB;EAAAjB,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,OArBxBkB;AAqBwB;;;;;;;AAU5B,SAASM,UAAUkB,UAAmC;CACpD,QAAQ9G,UAA6B;EACnC8G,SAAS9G,MAAM+G,YAAYC,OAAOxE,KAAK;CACzC;AACF;AAEA0B,cAAc+C,OAAOb"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { NavigationItemProps } from "../../navigation/index.js";
|
|
2
|
+
import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
3
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
4
|
+
//#region src/components/navigation-rail/index.d.ts
|
|
5
|
+
type NavigationRailItemProps = NavigationItemProps;
|
|
6
|
+
type NavigationRailProps = Omit<ViewProps, 'children' | 'style'> & {
|
|
7
|
+
/** The destinations: `NavigationRail.Item`s. */
|
|
8
|
+
readonly children?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* What the rail draws above its destinations: a menu button that expands
|
|
11
|
+
* it, or a floating action button.
|
|
12
|
+
*/
|
|
13
|
+
readonly header?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the rail is in its expanded form, each destination a pill with
|
|
16
|
+
* its label beside the icon, rather than collapsed with the label under it.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
readonly isExpanded?: boolean;
|
|
20
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
21
|
+
/**
|
|
22
|
+
* The route of the current destination, matched against each
|
|
23
|
+
* destination's `href`. The match is selected and draws the active
|
|
24
|
+
* indicator.
|
|
25
|
+
*/
|
|
26
|
+
readonly selectedRoute?: string;
|
|
27
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The column of top-level destinations a medium or wider window keeps at its
|
|
31
|
+
* leading edge, collapsed or, with `isExpanded`, expanded. Each destination
|
|
32
|
+
* goes to its `href` through the app's router, see `RouterProvider`.
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <NavigationRail selectedRoute="/first">
|
|
36
|
+
* <NavigationRail.Item href="/first" icon={<FirstIcon />}>
|
|
37
|
+
* First item
|
|
38
|
+
* </NavigationRail.Item>
|
|
39
|
+
* <NavigationRail.Item href="/second" icon={<SecondIcon />}>
|
|
40
|
+
* Second item
|
|
41
|
+
* </NavigationRail.Item>
|
|
42
|
+
* </NavigationRail>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* Draw it at the leading edge of a row holding the screen's content, which
|
|
46
|
+
* gives it its height: it paints its surface to the screen's edges and keeps
|
|
47
|
+
* its destinations clear of the status bar, the home indicator and a notch
|
|
48
|
+
* itself.
|
|
49
|
+
*
|
|
50
|
+
* `aria-label` names the destinations' tab list. `style`, `ref` and `testID`
|
|
51
|
+
* land on the rail's own view, its surface.
|
|
52
|
+
*/
|
|
53
|
+
declare function NavigationRail({ 'aria-label': ariaLabel, children, header, isExpanded, selectedRoute, style, ...props }: NavigationRailProps): import("react").JSX.Element;
|
|
54
|
+
declare namespace NavigationRail {
|
|
55
|
+
var Item: typeof NavigationRailItem;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* One destination of a navigation rail: an icon, a label and, while it is
|
|
59
|
+
* the current one, the active indicator. Pressing it calls `onPress`, then
|
|
60
|
+
* goes to its `href`. Renders nothing of its own outside a `NavigationRail`,
|
|
61
|
+
* whose `selectedRoute` says whether it is selected.
|
|
62
|
+
*
|
|
63
|
+
* `style`, `ref` and `testID` land on the destination's `Pressable`.
|
|
64
|
+
*/
|
|
65
|
+
declare function NavigationRailItem(props: NavigationRailItemProps): import("react").JSX.Element;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { NavigationRail, NavigationRailItem, type NavigationRailItemProps, type NavigationRailProps };
|
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { useTheme } from "../../theme/scope.js";
|
|
2
|
+
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
3
|
+
import { NavigationContext, NavigationItem } from "../../navigation/index.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { I18nManager, ScrollView, StyleSheet, View } from "react-native";
|
|
6
|
+
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from "react-native-reanimated";
|
|
7
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
8
|
+
import "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/navigation-rail/index.tsx
|
|
11
|
+
const COLLAPSED_WIDTH = 96;
|
|
12
|
+
const EXPANDED_MIN_WIDTH = 220;
|
|
13
|
+
const EXPANDED_MAX_WIDTH = 360;
|
|
14
|
+
const TOP_PADDING = 44;
|
|
15
|
+
const EXPANDED_PADDING = 20;
|
|
16
|
+
const RING_REACH = 4;
|
|
17
|
+
const styles = StyleSheet.create({
|
|
18
|
+
content: { flexShrink: 0 },
|
|
19
|
+
destinations: {
|
|
20
|
+
alignSelf: "stretch",
|
|
21
|
+
flexBasis: "auto",
|
|
22
|
+
flexGrow: 1,
|
|
23
|
+
flexShrink: 1,
|
|
24
|
+
margin: -4
|
|
25
|
+
},
|
|
26
|
+
inset: {
|
|
27
|
+
flexGrow: 1,
|
|
28
|
+
flexShrink: 1
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const stylesOf = themedStyles(({ colors, spacing }) => StyleSheet.create({
|
|
32
|
+
collapsed: {
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
flexGrow: 1,
|
|
35
|
+
flexShrink: 1,
|
|
36
|
+
paddingBottom: spacing.xl,
|
|
37
|
+
paddingTop: TOP_PADDING,
|
|
38
|
+
width: COLLAPSED_WIDTH
|
|
39
|
+
},
|
|
40
|
+
collapsedList: {
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
gap: spacing.xs,
|
|
43
|
+
padding: RING_REACH
|
|
44
|
+
},
|
|
45
|
+
expanded: {
|
|
46
|
+
flexGrow: 1,
|
|
47
|
+
flexShrink: 1,
|
|
48
|
+
maxWidth: EXPANDED_MAX_WIDTH,
|
|
49
|
+
minWidth: EXPANDED_MIN_WIDTH,
|
|
50
|
+
paddingBottom: spacing.xl,
|
|
51
|
+
paddingHorizontal: EXPANDED_PADDING,
|
|
52
|
+
paddingTop: TOP_PADDING
|
|
53
|
+
},
|
|
54
|
+
expandedList: {
|
|
55
|
+
alignItems: "flex-start",
|
|
56
|
+
padding: RING_REACH
|
|
57
|
+
},
|
|
58
|
+
header: {
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
marginBottom: spacing.xxxl - spacing.xs
|
|
61
|
+
},
|
|
62
|
+
headerExpanded: {
|
|
63
|
+
alignItems: "flex-start",
|
|
64
|
+
alignSelf: "stretch",
|
|
65
|
+
marginBottom: spacing.xxxl,
|
|
66
|
+
paddingStart: spacing.sm
|
|
67
|
+
},
|
|
68
|
+
rail: {
|
|
69
|
+
backgroundColor: colors.surface,
|
|
70
|
+
flexDirection: "row",
|
|
71
|
+
flexShrink: 0,
|
|
72
|
+
overflow: "hidden"
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
function edgesOf() {
|
|
76
|
+
return [
|
|
77
|
+
"bottom",
|
|
78
|
+
I18nManager.isRTL ? "right" : "left",
|
|
79
|
+
"top"
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The column of top-level destinations a medium or wider window keeps at its
|
|
84
|
+
* leading edge, collapsed or, with `isExpanded`, expanded. Each destination
|
|
85
|
+
* goes to its `href` through the app's router, see `RouterProvider`.
|
|
86
|
+
*
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <NavigationRail selectedRoute="/first">
|
|
89
|
+
* <NavigationRail.Item href="/first" icon={<FirstIcon />}>
|
|
90
|
+
* First item
|
|
91
|
+
* </NavigationRail.Item>
|
|
92
|
+
* <NavigationRail.Item href="/second" icon={<SecondIcon />}>
|
|
93
|
+
* Second item
|
|
94
|
+
* </NavigationRail.Item>
|
|
95
|
+
* </NavigationRail>
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* Draw it at the leading edge of a row holding the screen's content, which
|
|
99
|
+
* gives it its height: it paints its surface to the screen's edges and keeps
|
|
100
|
+
* its destinations clear of the status bar, the home indicator and a notch
|
|
101
|
+
* itself.
|
|
102
|
+
*
|
|
103
|
+
* `aria-label` names the destinations' tab list. `style`, `ref` and `testID`
|
|
104
|
+
* land on the rail's own view, its surface.
|
|
105
|
+
*/
|
|
106
|
+
function NavigationRail(t0) {
|
|
107
|
+
const $ = c(43);
|
|
108
|
+
let ariaLabel;
|
|
109
|
+
let children;
|
|
110
|
+
let header;
|
|
111
|
+
let props;
|
|
112
|
+
let selectedRoute;
|
|
113
|
+
let style;
|
|
114
|
+
let t1;
|
|
115
|
+
if ($[0] !== t0) {
|
|
116
|
+
({"aria-label": ariaLabel, children, header, isExpanded: t1, selectedRoute, style, ...props} = t0);
|
|
117
|
+
$[0] = t0;
|
|
118
|
+
$[1] = ariaLabel;
|
|
119
|
+
$[2] = children;
|
|
120
|
+
$[3] = header;
|
|
121
|
+
$[4] = props;
|
|
122
|
+
$[5] = selectedRoute;
|
|
123
|
+
$[6] = style;
|
|
124
|
+
$[7] = t1;
|
|
125
|
+
} else {
|
|
126
|
+
ariaLabel = $[1];
|
|
127
|
+
children = $[2];
|
|
128
|
+
header = $[3];
|
|
129
|
+
props = $[4];
|
|
130
|
+
selectedRoute = $[5];
|
|
131
|
+
style = $[6];
|
|
132
|
+
t1 = $[7];
|
|
133
|
+
}
|
|
134
|
+
const isExpanded = t1 === void 0 ? false : t1;
|
|
135
|
+
const theme = useTheme();
|
|
136
|
+
const own = stylesOf(theme);
|
|
137
|
+
const reduceMotion = useReducedMotion();
|
|
138
|
+
const width = useSharedValue(void 0);
|
|
139
|
+
const t2 = isExpanded ? "expanded" : "collapsed";
|
|
140
|
+
let t3;
|
|
141
|
+
if ($[8] !== selectedRoute || $[9] !== t2) {
|
|
142
|
+
t3 = {
|
|
143
|
+
form: t2,
|
|
144
|
+
measuring: false,
|
|
145
|
+
selectedRoute
|
|
146
|
+
};
|
|
147
|
+
$[8] = selectedRoute;
|
|
148
|
+
$[9] = t2;
|
|
149
|
+
$[10] = t3;
|
|
150
|
+
} else t3 = $[10];
|
|
151
|
+
const context = t3;
|
|
152
|
+
const widthStyle = useAnimatedStyle(() => {
|
|
153
|
+
"worklet";
|
|
154
|
+
const current = width.get();
|
|
155
|
+
return current === void 0 ? {} : { width: current };
|
|
156
|
+
});
|
|
157
|
+
const t4 = Animated;
|
|
158
|
+
const t5 = composeStyles(own.rail, widthStyle, style);
|
|
159
|
+
const T0 = View;
|
|
160
|
+
let t6;
|
|
161
|
+
if ($[11] !== reduceMotion || $[12] !== theme || $[13] !== width) {
|
|
162
|
+
t6 = widthThen(width, reduceMotion, timingOf(theme));
|
|
163
|
+
$[11] = reduceMotion;
|
|
164
|
+
$[12] = theme;
|
|
165
|
+
$[13] = width;
|
|
166
|
+
$[14] = t6;
|
|
167
|
+
} else t6 = $[14];
|
|
168
|
+
const t7 = styles;
|
|
169
|
+
const T1 = SafeAreaView;
|
|
170
|
+
let t8;
|
|
171
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
172
|
+
t8 = edgesOf();
|
|
173
|
+
$[15] = t8;
|
|
174
|
+
} else t8 = $[15];
|
|
175
|
+
const t9 = styles;
|
|
176
|
+
const T2 = View;
|
|
177
|
+
const t10 = isExpanded ? own.expanded : own.collapsed;
|
|
178
|
+
const t11 = header === void 0 ? null : /* @__PURE__ */ jsx(View, {
|
|
179
|
+
style: composeStyles(own.header, isExpanded ? own.headerExpanded : void 0),
|
|
180
|
+
children: header
|
|
181
|
+
});
|
|
182
|
+
const t12 = isExpanded ? own.expandedList : own.collapsedList;
|
|
183
|
+
let t13;
|
|
184
|
+
if ($[16] !== children || $[17] !== context) {
|
|
185
|
+
t13 = /* @__PURE__ */ jsx(NavigationContext, {
|
|
186
|
+
value: context,
|
|
187
|
+
children
|
|
188
|
+
});
|
|
189
|
+
$[16] = children;
|
|
190
|
+
$[17] = context;
|
|
191
|
+
$[18] = t13;
|
|
192
|
+
} else t13 = $[18];
|
|
193
|
+
let t14;
|
|
194
|
+
if ($[19] !== ariaLabel || $[20] !== t12 || $[21] !== t13) {
|
|
195
|
+
t14 = /* @__PURE__ */ jsx(ScrollView, {
|
|
196
|
+
"aria-label": ariaLabel,
|
|
197
|
+
contentContainerStyle: t12,
|
|
198
|
+
role: "tablist",
|
|
199
|
+
style: styles.destinations,
|
|
200
|
+
children: t13
|
|
201
|
+
});
|
|
202
|
+
$[19] = ariaLabel;
|
|
203
|
+
$[20] = t12;
|
|
204
|
+
$[21] = t13;
|
|
205
|
+
$[22] = t14;
|
|
206
|
+
} else t14 = $[22];
|
|
207
|
+
let t15;
|
|
208
|
+
if ($[23] !== T2 || $[24] !== t10 || $[25] !== t11 || $[26] !== t14) {
|
|
209
|
+
t15 = /* @__PURE__ */ jsxs(T2, {
|
|
210
|
+
style: t10,
|
|
211
|
+
children: [t11, t14]
|
|
212
|
+
});
|
|
213
|
+
$[23] = T2;
|
|
214
|
+
$[24] = t10;
|
|
215
|
+
$[25] = t11;
|
|
216
|
+
$[26] = t14;
|
|
217
|
+
$[27] = t15;
|
|
218
|
+
} else t15 = $[27];
|
|
219
|
+
let t16;
|
|
220
|
+
if ($[28] !== T1 || $[29] !== t15 || $[30] !== t8 || $[31] !== t9.inset) {
|
|
221
|
+
t16 = /* @__PURE__ */ jsx(T1, {
|
|
222
|
+
edges: t8,
|
|
223
|
+
style: t9.inset,
|
|
224
|
+
children: t15
|
|
225
|
+
});
|
|
226
|
+
$[28] = T1;
|
|
227
|
+
$[29] = t15;
|
|
228
|
+
$[30] = t8;
|
|
229
|
+
$[31] = t9.inset;
|
|
230
|
+
$[32] = t16;
|
|
231
|
+
} else t16 = $[32];
|
|
232
|
+
let t17;
|
|
233
|
+
if ($[33] !== T0 || $[34] !== t16 || $[35] !== t6 || $[36] !== t7.content) {
|
|
234
|
+
t17 = /* @__PURE__ */ jsx(T0, {
|
|
235
|
+
onLayout: t6,
|
|
236
|
+
style: t7.content,
|
|
237
|
+
children: t16
|
|
238
|
+
});
|
|
239
|
+
$[33] = T0;
|
|
240
|
+
$[34] = t16;
|
|
241
|
+
$[35] = t6;
|
|
242
|
+
$[36] = t7.content;
|
|
243
|
+
$[37] = t17;
|
|
244
|
+
} else t17 = $[37];
|
|
245
|
+
let t18;
|
|
246
|
+
if ($[38] !== props || $[39] !== t17 || $[40] !== t4.View || $[41] !== t5) {
|
|
247
|
+
t18 = /* @__PURE__ */ jsx(t4.View, {
|
|
248
|
+
...props,
|
|
249
|
+
style: t5,
|
|
250
|
+
children: t17
|
|
251
|
+
});
|
|
252
|
+
$[38] = props;
|
|
253
|
+
$[39] = t17;
|
|
254
|
+
$[40] = t4.View;
|
|
255
|
+
$[41] = t5;
|
|
256
|
+
$[42] = t18;
|
|
257
|
+
} else t18 = $[42];
|
|
258
|
+
return t18;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* One destination of a navigation rail: an icon, a label and, while it is
|
|
262
|
+
* the current one, the active indicator. Pressing it calls `onPress`, then
|
|
263
|
+
* goes to its `href`. Renders nothing of its own outside a `NavigationRail`,
|
|
264
|
+
* whose `selectedRoute` says whether it is selected.
|
|
265
|
+
*
|
|
266
|
+
* `style`, `ref` and `testID` land on the destination's `Pressable`.
|
|
267
|
+
*/
|
|
268
|
+
function NavigationRailItem(props) {
|
|
269
|
+
const $ = c(2);
|
|
270
|
+
let t0;
|
|
271
|
+
if ($[0] !== props) {
|
|
272
|
+
t0 = /* @__PURE__ */ jsx(NavigationItem, { ...props });
|
|
273
|
+
$[0] = props;
|
|
274
|
+
$[1] = t0;
|
|
275
|
+
} else t0 = $[1];
|
|
276
|
+
return t0;
|
|
277
|
+
}
|
|
278
|
+
function timingOf({ motion }) {
|
|
279
|
+
return {
|
|
280
|
+
duration: motion.durationLong2,
|
|
281
|
+
easing: Easing.bezier(...motion.easingEmphasized)
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function widthThen(width, reduceMotion, timing) {
|
|
285
|
+
return (event) => {
|
|
286
|
+
const next = event.nativeEvent.layout.width;
|
|
287
|
+
width.set(width.get() === void 0 || reduceMotion ? next : withTiming(next, timing));
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
NavigationRail.Item = NavigationRailItem;
|
|
291
|
+
//#endregion
|
|
292
|
+
export { NavigationRail, NavigationRailItem };
|
|
293
|
+
|
|
294
|
+
//# sourceMappingURL=index.js.map
|