@marktiderman/genesis-ui-native 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/{chunk-KH2RVAI5.js → chunk-DHONOH6K.js} +24 -210
- package/dist/chunk-DHONOH6K.js.map +1 -0
- package/dist/{chunk-O4BMDV7I.js → chunk-FGIIBON3.js} +333 -21
- package/dist/chunk-FGIIBON3.js.map +1 -0
- package/dist/{chunk-YWDDDYDI.js → chunk-FOJJB6AB.js} +2 -2
- package/dist/{chunk-YWDDDYDI.js.map → chunk-FOJJB6AB.js.map} +1 -1
- package/dist/{chunk-IXC3LO2K.js → chunk-JZ7RAGDQ.js} +44 -36
- package/dist/chunk-JZ7RAGDQ.js.map +1 -0
- package/dist/{chunk-RTYO24SC.js → chunk-PWS2HLDE.js} +63 -31
- package/dist/chunk-PWS2HLDE.js.map +1 -0
- package/dist/{chunk-3KFUS7O6.js → chunk-PWYMRUAK.js} +43 -30
- package/dist/chunk-PWYMRUAK.js.map +1 -0
- package/dist/{chunk-GBNIBHSU.js → chunk-T7FEVT62.js} +53 -12
- package/dist/chunk-T7FEVT62.js.map +1 -0
- package/dist/{chunk-7NDKIIOT.js → chunk-UZCJDMGE.js} +353 -19
- package/dist/chunk-UZCJDMGE.js.map +1 -0
- package/dist/components/index.d.ts +229 -23
- package/dist/components/index.js +5 -6
- package/dist/data/index.d.ts +2 -1
- package/dist/data/index.js +7 -12
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +7 -3
- package/dist/hooks/index.js +2 -3
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/icons/lucide.js +13 -3
- package/dist/icons/lucide.js.map +1 -1
- package/dist/{inbox-page-B7_Oi2fS.d.ts → inbox-page-BGqR_cBs.d.ts} +4 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -9
- package/dist/layouts/index.d.ts +12 -3
- package/dist/layouts/index.js +5 -6
- package/dist/{native-modules-DEJJQhDx.d.ts → native-modules-CeAaO2Dh.d.ts} +26 -2
- package/package.json +49 -1
- package/src/__tests__/native-modules-lists.test.tsx +1 -0
- package/src/components/__tests__/bulk-bar.test.tsx +36 -0
- package/src/components/__tests__/button-haptic.test.tsx +22 -0
- package/src/components/__tests__/composer-bar.test.tsx +116 -1
- package/src/components/__tests__/gallery-grid.test.tsx +2 -2
- package/src/components/__tests__/library-round-5.test.tsx +121 -0
- package/src/components/__tests__/share-sheet.test.tsx +47 -0
- package/src/components/__tests__/swipe-row-context-menu.test.tsx +215 -0
- package/src/components/__tests__/tab-bar.test.tsx +43 -0
- package/src/components/__tests__/thread-list.test.tsx +137 -0
- package/src/components/__tests__/tier-badge.test.tsx +57 -0
- package/src/components/__tests__/whats-new-sheet.test.tsx +29 -0
- package/src/components/bulk-bar.tsx +91 -0
- package/src/components/button.tsx +74 -35
- package/src/components/choice-card.tsx +104 -0
- package/src/components/composer-bar.tsx +20 -19
- package/src/components/context-menu.tsx +101 -0
- package/src/components/gallery-grid.tsx +10 -4
- package/src/components/index.ts +18 -1
- package/src/components/inline-alert.tsx +36 -1
- package/src/components/input.tsx +3 -0
- package/src/components/progress.tsx +24 -2
- package/src/components/rating.tsx +35 -16
- package/src/components/share-sheet.tsx +127 -0
- package/src/components/sheet.tsx +9 -1
- package/src/components/swipe-row.tsx +74 -0
- package/src/components/tab-bar.tsx +133 -0
- package/src/components/tabs.tsx +2 -0
- package/src/components/text.tsx +3 -0
- package/src/components/textarea.tsx +3 -0
- package/src/components/thread-list.tsx +48 -23
- package/src/components/tier-badge.tsx +74 -0
- package/src/components/whats-new-sheet.tsx +89 -0
- package/src/data/resource-view/NativeRecordView.tsx +3 -8
- package/src/data/resource-view/use-native-resource-view.ts +2 -2
- package/src/hooks/index.ts +1 -1
- package/src/hooks/use-theme-roles.ts +3 -0
- package/src/icon-names.ts +12 -2
- package/src/icons/lucide.ts +27 -7
- package/src/layouts/__tests__/inbox-page.test.tsx +26 -7
- package/src/layouts/__tests__/thread-page.test.tsx +89 -2
- package/src/layouts/inbox-page.tsx +28 -12
- package/src/layouts/thread-page.tsx +69 -8
- package/src/native-modules.tsx +16 -0
- package/dist/chunk-3KFUS7O6.js.map +0 -1
- package/dist/chunk-7NDKIIOT.js.map +0 -1
- package/dist/chunk-CAI7LGN6.js +0 -39
- package/dist/chunk-CAI7LGN6.js.map +0 -1
- package/dist/chunk-GBNIBHSU.js.map +0 -1
- package/dist/chunk-IXC3LO2K.js.map +0 -1
- package/dist/chunk-KH2RVAI5.js.map +0 -1
- package/dist/chunk-O4BMDV7I.js.map +0 -1
- package/dist/chunk-RTYO24SC.js.map +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { NativeImage } from './chunk-
|
|
2
|
-
import { NativeIcon, NativeSkeleton } from './chunk-
|
|
3
|
-
import { useGenesisModules, useThemeMode, useMotion, useReducedMotion, useThemeRoles } from './chunk-
|
|
1
|
+
import { NativeImage, NativeCheckbox } from './chunk-DHONOH6K.js';
|
|
2
|
+
import { NativeIcon, NativeSheet, NativeText, NativeBadge, NativeButton, buttonTextVariants, NativeSheetScrollView, NativeSkeleton } from './chunk-FGIIBON3.js';
|
|
3
|
+
import { useGenesisModules, useThemeMode, useMotion, useReducedMotion, useThemeRoles } from './chunk-PWS2HLDE.js';
|
|
4
4
|
import { cn } from './chunk-OHZD7KRO.js';
|
|
5
|
-
import { View, Text, Platform, AccessibilityInfo, Animated, Pressable, Modal, StatusBar, Dimensions, TextInput, ScrollView, PanResponder, FlatList, Easing } from 'react-native';
|
|
5
|
+
import { View, Text, Platform, AccessibilityInfo, Animated, Pressable, Modal, StatusBar, Dimensions, TextInput, ScrollView, PanResponder, FlatList, Easing, Share } from 'react-native';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { MOTION_DURATIONS, MOTION_EASINGS } from '@marktiderman/genesis-design-system/tokens/motion';
|
|
8
8
|
import { createContext, useState, useEffect, useCallback, useMemo, useRef, useContext, Children, cloneElement, isValidElement } from 'react';
|
|
9
9
|
import { SafeAreaProvider, SafeAreaInsetsContext, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
10
|
+
import { useOptionalTheme } from '@marktiderman/genesis-design-system';
|
|
10
11
|
import { cva } from 'class-variance-authority';
|
|
12
|
+
import { splitTabBarItems, TAB_BAR_MAX } from '@marktiderman/genesis-core/navigation';
|
|
11
13
|
|
|
12
14
|
function NativeHeaderCard({
|
|
13
15
|
title,
|
|
@@ -1339,11 +1341,54 @@ function Ellipsis() {
|
|
|
1339
1341
|
}
|
|
1340
1342
|
);
|
|
1341
1343
|
}
|
|
1344
|
+
function withAlpha(colour, alpha) {
|
|
1345
|
+
const full = /^#([0-9a-f]{3})$/i.test(colour) ? `#${[...colour.slice(1)].map((c) => c + c).join("")}` : colour;
|
|
1346
|
+
if (!/^#[0-9a-f]{6}$/i.test(full)) return "transparent";
|
|
1347
|
+
return `${full}${Math.round(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
1348
|
+
}
|
|
1349
|
+
function NativeTierBadge({ label, tone, icon, size = "md", className, textClassName, accessibilityLabel, testID }) {
|
|
1350
|
+
const accents = useOptionalTheme()?.tokens.accents;
|
|
1351
|
+
const accent = tone ? accents?.[tone] : void 0;
|
|
1352
|
+
return /* @__PURE__ */ jsxs(
|
|
1353
|
+
View,
|
|
1354
|
+
{
|
|
1355
|
+
className: cn(
|
|
1356
|
+
"flex-row items-center self-start rounded-full border",
|
|
1357
|
+
size === "sm" ? "gap-1 px-2 py-0.5" : "gap-1.5 px-2.5 py-1",
|
|
1358
|
+
!accent && "border-transparent bg-secondary",
|
|
1359
|
+
className
|
|
1360
|
+
),
|
|
1361
|
+
style: accent ? { borderColor: accent, backgroundColor: withAlpha(accent, 0.15) } : void 0,
|
|
1362
|
+
accessibilityRole: "text",
|
|
1363
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
1364
|
+
testID,
|
|
1365
|
+
children: [
|
|
1366
|
+
icon ? /* @__PURE__ */ jsx(NativeIcon, { name: icon, size: size === "sm" ? 12 : 14, ...accent ? { color: accent } : {} }) : null,
|
|
1367
|
+
/* @__PURE__ */ jsx(
|
|
1368
|
+
Text,
|
|
1369
|
+
{
|
|
1370
|
+
className: cn(
|
|
1371
|
+
"font-semibold",
|
|
1372
|
+
size === "sm" ? "text-xs" : "text-sm",
|
|
1373
|
+
accent ? "text-foreground" : "text-secondary-foreground",
|
|
1374
|
+
textClassName
|
|
1375
|
+
),
|
|
1376
|
+
children: label
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1379
|
+
]
|
|
1380
|
+
}
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1342
1383
|
function NativeProgress({
|
|
1343
1384
|
className,
|
|
1344
1385
|
value = 0,
|
|
1345
1386
|
trackClassName,
|
|
1346
1387
|
indicatorClassName,
|
|
1388
|
+
indicatorColor,
|
|
1389
|
+
trackColor,
|
|
1390
|
+
style,
|
|
1391
|
+
indicatorStyle,
|
|
1347
1392
|
...props
|
|
1348
1393
|
}) {
|
|
1349
1394
|
const safeValue = Number.isFinite(value) ? value : 0;
|
|
@@ -1360,11 +1405,16 @@ function NativeProgress({
|
|
|
1360
1405
|
accessibilityLabel: `${clampedValue}% complete`,
|
|
1361
1406
|
accessibilityValue: { min: 0, max: 100, now: clampedValue },
|
|
1362
1407
|
...props,
|
|
1408
|
+
style: trackColor === void 0 ? style : { ...style, backgroundColor: trackColor },
|
|
1363
1409
|
children: /* @__PURE__ */ jsx(
|
|
1364
1410
|
View,
|
|
1365
1411
|
{
|
|
1366
1412
|
className: cn("h-full rounded-full bg-primary", indicatorClassName),
|
|
1367
|
-
style: {
|
|
1413
|
+
style: {
|
|
1414
|
+
...indicatorStyle,
|
|
1415
|
+
width: `${clampedValue}%`,
|
|
1416
|
+
...indicatorColor === void 0 ? {} : { backgroundColor: indicatorColor }
|
|
1417
|
+
}
|
|
1368
1418
|
}
|
|
1369
1419
|
)
|
|
1370
1420
|
}
|
|
@@ -1490,6 +1540,63 @@ function NativeDropdownMenuItem({
|
|
|
1490
1540
|
}
|
|
1491
1541
|
);
|
|
1492
1542
|
}
|
|
1543
|
+
function Indicator({ on, multiple, testID }) {
|
|
1544
|
+
return /* @__PURE__ */ jsx(
|
|
1545
|
+
View,
|
|
1546
|
+
{
|
|
1547
|
+
testID,
|
|
1548
|
+
className: cn(
|
|
1549
|
+
"h-5 w-5 items-center justify-center border",
|
|
1550
|
+
multiple ? "rounded" : "rounded-full",
|
|
1551
|
+
on ? "border-primary" : "border-input",
|
|
1552
|
+
on && multiple && "bg-primary"
|
|
1553
|
+
),
|
|
1554
|
+
children: on ? multiple ? /* @__PURE__ */ jsx(Text, { className: "text-xs font-bold text-primary-foreground", children: "\u2713" }) : /* @__PURE__ */ jsx(View, { className: "h-2.5 w-2.5 rounded-full bg-primary" }) : null
|
|
1555
|
+
}
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
function NativeChoiceCard({
|
|
1559
|
+
title,
|
|
1560
|
+
description,
|
|
1561
|
+
media,
|
|
1562
|
+
selected,
|
|
1563
|
+
onPress,
|
|
1564
|
+
multiple = false,
|
|
1565
|
+
disabled = false,
|
|
1566
|
+
invalid = false,
|
|
1567
|
+
hint,
|
|
1568
|
+
className,
|
|
1569
|
+
testID = "native-choice-card"
|
|
1570
|
+
}) {
|
|
1571
|
+
const name = description ? `${title}, ${description}` : title;
|
|
1572
|
+
const accessibilityHint = [hint, invalid ? "Needs an answer" : ""].filter(Boolean).join(". ") || void 0;
|
|
1573
|
+
return /* @__PURE__ */ jsxs(
|
|
1574
|
+
Pressable,
|
|
1575
|
+
{
|
|
1576
|
+
testID,
|
|
1577
|
+
onPress,
|
|
1578
|
+
disabled,
|
|
1579
|
+
accessibilityRole: multiple ? "checkbox" : "radio",
|
|
1580
|
+
accessibilityLabel: name,
|
|
1581
|
+
accessibilityHint,
|
|
1582
|
+
accessibilityState: { checked: selected, selected, disabled },
|
|
1583
|
+
className: cn(
|
|
1584
|
+
"min-h-[44px] flex-row items-center gap-3 rounded-lg border bg-card p-3",
|
|
1585
|
+
selected ? "border-primary bg-primary/5" : invalid ? "border-destructive" : "border-border",
|
|
1586
|
+
disabled && "opacity-50",
|
|
1587
|
+
className
|
|
1588
|
+
),
|
|
1589
|
+
children: [
|
|
1590
|
+
/* @__PURE__ */ jsx(Indicator, { on: selected, multiple, testID: `${testID}-indicator` }),
|
|
1591
|
+
media ? /* @__PURE__ */ jsx(View, { testID: `${testID}-media`, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: media }) : null,
|
|
1592
|
+
/* @__PURE__ */ jsxs(View, { className: "flex-1", children: [
|
|
1593
|
+
/* @__PURE__ */ jsx(Text, { className: "text-base text-foreground", children: title }),
|
|
1594
|
+
description ? /* @__PURE__ */ jsx(Text, { className: "mt-0.5 text-sm text-muted-foreground", children: description }) : null
|
|
1595
|
+
] })
|
|
1596
|
+
]
|
|
1597
|
+
}
|
|
1598
|
+
);
|
|
1599
|
+
}
|
|
1493
1600
|
var RadioGroupContext = createContext(null);
|
|
1494
1601
|
function useRadioGroup() {
|
|
1495
1602
|
const context = useContext(RadioGroupContext);
|
|
@@ -1910,17 +2017,18 @@ function Grid({
|
|
|
1910
2017
|
Array.from({ length: cols - row.length }).map((_, padIndex) => /* @__PURE__ */ jsx(View, { className: "flex-1" }, `pad-${padIndex}`))
|
|
1911
2018
|
] }, `row-${rowIndex}`)) });
|
|
1912
2019
|
}
|
|
1913
|
-
var STAR_SIZE = { sm: 14, md: 20, lg: 28 };
|
|
2020
|
+
var STAR_SIZE = { sm: 14, md: 20, lg: 28, touch: 28 };
|
|
1914
2021
|
function nextRating(value, star) {
|
|
1915
2022
|
return star === value ? 0 : star;
|
|
1916
2023
|
}
|
|
1917
|
-
function Star({ on, size, testID }) {
|
|
2024
|
+
function Star({ on, size, tone, testID }) {
|
|
1918
2025
|
const roles = useThemeRoles();
|
|
1919
2026
|
const { symbol, icons } = useGenesisModules();
|
|
1920
|
-
const
|
|
2027
|
+
const onColor = tone === "primary" ? roles.tint : roles.warning;
|
|
2028
|
+
const color = on ? onColor : roles.secondaryLabel;
|
|
1921
2029
|
const Lucide = icons?.star;
|
|
1922
2030
|
if (!(Platform.OS === "ios" && symbol) && Lucide) {
|
|
1923
|
-
return /* @__PURE__ */ jsx(Lucide, { size, color, fill: on ?
|
|
2031
|
+
return /* @__PURE__ */ jsx(Lucide, { size, color, fill: on ? onColor : "none", strokeWidth: on ? 2 : 1.5, testID });
|
|
1924
2032
|
}
|
|
1925
2033
|
return /* @__PURE__ */ jsx(NativeIcon, { name: "star", size, weight: on ? "bold" : "regular", color, testID });
|
|
1926
2034
|
}
|
|
@@ -1930,6 +2038,9 @@ function NativeRating({
|
|
|
1930
2038
|
onChange,
|
|
1931
2039
|
readOnly = false,
|
|
1932
2040
|
size = "md",
|
|
2041
|
+
tone = "warning",
|
|
2042
|
+
clearable = true,
|
|
2043
|
+
disabled = false,
|
|
1933
2044
|
label,
|
|
1934
2045
|
getLabel,
|
|
1935
2046
|
className,
|
|
@@ -1951,7 +2062,7 @@ function NativeRating({
|
|
|
1951
2062
|
accessibilityRole: "image",
|
|
1952
2063
|
accessibilityLabel: summary,
|
|
1953
2064
|
className: cn("flex-row items-center gap-0.5", className),
|
|
1954
|
-
children: stars.map((n) => /* @__PURE__ */ jsx(Star, { on: n <= filled, size: px, testID: `${testID}-star-${n}` }, n))
|
|
2065
|
+
children: stars.map((n) => /* @__PURE__ */ jsx(Star, { on: n <= filled, size: px, tone, testID: `${testID}-star-${n}` }, n))
|
|
1955
2066
|
}
|
|
1956
2067
|
);
|
|
1957
2068
|
}
|
|
@@ -1962,7 +2073,8 @@ function NativeRating({
|
|
|
1962
2073
|
accessibilityRole: "radiogroup",
|
|
1963
2074
|
accessibilityLabel: label ?? "Rating",
|
|
1964
2075
|
accessibilityValue: { min: 0, max: count, now: filled, text: summary },
|
|
1965
|
-
|
|
2076
|
+
accessibilityState: { disabled },
|
|
2077
|
+
className: cn("flex-row items-center", size === "touch" ? "flex-wrap gap-1" : "gap-0.5", disabled && "opacity-50", className),
|
|
1966
2078
|
children: stars.map((n) => {
|
|
1967
2079
|
const selected = n === filled;
|
|
1968
2080
|
return /* @__PURE__ */ jsx(
|
|
@@ -1971,11 +2083,16 @@ function NativeRating({
|
|
|
1971
2083
|
testID: `${testID}-star-${n}`,
|
|
1972
2084
|
accessibilityRole: "radio",
|
|
1973
2085
|
accessibilityLabel: starsText(n),
|
|
1974
|
-
accessibilityState: { selected, checked: selected },
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
2086
|
+
accessibilityState: { selected, checked: selected, disabled },
|
|
2087
|
+
disabled,
|
|
2088
|
+
onPress: () => {
|
|
2089
|
+
const next = nextRating(filled, n);
|
|
2090
|
+
if (next === 0 && !clearable) return;
|
|
2091
|
+
onChange?.(next);
|
|
2092
|
+
},
|
|
2093
|
+
hitSlop: size === "touch" ? 0 : 4,
|
|
2094
|
+
className: size === "touch" ? "h-11 w-11 items-center justify-center rounded-md" : "p-0.5",
|
|
2095
|
+
children: /* @__PURE__ */ jsx(Star, { on: n <= filled, size: px, tone })
|
|
1979
2096
|
},
|
|
1980
2097
|
n
|
|
1981
2098
|
);
|
|
@@ -2512,7 +2629,224 @@ function NativeLiveIndicator({
|
|
|
2512
2629
|
}
|
|
2513
2630
|
);
|
|
2514
2631
|
}
|
|
2632
|
+
function Slot({ item, active }) {
|
|
2633
|
+
return /* @__PURE__ */ jsxs(View, { className: "items-center gap-1", children: [
|
|
2634
|
+
/* @__PURE__ */ jsxs(View, { children: [
|
|
2635
|
+
item.icon,
|
|
2636
|
+
item.badge != null ? /* @__PURE__ */ jsx(View, { className: "absolute -right-3 -top-1.5 min-w-4 items-center rounded-full bg-primary px-1", children: /* @__PURE__ */ jsx(Text, { className: "text-[10px] font-semibold text-primary-foreground", children: item.badge }) }) : null
|
|
2637
|
+
] }),
|
|
2638
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, className: cn("text-xs font-medium", active ? "text-primary" : "text-muted-foreground"), children: item.label })
|
|
2639
|
+
] });
|
|
2640
|
+
}
|
|
2641
|
+
function NativeTabBar({
|
|
2642
|
+
items,
|
|
2643
|
+
value,
|
|
2644
|
+
onChange,
|
|
2645
|
+
max = TAB_BAR_MAX,
|
|
2646
|
+
moreLabel = "More",
|
|
2647
|
+
className,
|
|
2648
|
+
testID = "native-tab-bar"
|
|
2649
|
+
}) {
|
|
2650
|
+
const [moreOpen, setMoreOpen] = useState(false);
|
|
2651
|
+
const { shown, more } = splitTabBarItems(items, max);
|
|
2652
|
+
const moreActive = more.some((item) => item.key === value);
|
|
2653
|
+
return /* @__PURE__ */ jsxs(NativeTabs, { defaultValue: value, value, onValueChange: onChange, testID, children: [
|
|
2654
|
+
/* @__PURE__ */ jsxs(View, { accessibilityRole: "tablist", className: cn("flex-row border-t border-border bg-background pt-1", className), children: [
|
|
2655
|
+
shown.map((item) => /* @__PURE__ */ jsx(
|
|
2656
|
+
NativeTabsTrigger,
|
|
2657
|
+
{
|
|
2658
|
+
value: item.key,
|
|
2659
|
+
testID: `${testID}-${item.key}`,
|
|
2660
|
+
accessibilityLabel: typeof item.badge === "string" || typeof item.badge === "number" ? `${item.label} (${item.badge})` : item.label,
|
|
2661
|
+
className: "min-h-[49px] rounded-none bg-transparent px-1 py-1 shadow-none",
|
|
2662
|
+
children: /* @__PURE__ */ jsx(Slot, { item, active: item.key === value })
|
|
2663
|
+
},
|
|
2664
|
+
item.key
|
|
2665
|
+
)),
|
|
2666
|
+
more.length > 0 ? /* @__PURE__ */ jsx(
|
|
2667
|
+
Pressable,
|
|
2668
|
+
{
|
|
2669
|
+
accessibilityRole: "button",
|
|
2670
|
+
accessibilityLabel: moreActive ? `${moreLabel}, current tab inside` : moreLabel,
|
|
2671
|
+
accessibilityState: { expanded: moreOpen, selected: moreActive },
|
|
2672
|
+
onPress: () => setMoreOpen(true),
|
|
2673
|
+
testID: `${testID}-more`,
|
|
2674
|
+
className: "min-h-[49px] flex-1 items-center justify-center px-1 py-1",
|
|
2675
|
+
children: /* @__PURE__ */ jsx(Slot, { item: { label: moreLabel, icon: /* @__PURE__ */ jsx(NativeIcon, { name: "more" }) }, active: moreActive })
|
|
2676
|
+
}
|
|
2677
|
+
) : null
|
|
2678
|
+
] }),
|
|
2679
|
+
more.length > 0 ? /* @__PURE__ */ jsx(NativeSheet, { open: moreOpen, onOpenChange: setMoreOpen, fitContent: true, testID: `${testID}-more-sheet`, children: /* @__PURE__ */ jsxs(View, { className: "gap-1 p-4", children: [
|
|
2680
|
+
/* @__PURE__ */ jsx(NativeText, { preset: "h4", accessibilityRole: "header", className: "mb-2", children: moreLabel }),
|
|
2681
|
+
more.map((item) => {
|
|
2682
|
+
const active = item.key === value;
|
|
2683
|
+
return /* @__PURE__ */ jsxs(
|
|
2684
|
+
Pressable,
|
|
2685
|
+
{
|
|
2686
|
+
accessibilityRole: "button",
|
|
2687
|
+
accessibilityState: { selected: active },
|
|
2688
|
+
onPress: () => {
|
|
2689
|
+
setMoreOpen(false);
|
|
2690
|
+
onChange(item.key);
|
|
2691
|
+
},
|
|
2692
|
+
testID: `${testID}-${item.key}`,
|
|
2693
|
+
className: cn("min-h-[44px] flex-row items-center gap-3 rounded-lg px-3", active && "bg-accent"),
|
|
2694
|
+
children: [
|
|
2695
|
+
item.icon,
|
|
2696
|
+
/* @__PURE__ */ jsx(Text, { className: cn("flex-1 text-base font-medium", active ? "text-primary" : "text-foreground"), children: item.label }),
|
|
2697
|
+
item.badge != null ? /* @__PURE__ */ jsx(NativeBadge, { variant: "secondary", children: item.badge }) : null
|
|
2698
|
+
]
|
|
2699
|
+
},
|
|
2700
|
+
item.key
|
|
2701
|
+
);
|
|
2702
|
+
})
|
|
2703
|
+
] }) }) : null
|
|
2704
|
+
] });
|
|
2705
|
+
}
|
|
2706
|
+
function NativeBulkBar({
|
|
2707
|
+
selected,
|
|
2708
|
+
totalCount,
|
|
2709
|
+
onToggleAll,
|
|
2710
|
+
onClearSelection,
|
|
2711
|
+
actions,
|
|
2712
|
+
selectedLabel = (count) => `${count} selected`,
|
|
2713
|
+
clearLabel = "Clear",
|
|
2714
|
+
className,
|
|
2715
|
+
testID = "native-bulk-bar"
|
|
2716
|
+
}) {
|
|
2717
|
+
if (selected.size === 0) return null;
|
|
2718
|
+
const all = selected.size === totalCount;
|
|
2719
|
+
return /* @__PURE__ */ jsxs(
|
|
2720
|
+
View,
|
|
2721
|
+
{
|
|
2722
|
+
testID,
|
|
2723
|
+
accessibilityRole: "toolbar",
|
|
2724
|
+
className: cn("mx-3 mb-2 flex-row items-center gap-2 rounded-xl border border-border bg-card px-3 py-2 shadow-md", className),
|
|
2725
|
+
children: [
|
|
2726
|
+
/* @__PURE__ */ jsx(NativeCheckbox, { checked: all, onCheckedChange: () => onToggleAll(), testID: `${testID}-all` }),
|
|
2727
|
+
/* @__PURE__ */ jsx(Text, { className: "text-sm font-medium text-foreground", accessibilityLiveRegion: "polite", children: selectedLabel(selected.size) }),
|
|
2728
|
+
/* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, className: "flex-1", contentContainerClassName: "gap-2 px-1", children: actions.map((action) => {
|
|
2729
|
+
const variant = action.variant ?? "outline";
|
|
2730
|
+
return /* @__PURE__ */ jsxs(
|
|
2731
|
+
NativeButton,
|
|
2732
|
+
{
|
|
2733
|
+
size: "sm",
|
|
2734
|
+
variant,
|
|
2735
|
+
onPress: action.onClick,
|
|
2736
|
+
disabled: action.disabled,
|
|
2737
|
+
testID: action.testId,
|
|
2738
|
+
accessibilityLabel: action.label,
|
|
2739
|
+
children: [
|
|
2740
|
+
/* @__PURE__ */ jsx(NativeIcon, { name: action.icon, size: 16 }),
|
|
2741
|
+
/* @__PURE__ */ jsx(Text, { className: buttonTextVariants({ variant, size: "sm" }), children: action.label })
|
|
2742
|
+
]
|
|
2743
|
+
},
|
|
2744
|
+
action.label
|
|
2745
|
+
);
|
|
2746
|
+
}) }),
|
|
2747
|
+
/* @__PURE__ */ jsx(NativeButton, { size: "sm", variant: "ghost", onPress: onClearSelection, testID: `${testID}-clear`, children: clearLabel })
|
|
2748
|
+
]
|
|
2749
|
+
}
|
|
2750
|
+
);
|
|
2751
|
+
}
|
|
2752
|
+
function IconButton({ icon, label, onPress, variant, testID }) {
|
|
2753
|
+
return /* @__PURE__ */ jsxs(NativeButton, { variant, onPress, testID, accessibilityLabel: label, className: "flex-1", children: [
|
|
2754
|
+
/* @__PURE__ */ jsx(NativeIcon, { name: icon, size: 16 }),
|
|
2755
|
+
/* @__PURE__ */ jsx(Text, { className: buttonTextVariants({ variant, size: "md" }), children: label })
|
|
2756
|
+
] });
|
|
2757
|
+
}
|
|
2758
|
+
function NativeShareSheet({
|
|
2759
|
+
open,
|
|
2760
|
+
onOpenChange,
|
|
2761
|
+
noun = "page",
|
|
2762
|
+
title = `Share your ${noun}`,
|
|
2763
|
+
description = "Anyone with the link can open it.",
|
|
2764
|
+
url,
|
|
2765
|
+
name,
|
|
2766
|
+
renderQr,
|
|
2767
|
+
onCopy,
|
|
2768
|
+
testID = "native-share-sheet"
|
|
2769
|
+
}) {
|
|
2770
|
+
const [copied, setCopied] = useState(false);
|
|
2771
|
+
useEffect(() => setCopied(false), [url]);
|
|
2772
|
+
const share = (link) => {
|
|
2773
|
+
const content = Platform.OS === "ios" ? { url: link } : { message: link };
|
|
2774
|
+
void Share.share(name ? { ...content, title: name } : content).catch(() => void 0);
|
|
2775
|
+
};
|
|
2776
|
+
const copy = (link) => {
|
|
2777
|
+
if (!onCopy) return share(link);
|
|
2778
|
+
void new Promise((resolve) => resolve(onCopy(link))).then(
|
|
2779
|
+
() => setCopied(true),
|
|
2780
|
+
() => share(link)
|
|
2781
|
+
);
|
|
2782
|
+
};
|
|
2783
|
+
return /* @__PURE__ */ jsx(
|
|
2784
|
+
NativeSheet,
|
|
2785
|
+
{
|
|
2786
|
+
open,
|
|
2787
|
+
onOpenChange: (next) => {
|
|
2788
|
+
if (!next) setCopied(false);
|
|
2789
|
+
onOpenChange(next);
|
|
2790
|
+
},
|
|
2791
|
+
fitContent: true,
|
|
2792
|
+
testID,
|
|
2793
|
+
children: /* @__PURE__ */ jsxs(View, { className: "gap-4 p-6", children: [
|
|
2794
|
+
/* @__PURE__ */ jsxs(View, { className: "gap-1", children: [
|
|
2795
|
+
/* @__PURE__ */ jsx(NativeText, { preset: "h3", accessibilityRole: "header", children: title }),
|
|
2796
|
+
typeof description === "string" ? /* @__PURE__ */ jsx(NativeText, { preset: "body-sm", className: "text-muted-foreground", children: description }) : description
|
|
2797
|
+
] }),
|
|
2798
|
+
!url ? /* @__PURE__ */ jsx(NativeText, { preset: "body-sm", className: "text-muted-foreground", testID: `${testID}-loading`, children: "Loading the link\u2026" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2799
|
+
renderQr ? /* @__PURE__ */ jsxs(View, { className: "items-center gap-2", testID: `${testID}-qr`, children: [
|
|
2800
|
+
/* @__PURE__ */ jsx(View, { className: "w-56 max-w-full", children: renderQr(url) }),
|
|
2801
|
+
/* @__PURE__ */ jsxs(NativeText, { preset: "caption", className: "text-center text-muted-foreground", children: [
|
|
2802
|
+
"Scan with a phone's camera to open the ",
|
|
2803
|
+
noun,
|
|
2804
|
+
"."
|
|
2805
|
+
] })
|
|
2806
|
+
] }) : null,
|
|
2807
|
+
/* @__PURE__ */ jsx(View, { className: "rounded-md border border-border bg-muted px-3 py-2", children: /* @__PURE__ */ jsx(Text, { selectable: true, numberOfLines: 2, className: "text-sm text-foreground", testID: `${testID}-url`, children: url }) }),
|
|
2808
|
+
/* @__PURE__ */ jsxs(View, { className: "flex-row gap-2", children: [
|
|
2809
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "copy", label: copied ? "Copied" : "Copy link", onPress: () => copy(url), variant: "outline", testID: `${testID}-copy` }),
|
|
2810
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "share", label: "Share", onPress: () => share(url), variant: "default", testID: `${testID}-share` })
|
|
2811
|
+
] })
|
|
2812
|
+
] })
|
|
2813
|
+
] })
|
|
2814
|
+
}
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2817
|
+
function NativeWhatsNewSheet({
|
|
2818
|
+
notes,
|
|
2819
|
+
dismiss,
|
|
2820
|
+
onOpenNote,
|
|
2821
|
+
title = "What's new",
|
|
2822
|
+
doneLabel = "Got it",
|
|
2823
|
+
learnMoreLabel = "Learn more",
|
|
2824
|
+
testID = "native-whats-new",
|
|
2825
|
+
noteTestID = (key) => `${testID}-${key}`
|
|
2826
|
+
}) {
|
|
2827
|
+
return /* @__PURE__ */ jsx(NativeSheet, { open: true, onOpenChange: (open) => open ? void 0 : dismiss(), testID, children: /* @__PURE__ */ jsxs(NativeSheetScrollView, { contentContainerStyle: { gap: 16, padding: 24 }, children: [
|
|
2828
|
+
/* @__PURE__ */ jsx(NativeText, { preset: "h3", accessibilityRole: "header", children: title }),
|
|
2829
|
+
notes.map((note) => /* @__PURE__ */ jsxs(View, { style: { gap: 4 }, testID: noteTestID(note.key), children: [
|
|
2830
|
+
/* @__PURE__ */ jsx(NativeText, { preset: "label", children: note.title }),
|
|
2831
|
+
note.body ? /* @__PURE__ */ jsx(NativeText, { preset: "body-sm", className: "text-muted-foreground", children: note.body }) : null,
|
|
2832
|
+
note.url && onOpenNote ? /* @__PURE__ */ jsx(
|
|
2833
|
+
NativeButton,
|
|
2834
|
+
{
|
|
2835
|
+
variant: "ghost",
|
|
2836
|
+
size: "sm",
|
|
2837
|
+
onPress: () => {
|
|
2838
|
+
dismiss();
|
|
2839
|
+
onOpenNote(note);
|
|
2840
|
+
},
|
|
2841
|
+
testID: `${testID}-open-${note.key}`,
|
|
2842
|
+
children: learnMoreLabel
|
|
2843
|
+
}
|
|
2844
|
+
) : null
|
|
2845
|
+
] }, note.key)),
|
|
2846
|
+
/* @__PURE__ */ jsx(NativeButton, { onPress: dismiss, testID: `${testID}-done`, children: doneLabel })
|
|
2847
|
+
] }) });
|
|
2848
|
+
}
|
|
2515
2849
|
|
|
2516
|
-
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeChip, NativeChipGroup, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGalleryCard, NativeGlassSurface, NativeHeaderCard, NativeLightbox, NativeLiveIndicator, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRating, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, NativeZoomablePhoto, Stack, defaultNativeLightboxLabels, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, lightboxTouchDistance, nextRating, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast };
|
|
2517
|
-
//# sourceMappingURL=chunk-
|
|
2518
|
-
//# sourceMappingURL=chunk-
|
|
2850
|
+
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeBulkBar, NativeChip, NativeChipGroup, NativeChoiceCard, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGalleryCard, NativeGlassSurface, NativeHeaderCard, NativeLightbox, NativeLiveIndicator, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRating, NativeShareSheet, NativeSlider, NativeStepper, NativeTabBar, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTierBadge, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, NativeWhatsNewSheet, NativeZoomablePhoto, Stack, defaultNativeLightboxLabels, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, lightboxTouchDistance, nextRating, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast };
|
|
2851
|
+
//# sourceMappingURL=chunk-UZCJDMGE.js.map
|
|
2852
|
+
//# sourceMappingURL=chunk-UZCJDMGE.js.map
|