@hanwenbo/x-taro-ui 0.0.1 → 0.0.2

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.
Files changed (55) hide show
  1. package/es/adapters/miniapp/overlayHost.js +14 -8
  2. package/es/auth/components.d.ts +17 -15
  3. package/es/auth/components.js +253 -133
  4. package/es/auth/entries/locales.d.ts +2 -0
  5. package/es/auth/entries/locales.js +1 -0
  6. package/es/auth/index.d.ts +1 -0
  7. package/es/auth/index.js +2 -1
  8. package/es/auth/internal.d.ts +17 -11
  9. package/es/auth/internal.js +107 -42
  10. package/es/auth/phoneNumberInput.d.ts +4 -2
  11. package/es/auth/phoneNumberInput.js +27 -8
  12. package/es/auth/provider.d.ts +2 -2
  13. package/es/auth/styles.css +161 -99
  14. package/es/auth/theme.js +20 -4
  15. package/es/components/_shared/render.d.ts +1 -1
  16. package/es/components/button/button.js +23 -3
  17. package/es/components/button/types.d.ts +6 -0
  18. package/es/components/capsuleTabs/capsuleTabs.js +4 -0
  19. package/es/components/icon/lucide.generated.d.ts +10 -0
  20. package/es/components/icon/lucide.generated.js +10 -0
  21. package/es/components/inputItem/inputItem.js +5 -2
  22. package/es/components/list/list.d.ts +1 -1
  23. package/es/components/pagination/pagination.js +18 -5
  24. package/es/components/sectionList/sectionList.d.ts +1 -2
  25. package/es/components/segmented/segmented.js +10 -2
  26. package/es/components/touchableOpacity/touchableOpacity.js +1 -0
  27. package/es/taro-components.d.ts +6 -0
  28. package/lib/adapters/miniapp/overlayHost.js +13 -6
  29. package/lib/auth/components.d.ts +17 -15
  30. package/lib/auth/components.js +257 -125
  31. package/lib/auth/entries/locales.d.ts +2 -0
  32. package/lib/auth/entries/locales.js +33 -0
  33. package/lib/auth/index.d.ts +1 -0
  34. package/lib/auth/index.js +13 -0
  35. package/lib/auth/internal.d.ts +17 -11
  36. package/lib/auth/internal.js +76 -31
  37. package/lib/auth/phoneNumberInput.d.ts +4 -2
  38. package/lib/auth/phoneNumberInput.js +65 -45
  39. package/lib/auth/provider.d.ts +2 -2
  40. package/lib/auth/styles.css +161 -99
  41. package/lib/auth/theme.js +7 -4
  42. package/lib/components/_shared/render.d.ts +1 -1
  43. package/lib/components/button/button.js +7 -0
  44. package/lib/components/button/types.d.ts +6 -0
  45. package/lib/components/capsuleTabs/capsuleTabs.js +1 -0
  46. package/lib/components/icon/lucide.generated.d.ts +10 -0
  47. package/lib/components/icon/lucide.generated.js +24 -0
  48. package/lib/components/inputItem/inputItem.js +3 -0
  49. package/lib/components/list/list.d.ts +1 -1
  50. package/lib/components/pagination/pagination.js +19 -5
  51. package/lib/components/sectionList/sectionList.d.ts +1 -2
  52. package/lib/components/segmented/segmented.js +6 -1
  53. package/lib/components/touchableOpacity/touchableOpacity.js +1 -0
  54. package/lib/taro-components.d.ts +6 -0
  55. package/package.json +4 -4
