@dynamic-framework/ui-react 2.0.0-dev.21 → 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.
- package/dist/css/dynamic-ui-non-root.css +13222 -2
- package/dist/css/dynamic-ui-non-root.min.css +3 -3
- package/dist/css/dynamic-ui-root.css +2 -2
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +13222 -2
- package/dist/css/dynamic-ui.min.css +3 -3
- package/dist/index.esm.js +149 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +157 -12
- package/dist/index.js.map +1 -1
- package/dist/types/components/DButton/DButton.d.ts +4 -1
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +5 -2
- package/dist/types/components/DCreditCard/DCreditCard.d.ts +2 -1
- package/dist/types/components/DDataStateWrapper/DDataStateWrapper.d.ts +14 -0
- package/dist/types/components/DDataStateWrapper/components/EmptyState.d.ts +8 -0
- package/dist/types/components/DDataStateWrapper/components/ErrorState.d.ts +8 -0
- package/dist/types/components/DDataStateWrapper/components/LoadingState.d.ts +6 -0
- package/dist/types/components/DDataStateWrapper/index.d.ts +2 -0
- package/dist/types/components/DErrorBoundary/DErrorBoundary.d.ts +11 -0
- package/dist/types/components/DErrorBoundary/components/DefaultErrorBoundary.d.ts +6 -0
- package/dist/types/components/DErrorBoundary/index.d.ts +3 -0
- package/dist/types/components/DVoucher/DVoucher.d.ts +5 -4
- package/dist/types/components/index.d.ts +2 -0
- package/package.json +3 -2
- package/src/style/abstracts/_utilities-dark.scss +72 -0
- package/src/style/components/_d-voucher.scss +1 -0
- package/src/style/dynamic-ui-non-root.scss +2 -0
- package/src/style/dynamic-ui.scss +1 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import type { BaseProps, ButtonVariant, ComponentColor, ComponentSize, EndIconProps, StartIconProps } from '../interface';
|
|
3
3
|
interface Props extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'>, BaseProps, StartIconProps, EndIconProps {
|
|
4
|
+
href?: string;
|
|
5
|
+
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
6
|
+
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
|
|
4
7
|
color?: ComponentColor;
|
|
5
8
|
size?: ComponentSize;
|
|
6
9
|
variant?: ButtonVariant;
|
|
@@ -9,5 +12,5 @@ interface Props extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'>,
|
|
|
9
12
|
loadingText?: string;
|
|
10
13
|
loadingAriaLabel?: string;
|
|
11
14
|
}
|
|
12
|
-
declare const DButton: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
declare const DButton: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
13
16
|
export default DButton;
|
|
@@ -13,7 +13,10 @@ type Props = BaseProps & FamilyIconProps & {
|
|
|
13
13
|
ariaLabel?: string;
|
|
14
14
|
stopPropagationEnabled?: boolean;
|
|
15
15
|
disabled?: boolean;
|
|
16
|
-
|
|
16
|
+
href?: string;
|
|
17
|
+
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
18
|
+
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
|
|
19
|
+
onClick?: (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
17
20
|
};
|
|
18
|
-
export default function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, color, type, loading, disabled, stopPropagationEnabled, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, color, type, loading, disabled, href, target, rel, stopPropagationEnabled, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
19
22
|
export {};
|
|
@@ -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,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;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode } from 'react';
|
|
1
|
+
import { ComponentProps, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import DIcon from '../DIcon';
|
|
2
3
|
type Props = PropsWithChildren<{
|
|
3
4
|
amount?: string;
|
|
4
5
|
amountDetails?: ReactNode;
|
|
5
|
-
icon?: string
|
|
6
|
-
|
|
6
|
+
icon?: false | null | string | Partial<ComponentProps<typeof DIcon>>;
|
|
7
|
+
className?: string;
|
|
7
8
|
message: string;
|
|
8
9
|
title: string;
|
|
9
10
|
downloadText?: string;
|
|
10
11
|
shareText?: string;
|
|
11
12
|
onError?: (err: Error) => Promise<void> | void;
|
|
12
13
|
}>;
|
|
13
|
-
export default function DVoucher({ amount, amountDetails, icon,
|
|
14
|
+
export default function DVoucher({ amount, amountDetails, icon, title, onError, message, downloadText, shareText, className, children, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -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,9 +3,9 @@
|
|
|
3
3
|
"sideEffects": [
|
|
4
4
|
"*.css"
|
|
5
5
|
],
|
|
6
|
-
"version": "2.0.0-dev.
|
|
6
|
+
"version": "2.0.0-dev.23",
|
|
7
7
|
"description": "React Dynamic Framework",
|
|
8
|
-
"license": "https://github.com/dynamic-framework/dynamic-ui/blob/master/
|
|
8
|
+
"license": "https://github.com/dynamic-framework/dynamic-ui/blob/master/LICENSE.md",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/dynamic-framework/dynamic-ui.git"
|
|
@@ -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);
|