@axelor/aos-mobile-ui 0.0.1
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 +234 -0
- package/lib/components/atoms/BlockInteractionScreen/BlockInteractionScreen.d.ts +7 -0
- package/lib/components/atoms/BlockInteractionScreen/BlockInteractionScreen.js +50 -0
- package/lib/components/atoms/BlockInteractionScreen/BlockInteractionScreen.js.map +1 -0
- package/lib/components/atoms/Card/Card.d.ts +6 -0
- package/lib/components/atoms/Card/Card.js +37 -0
- package/lib/components/atoms/Card/Card.js.map +1 -0
- package/lib/components/atoms/DottedLine/DottedLine.d.ts +5 -0
- package/lib/components/atoms/DottedLine/DottedLine.js +38 -0
- package/lib/components/atoms/DottedLine/DottedLine.js.map +1 -0
- package/lib/components/atoms/HorizontalRule/HorizontalRule.d.ts +5 -0
- package/lib/components/atoms/HorizontalRule/HorizontalRule.js +35 -0
- package/lib/components/atoms/HorizontalRule/HorizontalRule.js.map +1 -0
- package/lib/components/atoms/HtmlInput/HtmlInput.d.ts +9 -0
- package/lib/components/atoms/HtmlInput/HtmlInput.js +50 -0
- package/lib/components/atoms/HtmlInput/HtmlInput.js.map +1 -0
- package/lib/components/atoms/Icon/Icon.d.ts +13 -0
- package/lib/components/atoms/Icon/Icon.js +49 -0
- package/lib/components/atoms/Icon/Icon.js.map +1 -0
- package/lib/components/atoms/Input/Input.d.ts +18 -0
- package/lib/components/atoms/Input/Input.js +37 -0
- package/lib/components/atoms/Input/Input.js.map +1 -0
- package/lib/components/atoms/RenderHtml/RenderHtml.d.ts +6 -0
- package/lib/components/atoms/RenderHtml/RenderHtml.js +50 -0
- package/lib/components/atoms/RenderHtml/RenderHtml.js.map +1 -0
- package/lib/components/atoms/Screen/Screen.d.ts +9 -0
- package/lib/components/atoms/Screen/Screen.js +74 -0
- package/lib/components/atoms/Screen/Screen.js.map +1 -0
- package/lib/components/atoms/ScrollView/ScrollView.d.ts +6 -0
- package/lib/components/atoms/ScrollView/ScrollView.js +33 -0
- package/lib/components/atoms/ScrollView/ScrollView.js.map +1 -0
- package/lib/components/atoms/Switch/Switch.d.ts +6 -0
- package/lib/components/atoms/Switch/Switch.js +34 -0
- package/lib/components/atoms/Switch/Switch.js.map +1 -0
- package/lib/components/atoms/Text/Text.d.ts +12 -0
- package/lib/components/atoms/Text/Text.js +37 -0
- package/lib/components/atoms/Text/Text.js.map +1 -0
- package/lib/components/atoms/index.d.ts +12 -0
- package/lib/components/atoms/index.js +30 -0
- package/lib/components/atoms/index.js.map +1 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +21 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/molecules/AttachmentCard/AttachmentCard.d.ts +8 -0
- package/lib/components/molecules/AttachmentCard/AttachmentCard.js +61 -0
- package/lib/components/molecules/AttachmentCard/AttachmentCard.js.map +1 -0
- package/lib/components/molecules/Badge/Badge.d.ts +10 -0
- package/lib/components/molecules/Badge/Badge.js +43 -0
- package/lib/components/molecules/Badge/Badge.js.map +1 -0
- package/lib/components/molecules/Button/Button.d.ts +10 -0
- package/lib/components/molecules/Button/Button.js +48 -0
- package/lib/components/molecules/Button/Button.js.map +1 -0
- package/lib/components/molecules/CardIconButton/CardIconButton.d.ts +8 -0
- package/lib/components/molecules/CardIconButton/CardIconButton.js +42 -0
- package/lib/components/molecules/CardIconButton/CardIconButton.js.map +1 -0
- package/lib/components/molecules/Chip/Chip.d.ts +11 -0
- package/lib/components/molecules/Chip/Chip.js +69 -0
- package/lib/components/molecules/Chip/Chip.js.map +1 -0
- package/lib/components/molecules/ClearableCard/ClearableCard.d.ts +8 -0
- package/lib/components/molecules/ClearableCard/ClearableCard.js +43 -0
- package/lib/components/molecules/ClearableCard/ClearableCard.js.map +1 -0
- package/lib/components/molecules/DropdownCard/DropdownCard.d.ts +10 -0
- package/lib/components/molecules/DropdownCard/DropdownCard.js +84 -0
- package/lib/components/molecules/DropdownCard/DropdownCard.js.map +1 -0
- package/lib/components/molecules/DropdownMenu/DropdownMenu.d.ts +5 -0
- package/lib/components/molecules/DropdownMenu/DropdownMenu.js +57 -0
- package/lib/components/molecules/DropdownMenu/DropdownMenu.js.map +1 -0
- package/lib/components/molecules/DropdownMenuItem/DropdownMenuItem.d.ts +7 -0
- package/lib/components/molecules/DropdownMenuItem/DropdownMenuItem.js +42 -0
- package/lib/components/molecules/DropdownMenuItem/DropdownMenuItem.js.map +1 -0
- package/lib/components/molecules/EditableInput/EditableInput.d.ts +9 -0
- package/lib/components/molecules/EditableInput/EditableInput.js +65 -0
- package/lib/components/molecules/EditableInput/EditableInput.js.map +1 -0
- package/lib/components/molecules/FromTo/FromTo.d.ts +8 -0
- package/lib/components/molecules/FromTo/FromTo.js +44 -0
- package/lib/components/molecules/FromTo/FromTo.js.map +1 -0
- package/lib/components/molecules/HalfLabelCard/HalfLabelCard.d.ts +8 -0
- package/lib/components/molecules/HalfLabelCard/HalfLabelCard.js +51 -0
- package/lib/components/molecules/HalfLabelCard/HalfLabelCard.js.map +1 -0
- package/lib/components/molecules/HeaderIndicator/HeaderIndicator.d.ts +2 -0
- package/lib/components/molecules/HeaderIndicator/HeaderIndicator.js +65 -0
- package/lib/components/molecules/HeaderIndicator/HeaderIndicator.js.map +1 -0
- package/lib/components/molecules/IconButton/IconButton.d.ts +11 -0
- package/lib/components/molecules/IconButton/IconButton.js +48 -0
- package/lib/components/molecules/IconButton/IconButton.js.map +1 -0
- package/lib/components/molecules/IconInput/IconInput.d.ts +19 -0
- package/lib/components/molecules/IconInput/IconInput.js +50 -0
- package/lib/components/molecules/IconInput/IconInput.js.map +1 -0
- package/lib/components/molecules/Image/Image.d.ts +10 -0
- package/lib/components/molecules/Image/Image.js +36 -0
- package/lib/components/molecules/Image/Image.js.map +1 -0
- package/lib/components/molecules/Increment/Increment.d.ts +8 -0
- package/lib/components/molecules/Increment/Increment.js +97 -0
- package/lib/components/molecules/Increment/Increment.js.map +1 -0
- package/lib/components/molecules/InfoBubble/InfoBubble.d.ts +9 -0
- package/lib/components/molecules/InfoBubble/InfoBubble.js +73 -0
- package/lib/components/molecules/InfoBubble/InfoBubble.js.map +1 -0
- package/lib/components/molecules/LabelText/LabelText.d.ts +14 -0
- package/lib/components/molecules/LabelText/LabelText.js +45 -0
- package/lib/components/molecules/LabelText/LabelText.js.map +1 -0
- package/lib/components/molecules/LoadingIndicator/LoadingIndicator.d.ts +6 -0
- package/lib/components/molecules/LoadingIndicator/LoadingIndicator.js +49 -0
- package/lib/components/molecules/LoadingIndicator/LoadingIndicator.js.map +1 -0
- package/lib/components/molecules/MessageBox/MessageBox.d.ts +9 -0
- package/lib/components/molecules/MessageBox/MessageBox.js +60 -0
- package/lib/components/molecules/MessageBox/MessageBox.js.map +1 -0
- package/lib/components/molecules/MovementIndicationCard/MovementIndicationCard.d.ts +14 -0
- package/lib/components/molecules/MovementIndicationCard/MovementIndicationCard.js +66 -0
- package/lib/components/molecules/MovementIndicationCard/MovementIndicationCard.js.map +1 -0
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.d.ts +11 -0
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.js +80 -0
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.js.map +1 -0
- package/lib/components/molecules/NotesCard/NotesCard.d.ts +6 -0
- package/lib/components/molecules/NotesCard/NotesCard.js +55 -0
- package/lib/components/molecules/NotesCard/NotesCard.js.map +1 -0
- package/lib/components/molecules/PopUp/PopUp.d.ts +9 -0
- package/lib/components/molecules/PopUp/PopUp.js +74 -0
- package/lib/components/molecules/PopUp/PopUp.js.map +1 -0
- package/lib/components/molecules/RightIconButton/RightIconButton.d.ts +10 -0
- package/lib/components/molecules/RightIconButton/RightIconButton.js +49 -0
- package/lib/components/molecules/RightIconButton/RightIconButton.js.map +1 -0
- package/lib/components/molecules/SelectionContainer/SelectionContainer.d.ts +11 -0
- package/lib/components/molecules/SelectionContainer/SelectionContainer.js +111 -0
- package/lib/components/molecules/SelectionContainer/SelectionContainer.js.map +1 -0
- package/lib/components/molecules/StarScore/StarScore.d.ts +11 -0
- package/lib/components/molecules/StarScore/StarScore.js +58 -0
- package/lib/components/molecules/StarScore/StarScore.js.map +1 -0
- package/lib/components/molecules/SwitchCard/SwitchCard.d.ts +8 -0
- package/lib/components/molecules/SwitchCard/SwitchCard.js +31 -0
- package/lib/components/molecules/SwitchCard/SwitchCard.js.map +1 -0
- package/lib/components/molecules/TitledValue/TitledValue.d.ts +7 -0
- package/lib/components/molecules/TitledValue/TitledValue.js +40 -0
- package/lib/components/molecules/TitledValue/TitledValue.js.map +1 -0
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.d.ts +8 -0
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.js +66 -0
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.js.map +1 -0
- package/lib/components/molecules/UnorderedList/UnorderedList.d.ts +8 -0
- package/lib/components/molecules/UnorderedList/UnorderedList.js +51 -0
- package/lib/components/molecules/UnorderedList/UnorderedList.js.map +1 -0
- package/lib/components/molecules/ViewAllContainer/ViewAllContainer.d.ts +14 -0
- package/lib/components/molecules/ViewAllContainer/ViewAllContainer.js +91 -0
- package/lib/components/molecules/ViewAllContainer/ViewAllContainer.js.map +1 -0
- package/lib/components/molecules/index.d.ts +33 -0
- package/lib/components/molecules/index.js +51 -0
- package/lib/components/molecules/index.js.map +1 -0
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.d.ts +19 -0
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.js +148 -0
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.js.map +1 -0
- package/lib/components/organisms/ChipSelect/ChipSelect.d.ts +6 -0
- package/lib/components/organisms/ChipSelect/ChipSelect.js +39 -0
- package/lib/components/organisms/ChipSelect/ChipSelect.js.map +1 -0
- package/lib/components/organisms/DropdownCardSwitch/DropdownCardSwitch.d.ts +12 -0
- package/lib/components/organisms/DropdownCardSwitch/DropdownCardSwitch.js +40 -0
- package/lib/components/organisms/DropdownCardSwitch/DropdownCardSwitch.js.map +1 -0
- package/lib/components/organisms/HeaderContainer/HeaderContainer.d.ts +9 -0
- package/lib/components/organisms/HeaderContainer/HeaderContainer.js +65 -0
- package/lib/components/organisms/HeaderContainer/HeaderContainer.js.map +1 -0
- package/lib/components/organisms/ImageBubble/ImageBubble.d.ts +10 -0
- package/lib/components/organisms/ImageBubble/ImageBubble.js +105 -0
- package/lib/components/organisms/ImageBubble/ImageBubble.js.map +1 -0
- package/lib/components/organisms/MultiValuePicker/MultiValuePicker.d.ts +16 -0
- package/lib/components/organisms/MultiValuePicker/MultiValuePicker.js +103 -0
- package/lib/components/organisms/MultiValuePicker/MultiValuePicker.js.map +1 -0
- package/lib/components/organisms/Picker/Picker.d.ts +18 -0
- package/lib/components/organisms/Picker/Picker.js +101 -0
- package/lib/components/organisms/Picker/Picker.js.map +1 -0
- package/lib/components/organisms/PopUpOneButton/PopUpOneButton.d.ts +9 -0
- package/lib/components/organisms/PopUpOneButton/PopUpOneButton.js +35 -0
- package/lib/components/organisms/PopUpOneButton/PopUpOneButton.js.map +1 -0
- package/lib/components/organisms/PopUpTwoButton/PopUpTwoButton.d.ts +11 -0
- package/lib/components/organisms/PopUpTwoButton/PopUpTwoButton.js +38 -0
- package/lib/components/organisms/PopUpTwoButton/PopUpTwoButton.js.map +1 -0
- package/lib/components/organisms/ScrollList/ScrollList.d.ts +13 -0
- package/lib/components/organisms/ScrollList/ScrollList.js +70 -0
- package/lib/components/organisms/ScrollList/ScrollList.js.map +1 -0
- package/lib/components/organisms/SearchBar/SearchBar.d.ts +14 -0
- package/lib/components/organisms/SearchBar/SearchBar.js +44 -0
- package/lib/components/organisms/SearchBar/SearchBar.js.map +1 -0
- package/lib/components/organisms/index.d.ts +11 -0
- package/lib/components/organisms/index.js +29 -0
- package/lib/components/organisms/index.js.map +1 -0
- package/lib/config/ConfigContext.d.ts +26 -0
- package/lib/config/ConfigContext.js +184 -0
- package/lib/config/ConfigContext.js.map +1 -0
- package/lib/hooks/use-click-outside.d.ts +6 -0
- package/lib/hooks/use-click-outside.helper.d.ts +10 -0
- package/lib/hooks/use-click-outside.helper.js +35 -0
- package/lib/hooks/use-click-outside.helper.js.map +1 -0
- package/lib/hooks/use-click-outside.js +123 -0
- package/lib/hooks/use-click-outside.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +26 -0
- package/lib/index.js.map +1 -0
- package/lib/theme/ThemeContext.d.ts +19 -0
- package/lib/theme/ThemeContext.js +110 -0
- package/lib/theme/ThemeContext.js.map +1 -0
- package/lib/theme/WritingThemeContext.d.ts +10 -0
- package/lib/theme/WritingThemeContext.js +77 -0
- package/lib/theme/WritingThemeContext.js.map +1 -0
- package/lib/theme/index.d.ts +4 -0
- package/lib/theme/index.js +22 -0
- package/lib/theme/index.js.map +1 -0
- package/lib/theme/themes.d.ts +32 -0
- package/lib/theme/themes.js +178 -0
- package/lib/theme/themes.js.map +1 -0
- package/lib/theme/writingTheme.d.ts +19 -0
- package/lib/theme/writingTheme.js +45 -0
- package/lib/theme/writingTheme.js.map +1 -0
- package/lib/tools/AnimationUtil.d.ts +12 -0
- package/lib/tools/AnimationUtil.js +40 -0
- package/lib/tools/AnimationUtil.js.map +1 -0
- package/lib/types/file.d.ts +5 -0
- package/lib/types/file.js +62 -0
- package/lib/types/file.js.map +1 -0
- package/lib/utils/arrays.d.ts +2 -0
- package/lib/utils/arrays.js +31 -0
- package/lib/utils/arrays.js.map +1 -0
- package/lib/utils/commons-styles.d.ts +34 -0
- package/lib/utils/commons-styles.js +53 -0
- package/lib/utils/commons-styles.js.map +1 -0
- package/lib/utils/formatters.d.ts +2 -0
- package/lib/utils/formatters.js +48 -0
- package/lib/utils/formatters.js.map +1 -0
- package/lib/utils/headerStyle.d.ts +12 -0
- package/lib/utils/headerStyle.js +31 -0
- package/lib/utils/headerStyle.js.map +1 -0
- package/lib/utils/list.d.ts +2 -0
- package/lib/utils/list.js +47 -0
- package/lib/utils/list.js.map +1 -0
- package/lib/utils/number.d.ts +4 -0
- package/lib/utils/number.js +34 -0
- package/lib/utils/number.js.map +1 -0
- package/lib/utils/strings.d.ts +2 -0
- package/lib/utils/strings.js +33 -0
- package/lib/utils/strings.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<h1 align="center">@axelor/aos-mobile-ui</h1>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://i.imgur.com/KJAAFlT.png" width="30%"/>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
## Presentation
|
|
8
|
+
|
|
9
|
+
This package was developed for the [Axelor Open Mobile](https://github.com/axelor/axelor-mobile) application.
|
|
10
|
+
|
|
11
|
+
It contains:
|
|
12
|
+
- Basic components to create screens
|
|
13
|
+
- Themes management system with basic light theme and a color blind theme
|
|
14
|
+
- Writing themes management system with basic theme
|
|
15
|
+
- UseOutsideClick hook to notify components when the user clicked outside of itself
|
|
16
|
+
- Basic animation tools
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Install the library :
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @axelor/aos-mobile-ui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Compatibility with React v18.2.x and React Native v0.68.x.
|
|
27
|
+
|
|
28
|
+
This package has a few required libraries as peer dependencies:
|
|
29
|
+
|
|
30
|
+
- [react-native-vector-icons](https://www.npmjs.com/package/react-native-vector-icons)
|
|
31
|
+
- [react-native-system-navigation-bar](https://www.npmjs.com/package/react-native-system-navigation-bar)
|
|
32
|
+
- [react-native-pell-rich-editor](https://www.npmjs.com/package/react-native-pell-rich-editor)
|
|
33
|
+
|
|
34
|
+
### Use of basic components
|
|
35
|
+
|
|
36
|
+
You can import components from the main bundle:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import {Button} from '@axelor/aos-mobile-ui';
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then, you can use it as a regular component with the specified props :
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
<Button title="Save" onPress={() => console.log('Pressed')} />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Use themes management system
|
|
49
|
+
|
|
50
|
+
This package provides a context to manage themes system. To use this context you need to wrap your application with the ThemeProvider component. You can also define additional themes and the default theme value through the component props:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { ThemeProvider } from '@axelor/aos-mobile-ui';
|
|
54
|
+
|
|
55
|
+
...
|
|
56
|
+
|
|
57
|
+
<ThemeProvider themes={themes} defaultTheme={defaultTheme}>
|
|
58
|
+
...
|
|
59
|
+
</ThemeProvider>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
A theme in the application has the following structure:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
export interface Theme {
|
|
66
|
+
key: string;
|
|
67
|
+
name: string;
|
|
68
|
+
colors: ThemeColors;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ThemeColors {
|
|
72
|
+
screenBackgroundColor: string;
|
|
73
|
+
backgroundColor: string;
|
|
74
|
+
primaryColor: Color;
|
|
75
|
+
secondaryColor: Color;
|
|
76
|
+
secondaryColor_dark: Color;
|
|
77
|
+
errorColor: Color;
|
|
78
|
+
cautionColor: Color;
|
|
79
|
+
plannedColor: Color;
|
|
80
|
+
progressColor: Color;
|
|
81
|
+
priorityColor: Color;
|
|
82
|
+
defaultColor: Color;
|
|
83
|
+
importantColor: Color;
|
|
84
|
+
successColor: Color;
|
|
85
|
+
warningColor: Color;
|
|
86
|
+
inverseColor: Color;
|
|
87
|
+
infoColor: Color;
|
|
88
|
+
text: string;
|
|
89
|
+
placeholderTextColor: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface Color {
|
|
93
|
+
background_light: string; // This color is a lighter variation of the main color
|
|
94
|
+
foreground: string; // This color is mainly used for text to maintain a good contrast with the background color
|
|
95
|
+
background: string; // This is the main color for this structure
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Once the context is in place, you can access current theme colors with the hook `useThemeColor`. Then, you can use the colors directly in your components:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { Button, useThemeColor } from '@axelor/aos-mobile-ui';
|
|
103
|
+
|
|
104
|
+
...
|
|
105
|
+
|
|
106
|
+
const Colors = useThemeColor();
|
|
107
|
+
|
|
108
|
+
...
|
|
109
|
+
<Button
|
|
110
|
+
title="Save"
|
|
111
|
+
color={Colors.primaryColor}
|
|
112
|
+
onPress={() => console.log("Pressed")}
|
|
113
|
+
/>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Use writing themes management system
|
|
117
|
+
|
|
118
|
+
Writing themes management system is based on the same structure as theme system defined above with a context provider called `WritingThemeProvider`.
|
|
119
|
+
|
|
120
|
+
A writing theme in the application has the following structure:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
export interface Writing {
|
|
124
|
+
key: string;
|
|
125
|
+
name: string;
|
|
126
|
+
style: WritingStyles;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface WritingStyles {
|
|
130
|
+
defaultSize: number;
|
|
131
|
+
title: TextStyle;
|
|
132
|
+
subTitle: TextStyle;
|
|
133
|
+
textImportant: TextStyle;
|
|
134
|
+
textDetails: TextStyle;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface TextStyle {
|
|
138
|
+
fontSize?: number;
|
|
139
|
+
fontWeight?: 'normal' | 'bold';
|
|
140
|
+
fontStyle?: 'normal' | 'italic';
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Once the context is in place, you can access the current theme with the hook `useWritingStyle`. Then, you can use the writing styles directly in your components:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { Text, useWritingStyle } from '@axelor/aos-mobile-ui';
|
|
148
|
+
|
|
149
|
+
...
|
|
150
|
+
|
|
151
|
+
const Writing = useWritingStyle();
|
|
152
|
+
|
|
153
|
+
...
|
|
154
|
+
<Text style={Writing.title}>Hello World</Text>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Use outside click notifier
|
|
158
|
+
|
|
159
|
+
This package provides a context provider to notify components when the user clicks out, this provider is called `OutsideAlerterProvider` and should wrap the application component.
|
|
160
|
+
|
|
161
|
+
Once the context is in place, you can ask to be notified in the component by using the hook `useClickOutside`. This hook needs the reference of the global view of your component and a boolean to know if the component is active:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import { OUTSIDE_INDICATOR, useClickOutside } from '@axelor/aos-mobile-ui';
|
|
165
|
+
|
|
166
|
+
...
|
|
167
|
+
|
|
168
|
+
const ComponentName = (...) => {
|
|
169
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
170
|
+
const wrapperRef = useRef(null);
|
|
171
|
+
const clickOutside = useClickOutside({wrapperRef, visible: isOpen});
|
|
172
|
+
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
if (clickOutside === OUTSIDE_INDICATOR && isOpen) {
|
|
175
|
+
setIsOpen(false);
|
|
176
|
+
}
|
|
177
|
+
}, [clickOutside, isOpen]);
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<View ref={wrapperRef}>
|
|
181
|
+
...
|
|
182
|
+
</View>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Use animation tools
|
|
188
|
+
|
|
189
|
+
This package provides basic tools to create animation in your application.
|
|
190
|
+
|
|
191
|
+
All you have to do is to call the method `animateNext` from the object `animationUtil`. This method can take the animation config as an optional parameter or nothing. If nothing is provided, it will use the default config defined in the package:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
{
|
|
195
|
+
easeInEaseOut: LayoutAnimation.Presets.easeInEaseOut,
|
|
196
|
+
linear: LayoutAnimation.Presets.linear,
|
|
197
|
+
spring: LayoutAnimation.Presets.spring,
|
|
198
|
+
};
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
For example, if you want to animate the appearance and disappearance of a component children:
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import { animationUtil, Icon, useThemeColor } from '@axelor/aos-mobile-ui';
|
|
205
|
+
|
|
206
|
+
...
|
|
207
|
+
|
|
208
|
+
const ComponentName = ({children}) => {
|
|
209
|
+
const [isVisible, setVisible] = useState(true);
|
|
210
|
+
const Colors = useThemeColor();
|
|
211
|
+
|
|
212
|
+
const handleExpandPress = useCallback(() => {
|
|
213
|
+
animationUtil.animateNext();
|
|
214
|
+
setVisible(!isVisible);
|
|
215
|
+
}, [isVisible]);
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<View>
|
|
219
|
+
{isVisible && children}
|
|
220
|
+
<TouchableOpacity onPress={handleExpandPress}>
|
|
221
|
+
<Icon
|
|
222
|
+
name={isVisible ? 'angle-up' : 'angle-down'}
|
|
223
|
+
size={22}
|
|
224
|
+
color={Colors.primaryColor.background}
|
|
225
|
+
/>
|
|
226
|
+
</TouchableOpacity>
|
|
227
|
+
</View>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Developpment
|
|
233
|
+
|
|
234
|
+
This package is developed as part of the Axelor Open Mobile application. To contribute, please go to the [Github project](https://github.com/axelor/axelor-mobile) and follow the guidelines. You will also find an installation guide to help you configure your environment.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface BlockInteractionScreenProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
hideHeader?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const BlockInteractionScreen: ({ children, hideHeader, }: BlockInteractionScreenProps) => JSX.Element;
|
|
7
|
+
export default BlockInteractionScreen;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
20
|
+
import { useConfig } from '../../../config/ConfigContext';
|
|
21
|
+
const DEFAULT_TOP_OFFSET = 0;
|
|
22
|
+
const BlockInteractionScreen = ({ children, hideHeader = false, }) => {
|
|
23
|
+
const { headerHeight } = useConfig();
|
|
24
|
+
const styles = useMemo(() => getStyles(hideHeader ? DEFAULT_TOP_OFFSET : headerHeight), [headerHeight, hideHeader]);
|
|
25
|
+
return (<View style={styles.container}>
|
|
26
|
+
<View style={styles.greyCard}/>
|
|
27
|
+
{children}
|
|
28
|
+
</View>);
|
|
29
|
+
};
|
|
30
|
+
const getStyles = topOffset => StyleSheet.create({
|
|
31
|
+
container: {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
top: topOffset,
|
|
34
|
+
left: 0,
|
|
35
|
+
zIndex: 999,
|
|
36
|
+
},
|
|
37
|
+
greyCard: {
|
|
38
|
+
marginTop: 15,
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
backgroundColor: 'grey',
|
|
42
|
+
opacity: 0.2,
|
|
43
|
+
height: Dimensions.get('window').height * 2,
|
|
44
|
+
top: -50,
|
|
45
|
+
width: Dimensions.get('window').width,
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
export default BlockInteractionScreen;
|
|
50
|
+
//# sourceMappingURL=BlockInteractionScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockInteractionScreen.js","sourceRoot":"","sources":["../../../../src/components/atoms/BlockInteractionScreen/BlockInteractionScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAY,OAAO,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AAOxD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,sBAAsB,GAAG,CAAC,EAC9B,QAAQ,EACR,UAAU,GAAG,KAAK,GACU,EAAE,EAAE;IAChC,MAAM,EAAC,YAAY,EAAC,GAAG,SAAS,EAAE,CAAC;IAEnC,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,YAAY,CAAC,EAC/D,CAAC,YAAY,EAAE,UAAU,CAAC,CAC3B,CAAC;IAEF,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAC7B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,SAAS,CAAC,EAAE,CAC5B,UAAU,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,GAAG;KACZ;IACD,QAAQ,EAAE;QACR,SAAS,EAAE,EAAE;QACb,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,MAAM;QACvB,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC;QAC3C,GAAG,EAAE,CAAC,EAAE;QACR,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK;QACrC,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC;AAEL,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { StyleSheet, View } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
21
|
+
const Card = ({ style, children }) => {
|
|
22
|
+
const Colors = useThemeColor();
|
|
23
|
+
const styles = useMemo(() => getStyles(Colors), [Colors]);
|
|
24
|
+
return <View style={[styles.container, style]}>{children}</View>;
|
|
25
|
+
};
|
|
26
|
+
const getStyles = Colors => StyleSheet.create({
|
|
27
|
+
container: {
|
|
28
|
+
paddingHorizontal: 24,
|
|
29
|
+
paddingRight: 32,
|
|
30
|
+
paddingVertical: 16,
|
|
31
|
+
borderRadius: 14,
|
|
32
|
+
elevation: 3,
|
|
33
|
+
backgroundColor: Colors.backgroundColor,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export default Card;
|
|
37
|
+
//# sourceMappingURL=Card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../../src/components/atoms/Card/Card.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAO1D,MAAM,IAAI,GAAG,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAY,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CACzB,UAAU,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,EAAE;QACnB,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,CAAC;QACZ,eAAe,EAAE,MAAM,CAAC,eAAe;KACxC;CACF,CAAC,CAAC;AAEL,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { View, StyleSheet } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
21
|
+
function DottedLine({ style }) {
|
|
22
|
+
const Colors = useThemeColor();
|
|
23
|
+
const styles = useMemo(() => getStyles(Colors), [Colors]);
|
|
24
|
+
return <View style={[styles.dottedLine, style]}/>;
|
|
25
|
+
}
|
|
26
|
+
const getStyles = Colors => StyleSheet.create({
|
|
27
|
+
dottedLine: {
|
|
28
|
+
borderStyle: 'dotted',
|
|
29
|
+
height: 35,
|
|
30
|
+
borderLeftWidth: 2,
|
|
31
|
+
borderColor: Colors.secondaryColor_dark.background,
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
export default DottedLine;
|
|
38
|
+
//# sourceMappingURL=DottedLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DottedLine.js","sourceRoot":"","sources":["../../../../src/components/atoms/DottedLine/DottedLine.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAM1D,SAAS,UAAU,CAAC,EAAC,KAAK,EAAkB;IAC1C,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,EAAG,CAAC;AACrD,CAAC;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CACzB,UAAU,CAAC,MAAM,CAAC;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,QAAQ;QACrB,MAAM,EAAE,EAAE;QACV,eAAe,EAAE,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC,mBAAmB,CAAC,UAAU;QAClD,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC,CAAC;AAEL,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { View, StyleSheet } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
21
|
+
const HorizontalRule = ({ style }) => {
|
|
22
|
+
const Colors = useThemeColor();
|
|
23
|
+
const styles = useMemo(() => {
|
|
24
|
+
return getStyles(Colors);
|
|
25
|
+
}, [Colors]);
|
|
26
|
+
return <View style={[styles.line, style]}/>;
|
|
27
|
+
};
|
|
28
|
+
const getStyles = Colors => StyleSheet.create({
|
|
29
|
+
line: {
|
|
30
|
+
borderBottomColor: Colors.secondaryColor.background,
|
|
31
|
+
borderBottomWidth: 1,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export default HorizontalRule;
|
|
35
|
+
//# sourceMappingURL=HorizontalRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalRule.js","sourceRoot":"","sources":["../../../../src/components/atoms/HorizontalRule/HorizontalRule.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAM1D,MAAM,cAAc,GAAG,CAAC,EAAC,KAAK,EAAsB,EAAE,EAAE;IACtD,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAG,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CACzB,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU;QACnD,iBAAiB,EAAE,CAAC;KACrB;CACF,CAAC,CAAC;AAEL,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface HtmlInputProps {
|
|
2
|
+
style?: any;
|
|
3
|
+
styleToolbar?: any;
|
|
4
|
+
title?: string;
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
defaultInput?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const HtmlInput: ({ style, styleToolbar, title, onChange, defaultInput, }: HtmlInputProps) => JSX.Element;
|
|
9
|
+
export default HtmlInput;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useRef } from 'react';
|
|
19
|
+
import { View, ScrollView } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
21
|
+
import { actions, RichEditor, RichToolbar } from 'react-native-pell-rich-editor';
|
|
22
|
+
import Text from '../Text/Text';
|
|
23
|
+
const HtmlInput = ({ style, styleToolbar, title = '', onChange = () => { }, defaultInput = '', }) => {
|
|
24
|
+
const Colors = useThemeColor();
|
|
25
|
+
const richText = useRef();
|
|
26
|
+
return (<ScrollView>
|
|
27
|
+
<ScrollView style={[style]}>
|
|
28
|
+
<View>
|
|
29
|
+
<Text>{title}</Text>
|
|
30
|
+
<RichEditor ref={richText} androidHardwareAccelerationDisabled={true} initialContentHTML={defaultInput} onChange={onChange}/>
|
|
31
|
+
</View>
|
|
32
|
+
</ScrollView>
|
|
33
|
+
<RichToolbar style={styleToolbar} editor={richText} selectedIconTint={Colors.primaryColor.background} iconTint={Colors.primaryColor.foreground} actions={[
|
|
34
|
+
actions.setBold,
|
|
35
|
+
actions.setItalic,
|
|
36
|
+
actions.insertBulletsList,
|
|
37
|
+
actions.insertOrderedList,
|
|
38
|
+
actions.insertLink,
|
|
39
|
+
actions.setStrikethrough,
|
|
40
|
+
actions.setUnderline,
|
|
41
|
+
actions.checkboxList,
|
|
42
|
+
actions.undo,
|
|
43
|
+
actions.redo,
|
|
44
|
+
]} iconMap={{
|
|
45
|
+
[actions.heading1]: ({ tintColor }) => (<Text style={[{ color: tintColor }]}>H1</Text>),
|
|
46
|
+
}}/>
|
|
47
|
+
</ScrollView>);
|
|
48
|
+
};
|
|
49
|
+
export default HtmlInput;
|
|
50
|
+
//# sourceMappingURL=HtmlInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlInput.js","sourceRoot":"","sources":["../../../../src/components/atoms/HtmlInput/HtmlInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,MAAM,EAAC,MAAM,OAAO,CAAC;AACpC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC/E,OAAO,IAAI,MAAM,cAAc,CAAC;AAYhC,MAAM,SAAS,GAAG,CAAC,EACjB,KAAK,EACL,YAAY,EACZ,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,EACnB,YAAY,GAAG,EAAE,GACF,EAAE,EAAE;IACnB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC;IAE1B,OAAO,CACL,CAAC,UAAU,CACT;MAAA,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CACzB;QAAA,CAAC,IAAI,CACH;UAAA,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CACnB;UAAA,CAAC,UAAU,CACT,GAAG,CAAC,CAAC,QAAQ,CAAC,CACd,mCAAmC,CAAC,CAAC,IAAI,CAAC,CAC1C,kBAAkB,CAAC,CAAC,YAAY,CAAC,CACjC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAEvB;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,UAAU,CACZ;MAAA,CAAC,WAAW,CACV,KAAK,CAAC,CAAC,YAAY,CAAC,CACpB,MAAM,CAAC,CAAC,QAAQ,CAAC,CACjB,gBAAgB,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CACjD,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CACzC,OAAO,CAAC,CAAC;YACP,OAAO,CAAC,OAAO;YACf,OAAO,CAAC,SAAS;YACjB,OAAO,CAAC,iBAAiB;YACzB,OAAO,CAAC,iBAAiB;YACzB,OAAO,CAAC,UAAU;YAClB,OAAO,CAAC,gBAAgB;YACxB,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,IAAI;YACZ,OAAO,CAAC,IAAI;SACb,CAAC,CACF,OAAO,CAAC,CAAC;YACP,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAC,SAAS,EAAC,EAAE,EAAE,CAAC,CACnC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAC7C;SACF,CAAC,EAEN;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface IconProps {
|
|
2
|
+
style?: any;
|
|
3
|
+
name: string;
|
|
4
|
+
FontAwesome5?: boolean;
|
|
5
|
+
color?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
touchable?: boolean;
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const Icon: ({ style, name, FontAwesome5, color, size, touchable, visible, onPress, disabled, }: IconProps) => JSX.Element;
|
|
13
|
+
export default Icon;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
20
|
+
import Icon5 from 'react-native-vector-icons/FontAwesome5';
|
|
21
|
+
import Icon4 from 'react-native-vector-icons/FontAwesome';
|
|
22
|
+
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
23
|
+
const Icon = ({ style, name, FontAwesome5 = true, color, size = 18, touchable = false, visible = true, onPress = () => { }, disabled = false, }) => {
|
|
24
|
+
const Colors = useThemeColor();
|
|
25
|
+
const styles = useMemo(() => {
|
|
26
|
+
return getStyles(Colors, color == null ? Colors.secondaryColor_dark.background : color, touchable ? disabled : false, size);
|
|
27
|
+
}, [Colors, color, disabled, size, touchable]);
|
|
28
|
+
if (!visible) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return (<View style={[styles.container, style]}>
|
|
32
|
+
<TouchableOpacity onPress={onPress} disabled={!touchable || disabled}>
|
|
33
|
+
{FontAwesome5 ? (<Icon5 name={name} style={styles.icon}/>) : (<Icon4 name={name} style={styles.icon}/>)}
|
|
34
|
+
</TouchableOpacity>
|
|
35
|
+
</View>);
|
|
36
|
+
};
|
|
37
|
+
const getStyles = (Colors, color, disabled, size) => StyleSheet.create({
|
|
38
|
+
icon: {
|
|
39
|
+
color: disabled ? Colors.secondaryColor.background_light : color,
|
|
40
|
+
fontSize: size,
|
|
41
|
+
},
|
|
42
|
+
container: {
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
export default Icon;
|
|
49
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../src/components/atoms/Icon/Icon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,MAAM,wCAAwC,CAAC;AAC3D,OAAO,KAAK,MAAM,uCAAuC,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAc1D,MAAM,IAAI,GAAG,CAAC,EACZ,KAAK,EACL,IAAI,EACJ,YAAY,GAAG,IAAI,EACnB,KAAK,EACL,IAAI,GAAG,EAAE,EACT,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,IAAI,EACd,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,EAClB,QAAQ,GAAG,KAAK,GACN,EAAE,EAAE;IACd,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,OAAO,SAAS,CACd,MAAM,EACN,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAC7D,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAC5B,IAAI,CACL,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CACrC;MAAA,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,IAAI,QAAQ,CAAC,CACnE;QAAA,CAAC,YAAY,CAAC,CAAC,CAAC,CACd,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAG,CAC1C,CAAC,CAAC,CAAC,CACF,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAG,CAC1C,CACH;MAAA,EAAE,gBAAgB,CACpB;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAClD,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK;QAChE,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC,CAAC;AAEL,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { KeyboardTypeOptions } from 'react-native';
|
|
2
|
+
interface InputProps {
|
|
3
|
+
style: any;
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (any: any) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
secureTextEntry?: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
onSelection?: () => void;
|
|
10
|
+
multiline?: boolean;
|
|
11
|
+
numberOfLines?: number;
|
|
12
|
+
keyboardType?: KeyboardTypeOptions;
|
|
13
|
+
onEndFocus?: () => void;
|
|
14
|
+
isFocus?: boolean;
|
|
15
|
+
writingType?: 'title' | 'subtitle' | 'important' | 'details' | undefined;
|
|
16
|
+
}
|
|
17
|
+
declare const Input: ({ style, value, onChange, placeholder, secureTextEntry, readOnly, onSelection, multiline, numberOfLines, keyboardType, onEndFocus, isFocus, writingType, }: InputProps) => JSX.Element;
|
|
18
|
+
export default Input;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { TextInput } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
21
|
+
import { useWritingType } from '../../../theme/writingTheme';
|
|
22
|
+
import { useConfig } from '../../../config/ConfigContext';
|
|
23
|
+
const Input = ({ style, value, onChange, placeholder, secureTextEntry = false, readOnly = false, onSelection, multiline = false, numberOfLines = 1, keyboardType, onEndFocus = () => { }, isFocus = false, writingType = null, }) => {
|
|
24
|
+
const Colors = useThemeColor();
|
|
25
|
+
const { hideVirtualKeyboard } = useConfig();
|
|
26
|
+
const writingStyle = useWritingType(writingType);
|
|
27
|
+
const defaultStyle = useMemo(() => {
|
|
28
|
+
return {
|
|
29
|
+
...writingStyle,
|
|
30
|
+
color: Colors.text,
|
|
31
|
+
fontSize: 15,
|
|
32
|
+
};
|
|
33
|
+
}, [Colors.text, writingStyle]);
|
|
34
|
+
return (<TextInput style={[defaultStyle, style]} value={value} onChangeText={onChange} placeholder={placeholder} secureTextEntry={secureTextEntry} autoCapitalize="none" editable={!readOnly} onFocus={onSelection} placeholderTextColor={Colors.placeholderTextColor} keyboardType={keyboardType} multiline={multiline} numberOfLines={numberOfLines} onBlur={onEndFocus} showSoftInputOnFocus={hideVirtualKeyboard ? false : true} autoFocus={isFocus}/>);
|
|
35
|
+
};
|
|
36
|
+
export default Input;
|
|
37
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/atoms/Input/Input.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAsB,SAAS,EAAY,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AAkBxD,MAAM,KAAK,GAAG,CAAC,EACb,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAW,EACX,eAAe,GAAG,KAAK,EACvB,QAAQ,GAAG,KAAK,EAChB,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,CAAC,EACjB,YAAY,EACZ,UAAU,GAAG,GAAG,EAAE,GAAE,CAAC,EACrB,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,IAAI,GACP,EAAE,EAAE;IACf,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,EAAC,mBAAmB,EAAC,GAAG,SAAS,EAAE,CAAC;IAC1C,MAAM,YAAY,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAEjD,MAAM,YAAY,GAAc,OAAO,CAAC,GAAG,EAAE;QAC3C,OAAO;YACL,GAAG,YAAY;YACf,KAAK,EAAE,MAAM,CAAC,IAAI;YAClB,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAEhC,OAAO,CACL,CAAC,SAAS,CACR,KAAK,CAAC,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAC7B,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,YAAY,CAAC,CAAC,QAAQ,CAAC,CACvB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,cAAc,CAAC,MAAM,CACrB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CACpB,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,oBAAoB,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAClD,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,MAAM,CAAC,CAAC,UAAU,CAAC,CACnB,oBAAoB,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CACzD,SAAS,CAAC,CAAC,OAAO,CAAC,EACnB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|