@dynamic-framework/ui-react 2.0.0-dev.22 → 2.0.0-dev.23

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.
@@ -1,6 +1,7 @@
1
+ type CardBrand = 'visa' | 'mastercard';
1
2
  type Props = {
2
3
  className?: string;
3
- brand?: string;
4
+ brand?: CardBrand;
4
5
  isChipVisible?: boolean;
5
6
  name?: string;
6
7
  number?: string;
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from 'react';
2
+ type Renderable = ReactNode | (() => ReactNode);
3
+ type DDataStateWrapperProps<T> = {
4
+ isLoading: boolean;
5
+ isError: boolean;
6
+ data: T[] | undefined;
7
+ onRetry?: () => void;
8
+ renderLoading?: Renderable;
9
+ renderEmpty?: Renderable;
10
+ renderError?: Renderable;
11
+ children: (data: T[]) => ReactNode;
12
+ };
13
+ export default function DDataStateWrapper<T>({ isLoading, isError, data, onRetry, renderLoading, renderEmpty, renderError, children, }: DDataStateWrapperProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ interface EmptyStateProps {
2
+ message?: string;
3
+ icon?: string;
4
+ actionText?: string;
5
+ onAction?: () => void;
6
+ }
7
+ export declare function EmptyState({ message, icon, actionText, onAction, }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ type ErrorStateProps = {
2
+ message?: string;
3
+ onRetry?: () => void;
4
+ retryMessage?: string;
5
+ color?: 'danger' | 'warning';
6
+ };
7
+ export declare function ErrorState({ message, onRetry, retryMessage, color, }: ErrorStateProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ type LoadingStateProps = {
2
+ ariaLabel?: string;
3
+ className?: string;
4
+ };
5
+ export declare function LoadingState({ ariaLabel, className }: LoadingStateProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import DDataStateWrapper from './DDataStateWrapper';
2
+ export default DDataStateWrapper;
@@ -0,0 +1,11 @@
1
+ import { type PropsWithChildren, type ReactNode, type ErrorInfo } from 'react';
2
+ import { FallbackProps, useErrorBoundary, getErrorMessage } from 'react-error-boundary';
3
+ export { type FallbackProps, useErrorBoundary, getErrorMessage, };
4
+ export type DErrorBoundaryProps = PropsWithChildren<{
5
+ name?: string;
6
+ fallback?: (props: FallbackProps) => ReactNode;
7
+ resetKeys?: unknown[];
8
+ onReset?: () => void;
9
+ onError?: (error: unknown, info: ErrorInfo) => void;
10
+ }>;
11
+ export default function DErrorBoundary({ name, fallback, resetKeys, onReset, onError, children, }: DErrorBoundaryProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { FallbackProps } from 'react-error-boundary';
2
+ type Props = {
3
+ resetErrorBoundary: FallbackProps['resetErrorBoundary'];
4
+ };
5
+ export default function DefaultErrorBoundary({ resetErrorBoundary }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ import DErrorBoundary, { type FallbackProps, useErrorBoundary, getErrorMessage } from './DErrorBoundary';
2
+ export { type FallbackProps, useErrorBoundary, getErrorMessage, };
3
+ export default DErrorBoundary;
@@ -48,3 +48,5 @@ export { default as DCreditCard } from './DCreditCard';
48
48
  export { default as DDropdown } from './DDropdown';
49
49
  export { default as DVoucher } from './DVoucher';
50
50
  export { default as DOtp } from './DOtp';
51
+ export { default as DErrorBoundary, useErrorBoundary, type FallbackProps, getErrorMessage, } from './DErrorBoundary';
52
+ export { default as DDataStateWrapper } from './DDataStateWrapper';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sideEffects": [
4
4
  "*.css"
5
5
  ],
6
- "version": "2.0.0-dev.22",
6
+ "version": "2.0.0-dev.23",
7
7
  "description": "React Dynamic Framework",
8
8
  "license": "https://github.com/dynamic-framework/dynamic-ui/blob/master/LICENSE.md",
9
9
  "repository": {
@@ -103,6 +103,7 @@
103
103
  "jspdf": "^4.0.0",
104
104
  "lucide-react": "^0.553.0",
105
105
  "react-datepicker": "~8.3.0",
106
+ "react-error-boundary": "^6.1.0",
106
107
  "react-international-phone": "~4.6.0",
107
108
  "react-responsive-pagination": "~2.11.3",
108
109
  "react-select": "~5.10.2"
@@ -0,0 +1,72 @@
1
+ @mixin generate-dark-utility($utility) {
2
+ $values: map-get($utility, values);
3
+
4
+ @if type-of($values) == "string" or type-of(nth($values, 1)) != "list" {
5
+ $values: zip($values, $values);
6
+ }
7
+
8
+ @each $key, $value in $values {
9
+ $properties: map-get($utility, property);
10
+
11
+ @if type-of($properties) == "string" {
12
+ $properties: append((), $properties);
13
+ }
14
+
15
+ $property-class: if(map-has-key($utility, class), map-get($utility, class), nth($properties, 1));
16
+ $property-class: if($property-class == null, "", $property-class);
17
+ $css-variable-name: if(map-has-key($utility, css-variable-name), map-get($utility, css-variable-name), map-get($utility, class));
18
+ $property-class-modifier: if($key, if($property-class == "", "", "-") + $key, "");
19
+
20
+ $is-css-var: map-get($utility, css-var);
21
+ $is-local-vars: map-get($utility, local-vars);
22
+
23
+ @if $value != null {
24
+ $escaped-prefix: "dark\\:";
25
+ $selector: ".#{$escaped-prefix}#{$property-class}#{$property-class-modifier}";
26
+
27
+ @if $is-css-var {
28
+ @media (prefers-color-scheme: dark) {
29
+ #{$selector} {
30
+ --#{$prefix}#{$css-variable-name}: #{$value};
31
+ }
32
+ }
33
+ .dark #{$selector} {
34
+ --#{$prefix}#{$css-variable-name}: #{$value};
35
+ }
36
+ } @else {
37
+ @media (prefers-color-scheme: dark) {
38
+ #{$selector} {
39
+ @each $property in $properties {
40
+ @if $is-local-vars {
41
+ @each $local-var, $variable in $is-local-vars {
42
+ --#{$prefix}#{$local-var}: #{$variable};
43
+ }
44
+ }
45
+ #{$property}: $value if($enable-important-utilities, !important, null);
46
+ }
47
+ }
48
+ }
49
+ .dark #{$selector} {
50
+ @each $property in $properties {
51
+ @if $is-local-vars {
52
+ @each $local-var, $variable in $is-local-vars {
53
+ --#{$prefix}#{$local-var}: #{$variable};
54
+ }
55
+ }
56
+ #{$property}: $value if($enable-important-utilities, !important, null);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ @mixin generate-dark-utilities($utilities-map) {
65
+ @each $name, $utility in $utilities-map {
66
+ @if map-has-key($utility, values) and map-has-key($utility, property) {
67
+ @include generate-dark-utility($utility);
68
+ }
69
+ }
70
+ }
71
+
72
+ @include generate-dark-utilities($utilities);
@@ -12,4 +12,6 @@
12
12
 
13
13
  @import "abstracts/utilities-hover";
14
14
 
15
+ @import "abstracts/utilities-dark";
16
+
15
17
  @import "shame";
@@ -13,5 +13,6 @@
13
13
  @import "node_modules/bootstrap/scss/utilities/api";
14
14
 
15
15
  @import "abstracts/utilities-hover";
16
+ @import "abstracts/utilities-dark";
16
17
 
17
18
  @import "shame";