@@ -58,15 +58,21 @@ export var OverlayHost = function OverlayHost(_ref) {
58
58
  mounted = _useOverlayTransition.mounted,
59
59
  settled = _useOverlayTransition.settled;
60
60
  var previousVisibleRef = useRef(visible);
61
+ var afterCloseRef = useRef(afterClose);
61
62
  useEffect(function () {
62
- var wasVisible = previousVisibleRef.current;
63
- previousVisibleRef.current = visible;
64
- if (!wasVisible || visible || !afterClose) return undefined;
65
- var timer = setTimeout(afterClose, exitDuration);
66
- return function () {
67
- return clearTimeout(timer);
68
- };
69
- }, [afterClose, exitDuration, visible]);
63
+ afterCloseRef.current = afterClose;
64
+ }, [afterClose]);
65
+ useEffect(function () {
66
+ var _afterCloseRef$curren;
67
+ if (visible) {
68
+ previousVisibleRef.current = true;
69
+ return;
70
+ }
71
+ // The transition owns completion; changing callbacks must not cancel it.
72
+ if (shouldRender || !previousVisibleRef.current) return;
73
+ previousVisibleRef.current = false;
74
+ (_afterCloseRef$curren = afterCloseRef.current) === null || _afterCloseRef$curren === void 0 || _afterCloseRef$curren.call(afterCloseRef);
75
+ }, [shouldRender, visible]);
70
76
  useEffect(function () {
71
77
  var runtimeDocument = globalThis['document'];
72
78
  if (!visible || !disableBodyScroll || !(runtimeDocument !== null && runtimeDocument !== void 0 && runtimeDocument.body)) return undefined;
@@ -1,7 +1,7 @@
1
- import React, { type ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  import type { AccountSecurityState, AuthSession, ContactIdentifierType, SignInContextField, SignInMethod, ThirdPartyAuthProvider, ThirdPartySignInHandler, ThirdPartySignInResult } from '@hanwenbo/x-auth-core/types';
3
3
  import { type ModalProps } from '../components/modal';
4
- import { type AuthSurface } from './internal';
4
+ import { type AuthSurface, type AuthHeaderAlign } from './internal';
5
5
  import type { AuthComponentProps } from './types';
6
6
  import './styles.css';
7
7
  export interface ThirdPartySignInProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
@@ -10,8 +10,9 @@ export interface ThirdPartySignInProps<Session extends AuthSession = AuthSession
10
10
  onSuccess?: (session: Session) => void;
11
11
  providers?: ThirdPartyAuthProvider[];
12
12
  }
13
- export declare function ThirdPartySignIn<Session extends AuthSession = AuthSession>({ className, config, onAuthError, onProviderSignIn, onReauthenticationRequired, onResult, onSuccess, providers, services, style, testID, tokens }: ThirdPartySignInProps<Session>): React.JSX.Element | null;
13
+ export declare function ThirdPartySignIn<Session extends AuthSession = AuthSession>({ className, config, onAuthError, onProviderSignIn, onReauthenticationRequired, onResult, onSuccess, providers, services, style, testID, tokens }: ThirdPartySignInProps<Session>): import("react/jsx-runtime").JSX.Element | null;
14
14
  export interface SignInProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
15
+ headerAlign?: AuthHeaderAlign;
15
16
  contextFields?: SignInContextFieldProps[];
16
17
  defaultMethod?: SignInMethod;
17
18
  description?: ReactNode;
@@ -33,7 +34,7 @@ export interface SignInProps<Session extends AuthSession = AuthSession> extends
33
34
  export interface SignInContextFieldProps extends SignInContextField {
34
35
  prefix?: ReactNode;
35
36
  }
36
- export declare function SignIn<Session extends AuthSession = AuthSession>({ className, config, contextFields, defaultMethod, description, logo, methods, onAuthError, onForgotPassword, onMethodChange, onProviderResult, onProviderSignIn, onReauthenticationRequired, onSignUp, onSuccess, providers, services, showFieldLabels, showRemember, style, surface, testID, title, tokens }: SignInProps<Session>): React.JSX.Element;
37
+ export declare function SignIn<Session extends AuthSession = AuthSession>({ className, config, contextFields, defaultMethod, description, headerAlign, logo, methods, onAuthError, onForgotPassword, onMethodChange, onProviderResult, onProviderSignIn, onReauthenticationRequired, onSignUp, onSuccess, providers, services, showFieldLabels, showRemember, style, surface, testID, title, tokens }: SignInProps<Session>): import("react/jsx-runtime").JSX.Element;
37
38
  export interface SignUpProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
38
39
  defaultIdentifier?: ContactIdentifierType;
39
40
  description?: ReactNode;
@@ -44,8 +45,9 @@ export interface SignUpProps<Session extends AuthSession = AuthSession> extends
44
45
  surface?: AuthSurface;
45
46
  title?: ReactNode;
46
47
  }
47
- export declare function SignUp<Session extends AuthSession = AuthSession>({ className, config, defaultIdentifier, description, identifiers, logo, onAuthError, onReauthenticationRequired, onSignIn, onSuccess, services, style, surface, testID, title, tokens }: SignUpProps<Session>): React.JSX.Element;
48
+ export declare function SignUp<Session extends AuthSession = AuthSession>({ className, config, defaultIdentifier, description, identifiers, logo, onAuthError, onReauthenticationRequired, onSignIn, onSuccess, services, style, surface, testID, title, tokens }: SignUpProps<Session>): import("react/jsx-runtime").JSX.Element;
48
49
  export interface ForgotPasswordProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
50
+ description?: ReactNode;
49
51
  defaultIdentifier?: ContactIdentifierType;
50
52
  identifiers?: ContactIdentifierType[];
51
53
  onBackToSignIn?: () => void;
@@ -53,7 +55,7 @@ export interface ForgotPasswordProps<Session extends AuthSession = AuthSession>
53
55
  surface?: AuthSurface;
54
56
  title?: ReactNode;
55
57
  }
