@beda.software/web-item-controls 0.1.24 → 0.1.25-group-accordion.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/controls/Group/AccordionSection/index.d.ts +12 -0
  2. package/dist/controls/Group/AccordionSection/index.d.ts.map +1 -0
  3. package/dist/controls/Group/AccordionSection/index.js +33 -0
  4. package/dist/controls/Group/AccordionSection/styles.d.ts +13 -0
  5. package/dist/controls/Group/AccordionSection/styles.d.ts.map +1 -0
  6. package/dist/controls/Group/AccordionSection/styles.js +38 -0
  7. package/dist/controls/Group/ChildGroupAccordionProvider.d.ts +9 -0
  8. package/dist/controls/Group/ChildGroupAccordionProvider.d.ts.map +1 -0
  9. package/dist/controls/Group/ChildGroupAccordionProvider.js +24 -0
  10. package/dist/controls/Group/GoalsAndTasksAccordion.fixtures.d.ts +8 -0
  11. package/dist/controls/Group/GoalsAndTasksAccordion.fixtures.d.ts.map +1 -0
  12. package/dist/controls/Group/GroupAccordionExpandBus.stories.utils.d.ts +11 -0
  13. package/dist/controls/Group/GroupAccordionExpandBus.stories.utils.d.ts.map +1 -0
  14. package/dist/controls/Group/GroupCard/index.d.ts +3 -0
  15. package/dist/controls/Group/GroupCard/index.d.ts.map +1 -1
  16. package/dist/controls/Group/GroupCard/index.js +72 -40
  17. package/dist/controls/Group/GroupCard/styles.d.ts +14 -2
  18. package/dist/controls/Group/GroupCard/styles.d.ts.map +1 -1
  19. package/dist/controls/Group/GroupCard/styles.js +31 -11
  20. package/dist/controls/Group/RepeatableGroups/RepeatableGroupCard/index.d.ts.map +1 -1
  21. package/dist/controls/Group/RepeatableGroups/RepeatableGroupCard/index.js +23 -19
  22. package/dist/controls/Group/RepeatableGroups/index.d.ts.map +1 -1
  23. package/dist/controls/Group/RepeatableGroups/index.js +126 -50
  24. package/dist/controls/Group/RepeatableGroups/types.d.ts +2 -0
  25. package/dist/controls/Group/RepeatableGroups/types.d.ts.map +1 -1
  26. package/dist/controls/Group/accordionContext.d.ts +19 -0
  27. package/dist/controls/Group/accordionContext.d.ts.map +1 -0
  28. package/dist/controls/Group/accordionContext.js +47 -0
  29. package/dist/controls/Group/index.d.ts.map +1 -1
  30. package/dist/controls/Group/index.js +89 -67
  31. package/dist/controls/GroupWizard/GroupWizard.stories.utils.d.ts +1 -1
  32. package/dist/controls/GroupWizard/GroupWizard.stories.utils.d.ts.map +1 -1
  33. package/dist/controls/GroupWizard/index.d.ts +46 -1
  34. package/dist/controls/GroupWizard/index.d.ts.map +1 -1
  35. package/dist/controls/controls.js +14 -12
  36. package/dist/style.css +1 -1
  37. package/package.json +9 -14
  38. package/src/locale/de/messages.po +9 -6
  39. package/src/locale/en/messages.po +9 -6
  40. package/src/locale/es/messages.po +9 -6
  41. package/src/locale/ru/messages.po +9 -6
