@beda.software/web-item-controls 0.1.29-tab-validation.1 → 0.1.29

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.
@@ -1,5 +1,7 @@
1
1
  import { GroupTableChartProps } from './types';
2
2
  export { useGroupTableChart } from './hooks';
3
+ export { HighlightArea } from './HighlightArea';
4
+ export type { HighlightProps, HighlightParams } from './HighlightArea';
3
5
  export type { GroupTableChartProps, ChartType } from './types';
4
6
  export declare function GroupTableChart(props: GroupTableChartProps): import("react/jsx-runtime").JSX.Element;
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/GroupTable/GroupTableChart/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/D,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAgH1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/GroupTable/GroupTableChart/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvE,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/D,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAgH1D"}
@@ -57,5 +57,6 @@ function H(a) {
57
57
  }
58
58
  export {
59
59
  H as GroupTableChart,
60
+ I as HighlightArea,
60
61
  M as useGroupTableChart
61
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupTabs/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAsC,MAAM,SAAS,CAAC;AAM7E,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAgF9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupTabs/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAsC,MAAM,SAAS,CAAC;AAI7E,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CA0D9C"}
@@ -1,47 +1,33 @@
1
- import { jsx as s, jsxs as k } from "react/jsx-runtime";
2
- import { theme as y, Tabs as x, Flex as p, Badge as T } from "antd";
3
- import v from "lodash";
4
- import { useState as E } from "react";
5
- import { useWatch as P, useFormState as B } from "react-hook-form";
6
- import { getEnabledQuestions as C, QuestionItems as G } from "sdc-qrf";
7
- import { GroupWizardBus as K } from "../GroupWizard/index.js";
8
- import { countValidationErrors as j } from "./utils.js";
9
- function _(d) {
10
- var m;
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { Flex as f, Tabs as d } from "antd";
3
+ import { useState as b, useMemo as h } from "react";
4
+ import { useWatch as y } from "react-hook-form";
5
+ import { getEnabledQuestions as x, QuestionItems as I } from "sdc-qrf";
6
+ import { GroupWizardBus as v } from "../GroupWizard/index.js";
7
+ function B(p) {
8
+ var c;
11
9
  const {
12
- parentPath: i,
13
- questionItem: n,
14
- context: f
15
- } = d;
16
- n.repeats && console.warn("GroupTabs does not support repeatable groups in the first level");
17
- const h = P(), {
18
- errors: b
19
- } = B(), {
20
- token: g
21
- } = y.useToken(), [I, c] = E(), o = (() => {
10
+ parentPath: n,
11
+ questionItem: o,
12
+ context: a
13
+ } = p;
14
+ o.repeats && console.warn("GroupTabs does not support repeatable groups in the first level");
15
+ const m = y(), [l, u] = b(), r = h(() => {
22
16
  const {
23
- linkId: r
24
- } = n, e = f[0];
25
- return e ? C(n.item ?? [], i, h, e).filter((t) => !t.hidden).map((t) => {
26
- const u = [...i, r, "items", t.linkId, "items"], l = j(v.get(b, u)), a = l > 0;
27
- return {
28
- key: t.linkId,
29
- label: /* @__PURE__ */ k(p, { align: "center", gap: 8, "data-testid": `group-tab-${t.linkId}`, "data-has-errors": a, style: a ? {
30
- color: g.colorError
31
- } : void 0, children: [
32
- t.text,
33
- a ? /* @__PURE__ */ s(T, { count: l, size: "small", "data-testid": `group-tab-errors-count-${t.linkId}` }) : null
34
- ] }),
35
- children: /* @__PURE__ */ s(p, { gap: 16, vertical: !0, children: /* @__PURE__ */ s(G, { questionItems: t.item, parentPath: u, context: e }) })
36
- };
37
- }) : [];
38
- })();
39
- return K.useBus("scrollTo", ({
40
- groupLinkId: r
17
+ linkId: s
18
+ } = o, t = a[0];
19
+ return t ? x(o.item ?? [], n, m, t).filter((e) => !e.hidden).map((e) => ({
20
+ key: e.linkId,
21
+ label: e.text,
22
+ children: /* @__PURE__ */ i(f, { gap: 16, vertical: !0, children: /* @__PURE__ */ i(I, { questionItems: e.item, parentPath: [...n, s, "items", e.linkId, "items"], context: t }) })
23
+ })) : [];
24
+ }, [a, m, n, o]);
25
+ return v.useBus("scrollTo", ({
26
+ groupLinkId: s
41
27
  }) => {
42
- o.some((e) => e.key === r) && c(r);
43
- }, [o]), /* @__PURE__ */ s(x, { type: "card", items: o, activeKey: I ?? ((m = o[0]) == null ? void 0 : m.key), onChange: c, destroyInactiveTabPane: !0 });
28
+ r.some((t) => t.key === s) && u(s);
29
+ }, [r]), /* @__PURE__ */ i(d, { type: "card", items: r, activeKey: l ?? ((c = r[0]) == null ? void 0 : c.key), onChange: u, destroyInactiveTabPane: !0 });
44
30
  }
45
31
  export {
46
- _ as GroupTabs
32
+ B as GroupTabs
47
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beda.software/web-item-controls",
3
- "version": "0.1.29-tab-validation.1",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,8 +0,0 @@
1
- /**
2
- * Recursively counts leaf validation errors in a (nested) react-hook-form errors object.
3
- *
4
- * @param errors - A react-hook-form errors subtree (object, array or a single field error)
5
- * @returns Number of field errors found in the subtree
6
- */
7
- export declare function countValidationErrors(errors: unknown): number;
8
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupTabs/utils.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAU7D"}
@@ -1,10 +0,0 @@
1
- import i from "lodash";
2
- function n(t) {
3
- return i.isPlainObject(t) && typeof t.type == "string";
4
- }
5
- function o(t) {
6
- return n(t) ? 1 : i.isObjectLike(t) ? Object.values(t).reduce((r, e) => r + o(e), 0) : 0;
7
- }
8
- export {
9
- o as countValidationErrors
10
- };