@hortiview/default-components 1.5.0 → 1.5.1

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.
Files changed (43) hide show
  1. package/dist/components/DefaultAllowedComponent/DefaultAllowedComponent.js +8 -48
  2. package/dist/components/DefaultFormNumber/DefaultFormNumber.js +12 -1514
  3. package/dist/components/DefaultFormSelect/DefaultFormSelect.js +9 -178
  4. package/dist/components/DefaultLoadingSpinner/DefaultLoadingSpinner.js +6 -6
  5. package/dist/components/GenericTable/GenericTable.js +12 -18746
  6. package/dist/components/HealthChecks/DataBaseHealthCheck.js +2 -2
  7. package/dist/components/HealthChecks/DefaultHealthCheck.js +4 -4
  8. package/dist/components/HealthChecks/IotServiceHealthCheck.js +5 -5
  9. package/dist/components/HealthChecks/PlatformHealthCheck.js +4 -4
  10. package/dist/components/ImpatienceLoadingSpinner/ImpatienceLoadingSpinner.js +9 -9
  11. package/dist/components/InternationalizationWrapper/InternationalizationWrapper.js +4 -4
  12. package/dist/components/OfflineView/OfflineView.js +9 -9
  13. package/dist/i18n.js +1696 -5
  14. package/dist/{i18nInstance-D_96ADqd.js → i18nInstance-CYqpK5II.js} +2 -2
  15. package/dist/useTranslation-DGtUf8nl.js +101 -0
  16. package/package.json +2 -2
  17. package/dist/Iconify-D3gVmKx3.js +0 -84
  18. package/dist/InfoCard-Ba-VFnki.js +0 -58
  19. package/dist/LoadingSpinner-CmwCv7BO.js +0 -503
  20. package/dist/OfflineView-CIwV08EQ-BClnJRzV.js +0 -46
  21. package/dist/assets/DefaultAllowedComponent.css +0 -1
  22. package/dist/assets/DefaultFormNumber.css +0 -1
  23. package/dist/assets/DefaultFormSelect.css +0 -1
  24. package/dist/assets/GenericTable.css +0 -1
  25. package/dist/assets/Iconify.css +0 -1
  26. package/dist/assets/InfoCard.css +0 -1
  27. package/dist/assets/LoadingSpinner.css +0 -1
  28. package/dist/assets/OfflineView-CIwV08EQ.css +0 -1
  29. package/dist/component-Bz_dtX1r-DqCAj-DR.js +0 -304
  30. package/dist/component-DEJuY56h-CYiwt7Ga.js +0 -571
  31. package/dist/correct-is-regexp-logic-Y0ToWEjF-pByZFQLo.js +0 -494
  32. package/dist/i18n-CCQpJsQK.js +0 -1707
  33. package/dist/index.es--C-VLspF-B3Cy1zrT.js +0 -845
  34. package/dist/index.es-B74L_Dje-mYAvKwSb.js +0 -2005
  35. package/dist/index.es-B8p8KCdj--cmqwwUJ.js +0 -360
  36. package/dist/index.es-BPv5dCFQ-BmH1Hq7_.js +0 -1044
  37. package/dist/index.es-BanVdXEd-BYOBCuJj.js +0 -79
  38. package/dist/index.es-SjZ_-d7U-HvaOH_Z0.js +0 -860
  39. package/dist/index.es-nwjKmW7--CUlbl1RR.js +0 -14375
  40. package/dist/isTypedArray-DziahYkI-Cw9ssvDH.js +0 -210
  41. package/dist/slicedToArray-ByMQIs5x-BsvSjTDl.js +0 -432
  42. package/dist/useHelperText-Cqx6ggnc.js +0 -392
  43. package/dist/useTranslation-BQQybhSd.js +0 -5042