@@ -1,57 +1,133 @@
1
- import { jsxs as G, jsx as t } from "react/jsx-runtime";
2
- import { Trans as c } from "@lingui/react";
3
- import { PlusOutlined as k } from "@ant-design/icons";
4
- import { Button as x } from "antd";
5
- import f from "lodash";
6
- import F from "react";
7
- import { useFormContext as V } from "react-hook-form";
8
- import { getItemKey as R, populateItemKey as j } from "sdc-qrf";
9
- import { useFieldController as q } from "../../../components/BaseQuestionnaireResponseForm/hooks.js";
10
- import { RepeatableGroupCard as z } from "./RepeatableGroupCard/index.js";
11
- import { S as h } from "./styles.js";
12
- function B(i) {
13
- return [...i, {}];
1
+ import { jsxs as b, Fragment as R, jsx as i } from "react/jsx-runtime";
2
+ import { Trans as K } from "@lingui/react";
3
+ import { i18n as I } from "@lingui/core";
4
+ import { PlusOutlined as q } from "@ant-design/icons";
5
+ import { Modal as w, Button as S } from "antd";
6
+ import a from "lodash";
7
+ import E, { useState as H } from "react";
8
+ import { useFormContext as Q, useFieldArray as W } from "react-hook-form";
9
+ import { getItemKey as s, populateItemKey as X } from "sdc-qrf";
10
+ import { useFieldController as Z } from "../../../components/BaseQuestionnaireResponseForm/hooks.js";
11
+ import { GroupWizardBus as u } from "../../GroupWizard/index.js";
12
+ import { useGroupAccordionMode as D } from "../accordionContext.js";
13
+ import { RepeatableGroupCard as J } from "./RepeatableGroupCard/index.js";
14
+ import { S as L } from "./styles.js";
15
+ function U(f) {
16
+ return [...f, {}];
14
17
  }
15
- function A(i) {
18
+ function le(f) {
16
19
  const {
17
- groupItem: o,
18
- renderGroup: u,
19
- buildValue: g = B
20
- } = i, {
21
- parentPath: y,
22
- questionItem: p
23
- } = o, {
24
- linkId: I,
25
- text: s
26
- } = p, l = [...y, I], {
20
+ groupItem: l,
21
+ renderGroup: h,
22
+ buildValue: j = U
23
+ } = f, {
24
+ parentPath: x,
25
+ questionItem: y
26
+ } = l, {
27
+ linkId: o,
28
+ text: G
29
+ } = y, k = [...x, o], {
27
30
  onChange: m
28
- } = q(l, p), {
29
- getValues: C
30
- } = V(), n = f.get(C(), l), b = (r) => (g(r) || []).map(j), e = (n == null ? void 0 : n.items) || [];
31
- return /* @__PURE__ */ G(h.Group, { children: [
32
- f.map(e, (r, a) => {
33
- if (!e[a])
34
- return null;
35
- const d = R(r);
36
- return u ? /* @__PURE__ */ t(F.Fragment, { children: u({
37
- index: a,
38
- items: e,
39
- onChange: m,
40
- groupItem: o
41
- }) }, d) : /* @__PURE__ */ t(z, { index: a, items: e, onChange: m, groupItem: o, variant: "main-card" }, d);
42
- }),
43
- o.questionItem.readOnly ? null : /* @__PURE__ */ t(h.Footer, { children: /* @__PURE__ */ t(x, { icon: /* @__PURE__ */ t(k, {}), type: "primary", ghost: !0, onClick: () => {
44
- const r = {
45
- ...n,
46
- items: b(e ?? [])
47
- };
48
- m(r);
49
- }, size: "middle", "data-testid": "add-another-answer-button", children: /* @__PURE__ */ t("span", { children: s ? /* @__PURE__ */ t(c, { id: "yCbNQL", values: {
50
- text: s
51
- } }) : /* @__PURE__ */ t(c, { id: "kiGxiz" }) }) }) })
31
+ } = Z(k, y), {
32
+ getValues: M,
33
+ control: P
34
+ } = Q(), {
35
+ remove: T
36
+ } = W({
37
+ control: P,
38
+ name: [...x, o, "items"].join(".")
39
+ }), p = a.get(M(), k), V = (e) => (j(e) || []).map(X), t = (p == null ? void 0 : p.items) || [], n = D(), [O, g] = H(() => n && t.length ? s(t[t.length - 1]) : null), d = n && t.length ? a.some(t, (e) => s(e) === O) ? O : s(t[t.length - 1]) : null, [v, _] = w.useModal(), B = () => {
40
+ const e = V(t ?? []);
41
+ m({
42
+ ...p,
43
+ items: e
44
+ }), n && e.length && g(s(e[e.length - 1]));
45
+ }, C = (e) => {
46
+ if (!n)
47
+ return;
48
+ const r = a.map(t, s).indexOf(d) + e;
49
+ r < 0 || r >= t.length || g(s(t[r]));
50
+ }, z = () => {
51
+ const e = a.map(t, s).indexOf(d);
52
+ e !== -1 && (T(e), m({
53
+ ...p,
54
+ items: [...t.slice(0, e), ...t.slice(e + 1)]
55
+ }));
56
+ };
57
+ return u.useBus("addItem", ({
58
+ groupLinkId: e
59
+ }) => {
60
+ e === o && (u.dispatch({
61
+ type: "expandGroup",
62
+ groupLinkId: o
63
+ }), B());
64
+ }, [o, t, p, m, n]), u.useBus("openNextItem", ({
65
+ groupLinkId: e
66
+ }) => {
67
+ e === o && (u.dispatch({
68
+ type: "expandGroup",
69
+ groupLinkId: o
70
+ }), C(1));
71
+ }, [o, t, d]), u.useBus("openPreviousItem", ({
72
+ groupLinkId: e
73
+ }) => {
74
+ e === o && (u.dispatch({
75
+ type: "expandGroup",
76
+ groupLinkId: o
77
+ }), C(-1));
78
+ }, [o, t, d]), u.useBus("removeItem", ({
79
+ groupLinkId: e
80
+ }) => {
81
+ e !== o || !n || (u.dispatch({
82
+ type: "expandGroup",
83
+ groupLinkId: o
84
+ }), v.confirm({
85
+ title: I._(
86
+ /*i18n*/
87
+ {
88
+ id: "XtpCjZ"
89
+ }
90
+ ),
91
+ okText: I._(
92
+ /*i18n*/
93
+ {
94
+ id: "cnGeoo"
95
+ }
96
+ ),
97
+ okButtonProps: {
98
+ danger: !0
99
+ },
100
+ cancelText: I._(
101
+ /*i18n*/
102
+ {
103
+ id: "dEgA5A"
104
+ }
105
+ ),
106
+ onOk: z
107
+ }));
108
+ }, [o, n, t, d, p, m, v]), /* @__PURE__ */ b(R, { children: [
109
+ _,
110
+ /* @__PURE__ */ b(L.Group, { children: [
111
+ a.map(t, (e, c) => {
112
+ if (!t[c])
113
+ return null;
114
+ const r = s(e), A = n ? r === d : void 0, F = n ? () => g((N) => N === r ? null : r) : void 0;
115
+ return h ? /* @__PURE__ */ i(E.Fragment, { children: h({
116
+ index: c,
117
+ items: t,
118
+ onChange: m,
119
+ groupItem: l,
120
+ isOpen: A,
121
+ onToggle: F
122
+ }) }, r) : /* @__PURE__ */ i(J, { index: c, items: t, onChange: m, groupItem: l, variant: "main-card", isOpen: A, onToggle: F }, r);
123
+ }),
124
+ l.questionItem.readOnly ? null : /* @__PURE__ */ i(L.Footer, { children: /* @__PURE__ */ i(S, { icon: /* @__PURE__ */ i(q, {}), type: "primary", ghost: !0, onClick: B, size: "middle", "data-testid": "add-another-answer-button", children: /* @__PURE__ */ i("span", { children: G ? /* @__PURE__ */ i(K, { id: "yCbNQL", values: {
125
+ text: G
126
+ } }) : /* @__PURE__ */ i(K, { id: "kiGxiz" }) }) }) })
127
+ ] })
52
128
  ] });
53
129
  }
54
130
  export {
55
- z as RepeatableGroupCard,
56
- A as RepeatableGroups
131
+ J as RepeatableGroupCard,
132
+ le as RepeatableGroups
57
133
  };
@@ -4,5 +4,7 @@ export interface RepeatableGroupProps {
4
4
  items: any;
5
5
  onChange: (event: any) => void;
6
6
  groupItem: GroupItemProps;
7
+ isOpen?: boolean;
8
+ onToggle?: () => void;
7
9
  }
8
10
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/RepeatableGroups/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,cAAc,CAAC;CAC7B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/RepeatableGroups/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,cAAc,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB"}
@@ -0,0 +1,19 @@
1
+ import { FCEQuestionnaireItem } from 'sdc-qrf';
2
+ export declare function getAccordionSiblingCandidates(item: FCEQuestionnaireItem[] | undefined): FCEQuestionnaireItem[];
3
+ export declare function qualifiesForAccordion(candidates: FCEQuestionnaireItem[]): boolean;
4
+ export declare function containsLinkId(item: FCEQuestionnaireItem, linkId: string): boolean;
5
+ export declare function findCandidateContaining(candidates: FCEQuestionnaireItem[], linkId: string): FCEQuestionnaireItem | undefined;
6
+ export declare function getPendingExpandTarget(): string | undefined;
7
+ export declare function setPendingExpandTarget(linkId: string): void;
8
+ export declare const GroupAccordionModeContext: import('react').Context<boolean>;
9
+ export declare function useGroupAccordionMode(): boolean;
10
+ export interface GroupSiblingAccordionContextProps {
11
+ activeLinkId: string;
12
+ setActiveLinkId: (linkId: string) => void;
13
+ }
14
+ export declare const GroupSiblingAccordionContext: import('react').Context<GroupSiblingAccordionContextProps | undefined>;
15
+ export declare function useGroupSiblingAccordion(linkId: string): {
16
+ isOpen: boolean;
17
+ onToggle: () => void;
18
+ } | undefined;
19
+ //# sourceMappingURL=accordionContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordionContext.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/accordionContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAM/C,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,SAAS,0BAErF;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,oBAAoB,EAAE,WAEvE;AAKD,wBAAgB,cAAc,CAAC,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAMlF;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,oBAAoB,EAAE,EAAE,MAAM,EAAE,MAAM,oCAEzF;AAYD,wBAAgB,sBAAsB,uBAErC;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,QAEpD;AAED,eAAO,MAAM,yBAAyB,kCAAuB,CAAC;AAE9D,wBAAgB,qBAAqB,YAEpC;AAED,MAAM,WAAW,iCAAiC;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,4BAA4B,wEAA0E,CAAC;AAEpH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM;;;cAatD"}
@@ -0,0 +1,47 @@
1
+ import { createContext as o, useContext as i } from "react";
2
+ function g(n) {
3
+ return (n ?? []).filter((t) => t.type === "group" && !t.hidden);
4
+ }
5
+ function s(n) {
6
+ return n.length > 1 && n.some((t) => t.repeats);
7
+ }
8
+ function r(n, t) {
9
+ return n.linkId === t ? !0 : (n.item ?? []).some((e) => r(e, t));
10
+ }
11
+ function a(n, t) {
12
+ return n.find((e) => r(e, t));
13
+ }
14
+ let c;
15
+ function p() {
16
+ return c;
17
+ }
18
+ function x(n) {
19
+ c = n;
20
+ }
21
+ const u = o(!1);
22
+ function l() {
23
+ return i(u);
24
+ }
25
+ const d = o(void 0);
26
+ function A(n) {
27
+ const t = i(d);
28
+ if (!t)
29
+ return;
30
+ const e = t.activeLinkId === n;
31
+ return {
32
+ isOpen: e,
33
+ onToggle: () => t.setActiveLinkId(e ? "" : n)
34
+ };
35
+ }
36
+ export {
37
+ u as GroupAccordionModeContext,
38
+ d as GroupSiblingAccordionContext,
39
+ r as containsLinkId,
40
+ a as findCandidateContaining,
41
+ g as getAccordionSiblingCandidates,
42
+ p as getPendingExpandTarget,
43
+ s as qualifiesForAccordion,
44
+ x as setPendingExpandTarget,
45
+ l as useGroupAccordionMode,
46
+ A as useGroupSiblingAccordion
47
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAuExD,wBAAgB,KAAK,CAAC,KAAK,EAAE,cAAc,2CAE1C;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,2CAExC;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,2CAExC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,2CAE3C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,cAAc,2CAEzC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,2CAE5C;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,2CAEvD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,2CAE7C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,2CAE5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AA2GxD,wBAAgB,KAAK,CAAC,KAAK,EAAE,cAAc,2CAE1C;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,2CAExC;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,2CAExC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,2CAE3C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,cAAc,2CAEzC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,2CAE5C;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,2CAEvD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,2CAE7C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,2CAE5C"}
@@ -1,86 +1,108 @@
1
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
- import g from "classnames";
3
- import { QuestionItems as w } from "sdc-qrf";
4
- import { ItemHelpText as y } from "../../components/BaseQuestionnaireResponseForm/ItemHelpText.js";
5
- import { Title as C } from "../../components/Typography.js";
6
- import { GroupContext as R } from "./context.js";
7
- import { GridGroup as S } from "./GridGroup/index.js";
8
- import p from "./group.module.scss.js";
9
- import { GroupCard as a } from "./GroupCard/index.js";
10
- import { GTable as T } from "./GTable/index.js";
11
- import { RepeatableGroups as l } from "./RepeatableGroups/index.js";
12
- import { S as u } from "./styles.js";
13
- import { RepeatableGroupRow as P } from "./RepeatableGroups/RepeatableGroupRow.js";
14
- function o(r) {
1
+ import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
+ import b from "classnames";
3
+ import w from "lodash";
4
+ import { useFormContext as y } from "react-hook-form";
5
+ import { QuestionItems as C } from "sdc-qrf";
6
+ import { ItemHelpText as S } from "../../components/BaseQuestionnaireResponseForm/ItemHelpText.js";
7
+ import { Title as T } from "../../components/Typography.js";
8
+ import { useGroupSiblingAccordion as P } from "./accordionContext.js";
9
+ import { AccordionSection as R } from "./AccordionSection/index.js";
10
+ import { ChildGroupAccordionProvider as q } from "./ChildGroupAccordionProvider.js";
11
+ import { GroupContext as A } from "./context.js";
12
+ import { GridGroup as F } from "./GridGroup/index.js";
13
+ import h from "./group.module.scss.js";
14
+ import { GroupCard as x } from "./GroupCard/index.js";
15
+ import { GTable as O } from "./GTable/index.js";
16
+ import { RepeatableGroups as g } from "./RepeatableGroups/index.js";
17
+ import { S as f } from "./styles.js";
18
+ import { RepeatableGroupRow as j } from "./RepeatableGroups/RepeatableGroupRow.js";
19
+ function G(t) {
15
20
  const {
16
- parentPath: d,
17
- questionItem: f,
18
- context: s,
21
+ parentPath: m,
22
+ questionItem: l,
23
+ context: u,
19
24
  type: e = "col"
20
- } = r, {
21
- linkId: h,
22
- item: m,
23
- repeats: G,
24
- text: n,
25
- helpText: i,
26
- hidden: x
27
- } = f;
28
- if (x)
29
- return null;
30
- const b = () => e === "gtable" ? /* @__PURE__ */ t(T, { groupItem: r }) : e === "row" ? /* @__PURE__ */ t(l, { groupItem: r, renderGroup: (I) => /* @__PURE__ */ t(P, { ...I }) }) : /* @__PURE__ */ t(l, { groupItem: r });
25
+ } = t, {
26
+ linkId: p,
27
+ item: c,
28
+ repeats: d,
29
+ text: o,
30
+ helpText: i
31
+ } = l, a = () => e === "gtable" ? /* @__PURE__ */ r(O, { groupItem: t }) : e === "row" ? /* @__PURE__ */ r(g, { groupItem: t, renderGroup: (I) => /* @__PURE__ */ r(j, { ...I }) }) : /* @__PURE__ */ r(g, { groupItem: t });
31
32
  if (e === "grid")
32
- return /* @__PURE__ */ t(S, { groupItem: r });
33
- if (G)
34
- return /* @__PURE__ */ t(R.Provider, { value: {
33
+ return /* @__PURE__ */ r(F, { groupItem: t });
34
+ if (d)
35
+ return /* @__PURE__ */ r(A.Provider, { value: {
35
36
  type: e
36
- }, children: b() });
37
+ }, children: a() });
37
38
  const v = e === "section" || e === "section-with-divider";
38
- return /* @__PURE__ */ c(u.Group, { children: [
39
- n || i ? /* @__PURE__ */ t(u.Header, { $type: e, children: /* @__PURE__ */ c(u.Title, { children: [
40
- n && /* @__PURE__ */ t(C, { level: v ? 4 : 5, children: n }),
41
- i && /* @__PURE__ */ t(y, { helpText: i })
39
+ return /* @__PURE__ */ s(f.Group, { children: [
40
+ o || i ? /* @__PURE__ */ r(f.Header, { $type: e, children: /* @__PURE__ */ s(f.Title, { children: [
41
+ o && /* @__PURE__ */ r(T, { level: v ? 4 : 5, children: o }),
42
+ i && /* @__PURE__ */ r(S, { helpText: i })
42
43
  ] }) }) : null,
43
- m && /* @__PURE__ */ t("div", { className: g({
44
- [p.row]: e === "row",
45
- [p.col]: !e || e === "col"
46
- }), children: /* @__PURE__ */ t(w, { questionItems: m, parentPath: [...d, h, "items"], context: s[0] }) })
44
+ c && /* @__PURE__ */ r("div", { className: b({
45
+ [h.row]: e === "row",
46
+ [h.col]: !e || e === "col"
47
+ }), children: /* @__PURE__ */ r(q, { item: c, children: /* @__PURE__ */ r(C, { questionItems: c, parentPath: [...m, p, "items"], context: u[0] }) }) })
47
48
  ] });
48
49
  }
49
- function B(r) {
50
- return /* @__PURE__ */ t(o, { ...r });
50
+ function n(t) {
51
+ var i;
52
+ const {
53
+ parentPath: m,
54
+ questionItem: l
55
+ } = t, {
56
+ linkId: u,
57
+ text: e,
58
+ repeats: p,
59
+ hidden: c
60
+ } = l, {
61
+ getValues: d
62
+ } = y(), o = P(u);
63
+ if (c)
64
+ return null;
65
+ if (o) {
66
+ const a = p ? ((i = w.get(d(), [...m, u, "items"])) == null ? void 0 : i.length) ?? 0 : void 0;
67
+ return /* @__PURE__ */ r(R, { linkId: u, title: e, count: a, isOpen: o.isOpen, onToggle: o.onToggle, children: o.isOpen ? /* @__PURE__ */ r(G, { ...t }) : null });
68
+ }
69
+ return /* @__PURE__ */ r(G, { ...t });
70
+ }
71
+ function Y(t) {
72
+ return /* @__PURE__ */ r(n, { ...t });
51
73
  }
52
- function E(r) {
53
- return /* @__PURE__ */ t(o, { ...r, type: "col" });
74
+ function Z(t) {
75
+ return /* @__PURE__ */ r(n, { ...t, type: "col" });
54
76
  }
55
- function J(r) {
56
- return /* @__PURE__ */ t(o, { ...r, type: "row" });
77
+ function tt(t) {
78
+ return /* @__PURE__ */ r(n, { ...t, type: "row" });
57
79
  }
58
- function K(r) {
59
- return /* @__PURE__ */ t(o, { ...r, type: "gtable" });
80
+ function rt(t) {
81
+ return /* @__PURE__ */ r(n, { ...t, type: "gtable" });
60
82
  }
61
- function L(r) {
62
- return /* @__PURE__ */ t(o, { ...r, type: "grid" });
83
+ function et(t) {
84
+ return /* @__PURE__ */ r(n, { ...t, type: "grid" });
63
85
  }
64
- function O(r) {
65
- return /* @__PURE__ */ t(o, { ...r, type: "section" });
86
+ function ot(t) {
87
+ return /* @__PURE__ */ r(n, { ...t, type: "section" });
66
88
  }
67
- function U(r) {
68
- return /* @__PURE__ */ t(o, { ...r, type: "section-with-divider" });
89
+ function nt(t) {
90
+ return /* @__PURE__ */ r(n, { ...t, type: "section-with-divider" });
69
91
  }
70
- function V(r) {
71
- return /* @__PURE__ */ t(a, { ...r, variant: "main-card" });
92
+ function it(t) {
93
+ return /* @__PURE__ */ r(x, { ...t, variant: "main-card" });
72
94
  }
73
- function X(r) {
74
- return /* @__PURE__ */ t(a, { ...r, variant: "sub-card" });
95
+ function ut(t) {
96
+ return /* @__PURE__ */ r(x, { ...t, variant: "sub-card" });
75
97
  }
76
98
  export {
77
- E as Col,
78
- L as Grid,
79
- B as Group,
80
- K as Gtable,
81
- V as MainCard,
82
- J as Row,
83
- O as Section,
84
- U as SectionWithDivider,
85
- X as SubCard
99
+ Z as Col,
100
+ et as Grid,
101
+ Y as Group,
102
+ rt as Gtable,
103
+ it as MainCard,
104
+ tt as Row,
105
+ ot as Section,
106
+ nt as SectionWithDivider,
107
+ ut as SubCard
86
108
  };
@@ -6,5 +6,5 @@ export declare const QUESTIONNAIRE: Questionnaire;
6
6
  export declare const QUESTIONNAIRE_RESPONSE: QuestionnaireResponse;
7
7
  export declare const CONTEXT: ItemContext[];
8
8
  export declare const WithGroupWizardProviderDecorator: Decorator;
9
- export declare function testScrollTo(qi: FCEQuestionnaireItem): import('@storybook/core/csf').PlayFunction<import('@storybook/react').ReactRenderer, {}>;
9
+ export declare function testScrollTo(qi: FCEQuestionnaireItem): import('storybook/internal/csf').PlayFunction<import('@storybook/react').ReactRenderer, {}>;
10
10
  //# sourceMappingURL=GroupWizard.stories.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GroupWizard.stories.utils.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/GroupWizard.stories.utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAa,WAAW,EAAqC,MAAM,SAAS,CAAC;AAW1G,eAAO,MAAM,WAAW,EAAE,oBAqEzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAI3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAGpC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAAW,EAMhC,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,SAsB9C,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,EAAE,oBAAoB,4FAkBpD"}
1
+ {"version":3,"file":"GroupWizard.stories.utils.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/GroupWizard.stories.utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAa,WAAW,EAAqC,MAAM,SAAS,CAAC;AAY1G,eAAO,MAAM,WAAW,EAAE,oBAqEzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAI3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAGpC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAAW,EAMhC,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,SAsB9C,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,EAAE,oBAAoB,+FAkBpD"}
@@ -4,16 +4,61 @@ export interface GroupWizardProps extends GroupItemProps {
4
4
  wizard?: Partial<WizardProps>;
5
5
  }
6
6
  export declare const GroupWizardBus: {
7
- useBus: (type: "scrollTo", callback: (e: {
7
+ useBus: (type: "scrollTo" | "expandGroup" | "addItem" | "openNextItem" | "openPreviousItem" | "removeItem", callback: (e: {
8
8
  type: "scrollTo";
9
9
  groupLinkId: string;
10
+ } | {
11
+ type: "expandGroup";
12
+ groupLinkId: string;
13
+ } | {
14
+ type: "addItem";
15
+ groupLinkId: string;
16
+ } | {
17
+ type: "openNextItem";
18
+ groupLinkId: string;
19
+ } | {
20
+ type: "openPreviousItem";
21
+ groupLinkId: string;
22
+ } | {
23
+ type: "removeItem";
24
+ groupLinkId: string;
10
25
  }) => void, deps: Array<any>) => (action: {
11
26
  type: "scrollTo";
12
27
  groupLinkId: string;
28
+ } | {
29
+ type: "expandGroup";
30
+ groupLinkId: string;
31
+ } | {
32
+ type: "addItem";
33
+ groupLinkId: string;
34
+ } | {
35
+ type: "openNextItem";
36
+ groupLinkId: string;
37
+ } | {
38
+ type: "openPreviousItem";
39
+ groupLinkId: string;
40
+ } | {
41
+ type: "removeItem";
42
+ groupLinkId: string;
13
43
  }) => void;
14
44
  dispatch: (action: {
15
45
  type: "scrollTo";
16
46
  groupLinkId: string;
47
+ } | {
48
+ type: "expandGroup";
49
+ groupLinkId: string;
50
+ } | {
51
+ type: "addItem";
52
+ groupLinkId: string;
53
+ } | {
54
+ type: "openNextItem";
55
+ groupLinkId: string;
56
+ } | {
57
+ type: "openPreviousItem";
58
+ groupLinkId: string;
59
+ } | {
60
+ type: "removeItem";
61
+ groupLinkId: string;
17
62
  }) => void;
18
63
  };
19
64
  export declare function GroupWizardVertical(props: GroupWizardProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACH,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,WAAW,EAGd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKxE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,cAAc;;cACjB,UAAU;qBACH,MAAM;;cADb,UAAU;qBACH,MAAM;;;cADb,UAAU;qBACH,MAAM;;CACnB,CAAC;AAEL,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,2CAU1D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,2CAS9D;AAED,MAAM,WAAW,UAAU;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,yBAAyB,EAAE,MAAM,CAAC;CACrC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAkJlD;AAED,eAAO,MAAM,aAAa,GACtB,WAAW,oBAAoB,EAC/B,YAAY,MAAM,EAAE,EACpB,YAAY,SAAS,EACrB,SAAS,WAAW,KACrB,UAeF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACH,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,WAAW,EAGd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKxE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,cAAc;;cAEX,UAAU;qBACH,MAAM;;cAQb,aAAa;qBACN,MAAM;;cAKb,SAAS;qBACF,MAAM;;cAIb,cAAc;qBACP,MAAM;;cAGb,kBAAkB;qBACX,MAAM;;cAKb,YAAY;qBACL,MAAM;;cA/Bb,UAAU;qBACH,MAAM;;cAQb,aAAa;qBACN,MAAM;;cAKb,SAAS;qBACF,MAAM;;cAIb,cAAc;qBACP,MAAM;;cAGb,kBAAkB;qBACX,MAAM;;cAKb,YAAY;qBACL,MAAM;;;cA/Bb,UAAU;qBACH,MAAM;;cAQb,aAAa;qBACN,MAAM;;cAKb,SAAS;qBACF,MAAM;;cAIb,cAAc;qBACP,MAAM;;cAGb,kBAAkB;qBACX,MAAM;;cAKb,YAAY;qBACL,MAAM;;CAE1B,CAAC;AAEJ,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,2CAU1D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,2CAS9D;AAED,MAAM,WAAW,UAAU;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,yBAAyB,EAAE,MAAM,CAAC;CACrC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAkJlD;AAED,eAAO,MAAM,aAAa,GACtB,WAAW,oBAAoB,EAC/B,YAAY,MAAM,EAAE,EACpB,YAAY,SAAS,EACrB,SAAS,WAAW,KACrB,UAeF,CAAC"}
@@ -26,10 +26,13 @@ import "@lingui/react";
26
26
  import "sdc-qrf";
27
27
  import "./Group/GridGroup/Grid.styles.js";
28
28
  import "@lingui/core";
29
+ import { GroupWizard as m, GroupWizardWithTooltips as w, GroupWizardVertical as G } from "./GroupWizard/index.js";
30
+ import "./Group/accordionContext.js";
29
31
  import "./Group/GroupCard/styles.js";
32
+ import "./Group/AccordionSection/styles.js";
30
33
  import "./Group/RepeatableGroups/styles.js";
31
34
  import "./Group/GTable/GTable.styles.js";
32
- import { GroupTable as w } from "./GroupTable/index.js";
35
+ import { GroupTable as I } from "./GroupTable/index.js";
33
36
  import "recharts";
34
37
  import "styled-components";
35
38
  import "./GroupTable/GroupTableChart/Tooltip/styles.js";
@@ -45,7 +48,6 @@ import "../utils/yup-locale.js";
45
48
  import "antd/es/layout/layout";
46
49
  import "antd/es/layout/Sider";
47
50
  import "../components/Wizard/styles.js";
48
- import { GroupWizard as m, GroupWizardWithTooltips as G, GroupWizardVertical as I } from "./GroupWizard/index.js";
49
51
  import "../readonly-controls/GroupWizard/styles.js";
50
52
  import "react-markdown";
51
53
  import "rehype-raw";
@@ -77,7 +79,7 @@ import { QuestionText as B, QuestionString as E, QuestionEmail as M } from "./St
77
79
  import { TextWithMacroFill as q } from "./TextWithMacroFill/index.js";
78
80
  import { TimeRangePickerControl as F } from "./TimeRangePickerControl/index.js";
79
81
  import { UploadFileControl as U } from "./UploadFileControl/index.js";
80
- const lr = {
82
+ const fr = {
81
83
  text: B,
82
84
  string: E,
83
85
  decimal: R,
@@ -92,7 +94,7 @@ const lr = {
92
94
  reference: T,
93
95
  quantity: D,
94
96
  attachment: U
95
- }, cr = l, fr = {
97
+ }, br = l, gr = {
96
98
  phoneWidget: v,
97
99
  email: M,
98
100
  passwordWidget: k,
@@ -109,7 +111,7 @@ const lr = {
109
111
  barcode: n,
110
112
  // reference-radio-button is deprecated, use inline-reference instead
111
113
  "reference-radio-button": e
112
- }, br = {
114
+ }, Qr = {
113
115
  col: c,
114
116
  row: f,
115
117
  gtable: t,
@@ -122,16 +124,16 @@ const lr = {
122
124
  "blood-pressure": a,
123
125
  "time-range-picker": F,
124
126
  wizard: m,
125
- "wizard-with-tooltips": G,
127
+ "wizard-with-tooltips": w,
126
128
  "wizard-navigation-group": m,
127
- "wizard-vertical": I,
129
+ "wizard-vertical": G,
128
130
  "group-tabs": x,
129
- "group-table": w,
131
+ "group-table": I,
130
132
  "editable-group": u
131
133
  };
132
134
  export {
133
- cr as groupItemComponent,
134
- br as itemControlGroupItemComponents,
135
- fr as itemControlQuestionItemComponents,
136
- lr as questionItemComponents
135
+ br as groupItemComponent,
136
+ Qr as itemControlGroupItemComponents,
137
+ gr as itemControlQuestionItemComponents,
138
+ fr as questionItemComponents
137
139
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .ant-dropdown .ant-table-filter-dropdown{border:0;background:none;box-shadow:none;position:relative;overflow:visible}._row_dy31e_1{display:flex}._inputWrapper_dy31e_5{flex:auto}._splitterWrapper_dy31e_9{display:flex;flex-direction:column;justify-content:flex-end}._splitter_dy31e_9{position:relative;bottom:22px;margin:0 8px;font-weight:400;font-size:20px;line-height:22px}._form_1v4sy_1 .ant-form-item-label{font-weight:700}._form_1v4sy_1 .ant-form-item-row{flex:1;flex-direction:column;justify-content:space-between;gap:12px}._form_1v4sy_1 .ant-form-item-label{text-align:start;white-space:normal}._form_1v4sy_1 .ant-form-item-label label{display:flex;height:auto}._form_1v4sy_1 .ant-form-item-label label:after{display:none}._form_1v4sy_1 .ant-form-item-control{flex-grow:0}._content_1v4sy_25{display:flex;flex-direction:column;gap:24px}._field_1v4sy_31{width:100%;margin-bottom:0;display:flex}._field_1v4sy_31.__hidden_1v4sy_36{display:none}._group_1ndd9_1{display:flex;flex-direction:column;gap:16px;width:100%}._groupTitle_1ndd9_8{font-weight:700;font-size:16px;line-height:24px}._row_1ndd9_14{display:flex;flex-direction:row;justify-content:space-between;gap:16px;width:100%}._col_1ndd9_22{display:flex;flex-direction:column;gap:16px}._inputContainer_gs0vq_1{display:flex;flex-direction:column}._inputHeader_gs0vq_6{display:flex;margin-bottom:12px;align-items:center;justify-content:space-between}._label_gs0vq_13{font-weight:700;font-size:14px;line-height:22px}._column_14bfg_1{display:flex;flex-direction:column}._row_14bfg_6{display:flex;flex-direction:row;justify-content:space-between;align-items:center}._questionText_14bfg_13{font-weight:700;margin:0}._answer_14bfg_18{display:block;min-width:40%;max-width:40%}
1
+ .ant-dropdown .ant-table-filter-dropdown{border:0;background:none;box-shadow:none;position:relative;overflow:visible}._row_dy31e_1{display:flex}._inputWrapper_dy31e_5{flex:auto}._splitterWrapper_dy31e_9{display:flex;flex-direction:column;justify-content:flex-end}._splitter_dy31e_9{position:relative;bottom:22px;margin:0 8px;font-weight:400;font-size:20px;line-height:22px}._group_1ndd9_1{display:flex;flex-direction:column;gap:16px;width:100%}._groupTitle_1ndd9_8{font-weight:700;font-size:16px;line-height:24px}._row_1ndd9_14{display:flex;flex-direction:row;justify-content:space-between;gap:16px;width:100%}._col_1ndd9_22{display:flex;flex-direction:column;gap:16px}._form_1v4sy_1 .ant-form-item-label{font-weight:700}._form_1v4sy_1 .ant-form-item-row{flex:1;flex-direction:column;justify-content:space-between;gap:12px}._form_1v4sy_1 .ant-form-item-label{text-align:start;white-space:normal}._form_1v4sy_1 .ant-form-item-label label{display:flex;height:auto}._form_1v4sy_1 .ant-form-item-label label:after{display:none}._form_1v4sy_1 .ant-form-item-control{flex-grow:0}._content_1v4sy_25{display:flex;flex-direction:column;gap:24px}._field_1v4sy_31{width:100%;margin-bottom:0;display:flex}._field_1v4sy_31.__hidden_1v4sy_36{display:none}._inputContainer_gs0vq_1{display:flex;flex-direction:column}._inputHeader_gs0vq_6{display:flex;margin-bottom:12px;align-items:center;justify-content:space-between}._label_gs0vq_13{font-weight:700;font-size:14px;line-height:22px}._column_14bfg_1{display:flex;flex-direction:column}._row_14bfg_6{display:flex;flex-direction:row;justify-content:space-between;align-items:center}._questionText_14bfg_13{font-weight:700;margin:0}._answer_14bfg_18{display:block;min-width:40%;max-width:40%}