@otfdashkit/ui-native 0.1.0 → 0.1.2
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/LICENSE +1 -1
- package/README.md +110 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +608 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +539 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +36 -3
package/dist/index.mjs
CHANGED
|
@@ -186,13 +186,13 @@ function getOtfDesignTheme(themeId) {
|
|
|
186
186
|
|
|
187
187
|
// src/index.ts
|
|
188
188
|
import {
|
|
189
|
-
View as
|
|
189
|
+
View as View15,
|
|
190
190
|
Stack,
|
|
191
191
|
SizableStack,
|
|
192
192
|
ThemeableStack,
|
|
193
193
|
Frame,
|
|
194
|
-
XStack as
|
|
195
|
-
YStack as
|
|
194
|
+
XStack as XStack52,
|
|
195
|
+
YStack as YStack58,
|
|
196
196
|
ZStack,
|
|
197
197
|
ScrollView as ScrollView7,
|
|
198
198
|
Circle as Circle13,
|
|
@@ -210,13 +210,13 @@ import {
|
|
|
210
210
|
Aside,
|
|
211
211
|
H1 as H12,
|
|
212
212
|
H2 as H22,
|
|
213
|
-
H3 as
|
|
214
|
-
H4 as
|
|
213
|
+
H3 as H34,
|
|
214
|
+
H4 as H43,
|
|
215
215
|
H5 as H52,
|
|
216
216
|
H6 as H62,
|
|
217
217
|
Heading,
|
|
218
218
|
Paragraph,
|
|
219
|
-
SizableText as
|
|
219
|
+
SizableText as SizableText57,
|
|
220
220
|
Text as Text2,
|
|
221
221
|
Label,
|
|
222
222
|
Button as Button13,
|
|
@@ -232,7 +232,7 @@ import {
|
|
|
232
232
|
Card as Card2,
|
|
233
233
|
Avatar as Avatar2,
|
|
234
234
|
Separator as Separator7,
|
|
235
|
-
Image as
|
|
235
|
+
Image as Image11,
|
|
236
236
|
Progress,
|
|
237
237
|
Spinner as Spinner2,
|
|
238
238
|
ListItem as ListItem2,
|
|
@@ -5881,6 +5881,528 @@ function useCollapsibleHeader(opts = {}) {
|
|
|
5881
5881
|
});
|
|
5882
5882
|
return { scrollHandler, headerStyle, titleStyle, scrollY };
|
|
5883
5883
|
}
|
|
5884
|
+
|
|
5885
|
+
// src/patterns/Shockwave/Shockwave.tsx
|
|
5886
|
+
import {
|
|
5887
|
+
createContext as createContext3,
|
|
5888
|
+
memo as memo2,
|
|
5889
|
+
useCallback as useCallback15,
|
|
5890
|
+
useContext as useContext3,
|
|
5891
|
+
useEffect as useEffect11,
|
|
5892
|
+
useMemo as useMemo7,
|
|
5893
|
+
useRef as useRef10,
|
|
5894
|
+
useState as useState23
|
|
5895
|
+
} from "react";
|
|
5896
|
+
import { StyleSheet, View as View12 } from "react-native";
|
|
5897
|
+
import {
|
|
5898
|
+
Canvas,
|
|
5899
|
+
Fill,
|
|
5900
|
+
ImageShader,
|
|
5901
|
+
Shader,
|
|
5902
|
+
Skia
|
|
5903
|
+
} from "@shopify/react-native-skia";
|
|
5904
|
+
import {
|
|
5905
|
+
Easing as Easing4,
|
|
5906
|
+
useDerivedValue,
|
|
5907
|
+
useSharedValue as useSharedValue7,
|
|
5908
|
+
withTiming as withTiming5
|
|
5909
|
+
} from "react-native-reanimated";
|
|
5910
|
+
import { scheduleOnRN } from "react-native-worklets";
|
|
5911
|
+
|
|
5912
|
+
// src/patterns/Shockwave/conf.ts
|
|
5913
|
+
var SHOCKWAVE_DEFAULTS = {
|
|
5914
|
+
WIDTH: 320,
|
|
5915
|
+
HEIGHT: 320,
|
|
5916
|
+
DURATION: 900,
|
|
5917
|
+
SHOCK_STRENGTH: 0.12,
|
|
5918
|
+
LENSING_SPREAD: 0.2
|
|
5919
|
+
};
|
|
5920
|
+
|
|
5921
|
+
// src/patterns/Shockwave/shader.ts
|
|
5922
|
+
var SHOCKWAVE_SHADER_SOURCE = `
|
|
5923
|
+
uniform float2 iResolution;
|
|
5924
|
+
uniform float iTime;
|
|
5925
|
+
uniform float2 iMouse;
|
|
5926
|
+
uniform float uShockStrength;
|
|
5927
|
+
uniform float uLensingSpread;
|
|
5928
|
+
uniform shader iChannel0;
|
|
5929
|
+
uniform shader iChannel1;
|
|
5930
|
+
|
|
5931
|
+
half4 main(float2 fragCoord) {
|
|
5932
|
+
float2 uv = fragCoord / iResolution;
|
|
5933
|
+
float2 origin = iMouse / iResolution;
|
|
5934
|
+
|
|
5935
|
+
float t = clamp(iTime, 0.0, 1.0);
|
|
5936
|
+
float radius = sqrt(2.0) * t;
|
|
5937
|
+
float circle = radius - distance(origin, uv);
|
|
5938
|
+
float factor = uShockStrength
|
|
5939
|
+
* sin(t * 3.14159265)
|
|
5940
|
+
* pow(clamp(1.0 - abs(circle), 0.0, 1.0), 20.0);
|
|
5941
|
+
|
|
5942
|
+
float2 delta = origin - uv;
|
|
5943
|
+
float2 dir = delta / (length(delta) + 1e-6);
|
|
5944
|
+
|
|
5945
|
+
float2 d0 = (uLensingSpread) * factor * dir * iResolution;
|
|
5946
|
+
float2 d1 = (uLensingSpread * 1.2) * factor * dir * iResolution;
|
|
5947
|
+
float2 d2 = (uLensingSpread * 1.5) * factor * dir * iResolution;
|
|
5948
|
+
|
|
5949
|
+
half4 a = half4(
|
|
5950
|
+
iChannel0.eval(fragCoord + d0).r,
|
|
5951
|
+
iChannel0.eval(fragCoord + d1).g,
|
|
5952
|
+
iChannel0.eval(fragCoord + d2).b,
|
|
5953
|
+
1.0
|
|
5954
|
+
);
|
|
5955
|
+
half4 b = half4(
|
|
5956
|
+
iChannel1.eval(fragCoord + d0).r,
|
|
5957
|
+
iChannel1.eval(fragCoord + d1).g,
|
|
5958
|
+
iChannel1.eval(fragCoord + d2).b,
|
|
5959
|
+
1.0
|
|
5960
|
+
);
|
|
5961
|
+
|
|
5962
|
+
half mixT = half(clamp(t + circle * 5.0, 0.0, 1.0));
|
|
5963
|
+
return mix(a, b, mixT);
|
|
5964
|
+
}
|
|
5965
|
+
`;
|
|
5966
|
+
|
|
5967
|
+
// src/patterns/Shockwave/utils.ts
|
|
5968
|
+
import { Platform as Platform5 } from "react-native";
|
|
5969
|
+
import { makeImageFromView } from "@shopify/react-native-skia";
|
|
5970
|
+
var webNoopCallback = () => Promise.resolve(null);
|
|
5971
|
+
async function snapshotPair(fromRef, toRef, prev, next) {
|
|
5972
|
+
const callback = Platform5.OS === "web" ? webNoopCallback : null;
|
|
5973
|
+
const fromImg = await makeImageFromView(
|
|
5974
|
+
fromRef,
|
|
5975
|
+
callback
|
|
5976
|
+
);
|
|
5977
|
+
const toImg = await makeImageFromView(
|
|
5978
|
+
toRef,
|
|
5979
|
+
callback
|
|
5980
|
+
);
|
|
5981
|
+
if (!fromImg || !toImg) return null;
|
|
5982
|
+
const fromSnapshot = prev === "from" ? fromImg : toImg;
|
|
5983
|
+
const toSnapshot = next === "from" ? fromImg : toImg;
|
|
5984
|
+
return { from: fromSnapshot, to: toSnapshot };
|
|
5985
|
+
}
|
|
5986
|
+
|
|
5987
|
+
// src/patterns/Shockwave/Shockwave.tsx
|
|
5988
|
+
import { jsx as jsx69, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
5989
|
+
var useShockwaveShader = () => {
|
|
5990
|
+
const [shader, setShader] = useState23(null);
|
|
5991
|
+
useEffect11(() => {
|
|
5992
|
+
let cancelled = false;
|
|
5993
|
+
let attempts = 0;
|
|
5994
|
+
let timer = null;
|
|
5995
|
+
const tryCompile = () => {
|
|
5996
|
+
if (cancelled) return;
|
|
5997
|
+
try {
|
|
5998
|
+
if (Skia?.RuntimeEffect?.Make) {
|
|
5999
|
+
const compiled = Skia.RuntimeEffect.Make(SHOCKWAVE_SHADER_SOURCE);
|
|
6000
|
+
if (compiled) {
|
|
6001
|
+
setShader(compiled);
|
|
6002
|
+
return;
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
} catch {
|
|
6006
|
+
}
|
|
6007
|
+
attempts += 1;
|
|
6008
|
+
if (attempts < 30) {
|
|
6009
|
+
timer = setTimeout(tryCompile, 80);
|
|
6010
|
+
}
|
|
6011
|
+
};
|
|
6012
|
+
tryCompile();
|
|
6013
|
+
return () => {
|
|
6014
|
+
cancelled = true;
|
|
6015
|
+
if (timer !== null) clearTimeout(timer);
|
|
6016
|
+
};
|
|
6017
|
+
}, []);
|
|
6018
|
+
return shader;
|
|
6019
|
+
};
|
|
6020
|
+
var ShockwaveContext = createContext3(null);
|
|
6021
|
+
var useShockwaveContext = () => {
|
|
6022
|
+
const ctx = useContext3(ShockwaveContext);
|
|
6023
|
+
if (!ctx) {
|
|
6024
|
+
throw new Error(
|
|
6025
|
+
"<Shockwave.Transition.From> / <Shockwave.Transition.To> must be rendered inside <Shockwave>"
|
|
6026
|
+
);
|
|
6027
|
+
}
|
|
6028
|
+
return ctx;
|
|
6029
|
+
};
|
|
6030
|
+
var OFFSCREEN_OFFSET = 1e5;
|
|
6031
|
+
var From = memo2(function From2({ children, style }) {
|
|
6032
|
+
const { fromRef, activeValue, isTransitioning } = useShockwaveContext();
|
|
6033
|
+
const isActive = activeValue === "from";
|
|
6034
|
+
return /* @__PURE__ */ jsx69(
|
|
6035
|
+
View12,
|
|
6036
|
+
{
|
|
6037
|
+
ref: fromRef,
|
|
6038
|
+
collapsable: false,
|
|
6039
|
+
pointerEvents: isActive && !isTransitioning ? "auto" : "none",
|
|
6040
|
+
style: [
|
|
6041
|
+
StyleSheet.absoluteFill,
|
|
6042
|
+
{
|
|
6043
|
+
zIndex: isActive ? 2 : 1,
|
|
6044
|
+
transform: [{ translateX: isActive ? 0 : OFFSCREEN_OFFSET }]
|
|
6045
|
+
},
|
|
6046
|
+
style
|
|
6047
|
+
],
|
|
6048
|
+
children
|
|
6049
|
+
}
|
|
6050
|
+
);
|
|
6051
|
+
});
|
|
6052
|
+
var To = memo2(function To2({ children, style }) {
|
|
6053
|
+
const { toRef, activeValue, isTransitioning } = useShockwaveContext();
|
|
6054
|
+
const isActive = activeValue === "to";
|
|
6055
|
+
return /* @__PURE__ */ jsx69(
|
|
6056
|
+
View12,
|
|
6057
|
+
{
|
|
6058
|
+
ref: toRef,
|
|
6059
|
+
collapsable: false,
|
|
6060
|
+
pointerEvents: isActive && !isTransitioning ? "auto" : "none",
|
|
6061
|
+
style: [
|
|
6062
|
+
StyleSheet.absoluteFill,
|
|
6063
|
+
{
|
|
6064
|
+
zIndex: isActive ? 2 : 1,
|
|
6065
|
+
transform: [{ translateX: isActive ? 0 : OFFSCREEN_OFFSET }]
|
|
6066
|
+
},
|
|
6067
|
+
style
|
|
6068
|
+
],
|
|
6069
|
+
children
|
|
6070
|
+
}
|
|
6071
|
+
);
|
|
6072
|
+
});
|
|
6073
|
+
var Transition = { From, To };
|
|
6074
|
+
var ShockwaveRoot = memo2(function ShockwaveRoot2({
|
|
6075
|
+
value,
|
|
6076
|
+
width = SHOCKWAVE_DEFAULTS.WIDTH,
|
|
6077
|
+
height = SHOCKWAVE_DEFAULTS.HEIGHT,
|
|
6078
|
+
duration = SHOCKWAVE_DEFAULTS.DURATION,
|
|
6079
|
+
origin,
|
|
6080
|
+
shockStrength = SHOCKWAVE_DEFAULTS.SHOCK_STRENGTH,
|
|
6081
|
+
lensingSpread = SHOCKWAVE_DEFAULTS.LENSING_SPREAD,
|
|
6082
|
+
style,
|
|
6083
|
+
children,
|
|
6084
|
+
onTransitionEnd
|
|
6085
|
+
}) {
|
|
6086
|
+
const fromRef = useRef10(null);
|
|
6087
|
+
const toRef = useRef10(null);
|
|
6088
|
+
const prevValueRef = useRef10(value);
|
|
6089
|
+
const shader = useShockwaveShader();
|
|
6090
|
+
const [activeValue, setActiveValue] = useState23(value);
|
|
6091
|
+
const [snapshots, setSnapshots] = useState23(null);
|
|
6092
|
+
const progress = useSharedValue7(0);
|
|
6093
|
+
const finishTransition = useCallback15(
|
|
6094
|
+
(next) => {
|
|
6095
|
+
setActiveValue(next);
|
|
6096
|
+
setSnapshots(null);
|
|
6097
|
+
onTransitionEnd?.(next);
|
|
6098
|
+
},
|
|
6099
|
+
[onTransitionEnd]
|
|
6100
|
+
);
|
|
6101
|
+
useEffect11(() => {
|
|
6102
|
+
if (value === prevValueRef.current) return;
|
|
6103
|
+
const prev = prevValueRef.current;
|
|
6104
|
+
const next = value;
|
|
6105
|
+
prevValueRef.current = value;
|
|
6106
|
+
let cancelled = false;
|
|
6107
|
+
void (async () => {
|
|
6108
|
+
const pair = await snapshotPair(
|
|
6109
|
+
fromRef,
|
|
6110
|
+
toRef,
|
|
6111
|
+
prev,
|
|
6112
|
+
next
|
|
6113
|
+
);
|
|
6114
|
+
if (cancelled) return;
|
|
6115
|
+
if (!pair) {
|
|
6116
|
+
setActiveValue(next);
|
|
6117
|
+
return;
|
|
6118
|
+
}
|
|
6119
|
+
setSnapshots(pair);
|
|
6120
|
+
progress.value = 0;
|
|
6121
|
+
progress.value = withTiming5(
|
|
6122
|
+
1,
|
|
6123
|
+
{ duration, easing: Easing4.linear },
|
|
6124
|
+
(done) => {
|
|
6125
|
+
if (done) scheduleOnRN(finishTransition, next);
|
|
6126
|
+
}
|
|
6127
|
+
);
|
|
6128
|
+
})();
|
|
6129
|
+
return () => {
|
|
6130
|
+
cancelled = true;
|
|
6131
|
+
};
|
|
6132
|
+
}, [value, duration, finishTransition, progress]);
|
|
6133
|
+
const ox = origin?.x ?? width / 2;
|
|
6134
|
+
const oy = origin?.y ?? height / 2;
|
|
6135
|
+
const uniforms = useDerivedValue(() => ({
|
|
6136
|
+
iResolution: [width, height],
|
|
6137
|
+
iTime: progress.value,
|
|
6138
|
+
iMouse: [ox, oy],
|
|
6139
|
+
uShockStrength: shockStrength,
|
|
6140
|
+
uLensingSpread: lensingSpread
|
|
6141
|
+
}));
|
|
6142
|
+
const ctxValue = useMemo7(
|
|
6143
|
+
() => ({
|
|
6144
|
+
fromRef,
|
|
6145
|
+
toRef,
|
|
6146
|
+
activeValue,
|
|
6147
|
+
isTransitioning: snapshots !== null
|
|
6148
|
+
}),
|
|
6149
|
+
[activeValue, snapshots]
|
|
6150
|
+
);
|
|
6151
|
+
return /* @__PURE__ */ jsxs58(View12, { style: [styles.wrapper, { width, height }, style], children: [
|
|
6152
|
+
/* @__PURE__ */ jsx69(ShockwaveContext.Provider, { value: ctxValue, children }),
|
|
6153
|
+
snapshots && shader ? /* @__PURE__ */ jsx69(
|
|
6154
|
+
Canvas,
|
|
6155
|
+
{
|
|
6156
|
+
style: [StyleSheet.absoluteFill, styles.canvasOverlay],
|
|
6157
|
+
pointerEvents: "none",
|
|
6158
|
+
children: /* @__PURE__ */ jsx69(Fill, { children: /* @__PURE__ */ jsxs58(Shader, { source: shader, uniforms, children: [
|
|
6159
|
+
/* @__PURE__ */ jsx69(
|
|
6160
|
+
ImageShader,
|
|
6161
|
+
{
|
|
6162
|
+
image: snapshots.from,
|
|
6163
|
+
fit: "cover",
|
|
6164
|
+
rect: { x: 0, y: 0, width, height }
|
|
6165
|
+
}
|
|
6166
|
+
),
|
|
6167
|
+
/* @__PURE__ */ jsx69(
|
|
6168
|
+
ImageShader,
|
|
6169
|
+
{
|
|
6170
|
+
image: snapshots.to,
|
|
6171
|
+
fit: "cover",
|
|
6172
|
+
rect: { x: 0, y: 0, width, height }
|
|
6173
|
+
}
|
|
6174
|
+
)
|
|
6175
|
+
] }) })
|
|
6176
|
+
}
|
|
6177
|
+
) : null
|
|
6178
|
+
] });
|
|
6179
|
+
});
|
|
6180
|
+
var styles = StyleSheet.create({
|
|
6181
|
+
wrapper: {
|
|
6182
|
+
position: "relative",
|
|
6183
|
+
overflow: "hidden",
|
|
6184
|
+
backgroundColor: "transparent"
|
|
6185
|
+
},
|
|
6186
|
+
canvasOverlay: {
|
|
6187
|
+
zIndex: 3
|
|
6188
|
+
}
|
|
6189
|
+
});
|
|
6190
|
+
var Shockwave = Object.assign(ShockwaveRoot, { Transition });
|
|
6191
|
+
|
|
6192
|
+
// src/patterns/StayCard/StayBrowseScreen.tsx
|
|
6193
|
+
import { Image as Image9, View as View13 } from "react-native";
|
|
6194
|
+
import {
|
|
6195
|
+
YStack as YStack56,
|
|
6196
|
+
XStack as XStack50,
|
|
6197
|
+
H3 as H32,
|
|
6198
|
+
H4 as H42,
|
|
6199
|
+
SizableText as SizableText55
|
|
6200
|
+
} from "tamagui";
|
|
6201
|
+
import { Bed, Bath, Heart, MapPin, Star } from "@tamagui/lucide-icons";
|
|
6202
|
+
import { jsx as jsx70, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
6203
|
+
var DEFAULT_CATEGORIES = [
|
|
6204
|
+
{ label: "Villa" },
|
|
6205
|
+
{ label: "Hotel", active: true },
|
|
6206
|
+
{ label: "Apartment" },
|
|
6207
|
+
{ label: "Campsite" }
|
|
6208
|
+
];
|
|
6209
|
+
function StayBrowseScreen({
|
|
6210
|
+
greeting = "Good morning",
|
|
6211
|
+
headline = "Unlock Your\nPerfect Stay Today!",
|
|
6212
|
+
categories = DEFAULT_CATEGORIES,
|
|
6213
|
+
listing,
|
|
6214
|
+
onFavorite,
|
|
6215
|
+
backgroundColor = "#fafaf9"
|
|
6216
|
+
}) {
|
|
6217
|
+
return /* @__PURE__ */ jsxs59(YStack56, { flex: 1, backgroundColor, padding: 18, gap: 14, children: [
|
|
6218
|
+
/* @__PURE__ */ jsxs59(YStack56, { gap: 4, marginTop: 28, children: [
|
|
6219
|
+
/* @__PURE__ */ jsx70(SizableText55, { size: "$2", color: "#737373", children: greeting }),
|
|
6220
|
+
/* @__PURE__ */ jsx70(H32, { color: "#0a0a0a", size: "$7", lineHeight: 28, children: headline })
|
|
6221
|
+
] }),
|
|
6222
|
+
/* @__PURE__ */ jsx70(XStack50, { gap: 8, flexWrap: "wrap", children: categories.map((c) => /* @__PURE__ */ jsx70(
|
|
6223
|
+
View13,
|
|
6224
|
+
{
|
|
6225
|
+
onTouchEnd: c.onPress,
|
|
6226
|
+
style: {
|
|
6227
|
+
paddingHorizontal: 12,
|
|
6228
|
+
paddingVertical: 6,
|
|
6229
|
+
borderRadius: 999,
|
|
6230
|
+
backgroundColor: c.active ? "#d9f99d" : "#f4f4f5"
|
|
6231
|
+
},
|
|
6232
|
+
children: /* @__PURE__ */ jsx70(
|
|
6233
|
+
SizableText55,
|
|
6234
|
+
{
|
|
6235
|
+
size: "$2",
|
|
6236
|
+
color: c.active ? "#365314" : "#52525b",
|
|
6237
|
+
fontWeight: "600",
|
|
6238
|
+
children: c.label
|
|
6239
|
+
}
|
|
6240
|
+
)
|
|
6241
|
+
},
|
|
6242
|
+
c.label
|
|
6243
|
+
)) }),
|
|
6244
|
+
/* @__PURE__ */ jsxs59(
|
|
6245
|
+
YStack56,
|
|
6246
|
+
{
|
|
6247
|
+
flex: 1,
|
|
6248
|
+
borderRadius: 20,
|
|
6249
|
+
overflow: "hidden",
|
|
6250
|
+
backgroundColor: "#e7e5e4",
|
|
6251
|
+
marginTop: 4,
|
|
6252
|
+
children: [
|
|
6253
|
+
/* @__PURE__ */ jsx70(
|
|
6254
|
+
Image9,
|
|
6255
|
+
{
|
|
6256
|
+
source: { uri: listing.image },
|
|
6257
|
+
style: { width: "100%", height: "60%" },
|
|
6258
|
+
resizeMode: "cover"
|
|
6259
|
+
}
|
|
6260
|
+
),
|
|
6261
|
+
/* @__PURE__ */ jsxs59(YStack56, { flex: 1, padding: 14, gap: 8, children: [
|
|
6262
|
+
/* @__PURE__ */ jsxs59(XStack50, { alignItems: "center", justifyContent: "space-between", children: [
|
|
6263
|
+
/* @__PURE__ */ jsx70(H42, { color: "#0a0a0a", size: "$5", children: listing.title }),
|
|
6264
|
+
/* @__PURE__ */ jsx70(View13, { onTouchEnd: onFavorite, children: /* @__PURE__ */ jsx70(Heart, { size: 18, color: "#ef4444" }) })
|
|
6265
|
+
] }),
|
|
6266
|
+
/* @__PURE__ */ jsxs59(XStack50, { alignItems: "center", gap: 4, children: [
|
|
6267
|
+
/* @__PURE__ */ jsx70(MapPin, { size: 12, color: "#737373" }),
|
|
6268
|
+
/* @__PURE__ */ jsx70(SizableText55, { size: "$1", color: "#737373", children: listing.address })
|
|
6269
|
+
] }),
|
|
6270
|
+
/* @__PURE__ */ jsxs59(XStack50, { gap: 14, marginTop: 6, children: [
|
|
6271
|
+
typeof listing.bed === "number" ? /* @__PURE__ */ jsxs59(XStack50, { alignItems: "center", gap: 4, children: [
|
|
6272
|
+
/* @__PURE__ */ jsx70(Bed, { size: 14, color: "#737373" }),
|
|
6273
|
+
/* @__PURE__ */ jsxs59(SizableText55, { size: "$1", color: "#525252", children: [
|
|
6274
|
+
"Bed: ",
|
|
6275
|
+
listing.bed
|
|
6276
|
+
] })
|
|
6277
|
+
] }) : null,
|
|
6278
|
+
typeof listing.bath === "number" ? /* @__PURE__ */ jsxs59(XStack50, { alignItems: "center", gap: 4, children: [
|
|
6279
|
+
/* @__PURE__ */ jsx70(Bath, { size: 14, color: "#737373" }),
|
|
6280
|
+
/* @__PURE__ */ jsxs59(SizableText55, { size: "$1", color: "#525252", children: [
|
|
6281
|
+
"Bath: ",
|
|
6282
|
+
listing.bath
|
|
6283
|
+
] })
|
|
6284
|
+
] }) : null,
|
|
6285
|
+
typeof listing.rating === "number" ? /* @__PURE__ */ jsxs59(XStack50, { alignItems: "center", gap: 4, children: [
|
|
6286
|
+
/* @__PURE__ */ jsx70(Star, { size: 14, color: "#f59e0b", fill: "#f59e0b" }),
|
|
6287
|
+
/* @__PURE__ */ jsx70(SizableText55, { size: "$1", color: "#525252", children: listing.rating.toFixed(1) })
|
|
6288
|
+
] }) : null
|
|
6289
|
+
] })
|
|
6290
|
+
] })
|
|
6291
|
+
]
|
|
6292
|
+
}
|
|
6293
|
+
)
|
|
6294
|
+
] });
|
|
6295
|
+
}
|
|
6296
|
+
|
|
6297
|
+
// src/patterns/StayCard/StayDetailScreen.tsx
|
|
6298
|
+
import { Image as Image10, View as View14 } from "react-native";
|
|
6299
|
+
import { YStack as YStack57, XStack as XStack51, H3 as H33, SizableText as SizableText56 } from "tamagui";
|
|
6300
|
+
import { Bed as Bed2, Bath as Bath2, Star as Star2, Wifi } from "@tamagui/lucide-icons";
|
|
6301
|
+
import { jsx as jsx71, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
6302
|
+
var formatPrice = (n) => "$" + n.toLocaleString("en-US", { maximumFractionDigits: 0 });
|
|
6303
|
+
var buildDefaultMetrics = (props) => {
|
|
6304
|
+
const out = [];
|
|
6305
|
+
if (typeof props.listing.sqft === "number") {
|
|
6306
|
+
out.push({
|
|
6307
|
+
label: "Living",
|
|
6308
|
+
value: `${props.listing.sqft} sqft`
|
|
6309
|
+
});
|
|
6310
|
+
} else if (typeof props.listing.bed === "number") {
|
|
6311
|
+
out.push({
|
|
6312
|
+
label: "Beds",
|
|
6313
|
+
icon: /* @__PURE__ */ jsx71(Bed2, { size: 14, color: "#fafaf9" }),
|
|
6314
|
+
value: props.listing.bed
|
|
6315
|
+
});
|
|
6316
|
+
}
|
|
6317
|
+
if (typeof props.listing.bath === "number") {
|
|
6318
|
+
out.push({
|
|
6319
|
+
label: "Baths",
|
|
6320
|
+
icon: /* @__PURE__ */ jsx71(Bath2, { size: 14, color: "#fafaf9" }),
|
|
6321
|
+
value: props.listing.bath
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
out.push({
|
|
6325
|
+
label: "Wifi",
|
|
6326
|
+
icon: /* @__PURE__ */ jsx71(Wifi, { size: 14, color: "#fafaf9" }),
|
|
6327
|
+
value: "Fast"
|
|
6328
|
+
});
|
|
6329
|
+
return out;
|
|
6330
|
+
};
|
|
6331
|
+
function StayDetailScreen(props) {
|
|
6332
|
+
const {
|
|
6333
|
+
listing,
|
|
6334
|
+
metrics,
|
|
6335
|
+
eyebrow = "BOOKING DETAILS",
|
|
6336
|
+
ctaLabel = "Reserve now",
|
|
6337
|
+
onReserve,
|
|
6338
|
+
backgroundColor = "#0a0a0a",
|
|
6339
|
+
ctaColor = "#f97316"
|
|
6340
|
+
} = props;
|
|
6341
|
+
const resolvedMetrics = metrics ?? buildDefaultMetrics(props);
|
|
6342
|
+
return /* @__PURE__ */ jsxs60(YStack57, { flex: 1, backgroundColor, children: [
|
|
6343
|
+
/* @__PURE__ */ jsxs60(View14, { style: { position: "relative", height: "50%" }, children: [
|
|
6344
|
+
/* @__PURE__ */ jsx71(
|
|
6345
|
+
Image10,
|
|
6346
|
+
{
|
|
6347
|
+
source: { uri: listing.image },
|
|
6348
|
+
style: { width: "100%", height: "100%" },
|
|
6349
|
+
resizeMode: "cover"
|
|
6350
|
+
}
|
|
6351
|
+
),
|
|
6352
|
+
typeof listing.rating === "number" ? /* @__PURE__ */ jsxs60(
|
|
6353
|
+
View14,
|
|
6354
|
+
{
|
|
6355
|
+
style: {
|
|
6356
|
+
position: "absolute",
|
|
6357
|
+
top: 36,
|
|
6358
|
+
right: 18,
|
|
6359
|
+
backgroundColor: "rgba(255,255,255,0.92)",
|
|
6360
|
+
paddingHorizontal: 10,
|
|
6361
|
+
paddingVertical: 6,
|
|
6362
|
+
borderRadius: 999,
|
|
6363
|
+
flexDirection: "row",
|
|
6364
|
+
alignItems: "center",
|
|
6365
|
+
gap: 4
|
|
6366
|
+
},
|
|
6367
|
+
children: [
|
|
6368
|
+
/* @__PURE__ */ jsx71(Star2, { size: 12, color: "#f59e0b", fill: "#f59e0b" }),
|
|
6369
|
+
/* @__PURE__ */ jsx71(SizableText56, { size: "$1", color: "#0a0a0a", fontWeight: "700", children: listing.rating.toFixed(1) })
|
|
6370
|
+
]
|
|
6371
|
+
}
|
|
6372
|
+
) : null
|
|
6373
|
+
] }),
|
|
6374
|
+
/* @__PURE__ */ jsxs60(YStack57, { flex: 1, padding: 18, gap: 10, children: [
|
|
6375
|
+
/* @__PURE__ */ jsx71(SizableText56, { size: "$2", color: "#a3a3a3", children: eyebrow }),
|
|
6376
|
+
typeof listing.pricePerNight === "number" ? /* @__PURE__ */ jsxs60(H33, { color: "#fafaf9", size: "$7", children: [
|
|
6377
|
+
formatPrice(listing.pricePerNight),
|
|
6378
|
+
"/night"
|
|
6379
|
+
] }) : /* @__PURE__ */ jsx71(H33, { color: "#fafaf9", size: "$7", children: listing.title }),
|
|
6380
|
+
/* @__PURE__ */ jsxs60(SizableText56, { size: "$2", color: "#a3a3a3", children: [
|
|
6381
|
+
listing.ownerName ? listing.ownerName + " \xB7 " : "",
|
|
6382
|
+
listing.address
|
|
6383
|
+
] }),
|
|
6384
|
+
/* @__PURE__ */ jsx71(XStack51, { gap: 20, marginTop: 6, children: resolvedMetrics.map((m, i) => /* @__PURE__ */ jsxs60(YStack57, { gap: 2, children: [
|
|
6385
|
+
/* @__PURE__ */ jsx71(SizableText56, { size: "$1", color: "#737373", children: m.label }),
|
|
6386
|
+
m.icon ? /* @__PURE__ */ jsxs60(XStack51, { alignItems: "center", gap: 4, children: [
|
|
6387
|
+
m.icon,
|
|
6388
|
+
/* @__PURE__ */ jsx71(SizableText56, { size: "$3", color: "#fafaf9", fontWeight: "600", children: m.value })
|
|
6389
|
+
] }) : /* @__PURE__ */ jsx71(SizableText56, { size: "$3", color: "#fafaf9", fontWeight: "600", children: m.value })
|
|
6390
|
+
] }, i)) }),
|
|
6391
|
+
/* @__PURE__ */ jsx71(
|
|
6392
|
+
YStack57,
|
|
6393
|
+
{
|
|
6394
|
+
marginTop: "auto",
|
|
6395
|
+
padding: 14,
|
|
6396
|
+
borderRadius: 14,
|
|
6397
|
+
backgroundColor: ctaColor,
|
|
6398
|
+
alignItems: "center",
|
|
6399
|
+
onPress: onReserve,
|
|
6400
|
+
children: /* @__PURE__ */ jsx71(SizableText56, { size: "$3", color: "#fff", fontWeight: "700", children: ctaLabel })
|
|
6401
|
+
}
|
|
6402
|
+
)
|
|
6403
|
+
] })
|
|
6404
|
+
] });
|
|
6405
|
+
}
|
|
5884
6406
|
export {
|
|
5885
6407
|
Accordion,
|
|
5886
6408
|
ActionSheet,
|
|
@@ -5933,8 +6455,8 @@ export {
|
|
|
5933
6455
|
Group,
|
|
5934
6456
|
H12 as H1,
|
|
5935
6457
|
H22 as H2,
|
|
5936
|
-
|
|
5937
|
-
|
|
6458
|
+
H34 as H3,
|
|
6459
|
+
H43 as H4,
|
|
5938
6460
|
H52 as H5,
|
|
5939
6461
|
H62 as H6,
|
|
5940
6462
|
Header,
|
|
@@ -6003,8 +6525,9 @@ export {
|
|
|
6003
6525
|
Separator7 as Separator,
|
|
6004
6526
|
SettingsScreen,
|
|
6005
6527
|
Sheet5 as Sheet,
|
|
6528
|
+
Shockwave,
|
|
6006
6529
|
SizableStack,
|
|
6007
|
-
|
|
6530
|
+
SizableText57 as SizableText,
|
|
6008
6531
|
Skeleton,
|
|
6009
6532
|
Slider2 as Slider,
|
|
6010
6533
|
Spacer,
|
|
@@ -6012,6 +6535,8 @@ export {
|
|
|
6012
6535
|
Square,
|
|
6013
6536
|
Stack,
|
|
6014
6537
|
StatusBadge,
|
|
6538
|
+
StayBrowseScreen,
|
|
6539
|
+
StayDetailScreen,
|
|
6015
6540
|
Step,
|
|
6016
6541
|
StepPageLayout,
|
|
6017
6542
|
SubHeading,
|
|
@@ -6020,7 +6545,7 @@ export {
|
|
|
6020
6545
|
Switch4 as Switch,
|
|
6021
6546
|
TabBar,
|
|
6022
6547
|
Tabs,
|
|
6023
|
-
|
|
6548
|
+
Image11 as TamaguiImage,
|
|
6024
6549
|
ListItem2 as TamaguiListItem,
|
|
6025
6550
|
TamaguiProvider,
|
|
6026
6551
|
TestimonialCard2 as TestimonialCard,
|
|
@@ -6033,13 +6558,13 @@ export {
|
|
|
6033
6558
|
TooltipSimple,
|
|
6034
6559
|
Unspaced,
|
|
6035
6560
|
UserPreferences,
|
|
6036
|
-
|
|
6561
|
+
View15 as View,
|
|
6037
6562
|
VisuallyHidden,
|
|
6038
6563
|
WheelPicker,
|
|
6039
6564
|
XGroup,
|
|
6040
|
-
|
|
6565
|
+
XStack52 as XStack,
|
|
6041
6566
|
YGroup,
|
|
6042
|
-
|
|
6567
|
+
YStack58 as YStack,
|
|
6043
6568
|
ZStack,
|
|
6044
6569
|
addTheme,
|
|
6045
6570
|
composeEventHandlers,
|