@draftbit/core 54.0.6 → 54.0.7

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 (65) hide show
  1. package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +1 -1
  2. package/lib/commonjs/components/KeyboardAvoidingView.js +1 -1
  3. package/lib/commonjs/components/LoadingIndicator.js +1 -1
  4. package/lib/commonjs/components/LottieAnimation.js +1 -1
  5. package/lib/commonjs/components/Markdown.js +1 -1
  6. package/lib/commonjs/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js +1 -1
  7. package/lib/commonjs/components/PinInput/PinInput.js +1 -1
  8. package/lib/commonjs/components/Progress/LinearProgress/LinearProgress.js +1 -1
  9. package/lib/commonjs/components/Swiper/Swiper.js +1 -1
  10. package/lib/commonjs/components/Swiper/SwiperItem.js +1 -1
  11. package/lib/commonjs/components/Table/TableRow.js +1 -1
  12. package/lib/commonjs/components/Timer.js +1 -1
  13. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +1 -0
  14. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.js +5 -3
  15. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.js.map +1 -1
  16. package/lib/typescript/src/components/KeyboardAvoidingView.d.ts +1 -0
  17. package/lib/typescript/src/components/KeyboardAvoidingView.js +4 -2
  18. package/lib/typescript/src/components/KeyboardAvoidingView.js.map +1 -1
  19. package/lib/typescript/src/components/LoadingIndicator.d.ts +1 -0
  20. package/lib/typescript/src/components/LoadingIndicator.js +6 -2
  21. package/lib/typescript/src/components/LoadingIndicator.js.map +1 -1
  22. package/lib/typescript/src/components/LottieAnimation.d.ts +1 -0
  23. package/lib/typescript/src/components/LottieAnimation.js +4 -2
  24. package/lib/typescript/src/components/LottieAnimation.js.map +1 -1
  25. package/lib/typescript/src/components/Markdown.d.ts +1 -0
  26. package/lib/typescript/src/components/Markdown.js +13 -13
  27. package/lib/typescript/src/components/Markdown.js.map +1 -1
  28. package/lib/typescript/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js +3 -3
  29. package/lib/typescript/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js.map +1 -1
  30. package/lib/typescript/src/components/PinInput/CustomPinInputCell.d.ts +2 -1
  31. package/lib/typescript/src/components/PinInput/CustomPinInputCell.js.map +1 -1
  32. package/lib/typescript/src/components/PinInput/PinInput.d.ts +1 -0
  33. package/lib/typescript/src/components/PinInput/PinInput.js +10 -7
  34. package/lib/typescript/src/components/PinInput/PinInput.js.map +1 -1
  35. package/lib/typescript/src/components/PinInput/PinInputText.d.ts +1 -0
  36. package/lib/typescript/src/components/PinInput/PinInputText.js.map +1 -1
  37. package/lib/typescript/src/components/Progress/LinearProgress/LinearProgress.js +1 -1
  38. package/lib/typescript/src/components/Progress/LinearProgress/LinearProgress.js.map +1 -1
  39. package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
  40. package/lib/typescript/src/components/Swiper/Swiper.js +4 -2
  41. package/lib/typescript/src/components/Swiper/Swiper.js.map +1 -1
  42. package/lib/typescript/src/components/Swiper/SwiperItem.d.ts +3 -2
  43. package/lib/typescript/src/components/Swiper/SwiperItem.js +3 -1
  44. package/lib/typescript/src/components/Swiper/SwiperItem.js.map +1 -1
  45. package/lib/typescript/src/components/Table/TableRow.js +1 -1
  46. package/lib/typescript/src/components/Table/TableRow.js.map +1 -1
  47. package/lib/typescript/src/components/Timer.d.ts +1 -0
  48. package/lib/typescript/src/components/Timer.js +4 -2
  49. package/lib/typescript/src/components/Timer.js.map +1 -1
  50. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +3 -3
  52. package/src/components/DeckSwiper/DeckSwiperCard.tsx +5 -2
  53. package/src/components/KeyboardAvoidingView.tsx +4 -0
  54. package/src/components/LoadingIndicator.tsx +12 -2
  55. package/src/components/LottieAnimation.tsx +8 -1
  56. package/src/components/Markdown.tsx +30 -21
  57. package/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.tsx +3 -3
  58. package/src/components/PinInput/CustomPinInputCell.tsx +2 -1
  59. package/src/components/PinInput/PinInput.tsx +27 -22
  60. package/src/components/PinInput/PinInputText.tsx +1 -0
  61. package/src/components/Progress/LinearProgress/LinearProgress.tsx +1 -1
  62. package/src/components/Swiper/Swiper.tsx +10 -2
  63. package/src/components/Swiper/SwiperItem.tsx +10 -3
  64. package/src/components/Table/TableRow.tsx +1 -1
  65. package/src/components/Timer.tsx +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "54.0.6",
