@hero-design/rn-work-uikit 1.3.0 → 1.4.0

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 (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/lib/index.js +48742 -29649
  3. package/package.json +5 -4
  4. package/src/__tests__/index-export.spec.ts +64 -0
  5. package/src/components/DatePicker/__tests__/__snapshots__/index.spec.tsx.snap +1602 -0
  6. package/src/components/DatePicker/__tests__/index.spec.tsx +56 -0
  7. package/src/components/DatePicker/index.tsx +12 -0
  8. package/src/components/FormGroup/__tests__/__snapshots__/index.spec.tsx.snap +880 -0
  9. package/src/components/FormGroup/__tests__/index.spec.tsx +179 -0
  10. package/src/components/FormGroup/__tests__/utils.spec.ts +73 -0
  11. package/src/components/FormGroup/index.tsx +97 -0
  12. package/src/components/FormGroup/utils.ts +67 -0
  13. package/src/components/RichTextEditor/EditorEvent.ts +7 -0
  14. package/src/components/RichTextEditor/EditorToolbar.tsx +216 -0
  15. package/src/components/RichTextEditor/MentionList.tsx +99 -0
  16. package/src/components/RichTextEditor/RichTextEditor.tsx +88 -0
  17. package/src/components/RichTextEditor/RichTextEditorInput.tsx +286 -0
  18. package/src/components/RichTextEditor/StyledRichTextEditor.tsx +18 -0
  19. package/src/components/RichTextEditor/StyledToolbar.ts +32 -0
  20. package/src/components/RichTextEditor/__mocks__/hero-editor.js +3 -0
  21. package/src/components/RichTextEditor/__mocks__/heroEditorApp.ts +2 -0
  22. package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +144 -0
  23. package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +105 -0
  24. package/src/components/RichTextEditor/__tests__/RichTextEditorInput.spec.tsx +136 -0
  25. package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +414 -0
  26. package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +13 -0
  27. package/src/components/RichTextEditor/constants.ts +9 -0
  28. package/src/{hero-editor.d.ts → components/RichTextEditor/hero-editor.d.ts} +6 -0
  29. package/src/components/RichTextEditor/heroEditorApp.ts +3 -0
  30. package/src/components/RichTextEditor/index.tsx +20 -0
  31. package/src/components/RichTextEditor/types.ts +87 -0
  32. package/src/components/RichTextEditor/utils/events.ts +31 -0
  33. package/src/components/RichTextEditor/utils/rnWebView.tsx +30 -0
  34. package/src/components/Select/__tests__/__snapshots__/index.spec.tsx.snap +1293 -0
  35. package/src/components/Select/__tests__/index.spec.tsx +43 -0
  36. package/src/components/TextInput/Group/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
  37. package/src/components/TextInput/InputComponent.tsx +59 -18
  38. package/src/components/TextInput/InputRow.tsx +13 -7
  39. package/src/components/TextInput/StyledTextInput.tsx +0 -1
  40. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +0 -17
  41. package/src/components/TextInput/index.tsx +20 -11
  42. package/src/components/TextInput/types.ts +29 -4
  43. package/src/components/TimePicker/__tests__/index.spec.tsx +34 -0
  44. package/src/components/TimePicker/index.tsx +12 -0
  45. package/src/index.ts +4 -1
  46. package/src/utils/functions.ts +2 -0
  47. package/stats/1.3.0/rn-work-uikit-stats.html +1 -1
  48. package/stats/1.4.0/rn-work-uikit-stats.html +4844 -0
  49. package/src/__tests__/theme-export-override.spec.ts +0 -96
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn-work-uikit",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -23,7 +23,8 @@
23
23
  "@emotion/native": "^11.9.3",
24
24
  "@emotion/primitives-core": "11.0.0",
25
25
  "@emotion/react": "^11.9.3",
26
- "@hero-design/rn": "^8.103.2"
26
+ "@hero-design/rn": "^8.103.5",
27
+ "hero-editor": "^1.15.5"
27
28
  },
