@ankhorage/zora 23.0.0 → 23.2.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/constants/authoring.d.ts +4 -4
- package/dist/constants/authoring.d.ts.map +1 -1
- package/dist/constants/authoring.js +2 -0
- package/dist/constants/authoring.js.map +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
- package/dist/features/auth/adapters/inbound/AuthScreen.d.ts +10 -0
- package/dist/features/auth/adapters/inbound/AuthScreen.d.ts.map +1 -0
- package/dist/features/auth/adapters/inbound/AuthScreen.js +67 -0
- package/dist/features/auth/adapters/inbound/AuthScreen.js.map +1 -0
- package/dist/features/auth/authScreenMeta.d.ts +204 -0
- package/dist/features/auth/authScreenMeta.d.ts.map +1 -0
- package/dist/features/auth/authScreenMeta.js +112 -0
- package/dist/features/auth/authScreenMeta.js.map +1 -0
- package/dist/features/auth/public.d.ts +2 -1
- package/dist/features/auth/public.d.ts.map +1 -1
- package/dist/features/auth/public.js +1 -0
- package/dist/features/auth/public.js.map +1 -1
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
- package/dist/features/dialog/dialogMeta.d.ts +2 -2
- package/dist/features/gradient/gradientMeta.d.ts +1 -1
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/screenMeta.d.ts +1 -1
- package/dist/features/layout/scrollViewMeta.d.ts +1 -1
- package/dist/features/layout/viewMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/features/reader/meta.d.ts +2 -2
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.d.ts.map +1 -1
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js +2 -1
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js.map +1 -1
- package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
- package/dist/features/registry/componentMeta.d.ts.map +1 -1
- package/dist/features/registry/componentMeta.js +2 -0
- package/dist/features/registry/componentMeta.js.map +1 -1
- package/dist/features/scanner/meta.d.ts +2 -2
- package/dist/features/section/screenSectionMeta.d.ts +1 -1
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
- package/dist/features/tree-view/adapters/inbound/TreeItem.d.ts.map +1 -1
- package/dist/features/tree-view/adapters/inbound/TreeItem.js +2 -1
- package/dist/features/tree-view/adapters/inbound/TreeItem.js.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.d.ts.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.js +5 -4
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.js.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeView.d.ts +1 -0
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeView.d.ts.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeView.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/auth.d.ts +19 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/auth.js.map +1 -1
- package/dist/types/tree-view.d.ts +1 -0
- package/dist/types/tree-view.d.ts.map +1 -1
- package/dist/types/tree-view.js.map +1 -1
- package/package.json +2 -2
- package/src/constants/authoring.ts +2 -0
- package/src/features/auth/adapters/inbound/AuthScreen.tsx +202 -0
- package/src/features/auth/authScreenMeta.ts +114 -0
- package/src/features/auth/public.test.ts +6 -0
- package/src/features/auth/public.ts +3 -0
- package/src/features/registry/ZORA_COMPONENT_REGISTRY.ts +2 -0
- package/src/features/registry/componentMeta.test.ts +1 -0
- package/src/features/registry/componentMeta.ts +2 -0
- package/src/features/tree-view/adapters/inbound/TreeItem.tsx +3 -2
- package/src/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.tsx +12 -3
- package/src/features/tree-view/adapters/inbound/web-artifact/TreeView.test.tsx +19 -0
- package/src/features/tree-view/adapters/inbound/web-artifact/TreeView.tsx +1 -0
- package/src/index.ts +3 -0
- package/src/showcaseCoverage.test.ts +1 -0
- package/src/types/auth.ts +21 -0
- package/src/types/tree-view.ts +1 -0
- package/web-dist/chunks/{Accordion-q165k3az.js → Accordion-2ak69ntj.js} +9 -9
- package/web-dist/chunks/{Accordion-rx2gzadh.js → Accordion-46vwm9xv.js} +2 -2
- package/web-dist/chunks/{Accordion-xf8cj8z4.js → Accordion-4r9a9qny.js} +3 -3
- package/web-dist/chunks/{Accordion-w0k7gnn9.js → Accordion-5pskbqss.js} +5 -5
- package/web-dist/chunks/{Accordion-09se459d.js → Accordion-8xdet564.js} +13 -13
- package/web-dist/chunks/{Accordion-czmnsspb.js → Accordion-9n7h9hag.js} +6 -6
- package/web-dist/chunks/{Accordion-x1dg1f47.js → Accordion-b9myvfep.js} +3 -3
- package/web-dist/chunks/{Accordion-rspy7gjb.js → Accordion-bmp1ab7m.js} +494 -301
- package/web-dist/chunks/{Accordion-x13vca75.js → Accordion-cqgbx1pw.js} +3 -3
- package/web-dist/chunks/{Accordion-e633pb7z.js → Accordion-cydzrpk2.js} +1 -1
- package/web-dist/chunks/{Accordion-89q14src.js → Accordion-ejns5mga.js} +4 -4
- package/web-dist/chunks/{Accordion-f1t3rzgg.js → Accordion-ejy7gr0a.js} +4 -4
- package/web-dist/chunks/{Accordion-83hfn3y4.js → Accordion-f2mfgcx6.js} +13 -13
- package/web-dist/chunks/{Accordion-bsy1jrak.js → Accordion-ff583p4q.js} +2 -2
- package/web-dist/chunks/{Accordion-k7wwyx5x.js → Accordion-jksn8783.js} +3 -3
- package/web-dist/chunks/{Accordion-w7jv9y5t.js → Accordion-jnwa02s7.js} +2 -2
- package/web-dist/chunks/{Accordion-gkzhd3zk.js → Accordion-kmv2fp6m.js} +4 -4
- package/web-dist/chunks/{Accordion-cn8tbdvk.js → Accordion-mm4kx13n.js} +8 -8
- package/web-dist/chunks/{Accordion-b3ymabze.js → Accordion-nggjwm07.js} +3 -3
- package/web-dist/chunks/{Accordion-zx0jc0kg.js → Accordion-qb8ppq9t.js} +5 -5
- package/web-dist/chunks/Accordion-r23sx4gf.js +34 -0
- package/web-dist/chunks/{Accordion-q3z741vt.js → Accordion-rev0zb75.js} +4 -4
- package/web-dist/chunks/{Accordion-w1afjp87.js → Accordion-rnjt5z4y.js} +17 -17
- package/web-dist/chunks/{Accordion-swys7qts.js → Accordion-tyqds4zr.js} +4 -4
- package/web-dist/chunks/{Accordion-xzd0tx46.js → Accordion-v166qr59.js} +3 -3
- package/web-dist/chunks/{Accordion-gj63vb6b.js → Accordion-xw1gkpfk.js} +3 -3
- package/web-dist/chunks/{Accordion-dp638q63.js → Accordion-yms7x22j.js} +7 -7
- package/web-dist/chunks/{Accordion-fm3jxs1f.js → Accordion-z1trs7s1.js} +22 -22
- package/web-dist/chunks/{Accordion-5qmfa7vr.js → Accordion-z8h1hn96.js} +5 -5
- package/web-dist/components/accordion/Accordion.js +2 -2
- package/web-dist/components/accordion-item/AccordionItem.js +2 -2
- package/web-dist/components/app-bar/AppBar.js +6 -6
- package/web-dist/components/auth-screen/AuthScreen.d.ts +9 -0
- package/web-dist/components/auth-screen/AuthScreen.js +43 -0
- package/web-dist/components/auth-screen/index.d.ts +1 -0
- package/web-dist/components/auth-screen/index.js +2 -0
- package/web-dist/components/avatar/Avatar.js +2 -2
- package/web-dist/components/avatar-group/AvatarGroup.js +2 -2
- package/web-dist/components/badge/Badge.js +2 -2
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +8 -8
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +8 -8
- package/web-dist/components/button/Button.js +3 -3
- package/web-dist/components/button-group/ButtonGroup.js +3 -3
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +8 -8
- package/web-dist/components/card/Card.js +7 -7
- package/web-dist/components/chat-list-item/ChatListItem.js +6 -6
- package/web-dist/components/checkbox/Checkbox.js +4 -4
- package/web-dist/components/checkbox-group/CheckboxGroup.js +4 -4
- package/web-dist/components/chip/Chip.js +2 -2
- package/web-dist/components/chip-group/ChipGroup.js +2 -2
- package/web-dist/components/collection-editor/CollectionEditor.js +9 -9
- package/web-dist/components/content-rail/ContentRail.js +6 -6
- package/web-dist/components/data-table/DataTable.js +18 -18
- package/web-dist/components/date-picker/DatePicker.js +12 -12
- package/web-dist/components/dialog/Dialog.js +3 -3
- package/web-dist/components/empty-state/EmptyState.js +8 -8
- package/web-dist/components/field/Field.js +5 -5
- package/web-dist/components/flat-list/FlatList.js +5 -5
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.d.ts +1 -0
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +21 -16
- package/web-dist/components/form/Form.js +7 -7
- package/web-dist/components/form-actions/FormActions.js +7 -7
- package/web-dist/components/form-error/FormError.js +7 -7
- package/web-dist/components/heading/Heading.js +3 -3
- package/web-dist/components/hero/Hero.js +10 -10
- package/web-dist/components/icon-button/IconButton.js +3 -3
- package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +5 -32
- package/web-dist/components/list/List.js +5 -5
- package/web-dist/components/list-item/ListItem.js +5 -5
- package/web-dist/components/list-section/ListSection.js +5 -5
- package/web-dist/components/media-card/MediaCard.js +7 -7
- package/web-dist/components/message-bubble/MessageBubble.js +6 -6
- package/web-dist/components/metric-card/MetricCard.js +7 -7
- package/web-dist/components/missing-element/MissingElement.js +8 -8
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.d.ts +1 -0
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +21 -16
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.d.ts +1 -0
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +21 -16
- package/web-dist/components/otp-form/OtpForm.d.ts +1 -0
- package/web-dist/components/otp-form/OtpForm.js +21 -16
- package/web-dist/components/pagination/Pagination.js +6 -6
- package/web-dist/components/palette-item/PaletteItem.js +9 -9
- package/web-dist/components/popover-menu/PopoverMenu.js +3 -3
- package/web-dist/components/post-card/PostCard.js +7 -7
- package/web-dist/components/product-card/ProductCard.js +7 -7
- package/web-dist/components/progress/Progress.js +2 -2
- package/web-dist/components/progress-ring/ProgressRing.js +2 -2
- package/web-dist/components/radio/Radio.js +4 -4
- package/web-dist/components/radio-group/RadioGroup.js +4 -4
- package/web-dist/components/reader-surface/ReaderSurface.js +11 -11
- package/web-dist/components/scan-overlay/ScanOverlay.js +8 -8
- package/web-dist/components/screen-section/ScreenSection.js +2 -2
- package/web-dist/components/search-input/SearchInput.js +4 -4
- package/web-dist/components/section-header/SectionHeader.js +2 -2
- package/web-dist/components/section-list/SectionList.js +5 -5
- package/web-dist/components/select/Select.js +4 -4
- package/web-dist/components/sign-in-form/SignInForm.d.ts +1 -0
- package/web-dist/components/sign-in-form/SignInForm.js +21 -16
- package/web-dist/components/sign-up-form/SignUpForm.d.ts +1 -0
- package/web-dist/components/sign-up-form/SignUpForm.js +21 -16
- package/web-dist/components/skeleton/Skeleton.js +10 -10
- package/web-dist/components/skeleton-card/SkeletonCard.js +10 -10
- package/web-dist/components/skeleton-list/SkeletonList.js +10 -10
- package/web-dist/components/skeleton-text/SkeletonText.js +10 -10
- package/web-dist/components/switch/Switch.js +3 -3
- package/web-dist/components/tab/Tab.js +2 -2
- package/web-dist/components/tab-list/TabList.js +2 -2
- package/web-dist/components/tab-panel/TabPanel.js +2 -2
- package/web-dist/components/tabs/Tabs.js +2 -2
- package/web-dist/components/text/Text.js +3 -3
- package/web-dist/components/text-input/TextInput.js +4 -4
- package/web-dist/components/time-picker/TimePicker.js +10 -10
- package/web-dist/components/timeline/Timeline.js +4 -4
- package/web-dist/components/toast/Toast.js +3 -3
- package/web-dist/components/toast-provider/ToastProvider.js +3 -3
- package/web-dist/components/toolbar/Toolbar.js +7 -7
- package/web-dist/components/tree-item/TreeItem.js +10 -9
- package/web-dist/components/tree-view/TreeView.d.ts +1 -0
- package/web-dist/components/tree-view/TreeView.js +5 -2
- package/web-dist/components/uploader/Uploader.js +15 -15
- package/web-dist/manifest.json +444 -384
- package/web-dist/runtime/ZoraProvider.js +3 -3
|
@@ -1,27 +1,187 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import {
|
|
3
|
+
require_cjs
|
|
4
|
+
} from "./Accordion-7hn324r1.js";
|
|
2
5
|
import {
|
|
3
6
|
Button2
|
|
4
|
-
} from "./Accordion-
|
|
7
|
+
} from "./Accordion-yms7x22j.js";
|
|
5
8
|
import {
|
|
6
9
|
withZoraThemeScope
|
|
7
10
|
} from "./Accordion-13y3zx87.js";
|
|
8
11
|
import {
|
|
9
|
-
View2
|
|
12
|
+
View2,
|
|
13
|
+
Divider2,
|
|
14
|
+
ScrollView2
|
|
10
15
|
} from "./Accordion-01e56hb5.js";
|
|
11
16
|
import {
|
|
12
17
|
FormActions2,
|
|
13
18
|
FormError2,
|
|
14
19
|
hasRequiredRule,
|
|
15
20
|
useFormController
|
|
16
|
-
} from "./Accordion-
|
|
21
|
+
} from "./Accordion-ejy7gr0a.js";
|
|
22
|
+
import {
|
|
23
|
+
Text3
|
|
24
|
+
} from "./Accordion-46vwm9xv.js";
|
|
17
25
|
import {
|
|
18
26
|
Field2
|
|
19
|
-
} from "./Accordion-
|
|
27
|
+
} from "./Accordion-5pskbqss.js";
|
|
20
28
|
import {
|
|
21
29
|
TextInput2
|
|
22
|
-
} from "./Accordion-
|
|
30
|
+
} from "./Accordion-ejns5mga.js";
|
|
31
|
+
import {
|
|
32
|
+
KeyboardAvoidingView2
|
|
33
|
+
} from "./Accordion-r23sx4gf.js";
|
|
34
|
+
import {
|
|
35
|
+
Surface2
|
|
36
|
+
} from "./Accordion-kemavggr.js";
|
|
37
|
+
import {
|
|
38
|
+
__toESM
|
|
39
|
+
} from "./Accordion-9qvmwkxe.js";
|
|
23
40
|
|
|
24
|
-
// src/features/auth/
|
|
41
|
+
// src/features/auth/utils/oauthProviders.ts
|
|
42
|
+
var DEFAULT_OAUTH_PROVIDER_ICONS = {
|
|
43
|
+
apple: { provider: "FontAwesome", name: "apple" },
|
|
44
|
+
azure: { provider: "FontAwesome5", name: "microsoft", variant: "brand" },
|
|
45
|
+
bitbucket: { provider: "FontAwesome", name: "bitbucket" },
|
|
46
|
+
discord: { provider: "FontAwesome5", name: "discord", variant: "brand" },
|
|
47
|
+
facebook: { provider: "FontAwesome", name: "facebook" },
|
|
48
|
+
figma: { provider: "FontAwesome5", name: "figma", variant: "brand" },
|
|
49
|
+
github: { provider: "FontAwesome", name: "github" },
|
|
50
|
+
gitlab: { provider: "FontAwesome5", name: "gitlab", variant: "brand" },
|
|
51
|
+
google: { provider: "FontAwesome", name: "google" },
|
|
52
|
+
linkedin: { provider: "FontAwesome", name: "linkedin" },
|
|
53
|
+
microsoft: { provider: "FontAwesome5", name: "microsoft", variant: "brand" },
|
|
54
|
+
slack: { provider: "FontAwesome5", name: "slack", variant: "brand" },
|
|
55
|
+
spotify: { provider: "FontAwesome", name: "spotify" },
|
|
56
|
+
twitch: { provider: "FontAwesome5", name: "twitch", variant: "brand" },
|
|
57
|
+
twitter: { provider: "FontAwesome", name: "twitter" },
|
|
58
|
+
x: { provider: "FontAwesome6", name: "x-twitter", variant: "brand" },
|
|
59
|
+
zoom: { provider: "FontAwesome5", name: "video", variant: "solid" }
|
|
60
|
+
};
|
|
61
|
+
var DEFAULT_OAUTH_PROVIDER_LABELS = {
|
|
62
|
+
apple: "Apple",
|
|
63
|
+
azure: "Microsoft",
|
|
64
|
+
bitbucket: "Bitbucket",
|
|
65
|
+
discord: "Discord",
|
|
66
|
+
facebook: "Facebook",
|
|
67
|
+
figma: "Figma",
|
|
68
|
+
github: "GitHub",
|
|
69
|
+
gitlab: "GitLab",
|
|
70
|
+
google: "Google",
|
|
71
|
+
kakao: "Kakao",
|
|
72
|
+
keycloak: "Keycloak",
|
|
73
|
+
linkedin: "LinkedIn",
|
|
74
|
+
microsoft: "Microsoft",
|
|
75
|
+
notion: "Notion",
|
|
76
|
+
slack: "Slack",
|
|
77
|
+
spotify: "Spotify",
|
|
78
|
+
twitch: "Twitch",
|
|
79
|
+
twitter: "Twitter",
|
|
80
|
+
workos: "WorkOS",
|
|
81
|
+
x: "X",
|
|
82
|
+
zoom: "Zoom"
|
|
83
|
+
};
|
|
84
|
+
var oauthProviderIcons = new Map(Object.entries(DEFAULT_OAUTH_PROVIDER_ICONS));
|
|
85
|
+
var oauthProviderLabels = new Map(Object.entries(DEFAULT_OAUTH_PROVIDER_LABELS));
|
|
86
|
+
function resolveOAuthProviderIcon(providerId) {
|
|
87
|
+
return oauthProviderIcons.get(normalizeOAuthProviderId(providerId));
|
|
88
|
+
}
|
|
89
|
+
function resolveOAuthProviderLabel(providerId) {
|
|
90
|
+
const normalizedProviderId = normalizeOAuthProviderId(providerId);
|
|
91
|
+
const knownLabel = oauthProviderLabels.get(normalizedProviderId);
|
|
92
|
+
return knownLabel ?? titleCaseProviderId(normalizedProviderId);
|
|
93
|
+
}
|
|
94
|
+
function normalizeOAuthProviderId(providerId) {
|
|
95
|
+
return providerId.trim().toLowerCase();
|
|
96
|
+
}
|
|
97
|
+
function titleCaseProviderId(providerId) {
|
|
98
|
+
const words = providerId.split(/[-_\s]+/u).map((word) => word.trim()).filter((word) => word.length > 0);
|
|
99
|
+
if (words.length === 0) {
|
|
100
|
+
return "Provider";
|
|
101
|
+
}
|
|
102
|
+
return words.map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/features/auth/adapters/inbound/OAuthProviderButton.tsx
|
|
106
|
+
import { jsx } from "react/jsx-runtime";
|
|
107
|
+
function OAuthProviderButtonInner({
|
|
108
|
+
themeId: _themeId,
|
|
109
|
+
mode: _mode,
|
|
110
|
+
interactionPolicy,
|
|
111
|
+
providerId,
|
|
112
|
+
label,
|
|
113
|
+
icon,
|
|
114
|
+
disabled = false,
|
|
115
|
+
loading = false,
|
|
116
|
+
fullWidth = true,
|
|
117
|
+
size = "l",
|
|
118
|
+
variant = "outline",
|
|
119
|
+
color = "neutral",
|
|
120
|
+
onPress,
|
|
121
|
+
testID
|
|
122
|
+
}) {
|
|
123
|
+
const resolvedIcon = icon ?? resolveOAuthProviderIcon(providerId);
|
|
124
|
+
const resolvedLabel = label ?? `Continue with ${resolveOAuthProviderLabel(providerId)}`;
|
|
125
|
+
return /* @__PURE__ */ jsx(Button2, {
|
|
126
|
+
color,
|
|
127
|
+
disabled: disabled || loading || onPress === undefined,
|
|
128
|
+
fullWidth,
|
|
129
|
+
interactionPolicy,
|
|
130
|
+
leadingIcon: resolvedIcon,
|
|
131
|
+
loading,
|
|
132
|
+
onPress: () => {
|
|
133
|
+
onPress?.(providerId);
|
|
134
|
+
},
|
|
135
|
+
size,
|
|
136
|
+
testID,
|
|
137
|
+
variant,
|
|
138
|
+
children: resolvedLabel
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
var OAuthProviderButton2 = withZoraThemeScope(OAuthProviderButtonInner);
|
|
142
|
+
|
|
143
|
+
// src/features/auth/adapters/inbound/OAuthProviderList.tsx
|
|
144
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
145
|
+
function OAuthProviderListInner({
|
|
146
|
+
themeId: _themeId,
|
|
147
|
+
mode: _mode,
|
|
148
|
+
interactionPolicy,
|
|
149
|
+
providers,
|
|
150
|
+
disabled = false,
|
|
151
|
+
loading = false,
|
|
152
|
+
fullWidth,
|
|
153
|
+
layout = "stack",
|
|
154
|
+
size,
|
|
155
|
+
variant,
|
|
156
|
+
color,
|
|
157
|
+
onProviderPress,
|
|
158
|
+
testID
|
|
159
|
+
}) {
|
|
160
|
+
const direction = layout === "inline" ? "row" : "column";
|
|
161
|
+
const resolvedFullWidth = fullWidth ?? layout === "stack";
|
|
162
|
+
return /* @__PURE__ */ jsx2(View2, {
|
|
163
|
+
direction,
|
|
164
|
+
gap: "s",
|
|
165
|
+
testID,
|
|
166
|
+
wrap: layout === "inline" ? "wrap" : undefined,
|
|
167
|
+
children: providers.map((provider) => /* @__PURE__ */ jsx2(OAuthProviderButton2, {
|
|
168
|
+
color,
|
|
169
|
+
disabled: disabled || provider.disabled,
|
|
170
|
+
fullWidth: resolvedFullWidth,
|
|
171
|
+
icon: provider.icon,
|
|
172
|
+
label: provider.label,
|
|
173
|
+
loading: loading || provider.loading,
|
|
174
|
+
onPress: onProviderPress,
|
|
175
|
+
providerId: provider.id,
|
|
176
|
+
size,
|
|
177
|
+
variant,
|
|
178
|
+
interactionPolicy
|
|
179
|
+
}, provider.id))
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
var OAuthProviderList2 = withZoraThemeScope(OAuthProviderListInner);
|
|
183
|
+
|
|
184
|
+
// src/features/auth/adapters/inbound/SignInForm.tsx
|
|
25
185
|
import React from "react";
|
|
26
186
|
|
|
27
187
|
// src/features/auth/utils/authForm.ts
|
|
@@ -83,7 +243,7 @@ function normalizeIdentifierKind(identifier, identifiers) {
|
|
|
83
243
|
}
|
|
84
244
|
|
|
85
245
|
// src/features/auth/adapters/inbound/AuthFormField.tsx
|
|
86
|
-
import { jsx } from "react/jsx-runtime";
|
|
246
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
87
247
|
function AuthFormField({
|
|
88
248
|
field,
|
|
89
249
|
value,
|
|
@@ -94,7 +254,7 @@ function AuthFormField({
|
|
|
94
254
|
interactionPolicy
|
|
95
255
|
}) {
|
|
96
256
|
const fieldDisabled = disabled || loading || field.disabled;
|
|
97
|
-
return /* @__PURE__ */
|
|
257
|
+
return /* @__PURE__ */ jsx3(Field2, {
|
|
98
258
|
description: field.description,
|
|
99
259
|
disabled: fieldDisabled,
|
|
100
260
|
errorText: error,
|
|
@@ -104,7 +264,7 @@ function AuthFormField({
|
|
|
104
264
|
readOnly: field.readOnly,
|
|
105
265
|
required: field.required ?? hasRequiredRule(field.rules),
|
|
106
266
|
testID: field.testID,
|
|
107
|
-
children: /* @__PURE__ */
|
|
267
|
+
children: /* @__PURE__ */ jsx3(TextInput2, {
|
|
108
268
|
accessibilityLabel: typeof field.label === "string" ? field.label : undefined,
|
|
109
269
|
autoCapitalize: field.autoCapitalize ?? (["email", "password", "url"].includes(field.type ?? "text") ? "none" : undefined),
|
|
110
270
|
autoComplete: field.autoComplete,
|
|
@@ -148,7 +308,7 @@ function resolveTextContentType(field) {
|
|
|
148
308
|
}
|
|
149
309
|
|
|
150
310
|
// src/features/auth/adapters/inbound/AuthForm.tsx
|
|
151
|
-
import { jsx as
|
|
311
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
152
312
|
function AuthForm({
|
|
153
313
|
fields,
|
|
154
314
|
values,
|
|
@@ -168,10 +328,10 @@ function AuthForm({
|
|
|
168
328
|
gap: "m",
|
|
169
329
|
testID,
|
|
170
330
|
children: [
|
|
171
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ jsx4(FormError2, {
|
|
172
332
|
error
|
|
173
333
|
}),
|
|
174
|
-
fields.map((field) => /* @__PURE__ */
|
|
334
|
+
fields.map((field) => /* @__PURE__ */ jsx4(AuthFormField, {
|
|
175
335
|
disabled,
|
|
176
336
|
error: controller.errors[field.name],
|
|
177
337
|
field,
|
|
@@ -180,7 +340,7 @@ function AuthForm({
|
|
|
180
340
|
onChange: controller.setFieldValue,
|
|
181
341
|
value: values[field.name]
|
|
182
342
|
}, field.name)),
|
|
183
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ jsx4(FormActions2, {
|
|
184
344
|
disabled,
|
|
185
345
|
interactionPolicy,
|
|
186
346
|
loading,
|
|
@@ -195,26 +355,31 @@ function AuthForm({
|
|
|
195
355
|
});
|
|
196
356
|
}
|
|
197
357
|
|
|
198
|
-
// src/features/auth/adapters/inbound/
|
|
199
|
-
import { jsx as
|
|
200
|
-
function
|
|
358
|
+
// src/features/auth/adapters/inbound/SignInForm.tsx
|
|
359
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
360
|
+
function SignInFormInner({
|
|
201
361
|
themeId: _themeId,
|
|
202
|
-
mode: _mode,
|
|
203
362
|
interactionPolicy,
|
|
363
|
+
mode: _mode,
|
|
204
364
|
identifiers = defaultIdentifiers,
|
|
205
365
|
identifierLabel,
|
|
206
|
-
|
|
366
|
+
secretLabel = "Password",
|
|
367
|
+
forgotPasswordLabel = "Forgot password",
|
|
368
|
+
signUpLabel = "Sign up",
|
|
207
369
|
loading = false,
|
|
208
370
|
disabled = false,
|
|
209
371
|
error,
|
|
210
|
-
submitLabel = "
|
|
372
|
+
submitLabel = "Sign in",
|
|
211
373
|
onSubmit,
|
|
212
|
-
|
|
374
|
+
onForgotPassword,
|
|
375
|
+
onSignUp,
|
|
213
376
|
testID
|
|
214
377
|
}) {
|
|
215
378
|
const [values, setValues] = React.useState({
|
|
216
|
-
identifier: ""
|
|
379
|
+
identifier: "",
|
|
380
|
+
secret: ""
|
|
217
381
|
});
|
|
382
|
+
const hasActions = Boolean(onForgotPassword ?? onSignUp);
|
|
218
383
|
const fields = React.useMemo(() => [
|
|
219
384
|
{
|
|
220
385
|
name: "identifier",
|
|
@@ -222,28 +387,48 @@ function ForgotPasswordFormInner({
|
|
|
222
387
|
type: resolveIdentifierType(identifiers),
|
|
223
388
|
autoCapitalize: "none",
|
|
224
389
|
rules: resolveIdentifierRules(identifiers)
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: "secret",
|
|
393
|
+
label: secretLabel,
|
|
394
|
+
type: "password",
|
|
395
|
+
rules: [{ kind: "required" }]
|
|
225
396
|
}
|
|
226
|
-
], [identifierLabel, identifiers]);
|
|
397
|
+
], [identifierLabel, identifiers, secretLabel]);
|
|
227
398
|
const handleSubmit = React.useCallback((formValues) => onSubmit?.({
|
|
228
399
|
identifier: formValues.identifier.trim(),
|
|
229
|
-
identifierKind: normalizeIdentifierKind(formValues.identifier, identifiers)
|
|
400
|
+
identifierKind: normalizeIdentifierKind(formValues.identifier, identifiers),
|
|
401
|
+
secret: formValues.secret
|
|
230
402
|
}), [identifiers, onSubmit]);
|
|
231
|
-
return /* @__PURE__ */
|
|
232
|
-
actions:
|
|
403
|
+
return /* @__PURE__ */ jsx5(AuthForm, {
|
|
404
|
+
actions: hasActions ? /* @__PURE__ */ jsxs2(View2, {
|
|
233
405
|
direction: "row",
|
|
234
406
|
gap: "s",
|
|
235
407
|
wrap: "wrap",
|
|
236
|
-
children:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
408
|
+
children: [
|
|
409
|
+
onForgotPassword ? /* @__PURE__ */ jsx5(Button2, {
|
|
410
|
+
disabled: disabled || loading,
|
|
411
|
+
variant: "ghost",
|
|
412
|
+
onPress: () => {
|
|
413
|
+
onForgotPassword();
|
|
414
|
+
},
|
|
415
|
+
size: "s",
|
|
416
|
+
color: "neutral",
|
|
417
|
+
interactionPolicy,
|
|
418
|
+
children: forgotPasswordLabel
|
|
419
|
+
}) : null,
|
|
420
|
+
onSignUp ? /* @__PURE__ */ jsx5(Button2, {
|
|
421
|
+
disabled: disabled || loading,
|
|
422
|
+
variant: "ghost",
|
|
423
|
+
onPress: () => {
|
|
424
|
+
onSignUp();
|
|
425
|
+
},
|
|
426
|
+
size: "s",
|
|
427
|
+
color: "neutral",
|
|
428
|
+
interactionPolicy,
|
|
429
|
+
children: signUpLabel
|
|
430
|
+
}) : null
|
|
431
|
+
]
|
|
247
432
|
}) : undefined,
|
|
248
433
|
disabled,
|
|
249
434
|
error,
|
|
@@ -257,203 +442,63 @@ function ForgotPasswordFormInner({
|
|
|
257
442
|
values
|
|
258
443
|
});
|
|
259
444
|
}
|
|
260
|
-
var
|
|
445
|
+
var SignInForm2 = withZoraThemeScope(SignInFormInner);
|
|
261
446
|
|
|
262
|
-
// src/features/auth/
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
twitter: { provider: "FontAwesome", name: "twitter" },
|
|
279
|
-
x: { provider: "FontAwesome6", name: "x-twitter", variant: "brand" },
|
|
280
|
-
zoom: { provider: "FontAwesome5", name: "video", variant: "solid" }
|
|
281
|
-
};
|
|
282
|
-
var DEFAULT_OAUTH_PROVIDER_LABELS = {
|
|
283
|
-
apple: "Apple",
|
|
284
|
-
azure: "Microsoft",
|
|
285
|
-
bitbucket: "Bitbucket",
|
|
286
|
-
discord: "Discord",
|
|
287
|
-
facebook: "Facebook",
|
|
288
|
-
figma: "Figma",
|
|
289
|
-
github: "GitHub",
|
|
290
|
-
gitlab: "GitLab",
|
|
291
|
-
google: "Google",
|
|
292
|
-
kakao: "Kakao",
|
|
293
|
-
keycloak: "Keycloak",
|
|
294
|
-
linkedin: "LinkedIn",
|
|
295
|
-
microsoft: "Microsoft",
|
|
296
|
-
notion: "Notion",
|
|
297
|
-
slack: "Slack",
|
|
298
|
-
spotify: "Spotify",
|
|
299
|
-
twitch: "Twitch",
|
|
300
|
-
twitter: "Twitter",
|
|
301
|
-
workos: "WorkOS",
|
|
302
|
-
x: "X",
|
|
303
|
-
zoom: "Zoom"
|
|
304
|
-
};
|
|
305
|
-
var oauthProviderIcons = new Map(Object.entries(DEFAULT_OAUTH_PROVIDER_ICONS));
|
|
306
|
-
var oauthProviderLabels = new Map(Object.entries(DEFAULT_OAUTH_PROVIDER_LABELS));
|
|
307
|
-
function resolveOAuthProviderIcon(providerId) {
|
|
308
|
-
return oauthProviderIcons.get(normalizeOAuthProviderId(providerId));
|
|
309
|
-
}
|
|
310
|
-
function resolveOAuthProviderLabel(providerId) {
|
|
311
|
-
const normalizedProviderId = normalizeOAuthProviderId(providerId);
|
|
312
|
-
const knownLabel = oauthProviderLabels.get(normalizedProviderId);
|
|
313
|
-
return knownLabel ?? titleCaseProviderId(normalizedProviderId);
|
|
314
|
-
}
|
|
315
|
-
function normalizeOAuthProviderId(providerId) {
|
|
316
|
-
return providerId.trim().toLowerCase();
|
|
317
|
-
}
|
|
318
|
-
function titleCaseProviderId(providerId) {
|
|
319
|
-
const words = providerId.split(/[-_\s]+/u).map((word) => word.trim()).filter((word) => word.length > 0);
|
|
320
|
-
if (words.length === 0) {
|
|
321
|
-
return "Provider";
|
|
447
|
+
// src/features/auth/adapters/inbound/SignUpForm.tsx
|
|
448
|
+
import React2 from "react";
|
|
449
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
450
|
+
var defaultSignUpFields = [
|
|
451
|
+
{
|
|
452
|
+
name: "email",
|
|
453
|
+
label: "Email",
|
|
454
|
+
type: "email",
|
|
455
|
+
autoCapitalize: "none",
|
|
456
|
+
rules: [{ kind: "required" }, { kind: "email" }]
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: "password",
|
|
460
|
+
label: "Password",
|
|
461
|
+
type: "password",
|
|
462
|
+
rules: [{ kind: "required" }, { kind: "minLength", value: 8 }]
|
|
322
463
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
mode: _mode,
|
|
331
|
-
interactionPolicy,
|
|
332
|
-
providerId,
|
|
333
|
-
label,
|
|
334
|
-
icon,
|
|
335
|
-
disabled = false,
|
|
336
|
-
loading = false,
|
|
337
|
-
fullWidth = true,
|
|
338
|
-
size = "l",
|
|
339
|
-
variant = "outline",
|
|
340
|
-
color = "neutral",
|
|
341
|
-
onPress,
|
|
342
|
-
testID
|
|
343
|
-
}) {
|
|
344
|
-
const resolvedIcon = icon ?? resolveOAuthProviderIcon(providerId);
|
|
345
|
-
const resolvedLabel = label ?? `Continue with ${resolveOAuthProviderLabel(providerId)}`;
|
|
346
|
-
return /* @__PURE__ */ jsx4(Button2, {
|
|
347
|
-
color,
|
|
348
|
-
disabled: disabled || loading || onPress === undefined,
|
|
349
|
-
fullWidth,
|
|
350
|
-
interactionPolicy,
|
|
351
|
-
leadingIcon: resolvedIcon,
|
|
352
|
-
loading,
|
|
353
|
-
onPress: () => {
|
|
354
|
-
onPress?.(providerId);
|
|
355
|
-
},
|
|
356
|
-
size,
|
|
357
|
-
testID,
|
|
358
|
-
variant,
|
|
359
|
-
children: resolvedLabel
|
|
360
|
-
});
|
|
464
|
+
];
|
|
465
|
+
function createValues(fields) {
|
|
466
|
+
const values = fields.reduce((nextValues, field) => {
|
|
467
|
+
nextValues[field.name] = "";
|
|
468
|
+
return nextValues;
|
|
469
|
+
}, {});
|
|
470
|
+
return values;
|
|
361
471
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
// src/features/auth/adapters/inbound/OAuthProviderList.tsx
|
|
365
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
366
|
-
function OAuthProviderListInner({
|
|
472
|
+
function SignUpFormInner({
|
|
367
473
|
themeId: _themeId,
|
|
368
|
-
mode: _mode,
|
|
369
474
|
interactionPolicy,
|
|
370
|
-
providers,
|
|
371
|
-
disabled = false,
|
|
372
|
-
loading = false,
|
|
373
|
-
fullWidth,
|
|
374
|
-
layout = "stack",
|
|
375
|
-
size,
|
|
376
|
-
variant,
|
|
377
|
-
color,
|
|
378
|
-
onProviderPress,
|
|
379
|
-
testID
|
|
380
|
-
}) {
|
|
381
|
-
const direction = layout === "inline" ? "row" : "column";
|
|
382
|
-
const resolvedFullWidth = fullWidth ?? layout === "stack";
|
|
383
|
-
return /* @__PURE__ */ jsx5(View2, {
|
|
384
|
-
direction,
|
|
385
|
-
gap: "s",
|
|
386
|
-
testID,
|
|
387
|
-
wrap: layout === "inline" ? "wrap" : undefined,
|
|
388
|
-
children: providers.map((provider) => /* @__PURE__ */ jsx5(OAuthProviderButton2, {
|
|
389
|
-
color,
|
|
390
|
-
disabled: disabled || provider.disabled,
|
|
391
|
-
fullWidth: resolvedFullWidth,
|
|
392
|
-
icon: provider.icon,
|
|
393
|
-
label: provider.label,
|
|
394
|
-
loading: loading || provider.loading,
|
|
395
|
-
onPress: onProviderPress,
|
|
396
|
-
providerId: provider.id,
|
|
397
|
-
size,
|
|
398
|
-
variant,
|
|
399
|
-
interactionPolicy
|
|
400
|
-
}, provider.id))
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
var OAuthProviderList2 = withZoraThemeScope(OAuthProviderListInner);
|
|
404
|
-
|
|
405
|
-
// src/features/auth/adapters/inbound/OtpForm.tsx
|
|
406
|
-
import React2 from "react";
|
|
407
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
408
|
-
function OtpFormInner({
|
|
409
|
-
themeId: _themeId,
|
|
410
475
|
mode: _mode,
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
otpLabel = "Code",
|
|
414
|
-
resendLabel = "Resend code",
|
|
415
|
-
resendDisabled = false,
|
|
416
|
-
resendLoading = false,
|
|
476
|
+
fields = defaultSignUpFields,
|
|
477
|
+
signInLabel = "Sign in",
|
|
417
478
|
loading = false,
|
|
418
479
|
disabled = false,
|
|
419
480
|
error,
|
|
420
|
-
submitLabel = "
|
|
481
|
+
submitLabel = "Sign up",
|
|
421
482
|
onSubmit,
|
|
422
|
-
|
|
483
|
+
onSignIn,
|
|
423
484
|
testID
|
|
424
485
|
}) {
|
|
425
|
-
const
|
|
426
|
-
const [values, setValues] = React2.useState({
|
|
427
|
-
otp: ""
|
|
428
|
-
});
|
|
429
|
-
const fields = React2.useMemo(() => [
|
|
430
|
-
{
|
|
431
|
-
name: "otp",
|
|
432
|
-
label: otpLabel,
|
|
433
|
-
type: "otp",
|
|
434
|
-
maxLength: resolvedLength,
|
|
435
|
-
rules: [{ kind: "required" }, { kind: "minLength", value: resolvedLength }]
|
|
436
|
-
}
|
|
437
|
-
], [otpLabel, resolvedLength]);
|
|
438
|
-
const handleSubmit = React2.useCallback((formValues) => onSubmit?.({
|
|
439
|
-
otp: formValues.otp.trim()
|
|
440
|
-
}), [onSubmit]);
|
|
486
|
+
const [values, setValues] = React2.useState(() => createValues(fields));
|
|
441
487
|
return /* @__PURE__ */ jsx6(AuthForm, {
|
|
442
|
-
actions:
|
|
488
|
+
actions: onSignIn ? /* @__PURE__ */ jsx6(View2, {
|
|
443
489
|
direction: "row",
|
|
444
490
|
gap: "s",
|
|
445
491
|
wrap: "wrap",
|
|
446
492
|
children: /* @__PURE__ */ jsx6(Button2, {
|
|
447
|
-
disabled: disabled || loading
|
|
493
|
+
disabled: disabled || loading,
|
|
448
494
|
variant: "ghost",
|
|
449
|
-
loading: resendLoading,
|
|
450
495
|
onPress: () => {
|
|
451
|
-
|
|
496
|
+
onSignIn();
|
|
452
497
|
},
|
|
453
498
|
size: "s",
|
|
454
499
|
color: "neutral",
|
|
455
500
|
interactionPolicy,
|
|
456
|
-
children:
|
|
501
|
+
children: signInLabel
|
|
457
502
|
})
|
|
458
503
|
}) : undefined,
|
|
459
504
|
disabled,
|
|
@@ -462,40 +507,211 @@ function OtpFormInner({
|
|
|
462
507
|
interactionPolicy,
|
|
463
508
|
loading,
|
|
464
509
|
onChange: setValues,
|
|
465
|
-
onSubmit
|
|
510
|
+
onSubmit,
|
|
466
511
|
submitLabel,
|
|
467
512
|
testID,
|
|
468
513
|
values
|
|
469
514
|
});
|
|
470
515
|
}
|
|
471
|
-
var
|
|
516
|
+
var SignUpForm2 = withZoraThemeScope(SignUpFormInner);
|
|
472
517
|
|
|
473
|
-
// src/features/auth/adapters/inbound/
|
|
474
|
-
|
|
475
|
-
import { jsx as jsx7, jsxs as
|
|
476
|
-
|
|
518
|
+
// src/features/auth/adapters/inbound/AuthScreen.tsx
|
|
519
|
+
var import_react_native = __toESM(require_cjs(), 1);
|
|
520
|
+
import { jsx as jsx7, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
|
|
521
|
+
var AuthScreen2 = withZoraThemeScope(AuthScreenInner);
|
|
522
|
+
function AuthScreenInner({
|
|
477
523
|
themeId: _themeId,
|
|
524
|
+
mode: _themeMode,
|
|
525
|
+
interactionPolicy,
|
|
526
|
+
authMode,
|
|
527
|
+
title,
|
|
528
|
+
description,
|
|
529
|
+
info,
|
|
530
|
+
error,
|
|
531
|
+
loading = false,
|
|
532
|
+
disabled = false,
|
|
533
|
+
identifiers,
|
|
534
|
+
identifierLabel,
|
|
535
|
+
signUpFields,
|
|
536
|
+
oauthProviders = [],
|
|
537
|
+
oauthSeparatorLabel = "or continue with password",
|
|
538
|
+
onModeChange,
|
|
539
|
+
onOAuthProviderPress,
|
|
540
|
+
onSignInSubmit,
|
|
541
|
+
onSignUpSubmit,
|
|
542
|
+
testID
|
|
543
|
+
}) {
|
|
544
|
+
const effectiveTitle = title ?? (authMode === "signIn" ? "Sign in" : "Create account");
|
|
545
|
+
const hasOAuth = oauthProviders.length > 0;
|
|
546
|
+
return /* @__PURE__ */ jsx7(KeyboardAvoidingView2, {
|
|
547
|
+
behavior: import_react_native.Platform.select({ android: "height", ios: "padding" }),
|
|
548
|
+
interactionPolicy,
|
|
549
|
+
style: { flex: 1 },
|
|
550
|
+
children: /* @__PURE__ */ jsx7(ScrollView2, {
|
|
551
|
+
bg: "background",
|
|
552
|
+
contentContainerStyle: { flexGrow: 1 },
|
|
553
|
+
flex: 1,
|
|
554
|
+
interactionPolicy,
|
|
555
|
+
keyboardShouldPersistTaps: "handled",
|
|
556
|
+
children: /* @__PURE__ */ jsx7(View2, {
|
|
557
|
+
align: "center",
|
|
558
|
+
flex: 1,
|
|
559
|
+
interactionPolicy,
|
|
560
|
+
justify: "center",
|
|
561
|
+
px: { base: "m", md: "xl" },
|
|
562
|
+
py: "xl",
|
|
563
|
+
children: /* @__PURE__ */ jsxs3(Surface2, {
|
|
564
|
+
gap: "m",
|
|
565
|
+
maxWidth: 560,
|
|
566
|
+
p: { base: "l", md: "xl" },
|
|
567
|
+
radius: "l",
|
|
568
|
+
testID,
|
|
569
|
+
variant: "outline",
|
|
570
|
+
width: "100%",
|
|
571
|
+
children: [
|
|
572
|
+
/* @__PURE__ */ jsxs3(View2, {
|
|
573
|
+
gap: "xs",
|
|
574
|
+
interactionPolicy,
|
|
575
|
+
children: [
|
|
576
|
+
/* @__PURE__ */ jsx7(Text3, {
|
|
577
|
+
variant: "lead",
|
|
578
|
+
weight: "semiBold",
|
|
579
|
+
children: effectiveTitle
|
|
580
|
+
}),
|
|
581
|
+
description ? /* @__PURE__ */ jsx7(Text3, {
|
|
582
|
+
emphasis: "muted",
|
|
583
|
+
variant: "bodySmall",
|
|
584
|
+
children: description
|
|
585
|
+
}) : null
|
|
586
|
+
]
|
|
587
|
+
}),
|
|
588
|
+
hasOAuth ? /* @__PURE__ */ jsxs3(Fragment, {
|
|
589
|
+
children: [
|
|
590
|
+
/* @__PURE__ */ jsx7(OAuthProviderList2, {
|
|
591
|
+
disabled: disabled || loading,
|
|
592
|
+
interactionPolicy,
|
|
593
|
+
onProviderPress: onOAuthProviderPress,
|
|
594
|
+
providers: oauthProviders,
|
|
595
|
+
testID: testID ? `${testID}-oauth` : undefined
|
|
596
|
+
}),
|
|
597
|
+
/* @__PURE__ */ jsxs3(View2, {
|
|
598
|
+
align: "center",
|
|
599
|
+
direction: "row",
|
|
600
|
+
gap: "s",
|
|
601
|
+
interactionPolicy,
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ jsx7(View2, {
|
|
604
|
+
flex: 1,
|
|
605
|
+
interactionPolicy,
|
|
606
|
+
children: /* @__PURE__ */ jsx7(Divider2, {
|
|
607
|
+
interactionPolicy
|
|
608
|
+
})
|
|
609
|
+
}),
|
|
610
|
+
/* @__PURE__ */ jsx7(Text3, {
|
|
611
|
+
emphasis: "muted",
|
|
612
|
+
variant: "bodySmall",
|
|
613
|
+
children: oauthSeparatorLabel
|
|
614
|
+
}),
|
|
615
|
+
/* @__PURE__ */ jsx7(View2, {
|
|
616
|
+
flex: 1,
|
|
617
|
+
interactionPolicy,
|
|
618
|
+
children: /* @__PURE__ */ jsx7(Divider2, {
|
|
619
|
+
interactionPolicy
|
|
620
|
+
})
|
|
621
|
+
})
|
|
622
|
+
]
|
|
623
|
+
})
|
|
624
|
+
]
|
|
625
|
+
}) : null,
|
|
626
|
+
/* @__PURE__ */ jsx7(AuthScreenForm, {
|
|
627
|
+
authMode,
|
|
628
|
+
disabled,
|
|
629
|
+
error,
|
|
630
|
+
identifierLabel,
|
|
631
|
+
identifiers,
|
|
632
|
+
interactionPolicy,
|
|
633
|
+
loading,
|
|
634
|
+
onModeChange,
|
|
635
|
+
onSignInSubmit,
|
|
636
|
+
onSignUpSubmit,
|
|
637
|
+
signUpFields,
|
|
638
|
+
testID: testID ? `${testID}-form` : undefined
|
|
639
|
+
}),
|
|
640
|
+
info ? /* @__PURE__ */ jsx7(Text3, {
|
|
641
|
+
color: "success",
|
|
642
|
+
variant: "bodySmall",
|
|
643
|
+
children: info
|
|
644
|
+
}) : null
|
|
645
|
+
]
|
|
646
|
+
})
|
|
647
|
+
})
|
|
648
|
+
})
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
function AuthScreenForm({
|
|
652
|
+
authMode,
|
|
653
|
+
disabled,
|
|
654
|
+
error,
|
|
655
|
+
identifierLabel,
|
|
656
|
+
identifiers,
|
|
478
657
|
interactionPolicy,
|
|
658
|
+
loading,
|
|
659
|
+
onModeChange,
|
|
660
|
+
onSignInSubmit,
|
|
661
|
+
onSignUpSubmit,
|
|
662
|
+
signUpFields,
|
|
663
|
+
testID
|
|
664
|
+
}) {
|
|
665
|
+
if (authMode === "signIn") {
|
|
666
|
+
return /* @__PURE__ */ jsx7(SignInForm2, {
|
|
667
|
+
disabled,
|
|
668
|
+
error,
|
|
669
|
+
identifierLabel,
|
|
670
|
+
identifiers,
|
|
671
|
+
interactionPolicy,
|
|
672
|
+
loading,
|
|
673
|
+
onSignUp: onModeChange ? () => onModeChange("signUp") : undefined,
|
|
674
|
+
onSubmit: onSignInSubmit,
|
|
675
|
+
signUpLabel: "Need an account? Sign up",
|
|
676
|
+
submitLabel: "Sign in",
|
|
677
|
+
testID
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
return /* @__PURE__ */ jsx7(SignUpForm2, {
|
|
681
|
+
disabled,
|
|
682
|
+
error,
|
|
683
|
+
fields: signUpFields,
|
|
684
|
+
interactionPolicy,
|
|
685
|
+
loading,
|
|
686
|
+
onSignIn: onModeChange ? () => onModeChange("signIn") : undefined,
|
|
687
|
+
onSubmit: onSignUpSubmit,
|
|
688
|
+
signInLabel: "Already have an account? Sign in",
|
|
689
|
+
submitLabel: "Create account",
|
|
690
|
+
testID
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// src/features/auth/adapters/inbound/ForgotPasswordForm.tsx
|
|
695
|
+
import React3 from "react";
|
|
696
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
697
|
+
function ForgotPasswordFormInner({
|
|
698
|
+
themeId: _themeId,
|
|
479
699
|
mode: _mode,
|
|
700
|
+
interactionPolicy,
|
|
480
701
|
identifiers = defaultIdentifiers,
|
|
481
702
|
identifierLabel,
|
|
482
|
-
|
|
483
|
-
forgotPasswordLabel = "Forgot password",
|
|
484
|
-
signUpLabel = "Sign up",
|
|
703
|
+
signInLabel = "Sign in",
|
|
485
704
|
loading = false,
|
|
486
705
|
disabled = false,
|
|
487
706
|
error,
|
|
488
|
-
submitLabel = "
|
|
707
|
+
submitLabel = "Send code",
|
|
489
708
|
onSubmit,
|
|
490
|
-
|
|
491
|
-
onSignUp,
|
|
709
|
+
onSignIn,
|
|
492
710
|
testID
|
|
493
711
|
}) {
|
|
494
712
|
const [values, setValues] = React3.useState({
|
|
495
|
-
identifier: ""
|
|
496
|
-
secret: ""
|
|
713
|
+
identifier: ""
|
|
497
714
|
});
|
|
498
|
-
const hasActions = Boolean(onForgotPassword ?? onSignUp);
|
|
499
715
|
const fields = React3.useMemo(() => [
|
|
500
716
|
{
|
|
501
717
|
name: "identifier",
|
|
@@ -503,48 +719,28 @@ function SignInFormInner({
|
|
|
503
719
|
type: resolveIdentifierType(identifiers),
|
|
504
720
|
autoCapitalize: "none",
|
|
505
721
|
rules: resolveIdentifierRules(identifiers)
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
name: "secret",
|
|
509
|
-
label: secretLabel,
|
|
510
|
-
type: "password",
|
|
511
|
-
rules: [{ kind: "required" }]
|
|
512
722
|
}
|
|
513
|
-
], [identifierLabel, identifiers
|
|
723
|
+
], [identifierLabel, identifiers]);
|
|
514
724
|
const handleSubmit = React3.useCallback((formValues) => onSubmit?.({
|
|
515
725
|
identifier: formValues.identifier.trim(),
|
|
516
|
-
identifierKind: normalizeIdentifierKind(formValues.identifier, identifiers)
|
|
517
|
-
secret: formValues.secret
|
|
726
|
+
identifierKind: normalizeIdentifierKind(formValues.identifier, identifiers)
|
|
518
727
|
}), [identifiers, onSubmit]);
|
|
519
|
-
return /* @__PURE__ */
|
|
520
|
-
actions:
|
|
728
|
+
return /* @__PURE__ */ jsx8(AuthForm, {
|
|
729
|
+
actions: onSignIn ? /* @__PURE__ */ jsx8(View2, {
|
|
521
730
|
direction: "row",
|
|
522
731
|
gap: "s",
|
|
523
732
|
wrap: "wrap",
|
|
524
|
-
children:
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}) : null,
|
|
536
|
-
onSignUp ? /* @__PURE__ */ jsx7(Button2, {
|
|
537
|
-
disabled: disabled || loading,
|
|
538
|
-
variant: "ghost",
|
|
539
|
-
onPress: () => {
|
|
540
|
-
onSignUp();
|
|
541
|
-
},
|
|
542
|
-
size: "s",
|
|
543
|
-
color: "neutral",
|
|
544
|
-
interactionPolicy,
|
|
545
|
-
children: signUpLabel
|
|
546
|
-
}) : null
|
|
547
|
-
]
|
|
733
|
+
children: /* @__PURE__ */ jsx8(Button2, {
|
|
734
|
+
disabled: disabled || loading,
|
|
735
|
+
variant: "ghost",
|
|
736
|
+
onPress: () => {
|
|
737
|
+
onSignIn();
|
|
738
|
+
},
|
|
739
|
+
size: "s",
|
|
740
|
+
color: "neutral",
|
|
741
|
+
interactionPolicy,
|
|
742
|
+
children: signInLabel
|
|
743
|
+
})
|
|
548
744
|
}) : undefined,
|
|
549
745
|
disabled,
|
|
550
746
|
error,
|
|
@@ -558,63 +754,60 @@ function SignInFormInner({
|
|
|
558
754
|
values
|
|
559
755
|
});
|
|
560
756
|
}
|
|
561
|
-
var
|
|
757
|
+
var ForgotPasswordForm2 = withZoraThemeScope(ForgotPasswordFormInner);
|
|
562
758
|
|
|
563
|
-
// src/features/auth/adapters/inbound/
|
|
759
|
+
// src/features/auth/adapters/inbound/OtpForm.tsx
|
|
564
760
|
import React4 from "react";
|
|
565
|
-
import { jsx as
|
|
566
|
-
|
|
567
|
-
{
|
|
568
|
-
name: "email",
|
|
569
|
-
label: "Email",
|
|
570
|
-
type: "email",
|
|
571
|
-
autoCapitalize: "none",
|
|
572
|
-
rules: [{ kind: "required" }, { kind: "email" }]
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
name: "password",
|
|
576
|
-
label: "Password",
|
|
577
|
-
type: "password",
|
|
578
|
-
rules: [{ kind: "required" }, { kind: "minLength", value: 8 }]
|
|
579
|
-
}
|
|
580
|
-
];
|
|
581
|
-
function createValues(fields) {
|
|
582
|
-
const values = fields.reduce((nextValues, field) => {
|
|
583
|
-
nextValues[field.name] = "";
|
|
584
|
-
return nextValues;
|
|
585
|
-
}, {});
|
|
586
|
-
return values;
|
|
587
|
-
}
|
|
588
|
-
function SignUpFormInner({
|
|
761
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
762
|
+
function OtpFormInner({
|
|
589
763
|
themeId: _themeId,
|
|
590
|
-
interactionPolicy,
|
|
591
764
|
mode: _mode,
|
|
592
|
-
|
|
593
|
-
|
|
765
|
+
interactionPolicy,
|
|
766
|
+
length = 6,
|
|
767
|
+
otpLabel = "Code",
|
|
768
|
+
resendLabel = "Resend code",
|
|
769
|
+
resendDisabled = false,
|
|
770
|
+
resendLoading = false,
|
|
594
771
|
loading = false,
|
|
595
772
|
disabled = false,
|
|
596
773
|
error,
|
|
597
|
-
submitLabel = "
|
|
774
|
+
submitLabel = "Verify code",
|
|
598
775
|
onSubmit,
|
|
599
|
-
|
|
776
|
+
onResend,
|
|
600
777
|
testID
|
|
601
778
|
}) {
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
779
|
+
const resolvedLength = Math.max(1, length);
|
|
780
|
+
const [values, setValues] = React4.useState({
|
|
781
|
+
otp: ""
|
|
782
|
+
});
|
|
783
|
+
const fields = React4.useMemo(() => [
|
|
784
|
+
{
|
|
785
|
+
name: "otp",
|
|
786
|
+
label: otpLabel,
|
|
787
|
+
type: "otp",
|
|
788
|
+
maxLength: resolvedLength,
|
|
789
|
+
rules: [{ kind: "required" }, { kind: "minLength", value: resolvedLength }]
|
|
790
|
+
}
|
|
791
|
+
], [otpLabel, resolvedLength]);
|
|
792
|
+
const handleSubmit = React4.useCallback((formValues) => onSubmit?.({
|
|
793
|
+
otp: formValues.otp.trim()
|
|
794
|
+
}), [onSubmit]);
|
|
795
|
+
return /* @__PURE__ */ jsx9(AuthForm, {
|
|
796
|
+
actions: onResend ? /* @__PURE__ */ jsx9(View2, {
|
|
605
797
|
direction: "row",
|
|
606
798
|
gap: "s",
|
|
607
799
|
wrap: "wrap",
|
|
608
|
-
children: /* @__PURE__ */
|
|
609
|
-
disabled: disabled || loading,
|
|
800
|
+
children: /* @__PURE__ */ jsx9(Button2, {
|
|
801
|
+
disabled: disabled || loading || resendDisabled,
|
|
610
802
|
variant: "ghost",
|
|
803
|
+
loading: resendLoading,
|
|
611
804
|
onPress: () => {
|
|
612
|
-
|
|
805
|
+
onResend();
|
|
613
806
|
},
|
|
614
807
|
size: "s",
|
|
615
808
|
color: "neutral",
|
|
616
809
|
interactionPolicy,
|
|
617
|
-
children:
|
|
810
|
+
children: resendLabel
|
|
618
811
|
})
|
|
619
812
|
}) : undefined,
|
|
620
813
|
disabled,
|
|
@@ -623,11 +816,11 @@ function SignUpFormInner({
|
|
|
623
816
|
interactionPolicy,
|
|
624
817
|
loading,
|
|
625
818
|
onChange: setValues,
|
|
626
|
-
onSubmit,
|
|
819
|
+
onSubmit: handleSubmit,
|
|
627
820
|
submitLabel,
|
|
628
821
|
testID,
|
|
629
822
|
values
|
|
630
823
|
});
|
|
631
824
|
}
|
|
632
|
-
var
|
|
633
|
-
export {
|
|
825
|
+
var OtpForm2 = withZoraThemeScope(OtpFormInner);
|
|
826
|
+
export { OAuthProviderButton2, OAuthProviderList2, SignInForm2, SignUpForm2, AuthScreen2, ForgotPasswordForm2, OtpForm2 };
|