3
+ "version": "54.0.7",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "types": "lib/typescript/src/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "homepage": "https://github.com/draftbit/react-native-jigsaw#readme",
43
43
  "dependencies": {
44
44
  "@draftbit/react-theme-provider": "^2.1.1",
45
- "@draftbit/theme": "54.0.6",
45
+ "@draftbit/theme": "54.0.7",
46
46
  "@emotion/react": "^11.13.5",
47
47
  "@emotion/styled": "^11.13.5",
48
48
  "@expo/vector-icons": "^15.0.3",
@@ -123,5 +123,5 @@
123
123
  ],
124
124
  "testEnvironment": "node"
125
125
  },
126
- "gitHead": "fcbba18cc0dc8f351f84e33c2d96b789378ed6aa"
126
+ "gitHead": "9d2231245f05d8b42699f98248f2dead6b1188ee"
127
127
  }
@@ -12,21 +12,24 @@ import { withTheme } from "@draftbit/theme";
12
12
  export interface DeckSwiperCardProps
13
13
  extends Omit<ViewProps, "style" | "children"> {
14
14
  style?: StyleProp<ViewStyle>;
15
+ className?: string;
15
16
  theme: ReadTheme;
16
17
  }
17
18
 
18
19
  const DeckSwiperCard: React.FC<
19
20
  React.PropsWithChildren<DeckSwiperCardProps>
