@hortiview/default-components 0.0.11924 → 0.0.11933
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 +92 -1
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -31,10 +31,46 @@ This library provides form components using [react-hook-form](https://react-hook
|
|
|
31
31
|
|
|
32
32
|
Number input field that formats the users input depending on the input language. The component automatically sets the language specific thousand separators and only allows the language specific decimal separator.
|
|
33
33
|
|
|
34
|
+
```tsx
|
|
35
|
+
import { DefaultFormNumber } from '@hortiview/default-components';
|
|
36
|
+
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
|
|
37
|
+
|
|
38
|
+
const formMethods = useForm<{ birthday: string }>({
|
|
39
|
+
mode: 'onSubmit',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const { handleSubmit } = formMethods;
|
|
43
|
+
|
|
44
|
+
<FormProvider {...formMethods}>
|
|
45
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
46
|
+
<DefaultFormNumber<{ price: number }>
|
|
47
|
+
propertyName='price'
|
|
48
|
+
label='module.price'
|
|
49
|
+
decimalScale={5}
|
|
50
|
+
fixedDecimalScale={true}
|
|
51
|
+
allowNegative={false}
|
|
52
|
+
allowLeadingZeros={false}
|
|
53
|
+
prefix=' €'
|
|
54
|
+
/>
|
|
55
|
+
</form>
|
|
56
|
+
</FormProvider>;
|
|
57
|
+
```
|
|
58
|
+
|
|
34
59
|
### DefaultLoadingSpinner
|
|
35
60
|
|
|
36
61
|
Renders a loading spinner. The loading spinner can be customized in size and color. It can also be centered.
|
|
37
62
|
|
|
63
|
+
```TSX
|
|
64
|
+
import { DefaultLoadingSpinner } from '@hortiview/default-components';
|
|
65
|
+
|
|
66
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
67
|
+
|
|
68
|
+
/** add logic that changes state of isLoading */
|
|
69
|
+
|
|
70
|
+
if (isLoading) return <DefaultLoadingSpinner />
|
|
71
|
+
return <DefaultComponent />
|
|
72
|
+
```
|
|
73
|
+
|
|
38
74
|
### HealthCheckComponents
|
|
39
75
|
|
|
40
76
|
A screen that shows a health check failed message. It can be used if the check for database health, iot health or HV platform health fails. Please use the default components provided here to ensure a consistent user experience for the HV platform.
|
|
@@ -43,13 +79,68 @@ If a custom text and type should be displayed please use the shared component `<
|
|
|
43
79
|
|
|
44
80
|
#### DataBaseHealthCheck
|
|
45
81
|
|
|
46
|
-
|
|
82
|
+
```TSX
|
|
83
|
+
import { DataBaseHealthCheck } from '@hortiview/default-components';
|
|
84
|
+
|
|
85
|
+
const [isHealthy, setIsHealthy] = useState(false)
|
|
86
|
+
|
|
87
|
+
/** add logic that changes state of isHealthy */
|
|
88
|
+
|
|
89
|
+
if (!isHealthy) return <DataBaseHealthCheck />
|
|
90
|
+
return <DefaultComponent />
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### DataBaseHealthCheck
|
|
94
|
+
|
|
95
|
+
```TSX
|
|
96
|
+
import { DataBaseHealthCheck } from '@hortiview/default-components';
|
|
97
|
+
|
|
98
|
+
const [isHealthy, setIsHealthy] = useState(false)
|
|
99
|
+
|
|
100
|
+
/** add logic that changes state of isHealthy */
|
|
101
|
+
|
|
102
|
+
if (!isHealthy) return <DataBaseHealthCheck />
|
|
103
|
+
return <DefaultComponent />
|
|
104
|
+
```
|
|
47
105
|
|
|
48
106
|
#### IotServiceHealthCheck
|
|
49
107
|
|
|
108
|
+
```TSX
|
|
109
|
+
import { IotServiceHealthCheck } from '@hortiview/default-components';
|
|
110
|
+
|
|
111
|
+
const [isHealthy, setIsHealthy] = useState(false)
|
|
112
|
+
|
|
113
|
+
/** add logic that changes state of isHealthy */
|
|
114
|
+
|
|
115
|
+
if (!isHealthy) return <IotServiceHealthCheck />
|
|
116
|
+
return <DefaultComponent />
|
|
117
|
+
```
|
|
118
|
+
|
|
50
119
|
#### PlatformHealthCheck
|
|
51
120
|
|
|
121
|
+
```TSX
|
|
122
|
+
import { PlatformHealthCheck } from '@hortiview/default-components';
|
|
123
|
+
|
|
124
|
+
const [isHealthy, setIsHealthy] = useState(false)
|
|
125
|
+
|
|
126
|
+
/** add logic that changes state of isHealthy */
|
|
127
|
+
|
|
128
|
+
if (!isHealthy) return <PlatformHealthCheck />
|
|
129
|
+
return <DefaultComponent />
|
|
130
|
+
```
|
|
131
|
+
|
|
52
132
|
### ImpatienceLoadingSpinner
|
|
53
133
|
|
|
54
134
|
This Loading spinner will automatically change to a specific text, after a certain waiting time, the time is adjustable.
|
|
55
135
|
The default waiting time are 10 seconds.
|
|
136
|
+
|
|
137
|
+
```TSX
|
|
138
|
+
import { ImpatienceLoadingSpinner } from '@hortiview/default-components';
|
|
139
|
+
|
|
140
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
141
|
+
|
|
142
|
+
/** add logic that changes state of isLoading */
|
|
143
|
+
|
|
144
|
+
if (isLoading) return <ImpatienceLoadingSpinner />
|
|
145
|
+
return <DefaultComponent />
|
|
146
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/default-components",
|
|
3
3
|
"description": "This is a component library that should be used in the HortiView platform and its modules. The components provided here have default translation strings.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11933",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"registry": "https://registry.npmjs.org/"
|
|
17
17
|
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"HortiView",
|
|
20
|
+
"React",
|
|
21
|
+
"TranslatedComponents",
|
|
22
|
+
"ComponentLibrary"
|
|
23
|
+
],
|
|
18
24
|
"scripts": {
|
|
19
25
|
"dev": "vite",
|
|
20
26
|
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
@@ -30,7 +36,8 @@
|
|
|
30
36
|
"react": "^18.3.1",
|
|
31
37
|
"react-dom": "^18.3.1",
|
|
32
38
|
"react-hook-form": "^7.51.2",
|
|
33
|
-
"react-router-dom": "^6.22.3"
|
|
39
|
+
"react-router-dom": "^6.22.3",
|
|
40
|
+
"@hortiview/shared-components": "^0.0.11881"
|
|
34
41
|
},
|
|
35
42
|
"devDependencies": {
|
|
36
43
|
"@element-public/react-components": "2.0.0-alpha.1",
|