@hortiview/shared-components 2.2.0 → 2.4.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 +24 -0
- package/README.md +11 -0
- package/dist/AlertBanner-75jjene1.js +26 -0
- package/dist/OfflineView-BW19N4Cu.js +48 -0
- package/dist/assets/AlertBanner.css +1 -1
- package/dist/assets/ContextMenu.css +1 -1
- package/dist/assets/Modal.css +1 -1
- package/dist/assets/OfflineView.css +1 -0
- package/dist/components/AlertBanner/AlertBanner.d.ts +1 -2
- package/dist/components/AlertBanner/AlertBanner.js +6 -22
- package/dist/components/AlertBanner/AlertBanner.test.js +1 -1
- package/dist/components/AlertBanner/LinkBanner.d.ts +21 -0
- package/dist/components/AlertBanner/LinkBanner.js +37 -0
- package/dist/components/AlertBanner/LinkBanner.test.d.ts +1 -0
- package/dist/components/AlertBanner/LinkBanner.test.js +17 -0
- package/dist/components/BaseView/BaseView.d.ts +10 -1
- package/dist/components/BaseView/BaseView.js +42 -39
- package/dist/components/BaseView/BaseView.test.js +51 -34
- package/dist/components/ContextMenu/ContextMenu.d.ts +12 -1
- package/dist/components/ContextMenu/ContextMenu.js +40 -36
- package/dist/components/ContextMenu/ContextMenu.test.js +42 -19
- package/dist/components/DeleteModal/DeleteModal.d.ts +13 -1
- package/dist/components/DeleteModal/DeleteModal.js +52 -48
- package/dist/components/DeleteModal/DeleteModal.test.js +35 -11
- package/dist/components/GenericTable/GenericTable.d.ts +3 -1
- package/dist/components/GenericTable/GenericTable.js +1225 -1216
- package/dist/components/GenericTable/GenericTable.test.js +36 -6
- package/dist/components/Modal/Modal.d.ts +6 -1
- package/dist/components/Modal/Modal.js +126 -120
- package/dist/components/ModulePadding/ModulePadding.js +1 -1
- package/dist/components/OfflineView/OfflineView.d.ts +68 -0
- package/dist/components/OfflineView/OfflineView.js +9 -0
- package/dist/components/OfflineView/OfflineView.test.d.ts +1 -0
- package/dist/components/OfflineView/OfflineView.test.js +24 -0
- package/dist/components/Stepper/Stepper.d.ts +4 -3
- package/dist/components/Stepper/Stepper.js +33 -21
- package/dist/components/Stepper/Stepper.test.js +40 -64
- package/dist/components/Stepper/components/StepperButton.d.ts +8 -2
- package/dist/components/Stepper/components/StepperButton.js +54 -38
- package/dist/components/Stepper/stepperTypes.d.ts +31 -1
- package/dist/main.d.ts +6 -4
- package/dist/main.js +101 -97
- package/dist/types/GenericTable.d.ts +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## [2.4.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.3.0...v2.4.0) (2025-08-21)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* add button and tests ([fe8ba0d](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/fe8ba0d7e6439e8c8abf163c4b16d8c9aef1d36a))
|
|
6
|
+
* create OfflineView component ([b6ff2d7](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/b6ff2d78125216875f3d6345f06100aeb578f1b6))
|
|
7
|
+
* import offlineView and create tests and stories ([b577ae6](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/b577ae69559b1e215f0888f6da921b7cedf1e1ce))
|
|
8
|
+
|
|
9
|
+
### Code Refactoring
|
|
10
|
+
|
|
11
|
+
* add new props and clarify prop descriptions and defaults ([e81d321](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/e81d3219597a7aba649658dc055729eb6d6d5596))
|
|
12
|
+
* change props and add tests and storybook ([e742da8](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/e742da85acec7163125b4817728a07d011093046))
|
|
13
|
+
|
|
14
|
+
### Styles
|
|
15
|
+
|
|
16
|
+
* adjust .bgGrey and .bgWhite text color and add new .subtitle class ([5cbfb14](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/5cbfb14cbd0c560b5e00efba09b4683ef8a7bc9d))
|
|
17
|
+
|
|
18
|
+
## [2.3.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.2.0...v2.3.0) (2025-08-20)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add additional props to the stepper and stepper buttons ([e7a404d](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/e7a404df5f97ec90dbfc4055cef8026f6d84a136))
|
|
23
|
+
* added new LinkBanner component ([86d5360](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/86d5360b713cff6abd2bf6658e1f934b972c7020))
|
|
24
|
+
|
|
1
25
|
## [2.2.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.1.0...v2.2.0) (2025-07-24)
|
|
2
26
|
|
|
3
27
|
### Features
|
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ Additionally the library provides form components using [react-hook-form](https:
|
|
|
51
51
|
1. [LoadingSpinner](#loadingspinner)
|
|
52
52
|
1. [Modal](#modal)
|
|
53
53
|
1. [ModulePadding](#modulepadding)
|
|
54
|
+
1. [OfflineView](#offlineview)
|
|
54
55
|
1. [OnboardingBanner](#onboardingbanner)
|
|
55
56
|
1. [OverflowTooltip](#overflowtooltip)
|
|
56
57
|
1. [ScrollBar](#scrollbar)
|
|
@@ -888,6 +889,16 @@ import { ModulePadding } from '@hortiview/shared-components';
|
|
|
888
889
|
</ModulePadding>;
|
|
889
890
|
```
|
|
890
891
|
|
|
892
|
+
### OfflineView
|
|
893
|
+
|
|
894
|
+
Shows an offline state with icon, title, and optional subtitle. Use `size` 'small' inline and 'large' for full pages.
|
|
895
|
+
|
|
896
|
+
```jsx
|
|
897
|
+
import { OfflineView } from '@hortiview/shared-components';
|
|
898
|
+
|
|
899
|
+
<OfflineView title="Title" subtitle="Subtitle" />
|
|
900
|
+
```
|
|
901
|
+
|
|
891
902
|
### OnboardingBanner
|
|
892
903
|
|
|
893
904
|
A responsive onboarding banner that adapts its layout for desktop and mobile.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as n, Fragment as i, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { G as l } from "./index.es-DntoATwO.js";
|
|
3
|
+
import { I as _ } from "./index.es-3043KTnb.js";
|
|
4
|
+
import { T as d } from "./index.es-D54RuMc_.js";
|
|
5
|
+
import './assets/AlertBanner.css';const m = "_messageContainer_2hnjr_1", g = "_info_2hnjr_9", h = "_danger_2hnjr_14", p = "_success_2hnjr_19", f = "_warning_2hnjr_24", u = "_closeIcon_2hnjr_29", j = "_linkBanner_2hnjr_34", s = {
|
|
6
|
+
messageContainer: m,
|
|
7
|
+
info: g,
|
|
8
|
+
danger: h,
|
|
9
|
+
success: p,
|
|
10
|
+
warning: f,
|
|
11
|
+
closeIcon: u,
|
|
12
|
+
linkBanner: j
|
|
13
|
+
}, k = ({
|
|
14
|
+
text: e,
|
|
15
|
+
color: o = "info",
|
|
16
|
+
isOpen: a = !0,
|
|
17
|
+
isBold: c = !0,
|
|
18
|
+
onClose: r
|
|
19
|
+
}) => a ? /* @__PURE__ */ n("div", { "data-testid": "alert-banner", className: `${s.messageContainer} ${s[o]}`, children: /* @__PURE__ */ t(l, { primaryAlign: "space-between", secondaryAlign: "top", gap: "dense", fullWidth: !0, children: [
|
|
20
|
+
typeof e == "string" ? /* @__PURE__ */ n(d, { bold: c, level: 2, children: e }) : /* @__PURE__ */ n("div", { style: { width: "100%" }, children: e }),
|
|
21
|
+
r && /* @__PURE__ */ n(_, { icon: "close", iconSize: "small", onClick: r, className: s.closeIcon })
|
|
22
|
+
] }) }) : /* @__PURE__ */ n(i, {});
|
|
23
|
+
export {
|
|
24
|
+
k as A,
|
|
25
|
+
s
|
|
26
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { G as s } from "./index.es-DntoATwO.js";
|
|
3
|
+
import { Iconify as _ } from "./components/Iconify/Iconify.js";
|
|
4
|
+
import { b as m, d as y, T as h } from "./index.es-D54RuMc_.js";
|
|
5
|
+
import { B as v } from "./index.es-CiqbARoC.js";
|
|
6
|
+
import './assets/OfflineView.css';const w = "_gap_18we6_1", G = "_container_18we6_5", T = "_bgWhite_18we6_11", x = "_bgGrey_18we6_16", W = "_subtitle_18we6_21", i = {
|
|
7
|
+
gap: w,
|
|
8
|
+
container: G,
|
|
9
|
+
bgWhite: T,
|
|
10
|
+
bgGrey: x,
|
|
11
|
+
subtitle: W
|
|
12
|
+
}, z = ({
|
|
13
|
+
title: t = "You’re currently offline",
|
|
14
|
+
subtitle: a = "This feature is unavailable until you reconnect",
|
|
15
|
+
icon: l = "cloud_off",
|
|
16
|
+
size: c = "large",
|
|
17
|
+
variant: d = "basic",
|
|
18
|
+
"data-testid": f = "offline-view-container",
|
|
19
|
+
buttonLabel: n,
|
|
20
|
+
fullWidth: g = !1,
|
|
21
|
+
className: b,
|
|
22
|
+
onClick: p
|
|
23
|
+
}) => {
|
|
24
|
+
const r = c === "large", u = d === "filled";
|
|
25
|
+
return /* @__PURE__ */ o(
|
|
26
|
+
s,
|
|
27
|
+
{
|
|
28
|
+
className: `${b} ${i.container} ${u ? i.bgGrey : i.bgWhite}`,
|
|
29
|
+
gap: "standard",
|
|
30
|
+
direction: "vertical",
|
|
31
|
+
"data-testid": f,
|
|
32
|
+
secondaryAlign: "center",
|
|
33
|
+
fullWidth: g,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ o(s, { direction: "vertical", secondaryAlign: "center", className: i.gap, children: [
|
|
36
|
+
/* @__PURE__ */ e(_, { icon: l, iconSize: r ? "xlarge" : "medium" }),
|
|
37
|
+
r ? /* @__PURE__ */ e(m, { level: 6, children: t }) : /* @__PURE__ */ e(y, { level: 1, bold: !0, children: t })
|
|
38
|
+
] }),
|
|
39
|
+
a && /* @__PURE__ */ e(h, { className: i.subtitle, level: 2, children: a }),
|
|
40
|
+
n && /* @__PURE__ */ e(v, { "data-testid": "offline-view-action-button", label: n, onClick: p })
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
z as O,
|
|
47
|
+
i as s
|
|
48
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._messageContainer_2hnjr_1{border-radius:.25rem;padding:.75rem 1rem;width:-moz-available;width:-webkit-fill-available;width:stretch}._info_2hnjr_9{border:1px solid var(--lmnt-theme-on-secondary-stroke);background:var(--lmnt-theme-secondary-50)}._danger_2hnjr_14{border:1px solid var(--lmnt-theme-on-danger-stroke);background:var(--lmnt-theme-danger-50)}._success_2hnjr_19{border:1px solid var(--lmnt-theme-on-success-stroke);background:var(--lmnt-theme-success-50)}._warning_2hnjr_24{border:1px solid var(--lmnt-utility-orange-surface);background:#f6a6491a}._closeIcon_2hnjr_29{align-self:flex-start;margin-right:-.15rem}._linkBanner_2hnjr_34{cursor:pointer}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._menu_1xwk3_1{width:15.875rem}._icon_1xwk3_5{color:var(--lmnt-theme-on-secondary-inactive)}._listItem_1xwk3_9 [class*=mdc-list-item__start]{color:var(--lmnt-theme-on-secondary-inactive);align-self:center!important;margin:0 1rem!important}._listItem_1xwk3_9 [class*=mdc-list-item__end]{color:var(--lmnt-theme-on-secondary-inactive)}._offlineViewMargin_1xwk3_19{margin:.5rem}
|
package/dist/assets/Modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._modal_fr8bw_1 div[class*=lmnt-modal__surface]{max-height:100svh!important;max-width:100svw!important}._title_fr8bw_6{header{display:flex;justify-content:start;padding-left:.5rem!important;>div{width:100%;margin-left:0!important}}}._titleWithoutCloseIcon_fr8bw_18{margin-left:1rem!important}._closeButton_fr8bw_22:before{display:none!important}._closeButton_fr8bw_22:hover{background-color:var(--lmnt-theme-surface-variant)!important}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._gap_18we6_1{gap:.125rem!important}._container_18we6_5{border-radius:.5rem;padding:2.5rem 2rem;width:auto}._bgWhite_18we6_11{background:var(--lmnt-theme-surface);color:var(--lmnt-theme-on-surface-active)}._bgGrey_18we6_16{background:var(--lmnt-theme-surface-variant);color:var(--lmnt-theme-on-surface-active)}._subtitle_18we6_21{color:var(--on-colors-on-surface-inactive-medium, #000000BA);font-weight:500}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type AlertBannerProps = {
|
|
1
|
+
export type AlertBannerProps = {
|
|
2
2
|
text: string | JSX.Element;
|
|
3
3
|
color?: 'danger' | 'info' | 'success' | 'warning';
|
|
4
4
|
isOpen?: boolean;
|
|
@@ -13,4 +13,3 @@ type AlertBannerProps = {
|
|
|
13
13
|
action?: JSX.Element;
|
|
14
14
|
};
|
|
15
15
|
export declare const AlertBanner: ({ text, color, isOpen, isBold, onClose, }: AlertBannerProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
messageContainer: d,
|
|
7
|
-
info: g,
|
|
8
|
-
danger: p,
|
|
9
|
-
success: f,
|
|
10
|
-
warning: u,
|
|
11
|
-
closeIcon: y
|
|
12
|
-
}, b = ({
|
|
13
|
-
text: s,
|
|
14
|
-
color: r = "info",
|
|
15
|
-
isOpen: i = !0,
|
|
16
|
-
isBold: c = !0,
|
|
17
|
-
onClose: o
|
|
18
|
-
}) => i ? /* @__PURE__ */ n("div", { "data-testid": "alert-banner", className: `${e.messageContainer} ${e[r]}`, children: /* @__PURE__ */ t(l, { primaryAlign: "space-between", secondaryAlign: "top", gap: "dense", children: [
|
|
19
|
-
typeof s == "string" ? /* @__PURE__ */ n(m, { bold: c, level: 2, children: s }) : /* @__PURE__ */ n("div", { children: s }),
|
|
20
|
-
o && /* @__PURE__ */ n(_, { icon: "close", iconSize: "small", onClick: o, className: e.closeIcon })
|
|
21
|
-
] }) }) : /* @__PURE__ */ n(a, {});
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "../../index.es-DntoATwO.js";
|
|
3
|
+
import "../../index.es-3043KTnb.js";
|
|
4
|
+
import "../../index.es-D54RuMc_.js";
|
|
5
|
+
import { A as e } from "../../AlertBanner-75jjene1.js";
|
|
22
6
|
export {
|
|
23
|
-
|
|
7
|
+
e as AlertBanner
|
|
24
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, Fragment as m } from "react/jsx-runtime";
|
|
2
2
|
import { a as t, s } from "../../react.esm-CX1WJ2Pp.js";
|
|
3
3
|
import { a as o } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
4
|
-
import {
|
|
4
|
+
import { A as n } from "../../AlertBanner-75jjene1.js";
|
|
5
5
|
import { d as p, b as c, a as l, t as r, g as a } from "../../vi.CjhMlMwf-CKxPQtd6.js";
|
|
6
6
|
p("AlertBanner Test", () => {
|
|
7
7
|
c(() => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AlertBannerProps } from './AlertBanner';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* LinkBanner component, shows an alert banner but with a link as text
|
|
5
|
+
* @param text - The text of the link.
|
|
6
|
+
* @param url - The URL the link points to.
|
|
7
|
+
* @param color - The color of the link banner.
|
|
8
|
+
* @param isOpen - Whether the link banner is open or not.
|
|
9
|
+
* @param isBold - Whether the text is bold or not.
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare const LinkBanner: ({ text, color, isOpen, isBold, url, }: Omit<AlertBannerProps, "onClose" | "action" | "text"> & {
|
|
13
|
+
/**
|
|
14
|
+
* the given text is shown as a link, in addition a link icon is displayed
|
|
15
|
+
*/
|
|
16
|
+
url: string;
|
|
17
|
+
/**
|
|
18
|
+
* the text of the link
|
|
19
|
+
*/
|
|
20
|
+
text: string;
|
|
21
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as r, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { G as l } from "../../index.es-DntoATwO.js";
|
|
3
|
+
import { T as s } from "../../index.es-D54RuMc_.js";
|
|
4
|
+
import { Iconify as p } from "../Iconify/Iconify.js";
|
|
5
|
+
import { A as m, s as c } from "../../AlertBanner-75jjene1.js";
|
|
6
|
+
const g = ({
|
|
7
|
+
text: n,
|
|
8
|
+
color: o = "info",
|
|
9
|
+
isOpen: t = !0,
|
|
10
|
+
isBold: e = !0,
|
|
11
|
+
url: i
|
|
12
|
+
}) => /* @__PURE__ */ r(
|
|
13
|
+
m,
|
|
14
|
+
{
|
|
15
|
+
color: o,
|
|
16
|
+
isOpen: t,
|
|
17
|
+
isBold: e,
|
|
18
|
+
text: /* @__PURE__ */ r("a", { href: i, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ a(
|
|
19
|
+
l,
|
|
20
|
+
{
|
|
21
|
+
direction: "horizontal",
|
|
22
|
+
primaryAlign: "space-between",
|
|
23
|
+
gap: "dense",
|
|
24
|
+
secondaryAlign: "center",
|
|
25
|
+
className: c.linkBanner,
|
|
26
|
+
fullWidth: !0,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ r(s, { bold: e, level: 2, children: n }),
|
|
29
|
+
/* @__PURE__ */ r(p, { icon: "open_in_new", pointer: !0 })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
) })
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
export {
|
|
36
|
+
g as LinkBanner
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { a as r, s as e } from "../../react.esm-CX1WJ2Pp.js";
|
|
3
|
+
import { a as o } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
4
|
+
import { LinkBanner as a } from "./LinkBanner.js";
|
|
5
|
+
import { d as n, b as i, a as m, t as p, g as t } from "../../vi.CjhMlMwf-CKxPQtd6.js";
|
|
6
|
+
n("LinkBanner Test", () => {
|
|
7
|
+
i(() => {
|
|
8
|
+
m.spyOn(o, "useBreakpoints").mockReturnValue({
|
|
9
|
+
isMobile: !1,
|
|
10
|
+
isTablet: !1,
|
|
11
|
+
isDesktop: !0,
|
|
12
|
+
isDesktopNavbar: !0
|
|
13
|
+
});
|
|
14
|
+
}), p("render LinkBanner with text", () => {
|
|
15
|
+
r(/* @__PURE__ */ s(a, { text: "Test", url: "#" })), t(e.getByText("Test")).toBeInTheDocument(), t(e.getByText("open_in_new")).toBeInTheDocument(), t(e.getByRole("link")).toHaveAttribute("href", "#");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseListElement } from '../../types/ListElement';
|
|
2
2
|
import { LinkProps } from '../../types/internal/ReactRouterTypes';
|
|
3
|
+
import { OfflineViewProps } from '../OfflineView/OfflineView';
|
|
3
4
|
|
|
4
5
|
type BaseViewProps = {
|
|
5
6
|
/**
|
|
@@ -50,6 +51,14 @@ type BaseViewProps = {
|
|
|
50
51
|
* searchPlaceholder is the placeholder of the search input, @default ''
|
|
51
52
|
*/
|
|
52
53
|
searchPlaceholder?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the user is online; shows OfflineView when false.
|
|
56
|
+
*/
|
|
57
|
+
isOnline?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Props forwarded to <OfflineView /> when offline.
|
|
60
|
+
*/
|
|
61
|
+
offlineViewProps?: Partial<OfflineViewProps>;
|
|
53
62
|
/**
|
|
54
63
|
* routerLinkElement is the element to be used for the elements link, use react-router Link component for the best experience.
|
|
55
64
|
* If the element has `noNavigation=false` and the `routerLinkElement` is undefined an `<a>` tag is used.
|
|
@@ -62,5 +71,5 @@ type BaseViewProps = {
|
|
|
62
71
|
/**
|
|
63
72
|
* `BaseView` is a layout component that displays a main (a list) and a detail section.
|
|
64
73
|
*/
|
|
65
|
-
export declare const BaseView: ({ heading, action, hint, elements, emptyText, hasSearch, isSorted, className, withAvatar, listMaxHeight, pathname, routerLinkElement, searchPlaceholder, }: BaseViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
export declare const BaseView: ({ heading, action, hint, elements, emptyText, hasSearch, isSorted, className, withAvatar, listMaxHeight, pathname, isOnline, offlineViewProps, routerLinkElement, searchPlaceholder, }: BaseViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
66
75
|
export {};
|
|
@@ -1,70 +1,73 @@
|
|
|
1
1
|
import { jsx as i, Fragment as d, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import { G as r } from "../../index.es-DntoATwO.js";
|
|
3
3
|
import { useMemo as a } from "react";
|
|
4
|
-
import { BasicHeading as
|
|
5
|
-
import { EmptyView as
|
|
6
|
-
import { ListArea as
|
|
7
|
-
import { u as
|
|
8
|
-
import { VerticalDivider as
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
import { BasicHeading as h } from "../BasicHeading/BasicHeading.js";
|
|
5
|
+
import { EmptyView as G } from "../EmptyView/EmptyView.js";
|
|
6
|
+
import { ListArea as N } from "../ListArea/ListArea.js";
|
|
7
|
+
import { u as A } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
8
|
+
import { VerticalDivider as V } from "../VerticalDivider/VerticalDivider.js";
|
|
9
|
+
import { O as j } from "../../OfflineView-BW19N4Cu.js";
|
|
10
|
+
import '../../assets/BaseView.css';const E = "_parentGroup_w7vsz_1", H = "_divider_w7vsz_5", I = "_maxWidth_w7vsz_10", $ = "_desktopList_w7vsz_14", y = "_mobileList_w7vsz_19", F = "_desktopDetail_w7vsz_23", M = "_mobileDetail_w7vsz_28", o = {
|
|
11
|
+
parentGroup: E,
|
|
12
|
+
divider: H,
|
|
13
|
+
maxWidth: I,
|
|
14
|
+
desktopList: $,
|
|
15
|
+
mobileList: y,
|
|
16
|
+
desktopDetail: F,
|
|
17
|
+
mobileDetail: M
|
|
18
|
+
}, U = ({
|
|
18
19
|
heading: c,
|
|
19
20
|
action: m = /* @__PURE__ */ i(d, {}),
|
|
20
|
-
hint:
|
|
21
|
+
hint: _ = /* @__PURE__ */ i(d, {}),
|
|
21
22
|
elements: n,
|
|
22
23
|
emptyText: p,
|
|
23
|
-
hasSearch:
|
|
24
|
-
isSorted:
|
|
25
|
-
className:
|
|
26
|
-
withAvatar:
|
|
27
|
-
listMaxHeight:
|
|
24
|
+
hasSearch: f = !0,
|
|
25
|
+
isSorted: b = !0,
|
|
26
|
+
className: w,
|
|
27
|
+
withAvatar: D = !1,
|
|
28
|
+
listMaxHeight: g = "calc(100vh - 200px)",
|
|
28
29
|
pathname: l,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
isOnline: u = !0,
|
|
31
|
+
offlineViewProps: v,
|
|
32
|
+
routerLinkElement: k,
|
|
33
|
+
searchPlaceholder: L
|
|
31
34
|
}) => {
|
|
32
|
-
const { isDesktopNavbar: e } =
|
|
35
|
+
const { isDesktopNavbar: e } = A(), t = a(() => n.find((B) => B.route === l), [l, n]), x = a(() => u ? t?.component ?? (e ? /* @__PURE__ */ i(G, { subtitle: p }) : /* @__PURE__ */ i(d, {})) : /* @__PURE__ */ i(j, { ...v, fullWidth: !0 }), [t?.component, p, e, u, v]), W = a(() => e ? !0 : !t, [t, e]), z = a(() => e ? !0 : t, [t, e]);
|
|
33
36
|
return /* @__PURE__ */ s(
|
|
34
37
|
r,
|
|
35
38
|
{
|
|
36
39
|
"data-testid": "base-view-container",
|
|
37
|
-
className: `${o.parentGroup} ${
|
|
40
|
+
className: `${o.parentGroup} ${w ?? ""}`,
|
|
38
41
|
gap: "none",
|
|
39
42
|
fullWidth: !0,
|
|
40
43
|
children: [
|
|
41
|
-
|
|
42
|
-
c && /* @__PURE__ */ i(
|
|
43
|
-
|
|
44
|
+
W && /* @__PURE__ */ i(r, { gap: "none", className: e ? o.desktopList : o.mobileList, children: /* @__PURE__ */ s(r, { direction: "vertical", fullWidth: !0, gap: e ? "standard" : "dense", children: [
|
|
45
|
+
c && /* @__PURE__ */ i(h, { "data-testid": "heading", heading: c, level: 4, marginBottom: 0, children: m }),
|
|
46
|
+
_,
|
|
44
47
|
/* @__PURE__ */ i(
|
|
45
|
-
|
|
48
|
+
N,
|
|
46
49
|
{
|
|
47
50
|
elements: n,
|
|
48
|
-
hasSearch:
|
|
49
|
-
maxHeight:
|
|
50
|
-
isSorted:
|
|
51
|
+
hasSearch: f,
|
|
52
|
+
maxHeight: g,
|
|
53
|
+
isSorted: b,
|
|
51
54
|
pathname: l,
|
|
52
|
-
routerLinkElement:
|
|
53
|
-
searchPlaceholder:
|
|
55
|
+
routerLinkElement: k,
|
|
56
|
+
searchPlaceholder: L
|
|
54
57
|
}
|
|
55
58
|
)
|
|
56
59
|
] }) }),
|
|
57
|
-
|
|
60
|
+
z && /* @__PURE__ */ s(
|
|
58
61
|
r,
|
|
59
62
|
{
|
|
60
63
|
"data-testid": "details",
|
|
61
64
|
gap: "none",
|
|
62
65
|
className: e ? o.desktopDetail : o.mobileDetail,
|
|
63
66
|
children: [
|
|
64
|
-
e && /* @__PURE__ */ i(
|
|
67
|
+
e && /* @__PURE__ */ i(V, { className: o.divider, height: "100%" }),
|
|
65
68
|
/* @__PURE__ */ s(r, { direction: "vertical", fullWidth: !0, children: [
|
|
66
69
|
/* @__PURE__ */ i(
|
|
67
|
-
|
|
70
|
+
h,
|
|
68
71
|
{
|
|
69
72
|
className: o.maxWidth,
|
|
70
73
|
heading: t?.detailTitle ?? t?.title ?? "",
|
|
@@ -72,11 +75,11 @@ import '../../assets/BaseView.css';const A = "_parentGroup_w7vsz_1", V = "_divid
|
|
|
72
75
|
icon: t?.hideIconInDetail === !0 ? void 0 : t?.icon,
|
|
73
76
|
marginBottom: 0,
|
|
74
77
|
invisibleButton: t?.detailAction === void 0,
|
|
75
|
-
withAvatar:
|
|
78
|
+
withAvatar: D,
|
|
76
79
|
children: t?.detailAction ?? m
|
|
77
80
|
}
|
|
78
81
|
),
|
|
79
|
-
|
|
82
|
+
x
|
|
80
83
|
] })
|
|
81
84
|
]
|
|
82
85
|
}
|
|
@@ -86,5 +89,5 @@ import '../../assets/BaseView.css';const A = "_parentGroup_w7vsz_1", V = "_divid
|
|
|
86
89
|
);
|
|
87
90
|
};
|
|
88
91
|
export {
|
|
89
|
-
|
|
92
|
+
U as BaseView
|
|
90
93
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { a as
|
|
1
|
+
import { jsx as o, Fragment as s } from "react/jsx-runtime";
|
|
2
|
+
import { a as n, s as e, f as p } from "../../react.esm-CX1WJ2Pp.js";
|
|
3
3
|
import { a as l } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
4
|
-
import { BaseView as
|
|
5
|
-
import { d as u, b as
|
|
4
|
+
import { BaseView as r } from "./BaseView.js";
|
|
5
|
+
import { d as u, b as f, a as c, t as i, g as t } from "../../vi.CjhMlMwf-CKxPQtd6.js";
|
|
6
6
|
u("BaseView Test", () => {
|
|
7
|
-
|
|
7
|
+
f(() => {
|
|
8
8
|
c.spyOn(l, "useBreakpoints").mockReturnValue({
|
|
9
9
|
isMobile: !1,
|
|
10
10
|
isTablet: !1,
|
|
@@ -12,20 +12,20 @@ u("BaseView Test", () => {
|
|
|
12
12
|
isDesktopNavbar: !0
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
-
const
|
|
15
|
+
const a = [
|
|
16
16
|
{
|
|
17
17
|
id: "1",
|
|
18
18
|
title: "user.personal_information",
|
|
19
19
|
icon: "account_circle",
|
|
20
20
|
route: "/personal-profile/personal-information",
|
|
21
|
-
component: /* @__PURE__ */
|
|
21
|
+
component: /* @__PURE__ */ o(s, { children: "Personal information selected" })
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
id: "2",
|
|
25
25
|
title: "user.data_privacy",
|
|
26
26
|
icon: "privacy_tip",
|
|
27
27
|
route: "/personal-profile/data-privacy",
|
|
28
|
-
component: /* @__PURE__ */
|
|
28
|
+
component: /* @__PURE__ */ o(s, { children: "Data Privacy selected" }),
|
|
29
29
|
detailTitle: "Data Privacy 2000",
|
|
30
30
|
hideIconInDetail: !0
|
|
31
31
|
},
|
|
@@ -34,16 +34,16 @@ u("BaseView Test", () => {
|
|
|
34
34
|
title: "user.security",
|
|
35
35
|
icon: "security",
|
|
36
36
|
route: "/personal-profile/security",
|
|
37
|
-
component: /* @__PURE__ */
|
|
37
|
+
component: /* @__PURE__ */ o(s, { children: "Security selected" })
|
|
38
38
|
}
|
|
39
39
|
];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
40
|
+
i("render BaseView with empty view and navigation list", () => {
|
|
41
|
+
n(
|
|
42
|
+
/* @__PURE__ */ o(
|
|
43
|
+
r,
|
|
44
44
|
{
|
|
45
45
|
pathname: "/personal-profile",
|
|
46
|
-
elements:
|
|
46
|
+
elements: a,
|
|
47
47
|
heading: "user.personal-profile",
|
|
48
48
|
hasSearch: !1,
|
|
49
49
|
emptyText: "user.noselection",
|
|
@@ -52,13 +52,13 @@ u("BaseView Test", () => {
|
|
|
52
52
|
}
|
|
53
53
|
)
|
|
54
54
|
), t(e.getByText("user.noselection")).toBeInTheDocument(), t(e.getByText("user.personal-profile")).toBeInTheDocument(), t(e.getByText("user.personal_information")).toBeInTheDocument(), t(e.getByText("user.data_privacy")).toBeInTheDocument(), t(e.getByText("user.security")).toBeInTheDocument();
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
55
|
+
}), i("render BaseView with data and navigation list", () => {
|
|
56
|
+
n(
|
|
57
|
+
/* @__PURE__ */ o(
|
|
58
|
+
r,
|
|
59
59
|
{
|
|
60
60
|
pathname: "/personal-profile/personal-information",
|
|
61
|
-
elements:
|
|
61
|
+
elements: a,
|
|
62
62
|
heading: "user.personal-profile",
|
|
63
63
|
hasSearch: !1,
|
|
64
64
|
emptyText: "user.noselection",
|
|
@@ -67,13 +67,13 @@ u("BaseView Test", () => {
|
|
|
67
67
|
}
|
|
68
68
|
)
|
|
69
69
|
), t(e.getByText("Personal information selected")).toBeInTheDocument(), t(e.getAllByText("account_circle")).toHaveLength(2), t(e.getAllByText("user.personal_information")).toHaveLength(2);
|
|
70
|
-
}),
|
|
71
|
-
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
70
|
+
}), i("render BaseView with custom detail title and no detail icon", () => {
|
|
71
|
+
n(
|
|
72
|
+
/* @__PURE__ */ o(
|
|
73
|
+
r,
|
|
74
74
|
{
|
|
75
75
|
pathname: "/personal-profile/data-privacy",
|
|
76
|
-
elements:
|
|
76
|
+
elements: a,
|
|
77
77
|
heading: "user.personal-profile",
|
|
78
78
|
hasSearch: !1,
|
|
79
79
|
emptyText: "user.noselection",
|
|
@@ -82,18 +82,18 @@ u("BaseView Test", () => {
|
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
), t(e.getByText("Data Privacy selected")).toBeInTheDocument(), t(e.getByText("Data Privacy 2000")).toBeInTheDocument(), t(e.getAllByText("privacy_tip")).toHaveLength(1), t(e.getAllByText("user.data_privacy")).toHaveLength(1);
|
|
85
|
-
}),
|
|
85
|
+
}), i("hide empty view when screen is small", () => {
|
|
86
86
|
c.spyOn(l, "useBreakpoints").mockReturnValue({
|
|
87
87
|
isMobile: !0,
|
|
88
88
|
isTablet: !1,
|
|
89
89
|
isDesktop: !1,
|
|
90
90
|
isDesktopNavbar: !1
|
|
91
|
-
}),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
|
|
91
|
+
}), n(
|
|
92
|
+
/* @__PURE__ */ o(
|
|
93
|
+
r,
|
|
94
94
|
{
|
|
95
95
|
pathname: "/personal-profile/data-privacy",
|
|
96
|
-
elements:
|
|
96
|
+
elements: a,
|
|
97
97
|
heading: "user.personal-profile",
|
|
98
98
|
hasSearch: !1,
|
|
99
99
|
emptyText: "user.noselection",
|
|
@@ -102,13 +102,13 @@ u("BaseView Test", () => {
|
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
), t(e.queryByText("user.noselection")).not.toBeInTheDocument();
|
|
105
|
-
}),
|
|
106
|
-
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
|
|
105
|
+
}), i("render BaseView with selected detail section", () => {
|
|
106
|
+
n(
|
|
107
|
+
/* @__PURE__ */ o(
|
|
108
|
+
r,
|
|
109
109
|
{
|
|
110
110
|
pathname: "/personal-profile/data-privacy",
|
|
111
|
-
elements:
|
|
111
|
+
elements: a,
|
|
112
112
|
heading: "user.personal-profile",
|
|
113
113
|
hasSearch: !1,
|
|
114
114
|
emptyText: "user.noselection",
|
|
@@ -117,5 +117,22 @@ u("BaseView Test", () => {
|
|
|
117
117
|
}
|
|
118
118
|
)
|
|
119
119
|
), p.click(e.getAllByRole("option")[1]), t(e.getByText("Data Privacy selected")).toBeInTheDocument();
|
|
120
|
+
}), i("renders only offline view when offline", () => {
|
|
121
|
+
n(
|
|
122
|
+
/* @__PURE__ */ o(
|
|
123
|
+
r,
|
|
124
|
+
{
|
|
125
|
+
pathname: "/personal-profile/personal-information",
|
|
126
|
+
elements: a,
|
|
127
|
+
heading: "user.personal-profile",
|
|
128
|
+
hasSearch: !1,
|
|
129
|
+
emptyText: "user.noselection",
|
|
130
|
+
isSorted: !1,
|
|
131
|
+
isOnline: !1,
|
|
132
|
+
offlineViewProps: { "data-testid": "offline-test" },
|
|
133
|
+
routerLinkElement: void 0
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
), t(e.queryByText("Personal information selected")).not.toBeInTheDocument(), t(e.getByTestId("offline-test")).toBeInTheDocument();
|
|
120
137
|
});
|
|
121
138
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ListItemProps } from '@element-public/react-list';
|
|
2
|
+
import { OfflineViewProps } from '../OfflineView/OfflineView';
|
|
2
3
|
|
|
3
4
|
type ContextMenuProps = {
|
|
4
5
|
/**
|
|
@@ -19,6 +20,14 @@ type ContextMenuProps = {
|
|
|
19
20
|
* data-testid for testing
|
|
20
21
|
*/
|
|
21
22
|
'data-testid'?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the user is online; shows OfflineView when false.
|
|
25
|
+
*/
|
|
26
|
+
isOnline?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Props forwarded to <OfflineView /> when offline.
|
|
29
|
+
*/
|
|
30
|
+
offlineViewProps?: Partial<OfflineViewProps>;
|
|
22
31
|
};
|
|
23
32
|
export type ActionProps = ListItemProps & {
|
|
24
33
|
closeOnClick?: boolean;
|
|
@@ -35,7 +44,9 @@ export type ActionProps = ListItemProps & {
|
|
|
35
44
|
* { primaryText: 'Delete', onClick: () => DeleteSomeThing(), leadingBlock: 'delete_outline'},
|
|
36
45
|
* { primaryText: 'Edit', onClick: () => EditSomeThing(), leadingBlock: 'edit'},
|
|
37
46
|
* ];
|
|
47
|
+
* @param {boolean} isOnline Whether the user is online; shows OfflineView when false.
|
|
48
|
+
* @param {OfflineViewProps} offlineViewProps Props forwarded to OfflineView when offline.
|
|
38
49
|
* @returns a context menu with the given actions as ListItems
|
|
39
50
|
*/
|
|
40
|
-
export declare const ContextMenu: ({ triggerOpen, actions, iconOrientation, "data-testid": dataTestId, }: ContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare const ContextMenu: ({ triggerOpen, actions, iconOrientation, "data-testid": dataTestId, isOnline, offlineViewProps, }: ContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
52
|
export {};
|