@hortiview/default-components 0.0.11919 → 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 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
- #### DefaultHealthCheck
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
+ ```
@@ -0,0 +1,5 @@
1
+ import { FormNumberProps } from '@hortiview/shared-components/dist/components/FormComponents/FormNumber/FormNumber';
2
+ import { FieldValues } from 'react-hook-form';
3
+
4
+ export type DefaultFormNumberProps<T extends FieldValues> = Omit<FormNumberProps<T>, 'languageCode' | 'helperText'>;
5
+ export declare const DefaultFormNumber: <T extends FieldValues>({ ...props }: DefaultFormNumberProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { LoadingSpinnerProps } from '@hortiview/shared-components';
2
+
3
+ type DefaultLoadingSpinnerProps = Omit<LoadingSpinnerProps, 'text'>;
4
+ export declare const DefaultLoadingSpinner: ({ ...props }: DefaultLoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { HealthCheckFailedProps } from '@hortiview/shared-components';
2
+
3
+ type DataBaseHealthCheckProps = Omit<HealthCheckFailedProps, 'title' | 'subtitle' | 'type'>;
4
+ export declare const DataBaseHealthCheck: ({ ...props }: DataBaseHealthCheckProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { HealthCheckFailedProps } from '@hortiview/shared-components';
2
+
3
+ type DefaultHealthCheckProps = Omit<HealthCheckFailedProps, 'title' | 'subtitle' | 'type'>;
4
+ export declare const DefaultHealthCheck: ({ ...props }: DefaultHealthCheckProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { HealthCheckFailedProps } from '@hortiview/shared-components';
2
+
3
+ type IotServiceHealthCheckProps = Omit<HealthCheckFailedProps, 'title' | 'subtitle' | 'type'>;
4
+ export declare const IotServiceHealthCheck: ({ ...props }: IotServiceHealthCheckProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { HealthCheckFailedProps } from '@hortiview/shared-components';
2
+
3
+ type PlatformHealthCheckProps = Omit<HealthCheckFailedProps, 'title' | 'subtitle' | 'type'>;
4
+ export declare const PlatformHealthCheck: ({ ...props }: PlatformHealthCheckProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LoadingSpinnerProps } from '@hortiview/shared-components';
2
+
3
+ type ImpatienceLoadingSpinnerProps = Omit<LoadingSpinnerProps, 'impatienceMessage' | 'text'>;
4
+ export declare const ImpatienceLoadingSpinner: ({ ...props }: ImpatienceLoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,15 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { AVAILABLE_LOCALES } from '@hortiview/shared-components';
3
+
4
+ export type InternationalizationWrapperProps = PropsWithChildren;
5
+ /**
6
+ * Warpper to provide i18n context to children
7
+ * @param children
8
+ * @returns
9
+ */
10
+ export declare const InternationalizationWrapper: ({ children }: InternationalizationWrapperProps) => import("react/jsx-runtime").JSX.Element;
11
+ /**
12
+ * a hook to handle the language change of this i18next instance
13
+ * @param currentLanguage
14
+ */
15
+ export declare const useChangeDefaultComponentsLanguage: (currentLanguage: (typeof AVAILABLE_LOCALES)[number]) => void;
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const i18n: import('i18next').i18n;
2
+ export default i18n;
@@ -0,0 +1,22 @@
1
+ declare const _default: {
2
+ "loadingSpinner": {
3
+ "baseMessage": "Loading...",
4
+ "impatienceMessage": "This is taking longer than expected. Please be patient."
5
+ },
6
+ "healthCheck": {
7
+ "default": "Sorry, something went wrong!",
8
+ "defaultSubtitle": "The problem is being addressed by our technical team. Please come back later.",
9
+ "dataBase": "The data for this module is loading!",
10
+ "dataBaseSubtitle": "Please wait or come back later.",
11
+ "platform": "The platform data used by this module cannot be retrieved currently.",
12
+ "platformSubtitle": "Please wait or come back later.",
13
+ "iotService": "The data of your devices cannot be retrieved currently.",
14
+ "iotServiceSubtitle": "The problem is being addressed by our technical team. Please come back later."
15
+ },
16
+ "formNumber": {
17
+ "separator": "Please use a period as a decimal separator, e.g. 12,345.67"
18
+ }
19
+ }
20
+ ;
21
+
22
+ export default _default;
@@ -0,0 +1,22 @@
1
+ declare const _default: {
2
+ "formNumber": {
3
+ "separator": "Utilice un período como separador decimal, p. 12,345.67"
4
+ },
5
+ "healthCheck": {
6
+ "basic": "Lo siento, algo salió mal!",
7
+ "basicSubtitle": "El problema está siendo abordado por nuestro equipo técnico. Vuelve más tarde.",
8
+ "dataBase": "¡Los datos para este módulo se están cargando!",
9
+ "dataBaseSubtitle": "Espere o vuelva más tarde.",
10
+ "iotService": "Los datos de sus dispositivos no se pueden recuperar actualmente.",
11
+ "iotServiceSubtitle": "El problema está siendo abordado por nuestro equipo técnico. Vuelve más tarde.",
12
+ "platform": "Los datos de la plataforma utilizados por este módulo no se pueden recuperar actualmente.",
13
+ "platformSubtitle": "Espere o vuelva más tarde."
14
+ },
15
+ "loadingSpinner": {
16
+ "baseMessage": "Cargando...",
17
+ "impatienceMessage": "Esto está tardando más de lo esperado. Por favor, sea paciente."
18
+ }
19
+ }
20
+ ;
21
+
22
+ export default _default;
@@ -0,0 +1,22 @@
1
+ declare const _default: {
2
+ "formNumber": {
3
+ "separator": "Lütfen ondalık ayırıcı olarak virgül kullanın, ör. 12.345,67"
4
+ },
5
+ "healthCheck": {
6
+ "basic": "Üzgünüm, bir şeyler ters gitti!",
7
+ "basicSubtitle": "Sorun teknik ekibimiz tarafından ele alınmaktadır. Lütfen daha sonra tekrar gelin.",
8
+ "dataBase": "Bu modül için veriler yükleniyor!",
9
+ "dataBaseSubtitle": "Lütfen bekleyin veya daha sonra geri dönün.",
10
+ "iotService": "Cihazlarınızın verileri şu anda alınamaz.",
11
+ "iotServiceSubtitle": "Sorun teknik ekibimiz tarafından ele alınmaktadır. Lütfen daha sonra tekrar gelin.",
12
+ "platform": "Bu modül tarafından kullanılan platform verileri şu anda alınamaz.",
13
+ "platformSubtitle": "Lütfen bekleyin veya daha sonra geri dönün."
14
+ },
15
+ "loadingSpinner": {
16
+ "baseMessage": "Yükleme ...",
17
+ "impatienceMessage": "Bu beklenenden daha uzun sürüyor. Lütfen sabırlı olun."
18
+ }
19
+ }
20
+ ;
21
+
22
+ export default _default;
package/dist/main.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export { DefaultFormNumber } from './components/DefaultFormNumber/DefaultFormNumber';
2
+ export { DefaultLoadingSpinner } from './components/DefaultLoadingSpinner/DefaultLoadingSpinner';
3
+ export { ImpatienceLoadingSpinner } from './components/ImpatienceLoadingSpinner/ImpatienceLoadingSpinner';
4
+ /** default health checks */
5
+ export { DataBaseHealthCheck } from './components/HealthChecks/DataBaseHealthCheck';
6
+ export { DefaultHealthCheck } from './components/HealthChecks/DefaultHealthCheck';
7
+ export { IotServiceHealthCheck } from './components/HealthChecks/IotServiceHealthCheck';
8
+ export { PlatformHealthCheck } from './components/HealthChecks/PlatformHealthCheck';
9
+ /**
10
+ * the following hook is called in the HV main frame to
11
+ * set the language from the default components accordingly
12
+ * to the main i18next instance
13
+ */
14
+ export { useChangeDefaultComponentsLanguage } from './components/InternationalizationWrapper/InternationalizationWrapper';
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.11919",
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",
@@ -39,14 +46,14 @@
39
46
  "@hortiview/shared-components": "^0.0.11881",
40
47
  "@rollup/plugin-json": "^6.1.0",
41
48
  "@rollup/plugin-node-resolve": "^16.0.0",
42
- "@storybook/addon-essentials": "^8.5.3",
43
- "@storybook/addon-interactions": "^8.5.3",
44
- "@storybook/addon-links": "^8.5.3",
45
- "@storybook/addon-onboarding": "^8.5.3",
46
- "@storybook/blocks": "^8.5.3",
47
- "@storybook/react": "^8.5.3",
48
- "@storybook/react-vite": "^8.5.3",
49
- "@storybook/test": "^8.5.3",
49
+ "@storybook/addon-essentials": "8.5.3",
50
+ "@storybook/addon-interactions": "8.5.3",
51
+ "@storybook/addon-links": "8.5.3",
52
+ "@storybook/addon-onboarding": "8.5.3",
53
+ "@storybook/blocks": "8.5.3",
54
+ "@storybook/react": "8.5.3",
55
+ "@storybook/react-vite": "8.5.3",
56
+ "@storybook/test": "8.5.3",
50
57
  "@testing-library/dom": "^10.4.0",
51
58
  "@testing-library/jest-dom": "^6.6.3",
52
59
  "@testing-library/react": "^16.2.0",
@@ -78,11 +85,11 @@
78
85
  "react-number-format": "^5.4.3",
79
86
  "react-router-dom": "^6.22.3",
80
87
  "rollup-plugin-copy": "^3.5.0",
81
- "storybook": "^8.5.3",
88
+ "storybook": "8.5.3",
82
89
  "typescript": "~5.6.2",
83
90
  "typescript-eslint": "^8.18.2",
84
- "vite": "^6.0.5",
85
- "vite-plugin-dts": "^4.5.0",
91
+ "vite": "6.1.0",
92
+ "vite-plugin-dts": "3.9.1",
86
93
  "vite-plugin-lib-inject-css": "^2.2.1",
87
94
  "vite-plugin-svgr": "^4.3.0",
88
95
  "vitest": "^3.0.5"