@hortiview/default-components 1.4.4 → 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 (51) hide show
  1. package/README.md +51 -0
  2. package/dist/components/DefaultAllowedComponent/DefaultAllowedComponent.d.ts +11 -0
  3. package/dist/components/DefaultAllowedComponent/DefaultAllowedComponent.js +11 -0
  4. package/dist/components/DefaultFormNumber/DefaultFormNumber.js +12 -1496
  5. package/dist/components/DefaultFormSelect/DefaultFormSelect.js +9 -178
  6. package/dist/components/DefaultLoadingSpinner/DefaultLoadingSpinner.js +6 -6
  7. package/dist/components/GenericTable/GenericTable.js +12 -18731
  8. package/dist/components/HealthChecks/DataBaseHealthCheck.js +2 -2
  9. package/dist/components/HealthChecks/DefaultHealthCheck.js +4 -4
  10. package/dist/components/HealthChecks/IotServiceHealthCheck.js +5 -5
  11. package/dist/components/HealthChecks/PlatformHealthCheck.js +4 -4
  12. package/dist/components/ImpatienceLoadingSpinner/ImpatienceLoadingSpinner.js +9 -9
  13. package/dist/components/InternationalizationWrapper/InternationalizationWrapper.js +4 -4
  14. package/dist/components/OfflineView/OfflineView.js +9 -9
  15. package/dist/i18n.js +1696 -5
  16. package/dist/{i18nInstance-D_96ADqd.js → i18nInstance-CYqpK5II.js} +2 -2
  17. package/dist/locales/en-US.js +16 -14
  18. package/dist/locales/en-US.json.d.ts +3 -0
  19. package/dist/locales/es-MX.js +16 -14
  20. package/dist/locales/es-MX.json.d.ts +3 -0
  21. package/dist/locales/tr-TR.js +17 -15
  22. package/dist/locales/tr-TR.json.d.ts +3 -0
  23. package/dist/main.d.ts +1 -0
  24. package/dist/main.js +24 -22
  25. package/dist/useTranslation-DGtUf8nl.js +101 -0
  26. package/package.json +3 -32
  27. package/dist/Iconify-aUog1Oez.js +0 -83
  28. package/dist/InfoCard-BxjAQiFE.js +0 -58
  29. package/dist/LoadingSpinner-DBMjIfY1.js +0 -502
  30. package/dist/OfflineView-NUM9WE0F-BI9rnget.js +0 -46
  31. package/dist/assets/DefaultFormNumber.css +0 -1
  32. package/dist/assets/DefaultFormSelect.css +0 -1
  33. package/dist/assets/GenericTable.css +0 -1
  34. package/dist/assets/Iconify.css +0 -1
  35. package/dist/assets/InfoCard.css +0 -1
  36. package/dist/assets/LoadingSpinner.css +0 -1
  37. package/dist/assets/OfflineView-NUM9WE0F.css +0 -1
  38. package/dist/component-DsB0poTj-DgsYK0_R.js +0 -570
  39. package/dist/correct-is-regexp-logic-BBlm4UpN-CvII841s.js +0 -493
  40. package/dist/i18n-CCQpJsQK.js +0 -1707
  41. package/dist/index.es-B0QNuIUR-Bte5aF5M.js +0 -360
  42. package/dist/index.es-CIsLNz4j-ZEEcPmTs.js +0 -79
  43. package/dist/index.es-CvHDFF6V-CjZvA03R.js +0 -2004
  44. package/dist/index.es-DiONypF4-eT98Y3u_.js +0 -844
  45. package/dist/index.es-DnEIFMjv-DuuORGfo.js +0 -1044
  46. package/dist/index.es-NEYPxnlS-C8xQv2De.js +0 -860
  47. package/dist/index.es-fV9oWpEf-BXuhoGtE.js +0 -14374
  48. package/dist/isTypedArray-Dw_IY7Zq-wj3MphCb.js +0 -210
  49. package/dist/slicedToArray-h0Nnkd_P-C4SkVJMK.js +0 -432
  50. package/dist/useHelperText-B7OMZXvE.js +0 -391
  51. package/dist/useTranslation-B_lNCuLm.js +0 -5343
@@ -1,180 +1,11 @@
1
- import { jsx as o, Fragment as I, jsxs as q } from "react/jsx-runtime";
2
- import { a as b, v as U } from "../../useHelperText-B7OMZXvE.js";
3
- import { z as W, ao as X, u as Y } from "../../useTranslation-B_lNCuLm.js";
4
- import { useEffect as K, useMemo as P } from "react";
5
- import { useFormContext as Z, Controller as N } from "react-hook-form";
6
- import { I as k, K as G, V as J } from "../../index.es-fV9oWpEf-BXuhoGtE.js";
7
- import { O as Q, D as R } from "../../index.es-NEYPxnlS-C8xQv2De.js";
8
- import { InternationalizationWrapper as ee } from "../InternationalizationWrapper/InternationalizationWrapper.js";
9
- import '../../assets/DefaultFormSelect.css';const te = "_customPortal_1u11g_1", le = "_customSelect_1u11g_8", A = {
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
- ..._
19
- }) => {
20
- const c = `custom-portal-${t ?? "default"}`, n = k("elementSelectForTestId-");
21
- return K(() => {
22
- if (u && !document.getElementById(c)) {
23
- const s = document.createElement("div");
24
- s.id = c, s.className = `${A.customPortal} ${t ?? ""}`, document.body.appendChild(s);
25
- }
26
- }, [u, c, t]), K(() => {
27
- const s = document.querySelectorAll(`#${n} input[role="combobox"]`);
28
- s && s.forEach((x) => {
29
- x.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: `${A.customSelect} ${r ?? ""}`,
39
- ..._
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_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 = P(
79
- () => !C && b(w, e) !== void 0,
80
- [w, e, C]
81
- ), O = P(
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(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
- 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
- ie(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, L = `
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__ */ q(I, { children: [
119
- /* @__PURE__ */ o(
120
- oe,
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: L,
134
- disabled: u,
135
- valueKey: n,
136
- textKey: s,
137
- onChange: (i) => {
138
- var z;
139
- if (i == null) {
140
- y(i);
141
- return;
142
- }
143
- if (r) {
144
- y(i.map((j) => j[n]));
145
- return;
146
- }
147
- y(i[n]), (z = a == null ? void 0 : a.onChange) == null || z.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
- }, Ce = (e) => {
175
- const { t } = Y();
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 ie = /* @__PURE__ */ W(ae), ne = ({ value: e, textKey: t, valueKey: l }) =
185
16
  ) });
186
17
  };
187
18
  export {
188
- Ce 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-DBMjIfY1.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-B_lNCuLm.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