@vvedantb/native-ui 0.4.0 → 0.5.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/README.md +71 -12
- package/package.json +1 -1
- package/src/CaptureButton.tsx +62 -0
- package/src/Card.tsx +37 -13
- package/src/ColorSwatches.tsx +133 -0
- package/src/DateTimeField.tsx +75 -19
- package/src/HeaderIconButton.tsx +18 -1
- package/src/IconButton.tsx +87 -0
- package/src/ListRow.tsx +104 -30
- package/src/PageIndicator.tsx +87 -0
- package/src/SectionLabel.tsx +48 -0
- package/src/SheetRow.tsx +89 -0
- package/src/StackPageHeader.tsx +100 -0
- package/src/StatGrid.tsx +80 -0
- package/src/StatusDot.tsx +14 -1
- package/src/ThemeToggle.tsx +17 -5
- package/src/brand/AppIcons.tsx +2 -0
- package/src/brand/AppWordmark.tsx +2 -2
- package/src/brand/familyApps.ts +5 -2
- package/src/brand/index.ts +2 -2
- package/src/brand/svg.ts +29 -5
- package/src/brand/vProAppBenefits.ts +1 -1
- package/src/entries/date-time.ts +1 -0
- package/src/entries/layout.ts +6 -2
- package/src/entries/page-title.ts +7 -2
- package/src/entries/primitives.ts +19 -1
- package/src/examples/ParityGallery.tsx +170 -3
- package/src/index.ts +19 -0
- package/src/marketing/PricingModal.tsx +3 -3
package/src/StatusDot.tsx
CHANGED
|
@@ -4,7 +4,10 @@ import { palette, withAlpha } from "./palette";
|
|
|
4
4
|
import { tokens } from "./tokens";
|
|
5
5
|
import { useScheme } from "./useScheme";
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The web `StatusTone`s, and `info` (native only, from 0.5.0): neutral news
|
|
9
|
+
* such as "synced" or "new", in blue.
|
|
10
|
+
*/
|
|
8
11
|
export type StatusTone =
|
|
9
12
|
| "progress"
|
|
10
13
|
| "business-review"
|
|
@@ -13,6 +16,7 @@ export type StatusTone =
|
|
|
13
16
|
| "cancelled"
|
|
14
17
|
| "active"
|
|
15
18
|
| "critical"
|
|
19
|
+
| "info"
|
|
16
20
|
| "neutral";
|
|
17
21
|
|
|
18
22
|
export type StatusDotProps = ViewProps & {
|
|
@@ -22,6 +26,13 @@ export type StatusDotProps = ViewProps & {
|
|
|
22
26
|
className?: string;
|
|
23
27
|
};
|
|
24
28
|
|
|
29
|
+
/**
|
|
30
|
+
* The `info` blue: Tailwind `blue-500` in light and the lighter `blue-400` in
|
|
31
|
+
* dark. Local to the dot: `tokens.css` has no `--info`, so it is not a
|
|
32
|
+
* `palette` key.
|
|
33
|
+
*/
|
|
34
|
+
const INFO = { light: "#3b82f6", dark: "#60a5fa" } as const;
|
|
35
|
+
|
|
25
36
|
function toneColor(tone: StatusTone, scheme: "light" | "dark") {
|
|
26
37
|
switch (tone) {
|
|
27
38
|
case "progress":
|
|
@@ -37,6 +48,8 @@ function toneColor(tone: StatusTone, scheme: "light" | "dark") {
|
|
|
37
48
|
return withAlpha(tokens.color.muted[scheme], 0.4);
|
|
38
49
|
case "critical":
|
|
39
50
|
return palette.danger[scheme];
|
|
51
|
+
case "info":
|
|
52
|
+
return INFO[scheme];
|
|
40
53
|
default:
|
|
41
54
|
return withAlpha(tokens.color.muted[scheme], 0.6);
|
|
42
55
|
}
|
package/src/ThemeToggle.tsx
CHANGED
|
@@ -9,6 +9,10 @@ export type ThemeToggleProps = {
|
|
|
9
9
|
testID?: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
/** Logged when NativeWind's `setColorScheme` throws. */
|
|
13
|
+
const DARK_MODE_CLASS_HINT =
|
|
14
|
+
'ThemeToggle could not set the colour scheme. NativeWind throws while Tailwind darkMode is "media" (the default): set darkMode: "class" in tailwind.config.js. See the @vvedantb/native-ui README, Theme.';
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
17
|
* A `HeaderIconButton` that switches between light and dark with NativeWind's
|
|
14
18
|
* `setColorScheme`, the scheme `useScheme` reads. It shows and names the
|
|
@@ -16,6 +20,10 @@ export type ThemeToggleProps = {
|
|
|
16
20
|
* "Switch to light mode" in dark. The choice lasts only as long as NativeWind
|
|
17
21
|
* keeps it; an app that restores it on the next launch stores
|
|
18
22
|
* `useColorScheme().colorScheme` itself.
|
|
23
|
+
*
|
|
24
|
+
* `setColorScheme` throws unless the app sets Tailwind `darkMode: "class"`.
|
|
25
|
+
* The press then logs that fix with `console.error` and leaves the scheme as
|
|
26
|
+
* it is, instead of throwing from the press handler.
|
|
19
27
|
*/
|
|
20
28
|
export function ThemeToggle({ testID }: ThemeToggleProps) {
|
|
21
29
|
const { setColorScheme } = useColorScheme();
|
|
@@ -24,12 +32,16 @@ export function ThemeToggle({ testID }: ThemeToggleProps) {
|
|
|
24
32
|
const next = scheme === "dark" ? "light" : "dark";
|
|
25
33
|
const Icon = next === "dark" ? IconMoon : IconSun;
|
|
26
34
|
|
|
35
|
+
const toggle = () => {
|
|
36
|
+
try {
|
|
37
|
+
setColorScheme(next);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(DARK_MODE_CLASS_HINT, error);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
27
43
|
return (
|
|
28
|
-
<HeaderIconButton
|
|
29
|
-
label={`Switch to ${next} mode`}
|
|
30
|
-
testID={testID}
|
|
31
|
-
onPress={() => setColorScheme(next)}
|
|
32
|
-
>
|
|
44
|
+
<HeaderIconButton label={`Switch to ${next} mode`} testID={testID} onPress={toggle}>
|
|
33
45
|
<Icon size={largerText ? 26 : 22} color={tokens.color.foreground[scheme]} />
|
|
34
46
|
</HeaderIconButton>
|
|
35
47
|
);
|
package/src/brand/AppIcons.tsx
CHANGED
|
@@ -101,3 +101,5 @@ export const IconVmem = APP_ICONS.vmem;
|
|
|
101
101
|
export const IconVerve = APP_ICONS.verve;
|
|
102
102
|
export const IconVelth = APP_ICONS.velth;
|
|
103
103
|
export const IconProjectV = APP_ICONS.projectv;
|
|
104
|
+
export const IconEva = APP_ICONS.eva;
|
|
105
|
+
export const IconBee = APP_ICONS.bee;
|
|
@@ -6,8 +6,8 @@ import { useScheme } from "../useScheme";
|
|
|
6
6
|
import { APP_ICONS } from "./AppIcons";
|
|
7
7
|
import type { AppName } from "./svg";
|
|
8
8
|
|
|
9
|
-
/** The five product apps. `projectv` keeps its Michroma wordmark and never uses `AppWordmark`. */
|
|
10
|
-
export type ProductAppName = Exclude<AppName, "projectv">;
|
|
9
|
+
/** The five product apps. `projectv` keeps its Michroma wordmark and never uses `AppWordmark`. `eva` and `bee` are icons only. */
|
|
10
|
+
export type ProductAppName = Exclude<AppName, "projectv" | "eva" | "bee">;
|
|
11
11
|
|
|
12
12
|
export type AppWordmarkProps = {
|
|
13
13
|
/** Which product app's name to show. The label is always the lowercase app id. */
|
package/src/brand/familyApps.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { AppName } from "./svg";
|
|
2
2
|
|
|
3
|
+
/** Apps in the Project V family. `eva` and `bee` have marks and icons but are not family apps. */
|
|
4
|
+
export type FamilyAppName = Exclude<AppName, "eva" | "bee">;
|
|
5
|
+
|
|
3
6
|
export type FamilyApp = {
|
|
4
|
-
app:
|
|
7
|
+
app: FamilyAppName;
|
|
5
8
|
/** Display name. */
|
|
6
9
|
name: string;
|
|
7
10
|
/** Home page of the app. */
|
|
@@ -19,6 +22,6 @@ export const FAMILY_APPS: readonly FamilyApp[] = [
|
|
|
19
22
|
];
|
|
20
23
|
|
|
21
24
|
/** Entry of `FAMILY_APPS` for an app. */
|
|
22
|
-
export function familyApp(app:
|
|
25
|
+
export function familyApp(app: FamilyAppName): FamilyApp {
|
|
23
26
|
return FAMILY_APPS.find((entry) => entry.app === app)!;
|
|
24
27
|
}
|
package/src/brand/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// `svg.ts`, `familyApps.ts` and `vProAppBenefits.ts` are byte-identical copies of
|
|
2
2
|
// `@vvedantb/ui` `src/brand/` (pure data, no imports beyond each other). A test
|
|
3
3
|
// in this package fails when they differ: change both together.
|
|
4
|
-
export { APP_ICONS, IconProjectV, IconVelth, IconVerve, IconVhub, IconVibot, IconVmem } from "./AppIcons";
|
|
4
|
+
export { APP_ICONS, IconBee, IconEva, IconProjectV, IconVelth, IconVerve, IconVhub, IconVibot, IconVmem } from "./AppIcons";
|
|
5
5
|
export type { AppIconComponent, AppIconProps } from "./AppIcons";
|
|
6
6
|
export { AppMark } from "./AppMark";
|
|
7
7
|
export type { AppMarkProps } from "./AppMark";
|
|
@@ -31,6 +31,6 @@ export {
|
|
|
31
31
|
} from "./svg";
|
|
32
32
|
export type { AppMarkVariant, AppName, MarkShape } from "./svg";
|
|
33
33
|
export { FAMILY_APPS, familyApp } from "./familyApps";
|
|
34
|
-
export type { FamilyApp } from "./familyApps";
|
|
34
|
+
export type { FamilyApp, FamilyAppName } from "./familyApps";
|
|
35
35
|
export { V_PRO_APP_BENEFITS } from "./vProAppBenefits";
|
|
36
36
|
export type { PricingPlanAppBenefit } from "./vProAppBenefits";
|
package/src/brand/svg.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Geometry and raw SVG strings for the family app marks. No imports, so the
|
|
2
2
|
// asset script can load this file directly with Node.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/** Every mark. `eva` and `bee` are marks and icons only: they are not family apps, so `FAMILY_APPS` leaves them out. */
|
|
5
|
+
export const APP_NAMES = ["projectv", "vibot", "vhub", "vmem", "verve", "velth", "eva", "bee"] as const;
|
|
5
6
|
|
|
6
7
|
export type AppName = (typeof APP_NAMES)[number];
|
|
7
8
|
|
|
@@ -36,7 +37,9 @@ export function markLinecap(app: AppName): "butt" | "round" {
|
|
|
36
37
|
/**
|
|
37
38
|
* Glyphs sized by one rule: longest side = 512 * min(1.2, aspect^0.25), centred halfway between
|
|
38
39
|
* the bounding-box centre and the centre of mass. `verve` and `velth` are the final vectors.
|
|
39
|
-
*
|
|
40
|
+
* `vibot`, `vhub`, `vmem` and `projectv` are traced from the approved 1024px renders. `eva` (option A,
|
|
41
|
+
* a filled four-point star) and `bee` (option D, an orb with eyes, stripes and antennae) are the final
|
|
42
|
+
* vectors from their design sheet, as drawn there.
|
|
40
43
|
*/
|
|
41
44
|
export const APP_MARKS: Record<AppName, MarkShape> = {
|
|
42
45
|
projectv: {
|
|
@@ -77,6 +80,22 @@ export const APP_MARKS: Record<AppName, MarkShape> = {
|
|
|
77
80
|
"M512 732.3C644.2 652.1 734.3 471.9 724.3 301.6C604.1 371.7 524 552 512 732.3Z",
|
|
78
81
|
],
|
|
79
82
|
},
|
|
83
|
+
eva: {
|
|
84
|
+
kind: "fill",
|
|
85
|
+
paths: ["M242.9 512Q485.1 485.1 512 278.8Q538.9 485.1 781 512Q538.9 538.9 512 745.1Q485.1 538.9 242.9 512Z"],
|
|
86
|
+
},
|
|
87
|
+
bee: {
|
|
88
|
+
kind: "stroke",
|
|
89
|
+
paths: [
|
|
90
|
+
"M304 530.7A208.1 208.1 0 1 1 720.1 530.7A208.1 208.1 0 1 1 304 530.7",
|
|
91
|
+
"M447.5 414.2L447.5 445.4",
|
|
92
|
+
"M576.5 414.2L576.5 445.4",
|
|
93
|
+
"M306.3 561.9L717.7 561.9",
|
|
94
|
+
"M344 653.4L680 653.4",
|
|
95
|
+
"M468.3 341.4Q455.8 291.4 420.5 260.2",
|
|
96
|
+
"M555.7 341.4Q568.2 291.4 603.5 260.2",
|
|
97
|
+
],
|
|
98
|
+
},
|
|
80
99
|
};
|
|
81
100
|
|
|
82
101
|
type Point = [number, number];
|
|
@@ -180,6 +199,7 @@ export function markBBox(app: AppName): Box {
|
|
|
180
199
|
* (x 186 to 789, y 259.96 to 761.7) at side max(width, height) x 1.04 (about 4% padding), rounded outward.
|
|
181
200
|
* All five use this side, so glyph scale stays equal. Only the size is shared: each app has its own origin in
|
|
182
201
|
* `APP_MARK_VIEWBOX`. `projectv` is left out so its wide brand mark does not shrink the app glyphs.
|
|
202
|
+
* Historical: this union covers those five only. `eva` and `bee` reuse the 629 side but are not part of it.
|
|
183
203
|
*/
|
|
184
204
|
export const APP_MARK_CROP_VIEWBOX = "173 197 629 629";
|
|
185
205
|
|
|
@@ -190,9 +210,9 @@ export const APP_MARK_CROP_VIEWBOX = "173 197 629 629";
|
|
|
190
210
|
export const PROJECTV_MARK_VIEWBOX = "171.5 181 687 687";
|
|
191
211
|
|
|
192
212
|
/**
|
|
193
|
-
* Plain-mark viewBox per app. Always square.
|
|
194
|
-
* `markBBox(app)` centre minus 314.5 on both axes, so every glyph sits centred in its own frame. `projectv`
|
|
195
|
-
* its 687 frame, centre minus 343.5. Hardcoded; checked against `markBBox` in tests.
|
|
213
|
+
* Plain-mark viewBox per app. Always square. Every mark except `projectv` keeps one 629 side (equal scale), and each
|
|
214
|
+
* origin is `markBBox(app)` centre minus 314.5 on both axes, so every glyph sits centred in its own frame. `projectv`
|
|
215
|
+
* uses its 687 frame, centre minus 343.5. Hardcoded; checked against `markBBox` in tests.
|
|
196
216
|
*/
|
|
197
217
|
export const APP_MARK_VIEWBOX: Record<AppName, string> = {
|
|
198
218
|
projectv: PROJECTV_MARK_VIEWBOX,
|
|
@@ -201,6 +221,8 @@ export const APP_MARK_VIEWBOX: Record<AppName, string> = {
|
|
|
201
221
|
vmem: "197.24772201231343 196.33100022273135 629 629",
|
|
202
222
|
verve: "197.5 210.9 629 629",
|
|
203
223
|
velth: "197.5 202.45 629 629",
|
|
224
|
+
eva: "197.45 197.45 629 629",
|
|
225
|
+
bee: "197.55 187.2807619340906 629 629",
|
|
204
226
|
};
|
|
205
227
|
|
|
206
228
|
/**
|
|
@@ -215,6 +237,8 @@ export const APP_MARK_VIEWBOX_START: Record<AppName, string> = {
|
|
|
215
237
|
vmem: "255.5301217210191 196.33100022273135 629 629",
|
|
216
238
|
verve: "260.4 210.9 629 629",
|
|
217
239
|
velth: "273.9433593555699 202.45 629 629",
|
|
240
|
+
eva: "242.9 197.45 629 629",
|
|
241
|
+
bee: "278.94999999999993 187.2807619340906 629 629",
|
|
218
242
|
};
|
|
219
243
|
|
|
220
244
|
/** Width over height of a mark's viewBox. Always about 1, because the viewBoxes are square. Kept for API stability; do not use it for sizing. */
|
|
@@ -2,7 +2,7 @@ import type { AppName } from "./svg";
|
|
|
2
2
|
|
|
3
3
|
/** Benefits for one app, shown under that app's icon and name. */
|
|
4
4
|
export type PricingPlanAppBenefit = {
|
|
5
|
-
app: Exclude<AppName, "projectv">;
|
|
5
|
+
app: Exclude<AppName, "projectv" | "eva" | "bee">;
|
|
6
6
|
items: readonly string[];
|
|
7
7
|
};
|
|
8
8
|
|
package/src/entries/date-time.ts
CHANGED
package/src/entries/layout.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/layout`: screen containers, page headers
|
|
2
|
-
// chrome.
|
|
1
|
+
// `@vvedantb/native-ui/layout`: screen containers, page headers, section
|
|
2
|
+
// labels and settings chrome.
|
|
3
3
|
export { SafeAreaContainer } from "../SafeAreaContainer";
|
|
4
4
|
export { ScreenContainer } from "../ScreenContainer";
|
|
5
5
|
export { PageTitle, PageHeader } from "../PageTitle";
|
|
6
6
|
export type { PageTitleProps, PageHeaderProps } from "../PageTitle";
|
|
7
|
+
export { StackPageHeader } from "../StackPageHeader";
|
|
8
|
+
export type { StackPageHeaderProps } from "../StackPageHeader";
|
|
9
|
+
export { SectionLabel } from "../SectionLabel";
|
|
10
|
+
export type { SectionLabelProps } from "../SectionLabel";
|
|
7
11
|
export { SettingsSection } from "../settings/SettingsSection";
|
|
8
12
|
export { SettingsField } from "../settings/SettingsField";
|
|
9
13
|
export { SettingsToggleRow } from "../settings/SettingsToggleRow";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/page-title`: `PageTitle
|
|
2
|
-
// Reaches no optional peer, not even a loader.
|
|
1
|
+
// `@vvedantb/native-ui/page-title`: `PageTitle`, `PageHeader` and (from 0.5.0)
|
|
2
|
+
// `StackPageHeader`. Reaches no optional peer, not even a loader.
|
|
3
|
+
// `StackPageHeader` imports one Tabler icon (a required peer) for its back
|
|
4
|
+
// button; Metro does not tree-shake by default, so that bundles the Tabler
|
|
5
|
+
// package with this entry.
|
|
3
6
|
export { PageTitle, PageHeader } from "../PageTitle";
|
|
4
7
|
export type { PageTitleProps, PageHeaderProps } from "../PageTitle";
|
|
8
|
+
export { StackPageHeader } from "../StackPageHeader";
|
|
9
|
+
export type { StackPageHeaderProps } from "../StackPageHeader";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// `@vvedantb/native-ui/primitives`: fields, display, tabs, overlays and
|
|
2
2
|
// toasts. `BottomSheetContainer`, `DateTimeField` and `AmbientBackground` are
|
|
3
|
-
// not here; they have their own entries.
|
|
3
|
+
// not here; they have their own entries. `Text` and `TextClassContext` are the
|
|
4
|
+
// `primitives/text` variants (from 0.5.0); they are not on the root entry.
|
|
5
|
+
export { Text, TextClassContext } from "../primitives/text";
|
|
4
6
|
export { Button } from "../Button";
|
|
5
7
|
export type { ButtonProps, ButtonSize, ButtonVariant } from "../Button";
|
|
6
8
|
export { Input } from "../Input";
|
|
@@ -23,6 +25,20 @@ export { Badge } from "../Badge";
|
|
|
23
25
|
export type { BadgeProps, BadgeVariant } from "../Badge";
|
|
24
26
|
export { StatusDot } from "../StatusDot";
|
|
25
27
|
export type { StatusDotProps, StatusTone } from "../StatusDot";
|
|
28
|
+
export { ColorSwatches } from "../ColorSwatches";
|
|
29
|
+
export type { ColorSwatchesProps, ColorSwatchesSize } from "../ColorSwatches";
|
|
30
|
+
export { StatGrid } from "../StatGrid";
|
|
31
|
+
export type { StatGridItem, StatGridProps } from "../StatGrid";
|
|
32
|
+
export { SectionLabel } from "../SectionLabel";
|
|
33
|
+
export type { SectionLabelProps } from "../SectionLabel";
|
|
34
|
+
export { SheetRow } from "../SheetRow";
|
|
35
|
+
export type { SheetRowProps } from "../SheetRow";
|
|
36
|
+
export { PageIndicator } from "../PageIndicator";
|
|
37
|
+
export type { PageIndicatorProps } from "../PageIndicator";
|
|
38
|
+
export { IconButton } from "../IconButton";
|
|
39
|
+
export type { IconButtonProps, IconButtonSize, IconButtonVariant } from "../IconButton";
|
|
40
|
+
export { CaptureButton } from "../CaptureButton";
|
|
41
|
+
export type { CaptureButtonProps } from "../CaptureButton";
|
|
26
42
|
export { Separator } from "../Separator";
|
|
27
43
|
export type { SeparatorProps } from "../Separator";
|
|
28
44
|
export { Progress } from "../Progress";
|
|
@@ -43,6 +59,7 @@ export type {
|
|
|
43
59
|
TabsContentProps,
|
|
44
60
|
} from "../Tabs";
|
|
45
61
|
export { ListRow } from "../ListRow";
|
|
62
|
+
export type { ListRowProps } from "../ListRow";
|
|
46
63
|
export { HeaderIconButton } from "../HeaderIconButton";
|
|
47
64
|
export { ThemeToggle } from "../ThemeToggle";
|
|
48
65
|
export type { ThemeToggleProps } from "../ThemeToggle";
|
|
@@ -54,6 +71,7 @@ export {
|
|
|
54
71
|
CardContent,
|
|
55
72
|
CardFooter,
|
|
56
73
|
} from "../Card";
|
|
74
|
+
export type { CardProps } from "../Card";
|
|
57
75
|
export { Skeleton, CardSkeleton } from "../Skeleton";
|
|
58
76
|
export { EmptyState } from "../EmptyState";
|
|
59
77
|
export type { EmptyStateVariant } from "../EmptyState";
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
// Reference screen for the components that mirror `@vvedantb/ui`. Render it in
|
|
2
2
|
// an Expo route to compare against the web: it needs the same NativeWind setup
|
|
3
3
|
// as the rest of the package and a `SafeAreaProvider` above it. It always
|
|
4
|
-
// renders the default sizes (larger text off), as the web does. Prices
|
|
5
|
-
// are placeholders, not real
|
|
4
|
+
// renders the default sizes (larger text off), as the web does. Prices, names
|
|
5
|
+
// and figures below are placeholders, not real data.
|
|
6
6
|
import { useState, type ReactNode } from "react";
|
|
7
7
|
import { ScrollView, Text, View, type TextProps } from "react-native";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
IconCopy,
|
|
10
|
+
IconInbox,
|
|
11
|
+
IconPhoto,
|
|
12
|
+
IconRefresh,
|
|
13
|
+
IconTrash,
|
|
14
|
+
IconX,
|
|
15
|
+
} from "@tabler/icons-react-native";
|
|
9
16
|
import {
|
|
10
17
|
APP_ICONS,
|
|
11
18
|
APP_NAMES,
|
|
@@ -18,12 +25,14 @@ import {
|
|
|
18
25
|
AlertDialogHeader,
|
|
19
26
|
AlertDialogTitle,
|
|
20
27
|
AlertDialogTrigger,
|
|
28
|
+
AmbientBackground,
|
|
21
29
|
AppMark,
|
|
22
30
|
AppWordmark,
|
|
23
31
|
Avatar,
|
|
24
32
|
AvatarFallback,
|
|
25
33
|
Badge,
|
|
26
34
|
Button,
|
|
35
|
+
CaptureButton,
|
|
27
36
|
Card,
|
|
28
37
|
CardContent,
|
|
29
38
|
CardDescription,
|
|
@@ -32,7 +41,9 @@ import {
|
|
|
32
41
|
CardTitle,
|
|
33
42
|
CenteredSpinner,
|
|
34
43
|
Checkbox,
|
|
44
|
+
ColorSwatches,
|
|
35
45
|
ConfirmDialog,
|
|
46
|
+
DateTimeField,
|
|
36
47
|
Dialog,
|
|
37
48
|
DialogBody,
|
|
38
49
|
DialogClose,
|
|
@@ -44,15 +55,20 @@ import {
|
|
|
44
55
|
DialogTrigger,
|
|
45
56
|
EmptyState,
|
|
46
57
|
GoogleMark,
|
|
58
|
+
IconButton,
|
|
47
59
|
Input,
|
|
48
60
|
Label,
|
|
49
61
|
LabeledSwitchRow,
|
|
62
|
+
ListRow,
|
|
63
|
+
NEUTRAL_900,
|
|
50
64
|
NativeUiProvider,
|
|
51
65
|
PageHeader,
|
|
66
|
+
PageIndicator,
|
|
52
67
|
PageTitle,
|
|
53
68
|
PricingModal,
|
|
54
69
|
Progress,
|
|
55
70
|
SearchInput,
|
|
71
|
+
SectionLabel,
|
|
56
72
|
Select,
|
|
57
73
|
Separator,
|
|
58
74
|
Sheet,
|
|
@@ -60,10 +76,13 @@ import {
|
|
|
60
76
|
SheetDescription,
|
|
61
77
|
SheetFooter,
|
|
62
78
|
SheetHeader,
|
|
79
|
+
SheetRow,
|
|
63
80
|
SheetTitle,
|
|
64
81
|
SheetTrigger,
|
|
65
82
|
Skeleton,
|
|
66
83
|
Spinner,
|
|
84
|
+
StackPageHeader,
|
|
85
|
+
StatGrid,
|
|
67
86
|
StatusDot,
|
|
68
87
|
Switch,
|
|
69
88
|
Tabs,
|
|
@@ -75,6 +94,7 @@ import {
|
|
|
75
94
|
Toaster,
|
|
76
95
|
UpgradeToProCard,
|
|
77
96
|
initials,
|
|
97
|
+
palette,
|
|
78
98
|
toast,
|
|
79
99
|
tokens,
|
|
80
100
|
useNativeUi,
|
|
@@ -125,9 +145,13 @@ const STATUS_TONES: StatusTone[] = [
|
|
|
125
145
|
"cancelled",
|
|
126
146
|
"active",
|
|
127
147
|
"critical",
|
|
148
|
+
"info",
|
|
128
149
|
"neutral",
|
|
129
150
|
];
|
|
130
151
|
|
|
152
|
+
const SWATCHES = ["#db2777", "#2563eb", "#16a34a", "#f59e0b", "#181818", "#ffffff"];
|
|
153
|
+
const SWATCH_LABELS = ["Pink", "Blue", "Green", "Amber", "Black", "White"];
|
|
154
|
+
|
|
131
155
|
// Space after the last section, so Card, Upgrade and Overlays can scroll to the
|
|
132
156
|
// top of an 844-tall phone for screenshot crops.
|
|
133
157
|
const GALLERY_END_SPACE = 720;
|
|
@@ -194,6 +218,13 @@ function GalleryScreen() {
|
|
|
194
218
|
const [progress, setProgress] = useState(40);
|
|
195
219
|
const [pricingOpen, setPricingOpen] = useState(false);
|
|
196
220
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
221
|
+
const [swatch, setSwatch] = useState(SWATCHES[0]!);
|
|
222
|
+
const [due, setDue] = useState<Date | null>(null);
|
|
223
|
+
const [when, setWhen] = useState(() => new Date());
|
|
224
|
+
const [muted, setMuted] = useState(false);
|
|
225
|
+
const [sort, setSort] = useState<"newest" | "name">("newest");
|
|
226
|
+
const [page, setPage] = useState(0);
|
|
227
|
+
const scheme = useScheme();
|
|
197
228
|
|
|
198
229
|
return (
|
|
199
230
|
<View className="flex-1">
|
|
@@ -367,6 +398,9 @@ function GalleryScreen() {
|
|
|
367
398
|
<Card title="Today" description="Card props, as before.">
|
|
368
399
|
<GalleryText>Body</GalleryText>
|
|
369
400
|
</Card>
|
|
401
|
+
<Card title="Pressable" description="onPress makes the whole card a button." onPress={() => toast("Card pressed")}>
|
|
402
|
+
<GalleryText>Tap anywhere on the card.</GalleryText>
|
|
403
|
+
</Card>
|
|
370
404
|
<Card>
|
|
371
405
|
<CardHeader>
|
|
372
406
|
<CardTitle>Composed</CardTitle>
|
|
@@ -515,6 +549,139 @@ function GalleryScreen() {
|
|
|
515
549
|
</EmptyState.Root>
|
|
516
550
|
</Section>
|
|
517
551
|
|
|
552
|
+
{/* 0.5.0: the Verve, vibot and Velth pieces. */}
|
|
553
|
+
<Section title="ColorSwatches">
|
|
554
|
+
<ColorSwatches
|
|
555
|
+
value={swatch}
|
|
556
|
+
onChange={setSwatch}
|
|
557
|
+
colors={SWATCHES}
|
|
558
|
+
labels={SWATCH_LABELS}
|
|
559
|
+
accessibilityLabel="Accent colour"
|
|
560
|
+
/>
|
|
561
|
+
<ColorSwatches
|
|
562
|
+
value={swatch}
|
|
563
|
+
onChange={setSwatch}
|
|
564
|
+
colors={SWATCHES}
|
|
565
|
+
labels={SWATCH_LABELS}
|
|
566
|
+
accessibilityLabel="Accent colour"
|
|
567
|
+
size="sm"
|
|
568
|
+
disabled
|
|
569
|
+
/>
|
|
570
|
+
</Section>
|
|
571
|
+
|
|
572
|
+
<Section title="DateTimeField">
|
|
573
|
+
{/* Date only, empty until picked, with a clear button once set. */}
|
|
574
|
+
<DateTimeField
|
|
575
|
+
mode="date"
|
|
576
|
+
value={due}
|
|
577
|
+
onChange={setDue}
|
|
578
|
+
placeholder="No due date"
|
|
579
|
+
onClear={() => setDue(null)}
|
|
580
|
+
/>
|
|
581
|
+
<DateTimeField value={when} onChange={setWhen} />
|
|
582
|
+
</Section>
|
|
583
|
+
|
|
584
|
+
<Section title="ListRow">
|
|
585
|
+
{/* Long-press the first row for its second action. */}
|
|
586
|
+
<ListRow
|
|
587
|
+
title="Ada Lovelace"
|
|
588
|
+
meta="See you at nine"
|
|
589
|
+
leading={
|
|
590
|
+
<View>
|
|
591
|
+
<Avatar>
|
|
592
|
+
<AvatarFallback>{initials("Ada Lovelace")}</AvatarFallback>
|
|
593
|
+
</Avatar>
|
|
594
|
+
<StatusDot tone="info" size="md" className="absolute right-0 top-0" />
|
|
595
|
+
</View>
|
|
596
|
+
}
|
|
597
|
+
titleEnd={<Badge variant="secondary">09:41</Badge>}
|
|
598
|
+
accessibilityLabel="Ada Lovelace, unread, 09:41"
|
|
599
|
+
onPress={() => toast("Open thread")}
|
|
600
|
+
onLongPress={() => toast("Thread actions")}
|
|
601
|
+
/>
|
|
602
|
+
{/* The switch sits outside the pressable area: it toggles without opening the row. */}
|
|
603
|
+
<ListRow
|
|
604
|
+
title="Mute thread"
|
|
605
|
+
meta="Tap the row or the switch"
|
|
606
|
+
onPress={() => toast("Row pressed")}
|
|
607
|
+
control={<Switch checked={muted} onCheckedChange={setMuted} accessibilityLabel="Mute thread" />}
|
|
608
|
+
/>
|
|
609
|
+
</Section>
|
|
610
|
+
|
|
611
|
+
<Section title="SectionLabel and StatGrid">
|
|
612
|
+
<SectionLabel>Today</SectionLabel>
|
|
613
|
+
<StatGrid
|
|
614
|
+
items={[
|
|
615
|
+
{ label: "Done", value: "6" },
|
|
616
|
+
{ label: "This week", value: "31" },
|
|
617
|
+
{ label: "Streak", value: "12 days" },
|
|
618
|
+
]}
|
|
619
|
+
/>
|
|
620
|
+
<SectionLabel uppercase>Library</SectionLabel>
|
|
621
|
+
<StatGrid
|
|
622
|
+
columns={3}
|
|
623
|
+
items={[
|
|
624
|
+
{ label: "Books", value: "24" },
|
|
625
|
+
{ label: "Notes", value: "130" },
|
|
626
|
+
{ label: "Clips", value: "8" },
|
|
627
|
+
]}
|
|
628
|
+
/>
|
|
629
|
+
</Section>
|
|
630
|
+
|
|
631
|
+
<Section title="SheetRow">
|
|
632
|
+
{/* Static rows on the sheet surface; in an app they sit in a `SheetContent`. */}
|
|
633
|
+
<View className="py-2" style={{ backgroundColor: palette.overlay[scheme], borderRadius: tokens.radius.lg }}>
|
|
634
|
+
<SheetRow icon={IconCopy} title="Copy link" onPress={() => toast("Copied")} />
|
|
635
|
+
<SheetRow icon={IconPhoto} title="Save image" detail="To your photo library" onPress={() => toast("Saved")} />
|
|
636
|
+
<SheetRow title="Newest first" active={sort === "newest"} onPress={() => setSort("newest")} />
|
|
637
|
+
<SheetRow title="By name" active={sort === "name"} onPress={() => setSort("name")} />
|
|
638
|
+
<SheetRow icon={IconPhoto} title="Export" detail="Needs V Pro" disabled />
|
|
639
|
+
<SheetRow icon={IconTrash} title="Delete" danger onPress={() => toast.error("Deleted")} />
|
|
640
|
+
</View>
|
|
641
|
+
</Section>
|
|
642
|
+
|
|
643
|
+
<Section title="PageIndicator">
|
|
644
|
+
<PageIndicator count={4} index={page} />
|
|
645
|
+
<PageIndicator count={4} index={page} onChange={setPage} />
|
|
646
|
+
</Section>
|
|
647
|
+
|
|
648
|
+
<Section title="StackPageHeader">
|
|
649
|
+
{/* `safeTop={false}`: the strip is not at the top of the screen. */}
|
|
650
|
+
<AmbientBackground className="flex-none overflow-hidden rounded-lg">
|
|
651
|
+
<StackPageHeader
|
|
652
|
+
title="Details"
|
|
653
|
+
description="Edited 2 min ago"
|
|
654
|
+
safeTop={false}
|
|
655
|
+
onBack={() => toast("Back")}
|
|
656
|
+
headerRight={<ThemeToggle />}
|
|
657
|
+
/>
|
|
658
|
+
</AmbientBackground>
|
|
659
|
+
<AmbientBackground className="flex-none overflow-hidden rounded-lg">
|
|
660
|
+
<StackPageHeader title="A much longer page title that is cut off" safeTop={false} onBack={() => toast("Back")} />
|
|
661
|
+
</AmbientBackground>
|
|
662
|
+
</Section>
|
|
663
|
+
|
|
664
|
+
<Section title="Camera chrome">
|
|
665
|
+
{/* A dark stand-in for the live preview. */}
|
|
666
|
+
<View className="h-72 justify-between overflow-hidden rounded-lg p-4" style={{ backgroundColor: NEUTRAL_900 }}>
|
|
667
|
+
<View className="flex-row justify-between">
|
|
668
|
+
<IconButton variant="overlay" icon={IconX} label="Close camera" onPress={() => toast("Close")} />
|
|
669
|
+
<IconButton variant="overlay" icon={IconRefresh} label="Flip camera" onPress={() => toast("Flip")} />
|
|
670
|
+
</View>
|
|
671
|
+
<View className="flex-row items-center justify-between">
|
|
672
|
+
<IconButton variant="overlay" size="lg" icon={IconPhoto} label="Open library" onPress={() => toast("Library")} />
|
|
673
|
+
<CaptureButton onPress={() => toast.success("Captured")} />
|
|
674
|
+
<View style={{ width: 48 }} />
|
|
675
|
+
</View>
|
|
676
|
+
</View>
|
|
677
|
+
<View className="flex-row items-center gap-3">
|
|
678
|
+
<IconButton icon={IconCopy} label="Copy" size="sm" onPress={() => toast("Copied")} />
|
|
679
|
+
<IconButton icon={IconCopy} label="Copy" onPress={() => toast("Copied")} />
|
|
680
|
+
<IconButton icon={IconCopy} label="Copy" size="lg" onPress={() => toast("Copied")} />
|
|
681
|
+
<IconButton icon={IconTrash} label="Delete" disabled />
|
|
682
|
+
</View>
|
|
683
|
+
</Section>
|
|
684
|
+
|
|
518
685
|
{/* The full chat screen, with the composer and keyboard, is `AiChatGallery` (`@vvedantb/native-ui/ai-gallery`). */}
|
|
519
686
|
<Section title="AI chat">
|
|
520
687
|
<AiChatSamples />
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,20 @@ export { Badge } from "./Badge";
|
|
|
59
59
|
export type { BadgeProps, BadgeVariant } from "./Badge";
|
|
60
60
|
export { StatusDot } from "./StatusDot";
|
|
61
61
|
export type { StatusDotProps, StatusTone } from "./StatusDot";
|
|
62
|
+
export { ColorSwatches } from "./ColorSwatches";
|
|
63
|
+
export type { ColorSwatchesProps, ColorSwatchesSize } from "./ColorSwatches";
|
|
64
|
+
export { StatGrid } from "./StatGrid";
|
|
65
|
+
export type { StatGridItem, StatGridProps } from "./StatGrid";
|
|
66
|
+
export { SectionLabel } from "./SectionLabel";
|
|
67
|
+
export type { SectionLabelProps } from "./SectionLabel";
|
|
68
|
+
export { SheetRow } from "./SheetRow";
|
|
69
|
+
export type { SheetRowProps } from "./SheetRow";
|
|
70
|
+
export { PageIndicator } from "./PageIndicator";
|
|
71
|
+
export type { PageIndicatorProps } from "./PageIndicator";
|
|
72
|
+
export { IconButton } from "./IconButton";
|
|
73
|
+
export type { IconButtonProps, IconButtonSize, IconButtonVariant } from "./IconButton";
|
|
74
|
+
export { CaptureButton } from "./CaptureButton";
|
|
75
|
+
export type { CaptureButtonProps } from "./CaptureButton";
|
|
62
76
|
export { Separator } from "./Separator";
|
|
63
77
|
export type { SeparatorProps } from "./Separator";
|
|
64
78
|
export { Progress } from "./Progress";
|
|
@@ -79,6 +93,7 @@ export type {
|
|
|
79
93
|
TabsContentProps,
|
|
80
94
|
} from "./Tabs";
|
|
81
95
|
export { ListRow } from "./ListRow";
|
|
96
|
+
export type { ListRowProps } from "./ListRow";
|
|
82
97
|
export { HeaderIconButton } from "./HeaderIconButton";
|
|
83
98
|
export { ThemeToggle } from "./ThemeToggle";
|
|
84
99
|
export type { ThemeToggleProps } from "./ThemeToggle";
|
|
@@ -90,6 +105,7 @@ export {
|
|
|
90
105
|
CardContent,
|
|
91
106
|
CardFooter,
|
|
92
107
|
} from "./Card";
|
|
108
|
+
export type { CardProps } from "./Card";
|
|
93
109
|
export { Skeleton, CardSkeleton } from "./Skeleton";
|
|
94
110
|
export { EmptyState } from "./EmptyState";
|
|
95
111
|
export type { EmptyStateVariant } from "./EmptyState";
|
|
@@ -136,11 +152,14 @@ export { Toaster } from "./Toast";
|
|
|
136
152
|
export { toast } from "./toastStore";
|
|
137
153
|
export type { ToastOptions, ToastVariant } from "./toastStore";
|
|
138
154
|
export { DateTimeField } from "./DateTimeField";
|
|
155
|
+
export type { DateTimeFieldProps } from "./DateTimeField";
|
|
139
156
|
export { BottomSheetContainer } from "./BottomSheetContainer";
|
|
140
157
|
export { SafeAreaContainer } from "./SafeAreaContainer";
|
|
141
158
|
export { ScreenContainer } from "./ScreenContainer";
|
|
142
159
|
export { PageTitle, PageHeader } from "./PageTitle";
|
|
143
160
|
export type { PageTitleProps, PageHeaderProps } from "./PageTitle";
|
|
161
|
+
export { StackPageHeader } from "./StackPageHeader";
|
|
162
|
+
export type { StackPageHeaderProps } from "./StackPageHeader";
|
|
144
163
|
export { SettingsSection } from "./settings/SettingsSection";
|
|
145
164
|
export { SettingsField } from "./settings/SettingsField";
|
|
146
165
|
export { SettingsToggleRow } from "./settings/SettingsToggleRow";
|
|
@@ -11,7 +11,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
|
11
11
|
import { IconCheck, IconX } from "@tabler/icons-react-native";
|
|
12
12
|
import { APP_ICONS, IconProjectV } from "../brand/AppIcons";
|
|
13
13
|
import type { ProductAppName } from "../brand/AppWordmark";
|
|
14
|
-
import { familyApp } from "../brand/familyApps";
|
|
14
|
+
import { familyApp, type FamilyAppName } from "../brand/familyApps";
|
|
15
15
|
import type { AppName } from "../brand/svg";
|
|
16
16
|
import { Button } from "../Button";
|
|
17
17
|
import { cn } from "../cn";
|
|
@@ -41,8 +41,8 @@ export type PricingModalProps = {
|
|
|
41
41
|
description?: string;
|
|
42
42
|
/** Cards, top to bottom. */
|
|
43
43
|
plans: readonly PricingPlan[];
|
|
44
|
-
/** App marks at the top left. */
|
|
45
|
-
apps?: readonly
|
|
44
|
+
/** App marks at the top left. Family apps only: each links to its `FAMILY_APPS` site. */
|
|
45
|
+
apps?: readonly FamilyAppName[];
|
|
46
46
|
/** App the modal is shown in. Its `appBenefits` group comes first. */
|
|
47
47
|
currentApp?: ProductAppName;
|
|
48
48
|
/** Centred headline, for example "One plan. Every V app." */
|