@timmbr/ui 1.4.2 → 1.5.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/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Accordion/Accordion.styles.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.styles.js +3 -3
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/Alert/Alert.styles.js +4 -4
- package/dist/components/AlertDialog/AlertDialog.styles.js +4 -4
- package/dist/components/AuthModal/AuthModal.d.ts +4 -0
- package/dist/components/AuthModal/AuthModal.d.ts.map +1 -0
- package/dist/components/AuthModal/AuthModal.js +89 -0
- package/dist/components/AuthModal/AuthModal.labels.d.ts +6 -0
- package/dist/components/AuthModal/AuthModal.labels.d.ts.map +1 -0
- package/dist/components/AuthModal/AuthModal.labels.js +52 -0
- package/dist/components/AuthModal/AuthModal.styles.d.ts +12 -0
- package/dist/components/AuthModal/AuthModal.styles.d.ts.map +1 -0
- package/dist/components/AuthModal/AuthModal.styles.js +38 -0
- package/dist/components/AuthModal/AuthModal.types.d.ts +158 -0
- package/dist/components/AuthModal/AuthModal.types.d.ts.map +1 -0
- package/dist/components/AuthModal/index.d.ts +6 -0
- package/dist/components/AuthModal/index.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalBanner.d.ts +11 -0
- package/dist/components/AuthModal/subcomponents/AuthModalBanner.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalBanner.js +58 -0
- package/dist/components/AuthModal/subcomponents/AuthModalIdentifierForm.d.ts +11 -0
- package/dist/components/AuthModal/subcomponents/AuthModalIdentifierForm.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalIdentifierForm.js +62 -0
- package/dist/components/AuthModal/subcomponents/AuthModalOAuth.d.ts +11 -0
- package/dist/components/AuthModal/subcomponents/AuthModalOAuth.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalOAuth.js +19 -0
- package/dist/components/AuthModal/subcomponents/AuthModalOtpForm.d.ts +10 -0
- package/dist/components/AuthModal/subcomponents/AuthModalOtpForm.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalOtpForm.js +62 -0
- package/dist/components/AuthModal/subcomponents/AuthModalParts.d.ts +44 -0
- package/dist/components/AuthModal/subcomponents/AuthModalParts.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalParts.js +134 -0
- package/dist/components/AuthModal/subcomponents/AuthModalPasswordForm.d.ts +10 -0
- package/dist/components/AuthModal/subcomponents/AuthModalPasswordForm.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalPasswordForm.js +54 -0
- package/dist/components/AuthModal/subcomponents/AuthModalSetPasswordForm.d.ts +10 -0
- package/dist/components/AuthModal/subcomponents/AuthModalSetPasswordForm.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalSetPasswordForm.js +79 -0
- package/dist/components/AuthModal/subcomponents/AuthModalSuccess.d.ts +10 -0
- package/dist/components/AuthModal/subcomponents/AuthModalSuccess.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/AuthModalSuccess.js +26 -0
- package/dist/components/AuthModal/subcomponents/OAuthButton.d.ts +12 -0
- package/dist/components/AuthModal/subcomponents/OAuthButton.d.ts.map +1 -0
- package/dist/components/AuthModal/subcomponents/OAuthButton.js +38 -0
- package/dist/components/AuthModal/subcomponents/index.d.ts +9 -0
- package/dist/components/AuthModal/subcomponents/index.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.styles.js +11 -11
- package/dist/components/Badge/Badge.styles.js +8 -8
- package/dist/components/Button/Button.styles.js +7 -7
- package/dist/components/Card/Card.styles.d.ts.map +1 -1
- package/dist/components/Card/Card.styles.js +5 -5
- package/dist/components/Checkbox/Checkbox.js +4 -4
- package/dist/components/Checkbox/Checkbox.styles.js +1 -1
- package/dist/components/Chip/Chip.js +1 -1
- package/dist/components/Chip/Chip.styles.js +5 -5
- package/dist/components/DataList/DataList.styles.js +3 -3
- package/dist/components/Dialog/Dialog.styles.js +6 -6
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/Drawer/Drawer.styles.js +2 -2
- package/dist/components/Dropdown/Dropdown.js +2 -2
- package/dist/components/Dropdown/Dropdown.styles.js +2 -2
- package/dist/components/EmptyState/EmptyState.js +2 -2
- package/dist/components/EmptyState/EmptyState.styles.js +3 -3
- package/dist/components/FormField/FormField.js +1 -1
- package/dist/components/Heading/Heading.styles.d.ts.map +1 -1
- package/dist/components/Heading/Heading.styles.js +12 -10
- package/dist/components/Icon/Icon.styles.js +6 -6
- package/dist/components/ImageUpload/ImageUpload.js +6 -6
- package/dist/components/ImageUpload/subcomponents/ImageUploadDropzone.js +10 -10
- package/dist/components/ImageUpload/subcomponents/ImageUploadModal.js +8 -8
- package/dist/components/ImageUpload/subcomponents/ImageUploadSinglePreview.js +7 -7
- package/dist/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.js +10 -10
- package/dist/components/Input/Input.js +4 -4
- package/dist/components/Input/Input.styles.js +6 -6
- package/dist/components/Label/Label.styles.js +4 -4
- package/dist/components/LinkButton/LinkButton.styles.js +6 -6
- package/dist/components/List/List.js +1 -1
- package/dist/components/List/List.styles.js +3 -3
- package/dist/components/NavFooter/NavFooter.styles.js +9 -9
- package/dist/components/NavFooter/subcomponents/FooterBrand.js +3 -3
- package/dist/components/NavFooter/subcomponents/FooterLegalBar.js +1 -1
- package/dist/components/NavFooter/subcomponents/FooterNavSection.js +4 -4
- package/dist/components/NavFooter/subcomponents/FooterNewsletter.js +7 -7
- package/dist/components/NavFooter/subcomponents/FooterOffice.js +5 -5
- package/dist/components/NavFooter/subcomponents/FooterSocial.js +3 -3
- package/dist/components/NavHeader/NavHeader.d.ts.map +1 -1
- package/dist/components/NavHeader/NavHeader.js +11 -3
- package/dist/components/NavHeader/NavHeader.styles.js +16 -16
- package/dist/components/NavHeader/NavHeader.types.d.ts +19 -0
- package/dist/components/NavHeader/NavHeader.types.d.ts.map +1 -1
- package/dist/components/NavHeader/subcomponents/NavActionLabelSkeleton.d.ts +4 -0
- package/dist/components/NavHeader/subcomponents/NavActionLabelSkeleton.d.ts.map +1 -0
- package/dist/components/NavHeader/subcomponents/NavActionLabelSkeleton.js +16 -0
- package/dist/components/NavHeader/subcomponents/NavActionOverflow.d.ts.map +1 -1
- package/dist/components/NavHeader/subcomponents/NavActionOverflow.js +6 -5
- package/dist/components/NavHeader/subcomponents/NavActions.d.ts +9 -0
- package/dist/components/NavHeader/subcomponents/NavActions.d.ts.map +1 -1
- package/dist/components/NavHeader/subcomponents/NavActions.js +51 -15
- package/dist/components/NavHeader/subcomponents/NavBrand.d.ts.map +1 -1
- package/dist/components/NavHeader/subcomponents/NavBrand.js +14 -15
- package/dist/components/NavHeader/subcomponents/NavItems.js +3 -3
- package/dist/components/NavHeader/subcomponents/NavItemsOverflow.js +7 -7
- package/dist/components/NavHeader/subcomponents/NavMobileSearchDrawer.js +5 -5
- package/dist/components/NavHeader/subcomponents/NavMobileTabSlider.js +2 -2
- package/dist/components/NavHeader/subcomponents/NavSearch.js +5 -5
- package/dist/components/NavHeader/subcomponents/OfferBanner.js +1 -1
- package/dist/components/OtpInput/OtpInput.d.ts +4 -0
- package/dist/components/OtpInput/OtpInput.d.ts.map +1 -0
- package/dist/components/OtpInput/OtpInput.js +114 -0
- package/dist/components/OtpInput/OtpInput.styles.d.ts +10 -0
- package/dist/components/OtpInput/OtpInput.styles.d.ts.map +1 -0
- package/dist/components/OtpInput/OtpInput.styles.js +49 -0
- package/dist/components/OtpInput/OtpInput.types.d.ts +40 -0
- package/dist/components/OtpInput/OtpInput.types.d.ts.map +1 -0
- package/dist/components/OtpInput/index.d.ts +4 -0
- package/dist/components/OtpInput/index.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.styles.js +3 -3
- package/dist/components/Popover/Popover.styles.js +1 -1
- package/dist/components/Progress/Progress.js +2 -2
- package/dist/components/Radio/Radio.js +4 -4
- package/dist/components/Radio/Radio.styles.js +1 -1
- package/dist/components/RangeSlider/RangeSlider.js +3 -3
- package/dist/components/RangeSlider/RangeSlider.styles.js +1 -1
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Select/Select.styles.js +8 -8
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.js +8 -8
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.js +3 -3
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.js +1 -1
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.js +4 -4
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.js +9 -9
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.js +2 -2
- package/dist/components/Skeleton/Skeleton.styles.js +1 -1
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.js +9 -7
- package/dist/components/Spinner/Spinner.styles.d.ts +8 -2
- package/dist/components/Spinner/Spinner.styles.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.styles.js +27 -24
- package/dist/components/Spinner/Spinner.types.d.ts +9 -0
- package/dist/components/Spinner/Spinner.types.d.ts.map +1 -1
- package/dist/components/Stat/Stat.styles.js +4 -4
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Switch/Switch.styles.js +1 -1
- package/dist/components/Table/Table.js +1 -1
- package/dist/components/Table/Table.styles.js +5 -5
- package/dist/components/Table/TablePagination.js +4 -4
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Tabs/Tabs.styles.js +8 -8
- package/dist/components/Text/Text.styles.d.ts.map +1 -1
- package/dist/components/Text/Text.styles.js +17 -15
- package/dist/components/Textarea/Textarea.js +4 -4
- package/dist/components/Textarea/Textarea.styles.js +6 -6
- package/dist/components/Toast/Toast.js +3 -3
- package/dist/components/Toast/Toast.styles.js +5 -5
- package/dist/components/Toast/ToastContainer.js +1 -1
- package/dist/components/Tooltip/Tooltip.styles.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/package.json +7 -6
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts +0 -10
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts.map +0 -1
- package/dist/components/CrossZoneLink/CrossZoneLink.js +0 -111
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts +0 -8
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts.map +0 -1
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.js +0 -33
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts +0 -31
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts.map +0 -1
- package/dist/components/CrossZoneLink/index.d.ts +0 -4
- package/dist/components/CrossZoneLink/index.d.ts.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
4
|
+
import { authModalInputVariants, authModalLinkVariants } from '../AuthModal.styles.js';
|
|
5
|
+
import { AuthStepHeader, AuthForm, AuthFieldError, AuthSubmitButton, AuthTextLink } from './AuthModalParts.js';
|
|
6
|
+
|
|
7
|
+
const INPUT_ID = "auth-identifier-input";
|
|
8
|
+
const ERROR_ID = "auth-identifier-error";
|
|
9
|
+
function AuthModalIdentifierForm({ form, legal }) {
|
|
10
|
+
const labels = useAuthModalLabels();
|
|
11
|
+
const {
|
|
12
|
+
identifier = "",
|
|
13
|
+
onIdentifierChange,
|
|
14
|
+
onIdentifierSubmit,
|
|
15
|
+
onUsePassword,
|
|
16
|
+
isLoading = false,
|
|
17
|
+
error
|
|
18
|
+
} = form;
|
|
19
|
+
const isEmpty = !identifier.trim();
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "auth-modal-identifier-step", className: "flex flex-col", children: [
|
|
21
|
+
/* @__PURE__ */ jsx(AuthStepHeader, { title: labels.identifierTitle, subtitle: labels.identifierSubtitle }),
|
|
22
|
+
/* @__PURE__ */ jsxs(AuthForm, { onSubmit: onIdentifierSubmit, className: "space-y-4", children: [
|
|
23
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
24
|
+
/* @__PURE__ */ jsx("label", { htmlFor: INPUT_ID, className: "sr-only", children: labels.identifierLabel }),
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
"input",
|
|
27
|
+
{
|
|
28
|
+
id: INPUT_ID,
|
|
29
|
+
type: "text",
|
|
30
|
+
inputMode: "email",
|
|
31
|
+
autoComplete: "username",
|
|
32
|
+
autoCapitalize: "none",
|
|
33
|
+
spellCheck: false,
|
|
34
|
+
value: identifier,
|
|
35
|
+
onChange: (e) => onIdentifierChange?.(e.target.value),
|
|
36
|
+
placeholder: labels.identifierPlaceholder,
|
|
37
|
+
disabled: isLoading,
|
|
38
|
+
autoFocus: true,
|
|
39
|
+
"aria-invalid": !!error || void 0,
|
|
40
|
+
"aria-describedby": error ? ERROR_ID : void 0,
|
|
41
|
+
className: authModalInputVariants({ invalid: !!error })
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsx(AuthFieldError, { id: ERROR_ID, children: error })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx(AuthSubmitButton, { isLoading, disabled: isEmpty, children: labels.continue }),
|
|
47
|
+
onUsePassword && /* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx(AuthTextLink, { onClick: onUsePassword, disabled: isLoading || isEmpty, className: "text-body-2", children: labels.usePassword }) }),
|
|
48
|
+
/* @__PURE__ */ jsxs("p", { className: "text-body-3 text-grey-600 text-center leading-relaxed pt-1", children: [
|
|
49
|
+
labels.legalPrefix,
|
|
50
|
+
" ",
|
|
51
|
+
/* @__PURE__ */ jsx("a", { href: legal?.termsUrl ?? "/terms", className: authModalLinkVariants(), children: labels.termsOfUse }),
|
|
52
|
+
" ",
|
|
53
|
+
"&",
|
|
54
|
+
" ",
|
|
55
|
+
/* @__PURE__ */ jsx("a", { href: legal?.privacyUrl ?? "/privacy", className: authModalLinkVariants(), children: labels.privacyPolicy })
|
|
56
|
+
] })
|
|
57
|
+
] })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
AuthModalIdentifierForm.displayName = "AuthModalIdentifierForm";
|
|
61
|
+
|
|
62
|
+
export { AuthModalIdentifierForm };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AuthModalOAuthProps } from '../AuthModal.types';
|
|
3
|
+
export interface AuthModalOAuthSectionProps extends AuthModalOAuthProps {
|
|
4
|
+
/** Disable every provider (e.g. while an OTP request is in flight) */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function AuthModalOAuth({ providers, disabled }: AuthModalOAuthSectionProps): React.JSX.Element | null;
|
|
8
|
+
export declare namespace AuthModalOAuth {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=AuthModalOAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthModalOAuth.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/AuthModalOAuth.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,0BAA0B,4BAsBjF;yBAtBe,cAAc"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { OAuthButton } from './OAuthButton.js';
|
|
4
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
5
|
+
|
|
6
|
+
function AuthModalOAuth({ providers, disabled }) {
|
|
7
|
+
const labels = useAuthModalLabels();
|
|
8
|
+
if (!providers || providers.length === 0) return null;
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "auth-modal-oauth-section", className: "mt-6 flex flex-col", children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-center my-2", "aria-hidden": "true", children: [
|
|
11
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ jsx("div", { className: "w-full border-t border-border-warm" }) }),
|
|
12
|
+
/* @__PURE__ */ jsx("div", { className: "relative px-3 bg-grey-50 text-body-3 text-sand-muted uppercase font-medium tracking-wider", children: labels.oauthDivider })
|
|
13
|
+
] }),
|
|
14
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col gap-3", children: providers.map((provider) => /* @__PURE__ */ jsx(OAuthButton, { provider, disabled }, provider.id)) })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
AuthModalOAuth.displayName = "AuthModalOAuth";
|
|
18
|
+
|
|
19
|
+
export { AuthModalOAuth };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AuthModalFormProps } from '../AuthModal.types';
|
|
3
|
+
export interface AuthModalOtpFormProps {
|
|
4
|
+
form: AuthModalFormProps;
|
|
5
|
+
}
|
|
6
|
+
export declare function AuthModalOtpForm({ form }: AuthModalOtpFormProps): React.JSX.Element;
|
|
7
|
+
export declare namespace AuthModalOtpForm {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AuthModalOtpForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthModalOtpForm.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/AuthModalOtpForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAS7D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,EAAE,qBAAqB,qBAgE/D;yBAhEe,gBAAgB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
4
|
+
import { AuthStepHeader, AuthDestination, AuthForm, AuthSubmitButton, AuthTextLink } from './AuthModalParts.js';
|
|
5
|
+
import { OtpInput } from '../../OtpInput/OtpInput.js';
|
|
6
|
+
|
|
7
|
+
function AuthModalOtpForm({ form }) {
|
|
8
|
+
const labels = useAuthModalLabels();
|
|
9
|
+
const {
|
|
10
|
+
identifier = "",
|
|
11
|
+
otp = "",
|
|
12
|
+
otpLength = 6,
|
|
13
|
+
onOtpChange,
|
|
14
|
+
onOtpSubmit,
|
|
15
|
+
onResendOtp,
|
|
16
|
+
onEditIdentifier,
|
|
17
|
+
isLoading = false,
|
|
18
|
+
error,
|
|
19
|
+
destination,
|
|
20
|
+
resendCountdown = 0
|
|
21
|
+
} = form;
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "auth-modal-otp-step", className: "flex flex-col", children: [
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
AuthStepHeader,
|
|
25
|
+
{
|
|
26
|
+
title: labels.otpTitle,
|
|
27
|
+
subtitle: /* @__PURE__ */ jsxs("span", { className: "inline-flex flex-wrap items-center gap-1", children: [
|
|
28
|
+
labels.otpSentTo,
|
|
29
|
+
" ",
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
AuthDestination,
|
|
32
|
+
{
|
|
33
|
+
value: destination || identifier,
|
|
34
|
+
onEdit: onEditIdentifier,
|
|
35
|
+
disabled: isLoading
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] })
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsxs(AuthForm, { onSubmit: onOtpSubmit, className: "space-y-6", children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
OtpInput,
|
|
44
|
+
{
|
|
45
|
+
length: otpLength,
|
|
46
|
+
value: otp,
|
|
47
|
+
onChange: onOtpChange,
|
|
48
|
+
disabled: isLoading,
|
|
49
|
+
autoFocus: true,
|
|
50
|
+
autoComplete: "one-time-code",
|
|
51
|
+
"aria-label": labels.otpLabel,
|
|
52
|
+
error: error ?? void 0
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(AuthSubmitButton, { isLoading, disabled: otp.length !== otpLength, children: labels.otpSubmit }),
|
|
56
|
+
/* @__PURE__ */ jsx("div", { className: "text-center pt-1 text-body-3", children: resendCountdown > 0 ? /* @__PURE__ */ jsx("p", { className: "text-grey-600", "aria-live": "polite", children: labels.otpResendIn(resendCountdown) }) : onResendOtp && /* @__PURE__ */ jsx(AuthTextLink, { onClick: onResendOtp, disabled: isLoading, children: labels.otpResend }) })
|
|
57
|
+
] })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
AuthModalOtpForm.displayName = "AuthModalOtpForm";
|
|
61
|
+
|
|
62
|
+
export { AuthModalOtpForm };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** A <form> that never falls back to a native, page-reloading submit. */
|
|
3
|
+
export declare function AuthForm({ onSubmit, className, children, }: {
|
|
4
|
+
onSubmit?: (e: React.FormEvent) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
/** Step heading. `focusOnMount` moves focus here for steps without an input to focus. */
|
|
9
|
+
export declare function AuthStepHeader({ title, subtitle, focusOnMount, }: {
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
subtitle?: React.ReactNode;
|
|
12
|
+
focusOnMount?: boolean;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
export declare function AuthFieldError({ id, children }: {
|
|
15
|
+
id: string;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element | null;
|
|
18
|
+
export declare function AuthSubmitButton({ isLoading, disabled, children, }: {
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
export declare function AuthTextLink({ onClick, disabled, className, children, }: {
|
|
24
|
+
onClick?: () => void;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}): React.JSX.Element;
|
|
29
|
+
/** Masked destination with an optional "Edit" link back to the identifier step. */
|
|
30
|
+
export declare function AuthDestination({ value, onEdit, disabled, }: {
|
|
31
|
+
value: string;
|
|
32
|
+
onEdit?: () => void;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
type PasswordFieldProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'type'> & {
|
|
36
|
+
id: string;
|
|
37
|
+
label: string;
|
|
38
|
+
onValueChange?: (value: string) => void;
|
|
39
|
+
invalid?: boolean;
|
|
40
|
+
describedBy?: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function AuthPasswordField({ id, label, onValueChange, invalid, describedBy, className, ...inputProps }: PasswordFieldProps): React.JSX.Element;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=AuthModalParts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthModalParts.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/AuthModalParts.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE;IACD,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAaA;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,YAAoB,GACrB,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,qBAcA;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4BAO1F;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAmBA;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAWA;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,MAAM,EACN,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,qBAYA;AAED,KAAK,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG;IACjG,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,EAAE,EACF,KAAK,EACL,aAAa,EACb,OAAO,EACP,WAAW,EACX,SAAS,EACT,GAAG,UAAU,EACd,EAAE,kBAAkB,qBA+BpB"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from '@timmbr/utils';
|
|
5
|
+
import { EyeOff, Eye } from '@timmbr/icons';
|
|
6
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
7
|
+
import { authModalHeadingVariants, authModalSubtitleVariants, authModalSubmitButtonVariants, authModalLinkVariants, authModalInputVariants } from '../AuthModal.styles.js';
|
|
8
|
+
import { Spinner } from '../../Spinner/Spinner.js';
|
|
9
|
+
|
|
10
|
+
function AuthForm({
|
|
11
|
+
onSubmit,
|
|
12
|
+
className,
|
|
13
|
+
children
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"form",
|
|
17
|
+
{
|
|
18
|
+
noValidate: true,
|
|
19
|
+
className,
|
|
20
|
+
onSubmit: (e) => {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
onSubmit?.(e);
|
|
23
|
+
},
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function AuthStepHeader({
|
|
29
|
+
title,
|
|
30
|
+
subtitle,
|
|
31
|
+
focusOnMount = false
|
|
32
|
+
}) {
|
|
33
|
+
const ref = React.useRef(null);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (focusOnMount) ref.current?.focus();
|
|
36
|
+
}, [focusOnMount]);
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("h2", { ref, tabIndex: -1, className: authModalHeadingVariants(), children: title }),
|
|
39
|
+
subtitle && /* @__PURE__ */ jsx("div", { className: authModalSubtitleVariants(), children: subtitle })
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
function AuthFieldError({ id, children }) {
|
|
43
|
+
if (!children) return null;
|
|
44
|
+
return /* @__PURE__ */ jsx("p", { id, role: "alert", "data-slot": "auth-modal-error", className: "mt-2 text-body-3 text-destructive font-medium", children });
|
|
45
|
+
}
|
|
46
|
+
function AuthSubmitButton({
|
|
47
|
+
isLoading,
|
|
48
|
+
disabled,
|
|
49
|
+
children
|
|
50
|
+
}) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
type: "submit",
|
|
55
|
+
disabled: disabled || isLoading,
|
|
56
|
+
"aria-busy": isLoading || void 0,
|
|
57
|
+
className: authModalSubmitButtonVariants(),
|
|
58
|
+
children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Spinner, { size: "sm", variant: "white", decorative: true }),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children })
|
|
61
|
+
] }) : children
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function AuthTextLink({
|
|
66
|
+
onClick,
|
|
67
|
+
disabled,
|
|
68
|
+
className,
|
|
69
|
+
children
|
|
70
|
+
}) {
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
type: "button",
|
|
75
|
+
onClick,
|
|
76
|
+
disabled,
|
|
77
|
+
className: cn(authModalLinkVariants(), className),
|
|
78
|
+
children
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function AuthDestination({
|
|
83
|
+
value,
|
|
84
|
+
onEdit,
|
|
85
|
+
disabled
|
|
86
|
+
}) {
|
|
87
|
+
const labels = useAuthModalLabels();
|
|
88
|
+
return /* @__PURE__ */ jsxs("span", { className: "inline-flex flex-wrap items-center gap-2", children: [
|
|
89
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-grey-950 break-all", children: value }),
|
|
90
|
+
onEdit && /* @__PURE__ */ jsx(AuthTextLink, { onClick: onEdit, disabled, className: "text-body-3", children: labels.edit })
|
|
91
|
+
] });
|
|
92
|
+
}
|
|
93
|
+
function AuthPasswordField({
|
|
94
|
+
id,
|
|
95
|
+
label,
|
|
96
|
+
onValueChange,
|
|
97
|
+
invalid,
|
|
98
|
+
describedBy,
|
|
99
|
+
className,
|
|
100
|
+
...inputProps
|
|
101
|
+
}) {
|
|
102
|
+
const labels = useAuthModalLabels();
|
|
103
|
+
const [visible, setVisible] = React.useState(false);
|
|
104
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
105
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "sr-only", children: label }),
|
|
106
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"input",
|
|
109
|
+
{
|
|
110
|
+
id,
|
|
111
|
+
type: visible ? "text" : "password",
|
|
112
|
+
onChange: (e) => onValueChange?.(e.target.value),
|
|
113
|
+
"aria-invalid": invalid || void 0,
|
|
114
|
+
"aria-describedby": describedBy,
|
|
115
|
+
className: cn(authModalInputVariants({ invalid: !!invalid }), "pr-12"),
|
|
116
|
+
...inputProps
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
type: "button",
|
|
123
|
+
onClick: () => setVisible((v) => !v),
|
|
124
|
+
"aria-label": visible ? labels.hidePassword : labels.showPassword,
|
|
125
|
+
"aria-pressed": visible,
|
|
126
|
+
className: "absolute inset-y-0 right-0 flex w-12 items-center justify-center text-grey-600 hover:text-grey-950 focus:outline-none focus-visible:text-primary cursor-pointer",
|
|
127
|
+
children: visible ? /* @__PURE__ */ jsx(EyeOff, { className: "size-5", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Eye, { className: "size-5", "aria-hidden": "true" })
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] })
|
|
131
|
+
] });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { AuthDestination, AuthFieldError, AuthForm, AuthPasswordField, AuthStepHeader, AuthSubmitButton, AuthTextLink };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AuthModalFormProps } from '../AuthModal.types';
|
|
3
|
+
export interface AuthModalPasswordFormProps {
|
|
4
|
+
form: AuthModalFormProps;
|
|
5
|
+
}
|
|
6
|
+
export declare function AuthModalPasswordForm({ form }: AuthModalPasswordFormProps): React.JSX.Element;
|
|
7
|
+
export declare namespace AuthModalPasswordForm {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AuthModalPasswordForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthModalPasswordForm.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/AuthModalPasswordForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAW7D,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAID,wBAAgB,qBAAqB,CAAC,EAAE,IAAI,EAAE,EAAE,0BAA0B,qBAsDzE;yBAtDe,qBAAqB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
4
|
+
import { AuthStepHeader, AuthDestination, AuthForm, AuthPasswordField, AuthFieldError, AuthSubmitButton, AuthTextLink } from './AuthModalParts.js';
|
|
5
|
+
|
|
6
|
+
const ERROR_ID = "auth-password-error";
|
|
7
|
+
function AuthModalPasswordForm({ form }) {
|
|
8
|
+
const labels = useAuthModalLabels();
|
|
9
|
+
const {
|
|
10
|
+
identifier = "",
|
|
11
|
+
password = "",
|
|
12
|
+
onPasswordChange,
|
|
13
|
+
onPasswordSubmit,
|
|
14
|
+
onForgotPassword,
|
|
15
|
+
onEditIdentifier,
|
|
16
|
+
isLoading = false,
|
|
17
|
+
error
|
|
18
|
+
} = form;
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "auth-modal-password-step", className: "flex flex-col", children: [
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
AuthStepHeader,
|
|
22
|
+
{
|
|
23
|
+
title: labels.passwordTitle,
|
|
24
|
+
subtitle: /* @__PURE__ */ jsx(AuthDestination, { value: identifier, onEdit: onEditIdentifier, disabled: isLoading })
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsxs(AuthForm, { onSubmit: onPasswordSubmit, className: "space-y-4", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name: "username", autoComplete: "username", value: identifier, readOnly: true }),
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
AuthPasswordField,
|
|
32
|
+
{
|
|
33
|
+
id: "auth-password-input",
|
|
34
|
+
label: labels.passwordLabel,
|
|
35
|
+
placeholder: labels.passwordPlaceholder,
|
|
36
|
+
autoComplete: "current-password",
|
|
37
|
+
value: password,
|
|
38
|
+
onValueChange: onPasswordChange,
|
|
39
|
+
disabled: isLoading,
|
|
40
|
+
autoFocus: true,
|
|
41
|
+
invalid: !!error,
|
|
42
|
+
describedBy: error ? ERROR_ID : void 0
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ jsx(AuthFieldError, { id: ERROR_ID, children: error })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsx(AuthSubmitButton, { isLoading, disabled: !password, children: labels.passwordSubmit }),
|
|
48
|
+
onForgotPassword && /* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx(AuthTextLink, { onClick: onForgotPassword, disabled: isLoading, className: "text-body-2", children: labels.forgotPassword }) })
|
|
49
|
+
] })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
AuthModalPasswordForm.displayName = "AuthModalPasswordForm";
|
|
53
|
+
|
|
54
|
+
export { AuthModalPasswordForm };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AuthModalFormProps } from '../AuthModal.types';
|
|
3
|
+
export interface AuthModalSetPasswordFormProps {
|
|
4
|
+
form: AuthModalFormProps;
|
|
5
|
+
}
|
|
6
|
+
export declare function AuthModalSetPasswordForm({ form }: AuthModalSetPasswordFormProps): React.JSX.Element;
|
|
7
|
+
export declare namespace AuthModalSetPasswordForm {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AuthModalSetPasswordForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthModalSetPasswordForm.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/AuthModalSetPasswordForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAU7D,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAKD,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,EAAE,6BAA6B,qBA0E/E;yBA1Ee,wBAAwB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
4
|
+
import { AuthStepHeader, AuthForm, AuthPasswordField, AuthFieldError, AuthSubmitButton, AuthTextLink } from './AuthModalParts.js';
|
|
5
|
+
|
|
6
|
+
const HINT_ID = "auth-new-password-hint";
|
|
7
|
+
const ERROR_ID = "auth-set-password-error";
|
|
8
|
+
function AuthModalSetPasswordForm({ form }) {
|
|
9
|
+
const labels = useAuthModalLabels();
|
|
10
|
+
const {
|
|
11
|
+
setPasswordMode = "create",
|
|
12
|
+
newPassword = "",
|
|
13
|
+
onNewPasswordChange,
|
|
14
|
+
confirmPassword = "",
|
|
15
|
+
onConfirmPasswordChange,
|
|
16
|
+
onSetPasswordSubmit,
|
|
17
|
+
onSkipSetPassword,
|
|
18
|
+
isLoading = false,
|
|
19
|
+
error
|
|
20
|
+
} = form;
|
|
21
|
+
const isReset = setPasswordMode === "reset";
|
|
22
|
+
const mismatch = confirmPassword.length > 0 && confirmPassword !== newPassword;
|
|
23
|
+
const shownError = error ?? (mismatch ? labels.passwordMismatch : null);
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "auth-modal-set-password-step", className: "flex flex-col", children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
AuthStepHeader,
|
|
27
|
+
{
|
|
28
|
+
title: isReset ? labels.setPasswordResetTitle : labels.setPasswordCreateTitle,
|
|
29
|
+
subtitle: isReset ? labels.setPasswordResetSubtitle : labels.setPasswordCreateSubtitle
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ jsxs(AuthForm, { onSubmit: onSetPasswordSubmit, className: "space-y-4", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
AuthPasswordField,
|
|
35
|
+
{
|
|
36
|
+
id: "auth-new-password-input",
|
|
37
|
+
label: labels.newPasswordLabel,
|
|
38
|
+
placeholder: labels.newPasswordLabel,
|
|
39
|
+
autoComplete: "new-password",
|
|
40
|
+
value: newPassword,
|
|
41
|
+
onValueChange: onNewPasswordChange,
|
|
42
|
+
disabled: isLoading,
|
|
43
|
+
autoFocus: true,
|
|
44
|
+
describedBy: HINT_ID
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
AuthPasswordField,
|
|
50
|
+
{
|
|
51
|
+
id: "auth-confirm-password-input",
|
|
52
|
+
label: labels.confirmPasswordLabel,
|
|
53
|
+
placeholder: labels.confirmPasswordLabel,
|
|
54
|
+
autoComplete: "new-password",
|
|
55
|
+
value: confirmPassword,
|
|
56
|
+
onValueChange: onConfirmPasswordChange,
|
|
57
|
+
disabled: isLoading,
|
|
58
|
+
invalid: !!shownError,
|
|
59
|
+
describedBy: shownError ? ERROR_ID : void 0
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx(AuthFieldError, { id: ERROR_ID, children: shownError })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsx("p", { id: HINT_ID, className: "text-body-3 text-grey-600", children: labels.passwordHint }),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
AuthSubmitButton,
|
|
67
|
+
{
|
|
68
|
+
isLoading,
|
|
69
|
+
disabled: !newPassword || newPassword !== confirmPassword,
|
|
70
|
+
children: labels.setPasswordSubmit
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
!isReset && onSkipSetPassword && /* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx(AuthTextLink, { onClick: onSkipSetPassword, disabled: isLoading, className: "text-body-2", children: labels.skipForNow }) })
|
|
74
|
+
] })
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
AuthModalSetPasswordForm.displayName = "AuthModalSetPasswordForm";
|
|
78
|
+
|
|
79
|
+
export { AuthModalSetPasswordForm };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AuthModalFormProps } from '../AuthModal.types';
|
|
3
|
+
export interface AuthModalSuccessProps {
|
|
4
|
+
form: AuthModalFormProps;
|
|
5
|
+
}
|
|
6
|
+
export declare function AuthModalSuccess({ form }: AuthModalSuccessProps): React.JSX.Element;
|
|
7
|
+
export declare namespace AuthModalSuccess {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AuthModalSuccess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthModalSuccess.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/AuthModalSuccess.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,EAAE,qBAAqB,qBAkB/D;yBAlBe,gBAAgB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { CheckCircle } from '@timmbr/icons';
|
|
4
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
5
|
+
import { AuthStepHeader } from './AuthModalParts.js';
|
|
6
|
+
|
|
7
|
+
function AuthModalSuccess({ form }) {
|
|
8
|
+
const labels = useAuthModalLabels();
|
|
9
|
+
const { successTitle = labels.successTitle, successMessage } = form;
|
|
10
|
+
return /* @__PURE__ */ jsxs(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "auth-modal-success-step",
|
|
14
|
+
role: "status",
|
|
15
|
+
"aria-live": "polite",
|
|
16
|
+
className: "flex flex-col items-center justify-center text-center gap-4 py-10 min-h-[320px]",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-16 items-center justify-center rounded-full bg-primary/10 text-primary", children: /* @__PURE__ */ jsx(CheckCircle, { className: "size-9", "aria-hidden": "true" }) }),
|
|
19
|
+
/* @__PURE__ */ jsx(AuthStepHeader, { title: successTitle, subtitle: successMessage, focusOnMount: true })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
AuthModalSuccess.displayName = "AuthModalSuccess";
|
|
25
|
+
|
|
26
|
+
export { AuthModalSuccess };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AuthOAuthProvider } from '../AuthModal.types';
|
|
3
|
+
export interface OAuthButtonProps {
|
|
4
|
+
provider: AuthOAuthProvider;
|
|
5
|
+
/** Disable while another sign-in request is in flight */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function OAuthButton({ provider, disabled }: OAuthButtonProps): React.JSX.Element;
|
|
9
|
+
export declare namespace OAuthButton {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=OAuthButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuthButton.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/OAuthButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAe5D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,gBAAgB,qBAoBnE;yBApBe,WAAW"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { GitHubIcon, AppleIcon, GoogleIcon } from '@timmbr/icons';
|
|
4
|
+
import { useAuthModalLabels } from '../AuthModal.labels.js';
|
|
5
|
+
import { authModalSecondaryButtonVariants } from '../AuthModal.styles.js';
|
|
6
|
+
import { Spinner } from '../../Spinner/Spinner.js';
|
|
7
|
+
|
|
8
|
+
const PROVIDER_ICONS = {
|
|
9
|
+
google: GoogleIcon,
|
|
10
|
+
apple: AppleIcon,
|
|
11
|
+
github: GitHubIcon
|
|
12
|
+
};
|
|
13
|
+
function ProviderIcon({ provider }) {
|
|
14
|
+
if (provider.icon) return /* @__PURE__ */ jsx(Fragment, { children: provider.icon });
|
|
15
|
+
const BuiltIn = PROVIDER_ICONS[provider.id.toLowerCase()];
|
|
16
|
+
return BuiltIn ? /* @__PURE__ */ jsx(BuiltIn, { className: "size-5 shrink-0" }) : null;
|
|
17
|
+
}
|
|
18
|
+
function OAuthButton({ provider, disabled }) {
|
|
19
|
+
const labels = useAuthModalLabels();
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
"button",
|
|
22
|
+
{
|
|
23
|
+
type: "button",
|
|
24
|
+
onClick: provider.onClick,
|
|
25
|
+
disabled: disabled || provider.disabled || provider.isLoading,
|
|
26
|
+
"aria-busy": provider.isLoading || void 0,
|
|
27
|
+
"data-slot": `oauth-button-${provider.id}`,
|
|
28
|
+
className: authModalSecondaryButtonVariants(),
|
|
29
|
+
children: [
|
|
30
|
+
provider.isLoading ? /* @__PURE__ */ jsx(Spinner, { size: "sm", variant: "primary", decorative: true }) : /* @__PURE__ */ jsx(ProviderIcon, { provider }),
|
|
31
|
+
/* @__PURE__ */ jsx("span", { children: labels.oauthContinueWith(provider.name) })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
OAuthButton.displayName = "OAuthButton";
|
|
37
|
+
|
|
38
|
+
export { OAuthButton };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './OAuthButton';
|
|
2
|
+
export * from './AuthModalBanner';
|
|
3
|
+
export * from './AuthModalIdentifierForm';
|
|
4
|
+
export * from './AuthModalOtpForm';
|
|
5
|
+
export * from './AuthModalPasswordForm';
|
|
6
|
+
export * from './AuthModalSetPasswordForm';
|
|
7
|
+
export * from './AuthModalOAuth';
|
|
8
|
+
export * from './AuthModalSuccess';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthModal/subcomponents/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|