@olenbetong/appframe-ds 0.4.1 → 0.5.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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/scripts/copyAssets.mjs +8 -0
- package/src/index.ts +3 -0
- package/src/layout/AppLayoutDesktop.tsx +3 -0
- package/src/layout/AppLayoutMobile.tsx +3 -0
- package/src/layout/AppMenu.css +1 -0
- package/src/layout/PageContainer.tsx +6 -0
- package/src/layout/index.tsx +5 -0
- package/src/list/ItemList.css +30 -0
- package/src/list/ItemList.tsx +52 -0
- package/src/list/ItemListItem.tsx +41 -0
- package/src/list/ItemListItemText.tsx +23 -0
- package/src/list/index.ts +3 -0
- package/src/page/Page.css +45 -0
- package/src/page/Page.tsx +70 -0
- package/src/page/PageBlock.css +59 -0
- package/src/page/PageBlock.tsx +78 -0
- package/src/page/PageHeader.css +148 -0
- package/src/page/PageHeader.tsx +184 -0
- package/src/page/index.ts +3 -0
- package/src/paper/Paper.css +35 -0
- package/src/paper/Paper.tsx +50 -0
- package/src/paper/index.ts +1 -0
- package/es/AfLookup/BoundLookup.d.ts +0 -10
- package/es/AfLookup/BoundLookup.js +0 -16
- package/es/AfLookup/Combobox.css +0 -78
- package/es/AfLookup/Combobox.d.ts +0 -32
- package/es/AfLookup/Combobox.js +0 -76
- package/es/AfLookup/Lookup.css +0 -125
- package/es/AfLookup/Lookup.d.ts +0 -35
- package/es/AfLookup/Lookup.js +0 -59
- package/es/AfLookup/LookupEdit.d.ts +0 -21
- package/es/AfLookup/LookupEdit.js +0 -49
- package/es/AfLookup/LookupGrid.css +0 -57
- package/es/AfLookup/LookupGrid.d.ts +0 -13
- package/es/AfLookup/LookupGrid.js +0 -27
- package/es/AfLookup/index.d.ts +0 -5
- package/es/AfLookup/index.js +0 -5
- package/es/binding/BoundCheckbox.d.ts +0 -9
- package/es/binding/BoundCheckbox.js +0 -13
- package/es/binding/BoundDatePicker.d.ts +0 -7
- package/es/binding/BoundDatePicker.js +0 -12
- package/es/binding/BoundDateTimePicker.d.ts +0 -7
- package/es/binding/BoundDateTimePicker.js +0 -14
- package/es/binding/BoundInput.d.ts +0 -6
- package/es/binding/BoundInput.js +0 -12
- package/es/binding/BoundNumericTextField.d.ts +0 -20
- package/es/binding/BoundNumericTextField.js +0 -58
- package/es/binding/BoundSelect.d.ts +0 -9
- package/es/binding/BoundSelect.js +0 -13
- package/es/binding/BoundSwitch.d.ts +0 -9
- package/es/binding/BoundSwitch.js +0 -13
- package/es/binding/BoundTextField.d.ts +0 -7
- package/es/binding/BoundTextField.js +0 -22
- package/es/binding/CancelButton.d.ts +0 -3
- package/es/binding/CancelButton.js +0 -14
- package/es/binding/CancelIconButton.d.ts +0 -2
- package/es/binding/CancelIconButton.js +0 -15
- package/es/binding/DataEditToolbar.d.ts +0 -13
- package/es/binding/DataEditToolbar.js +0 -28
- package/es/binding/DataObjectSelect.d.ts +0 -50
- package/es/binding/DataObjectSelect.js +0 -26
- package/es/binding/DeleteButton.d.ts +0 -8
- package/es/binding/DeleteButton.js +0 -14
- package/es/binding/DeleteIconButton.d.ts +0 -10
- package/es/binding/DeleteIconButton.js +0 -15
- package/es/binding/RefreshButton.d.ts +0 -3
- package/es/binding/RefreshButton.js +0 -14
- package/es/binding/RefreshIconButton.d.ts +0 -2
- package/es/binding/RefreshIconButton.js +0 -16
- package/es/binding/RefreshRowIconButton.d.ts +0 -7
- package/es/binding/RefreshRowIconButton.js +0 -15
- package/es/binding/SaveButton.d.ts +0 -3
- package/es/binding/SaveButton.js +0 -14
- package/es/binding/SaveIconButton.d.ts +0 -2
- package/es/binding/SaveIconButton.js +0 -15
- package/es/binding/index.d.ts +0 -19
- package/es/binding/index.js +0 -19
- package/es/index.d.ts +0 -3
- package/es/index.js +0 -3
- package/es/layout/AppLayoutDesktop.css +0 -65
- package/es/layout/AppLayoutDesktop.d.ts +0 -3
- package/es/layout/AppLayoutDesktop.js +0 -19
- package/es/layout/AppLayoutMobile.css +0 -75
- package/es/layout/AppLayoutMobile.d.ts +0 -3
- package/es/layout/AppLayoutMobile.js +0 -18
- package/es/layout/AppMenu.css +0 -67
- package/es/layout/AppMenu.d.ts +0 -8
- package/es/layout/AppMenu.js +0 -36
- package/es/layout/AppMenuItem.css +0 -97
- package/es/layout/AppMenuItem.d.ts +0 -50
- package/es/layout/AppMenuItem.js +0 -14
- package/es/layout/AppMenuSubheader.css +0 -18
- package/es/layout/AppMenuSubheader.d.ts +0 -4
- package/es/layout/AppMenuSubheader.js +0 -6
- package/es/layout/ErrorBoundary.css +0 -101
- package/es/layout/ErrorBoundary.d.ts +0 -30
- package/es/layout/ErrorBoundary.js +0 -81
- package/es/layout/PageContainer.css +0 -29
- package/es/layout/PageContainer.d.ts +0 -7
- package/es/layout/PageContainer.js +0 -6
- package/es/layout/PartnerToggle.d.ts +0 -5
- package/es/layout/PartnerToggle.js +0 -9
- package/es/layout/constants.d.ts +0 -2
- package/es/layout/constants.js +0 -2
- package/es/layout/index.css +0 -65
- package/es/layout/index.d.ts +0 -33
- package/es/layout/index.js +0 -31
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
.AppMenuItem-root {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
position: relative;
|
|
5
|
-
border-radius: var(--ds-border-radius-md, 0.25rem);
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
margin: 0.5rem;
|
|
8
|
-
padding: 0.5rem;
|
|
9
|
-
width: calc(100% - 1rem);
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
text-decoration: none;
|
|
12
|
-
color: var(--ds-color-neutral-text-default, rgba(0, 0, 0, 0.87));
|
|
13
|
-
background: transparent;
|
|
14
|
-
border: none;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
font-family: inherit;
|
|
17
|
-
font-size: inherit;
|
|
18
|
-
text-align: left;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@media (pointer: fine) {
|
|
22
|
-
.AppMenuItem-root {
|
|
23
|
-
margin: 0.2rem 0.5rem;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.AppMenuItem-icon {
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
min-width: 2.5rem;
|
|
31
|
-
color: inherit;
|
|
32
|
-
flex-shrink: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.AppMenuItem-text {
|
|
36
|
-
flex: 1;
|
|
37
|
-
font-weight: 500;
|
|
38
|
-
color: var(--ds-color-neutral-text-default, rgba(0, 0, 0, 0.87));
|
|
39
|
-
min-width: 0;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
text-overflow: ellipsis;
|
|
42
|
-
white-space: nowrap;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.AppMenuItem-info {
|
|
46
|
-
margin-left: auto;
|
|
47
|
-
flex-shrink: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.AppMenuItem-root::before {
|
|
51
|
-
background-color: #000;
|
|
52
|
-
opacity: 0;
|
|
53
|
-
transition:
|
|
54
|
-
opacity 30ms linear,
|
|
55
|
-
background-color 30ms linear;
|
|
56
|
-
content: "";
|
|
57
|
-
position: absolute;
|
|
58
|
-
top: 0;
|
|
59
|
-
left: 0;
|
|
60
|
-
height: 100%;
|
|
61
|
-
width: 100%;
|
|
62
|
-
pointer-events: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.AppMenuItem-root:hover,
|
|
66
|
-
.AppMenuItem-root:focus,
|
|
67
|
-
.AppMenuItem-root:active {
|
|
68
|
-
text-decoration: none;
|
|
69
|
-
outline: none;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.AppMenuItem-root:hover::before {
|
|
73
|
-
opacity: 0.04;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.AppMenuItem-root:active::before {
|
|
77
|
-
opacity: 0.16;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.AppMenuItem-root.active::before,
|
|
81
|
-
.AppMenuItem-root.active:hover::before {
|
|
82
|
-
background-color: var(--ds-color-brand-base-default, var(--brand-primary, #0062ba));
|
|
83
|
-
opacity: 0.16;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.AppMenuItem-root.active:hover::before {
|
|
87
|
-
opacity: 0.2;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.AppMenuItem-root.active:active::before {
|
|
91
|
-
opacity: 0.24;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.AppMenuItem-root.active .AppMenuItem-text,
|
|
95
|
-
.AppMenuItem-root.active .AppMenuItem-icon {
|
|
96
|
-
color: var(--ds-color-brand-base-default, var(--brand-primary, #0062ba));
|
|
97
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import "./AppMenuItem.css";
|
|
2
|
-
import type { To } from "react-router";
|
|
3
|
-
import { type NavLinkProps } from "react-router";
|
|
4
|
-
import type React from "react";
|
|
5
|
-
export type AppMenuItemProps = Omit<NavLinkProps, "className"> & {
|
|
6
|
-
children: React.ReactNode | React.ReactNode[];
|
|
7
|
-
info?: React.ReactNode | React.ReactNode[];
|
|
8
|
-
icon?: React.ReactNode;
|
|
9
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
10
|
-
to: To;
|
|
11
|
-
end?: boolean;
|
|
12
|
-
className?: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const AppMenuItem: React.ForwardRefExoticComponent<Omit<NavLinkProps, "className"> & {
|
|
15
|
-
children: React.ReactNode | React.ReactNode[];
|
|
16
|
-
info?: React.ReactNode | React.ReactNode[];
|
|
17
|
-
icon?: React.ReactNode;
|
|
18
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
19
|
-
to: To;
|
|
20
|
-
end?: boolean;
|
|
21
|
-
className?: string;
|
|
22
|
-
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
23
|
-
export type AppMenuItemExternalLinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & {
|
|
24
|
-
children: React.ReactNode | React.ReactNode[];
|
|
25
|
-
info?: React.ReactNode | React.ReactNode[];
|
|
26
|
-
icon?: React.ReactNode;
|
|
27
|
-
href: string;
|
|
28
|
-
target?: string;
|
|
29
|
-
};
|
|
30
|
-
export declare const AppMenuItemExternalLink: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & {
|
|
31
|
-
children: React.ReactNode | React.ReactNode[];
|
|
32
|
-
info?: React.ReactNode | React.ReactNode[];
|
|
33
|
-
icon?: React.ReactNode;
|
|
34
|
-
href: string;
|
|
35
|
-
target?: string;
|
|
36
|
-
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
37
|
-
export type AppMenuItemButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> & {
|
|
38
|
-
active?: boolean;
|
|
39
|
-
children: React.ReactNode | React.ReactNode[];
|
|
40
|
-
info?: React.ReactNode | React.ReactNode[];
|
|
41
|
-
icon?: React.ReactNode;
|
|
42
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
43
|
-
};
|
|
44
|
-
export declare const AppMenuItemButton: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> & {
|
|
45
|
-
active?: boolean;
|
|
46
|
-
children: React.ReactNode | React.ReactNode[];
|
|
47
|
-
info?: React.ReactNode | React.ReactNode[];
|
|
48
|
-
icon?: React.ReactNode;
|
|
49
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
50
|
-
} & React.RefAttributes<HTMLButtonElement>>;
|
package/es/layout/AppMenuItem.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "./AppMenuItem.css";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import { forwardRef } from "react";
|
|
5
|
-
import { NavLink } from "react-router";
|
|
6
|
-
export const AppMenuItem = forwardRef(function AppMenuItem({ children, className, end = true, info, to, icon, ...props }, ref) {
|
|
7
|
-
return (_jsxs(NavLink, { viewTransition: true, to: to, className: clsx("AppMenuItem-root", className), end: end, ...props, ref: ref, children: [icon && _jsx("span", { className: "AppMenuItem-icon", children: icon }), _jsx("span", { className: "AppMenuItem-text", children: children }), info && _jsx("span", { className: "AppMenuItem-info", children: info })] }));
|
|
8
|
-
});
|
|
9
|
-
export const AppMenuItemExternalLink = forwardRef(function AppMenuItemExternalLink({ children, className, href, info, icon, target, ...props }, ref) {
|
|
10
|
-
return (_jsxs("a", { href: href, className: clsx("AppMenuItem-root", className), target: target, ...props, ref: ref, children: [icon && _jsx("span", { className: "AppMenuItem-icon", children: icon }), _jsx("span", { className: "AppMenuItem-text", children: children }), info && _jsx("span", { className: "AppMenuItem-info", children: info })] }));
|
|
11
|
-
});
|
|
12
|
-
export const AppMenuItemButton = forwardRef(function AppMenuItemButton({ children, className, active = false, info, onClick, icon, ...props }, ref) {
|
|
13
|
-
return (_jsxs("button", { type: "button", onClick: onClick, className: clsx("AppMenuItem-root", className, active && "active"), ...props, ref: ref, children: [icon && _jsx("span", { className: "AppMenuItem-icon", children: icon }), _jsx("span", { className: "AppMenuItem-text", children: children }), info && _jsx("span", { className: "AppMenuItem-info", children: info })] }));
|
|
14
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.AppMenuSubheader-root {
|
|
2
|
-
font-size: var(--ds-font-size-xs, 0.75rem);
|
|
3
|
-
font-weight: 600;
|
|
4
|
-
letter-spacing: 0.08em;
|
|
5
|
-
text-transform: uppercase;
|
|
6
|
-
padding: 0.5rem 1rem;
|
|
7
|
-
color: var(--ds-color-neutral-text-subtle, #555);
|
|
8
|
-
background-color: var(--ds-color-neutral-background-default, transparent);
|
|
9
|
-
position: sticky;
|
|
10
|
-
top: 0;
|
|
11
|
-
z-index: 1;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@media (pointer: fine) {
|
|
15
|
-
.AppMenuSubheader-root {
|
|
16
|
-
line-height: 36px;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./AppMenuSubheader.css";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
export function AppMenuSubheader({ children, className, ...props }) {
|
|
5
|
-
return (_jsx("div", { className: clsx("AppMenuSubheader-root", className), ...props, children: children }));
|
|
6
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
.AppErrorBoundary-root {
|
|
2
|
-
height: 100vh;
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.AppErrorBoundary-inner {
|
|
9
|
-
max-width: 36rem;
|
|
10
|
-
width: 100%;
|
|
11
|
-
margin: 0 auto;
|
|
12
|
-
padding: 1rem;
|
|
13
|
-
text-align: center;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.AppErrorBoundary-image {
|
|
17
|
-
opacity: 0.6;
|
|
18
|
-
max-height: 30vh;
|
|
19
|
-
max-width: 50vw;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.AppErrorBoundary-title {
|
|
23
|
-
margin-top: var(--ds-size-6, 1.5rem);
|
|
24
|
-
font-size: var(--ds-font-size-6, 1.5rem);
|
|
25
|
-
font-weight: 700;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.AppErrorBoundary-alert {
|
|
29
|
-
margin-block: var(--ds-size-6, 1.5rem);
|
|
30
|
-
background: var(--ds-color-danger-surface-default, #fde8e8);
|
|
31
|
-
color: var(--ds-color-danger-text-default, #c01c2c);
|
|
32
|
-
border: 1px solid var(--ds-color-danger-border-default, #f5a6ae);
|
|
33
|
-
border-radius: var(--ds-border-radius-md, 0.25rem);
|
|
34
|
-
padding: var(--ds-size-3, 0.75rem) var(--ds-size-4, 1rem);
|
|
35
|
-
text-align: left;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.AppErrorBoundary-message {
|
|
39
|
-
margin-bottom: var(--ds-size-6, 1.5rem);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.AppErrorBoundary-reload {
|
|
43
|
-
appearance: none;
|
|
44
|
-
border: 1px solid currentColor;
|
|
45
|
-
border-radius: var(--ds-border-radius-md, 0.25rem);
|
|
46
|
-
background: transparent;
|
|
47
|
-
color: inherit;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
font: inherit;
|
|
50
|
-
font-size: var(--ds-font-size-3, 1rem);
|
|
51
|
-
padding: var(--ds-size-2, 0.5rem) var(--ds-size-4, 1rem);
|
|
52
|
-
margin-block: var(--ds-size-6, 1.5rem);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.AppErrorBoundary-reload:hover {
|
|
56
|
-
background: rgb(0 0 0 / 0.05);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.ErrorAlertFallback-root {
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: flex-start;
|
|
62
|
-
gap: var(--ds-size-2, 0.5rem);
|
|
63
|
-
background: var(--ds-color-danger-surface-default, #fde8e8);
|
|
64
|
-
color: var(--ds-color-danger-text-default, #c01c2c);
|
|
65
|
-
border: 1px solid var(--ds-color-danger-border-default, #f5a6ae);
|
|
66
|
-
border-radius: var(--ds-border-radius-md, 0.25rem);
|
|
67
|
-
padding: var(--ds-size-3, 0.75rem) var(--ds-size-4, 1rem);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.ErrorAlertFallback-content {
|
|
71
|
-
flex: 1;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.ErrorAlertFallback-title {
|
|
75
|
-
font-weight: 600;
|
|
76
|
-
margin-bottom: var(--ds-size-1, 0.25rem);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ErrorAlertFallback-reload {
|
|
80
|
-
appearance: none;
|
|
81
|
-
background: transparent;
|
|
82
|
-
border: none;
|
|
83
|
-
color: inherit;
|
|
84
|
-
cursor: pointer;
|
|
85
|
-
font: inherit;
|
|
86
|
-
font-weight: 600;
|
|
87
|
-
padding: 0;
|
|
88
|
-
text-decoration: underline;
|
|
89
|
-
flex-shrink: 0;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.RouteErrorPage-stack {
|
|
93
|
-
background: rgb(0 0 0 / 0.07);
|
|
94
|
-
border: 2px solid rgb(0 0 0 / 0.15);
|
|
95
|
-
border-radius: var(--ds-border-radius-md, 0.25rem);
|
|
96
|
-
padding: var(--ds-size-4, 1rem);
|
|
97
|
-
overflow-x: auto;
|
|
98
|
-
white-space: pre-wrap;
|
|
99
|
-
word-break: break-all;
|
|
100
|
-
font-size: var(--ds-font-size-1, 0.75rem);
|
|
101
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "./ErrorBoundary.css";
|
|
2
|
-
import type { DataObject } from "@olenbetong/appframe-data";
|
|
3
|
-
import { Component } from "react";
|
|
4
|
-
export type AppErrorBoundaryProps = {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
message?: string | ((error: unknown) => string);
|
|
7
|
-
imgSrc?: string;
|
|
8
|
-
image?: React.ReactNode;
|
|
9
|
-
};
|
|
10
|
-
type AppErrorBoundaryState = {
|
|
11
|
-
hasError: boolean;
|
|
12
|
-
error: unknown;
|
|
13
|
-
};
|
|
14
|
-
export declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppErrorBoundaryState> {
|
|
15
|
-
constructor(props: AppErrorBoundaryProps);
|
|
16
|
-
static getDerivedStateFromError(error: unknown): AppErrorBoundaryState;
|
|
17
|
-
componentDidCatch(error: unknown, errorInfo: unknown): void;
|
|
18
|
-
render(): React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
export type ErrorAlertFallbackProps = {
|
|
21
|
-
error: unknown;
|
|
22
|
-
className?: string;
|
|
23
|
-
};
|
|
24
|
-
export declare function ErrorAlertFallback({ error, className }: ErrorAlertFallbackProps): import("react").JSX.Element;
|
|
25
|
-
export declare function RouteErrorPage(): import("react").JSX.Element;
|
|
26
|
-
export declare function AsyncErrorAlert(): import("react").JSX.Element;
|
|
27
|
-
export declare function DataObjectErrorAlert({ dataObject }: {
|
|
28
|
-
dataObject: DataObject<any>;
|
|
29
|
-
}): import("react").JSX.Element | null;
|
|
30
|
-
export {};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "./ErrorBoundary.css";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
|
-
import { useError } from "@olenbetong/appframe-react";
|
|
5
|
-
import { Component, useEffect } from "react";
|
|
6
|
-
import { useAsyncError, useRouteError } from "react-router";
|
|
7
|
-
import { PageContainer } from "./PageContainer.js";
|
|
8
|
-
function parseError(error) {
|
|
9
|
-
let message = "Unspecified error";
|
|
10
|
-
let stackTrace = null;
|
|
11
|
-
let title = getLocalizedString("Unexpected application error");
|
|
12
|
-
if (typeof error === "string") {
|
|
13
|
-
message = error;
|
|
14
|
-
}
|
|
15
|
-
else if (error && typeof error === "object") {
|
|
16
|
-
const err = error;
|
|
17
|
-
if (err.status) {
|
|
18
|
-
title = `${err.status} ${err.statusText}`;
|
|
19
|
-
message = err.message ?? "";
|
|
20
|
-
}
|
|
21
|
-
else if (err.message) {
|
|
22
|
-
message = err.message;
|
|
23
|
-
if (err.type) {
|
|
24
|
-
message = `${err.type}: ${message}`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
message = String(error);
|
|
29
|
-
}
|
|
30
|
-
if (err.stack || err.stackTrace) {
|
|
31
|
-
stackTrace = err.stack ?? err.stackTrace;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return { message, stackTrace, title };
|
|
35
|
-
}
|
|
36
|
-
export class AppErrorBoundary extends Component {
|
|
37
|
-
constructor(props) {
|
|
38
|
-
super(props);
|
|
39
|
-
this.state = { hasError: false, error: null };
|
|
40
|
-
}
|
|
41
|
-
static getDerivedStateFromError(error) {
|
|
42
|
-
return { hasError: true, error };
|
|
43
|
-
}
|
|
44
|
-
componentDidCatch(error, errorInfo) {
|
|
45
|
-
console.error(error, errorInfo);
|
|
46
|
-
}
|
|
47
|
-
render() {
|
|
48
|
-
if (this.state.hasError) {
|
|
49
|
-
const { imgSrc, message, image } = this.props;
|
|
50
|
-
const { message: errorMessage } = parseError(this.state.error);
|
|
51
|
-
const customMessage = typeof message === "function" ? message(this.state.error) : message;
|
|
52
|
-
return (_jsx("div", { className: "AppErrorBoundary-root", children: _jsxs("div", { className: "AppErrorBoundary-inner", children: [image ?? (_jsx("img", { alt: "", src: imgSrc ?? "/file/site/graphic/error-broken-robot.svg", className: "AppErrorBoundary-image" })), _jsx("h1", { className: "AppErrorBoundary-title", children: getLocalizedString("Something went terribly wrong!") }), _jsx("div", { className: "AppErrorBoundary-alert", children: errorMessage }), _jsx("p", { className: "AppErrorBoundary-message", children: customMessage ??
|
|
53
|
-
getLocalizedString("Sometimes it is enough to simply refresh the page. If the error persists, contact the IT department.") }), _jsx("button", { type: "button", className: "AppErrorBoundary-reload", onClick: () => window.location.reload(), children: getLocalizedString("Refresh page") })] }) }));
|
|
54
|
-
}
|
|
55
|
-
return this.props.children;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
export function ErrorAlertFallback({ error, className }) {
|
|
59
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
60
|
-
return (_jsxs("div", { className: `ErrorAlertFallback-root${className ? ` ${className}` : ""}`, children: [_jsxs("div", { className: "ErrorAlertFallback-content", children: [_jsx("p", { className: "ErrorAlertFallback-title", children: getLocalizedString("An error occured. Try refreshing the page") }), _jsx("p", { children: message })] }), _jsx("button", { type: "button", className: "ErrorAlertFallback-reload", onClick: () => window.location.reload(), children: getLocalizedString("Reload page") })] }));
|
|
61
|
-
}
|
|
62
|
-
// ── RouteErrorPage ────────────────────────────────────────────────────────────
|
|
63
|
-
export function RouteErrorPage() {
|
|
64
|
-
const error = useRouteError();
|
|
65
|
-
const { message, stackTrace, title } = parseError(error);
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
globalThis.af?.common?.logError?.(error);
|
|
68
|
-
}, [error]);
|
|
69
|
-
return (_jsxs(PageContainer, { className: "flow", children: [_jsx("h1", { children: title }), message && _jsx("p", { children: message }), stackTrace && _jsx("pre", { className: "RouteErrorPage-stack", children: stackTrace })] }));
|
|
70
|
-
}
|
|
71
|
-
// ── AsyncErrorAlert ───────────────────────────────────────────────────────────
|
|
72
|
-
export function AsyncErrorAlert() {
|
|
73
|
-
const error = useAsyncError();
|
|
74
|
-
const message = typeof error === "string" ? error : error?.message;
|
|
75
|
-
return _jsx("div", { className: "ErrorAlertFallback-root", children: message });
|
|
76
|
-
}
|
|
77
|
-
// ── DataObjectErrorAlert ──────────────────────────────────────────────────────
|
|
78
|
-
export function DataObjectErrorAlert({ dataObject }) {
|
|
79
|
-
const error = useError(dataObject);
|
|
80
|
-
return error ? _jsx("div", { className: "ErrorAlertFallback-root", children: error }) : null;
|
|
81
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
@media screen {
|
|
2
|
-
.ObPageContainer-root {
|
|
3
|
-
max-height: 100%;
|
|
4
|
-
overflow: auto;
|
|
5
|
-
height: auto;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.ObPageContainer-root.ObPageContainer-fullHeight {
|
|
9
|
-
height: 100%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.ObPageContainer-inner {
|
|
13
|
-
margin-left: 0;
|
|
14
|
-
height: auto;
|
|
15
|
-
padding: 1rem;
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
max-width: 100%;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.ObPageContainer-fullHeight .ObPageContainer-inner {
|
|
21
|
-
height: 100%;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@media screen and (min-width: 600px) {
|
|
26
|
-
.ObPageContainer-inner {
|
|
27
|
-
padding: 1rem 1.5rem;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "./PageContainer.css";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
export type PageContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
-
fullHeight?: boolean;
|
|
5
|
-
maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | false;
|
|
6
|
-
};
|
|
7
|
-
export declare function PageContainer({ children, className, fullHeight, maxWidth, ...props }: PageContainerProps): React.JSX.Element;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./PageContainer.css";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
export function PageContainer({ children, className, fullHeight, maxWidth, ...props }) {
|
|
5
|
-
return (_jsx("div", { className: clsx("ObPageContainer-root", fullHeight && "ObPageContainer-fullHeight"), children: _jsx("div", { className: clsx("ObPageContainer-inner", className), ...props, children: children }) }));
|
|
6
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createPortal } from "react-dom";
|
|
3
|
-
let toggleRoot = document.createElement("div");
|
|
4
|
-
let brand = document.querySelector(".partner-nav__brand");
|
|
5
|
-
toggleRoot.id = "toggle-root";
|
|
6
|
-
document.querySelector(".partner-nav")?.insertBefore(toggleRoot, brand);
|
|
7
|
-
export function PartnerToggle({ onClick, open, }) {
|
|
8
|
-
return createPortal(_jsx("button", { type: "button", className: "LayoutSmall-toggle", onClick: onClick, children: open ? "◀" : "☰" }), toggleRoot);
|
|
9
|
-
}
|
package/es/layout/constants.d.ts
DELETED
package/es/layout/constants.js
DELETED
package/es/layout/index.css
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
.app-view {
|
|
2
|
-
height: 100%;
|
|
3
|
-
overflow-y: hidden;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.scroll-view {
|
|
7
|
-
height: 100%;
|
|
8
|
-
max-height: 100%;
|
|
9
|
-
overflow-y: auto;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.flow > * + * {
|
|
13
|
-
margin-top: var(--flow-spacing, 1rem) !important;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.flow-xs > * {
|
|
17
|
-
--flow-spacing: 0.25rem;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.flow-sm > * {
|
|
21
|
-
--flow-spacing: 0.5rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.flow-lg > * {
|
|
25
|
-
--flow-spacing: 1.5rem;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.flow-xl > * {
|
|
29
|
-
--flow-spacing: 2rem;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.flow-xxl > * {
|
|
33
|
-
--flow-spacing: 3rem;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.app-grid {
|
|
37
|
-
height: 100%;
|
|
38
|
-
overflow-y: hidden;
|
|
39
|
-
display: grid;
|
|
40
|
-
gap: 1rem;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.rows-af {
|
|
44
|
-
grid-template-rows: auto 1fr;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.rows-aaf {
|
|
48
|
-
grid-template-rows: auto auto 1fr;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.rows-afaf {
|
|
52
|
-
grid-template-rows: auto 1fr auto 1fr;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.rows-aff {
|
|
56
|
-
grid-template-rows: auto 1fr 1fr;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.rows-f {
|
|
60
|
-
grid-template-rows: 1fr;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.rows-ff {
|
|
64
|
-
grid-template-rows: 1fr 1fr;
|
|
65
|
-
}
|
package/es/layout/index.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
import type { AppMenuProps } from "./AppMenu.js";
|
|
4
|
-
export type AppLayoutProps = {
|
|
5
|
-
AppMenuProps?: AppMenuProps;
|
|
6
|
-
children: React.ReactNode | React.ReactNode[];
|
|
7
|
-
menu?: React.ReactNode | React.ReactNode[];
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated The toolbar is now server-rendered. This prop has no effect.
|
|
10
|
-
*/
|
|
11
|
-
toolbar?: React.ReactNode | React.ReactNode[];
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated The title is now rendered in the server-rendered toolbar. This prop has no effect.
|
|
14
|
-
*/
|
|
15
|
-
title?: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated The toolbar is now server-rendered. This prop has no effect.
|
|
18
|
-
*/
|
|
19
|
-
enableMenuToggle?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Enable partner mode (for partner.olenbetong.no applications).
|
|
22
|
-
* Adds a toggle button to the existing partner header instead of the app bar.
|
|
23
|
-
*/
|
|
24
|
-
partner?: boolean;
|
|
25
|
-
};
|
|
26
|
-
export * from "./AppMenu.js";
|
|
27
|
-
export * from "./AppMenuItem.js";
|
|
28
|
-
export * from "./AppMenuSubheader.js";
|
|
29
|
-
export * from "./constants.js";
|
|
30
|
-
export * from "./ErrorBoundary.js";
|
|
31
|
-
export * from "./PageContainer.js";
|
|
32
|
-
export * from "./PartnerToggle.js";
|
|
33
|
-
export declare function AppLayout(props: AppLayoutProps): React.JSX.Element;
|
package/es/layout/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./index.css";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { AppLayoutDesktop } from "./AppLayoutDesktop.js";
|
|
5
|
-
import { AppLayoutMobile } from "./AppLayoutMobile.js";
|
|
6
|
-
function useIsMobile() {
|
|
7
|
-
let [isMobile, setIsMobile] = useState(() => {
|
|
8
|
-
if (typeof window === "undefined")
|
|
9
|
-
return false;
|
|
10
|
-
return window.matchMedia("(max-width: 1199px)").matches;
|
|
11
|
-
});
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
let mq = window.matchMedia("(max-width: 1199px)");
|
|
14
|
-
let handler = (e) => setIsMobile(e.matches);
|
|
15
|
-
mq.addEventListener("change", handler);
|
|
16
|
-
return () => mq.removeEventListener("change", handler);
|
|
17
|
-
}, []);
|
|
18
|
-
return isMobile;
|
|
19
|
-
}
|
|
20
|
-
export * from "./AppMenu.js";
|
|
21
|
-
export * from "./AppMenuItem.js";
|
|
22
|
-
export * from "./AppMenuSubheader.js";
|
|
23
|
-
export * from "./constants.js";
|
|
24
|
-
export * from "./ErrorBoundary.js";
|
|
25
|
-
export * from "./PageContainer.js";
|
|
26
|
-
export * from "./PartnerToggle.js";
|
|
27
|
-
export function AppLayout(props) {
|
|
28
|
-
let isSmall = useIsMobile();
|
|
29
|
-
let Component = isSmall ? AppLayoutMobile : AppLayoutDesktop;
|
|
30
|
-
return _jsx(Component, { ...props });
|
|
31
|
-
}
|