@ohmyteeth/react-native-line-flex-message-renderer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ import { Action } from "@ohmyteeth/line-flex-message-renderer-core";
2
+ //#region src/renderer.d.ts
3
+ type FlexMessageRendererProps = {
4
+ /**
5
+ * A JSON string representing the Flex Message to be rendered.
6
+ */
7
+ json: string;
8
+ onAction?: (action: Action) => void;
9
+ };
10
+ declare const FlexMessageRenderer: ({ json, onAction }: FlexMessageRendererProps) => import("react").JSX.Element;
11
+ //#endregion
12
+ export { FlexMessageRenderer };
13
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/renderer.tsx"],"mappings":";;KASK;;;;EAIH;EAEA,YAAY,QAAQ;;cAGT,wBAAmB,MAAA,YAAwB,6CAAwB,IAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,490 @@
1
+ import { getActualNumericSize, getActualSize, getBorderRadius, getBorderWidth, getButtonHeight, getIconSize, getImageSize, getMarginSize, getOffset, getPaddingSize, getSpacingSize, registerComponents, renderComponent } from "@ohmyteeth/line-flex-message-renderer-core";
2
+ import { Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from "react-native";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import React, { useCallback, useMemo, useState } from "react";
5
+ //#region src/components/filler.tsx
6
+ const Filler = ({ flex }) => {
7
+ return /* @__PURE__ */ jsx(View, { style: {
8
+ flexGrow: 1,
9
+ flexShrink: 0,
10
+ flexBasis: 0,
11
+ flex
12
+ } });
13
+ };
14
+ //#endregion
15
+ //#region src/hooks/useParentFlexDirection.tsx
16
+ const ParentFlexDirectionContext = React.createContext("column");
17
+ const ParentFlexDirectionProvider = ({ children, direction }) => {
18
+ return /* @__PURE__ */ jsx(ParentFlexDirectionContext.Provider, {
19
+ value: direction,
20
+ children
21
+ });
22
+ };
23
+ const useParentFlexDirection = () => {
24
+ return React.useContext(ParentFlexDirectionContext);
25
+ };
26
+ //#endregion
27
+ //#region src/components/icon.tsx
28
+ const Icon = ({ url, margin, position, offsetTop, offsetBottom, offsetStart, offsetEnd, size, scaling, aspectRatio }) => {
29
+ const parentDirection = useParentFlexDirection();
30
+ const width = getActualSize(getIconSize(size ?? "md"));
31
+ const marginSize = getActualSize(getMarginSize(margin));
32
+ return /* @__PURE__ */ jsx(View, {
33
+ style: {
34
+ width,
35
+ flexShrink: 0,
36
+ ...parentDirection === "column" ? { marginTop: marginSize } : { marginLeft: marginSize }
37
+ },
38
+ children: /* @__PURE__ */ jsx(Image, {
39
+ style: {
40
+ aspectRatio: aspectRatio?.split(":").join("/") ?? "1",
41
+ top: getActualSize(getOffset(offsetTop)),
42
+ bottom: getActualSize(getOffset(offsetBottom)),
43
+ left: getActualSize(getOffset(offsetStart)),
44
+ right: getActualSize(getOffset(offsetEnd)),
45
+ position: position === void 0 ? "relative" : position
46
+ },
47
+ source: { uri: url }
48
+ })
49
+ });
50
+ };
51
+ //#endregion
52
+ //#region src/containers/bubble.tsx
53
+ const Bubble = ({ body, direction, footer, header, hero, size, style, action, onClick, containerStyle, onLayout }) => {
54
+ const hasHero = !!hero;
55
+ const hasFooter = !!footer;
56
+ const hasHeader = !!header;
57
+ const handleClick = () => {
58
+ if (action) onClick?.(action);
59
+ };
60
+ const inner = {
61
+ ...Styles$1.bubbleInner,
62
+ ...containerStyle !== void 0 && { flexGrow: 1 },
63
+ ...size === "nano" && Styles$1.nanoInner,
64
+ ...size === "micro" && Styles$1.microInner,
65
+ ...size === "deca" && Styles$1.decaInner,
66
+ ...size === "hecto" && Styles$1.hectoInner,
67
+ ...size === "kilo" && Styles$1.kiloInner,
68
+ ...size === "mega" && Styles$1.megaInner,
69
+ ...size === "giga" && Styles$1.gigaInner
70
+ };
71
+ return /* @__PURE__ */ jsx(TouchableOpacity, {
72
+ style: [{
73
+ ...Styles$1.bubble,
74
+ ...Styles$1[size ?? "mega"]
75
+ }, containerStyle],
76
+ onPress: handleClick,
77
+ onLayout,
78
+ children: /* @__PURE__ */ jsxs(View, {
79
+ style: inner,
80
+ children: [
81
+ header && /* @__PURE__ */ jsx(View, {
82
+ style: {
83
+ backgroundColor: style?.header?.backgroundColor ?? "#fff",
84
+ borderBottomWidth: style?.header?.separator ? 1 : 0,
85
+ borderColor: style?.header?.separatorColor ?? "#000"
86
+ },
87
+ children: renderComponent(header, onClick)
88
+ }),
89
+ hero && /* @__PURE__ */ jsx(View, {
90
+ style: { backgroundColor: style?.hero?.backgroundColor ?? "#fff" },
91
+ children: renderComponent(hero, onClick)
92
+ }),
93
+ body && /* @__PURE__ */ jsx(View, {
94
+ style: {
95
+ ...Styles$1.body,
96
+ ...hasHeader && !body.paddingAll && Styles$1.bodyWithHeader,
97
+ ...hasHero && size !== "micro" && Styles$1.bodyWithHero,
98
+ ...hasFooter && Styles$1.bodyWithFooter,
99
+ ...!body.paddingAll && Styles$1.withPadding,
100
+ backgroundColor: style?.body?.backgroundColor ?? "#fff"
101
+ },
102
+ children: renderComponent(body, onClick)
103
+ }),
104
+ footer && /* @__PURE__ */ jsx(View, {
105
+ style: {
106
+ ...Styles$1.footer,
107
+ backgroundColor: style?.footer?.backgroundColor ?? "#fff",
108
+ borderTopWidth: style?.footer?.separator ? 1 : 0,
109
+ borderColor: style?.footer?.separatorColor ?? "#000"
110
+ },
111
+ children: renderComponent(footer, onClick)
112
+ })
113
+ ]
114
+ })
115
+ });
116
+ };
117
+ const Styles$1 = StyleSheet.create({
118
+ bubble: {
119
+ flexDirection: "column",
120
+ width: "100%"
121
+ },
122
+ bubbleInner: {
123
+ flexDirection: "column",
124
+ overflow: "hidden",
125
+ borderRadius: 10
126
+ },
127
+ nano: {
128
+ width: 120,
129
+ maxWidth: 120
130
+ },
131
+ nanoInner: { borderRadius: 10 },
132
+ micro: {
133
+ width: 160,
134
+ maxWidth: 160
135
+ },
136
+ microInner: { borderRadius: 10 },
137
+ deca: {
138
+ width: 220,
139
+ maxWidth: 220
140
+ },
141
+ decaInner: { borderRadius: 10 },
142
+ hecto: {
143
+ width: 241,
144
+ maxWidth: 241
145
+ },
146
+ hectoInner: { borderRadius: 10 },
147
+ kilo: {
148
+ width: 260,
149
+ maxWidth: 260
150
+ },
151
+ kiloInner: { borderRadius: 10 },
152
+ mega: {
153
+ width: 300,
154
+ maxWidth: 300
155
+ },
156
+ megaInner: { borderRadius: 17 },
157
+ giga: {
158
+ width: 340,
159
+ maxWidth: 340
160
+ },
161
+ gigaInner: { borderRadius: 5 },
162
+ body: { flexGrow: 1 },
163
+ withPadding: { padding: 20 },
164
+ bodyWithHeader: { padding: 20 },
165
+ bodyWithHero: { padding: 20 },
166
+ bodyWithFooter: { paddingBottom: 10 },
167
+ footer: { padding: 10 }
168
+ });
169
+ //#endregion
170
+ //#region src/containers/carousel.tsx
171
+ const Carousel = ({ contents, onClick }) => {
172
+ const [heights, setHeights] = useState({});
173
+ const measured = Object.keys(heights).length === contents.length;
174
+ const maxHeight = measured ? Math.max(...Object.values(heights)) : void 0;
175
+ const handleLayout = useCallback((index, event) => {
176
+ const { height } = event.nativeEvent.layout;
177
+ setHeights((prev) => prev[index] === height ? prev : {
178
+ ...prev,
179
+ [index]: height
180
+ });
181
+ }, []);
182
+ return /* @__PURE__ */ jsx(ScrollView, {
183
+ horizontal: true,
184
+ contentContainerStyle: Styles.carousel,
185
+ children: contents.map((bubble, index) => /* @__PURE__ */ jsx(Bubble, {
186
+ ...bubble,
187
+ onClick,
188
+ containerStyle: maxHeight !== void 0 ? { height: maxHeight } : void 0,
189
+ onLayout: measured ? void 0 : (event) => handleLayout(index, event)
190
+ }, index))
191
+ });
192
+ };
193
+ const Styles = StyleSheet.create({ carousel: {
194
+ flexDirection: "row",
195
+ columnGap: 20,
196
+ alignItems: "flex-start"
197
+ } });
198
+ //#endregion
199
+ //#region src/renderer.tsx
200
+ const FlexMessageRenderer = ({ json, onAction }) => {
201
+ const data = useMemo(() => {
202
+ return JSON.parse(json);
203
+ }, [json]);
204
+ const handleClick = useCallback((action) => {
205
+ if (action) onAction?.(action);
206
+ }, [onAction]);
207
+ switch (data.type) {
208
+ case "bubble": return /* @__PURE__ */ jsx(Bubble, {
209
+ ...data,
210
+ onClick: handleClick
211
+ });
212
+ case "carousel": return /* @__PURE__ */ jsx(Carousel, {
213
+ ...data,
214
+ onClick: handleClick
215
+ });
216
+ default: throw new Error(`Unsupported Flex Message type: ${data}`);
217
+ }
218
+ };
219
+ //#endregion
220
+ //#region src/components/span.tsx
221
+ const Span = ({ text, color, size, weight, style, decoration }) => {
222
+ return /* @__PURE__ */ jsx(Text, {
223
+ style: {
224
+ color,
225
+ fontSize: getActualNumericSize(getIconSize(size)),
226
+ fontStyle: style,
227
+ fontWeight: weight === "regular" ? "400" : weight,
228
+ textDecorationLine: decoration !== "none" ? decoration : void 0
229
+ },
230
+ children: text
231
+ });
232
+ };
233
+ //#endregion
234
+ //#region src/components/button.tsx
235
+ const Button = ({ action, adjustMode, color, flex, gravity, height, margin, offsetBottom, offsetEnd, offsetStart, offsetTop, position, scaling, style, onClick }) => {
236
+ const parentDirection = useParentFlexDirection();
237
+ const handleClick = () => {
238
+ if (action) onClick?.(action);
239
+ };
240
+ const resolvedStyle = style ?? "link";
241
+ const textColor = resolvedStyle === "primary" ? "#fff" : resolvedStyle === "link" ? "#42659a" : void 0;
242
+ return /* @__PURE__ */ jsx(TouchableOpacity, {
243
+ onPress: handleClick,
244
+ children: /* @__PURE__ */ jsx(View, {
245
+ style: {
246
+ ...resolvedStyle === "primary" ? {
247
+ backgroundColor: "#17c950",
248
+ width: "100%",
249
+ paddingTop: 0,
250
+ paddingBottom: 0,
251
+ paddingLeft: 16,
252
+ paddingRight: 16,
253
+ justifyContent: "center",
254
+ alignItems: "center",
255
+ borderRadius: 8
256
+ } : {},
257
+ ...resolvedStyle === "link" ? {
258
+ alignItems: "center",
259
+ justifyContent: "center",
260
+ backgroundColor: "transparent"
261
+ } : {},
262
+ ...flex !== void 0 ? {
263
+ flexGrow: flex === 0 ? 0 : flex,
264
+ flexShrink: 0,
265
+ flexBasis: "auto"
266
+ } : {},
267
+ top: getActualSize(getOffset(offsetTop)),
268
+ bottom: getActualSize(getOffset(offsetBottom)),
269
+ left: getActualSize(getOffset(offsetStart)),
270
+ right: getActualSize(getOffset(offsetEnd)),
271
+ ...parentDirection === "column" ? { marginTop: getActualSize(getMarginSize(margin)) } : { marginLeft: getActualSize(getMarginSize(margin)) },
272
+ position: position === void 0 ? "relative" : position,
273
+ height: getActualSize(getButtonHeight(height)),
274
+ ...color !== void 0 ? { backgroundColor: color } : {}
275
+ },
276
+ children: action.type === "uri" && /* @__PURE__ */ jsx(Text, {
277
+ style: { color: textColor },
278
+ children: action.label
279
+ })
280
+ })
281
+ });
282
+ };
283
+ //#endregion
284
+ //#region src/components/image.tsx
285
+ const Image$1 = ({ url, flex, position, margin, offsetTop, offsetBottom, offsetStart, offsetEnd, align, gravity, size, aspectRatio, aspectMode, backgroundColor, animated, action, onClick }) => {
286
+ const parentDirection = useParentFlexDirection();
287
+ const rawWidth = getImageSize(size);
288
+ const sizeWidth = rawWidth === "unset" ? void 0 : getActualSize(rawWidth);
289
+ const width = flex ? "100%" : sizeWidth;
290
+ const handleClick = () => {
291
+ if (action) onClick?.(action);
292
+ };
293
+ return /* @__PURE__ */ jsx(View, {
294
+ style: {
295
+ flexDirection: "row",
296
+ justifyContent: "center",
297
+ ...flex !== void 0 ? {
298
+ flexGrow: flex === 0 ? 0 : flex,
299
+ flexShrink: 0,
300
+ flexBasis: flex === 0 ? "auto" : 0
301
+ } : { flexShrink: 1 },
302
+ ...width === void 0 ? { height: "100%" } : {},
303
+ ...margin ? parentDirection === "column" ? { marginTop: getActualSize(getMarginSize(margin)) } : { marginLeft: getActualSize(getMarginSize(margin)) } : flex ? {} : {
304
+ marginTop: 0,
305
+ marginBottom: 0,
306
+ marginRight: "auto",
307
+ marginLeft: "auto"
308
+ }
309
+ },
310
+ children: /* @__PURE__ */ jsx(TouchableOpacity, {
311
+ onPress: handleClick,
312
+ style: width !== void 0 ? { width } : { height: "100%" },
313
+ children: /* @__PURE__ */ jsx(Image, {
314
+ style: {
315
+ aspectRatio: aspectRatio?.split(":").join("/") ?? "1",
316
+ objectFit: aspectMode === "cover" ? "cover" : "contain",
317
+ backgroundColor,
318
+ position: position === void 0 ? "relative" : position,
319
+ top: getActualSize(getOffset(offsetTop)),
320
+ bottom: getActualSize(getOffset(offsetBottom)),
321
+ left: getActualSize(getOffset(offsetStart)),
322
+ right: getActualSize(getOffset(offsetEnd)),
323
+ ...width !== void 0 ? { width } : { height: "100%" }
324
+ },
325
+ source: { uri: url }
326
+ })
327
+ })
328
+ });
329
+ };
330
+ //#endregion
331
+ //#region src/components/video.tsx
332
+ const Video = ({ action, onClick }) => {
333
+ const handleClick = () => {
334
+ if (action) onClick?.(action);
335
+ };
336
+ return /* @__PURE__ */ jsx(TouchableOpacity, { onPress: handleClick });
337
+ };
338
+ //#endregion
339
+ //#region src/components/box.tsx
340
+ const Box = ({ layout, contents, backgroundColor, borderColor, borderWidth, cornerRadius, width, maxWidth, height, maxHeight, flex, spacing, margin, paddingAll, paddingTop, paddingBottom, paddingStart, paddingEnd, position, offsetTop, offsetBottom, offsetStart, offsetEnd, justifyContent, alignItems, background, action, onClick }) => {
341
+ const handleClick = () => {
342
+ if (action) onClick?.(action);
343
+ };
344
+ const parentDirection = useParentFlexDirection();
345
+ const ownDirection = layout === "vertical" ? "column" : "row";
346
+ return /* @__PURE__ */ jsx(TouchableOpacity, {
347
+ style: {
348
+ ...layout === "baseline" ? {
349
+ flexDirection: "row",
350
+ alignItems: "baseline",
351
+ columnGap: getActualSize(getSpacingSize(spacing))
352
+ } : layout === "horizontal" ? {
353
+ flexDirection: "row",
354
+ columnGap: getActualSize(getSpacingSize(spacing))
355
+ } : {
356
+ flexDirection: "column",
357
+ rowGap: getActualSize(getSpacingSize(spacing))
358
+ },
359
+ ...flex !== void 0 ? {
360
+ flexGrow: flex === 0 ? 0 : flex,
361
+ flexShrink: 0,
362
+ flexBasis: flex === 0 || parentDirection === "column" ? "auto" : 0
363
+ } : { flexShrink: 1 },
364
+ width: getActualSize(width) ?? (layout === "baseline" ? "100%" : void 0),
365
+ maxWidth: getActualSize(maxWidth),
366
+ height: getActualSize(height),
367
+ maxHeight: getActualSize(maxHeight),
368
+ backgroundColor: backgroundColor ?? background?.startColor,
369
+ borderColor,
370
+ borderWidth: getActualNumericSize(getBorderWidth(borderWidth)),
371
+ borderRadius: getActualNumericSize(getBorderRadius(cornerRadius)),
372
+ ...cornerRadius !== void 0 ? { overflow: "hidden" } : {},
373
+ paddingTop: getActualSize(getPaddingSize(paddingTop)),
374
+ paddingBottom: getActualSize(getPaddingSize(paddingBottom)),
375
+ paddingLeft: getActualSize(getPaddingSize(paddingStart)),
376
+ paddingRight: getActualSize(getPaddingSize(paddingEnd)),
377
+ padding: getActualSize(getPaddingSize(paddingAll)),
378
+ ...parentDirection === "column" ? { marginTop: getActualSize(getMarginSize(margin)) } : { marginLeft: getActualSize(getMarginSize(margin)) },
379
+ position: position === void 0 ? "relative" : position,
380
+ alignItems: alignItems ?? (layout === "baseline" ? "baseline" : void 0),
381
+ justifyContent,
382
+ top: getActualSize(getOffset(offsetTop)),
383
+ bottom: getActualSize(getOffset(offsetBottom)),
384
+ left: getActualSize(getOffset(offsetStart)),
385
+ right: getActualSize(getOffset(offsetEnd)),
386
+ ...width ? { flexShrink: 0 } : {}
387
+ },
388
+ onPress: handleClick,
389
+ children: /* @__PURE__ */ jsx(ParentFlexDirectionProvider, {
390
+ direction: ownDirection,
391
+ children: contents.map((content, i) => /* @__PURE__ */ jsx(React.Fragment, { children: renderComponent(content) }, i))
392
+ })
393
+ });
394
+ };
395
+ //#endregion
396
+ //#region src/hooks/useInheritedMarginSize.tsx
397
+ const MarginSizeContext = React.createContext(void 0);
398
+ const MarginSizeProvider = ({ children, marginSize }) => {
399
+ return /* @__PURE__ */ jsx(MarginSizeContext.Provider, {
400
+ value: marginSize,
401
+ children
402
+ });
403
+ };
404
+ //#endregion
405
+ //#region src/components/text.tsx
406
+ const Text$1 = ({ text, contents, adjustMode, flex, margin, position, offsetTop, offsetBottom, offsetStart, offsetEnd, size, scaling, align, gravity, wrap, lineSpacing, maxLines, weight, color, style, decoration, action, onClick }) => {
407
+ const parentDirection = useParentFlexDirection();
408
+ const handleClick = () => {
409
+ if (action) onClick?.(action);
410
+ };
411
+ if (!text && !contents) return null;
412
+ const marginSize = getActualSize(getMarginSize(margin));
413
+ const containerStyle = {
414
+ ...flex !== void 0 ? {
415
+ flexGrow: flex === 0 ? 0 : flex,
416
+ flexShrink: 0,
417
+ flexBasis: flex === 0 || parentDirection === "column" ? "auto" : 0
418
+ } : {},
419
+ ...parentDirection === "column" ? { marginTop: marginSize } : { marginLeft: marginSize },
420
+ top: getActualSize(getOffset(offsetTop)),
421
+ bottom: getActualSize(getOffset(offsetBottom)),
422
+ left: getActualSize(getOffset(offsetStart)),
423
+ right: getActualSize(getOffset(offsetEnd)),
424
+ position: position === void 0 ? "relative" : position,
425
+ width: align === "center" || align === "end" && flex !== 0 ? "100%" : void 0,
426
+ ...(align === "center" || align === "end") && flex === void 0 ? { flexShrink: 1 } : {}
427
+ };
428
+ const numberOfLines = maxLines ?? (wrap || parentDirection !== "column" ? void 0 : 1);
429
+ const textStyle = {
430
+ color,
431
+ fontSize: getActualSize(getIconSize(size)),
432
+ fontStyle: style,
433
+ fontWeight: weight === "regular" ? "400" : weight,
434
+ textAlign: align === "center" ? "center" : align === "end" ? "right" : "left",
435
+ textDecorationLine: decoration !== "none" ? decoration : void 0
436
+ };
437
+ if (text) return /* @__PURE__ */ jsx(TouchableOpacity, {
438
+ style: containerStyle,
439
+ onPress: handleClick,
440
+ children: /* @__PURE__ */ jsx(MarginSizeProvider, {
441
+ marginSize,
442
+ children: /* @__PURE__ */ jsx(Text, {
443
+ style: textStyle,
444
+ numberOfLines,
445
+ ellipsizeMode: "tail",
446
+ children: text
447
+ })
448
+ })
449
+ });
450
+ if (contents) return /* @__PURE__ */ jsx(TouchableOpacity, {
451
+ style: containerStyle,
452
+ onPress: handleClick,
453
+ children: /* @__PURE__ */ jsx(MarginSizeProvider, {
454
+ marginSize,
455
+ children: /* @__PURE__ */ jsx(Text, {
456
+ style: textStyle,
457
+ numberOfLines,
458
+ ellipsizeMode: "tail",
459
+ children: contents.map((content, index) => /* @__PURE__ */ jsx(React.Fragment, { children: renderComponent(content) }, index))
460
+ })
461
+ })
462
+ });
463
+ };
464
+ //#endregion
465
+ //#region src/components/separator.tsx
466
+ const Separator = ({ margin, color }) => {
467
+ const parentDirection = useParentFlexDirection();
468
+ return /* @__PURE__ */ jsx(View, { style: {
469
+ height: 1,
470
+ backgroundColor: color ?? "#d4d6da",
471
+ ...parentDirection === "column" ? { marginTop: getActualSize(getMarginSize(margin)) } : { marginLeft: getActualSize(getMarginSize(margin)) }
472
+ } });
473
+ };
474
+ //#endregion
475
+ //#region src/index.ts
476
+ registerComponents({
477
+ box: Box,
478
+ button: Button,
479
+ filler: Filler,
480
+ icon: Icon,
481
+ image: Image$1,
482
+ separator: Separator,
483
+ span: Span,
484
+ text: Text$1,
485
+ video: Video
486
+ });
487
+ //#endregion
488
+ export { FlexMessageRenderer };
489
+
490
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["Styles","Touchable","Image","RNImage","Text","RNText","Image","Text"],"sources":["../src/components/filler.tsx","../src/hooks/useParentFlexDirection.tsx","../src/components/icon.tsx","../src/containers/bubble.tsx","../src/containers/carousel.tsx","../src/renderer.tsx","../src/components/span.tsx","../src/components/button.tsx","../src/components/image.tsx","../src/components/video.tsx","../src/components/box.tsx","../src/hooks/useInheritedMarginSize.tsx","../src/components/text.tsx","../src/components/separator.tsx","../src/index.ts"],"sourcesContent":["import type { FillerComponent } from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { View } from \"react-native\";\r\n\r\nexport const Filler = ({ flex }: FillerComponent) => {\r\n return <View style={{ flexGrow: 1, flexShrink: 0, flexBasis: 0, flex }} />;\r\n};\r\n","import React from \"react\";\r\n\r\nconst ParentFlexDirectionContext = React.createContext<\"row\" | \"column\">(\"column\");\r\n\r\nexport const ParentFlexDirectionProvider = ({\r\n children,\r\n direction,\r\n}: {\r\n children: React.ReactNode;\r\n direction: \"row\" | \"column\";\r\n}) => {\r\n return <ParentFlexDirectionContext.Provider value={direction}>{children}</ParentFlexDirectionContext.Provider>;\r\n};\r\n\r\nexport const useParentFlexDirection = () => {\r\n return React.useContext(ParentFlexDirectionContext);\r\n};\r\n","import {\r\n getActualSize,\r\n getIconSize,\r\n getMarginSize,\r\n getOffset,\r\n type IconComponent,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { Image, View } from \"react-native\";\r\nimport { useParentFlexDirection } from \"../hooks/useParentFlexDirection.js\";\r\n\r\nexport const Icon = ({\r\n url,\r\n margin,\r\n position,\r\n offsetTop,\r\n offsetBottom,\r\n offsetStart,\r\n offsetEnd,\r\n size,\r\n scaling,\r\n aspectRatio,\r\n}: IconComponent) => {\r\n const parentDirection = useParentFlexDirection();\r\n // getIconSize(undefined) returns undefined; without this fallback an unsized icon renders at its source's native pixel size.\r\n const width = getActualSize(getIconSize(size ?? \"md\"));\r\n const marginSize = getActualSize(getMarginSize(margin));\r\n\r\n return (\r\n <View\r\n style={{\r\n width,\r\n flexShrink: 0,\r\n // `margin` is space along whichever axis the parent lays siblings out on — marginTop in a\r\n // \"column\" parent, marginLeft in a \"row\" (horizontal/baseline) parent.\r\n ...(parentDirection === \"column\" ? { marginTop: marginSize } : { marginLeft: marginSize }),\r\n }}\r\n >\r\n <Image\r\n style={{\r\n aspectRatio: aspectRatio?.split(\":\").join(\"/\") ?? \"1\",\r\n top: getActualSize(getOffset(offsetTop)),\r\n bottom: getActualSize(getOffset(offsetBottom)),\r\n left: getActualSize(getOffset(offsetStart)),\r\n right: getActualSize(getOffset(offsetEnd)),\r\n position: position === undefined ? \"relative\" : position,\r\n }}\r\n source={{ uri: url }}\r\n />\r\n </View>\r\n );\r\n};\r\n","import {\r\n renderComponent,\r\n type BubbleContainer,\r\n type ClickHandler,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { StyleSheet, TouchableOpacity, View, type StyleProp, type ViewStyle, type LayoutChangeEvent } from \"react-native\";\r\n\r\nexport const Bubble = ({\r\n body,\r\n direction,\r\n footer,\r\n header,\r\n hero,\r\n size,\r\n style,\r\n action,\r\n onClick,\r\n containerStyle,\r\n onLayout,\r\n}: BubbleContainer & {\r\n onClick?: ClickHandler | undefined;\r\n // Native-only, not part of the Flex Message spec: lets Carousel measure every bubble's natural height\r\n // and stretch them all to match the tallest one, since ScrollView content doesn't do this on its own.\r\n containerStyle?: StyleProp<ViewStyle>;\r\n onLayout?: ((event: LayoutChangeEvent) => void) | undefined;\r\n}) => {\r\n const hasHero = !!hero;\r\n const hasFooter = !!footer;\r\n const hasHeader = !!header;\r\n const handleClick = () => {\r\n if (action) {\r\n onClick?.(action);\r\n }\r\n };\r\n\r\n const inner = {\r\n ...Styles.bubbleInner,\r\n // Only when Carousel hands us an explicit (now definite, non-percentage) height to match: without\r\n // this, bubbleInner stays content-sized and the extra space added below is just blank/transparent.\r\n ...(containerStyle !== undefined && { flexGrow: 1 }),\r\n ...(size === \"nano\" && Styles.nanoInner),\r\n ...(size === \"micro\" && Styles.microInner),\r\n ...(size === \"deca\" && Styles.decaInner),\r\n ...(size === \"hecto\" && Styles.hectoInner),\r\n ...(size === \"kilo\" && Styles.kiloInner),\r\n ...(size === \"mega\" && Styles.megaInner),\r\n ...(size === \"giga\" && Styles.gigaInner),\r\n };\r\n\r\n return (\r\n <TouchableOpacity\r\n style={[{ ...Styles.bubble, ...Styles[size ?? \"mega\"] }, containerStyle]}\r\n onPress={handleClick}\r\n onLayout={onLayout}\r\n >\r\n <View style={inner}>\r\n {header && (\r\n <View\r\n style={{\r\n backgroundColor: style?.header?.backgroundColor ?? \"#fff\",\r\n borderBottomWidth: style?.header?.separator ? 1 : 0,\r\n borderColor: style?.header?.separatorColor ?? \"#000\",\r\n }}\r\n >\r\n {renderComponent(header, onClick)}\r\n </View>\r\n )}\r\n\r\n {hero && (\r\n <View style={{ backgroundColor: style?.hero?.backgroundColor ?? \"#fff\" }}>\r\n {renderComponent(hero, onClick)}\r\n </View>\r\n )}\r\n\r\n {body && (\r\n <View\r\n style={{\r\n ...Styles.body,\r\n ...(hasHeader && !body.paddingAll && Styles.bodyWithHeader),\r\n // The web port zeroes this out specifically for \"micro\" bubbles (see its CSS), since a\r\n // micro body commonly sets its own smaller `paddingAll` — without this exception the two\r\n // paddings stack (this wrapper's 20px plus the body Box's own), roughly doubling the gap.\r\n ...(hasHero && size !== \"micro\" && Styles.bodyWithHero),\r\n ...(hasFooter && Styles.bodyWithFooter),\r\n ...(!body.paddingAll && Styles.withPadding),\r\n backgroundColor: style?.body?.backgroundColor ?? \"#fff\",\r\n }}\r\n >\r\n {renderComponent(body, onClick)}\r\n </View>\r\n )}\r\n\r\n {footer && (\r\n <View\r\n style={{\r\n ...Styles.footer,\r\n backgroundColor: style?.footer?.backgroundColor ?? \"#fff\",\r\n borderTopWidth: style?.footer?.separator ? 1 : 0,\r\n borderColor: style?.footer?.separatorColor ?? \"#000\",\r\n }}\r\n >\r\n {renderComponent(footer, onClick)}\r\n </View>\r\n )}\r\n </View>\r\n </TouchableOpacity>\r\n );\r\n};\r\n\r\nconst Styles = StyleSheet.create({\r\n bubble: {\r\n flexDirection: \"column\",\r\n width: \"100%\",\r\n },\r\n bubbleInner: {\r\n flexDirection: \"column\",\r\n overflow: \"hidden\",\r\n borderRadius: 10,\r\n },\r\n nano: {\r\n width: 120,\r\n maxWidth: 120,\r\n },\r\n nanoInner: {\r\n borderRadius: 10,\r\n },\r\n micro: {\r\n width: 160,\r\n maxWidth: 160,\r\n },\r\n microInner: {\r\n borderRadius: 10,\r\n },\r\n deca: {\r\n width: 220,\r\n maxWidth: 220,\r\n },\r\n decaInner: {\r\n borderRadius: 10,\r\n },\r\n hecto: {\r\n width: 241,\r\n maxWidth: 241,\r\n },\r\n hectoInner: {\r\n borderRadius: 10,\r\n },\r\n kilo: {\r\n width: 260,\r\n maxWidth: 260,\r\n },\r\n kiloInner: {\r\n borderRadius: 10,\r\n },\r\n mega: {\r\n width: 300,\r\n maxWidth: 300,\r\n },\r\n megaInner: {\r\n borderRadius: 17,\r\n },\r\n giga: {\r\n width: 340,\r\n maxWidth: 340,\r\n },\r\n gigaInner: {\r\n borderRadius: 5,\r\n },\r\n body: {\r\n flexGrow: 1,\r\n },\r\n withPadding: {\r\n padding: 20,\r\n },\r\n bodyWithHeader: {\r\n padding: 20,\r\n },\r\n bodyWithHero: {\r\n padding: 20,\r\n },\r\n bodyWithFooter: {\r\n paddingBottom: 10,\r\n },\r\n footer: {\r\n padding: 10,\r\n },\r\n});\r\n","import {\r\n type CarouselContainer,\r\n type ClickHandler,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { useCallback, useState } from \"react\";\r\nimport { ScrollView, StyleSheet, type LayoutChangeEvent } from \"react-native\";\r\nimport { Bubble } from \"./bubble.js\";\r\n\r\nexport const Carousel = ({ contents, onClick }: CarouselContainer & { onClick?: ClickHandler }) => {\r\n // `alignItems: \"stretch\"` doesn't equalize bubble heights here — ScrollView content doesn't participate\r\n // in cross-axis stretch the way a plain flex row does — so each bubble's natural height is measured via\r\n // onLayout, and once all have reported in, every bubble is pinned to the tallest one's height.\r\n const [heights, setHeights] = useState<Record<number, number>>({});\r\n const measured = Object.keys(heights).length === contents.length;\r\n const maxHeight = measured ? Math.max(...Object.values(heights)) : undefined;\r\n\r\n const handleLayout = useCallback((index: number, event: LayoutChangeEvent) => {\r\n const { height } = event.nativeEvent.layout;\r\n setHeights((prev) => (prev[index] === height ? prev : { ...prev, [index]: height }));\r\n }, []);\r\n\r\n return (\r\n // TODO: web uses `scroll-snap-type: x mandatory` to snap between bubbles; ScrollView has no direct\r\n // equivalent (would need `snapToInterval`/`snapToOffsets`, which assume a fixed bubble width per size).\r\n <ScrollView horizontal contentContainerStyle={Styles.carousel}>\r\n {contents.map((bubble, index) => (\r\n <Bubble\r\n key={index}\r\n {...bubble}\r\n onClick={onClick}\r\n containerStyle={maxHeight !== undefined ? { height: maxHeight } : undefined}\r\n onLayout={measured ? undefined : (event) => handleLayout(index, event)}\r\n />\r\n ))}\r\n </ScrollView>\r\n );\r\n};\r\n\r\nconst Styles = StyleSheet.create({\r\n carousel: {\r\n flexDirection: \"row\",\r\n columnGap: 20,\r\n // Not \"stretch\": that's exactly the unreliable ScrollView cross-axis stretch this component works\r\n // around above — leaving it on lets the very first (pre-measurement) layout pass report an inflated\r\n // height, which then gets locked in as the \"tallest\" bubble for everyone to match.\r\n alignItems: \"flex-start\",\r\n },\r\n});\r\n","import type {\r\n Action,\r\n BubbleContainer,\r\n CarouselContainer,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { useCallback, useMemo } from \"react\";\r\nimport { Bubble } from \"./containers/bubble.js\";\r\nimport { Carousel } from \"./containers/carousel.js\";\r\n\r\ntype FlexMessageRendererProps = {\r\n /**\r\n * A JSON string representing the Flex Message to be rendered.\r\n */\r\n json: string;\r\n\r\n onAction?: (action: Action) => void;\r\n};\r\n\r\nexport const FlexMessageRenderer = ({ json, onAction }: FlexMessageRendererProps) => {\r\n const data = useMemo(() => {\r\n return JSON.parse(json) as CarouselContainer | BubbleContainer;\r\n }, [json]);\r\n const handleClick = useCallback(\r\n (action?: Action) => {\r\n if (action) {\r\n onAction?.(action);\r\n }\r\n },\r\n [onAction],\r\n );\r\n\r\n switch (data.type) {\r\n case \"bubble\":\r\n return <Bubble {...data} onClick={handleClick} />;\r\n\r\n case \"carousel\":\r\n return <Carousel {...data} onClick={handleClick} />;\r\n\r\n default:\r\n throw new Error(`Unsupported Flex Message type: ${data}`);\r\n }\r\n};\r\n","import { getActualNumericSize, getIconSize, type SpanComponent } from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { Text } from \"react-native\";\r\n\r\nexport const Span = ({ text, color, size, weight, style, decoration }: SpanComponent) => {\r\n return <Text style={{\r\n color,\r\n fontSize: getActualNumericSize(getIconSize(size)),\r\n fontStyle: style,\r\n fontWeight: weight === \"regular\" ? \"400\" : weight,\r\n textDecorationLine: decoration !== \"none\" ? decoration : undefined,\r\n }}>\r\n {text}\r\n </Text>;\r\n};\r\n","import {\r\n getActualSize,\r\n getButtonHeight,\r\n getMarginSize,\r\n getOffset,\r\n type ButtonComponent,\r\n type ClickHandler,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { Text, TouchableOpacity as Touchable, View } from \"react-native\";\r\nimport { useParentFlexDirection } from \"../hooks/useParentFlexDirection.js\";\r\n\r\nexport const Button = ({\r\n action,\r\n adjustMode,\r\n color,\r\n flex,\r\n gravity,\r\n height,\r\n margin,\r\n offsetBottom,\r\n offsetEnd,\r\n offsetStart,\r\n offsetTop,\r\n position,\r\n scaling,\r\n style,\r\n onClick,\r\n}: ButtonComponent & { onClick?: ClickHandler | undefined }) => {\r\n const parentDirection = useParentFlexDirection();\r\n const handleClick = () => {\r\n if (action) {\r\n onClick?.(action);\r\n }\r\n };\r\n // LINE's default button style is \"link\" when unspecified (matches the web port's `style ?? \"link\"`).\r\n const resolvedStyle = style ?? \"link\";\r\n const textColor = resolvedStyle === \"primary\" ? \"#fff\" : resolvedStyle === \"link\" ? \"#42659a\" : undefined;\r\n\r\n return (\r\n <Touchable onPress={handleClick}>\r\n <View\r\n style={{\r\n ...(resolvedStyle === \"primary\" ? {\r\n backgroundColor: \"#17c950\",\r\n width: \"100%\",\r\n paddingTop: 0,\r\n paddingBottom: 0,\r\n paddingLeft: 16,\r\n paddingRight: 16,\r\n justifyContent: \"center\",\r\n alignItems: \"center\",\r\n borderRadius: 8,\r\n } : {}),\r\n ...(resolvedStyle === \"link\" ? {\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n backgroundColor: \"transparent\",\r\n } : {}),\r\n // \"secondary\" has no dedicated look in the web port either (its CSS class is empty) — it just\r\n // renders as a plain, unstyled box with default text color.\r\n // Only override flex sizing when `flex` is actually specified (see text.tsx/box.tsx for why).\r\n // flexBasis is explicitly \"auto\" (matching the web port's `flex 0 auto`, not `flex 0 0`) so the\r\n // explicit `height` below still wins — an explicit flexBasis otherwise overrides `height`\r\n // entirely for flex layout, collapsing the button whenever its parent has no space to grow into.\r\n ...(flex !== undefined ? { flexGrow: flex === 0 ? 0 : flex, flexShrink: 0, flexBasis: \"auto\" } : {}),\r\n top: getActualSize(getOffset(offsetTop)),\r\n bottom: getActualSize(getOffset(offsetBottom)),\r\n left: getActualSize(getOffset(offsetStart)),\r\n right: getActualSize(getOffset(offsetEnd)),\r\n // `margin` is space along whichever axis the parent lays siblings out on — marginTop in a\r\n // \"column\" parent, marginLeft in a \"row\" (horizontal/baseline) parent.\r\n ...(parentDirection === \"column\"\r\n ? { marginTop: getActualSize(getMarginSize(margin)) }\r\n : { marginLeft: getActualSize(getMarginSize(margin)) }),\r\n position: position === undefined ? \"relative\" : position,\r\n height: getActualSize(getButtonHeight(height)),\r\n // `color` should only override the style preset's background when it's actually provided —\r\n // otherwise this erases the \"primary\" green / makes \"link\" buttons blend into the card.\r\n ...(color !== undefined ? { backgroundColor: color } : {}),\r\n }}\r\n >\r\n {action.type === \"uri\" && <Text style={{ color: textColor }}>{action.label}</Text>}\r\n </View>\r\n </Touchable>\r\n );\r\n};\r\n","import {\r\n getImageSize,\r\n getMarginSize,\r\n getOffset,\r\n type ImageComponent,\r\n type ClickHandler,\r\n getActualSize,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { Image as RNImage, TouchableOpacity, View } from \"react-native\";\r\nimport { useParentFlexDirection } from \"../hooks/useParentFlexDirection.js\";\r\n\r\nexport const Image = ({\r\n url,\r\n flex,\r\n position,\r\n margin,\r\n offsetTop,\r\n offsetBottom,\r\n offsetStart,\r\n offsetEnd,\r\n align,\r\n gravity,\r\n size,\r\n aspectRatio,\r\n aspectMode,\r\n backgroundColor,\r\n animated,\r\n action,\r\n onClick,\r\n}: ImageComponent & { onClick?: ClickHandler | undefined }) => {\r\n const parentDirection = useParentFlexDirection();\r\n const rawWidth = getImageSize(size);\r\n const sizeWidth = rawWidth === \"unset\" ? undefined : getActualSize(rawWidth);\r\n // When `flex` is meant to grow this image within a row/column of siblings, let it fill 100% of\r\n // whatever space it's allocated instead of the fixed `size` width — otherwise the fixed width fights\r\n // the flex-grown container for space (the fixed width wins, and the image can end up misplaced or\r\n // fully covered by a sibling that gets laid out for the space the image should have used).\r\n const width = flex ? \"100%\" : sizeWidth;\r\n const handleClick = () => {\r\n if (action) {\r\n onClick?.(action);\r\n }\r\n };\r\n\r\n return (\r\n <View\r\n style={{\r\n flexDirection: \"row\",\r\n justifyContent: \"center\",\r\n // Explicit flexGrow/flexShrink, not the bare `flex` shorthand (only to avoid ambiguity — the\r\n // shorthand's implied flexBasis:0% is actually what we want here, unlike box.tsx/text.tsx).\r\n // flexBasis stays \"0\", not \"auto\": an \"auto\" basis makes RN measure this View's content to find\r\n // its natural size, and Image's own natural-size measurement falls back to the source asset's\r\n // native pixel size instead of respecting `width`, letting one image claim all of its siblings'\r\n // space. Basis 0 sidesteps that measurement entirely — the final size is already fully\r\n // determined by the explicit width/aspectRatio below regardless of the starting basis.\r\n ...(flex !== undefined\r\n ? { flexGrow: flex === 0 ? 0 : flex, flexShrink: 0, flexBasis: flex === 0 ? \"auto\" : 0 }\r\n : { flexShrink: 1 }),\r\n // Same rule as below: only force a % height when width can't drive sizing on its own — otherwise\r\n // this resolves against whatever definite height it finds further up and stretches the whole card.\r\n ...(width === undefined ? { height: \"100%\" } : {}),\r\n // Auto left/right margins center a naturally-sized image, but they compete with flexGrow for the\r\n // same leftover space — skip them when `flex` is meant to actually grow this image instead.\r\n // `margin` itself is space along whichever axis the parent lays siblings out on — marginTop in a\r\n // \"column\" parent, marginLeft in a \"row\" (horizontal/baseline) parent.\r\n ...(margin\r\n ? parentDirection === \"column\"\r\n ? { marginTop: getActualSize(getMarginSize(margin)) }\r\n : { marginLeft: getActualSize(getMarginSize(margin)) }\r\n : flex\r\n ? {}\r\n : { marginTop: 0, marginBottom: 0, marginRight: \"auto\", marginLeft: \"auto\" }),\r\n }}\r\n >\r\n {/* Only one of width/height may be definite — the other must stay unset so aspectRatio can derive it. */}\r\n <TouchableOpacity onPress={handleClick} style={width !== undefined ? { width } : { height: \"100%\" }}>\r\n <RNImage\r\n style={{\r\n aspectRatio: aspectRatio?.split(\":\").join(\"/\") ?? \"1\",\r\n objectFit: aspectMode === \"cover\" ? \"cover\" : \"contain\",\r\n backgroundColor,\r\n position: position === undefined ? \"relative\" : position,\r\n top: getActualSize(getOffset(offsetTop)),\r\n bottom: getActualSize(getOffset(offsetBottom)),\r\n left: getActualSize(getOffset(offsetStart)),\r\n right: getActualSize(getOffset(offsetEnd)),\r\n ...(width !== undefined ? { width } : { height: \"100%\" }),\r\n }}\r\n source={{ uri: url }}\r\n />\r\n </TouchableOpacity>\r\n </View>\r\n );\r\n};\r\n","import type { VideoComponent } from \"@ohmyteeth/line-flex-message-renderer-core\";\r\n\r\nimport type { ClickHandler } from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { TouchableOpacity } from \"react-native\";\r\n\r\nexport const Video = ({\r\n action,\r\n onClick,\r\n}: VideoComponent & { onClick?: ClickHandler | undefined }) => {\r\n const handleClick = () => {\r\n if (action) {\r\n onClick?.(action);\r\n }\r\n };\r\n\r\n return <TouchableOpacity onPress={handleClick} />;\r\n};\r\n","import {\r\n getActualNumericSize,\r\n getActualSize,\r\n getBorderRadius,\r\n getBorderWidth,\r\n getMarginSize,\r\n getOffset,\r\n getPaddingSize,\r\n getSpacingSize,\r\n renderComponent,\r\n type BoxComponent,\r\n type ClickHandler,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport React from \"react\";\r\nimport { TouchableOpacity, type ViewStyle } from \"react-native\";\r\nimport { ParentFlexDirectionProvider, useParentFlexDirection } from \"../hooks/useParentFlexDirection.js\";\r\n\r\nexport const Box = ({\r\n layout,\r\n contents,\r\n backgroundColor,\r\n borderColor,\r\n borderWidth,\r\n cornerRadius,\r\n width,\r\n maxWidth,\r\n height,\r\n maxHeight,\r\n flex,\r\n spacing,\r\n margin,\r\n paddingAll,\r\n paddingTop,\r\n paddingBottom,\r\n paddingStart,\r\n paddingEnd,\r\n position,\r\n offsetTop,\r\n offsetBottom,\r\n offsetStart,\r\n offsetEnd,\r\n justifyContent,\r\n alignItems,\r\n background,\r\n action,\r\n onClick,\r\n}: BoxComponent & { onClick?: ClickHandler | undefined }) => {\r\n const handleClick = () => {\r\n if (action) {\r\n onClick?.(action);\r\n }\r\n };\r\n const parentDirection = useParentFlexDirection();\r\n const ownDirection = layout === \"vertical\" ? \"column\" : \"row\";\r\n\r\n const containerStyle: ViewStyle = {\r\n ...(layout === \"baseline\"\r\n ? { flexDirection: \"row\", alignItems: \"baseline\", columnGap: getActualSize(getSpacingSize(spacing)) }\r\n : layout === \"horizontal\"\r\n ? { flexDirection: \"row\", columnGap: getActualSize(getSpacingSize(spacing)) }\r\n : { flexDirection: \"column\", rowGap: getActualSize(getSpacingSize(spacing)) }),\r\n // flexBasis of 0 only makes sense along the parent's main axis when that axis has a definite total to\r\n // distribute — true for \"row\" parents here (bubble width is always fixed), but not for \"column\"\r\n // parents (bubble height is always auto/content-driven). In a \"column\" parent, flexBasis:0 makes this\r\n // box contribute nothing to that auto-height calculation, collapsing the whole ancestor chain to 0.\r\n ...(flex !== undefined\r\n ? {\r\n flexGrow: flex === 0 ? 0 : flex,\r\n flexShrink: 0,\r\n flexBasis: flex === 0 || parentDirection === \"column\" ? \"auto\" : 0,\r\n }\r\n : { flexShrink: 1 }),\r\n width: getActualSize(width) ?? (layout === \"baseline\" ? \"100%\" : undefined),\r\n maxWidth: getActualSize(maxWidth),\r\n height: getActualSize(height),\r\n maxHeight: getActualSize(maxHeight),\r\n backgroundColor: backgroundColor ?? background?.startColor,\r\n borderColor,\r\n borderWidth: getActualNumericSize(getBorderWidth(borderWidth)),\r\n borderRadius: getActualNumericSize(getBorderRadius(cornerRadius)),\r\n // Unlike CSS, RN's borderRadius only rounds this box's own background/border — it doesn't clip\r\n // children to the rounded shape unless overflow is also hidden (e.g. a square image inside a\r\n // circular avatar box would otherwise cover the rounded corners entirely).\r\n ...(cornerRadius !== undefined ? { overflow: \"hidden\" } : {}),\r\n paddingTop: getActualSize(getPaddingSize(paddingTop)),\r\n paddingBottom: getActualSize(getPaddingSize(paddingBottom)),\r\n paddingLeft: getActualSize(getPaddingSize(paddingStart)),\r\n paddingRight: getActualSize(getPaddingSize(paddingEnd)),\r\n padding: getActualSize(getPaddingSize(paddingAll)),\r\n // Same rule as text.tsx: `margin` is space along whichever axis the parent lays siblings out on —\r\n // marginTop in a \"column\" parent, marginLeft in a \"row\" (horizontal/baseline) parent.\r\n ...(parentDirection === \"column\"\r\n ? { marginTop: getActualSize(getMarginSize(margin)) }\r\n : { marginLeft: getActualSize(getMarginSize(margin)) }),\r\n position: position === undefined ? \"relative\" : position,\r\n // `alignItems` here (from the JSON) must win when explicitly set, but otherwise must NOT blindly\r\n // override the \"baseline\" set above for `layout:\"baseline\"` — it was doing exactly that (since this\r\n // key appears later in the same object), silently turning every baseline row into RN's default\r\n // \"stretch\" instead, which stretches every child to match the tallest sibling's height.\r\n alignItems: alignItems ?? (layout === \"baseline\" ? \"baseline\" : undefined),\r\n justifyContent,\r\n top: getActualSize(getOffset(offsetTop)),\r\n bottom: getActualSize(getOffset(offsetBottom)),\r\n left: getActualSize(getOffset(offsetStart)),\r\n right: getActualSize(getOffset(offsetEnd)),\r\n ...(width ? { flexShrink: 0 } : {}),\r\n };\r\n\r\n return (\r\n <TouchableOpacity style={containerStyle} onPress={handleClick}>\r\n <ParentFlexDirectionProvider direction={ownDirection}>\r\n {contents.map((content, i) => (\r\n <React.Fragment key={i}>{renderComponent(content)}</React.Fragment>\r\n ))}\r\n </ParentFlexDirectionProvider>\r\n </TouchableOpacity>\r\n );\r\n};\r\n","import React from \"react\";\r\n\r\nconst MarginSizeContext = React.createContext<number | undefined>(undefined);\r\n\r\nexport const MarginSizeProvider = ({ children, marginSize }: { children: React.ReactNode; marginSize: number | undefined }) => {\r\n return <MarginSizeContext.Provider value={marginSize}>{children}</MarginSizeContext.Provider>;\r\n}\r\n\r\nexport const useInheritedMarginSize = () => {\r\n return React.useContext(MarginSizeContext);\r\n};","import {\r\n getActualSize,\r\n getIconSize,\r\n getMarginSize,\r\n getOffset,\r\n renderComponent,\r\n type TextComponent,\r\n type ClickHandler,\r\n} from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport React from \"react\";\r\nimport { Text as RNText, TouchableOpacity, type TextStyle, type ViewStyle } from \"react-native\";\r\nimport { MarginSizeProvider } from \"../hooks/useInheritedMarginSize.js\";\r\nimport { useParentFlexDirection } from \"../hooks/useParentFlexDirection.js\";\r\n\r\nexport const Text = ({\r\n text,\r\n contents,\r\n adjustMode,\r\n flex,\r\n margin,\r\n position,\r\n offsetTop,\r\n offsetBottom,\r\n offsetStart,\r\n offsetEnd,\r\n size,\r\n scaling,\r\n align,\r\n gravity,\r\n wrap,\r\n lineSpacing,\r\n maxLines,\r\n weight,\r\n color,\r\n style,\r\n decoration,\r\n action,\r\n onClick,\r\n}: TextComponent & { onClick?: ClickHandler | undefined }) => {\r\n const parentDirection = useParentFlexDirection();\r\n const handleClick = () => {\r\n if (action) {\r\n onClick?.(action);\r\n }\r\n };\r\n\r\n if (!text && !contents) {\r\n return null;\r\n }\r\n\r\n const marginSize = getActualSize(getMarginSize(margin)) as number | undefined;\r\n\r\n const containerStyle: ViewStyle = {\r\n // Only override flex sizing when `flex` is actually specified. flexBasis:0 only makes sense along a\r\n // \"row\" parent's main axis (bubble width is always fixed) — a \"column\" parent's height is always\r\n // auto/content-driven, and flexBasis:0 there makes this Text contribute nothing to that calculation,\r\n // collapsing the whole auto-height ancestor chain. See box.tsx for the fuller explanation.\r\n // No flexShrink default when `flex` is undefined (unlike box.tsx): a plain label Text (e.g. \"ITEMS\"\r\n // next to a right-aligned price) needs to hold its natural width so its \"align:end\" sibling below is\r\n // the one that shrinks to fit — making this Text shrinkable too would let both compete for the same\r\n // space and truncate the label.\r\n ...(flex !== undefined\r\n ? {\r\n flexGrow: flex === 0 ? 0 : flex,\r\n flexShrink: 0,\r\n flexBasis: flex === 0 || parentDirection === \"column\" ? \"auto\" : 0,\r\n }\r\n : {}),\r\n // The space `margin` describes is this Text's own gap before its previous sibling, along whichever\r\n // axis the parent actually lays siblings out on — marginTop in a \"column\" (vertical) parent, but\r\n // marginLeft in a \"row\" (horizontal/baseline) parent, matching the web port's per-direction CSS.\r\n ...(parentDirection === \"column\" ? { marginTop: marginSize } : { marginLeft: marginSize }),\r\n top: getActualSize(getOffset(offsetTop)),\r\n bottom: getActualSize(getOffset(offsetBottom)),\r\n left: getActualSize(getOffset(offsetStart)),\r\n right: getActualSize(getOffset(offsetEnd)),\r\n position: position === undefined ? \"relative\" : position,\r\n width: align === \"center\" || (align === \"end\" && flex !== 0) ? \"100%\" : undefined,\r\n // RN defaults flexShrink to 0 (web defaults to 1), so without this a \"100%\"-wide row item can't\r\n // shrink to fit whatever space its siblings left behind and instead overflows past the card edge.\r\n // Skipped when `flex` is explicitly set, since that case is already fully handled above.\r\n ...((align === \"center\" || align === \"end\") && flex === undefined ? { flexShrink: 1 } : {}),\r\n };\r\n\r\n // RN has a known bug where a Text with numberOfLines inside an `alignItems:\"baseline\"` row can size its\r\n // container to the text's full untruncated height even though the text itself renders truncated (see\r\n // https://github.com/facebook/react-native/issues/35276). Row/baseline labels are short by convention\r\n // and the \"align:end\" siblings already shrink-to-fit instead of truncating, so it's safe to just not\r\n // cap line count there rather than risk that bug.\r\n const numberOfLines = maxLines ?? (wrap || parentDirection !== \"column\" ? undefined : 1);\r\n\r\n const textStyle: TextStyle = {\r\n color,\r\n fontSize: getActualSize(getIconSize(size)) as number | undefined,\r\n fontStyle: style,\r\n fontWeight: weight === \"regular\" ? \"400\" : weight,\r\n textAlign: align === \"center\" ? \"center\" : align === \"end\" ? \"right\" : \"left\",\r\n textDecorationLine: decoration !== \"none\" ? decoration : undefined,\r\n };\r\n\r\n if (text) {\r\n return (\r\n <TouchableOpacity style={containerStyle} onPress={handleClick}>\r\n <MarginSizeProvider marginSize={marginSize}>\r\n <RNText style={textStyle} numberOfLines={numberOfLines} ellipsizeMode=\"tail\">\r\n {text}\r\n </RNText>\r\n </MarginSizeProvider>\r\n </TouchableOpacity>\r\n );\r\n }\r\n\r\n if (contents) {\r\n return (\r\n <TouchableOpacity style={containerStyle} onPress={handleClick}>\r\n <MarginSizeProvider marginSize={marginSize}>\r\n <RNText style={textStyle} numberOfLines={numberOfLines} ellipsizeMode=\"tail\">\r\n {contents.map((content, index) => (\r\n <React.Fragment key={index}>{renderComponent(content)}</React.Fragment>\r\n ))}\r\n </RNText>\r\n </MarginSizeProvider>\r\n </TouchableOpacity>\r\n );\r\n }\r\n};\r\n","import { getActualSize, getMarginSize, type SeparatorComponent } from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { View } from \"react-native\";\r\nimport { useParentFlexDirection } from \"../hooks/useParentFlexDirection.js\";\r\n\r\nexport const Separator = ({ margin, color }: SeparatorComponent) => {\r\n const parentDirection = useParentFlexDirection();\r\n\r\n return (\r\n <View\r\n style={{\r\n height: 1,\r\n backgroundColor: color ?? \"#d4d6da\",\r\n // `margin` is space along whichever axis the parent lays siblings out on — marginTop in a\r\n // \"column\" parent, marginLeft in a \"row\" (horizontal/baseline) parent.\r\n ...(parentDirection === \"column\"\r\n ? { marginTop: getActualSize(getMarginSize(margin)) }\r\n : { marginLeft: getActualSize(getMarginSize(margin)) }),\r\n }}\r\n />\r\n );\r\n};\r\n","import { registerComponents } from \"@ohmyteeth/line-flex-message-renderer-core\";\r\nimport { Filler } from \"./components/filler.js\";\r\nimport { Icon } from \"./components/icon.js\";\r\nimport { FlexMessageRenderer } from \"./renderer.js\";\r\nimport { Span } from \"./components/span.js\";\r\nimport { Button } from \"./components/button.js\";\r\nimport { Image } from \"./components/image.js\";\r\nimport { Video } from \"./components/video.js\";\r\nimport { Box } from \"./components/box.js\";\r\nimport { Text } from \"./components/text.js\";\r\nimport { Separator } from \"./components/separator.js\";\r\n\r\nregisterComponents({\r\n box: Box,\r\n button: Button,\r\n filler: Filler,\r\n icon: Icon,\r\n image: Image,\r\n separator: Separator,\r\n span: Span,\r\n text: Text,\r\n video: Video,\r\n});\r\n\r\nexport { FlexMessageRenderer };\r\n"],"mappings":";;;;;AAGA,MAAa,UAAU,EAAE,WAA4B;CACnD,OAAO,oBAAC,MAAD,EAAM,OAAO;EAAE,UAAU;EAAG,YAAY;EAAG,WAAW;EAAG;CAAK,EAAI,CAAA;AAC3E;;;ACHA,MAAM,6BAA6B,MAAM,cAAgC,QAAQ;AAEjF,MAAa,+BAA+B,EAC1C,UACA,gBAII;CACJ,OAAO,oBAAC,2BAA2B,UAA5B;EAAqC,OAAO;EAAY;CAA8C,CAAA;AAC/G;AAEA,MAAa,+BAA+B;CAC1C,OAAO,MAAM,WAAW,0BAA0B;AACpD;;;ACNA,MAAa,QAAQ,EACnB,KACA,QACA,UACA,WACA,cACA,aACA,WACA,MACA,SACA,kBACmB;CACnB,MAAM,kBAAkB,uBAAuB;CAE/C,MAAM,QAAQ,cAAc,YAAY,QAAQ,IAAI,CAAC;CACrD,MAAM,aAAa,cAAc,cAAc,MAAM,CAAC;CAEtD,OACE,oBAAC,MAAD;EACE,OAAO;GACL;GACA,YAAY;GAGZ,GAAI,oBAAoB,WAAW,EAAE,WAAW,WAAW,IAAI,EAAE,YAAY,WAAW;EAC1F;YAEA,oBAAC,OAAD;GACE,OAAO;IACL,aAAa,aAAa,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,KAAK;IAClD,KAAK,cAAc,UAAU,SAAS,CAAC;IACvC,QAAQ,cAAc,UA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;aAC9B,oBAACC,MAAD;IAAQ,OAAO;IAA0B;IAAe,eAAc;cACnE;GACK,CAAA;EACU,CAAA;CACJ,CAAA;CAItB,IAAI,UACF,OACE,oBAAC,kBAAD;EAAkB,OAAO;EAAgB,SAAS;YAChD,oBAAC,oBAAD;GAAgC;aAC9B,oBAACA,MAAD;IAAQ,OAAO;IAA0B;IAAe,eAAc;cACnE,SAAS,KAAK,SAAS,UACtB,oBAAC,MAAM,UAAP,EAAA,UAA6B,gBAAgB,OAAO,EAAkB,GAAjD,KAAiD,CACvE;GACK,CAAA;EACU,CAAA;CACJ,CAAA;AAGxB;;;ACzHA,MAAa,aAAa,EAAE,QAAQ,YAAgC;CAClE,MAAM,kBAAkB,uBAAuB;CAE/C,OACE,oBAAC,MAAD,EACE,OAAO;EACL,QAAQ;EACR,iBAAiB,SAAS;EAG1B,GAAI,oBAAoB,WACpB,EAAE,WAAW,cAAc,cAAc,MAAM,CAAC,EAAE,IAClD,EAAE,YAAY,cAAc,cAAc,MAAM,CAAC,EAAE;CACzD,EACD,CAAA;AAEL;;;ACRA,mBAAmB;CACjB,KAAK;CACL,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,OAAOC;CACP,WAAW;CACX,MAAM;CACN,MAAMC;CACN,OAAO;AACT,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@ohmyteeth/react-native-line-flex-message-renderer",
3
+ "version": "0.1.0",
4
+ "description": "This is a component library for rendering LINE Flex Messages in React Native.",
5
+ "license": "MIT",
6
+ "author": "Oh my teeth, Co.",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ohmyteeth/react-line-flex-message-renderer.git"
10
+ },
11
+ "homepage": "https://github.com/ohmyteeth/react-line-flex-message-renderer",
12
+ "bugs": {
13
+ "url": "https://github.com/ohmyteeth/react-line-flex-message-renderer/issues"
14
+ },
15
+ "keywords": [
16
+ "LINE",
17
+ "Flex Message",
18
+ "React",
19
+ "React Native"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "type": "module",
30
+ "main": "./dist/index.mjs",
31
+ "types": "./dist/index.d.mts",
32
+ "exports": {
33
+ ".": {
34
+ "import": "./dist/index.mjs",
35
+ "types": "./dist/index.d.mts"
36
+ },
37
+ "./style.css": {
38
+ "import": "./dist/style.css"
39
+ }
40
+ },
41
+ "scripts": {
42
+ "dev": "run-p dev:*",
43
+ "dev:tsdown": "tsdown --watch",
44
+ "build": "tsdown",
45
+ "prepublishOnly": "pnpm run typecheck && pnpm run build",
46
+ "typecheck": "tsc -p tsconfig.json --noEmit"
47
+ },
48
+ "dependencies": {
49
+ "@ohmyteeth/line-flex-message-renderer-core": "workspace:*"
50
+ },
51
+ "devDependencies": {
52
+ "@oxfmt/binding-darwin-arm64": "catalog:",
53
+ "@oxfmt/binding-win32-x64-msvc": "catalog:",
54
+ "@oxlint/binding-darwin-arm64": "catalog:",
55
+ "@oxlint/binding-win32-x64-msvc": "catalog:",
56
+ "@types/node": "^26.1.1",
57
+ "@types/react": "^19.2.18",
58
+ "npm-run-all2": "catalog:",
59
+ "oxfmt": "catalog:",
60
+ "oxlint": "catalog:",
61
+ "react": "^19.2.7",
62
+ "react-dom": "^19.2.7",
63
+ "react-native": "^0.86.0",
64
+ "tsdown": "catalog:",
65
+ "typescript": "catalog:",
66
+ "vitest": "^4.1.10"
67
+ },
68
+ "peerDependencies": {
69
+ "react": "^19.2.7",
70
+ "react-native": "^0.86.0"
71
+ },
72
+ "packageManager": "pnpm@11.12.0"
73
+ }