@hero-design/rn-work-uikit 1.9.5 → 1.10.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.
- package/CHANGELOG.md +21 -0
- package/README.md +219 -63
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +55337 -0
- package/lib/index.js +7173 -21259
- package/package.json +22 -22
- package/src/components/FormGroup/index.tsx +21 -10
- package/src/components/FormGroup/utils.ts +3 -3
- package/src/components/TextInput/InputRow.tsx +3 -6
- package/src/components/TextInput/index.tsx +4 -4
- package/src/components/TextInput/types.ts +4 -8
- package/types/index.d.ts +525 -0
- package/src/__tests__/index-export.spec.ts +0 -64
- package/src/__tests__/index.spec.tsx +0 -14
- package/src/components/DatePicker/__tests__/__snapshots__/index.spec.tsx.snap +0 -1649
- package/src/components/DatePicker/__tests__/index.spec.tsx +0 -56
- package/src/components/FormGroup/__tests__/__snapshots__/index.spec.tsx.snap +0 -908
- package/src/components/FormGroup/__tests__/index.spec.tsx +0 -319
- package/src/components/FormGroup/__tests__/utils.spec.ts +0 -73
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +0 -154
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +0 -105
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +0 -81
- package/src/components/RichTextEditor/__tests__/RichTextEditorInput.spec.tsx +0 -174
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +0 -407
- package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +0 -13
- package/src/components/Select/__tests__/__snapshots__/index.spec.tsx.snap +0 -1324
- package/src/components/Select/__tests__/index.spec.tsx +0 -43
- package/src/components/TextInput/__tests__/ErrorOrHelpText.spec.tsx +0 -20
- package/src/components/TextInput/__tests__/FloatingLabel.spec.tsx +0 -190
- package/src/components/TextInput/__tests__/InputComponent.spec.tsx +0 -41
- package/src/components/TextInput/__tests__/InputRow.spec.tsx +0 -233
- package/src/components/TextInput/__tests__/MaxLengthMessage.spec.tsx +0 -17
- package/src/components/TextInput/__tests__/PrefixComponent.spec.tsx +0 -14
- package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +0 -114
- package/src/components/TextInput/__tests__/SuffixComponent.spec.tsx +0 -20
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +0 -583
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +0 -5835
- package/src/components/TextInput/__tests__/getState.spec.tsx +0 -89
- package/src/components/TextInput/__tests__/index.spec.tsx +0 -679
- package/src/components/TimePicker/__tests__/index.spec.tsx +0 -34
- package/src/theme/__tests__/ThemeProvider.spec.tsx +0 -32
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +0 -2042
- package/src/theme/__tests__/index.spec.ts +0 -7
- package/src/utils/__tests__/helpers.spec.ts +0 -92
- package/stats/1.3.0/rn-work-uikit-stats.html +0 -4842
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @hero-design/rn-work-uikit
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4688](https://github.com/Thinkei/hero-design/pull/4688) [`3d2afde0f5db3e46a63fc12c5ef2984085022531`](https://github.com/Thinkei/hero-design/commit/3d2afde0f5db3e46a63fc12c5ef2984085022531) Thanks [@ttkien](https://github.com/ttkien)! - Upgrade react-native 0.81
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`3d2afde0f5db3e46a63fc12c5ef2984085022531`](https://github.com/Thinkei/hero-design/commit/3d2afde0f5db3e46a63fc12c5ef2984085022531)]:
|
|
12
|
+
- @hero-design/react-native-month-year-picker@8.44.0
|
|
13
|
+
- @hero-design/rn@9.0.0
|
|
14
|
+
|
|
15
|
+
## 1.9.6
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#4628](https://github.com/Thinkei/hero-design/pull/4628) [`16247abc62d3e7d4cc8b389fa524f71897709203`](https://github.com/Thinkei/hero-design/commit/16247abc62d3e7d4cc8b389fa524f71897709203) Thanks [@tqdungit](https://github.com/tqdungit)! - Add `.npmignore` published packages
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`16247abc62d3e7d4cc8b389fa524f71897709203`](https://github.com/Thinkei/hero-design/commit/16247abc62d3e7d4cc8b389fa524f71897709203)]:
|
|
22
|
+
- @hero-design/rn@8.115.1
|
|
23
|
+
|
|
3
24
|
## 1.9.5
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,103 +1,259 @@
|
|
|
1
1
|
# @hero-design/rn-work-uikit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This package provides a customized UI kit specifically for the EH Work application. It inherits all components from the base `@hero-design/rn` package and allows for EH Work-specific customizations without affecting other applications.
|
|
5
|
+
`@hero-design/rn-work-uikit` is an EH Work-specific UI component library built on top of `@hero-design/rn`. It re-exports all components from the base React Native library and provides EH Work-specific overrides for `TextInput`, `Select`, `DatePicker`, `TimePicker`, `FormGroup`, and `RichTextEditor` with custom styling, behavior, and theme configuration.
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# Install the main package
|
|
9
|
+
```sh
|
|
15
10
|
yarn add @hero-design/rn-work-uikit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Peer Dependencies:**
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
yarn add @
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
```sh
|
|
16
|
+
yarn add react@18.3.1 react-native@0.77.3
|
|
17
|
+
yarn add @hero-design/react-native-month-year-picker@^8.43.2
|
|
18
|
+
yarn add @ptomasroos/react-native-multi-slider@^2.2.2
|
|
19
|
+
yarn add @react-native-community/datetimepicker@^3.5.2
|
|
20
|
+
yarn add @react-native-community/slider@^4.5.1
|
|
21
|
+
yarn add react-native-gesture-handler@~2.20.2
|
|
22
|
+
yarn add react-native-linear-gradient@^2.8.3
|
|
23
|
+
yarn add react-native-pager-view@^6.7.0
|
|
24
|
+
yarn add react-native-safe-area-context@^4.7.0
|
|
25
|
+
yarn add react-native-svg@^15.11.2
|
|
26
|
+
yarn add react-native-vector-icons@^9.1.0
|
|
27
|
+
yarn add react-native-webview@^13.10.2
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
**
|
|
30
|
+
**Requirements:**
|
|
31
|
+
- React 18.3.1
|
|
32
|
+
- React Native 0.77.3
|
|
33
|
+
- Node.js >= 20.0.0 (20.19.5 recommended)
|
|
34
|
+
- Yarn >= 4.0.2 (enabled via Corepack: `corepack enable`)
|
|
35
|
+
- iOS Simulator (iPhone 14, iOS 18+) or Android Emulator (Pixel 6, API 30) for development
|
|
32
36
|
|
|
33
37
|
## Usage
|
|
34
38
|
|
|
39
|
+
### Basic Example
|
|
40
|
+
|
|
35
41
|
This package re-exports all components from `@hero-design/rn`, so you can use it as a drop-in replacement:
|
|
36
42
|
|
|
37
|
-
```
|
|
38
|
-
import
|
|
43
|
+
```tsx
|
|
44
|
+
import React from 'react';
|
|
45
|
+
import { ThemeSwitcher, Button, Card, Typography } from '@hero-design/rn-work-uikit';
|
|
39
46
|
|
|
40
|
-
function
|
|
47
|
+
function App() {
|
|
41
48
|
return (
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
<ThemeSwitcher name="ehWork">
|
|
50
|
+
<Card>
|
|
51
|
+
<Typography.Title>Welcome to EH Work</Typography.Title>
|
|
52
|
+
<Button text="Get Started" intent="primary" onPress={() => {}} />
|
|
53
|
+
</Card>
|
|
54
|
+
</ThemeSwitcher>
|
|
46
55
|
);
|
|
47
56
|
}
|
|
48
57
|
```
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
### Using Work Specific Components
|
|
51
60
|
|
|
52
|
-
|
|
61
|
+
EH Work-specific components are automatically available and override the base components:
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- `yarn type-check` - Run TypeScript type checking
|
|
57
|
-
- `yarn build` - Build the package
|
|
58
|
-
- `yarn build:watch` - Build in watch mode
|
|
63
|
+
```tsx
|
|
64
|
+
import { TextInput, Select, DatePicker, FormGroup } from '@hero-design/rn-work-uikit';
|
|
59
65
|
|
|
66
|
+
function WorkForm() {
|
|
67
|
+
return (
|
|
68
|
+
<FormGroup>
|
|
69
|
+
<TextInput
|
|
70
|
+
label="Employee Name"
|
|
71
|
+
placeholder="Enter name"
|
|
72
|
+
/>
|
|
73
|
+
<Select
|
|
74
|
+
label="Department"
|
|
75
|
+
options={[
|
|
76
|
+
{ value: 'engineering', label: 'Engineering' },
|
|
77
|
+
{ value: 'sales', label: 'Sales' },
|
|
78
|
+
]}
|
|
79
|
+
/>
|
|
80
|
+
<DatePicker
|
|
81
|
+
label="Start Date"
|
|
82
|
+
onDateChange={(date) => console.log(date)}
|
|
83
|
+
/>
|
|
84
|
+
</FormGroup>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
60
88
|
|
|
61
|
-
|
|
89
|
+
## Theming
|
|
62
90
|
|
|
63
|
-
|
|
91
|
+
The package includes a work-specific theme that extends the base `@hero-design/rn` theme with EH Work branding and customizations.
|
|
64
92
|
|
|
65
|
-
|
|
66
|
-
2. Export it from `src/index.ts`
|
|
67
|
-
3. Add tests for your component
|
|
93
|
+
### Basic Theme Usage
|
|
68
94
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
```tsx
|
|
96
|
+
import { ThemeSwitcher } from '@hero-design/rn-work-uikit';
|
|
97
|
+
|
|
98
|
+
function App() {
|
|
99
|
+
return (
|
|
100
|
+
<ThemeSwitcher name="ehWork">
|
|
101
|
+
{/* Your app components */}
|
|
102
|
+
</ThemeSwitcher>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Work Theme Customization
|
|
74
108
|
|
|
75
|
-
|
|
76
|
-
return <Button {...props} workTheme />;
|
|
77
|
-
};
|
|
109
|
+
The work theme includes EH Work-specific colors, typography, and component styles:
|
|
78
110
|
|
|
79
|
-
|
|
80
|
-
|
|
111
|
+
```tsx
|
|
112
|
+
import { ThemeProvider, getTheme, useTheme } from '@hero-design/rn-work-uikit';
|
|
113
|
+
import { styled } from '@emotion/native';
|
|
114
|
+
|
|
115
|
+
const StyledView = styled.View`
|
|
116
|
+
background-color: ${({ theme }) => theme.colors.defaultGlobalSurface};
|
|
117
|
+
padding: ${({ theme }) => theme.space.medium}px;
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
function MyComponent() {
|
|
121
|
+
const theme = useTheme();
|
|
122
|
+
return <StyledView>EH Work Content</StyledView>;
|
|
123
|
+
}
|
|
81
124
|
```
|
|
82
125
|
|
|
83
|
-
|
|
126
|
+
### Design Tokens
|
|
127
|
+
|
|
128
|
+
For comprehensive design tokens documentation and examples, visit the [Hero Design documentation site](https://design.employmenthero.com/mobile/intro) or explore the [rn-playground](https://github.com/Thinkei/hero-design/tree/master/apps/rn-playground) for interactive examples.
|
|
129
|
+
|
|
130
|
+
## Examples
|
|
131
|
+
|
|
132
|
+
### Enhanced TextInput
|
|
84
133
|
|
|
85
|
-
|
|
134
|
+
The work-specific `TextInput` includes additional features:
|
|
86
135
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
136
|
+
```tsx
|
|
137
|
+
import { TextInput } from '@hero-design/rn-work-uikit';
|
|
138
|
+
|
|
139
|
+
function FormExample() {
|
|
140
|
+
return (
|
|
141
|
+
<>
|
|
142
|
+
<TextInput
|
|
143
|
+
label="Email"
|
|
144
|
+
placeholder="Enter your email"
|
|
145
|
+
keyboardType="email-address"
|
|
146
|
+
autoCapitalize="none"
|
|
147
|
+
error="Invalid email"
|
|
148
|
+
helpText="We'll never share your email"
|
|
149
|
+
maxLength={100}
|
|
150
|
+
/>
|
|
151
|
+
<TextInput
|
|
152
|
+
label="Password"
|
|
153
|
+
placeholder="Enter password"
|
|
154
|
+
secureTextEntry
|
|
155
|
+
/>
|
|
156
|
+
</>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Rich Text Editor
|
|
162
|
+
|
|
163
|
+
The work-specific `RichTextEditor` provides rich text editing capabilities:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import { RichTextEditor } from '@hero-design/rn-work-uikit';
|
|
167
|
+
|
|
168
|
+
function CommentEditor() {
|
|
169
|
+
const [content, setContent] = useState([]);
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<RichTextEditor
|
|
173
|
+
name="comment-editor"
|
|
174
|
+
label="Comment"
|
|
175
|
+
value={content}
|
|
176
|
+
onChange={setContent}
|
|
177
|
+
placeholder="Write a comment..."
|
|
178
|
+
helpText="You can format your text"
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### FormGroup
|
|
185
|
+
|
|
186
|
+
The work-specific `FormGroup` provides consistent form layout:
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import { FormGroup, TextInput, Select, DatePicker } from '@hero-design/rn-work-uikit';
|
|
190
|
+
|
|
191
|
+
function EmployeeForm() {
|
|
192
|
+
return (
|
|
193
|
+
<FormGroup>
|
|
194
|
+
<TextInput label="First Name" />
|
|
195
|
+
<TextInput label="Last Name" />
|
|
196
|
+
<Select
|
|
197
|
+
label="Department"
|
|
198
|
+
options={[
|
|
199
|
+
{ value: 'eng', label: 'Engineering' },
|
|
200
|
+
{ value: 'sales', label: 'Sales' },
|
|
201
|
+
]}
|
|
202
|
+
/>
|
|
203
|
+
<DatePicker label="Hire Date" />
|
|
204
|
+
</FormGroup>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Using Base Components
|
|
210
|
+
|
|
211
|
+
All base components from `@hero-design/rn` are available:
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import {
|
|
215
|
+
Button,
|
|
216
|
+
Card,
|
|
217
|
+
Typography,
|
|
218
|
+
List,
|
|
219
|
+
ListItem,
|
|
220
|
+
Avatar,
|
|
221
|
+
Badge,
|
|
222
|
+
Modal,
|
|
223
|
+
BottomSheet,
|
|
224
|
+
Icon,
|
|
225
|
+
} from '@hero-design/rn-work-uikit';
|
|
226
|
+
|
|
227
|
+
function WorkApp() {
|
|
228
|
+
return (
|
|
229
|
+
<>
|
|
230
|
+
<Card>
|
|
231
|
+
<Typography.Title level={2}>EH Work Dashboard</Typography.Title>
|
|
232
|
+
<Button text="Action" intent="primary" onPress={() => {}} />
|
|
233
|
+
</Card>
|
|
234
|
+
<List>
|
|
235
|
+
<ListItem
|
|
236
|
+
left={<Avatar source={{ uri: 'avatar-url' }} />}
|
|
237
|
+
title="Employee Name"
|
|
238
|
+
subtitle="Department"
|
|
239
|
+
right={<Badge count={5} />}
|
|
240
|
+
/>
|
|
241
|
+
</List>
|
|
242
|
+
</>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
91
246
|
|
|
92
247
|
## Contributing
|
|
93
248
|
|
|
94
|
-
|
|
95
|
-
2. Add tests for new components
|
|
96
|
-
3. Update documentation for new features
|
|
97
|
-
4. Ensure all checks pass: `yarn test && yarn lint && yarn type-check`
|
|
249
|
+
Contributions to `@hero-design/rn-work-uikit` are welcome!
|
|
98
250
|
|
|
99
|
-
|
|
251
|
+
To get started:
|
|
100
252
|
|
|
101
|
-
|
|
102
|
-
|
|
253
|
+
1. Clone the repository: `git clone git@github.com:Thinkei/hero-design.git`
|
|
254
|
+
2. Enable Corepack: `corepack enable`
|
|
255
|
+
3. Install dependencies: `yarn install`
|
|
256
|
+
4. Build the package: `yarn turbo run build --filter=@hero-design/rn-work-uikit`
|
|
257
|
+
5. Run the playground: `yarn dev:rn`
|
|
103
258
|
|
|
259
|
+
For detailed contributing guidelines, see the main repository [Contributing documentation](https://design.employmenthero.com/mobile/Contributing/coContribution).
|
|
Binary file
|