@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
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ interface Props {
3
+ linkId: string;
4
+ title?: ReactNode;
5
+ count?: number;
6
+ isOpen: boolean;
7
+ onToggle: () => void;
8
+ children?: ReactNode;
9
+ }
10
+ export declare function AccordionSection(props: Props): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/AccordionSection/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlC,UAAU,KAAK;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,2CA4B5C"}
@@ -0,0 +1,33 @@
1
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
+ import { CaretDownOutlined as p } from "@ant-design/icons";
3
+ import { Title as s } from "../../../components/Typography.js";
4
+ import { S as e } from "./styles.js";
5
+ function g(a) {
6
+ const {
7
+ linkId: i,
8
+ title: m,
9
+ count: r,
10
+ isOpen: l,
11
+ onToggle: c,
12
+ children: d
13
+ } = a;
14
+ return /* @__PURE__ */ n(e.Section, { "data-testid": `accordion-section-${i}`, children: [
15
+ /* @__PURE__ */ n(e.Header, { role: "button", tabIndex: 0, onClick: c, onKeyDown: (o) => {
16
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), c());
17
+ }, "data-testid": `accordion-toggle-${i}`, children: [
18
+ /* @__PURE__ */ t(e.Caret, { $isOpen: l, children: /* @__PURE__ */ t(p, {}) }),
19
+ /* @__PURE__ */ n(e.Title, { children: [
20
+ /* @__PURE__ */ t(s, { level: 4, children: m }),
21
+ typeof r == "number" && /* @__PURE__ */ n(e.Count, { children: [
22
+ "(",
23
+ r,
24
+ ")"
25
+ ] })
26
+ ] })
27
+ ] }),
28
+ l && d ? /* @__PURE__ */ t(e.Content, { children: d }) : null
29
+ ] });
30
+ }
31
+ export {
32
+ g as AccordionSection
33
+ };
@@ -0,0 +1,13 @@
1
+ export declare const S: {
2
+ Section: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
3
+ Header: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
4
+ Caret: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$isOpen"> & {
5
+ $isOpen: boolean;
6
+ }, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$isOpen"> & {
7
+ $isOpen: boolean;
8
+ }, never>>> & string;
9
+ Title: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
10
+ Count: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
11
+ Content: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
12
+ };
13
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/AccordionSection/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC;;;;iBAkBoB,OAAO;;iBAAP,OAAO;;;;;CAqBxC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import e from "styled-components";
2
+ const n = {
3
+ Section: e.div.withConfig({
4
+ displayName: "AccordionSection__Section",
5
+ componentId: "sc-ocaqz7-0"
6
+ })(["display:flex;flex-direction:column;width:100%;border:1px solid ", ";border-radius:6px;overflow:hidden;"], ({
7
+ theme: o
8
+ }) => o.neutral.dividers),
9
+ Header: e.div.withConfig({
10
+ displayName: "AccordionSection__Header",
11
+ componentId: "sc-ocaqz7-1"
12
+ })(["display:flex;align-items:center;gap:12px;padding:16px 24px;background-color:", ";cursor:pointer;user-select:none;"], ({
13
+ theme: o
14
+ }) => o.neutralPalette.gray_3),
15
+ Caret: e.span.withConfig({
16
+ displayName: "AccordionSection__Caret",
17
+ componentId: "sc-ocaqz7-2"
18
+ })(["display:inline-flex;align-items:center;transform:rotate(", "deg);transition:transform 0.2s ease;"], ({
19
+ $isOpen: o
20
+ }) => o ? 0 : 180),
21
+ Title: e.div.withConfig({
22
+ displayName: "AccordionSection__Title",
23
+ componentId: "sc-ocaqz7-3"
24
+ })(["flex:1;display:flex;align-items:baseline;gap:8px;"]),
25
+ Count: e.span.withConfig({
26
+ displayName: "AccordionSection__Count",
27
+ componentId: "sc-ocaqz7-4"
28
+ })(["color:", ";"], ({
29
+ theme: o
30
+ }) => o.neutral.secondaryText),
31
+ Content: e.div.withConfig({
32
+ displayName: "AccordionSection__Content",
33
+ componentId: "sc-ocaqz7-5"
34
+ })(["display:flex;flex-direction:column;gap:24px;padding:24px;"])
35
+ };
36
+ export {
37
+ n as S
38
+ };
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { FCEQuestionnaireItem } from 'sdc-qrf';
3
+ interface Props {
4
+ item: FCEQuestionnaireItem[] | undefined;
5
+ children: ReactNode;
6
+ }
7
+ export declare function ChildGroupAccordionProvider(props: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=ChildGroupAccordionProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChildGroupAccordionProvider.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/ChildGroupAccordionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAc/C,UAAU,KAAK;IACX,IAAI,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAC;IACzC,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,KAAK,2CAiDvD"}
@@ -0,0 +1,24 @@
1
+ import { jsx as r, Fragment as p } from "react/jsx-runtime";
2
+ import { useState as f } from "react";
3
+ import { GroupWizardBus as g } from "../GroupWizard/index.js";
4
+ import { getAccordionSiblingCandidates as l, qualifiesForAccordion as m, findCandidateContaining as a, GroupAccordionModeContext as C, GroupSiblingAccordionContext as v, getPendingExpandTarget as x, setPendingExpandTarget as A } from "./accordionContext.js";
5
+ function I(c) {
6
+ const {
7
+ item: u,
8
+ children: t
9
+ } = c, n = l(u), i = m(n), [s, o] = f(() => i ? (a(n, x() ?? "") ?? n[0]).linkId : "");
10
+ return g.useBus("expandGroup", ({
11
+ groupLinkId: e
12
+ }) => {
13
+ if (!i)
14
+ return;
15
+ const d = a(n, e);
16
+ d && (A(e), o(d.linkId));
17
+ }, [n, i]), i ? /* @__PURE__ */ r(C.Provider, { value: !0, children: /* @__PURE__ */ r(v.Provider, { value: {
18
+ activeLinkId: s,
19
+ setActiveLinkId: o
20
+ }, children: t }) }) : /* @__PURE__ */ r(p, { children: t });
21
+ }
22
+ export {
23
+ I as ChildGroupAccordionProvider
24
+ };
@@ -0,0 +1,8 @@
1
+ import { Questionnaire, QuestionnaireResponse } from 'fhir/r4b';
2
+ import { FCEQuestionnaireItem, ItemContext } from 'sdc-qrf';
3
+ export declare const GOAL_SETTING_ITEM: FCEQuestionnaireItem;
4
+ export declare const PLAN_GOALSTASKS_TAB_ITEM: FCEQuestionnaireItem;
5
+ export declare const QUESTIONNAIRE: Questionnaire;
6
+ export declare const QUESTIONNAIRE_RESPONSE: QuestionnaireResponse;
7
+ export declare const CONTEXT: ItemContext[];
8
+ //# sourceMappingURL=GoalsAndTasksAccordion.fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoalsAndTasksAccordion.fixtures.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/GoalsAndTasksAccordion.fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAS5D,eAAO,MAAM,iBAAiB,EAAE,oBAoB/B,CAAC;AA0EF,eAAO,MAAM,wBAAwB,EAAE,oBAKtC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAI3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAwFpC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAAW,EAMhC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Decorator } from '@storybook/react';
2
+ import { Questionnaire, QuestionnaireResponse } from 'fhir/r4b';
3
+ import { FCEQuestionnaireItem, ItemContext } from 'sdc-qrf';
4
+ export declare const ROOT_ITEM: FCEQuestionnaireItem;
5
+ export declare const QUESTIONNAIRE: Questionnaire;
6
+ export declare const QUESTIONNAIRE_RESPONSE: QuestionnaireResponse;
7
+ export declare const CONTEXT: ItemContext[];
8
+ export declare const WithGroupAccordionProviderDecorator: Decorator;
9
+ export declare function testExpandSibling(): import('storybook/internal/csf').PlayFunction<import('@storybook/react').ReactRenderer, {}>;
10
+ export declare function testExpandCascadesThroughCollapsedAncestors(): import('storybook/internal/csf').PlayFunction<import('@storybook/react').ReactRenderer, {}>;
11
+ //# sourceMappingURL=GroupAccordionExpandBus.stories.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupAccordionExpandBus.stories.utils.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/GroupAccordionExpandBus.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,EACH,oBAAoB,EAEpB,WAAW,EAGd,MAAM,SAAS,CAAC;AAiBjB,eAAO,MAAM,SAAS,EAAE,oBAmCvB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAI3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBA2BpC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAAW,EAMhC,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,SAuBjD,CAAC;AAEF,wBAAgB,iBAAiB,gGAkBhC;AAED,wBAAgB,2CAA2C,gGAoB1D"}
@@ -9,6 +9,9 @@ interface CardProps {
9
9
  title?: React.ReactNode;
10
10
  onRemove?: () => void;
11
11
  readOnly?: boolean;
12
+ isOpen?: boolean;
13
+ onToggle?: () => void;
14
+ highlightActive?: boolean;
12
15
  }
13
16
  export declare function GroupMainCard(props: CardProps): import("react/jsx-runtime").JSX.Element;
14
17
  export declare function GroupSubCard(props: CardProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/GroupCard/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAQxD,UAAU,cAAe,SAAQ,cAAc;IAC3C,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACtC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,kDAwC9C;AAED,UAAU,SAAS;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,2CA4B7C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,2CAgB5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/GroupCard/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAWxD,UAAU,cAAe,SAAQ,cAAc;IAC3C,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACtC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,kDAkE9C;AAED,UAAU,SAAS;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AA6BD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,2CA0C7C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,2CA4B5C"}
@@ -1,61 +1,93 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { Trans as G } from "@lingui/react";
3
- import { i18n as p } from "@lingui/core";
4
- import { DeleteOutlined as s } from "@ant-design/icons";
5
- import { Button as f } from "antd";
6
- import { QuestionItems as R } from "sdc-qrf";
1
+ import { jsx as e, jsxs as $ } from "react/jsx-runtime";
2
+ import { Trans as R } from "@lingui/react";
3
+ import { i18n as b } from "@lingui/core";
4
+ import { DeleteOutlined as O, CaretDownOutlined as y } from "@ant-design/icons";
5
+ import { Button as x } from "antd";
6
+ import A from "lodash";
7
+ import { useFormContext as I } from "react-hook-form";
8
+ import { QuestionItems as k } from "sdc-qrf";
7
9
  import { Title as v } from "../../../components/Typography.js";
8
- import { S as d } from "./styles.js";
9
- import { RepeatableGroups as c } from "../RepeatableGroups/index.js";
10
- import { RepeatableGroupCard as x } from "../RepeatableGroups/RepeatableGroupCard/index.js";
11
- function _(e) {
10
+ import { S as m } from "./styles.js";
11
+ import { useGroupSiblingAccordion as E } from "../accordionContext.js";
12
+ import { AccordionSection as D } from "../AccordionSection/index.js";
13
+ import { ChildGroupAccordionProvider as S } from "../ChildGroupAccordionProvider.js";
14
+ import { RepeatableGroups as C } from "../RepeatableGroups/index.js";
15
+ import { RepeatableGroupCard as q } from "../RepeatableGroups/RepeatableGroupCard/index.js";
16
+ function W(i) {
17
+ var g;
12
18
  const {
13
- parentPath: i,
14
- questionItem: o,
15
- context: a,
19
+ parentPath: r,
20
+ questionItem: c,
21
+ context: u,
16
22
  variant: n = "main-card"
17
- } = e, {
18
- linkId: r,
19
- item: l,
20
- repeats: h,
21
- text: m,
22
- hidden: C
23
- } = o;
24
- if (C)
23
+ } = i, {
24
+ linkId: t,
25
+ item: o,
26
+ repeats: a,
27
+ text: l,
28
+ hidden: d
29
+ } = c, {
30
+ getValues: T
31
+ } = I(), s = E(t);
32
+ if (d)
25
33
  return null;
26
- const u = () => l && /* @__PURE__ */ t(R, { questionItems: l, parentPath: [...i, r, "items"], context: a[0] });
27
- return h ? n === "sub-card" ? /* @__PURE__ */ t(c, { groupItem: e, renderGroup: (b) => /* @__PURE__ */ t(x, { ...b, variant: "sub-card" }) }) : /* @__PURE__ */ t(c, { groupItem: e }) : n === "sub-card" ? /* @__PURE__ */ t(O, { title: m, children: u() }) : /* @__PURE__ */ t(I, { title: m, children: u() });
34
+ const h = () => o && /* @__PURE__ */ e(S, { item: o, children: /* @__PURE__ */ e(k, { questionItems: o, parentPath: [...r, t, "items"], context: u[0] }) }), f = () => a ? n === "sub-card" ? /* @__PURE__ */ e(C, { groupItem: i, renderGroup: (p) => /* @__PURE__ */ e(q, { ...p, variant: "sub-card" }) }) : /* @__PURE__ */ e(C, { groupItem: i }) : n === "sub-card" ? /* @__PURE__ */ e(_, { title: l, children: h() }) : /* @__PURE__ */ e(P, { title: l, children: h() });
35
+ if (s) {
36
+ const p = a ? ((g = A.get(T(), [...r, t, "items"])) == null ? void 0 : g.length) ?? 0 : void 0;
37
+ return /* @__PURE__ */ e(D, { linkId: t, title: l, count: p, isOpen: s.isOpen, onToggle: s.onToggle, children: s.isOpen ? f() : null });
38
+ }
39
+ return f();
28
40
  }
29
- function I(e) {
41
+ function G(i) {
30
42
  const {
31
- title: i = p._(
43
+ title: r,
44
+ level: c,
45
+ isOpen: u,
46
+ onToggle: n
47
+ } = i;
48
+ return n ? /* @__PURE__ */ $(m.CollapsibleTitle, { role: "button", tabIndex: 0, onClick: n, onKeyDown: (t) => {
49
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), n());
50
+ }, children: [
51
+ /* @__PURE__ */ e(m.Caret, { $isOpen: !!u, children: /* @__PURE__ */ e(y, {}) }),
52
+ /* @__PURE__ */ e(v, { level: c, children: r })
53
+ ] }) : /* @__PURE__ */ e(v, { level: c, children: r });
54
+ }
55
+ function P(i) {
56
+ const {
57
+ title: r = b._(
32
58
  /*i18n*/
33
59
  {
34
60
  id: "L8fEEm"
35
61
  }
36
62
  ),
37
- children: o,
38
- readOnly: a,
39
- onRemove: n
40
- } = e, r = a ? void 0 : n;
41
- return /* @__PURE__ */ t(d.Card, { title: /* @__PURE__ */ t(v, { level: 4, children: i }), $variant: "main-card", extra: r ? /* @__PURE__ */ t(f, { type: "default", onClick: r, size: "middle", icon: /* @__PURE__ */ t(s, {}), "data-testid": "remove-group-button", children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(G, { id: "t/YqKh" }) }) }) : null, children: /* @__PURE__ */ t(d.GroupContent, { children: o }) });
63
+ children: c,
64
+ readOnly: u,
65
+ onRemove: n,
66
+ isOpen: t,
67
+ onToggle: o,
68
+ highlightActive: a = !0
69
+ } = i, l = u ? void 0 : n, d = !!o;
70
+ return /* @__PURE__ */ e(m.Card, { title: /* @__PURE__ */ e(G, { title: r, level: 4, isOpen: t, onToggle: o }), $variant: "main-card", $collapsible: d, $isOpen: !!t, $highlightActive: a, extra: l ? /* @__PURE__ */ e(x, { type: "default", onClick: l, size: "middle", icon: /* @__PURE__ */ e(O, {}), "data-testid": "remove-group-button", children: d ? null : /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(R, { id: "t/YqKh" }) }) }) : null, children: d && !t ? null : /* @__PURE__ */ e(m.GroupContent, { children: c }) });
42
71
  }
