dry-ux 1.70.0 → 1.72.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/dist/dajaxice/DajaxiceCall.js +1 -1
- package/dist/dajaxice/Proxy.interface.d.ts +4 -0
- package/dist/enhanced-inputs/interface.d.ts +15 -0
- package/dist/error/ErrorBoundary.stories.d.ts +5 -0
- package/dist/error/ErrorBoundary.stories.js +23 -0
- package/dist/error/ErrorScreen.stories.d.ts +4 -0
- package/dist/error/ErrorScreen.stories.js +12 -0
- package/dist/helpers/logger.d.ts +15 -0
- package/dist/helpers/logger.js +19 -0
- package/dist/provider.d.ts +13 -1
- package/dist/provider.js +6 -0
- package/dist/styles/helper.css +863 -0
- package/dist/ui-utils/ActionsOverlay.d.ts +10 -0
- package/dist/ui-utils/ActionsOverlay.js +24 -16
- package/dist/ui-utils/Modal.d.ts +33 -0
- package/dist/ui-utils/Modal.js +6 -0
- package/dist/ui-utils/Money.stories.d.ts +7 -0
- package/dist/ui-utils/Money.stories.js +34 -0
- package/dist/ui-utils/RenderWhenVisible.stories.d.ts +4 -0
- package/dist/ui-utils/RenderWhenVisible.stories.js +15 -0
- package/dist/ui-utils/Spinner.stories.d.ts +7 -0
- package/dist/ui-utils/Spinner.stories.js +11 -0
- package/dist/ui-utils/UIUtil.interface.d.ts +72 -10
- package/dist/ui-utils/UIUtilProvider.d.ts +80 -0
- package/dist/ui-utils/UIUtilProvider.js +65 -0
- package/dist/ui-utils/UIUtilRenderer.d.ts +12 -0
- package/dist/ui-utils/UIUtilRenderer.js +6 -0
- package/dist/ui-utils/ViewportDetect.d.ts +40 -0
- package/dist/ui-utils/ViewportDetect.js +47 -0
- package/package.json +21 -6
- package/README.md +0 -0
|
@@ -98,7 +98,7 @@ class DajaxiceCall {
|
|
|
98
98
|
this.callApi();
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
(0, utilities_1.fnWithAuthCheck)(this.callApi, authCheck.url, authCheck.redirectUrl).catch(this.handleError);
|
|
101
|
+
(0, utilities_1.fnWithAuthCheck)(this.callApi, authCheck.url, authCheck.redirectUrl).catch(authCheck.onError || this.handleError);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
@@ -70,6 +70,10 @@ export interface IDajaxiceProxy<TModule> {
|
|
|
70
70
|
* The URL to redirect to if not authenticated.
|
|
71
71
|
*/
|
|
72
72
|
redirectUrl: string;
|
|
73
|
+
/**
|
|
74
|
+
* The method to call if the authentication check fails.
|
|
75
|
+
*/
|
|
76
|
+
onError?: (error: any) => void;
|
|
73
77
|
};
|
|
74
78
|
/**
|
|
75
79
|
* The error handler function.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Type alias for validation, which can be a boolean or a string.
|
|
4
|
+
*/
|
|
2
5
|
export type IValidation = boolean | string;
|
|
6
|
+
/**
|
|
7
|
+
* Interface representing a value validation with an optional message.
|
|
8
|
+
*/
|
|
3
9
|
export interface IValueValidation<T> {
|
|
4
10
|
/**
|
|
5
11
|
* The value to be validated.
|
|
@@ -10,6 +16,9 @@ export interface IValueValidation<T> {
|
|
|
10
16
|
*/
|
|
11
17
|
message?: string;
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Interface representing various validation rules for a field.
|
|
21
|
+
*/
|
|
13
22
|
export interface IValidations {
|
|
14
23
|
/**
|
|
15
24
|
* Indicates if the field is required.
|
|
@@ -80,6 +89,9 @@ export interface IValidations {
|
|
|
80
89
|
*/
|
|
81
90
|
errorRef?: string;
|
|
82
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Interface representing enhanced properties for an input field.
|
|
94
|
+
*/
|
|
83
95
|
export interface IEnhancedProps {
|
|
84
96
|
/**
|
|
85
97
|
* Validation rules for the field.
|
|
@@ -106,4 +118,7 @@ export interface IEnhancedProps {
|
|
|
106
118
|
*/
|
|
107
119
|
validateOnChange?: boolean;
|
|
108
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Type alias for input attributes, extending HTML input, select, and textarea attributes.
|
|
123
|
+
*/
|
|
109
124
|
export type InputAttributes = InputHTMLAttributes<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WithError = exports.Default = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const ErrorBoundary_1 = require("./ErrorBoundary");
|
|
6
|
+
exports.default = {
|
|
7
|
+
title: "ErrorBoundary",
|
|
8
|
+
component: ErrorBoundary_1.ErrorBoundary,
|
|
9
|
+
};
|
|
10
|
+
const Template = args => (React.createElement(ErrorBoundary_1.ErrorBoundary, Object.assign({}, args),
|
|
11
|
+
React.createElement("div", null, "Child component content")));
|
|
12
|
+
exports.Default = Template.bind({});
|
|
13
|
+
exports.Default.args = {};
|
|
14
|
+
exports.WithError = Template.bind({});
|
|
15
|
+
exports.WithError.args = {
|
|
16
|
+
fallback: (error, resetError) => (React.createElement("div", null,
|
|
17
|
+
React.createElement("h1", null, "Custom Fallback UI"),
|
|
18
|
+
React.createElement("p", null, error.message),
|
|
19
|
+
React.createElement("button", { onClick: resetError }, "Try Again"))),
|
|
20
|
+
children: (() => {
|
|
21
|
+
throw new Error("Test error");
|
|
22
|
+
})(),
|
|
23
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const ErrorScreen_1 = require("./ErrorScreen");
|
|
6
|
+
exports.default = {
|
|
7
|
+
title: "ErrorScreen",
|
|
8
|
+
component: ErrorScreen_1.ErrorScreen,
|
|
9
|
+
};
|
|
10
|
+
const Template = args => React.createElement(ErrorScreen_1.ErrorScreen, Object.assign({}, args));
|
|
11
|
+
exports.Default = Template.bind({});
|
|
12
|
+
exports.Default.args = {};
|
package/dist/helpers/logger.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing a logger with various logging methods.
|
|
3
|
+
*/
|
|
1
4
|
export interface ILogger {
|
|
2
5
|
/**
|
|
3
6
|
* Logs a message with the info level.
|
|
@@ -20,6 +23,18 @@ export interface ILogger {
|
|
|
20
23
|
*/
|
|
21
24
|
warn(...message: any[]): void;
|
|
22
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Initializes a logger factory with the specified path.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} path - The endpoint to which log messages will be sent.
|
|
30
|
+
* @returns {Object} An object containing a useLogger method to create logger instances.
|
|
31
|
+
*/
|
|
23
32
|
export declare const initLoggerFactory: (path: string) => {
|
|
33
|
+
/**
|
|
34
|
+
* Creates a logger instance with the specified name.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} name - The name of the logger.
|
|
37
|
+
* @returns {ILogger} The logger instance with methods to log messages at different levels.
|
|
38
|
+
*/
|
|
24
39
|
useLogger: (name: string) => ILogger;
|
|
25
40
|
};
|
package/dist/helpers/logger.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initLoggerFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a logger instance with the specified path and name.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} path - The endpoint to which log messages will be sent.
|
|
8
|
+
* @param {string} name - The name of the logger.
|
|
9
|
+
* @returns {ILogger} The logger instance with methods to log messages at different levels.
|
|
10
|
+
*/
|
|
4
11
|
const useLogger = (path, name) => {
|
|
5
12
|
const convertMessage = (message) => message
|
|
6
13
|
.map(m => {
|
|
@@ -35,7 +42,19 @@ const useLogger = (path, name) => {
|
|
|
35
42
|
warn: (...message) => log("warn", message),
|
|
36
43
|
};
|
|
37
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Initializes a logger factory with the specified path.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} path - The endpoint to which log messages will be sent.
|
|
49
|
+
* @returns {Object} An object containing a useLogger method to create logger instances.
|
|
50
|
+
*/
|
|
38
51
|
const initLoggerFactory = (path) => ({
|
|
52
|
+
/**
|
|
53
|
+
* Creates a logger instance with the specified name.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} name - The name of the logger.
|
|
56
|
+
* @returns {ILogger} The logger instance with methods to log messages at different levels.
|
|
57
|
+
*/
|
|
39
58
|
useLogger: (name) => useLogger(path, name),
|
|
40
59
|
});
|
|
41
60
|
exports.initLoggerFactory = initLoggerFactory;
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { UIUtilRendererProps } from "./ui-utils/UIUtilRenderer";
|
|
3
|
+
/**
|
|
4
|
+
* Props for the DryUXProvider component.
|
|
5
|
+
*/
|
|
3
6
|
interface IDryUXProviderProps {
|
|
4
7
|
/**
|
|
5
8
|
* Does not render the renderer for this provider. If this is set to true, then the renderer needs to be mounted
|
|
6
|
-
*
|
|
9
|
+
* explicitly.
|
|
7
10
|
*/
|
|
8
11
|
noRenderer?: boolean;
|
|
9
12
|
/**
|
|
@@ -14,7 +17,16 @@ interface IDryUXProviderProps {
|
|
|
14
17
|
* If true, the viewport detection will be enabled.
|
|
15
18
|
*/
|
|
16
19
|
viewportDetect?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The children elements to be rendered within the provider.
|
|
22
|
+
*/
|
|
17
23
|
children: React.ReactNode;
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* DryUXProvider component that provides UI utilities and optionally renders a UIUtilRenderer.
|
|
27
|
+
*
|
|
28
|
+
* @param {IDryUXProviderProps} props - The props for the DryUXProvider component.
|
|
29
|
+
* @returns {JSX.Element} The DryUXProvider component.
|
|
30
|
+
*/
|
|
19
31
|
export declare const DryUXProvider: React.FC<IDryUXProviderProps>;
|
|
20
32
|
export {};
|
package/dist/provider.js
CHANGED
|
@@ -4,6 +4,12 @@ exports.DryUXProvider = void 0;
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const UIUtilProvider_1 = require("./ui-utils/UIUtilProvider");
|
|
6
6
|
const UIUtilRenderer_1 = require("./ui-utils/UIUtilRenderer");
|
|
7
|
+
/**
|
|
8
|
+
* DryUXProvider component that provides UI utilities and optionally renders a UIUtilRenderer.
|
|
9
|
+
*
|
|
10
|
+
* @param {IDryUXProviderProps} props - The props for the DryUXProvider component.
|
|
11
|
+
* @returns {JSX.Element} The DryUXProvider component.
|
|
12
|
+
*/
|
|
7
13
|
exports.DryUXProvider = React.memo(({ children, noRenderer = false, rendererProps, viewportDetect }) => (React.createElement(UIUtilProvider_1.UIUtilProvider, { viewportDetect: viewportDetect },
|
|
8
14
|
children,
|
|
9
15
|
!noRenderer && React.createElement(UIUtilRenderer_1.UIUtilRenderer, Object.assign({}, rendererProps)))));
|