56
- export declare function ForgotPassword<Session extends AuthSession = AuthSession>({ className, config, defaultIdentifier, identifiers, onAuthError, onBackToSignIn, onReauthenticationRequired, onSuccess, services, style, surface, testID, title, tokens }: ForgotPasswordProps<Session>): React.JSX.Element;
58
+ export declare function ForgotPassword<Session extends AuthSession = AuthSession>({ className, config, description, defaultIdentifier, identifiers, onAuthError, onBackToSignIn, onReauthenticationRequired, onSuccess, services, style, surface, testID, title, tokens }: ForgotPasswordProps<Session>): import("react/jsx-runtime").JSX.Element;
57
59
  export interface QuickSignInProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
58
60
  autoContinuePhone?: boolean;
59
61
  autoSubmitCode?: boolean;
@@ -70,7 +72,7 @@ export interface QuickSignInProps<Session extends AuthSession = AuthSession> ext
70
72
  surface?: AuthSurface;
71
73
  title?: ReactNode;
72
74
  }
73
- export declare function QuickSignIn<Session extends AuthSession = AuthSession>({ autoSubmitCode, className, config, description, footer, identifierSubmitText, identifierType, initialIdentifier, onAuthError, onClose, onReauthenticationRequired, onStepChange, onSuccess, services, showHeader, style, submitText, surface, testID, title, tokens }: QuickSignInProps<Session>): React.JSX.Element;
75
+ export declare function QuickSignIn<Session extends AuthSession = AuthSession>({ autoSubmitCode, className, config, description, footer, identifierSubmitText, identifierType, initialIdentifier, onAuthError, onClose, onReauthenticationRequired, onStepChange, onSuccess, services, showHeader, style, submitText, surface, testID, title, tokens }: QuickSignInProps<Session>): import("react/jsx-runtime").JSX.Element;
74
76
  export interface QuickSignInDialogProps<Session extends AuthSession = AuthSession> extends Omit<QuickSignInProps<Session>, 'onClose' | 'showHeader' | 'surface'> {
75
77
  closeOnSuccess?: boolean;
76
78
  modalProps?: Omit<ModalProps, 'afterClose' | 'body' | 'onClose' | 'visible'> & {
@@ -79,7 +81,7 @@ export interface QuickSignInDialogProps<Session extends AuthSession = AuthSessio
79
81
  onClose: () => void;
80
82
  visible: boolean;
81
83
  }
82
- export declare function QuickSignInDialog<Session extends AuthSession = AuthSession>({ closeOnSuccess, modalProps, onClose, onSuccess, visible, ...props }: QuickSignInDialogProps<Session>): React.JSX.Element;
84
+ export declare function QuickSignInDialog<Session extends AuthSession = AuthSession>({ closeOnSuccess, modalProps, onClose, onSuccess, visible, ...props }: QuickSignInDialogProps<Session>): import("react/jsx-runtime").JSX.Element;
83
85
  export declare type IdentifierBindingAction = 'bind' | 'change';
84
86
  export interface IdentifierBindingProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
85
87
  action?: IdentifierBindingAction;
@@ -91,7 +93,7 @@ export interface IdentifierBindingProps<Session extends AuthSession = AuthSessio
91
93
  surface?: AuthSurface;
92
94
  title?: ReactNode;
93
95
  }
