@nexub/react-native 0.0.0-stage → 2.1.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 +111 -2
- package/lib/module/components/actions.js +222 -0
- package/lib/module/components/actions.js.map +1 -0
- package/lib/module/components/containers.js +292 -0
- package/lib/module/components/containers.js.map +1 -0
- package/lib/module/components/display.js +266 -0
- package/lib/module/components/display.js.map +1 -0
- package/lib/module/components/feedback.js +464 -0
- package/lib/module/components/feedback.js.map +1 -0
- package/lib/module/components/inputs.js +746 -0
- package/lib/module/components/inputs.js.map +1 -0
- package/lib/module/components/mobile.js +811 -0
- package/lib/module/components/mobile.js.map +1 -0
- package/lib/module/components/overlays.js +418 -0
- package/lib/module/components/overlays.js.map +1 -0
- package/lib/module/components/shared.js +57 -0
- package/lib/module/components/shared.js.map +1 -0
- package/lib/module/hooks/useControllableState.js +23 -0
- package/lib/module/hooks/useControllableState.js.map +1 -0
- package/lib/module/index.js +30 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/patterns/app.js +709 -0
- package/lib/module/patterns/app.js.map +1 -0
- package/lib/module/patterns/auth.js +224 -0
- package/lib/module/patterns/auth.js.map +1 -0
- package/lib/module/patterns/index.js +7 -0
- package/lib/module/patterns/index.js.map +1 -0
- package/lib/module/patterns/money.js +419 -0
- package/lib/module/patterns/money.js.map +1 -0
- package/lib/module/primitives/Icon.js +17 -0
- package/lib/module/primitives/Icon.js.map +1 -0
- package/lib/module/primitives/Layout.js +79 -0
- package/lib/module/primitives/Layout.js.map +1 -0
- package/lib/module/primitives/Pressable.js +77 -0
- package/lib/module/primitives/Pressable.js.map +1 -0
- package/lib/module/primitives/ScreenContainer.js +58 -0
- package/lib/module/primitives/ScreenContainer.js.map +1 -0
- package/lib/module/primitives/Surface.js +57 -0
- package/lib/module/primitives/Surface.js.map +1 -0
- package/lib/module/primitives/Text.js +70 -0
- package/lib/module/primitives/Text.js.map +1 -0
- package/lib/module/theme/ThemeProvider.js +127 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/fonts.js +56 -0
- package/lib/module/theme/fonts.js.map +1 -0
- package/lib/module/theme/haptics.js +56 -0
- package/lib/module/theme/haptics.js.map +1 -0
- package/lib/module/theme/navigation.js +99 -0
- package/lib/module/theme/navigation.js.map +1 -0
- package/lib/typescript/components/actions.d.ts +53 -0
- package/lib/typescript/components/actions.d.ts.map +1 -0
- package/lib/typescript/components/containers.d.ts +59 -0
- package/lib/typescript/components/containers.d.ts.map +1 -0
- package/lib/typescript/components/display.d.ts +62 -0
- package/lib/typescript/components/display.d.ts.map +1 -0
- package/lib/typescript/components/feedback.d.ts +93 -0
- package/lib/typescript/components/feedback.d.ts.map +1 -0
- package/lib/typescript/components/inputs.d.ts +141 -0
- package/lib/typescript/components/inputs.d.ts.map +1 -0
- package/lib/typescript/components/mobile.d.ts +173 -0
- package/lib/typescript/components/mobile.d.ts.map +1 -0
- package/lib/typescript/components/overlays.d.ts +74 -0
- package/lib/typescript/components/overlays.d.ts.map +1 -0
- package/lib/typescript/components/shared.d.ts +20 -0
- package/lib/typescript/components/shared.d.ts.map +1 -0
- package/lib/typescript/hooks/useControllableState.d.ts +6 -0
- package/lib/typescript/hooks/useControllableState.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +37 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/patterns/app.d.ts +139 -0
- package/lib/typescript/patterns/app.d.ts.map +1 -0
- package/lib/typescript/patterns/auth.d.ts +54 -0
- package/lib/typescript/patterns/auth.d.ts.map +1 -0
- package/lib/typescript/patterns/index.d.ts +7 -0
- package/lib/typescript/patterns/index.d.ts.map +1 -0
- package/lib/typescript/patterns/money.d.ts +106 -0
- package/lib/typescript/patterns/money.d.ts.map +1 -0
- package/lib/typescript/primitives/Icon.d.ts +12 -0
- package/lib/typescript/primitives/Icon.d.ts.map +1 -0
- package/lib/typescript/primitives/Layout.d.ts +26 -0
- package/lib/typescript/primitives/Layout.d.ts.map +1 -0
- package/lib/typescript/primitives/Pressable.d.ts +21 -0
- package/lib/typescript/primitives/Pressable.d.ts.map +1 -0
- package/lib/typescript/primitives/ScreenContainer.d.ts +25 -0
- package/lib/typescript/primitives/ScreenContainer.d.ts.map +1 -0
- package/lib/typescript/primitives/Surface.d.ts +23 -0
- package/lib/typescript/primitives/Surface.d.ts.map +1 -0
- package/lib/typescript/primitives/Text.d.ts +21 -0
- package/lib/typescript/primitives/Text.d.ts.map +1 -0
- package/lib/typescript/theme/ThemeProvider.d.ts +69 -0
- package/lib/typescript/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/theme/fonts.d.ts +25 -0
- package/lib/typescript/theme/fonts.d.ts.map +1 -0
- package/lib/typescript/theme/haptics.d.ts +3 -0
- package/lib/typescript/theme/haptics.d.ts.map +1 -0
- package/lib/typescript/theme/navigation.d.ts +158 -0
- package/lib/typescript/theme/navigation.d.ts.map +1 -0
- package/package.json +138 -3
- package/src/components/actions.tsx +259 -0
- package/src/components/containers.tsx +341 -0
- package/src/components/display.tsx +314 -0
- package/src/components/feedback.tsx +522 -0
- package/src/components/inputs.tsx +851 -0
- package/src/components/mobile.tsx +879 -0
- package/src/components/overlays.tsx +485 -0
- package/src/components/shared.ts +54 -0
- package/src/hooks/useControllableState.ts +27 -0
- package/src/index.ts +175 -0
- package/src/patterns/app.tsx +715 -0
- package/src/patterns/auth.tsx +266 -0
- package/src/patterns/index.ts +57 -0
- package/src/patterns/money.tsx +458 -0
- package/src/primitives/Icon.tsx +15 -0
- package/src/primitives/Layout.tsx +71 -0
- package/src/primitives/Pressable.tsx +94 -0
- package/src/primitives/ScreenContainer.tsx +65 -0
- package/src/primitives/Surface.tsx +75 -0
- package/src/primitives/Text.tsx +79 -0
- package/src/theme/ThemeProvider.tsx +210 -0
- package/src/theme/fonts.ts +52 -0
- package/src/theme/haptics.ts +57 -0
- package/src/theme/navigation.ts +68 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ScrollView, View } from 'react-native';
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
+
import { useTheme } from "../theme/ThemeProvider.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* The root of every screen: background, edge-to-edge safe-area insets and
|
|
10
|
+
* content padding. With `scroll`, iOS adjusts insets itself
|
|
11
|
+
* (contentInsetAdjustmentBehavior) so native large titles collapse.
|
|
12
|
+
*/
|
|
13
|
+
export function ScreenContainer({
|
|
14
|
+
scroll = true,
|
|
15
|
+
edges = ['left', 'right', 'bottom'],
|
|
16
|
+
background = 'surface',
|
|
17
|
+
padding = '4',
|
|
18
|
+
gap = '4',
|
|
19
|
+
contentStyle,
|
|
20
|
+
children,
|
|
21
|
+
style,
|
|
22
|
+
...rest
|
|
23
|
+
}) {
|
|
24
|
+
const {
|
|
25
|
+
roles,
|
|
26
|
+
tokens
|
|
27
|
+
} = useTheme();
|
|
28
|
+
const insets = useSafeAreaInsets();
|
|
29
|
+
const pad = tokens.spacing[padding];
|
|
30
|
+
const inner = {
|
|
31
|
+
paddingTop: pad + (edges.includes('top') ? insets.top : 0),
|
|
32
|
+
paddingBottom: pad + (edges.includes('bottom') ? insets.bottom : 0),
|
|
33
|
+
paddingStart: pad + (edges.includes('left') ? insets.left : 0),
|
|
34
|
+
paddingEnd: pad + (edges.includes('right') ? insets.right : 0),
|
|
35
|
+
gap: tokens.spacing[gap]
|
|
36
|
+
};
|
|
37
|
+
if (!scroll) {
|
|
38
|
+
return /*#__PURE__*/_jsx(View, {
|
|
39
|
+
style: [{
|
|
40
|
+
flex: 1,
|
|
41
|
+
backgroundColor: roles[background]
|
|
42
|
+
}, inner, contentStyle, style],
|
|
43
|
+
children: children
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
47
|
+
contentInsetAdjustmentBehavior: "automatic",
|
|
48
|
+
keyboardShouldPersistTaps: "handled",
|
|
49
|
+
style: [{
|
|
50
|
+
flex: 1,
|
|
51
|
+
backgroundColor: roles[background]
|
|
52
|
+
}, style],
|
|
53
|
+
contentContainerStyle: [inner, contentStyle],
|
|
54
|
+
...rest,
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=ScreenContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","ScrollView","View","useSafeAreaInsets","useTheme","jsx","_jsx","ScreenContainer","scroll","edges","background","padding","gap","contentStyle","children","style","rest","roles","tokens","insets","pad","spacing","inner","paddingTop","includes","top","paddingBottom","bottom","paddingStart","left","paddingEnd","right","flex","backgroundColor","contentInsetAdjustmentBehavior","keyboardShouldPersistTaps","contentContainerStyle"],"sourceRoot":"../../../src","sources":["primitives/ScreenContainer.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,IAAI,QAA8C,cAAc;AACrF,SAASC,iBAAiB,QAAmB,gCAAgC;AAC7E,SAASC,QAAQ,QAAuB,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAiBjE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAC;EAC9BC,MAAM,GAAG,IAAI;EACbC,KAAK,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;EACnCC,UAAU,GAAG,SAAS;EACtBC,OAAO,GAAG,GAAG;EACbC,GAAG,GAAG,GAAG;EACTC,YAAY;EACZC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACiB,CAAC,EAAE;EACvB,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGd,QAAQ,CAAC,CAAC;EACpC,MAAMe,MAAM,GAAGhB,iBAAiB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,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useTheme } from "../theme/ThemeProvider.js";
|
|
6
|
+
|
|
7
|
+
// Optional peer: native Liquid Glass on iOS 26+. Everything else gets the solid fallback.
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
let Glass;
|
|
10
|
+
try {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- optional peer, must not fail when absent
|
|
12
|
+
Glass = require('expo-glass-effect');
|
|
13
|
+
} catch {
|
|
14
|
+
Glass = undefined;
|
|
15
|
+
}
|
|
16
|
+
const liquidGlass = Platform.OS === 'ios' && !!Glass?.isLiquidGlassAvailable();
|
|
17
|
+
/**
|
|
18
|
+
* A tonal surface. `material="glass"` is native Liquid Glass on iOS 26+, and
|
|
19
|
+
* `surface-elevated` + hairline elsewhere, or whenever glass is 'off' (user
|
|
20
|
+
* setting or Reduce Transparency).
|
|
21
|
+
*/
|
|
22
|
+
export function Surface({
|
|
23
|
+
tone = 'surface',
|
|
24
|
+
elevation = 0,
|
|
25
|
+
material = 'solid',
|
|
26
|
+
radius,
|
|
27
|
+
style,
|
|
28
|
+
...rest
|
|
29
|
+
}) {
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
const borderRadius = typeof radius === 'string' ? theme.tokens.shape[radius] : radius;
|
|
32
|
+
const glass = material === 'glass' && theme.glass !== 'off';
|
|
33
|
+
if (glass && liquidGlass && Glass) {
|
|
34
|
+
return /*#__PURE__*/_jsx(Glass.GlassView, {
|
|
35
|
+
glassEffectStyle: theme.glass === 'clear' ? 'clear' : 'regular',
|
|
36
|
+
tintColor: theme.glass === 'tinted' ? theme.roles['surface-elevated'] : undefined,
|
|
37
|
+
colorScheme: theme.scheme,
|
|
38
|
+
style: [{
|
|
39
|
+
borderRadius,
|
|
40
|
+
boxShadow: theme.elevation(elevation)
|
|
41
|
+
}, style],
|
|
42
|
+
...rest
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/_jsx(View, {
|
|
46
|
+
style: [{
|
|
47
|
+
backgroundColor: theme.roles[material === 'glass' ? 'surface-elevated' : tone],
|
|
48
|
+
borderRadius,
|
|
49
|
+
boxShadow: theme.elevation(elevation)
|
|
50
|
+
}, material === 'glass' && {
|
|
51
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
52
|
+
borderColor: theme.roles['outline-variant']
|
|
53
|
+
}, style],
|
|
54
|
+
...rest
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=Surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","View","useTheme","jsx","_jsx","Glass","require","undefined","liquidGlass","OS","isLiquidGlassAvailable","Surface","tone","elevation","material","radius","style","rest","theme","borderRadius","tokens","shape","glass","GlassView","glassEffectStyle","tintColor","roles","colorScheme","scheme","boxShadow","backgroundColor","borderWidth","hairlineWidth","borderColor"],"sourceRoot":"../../../src","sources":["primitives/Surface.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAwB,cAAc;AAEzE,SAASC,QAAQ,QAA4C,2BAAwB;;AAErF;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,IAAIC,KAAqD;AACzD,IAAI;EACF;EACAA,KAAK,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AACtC,CAAC,CAAC,MAAM;EACND,KAAK,GAAGE,SAAS;AACnB;AACA,MAAMC,WAAW,GAAGT,QAAQ,CAACU,EAAE,KAAK,KAAK,IAAI,CAAC,CAACJ,KAAK,EAAEK,sBAAsB,CAAC,CAAC;AAgB9E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAC;EACtBC,IAAI,GAAG,SAAS;EAChBC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AI,CACT,CAAC;AAEN","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Text as RNText } from 'react-native';
|
|
5
|
+
import { fontStyle } from "../theme/fonts.js";
|
|
6
|
+
import { useTheme } from "../theme/ThemeProvider.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
// iOS Dynamic Type: each role follows its Apple text style's scaling curve.
|
|
9
|
+
const RAMP = {
|
|
10
|
+
'display-lg': 'largeTitle',
|
|
11
|
+
'display-md': 'largeTitle',
|
|
12
|
+
'display-sm': 'largeTitle',
|
|
13
|
+
'headline-lg': 'title1',
|
|
14
|
+
'headline-md': 'title2',
|
|
15
|
+
'headline-sm': 'title3',
|
|
16
|
+
'title-lg': 'title3',
|
|
17
|
+
'title-md': 'headline',
|
|
18
|
+
'title-sm': 'subheadline',
|
|
19
|
+
'body-lg': 'body',
|
|
20
|
+
'body-md': 'body',
|
|
21
|
+
'body-sm': 'footnote',
|
|
22
|
+
'label-lg': 'subheadline',
|
|
23
|
+
'label-md': 'footnote',
|
|
24
|
+
'label-sm': 'caption1'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Big type already reads at large sizes; cap it so it doesn't push content off
|
|
28
|
+
// screen. Body, title and label roles scale without a cap (WCAG 1.4.4).
|
|
29
|
+
const cap = role => role.startsWith('display') ? 1.3 : role.startsWith('headline') ? 1.6 : undefined;
|
|
30
|
+
export function Text({
|
|
31
|
+
variant = 'body-md',
|
|
32
|
+
color = 'on-surface',
|
|
33
|
+
tabular,
|
|
34
|
+
family,
|
|
35
|
+
style,
|
|
36
|
+
...rest
|
|
37
|
+
}) {
|
|
38
|
+
const {
|
|
39
|
+
roles,
|
|
40
|
+
tokens,
|
|
41
|
+
fonts
|
|
42
|
+
} = useTheme();
|
|
43
|
+
const t = tokens.type[variant];
|
|
44
|
+
return /*#__PURE__*/_jsx(RNText, {
|
|
45
|
+
dynamicTypeRamp: RAMP[variant],
|
|
46
|
+
maxFontSizeMultiplier: cap(variant),
|
|
47
|
+
style: [{
|
|
48
|
+
...fontStyle(family ?? t.family, t.weight, fonts),
|
|
49
|
+
fontSize: t.size,
|
|
50
|
+
lineHeight: t.lineHeight,
|
|
51
|
+
letterSpacing: t.letterSpacing,
|
|
52
|
+
color: roles[color]
|
|
53
|
+
}, tabular && {
|
|
54
|
+
fontVariant: ['tabular-nums']
|
|
55
|
+
}, style],
|
|
56
|
+
...rest
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Text announced as a heading. @default variant 'headline-sm' */
|
|
60
|
+
export function Heading({
|
|
61
|
+
variant = 'headline-sm',
|
|
62
|
+
...rest
|
|
63
|
+
}) {
|
|
64
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
65
|
+
accessibilityRole: "header",
|
|
66
|
+
variant: variant,
|
|
67
|
+
...rest
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Text","RNText","fontStyle","useTheme","jsx","_jsx","RAMP","cap","role","startsWith","undefined","variant","color","tabular","family","style","rest","roles","tokens","fonts","t","type","dynamicTypeRamp","maxFontSizeMultiplier","weight","fontSize","size","lineHeight","letterSpacing","fontVariant","Heading","accessibilityRole"],"sourceRoot":"../../../src","sources":["primitives/Text.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,IAAI,IAAIC,MAAM,QAAuC,cAAc;AAE5E,SAASC,SAAS,QAAyB,mBAAgB;AAC3D,SAASC,QAAQ,QAAuB,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIjE;AACA,MAAMC,IAAkC,GAAG;EACzC,YAAY,EAAE,YAAY;EAC1B,YAAY,EAAE,YAAY;EAC1B,YAAY,EAAE,YAAY;EAC1B,aAAa,EAAE,Q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AC5Cd,KAAK,CACL;IAAA,GACEC;EAAI,CACT,CAAC;AAEN;AAIA;AACA,OAAO,SAASc,OAAOA,CAAC;EAAEnB,OAAO,GAAG,aAAa;EAAE,GAAGK;AAAmB,CAAC,EAAE;EAC1E,oBAAOX,IAAA,CAACL,IAAI;IAAC+B,iBAAiB,EAAC,QAAQ;IAACpB,OAAO,EAAEA,OAAQ;IAAA,GAAKK;EAAI,CAAG,CAAC;AACxE","ignoreList":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { AccessibilityInfo, AppState, Platform, StyleSheet, View, useColorScheme } from 'react-native';
|
|
5
|
+
import { native } from '@nexub/tokens/native';
|
|
6
|
+
import { createSeedRoles } from '@nexub/tokens/seed';
|
|
7
|
+
import { defaultMessages, directionOf } from '@nexub/core';
|
|
8
|
+
import { playHaptic } from "./haptics.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const ThemeContext = /*#__PURE__*/React.createContext(null);
|
|
11
|
+
|
|
12
|
+
// AccessibilityInfo reads that fire no change event (contrast): re-read on foreground.
|
|
13
|
+
function useForegroundSetting(read, enabled) {
|
|
14
|
+
const [on, setOn] = React.useState(false);
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!enabled || !read) return;
|
|
17
|
+
const get = () => read().then(setOn, () => setOn(false));
|
|
18
|
+
get();
|
|
19
|
+
const sub = AppState.addEventListener('change', s => s === 'active' && get());
|
|
20
|
+
return () => sub.remove();
|
|
21
|
+
}, [enabled, read]);
|
|
22
|
+
return on;
|
|
23
|
+
}
|
|
24
|
+
function useSetting(read, event) {
|
|
25
|
+
const [on, setOn] = React.useState(false);
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
read().then(setOn, () => setOn(false));
|
|
28
|
+
const sub = AccessibilityInfo.addEventListener(event, setOn);
|
|
29
|
+
return () => sub.remove();
|
|
30
|
+
}, [read, event]);
|
|
31
|
+
return on;
|
|
32
|
+
}
|
|
33
|
+
const a11y = AccessibilityInfo;
|
|
34
|
+
const readHighContrast = Platform.OS === 'ios' ? a11y.isDarkerSystemColorsEnabled?.bind(a11y) : a11y.isHighTextContrastEnabled?.bind(a11y);
|
|
35
|
+
const readReduceMotion = () => AccessibilityInfo.isReduceMotionEnabled();
|
|
36
|
+
const readReduceTransparency = () => Platform.OS === 'ios' ? AccessibilityInfo.isReduceTransparencyEnabled() : Promise.resolve(false);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Theme, accessibility preferences, locale and strings for every
|
|
40
|
+
* @nexub/react-native component. Wrap the app once, inside the safe-area provider.
|
|
41
|
+
*/
|
|
42
|
+
export function NexubNativeProvider({
|
|
43
|
+
scheme: schemeProp = 'system',
|
|
44
|
+
contrast: contrastProp = 'system',
|
|
45
|
+
product,
|
|
46
|
+
seed,
|
|
47
|
+
seedTarget = 'primary',
|
|
48
|
+
glass = 'balanced',
|
|
49
|
+
haptics = true,
|
|
50
|
+
fonts = 'nexub',
|
|
51
|
+
locale = 'en',
|
|
52
|
+
dir,
|
|
53
|
+
messages,
|
|
54
|
+
children
|
|
55
|
+
}) {
|
|
56
|
+
const system = useColorScheme();
|
|
57
|
+
const scheme = schemeProp === 'system' ? system === 'dark' ? 'dark' : 'light' : schemeProp;
|
|
58
|
+
const systemHigh = useForegroundSetting(readHighContrast, contrastProp === 'system');
|
|
59
|
+
const contrast = contrastProp === 'system' ? systemHigh ? 'high' : 'standard' : contrastProp;
|
|
60
|
+
const reducedMotion = useSetting(readReduceMotion, 'reduceMotionChanged');
|
|
61
|
+
const reduceTransparency = useSetting(readReduceTransparency, 'reduceTransparencyChanged');
|
|
62
|
+
const resolvedDir = dir ?? directionOf(locale);
|
|
63
|
+
const theme = React.useMemo(() => {
|
|
64
|
+
const roles = {
|
|
65
|
+
...native.color.roles[contrast][scheme],
|
|
66
|
+
...(product ? native.color.products[product][contrast][scheme] : {}),
|
|
67
|
+
...(seed ? createSeedRoles(seed, {
|
|
68
|
+
contrast,
|
|
69
|
+
target: seedTarget
|
|
70
|
+
})[scheme] : {})
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
scheme,
|
|
74
|
+
contrast,
|
|
75
|
+
product,
|
|
76
|
+
roles,
|
|
77
|
+
tokens: native,
|
|
78
|
+
elevation: level => level ? native.elevation[level][scheme] : undefined,
|
|
79
|
+
glass: reduceTransparency ? 'off' : glass,
|
|
80
|
+
reducedMotion,
|
|
81
|
+
haptics,
|
|
82
|
+
fonts,
|
|
83
|
+
locale,
|
|
84
|
+
dir: resolvedDir,
|
|
85
|
+
messages: {
|
|
86
|
+
...defaultMessages,
|
|
87
|
+
...messages
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}, [scheme, contrast, product, seed, seedTarget, glass, reduceTransparency, reducedMotion, haptics, fonts, locale, resolvedDir, messages]);
|
|
91
|
+
return /*#__PURE__*/_jsx(ThemeContext.Provider, {
|
|
92
|
+
value: theme,
|
|
93
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
94
|
+
style: [styles.root, {
|
|
95
|
+
direction: resolvedDir
|
|
96
|
+
}],
|
|
97
|
+
children: children
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const styles = StyleSheet.create({
|
|
102
|
+
root: {
|
|
103
|
+
flex: 1
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
/** The active theme. Throws outside NexubNativeProvider. */
|
|
108
|
+
export function useTheme() {
|
|
109
|
+
const theme = React.useContext(ThemeContext);
|
|
110
|
+
if (!theme) throw new Error('@nexub/react-native: wrap your app in <NexubNativeProvider>.');
|
|
111
|
+
return theme;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Shorthand for `useTheme().roles`. */
|
|
115
|
+
export const useRoles = () => useTheme().roles;
|
|
116
|
+
|
|
117
|
+
/** The active strings: defaults merged with the provider's overrides. */
|
|
118
|
+
export const useNexubMessages = () => useTheme().messages;
|
|
119
|
+
|
|
120
|
+
/** Plays a semantic haptic, unless the user turned haptics off. */
|
|
121
|
+
export function useHaptics() {
|
|
122
|
+
const {
|
|
123
|
+
haptics
|
|
124
|
+
} = useTheme();
|
|
125
|
+
return React.useCallback(token => haptics && playHaptic(token), [haptics]);
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","AccessibilityInfo","AppState","Platform","StyleSheet","View","useColorScheme","native","createSeedRoles","defaultMessages","directionOf","playHaptic","jsx","_jsx","ThemeContext","createContext","useForegroundSetting","read","enabled","on","setOn","useState","useEffect","get","then","sub","addEventListener","s","remove","useSetting","event","a11y","readHighContrast","OS","isDarkerSystemColorsEnabled","bind","isHighTextContrastEnabled","readReduceMotion","isReduceMotionEnabled","readReduceTransparency","isReduceTransparencyEnabled","Promise","resolve","NexubNativeProvider","scheme","schemeProp","contrast","contrastProp","product","seed","seedTarget","glass","haptics","fonts","locale","dir","messages","children","system","systemHigh","reducedMotion","reduceTransparency","resolvedDir","theme","useMemo","roles","color","products","target","tokens","elevation","level","undefined","Provider","value","style","styles","root","direction","create","flex","useTheme","useContext","Error","useRoles","useNexubMessages","useHaptics","useCallback","token"],"sourceRoot":"../../../src","sources":["theme/ThemeProvider.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,iBAAiB,EACjBC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,IAAI,EACJC,cAAc,QACT,cAAc;AACrB,SAASC,MAAM,QAA0B,sBAAsB;AAC/D,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SACEC,eAAe,EACfC,WAAW,QAMN,aAAa;AACpB,SAASC,UAAU,QAA0B,cAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAsDzD,MAAMC,YAAY,gBAAGd,KAAK,CAACe,aAAa,CAAo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A,CAACR,IAAI;MAACsE,KAAK,EAAE,CAACC,MAAM,CAACC,IAAI,EAAE;QAAEC,SAAS,EAAEhB;MAAY,CAAC,CAAE;MAAAL,QAAA,EAAEA;IAAQ,CAAO;EAAC,CACpD,CAAC;AAE5B;AAEA,MAAMmB,MAAM,GAAGxE,UAAU,CAAC2E,MAAM,CAAC;EAAEF,IAAI,EAAE;IAAEG,IAAI,EAAE;EAAE;AAAE,CAAC,CAAC;;AAEvD;AACA,OAAO,SAASC,QAAQA,CAAA,EAAe;EACrC,MAAMlB,KAAK,GAAG/D,KAAK,CAACkF,UAAU,CAACpE,YAAY,CAAC;EAC5C,IAAI,CAACiD,KAAK,EAAE,MAAM,IAAIoB,KAAK,CAAC,8DAA8D,CAAC;EAC3F,OAAOpB,KAAK;AACd;;AAEA;AACA,OAAO,MAAMqB,QAAQ,GAAGA,CAAA,KAAaH,QAAQ,CAAC,CAAC,CAAChB,KAAK;;AAErD;AACA,OAAO,MAAMoB,gBAAgB,GAAGA,CAAA,KAAqBJ,QAAQ,CAAC,CAAC,CAACzB,QAAQ;;AAExE;AACA,OAAO,SAAS8B,UAAUA,CAAA,EAAiC;EACzD,MAAM;IAAElC;EAAQ,CAAC,GAAG6B,QAAQ,CAAC,CAAC;EAC9B,OAAOjF,KAAK,CAACuF,WAAW,CAAEC,KAAK,IAAKpC,OAAO,IAAIzC,UAAU,CAAC6E,KAAK,CAAC,EAAE,CAACpC,OAAO,CAAC,CAAC;AAC9E","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Nexub faces as static TTFs (OFL) from @expo-google-fonts, one file per weight.
|
|
4
|
+
// Load them once at startup: const [ready] = useFonts(nexubFonts) (expo-font).
|
|
5
|
+
// Per-weight subpaths don't import expo-font, so bare RN apps can load the same
|
|
6
|
+
// files with their own loader.
|
|
7
|
+
import { Inter_400Regular } from '@expo-google-fonts/inter/400Regular';
|
|
8
|
+
import { Inter_500Medium } from '@expo-google-fonts/inter/500Medium';
|
|
9
|
+
import { Inter_600SemiBold } from '@expo-google-fonts/inter/600SemiBold';
|
|
10
|
+
import { Inter_700Bold } from '@expo-google-fonts/inter/700Bold';
|
|
11
|
+
import { PlusJakartaSans_600SemiBold } from '@expo-google-fonts/plus-jakarta-sans/600SemiBold';
|
|
12
|
+
import { PlusJakartaSans_700Bold } from '@expo-google-fonts/plus-jakarta-sans/700Bold';
|
|
13
|
+
import { PlusJakartaSans_800ExtraBold } from '@expo-google-fonts/plus-jakarta-sans/800ExtraBold';
|
|
14
|
+
import { GeistMono_400Regular } from '@expo-google-fonts/geist-mono/400Regular';
|
|
15
|
+
export const nexubFonts = {
|
|
16
|
+
Inter_400Regular,
|
|
17
|
+
Inter_500Medium,
|
|
18
|
+
Inter_600SemiBold,
|
|
19
|
+
Inter_700Bold,
|
|
20
|
+
PlusJakartaSans_600SemiBold,
|
|
21
|
+
PlusJakartaSans_700Bold,
|
|
22
|
+
PlusJakartaSans_800ExtraBold,
|
|
23
|
+
GeistMono_400Regular
|
|
24
|
+
};
|
|
25
|
+
const SANS = {
|
|
26
|
+
400: 'Inter_400Regular',
|
|
27
|
+
500: 'Inter_500Medium',
|
|
28
|
+
600: 'Inter_600SemiBold',
|
|
29
|
+
700: 'Inter_700Bold',
|
|
30
|
+
800: 'Inter_700Bold'
|
|
31
|
+
};
|
|
32
|
+
const DISPLAY = {
|
|
33
|
+
400: 'PlusJakartaSans_600SemiBold',
|
|
34
|
+
500: 'PlusJakartaSans_600SemiBold',
|
|
35
|
+
600: 'PlusJakartaSans_600SemiBold',
|
|
36
|
+
700: 'PlusJakartaSans_700Bold',
|
|
37
|
+
800: 'PlusJakartaSans_800ExtraBold'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Style for a family + weight. With static files the weight lives in the file
|
|
42
|
+
* name, so `fontWeight` is only set for the system font (Android picks the
|
|
43
|
+
* wrong file when both are set).
|
|
44
|
+
*/
|
|
45
|
+
export function fontStyle(family, weight, source) {
|
|
46
|
+
if (source === 'system') return {
|
|
47
|
+
fontWeight: String(weight)
|
|
48
|
+
};
|
|
49
|
+
if (family === 'mono') return {
|
|
50
|
+
fontFamily: 'GeistMono_400Regular'
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
fontFamily: (family === 'display' ? DISPLAY : SANS)[weight] ?? SANS[400]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Inter_400Regular","Inter_500Medium","Inter_600SemiBold","Inter_700Bold","PlusJakartaSans_600SemiBold","PlusJakartaSans_700Bold","PlusJakartaSans_800ExtraBold","GeistMono_400Regular","nexubFonts","SANS","DISPLAY","fontStyle","family","weight","source","fontWeight","String","fontFamily"],"sourceRoot":"../../../src","sources":["theme/fonts.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,eAAe,QAAQ,oCAAoC;AACpE,SAASC,iBAAiB,QAAQ,sCAAsC;AACxE,SAASC,aAAa,QAAQ,kCAAkC;AAChE,SAASC,2BAA2B,QAAQ,kDAAkD;AAC9F,SAASC,uBAAuB,QAAQ,8CAA8C;AACtF,SAASC,4BAA4B,QAAQ,mDAAmD;AAChG,SAASC,oBAAoB,QAAQ,0CAA0C;AAE/E,OAAO,MAAMC,UAAU,GAAG;EACxBR,gBAAgB;EAChBC,eAAe;EACfC,iBAAiB;EACjBC,aAAa;EACbC,2BAA2B;EAC3BC,uBAAuB;EACvBC,4BAA4B;EAC5BC;AACF,CAAC;AAKD,MAAME,IAA4B,GAAG;EACnC,GAAG,EAAE,kBAAkB;EACvB,GAAG,EAAE,iBAAiB;EACtB,GAAG,EAAE,mBAAmB;EACxB,GAAG,EAAE,eAAe;EACpB,GAAG,EAAE;AACP,CAAC;AACD,MAAMC,OAA+B,GAAG;EACtC,GAAG,EAAE,6BAA6B;EAClC,GAAG,EAAE,6BAA6B;EAClC,GAAG,EAAE,6BAA6B;EAClC,GAAG,EAAE,yBAAyB;EAC9B,GAAG,EAAE;AACP,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,MAAkB,EAAEC,MAAc,EAAEC,MAAkB,EAAE;EAChF,IAAIA,MAAM,KAAK,QAAQ,EAAE,OAAO;IAAEC,UAAU,EAAEC,MAAM,CAACH,MAAM;EAAW,CAAC;EACvE,IAAID,MAAM,KAAK,MAAM,EAAE,OAAO;IAAEK,UAAU,EAAE;EAAuB,CAAC;EACpE,OAAO;IAAEA,UAAU,EAAE,CAACL,MAAM,KAAK,SAAS,GAAGF,OAAO,GAAGD,IAAI,EAAEI,MAAM,CAAC,IAAIJ,IAAI,CAAC,GAAG;EAAE,CAAC;AACrF","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// Semantic haptics (MOBILE_PLAN.md §4.4). Apple's rule: never on plain taps,
|
|
6
|
+
// never the only feedback. Android uses the platform constants, not the
|
|
7
|
+
// vibrator-based impact API.
|
|
8
|
+
|
|
9
|
+
// Optional peer: without expo-haptics every haptic is a no-op.
|
|
10
|
+
let H;
|
|
11
|
+
try {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- optional peer, must not fail when absent
|
|
13
|
+
H = require('expo-haptics');
|
|
14
|
+
} catch {
|
|
15
|
+
H = undefined;
|
|
16
|
+
}
|
|
17
|
+
const ANDROID = {
|
|
18
|
+
selection: 'Segment_Tick',
|
|
19
|
+
toggleOn: 'Toggle_On',
|
|
20
|
+
toggleOff: 'Toggle_Off',
|
|
21
|
+
confirm: 'Confirm',
|
|
22
|
+
reject: 'Reject',
|
|
23
|
+
warning: 'Reject',
|
|
24
|
+
snap: 'Gesture_End'
|
|
25
|
+
};
|
|
26
|
+
export function playHaptic(token) {
|
|
27
|
+
if (!H) return;
|
|
28
|
+
const done = () => {};
|
|
29
|
+
if (Platform.OS === 'android') {
|
|
30
|
+
H.performAndroidHapticsAsync(H.AndroidHaptics[ANDROID[token]]).catch(done);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (Platform.OS !== 'ios') return;
|
|
34
|
+
switch (token) {
|
|
35
|
+
case 'selection':
|
|
36
|
+
H.selectionAsync().catch(done);
|
|
37
|
+
break;
|
|
38
|
+
case 'toggleOn':
|
|
39
|
+
case 'toggleOff':
|
|
40
|
+
H.impactAsync(H.ImpactFeedbackStyle.Light).catch(done);
|
|
41
|
+
break;
|
|
42
|
+
case 'snap':
|
|
43
|
+
H.impactAsync(H.ImpactFeedbackStyle.Medium).catch(done);
|
|
44
|
+
break;
|
|
45
|
+
case 'confirm':
|
|
46
|
+
H.notificationAsync(H.NotificationFeedbackType.Success).catch(done);
|
|
47
|
+
break;
|
|
48
|
+
case 'reject':
|
|
49
|
+
H.notificationAsync(H.NotificationFeedbackType.Error).catch(done);
|
|
50
|
+
break;
|
|
51
|
+
case 'warning':
|
|
52
|
+
H.notificationAsync(H.NotificationFeedbackType.Warning).catch(done);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=haptics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","H","require","undefined","ANDROID","selection","toggleOn","toggleOff","confirm","reject","warning","snap","playHaptic","token","done","OS","performAndroidHapticsAsync","AndroidHaptics","catch","selectionAsync","impactAsync","ImpactFeedbackStyle","Light","Medium","notificationAsync","NotificationFeedbackType","Success","Error","Warning"],"sourceRoot":"../../../src","sources":["theme/haptics.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AACA;;AAIA;AACA,IAAIC,CAA4C;AAChD,IAAI;EACF;EACAA,CAAC,GAAGC,OAAO,CAAC,c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,KAAK,CAAC,CAACT,KAAK,CAACJ,IAAI,CAAC;MACjE;IACF,KAAK,SAAS;MACZb,CAAC,CAACuB,iBAAiB,CAACvB,CAAC,CAACwB,wBAAwB,CAACG,OAAO,CAAC,CAACV,KAAK,CAACJ,IAAI,CAAC;MACnE;EACJ;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Native chrome, Nexub colours: options for the system navigation (native
|
|
4
|
+
// stack header, tabs, React Navigation theme). We theme it; we never redraw it.
|
|
5
|
+
import { fontStyle } from "./fonts.js";
|
|
6
|
+
import { useTheme } from "./ThemeProvider.js";
|
|
7
|
+
|
|
8
|
+
/** Native stack `screenOptions`: large titles on a surface-coloured native header, Nexub type and tint. */
|
|
9
|
+
export function nexubStackOptions(theme) {
|
|
10
|
+
const {
|
|
11
|
+
roles,
|
|
12
|
+
fonts
|
|
13
|
+
} = theme;
|
|
14
|
+
return {
|
|
15
|
+
headerLargeTitle: true,
|
|
16
|
+
// Opaque: a transparent header hid the expanded large title (iOS 26); the
|
|
17
|
+
// system still draws its scroll-edge effect on an opaque native header.
|
|
18
|
+
headerTransparent: false,
|
|
19
|
+
headerShadowVisible: false,
|
|
20
|
+
headerLargeTitleShadowVisible: false,
|
|
21
|
+
headerTintColor: roles.primary,
|
|
22
|
+
headerStyle: {
|
|
23
|
+
backgroundColor: roles.surface
|
|
24
|
+
},
|
|
25
|
+
headerTitleStyle: {
|
|
26
|
+
color: roles['on-surface'],
|
|
27
|
+
...fontStyle('sans', 600, fonts)
|
|
28
|
+
},
|
|
29
|
+
headerLargeTitleStyle: {
|
|
30
|
+
color: roles['on-surface'],
|
|
31
|
+
...fontStyle('display', 700, fonts)
|
|
32
|
+
},
|
|
33
|
+
contentStyle: {
|
|
34
|
+
backgroundColor: roles.surface
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** React Navigation `theme` (also Expo Router's ThemeProvider). */
|
|
40
|
+
export function nexubNavigationTheme(theme) {
|
|
41
|
+
const {
|
|
42
|
+
roles,
|
|
43
|
+
fonts,
|
|
44
|
+
scheme
|
|
45
|
+
} = theme;
|
|
46
|
+
const font = weight => {
|
|
47
|
+
const f = fontStyle('sans', weight, fonts);
|
|
48
|
+
return {
|
|
49
|
+
fontFamily: 'fontFamily' in f ? f.fontFamily : 'System',
|
|
50
|
+
fontWeight: String(weight)
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
dark: scheme === 'dark',
|
|
55
|
+
colors: {
|
|
56
|
+
primary: roles.primary,
|
|
57
|
+
background: roles.surface,
|
|
58
|
+
card: roles['surface-container'],
|
|
59
|
+
text: roles['on-surface'],
|
|
60
|
+
border: roles['outline-variant'],
|
|
61
|
+
notification: roles.error
|
|
62
|
+
},
|
|
63
|
+
fonts: {
|
|
64
|
+
regular: font(400),
|
|
65
|
+
medium: font(500),
|
|
66
|
+
bold: font(600),
|
|
67
|
+
heavy: font(700)
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Colours for native tab bars (Expo Router NativeTabs / react-native-bottom-tabs). */
|
|
73
|
+
export function nexubTabsOptions(theme) {
|
|
74
|
+
const {
|
|
75
|
+
roles,
|
|
76
|
+
fonts
|
|
77
|
+
} = theme;
|
|
78
|
+
return {
|
|
79
|
+
tintColor: roles.primary,
|
|
80
|
+
inactiveTintColor: roles['on-surface-variant'],
|
|
81
|
+
backgroundColor: roles['surface-container'],
|
|
82
|
+
badgeBackgroundColor: roles.error,
|
|
83
|
+
labelStyle: {
|
|
84
|
+
...fontStyle('sans', 500, fonts),
|
|
85
|
+
fontSize: 11
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** All three for the current theme: `const nav = useNexubNavigation()`. */
|
|
91
|
+
export function useNexubNavigation() {
|
|
92
|
+
const theme = useTheme();
|
|
93
|
+
return {
|
|
94
|
+
stack: nexubStackOptions(theme),
|
|
95
|
+
theme: nexubNavigationTheme(theme),
|
|
96
|
+
tabs: nexubTabsOptions(theme)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fontStyle","useTheme","nexubStackOptions","theme","roles","fonts","headerLargeTitle","headerTransparent","headerShadowVisible","headerLargeTitleShadowVisible","headerTintColor","primary","headerStyle","backgroundColor","surface","headerTitleStyle","color","headerLargeTitleStyle","contentStyle","nexubNavigationTheme","scheme","font","weight","f","fontFamily","fontWeight","String","dark","colors","background","card","text","border","notification","error","regular","medium","bold","heavy","nexubTabsOptions","tintColor","inactiveTintColor","badgeBackgroundColor","labelStyle","fontSize","useNexubNavigation","stack","tabs"],"sourceRoot":"../../../src","sources":["theme/navigation.ts"],"mappings":";;AAAA;AACA;AACA,SAASA,SAAS,QAAQ,YAAS;AACnC,SAASC,QAAQ,QAAyB,oBAAiB;;AAE3D;AACA,OAAO,SAASC,iBAAiBA,CAACC,KAAiB,EAAE;EACnD,MAAM;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGF,KAAK;EAC9B,OAAO;IACLG,gBAAgB,EAAE,IAAI;IACtB;IACA;IACAC,iBAAiB,EAAE,KAAK;IACxBC,mBAAmB,EAAE,KAAK;IAC1BC,6BAA6B,EAAE,KAAK;IACpCC,eAAe,EAAEN,KAAK,CAACO,OAAO;IAC9BC,WAAW,EAAE;MAAEC,eAAe,EAAET,KAAK,CAACU;IAAQ,CAAC;IAC/CC,gBAAgB,EAAE;MAAEC,KAAK,EAAEZ,KAAK,CAAC,YAAY,CAAC;MAAE,GAAGJ,SAAS,CAAC,MAAM,EAAE,GAAG,EAAEK,KAAK;IAAE,CAAC;IAClFY,qBAAqB,EAAE;MAAED,KAAK,EAAEZ,KAAK,CAAC,YAAY,CAAC;MAAE,GAAGJ,SAAS,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AAEpC,KAAK,CAACO,OAAO;IACxB8B,iBAAiB,EAAErC,KAAK,CAAC,oBAAoB,CAAC;IAC9CS,eAAe,EAAET,KAAK,CAAC,mBAAmB,CAAC;IAC3CsC,oBAAoB,EAAEtC,KAAK,CAAC8B,KAAK;IACjCS,UAAU,EAAE;MAAE,GAAG3C,SAAS,CAAC,MAAM,EAAE,GAAG,EAAEK,KAAK,CAAC;MAAEuC,QAAQ,EAAE;IAAG;EAC/D,CAAC;AACH;;AAEA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACnC,MAAM1C,KAAK,GAAGF,QAAQ,CAAC,CAAC;EACxB,OAAO;IACL6C,KAAK,EAAE5C,iBAAiB,CAACC,KAAK,CAAC;IAC/BA,KAAK,EAAEgB,oBAAoB,CAAChB,KAAK,CAAC;IAClC4C,IAAI,EAAER,gBAAgB,CAACpC,KAAK;EAC9B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { ControlSize, ToneValue } from '@nexub/core';
|
|
4
|
+
import type { NativeIconProps } from '@nexub/icons/native';
|
|
5
|
+
import { type PressableProps } from '../primitives/Pressable.js';
|
|
6
|
+
import type { HapticToken } from '../theme/haptics.js';
|
|
7
|
+
export type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'text' | 'glass';
|
|
8
|
+
export interface ButtonProps extends Omit<PressableProps, 'children'> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/** @default 'filled' */
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
/** Solid semantic or product colour (overrides the variant colour). */
|
|
13
|
+
tone?: ToneValue;
|
|
14
|
+
/** The control ladder. Primary actions on mobile use 'lg' (48). @default 'md' */
|
|
15
|
+
size?: ControlSize;
|
|
16
|
+
/** Shows a spinner, blocks presses and announces `loadingLabel`. */
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
loadingLabel?: string;
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
leadingIcon?: React.ComponentType<NativeIconProps>;
|
|
21
|
+
trailingIcon?: React.ComponentType<NativeIconProps>;
|
|
22
|
+
}
|
|
23
|
+
/** Capsule button. One `filled` (or toned) action per screen; the rest tonal/outlined/text. */
|
|
24
|
+
export declare function Button({ children, variant, tone, size, loading, loadingLabel, fullWidth, leadingIcon: Leading, trailingIcon: Trailing, disabled, style, accessibilityLabel, ...rest }: ButtonProps): React.JSX.Element;
|
|
25
|
+
export interface IconButtonProps extends Omit<PressableProps, 'children'> {
|
|
26
|
+
icon: React.ComponentType<NativeIconProps>;
|
|
27
|
+
/** Required: the accessible name (what it does, not "button"). */
|
|
28
|
+
label: string;
|
|
29
|
+
/** @default 'text' */
|
|
30
|
+
variant?: ButtonVariant;
|
|
31
|
+
tone?: ToneValue;
|
|
32
|
+
/** @default 'md' */
|
|
33
|
+
size?: ControlSize;
|
|
34
|
+
/** Toggle state for icon toggles (favourite, mute). */
|
|
35
|
+
selected?: boolean;
|
|
36
|
+
haptic?: HapticToken;
|
|
37
|
+
}
|
|
38
|
+
/** Circular icon-only button; always 44pt+ to touch. */
|
|
39
|
+
export declare function IconButton({ icon: Glyph, label, variant, tone, size, selected, disabled, style, ...rest }: IconButtonProps): React.JSX.Element;
|
|
40
|
+
export interface ButtonGroupProps {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
/** 'stack' puts actions full-width in a column (bottom of forms). @default 'row' */
|
|
43
|
+
direction?: 'row' | 'stack';
|
|
44
|
+
style?: StyleProp<ViewStyle>;
|
|
45
|
+
}
|
|
46
|
+
/** Related actions together. In a stack, put the primary action first. */
|
|
47
|
+
export declare function ButtonGroup({ children, direction, style }: ButtonGroupProps): React.JSX.Element;
|
|
48
|
+
export interface LinkProps extends Omit<PressableProps, 'children'> {
|
|
49
|
+
children: string;
|
|
50
|
+
}
|
|
51
|
+
/** Inline text action. Opens nothing by itself: pass `onPress` (e.g. router.push / Linking.openURL). */
|
|
52
|
+
export declare function Link({ children, style, ...rest }: LinkProps): React.JSX.Element;
|
|
53
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/components/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,4BAAyB,CAAC;AAIzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAkB,CAAC;AAGpD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AA2B/E,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC;IACnE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,wBAAwB;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,uEAAuE;IACvE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,iFAAiF;IACjF,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;CACrD;AAED,+FAA+F;AAC/F,wBAAgB,MAAM,CAAC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