@hortiview/shared-components 0.0.6403 → 0.0.6829
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/ListAreaService-DDlsV9UD.js +100 -0
- package/dist/assets/BaseView.css +1 -1
- package/dist/assets/ListAreaService.css +1 -1
- package/dist/components/BaseView/BaseView.d.ts +1 -1
- package/dist/components/BaseView/BaseView.js +57 -55
- package/dist/components/BasicHeading/BasicHeading.js +38 -37
- package/dist/components/FormComponents/FormSelect/FormSelect.js +90 -1465
- package/dist/components/FormComponents/FormSelect/FormSelect.test.js +70 -3027
- package/dist/components/FormComponents/FormText/FormText.d.ts +2 -1
- package/dist/components/FormComponents/FormText/FormText.js +50 -48
- package/dist/components/ListArea/ListArea.js +1 -1
- package/dist/components/ListArea/ListArea.test.js +1 -1
- package/dist/components/ListArea/ListAreaService.d.ts +2 -2
- package/dist/components/ListArea/ListAreaService.js +1 -1
- package/dist/components/OverflowTooltip/OverflowTooltip.d.ts +30 -0
- package/dist/components/OverflowTooltip/OverflowTooltip.js +22 -0
- package/dist/components/OverflowTooltip/OverflowTooltip.test.d.ts +1 -0
- package/dist/components/OverflowTooltip/OverflowTooltip.test.js +37 -0
- package/dist/index-DfbRag7b.js +2963 -0
- package/dist/react-tooltip.min-BzHiZW8k.js +1380 -0
- package/package.json +1 -1
- package/dist/ListAreaService-BoNnFzrZ.js +0 -82
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { TextfieldProps } from '@element/react-components';
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
3
|
import { FieldPath, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
4
|
/**
|
|
4
5
|
* a generic FormText property type. the generic T represents the interface, which is used in the form, like {@link CreateOrganizationDto}
|
|
5
6
|
*/
|
|
6
|
-
export type FormTextProps<T extends FieldValues> = {
|
|
7
|
+
export type FormTextProps<T extends FieldValues> = TextfieldProps & {
|
|
7
8
|
/** the path to the property, like Address.AddressLine1 */
|
|
8
9
|
propertyName: Path<T>;
|
|
9
10
|
/** the label of the Textbox */
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../../../assets/FormText.css";
|
|
2
|
-
import { jsx as n, Fragment as
|
|
3
|
-
import { Textfield as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useFormContext as
|
|
6
|
-
const
|
|
7
|
-
formTextAreaHelperText:
|
|
8
|
-
invalid:
|
|
9
|
-
required:
|
|
10
|
-
formTextArea:
|
|
11
|
-
},
|
|
2
|
+
import { jsx as n, Fragment as C, jsxs as M } from "react/jsx-runtime";
|
|
3
|
+
import { Textfield as P, TypoCaption as R } from "@element/react-components";
|
|
4
|
+
import { useState as V, useMemo as d } from "react";
|
|
5
|
+
import { useFormContext as W, Controller as _ } from "react-hook-form";
|
|
6
|
+
const w = "_formTextAreaHelperText_1n0bk_1", D = "_invalid_1n0bk_6", E = "_required_1n0bk_9", G = "_formTextArea_1n0bk_1", i = {
|
|
7
|
+
formTextAreaHelperText: w,
|
|
8
|
+
invalid: D,
|
|
9
|
+
required: E,
|
|
10
|
+
formTextArea: G
|
|
11
|
+
}, J = ({
|
|
12
12
|
count: e,
|
|
13
13
|
maxCount: c,
|
|
14
14
|
invalid: m = !1,
|
|
@@ -17,93 +17,95 @@ const W = "_formTextAreaHelperText_1n0bk_1", w = "_invalid_1n0bk_6", D = "_requi
|
|
|
17
17
|
"div",
|
|
18
18
|
{
|
|
19
19
|
className: `${i.formTextAreaHelperText} ${m ? i.invalid : ""} ${r ? i.required : ""}`,
|
|
20
|
-
children: /* @__PURE__ */ n(
|
|
20
|
+
children: /* @__PURE__ */ n(R, { children: `${e}/${c}` })
|
|
21
21
|
}
|
|
22
|
-
),
|
|
22
|
+
), N = (e) => e.textarea ? /* @__PURE__ */ n(K, { ...e }) : /* @__PURE__ */ n(O, { ...e }), K = (e) => /* @__PURE__ */ n("div", { className: i.formTextArea, children: /* @__PURE__ */ n(A, { ...e }) }), O = (e) => /* @__PURE__ */ n(A, { ...e }), A = ({
|
|
23
23
|
propertyName: e,
|
|
24
24
|
label: c,
|
|
25
25
|
disabled: m = !1,
|
|
26
26
|
textarea: r = !1,
|
|
27
|
-
hidden:
|
|
28
|
-
placeholder:
|
|
29
|
-
type:
|
|
30
|
-
prefixText:
|
|
31
|
-
inputMode:
|
|
32
|
-
trailingIcon:
|
|
27
|
+
hidden: q = !1,
|
|
28
|
+
placeholder: F,
|
|
29
|
+
type: $,
|
|
30
|
+
prefixText: L,
|
|
31
|
+
inputMode: k,
|
|
32
|
+
trailingIcon: H,
|
|
33
33
|
trigger: x = "likeForm",
|
|
34
|
-
rules: t
|
|
34
|
+
rules: t,
|
|
35
|
+
...f
|
|
35
36
|
}) => {
|
|
36
37
|
const {
|
|
37
|
-
control:
|
|
38
|
+
control: v,
|
|
38
39
|
getFieldState: u,
|
|
39
40
|
formState: { errors: s },
|
|
40
41
|
trigger: T
|
|
41
|
-
} =
|
|
42
|
+
} = W(), [b, B] = V(0), S = (a) => {
|
|
42
43
|
const l = a.target.value;
|
|
43
|
-
|
|
44
|
-
},
|
|
44
|
+
B(l?.length ?? 0);
|
|
45
|
+
}, j = () => {
|
|
45
46
|
if (s && s[e]) {
|
|
46
47
|
const a = s[e]?.message;
|
|
47
48
|
return a || "Invalid input";
|
|
48
49
|
}
|
|
49
|
-
return
|
|
50
|
+
return I;
|
|
50
51
|
}, o = d(
|
|
51
52
|
() => t?.maxLength?.value,
|
|
52
53
|
[t]
|
|
53
|
-
),
|
|
54
|
+
), z = d(
|
|
54
55
|
() => t?.minLength?.value,
|
|
55
56
|
[t]
|
|
56
|
-
),
|
|
57
|
+
), g = d(
|
|
57
58
|
() => t?.required?.value,
|
|
58
59
|
[t]
|
|
59
|
-
),
|
|
60
|
+
), I = d(
|
|
60
61
|
() => t?.required?.message,
|
|
61
62
|
[t]
|
|
62
63
|
);
|
|
63
|
-
return
|
|
64
|
-
|
|
64
|
+
return q ? /* @__PURE__ */ n(_, { name: e, control: v, render: () => /* @__PURE__ */ n(C, {}) }) : /* @__PURE__ */ n(
|
|
65
|
+
_,
|
|
65
66
|
{
|
|
66
67
|
name: e,
|
|
67
68
|
rules: t,
|
|
68
|
-
control:
|
|
69
|
-
render: ({ field: { ref: a, ...l } }) => /* @__PURE__ */
|
|
69
|
+
control: v,
|
|
70
|
+
render: ({ field: { ref: a, ...l } }) => /* @__PURE__ */ M(C, { children: [
|
|
70
71
|
/* @__PURE__ */ n(
|
|
71
|
-
|
|
72
|
+
P,
|
|
72
73
|
{
|
|
74
|
+
...f,
|
|
73
75
|
...l,
|
|
74
76
|
value: l.value ?? "",
|
|
75
|
-
type:
|
|
77
|
+
type: $,
|
|
76
78
|
fullWidth: !0,
|
|
77
|
-
inputMode:
|
|
78
|
-
placeholder:
|
|
79
|
-
prefixText:
|
|
79
|
+
inputMode: k,
|
|
80
|
+
placeholder: F,
|
|
81
|
+
prefixText: L,
|
|
80
82
|
disabled: m,
|
|
81
|
-
helperText:
|
|
82
|
-
helperTextPersistent: s !== void 0 ||
|
|
83
|
+
helperText: j(),
|
|
84
|
+
helperTextPersistent: s !== void 0 || g || o !== void 0 && r,
|
|
83
85
|
label: c,
|
|
84
86
|
variant: "outlined",
|
|
85
87
|
maxlength: o,
|
|
86
|
-
minLength:
|
|
88
|
+
minLength: z,
|
|
87
89
|
textarea: r,
|
|
88
90
|
noResize: !1,
|
|
89
91
|
onBlur: () => {
|
|
90
|
-
x === "onBlur" && T(e);
|
|
92
|
+
x === "onBlur" && T(e), f.onBlur?.();
|
|
91
93
|
},
|
|
92
|
-
onChange: (
|
|
93
|
-
l.onChange(
|
|
94
|
+
onChange: (h) => {
|
|
95
|
+
l.onChange(h), r && o !== void 0 && S(h), x === "onChange" && T(e);
|
|
94
96
|
},
|
|
95
97
|
valid: !u(e).invalid,
|
|
96
98
|
className: `${i.formText} ${u(e).invalid ? i.invalid : ""}`,
|
|
97
|
-
trailingIcon:
|
|
99
|
+
trailingIcon: H
|
|
98
100
|
}
|
|
99
101
|
),
|
|
100
|
-
o && r && /* @__PURE__ */ n(
|
|
101
|
-
|
|
102
|
+
o !== void 0 && r && /* @__PURE__ */ n(
|
|
103
|
+
J,
|
|
102
104
|
{
|
|
103
|
-
count:
|
|
105
|
+
count: b,
|
|
104
106
|
maxCount: o,
|
|
105
107
|
invalid: u(e).invalid,
|
|
106
|
-
required:
|
|
108
|
+
required: g
|
|
107
109
|
}
|
|
108
110
|
)
|
|
109
111
|
] })
|
|
@@ -111,5 +113,5 @@ const W = "_formTextAreaHelperText_1n0bk_1", w = "_invalid_1n0bk_6", D = "_requi
|
|
|
111
113
|
);
|
|
112
114
|
};
|
|
113
115
|
export {
|
|
114
|
-
|
|
116
|
+
N as FormText
|
|
115
117
|
};
|
|
@@ -4,7 +4,7 @@ import { g as Hr } from "../../_commonjsHelpers-CT_km90n.js";
|
|
|
4
4
|
import { _ as H, a as Tr, b as wr, c as w, d as Nr, e as Wr, f as h, h as N, j as B, k as Xr, l as zr, m as I, n as Yr, o as Zr, p as Jr, q as W, r as Qr, s as Or, t as Pr, u as kr, v as Vr } from "../../get-BRDhkfK0.js";
|
|
5
5
|
import { useState as re, useMemo as k } from "react";
|
|
6
6
|
import { SearchBar as ee } from "../SearchBar/SearchBar.js";
|
|
7
|
-
import { g as ae, a as te, s as T } from "../../ListAreaService-
|
|
7
|
+
import { g as ae, a as te, s as T } from "../../ListAreaService-DDlsV9UD.js";
|
|
8
8
|
var ne = H;
|
|
9
9
|
function se() {
|
|
10
10
|
this.__data__ = new ne(), this.size = 0;
|
|
@@ -2,7 +2,7 @@ import { jsx as r, Fragment as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { TypoButton as p } from "@element/react-components";
|
|
3
3
|
import { r as s, s as a, f as u } from "../../react.esm-BBemCHUU.js";
|
|
4
4
|
import { ListArea as c } from "./ListArea.js";
|
|
5
|
-
import { g as h } from "../../ListAreaService-
|
|
5
|
+
import { g as h } from "../../ListAreaService-DDlsV9UD.js";
|
|
6
6
|
import { d as m, t as n, g as t } from "../../vi.JYQecGiw-BbUbJcT8.js";
|
|
7
7
|
m("ListArea Test", () => {
|
|
8
8
|
const o = [
|
|
@@ -26,7 +26,7 @@ export declare const getListedItems: (items: ListElement[], pathname: string, it
|
|
|
26
26
|
select: boolean;
|
|
27
27
|
primaryText: string;
|
|
28
28
|
secondaryText: import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
overlineText:
|
|
29
|
+
overlineText: import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
trailingBlock: string | number | boolean | JSX.Element | Iterable<import("react").ReactNode>;
|
|
31
31
|
leadingBlock: string | JSX.Element | undefined;
|
|
32
32
|
value: string | undefined;
|
|
@@ -55,7 +55,7 @@ export declare const mapListElement: (element: ListElement, pathname: string | u
|
|
|
55
55
|
select: boolean;
|
|
56
56
|
primaryText: string;
|
|
57
57
|
secondaryText: import("react/jsx-runtime").JSX.Element;
|
|
58
|
-
overlineText:
|
|
58
|
+
overlineText: import("react/jsx-runtime").JSX.Element;
|
|
59
59
|
trailingBlock: string | number | boolean | JSX.Element | Iterable<import("react").ReactNode>;
|
|
60
60
|
leadingBlock: string | JSX.Element | undefined;
|
|
61
61
|
value: string | undefined;
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "@element/react-components";
|
|
3
3
|
import "../Iconify/Iconify.js";
|
|
4
4
|
import "../../enums/AvailableCustomIcons.js";
|
|
5
|
-
import { g as s, a as i, m as a } from "../../ListAreaService-
|
|
5
|
+
import { g as s, a as i, m as a } from "../../ListAreaService-DDlsV9UD.js";
|
|
6
6
|
export {
|
|
7
7
|
s as getGroupedItems,
|
|
8
8
|
i as getListedItems,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type OverflowTooltipProps = {
|
|
3
|
+
/**
|
|
4
|
+
* the id of the tooltip
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* the full text to be displayed
|
|
9
|
+
*/
|
|
10
|
+
text: string;
|
|
11
|
+
/**
|
|
12
|
+
* the children that will have the tooltip
|
|
13
|
+
*/
|
|
14
|
+
children: JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A component that displays a tooltip when the text is overflowing.
|
|
18
|
+
* It can be wrapped around Element's Typography components (e.g. TypoDisplay).
|
|
19
|
+
* It clones the child element and adds the tooltip functionality.
|
|
20
|
+
*
|
|
21
|
+
* Hint: It was not written as a component that directly takes the Typography string as child,
|
|
22
|
+
* because then the OverflowTooltip would be nested within the Typography component and thus inherit the Typography styles.
|
|
23
|
+
* Furthermore, OverflowTooltip does not work on hovering ListArea items.
|
|
24
|
+
*
|
|
25
|
+
* @param id - the id of the tooltip
|
|
26
|
+
* @param text - the full text to be displayed
|
|
27
|
+
* @param children - the children that will have the tooltip
|
|
28
|
+
*/
|
|
29
|
+
export declare const OverflowTooltip: ({ id, text, children }: OverflowTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as m, Fragment as p, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useMemo as f, cloneElement as d } from "react";
|
|
3
|
+
import { H as x } from "../../react-tooltip.min-BzHiZW8k.js";
|
|
4
|
+
const a = ({ id: t, text: e, children: i }) => {
|
|
5
|
+
const [l, s] = h(""), n = f(
|
|
6
|
+
() => d(i, {
|
|
7
|
+
"data-tooltip-id": t,
|
|
8
|
+
onMouseEnter: ({ currentTarget: o }) => {
|
|
9
|
+
const r = o.clientWidth < o.scrollWidth || o.clientHeight < o.scrollHeight;
|
|
10
|
+
s(r ? e : "");
|
|
11
|
+
}
|
|
12
|
+
}),
|
|
13
|
+
[i, t, e]
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ m(p, { children: [
|
|
16
|
+
n,
|
|
17
|
+
/* @__PURE__ */ c(x, { id: t, noArrow: !0, place: "bottom", children: l })
|
|
18
|
+
] });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
a as OverflowTooltip
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { TypoDisplay as n } from "@element/react-components";
|
|
3
|
+
import { r as i, s as e, w as s } from "../../react.esm-BBemCHUU.js";
|
|
4
|
+
import { u as a } from "../../index-DfbRag7b.js";
|
|
5
|
+
import { OverflowTooltip as c } from "./OverflowTooltip.js";
|
|
6
|
+
import { d as u, t as p, g as r } from "../../vi.JYQecGiw-BbUbJcT8.js";
|
|
7
|
+
u("OverflowTooltip Test", () => {
|
|
8
|
+
p("should render OverflowTooltip on hover", async () => {
|
|
9
|
+
Object.defineProperty(HTMLElement.prototype, "clientWidth", {
|
|
10
|
+
configurable: !0,
|
|
11
|
+
value: 100
|
|
12
|
+
}), Object.defineProperty(HTMLElement.prototype, "scrollWidth", {
|
|
13
|
+
configurable: !0,
|
|
14
|
+
value: 200
|
|
15
|
+
});
|
|
16
|
+
const l = a.setup(), o = "Block name that should be truncated with an ellipsis because it is very very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong";
|
|
17
|
+
i(
|
|
18
|
+
/* @__PURE__ */ t(c, { id: o, text: o, children: /* @__PURE__ */ t(n, { children: o }) })
|
|
19
|
+
), r(e.getByText(o)).toBeInTheDocument(), l.hover(e.getByText(o)), await s(() => {
|
|
20
|
+
r(e.getByRole("tooltip")).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
}), p("should not render OverflowTooltip on hover", async () => {
|
|
23
|
+
Object.defineProperty(HTMLElement.prototype, "clientWidth", {
|
|
24
|
+
configurable: !0,
|
|
25
|
+
value: 200
|
|
26
|
+
}), Object.defineProperty(HTMLElement.prototype, "scrollWidth", {
|
|
27
|
+
configurable: !0,
|
|
28
|
+
value: 200
|
|
29
|
+
});
|
|
30
|
+
const l = a.setup(), o = "Block name that should be truncated with an ellipsis because it is very very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong";
|
|
31
|
+
i(
|
|
32
|
+
/* @__PURE__ */ t(c, { id: o, text: o, children: /* @__PURE__ */ t(n, { children: o }) })
|
|
33
|
+
), r(e.getByText(o)).toBeInTheDocument(), l.hover(e.getByText(o)), await s(() => {
|
|
34
|
+
r(e.queryByRole("tooltip")).not.toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|