@retray-dev/ui-kit 7.0.1 → 9.0.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 +554 -11
- package/EXAMPLES.md +2 -2
- package/README.md +14 -8
- package/dist/Accordion.js +57 -5
- package/dist/Accordion.mjs +4 -3
- package/dist/AlertBanner.js +4 -1
- package/dist/AlertBanner.mjs +3 -2
- package/dist/AppHeader.d.mts +40 -0
- package/dist/AppHeader.d.ts +40 -0
- package/dist/AppHeader.js +515 -0
- package/dist/AppHeader.mjs +10 -0
- package/dist/Avatar.js +39 -29
- package/dist/Avatar.mjs +2 -1
- package/dist/Badge.js +11 -1
- package/dist/Badge.mjs +2 -1
- package/dist/Button.d.mts +8 -3
- package/dist/Button.d.ts +8 -3
- package/dist/Button.js +126 -108
- package/dist/Button.mjs +6 -5
- package/dist/ButtonGroup.mjs +1 -0
- package/dist/Card.js +90 -70
- package/dist/Card.mjs +5 -4
- package/dist/CategoryStrip.js +79 -22
- package/dist/CategoryStrip.mjs +6 -6
- package/dist/Checkbox.js +118 -86
- package/dist/Checkbox.mjs +5 -5
- package/dist/Chip.js +113 -80
- package/dist/Chip.mjs +5 -5
- package/dist/ConfirmDialog.js +140 -110
- package/dist/ConfirmDialog.mjs +7 -6
- package/dist/CurrencyDisplay.mjs +1 -0
- package/dist/CurrencyInput.d.mts +1 -1
- package/dist/CurrencyInput.d.ts +1 -1
- package/dist/CurrencyInput.js +9 -5
- package/dist/CurrencyInput.mjs +5 -4
- package/dist/DetailRow.mjs +1 -0
- package/dist/EmptyState.js +131 -111
- package/dist/EmptyState.mjs +7 -6
- package/dist/ErrorBoundary.d.mts +42 -0
- package/dist/ErrorBoundary.d.ts +42 -0
- package/dist/ErrorBoundary.js +351 -0
- package/dist/ErrorBoundary.mjs +7 -0
- package/dist/Form.mjs +1 -0
- package/dist/HolographicCard.d.mts +55 -0
- package/dist/HolographicCard.d.ts +55 -0
- package/dist/HolographicCard.js +316 -0
- package/dist/HolographicCard.mjs +191 -0
- package/dist/IconButton.d.mts +8 -3
- package/dist/IconButton.d.ts +8 -3
- package/dist/IconButton.js +115 -98
- package/dist/IconButton.mjs +5 -4
- package/dist/ImageViewer.d.mts +23 -0
- package/dist/ImageViewer.d.ts +23 -0
- package/dist/ImageViewer.js +582 -0
- package/dist/ImageViewer.mjs +8 -0
- package/dist/Input.mjs +4 -3
- package/dist/LabelValue.mjs +1 -0
- package/dist/ListGroup.mjs +1 -0
- package/dist/ListItem.js +131 -117
- package/dist/ListItem.mjs +6 -5
- package/dist/MediaCard.js +54 -6
- package/dist/MediaCard.mjs +6 -5
- package/dist/MenuGroup.mjs +1 -0
- package/dist/MenuItem.js +91 -79
- package/dist/MenuItem.mjs +6 -5
- package/dist/MonthPicker.d.mts +10 -2
- package/dist/MonthPicker.d.ts +10 -2
- package/dist/MonthPicker.js +80 -17
- package/dist/MonthPicker.mjs +3 -2
- package/dist/PagerDots.d.mts +35 -0
- package/dist/PagerDots.d.ts +35 -0
- package/dist/PagerDots.js +392 -0
- package/dist/PagerDots.mjs +7 -0
- package/dist/Pressable.d.mts +5 -5
- package/dist/Pressable.d.ts +5 -5
- package/dist/Pressable.js +97 -86
- package/dist/Pressable.mjs +5 -4
- package/dist/PricingCard.d.mts +50 -0
- package/dist/PricingCard.d.ts +50 -0
- package/dist/PricingCard.js +636 -0
- package/dist/PricingCard.mjs +11 -0
- package/dist/Progress.mjs +3 -2
- package/dist/RadioGroup.js +81 -30
- package/dist/RadioGroup.mjs +5 -5
- package/dist/RetrayProvider.d.mts +2 -0
- package/dist/RetrayProvider.d.ts +2 -0
- package/dist/RetrayProvider.js +214 -0
- package/dist/RetrayProvider.mjs +5 -0
- package/dist/Select.js +51 -4
- package/dist/Select.mjs +5 -4
- package/dist/SelectableGrid.d.mts +44 -0
- package/dist/SelectableGrid.d.ts +44 -0
- package/dist/SelectableGrid.js +448 -0
- package/dist/SelectableGrid.mjs +9 -0
- package/dist/Separator.mjs +1 -0
- package/dist/Sheet.d.mts +13 -1
- package/dist/Sheet.d.ts +13 -1
- package/dist/Sheet.js +115 -5
- package/dist/Sheet.mjs +4 -2
- package/dist/Skeleton.d.mts +50 -0
- package/dist/Skeleton.d.ts +50 -0
- package/dist/Skeleton.js +61 -0
- package/dist/Skeleton.mjs +4 -2
- package/dist/Slider.js +51 -4
- package/dist/Slider.mjs +3 -2
- package/dist/Spinner.js +28 -7
- package/dist/Spinner.mjs +2 -1
- package/dist/Switch.js +98 -48
- package/dist/Switch.mjs +4 -3
- package/dist/TabBar.d.mts +42 -0
- package/dist/TabBar.d.ts +42 -0
- package/dist/TabBar.js +361 -0
- package/dist/TabBar.mjs +6 -0
- package/dist/Tabs.js +92 -62
- package/dist/Tabs.mjs +5 -4
- package/dist/Text.js +16 -0
- package/dist/Text.mjs +2 -1
- package/dist/Textarea.mjs +4 -3
- package/dist/Toast.d.mts +7 -7
- package/dist/Toast.d.ts +7 -7
- package/dist/Toast.mjs +1 -0
- package/dist/Toggle.d.mts +6 -3
- package/dist/Toggle.d.ts +6 -3
- package/dist/Toggle.js +135 -120
- package/dist/Toggle.mjs +5 -5
- package/dist/VirtualList.mjs +1 -0
- package/dist/{chunk-7H2OR44A.mjs → chunk-26BCI223.mjs} +1 -1
- package/dist/{chunk-CRYBX2CM.mjs → chunk-2TFTAWVJ.mjs} +44 -59
- package/dist/chunk-3DKJ2GIC.mjs +30 -0
- package/dist/{chunk-KWCPOM6W.mjs → chunk-3U4SSNWP.mjs} +32 -48
- package/dist/chunk-4I7D47FH.mjs +139 -0
- package/dist/chunk-4K625MVM.mjs +142 -0
- package/dist/{chunk-MN7OG7IY.mjs → chunk-6OAZJ577.mjs} +6 -4
- package/dist/{chunk-L7E7TVEZ.mjs → chunk-756RAKE4.mjs} +2 -2
- package/dist/{chunk-HSPSMN6U.mjs → chunk-7QHVVCB3.mjs} +2 -2
- package/dist/{chunk-URLL5JBR.mjs → chunk-A3A6KNQN.mjs} +3 -3
- package/dist/chunk-AJ7ZDNBT.mjs +120 -0
- package/dist/{chunk-FTLJOUOQ.mjs → chunk-AV4EMIRH.mjs} +25 -28
- package/dist/chunk-AZJF2BLK.mjs +115 -0
- package/dist/chunk-BNP626TY.mjs +159 -0
- package/dist/{chunk-5IKW3VNC.mjs → chunk-DVK4G2GT.mjs} +17 -1
- package/dist/{chunk-6LQYY7HC.mjs → chunk-EH745HE5.mjs} +2 -2
- package/dist/chunk-EJ7ZPXOH.mjs +163 -0
- package/dist/{chunk-RKLHUDZS.mjs → chunk-GD6KXMG5.mjs} +29 -15
- package/dist/{chunk-RR2VQLKE.mjs → chunk-GQYFLP3D.mjs} +14 -17
- package/dist/{chunk-Y6MXOREN.mjs → chunk-ID72TK46.mjs} +8 -17
- package/dist/{chunk-NQGVLMWG.mjs → chunk-JMOZEC77.mjs} +1 -1
- package/dist/{chunk-GCWOGZYL.mjs → chunk-JT7HKXRB.mjs} +39 -29
- package/dist/{chunk-LWG526VX.mjs → chunk-KIHCWCWL.mjs} +47 -62
- package/dist/chunk-LXJIIOYQ.mjs +104 -0
- package/dist/{chunk-SBZYEV4S.mjs → chunk-M6ZXVBTK.mjs} +5 -2
- package/dist/{chunk-XDMN67KV.mjs → chunk-MAC465BB.mjs} +10 -8
- package/dist/chunk-MBMXYJJV.mjs +36 -0
- package/dist/chunk-MLF3EZFW.mjs +119 -0
- package/dist/chunk-NA7PARID.mjs +147 -0
- package/dist/{chunk-QXGYKWI7.mjs → chunk-O3HA6TYM.mjs} +9 -4
- package/dist/{chunk-63357L2X.mjs → chunk-OB4JUQ3O.mjs} +1 -1
- package/dist/{chunk-AU2VDY4P.mjs → chunk-PFZTM6D5.mjs} +52 -4
- package/dist/chunk-QKH5ZOD5.mjs +97 -0
- package/dist/{chunk-KZJRQOIU.mjs → chunk-TERDKCLE.mjs} +11 -1
- package/dist/{chunk-U4N7WF4Z.mjs → chunk-UREA2GYY.mjs} +28 -23
- package/dist/{chunk-TAJ2PQ2O.mjs → chunk-VGTDN7SW.mjs} +7 -6
- package/dist/{chunk-URDE3EUU.mjs → chunk-VQ57HWPL.mjs} +27 -15
- package/dist/chunk-WBOOUHSS.mjs +62 -0
- package/dist/{chunk-GNGLDL6Z.mjs → chunk-WJLKJMKR.mjs} +18 -0
- package/dist/{chunk-YZJAFS4P.mjs → chunk-X4G6APW6.mjs} +22 -19
- package/dist/chunk-Y6FXYEAI.mjs +8 -0
- package/dist/chunk-YFZ3ELX5.mjs +16 -0
- package/dist/{chunk-QCNARS3X.mjs → chunk-YNROWHQJ.mjs} +1 -1
- package/dist/chunk-Z4BVUWW6.mjs +196 -0
- package/dist/{chunk-GPOUINK5.mjs → chunk-ZJKGQMYH.mjs} +10 -27
- package/dist/index-wt-orHUi.d.mts +85 -0
- package/dist/index-wt-orHUi.d.ts +85 -0
- package/dist/index.d.mts +59 -51
- package/dist/index.d.ts +59 -51
- package/dist/index.js +1940 -744
- package/dist/index.mjs +49 -39
- package/package.json +35 -5
- package/src/components/Accordion/Accordion.tsx +12 -1
- package/src/components/AlertBanner/AlertBanner.tsx +5 -0
- package/src/components/AppHeader/AppHeader.tsx +172 -0
- package/src/components/AppHeader/index.ts +1 -0
- package/src/components/Avatar/Avatar.tsx +10 -2
- package/src/components/Badge/Badge.tsx +8 -1
- package/src/components/Button/Button.tsx +20 -27
- package/src/components/Card/Card.tsx +12 -23
- package/src/components/CategoryStrip/CategoryStrip.tsx +17 -21
- package/src/components/Checkbox/Checkbox.tsx +26 -40
- package/src/components/Chip/Chip.tsx +24 -33
- package/src/components/CurrencyInput/CurrencyInput.tsx +10 -8
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +153 -0
- package/src/components/ErrorBoundary/index.ts +1 -0
- package/src/components/HolographicCard/HolographicCard.tsx +315 -0
- package/src/components/HolographicCard/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +19 -27
- package/src/components/ImageViewer/ImageViewer.tsx +290 -0
- package/src/components/ImageViewer/index.ts +1 -0
- package/src/components/ListItem/ListItem.tsx +70 -67
- package/src/components/MediaCard/MediaCard.tsx +8 -2
- package/src/components/MenuItem/MenuItem.tsx +10 -25
- package/src/components/MonthPicker/MonthPicker.tsx +39 -13
- package/src/components/MonthPicker/index.ts +1 -1
- package/src/components/PagerDots/PagerDots.tsx +200 -0
- package/src/components/PagerDots/index.ts +1 -0
- package/src/components/Pressable/Pressable.tsx +19 -35
- package/src/components/PricingCard/PricingCard.tsx +220 -0
- package/src/components/PricingCard/index.ts +1 -0
- package/src/components/RadioGroup/RadioGroup.tsx +14 -27
- package/src/components/RetrayProvider/RetrayProvider.tsx +59 -0
- package/src/components/RetrayProvider/index.ts +1 -0
- package/src/components/SelectableGrid/SelectableGrid.tsx +205 -0
- package/src/components/SelectableGrid/index.ts +1 -0
- package/src/components/Sheet/Sheet.tsx +65 -1
- package/src/components/Skeleton/Skeleton.tsx +142 -1
- package/src/components/Spinner/Spinner.tsx +17 -2
- package/src/components/Switch/Switch.tsx +30 -58
- package/src/components/TabBar/TabBar.tsx +169 -0
- package/src/components/TabBar/index.ts +1 -0
- package/src/components/Tabs/Tabs.tsx +23 -26
- package/src/components/Text/Text.tsx +2 -0
- package/src/components/Toggle/Toggle.tsx +35 -51
- package/src/fonts.ts +4 -1
- package/src/index.ts +23 -2
- package/src/utils/animations.ts +29 -1
- package/src/utils/fontGuard.ts +34 -0
- package/src/utils/haptics.ts +211 -9
- package/src/utils/pressable.ts +66 -0
- package/dist/chunk-76PFOSM2.mjs +0 -41
- package/dist/chunk-DITNP6PL.mjs +0 -106
- package/dist/chunk-JBLL7U3U.mjs +0 -64
- package/dist/chunk-LG4DO3DK.mjs +0 -174
- package/dist/chunk-RMMK64W5.mjs +0 -54
- package/dist/chunk-RTC3CFXF.mjs +0 -29
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React3 = require('react');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
|
+
var Animated = require('react-native-reanimated');
|
|
6
|
+
var AntDesign = require('@expo/vector-icons/AntDesign');
|
|
7
|
+
var Entypo = require('@expo/vector-icons/Entypo');
|
|
8
|
+
var Feather = require('@expo/vector-icons/Feather');
|
|
9
|
+
var FontAwesome5 = require('@expo/vector-icons/FontAwesome5');
|
|
10
|
+
var MaterialIcons = require('@expo/vector-icons/MaterialIcons');
|
|
11
|
+
var Ionicons = require('@expo/vector-icons/Ionicons');
|
|
12
|
+
var reactNativeSizeMatters = require('react-native-size-matters');
|
|
13
|
+
|
|
14
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
|
|
16
|
+
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
17
|
+
var Animated__default = /*#__PURE__*/_interopDefault(Animated);
|
|
18
|
+
var AntDesign__default = /*#__PURE__*/_interopDefault(AntDesign);
|
|
19
|
+
var Entypo__default = /*#__PURE__*/_interopDefault(Entypo);
|
|
20
|
+
var Feather__default = /*#__PURE__*/_interopDefault(Feather);
|
|
21
|
+
var FontAwesome5__default = /*#__PURE__*/_interopDefault(FontAwesome5);
|
|
22
|
+
var MaterialIcons__default = /*#__PURE__*/_interopDefault(MaterialIcons);
|
|
23
|
+
var Ionicons__default = /*#__PURE__*/_interopDefault(Ionicons);
|
|
24
|
+
|
|
25
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
26
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
27
|
+
}) : x)(function(x) {
|
|
28
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
29
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// src/theme/colorUtils.ts
|
|
33
|
+
function hexToRgb(hex) {
|
|
34
|
+
const clean = hex.replace("#", "");
|
|
35
|
+
const full = clean.length === 3 ? clean.split("").map((c) => c + c).join("") : clean;
|
|
36
|
+
if (full.length !== 6) return null;
|
|
37
|
+
return {
|
|
38
|
+
r: parseInt(full.slice(0, 2), 16),
|
|
39
|
+
g: parseInt(full.slice(2, 4), 16),
|
|
40
|
+
b: parseInt(full.slice(4, 6), 16)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function componentToHex(c) {
|
|
44
|
+
return Math.round(Math.max(0, Math.min(255, c))).toString(16).padStart(2, "0");
|
|
45
|
+
}
|
|
46
|
+
function rgbToHex(r, g, b) {
|
|
47
|
+
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
|
|
48
|
+
}
|
|
49
|
+
function withAlphaOnWhite(hex, alpha) {
|
|
50
|
+
const rgb = hexToRgb(hex);
|
|
51
|
+
if (!rgb) return hex;
|
|
52
|
+
const r = rgb.r * alpha + 255 * (1 - alpha);
|
|
53
|
+
const g = rgb.g * alpha + 255 * (1 - alpha);
|
|
54
|
+
const b = rgb.b * alpha + 255 * (1 - alpha);
|
|
55
|
+
return rgbToHex(r, g, b);
|
|
56
|
+
}
|
|
57
|
+
function withAlphaOnDark(hex, alpha, bgHex = "#0f0f0f") {
|
|
58
|
+
const rgb = hexToRgb(hex);
|
|
59
|
+
const bg = hexToRgb(bgHex);
|
|
60
|
+
if (!rgb || !bg) return hex;
|
|
61
|
+
const r = rgb.r * alpha + bg.r * (1 - alpha);
|
|
62
|
+
const g = rgb.g * alpha + bg.g * (1 - alpha);
|
|
63
|
+
const b = rgb.b * alpha + bg.b * (1 - alpha);
|
|
64
|
+
return rgbToHex(r, g, b);
|
|
65
|
+
}
|
|
66
|
+
function mixWithBackground(fgHex, bgHex, opacity) {
|
|
67
|
+
const fg = hexToRgb(fgHex);
|
|
68
|
+
const bg = hexToRgb(bgHex);
|
|
69
|
+
if (!fg || !bg) return fgHex;
|
|
70
|
+
const r = fg.r * opacity + bg.r * (1 - opacity);
|
|
71
|
+
const g = fg.g * opacity + bg.g * (1 - opacity);
|
|
72
|
+
const b = fg.b * opacity + bg.b * (1 - opacity);
|
|
73
|
+
return rgbToHex(r, g, b);
|
|
74
|
+
}
|
|
75
|
+
function lighten(hex, amount) {
|
|
76
|
+
return withAlphaOnWhite(hex, 1 - amount);
|
|
77
|
+
}
|
|
78
|
+
function darken(hex, amount) {
|
|
79
|
+
const rgb = hexToRgb(hex);
|
|
80
|
+
if (!rgb) return hex;
|
|
81
|
+
return rgbToHex(rgb.r * (1 - amount), rgb.g * (1 - amount), rgb.b * (1 - amount));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/theme/colors.ts
|
|
85
|
+
var defaultLight = {
|
|
86
|
+
background: "#ffffff",
|
|
87
|
+
foreground: "#1a1a1a",
|
|
88
|
+
card: "#ffffff",
|
|
89
|
+
primary: "#1a1a1a",
|
|
90
|
+
primaryForeground: "#ffffff",
|
|
91
|
+
// AUDIT FIX: brand accent — was undefined; falls back to primary when omitted
|
|
92
|
+
accent: "#d4561d",
|
|
93
|
+
accentForeground: "#ffffff",
|
|
94
|
+
border: "#dddddd",
|
|
95
|
+
// AUDIT FIX: was #e53935 (4.22:1 on white — fails AA); #c72828 = 5.59:1 ✓
|
|
96
|
+
destructive: "#c72828",
|
|
97
|
+
destructiveForeground: "#ffffff",
|
|
98
|
+
success: "#1a7a45",
|
|
99
|
+
successForeground: "#ffffff",
|
|
100
|
+
// AUDIT FIX: was #e67e00 (2.86:1 — severe fail); #9a5200 = 5.86:1 ✓ AAA-near
|
|
101
|
+
warning: "#9a5200",
|
|
102
|
+
warningForeground: "#ffffff"
|
|
103
|
+
};
|
|
104
|
+
function deriveColors(t, scheme) {
|
|
105
|
+
const dark = scheme === "dark";
|
|
106
|
+
const bg = t.background;
|
|
107
|
+
const foregroundSubtle = mixWithBackground(t.foreground, bg, 0.7);
|
|
108
|
+
const foregroundMuted = mixWithBackground(t.foreground, bg, 0.62);
|
|
109
|
+
const surface = dark ? lighten(bg, -0.06) : darken(bg, 0.04);
|
|
110
|
+
const surfaceStrong = dark ? lighten(bg, -0.12) : darken(bg, 0.08);
|
|
111
|
+
const destructiveTint = dark ? withAlphaOnDark(t.destructive, 0.15, bg) : withAlphaOnWhite(t.destructive, 0.08);
|
|
112
|
+
const destructiveBorder = dark ? withAlphaOnDark(t.destructive, 0.45, bg) : withAlphaOnWhite(t.destructive, 0.3);
|
|
113
|
+
const successTint = dark ? withAlphaOnDark(t.success, 0.15, bg) : withAlphaOnWhite(t.success, 0.08);
|
|
114
|
+
const successBorder = dark ? withAlphaOnDark(t.success, 0.45, bg) : withAlphaOnWhite(t.success, 0.3);
|
|
115
|
+
const warningTint = dark ? withAlphaOnDark(t.warning, 0.15, bg) : withAlphaOnWhite(t.warning, 0.08);
|
|
116
|
+
const warningBorder = dark ? withAlphaOnDark(t.warning, 0.45, bg) : withAlphaOnWhite(t.warning, 0.3);
|
|
117
|
+
return {
|
|
118
|
+
...t,
|
|
119
|
+
foregroundSubtle,
|
|
120
|
+
foregroundMuted,
|
|
121
|
+
surface,
|
|
122
|
+
surfaceStrong,
|
|
123
|
+
destructiveTint,
|
|
124
|
+
destructiveBorder,
|
|
125
|
+
successTint,
|
|
126
|
+
successBorder,
|
|
127
|
+
warningTint,
|
|
128
|
+
warningBorder,
|
|
129
|
+
overlay: t.overlay ?? "rgba(0,0,0,0.45)",
|
|
130
|
+
accentResolved: t.accent ?? t.primary,
|
|
131
|
+
accentForegroundResolved: t.accentForeground ?? t.primaryForeground,
|
|
132
|
+
ring: t.accent ?? t.primary,
|
|
133
|
+
input: t.border,
|
|
134
|
+
separator: dark ? lighten(t.border, 0.22) : darken(t.border, 0.16)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/theme/ThemeProvider.tsx
|
|
139
|
+
var ThemeContext = React3.createContext({
|
|
140
|
+
colors: deriveColors(defaultLight, "light"),
|
|
141
|
+
colorScheme: "light"
|
|
142
|
+
});
|
|
143
|
+
function useTheme() {
|
|
144
|
+
const context = React3.useContext(ThemeContext);
|
|
145
|
+
if (!context) {
|
|
146
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
147
|
+
}
|
|
148
|
+
return context;
|
|
149
|
+
}
|
|
150
|
+
var glyphMapOf = (mod) => mod.glyphMap ?? {};
|
|
151
|
+
var ALL_FAMILIES = [
|
|
152
|
+
{ name: "Ionicons", component: Ionicons__default.default, getGlyphMap: () => glyphMapOf(Ionicons__default.default) },
|
|
153
|
+
{ name: "MaterialIcons", component: MaterialIcons__default.default, getGlyphMap: () => glyphMapOf(MaterialIcons__default.default) },
|
|
154
|
+
{ name: "FontAwesome5", component: FontAwesome5__default.default, getGlyphMap: () => glyphMapOf(FontAwesome5__default.default) },
|
|
155
|
+
{ name: "Entypo", component: Entypo__default.default, getGlyphMap: () => glyphMapOf(Entypo__default.default) },
|
|
156
|
+
{ name: "AntDesign", component: AntDesign__default.default, getGlyphMap: () => glyphMapOf(AntDesign__default.default) },
|
|
157
|
+
{ name: "Feather", component: Feather__default.default, getGlyphMap: () => glyphMapOf(Feather__default.default) }
|
|
158
|
+
];
|
|
159
|
+
var activeFamilies = ALL_FAMILIES;
|
|
160
|
+
var resolvedCache = null;
|
|
161
|
+
function buildCache() {
|
|
162
|
+
const cache = /* @__PURE__ */ new Map();
|
|
163
|
+
for (const family of activeFamilies) {
|
|
164
|
+
const glyphMap = family.getGlyphMap();
|
|
165
|
+
for (const iconName of Object.keys(glyphMap)) {
|
|
166
|
+
cache.set(iconName, family);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return cache;
|
|
170
|
+
}
|
|
171
|
+
function resolveFamily(name) {
|
|
172
|
+
if (!resolvedCache) {
|
|
173
|
+
resolvedCache = buildCache();
|
|
174
|
+
}
|
|
175
|
+
return resolvedCache.get(name) ?? null;
|
|
176
|
+
}
|
|
177
|
+
function Icon({ name, size, color, family }) {
|
|
178
|
+
let resolved = null;
|
|
179
|
+
if (family) {
|
|
180
|
+
resolved = ALL_FAMILIES.find((f) => f.name === family) ?? null;
|
|
181
|
+
} else {
|
|
182
|
+
resolved = resolveFamily(name);
|
|
183
|
+
}
|
|
184
|
+
if (!resolved) return null;
|
|
185
|
+
const Component = resolved.component;
|
|
186
|
+
return React3__default.default.createElement(Component, { name, size, color });
|
|
187
|
+
}
|
|
188
|
+
function renderIcon(name, size, color) {
|
|
189
|
+
return React3__default.default.createElement(Icon, { name, size, color });
|
|
190
|
+
}
|
|
191
|
+
var SPRINGS = {
|
|
192
|
+
/** Tight, premium press feel — Buttons, Toggle, Tabs triggers. */
|
|
193
|
+
pressIn: { stiffness: 600, damping: 35, mass: 0.8 },
|
|
194
|
+
pressOut: { stiffness: 280, damping: 22, mass: 0.8 }};
|
|
195
|
+
({
|
|
196
|
+
/** Material-style ease-out — natural deceleration for state changes. */
|
|
197
|
+
standard: Animated.Easing.bezier(0.2, 0, 0, 1),
|
|
198
|
+
/** Strong ease-out for expanding surfaces (Accordion open). */
|
|
199
|
+
expand: Animated.Easing.bezier(0.23, 1, 0.32, 1),
|
|
200
|
+
/** Quick ease-in for collapsing. */
|
|
201
|
+
collapse: Animated.Easing.in(Animated.Easing.ease)
|
|
202
|
+
});
|
|
203
|
+
var PRESS_SCALE = {
|
|
204
|
+
button: 0.95,
|
|
205
|
+
chip: 0.94
|
|
206
|
+
};
|
|
207
|
+
function useHover() {
|
|
208
|
+
const [hovered, setHovered] = React3.useState(false);
|
|
209
|
+
const onMouseEnter = React3.useCallback(() => setHovered(true), []);
|
|
210
|
+
const onMouseLeave = React3.useCallback(() => setHovered(false), []);
|
|
211
|
+
if (reactNative.Platform.OS !== "web") {
|
|
212
|
+
return { hovered: false, hoverHandlers: {} };
|
|
213
|
+
}
|
|
214
|
+
return { hovered, hoverHandlers: { onMouseEnter, onMouseLeave } };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/utils/usePressScale.ts
|
|
218
|
+
function usePressScale({
|
|
219
|
+
pressScale = PRESS_SCALE.button,
|
|
220
|
+
hoverScale = 1.02,
|
|
221
|
+
pressInSpring = SPRINGS.pressIn,
|
|
222
|
+
pressOutSpring = SPRINGS.pressOut,
|
|
223
|
+
disabled = false
|
|
224
|
+
} = {}) {
|
|
225
|
+
const scale2 = Animated.useSharedValue(1);
|
|
226
|
+
const { hovered, hoverHandlers } = useHover();
|
|
227
|
+
const onPressIn = React3.useCallback(() => {
|
|
228
|
+
if (disabled) return;
|
|
229
|
+
scale2.value = Animated.withSpring(pressScale, pressInSpring);
|
|
230
|
+
}, [disabled, pressScale, pressInSpring, scale2]);
|
|
231
|
+
const onPressOut = React3.useCallback(() => {
|
|
232
|
+
if (disabled) return;
|
|
233
|
+
scale2.value = Animated.withSpring(1, pressOutSpring);
|
|
234
|
+
}, [disabled, pressOutSpring, scale2]);
|
|
235
|
+
const hoverActive = reactNative.Platform.OS === "web" && hovered && hoverScale !== 1 && !disabled;
|
|
236
|
+
const animatedStyle = Animated.useAnimatedStyle(() => ({
|
|
237
|
+
transform: [
|
|
238
|
+
{ scale: scale2.value * (hoverActive ? hoverScale : 1) }
|
|
239
|
+
]
|
|
240
|
+
}));
|
|
241
|
+
return {
|
|
242
|
+
animatedStyle,
|
|
243
|
+
onPressIn,
|
|
244
|
+
onPressOut,
|
|
245
|
+
hoverHandlers
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
var _haptics = null;
|
|
249
|
+
var _hapticsLoaded = false;
|
|
250
|
+
async function getHaptics() {
|
|
251
|
+
if (reactNative.Platform.OS === "web") return null;
|
|
252
|
+
if (!_hapticsLoaded) {
|
|
253
|
+
_hapticsLoaded = true;
|
|
254
|
+
try {
|
|
255
|
+
_haptics = await import('expo-haptics');
|
|
256
|
+
} catch {
|
|
257
|
+
_haptics = null;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return _haptics;
|
|
261
|
+
}
|
|
262
|
+
var _pulsar = null;
|
|
263
|
+
var _pulsarChecked = false;
|
|
264
|
+
var _pulsarAvailable = false;
|
|
265
|
+
function isPulsarNativeRegistered() {
|
|
266
|
+
try {
|
|
267
|
+
const g = globalThis;
|
|
268
|
+
if (typeof g.__turboModuleProxy === "function") {
|
|
269
|
+
return g.__turboModuleProxy("RNPulsar") != null;
|
|
270
|
+
}
|
|
271
|
+
return reactNative.NativeModules?.RNPulsar != null;
|
|
272
|
+
} catch {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function getPulsar() {
|
|
277
|
+
if (reactNative.Platform.OS === "web") return null;
|
|
278
|
+
if (!_pulsarChecked) {
|
|
279
|
+
_pulsarChecked = true;
|
|
280
|
+
try {
|
|
281
|
+
if (isPulsarNativeRegistered()) {
|
|
282
|
+
_pulsar = __require("react-native-pulsar");
|
|
283
|
+
_pulsarAvailable = true;
|
|
284
|
+
}
|
|
285
|
+
} catch {
|
|
286
|
+
_pulsar = null;
|
|
287
|
+
_pulsarAvailable = false;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return _pulsarAvailable ? _pulsar : null;
|
|
291
|
+
}
|
|
292
|
+
function selectionAsync() {
|
|
293
|
+
if (reactNative.Platform.OS === "web") return;
|
|
294
|
+
getHaptics().then((h) => {
|
|
295
|
+
if (h) {
|
|
296
|
+
h.selectionAsync();
|
|
297
|
+
} else {
|
|
298
|
+
getPulsar()?.Presets.System.selection();
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
var isWeb = reactNative.Platform.OS === "web";
|
|
303
|
+
var s = isWeb ? (n) => n : reactNativeSizeMatters.scale;
|
|
304
|
+
var vs = isWeb ? (n) => n : reactNativeSizeMatters.verticalScale;
|
|
305
|
+
var ms = isWeb ? (n, _factor) => n : reactNativeSizeMatters.moderateScale;
|
|
306
|
+
var mvs = isWeb ? (n, _factor) => n : reactNativeSizeMatters.moderateVerticalScale;
|
|
307
|
+
|
|
308
|
+
// src/tokens.ts
|
|
309
|
+
var RADIUS = {
|
|
310
|
+
md: 14};
|
|
311
|
+
|
|
312
|
+
// src/components/SelectableGrid/SelectableGrid.tsx
|
|
313
|
+
function isSelected(value, candidate) {
|
|
314
|
+
if (value == null) return false;
|
|
315
|
+
return Array.isArray(value) ? value.includes(candidate) : value === candidate;
|
|
316
|
+
}
|
|
317
|
+
function Cell({ item, selected, width, onPress }) {
|
|
318
|
+
const { colors } = useTheme();
|
|
319
|
+
const { animatedStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
320
|
+
pressScale: PRESS_SCALE.chip,
|
|
321
|
+
disabled: item.disabled
|
|
322
|
+
});
|
|
323
|
+
const iconColor = selected ? colors.primary : colors.foregroundSubtle;
|
|
324
|
+
const iconNode = item.icon ?? (item.iconName ? renderIcon(item.iconName, ms(24), iconColor) : null);
|
|
325
|
+
return /* @__PURE__ */ React3__default.default.createElement(Animated__default.default.View, { style: [{ width }, animatedStyle] }, /* @__PURE__ */ React3__default.default.createElement(
|
|
326
|
+
reactNative.TouchableOpacity,
|
|
327
|
+
{
|
|
328
|
+
onPress,
|
|
329
|
+
onPressIn,
|
|
330
|
+
onPressOut,
|
|
331
|
+
disabled: item.disabled,
|
|
332
|
+
activeOpacity: 1,
|
|
333
|
+
touchSoundDisabled: true,
|
|
334
|
+
accessibilityRole: "button",
|
|
335
|
+
accessibilityState: { selected, disabled: item.disabled },
|
|
336
|
+
accessibilityLabel: item.label ?? String(item.value),
|
|
337
|
+
...hoverHandlers,
|
|
338
|
+
style: [
|
|
339
|
+
styles.cell,
|
|
340
|
+
{
|
|
341
|
+
backgroundColor: selected ? colors.primary + "14" : colors.surface,
|
|
342
|
+
borderColor: selected ? colors.primary : "transparent"
|
|
343
|
+
},
|
|
344
|
+
item.disabled && styles.cellDisabled
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
iconNode,
|
|
348
|
+
item.label ? /* @__PURE__ */ React3__default.default.createElement(
|
|
349
|
+
reactNative.Text,
|
|
350
|
+
{
|
|
351
|
+
style: [styles.label, { color: selected ? colors.primary : colors.foreground }],
|
|
352
|
+
numberOfLines: 1,
|
|
353
|
+
allowFontScaling: true
|
|
354
|
+
},
|
|
355
|
+
item.label
|
|
356
|
+
) : null
|
|
357
|
+
));
|
|
358
|
+
}
|
|
359
|
+
function SelectableGrid({
|
|
360
|
+
items,
|
|
361
|
+
value,
|
|
362
|
+
onChange,
|
|
363
|
+
multiple = false,
|
|
364
|
+
numColumns = 4,
|
|
365
|
+
gap = 12,
|
|
366
|
+
orientation = "grid",
|
|
367
|
+
style
|
|
368
|
+
}) {
|
|
369
|
+
const [containerWidth, setContainerWidth] = React3.useState(0);
|
|
370
|
+
const gapPx = s(gap);
|
|
371
|
+
const cellWidth = containerWidth > 0 ? (containerWidth - gapPx * (numColumns - 1)) / numColumns - 0.5 : 0;
|
|
372
|
+
const horizCellWidth = s(72);
|
|
373
|
+
const handlePress = (item) => {
|
|
374
|
+
if (item.disabled) return;
|
|
375
|
+
selectionAsync();
|
|
376
|
+
onChange(item.value);
|
|
377
|
+
};
|
|
378
|
+
if (orientation === "horizontal") {
|
|
379
|
+
return /* @__PURE__ */ React3__default.default.createElement(
|
|
380
|
+
reactNative.ScrollView,
|
|
381
|
+
{
|
|
382
|
+
horizontal: true,
|
|
383
|
+
showsHorizontalScrollIndicator: false,
|
|
384
|
+
contentContainerStyle: [styles.horizontal, { gap: gapPx }, style],
|
|
385
|
+
accessibilityRole: multiple ? void 0 : "radiogroup"
|
|
386
|
+
},
|
|
387
|
+
items.map((item) => /* @__PURE__ */ React3__default.default.createElement(
|
|
388
|
+
Cell,
|
|
389
|
+
{
|
|
390
|
+
key: String(item.value),
|
|
391
|
+
item,
|
|
392
|
+
selected: isSelected(value, item.value),
|
|
393
|
+
width: horizCellWidth,
|
|
394
|
+
onPress: () => handlePress(item)
|
|
395
|
+
}
|
|
396
|
+
))
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
return /* @__PURE__ */ React3__default.default.createElement(
|
|
400
|
+
reactNative.View,
|
|
401
|
+
{
|
|
402
|
+
style: [styles.grid, { gap: gapPx }, style],
|
|
403
|
+
onLayout: (e) => setContainerWidth(e.nativeEvent.layout.width),
|
|
404
|
+
accessibilityRole: multiple ? void 0 : "radiogroup"
|
|
405
|
+
},
|
|
406
|
+
cellWidth > 0 ? items.map((item) => /* @__PURE__ */ React3__default.default.createElement(
|
|
407
|
+
Cell,
|
|
408
|
+
{
|
|
409
|
+
key: String(item.value),
|
|
410
|
+
item,
|
|
411
|
+
selected: isSelected(value, item.value),
|
|
412
|
+
width: cellWidth,
|
|
413
|
+
onPress: () => handlePress(item)
|
|
414
|
+
}
|
|
415
|
+
)) : null
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
var styles = reactNative.StyleSheet.create({
|
|
419
|
+
grid: {
|
|
420
|
+
flexDirection: "row",
|
|
421
|
+
flexWrap: "wrap"
|
|
422
|
+
},
|
|
423
|
+
horizontal: {
|
|
424
|
+
flexDirection: "row",
|
|
425
|
+
paddingHorizontal: s(4)
|
|
426
|
+
},
|
|
427
|
+
cell: {
|
|
428
|
+
flex: 1,
|
|
429
|
+
borderRadius: RADIUS.md,
|
|
430
|
+
borderWidth: 2,
|
|
431
|
+
alignItems: "center",
|
|
432
|
+
justifyContent: "center",
|
|
433
|
+
gap: vs(4),
|
|
434
|
+
paddingHorizontal: s(12),
|
|
435
|
+
paddingVertical: vs(12)
|
|
436
|
+
},
|
|
437
|
+
cellDisabled: {
|
|
438
|
+
opacity: 0.4
|
|
439
|
+
},
|
|
440
|
+
label: {
|
|
441
|
+
fontFamily: "Sohne-Medium",
|
|
442
|
+
fontSize: ms(12),
|
|
443
|
+
lineHeight: mvs(15),
|
|
444
|
+
textAlign: "center"
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
exports.SelectableGrid = SelectableGrid;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { SelectableGrid } from './chunk-NA7PARID.mjs';
|
|
2
|
+
import './chunk-YNROWHQJ.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/Separator.mjs
CHANGED
package/dist/Sheet.d.mts
CHANGED
|
@@ -67,11 +67,23 @@ interface SheetProps {
|
|
|
67
67
|
* When omitted, sheet uses dynamic sizing (auto-fits content).
|
|
68
68
|
*/
|
|
69
69
|
snapPoints?: (string | number)[];
|
|
70
|
+
/**
|
|
71
|
+
* When true, render as a centered modal dialog on wide screens (width ≥
|
|
72
|
+
* `BREAKPOINTS.wide`) instead of a bottom sheet. On narrow screens it stays a
|
|
73
|
+
* bottom sheet. Use for store/category/picker dialogs that should feel native
|
|
74
|
+
* on tablets and web.
|
|
75
|
+
*
|
|
76
|
+
* Note: the centered-dialog path uses a plain RN `Modal`, so `SheetTextInput`
|
|
77
|
+
* is not required there — use a regular `TextInput`.
|
|
78
|
+
*/
|
|
79
|
+
responsive?: boolean;
|
|
80
|
+
/** Max width of the centered dialog (dp). Only applies when `responsive`. Defaults to 480. */
|
|
81
|
+
dialogMaxWidth?: number;
|
|
70
82
|
}
|
|
71
83
|
declare function SheetHeader({ children, style }: SheetHeaderProps): React.JSX.Element;
|
|
72
84
|
declare function SheetContent({ children, style }: SheetContentProps): React.JSX.Element;
|
|
73
85
|
declare function SheetFooter({ children, style }: SheetFooterProps): React.JSX.Element;
|
|
74
|
-
declare function Sheet({ open, onClose, title, subtitle, description, showCloseButton, children, style, contentStyle, scrollable, maxHeight, keyboardBehavior, keyboardBlurBehavior, enableBlurKeyboardOnGesture, android_keyboardInputMode, footer, snapPoints, }: SheetProps): React.JSX.Element;
|
|
86
|
+
declare function Sheet({ open, onClose, title, subtitle, description, showCloseButton, children, style, contentStyle, scrollable, maxHeight, keyboardBehavior, keyboardBlurBehavior, enableBlurKeyboardOnGesture, android_keyboardInputMode, footer, snapPoints, responsive, dialogMaxWidth, }: SheetProps): React.JSX.Element;
|
|
75
87
|
declare namespace Sheet {
|
|
76
88
|
var Header: typeof SheetHeader;
|
|
77
89
|
var Content: typeof SheetContent;
|
package/dist/Sheet.d.ts
CHANGED
|
@@ -67,11 +67,23 @@ interface SheetProps {
|
|
|
67
67
|
* When omitted, sheet uses dynamic sizing (auto-fits content).
|
|
68
68
|
*/
|
|
69
69
|
snapPoints?: (string | number)[];
|
|
70
|
+
/**
|
|
71
|
+
* When true, render as a centered modal dialog on wide screens (width ≥
|
|
72
|
+
* `BREAKPOINTS.wide`) instead of a bottom sheet. On narrow screens it stays a
|
|
73
|
+
* bottom sheet. Use for store/category/picker dialogs that should feel native
|
|
74
|
+
* on tablets and web.
|
|
75
|
+
*
|
|
76
|
+
* Note: the centered-dialog path uses a plain RN `Modal`, so `SheetTextInput`
|
|
77
|
+
* is not required there — use a regular `TextInput`.
|
|
78
|
+
*/
|
|
79
|
+
responsive?: boolean;
|
|
80
|
+
/** Max width of the centered dialog (dp). Only applies when `responsive`. Defaults to 480. */
|
|
81
|
+
dialogMaxWidth?: number;
|
|
70
82
|
}
|
|
71
83
|
declare function SheetHeader({ children, style }: SheetHeaderProps): React.JSX.Element;
|
|
72
84
|
declare function SheetContent({ children, style }: SheetContentProps): React.JSX.Element;
|
|
73
85
|
declare function SheetFooter({ children, style }: SheetFooterProps): React.JSX.Element;
|
|
74
|
-
declare function Sheet({ open, onClose, title, subtitle, description, showCloseButton, children, style, contentStyle, scrollable, maxHeight, keyboardBehavior, keyboardBlurBehavior, enableBlurKeyboardOnGesture, android_keyboardInputMode, footer, snapPoints, }: SheetProps): React.JSX.Element;
|
|
86
|
+
declare function Sheet({ open, onClose, title, subtitle, description, showCloseButton, children, style, contentStyle, scrollable, maxHeight, keyboardBehavior, keyboardBlurBehavior, enableBlurKeyboardOnGesture, android_keyboardInputMode, footer, snapPoints, responsive, dialogMaxWidth, }: SheetProps): React.JSX.Element;
|
|
75
87
|
declare namespace Sheet {
|
|
76
88
|
var Header: typeof SheetHeader;
|
|
77
89
|
var Content: typeof SheetContent;
|
package/dist/Sheet.js
CHANGED
|
@@ -11,18 +11,65 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
11
11
|
|
|
12
12
|
var React2__default = /*#__PURE__*/_interopDefault(React2);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
15
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
16
|
+
}) : x)(function(x) {
|
|
17
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
18
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
19
|
+
});
|
|
15
20
|
var _haptics = null;
|
|
21
|
+
var _hapticsLoaded = false;
|
|
16
22
|
async function getHaptics() {
|
|
17
23
|
if (reactNative.Platform.OS === "web") return null;
|
|
18
|
-
if (!
|
|
19
|
-
|
|
24
|
+
if (!_hapticsLoaded) {
|
|
25
|
+
_hapticsLoaded = true;
|
|
26
|
+
try {
|
|
27
|
+
_haptics = await import('expo-haptics');
|
|
28
|
+
} catch {
|
|
29
|
+
_haptics = null;
|
|
30
|
+
}
|
|
20
31
|
}
|
|
21
32
|
return _haptics;
|
|
22
33
|
}
|
|
34
|
+
var _pulsar = null;
|
|
35
|
+
var _pulsarChecked = false;
|
|
36
|
+
var _pulsarAvailable = false;
|
|
37
|
+
function isPulsarNativeRegistered() {
|
|
38
|
+
try {
|
|
39
|
+
const g = globalThis;
|
|
40
|
+
if (typeof g.__turboModuleProxy === "function") {
|
|
41
|
+
return g.__turboModuleProxy("RNPulsar") != null;
|
|
42
|
+
}
|
|
43
|
+
return reactNative.NativeModules?.RNPulsar != null;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function getPulsar() {
|
|
49
|
+
if (reactNative.Platform.OS === "web") return null;
|
|
50
|
+
if (!_pulsarChecked) {
|
|
51
|
+
_pulsarChecked = true;
|
|
52
|
+
try {
|
|
53
|
+
if (isPulsarNativeRegistered()) {
|
|
54
|
+
_pulsar = __require("react-native-pulsar");
|
|
55
|
+
_pulsarAvailable = true;
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
_pulsar = null;
|
|
59
|
+
_pulsarAvailable = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return _pulsarAvailable ? _pulsar : null;
|
|
63
|
+
}
|
|
23
64
|
function impactMedium() {
|
|
24
65
|
if (reactNative.Platform.OS === "web") return;
|
|
25
|
-
getHaptics().then((h) =>
|
|
66
|
+
getHaptics().then((h) => {
|
|
67
|
+
if (h) {
|
|
68
|
+
h.impactAsync(h.ImpactFeedbackStyle.Medium);
|
|
69
|
+
} else {
|
|
70
|
+
getPulsar()?.Presets.System.impactMedium();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
26
73
|
}
|
|
27
74
|
|
|
28
75
|
// src/theme/colorUtils.ts
|
|
@@ -149,6 +196,22 @@ var vs = isWeb ? (n) => n : reactNativeSizeMatters.verticalScale;
|
|
|
149
196
|
var ms = isWeb ? (n, _factor) => n : reactNativeSizeMatters.moderateScale;
|
|
150
197
|
var mvs = isWeb ? (n, _factor) => n : reactNativeSizeMatters.moderateVerticalScale;
|
|
151
198
|
|
|
199
|
+
// src/tokens.ts
|
|
200
|
+
var RADIUS = {
|
|
201
|
+
lg: 20};
|
|
202
|
+
var SHADOWS = {
|
|
203
|
+
xl: {
|
|
204
|
+
shadowColor: "#000",
|
|
205
|
+
shadowOffset: { width: 0, height: 12 },
|
|
206
|
+
shadowOpacity: 0.24,
|
|
207
|
+
shadowRadius: 24,
|
|
208
|
+
elevation: 18
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
var BREAKPOINTS = {
|
|
212
|
+
wide: 700
|
|
213
|
+
};
|
|
214
|
+
|
|
152
215
|
// src/components/Sheet/Sheet.tsx
|
|
153
216
|
var SCREEN_HEIGHT = reactNative.Dimensions.get("window").height;
|
|
154
217
|
var DEFAULT_MAX_HEIGHT = SCREEN_HEIGHT * 0.85;
|
|
@@ -180,11 +243,15 @@ function Sheet({
|
|
|
180
243
|
enableBlurKeyboardOnGesture = true,
|
|
181
244
|
android_keyboardInputMode = "adjustPan",
|
|
182
245
|
footer,
|
|
183
|
-
snapPoints
|
|
246
|
+
snapPoints,
|
|
247
|
+
responsive = false,
|
|
248
|
+
dialogMaxWidth = 480
|
|
184
249
|
}) {
|
|
185
250
|
const { colors } = useTheme();
|
|
186
251
|
const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
252
|
+
const { width: windowWidth } = reactNative.useWindowDimensions();
|
|
187
253
|
const ref = React2.useRef(null);
|
|
254
|
+
const asDialog = responsive && windowWidth >= BREAKPOINTS.wide;
|
|
188
255
|
const effectiveKeyboardBehavior = keyboardBehavior ?? "interactive";
|
|
189
256
|
React2.useEffect(() => {
|
|
190
257
|
if (open) {
|
|
@@ -231,6 +298,31 @@ function Sheet({
|
|
|
231
298
|
if (!effectiveFooter) return null;
|
|
232
299
|
return /* @__PURE__ */ React2__default.default.createElement(bottomSheet.BottomSheetFooter, { ...props }, effectiveFooter);
|
|
233
300
|
}, [effectiveFooter]);
|
|
301
|
+
if (asDialog) {
|
|
302
|
+
return /* @__PURE__ */ React2__default.default.createElement(reactNative.Modal, { visible: open, transparent: true, animationType: "fade", onRequestClose: onClose }, /* @__PURE__ */ React2__default.default.createElement(reactNative.Pressable, { style: styles.dialogBackdrop, onPress: onClose, accessibilityRole: "button", accessibilityLabel: "Close" }, /* @__PURE__ */ React2__default.default.createElement(
|
|
303
|
+
reactNative.Pressable,
|
|
304
|
+
{
|
|
305
|
+
style: [
|
|
306
|
+
styles.dialogCard,
|
|
307
|
+
{ backgroundColor: colors.card, maxWidth: dialogMaxWidth, maxHeight: SCREEN_HEIGHT * 0.85 }
|
|
308
|
+
],
|
|
309
|
+
onPress: () => {
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
headerNode,
|
|
313
|
+
/* @__PURE__ */ React2__default.default.createElement(
|
|
314
|
+
reactNative.ScrollView,
|
|
315
|
+
{
|
|
316
|
+
contentContainerStyle: [styles.dialogContent, style],
|
|
317
|
+
style: contentStyle,
|
|
318
|
+
showsVerticalScrollIndicator: true,
|
|
319
|
+
bounces: false
|
|
320
|
+
},
|
|
321
|
+
contentNode
|
|
322
|
+
),
|
|
323
|
+
effectiveFooter
|
|
324
|
+
)));
|
|
325
|
+
}
|
|
234
326
|
const useScroll = scrollable || !!maxHeight;
|
|
235
327
|
const effectiveMaxHeight = maxHeight ?? DEFAULT_MAX_HEIGHT;
|
|
236
328
|
const useDynamicSizing = !snapPoints;
|
|
@@ -326,6 +418,24 @@ var styles = reactNative.StyleSheet.create({
|
|
|
326
418
|
borderTopWidth: 1,
|
|
327
419
|
flexDirection: "row",
|
|
328
420
|
gap: s(12)
|
|
421
|
+
},
|
|
422
|
+
dialogBackdrop: {
|
|
423
|
+
flex: 1,
|
|
424
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
425
|
+
alignItems: "center",
|
|
426
|
+
justifyContent: "center",
|
|
427
|
+
padding: s(24)
|
|
428
|
+
},
|
|
429
|
+
dialogCard: {
|
|
430
|
+
width: "100%",
|
|
431
|
+
borderRadius: RADIUS.lg,
|
|
432
|
+
paddingTop: vs(16),
|
|
433
|
+
overflow: "hidden",
|
|
434
|
+
...SHADOWS.xl
|
|
435
|
+
},
|
|
436
|
+
dialogContent: {
|
|
437
|
+
paddingHorizontal: s(16),
|
|
438
|
+
paddingBottom: vs(16)
|
|
329
439
|
}
|
|
330
440
|
});
|
|
331
441
|
|
package/dist/Sheet.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { BottomSheetModalProvider, Sheet, BottomSheetTextInput as SheetTextInput } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { BottomSheetModalProvider, Sheet, BottomSheetTextInput as SheetTextInput } from './chunk-PFZTM6D5.mjs';
|
|
2
|
+
import './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import './chunk-QY3X2UYR.mjs';
|
|
3
4
|
import './chunk-SOYNZDVY.mjs';
|
|
4
5
|
import './chunk-2CE3TQVY.mjs';
|
|
6
|
+
import './chunk-Y6FXYEAI.mjs';
|