@devopness/ui-react 2.149.0 → 2.150.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.
@@ -0,0 +1,43 @@
1
+ /** Error with a type field that can be 'required' or any other string except 'required' */
2
+ type ErrorWithType = {
3
+ type: 'required' | Omit<string, 'required'>;
4
+ };
5
+ /** Error containing a direct message string */
6
+ type ErrorWithMessage = {
7
+ message: string;
8
+ };
9
+ /** API error response containing nested message */
10
+ type APIError = {
11
+ errors: {
12
+ message: string;
13
+ };
14
+ };
15
+ type ErrorMessageProps = {
16
+ /** Renders the following error formats, by first match:
17
+ *
18
+ * 1. { type: 'required' }
19
+ *
20
+ * 2. { message: string }
21
+ *
22
+ * 3. { errors: { message: string } } [1]
23
+ *
24
+ * 4. Record<string, any> [2]
25
+ *
26
+ * [1] API Error response
27
+ * [2] Custom error objects
28
+ */
29
+ error?: ErrorWithType | ErrorWithMessage | APIError | Record<string, any> | null;
30
+ /** Additional CSS classes to apply to the error message container */
31
+ className?: string;
32
+ };
33
+ /**
34
+ * Component that displays error messages in a standardized format.
35
+ * Handles multiple error object formats and renders them consistently.
36
+ *
37
+ * @param props - Component props
38
+ * @param props.error - Error object in various possible formats
39
+ * @param props.className - Additional CSS classes to apply to the container
40
+ */
41
+ declare const ErrorMessage: ({ error, className }: ErrorMessageProps) => import("react/jsx-runtime").JSX.Element;
42
+ export type { ErrorMessageProps };
43
+ export { ErrorMessage };
@@ -0,0 +1 @@
1
+ export declare const StyledErrorMessage: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
@@ -0,0 +1 @@
1
+ export * from './ErrorMessage';
@@ -3,4 +3,5 @@ export type { IconProps } from './Icon';
3
3
  export { Icon as IconComponent } from './Icon';
4
4
  export * from './Link';
5
5
  export * from './Tooltip';
6
+ export * from './ErrorMessage';
6
7
  export * from './Pagination';