@retray-dev/ui-kit 9.1.0 → 9.3.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/COMPONENTS.md +166 -4
- package/CONSUMER.md +247 -0
- package/DESIGN.md +668 -0
- package/FONTS.md +107 -0
- package/README.md +3 -3
- package/dist/AlertBanner.d.mts +3 -1
- package/dist/AlertBanner.d.ts +3 -1
- package/dist/AlertBanner.js +18 -2
- package/dist/AlertBanner.mjs +1 -1
- package/dist/ConfirmDialog.d.mts +3 -1
- package/dist/ConfirmDialog.d.ts +3 -1
- package/dist/ConfirmDialog.js +3 -0
- package/dist/ConfirmDialog.mjs +1 -1
- package/dist/CurrencyInput.d.mts +3 -1
- package/dist/CurrencyInput.d.ts +3 -1
- package/dist/CurrencyInput.js +52 -39
- package/dist/CurrencyInput.mjs +2 -3
- package/dist/ImageUpload.d.mts +27 -0
- package/dist/ImageUpload.d.ts +27 -0
- package/dist/ImageUpload.js +399 -0
- package/dist/ImageUpload.mjs +9 -0
- package/dist/Input.d.mts +3 -1
- package/dist/Input.d.ts +3 -1
- package/dist/Input.js +48 -37
- package/dist/Input.mjs +1 -2
- package/dist/ListItem.d.mts +9 -2
- package/dist/ListItem.d.ts +9 -2
- package/dist/ListItem.js +9 -2
- package/dist/ListItem.mjs +1 -1
- package/dist/SheetSelect.d.mts +25 -0
- package/dist/SheetSelect.d.ts +25 -0
- package/dist/SheetSelect.js +440 -0
- package/dist/SheetSelect.mjs +9 -0
- package/dist/Textarea.mjs +1 -2
- package/dist/{chunk-M6ZXVBTK.mjs → chunk-6MKGPAR2.mjs} +21 -5
- package/dist/{chunk-EH745HE5.mjs → chunk-CZCQZHG6.mjs} +13 -4
- package/dist/{chunk-7QHVVCB3.mjs → chunk-FZZLPJ6B.mjs} +3 -0
- package/dist/{chunk-MAC465BB.mjs → chunk-JUXSWN54.mjs} +5 -3
- package/dist/{chunk-BNP626TY.mjs → chunk-OHBNABL5.mjs} +10 -3
- package/dist/chunk-URI2WBIV.mjs +147 -0
- package/dist/chunk-Y4GL2MHX.mjs +112 -0
- package/dist/{chunk-756RAKE4.mjs → chunk-ZUR7AU5R.mjs} +38 -20
- package/dist/fonts.d.mts +32 -0
- package/dist/fonts.d.ts +32 -0
- package/dist/fonts.js +44 -0
- package/dist/fonts.mjs +37 -0
- package/dist/index.d.mts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +425 -106
- package/dist/index.mjs +55 -17
- package/package.json +23 -6
- package/src/components/AlertBanner/AlertBanner.tsx +21 -3
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +5 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +4 -0
- package/src/components/ImageUpload/ImageUpload.tsx +158 -0
- package/src/components/ImageUpload/index.ts +1 -0
- package/src/components/Input/Input.tsx +64 -53
- package/src/components/ListItem/ListItem.tsx +23 -4
- package/src/components/SheetSelect/SheetSelect.tsx +192 -0
- package/src/components/SheetSelect/index.ts +1 -0
- package/src/fonts.ts +30 -29
- package/src/hooks/useConfirmDialog.ts +67 -0
- package/src/index.ts +6 -0
- package/dist/chunk-26BCI223.mjs +0 -14
package/dist/ListItem.js
CHANGED
|
@@ -294,6 +294,7 @@ pressto.createAnimatedPressable((progress) => {
|
|
|
294
294
|
|
|
295
295
|
// src/components/ListItem/ListItem.tsx
|
|
296
296
|
function ListItemBase({
|
|
297
|
+
imageSource,
|
|
297
298
|
leftRender,
|
|
298
299
|
rightRender,
|
|
299
300
|
trailing,
|
|
@@ -313,6 +314,7 @@ function ListItemBase({
|
|
|
313
314
|
style,
|
|
314
315
|
titleStyle,
|
|
315
316
|
subtitleStyle,
|
|
317
|
+
subtitleNumberOfLines = 2,
|
|
316
318
|
captionStyle,
|
|
317
319
|
accessibilityLabel
|
|
318
320
|
}) {
|
|
@@ -321,7 +323,7 @@ function ListItemBase({
|
|
|
321
323
|
selectionAsync();
|
|
322
324
|
onPress?.();
|
|
323
325
|
};
|
|
324
|
-
const effectiveLeft = leftIcon ? renderIcon(leftIcon, 24, leftIconColor ?? colors.foreground) : leftRender ?? icon;
|
|
326
|
+
const effectiveLeft = imageSource ? /* @__PURE__ */ React3__default.default.createElement(reactNative.Image, { source: imageSource, style: styles.image }) : leftIcon ? renderIcon(leftIcon, 24, leftIconColor ?? colors.foreground) : leftRender ?? icon;
|
|
325
327
|
const effectiveRight = rightIcon ? renderIcon(rightIcon, 24, rightIconColor ?? colors.foregroundMuted) : rightRender ?? trailing;
|
|
326
328
|
const cardStyle = variant === "card" ? {
|
|
327
329
|
backgroundColor: colors.card,
|
|
@@ -347,7 +349,7 @@ function ListItemBase({
|
|
|
347
349
|
reactNative.Text,
|
|
348
350
|
{
|
|
349
351
|
style: [styles.subtitle, { color: colors.foregroundMuted }, subtitleStyle],
|
|
350
|
-
numberOfLines:
|
|
352
|
+
numberOfLines: subtitleNumberOfLines,
|
|
351
353
|
allowFontScaling: true
|
|
352
354
|
},
|
|
353
355
|
subtitle
|
|
@@ -402,6 +404,11 @@ var styles = reactNative.StyleSheet.create({
|
|
|
402
404
|
justifyContent: "center",
|
|
403
405
|
flexShrink: 0
|
|
404
406
|
},
|
|
407
|
+
image: {
|
|
408
|
+
width: s(40),
|
|
409
|
+
height: s(40),
|
|
410
|
+
borderRadius: 8
|
|
411
|
+
},
|
|
405
412
|
content: {
|
|
406
413
|
flex: 1,
|
|
407
414
|
gap: vs(4)
|
package/dist/ListItem.mjs
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface SheetSelectOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
iconName?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface SheetSelectProps {
|
|
11
|
+
options: SheetSelectOption[];
|
|
12
|
+
value?: string | number | (string | number)[];
|
|
13
|
+
onValueChange?: (value: string | number | (string | number)[]) => void;
|
|
14
|
+
/** Allow multiple simultaneous selections. Defaults to false (radio). */
|
|
15
|
+
multiSelect?: boolean;
|
|
16
|
+
label?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
/** Wrap chips into multiple rows instead of a single horizontal scroll. Defaults to false. */
|
|
19
|
+
wrap?: boolean;
|
|
20
|
+
style?: ViewStyle;
|
|
21
|
+
accessibilityLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
declare function SheetSelect({ options, value, onValueChange, multiSelect, label, error, wrap, style, accessibilityLabel, }: SheetSelectProps): React.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { SheetSelect, type SheetSelectOption, type SheetSelectProps };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface SheetSelectOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
iconName?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface SheetSelectProps {
|
|
11
|
+
options: SheetSelectOption[];
|
|
12
|
+
value?: string | number | (string | number)[];
|
|
13
|
+
onValueChange?: (value: string | number | (string | number)[]) => void;
|
|
14
|
+
/** Allow multiple simultaneous selections. Defaults to false (radio). */
|
|
15
|
+
multiSelect?: boolean;
|
|
16
|
+
label?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
/** Wrap chips into multiple rows instead of a single horizontal scroll. Defaults to false. */
|
|
19
|
+
wrap?: boolean;
|
|
20
|
+
style?: ViewStyle;
|
|
21
|
+
accessibilityLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
declare function SheetSelect({ options, value, onValueChange, multiSelect, label, error, wrap, style, accessibilityLabel, }: SheetSelectProps): React.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { SheetSelect, type SheetSelectOption, type SheetSelectProps };
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React3 = require('react');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
|
+
var reactNativeEase = require('react-native-ease');
|
|
6
|
+
var reactNativeSizeMatters = require('react-native-size-matters');
|
|
7
|
+
var AntDesign = require('@expo/vector-icons/AntDesign');
|
|
8
|
+
var Entypo = require('@expo/vector-icons/Entypo');
|
|
9
|
+
var Feather = require('@expo/vector-icons/Feather');
|
|
10
|
+
var FontAwesome5 = require('@expo/vector-icons/FontAwesome5');
|
|
11
|
+
var MaterialIcons = require('@expo/vector-icons/MaterialIcons');
|
|
12
|
+
var Ionicons = require('@expo/vector-icons/Ionicons');
|
|
13
|
+
var reactNativeReanimated = require('react-native-reanimated');
|
|
14
|
+
var pressto = require('pressto');
|
|
15
|
+
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
|
|
18
|
+
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
19
|
+
var AntDesign__default = /*#__PURE__*/_interopDefault(AntDesign);
|
|
20
|
+
var Entypo__default = /*#__PURE__*/_interopDefault(Entypo);
|
|
21
|
+
var Feather__default = /*#__PURE__*/_interopDefault(Feather);
|
|
22
|
+
var FontAwesome5__default = /*#__PURE__*/_interopDefault(FontAwesome5);
|
|
23
|
+
var MaterialIcons__default = /*#__PURE__*/_interopDefault(MaterialIcons);
|
|
24
|
+
var Ionicons__default = /*#__PURE__*/_interopDefault(Ionicons);
|
|
25
|
+
|
|
26
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
27
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
28
|
+
}) : x)(function(x) {
|
|
29
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
30
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
31
|
+
});
|
|
32
|
+
var _haptics = null;
|
|
33
|
+
var _hapticsLoaded = false;
|
|
34
|
+
async function getHaptics() {
|
|
35
|
+
if (reactNative.Platform.OS === "web") return null;
|
|
36
|
+
if (!_hapticsLoaded) {
|
|
37
|
+
_hapticsLoaded = true;
|
|
38
|
+
try {
|
|
39
|
+
_haptics = await import('expo-haptics');
|
|
40
|
+
} catch {
|
|
41
|
+
_haptics = null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return _haptics;
|
|
45
|
+
}
|
|
46
|
+
var _pulsar = null;
|
|
47
|
+
var _pulsarChecked = false;
|
|
48
|
+
var _pulsarAvailable = false;
|
|
49
|
+
function isPulsarNativeRegistered() {
|
|
50
|
+
try {
|
|
51
|
+
const g = globalThis;
|
|
52
|
+
if (typeof g.__turboModuleProxy === "function") {
|
|
53
|
+
return g.__turboModuleProxy("RNPulsar") != null;
|
|
54
|
+
}
|
|
55
|
+
return reactNative.NativeModules?.RNPulsar != null;
|
|
56
|
+
} catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function getPulsar() {
|
|
61
|
+
if (reactNative.Platform.OS === "web") return null;
|
|
62
|
+
if (!_pulsarChecked) {
|
|
63
|
+
_pulsarChecked = true;
|
|
64
|
+
try {
|
|
65
|
+
if (isPulsarNativeRegistered()) {
|
|
66
|
+
_pulsar = __require("react-native-pulsar");
|
|
67
|
+
_pulsarAvailable = true;
|
|
68
|
+
}
|
|
69
|
+
} catch {
|
|
70
|
+
_pulsar = null;
|
|
71
|
+
_pulsarAvailable = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return _pulsarAvailable ? _pulsar : null;
|
|
75
|
+
}
|
|
76
|
+
function selectionAsync() {
|
|
77
|
+
if (reactNative.Platform.OS === "web") return;
|
|
78
|
+
getHaptics().then((h) => {
|
|
79
|
+
if (h) {
|
|
80
|
+
h.selectionAsync();
|
|
81
|
+
} else {
|
|
82
|
+
getPulsar()?.Presets.System.selection();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/theme/colorUtils.ts
|
|
88
|
+
function hexToRgb(hex) {
|
|
89
|
+
const clean = hex.replace("#", "");
|
|
90
|
+
const full = clean.length === 3 ? clean.split("").map((c) => c + c).join("") : clean;
|
|
91
|
+
if (full.length !== 6) return null;
|
|
92
|
+
return {
|
|
93
|
+
r: parseInt(full.slice(0, 2), 16),
|
|
94
|
+
g: parseInt(full.slice(2, 4), 16),
|
|
95
|
+
b: parseInt(full.slice(4, 6), 16)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function componentToHex(c) {
|
|
99
|
+
return Math.round(Math.max(0, Math.min(255, c))).toString(16).padStart(2, "0");
|
|
100
|
+
}
|
|
101
|
+
function rgbToHex(r, g, b) {
|
|
102
|
+
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
|
|
103
|
+
}
|
|
104
|
+
function withAlphaOnWhite(hex, alpha) {
|
|
105
|
+
const rgb = hexToRgb(hex);
|
|
106
|
+
if (!rgb) return hex;
|
|
107
|
+
const r = rgb.r * alpha + 255 * (1 - alpha);
|
|
108
|
+
const g = rgb.g * alpha + 255 * (1 - alpha);
|
|
109
|
+
const b = rgb.b * alpha + 255 * (1 - alpha);
|
|
110
|
+
return rgbToHex(r, g, b);
|
|
111
|
+
}
|
|
112
|
+
function withAlphaOnDark(hex, alpha, bgHex = "#0f0f0f") {
|
|
113
|
+
const rgb = hexToRgb(hex);
|
|
114
|
+
const bg = hexToRgb(bgHex);
|
|
115
|
+
if (!rgb || !bg) return hex;
|
|
116
|
+
const r = rgb.r * alpha + bg.r * (1 - alpha);
|
|
117
|
+
const g = rgb.g * alpha + bg.g * (1 - alpha);
|
|
118
|
+
const b = rgb.b * alpha + bg.b * (1 - alpha);
|
|
119
|
+
return rgbToHex(r, g, b);
|
|
120
|
+
}
|
|
121
|
+
function mixWithBackground(fgHex, bgHex, opacity) {
|
|
122
|
+
const fg = hexToRgb(fgHex);
|
|
123
|
+
const bg = hexToRgb(bgHex);
|
|
124
|
+
if (!fg || !bg) return fgHex;
|
|
125
|
+
const r = fg.r * opacity + bg.r * (1 - opacity);
|
|
126
|
+
const g = fg.g * opacity + bg.g * (1 - opacity);
|
|
127
|
+
const b = fg.b * opacity + bg.b * (1 - opacity);
|
|
128
|
+
return rgbToHex(r, g, b);
|
|
129
|
+
}
|
|
130
|
+
function lighten(hex, amount) {
|
|
131
|
+
return withAlphaOnWhite(hex, 1 - amount);
|
|
132
|
+
}
|
|
133
|
+
function darken(hex, amount) {
|
|
134
|
+
const rgb = hexToRgb(hex);
|
|
135
|
+
if (!rgb) return hex;
|
|
136
|
+
return rgbToHex(rgb.r * (1 - amount), rgb.g * (1 - amount), rgb.b * (1 - amount));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/theme/colors.ts
|
|
140
|
+
var defaultLight = {
|
|
141
|
+
background: "#ffffff",
|
|
142
|
+
foreground: "#1a1a1a",
|
|
143
|
+
card: "#ffffff",
|
|
144
|
+
primary: "#1a1a1a",
|
|
145
|
+
primaryForeground: "#ffffff",
|
|
146
|
+
// AUDIT FIX: brand accent — was undefined; falls back to primary when omitted
|
|
147
|
+
accent: "#d4561d",
|
|
148
|
+
accentForeground: "#ffffff",
|
|
149
|
+
border: "#dddddd",
|
|
150
|
+
// AUDIT FIX: was #e53935 (4.22:1 on white — fails AA); #c72828 = 5.59:1 ✓
|
|
151
|
+
destructive: "#c72828",
|
|
152
|
+
destructiveForeground: "#ffffff",
|
|
153
|
+
success: "#1a7a45",
|
|
154
|
+
successForeground: "#ffffff",
|
|
155
|
+
// AUDIT FIX: was #e67e00 (2.86:1 — severe fail); #9a5200 = 5.86:1 ✓ AAA-near
|
|
156
|
+
warning: "#9a5200",
|
|
157
|
+
warningForeground: "#ffffff"
|
|
158
|
+
};
|
|
159
|
+
function deriveColors(t, scheme) {
|
|
160
|
+
const dark = scheme === "dark";
|
|
161
|
+
const bg = t.background;
|
|
162
|
+
const foregroundSubtle = mixWithBackground(t.foreground, bg, 0.7);
|
|
163
|
+
const foregroundMuted = mixWithBackground(t.foreground, bg, 0.62);
|
|
164
|
+
const surface = dark ? lighten(bg, -0.06) : darken(bg, 0.04);
|
|
165
|
+
const surfaceStrong = dark ? lighten(bg, -0.12) : darken(bg, 0.08);
|
|
166
|
+
const destructiveTint = dark ? withAlphaOnDark(t.destructive, 0.15, bg) : withAlphaOnWhite(t.destructive, 0.08);
|
|
167
|
+
const destructiveBorder = dark ? withAlphaOnDark(t.destructive, 0.45, bg) : withAlphaOnWhite(t.destructive, 0.3);
|
|
168
|
+
const successTint = dark ? withAlphaOnDark(t.success, 0.15, bg) : withAlphaOnWhite(t.success, 0.08);
|
|
169
|
+
const successBorder = dark ? withAlphaOnDark(t.success, 0.45, bg) : withAlphaOnWhite(t.success, 0.3);
|
|
170
|
+
const warningTint = dark ? withAlphaOnDark(t.warning, 0.15, bg) : withAlphaOnWhite(t.warning, 0.08);
|
|
171
|
+
const warningBorder = dark ? withAlphaOnDark(t.warning, 0.45, bg) : withAlphaOnWhite(t.warning, 0.3);
|
|
172
|
+
return {
|
|
173
|
+
...t,
|
|
174
|
+
foregroundSubtle,
|
|
175
|
+
foregroundMuted,
|
|
176
|
+
surface,
|
|
177
|
+
surfaceStrong,
|
|
178
|
+
destructiveTint,
|
|
179
|
+
destructiveBorder,
|
|
180
|
+
successTint,
|
|
181
|
+
successBorder,
|
|
182
|
+
warningTint,
|
|
183
|
+
warningBorder,
|
|
184
|
+
overlay: t.overlay ?? "rgba(0,0,0,0.45)",
|
|
185
|
+
accentResolved: t.accent ?? t.primary,
|
|
186
|
+
accentForegroundResolved: t.accentForeground ?? t.primaryForeground,
|
|
187
|
+
ring: t.accent ?? t.primary,
|
|
188
|
+
input: t.border,
|
|
189
|
+
separator: dark ? lighten(t.border, 0.22) : darken(t.border, 0.16)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/theme/ThemeProvider.tsx
|
|
194
|
+
var ThemeContext = React3.createContext({
|
|
195
|
+
colors: deriveColors(defaultLight, "light"),
|
|
196
|
+
colorScheme: "light"
|
|
197
|
+
});
|
|
198
|
+
function useTheme() {
|
|
199
|
+
const context = React3.useContext(ThemeContext);
|
|
200
|
+
if (!context) {
|
|
201
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
202
|
+
}
|
|
203
|
+
return context;
|
|
204
|
+
}
|
|
205
|
+
var isWeb = reactNative.Platform.OS === "web";
|
|
206
|
+
var s = isWeb ? (n) => n : reactNativeSizeMatters.scale;
|
|
207
|
+
var vs = isWeb ? (n) => n : reactNativeSizeMatters.verticalScale;
|
|
208
|
+
var ms = isWeb ? (n, _factor) => n : reactNativeSizeMatters.moderateScale;
|
|
209
|
+
var mvs = isWeb ? (n, _factor) => n : reactNativeSizeMatters.moderateVerticalScale;
|
|
210
|
+
var glyphMapOf = (mod) => mod.glyphMap ?? {};
|
|
211
|
+
var ALL_FAMILIES = [
|
|
212
|
+
{ name: "Ionicons", component: Ionicons__default.default, getGlyphMap: () => glyphMapOf(Ionicons__default.default) },
|
|
213
|
+
{ name: "MaterialIcons", component: MaterialIcons__default.default, getGlyphMap: () => glyphMapOf(MaterialIcons__default.default) },
|
|
214
|
+
{ name: "FontAwesome5", component: FontAwesome5__default.default, getGlyphMap: () => glyphMapOf(FontAwesome5__default.default) },
|
|
215
|
+
{ name: "Entypo", component: Entypo__default.default, getGlyphMap: () => glyphMapOf(Entypo__default.default) },
|
|
216
|
+
{ name: "AntDesign", component: AntDesign__default.default, getGlyphMap: () => glyphMapOf(AntDesign__default.default) },
|
|
217
|
+
{ name: "Feather", component: Feather__default.default, getGlyphMap: () => glyphMapOf(Feather__default.default) }
|
|
218
|
+
];
|
|
219
|
+
var activeFamilies = ALL_FAMILIES;
|
|
220
|
+
var resolvedCache = null;
|
|
221
|
+
function buildCache() {
|
|
222
|
+
const cache = /* @__PURE__ */ new Map();
|
|
223
|
+
for (const family of activeFamilies) {
|
|
224
|
+
const glyphMap = family.getGlyphMap();
|
|
225
|
+
for (const iconName of Object.keys(glyphMap)) {
|
|
226
|
+
cache.set(iconName, family);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return cache;
|
|
230
|
+
}
|
|
231
|
+
function resolveFamily(name) {
|
|
232
|
+
if (!resolvedCache) {
|
|
233
|
+
resolvedCache = buildCache();
|
|
234
|
+
}
|
|
235
|
+
return resolvedCache.get(name) ?? null;
|
|
236
|
+
}
|
|
237
|
+
function Icon({ name, size, color, family }) {
|
|
238
|
+
let resolved = null;
|
|
239
|
+
if (family) {
|
|
240
|
+
resolved = ALL_FAMILIES.find((f) => f.name === family) ?? null;
|
|
241
|
+
} else {
|
|
242
|
+
resolved = resolveFamily(name);
|
|
243
|
+
}
|
|
244
|
+
if (!resolved) return null;
|
|
245
|
+
const Component = resolved.component;
|
|
246
|
+
return React3__default.default.createElement(Component, { name, size, color });
|
|
247
|
+
}
|
|
248
|
+
function renderIcon(name, size, color) {
|
|
249
|
+
return React3__default.default.createElement(Icon, { name, size, color });
|
|
250
|
+
}
|
|
251
|
+
var TIMINGS = {
|
|
252
|
+
/** Color/opacity transitions on toggles, checkboxes, switches. */
|
|
253
|
+
state: { duration: 160 }};
|
|
254
|
+
({
|
|
255
|
+
/** Material-style ease-out — natural deceleration for state changes. */
|
|
256
|
+
standard: reactNativeReanimated.Easing.bezier(0.2, 0, 0, 1),
|
|
257
|
+
/** Strong ease-out for expanding surfaces (Accordion open). */
|
|
258
|
+
expand: reactNativeReanimated.Easing.bezier(0.23, 1, 0.32, 1),
|
|
259
|
+
/** Quick ease-in for collapsing. */
|
|
260
|
+
collapse: reactNativeReanimated.Easing.in(reactNativeReanimated.Easing.ease)
|
|
261
|
+
});
|
|
262
|
+
var COLOR_TRANSITION = {
|
|
263
|
+
type: "timing",
|
|
264
|
+
duration: TIMINGS.state.duration,
|
|
265
|
+
easing: [0.2, 0, 0, 1]
|
|
266
|
+
};
|
|
267
|
+
var PRESS_SCALE = {
|
|
268
|
+
button: 0.95,
|
|
269
|
+
card: 0.98,
|
|
270
|
+
row: 0.97,
|
|
271
|
+
chip: 0.94
|
|
272
|
+
};
|
|
273
|
+
pressto.createAnimatedPressable((progress) => {
|
|
274
|
+
"worklet";
|
|
275
|
+
const scale2 = 1 - (1 - PRESS_SCALE.button) * progress;
|
|
276
|
+
return { transform: [{ scale: scale2 }] };
|
|
277
|
+
});
|
|
278
|
+
pressto.createAnimatedPressable((progress) => {
|
|
279
|
+
"worklet";
|
|
280
|
+
const scale2 = 1 - (1 - PRESS_SCALE.card) * progress;
|
|
281
|
+
return { transform: [{ scale: scale2 }] };
|
|
282
|
+
});
|
|
283
|
+
pressto.createAnimatedPressable((progress) => {
|
|
284
|
+
"worklet";
|
|
285
|
+
const scale2 = 1 - (1 - PRESS_SCALE.row) * progress;
|
|
286
|
+
return { transform: [{ scale: scale2 }] };
|
|
287
|
+
});
|
|
288
|
+
var PressableChip = pressto.createAnimatedPressable((progress) => {
|
|
289
|
+
"worklet";
|
|
290
|
+
const scale2 = 1 - (1 - PRESS_SCALE.chip) * progress;
|
|
291
|
+
return { transform: [{ scale: scale2 }] };
|
|
292
|
+
});
|
|
293
|
+
pressto.createAnimatedPressable((progress) => {
|
|
294
|
+
"worklet";
|
|
295
|
+
const scale2 = 1 - (1 - PRESS_SCALE.button) * progress;
|
|
296
|
+
return { transform: [{ scale: scale2 }] };
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// src/tokens.ts
|
|
300
|
+
var RADIUS = {
|
|
301
|
+
full: 9999
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// src/components/SheetSelect/SheetSelect.tsx
|
|
305
|
+
function SheetSelectChip({
|
|
306
|
+
option,
|
|
307
|
+
selected,
|
|
308
|
+
onPress
|
|
309
|
+
}) {
|
|
310
|
+
const { colors } = useTheme();
|
|
311
|
+
const handlePress = () => {
|
|
312
|
+
selectionAsync();
|
|
313
|
+
onPress();
|
|
314
|
+
};
|
|
315
|
+
const iconColor = selected ? colors.primaryForeground : colors.foreground;
|
|
316
|
+
const resolvedIcon = option.iconName ? renderIcon(option.iconName, ms(13), iconColor) : null;
|
|
317
|
+
return /* @__PURE__ */ React3__default.default.createElement(
|
|
318
|
+
PressableChip,
|
|
319
|
+
{
|
|
320
|
+
onPress: option.disabled ? void 0 : handlePress,
|
|
321
|
+
rippleColor: "transparent",
|
|
322
|
+
touchSoundDisabled: true,
|
|
323
|
+
accessibilityRole: "button",
|
|
324
|
+
accessibilityLabel: option.disabled ? `${option.label}, unavailable` : option.label,
|
|
325
|
+
accessibilityState: { selected, disabled: option.disabled }
|
|
326
|
+
},
|
|
327
|
+
/* @__PURE__ */ React3__default.default.createElement(
|
|
328
|
+
reactNativeEase.EaseView,
|
|
329
|
+
{
|
|
330
|
+
style: [styles.chip, option.disabled && styles.chipDisabled],
|
|
331
|
+
animate: {
|
|
332
|
+
backgroundColor: selected ? colors.primary : colors.surface,
|
|
333
|
+
borderColor: selected ? colors.primary : colors.border
|
|
334
|
+
},
|
|
335
|
+
transition: COLOR_TRANSITION
|
|
336
|
+
},
|
|
337
|
+
resolvedIcon ? /* @__PURE__ */ React3__default.default.createElement(reactNative.View, { style: styles.chipIcon }, resolvedIcon) : null,
|
|
338
|
+
/* @__PURE__ */ React3__default.default.createElement(
|
|
339
|
+
reactNative.Text,
|
|
340
|
+
{
|
|
341
|
+
style: [styles.chipLabel, { color: selected ? colors.primaryForeground : colors.foreground }],
|
|
342
|
+
allowFontScaling: true
|
|
343
|
+
},
|
|
344
|
+
option.label
|
|
345
|
+
)
|
|
346
|
+
)
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function SheetSelect({
|
|
350
|
+
options,
|
|
351
|
+
value,
|
|
352
|
+
onValueChange,
|
|
353
|
+
multiSelect = false,
|
|
354
|
+
label,
|
|
355
|
+
error,
|
|
356
|
+
wrap = false,
|
|
357
|
+
style,
|
|
358
|
+
accessibilityLabel
|
|
359
|
+
}) {
|
|
360
|
+
const { colors } = useTheme();
|
|
361
|
+
const isSelected = (optionValue) => {
|
|
362
|
+
if (Array.isArray(value)) return value.includes(optionValue);
|
|
363
|
+
return optionValue === value;
|
|
364
|
+
};
|
|
365
|
+
const handlePress = (optionValue) => {
|
|
366
|
+
if (!multiSelect) {
|
|
367
|
+
onValueChange?.(optionValue);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const currentArray = Array.isArray(value) ? value : value != null ? [value] : [];
|
|
371
|
+
const alreadySelected = currentArray.includes(optionValue);
|
|
372
|
+
const newArray = alreadySelected ? currentArray.filter((v) => v !== optionValue) : [...currentArray, optionValue];
|
|
373
|
+
onValueChange?.(newArray);
|
|
374
|
+
};
|
|
375
|
+
const chips = options.map((opt) => /* @__PURE__ */ React3__default.default.createElement(
|
|
376
|
+
SheetSelectChip,
|
|
377
|
+
{
|
|
378
|
+
key: opt.value,
|
|
379
|
+
option: opt,
|
|
380
|
+
selected: isSelected(opt.value),
|
|
381
|
+
onPress: () => handlePress(opt.value)
|
|
382
|
+
}
|
|
383
|
+
));
|
|
384
|
+
return /* @__PURE__ */ React3__default.default.createElement(reactNative.View, { style: [styles.container, style], accessibilityLabel }, label ? /* @__PURE__ */ React3__default.default.createElement(reactNative.Text, { style: [styles.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, wrap ? /* @__PURE__ */ React3__default.default.createElement(reactNative.View, { style: styles.wrapContainer }, chips) : /* @__PURE__ */ React3__default.default.createElement(
|
|
385
|
+
reactNative.ScrollView,
|
|
386
|
+
{
|
|
387
|
+
horizontal: true,
|
|
388
|
+
showsHorizontalScrollIndicator: false,
|
|
389
|
+
contentContainerStyle: styles.scrollContent
|
|
390
|
+
},
|
|
391
|
+
chips
|
|
392
|
+
), error ? /* @__PURE__ */ React3__default.default.createElement(reactNative.Text, { style: [styles.error, { color: colors.destructive }], allowFontScaling: true, accessibilityLiveRegion: "polite" }, error) : null);
|
|
393
|
+
}
|
|
394
|
+
var styles = reactNative.StyleSheet.create({
|
|
395
|
+
container: {
|
|
396
|
+
gap: vs(8)
|
|
397
|
+
},
|
|
398
|
+
label: {
|
|
399
|
+
fontFamily: "Sohne-Medium",
|
|
400
|
+
fontSize: ms(14)
|
|
401
|
+
},
|
|
402
|
+
scrollContent: {
|
|
403
|
+
flexDirection: "row",
|
|
404
|
+
gap: s(8)
|
|
405
|
+
},
|
|
406
|
+
wrapContainer: {
|
|
407
|
+
flexDirection: "row",
|
|
408
|
+
flexWrap: "wrap",
|
|
409
|
+
gap: s(8)
|
|
410
|
+
},
|
|
411
|
+
chip: {
|
|
412
|
+
borderRadius: RADIUS.full,
|
|
413
|
+
paddingHorizontal: s(14),
|
|
414
|
+
paddingVertical: vs(10),
|
|
415
|
+
minHeight: 44,
|
|
416
|
+
borderWidth: 1,
|
|
417
|
+
alignItems: "center",
|
|
418
|
+
justifyContent: "center",
|
|
419
|
+
flexDirection: "row",
|
|
420
|
+
gap: s(5)
|
|
421
|
+
},
|
|
422
|
+
chipDisabled: {
|
|
423
|
+
opacity: 0.4
|
|
424
|
+
},
|
|
425
|
+
chipIcon: {
|
|
426
|
+
alignItems: "center",
|
|
427
|
+
justifyContent: "center"
|
|
428
|
+
},
|
|
429
|
+
chipLabel: {
|
|
430
|
+
fontFamily: "Sohne-Medium",
|
|
431
|
+
fontSize: ms(13),
|
|
432
|
+
lineHeight: mvs(18)
|
|
433
|
+
},
|
|
434
|
+
error: {
|
|
435
|
+
fontFamily: "Sohne-Regular",
|
|
436
|
+
fontSize: ms(13)
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
exports.SheetSelect = SheetSelect;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { SheetSelect } from './chunk-URI2WBIV.mjs';
|
|
2
|
+
import './chunk-3DKJ2GIC.mjs';
|
|
3
|
+
import './chunk-EJ7ZPXOH.mjs';
|
|
4
|
+
import './chunk-DVK4G2GT.mjs';
|
|
5
|
+
import './chunk-QY3X2UYR.mjs';
|
|
6
|
+
import './chunk-T7XZ7H7Y.mjs';
|
|
7
|
+
import './chunk-SOYNZDVY.mjs';
|
|
8
|
+
import './chunk-2CE3TQVY.mjs';
|
|
9
|
+
import './chunk-Y6FXYEAI.mjs';
|
package/dist/Textarea.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { RADIUS } from './chunk-QY3X2UYR.mjs';
|
|
2
2
|
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
3
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { s, vs, ms } from './chunk-2CE3TQVY.mjs';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { StyleSheet, View, Text } from 'react-native';
|
|
7
|
-
import { FontAwesome5, MaterialIcons, Entypo } from '@expo/vector-icons';
|
|
6
|
+
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
|
|
7
|
+
import { FontAwesome5, MaterialIcons, Entypo, Feather } from '@expo/vector-icons';
|
|
8
8
|
|
|
9
|
-
function AlertBanner({ title, description, variant = "default", icon, iconName, iconColor, style }) {
|
|
9
|
+
function AlertBanner({ title, description, variant = "default", icon, iconName, iconColor, onDismiss, style }) {
|
|
10
10
|
const { colors, colorScheme } = useTheme();
|
|
11
11
|
const isDark = colorScheme === "dark";
|
|
12
12
|
const accentColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : variant === "warning" ? colors.warning : colors.foreground;
|
|
@@ -32,7 +32,18 @@ function AlertBanner({ title, description, variant = "default", icon, iconName,
|
|
|
32
32
|
accessibilityLabel: a11yLabel
|
|
33
33
|
},
|
|
34
34
|
/* @__PURE__ */ React.createElement(View, { style: styles.iconSlot }, effectiveIcon),
|
|
35
|
-
/* @__PURE__ */ React.createElement(View, { style: styles.content }, /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title), description ? /* @__PURE__ */ React.createElement(Text, { style: [styles.description, { color: colors.foreground, opacity: 0.85 }], allowFontScaling: true }, description) : null)
|
|
35
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.content }, /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title), description ? /* @__PURE__ */ React.createElement(Text, { style: [styles.description, { color: colors.foreground, opacity: 0.85 }], allowFontScaling: true }, description) : null),
|
|
36
|
+
onDismiss ? /* @__PURE__ */ React.createElement(
|
|
37
|
+
TouchableOpacity,
|
|
38
|
+
{
|
|
39
|
+
onPress: onDismiss,
|
|
40
|
+
style: styles.dismissButton,
|
|
41
|
+
activeOpacity: 0.6,
|
|
42
|
+
accessibilityRole: "button",
|
|
43
|
+
accessibilityLabel: "Dismiss"
|
|
44
|
+
},
|
|
45
|
+
/* @__PURE__ */ React.createElement(Feather, { name: "x", size: ms(16), color: colors.foregroundMuted })
|
|
46
|
+
) : null
|
|
36
47
|
);
|
|
37
48
|
}
|
|
38
49
|
var styles = StyleSheet.create({
|
|
@@ -58,6 +69,11 @@ var styles = StyleSheet.create({
|
|
|
58
69
|
description: {
|
|
59
70
|
fontFamily: "Sohne-Regular",
|
|
60
71
|
fontSize: ms(12)
|
|
72
|
+
},
|
|
73
|
+
dismissButton: {
|
|
74
|
+
padding: s(4),
|
|
75
|
+
marginTop: vs(-2),
|
|
76
|
+
marginRight: -s(4)
|
|
61
77
|
}
|
|
62
78
|
});
|
|
63
79
|
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TIMINGS } from './chunk-DVK4G2GT.mjs';
|
|
1
|
+
import { TIMINGS, EASINGS } from './chunk-DVK4G2GT.mjs';
|
|
3
2
|
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
4
3
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
4
|
import { vs, ms, s } from './chunk-2CE3TQVY.mjs';
|
|
6
|
-
import React, { useState } from 'react';
|
|
5
|
+
import React, { useState, useEffect } from 'react';
|
|
7
6
|
import { Platform, StyleSheet, View, Text, TextInput } from 'react-native';
|
|
8
|
-
import Animated, { useAnimatedStyle, interpolate, interpolateColor } from 'react-native-reanimated';
|
|
7
|
+
import Animated, { useAnimatedStyle, interpolate, interpolateColor, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
9
8
|
|
|
9
|
+
function useColorTransition(active, options = {}) {
|
|
10
|
+
const { duration = TIMINGS.state.duration } = options;
|
|
11
|
+
const progress = useSharedValue(active ? 1 : 0);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
progress.value = withTiming(active ? 1 : 0, { duration, easing: EASINGS.standard });
|
|
14
|
+
}, [active, duration, progress]);
|
|
15
|
+
return progress;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/components/Textarea/Textarea.tsx
|
|
10
19
|
var webInputResetStyle = Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
11
20
|
function Textarea({
|
|
12
21
|
label,
|
|
@@ -14,6 +14,7 @@ function ConfirmDialog({
|
|
|
14
14
|
confirmLabel = "Confirm",
|
|
15
15
|
cancelLabel = "Cancel",
|
|
16
16
|
confirmVariant = "primary",
|
|
17
|
+
loading = false,
|
|
17
18
|
onConfirm,
|
|
18
19
|
onCancel
|
|
19
20
|
}) {
|
|
@@ -53,6 +54,8 @@ function ConfirmDialog({
|
|
|
53
54
|
label: confirmLabel,
|
|
54
55
|
variant: confirmVariant,
|
|
55
56
|
fullWidth: true,
|
|
57
|
+
loading,
|
|
58
|
+
disabled: loading,
|
|
56
59
|
onPress: () => {
|
|
57
60
|
notificationSuccess();
|
|
58
61
|
onConfirm();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Input } from './chunk-
|
|
1
|
+
import { Input } from './chunk-ZUR7AU5R.mjs';
|
|
2
2
|
import { ms, vs } from './chunk-2CE3TQVY.mjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
@@ -20,7 +20,8 @@ function CurrencyInput({
|
|
|
20
20
|
placeholder,
|
|
21
21
|
editable,
|
|
22
22
|
containerStyle,
|
|
23
|
-
style
|
|
23
|
+
style,
|
|
24
|
+
sheetMode
|
|
24
25
|
}) {
|
|
25
26
|
const handleChange = (text) => {
|
|
26
27
|
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
@@ -53,7 +54,8 @@ function CurrencyInput({
|
|
|
53
54
|
prefixStyle,
|
|
54
55
|
containerStyle,
|
|
55
56
|
inputWrapperStyle: isLarge ? { paddingVertical: vs(16), minHeight: 72 } : void 0,
|
|
56
|
-
style: [inputStyle, style]
|
|
57
|
+
style: [inputStyle, style],
|
|
58
|
+
sheetMode
|
|
57
59
|
}
|
|
58
60
|
);
|
|
59
61
|
}
|