@hortiview/default-components 1.3.0 → 1.4.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 (41) hide show
  1. package/dist/{HealthCheckFailed-BA_vyKwG.js → HealthCheckFailed-DoqoTvwZ.js} +12 -11
  2. package/dist/Iconify-Cjdr-ccS.js +82 -0
  3. package/dist/{LoadingSpinner-5JYKhDod.js → LoadingSpinner-FRQEZvxs.js} +26 -25
  4. package/dist/OfflineView-HbuDPpQL-BX2tMPh9.js +46 -0
  5. package/dist/assets/DefaultFormSelect.css +1 -0
  6. package/dist/{component-DsB0poTj-uxpi4oSj.js → component-DsB0poTj-BZ89hFvY.js} +3 -3
  7. package/dist/components/DefaultFormNumber/DefaultFormNumber.js +239 -251
  8. package/dist/components/DefaultFormSelect/DefaultFormSelect.d.ts +14 -0
  9. package/dist/components/DefaultFormSelect/DefaultFormSelect.js +189 -0
  10. package/dist/components/DefaultLoadingSpinner/DefaultLoadingSpinner.js +2 -2
  11. package/dist/components/GenericTable/GenericTable.js +9928 -23562
  12. package/dist/components/HealthChecks/DataBaseHealthCheck.js +2 -2
  13. package/dist/components/HealthChecks/DefaultHealthCheck.js +2 -2
  14. package/dist/components/HealthChecks/IotServiceHealthCheck.js +2 -2
  15. package/dist/components/HealthChecks/PlatformHealthCheck.js +2 -2
  16. package/dist/components/ImpatienceLoadingSpinner/ImpatienceLoadingSpinner.js +2 -2
  17. package/dist/components/OfflineView/OfflineView.js +2 -2
  18. package/dist/index.es--yyG47az-DBKBm3yD.js +825 -0
  19. package/dist/{index.es-CiqbARoC-D-muiSwa.js → index.es-Bx1E5MPK-BWa0n8W0.js} +31 -31
  20. package/dist/index.es-CzUKBF7E-BPJhlGEA.js +13567 -0
  21. package/dist/{index.es-D-CKRzIB-DPq2PQz-.js → index.es-D-ph6ImM-CWxTa_iD.js} +15 -15
  22. package/dist/index.es-DDo_AHL0-Bnqdxr8c.js +1033 -0
  23. package/dist/index.es-Kg9soDed-DUORjY8X.js +440 -0
  24. package/dist/index.es-U5-b20Gv-Bta-iNSF.js +1010 -0
  25. package/dist/locales/en-US.js +9 -7
  26. package/dist/locales/en-US.json.d.ts +8 -2
  27. package/dist/locales/es-MX.js +8 -6
  28. package/dist/locales/es-MX.json.d.ts +8 -2
  29. package/dist/locales/tr-TR.js +15 -13
  30. package/dist/locales/tr-TR.json.d.ts +8 -2
  31. package/dist/main.d.ts +6 -3
  32. package/dist/main.js +22 -20
  33. package/dist/{index.es-25EARqhH-CciUgLci.js → omit-1Eom1PmQ-DluRHOwa.js} +748 -1314
  34. package/dist/useHelperText-BjFihJ7h.js +21 -0
  35. package/dist/useTranslation-B_ODv8uN.js +4306 -0
  36. package/package.json +3 -3
  37. package/dist/Iconify-B42tJF6q.js +0 -979
  38. package/dist/OfflineView-BW19N4Cu-CpgiY6nC.js +0 -45
  39. package/dist/index.es-6TJ1S8Jr-C4X_iaSC.js +0 -1468
  40. package/dist/useTranslation-v0qSkb40.js +0 -4223
  41. /package/dist/assets/{OfflineView-BW19N4Cu.css → OfflineView-HbuDPpQL.css} +0 -0
