@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
@@ -162,16 +162,21 @@ var Pagination = function Pagination(_ref3) {
162
162
  return /*#__PURE__*/_jsx(View, {
163
163
  "data-slot": "pagination-total",
164
164
  style: {
165
- flexShrink: 0,
165
+ flexShrink: 1,
166
+ minWidth: 0,
167
+ maxWidth: '100%',
166
168
  display: 'flex',
167
169
  alignItems: 'center',
168
- height: sizeTokens.buttonSize
170
+ minHeight: sizeTokens.buttonSize
169
171
  },
170
172
  children: /*#__PURE__*/_jsx(Text, {
171
173
  style: {
174
+ maxWidth: '100%',
172
175
  fontSize: sizeTokens.fontSize,
173
- lineHeight: "".concat(sizeTokens.buttonSize, "px"),
174
- color: palette.summary
176
+ lineHeight: "".concat(sizeTokens.textLineHeight, "px"),
177
+ color: palette.summary,
178
+ whiteSpace: 'normal',
179
+ overflowWrap: 'anywhere'
175
180
  },
176
181
  children: content
177
182
  })
@@ -219,9 +224,13 @@ var Pagination = function Pagination(_ref3) {
219
224
  onPress: function onPress() {
220
225
  return changePage(pageNumber);
221
226
  },
222
- style: getButtonStyle({
227
+ style: _objectSpread(_objectSpread({}, getButtonStyle({
223
228
  active: isActive,
224
229
  disabledState: disabled
230
+ })), {}, {
231
+ width: 'auto',
232
+ paddingLeft: sizeTokens.ellipsisPaddingX,
233
+ paddingRight: sizeTokens.ellipsisPaddingX
225
234
  }),
226
235
  children: /*#__PURE__*/_jsx(Text, {
227
236
  style: getPageTextStyle(isActive),
@@ -385,6 +394,9 @@ var Pagination = function Pagination(_ref3) {
385
394
  flexDirection: 'row',
386
395
  flexWrap: 'wrap',
387
396
  alignItems: 'center',
397
+ minWidth: 0,
398
+ maxWidth: '100%',
399
+ boxSizing: 'border-box',
388
400
  gap: sizeTokens.gap
389
401
  }, style),
390
402
  children: [renderTotal(), /*#__PURE__*/_jsx(View, {
@@ -396,6 +408,7 @@ var Pagination = function Pagination(_ref3) {
396
408
  flexWrap: 'wrap',
397
409
  alignItems: 'center',
398
410
  gap: groupGap,
411
+ minWidth: 0,
399
412
  maxWidth: '100%',
400
413
  overflowX: 'visible'
401
414
  },
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
1
  import type { SectionListProps } from './types';
3
- declare function SectionList<T>({ sections, renderItem, renderSectionHeader, renderSectionFooter, keyExtractor, sectionKeyExtractor, stickySectionHeadersEnabled, extraData, initialNumToRender, inverted, ItemSeparatorComponent, SectionSeparatorComponent, ListEmptyComponent, ListHeaderComponent, ListFooterComponent, testID, activeSectionKey, defaultActiveSectionKey, collapsedSectionKeys, defaultCollapsedSectionKeys, size, variant, collapsible, accordion, divider, emptyText, onSectionChange, onCollapsedSectionKeysChange, children, className, style }: SectionListProps<T>): React.JSX.Element;
2
+ declare function SectionList<T>({ sections, renderItem, renderSectionHeader, renderSectionFooter, keyExtractor, sectionKeyExtractor, stickySectionHeadersEnabled, extraData, initialNumToRender, inverted, ItemSeparatorComponent, SectionSeparatorComponent, ListEmptyComponent, ListHeaderComponent, ListFooterComponent, testID, activeSectionKey, defaultActiveSectionKey, collapsedSectionKeys, defaultCollapsedSectionKeys, size, variant, collapsible, accordion, divider, emptyText, onSectionChange, onCollapsedSectionKeysChange, children, className, style }: SectionListProps<T>): import("react/jsx-runtime").JSX.Element;
4
3
  declare namespace SectionList {
5
4
  var displayName: string;
6
5
  }
@@ -10,9 +10,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
- import React, { useMemo, useState } from 'react';
13
+ import React, { useEffect, useMemo, useState } from 'react';
14
14
  import { Text, View } from '@tarojs/components';
15
15
  import { usePressable } from "../../patterns";
16
+ import { subscribeViewportChange } from "../../adapters/miniapp/measure";
16
17
  import { segmentedSizeMetrics, useTheme } from "../../theme";
17
18
  import { classNames } from "../../utils";
18
19
  import { centeredInlineContent, centeredInlineSlot } from "../../utils/inlineAlignment";
@@ -211,7 +212,14 @@ var Segmented = function Segmented(_ref2) {
211
212
  itemId = _useTaroSelectionIndi.itemId,
212
213
  indicatorStyle = _useTaroSelectionIndi.indicatorStyle,
213
214
  indicatorReady = _useTaroSelectionIndi.indicatorReady,
214
- indicatorMotionReady = _useTaroSelectionIndi.indicatorMotionReady;
215
+ indicatorMotionReady = _useTaroSelectionIndi.indicatorMotionReady,
216
+ remeasure = _useTaroSelectionIndi.remeasure;
217
+ useEffect(function () {
218
+ if (!motion) return;
219
+ return subscribeViewportChange(function () {
220
+ return void remeasure();
221
+ });
222
+ }, [motion, remeasure]);
215
223
  var activeTextColor = variant === 'filled' ? theme.colors['primary-foreground'] : theme.colors.foreground;
216
224
  var handleSelect = function handleSelect(option) {
217
225
  if (disabled || option.disabled || option.value === currentValue) return;
@@ -134,6 +134,7 @@ var TouchableOpacity = function TouchableOpacity(_ref) {
134
134
  "data-pressed": pressed ? 'true' : undefined,
135
135
  "data-testid": testID,
136
136
  style: _objectSpread({
137
+ boxSizing: 'border-box',
137
138
  width: block ? '100%' : undefined,
138
139
  cursor: disabled ? 'not-allowed' : 'pointer',
139
140
  userSelect: 'none',
@@ -21,6 +21,12 @@ declare module '@tarojs/components/types/View' {
21
21
  }
22
22
  }
23
23
 
24
+ declare module '@tarojs/components/types/Button' {
25
+ interface ButtonProps {
26
+ role?: string;
27
+ }
28
+ }
29
+
24
30
  declare module '@tarojs/components/types/Input' {
25
31
  interface InputProps {
26
32
  readonly?: boolean;
@@ -67,13 +67,20 @@ var OverlayHost = ({
67
67
  enterDuration
68
68
  );
69
69
  const previousVisibleRef = (0, import_react.useRef)(visible);
70
+ const afterCloseRef = (0, import_react.useRef)(afterClose);
70
71
  (0, import_react.useEffect)(() => {
71
- const wasVisible = previousVisibleRef.current;
72
- previousVisibleRef.current = visible;
73
- if (!wasVisible || visible || !afterClose) return void 0;
74
- const timer = setTimeout(afterClose, exitDuration);
75
- return () => clearTimeout(timer);
76
- }, [afterClose, exitDuration, visible]);
72
+ afterCloseRef.current = afterClose;
73
+ }, [afterClose]);
74
+ (0, import_react.useEffect)(() => {
75
+ var _a;
76
+ if (visible) {
77
+ previousVisibleRef.current = true;
78
+ return;
79
+ }
80
+ if (shouldRender || !previousVisibleRef.current) return;
81
+ previousVisibleRef.current = false;
82
+ (_a = afterCloseRef.current) == null ? void 0 : _a.call(afterCloseRef);
83
+ }, [shouldRender, visible]);
77
84
  (0, import_react.useEffect)(() => {
78
85
  const runtimeDocument = globalThis["document"];
79
86
  if (!visible || !disableBodyScroll || !(runtimeDocument == null ? void 0 : runtimeDocument.body)) return void 0;
@@ -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