@hero-design/rn-work-uikit 1.9.1 → 1.9.3

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.
@@ -5,6 +5,9 @@ import MentionList from './MentionList';
5
5
  import type { RichTextEditorProps } from './types';
6
6
 
7
7
  import Toolbar from './EditorToolbar';
8
+ import RichTextEditorInput from './RichTextEditorInput';
9
+ import { EditorEvents, ToolbarEvents } from './constants';
10
+ import useRichTextEditorEvents from './hooks/useRichTextEditorEvents';
8
11
 
9
12
  const RichTextEditorWithRef = forwardRef<
10
13
  RichTextEditorRef,
@@ -14,6 +17,10 @@ const RichTextEditorWithRef = forwardRef<
14
17
  RichTextEditorWithRef.displayName = 'RichTextEditor';
15
18
 
16
19
  export default Object.assign(RichTextEditorWithRef, {
17
- MentionList,
18
20
  Toolbar,
21
+ MentionList,
22
+ EditorEvents,
23
+ ToolbarEvents,
24
+ useRichTextEditorEvents,
25
+ Base: RichTextEditorInput,
19
26
  });
@@ -4,21 +4,9 @@ export interface Listener<T> {
4
4
  (data: T): void;
5
5
  }
6
6
 
7
- export const off = <T>(
8
- emitter: EventEmitter,
9
- eventName: string,
10
- listener: Listener<T>
11
- ) => {
12
- emitter.off(eventName, listener);
13
- };
14
-
15
7
  export const emit = <T>(emitter: EventEmitter, eventName: string, data: T) =>
16
8
  emitter.emit(eventName, data);
17
9
 
18
- export const setMaxListeners = (emitter: EventEmitter, n: number) => {
19
- emitter.setMaxListeners(n);
20
- };
21
-
22
10
  export const on = <T>(
23
11
  emitter: EventEmitter,
24
12
  eventName: string,
@@ -127,13 +127,6 @@ const StyledPrefixComponentWrapper = styled(View)(({ theme }) => ({
127
127
  marginRight: theme.__hd__.textInput.space.prefixAndInputContainerGap,
128
128
  }));
129
129
 
130
- const StyledErrorAndHelpTextContainer = styled(View)(({ theme }) => ({
131
- paddingHorizontal:
132
- theme.__hd__.textInput.space.errorAndHelpTextContainerHorizontalPadding,
133
- minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight,
134
- paddingTop: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingTop,
135
- }));
136
-
137
130
  const StyledBottomContainer = styled(View)(() => ({
138
131
  flexDirection: 'row',
139
132
  justifyContent: 'space-between',
@@ -156,7 +149,6 @@ export {
156
149
  StyledHelperText,
157
150
  StyledInputRow,
158
151
  StyledFloatingLabelContainer,
159
- StyledErrorAndHelpTextContainer,
160
152
  StyledBorder,
161
153
  StyledBottomContainer,
162
154
  StyledSuffixContainer,
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ import Select from './components/Select';
4
4
  import DatePicker from './components/DatePicker';
5
5
  import TimePicker from './components/TimePicker';
6
6
  import FormGroup from './components/FormGroup';
7
+ import RichTextEditor from './components/RichTextEditor';
7
8
 
8
9
  export * from '@hero-design/rn';
9
10
 
@@ -18,4 +19,4 @@ export {
18
19
  } from './theme';
19
20
 
20
21
  export { default as theme } from './theme';
21
- export { TextInput, Select, DatePicker, TimePicker, FormGroup };
22
+ export { TextInput, Select, DatePicker, TimePicker, FormGroup, RichTextEditor };
@@ -16,5 +16,3 @@ const WorkThemeProvider = BaseThemeProvider as ThemeProviderType;
16
16
  const useWorkTheme = useTheme as () => Theme;
17
17
 
18
18
  export { WorkThemeProvider, useWorkTheme };
19
-
20
- export default WorkThemeProvider;
@@ -1,8 +1,5 @@
1
- import { Platform, Keyboard } from 'react-native';
1
+ import { Platform } from 'react-native';
2
2
 
3
- import { useEffect, useState } from 'react';
4
-
5
- export const isIOS = Platform.OS === 'ios';
6
3
  export const isAndroid = Platform.OS === 'android';
7
4
 
8
5
  export function pick<O extends object, T extends keyof O>(
@@ -30,15 +27,6 @@ export function omit<O, T extends keyof O>(keys: T[], obj: O): Omit<O, T> {
30
27
  return result;
31
28
  }
32
29
 
33
- export function hexToRgba(hex: string, a: number) {
34
- const arrBuff = new ArrayBuffer(4);
35
- const vw = new DataView(arrBuff);
36
- vw.setUint32(0, parseInt(hex, 16), false);
37
- const arrByte = new Uint8Array(arrBuff);
38
- const [r, g, b] = arrByte;
39
- return `rgba(${r},${g},${b},${a})`;
40
- }
41
-
42
30
  export const deepCompareValue = <V>(a: V, b: V): boolean => {
43
31
  // Handle strict equality first (handles primitives, null, undefined)
44
32
  if (a === b) return true;
@@ -83,31 +71,3 @@ export const deepCompareValue = <V>(a: V, b: V): boolean => {
83
71
  // If none of the above conditions matched, they're not equal
84
72
  return false;
85
73
  };
86
-
87
- export const useKeyboard = () => {
88
- const [isKeyboardVisible, setKeyboardVisible] = useState(false);
89
- const [keyboardHeight, setKeyboardHeight] = useState(0);
90
-
91
- useEffect(() => {
92
- const keyboardWillShowListener = Keyboard.addListener(
93
- 'keyboardWillShow',
94
- (e) => {
95
- setKeyboardVisible(true);
96
- setKeyboardHeight(e.endCoordinates.height);
97
- }
98
- );
99
- const keyboardWillHideListener = Keyboard.addListener(
100
- 'keyboardWillHide',
101
- () => {
102
- setKeyboardVisible(false);
103
- }
104
- );
105
-
106
- return () => {
107
- keyboardWillShowListener.remove();
108
- keyboardWillHideListener.remove();
109
- };
110
- }, []);
111
-
112
- return { isKeyboardVisible, keyboardHeight };
113
- };