@@ -0,0 +1,14 @@
1
+ import { FormSelectProps } from '@hortiview/shared-components';
2
+ import { FieldValues } from 'react-hook-form';
3
+
4
+ /**
5
+ * Default form select component with translations for common labels.
6
+ * Translated labels are:
7
+ * - multiDisplayTextValue
8
+ * - noOptionsMessage
9
+ * - optionFilterLabel
10
+ * - selectAllLabel
11
+ * @param props
12
+ * @returns
13
+ */
14
+ export declare const DefaultFormSelect: <T extends FieldValues>(props: FormSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,189 @@
1
+ import { jsx as o, Fragment as I, jsxs as U } from "react/jsx-runtime";
2
+ import { a as b, v as j } from "../../useHelperText-BjFihJ7h.js";
3
+ import { g as W, U as X, u as Y } from "../../useTranslation-B_ODv8uN.js";
4
+ import { useEffect as z, useMemo as N } from "react";
5
+ import { useFormContext as Z, Controller as A } from "react-hook-form";
6
+ import { I as k, t as G, V as J } from "../../index.es-CzUKBF7E-BPJhlGEA.js";
7
+ import { n as Q, f as R } from "../../index.es--yyG47az-DBKBm3yD.js";
8
+ import { InternationalizationWrapper as ee } from "../InternationalizationWrapper/InternationalizationWrapper.js";
9
+ import '../../assets/DefaultFormSelect.css';const te = "_customPortal_8wq49_1", le = "_customSelect_8wq49_7", K = {
10
+ customPortal: te,
11
+ customSelect: le
12
+ }, oe = ({
13
+ menuMaxHeight: e = "15rem",
14
+ portalClassName: t,
15
+ "data-testid": l = "custom-select",
16
+ className: r,
17
+ hoisted: u,
18
+ ...x
19
+ }) => {
20
+ const c = `custom-portal-${t ?? "default"}`, n = k("elementSelectForTestId-");
21
+ return z(() => {
22
+ if (u && !document.getElementById(c)) {
23
+ const s = document.createElement("div");
24
+ s.id = c, s.className = `${K.customPortal} ${t ?? ""}`, document.body.appendChild(s);
25
+ }
26
+ }, [u, c, t]), z(() => {
27
+ const s = document.querySelectorAll(`#${n} input[role="combobox"]`);
28
+ s && s.forEach((_) => {
29
+ _.setAttribute("data-testid", l);
30
+ });
31
+ }, [l, n]), /* @__PURE__ */ o(
32
+ G,
33
+ {
34
+ menuMaxHeight: e,
35
+ hoisted: u,
36
+ id: n,
37
+ portalContainer: document.getElementById(c) ? `#${c}` : void 0,
38
+ className: `${K.customSelect} ${r ?? ""}`,
39
+ ...x
40
+ }
41
+ );
42
+ };
43
+ var ae = X();
44
+ const ie = /* @__PURE__ */ W(ae), 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_1qcz0_1", se = "_invalidBorder_1qcz0_5", de = "_invalidPlaceholder_1qcz0_9", ce = "_invalidDropdownIcon_1qcz0_13", me = "_formSelectContainer_1qcz0_18", ue = "_formSelect_1qcz0_18", pe = "_multiText_1qcz0_40", fe = "_tooltip_1qcz0_49", he = "_disabled_1qcz0_54", d = {
48
+ invalidHelperText: re,
49
+ invalidBorder: se,
50
+ invalidPlaceholder: de,
51
+ invalidDropdownIcon: ce,
52
+ formSelectContainer: me,
53
+ formSelect: ue,
54
+ multiText: pe,
55
+ tooltip: fe,
56
+ disabled: he
57
+ }, ve = ({
58
+ propertyName: e,
59
+ label: t,
60
+ options: l,
61
+ multi: r = !1,
62
+ disabled: u = !1,
63
+ hoisted: x = !1,
64
+ hidden: c = !1,
65
+ valueKey: n = "value",
66
+ textKey: s = "text",
67
+ clearable: _ = !1,
68
+ searchable: M = !0,
69
+ noOptionsMessage: S = "",
70
+ rules: p,
71
+ menuPosition: $ = "auto",
72
+ ...a
73
+ }) => {
74
+ const {
75
+ control: T,
76
+ getFieldState: F,
77
+ formState: { errors: q, isValidating: C }
78
+ } = Z(), w = N(
79
+ () => !C && b(q, e) !== void 0,
80
+ [q, e, C]
81
+ ), D = N(
82
+ () => {
83
+ var g;
84
+ return (g = p == null ? void 0 : p.required) == null ? void 0 : g.message;
85
+ },
86
+ [p]
87
+ ), { helperText: H, helperTextPersistent: B } = j({
88
+ propertyName: e,
89
+ helperText: a.helperText,
90
+ requiredText: D,
91
+ hasCharacterCount: !1
92
+ });
93
+ return c ? /* @__PURE__ */ o(A, { name: e, control: T, render: () => /* @__PURE__ */ o(I, {}) }) : /* @__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
+ A,
101
+ {
102
+ name: e,
103
+ rules: p,
104
+ control: T,
105
+ render: ({ field: { ref: g, onChange: y, value: f, ...E } }) => {
106
+ let m = l;
107
+ ie(l) && b(l[0], "options") !== void 0 && (m = l.flatMap((i) => b(i, "options") ?? []));
108
+ const h = r ? m == null ? void 0 : m.filter(
109
+ (i) => f == null ? void 0 : f.includes(i[n])
110
+ ) : m == null ? void 0 : m.find((i) => i[n] === f), O = r && a.multiDisplayType === "text" && a.fixedHeightInput, v = F(e).invalid, V = `
111
+ ${d.formSelect}
112
+ ${v ? d.invalidHelperText : ""}
113
+ ${v ? d.invalidDropdownIcon : ""}
114
+ ${v ? d.invalidBorder : ""}
115
+ ${v ? d.invalidPlaceholder : ""}
116
+ ${O ? d.multiText : ""}
117
+ ${u ? d.disabled : ""}`;
118
+ return /* @__PURE__ */ U(I, { children: [
119
+ /* @__PURE__ */ o(
120
+ oe,
121
+ {
122
+ ...E,
123
+ ...a,
124
+ value: h ?? [],
125
+ label: t,
126
+ variant: "outlined",
127
+ helperText: H,
128
+ helperTextPersistent: B,
129
+ options: l,
130
+ valid: !w,
131
+ "data-testid": a["data-testid"] ?? `select-${e}`,
132
+ multiSelect: !(l != null && l.length) && S ? !1 : r,
133
+ className: V,
134
+ disabled: u,
135
+ valueKey: n,
136
+ textKey: s,
137
+ onChange: (i) => {
138
+ var P;
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]), (P = a == null ? void 0 : a.onChange) == null || P.call(a, i);
148
+ },
149
+ hoisted: x,
150
+ noOptionsMessage: S,
151
+ searchable: M,
152
+ clearable: _,
153
+ menuPosition: $
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: !h || h.length === 0 || !a.fixedHeightInput,
165
+ children: /* @__PURE__ */ o(ne, { value: h, textKey: s, valueKey: n })
166
+ }
167
+ )
168
+ ] });
169
+ }
170
+ }
171
+ )
172
+ }
173
+ );
174
+ }, Ce = (e) => {
175
+ const { t } = Y();
176
+ return /* @__PURE__ */ o(ee, { children: /* @__PURE__ */ o(
177
+ ve,
178
+ {
179
+ ...e,
180
+ multiDisplayTextValue: e.multiDisplayTextValue ?? t("formSelect.multiItems"),
181
+ noOptionsMessage: e.noOptionsMessage ?? t("formSelect.noOptions"),
182
+ optionFilterLabel: e.optionFilterLabel ?? t("formSelect.filterOptions"),
183
+ selectAllLabel: e.selectAllLabel ?? t("formSelect.selectAll")
184
+ }
185
+ ) });
186
+ };
187
+ export {
188
+ Ce as DefaultFormSelect
189
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { p as t } from "../../LoadingSpinner-5JYKhDod.js";
2
+ import { p as t } from "../../LoadingSpinner-FRQEZvxs.js";
3
3
  import { InternationalizationWrapper as o } from "../InternationalizationWrapper/InternationalizationWrapper.js";
4
- import { u as a } from "../../useTranslation-v0qSkb40.js";
4
+ import { u as a } from "../../useTranslation-B_ODv8uN.js";
5
5
  const l = ({ ...n }) => {
6
6
  const { t: r } = a();
7
7
  return /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(t, { ...n, text: r("loadingSpinner.baseMessage"), impatienceMessage: null }) });