94
- export declare function IdentifierBinding<Session extends AuthSession = AuthSession>({ action, className, config, currentDisplayValue, identifierType, onAuthError, onCancel, onReauthenticationRequired, onSuccess, requireReauthentication, services, style, surface, testID, title, tokens }: IdentifierBindingProps<Session>): React.JSX.Element;
96
+ export declare function IdentifierBinding<Session extends AuthSession = AuthSession>({ action, className, config, currentDisplayValue, identifierType, onAuthError, onCancel, onReauthenticationRequired, onSuccess, requireReauthentication, services, style, surface, testID, title, tokens }: IdentifierBindingProps<Session>): import("react/jsx-runtime").JSX.Element;
95
97
  export interface ChangePasswordProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
96
98
  description?: ReactNode;
97
99
  onCancel?: () => void;
@@ -100,18 +102,18 @@ export interface ChangePasswordProps<Session extends AuthSession = AuthSession>
100
102
  surface?: AuthSurface;
101
103
  title?: ReactNode;
102
104
  }
103
- export declare function ChangePassword<Session extends AuthSession = AuthSession>({ className, config, description, onAuthError, onCancel, onReauthenticationRequired, onSuccess, requireCurrentPassword, services, style, surface, testID, title, tokens }: ChangePasswordProps<Session>): React.JSX.Element;
105
+ export declare function ChangePassword<Session extends AuthSession = AuthSession>({ className, config, description, onAuthError, onCancel, onReauthenticationRequired, onSuccess, requireCurrentPassword, services, style, surface, testID, title, tokens }: ChangePasswordProps<Session>): import("react/jsx-runtime").JSX.Element;
104
106
  export interface AccountSecurityProps<Session extends AuthSession = AuthSession> extends AuthComponentProps<Session> {
105
107
  description?: ReactNode;
106
108
  onStateChange?: (state: AccountSecurityState) => void;
107
109
  state?: AccountSecurityState;
108
110
  title?: ReactNode;
109
111
  }
110
- export declare function AccountSecurity<Session extends AuthSession = AuthSession>({ className, config, description, onAuthError, onReauthenticationRequired, onStateChange, services, state, style, testID, title, tokens }: AccountSecurityProps<Session>): React.JSX.Element;
112
+ export declare function AccountSecurity<Session extends AuthSession = AuthSession>({ className, config, description, onAuthError, onReauthenticationRequired, onStateChange, services, state, style, testID, title, tokens }: AccountSecurityProps<Session>): import("react/jsx-runtime").JSX.Element;
111
113
  declare type IdentifierShortcutProps<Session extends AuthSession> = Omit<IdentifierBindingProps<Session>, 'action' | 'identifierType'>;
112
- export declare function BindPhone<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): React.JSX.Element;
113
- export declare function BindEmail<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): React.JSX.Element;
114
- export declare function ChangePhone<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): React.JSX.Element;
115
- export declare function ChangeEmail<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): React.JSX.Element;
114
+ export declare function BindPhone<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): import("react/jsx-runtime").JSX.Element;
115
+ export declare function BindEmail<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): import("react/jsx-runtime").JSX.Element;
116
+ export declare function ChangePhone<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): import("react/jsx-runtime").JSX.Element;
117
+ export declare function ChangeEmail<Session extends AuthSession = AuthSession>(props: IdentifierShortcutProps<Session>): import("react/jsx-runtime").JSX.Element;
116
118
  export {};
117
119
  //# sourceMappingURL=components.d.ts.map