@btndprojects/loam-ui-native 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +55 -2
- package/dist/accordion/index.js +3 -0
- package/dist/adaptive/index.js +2 -0
- package/dist/alert/index.js +3 -0
- package/dist/analyzer/index.js +6 -0
- package/dist/announcement/index.js +6 -0
- package/dist/audio-player/index.js +3 -0
- package/dist/avatar/index.js +3 -0
- package/dist/avatar-group/index.js +3 -0
- package/dist/badge/index.js +5 -0
- package/dist/banner/index.js +2 -0
- package/dist/board/index.js +7 -0
- package/dist/button/index.js +5 -0
- package/dist/camera-permission/index.js +13 -0
- package/dist/capture-result/index.js +18 -0
- package/dist/card/index.js +4 -0
- package/dist/card-form/index.js +10 -0
- package/dist/carousel/index.js +2 -0
- package/dist/chart/index.js +6 -0
- package/dist/charts/index.js +7 -0
- package/dist/checkbox/index.js +7 -0
- package/dist/checklist/index.js +10 -0
- package/dist/checkout/index.js +13 -0
- package/dist/chip/index.js +7 -0
- package/dist/chunk-223Q2T2Q.js +229 -0
- package/dist/chunk-2A5NIQAK.js +254 -0
- package/dist/chunk-2GK6PHGE.js +363 -0
- package/dist/chunk-2WUTXHMU.js +1 -0
- package/dist/chunk-2ZZ7TDJ4.js +324 -0
- package/dist/chunk-35OFI3JG.js +499 -0
- package/dist/chunk-3ARE4TES.js +195 -0
- package/dist/chunk-3ECPOSKO.js +1 -0
- package/dist/chunk-3ENTMPQY.js +229 -0
- package/dist/chunk-3HJH6FF4.js +98 -0
- package/dist/chunk-3NMD74ZU.js +4 -0
- package/dist/chunk-3WPW4KUN.js +182 -0
- package/dist/chunk-423B7SPN.js +993 -0
- package/dist/chunk-47FWHGUN.js +394 -0
- package/dist/chunk-4BXMXBJO.js +141 -0
- package/dist/chunk-4DS5ZWVC.js +83 -0
- package/dist/chunk-4GBOGOTV.js +295 -0
- package/dist/chunk-4SZYY6AN.js +99 -0
- package/dist/chunk-4YIP3CWS.js +237 -0
- package/dist/chunk-4YQOR7JM.js +204 -0
- package/dist/chunk-4ZAHCY44.js +177 -0
- package/dist/chunk-52X2VYTD.js +228 -0
- package/dist/chunk-5P26LBDL.js +1 -0
- package/dist/chunk-5XLRYDAX.js +1 -0
- package/dist/chunk-5YNTNN5A.js +177 -0
- package/dist/chunk-6HT2LP62.js +504 -0
- package/dist/chunk-6N33LFQA.js +35 -0
- package/dist/chunk-6X6PQ443.js +432 -0
- package/dist/chunk-7CFF4HXS.js +126 -0
- package/dist/chunk-7O2FMUPT.js +755 -0
- package/dist/chunk-AI4DWZCD.js +162 -0
- package/dist/chunk-AWJOCGFZ.js +213 -0
- package/dist/chunk-AZRX6SAC.js +285 -0
- package/dist/chunk-B54QE2FN.js +1 -0
- package/dist/chunk-BC475SJH.js +1 -0
- package/dist/chunk-BEDBFJND.js +202 -0
- package/dist/chunk-BTTFCMKG.js +166 -0
- package/dist/chunk-BV3B2HYZ.js +1635 -0
- package/dist/chunk-C2NTXVWM.js +98 -0
- package/dist/chunk-CDRZHT42.js +424 -0
- package/dist/chunk-CJ5EOYZE.js +62 -0
- package/dist/chunk-CUMUNPXY.js +128 -0
- package/dist/chunk-CUS3ZSCU.js +1 -0
- package/dist/chunk-CYRBHQQZ.js +411 -0
- package/dist/chunk-DHWADYZX.js +144 -0
- package/dist/chunk-DKCSPATL.js +1 -0
- package/dist/chunk-DM5QUKKO.js +326 -0
- package/dist/chunk-DYBH2I6W.js +1 -0
- package/dist/chunk-DZ255O2F.js +1 -0
- package/dist/chunk-E35BPSGW.js +1 -0
- package/dist/chunk-EJBDRVIH.js +166 -0
- package/dist/chunk-F43NP42L.js +1 -0
- package/dist/chunk-F5XNPWS7.js +1024 -0
- package/dist/chunk-FMYDDECK.js +1521 -0
- package/dist/chunk-G3HOYSF7.js +1 -0
- package/dist/chunk-GDKZTW34.js +395 -0
- package/dist/chunk-GL7B2DOW.js +134 -0
- package/dist/chunk-GNNJ4GCC.js +471 -0
- package/dist/chunk-GNZ56EUI.js +1 -0
- package/dist/chunk-H6NIOQHK.js +346 -0
- package/dist/chunk-H6PC7RDA.js +1 -0
- package/dist/chunk-HET4LLMX.js +129 -0
- package/dist/chunk-HPPW424V.js +334 -0
- package/dist/chunk-HQOQIBJI.js +1 -0
- package/dist/chunk-HU2EQNRZ.js +44 -0
- package/dist/chunk-HZ6CNMAF.js +870 -0
- package/dist/chunk-IIQTAY3J.js +715 -0
- package/dist/chunk-ITTYJZWX.js +271 -0
- package/dist/chunk-IVNRBPGC.js +1018 -0
- package/dist/chunk-J4KLDGI4.js +1 -0
- package/dist/chunk-J7Q7VCVC.js +254 -0
- package/dist/chunk-JDEOITQ2.js +1 -0
- package/dist/chunk-JNH2TYIN.js +96 -0
- package/dist/chunk-JNY4ZHAR.js +634 -0
- package/dist/chunk-JRLTGLN4.js +1 -0
- package/dist/chunk-JTRJJLKL.js +1 -0
- package/dist/chunk-JUAMLEHX.js +379 -0
- package/dist/chunk-JXJB2X6M.js +131 -0
- package/dist/chunk-KMI5ML5I.js +262 -0
- package/dist/chunk-KTAC4MGE.js +4 -0
- package/dist/chunk-LAECSR4H.js +178 -0
- package/dist/chunk-LK4BCSGX.js +1 -0
- package/dist/chunk-LOE5YNN3.js +470 -0
- package/dist/chunk-LRJNDEIA.js +302 -0
- package/dist/chunk-LSS54GLJ.js +116 -0
- package/dist/chunk-LZLHELAG.js +137 -0
- package/dist/chunk-M2LUXGKZ.js +1 -0
- package/dist/chunk-MOUJOP55.js +425 -0
- package/dist/chunk-N32RGOA5.js +159 -0
- package/dist/chunk-N5ZNE2YE.js +1 -0
- package/dist/chunk-NBNCBML6.js +1 -0
- package/dist/chunk-NKB7BZYK.js +167 -0
- package/dist/chunk-NQYBUO3K.js +1795 -0
- package/dist/chunk-NY2U3PBI.js +59 -0
- package/dist/chunk-O4AEHWII.js +464 -0
- package/dist/chunk-O7AE6DAF.js +146 -0
- package/dist/chunk-OETCUXQP.js +134 -0
- package/dist/chunk-OOPPQH27.js +179 -0
- package/dist/chunk-OPXFZ4Y5.js +204 -0
- package/dist/chunk-P23EQNRQ.js +338 -0
- package/dist/chunk-PJXUJYS6.js +248 -0
- package/dist/chunk-PNWUWOBF.js +1 -0
- package/dist/chunk-PUPM2YGF.js +376 -0
- package/dist/chunk-PZXZJBMP.js +620 -0
- package/dist/chunk-Q72LJOVE.js +169 -0
- package/dist/chunk-QCDXZBC5.js +247 -0
- package/dist/chunk-QDYDBCFP.js +197 -0
- package/dist/chunk-QJJ6MADV.js +274 -0
- package/dist/chunk-QKXCPTFS.js +349 -0
- package/dist/chunk-QWCMU5B2.js +860 -0
- package/dist/chunk-RIBDXGUG.js +108 -0
- package/dist/chunk-RJQOOHT2.js +214 -0
- package/dist/chunk-RNGLIHFA.js +191 -0
- package/dist/chunk-RQ3HASCC.js +6 -0
- package/dist/chunk-RSOJT5YW.js +124 -0
- package/dist/chunk-RTIKSY6A.js +1 -0
- package/dist/chunk-RUZHTGKB.js +237 -0
- package/dist/chunk-RW6ZL2FQ.js +284 -0
- package/dist/chunk-S7F6XLTK.js +540 -0
- package/dist/chunk-SBMNWWBV.js +155 -0
- package/dist/chunk-SDTQPRRB.js +1 -0
- package/dist/chunk-SYNOJOQO.js +377 -0
- package/dist/chunk-T753XT36.js +1 -0
- package/dist/chunk-TKQYWZ5V.js +196 -0
- package/dist/chunk-TKVFVF5D.js +95 -0
- package/dist/chunk-TOXAGRDQ.js +144 -0
- package/dist/chunk-TUTI5HOZ.js +112 -0
- package/dist/chunk-U7TFM2JA.js +140 -0
- package/dist/chunk-UC2WGUP3.js +627 -0
- package/dist/chunk-UWFLYMAR.js +1126 -0
- package/dist/chunk-UWSZB7BJ.js +1 -0
- package/dist/chunk-UYG5L34B.js +87 -0
- package/dist/chunk-VBOXAEPI.js +336 -0
- package/dist/chunk-VCDBXW5H.js +188 -0
- package/dist/chunk-VCXPHHDS.js +1 -0
- package/dist/chunk-VEAYTRPX.js +414 -0
- package/dist/chunk-VFCUIDRT.js +1 -0
- package/dist/chunk-VQHPQEUH.js +273 -0
- package/dist/chunk-VXDZFJGP.js +874 -0
- package/dist/chunk-WS56BL3D.js +1 -0
- package/dist/chunk-WSW6ZFAQ.js +98 -0
- package/dist/chunk-XNUVB5OL.js +375 -0
- package/dist/chunk-XOSCY2CW.js +242 -0
- package/dist/chunk-XXXEFXY5.js +99 -0
- package/dist/chunk-Y5CSSPV4.js +1 -0
- package/dist/chunk-Y6DU4J47.js +1 -0
- package/dist/chunk-YC6WORFL.js +535 -0
- package/dist/chunk-YDGVJETP.js +60 -0
- package/dist/chunk-YF4NSSMT.js +366 -0
- package/dist/chunk-YG3ZJHGU.js +223 -0
- package/dist/chunk-YIJ55TBC.js +1 -0
- package/dist/chunk-YKZ4RZZF.js +1 -0
- package/dist/chunk-YLLCXTMC.js +37 -0
- package/dist/chunk-YTA74UZR.js +1 -0
- package/dist/chunk-YTFKPRUK.js +845 -0
- package/dist/chunk-Z7H7VSFZ.js +323 -0
- package/dist/chunk-ZK2H4O5P.js +1 -0
- package/dist/chunk-ZVFE5QGU.js +524 -0
- package/dist/coachmark/index.js +4 -0
- package/dist/code-block/index.js +4 -0
- package/dist/color-field/index.js +7 -0
- package/dist/commerce/index.js +20 -0
- package/dist/connectivity/index.js +2 -0
- package/dist/context-menu/index.js +5 -0
- package/dist/copy-button/index.js +3 -0
- package/dist/data-grid/index.js +24 -0
- package/dist/date-range-picker/index.js +13 -0
- package/dist/description-list/index.js +2 -0
- package/dist/dialog/index.js +3 -0
- package/dist/empty-state/index.js +3 -0
- package/dist/error-summary/index.js +3 -0
- package/dist/fab/index.js +2 -0
- package/dist/file-upload/index.js +9 -0
- package/dist/filter-bar/index.js +8 -0
- package/dist/flow-run/index.js +14 -0
- package/dist/form/index.js +3 -0
- package/dist/gallery/index.js +2 -0
- package/dist/header/index.js +5 -0
- package/dist/hold-to-confirm/index.js +4 -0
- package/dist/index.d.ts +22883 -0
- package/dist/index.js +158 -0
- package/dist/infinite-list/index.js +2 -0
- package/dist/inline-edit/index.js +5 -0
- package/dist/input/index.js +5 -0
- package/dist/interactions/index.js +2 -0
- package/dist/invoice/index.js +10 -0
- package/dist/kbd/index.js +1 -0
- package/dist/keyboard/index.js +3 -0
- package/dist/list-row/index.js +7 -0
- package/dist/log-viewer/index.js +2 -0
- package/dist/map-view/index.js +3 -0
- package/dist/markdown/index.js +6 -0
- package/dist/metric/index.js +4 -0
- package/dist/money/index.js +3 -0
- package/dist/nav-drawer/index.js +2 -0
- package/dist/navigation/index.js +2 -0
- package/dist/notification-center/index.js +16 -0
- package/dist/number-roll/index.js +3 -0
- package/dist/one-handed/index.js +5 -0
- package/dist/os-surfaces/index.js +3 -0
- package/dist/otp/index.js +7 -0
- package/dist/page-header/index.js +1 -0
- package/dist/payment-method/index.js +12 -0
- package/dist/payment-status/index.js +16 -0
- package/dist/permission/index.js +2 -0
- package/dist/picker/index.js +7 -0
- package/dist/progress/index.js +5 -0
- package/dist/pull-to-refresh/index.js +4 -0
- package/dist/radio-group/index.js +6 -0
- package/dist/rating/index.js +2 -0
- package/dist/receivables/index.js +20 -0
- package/dist/refund/index.js +16 -0
- package/dist/save-status/index.js +3 -0
- package/dist/scroll-area/index.js +1 -0
- package/dist/search-bar/index.js +5 -0
- package/dist/segmented-control/index.js +5 -0
- package/dist/sheet/index.js +4 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/index.js +5 -0
- package/dist/spinner/index.js +2 -0
- package/dist/split-button/index.js +7 -0
- package/dist/spotlight/index.js +2 -0
- package/dist/stage-timeline/index.js +4 -0
- package/dist/status-dot/index.js +2 -0
- package/dist/stepper/index.js +6 -0
- package/dist/streaming-text/index.js +3 -0
- package/dist/survey/index.js +19 -0
- package/dist/switch/index.js +5 -0
- package/dist/system-state/index.js +4 -0
- package/dist/tab-bar/index.js +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/textarea/index.js +6 -0
- package/dist/thinking/index.js +2 -0
- package/dist/timeline/index.js +4 -0
- package/dist/toast/index.js +2 -0
- package/dist/toolbar/index.js +2 -0
- package/dist/tour/index.js +11 -0
- package/dist/truncation-notice/index.js +2 -0
- package/dist/update-notice/index.js +11 -0
- package/dist/video-player/index.js +2 -0
- package/dist/viewfinder/index.js +5 -0
- package/dist/widget/index.js +4 -0
- package/dist/wizard/index.js +6 -0
- package/package.json +76 -3
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Animated, Easing, AccessibilityInfo, View } from 'react-native';
|
|
3
|
+
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/skeleton/skeleton.tsx
|
|
7
|
+
var CIRCLE_DEFAULT = 40;
|
|
8
|
+
var TEXT_HEIGHT = 14;
|
|
9
|
+
var RECT_HEIGHT = 120;
|
|
10
|
+
function Skeleton({
|
|
11
|
+
variant = "text",
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
14
|
+
radius,
|
|
15
|
+
style,
|
|
16
|
+
accessibilityLabel = "Loading",
|
|
17
|
+
testID
|
|
18
|
+
}) {
|
|
19
|
+
const theme = useLoamTheme();
|
|
20
|
+
const { styles } = useStyles(sheet, { variant });
|
|
21
|
+
let resolvedWidth;
|
|
22
|
+
let resolvedHeight;
|
|
23
|
+
if (variant === "circle") {
|
|
24
|
+
const size = width ?? height ?? CIRCLE_DEFAULT;
|
|
25
|
+
resolvedWidth = size;
|
|
26
|
+
resolvedHeight = size;
|
|
27
|
+
} else {
|
|
28
|
+
resolvedWidth = width ?? "100%";
|
|
29
|
+
resolvedHeight = height ?? (variant === "text" ? TEXT_HEIGHT : RECT_HEIGHT);
|
|
30
|
+
}
|
|
31
|
+
const opacity = React.useRef(new Animated.Value(1)).current;
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
let cancelled = false;
|
|
34
|
+
let loop;
|
|
35
|
+
const bezier = Easing.bezier(...theme.easing.base);
|
|
36
|
+
AccessibilityInfo.isReduceMotionEnabled().then((reduced) => {
|
|
37
|
+
if (cancelled || reduced) return;
|
|
38
|
+
loop = Animated.loop(
|
|
39
|
+
Animated.sequence([
|
|
40
|
+
Animated.timing(opacity, {
|
|
41
|
+
toValue: 0.5,
|
|
42
|
+
duration: theme.duration.slow,
|
|
43
|
+
easing: bezier,
|
|
44
|
+
useNativeDriver: true
|
|
45
|
+
}),
|
|
46
|
+
Animated.timing(opacity, {
|
|
47
|
+
toValue: 1,
|
|
48
|
+
duration: theme.duration.slow,
|
|
49
|
+
easing: bezier,
|
|
50
|
+
useNativeDriver: true
|
|
51
|
+
})
|
|
52
|
+
])
|
|
53
|
+
);
|
|
54
|
+
loop.start();
|
|
55
|
+
});
|
|
56
|
+
return () => {
|
|
57
|
+
cancelled = true;
|
|
58
|
+
loop?.stop();
|
|
59
|
+
};
|
|
60
|
+
}, [opacity, theme.duration.slow, theme.easing.base]);
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
Animated.View,
|
|
63
|
+
{
|
|
64
|
+
accessibilityRole: "image",
|
|
65
|
+
accessibilityLabel,
|
|
66
|
+
accessibilityState: { busy: true },
|
|
67
|
+
testID,
|
|
68
|
+
style: [
|
|
69
|
+
styles.base,
|
|
70
|
+
{ width: resolvedWidth, height: resolvedHeight, opacity },
|
|
71
|
+
radius ? { borderRadius: theme.radius[radius] } : null,
|
|
72
|
+
style
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function SkeletonText({
|
|
78
|
+
lines = 3,
|
|
79
|
+
lastLineWidth = "60%",
|
|
80
|
+
lineHeight = TEXT_HEIGHT,
|
|
81
|
+
style,
|
|
82
|
+
testID
|
|
83
|
+
}) {
|
|
84
|
+
const theme = useLoamTheme();
|
|
85
|
+
return /* @__PURE__ */ jsx(View, { style: [{ gap: theme.space.s2 }, style], testID, children: Array.from({ length: Math.max(0, lines) }).map((_, i) => /* @__PURE__ */ jsx(
|
|
86
|
+
Skeleton,
|
|
87
|
+
{
|
|
88
|
+
variant: "text",
|
|
89
|
+
height: lineHeight,
|
|
90
|
+
style: i === lines - 1 ? { width: lastLineWidth } : void 0
|
|
91
|
+
},
|
|
92
|
+
i
|
|
93
|
+
)) });
|
|
94
|
+
}
|
|
95
|
+
var sheet = createStyleSheet((theme) => ({
|
|
96
|
+
base: {
|
|
97
|
+
backgroundColor: theme.color.surface2,
|
|
98
|
+
variants: {
|
|
99
|
+
variant: {
|
|
100
|
+
text: { borderRadius: theme.radius.sm },
|
|
101
|
+
circle: { borderRadius: theme.radius.full },
|
|
102
|
+
rect: { borderRadius: theme.radius.lg }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
export { Skeleton, SkeletonText };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Dialog, DialogTitle, DialogFooter } from './chunk-OPXFZ4Y5.js';
|
|
2
|
+
import { Button } from './chunk-3ARE4TES.js';
|
|
3
|
+
import { Icon } from './chunk-TKVFVF5D.js';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { Animated, Easing, Text, Pressable, View } from 'react-native';
|
|
6
|
+
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
function AnnouncementBar({
|
|
10
|
+
tone = "info",
|
|
11
|
+
children,
|
|
12
|
+
icon,
|
|
13
|
+
actionLabel,
|
|
14
|
+
onAction,
|
|
15
|
+
onDismiss,
|
|
16
|
+
dismissLabel = "Dismiss",
|
|
17
|
+
wrap = false,
|
|
18
|
+
motion = "full"
|
|
19
|
+
}) {
|
|
20
|
+
const theme = useLoamTheme();
|
|
21
|
+
const { styles } = useStyles(sheet, { tone });
|
|
22
|
+
const slide = React.useRef(new Animated.Value(0)).current;
|
|
23
|
+
const animate = motion === "full" && !theme.reduceMotion;
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
Animated.timing(slide, {
|
|
26
|
+
toValue: 1,
|
|
27
|
+
duration: animate ? theme.motion.enter.duration : 0,
|
|
28
|
+
easing: Easing.bezier(...theme.motion.enter.easing),
|
|
29
|
+
useNativeDriver: true
|
|
30
|
+
}).start();
|
|
31
|
+
}, [slide, animate, theme.motion.enter]);
|
|
32
|
+
const ink = tone === "info" ? theme.color.infoOnSoft : tone === "warn" ? theme.color.warnOnSoft : tone === "danger" ? theme.color.dangerOnSoft : tone === "good" ? theme.color.goodOnSoft : theme.color.accentOnSoft;
|
|
33
|
+
const defaultIcon = tone === "warn" ? "alert-triangle" : tone === "danger" ? "alert-circle" : tone === "good" ? "check-circle" : tone === "accent" ? "star" : "info";
|
|
34
|
+
return /* @__PURE__ */ jsxs(
|
|
35
|
+
Animated.View,
|
|
36
|
+
{
|
|
37
|
+
accessibilityRole: tone === "warn" || tone === "danger" ? "alert" : "text",
|
|
38
|
+
accessibilityLiveRegion: "polite",
|
|
39
|
+
style: [
|
|
40
|
+
styles.bar,
|
|
41
|
+
{
|
|
42
|
+
transform: [
|
|
43
|
+
{ translateY: slide.interpolate({ inputRange: [0, 1], outputRange: [-theme.space[40], 0] }) }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Icon, { name: icon ?? defaultIcon, size: theme.icon.sm, color: ink }),
|
|
49
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: wrap ? 2 : 1, style: [styles.text, { color: ink }], children }),
|
|
50
|
+
actionLabel && onAction ? /* @__PURE__ */ jsxs(
|
|
51
|
+
Pressable,
|
|
52
|
+
{
|
|
53
|
+
accessibilityRole: "button",
|
|
54
|
+
accessibilityLabel: actionLabel,
|
|
55
|
+
onPress: onAction,
|
|
56
|
+
hitSlop: theme.space[10],
|
|
57
|
+
style: styles.action,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.actionLabel, { color: ink }], children: actionLabel }),
|
|
60
|
+
/* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: theme.icon.xs, color: ink })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
) : null,
|
|
64
|
+
onDismiss ? /* @__PURE__ */ jsx(
|
|
65
|
+
Pressable,
|
|
66
|
+
{
|
|
67
|
+
accessibilityRole: "button",
|
|
68
|
+
accessibilityLabel: dismissLabel,
|
|
69
|
+
onPress: onDismiss,
|
|
70
|
+
hitSlop: theme.space[10],
|
|
71
|
+
style: styles.iconButton,
|
|
72
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "x", size: theme.icon.xs, color: ink })
|
|
73
|
+
}
|
|
74
|
+
) : null
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function AnnouncementHighlights({
|
|
80
|
+
items
|
|
81
|
+
}) {
|
|
82
|
+
const theme = useLoamTheme();
|
|
83
|
+
const { styles } = useStyles(sheet, { tone: "info" });
|
|
84
|
+
if (!items.length) return null;
|
|
85
|
+
return /* @__PURE__ */ jsx(View, { style: styles.highlights, children: items.map((h) => /* @__PURE__ */ jsxs(View, { style: styles.highlightRow, children: [
|
|
86
|
+
/* @__PURE__ */ jsx(Icon, { name: "check", size: theme.icon.xs, color: theme.color.good }),
|
|
87
|
+
/* @__PURE__ */ jsx(Text, { style: styles.highlightText, children: h })
|
|
88
|
+
] }, h)) });
|
|
89
|
+
}
|
|
90
|
+
function AnnouncementModal({
|
|
91
|
+
open,
|
|
92
|
+
onOpenChange,
|
|
93
|
+
kicker,
|
|
94
|
+
title,
|
|
95
|
+
body,
|
|
96
|
+
media,
|
|
97
|
+
highlights,
|
|
98
|
+
primaryLabel = "See what changed",
|
|
99
|
+
onPrimary,
|
|
100
|
+
secondaryLabel = "Later",
|
|
101
|
+
onSecondary,
|
|
102
|
+
motion = "full"
|
|
103
|
+
}) {
|
|
104
|
+
const { styles } = useStyles(sheet, { tone: "info" });
|
|
105
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onClose: () => onOpenChange(false), accessibilityLabel: title, motion, children: [
|
|
106
|
+
/* @__PURE__ */ jsxs(View, { style: styles.modalBody, children: [
|
|
107
|
+
kicker ? /* @__PURE__ */ jsx(Text, { style: styles.kicker, children: kicker }) : null,
|
|
108
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: title }),
|
|
109
|
+
media,
|
|
110
|
+
body ? /* @__PURE__ */ jsx(Text, { style: styles.modalText, children: body }) : null,
|
|
111
|
+
highlights ? /* @__PURE__ */ jsx(AnnouncementHighlights, { items: highlights }) : null
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
Button,
|
|
116
|
+
{
|
|
117
|
+
size: "lg",
|
|
118
|
+
variant: "outline",
|
|
119
|
+
onPress: () => {
|
|
120
|
+
onSecondary?.();
|
|
121
|
+
onOpenChange(false);
|
|
122
|
+
},
|
|
123
|
+
children: secondaryLabel
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
Button,
|
|
128
|
+
{
|
|
129
|
+
size: "lg",
|
|
130
|
+
variant: "primary",
|
|
131
|
+
onPress: () => {
|
|
132
|
+
onPrimary?.();
|
|
133
|
+
onOpenChange(false);
|
|
134
|
+
},
|
|
135
|
+
children: primaryLabel
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] })
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
var sheet = createStyleSheet((theme) => ({
|
|
142
|
+
bar: {
|
|
143
|
+
flexDirection: "row",
|
|
144
|
+
alignItems: "center",
|
|
145
|
+
gap: theme.space[11],
|
|
146
|
+
paddingHorizontal: theme.space[12],
|
|
147
|
+
paddingVertical: theme.space[9],
|
|
148
|
+
borderBottomWidth: theme.borderWidth.thin,
|
|
149
|
+
borderBottomColor: theme.color.border,
|
|
150
|
+
variants: {
|
|
151
|
+
// Each tint pairs with its own on-soft ink and a tone edge, so the strip
|
|
152
|
+
// survives high contrast, where the tint collapses to the plain surface.
|
|
153
|
+
tone: {
|
|
154
|
+
info: { backgroundColor: theme.color.infoSoft, borderBottomColor: theme.edge.info },
|
|
155
|
+
warn: { backgroundColor: theme.color.warnSoft, borderBottomColor: theme.edge.warn },
|
|
156
|
+
danger: { backgroundColor: theme.color.dangerSoft, borderBottomColor: theme.edge.danger },
|
|
157
|
+
good: { backgroundColor: theme.color.goodSoft, borderBottomColor: theme.edge.good },
|
|
158
|
+
accent: { backgroundColor: theme.color.accentSoft, borderBottomColor: theme.edge.accent }
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
text: {
|
|
163
|
+
flex: 1,
|
|
164
|
+
fontFamily: theme.font.sans,
|
|
165
|
+
fontSize: theme.type.footnote.fontSize,
|
|
166
|
+
lineHeight: theme.type.footnote.lineHeight
|
|
167
|
+
},
|
|
168
|
+
action: { flexDirection: "row", alignItems: "center", gap: theme.space[2] },
|
|
169
|
+
actionLabel: {
|
|
170
|
+
fontFamily: theme.font.sans,
|
|
171
|
+
fontWeight: theme.fontWeight.extrabold,
|
|
172
|
+
fontSize: theme.type.footnote.fontSize,
|
|
173
|
+
textDecorationLine: "underline"
|
|
174
|
+
},
|
|
175
|
+
iconButton: {
|
|
176
|
+
width: theme.ctl.xs,
|
|
177
|
+
height: theme.ctl.xs,
|
|
178
|
+
alignItems: "center",
|
|
179
|
+
justifyContent: "center",
|
|
180
|
+
borderRadius: theme.radius.full
|
|
181
|
+
},
|
|
182
|
+
highlights: {
|
|
183
|
+
gap: theme.space[8],
|
|
184
|
+
padding: theme.space[12],
|
|
185
|
+
borderRadius: theme.radius.md,
|
|
186
|
+
borderWidth: theme.borderWidth.thin,
|
|
187
|
+
borderColor: theme.color.border,
|
|
188
|
+
backgroundColor: theme.color.surface2
|
|
189
|
+
},
|
|
190
|
+
highlightRow: { flexDirection: "row", alignItems: "flex-start", gap: theme.space[9] },
|
|
191
|
+
highlightText: {
|
|
192
|
+
flex: 1,
|
|
193
|
+
fontFamily: theme.font.sans,
|
|
194
|
+
fontSize: theme.type.subheadline.fontSize,
|
|
195
|
+
lineHeight: theme.type.subheadline.lineHeight,
|
|
196
|
+
color: theme.color.text2
|
|
197
|
+
},
|
|
198
|
+
modalBody: { gap: theme.space[12] },
|
|
199
|
+
modalText: {
|
|
200
|
+
fontFamily: theme.font.sans,
|
|
201
|
+
fontSize: theme.type.body.fontSize,
|
|
202
|
+
lineHeight: theme.type.body.lineHeight,
|
|
203
|
+
color: theme.color.text2
|
|
204
|
+
},
|
|
205
|
+
kicker: {
|
|
206
|
+
fontFamily: theme.font.mono,
|
|
207
|
+
fontSize: theme.type.caption2.fontSize,
|
|
208
|
+
letterSpacing: theme.tracking.caps,
|
|
209
|
+
textTransform: "uppercase",
|
|
210
|
+
color: theme.color.accentStrong
|
|
211
|
+
}
|
|
212
|
+
}));
|
|
213
|
+
|
|
214
|
+
export { AnnouncementBar, AnnouncementHighlights, AnnouncementModal };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/kbd/kbd.tsx
|
|
7
|
+
var COMMON_GLYPHS = {
|
|
8
|
+
enter: "\u21B5",
|
|
9
|
+
return: "\u21B5",
|
|
10
|
+
esc: "Esc",
|
|
11
|
+
escape: "Esc",
|
|
12
|
+
tab: "\u21E5",
|
|
13
|
+
backspace: "\u232B",
|
|
14
|
+
delete: "\u2326",
|
|
15
|
+
del: "\u2326",
|
|
16
|
+
space: "\u2423",
|
|
17
|
+
up: "\u2191",
|
|
18
|
+
down: "\u2193",
|
|
19
|
+
left: "\u2190",
|
|
20
|
+
right: "\u2192",
|
|
21
|
+
arrowup: "\u2191",
|
|
22
|
+
arrowdown: "\u2193",
|
|
23
|
+
arrowleft: "\u2190",
|
|
24
|
+
arrowright: "\u2192",
|
|
25
|
+
pageup: "\u21DE",
|
|
26
|
+
pagedown: "\u21DF",
|
|
27
|
+
home: "\u2196",
|
|
28
|
+
end: "\u2198",
|
|
29
|
+
capslock: "\u21EA",
|
|
30
|
+
win: "\u229E"
|
|
31
|
+
};
|
|
32
|
+
var APPLE_MODIFIERS = {
|
|
33
|
+
cmd: "\u2318",
|
|
34
|
+
command: "\u2318",
|
|
35
|
+
meta: "\u2318",
|
|
36
|
+
super: "\u2318",
|
|
37
|
+
shift: "\u21E7",
|
|
38
|
+
ctrl: "\u2303",
|
|
39
|
+
control: "\u2303",
|
|
40
|
+
alt: "\u2325",
|
|
41
|
+
opt: "\u2325",
|
|
42
|
+
option: "\u2325"
|
|
43
|
+
};
|
|
44
|
+
var TEXT_MODIFIERS = {
|
|
45
|
+
cmd: "Cmd",
|
|
46
|
+
command: "Cmd",
|
|
47
|
+
meta: "Meta",
|
|
48
|
+
super: "Super",
|
|
49
|
+
shift: "Shift",
|
|
50
|
+
ctrl: "Ctrl",
|
|
51
|
+
control: "Ctrl",
|
|
52
|
+
alt: "Alt",
|
|
53
|
+
opt: "Alt",
|
|
54
|
+
option: "Alt"
|
|
55
|
+
};
|
|
56
|
+
var SPOKEN = {
|
|
57
|
+
cmd: "Command",
|
|
58
|
+
command: "Command",
|
|
59
|
+
meta: "Command",
|
|
60
|
+
super: "Command",
|
|
61
|
+
shift: "Shift",
|
|
62
|
+
ctrl: "Control",
|
|
63
|
+
control: "Control",
|
|
64
|
+
alt: "Option",
|
|
65
|
+
opt: "Option",
|
|
66
|
+
option: "Option",
|
|
67
|
+
enter: "Enter",
|
|
68
|
+
return: "Return",
|
|
69
|
+
esc: "Escape",
|
|
70
|
+
escape: "Escape",
|
|
71
|
+
tab: "Tab",
|
|
72
|
+
backspace: "Backspace",
|
|
73
|
+
delete: "Delete",
|
|
74
|
+
del: "Delete",
|
|
75
|
+
space: "Space",
|
|
76
|
+
up: "Up",
|
|
77
|
+
down: "Down",
|
|
78
|
+
left: "Left",
|
|
79
|
+
right: "Right",
|
|
80
|
+
arrowup: "Up",
|
|
81
|
+
arrowdown: "Down",
|
|
82
|
+
arrowleft: "Left",
|
|
83
|
+
arrowright: "Right",
|
|
84
|
+
pageup: "Page Up",
|
|
85
|
+
pagedown: "Page Down",
|
|
86
|
+
home: "Home",
|
|
87
|
+
end: "End",
|
|
88
|
+
capslock: "Caps Lock",
|
|
89
|
+
win: "Windows"
|
|
90
|
+
};
|
|
91
|
+
function resolveKey(key, symbols, apple) {
|
|
92
|
+
if (!symbols) return key;
|
|
93
|
+
const k = key.trim().toLowerCase();
|
|
94
|
+
const modifiers = apple ? APPLE_MODIFIERS : TEXT_MODIFIERS;
|
|
95
|
+
return modifiers[k] ?? COMMON_GLYPHS[k] ?? key;
|
|
96
|
+
}
|
|
97
|
+
function spokenKey(key, apple) {
|
|
98
|
+
const k = key.trim().toLowerCase();
|
|
99
|
+
const word = SPOKEN[k];
|
|
100
|
+
if (word) {
|
|
101
|
+
if (!apple && (k === "alt" || k === "opt" || k === "option")) return "Alt";
|
|
102
|
+
return word;
|
|
103
|
+
}
|
|
104
|
+
return key.length === 1 ? key.toUpperCase() : key;
|
|
105
|
+
}
|
|
106
|
+
function spokenLabel(parts, apple) {
|
|
107
|
+
return parts.map((k) => spokenKey(k, apple)).join(" ");
|
|
108
|
+
}
|
|
109
|
+
function Kbd({
|
|
110
|
+
keys,
|
|
111
|
+
symbols = true,
|
|
112
|
+
size = "md",
|
|
113
|
+
// `motion` is accepted for API parity but intentionally unused — Kbd has no
|
|
114
|
+
// animation. Destructured so it never lands on the underlying View.
|
|
115
|
+
motion: _motion = "full",
|
|
116
|
+
children,
|
|
117
|
+
accessibilityLabel
|
|
118
|
+
}) {
|
|
119
|
+
const { styles } = useStyles(sheet, { size });
|
|
120
|
+
const theme = useLoamTheme();
|
|
121
|
+
const apple = theme.platform === "iOS";
|
|
122
|
+
if (keys === void 0) {
|
|
123
|
+
const label2 = accessibilityLabel ?? (typeof children === "string" ? spokenLabel([children], apple) : void 0);
|
|
124
|
+
return /* @__PURE__ */ jsx(View, { accessible: true, accessibilityRole: "text", accessibilityLabel: label2, style: styles.cap, children: typeof children === "string" ? /* @__PURE__ */ jsx(Text, { style: styles.label, children }) : children });
|
|
125
|
+
}
|
|
126
|
+
const list = Array.isArray(keys) ? keys : String(keys).split("+");
|
|
127
|
+
const parts = list.map((k) => k.trim()).filter((k) => k.length > 0);
|
|
128
|
+
const label = accessibilityLabel ?? spokenLabel(parts, apple);
|
|
129
|
+
return /* @__PURE__ */ jsx(View, { accessible: true, accessibilityRole: "text", accessibilityLabel: label, style: styles.group, children: parts.map((key, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
130
|
+
i > 0 ? /* @__PURE__ */ jsx(Text, { style: styles.plus, children: "+" }) : null,
|
|
131
|
+
/* @__PURE__ */ jsx(View, { style: styles.cap, children: /* @__PURE__ */ jsx(Text, { style: styles.label, children: resolveKey(key, symbols, apple) }) })
|
|
132
|
+
] }, `${key}-${i}`)) });
|
|
133
|
+
}
|
|
134
|
+
var sheet = createStyleSheet((theme) => ({
|
|
135
|
+
// The row of keycaps. `space.s1` gap matches the web `gap-1` between caps.
|
|
136
|
+
group: { flexDirection: "row", alignItems: "center", gap: theme.space.s1 },
|
|
137
|
+
// A single keycap. No native `--kbd-bg` token exists, so — as the native
|
|
138
|
+
// contract prescribes — the subtle surface falls back to `surface2` + a
|
|
139
|
+
// hairline border. The tiny `minWidth`/`minHeight` (20 / 24) mirror the web
|
|
140
|
+
// `kbd`'s raw-px `h-[20px]`/`min-w-[20px]` keycap box one-to-one.
|
|
141
|
+
cap: {
|
|
142
|
+
alignItems: "center",
|
|
143
|
+
justifyContent: "center",
|
|
144
|
+
backgroundColor: theme.color.surface2,
|
|
145
|
+
borderWidth: theme.borderWidth.base,
|
|
146
|
+
borderColor: theme.color.border,
|
|
147
|
+
borderRadius: theme.radius.sm,
|
|
148
|
+
variants: {
|
|
149
|
+
size: {
|
|
150
|
+
sm: {
|
|
151
|
+
minWidth: theme.space[20],
|
|
152
|
+
minHeight: theme.space[20],
|
|
153
|
+
paddingHorizontal: theme.space.s1
|
|
154
|
+
},
|
|
155
|
+
md: {
|
|
156
|
+
minWidth: theme.space[24],
|
|
157
|
+
minHeight: theme.space[24],
|
|
158
|
+
paddingHorizontal: theme.space.s2
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
// Monospace, tabular figures so combos line up. `text2` matches web `text-ink-2`.
|
|
164
|
+
label: {
|
|
165
|
+
fontFamily: theme.font.mono,
|
|
166
|
+
color: theme.color.text2,
|
|
167
|
+
textAlign: "center",
|
|
168
|
+
fontVariant: ["tabular-nums"],
|
|
169
|
+
variants: {
|
|
170
|
+
size: {
|
|
171
|
+
sm: {
|
|
172
|
+
fontSize: theme.type.caption2.fontSize,
|
|
173
|
+
lineHeight: theme.type.caption2.lineHeight
|
|
174
|
+
},
|
|
175
|
+
md: {
|
|
176
|
+
fontSize: theme.type.caption1.fontSize,
|
|
177
|
+
lineHeight: theme.type.caption1.lineHeight
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
// The `+` between keys — muted (`text3`, web `text-ink-3`), decorative only.
|
|
183
|
+
plus: {
|
|
184
|
+
fontFamily: theme.font.mono,
|
|
185
|
+
color: theme.color.text3,
|
|
186
|
+
fontSize: theme.type.caption1.fontSize,
|
|
187
|
+
lineHeight: theme.type.caption1.lineHeight
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
190
|
+
|
|
191
|
+
export { Kbd };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Icon } from './chunk-TKVFVF5D.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { View, Pressable, Text } from 'react-native';
|
|
4
|
+
import { Svg, Path } from 'react-native-svg';
|
|
5
|
+
import { icons, ICON_VIEWBOX } from '@btndprojects/loam-icons';
|
|
6
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var ICON_SIZE = { sm: 20, md: 26, lg: 34 };
|
|
10
|
+
var STAR_PATH = icons.star.flatMap((part) => part.t === "path" ? [part.d] : []).join(" ");
|
|
11
|
+
function toHalfStep(value) {
|
|
12
|
+
return Math.round(value * 2) / 2;
|
|
13
|
+
}
|
|
14
|
+
function Star({ fraction, size }) {
|
|
15
|
+
const theme = useLoamTheme();
|
|
16
|
+
const { styles } = useStyles(starSheet);
|
|
17
|
+
const filled = Math.max(0, Math.min(1, fraction));
|
|
18
|
+
return /* @__PURE__ */ jsxs(View, { style: { width: size, height: size }, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Icon, { name: "star", size, color: theme.color.text3 }),
|
|
20
|
+
filled > 0 ? /* @__PURE__ */ jsx(View, { testID: "rating-star-fill", style: [styles.clip, { width: size * filled }], children: /* @__PURE__ */ jsx(View, { style: styles.paint, children: /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: ICON_VIEWBOX, children: /* @__PURE__ */ jsx(
|
|
21
|
+
Path,
|
|
22
|
+
{
|
|
23
|
+
d: STAR_PATH,
|
|
24
|
+
fill: theme.color.warn,
|
|
25
|
+
stroke: theme.color.warn,
|
|
26
|
+
strokeWidth: theme.borderWidth.thick,
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
strokeLinejoin: "round"
|
|
29
|
+
}
|
|
30
|
+
) }) }) }) : null
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
function Rating({
|
|
34
|
+
value,
|
|
35
|
+
defaultValue = 0,
|
|
36
|
+
onValueChange,
|
|
37
|
+
max = 5,
|
|
38
|
+
size = "md",
|
|
39
|
+
readOnly = false,
|
|
40
|
+
accessibilityLabel = "Rating",
|
|
41
|
+
showValue = false,
|
|
42
|
+
count
|
|
43
|
+
}) {
|
|
44
|
+
const { styles } = useStyles(sheet, { size });
|
|
45
|
+
const theme = useLoamTheme();
|
|
46
|
+
const iconSize = ICON_SIZE[size];
|
|
47
|
+
const starSlopY = Math.max(0, (theme.tapMin - (iconSize + theme.space.s1 * 2)) / 2);
|
|
48
|
+
const isControlled = value !== void 0;
|
|
49
|
+
const [internal, setInternal] = React.useState(defaultValue);
|
|
50
|
+
const current = isControlled ? value : internal;
|
|
51
|
+
const setValue = (next) => {
|
|
52
|
+
if (!isControlled) setInternal(next);
|
|
53
|
+
onValueChange?.(next);
|
|
54
|
+
};
|
|
55
|
+
const snapped = toHalfStep(Math.max(0, Math.min(max, current)));
|
|
56
|
+
const shown = Number.isInteger(snapped) ? String(snapped) : snapped.toFixed(1);
|
|
57
|
+
const label = readOnly ? `${accessibilityLabel}: ${shown} out of ${max} stars` : accessibilityLabel;
|
|
58
|
+
const readoutLabel = count !== void 0 ? `${shown} of ${max} \xB7 ${count} reviews` : `${shown} of ${max}`;
|
|
59
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.wrapper, children: [
|
|
60
|
+
/* @__PURE__ */ jsx(View, { style: styles.row, role: "group", accessibilityLabel: label, children: Array.from({ length: max }, (_, i) => {
|
|
61
|
+
const starValue = i + 1;
|
|
62
|
+
const fraction = Math.max(0, Math.min(1, snapped - i));
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
Pressable,
|
|
65
|
+
{
|
|
66
|
+
style: styles.star,
|
|
67
|
+
accessibilityRole: "button",
|
|
68
|
+
accessibilityLabel: `Rate ${starValue} of ${max}`,
|
|
69
|
+
accessibilityState: { disabled: readOnly, selected: fraction >= 0.5 },
|
|
70
|
+
disabled: readOnly,
|
|
71
|
+
hitSlop: { top: starSlopY, bottom: starSlopY },
|
|
72
|
+
onPress: readOnly ? void 0 : () => setValue(starValue),
|
|
73
|
+
children: /* @__PURE__ */ jsx(Star, { fraction, size: iconSize })
|
|
74
|
+
},
|
|
75
|
+
i
|
|
76
|
+
);
|
|
77
|
+
}) }),
|
|
78
|
+
showValue ? /* @__PURE__ */ jsx(Text, { testID: "rating-readout", style: styles.readout, children: readoutLabel }) : null
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
var sheet = createStyleSheet((theme) => ({
|
|
82
|
+
// Outer wrapper groups the star row with the optional readout.
|
|
83
|
+
wrapper: {
|
|
84
|
+
flexDirection: "row",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
gap: theme.space.s2
|
|
87
|
+
},
|
|
88
|
+
row: {
|
|
89
|
+
flexDirection: "row",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
variants: {
|
|
92
|
+
size: {
|
|
93
|
+
sm: { gap: theme.space.s1 },
|
|
94
|
+
md: { gap: theme.space.s1 },
|
|
95
|
+
lg: { gap: theme.space.s2 }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
star: {
|
|
100
|
+
padding: theme.space.s1
|
|
101
|
+
},
|
|
102
|
+
// Companion readout — uses body/sm weight and text2 tone so it reads as
|
|
103
|
+
// secondary information alongside the star icons.
|
|
104
|
+
readout: {
|
|
105
|
+
fontFamily: theme.font.sans,
|
|
106
|
+
fontSize: theme.fontSize[14],
|
|
107
|
+
color: theme.color.text2
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
var starSheet = createStyleSheet(() => ({
|
|
111
|
+
// `start` + `overflow: 'hidden'` is the clip: the painted star inside keeps its
|
|
112
|
+
// full width and is cropped to the fraction, from the leading edge either way
|
|
113
|
+
// round, so RTL needs no sign flip.
|
|
114
|
+
clip: {
|
|
115
|
+
position: "absolute",
|
|
116
|
+
top: 0,
|
|
117
|
+
bottom: 0,
|
|
118
|
+
start: 0,
|
|
119
|
+
overflow: "hidden"
|
|
120
|
+
},
|
|
121
|
+
paint: { position: "absolute", top: 0, start: 0 }
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
export { Rating };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|