react-native-better-html 1.0.18 → 1.0.20

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/index.d.mts CHANGED
@@ -3,7 +3,7 @@ export { AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme,
3
3
  import * as react from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as react_native from 'react-native';
6
- import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextInput, TextStyle, NativeSyntheticEvent, NativeTouchEvent, FocusEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
6
+ import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, ColorValue, TextInput, TextStyle, NativeSyntheticEvent, NativeTouchEvent, FocusEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
7
7
  import { SymbolView } from 'expo-symbols';
8
8
  import { EaseFunction, PropsTransforms } from '@legendapp/motion';
9
9
 
@@ -12,7 +12,7 @@ type BetterComponentsConfig = {
12
12
  app: AppConfig;
13
13
  };
14
14
 
15
- type PluginName = "asyncStorage";
15
+ type PluginName = "alerts" | "asyncStorage";
16
16
  type BetterComponentsPluginConstructor<T extends object = object> = (config?: T) => BetterComponentsPlugin<T>;
17
17
  type BetterComponentsPlugin<T = object> = {
18
18
  name: PluginName;
@@ -20,7 +20,26 @@ type BetterComponentsPlugin<T = object> = {
20
20
  getConfig: () => T;
21
21
  };
22
22
 
23
+ type AlertType = "info" | "success" | "warning" | "error";
24
+ type AlertDuration = number | "auto";
25
+ type AlertDisplay = "default" | "prominent";
26
+ type Alert = {
27
+ id: string;
28
+ type: AlertType;
29
+ /** @default "default" */
30
+ display?: AlertDisplay;
31
+ title?: string;
32
+ message?: string;
33
+ /** @default "auto" */
34
+ duration?: AlertDuration;
35
+ onClose?: (alert: Alert) => void;
36
+ };
37
+
23
38
  declare const useBetterComponentsContext: () => BetterComponentsConfig & BetterCoreConfig;
39
+ declare const useAlertControls: () => {
40
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
41
+ removeAlert: (alertId: string) => void;
42
+ };
24
43
  type BetterComponentsProviderInternalConfig = DeepPartialRecord<BetterComponentsConfig>;
25
44
  type BetterProviderCommonProps = {
26
45
  plugins?: BetterComponentsPlugin[];
@@ -45,6 +64,10 @@ type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
45
64
  ref?: React.Ref<ComponentRef>;
46
65
  };
47
66
 
67
+ declare const alertControls: {
68
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
69
+ removeAlert: (alertId: string) => void;
70
+ };
48
71
  declare const pressStrength: () => Record<"p05" | "p1" | "p2" | "p3", number>;
49
72
 
50
73
  type ViewProps<Value = unknown> = {
@@ -81,7 +104,7 @@ type IconProps = {
81
104
  nameIOS?: IconNameIOS;
82
105
  /** @default 16 */
83
106
  size?: number;
84
- color?: string;
107
+ color?: ColorValue;
85
108
  } & OmitProps<ViewProps, "width" | "height" | "pressType">;
86
109
  declare function Icon({ name, nameIOS, size, color, ...props }: IconProps): react_jsx_runtime.JSX.Element;
87
110
  declare const _default$3: react.MemoExoticComponent<typeof Icon>;
@@ -270,6 +293,7 @@ type ButtonProps<Value> = {
270
293
  /** @default "base" */
271
294
  textColor?: ColorValue;
272
295
  icon?: IconName | AnyOtherString;
296
+ iconIOS?: IconNameIOS;
273
297
  /** @default "left" */
274
298
  iconPosition?: "left" | "right";
275
299
  /** @default Same as text color */
@@ -296,17 +320,26 @@ type ButtonComponentType = {
296
320
  secondary: <Value>(props: ButtonProps<Value>) => React.ReactElement;
297
321
  destructive: <Value>(props: ButtonProps<Value>) => React.ReactElement;
298
322
  text: <Value>(props: ButtonProps<Value>) => React.ReactElement;
323
+ icon: <Value>(props: OmitProps<ButtonProps<Value>, "width" | "height" | "isSmall"> & {
324
+ /** @default 16 */
325
+ size?: number;
326
+ }) => React.ReactElement;
299
327
  };
300
328
  declare const ButtonComponent: {
301
- <Value>({ text, textFontSize, textFontWeight, textDecorationLine, textColor, icon, iconPosition, iconColor, iconSize, image, imagePosition, imageWidth, imageHeight, loaderName, isLoading, isSmall, animateOpacity, flex, alignSelf, disabled, ...props }: InternalButtonProps<Value>): react_jsx_runtime.JSX.Element;
329
+ <Value>({ value, text, textFontSize, textFontWeight, textDecorationLine, textColor, icon, iconIOS, iconPosition, iconColor, iconSize, image, imagePosition, imageWidth, imageHeight, loaderName, isLoading, isSmall, animateOpacity, flex, alignSelf, disabled, onPress, onPressWithValue, ...props }: InternalButtonProps<Value>): react_jsx_runtime.JSX.Element;
302
330
  secondary: <Value>(props: ButtonProps<Value>) => React.ReactElement;
303
331
  destructive: <Value>(props: ButtonProps<Value>) => React.ReactElement;
304
332
  text: <Value>(props: ButtonProps<Value>) => React.ReactElement;
333
+ icon: <Value>(props: OmitProps<ButtonProps<Value>, "width" | "height" | "isSmall"> & {
334
+ /** @default 16 */
335
+ size?: number;
336
+ }) => React.ReactElement;
305
337
  };
306
338
  declare const Button: ButtonComponentType & {
307
339
  secondary: typeof ButtonComponent.secondary;
308
340
  destructive: typeof ButtonComponent.destructive;
309
341
  text: typeof ButtonComponent.text;
342
+ icon: typeof ButtonComponent.icon;
310
343
  };
311
344
 
312
345
  type LoaderSize = "small" | "large";
@@ -465,21 +498,35 @@ type ListItemProps = {
465
498
  iconIOS?: IconNameIOS;
466
499
  title?: string;
467
500
  description?: string;
501
+ descriptionSelectable?: boolean;
468
502
  rightElement?: "arrow" | "switch";
469
503
  /** @default theme.colors.backgroundBase */
470
504
  backgroundColor?: ViewProps["backgroundColor"];
471
505
  /** @default false */
472
506
  insideScreenHolder?: boolean;
473
507
  onPress?: () => void;
474
- rightArrowValue?: string | number;
508
+ rightValue?: string | number;
509
+ rightValueSelectable?: boolean;
475
510
  switchIsEnabled?: boolean;
476
511
  switchOnChange?: (isEnabled: boolean) => void;
477
512
  };
478
- declare function ListItem({ icon, iconIOS, title, description, rightElement, backgroundColor, insideScreenHolder, onPress, rightArrowValue, switchIsEnabled, switchOnChange, }: ListItemProps): react_jsx_runtime.JSX.Element;
513
+ declare function ListItem({ icon, iconIOS, title, description, descriptionSelectable, rightElement, backgroundColor, insideScreenHolder, onPress, rightValue, rightValueSelectable, switchIsEnabled, switchOnChange, }: ListItemProps): react_jsx_runtime.JSX.Element;
479
514
  declare const _default: react.MemoExoticComponent<typeof ListItem>;
480
515
 
516
+ type AlertsPluginOptions = {
517
+ /** @default "right" */
518
+ align?: "left" | "center" | "right";
519
+ /** @default "auto" */
520
+ defaultDuration?: AlertDuration;
521
+ defaultDisplay?: PartialRecord<AlertType, AlertDisplay>;
522
+ /** @default true */
523
+ withCloseButton?: boolean;
524
+ };
525
+ declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
526
+ declare const alertsPlugin: BetterComponentsPluginConstructor<AlertsPluginOptions>;
527
+
481
528
  type AsyncStoragePluginOptions = {};
482
529
  declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
483
530
  declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
484
531
 
485
- export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$4 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, _default$3 as Icon, type IconNameIOS, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, _default as ListItem, type ListItemProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default$1 as StatusBar, type StatusBarProps, _default$2 as Switch, type SwitchProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useBetterComponentsContext, useDevice, useEventEmitter, useForm, useKeyboard };
532
+ export { type AlertsPluginOptions, Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$4 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, _default$3 as Icon, type IconNameIOS, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, _default as ListItem, type ListItemProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default$1 as StatusBar, type StatusBarProps, _default$2 as Switch, type SwitchProps, Text, type TextProps, View, type ViewProps, alertControls, alertsPlugin, asyncStoragePlugin, defaultAlertsPluginOptions, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useAlertControls, useBetterComponentsContext, useDevice, useEventEmitter, useForm, useKeyboard };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme,
3
3
  import * as react from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as react_native from 'react-native';
6
- import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextInput, TextStyle, NativeSyntheticEvent, NativeTouchEvent, FocusEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
6
+ import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, ColorValue, TextInput, TextStyle, NativeSyntheticEvent, NativeTouchEvent, FocusEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
7
7
  import { SymbolView } from 'expo-symbols';
8
8
  import { EaseFunction, PropsTransforms } from '@legendapp/motion';
9
9
 
@@ -12,7 +12,7 @@ type BetterComponentsConfig = {
12
12
  app: AppConfig;
13
13
  };
14
14
 
15
- type PluginName = "asyncStorage";
15
+ type PluginName = "alerts" | "asyncStorage";
16
16
  type BetterComponentsPluginConstructor<T extends object = object> = (config?: T) => BetterComponentsPlugin<T>;
17
17
  type BetterComponentsPlugin<T = object> = {
18
18
  name: PluginName;
@@ -20,7 +20,26 @@ type BetterComponentsPlugin<T = object> = {
20
20
  getConfig: () => T;
21
21
  };
22
22
 
23
+ type AlertType = "info" | "success" | "warning" | "error";
24
+ type AlertDuration = number | "auto";
25
+ type AlertDisplay = "default" | "prominent";
26
+ type Alert = {
27
+ id: string;
28
+ type: AlertType;
29
+ /** @default "default" */
30
+ display?: AlertDisplay;
31
+ title?: string;
32
+ message?: string;
33
+ /** @default "auto" */
34
+ duration?: AlertDuration;
35
+ onClose?: (alert: Alert) => void;
36
+ };
37
+
23
38
  declare const useBetterComponentsContext: () => BetterComponentsConfig & BetterCoreConfig;
39
+ declare const useAlertControls: () => {
40
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
41
+ removeAlert: (alertId: string) => void;
42
+ };
24
43
  type BetterComponentsProviderInternalConfig = DeepPartialRecord<BetterComponentsConfig>;
25
44
  type BetterProviderCommonProps = {
26
45
  plugins?: BetterComponentsPlugin[];
@@ -45,6 +64,10 @@ type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
45
64
  ref?: React.Ref<ComponentRef>;
46
65
  };
47
66
 
67
+ declare const alertControls: {
68
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
69
+ removeAlert: (alertId: string) => void;
70
+ };
48
71
  declare const pressStrength: () => Record<"p05" | "p1" | "p2" | "p3", number>;
49
72
 
50
73
  type ViewProps<Value = unknown> = {
@@ -81,7 +104,7 @@ type IconProps = {
81
104
  nameIOS?: IconNameIOS;
82
105
  /** @default 16 */
83
106
  size?: number;
84
- color?: string;
107
+ color?: ColorValue;
85
108
  } & OmitProps<ViewProps, "width" | "height" | "pressType">;
86
109
  declare function Icon({ name, nameIOS, size, color, ...props }: IconProps): react_jsx_runtime.JSX.Element;
87
110
  declare const _default$3: react.MemoExoticComponent<typeof Icon>;
@@ -270,6 +293,7 @@ type ButtonProps<Value> = {
270
293
  /** @default "base" */
271
294
  textColor?: ColorValue;
272
295
  icon?: IconName | AnyOtherString;
296
+ iconIOS?: IconNameIOS;
273
297
  /** @default "left" */
274
298
  iconPosition?: "left" | "right";
275
299
  /** @default Same as text color */
@@ -296,17 +320,26 @@ type ButtonComponentType = {
296
320
  secondary: <Value>(props: ButtonProps<Value>) => React.ReactElement;
297
321
  destructive: <Value>(props: ButtonProps<Value>) => React.ReactElement;
298
322
  text: <Value>(props: ButtonProps<Value>) => React.ReactElement;
323
+ icon: <Value>(props: OmitProps<ButtonProps<Value>, "width" | "height" | "isSmall"> & {
324
+ /** @default 16 */
325
+ size?: number;
326
+ }) => React.ReactElement;
299
327
  };
300
328
  declare const ButtonComponent: {
301
- <Value>({ text, textFontSize, textFontWeight, textDecorationLine, textColor, icon, iconPosition, iconColor, iconSize, image, imagePosition, imageWidth, imageHeight, loaderName, isLoading, isSmall, animateOpacity, flex, alignSelf, disabled, ...props }: InternalButtonProps<Value>): react_jsx_runtime.JSX.Element;
329
+ <Value>({ value, text, textFontSize, textFontWeight, textDecorationLine, textColor, icon, iconIOS, iconPosition, iconColor, iconSize, image, imagePosition, imageWidth, imageHeight, loaderName, isLoading, isSmall, animateOpacity, flex, alignSelf, disabled, onPress, onPressWithValue, ...props }: InternalButtonProps<Value>): react_jsx_runtime.JSX.Element;
302
330
  secondary: <Value>(props: ButtonProps<Value>) => React.ReactElement;
303
331
  destructive: <Value>(props: ButtonProps<Value>) => React.ReactElement;
304
332
  text: <Value>(props: ButtonProps<Value>) => React.ReactElement;
333
+ icon: <Value>(props: OmitProps<ButtonProps<Value>, "width" | "height" | "isSmall"> & {
334
+ /** @default 16 */
335
+ size?: number;
336
+ }) => React.ReactElement;
305
337
  };
306
338
  declare const Button: ButtonComponentType & {
307
339
  secondary: typeof ButtonComponent.secondary;
308
340
  destructive: typeof ButtonComponent.destructive;
309
341
  text: typeof ButtonComponent.text;
342
+ icon: typeof ButtonComponent.icon;
310
343
  };
311
344
 
312
345
  type LoaderSize = "small" | "large";
@@ -465,21 +498,35 @@ type ListItemProps = {
465
498
  iconIOS?: IconNameIOS;
466
499
  title?: string;
467
500
  description?: string;
501
+ descriptionSelectable?: boolean;
468
502
  rightElement?: "arrow" | "switch";
469
503
  /** @default theme.colors.backgroundBase */
470
504
  backgroundColor?: ViewProps["backgroundColor"];
471
505
  /** @default false */
472
506
  insideScreenHolder?: boolean;
473
507
  onPress?: () => void;
474
- rightArrowValue?: string | number;
508
+ rightValue?: string | number;
509
+ rightValueSelectable?: boolean;
475
510
  switchIsEnabled?: boolean;
476
511
  switchOnChange?: (isEnabled: boolean) => void;
477
512
  };
478
- declare function ListItem({ icon, iconIOS, title, description, rightElement, backgroundColor, insideScreenHolder, onPress, rightArrowValue, switchIsEnabled, switchOnChange, }: ListItemProps): react_jsx_runtime.JSX.Element;
513
+ declare function ListItem({ icon, iconIOS, title, description, descriptionSelectable, rightElement, backgroundColor, insideScreenHolder, onPress, rightValue, rightValueSelectable, switchIsEnabled, switchOnChange, }: ListItemProps): react_jsx_runtime.JSX.Element;
479
514
  declare const _default: react.MemoExoticComponent<typeof ListItem>;
480
515
 
516
+ type AlertsPluginOptions = {
517
+ /** @default "right" */
518
+ align?: "left" | "center" | "right";
519
+ /** @default "auto" */
520
+ defaultDuration?: AlertDuration;
521
+ defaultDisplay?: PartialRecord<AlertType, AlertDisplay>;
522
+ /** @default true */
523
+ withCloseButton?: boolean;
524
+ };
525
+ declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
526
+ declare const alertsPlugin: BetterComponentsPluginConstructor<AlertsPluginOptions>;
527
+
481
528
  type AsyncStoragePluginOptions = {};
482
529
  declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
483
530
  declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
484
531
 
485
- export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$4 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, _default$3 as Icon, type IconNameIOS, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, _default as ListItem, type ListItemProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default$1 as StatusBar, type StatusBarProps, _default$2 as Switch, type SwitchProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useBetterComponentsContext, useDevice, useEventEmitter, useForm, useKeyboard };
532
+ export { type AlertsPluginOptions, Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$4 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, _default$3 as Icon, type IconNameIOS, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, _default as ListItem, type ListItemProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default$1 as StatusBar, type StatusBarProps, _default$2 as Switch, type SwitchProps, Text, type TextProps, View, type ViewProps, alertControls, alertsPlugin, asyncStoragePlugin, defaultAlertsPluginOptions, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useAlertControls, useBetterComponentsContext, useDevice, useEventEmitter, useForm, useKeyboard };