@@ -1,180 +1,11 @@
1
- import { jsx as o, Fragment as K, jsxs as j } from "react/jsx-runtime";
2
- import { a as b, v as U } from "../../useHelperText-Cqx6ggnc.js";
3
- import { q as W, u as X } from "../../useTranslation-BQQybhSd.js";
4
- import { U as Y } from "../../component-Bz_dtX1r-DqCAj-DR.js";
5
- import { useEffect as P, useMemo as z } from "react";
6
- import { useFormContext as Z, Controller as N } from "react-hook-form";
7
- import { I as k, K as G, V as J } from "../../index.es-nwjKmW7--CUlbl1RR.js";
8
- import { O as Q, D as R } from "../../index.es-SjZ_-d7U-HvaOH_Z0.js";
9
- import { InternationalizationWrapper as ee } from "../InternationalizationWrapper/InternationalizationWrapper.js";
10
- import '../../assets/DefaultFormSelect.css';var te = Y();
11
- const le = /* @__PURE__ */ W(te), oe = "_customPortal_1u11g_1", ae = "_customSelect_1u11g_8", A = {
12
- customPortal: oe,
13
- customSelect: ae
14
- }, ie = ({
15
- menuMaxHeight: e = "15rem",
16
- portalClassName: t,
17
- "data-testid": l = "custom-select",
18
- className: r,
19
- hoisted: u,
20
- ..._
21
- }) => {
22
- const c = `custom-portal-${t ?? "default"}`, n = k("elementSelectForTestId-");
23
- return P(() => {
24
- if (u && !document.getElementById(c)) {
25
- const s = document.createElement("div");
26
- s.id = c, s.className = `${A.customPortal} ${t ?? ""}`, document.body.appendChild(s);
27
- }
28
- }, [u, c, t]), P(() => {
29
- const s = document.querySelectorAll(`#${n} input[role="combobox"]`);
30
- s && s.forEach((x) => {
31
- x.setAttribute("data-testid", l);
32
- });
33
- }, [l, n]), /* @__PURE__ */ o(
34
- G,
35
- {
36
- menuMaxHeight: e,
37
- hoisted: u,
38
- id: n,
39
- portalContainer: document.getElementById(c) ? `#${c}` : void 0,
40
- className: `${A.customSelect} ${r ?? ""}`,
41
- ..._
42
- }
43
- );
44
- }, ne = ({ value: e, textKey: t, valueKey: l }) => {
45
- if (!(!e || e.length === 0))
46
- return Array.isArray(e) ? /* @__PURE__ */ o(Q, { "data-testid": "select-tooltip", direction: "vertical", gap: "dense", children: e == null ? void 0 : e.map((r) => /* @__PURE__ */ o(R, { level: 2, children: r[t] }, r[l])) }) : e == null ? void 0 : e[t];
47
- }, re = "_invalidHelperText_zh2wu_1", se = "_invalidBorder_zh2wu_5", de = "_invalidPlaceholder_zh2wu_9", ce = "_invalidDropdownIcon_zh2wu_13", me = "_formSelectContainer_zh2wu_18", ue = "_formSelect_zh2wu_18", pe = "_multiText_zh2wu_53", he = "_tooltip_zh2wu_62", fe = "_disabled_zh2wu_67", d = {
48
- invalidHelperText: re,
49
- invalidBorder: se,
50
- invalidPlaceholder: de,
51
- invalidDropdownIcon: ce,
52
- formSelectContainer: me,
53
- formSelect: ue,
54
- multiText: pe,
55
- tooltip: he,
56
- disabled: fe
57
- }, ve = ({
58
- propertyName: e,
59
- label: t,
60
- options: l,
61
- multi: r = !1,
62
- disabled: u = !1,
63
- hoisted: _ = !1,
64
- hidden: c = !1,
65
- valueKey: n = "value",
66
- textKey: s = "text",
67
- clearable: x = !1,
68
- searchable: M = !0,
69
- noOptionsMessage: S = "",
70
- rules: p,
71
- menuPosition: D = "auto",
72
- ...a
73
- }) => {
74
- const {
75
- control: T,
76
- getFieldState: F,
77
- formState: { errors: w, isValidating: C }
78
- } = Z(), H = z(
79
- () => !C && b(w, e) !== void 0,
80
- [w, e, C]
81
- ), O = z(
82
- () => {
83
- var g;
84
- return (g = p == null ? void 0 : p.required) == null ? void 0 : g.message;
85
- },
86
- [p]
87
- ), { helperText: $, helperTextPersistent: B } = U({
88
- propertyName: e,
89
- helperText: a.helperText,
90
- requiredText: O,
91
- hasCharacterCount: !1
92
- });
93
- return c ? /* @__PURE__ */ o(N, { name: e, control: T, render: () => /* @__PURE__ */ o(K, {}) }) : /* @__PURE__ */ o(
94
- "div",
95
- {
96
- "data-testid": "form-select-container",
97
- className: d.formSelectContainer,
98
- "data-tooltip-id": t,
99
- children: /* @__PURE__ */ o(
100
- N,
101
- {
102
- name: e,
103
- rules: p,
104
- control: T,
105
- render: ({ field: { ref: g, onChange: y, value: h, ...E } }) => {
106
- let m = l;
107
- le(l) && b(l[0], "options") !== void 0 && (m = l.flatMap((i) => b(i, "options") ?? []));
108
- const f = r ? m == null ? void 0 : m.filter(
109
- (i) => h == null ? void 0 : h.includes(i[n])
110
- ) : m == null ? void 0 : m.find((i) => i[n] === h), V = r && a.multiDisplayType === "text" && a.fixedHeightInput, v = F(e).invalid, q = `
111
- ${d.formSelect}
112
- ${v ? d.invalidHelperText : ""}
113
- ${v ? d.invalidDropdownIcon : ""}
114
- ${v ? d.invalidBorder : ""}
115
- ${v ? d.invalidPlaceholder : ""}
116
- ${V ? d.multiText : ""}
117
- ${u ? d.disabled : ""}`;
118
- return /* @__PURE__ */ j(K, { children: [
119
- /* @__PURE__ */ o(
120
- ie,
121
- {
122
- ...E,
123
- ...a,
124
- value: f ?? [],
125
- label: t,
126
- variant: "outlined",
127
- helperText: $,
128
- helperTextPersistent: B,
129
- options: l,
130
- valid: !H,
131
- "data-testid": a["data-testid"] ?? `select-${e}`,
132
- multiSelect: !(l != null && l.length) && S ? !1 : r,
133
- className: q,
134
- disabled: u,
135
- valueKey: n,
136
- textKey: s,
137
- onChange: (i) => {
138
- var I;
139
- if (i == null) {
140
- y(i);
141
- return;
142
- }
143
- if (r) {
144
- y(i.map((L) => L[n]));
145
- return;
146
- }
147
- y(i[n]), (I = a == null ? void 0 : a.onChange) == null || I.call(a, i);
148
- },
149
- hoisted: _,
150
- noOptionsMessage: S,
151
- searchable: M,
152
- clearable: x,
153
- menuPosition: D
154
- }
155
- ),
156
- /* @__PURE__ */ o(
157
- J,
158
- {
159
- id: t,
160
- noArrow: !0,
161
- place: "bottom",
162
- delayShow: 420,
163
- className: d.tooltip,
164
- hidden: !f || f.length === 0 || !a.fixedHeightInput,
165
- children: /* @__PURE__ */ o(ne, { value: f, textKey: s, valueKey: n })
166
- }
167
- )
168
- ] });
169
- }
170
- }
171
- )
172
- }
173
- );
174
- }, Ie = (e) => {
175
- const { t } = X();
176
- return /* @__PURE__ */ o(ee, { children: /* @__PURE__ */ o(
177
- ve,
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { FormSelect as o } from "@hortiview/shared-components";
3
+ import { InternationalizationWrapper as i } from "../InternationalizationWrapper/InternationalizationWrapper.js";
4
+ import { u as r } from "../../useTranslation-DGtUf8nl.js";
5
+ const c = (e) => {
6
+ const { t } = r();
7
+ return /* @__PURE__ */ l(i, { children: /* @__PURE__ */ l(
8
+ o,
178
9
  {
179
10
  ...e,
180
11
  multiDisplayTextValue: e.multiDisplayTextValue ?? t("formSelect.multiItems"),
@@ -185,5 +16,5 @@ const le = /* @__PURE__ */ W(te), oe = "_customPortal_1u11g_1", ae = "_customSel
185
16
  ) });
186
17
  };
187
18
  export {
188
- Ie as DefaultFormSelect
19
+ c as DefaultFormSelect
189
20
  };
@@ -1,10 +1,10 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { N as t } from "../../LoadingSpinner-CmwCv7BO.js";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { LoadingSpinner as i } from "@hortiview/shared-components";
3
3
  import { InternationalizationWrapper as o } from "../InternationalizationWrapper/InternationalizationWrapper.js";
4
- import { u as a } from "../../useTranslation-BQQybhSd.js";
5
- const l = ({ ...n }) => {
6
- const { t: r } = a();
7
- return /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(t, { ...n, text: r("loadingSpinner.baseMessage"), impatienceMessage: null }) });
4
+ import { u as t } from "../../useTranslation-DGtUf8nl.js";
5
+ const l = ({ ...r }) => {
6
+ const { t: e } = t();
7
+ return /* @__PURE__ */ n(o, { children: /* @__PURE__ */ n(i, { ...r, text: e("loadingSpinner.baseMessage"), impatienceMessage: null }) });
8
8
  };
9
9
  export {
10
10
  l as DefaultLoadingSpinner