@core_super_app/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.
package/README.md CHANGED
@@ -1,37 +1,176 @@
1
- # @core/ui
1
+ # @core_super_app/ui
2
2
 
3
- Define common components for project
3
+ Thư viện UI component dùng chung cho ứng dụng React Native trong hệ sinh thái Super App.
4
4
 
5
- ## Installation
5
+ ## Tinh nang
6
6
 
7
+ - `BaseView`: layout khung trang + header + loading overlay
8
+ - `Header`: header co nut back, title/subtitle, right view
9
+ - `LoadingOverlay`: overlay loading toan man hinh
10
+ - `TextWrapper`: wrapper cho `Text` voi default style va accessibility
11
+ - `BasicButton`: button gradient co trang thai disabled
12
+ - `BasicInput`: input label dong, clear button, counter, imperative ref
13
+ - Export sang `ImageSrc` cho cac asset icon
7
14
 
8
- ```sh
9
- npm install @core/ui
15
+ ## Cai dat
16
+
17
+ ```bash
18
+ npm install @core_super_app/ui
19
+ ```
20
+
21
+ hoac
22
+
23
+ ```bash
24
+ yarn add @core_super_app/ui
25
+ ```
26
+
27
+ ## Yeu cau
28
+
29
+ - Node.js `v22.20.0` (xem `.nvmrc`)
30
+ - React Native `0.84.x`
31
+ - Peer ecosystem su dung trong source:
32
+ - `react-native-reanimated`
33
+ - `react-native-linear-gradient`
34
+ - `@react-navigation/native`
35
+ - `@core_super_app/utils`
36
+
37
+ ## Cac export chinh
38
+
39
+ Tu root package:
40
+
41
+ ```ts
42
+ import {
43
+ BaseView,
44
+ Header,
45
+ LoadingOverlay,
46
+ TextWrapper,
47
+ BasicButton,
48
+ BasicInput,
49
+ ImageSrc,
50
+ } from '@core_super_app/ui';
10
51
  ```
11
52
 
53
+ `src/index.tsx` hien tai export:
12
54
 
13
- ## Usage
55
+ - toan bo trong `components`
56
+ - namespace `ImageSrc` tu `constants/image`
14
57
 
58
+ ## Vi du su dung
15
59
 
16
- ```js
17
- import { multiply } from '@core/ui';
60
+ ### `BasicButton`
18
61
 
19
- // ...
62
+ ```tsx
63
+ import { BasicButton } from '@core_super_app/ui';
20
64
 
21
- const result = multiply(3, 7);
65
+ <BasicButton onPress={() => console.log('pressed')}>
66
+ Dang nhap
67
+ </BasicButton>;
22
68
  ```
23
69
 
70
+ ### `BasicInput` voi ref
71
+
72
+ ```tsx
73
+ import { useRef } from 'react';
74
+ import { BasicInput } from '@core_super_app/ui';
75
+
76
+ type InputRef = {
77
+ focus: () => void;
78
+ blur: () => void;
79
+ };
80
+
81
+ const inputRef = useRef<InputRef>(null);
82
+
83
+ <BasicInput
84
+ ref={inputRef}
85
+ label="So dien thoai"
86
+ value={phone}
87
+ onChange={setPhone}
88
+ showClearButton
89
+ />;
90
+ ```
91
+
92
+ ### `BaseView`
93
+
94
+ ```tsx
95
+ import { BaseView } from '@core_super_app/ui';
96
+
97
+ <BaseView
98
+ isLoading={loading}
99
+ back
100
+ title="Thong tin ca nhan"
101
+ >
102
+ {/* Screen content */}
103
+ </BaseView>;
104
+ ```
105
+
106
+ ## API tong quan
107
+
108
+ ### Components
109
+
110
+ - `BaseView`
111
+ - Props gom:
112
+ - `background`
113
+ - toan bo `HeaderProps`
114
+ - toan bo `LoadingOverlayProps`
115
+ - `Header`
116
+ - Props chinh:
117
+ - `back`, `leftIcon`, `onPressLeftIcon`
118
+ - `title`, `subTitle`, `titleStyle`, `titleMaxLines`
119
+ - `rightView`
120
+ - `disabledBackHandler`
121
+ - `LoadingOverlay`
122
+ - `isLoading?: boolean`
123
+ - `indicatorColor?: string`
124
+ - `TextWrapper`
125
+ - `children`, `style`, `numberOfLines`, `ellipsizeMode`, `onPress`, `testID`
126
+ - `BasicButton`
127
+ - `onPress`, `disabled`, `colors`, `style`, `textStyle`, `children`
128
+ - `BasicInput`
129
+ - Ho tro label animation, clear icon, char counter, regex replace input
130
+ - Ho tro imperative ref: `focus()` va `blur()`
131
+
132
+ ## Scripts
133
+
134
+ Trong `package.json`:
135
+
136
+ - `yarn clean` - xoa build artifacts
137
+ - `yarn prepare` - build package bang `react-native-builder-bob`
138
+ - `yarn typecheck` - kiem tra TypeScript
139
+ - `yarn lint` - lint source
140
+ - `yarn test` - chay Jest
141
+ - `yarn release` - bump version/publish qua `release-it`
142
+
143
+ ## CI
144
+
145
+ GitHub Actions (`.github/workflows/ci.yml`) dang chay:
146
+
147
+ - lint + typecheck
148
+ - unit test (coverage)
149
+ - build library
150
+ - build Android example (co turbo cache)
151
+ - build iOS example (co turbo cache)
152
+
153
+ ## Publishing
154
+
155
+ Package publish public len npm:
156
+
157
+ - `publishConfig.access = public`
158
+ - release command:
159
+
160
+ ```bash
161
+ yarn release
162
+ ```
163
+
164
+ Release flow su dung `release-it` + conventional changelog + git tag `v<version>`.
24
165
 
25
166
  ## Contributing
26
167
 
27
- - [Development workflow](CONTRIBUTING.md#development-workflow)
28
- - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
29
- - [Code of conduct](CODE_OF_CONDUCT.md)
168
+ - [Development workflow](./CONTRIBUTING.md#development-workflow)
169
+ - [Sending a pull request](./CONTRIBUTING.md#sending-a-pull-request)
170
+ - [Code of conduct](./CODE_OF_CONDUCT.md)
171
+
172
+ Commit message convention theo [Conventional Commits](https://www.conventionalcommits.org/).
30
173
 
31
174
  ## License
32
175
 
33
176
  MIT
34
-
35
- ---
36
-
37
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,eAAY;AAC1B,cAAc,aAAU;AACxB,cAAc,qBAAkB;AAChC,cAAc,kBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,kBAAe","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["components/index.tsx"],"mappings":";;AAAA,cAAc,eAAY;AAC1B,cAAc,aAAU;AACxB,cAAc,qBAAkB;AAChC,cAAc,kBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,kBAAe","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core_super_app/ui",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Define common components for project",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -37,7 +37,6 @@
37
37
  "!**/.*"
38
38
  ],
39
39
  "scripts": {
40
- "example": "yarn workspace @core/ui-example",
41
40
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
42
41
  "prepare": "bob build",
43
42
  "typecheck": "tsc",
File without changes