@retray-dev/ui-kit 6.2.0 → 7.0.1
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/COMPONENTS.md +444 -10
- package/EXAMPLES.md +248 -0
- package/README.md +11 -10
- package/dist/Accordion.d.mts +28 -0
- package/dist/Accordion.d.ts +28 -0
- package/dist/Accordion.js +340 -0
- package/dist/Accordion.mjs +6 -0
- package/dist/AlertBanner.d.mts +16 -0
- package/dist/AlertBanner.d.ts +16 -0
- package/dist/AlertBanner.js +247 -0
- package/dist/AlertBanner.mjs +5 -0
- package/dist/Avatar.d.mts +20 -0
- package/dist/Avatar.d.ts +20 -0
- package/dist/Avatar.js +234 -0
- package/dist/Avatar.mjs +3 -0
- package/dist/Badge.d.mts +26 -0
- package/dist/Badge.d.ts +26 -0
- package/dist/Badge.js +247 -0
- package/dist/Badge.mjs +4 -0
- package/dist/Button.d.mts +25 -0
- package/dist/Button.d.ts +25 -0
- package/dist/Button.js +414 -0
- package/dist/Button.mjs +8 -0
- package/dist/ButtonGroup.d.mts +26 -0
- package/dist/ButtonGroup.d.ts +26 -0
- package/dist/ButtonGroup.js +52 -0
- package/dist/ButtonGroup.mjs +2 -0
- package/dist/Card.d.mts +39 -0
- package/dist/Card.d.ts +39 -0
- package/dist/Card.js +329 -0
- package/dist/Card.mjs +7 -0
- package/dist/CategoryStrip.d.mts +26 -0
- package/dist/CategoryStrip.d.ts +26 -0
- package/dist/CategoryStrip.js +396 -0
- package/dist/CategoryStrip.mjs +9 -0
- package/dist/Checkbox.d.mts +14 -0
- package/dist/Checkbox.d.ts +14 -0
- package/dist/Checkbox.js +304 -0
- package/dist/Checkbox.mjs +7 -0
- package/dist/Chip.d.mts +31 -0
- package/dist/Chip.d.ts +31 -0
- package/dist/Chip.js +370 -0
- package/dist/Chip.mjs +8 -0
- package/dist/ConfirmDialog.d.mts +15 -0
- package/dist/ConfirmDialog.d.ts +15 -0
- package/dist/ConfirmDialog.js +530 -0
- package/dist/ConfirmDialog.mjs +9 -0
- package/dist/CurrencyDisplay.d.mts +24 -0
- package/dist/CurrencyDisplay.d.ts +24 -0
- package/dist/CurrencyDisplay.js +189 -0
- package/dist/CurrencyDisplay.mjs +3 -0
- package/dist/CurrencyInput.d.mts +26 -0
- package/dist/CurrencyInput.d.ts +26 -0
- package/dist/CurrencyInput.js +404 -0
- package/dist/CurrencyInput.mjs +7 -0
- package/dist/DetailRow.d.mts +32 -0
- package/dist/DetailRow.d.ts +32 -0
- package/dist/DetailRow.js +275 -0
- package/dist/DetailRow.mjs +4 -0
- package/dist/EmptyState.d.mts +27 -0
- package/dist/EmptyState.d.ts +27 -0
- package/dist/EmptyState.js +503 -0
- package/dist/EmptyState.mjs +9 -0
- package/dist/Form.d.mts +52 -0
- package/dist/Form.d.ts +52 -0
- package/dist/Form.js +204 -0
- package/dist/Form.mjs +3 -0
- package/dist/IconButton.d.mts +22 -0
- package/dist/IconButton.d.ts +22 -0
- package/dist/IconButton.js +383 -0
- package/dist/IconButton.mjs +7 -0
- package/dist/Input.d.mts +23 -0
- package/dist/Input.d.ts +23 -0
- package/dist/Input.js +351 -0
- package/dist/Input.mjs +6 -0
- package/dist/LabelValue.d.mts +16 -0
- package/dist/LabelValue.d.ts +16 -0
- package/dist/LabelValue.js +225 -0
- package/dist/LabelValue.mjs +4 -0
- package/dist/ListGroup.d.mts +34 -0
- package/dist/ListGroup.d.ts +34 -0
- package/dist/ListGroup.js +217 -0
- package/dist/ListGroup.mjs +4 -0
- package/dist/ListItem.d.mts +64 -0
- package/dist/ListItem.d.ts +64 -0
- package/dist/ListItem.js +430 -0
- package/dist/ListItem.mjs +8 -0
- package/dist/MediaCard.d.mts +39 -0
- package/dist/MediaCard.d.ts +39 -0
- package/dist/MediaCard.js +427 -0
- package/dist/MediaCard.mjs +8 -0
- package/dist/MenuGroup.d.mts +34 -0
- package/dist/MenuGroup.d.ts +34 -0
- package/dist/MenuGroup.js +217 -0
- package/dist/MenuGroup.mjs +4 -0
- package/dist/MenuItem.d.mts +48 -0
- package/dist/MenuItem.d.ts +48 -0
- package/dist/MenuItem.js +403 -0
- package/dist/MenuItem.mjs +8 -0
- package/dist/MonthPicker.d.mts +20 -0
- package/dist/MonthPicker.d.ts +20 -0
- package/dist/MonthPicker.js +234 -0
- package/dist/MonthPicker.mjs +4 -0
- package/dist/Pressable.d.mts +34 -0
- package/dist/Pressable.d.ts +34 -0
- package/dist/Pressable.js +132 -0
- package/dist/Pressable.mjs +4 -0
- package/dist/Progress.d.mts +14 -0
- package/dist/Progress.d.ts +14 -0
- package/dist/Progress.js +191 -0
- package/dist/Progress.mjs +4 -0
- package/dist/RadioGroup.d.mts +19 -0
- package/dist/RadioGroup.d.ts +19 -0
- package/dist/RadioGroup.js +341 -0
- package/dist/RadioGroup.mjs +7 -0
- package/dist/Select.d.mts +22 -0
- package/dist/Select.d.ts +22 -0
- package/dist/Select.js +441 -0
- package/dist/Select.mjs +6 -0
- package/dist/Separator.d.mts +10 -0
- package/dist/Separator.d.ts +10 -0
- package/dist/Separator.js +156 -0
- package/dist/Separator.mjs +2 -0
- package/dist/Sheet.d.mts +81 -0
- package/dist/Sheet.d.ts +81 -0
- package/dist/Sheet.js +340 -0
- package/dist/Sheet.mjs +4 -0
- package/dist/Skeleton.d.mts +17 -0
- package/dist/Skeleton.d.ts +17 -0
- package/dist/Skeleton.js +205 -0
- package/dist/Skeleton.mjs +4 -0
- package/dist/Slider.d.mts +20 -0
- package/dist/Slider.d.ts +20 -0
- package/dist/Slider.js +232 -0
- package/dist/Slider.mjs +4 -0
- package/dist/Spinner.d.mts +12 -0
- package/dist/Spinner.d.ts +12 -0
- package/dist/Spinner.js +172 -0
- package/dist/Spinner.mjs +3 -0
- package/dist/Switch.d.mts +13 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.js +261 -0
- package/dist/Switch.mjs +5 -0
- package/dist/Tabs.d.mts +27 -0
- package/dist/Tabs.d.ts +27 -0
- package/dist/Tabs.js +389 -0
- package/dist/Tabs.mjs +6 -0
- package/dist/Text.d.mts +12 -0
- package/dist/Text.d.ts +12 -0
- package/dist/Text.js +311 -0
- package/dist/Text.mjs +4 -0
- package/dist/Textarea.d.mts +16 -0
- package/dist/Textarea.d.ts +16 -0
- package/dist/Textarea.js +333 -0
- package/dist/Textarea.mjs +6 -0
- package/dist/Toast.d.mts +47 -0
- package/dist/Toast.d.ts +47 -0
- package/dist/Toast.js +185 -0
- package/dist/Toast.mjs +3 -0
- package/dist/Toggle.d.mts +33 -0
- package/dist/Toggle.d.ts +33 -0
- package/dist/Toggle.js +397 -0
- package/dist/Toggle.mjs +8 -0
- package/dist/VirtualList.d.mts +19 -0
- package/dist/VirtualList.d.ts +19 -0
- package/dist/VirtualList.js +38 -0
- package/dist/VirtualList.mjs +1 -0
- package/dist/chunk-2CE3TQVY.mjs +11 -0
- package/dist/chunk-2UYENBLV.mjs +49 -0
- package/dist/chunk-3BBOZ3OQ.mjs +41 -0
- package/dist/chunk-5IKW3VNC.mjs +43 -0
- package/dist/chunk-63357L2X.mjs +51 -0
- package/dist/chunk-6LQYY7HC.mjs +127 -0
- package/dist/chunk-6Q64UFIA.mjs +71 -0
- package/dist/chunk-76PFOSM2.mjs +41 -0
- package/dist/chunk-7H2OR44A.mjs +14 -0
- package/dist/chunk-A4MDAP7G.mjs +42 -0
- package/dist/chunk-AU2VDY4P.mjs +190 -0
- package/dist/chunk-BRKYVJVV.mjs +60 -0
- package/dist/chunk-CRYBX2CM.mjs +146 -0
- package/dist/chunk-DITNP6PL.mjs +106 -0
- package/dist/chunk-FTLJOUOQ.mjs +97 -0
- package/dist/chunk-GCWOGZYL.mjs +104 -0
- package/dist/chunk-GNGLDL6Z.mjs +60 -0
- package/dist/chunk-GPOUINK5.mjs +148 -0
- package/dist/chunk-HSPSMN6U.mjs +115 -0
- package/dist/chunk-IRRY3CRZ.mjs +82 -0
- package/dist/chunk-JB67UOB5.mjs +92 -0
- package/dist/chunk-JBLL7U3U.mjs +64 -0
- package/dist/chunk-KWCPOM6W.mjs +136 -0
- package/dist/chunk-KZJRQOIU.mjs +64 -0
- package/dist/chunk-L7E7TVEZ.mjs +145 -0
- package/dist/chunk-LG4DO3DK.mjs +174 -0
- package/dist/chunk-LWG526VX.mjs +139 -0
- package/dist/chunk-MN7OG7IY.mjs +96 -0
- package/dist/chunk-MX6HRKMI.mjs +29 -0
- package/dist/chunk-NC5ZTR2Y.mjs +32 -0
- package/dist/chunk-NQGVLMWG.mjs +90 -0
- package/dist/chunk-QCNARS3X.mjs +46 -0
- package/dist/chunk-QXGYKWI7.mjs +134 -0
- package/dist/chunk-QY3X2UYR.mjs +191 -0
- package/dist/chunk-RKLHUDZS.mjs +92 -0
- package/dist/chunk-RMMK64W5.mjs +54 -0
- package/dist/chunk-RR2VQLKE.mjs +190 -0
- package/dist/chunk-RTC3CFXF.mjs +29 -0
- package/dist/chunk-SBZYEV4S.mjs +61 -0
- package/dist/chunk-SOA2Z4RB.mjs +82 -0
- package/dist/chunk-SOYNZDVY.mjs +151 -0
- package/dist/chunk-T7XZ7H7Y.mjs +57 -0
- package/dist/chunk-TAJ2PQ2O.mjs +163 -0
- package/dist/chunk-U4N7WF4Z.mjs +108 -0
- package/dist/chunk-URDE3EUU.mjs +132 -0
- package/dist/chunk-URLL5JBR.mjs +245 -0
- package/dist/chunk-XDMN67KV.mjs +59 -0
- package/dist/chunk-Y6MXOREN.mjs +120 -0
- package/dist/chunk-YZJAFS4P.mjs +131 -0
- package/dist/index.d.mts +94 -873
- package/dist/index.d.ts +94 -873
- package/dist/index.js +751 -357
- package/dist/index.mjs +50 -3895
- package/package.json +23 -14
- package/src/assets/fonts/Sohne-Bold.otf +0 -0
- package/src/assets/fonts/Sohne-BoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBold.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLight.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Italic.otf +0 -0
- package/src/assets/fonts/Sohne-Light.otf +0 -0
- package/src/assets/fonts/Sohne-LightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Medium.otf +0 -0
- package/src/assets/fonts/Sohne-MediumItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Regular.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBold.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Bold.otf +0 -0
- package/src/assets/fonts/SohneMono-BoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBold.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLight.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Italic.otf +0 -0
- package/src/assets/fonts/SohneMono-Light.otf +0 -0
- package/src/assets/fonts/SohneMono-LightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Medium.otf +0 -0
- package/src/assets/fonts/SohneMono-MediumItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Regular.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBold.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBoldItalic.otf +0 -0
- package/src/components/Accordion/Accordion.tsx +3 -3
- package/src/components/AlertBanner/AlertBanner.tsx +33 -12
- package/src/components/Avatar/Avatar.tsx +4 -2
- package/src/components/Badge/Badge.tsx +4 -2
- package/src/components/Button/Button.tsx +10 -11
- package/src/components/ButtonGroup/ButtonGroup.tsx +13 -10
- package/src/components/Card/Card.tsx +17 -34
- package/src/components/CategoryStrip/CategoryStrip.tsx +24 -21
- package/src/components/Checkbox/Checkbox.tsx +11 -6
- package/src/components/Chip/Chip.tsx +17 -15
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +2 -2
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +4 -2
- package/src/components/CurrencyInput/CurrencyInput.tsx +2 -2
- package/src/components/DetailRow/DetailRow.tsx +9 -7
- package/src/components/EmptyState/EmptyState.tsx +2 -2
- package/src/components/Form/Form.tsx +149 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +4 -2
- package/src/components/Input/Input.tsx +27 -31
- package/src/components/LabelValue/LabelValue.tsx +6 -4
- package/src/components/ListGroup/ListGroup.tsx +145 -0
- package/src/components/ListGroup/index.ts +1 -0
- package/src/components/ListItem/ListItem.tsx +9 -10
- package/src/components/MediaCard/MediaCard.tsx +7 -5
- package/src/components/MenuGroup/MenuGroup.tsx +145 -0
- package/src/components/MenuGroup/index.ts +1 -0
- package/src/components/MenuItem/MenuItem.tsx +7 -9
- package/src/components/MonthPicker/MonthPicker.tsx +2 -2
- package/src/components/RadioGroup/RadioGroup.tsx +11 -14
- package/src/components/Select/Select.tsx +6 -6
- package/src/components/Separator/Separator.tsx +1 -3
- package/src/components/Sheet/Sheet.tsx +81 -17
- package/src/components/Skeleton/Skeleton.tsx +1 -1
- package/src/components/Slider/Slider.tsx +2 -2
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Switch/Switch.tsx +28 -5
- package/src/components/Tabs/Tabs.tsx +22 -18
- package/src/components/Text/Text.tsx +3 -1
- package/src/components/Textarea/Textarea.tsx +18 -14
- package/src/components/Toast/Toast.tsx +6 -6
- package/src/components/Toggle/Toggle.tsx +47 -23
- package/src/components/VirtualList/VirtualList.tsx +60 -0
- package/src/components/VirtualList/index.ts +1 -0
- package/src/fonts.ts +38 -20
- package/src/index.ts +5 -1
- package/src/theme/colors.ts +53 -39
- package/src/theme/types.ts +3 -0
- package/src/tokens.ts +49 -39
- package/src/utils/icons.ts +47 -20
- package/src/utils/usePressScale.ts +2 -0
- package/src/assets/fonts/Poppins-Black.ttf +0 -0
- package/src/assets/fonts/Poppins-BlackItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/src/assets/fonts/Poppins-BoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLight.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Italic.ttf +0 -0
- package/src/assets/fonts/Poppins-Light.ttf +0 -0
- package/src/assets/fonts/Poppins-LightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Medium.ttf +0 -0
- package/src/assets/fonts/Poppins-MediumItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Regular.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Thin.ttf +0 -0
- package/src/assets/fonts/Poppins-ThinItalic.ttf +0 -0
package/dist/Tabs.js
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React2 = require('react');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
|
+
var Animated = require('react-native-reanimated');
|
|
6
|
+
var reactNativeSizeMatters = require('react-native-size-matters');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var React2__default = /*#__PURE__*/_interopDefault(React2);
|
|
11
|
+
var Animated__default = /*#__PURE__*/_interopDefault(Animated);
|
|
12
|
+
|
|
13
|
+
// src/components/Tabs/Tabs.tsx
|
|
14
|
+
var _haptics = null;
|
|
15
|
+
async function getHaptics() {
|
|
16
|
+
if (reactNative.Platform.OS === "web") return null;
|
|
17
|
+
if (!_haptics) {
|
|
18
|
+
_haptics = await import('expo-haptics');
|
|
19
|
+
}
|
|
20
|
+
return _haptics;
|
|
21
|
+
}
|
|
22
|
+
function selectionAsync() {
|
|
23
|
+
if (reactNative.Platform.OS === "web") return;
|
|
24
|
+
getHaptics().then((h) => h?.selectionAsync());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/theme/colorUtils.ts
|
|
28
|
+
function hexToRgb(hex) {
|
|
29
|
+
const clean = hex.replace("#", "");
|
|
30
|
+
const full = clean.length === 3 ? clean.split("").map((c) => c + c).join("") : clean;
|
|
31
|
+
if (full.length !== 6) return null;
|
|
32
|
+
return {
|
|
33
|
+
r: parseInt(full.slice(0, 2), 16),
|
|
34
|
+
g: parseInt(full.slice(2, 4), 16),
|
|
35
|
+
b: parseInt(full.slice(4, 6), 16)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function componentToHex(c) {
|
|
39
|
+
return Math.round(Math.max(0, Math.min(255, c))).toString(16).padStart(2, "0");
|
|
40
|
+
}
|
|
41
|
+
function rgbToHex(r, g, b) {
|
|
42
|
+
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
|
|
43
|
+
}
|
|
44
|
+
function withAlphaOnWhite(hex, alpha) {
|
|
45
|
+
const rgb = hexToRgb(hex);
|
|
46
|
+
if (!rgb) return hex;
|
|
47
|
+
const r = rgb.r * alpha + 255 * (1 - alpha);
|
|
48
|
+
const g = rgb.g * alpha + 255 * (1 - alpha);
|
|
49
|
+
const b = rgb.b * alpha + 255 * (1 - alpha);
|
|
50
|
+
return rgbToHex(r, g, b);
|
|
51
|
+
}
|
|
52
|
+
function withAlphaOnDark(hex, alpha, bgHex = "#0f0f0f") {
|
|
53
|
+
const rgb = hexToRgb(hex);
|
|
54
|
+
const bg = hexToRgb(bgHex);
|
|
55
|
+
if (!rgb || !bg) return hex;
|
|
56
|
+
const r = rgb.r * alpha + bg.r * (1 - alpha);
|
|
57
|
+
const g = rgb.g * alpha + bg.g * (1 - alpha);
|
|
58
|
+
const b = rgb.b * alpha + bg.b * (1 - alpha);
|
|
59
|
+
return rgbToHex(r, g, b);
|
|
60
|
+
}
|
|
61
|
+
function mixWithBackground(fgHex, bgHex, opacity) {
|
|
62
|
+
const fg = hexToRgb(fgHex);
|
|
63
|
+
const bg = hexToRgb(bgHex);
|
|
64
|
+
if (!fg || !bg) return fgHex;
|
|
65
|
+
const r = fg.r * opacity + bg.r * (1 - opacity);
|
|
66
|
+
const g = fg.g * opacity + bg.g * (1 - opacity);
|
|
67
|
+
const b = fg.b * opacity + bg.b * (1 - opacity);
|
|
68
|
+
return rgbToHex(r, g, b);
|
|
69
|
+
}
|
|
70
|
+
function lighten(hex, amount) {
|
|
71
|
+
return withAlphaOnWhite(hex, 1 - amount);
|
|
72
|
+
}
|
|
73
|
+
function darken(hex, amount) {
|
|
74
|
+
const rgb = hexToRgb(hex);
|
|
75
|
+
if (!rgb) return hex;
|
|
76
|
+
return rgbToHex(rgb.r * (1 - amount), rgb.g * (1 - amount), rgb.b * (1 - amount));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/theme/colors.ts
|
|
80
|
+
var defaultLight = {
|
|
81
|
+
background: "#ffffff",
|
|
82
|
+
foreground: "#1a1a1a",
|
|
83
|
+
card: "#ffffff",
|
|
84
|
+
primary: "#1a1a1a",
|
|
85
|
+
primaryForeground: "#ffffff",
|
|
86
|
+
// AUDIT FIX: brand accent — was undefined; falls back to primary when omitted
|
|
87
|
+
accent: "#d4561d",
|
|
88
|
+
accentForeground: "#ffffff",
|
|
89
|
+
border: "#dddddd",
|
|
90
|
+
// AUDIT FIX: was #e53935 (4.22:1 on white — fails AA); #c72828 = 5.59:1 ✓
|
|
91
|
+
destructive: "#c72828",
|
|
92
|
+
destructiveForeground: "#ffffff",
|
|
93
|
+
success: "#1a7a45",
|
|
94
|
+
successForeground: "#ffffff",
|
|
95
|
+
// AUDIT FIX: was #e67e00 (2.86:1 — severe fail); #9a5200 = 5.86:1 ✓ AAA-near
|
|
96
|
+
warning: "#9a5200",
|
|
97
|
+
warningForeground: "#ffffff"
|
|
98
|
+
};
|
|
99
|
+
function deriveColors(t, scheme) {
|
|
100
|
+
const dark = scheme === "dark";
|
|
101
|
+
const bg = t.background;
|
|
102
|
+
const foregroundSubtle = mixWithBackground(t.foreground, bg, 0.7);
|
|
103
|
+
const foregroundMuted = mixWithBackground(t.foreground, bg, 0.62);
|
|
104
|
+
const surface = dark ? lighten(bg, -0.06) : darken(bg, 0.04);
|
|
105
|
+
const surfaceStrong = dark ? lighten(bg, -0.12) : darken(bg, 0.08);
|
|
106
|
+
const destructiveTint = dark ? withAlphaOnDark(t.destructive, 0.15, bg) : withAlphaOnWhite(t.destructive, 0.08);
|
|
107
|
+
const destructiveBorder = dark ? withAlphaOnDark(t.destructive, 0.45, bg) : withAlphaOnWhite(t.destructive, 0.3);
|
|
108
|
+
const successTint = dark ? withAlphaOnDark(t.success, 0.15, bg) : withAlphaOnWhite(t.success, 0.08);
|
|
109
|
+
const successBorder = dark ? withAlphaOnDark(t.success, 0.45, bg) : withAlphaOnWhite(t.success, 0.3);
|
|
110
|
+
const warningTint = dark ? withAlphaOnDark(t.warning, 0.15, bg) : withAlphaOnWhite(t.warning, 0.08);
|
|
111
|
+
const warningBorder = dark ? withAlphaOnDark(t.warning, 0.45, bg) : withAlphaOnWhite(t.warning, 0.3);
|
|
112
|
+
return {
|
|
113
|
+
...t,
|
|
114
|
+
foregroundSubtle,
|
|
115
|
+
foregroundMuted,
|
|
116
|
+
surface,
|
|
117
|
+
surfaceStrong,
|
|
118
|
+
destructiveTint,
|
|
119
|
+
destructiveBorder,
|
|
120
|
+
successTint,
|
|
121
|
+
successBorder,
|
|
122
|
+
warningTint,
|
|
123
|
+
warningBorder,
|
|
124
|
+
overlay: t.overlay ?? "rgba(0,0,0,0.45)",
|
|
125
|
+
accentResolved: t.accent ?? t.primary,
|
|
126
|
+
accentForegroundResolved: t.accentForeground ?? t.primaryForeground,
|
|
127
|
+
ring: t.accent ?? t.primary,
|
|
128
|
+
input: t.border,
|
|
129
|
+
separator: dark ? lighten(t.border, 0.22) : darken(t.border, 0.16)
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/theme/ThemeProvider.tsx
|
|
134
|
+
var ThemeContext = React2.createContext({
|
|
135
|
+
colors: deriveColors(defaultLight, "light"),
|
|
136
|
+
colorScheme: "light"
|
|
137
|
+
});
|
|
138
|
+
function useTheme() {
|
|
139
|
+
const context = React2.useContext(ThemeContext);
|
|
140
|
+
if (!context) {
|
|
141
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
142
|
+
}
|
|
143
|
+
return context;
|
|
144
|
+
}
|
|
145
|
+
var isWeb = reactNative.Platform.OS === "web";
|
|
146
|
+
var s = isWeb ? (n) => n : reactNativeSizeMatters.scale;
|
|
147
|
+
var vs = isWeb ? (n) => n : reactNativeSizeMatters.verticalScale;
|
|
148
|
+
var ms = isWeb ? (n, _factor) => n : reactNativeSizeMatters.moderateScale;
|
|
149
|
+
var SPRINGS = {
|
|
150
|
+
/** Tight, premium press feel — Buttons, Toggle, Tabs triggers. */
|
|
151
|
+
pressIn: { stiffness: 600, damping: 35, mass: 0.8 },
|
|
152
|
+
pressOut: { stiffness: 280, damping: 22, mass: 0.8 },
|
|
153
|
+
/** Settled transitions for moving indicators — Tabs pill, Switch thumb. */
|
|
154
|
+
glide: { stiffness: 380, damping: 38, mass: 1 }};
|
|
155
|
+
({
|
|
156
|
+
/** Material-style ease-out — natural deceleration for state changes. */
|
|
157
|
+
standard: Animated.Easing.bezier(0.2, 0, 0, 1),
|
|
158
|
+
/** Strong ease-out for expanding surfaces (Accordion open). */
|
|
159
|
+
expand: Animated.Easing.bezier(0.23, 1, 0.32, 1),
|
|
160
|
+
/** Quick ease-in for collapsing. */
|
|
161
|
+
collapse: Animated.Easing.in(Animated.Easing.ease)
|
|
162
|
+
});
|
|
163
|
+
var PRESS_SCALE = {
|
|
164
|
+
button: 0.95};
|
|
165
|
+
function useHover() {
|
|
166
|
+
const [hovered, setHovered] = React2.useState(false);
|
|
167
|
+
const onMouseEnter = React2.useCallback(() => setHovered(true), []);
|
|
168
|
+
const onMouseLeave = React2.useCallback(() => setHovered(false), []);
|
|
169
|
+
if (reactNative.Platform.OS !== "web") {
|
|
170
|
+
return { hovered: false, hoverHandlers: {} };
|
|
171
|
+
}
|
|
172
|
+
return { hovered, hoverHandlers: { onMouseEnter, onMouseLeave } };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/utils/usePressScale.ts
|
|
176
|
+
function usePressScale({
|
|
177
|
+
pressScale = PRESS_SCALE.button,
|
|
178
|
+
hoverScale = 1.02,
|
|
179
|
+
pressInSpring = SPRINGS.pressIn,
|
|
180
|
+
pressOutSpring = SPRINGS.pressOut,
|
|
181
|
+
disabled = false
|
|
182
|
+
} = {}) {
|
|
183
|
+
const scale2 = Animated.useSharedValue(1);
|
|
184
|
+
const { hovered, hoverHandlers } = useHover();
|
|
185
|
+
const onPressIn = React2.useCallback(() => {
|
|
186
|
+
if (disabled) return;
|
|
187
|
+
scale2.value = Animated.withSpring(pressScale, pressInSpring);
|
|
188
|
+
}, [disabled, pressScale, pressInSpring, scale2]);
|
|
189
|
+
const onPressOut = React2.useCallback(() => {
|
|
190
|
+
if (disabled) return;
|
|
191
|
+
scale2.value = Animated.withSpring(1, pressOutSpring);
|
|
192
|
+
}, [disabled, pressOutSpring, scale2]);
|
|
193
|
+
const hoverActive = reactNative.Platform.OS === "web" && hovered && hoverScale !== 1 && !disabled;
|
|
194
|
+
const animatedStyle = Animated.useAnimatedStyle(() => ({
|
|
195
|
+
transform: [
|
|
196
|
+
{ scale: scale2.value * (hoverActive ? hoverScale : 1) }
|
|
197
|
+
]
|
|
198
|
+
}));
|
|
199
|
+
return {
|
|
200
|
+
animatedStyle,
|
|
201
|
+
onPressIn,
|
|
202
|
+
onPressOut,
|
|
203
|
+
hoverHandlers
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/components/Tabs/Tabs.tsx
|
|
208
|
+
function TabTrigger({
|
|
209
|
+
tab,
|
|
210
|
+
isActive,
|
|
211
|
+
onPress,
|
|
212
|
+
onLayout,
|
|
213
|
+
variant
|
|
214
|
+
}) {
|
|
215
|
+
const { colors } = useTheme();
|
|
216
|
+
const { animatedStyle, onPressIn, onPressOut } = usePressScale({
|
|
217
|
+
pressScale: PRESS_SCALE.button
|
|
218
|
+
});
|
|
219
|
+
const isUnderline = variant === "underline";
|
|
220
|
+
return /* @__PURE__ */ React2__default.default.createElement(
|
|
221
|
+
reactNative.TouchableOpacity,
|
|
222
|
+
{
|
|
223
|
+
style: [
|
|
224
|
+
styles.trigger,
|
|
225
|
+
isUnderline && styles.triggerUnderline,
|
|
226
|
+
isUnderline && isActive && { borderBottomColor: colors.primary }
|
|
227
|
+
],
|
|
228
|
+
onPress,
|
|
229
|
+
onPressIn,
|
|
230
|
+
onPressOut,
|
|
231
|
+
onLayout,
|
|
232
|
+
activeOpacity: 1,
|
|
233
|
+
touchSoundDisabled: true,
|
|
234
|
+
accessibilityRole: "tab",
|
|
235
|
+
accessibilityState: { selected: isActive },
|
|
236
|
+
accessibilityLabel: tab.label
|
|
237
|
+
},
|
|
238
|
+
/* @__PURE__ */ React2__default.default.createElement(Animated__default.default.View, { style: animatedStyle }, /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: styles.triggerInner }, tab.icon ? typeof tab.icon === "function" ? tab.icon(isActive) : tab.icon : null, /* @__PURE__ */ React2__default.default.createElement(
|
|
239
|
+
reactNative.Text,
|
|
240
|
+
{
|
|
241
|
+
style: [
|
|
242
|
+
styles.triggerLabel,
|
|
243
|
+
// AUDIT FIX: active state now only changes color, never font metrics.
|
|
244
|
+
// Previously: inactive=Regular, active=Medium (pill) or SemiBold+fontSize14 (underline)
|
|
245
|
+
// The weight/size change caused measurable layout reflow every tab switch.
|
|
246
|
+
// Solution: all labels render at SemiBold always; active = foreground, inactive = foregroundMuted.
|
|
247
|
+
{ color: isActive ? colors.foreground : colors.foregroundMuted }
|
|
248
|
+
],
|
|
249
|
+
allowFontScaling: true
|
|
250
|
+
},
|
|
251
|
+
tab.label
|
|
252
|
+
)))
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function Tabs({ tabs, variant = "pill", value, onValueChange, children, style }) {
|
|
256
|
+
const [internal, setInternal] = React2.useState(tabs[0]?.value ?? "");
|
|
257
|
+
const { colors } = useTheme();
|
|
258
|
+
const active = value ?? internal;
|
|
259
|
+
const tabLayouts = React2.useRef({});
|
|
260
|
+
const pillX = Animated.useSharedValue(0);
|
|
261
|
+
const pillWidth = Animated.useSharedValue(0);
|
|
262
|
+
const initialised = React2.useRef(false);
|
|
263
|
+
const animatePill = React2.useCallback((tabValue, animate) => {
|
|
264
|
+
const layout = tabLayouts.current[tabValue];
|
|
265
|
+
if (!layout) return;
|
|
266
|
+
if (animate) {
|
|
267
|
+
pillX.value = Animated.withSpring(layout.x, SPRINGS.glide);
|
|
268
|
+
pillWidth.value = Animated.withSpring(layout.width, SPRINGS.glide);
|
|
269
|
+
} else {
|
|
270
|
+
pillX.value = layout.x;
|
|
271
|
+
pillWidth.value = layout.width;
|
|
272
|
+
}
|
|
273
|
+
}, [pillX, pillWidth]);
|
|
274
|
+
React2.useEffect(() => {
|
|
275
|
+
if (initialised.current) animatePill(active, true);
|
|
276
|
+
}, [active, animatePill]);
|
|
277
|
+
const handlePress = (v) => {
|
|
278
|
+
selectionAsync();
|
|
279
|
+
if (!value) setInternal(v);
|
|
280
|
+
onValueChange?.(v);
|
|
281
|
+
};
|
|
282
|
+
const pillAnimatedStyle = Animated.useAnimatedStyle(() => ({
|
|
283
|
+
transform: [{ translateX: pillX.value }],
|
|
284
|
+
width: pillWidth.value
|
|
285
|
+
}));
|
|
286
|
+
return /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style }, /* @__PURE__ */ React2__default.default.createElement(
|
|
287
|
+
reactNative.View,
|
|
288
|
+
{
|
|
289
|
+
style: [
|
|
290
|
+
variant === "pill" ? [styles.list, { backgroundColor: colors.surface }] : styles.listUnderline
|
|
291
|
+
],
|
|
292
|
+
accessibilityRole: "tablist"
|
|
293
|
+
},
|
|
294
|
+
variant === "pill" && /* @__PURE__ */ React2__default.default.createElement(
|
|
295
|
+
Animated__default.default.View,
|
|
296
|
+
{
|
|
297
|
+
style: [
|
|
298
|
+
styles.pill,
|
|
299
|
+
{
|
|
300
|
+
backgroundColor: colors.background,
|
|
301
|
+
position: "absolute",
|
|
302
|
+
top: 4,
|
|
303
|
+
bottom: 4,
|
|
304
|
+
left: 0,
|
|
305
|
+
borderRadius: 8,
|
|
306
|
+
shadowColor: "#000",
|
|
307
|
+
shadowOffset: { width: 0, height: 1 },
|
|
308
|
+
shadowOpacity: 0.08,
|
|
309
|
+
shadowRadius: 2,
|
|
310
|
+
elevation: 2
|
|
311
|
+
},
|
|
312
|
+
pillAnimatedStyle
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
tabs.map((tab) => /* @__PURE__ */ React2__default.default.createElement(
|
|
317
|
+
TabTrigger,
|
|
318
|
+
{
|
|
319
|
+
key: tab.value,
|
|
320
|
+
tab,
|
|
321
|
+
isActive: tab.value === active,
|
|
322
|
+
onPress: () => handlePress(tab.value),
|
|
323
|
+
variant,
|
|
324
|
+
onLayout: (e) => {
|
|
325
|
+
const { x, width } = e.nativeEvent.layout;
|
|
326
|
+
tabLayouts.current[tab.value] = { x, width };
|
|
327
|
+
if (tab.value === active) {
|
|
328
|
+
animatePill(tab.value, false);
|
|
329
|
+
initialised.current = true;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
))
|
|
334
|
+
), children);
|
|
335
|
+
}
|
|
336
|
+
function TabsContent({ value, activeValue, children, style }) {
|
|
337
|
+
if (value !== activeValue) return null;
|
|
338
|
+
return /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style, accessibilityRole: "none" }, children);
|
|
339
|
+
}
|
|
340
|
+
var styles = reactNative.StyleSheet.create({
|
|
341
|
+
list: {
|
|
342
|
+
flexDirection: "row",
|
|
343
|
+
borderRadius: 12,
|
|
344
|
+
padding: s(4),
|
|
345
|
+
gap: s(4)
|
|
346
|
+
},
|
|
347
|
+
listUnderline: {
|
|
348
|
+
flexDirection: "row",
|
|
349
|
+
// AUDIT FIX: was missing borderBottomColor — the 1px hairline would render
|
|
350
|
+
// as transparent on some platforms. Explicit token reference ensures visibility.
|
|
351
|
+
borderBottomWidth: 1
|
|
352
|
+
},
|
|
353
|
+
pill: {},
|
|
354
|
+
trigger: {
|
|
355
|
+
flex: 1,
|
|
356
|
+
paddingVertical: vs(7),
|
|
357
|
+
paddingHorizontal: s(10),
|
|
358
|
+
borderRadius: 8,
|
|
359
|
+
alignItems: "center",
|
|
360
|
+
justifyContent: "center",
|
|
361
|
+
zIndex: 1
|
|
362
|
+
},
|
|
363
|
+
triggerUnderline: {
|
|
364
|
+
flex: 0,
|
|
365
|
+
paddingVertical: vs(12),
|
|
366
|
+
paddingHorizontal: s(16),
|
|
367
|
+
borderRadius: 0,
|
|
368
|
+
borderBottomWidth: 2,
|
|
369
|
+
borderBottomColor: "transparent"
|
|
370
|
+
},
|
|
371
|
+
triggerInner: {
|
|
372
|
+
flexDirection: "row",
|
|
373
|
+
alignItems: "center",
|
|
374
|
+
justifyContent: "center",
|
|
375
|
+
gap: s(4)
|
|
376
|
+
},
|
|
377
|
+
// AUDIT FIX: was Sohne-Regular at rest, Sohne-Medium/SemiBold when active.
|
|
378
|
+
// Font-weight changes at runtime cause advance-width shifts → the tab bar would
|
|
379
|
+
// visibly jump/reflow on every selection. Now always SemiBold; active state
|
|
380
|
+
// is communicated by color alone (foreground vs foregroundMuted). The pill
|
|
381
|
+
// indicator provides additional active signal without text layout side-effects.
|
|
382
|
+
triggerLabel: {
|
|
383
|
+
fontFamily: "Sohne-SemiBold",
|
|
384
|
+
fontSize: ms(13)
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
exports.Tabs = Tabs;
|
|
389
|
+
exports.TabsContent = TabsContent;
|
package/dist/Tabs.mjs
ADDED
package/dist/Text.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextProps as TextProps$1 } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type TextVariant = 'display-hero' | 'display-xl' | 'display-lg' | 'display-md' | 'display-sm' | 'title-md' | 'title-sm' | 'body-md' | 'body-sm' | 'caption' | 'caption-sm' | 'badge-text' | 'micro-label' | 'uppercase-tag' | 'button-lg' | 'button-sm';
|
|
5
|
+
interface TextProps extends TextProps$1 {
|
|
6
|
+
variant?: TextVariant;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
declare function TextBase({ variant, color, style, children, ...props }: TextProps): React.JSX.Element;
|
|
10
|
+
declare const Text: React.MemoExoticComponent<typeof TextBase>;
|
|
11
|
+
|
|
12
|
+
export { Text, type TextProps, type TextVariant };
|
package/dist/Text.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextProps as TextProps$1 } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type TextVariant = 'display-hero' | 'display-xl' | 'display-lg' | 'display-md' | 'display-sm' | 'title-md' | 'title-sm' | 'body-md' | 'body-sm' | 'caption' | 'caption-sm' | 'badge-text' | 'micro-label' | 'uppercase-tag' | 'button-lg' | 'button-sm';
|
|
5
|
+
interface TextProps extends TextProps$1 {
|
|
6
|
+
variant?: TextVariant;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
declare function TextBase({ variant, color, style, children, ...props }: TextProps): React.JSX.Element;
|
|
10
|
+
declare const Text: React.MemoExoticComponent<typeof TextBase>;
|
|
11
|
+
|
|
12
|
+
export { Text, type TextProps, type TextVariant };
|