20
- > = ({ style, children, theme, ...rest }) => (
21
+ > = ({ style, className, children, theme, ...rest }) => (
21
22
  <View
22
23
  style={[
23
24
  styles.card,
24
- {
25
+ !className && {
25
26
  backgroundColor: theme.colors.background.base,
26
27
  borderColor: theme.colors.border.base,
27
28
  },
28
29
  style,
29
30
  ]}
31
+ // @ts-ignore
32
+ className={className}
30
33
  {...rest}
31
34
  >
32
35
  {children}
@@ -18,6 +18,7 @@ interface KeyboardAvoidingViewProps extends ViewProps {
18
18
  androidKeyboardVerticalOffset?: number;
19
19
  iosBehavior?: KeyboardAvoidingViewBehavior;
20
20
  iosKeyboardVerticalOffset?: number;
21
+ className?: string;
21
22
  }
22
23
 
23
24
  const KeyboardAvoidingView: React.FC<KeyboardAvoidingViewProps> = ({
@@ -27,6 +28,7 @@ const KeyboardAvoidingView: React.FC<KeyboardAvoidingViewProps> = ({
27
28
  androidKeyboardVerticalOffset,
28
29
  iosBehavior,
29
30
  iosKeyboardVerticalOffset,
31
+ className,
30
32
  ...rest
31
33
  }) => {
32
34
  let behaviorResult: KeyboardAvoidingViewBehavior;
@@ -53,6 +55,8 @@ const KeyboardAvoidingView: React.FC<KeyboardAvoidingViewProps> = ({
53
55
  <KeyboardAvoidingViewComponent
54
56
  behavior={behaviorResult ?? undefined}
55
57
  keyboardVerticalOffset={keyboardVerticalOffsetResult}
58
+ // @ts-ignore
59
+ className={className}
56
60
  {...rest}
57
61
  />
58
62
  );
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
2
+ import { View, StyleProp, ViewStyle } from "react-native";
3
3
  import { withTheme } from "@draftbit/theme";
4
4
  import type { ReadTheme } from "@draftbit/theme";
5
5
  import {
@@ -34,6 +34,7 @@ export enum LoadingIndicatorType {
34
34
 
35
35
  type Props = {
36
36
  style?: StyleProp<ViewStyle>;
37
+ className?: string;
37
38
  color?: string;
38
39
  theme: ReadTheme;
39
40
  type?: LoadingIndicatorType;
@@ -61,10 +62,19 @@ const LoadingIndicator: React.FC<React.PropsWithChildren<Props>> = ({
61
62
  type = LoadingIndicatorType.plane,
62
63
  size,
63
64
  style,
65
+ className,
64
66
  ...rest
65
67
  }) => {
66
68
  const SpinnerComponent = SPINNER_COMPONENTS[type];
67
- return <SpinnerComponent size={size} color={color} style={style} {...rest} />;
69
+ return (
70
+ <View
71
+ style={style}
72
+ // @ts-ignore
73
+ className={className}
74
+ >
75
+ <SpinnerComponent size={size} color={color} {...rest} />
76
+ </View>
77
+ );
68
78
  };
69
79
 
70
80
  export default withTheme(LoadingIndicator);
@@ -4,6 +4,7 @@ import LottieView, { AnimationObject } from "lottie-react-native";
4
4
 
5
5
  type Props = {
6
6
  style?: StyleProp<ViewStyle>;
7
+ className?: string;
7
8
  resizeMode?: "cover" | "contain" | "center";
8
9
  source: string | AnimationObject | { uri: string };
9
10
  autoPlay?: boolean;
@@ -15,6 +16,7 @@ const LottieAnimation = forwardRef<LottieView, Props>(
15
16
  (
16
17
  {
17
18
  style,
19
+ className,
18
20
  source,
19
21
  autoPlay = true,
20
22
  loop = true,
@@ -25,7 +27,12 @@ const LottieAnimation = forwardRef<LottieView, Props>(
25
27
  ref
26
28
  ) => {
27
29
  return (
28
- <View style={style} {...rest}>
30
+ <View
31
+ style={style}
32
+ // @ts-ignore
33
+ className={className}
34
+ {...rest}
35
+ >
29
36
  <LottieView
30
37
  ref={ref}
31
38
  source={source}
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import {
3
3
  Text,
4
+ View,
4
5
  StyleProp,
5
6
  ViewStyle,
6
7
  TextStyle,
@@ -11,6 +12,7 @@ import { extractStyles } from "../utilities";
11
12
 
12
13
  type MarkdownProps = {
13
14
  style?: StyleProp<ViewStyle & TextStyle>;
15
+ className?: string;
14
16
  };
15
17
 
16
18
  const childToString = (child?: React.ReactNode): string => {
@@ -32,35 +34,42 @@ const childToString = (child?: React.ReactNode): string => {
32
34
  const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>> = ({
33
35
  children: childrenProp,
34
36
  style,
37
+ className,
35
38
  }) => {
36
39
  const children = React.Children.toArray(childrenProp);
37
40
  const text = children.map(childToString).join("");
38
41
 
39
42
  const bodyStyle = StyleSheet.flatten(style);
40
- const { textStyles } = extractStyles(bodyStyle);
43
+ const { viewStyles, textStyles } = extractStyles(bodyStyle);
41
44
 
42
45
  return (
43
- //'body' style applies to all markdown components
44
- //@ts-ignore TS does not like the type of this named style for some reason
45
- <MarkdownComponent
46
- style={{ body: bodyStyle }}
47
- rules={{
48
- // By default, strong does not work with custom fonts on iOS. This addresses the issue
49
- strong: (node) => (
50
- <Text
51
- key={node.key}
52
- style={{
53
- ...textStyles,
54
- fontWeight: "bold",
55
- }}
56
- >
57
- {node.children[0].content}
58
- </Text>
59
- ),
60
- }}
46
+ <View
47
+ style={viewStyles}
48
+ // @ts-ignore
49
+ className={className}
61
50
  >
62
- {text}
63
- </MarkdownComponent>
51
+ {/*//'body' style applies to all markdown components*/}
52
+ {/*@ts-ignore TS does not like the type of this named style for some reason*/}
53
+ <MarkdownComponent
54
+ style={{ body: bodyStyle }}
55
+ rules={{
56
+ // By default, strong does not work with custom fonts on iOS. This addresses the issue
57
+ strong: (node) => (
58
+ <Text
59
+ key={node.key}
60
+ style={{
61
+ ...textStyles,
62
+ fontWeight: "bold",
63
+ }}
64
+ >
65
+ {node.children[0].content}
66
+ </Text>
67
+ ),
68
+ }}
69
+ >
70
+ {text}
71
+ </MarkdownComponent>
72
+ </View>
64
73
  );
65
74
  };
66
75
 
@@ -52,7 +52,7 @@ const AudioPlayerWithInterface = React.forwardRef<
52
52
  : newHeadlessAudioPlayerRef;
53
53
 
54
54
  const {
55
- color = theme.colors.text.strong,
55
+ color,
56
56
  fontFamily,
57
57
  fontWeight,
58
58
  fontSize,
@@ -67,7 +67,7 @@ const AudioPlayerWithInterface = React.forwardRef<
67
67
  } = StyleSheet.flatten(style || {});
68
68
 
69
69
  const textStyles = {
70
- color,
70
+ color: color ?? (className ? undefined : theme.colors.text.strong),
71
71
  fontFamily,
72
72
  fontWeight,
73
73
  fontSize,
@@ -131,7 +131,7 @@ const AudioPlayerWithInterface = React.forwardRef<
131
131
  // @ts-ignore
132
132
  className={className}
133
133
  style={[
134
- {
134
+ !className && {
135
135
  backgroundColor: theme.colors.background.base,
136
136
  borderColor: theme.colors.border.base,
137
137
  },
@@ -3,7 +3,8 @@ import { StyleProp, ViewStyle, View, LayoutChangeEvent } from "react-native";
3
3
 
4
4
  interface CustomPinInputCellProps {
5
5
  style?: StyleProp<ViewStyle>;
6
- onLayout: (event: LayoutChangeEvent) => void;
6
+ className?: string;
7
+ onLayout?: (event: LayoutChangeEvent) => void;
7
8
  }
8
9
 
9
10
  /**
@@ -35,6 +35,7 @@ interface PinInputProps extends Omit<TextInputProps, "style"> {
35
35
  focusedBorderWidth?: number;
36
36
  focusedTextColor?: string;
37
37
  style?: StyleProp<ViewStyle | TextStyle>;
38
+ className?: string;
38
39
  theme: ReadTheme;
39
40
  }
40
41
 
@@ -55,6 +56,7 @@ const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
55
56
  focusedTextColor,
56
57
  secureTextEntry,
57
58
  style,
59
+ className,
58
60
  ...rest
59
61
  },
60
62
  ref
@@ -132,28 +134,31 @@ const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
132
134
  };
133
135
 
134
136
  return (
135
- <CodeField
136
- ref={pinInputRef}
137
- {...(clearOnCellFocus ? codeFieldProps : {})}
138
- value={value}
139
- onChangeText={onChangeText}
140
- rootStyle={styles.rootContainer}
141
- textInputStyle={[
142
- // addresses issue on firefox where the hidden input did not fill the height
143
- { height: "100%" },
144
- //@ts-ignore Web specific prop. Removes default blue outline that appears on the hidden TextInput
145
- Platform.OS === "web" ? { outlineWidth: 0 } : {},
146
- ]}
147
- InputComponent={TextInput}
148
- cellCount={cellCount}
149
- renderCell={({ symbol: cellValue, index, isFocused }) => (
150
- <React.Fragment key={index}>
151
- {renderCell(cellValue, index, isFocused)}
152
- </React.Fragment>
153
- )}
154
- secureTextEntry={secureTextEntry}
155
- {...rest}
156
- />
137
+ // @ts-ignore
138
+ <View className={className}>
139
+ <CodeField
140
+ ref={pinInputRef}
141
+ {...(clearOnCellFocus ? codeFieldProps : {})}
142
+ value={value}
143
+ onChangeText={onChangeText}
144
+ rootStyle={styles.rootContainer}
145
+ textInputStyle={[
146
+ // addresses issue on firefox where the hidden input did not fill the height
147
+ { height: "100%" },
148
+ //@ts-ignore Web specific prop. Removes default blue outline that appears on the hidden TextInput
149
+ Platform.OS === "web" ? { outlineWidth: 0 } : {},
150
+ ]}
151
+ InputComponent={TextInput}
152
+ cellCount={cellCount}
153
+ renderCell={({ symbol: cellValue, index, isFocused }) => (
154
+ <React.Fragment key={index}>
155
+ {renderCell(cellValue, index, isFocused)}
156
+ </React.Fragment>
157
+ )}
158
+ secureTextEntry={secureTextEntry}
159
+ {...rest}
160
+ />
161
+ </View>
157
162
  );
158
163
  }
159
164
  );
@@ -8,6 +8,7 @@ interface CustomPinInputTextProps extends TextProps {
8
8
  cursorBlinkDuration?: number;
9
9
  cursorText?: string;
10
10
  isFocused?: boolean;
11
+ className?: string;
11
12
  theme: ReadTheme;
12
13
  }
13
14
 
@@ -98,7 +98,7 @@ export const LinearProgress: React.FC<ValueProgressProps> = ({
98
98
  style={[
99
99
  {
100
100
  height: maxThickness,
101
- width: "100%",
101
+ ...(className ? {} : { width: "100%" }),
102
102
  },
103
103
  style,
104
104
  ]}
@@ -9,7 +9,9 @@ export interface SwiperRef {
9
9
  swipePrev: () => void;
10
10
  }
11
11
 
12
- export interface SwiperProps<T> extends Omit<ViewProps, "style" | "children"> {
12
+ export interface SwiperProps<T>
13
+ extends Omit<ViewProps, "style" | "children" | "className"> {
14
+ className?: string;
13
15
  onSwipe?: (index: number) => void;
14
16
  onSwipedNext?: (index: number) => void;
15
17
  onSwipedPrevious?: (index: number) => void;
@@ -62,6 +64,7 @@ const Swiper = forwardRef<SwiperRef, SwiperProps<any>>(
62
64
  minDistanceForAction,
63
65
  minDistanceToCapture,
64
66
  style,
67
+ className,
65
68
  hideDots = false,
66
69
  ...rest
67
70
  }: SwiperProps<any>,
@@ -142,7 +145,12 @@ const Swiper = forwardRef<SwiperRef, SwiperProps<any>>(
142
145
  }));
143
146
 
144
147
  return (
145
- <View style={style} {...rest}>
148
+ <View
149
+ style={style}
150
+ // @ts-ignore
151
+ className={className}
152
+ {...rest}
153
+ >
146
154
  {/* @ts-ignore */}
147
155
  <SwiperComponent
148
156
  ref={swiperRef}
@@ -13,13 +13,20 @@ const styles = StyleSheet.create({
13
13
  },
14
14
  });
15
15
 
16
- export interface SwiperProps extends Omit<ViewProps, "style" | "children"> {
16
+ export interface SwiperProps
17
+ extends Omit<ViewProps, "style" | "children" | "className"> {
17
18
  children: React.ReactNode;
18
19
  style?: StyleProp<ViewStyle>;
20
+ className?: string;
19
21
  }
20
22
 
21
- const SwiperItem = ({ children, style, ...rest }: SwiperProps) => (
22
- <View style={[styles.wrapper, style]} {...rest}>
23
+ const SwiperItem = ({ children, style, className, ...rest }: SwiperProps) => (
24
+ <View
25
+ style={[styles.wrapper, style]}
26
+ // @ts-ignore
27
+ className={className}
28
+ {...rest}
29
+ >
23
30
  {children}
24
31
  </View>
25
32
  );
@@ -67,7 +67,7 @@ const TableRow: React.FC<React.PropsWithChildren<Props>> = ({
67
67
  className={className}
68
68
  style={[
69
69
  borderViewStyle,
70
- isTableHeader
70
+ isTableHeader && !className
71
71
  ? { backgroundColor: theme.colors.branding.primary }
72
72
  : {},
73
73
  style,
@@ -15,6 +15,7 @@ import {
15
15
 
16
16
  interface TimerProps extends TextProps {
17
17
  style?: StyleProp<TextStyle>;
18
+ className?: string;
18
19
  initialTime?: number;
19
20
  updateInterval?: number;
20
21
  format?: "ss" | "mm:ss" | "hh:mm:ss" | "ss:ms" | "mm:ss:ms" | "hh:mm:ss:ms";
@@ -34,6 +35,7 @@ const Timer = forwardRef<TimerHandle, TimerProps>(
34
35
  (
35
36
  {
36
37
  style,
38
+ className,
37
39
  initialTime,
38
40
  updateInterval = 1000,
39
41
  format = "mm:ss",
@@ -136,7 +138,12 @@ const Timer = forwardRef<TimerHandle, TimerProps>(
136
138
  };
137
139
 
138
140
  return (
139
- <Text {...rest} style={[styles.defaultTimerStyle, style]}>
141
+ <Text
142
+ {...rest}
143
+ style={[!className && styles.defaultTimerStyle, style]}
144
+ // @ts-ignore
145
+ className={className}
146
+ >
140
147
  {formatTime(time)}
141
148
  </Text>
142
149
  );