28
29
  "peerDependencies": {
29
30
  "@hero-design/react-native-month-year-picker": "^8.43.1",
@@ -89,10 +90,10 @@
89
90
  "eslint-config-hd": "8.42.5",
90
91
  "eslint-config-prettier": "^8.5.0",
91
92
  "eslint-import-resolver-typescript": "^3.5.2",
92
- "eslint-plugin-import": "^2.26.0",
93
+ "eslint-plugin-import": "^2.32.0",
93
94
  "eslint-plugin-jsx-a11y": "^6.5.1",
94
95
  "eslint-plugin-prettier": "^4.0.0",
95
- "eslint-plugin-react": "^7.37.3",
96
+ "eslint-plugin-react": "^7.37.5",
96
97
  "eslint-plugin-react-hooks": "^4.3.0",
97
98
  "jest": "^29.2.1",
98
99
  "jest-environment-jsdom": "^29.2.1",
@@ -0,0 +1,64 @@
1
+ import * as Base from '@hero-design/rn';
2
+ import * as HD from '../index';
3
+ import TextInput from '../components/TextInput';
4
+ import Select from '../components/Select';
5
+ import DatePicker from '../components/DatePicker';
6
+ import TimePicker from '../components/TimePicker';
7
+ import { getTheme, theme } from '../index';
8
+
9
+ describe('index.ts exports', () => {
10
+ it('TextInput, Select, DatePicker, TimePicker should be custom rn-work-uikit versions', () => {
11
+ // Check that the exported components are not the same as the base ones
12
+ expect(HD.TextInput).not.toBe(Base.TextInput);
13
+ expect(HD.Select).not.toBe(Base.Select);
14
+ expect(HD.DatePicker).not.toBe(Base.DatePicker);
15
+ expect(HD.TimePicker).not.toBe(Base.TimePicker);
16
+ });
17
+
18
+ it('TextInput, Select, DatePicker, TimePicker should use the custom TextInput', () => {
19
+ // For TextInput, it's a direct export
20
+ expect(HD.TextInput).toBe(TextInput);
21
+ // For Select, DatePicker, TimePicker, check that they use the custom TextInput
22
+ // We can check the displayName or inspect the rendered output
23
+ // For DatePicker and TimePicker, check the TextInputComponent prop
24
+ // (We can't fully render without React Native, but we can check the implementation)
25
+ // These checks are mostly structural
26
+ expect(Select).toBe(HD.Select);
27
+ expect(DatePicker).toBe(HD.DatePicker);
28
+ expect(TimePicker).toBe(HD.TimePicker);
29
+ });
30
+ });
31
+
32
+ describe('Theme Export Override', () => {
33
+ it('should export work-specific theme with overridden textInput from index', () => {
34
+ // Check a few key values from the textInput override
35
+ expect(theme.__hd__.textInput.sizes.containerMinHeight).toBe(
36
+ 54.92307692307692
37
+ );
38
+ expect(theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight).toBe(
39
+ 0
40
+ );
41
+ expect(theme.__hd__.textInput.space.prefixAndInputContainerGap).toBe(
42
+ 3.9230769230769234
43
+ );
44
+ // Check that borderWidths.container.normal is overridden
45
+ expect(theme.__hd__.textInput.borderWidths.container.normal).toBe(2);
46
+ // Check that colors.borders.default is overridden
47
+ expect(theme.__hd__.textInput.colors.borders.default).toBe('#e8e9ea');
48
+ });
49
+
50
+ it('should export work-specific getTheme function with overridden textInput', () => {
51
+ const workTheme = getTheme();
52
+ expect(workTheme.__hd__.textInput.sizes.containerMinHeight).toBe(
53
+ 54.92307692307692
54
+ );
55
+ expect(
56
+ workTheme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight
57
+ ).toBe(0);
58
+ expect(workTheme.__hd__.textInput.space.prefixAndInputContainerGap).toBe(
59
+ 3.9230769230769234
60
+ );
61
+ expect(workTheme.__hd__.textInput.borderWidths.container.normal).toBe(2);
62
+ expect(workTheme.__hd__.textInput.colors.borders.default).toBe('#e8e9ea');
63
+ });
64
+ });