43
- function O(e) {
72
+ function _(i) {
44
73
  const {
45
- title: i = p._(
74
+ title: r = b._(
46
75
  /*i18n*/
47
76
  {
48
77
  id: "L8fEEm"
49
78
  }
50
79
  ),
51
- children: o,
52
- readOnly: a,
53
- onRemove: n
54
- } = e, r = a ? void 0 : n;
55
- return /* @__PURE__ */ t(d.Card, { title: /* @__PURE__ */ t(v, { level: 5, children: i }), $variant: "sub-card", extra: r ? /* @__PURE__ */ t(f, { icon: /* @__PURE__ */ t(s, {}), type: "default", onClick: r, size: "middle" }) : null, children: /* @__PURE__ */ t(d.GroupContent, { children: o }) });
80
+ children: c,
81
+ readOnly: u,
82
+ onRemove: n,
83
+ isOpen: t,
84
+ onToggle: o,
85
+ highlightActive: a = !0
86
+ } = i, l = u ? void 0 : n, d = !!o;
87
+ return /* @__PURE__ */ e(m.Card, { title: /* @__PURE__ */ e(G, { title: r, level: 5, isOpen: t, onToggle: o }), $variant: "sub-card", $collapsible: d, $isOpen: !!t, $highlightActive: a, extra: l ? /* @__PURE__ */ e(x, { icon: /* @__PURE__ */ e(O, {}), type: "default", onClick: l, size: "middle" }) : null, children: d && !t ? null : /* @__PURE__ */ e(m.GroupContent, { children: c }) });
56
88
  }
57
89
  export {
58
- _ as GroupCard,
59
- I as GroupMainCard,
60
- O as GroupSubCard
90
+ W as GroupCard,
91
+ P as GroupMainCard,
92
+ _ as GroupSubCard
61
93
  };
@@ -1,13 +1,25 @@
1
1
  export declare const S: {
2
2
  Card: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<Omit<import('antd').CardProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
3
3
  ref?: ((instance: HTMLDivElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLDivElement> | null | undefined;
4
- }, "$variant"> & {
4
+ }, "$isOpen" | "$variant" | "$collapsible" | "$highlightActive"> & {
5
5
  $variant: "main-card" | "sub-card";
6
+ $collapsible?: boolean;
7
+ $isOpen?: boolean;
8
+ $highlightActive?: boolean;
6
9
  }, never> & Partial<Pick<import('styled-components').FastOmit<Omit<import('antd').CardProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
7
10
  ref?: ((instance: HTMLDivElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLDivElement> | null | undefined;
8
- }, "$variant"> & {
11
+ }, "$isOpen" | "$variant" | "$collapsible" | "$highlightActive"> & {
9
12
  $variant: "main-card" | "sub-card";
13
+ $collapsible?: boolean;
14
+ $isOpen?: boolean;
15
+ $highlightActive?: boolean;
10
16
  }, never>>> & string & Omit<import('antd/es/card').CardInterface, keyof import('react').Component<any, {}, any>>;
17
+ CollapsibleTitle: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
18
+ Caret: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$isOpen"> & {
19
+ $isOpen: boolean;
20
+ }, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$isOpen"> & {
21
+ $isOpen: boolean;
22
+ }, never>>> & string;
11
23
  GroupContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
12
24
  };
13
25
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/GroupCard/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,CAAC;;;;kBACqB,WAAW,GAAG,UAAU;;;;kBAAxB,WAAW,GAAG,UAAU;;;CAmB1D,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/GroupCard/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,CAAC;;;;kBAEI,WAAW,GAAG,UAAU;uBACnB,OAAO;kBACZ,OAAO;2BACE,OAAO;;;;kBAHhB,WAAW,GAAG,UAAU;uBACnB,OAAO;kBACZ,OAAO;2BACE,OAAO;;;;iBAyCA,OAAO;;iBAAP,OAAO;;;CAYxC,CAAC"}
@@ -1,21 +1,41 @@
1
- import { Card as t } from "antd";
2
- import o, { css as d } from "styled-components";
3
- const c = {
4
- Card: o(t).withConfig({
1
+ import { Card as l } from "antd";
2
+ import r, { css as o } from "styled-components";
3
+ const s = {
4
+ Card: r(l).withConfig({
5
5
  displayName: "GroupCard__Card",
6
6
  componentId: "sc-hhnxba-0"
7
- })([".ant-card-head{background-color:", ";}", ""], ({
7
+ })([".ant-card-head{background-color:", ";}", " ", ""], ({
8
8
  theme: a
9
9
  }) => a.neutralPalette.gray_3, ({
10
10
  $variant: a
11
- }) => a === "sub-card" && d([".ant-card-head{background-color:", ";}"], ({
12
- theme: r
13
- }) => r.neutralPalette.gray_2)),
14
- GroupContent: o.div.withConfig({
15
- displayName: "GroupCard__GroupContent",
11
+ }) => a === "sub-card" && o([".ant-card-head{background-color:", ";}"], ({
12
+ theme: e
13
+ }) => e.neutralPalette.gray_2), ({
14
+ $collapsible: a,
15
+ $isOpen: e,
16
+ $highlightActive: i,
17
+ theme: t
18
+ }) => {
19
+ if (!a)
20
+ return null;
21
+ const n = e && i;
22
+ return o(["border-left:4px solid ", ";.ant-card-head{background-color:", ";}"], n ? t.primaryPalette.bcp_3 : "transparent", n ? t.primaryPalette.bcp_1 : t.neutralPalette.gray_2);
23
+ }),
24
+ CollapsibleTitle: r.div.withConfig({
25
+ displayName: "GroupCard__CollapsibleTitle",
16
26
  componentId: "sc-hhnxba-1"
27
+ })(["display:flex;align-items:center;gap:12px;cursor:pointer;user-select:none;"]),
28
+ Caret: r.span.withConfig({
29
+ displayName: "GroupCard__Caret",
30
+ componentId: "sc-hhnxba-2"
31
+ })(["display:inline-flex;align-items:center;transform:rotate(", "deg);transition:transform 0.2s ease;"], ({
32
+ $isOpen: a
33
+ }) => a ? 0 : 180),
34
+ GroupContent: r.div.withConfig({
35
+ displayName: "GroupCard__GroupContent",
36
+ componentId: "sc-hhnxba-3"
17
37
  })(["display:flex;flex-direction:column;gap:16px;width:100%;"])
18
38
  };
19
39
  export {
20
- c as S
40
+ s as S
21
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/controls/Group/RepeatableGroups/RepeatableGroupCard/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,UAAU,KAAM,SAAQ,oBAAoB;IACxC,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACtC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,2CAsB/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/controls/Group/RepeatableGroups/RepeatableGroupCard/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,UAAU,KAAM,SAAQ,oBAAoB;IACxC,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACtC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,2CAgD/C"}
@@ -1,31 +1,35 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { i18n as l } from "@lingui/core";
3
- import { QuestionItems as a } from "sdc-qrf";
4
- import { useRepeatableGroup as x } from "./hooks.js";
5
- import { GroupSubCard as I, GroupMainCard as b } from "../../GroupCard/index.js";
6
- function v(e) {
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { i18n as x } from "@lingui/core";
3
+ import { QuestionItems as b } from "sdc-qrf";
4
+ import { useRepeatableGroup as C } from "./hooks.js";
5
+ import { qualifiesForAccordion as G, getAccordionSiblingCandidates as v } from "../../accordionContext.js";
6
+ import { ChildGroupAccordionProvider as A } from "../../ChildGroupAccordionProvider.js";
7
+ import { GroupSubCard as I, GroupMainCard as q } from "../../GroupCard/index.js";
8
+ function F(r) {
7
9
  const {
8
10
  index: s,
9
11
  groupItem: p,
10
- variant: c
11
- } = e, {
12
- questionItem: d
12
+ variant: u,
13
+ isOpen: e,
14
+ onToggle: i
15
+ } = r, {
16
+ questionItem: l
13
17
  } = p, {
14
- item: o,
18
+ item: t,
15
19
  text: f,
16
- readOnly: r
17
- } = d, {
18
- onRemove: n,
19
- parentPath: i,
20
- context: m
21
- } = x(e), u = `${f || l._(
20
+ readOnly: n
21
+ } = l, {
22
+ onRemove: c,
23
+ parentPath: h,
24
+ context: g
25
+ } = C(r), m = `${f || x._(
22
26
  /*i18n*/
23
27
  {
24
28
  id: "HX5SVx"
25
29
  }
26
- )} ${s + 1}`;
27
- return c === "sub-card" ? /* @__PURE__ */ t(I, { title: u, onRemove: n, readOnly: r, children: /* @__PURE__ */ t(a, { questionItems: o, parentPath: i, context: m }) }) : /* @__PURE__ */ t(b, { title: u, onRemove: n, readOnly: r, children: /* @__PURE__ */ t(a, { questionItems: o, parentPath: i, context: m }) });
30
+ )} ${s + 1}`, a = !G(v(t)), d = /* @__PURE__ */ o(A, { item: t, children: /* @__PURE__ */ o(b, { questionItems: t, parentPath: h, context: g }) });
31
+ return u === "sub-card" ? /* @__PURE__ */ o(I, { title: m, onRemove: c, readOnly: n, isOpen: e, onToggle: i, highlightActive: a, children: d }) : /* @__PURE__ */ o(q, { title: m, onRemove: c, readOnly: n, isOpen: e, onToggle: i, highlightActive: a, children: d });
28
32
  }
29
33
  export {
30
- v as RepeatableGroupCard
34
+ F as RepeatableGroupCard
31
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/RepeatableGroups/index.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAyD,MAAM,SAAS,CAAC;AAIhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAEnD,UAAU,qBAAqB;IAC3B,SAAS,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAAC;IACzD,UAAU,CAAC,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;CACnD;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAiE5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/RepeatableGroups/index.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAyD,MAAM,SAAS,CAAC;AAMhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAEnD,UAAU,qBAAqB;IAC3B,SAAS,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAAC;IACzD,UAAU,CAAC,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;CACnD;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAoM5D"}