@firedesktop/react-base 2.1.25 → 3.0.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/LICENSE +162 -0
- package/README.md +174 -94
- package/dist/components/AppPagination.js.map +1 -1
- package/dist/components/Spin.js +11 -7
- package/dist/components/Spin.js.map +1 -1
- package/dist/components/Toaster/Toaster.js +17 -5
- package/dist/components/Toaster/Toaster.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/CurrencyUtiles.js +7 -2
- package/dist/utils/CurrencyUtiles.js.map +1 -1
- package/dist/utils/DateUtils.js +16 -5
- package/dist/utils/DateUtils.js.map +1 -1
- package/dist/utils/FileUtils.d.ts +1 -1
- package/dist/utils/FileUtils.js.map +1 -1
- package/dist/utils/Logger.d.ts +13 -0
- package/dist/utils/Logger.js +44 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/UrlUtils.js +1 -1
- package/dist/utils/UrlUtils.js.map +1 -1
- package/dist/utils/configuration/ConfigurationLoader.js +4 -3
- package/dist/utils/configuration/ConfigurationLoader.js.map +1 -1
- package/dist/utils/configuration/ConfigurationManager.js +13 -6
- package/dist/utils/configuration/ConfigurationManager.js.map +1 -1
- package/dist/utils/configuration/ConfigurationReturner.js +4 -3
- package/dist/utils/configuration/ConfigurationReturner.js.map +1 -1
- package/dist/utils/fetch/fetchWrapper.d.ts +5 -5
- package/dist/utils/fetch/fetchWrapper.js +8 -2
- package/dist/utils/fetch/fetchWrapper.js.map +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/labels/LanguageLoader.js +39 -9
- package/dist/utils/labels/LanguageLoader.js.map +1 -1
- package/dist/utils/labels/LanguageManager.js +14 -6
- package/dist/utils/labels/LanguageManager.js.map +1 -1
- package/dist/utils/labels/LanguageReturner.js +4 -3
- package/dist/utils/labels/LanguageReturner.js.map +1 -1
- package/docs/APP_ICON.md +82 -0
- package/docs/APP_INPUT.md +81 -0
- package/docs/APP_PAGINATION.md +61 -0
- package/docs/CONFIGURATION.md +105 -0
- package/docs/FETCH_WRAPPER.md +163 -0
- package/docs/LABELS.md +148 -0
- package/docs/LOGGER.md +112 -0
- package/docs/SECURITY_AUDIT_2026-02-05.md +468 -0
- package/docs/SPIN.md +45 -0
- package/docs/TOASTER.md +75 -0
- package/docs/UTILITIES.md +177 -0
- package/package.json +24 -34
- package/src/App.css +0 -12
- package/src/lib/components/AppIcon.tsx +0 -784
- package/src/lib/components/AppInput.tsx +0 -66
- package/src/lib/components/AppPagination.tsx +0 -124
- package/src/lib/components/Spin.tsx +0 -31
- package/src/lib/components/Toaster/Toaster.tsx +0 -50
- package/src/lib/components/Toaster/Types.ts +0 -11
- package/src/lib/components/index.ts +0 -8
- package/src/lib/index.ts +0 -15
- package/src/lib/styles/base.css +0 -392
- package/src/lib/styles/syncfusion_bootstrap4.css +0 -10
- package/src/lib/styles/toaster.css +0 -50
- package/src/lib/utils/CurrencyUtiles.ts +0 -48
- package/src/lib/utils/DateUtils.ts +0 -135
- package/src/lib/utils/FileUtils.ts +0 -40
- package/src/lib/utils/RegExValidation.ts +0 -49
- package/src/lib/utils/UrlUtils.ts +0 -17
- package/src/lib/utils/configuration/ConfigurationLoader.tsx +0 -43
- package/src/lib/utils/configuration/ConfigurationManager.ts +0 -38
- package/src/lib/utils/configuration/ConfigurationReturner.tsx +0 -39
- package/src/lib/utils/configuration/index.ts +0 -9
- package/src/lib/utils/fetch/Types.ts +0 -11
- package/src/lib/utils/fetch/fetchWrapper.ts +0 -174
- package/src/lib/utils/fetch/index.ts +0 -4
- package/src/lib/utils/index.ts +0 -11
- package/src/lib/utils/labels/LanguageLoader.tsx +0 -69
- package/src/lib/utils/labels/LanguageManager.ts +0 -61
- package/src/lib/utils/labels/LanguageReturner.tsx +0 -41
- package/src/lib/utils/labels/index.ts +0 -9
package/docs/TOASTER.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Toaster
|
|
2
|
+
|
|
3
|
+
Toast notification component using Syncfusion's ToastComponent. Displays styled notifications for errors, info, success, and warnings.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
import { Components } from '@firedesktop/react-base';
|
|
9
|
+
const { Toaster, Toaster_Types } = Components;
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Types
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
type Toaster_Type = 'Error' | 'Information' | 'Success' | 'Warning';
|
|
16
|
+
|
|
17
|
+
type Toaster_Prop_Type = {
|
|
18
|
+
content?: string;
|
|
19
|
+
title: string;
|
|
20
|
+
type: Toaster_Type;
|
|
21
|
+
};
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Required | Description |
|
|
27
|
+
|------|------|----------|-------------|
|
|
28
|
+
| `propertiesObject` | `Toaster_Prop_Type` | Yes | Toast configuration object |
|
|
29
|
+
|
|
30
|
+
### `propertiesObject` fields
|
|
31
|
+
|
|
32
|
+
| Field | Type | Required | Description |
|
|
33
|
+
|-------|------|----------|-------------|
|
|
34
|
+
| `title` | `string` | Yes | Toast title |
|
|
35
|
+
| `content` | `string` | No | Toast body message |
|
|
36
|
+
| `type` | `Toaster_Type` | Yes | Notification type |
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
```jsx
|
|
41
|
+
const [toast, setToast] = useState(null);
|
|
42
|
+
|
|
43
|
+
{toast && <Toaster propertiesObject={toast} />}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Showing different notification types
|
|
47
|
+
|
|
48
|
+
```jsx
|
|
49
|
+
// Success
|
|
50
|
+
setToast({ title: 'Saved', content: 'Record saved.', type: 'Success' });
|
|
51
|
+
|
|
52
|
+
// Error
|
|
53
|
+
setToast({ title: 'Error', content: 'Failed to save.', type: 'Error' });
|
|
54
|
+
|
|
55
|
+
// Warning
|
|
56
|
+
setToast({ title: 'Warning', content: 'Unsaved changes.', type: 'Warning' });
|
|
57
|
+
|
|
58
|
+
// Information
|
|
59
|
+
setToast({ title: 'Info', content: 'New version available.', type: 'Information' });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Behavior
|
|
63
|
+
|
|
64
|
+
- Displays a toast notification positioned to the right
|
|
65
|
+
- Each type has a distinct CSS class and icon:
|
|
66
|
+
- `Error` -- `e-toast-danger`, error icon, 4s timeout
|
|
67
|
+
- `Information` -- `e-toast-info`, info icon
|
|
68
|
+
- `Success` -- `e-toast-success`, success icon
|
|
69
|
+
- `Warning` -- `e-toast-warning`, warning icon
|
|
70
|
+
- Shows a progress bar and close button
|
|
71
|
+
- Title and content are HTML-escaped before rendering (XSS protection)
|
|
72
|
+
|
|
73
|
+
## Dependencies
|
|
74
|
+
|
|
75
|
+
Uses `ToastComponent` from `@syncfusion/ej2-react-notifications` (bundled dependency). Requires the Syncfusion Bootstrap4 theme CSS for styling.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Utilities
|
|
2
|
+
|
|
3
|
+
Standalone utility functions for dates, currency, files, URLs, and input validation.
|
|
4
|
+
|
|
5
|
+
All utilities use the factory pattern: import the function, call it to get an object of methods.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
import { Utils } from '@firedesktop/react-base';
|
|
11
|
+
|
|
12
|
+
const { dateToString, dateToString_Italian, isoStringToDate, removeTime, zuluTimeUTC_to_yourTimeZone } = Utils.DateUtils();
|
|
13
|
+
const { numberToCurrencyString, numberToCurrencyStringNoSymbol } = Utils.CurrencyUtiles();
|
|
14
|
+
const { b64toBlob, fileReadAsync } = Utils.FileUtils();
|
|
15
|
+
const { validate: validateUrl } = Utils.UrlUtils();
|
|
16
|
+
const { isAValid_CSharpName, isAValid_EmailAddress } = Utils.RegExValidation();
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## DateUtils
|
|
22
|
+
|
|
23
|
+
### `dateToString(date, locale?)`
|
|
24
|
+
|
|
25
|
+
Format a date using `Intl.DateTimeFormat`.
|
|
26
|
+
|
|
27
|
+
| Parameter | Type | Default | Description |
|
|
28
|
+
|-----------|------|---------|-------------|
|
|
29
|
+
| `date` | `string \| Date` | -- | Date to format |
|
|
30
|
+
| `locale` | `string` | `'IT'` | Locale code for formatting |
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
dateToString(new Date()); // "05/02/2026"
|
|
34
|
+
dateToString('2026-02-05', 'en-US'); // "2/5/2026"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `dateToString_Italian(date, separator, time?)`
|
|
38
|
+
|
|
39
|
+
Format as Italian-style string with configurable separator and optional time.
|
|
40
|
+
|
|
41
|
+
| Parameter | Type | Description |
|
|
42
|
+
|-----------|------|-------------|
|
|
43
|
+
| `date` | `string \| Date \| undefined` | Date to format |
|
|
44
|
+
| `separator` | `string` | Date separator (e.g., `'/'`, `'-'`, `'.'`) |
|
|
45
|
+
| `time` | `'HH:mm' \| 'HH:mm:ss' \| undefined` | Optional time format |
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
dateToString_Italian(new Date(), '/', 'HH:mm'); // "05/02/2026 14:30"
|
|
49
|
+
dateToString_Italian(new Date(), '-', 'HH:mm:ss'); // "05-02-2026 14:30:45"
|
|
50
|
+
dateToString_Italian(new Date(), '/'); // "05/02/2026"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `isoStringToDate(value)`
|
|
54
|
+
|
|
55
|
+
Parse an ISO date string to a `Date` object. Returns `undefined` if invalid.
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
isoStringToDate('2026-02-05T14:00:00.000Z'); // Date object
|
|
59
|
+
isoStringToDate(undefined); // undefined
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `removeTime(date)`
|
|
63
|
+
|
|
64
|
+
Return a new `Date` at midnight (00:00:00) on the same day.
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
removeTime(new Date('2026-02-05T14:30:00')); // Date at 2026-02-05T00:00:00
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### `zuluTimeUTC_to_yourTimeZone(isoString)`
|
|
71
|
+
|
|
72
|
+
Convert a Z-formatted UTC string to local timezone in `YYYY-MM-DDTHH:mm:ss` format (no `Z` suffix). Returns the input unchanged if it doesn't end with `Z`.
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
zuluTimeUTC_to_yourTimeZone('2026-02-05T14:00:00.000Z'); // "2026-02-05T15:00:00" (CET)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## CurrencyUtiles
|
|
81
|
+
|
|
82
|
+
### `numberToCurrencyString(value, locale?, currency?)`
|
|
83
|
+
|
|
84
|
+
Format a number as a currency string using `Intl.NumberFormat`.
|
|
85
|
+
|
|
86
|
+
| Parameter | Type | Default | Description |
|
|
87
|
+
|-----------|------|---------|-------------|
|
|
88
|
+
| `value` | `string \| number \| undefined` | -- | Value to format |
|
|
89
|
+
| `locale` | `string` | `'IT'` | Locale for formatting |
|
|
90
|
+
| `currency` | `string` | `'EUR'` | ISO 4217 currency code |
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
numberToCurrencyString(1234.5); // "1.234,50 €"
|
|
94
|
+
numberToCurrencyString(1234.5, 'en-US', 'USD'); // "$1,234.50"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### `numberToCurrencyStringNoSymbol(value, locale?, minimumFractionDigits?)`
|
|
98
|
+
|
|
99
|
+
Format a number without a currency symbol.
|
|
100
|
+
|
|
101
|
+
| Parameter | Type | Default | Description |
|
|
102
|
+
|-----------|------|---------|-------------|
|
|
103
|
+
| `value` | `string \| number \| undefined` | -- | Value to format |
|
|
104
|
+
| `locale` | `string` | `'IT'` | Locale for formatting |
|
|
105
|
+
| `minimumFractionDigits` | `number` | `2` | Minimum decimal places |
|
|
106
|
+
|
|
107
|
+
```javascript
|
|
108
|
+
numberToCurrencyStringNoSymbol(1234.5); // "1.234,50"
|
|
109
|
+
numberToCurrencyStringNoSymbol(1234.5, 'en-US'); // "1,234.50"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## FileUtils
|
|
115
|
+
|
|
116
|
+
### `b64toBlob(b64Data, contentType?, sliceSize?)`
|
|
117
|
+
|
|
118
|
+
Convert a base64 string to a `Blob`.
|
|
119
|
+
|
|
120
|
+
| Parameter | Type | Default | Description |
|
|
121
|
+
|-----------|------|---------|-------------|
|
|
122
|
+
| `b64Data` | `string` | -- | Base64-encoded data |
|
|
123
|
+
| `contentType` | `string` | `''` | MIME type |
|
|
124
|
+
| `sliceSize` | `number` | `512` | Byte processing chunk size |
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
const blob = b64toBlob(pdfBase64, 'application/pdf');
|
|
128
|
+
const url = URL.createObjectURL(blob);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### `fileReadAsync(file)`
|
|
132
|
+
|
|
133
|
+
Read a `File` object as text asynchronously.
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
const text = await fileReadAsync(inputElement.files[0]);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## UrlUtils
|
|
142
|
+
|
|
143
|
+
### `validate(url?)`
|
|
144
|
+
|
|
145
|
+
Validate a URL string (supports HTTP/HTTPS, domain names, IPs, ports, paths, query strings, fragments).
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
validateUrl('https://example.com'); // true
|
|
149
|
+
validateUrl('http://192.168.1.1:8080'); // true
|
|
150
|
+
validateUrl('not a url'); // false
|
|
151
|
+
validateUrl(undefined); // false
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## RegExValidation
|
|
157
|
+
|
|
158
|
+
### `isAValid_CSharpName(value?)`
|
|
159
|
+
|
|
160
|
+
Validate that a string is a valid C# identifier: starts with a letter, contains only letters, digits, and underscores.
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
isAValid_CSharpName('MyClass'); // true
|
|
164
|
+
isAValid_CSharpName('my_var_1'); // true
|
|
165
|
+
isAValid_CSharpName('1invalid'); // false
|
|
166
|
+
isAValid_CSharpName('has space'); // false
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### `isAValid_EmailAddress(value?)`
|
|
170
|
+
|
|
171
|
+
Validate email format.
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
isAValid_EmailAddress('user@example.com'); // true
|
|
175
|
+
isAValid_EmailAddress('invalid'); // false
|
|
176
|
+
isAValid_EmailAddress(undefined); // false
|
|
177
|
+
```
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firedesktop/react-base",
|
|
3
|
-
"version": "
|
|
4
|
-
"license": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/",
|
|
9
|
+
"docs/",
|
|
10
|
+
"LICENSE",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
6
13
|
"description": "This is the FireDesktop base package used to support every React Project in this Company.",
|
|
7
14
|
"author": "Firedesktop",
|
|
8
15
|
"repository": "https://firedesktopDevOps@dev.azure.com/firedesktopDevOps/baseFEComponents/_git/baseFEComponents",
|
|
@@ -11,30 +18,30 @@
|
|
|
11
18
|
"@syncfusion/ej2-react-notifications": "32.1.24"
|
|
12
19
|
},
|
|
13
20
|
"devDependencies": {
|
|
14
|
-
"@babel/cli": "7.28.6",
|
|
15
|
-
"@babel/core": "7.28.6",
|
|
16
|
-
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
17
|
-
"@babel/plugin-transform-arrow-functions": "7.27.1",
|
|
18
|
-
"@babel/preset-typescript": "7.28.5",
|
|
19
21
|
"@testing-library/jest-dom": "6.9.1",
|
|
20
22
|
"@testing-library/react": "16.3.2",
|
|
21
23
|
"@testing-library/user-event": "14.6.1",
|
|
22
|
-
"@types/jest": "30.0.0",
|
|
23
24
|
"@types/node": "25.0.9",
|
|
24
25
|
"@types/react": "19.2.9",
|
|
25
26
|
"@types/react-dom": "19.2.3",
|
|
26
27
|
"@types/react-redux": "7.1.34",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
29
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
30
|
+
"@vitejs/plugin-react": "^5.1.3",
|
|
29
31
|
"bootstrap": "5.3.8",
|
|
30
32
|
"copyfiles": "2.4.1",
|
|
31
|
-
"
|
|
33
|
+
"eslint": "^9.39.2",
|
|
34
|
+
"eslint-plugin-react": "^7.37.5",
|
|
35
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
36
|
+
"jsdom": "^28.0.0",
|
|
37
|
+
"lodash": "4.17.23",
|
|
32
38
|
"react": "18.3.1",
|
|
33
|
-
"react-dom": "18.3.1",
|
|
39
|
+
"react-dom": "18.3.1",
|
|
34
40
|
"react-redux": "9.2.0",
|
|
35
|
-
"
|
|
41
|
+
"redux": "^5.0.1",
|
|
36
42
|
"typescript": "4.9.5",
|
|
37
|
-
"
|
|
43
|
+
"vite": "^7.3.1",
|
|
44
|
+
"vitest": "^4.0.18"
|
|
38
45
|
},
|
|
39
46
|
"peerDependencies": {
|
|
40
47
|
"bootstrap": ">=4.5.3",
|
|
@@ -44,25 +51,8 @@
|
|
|
44
51
|
},
|
|
45
52
|
"scripts": {
|
|
46
53
|
"distribute": "rmdir /s /q dist & mkdir dist\\styles && tsc && copyfiles -f src/lib/styles/* dist/styles",
|
|
47
|
-
"start": "
|
|
48
|
-
"test": "
|
|
49
|
-
|
|
50
|
-
"eslintConfig": {
|
|
51
|
-
"extends": [
|
|
52
|
-
"react-app",
|
|
53
|
-
"react-app/jest"
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
"browserslist": {
|
|
57
|
-
"production": [
|
|
58
|
-
">0.2%",
|
|
59
|
-
"not dead",
|
|
60
|
-
"not op_mini all"
|
|
61
|
-
],
|
|
62
|
-
"development": [
|
|
63
|
-
"last 1 chrome version",
|
|
64
|
-
"last 1 firefox version",
|
|
65
|
-
"last 1 safari version"
|
|
66
|
-
]
|
|
54
|
+
"start": "vite",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:watch": "vitest"
|
|
67
57
|
}
|
|
68
58
|
}
|