@tedi-design-system/react 18.1.0-rc.23 → 18.1.0-rc.25

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 (24) hide show
  1. package/bundle-stats.html +1 -1
  2. package/index.css +1 -1
  3. package/package.json +1 -1
  4. package/src/tedi/components/content/label/label.cjs.js +1 -1
  5. package/src/tedi/components/content/label/label.d.ts +4 -3
  6. package/src/tedi/components/content/label/label.es.js +24 -27
  7. package/src/tedi/components/content/label/label.module.scss.cjs.js +1 -1
  8. package/src/tedi/components/content/label/label.module.scss.es.js +2 -1
  9. package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
  10. package/src/tedi/components/form/checkbox/checkbox.es.js +64 -58
  11. package/src/tedi/components/form/choice-group/choice-group.cjs.js +1 -1
  12. package/src/tedi/components/form/choice-group/choice-group.es.js +98 -85
  13. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
  14. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +13 -14
  15. package/src/tedi/components/form/choice-input.types.d.ts +3 -2
  16. package/src/tedi/components/form/form-label/form-label.d.ts +1 -1
  17. package/src/tedi/components/form/radio/radio.cjs.js +1 -1
  18. package/src/tedi/components/form/radio/radio.es.js +24 -23
  19. package/src/tedi/components/overlays/tooltip/index.d.ts +1 -0
  20. package/src/tedi/components/overlays/tooltip/info-tooltip.cjs.js +1 -0
  21. package/src/tedi/components/overlays/tooltip/info-tooltip.d.ts +52 -0
  22. package/src/tedi/components/overlays/tooltip/info-tooltip.es.js +24 -0
  23. package/tedi.cjs.js +1 -1
  24. package/tedi.es.js +156 -154
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "18.1.0-rc.23",
3
+ "version": "18.1.0-rc.25",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("../../../../../external/classnames/index.cjs.js"),j=require("react"),x=require("../../buttons/info-button/info-button.cjs.js"),l=require("../../overlays/tooltip/tooltip.cjs.js"),t=require("./label.module.scss.cjs.js"),B=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),g=require("../../../providers/label-provider/use-labels.cjs.js"),o=j.forwardRef((r,s)=>{const{getCurrentBreakpointProps:n}=B.useBreakpointProps(r.defaultServerBreakpoint),{as:d="label",children:u,className:c,isBold:b,isSmall:a,required:f,tooltip:i,...p}=n(r),{getLabel:m}=g.useLabels(),q=h.default(t.default["tedi-label"],b&&t.default["tedi-label--bold"],a&&t.default["tedi-label--small"],c);return e.jsxs(d,{ref:s,className:q,...p,children:[u,f&&e.jsx("span",{className:t.default["tedi-label__required"],"aria-hidden":"true",children:"*"}),i&&e.jsx("span",{"aria-hidden":"true",className:t.default["tedi-label__info"],children:e.jsxs(l.Tooltip,{children:[e.jsx(l.Tooltip.Trigger,{children:e.jsx(x.InfoButton,{isSmall:a,"aria-label":m("infoButton.moreInformation")})}),e.jsx(l.Tooltip.Content,{children:i})]})})]})});o.displayName="Label";exports.Label=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),q=require("../../../../../external/classnames/index.cjs.js"),h=require("react"),j=require("../../overlays/tooltip/info-tooltip.cjs.js"),e=require("./label.module.scss.cjs.js"),x=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),i=h.forwardRef((a,n)=>{const{getCurrentBreakpointProps:o}=x.useBreakpointProps(a.defaultServerBreakpoint),{as:d="label",children:u,className:c,isBold:b,isSmall:t,required:f,tooltip:r,...p}=o(a),m=q.default(e.default["tedi-label"],b&&e.default["tedi-label--bold"],t&&e.default["tedi-label--small"],c),s=l.jsxs(d,{ref:n,className:m,...p,children:[u,f&&l.jsx("span",{className:e.default["tedi-label__required"],"aria-hidden":"true",children:"*"})]});return r?l.jsxs("span",{className:e.default["tedi-label__wrapper"],children:[s,l.jsx("span",{className:e.default["tedi-label__info"],children:l.jsx(j.InfoTooltip,{isSmall:t,children:r})})]}):s});i.displayName="Label";exports.Label=i;
@@ -1,4 +1,4 @@
1
- import { ElementType, LabelHTMLAttributes } from 'react';
1
+ import { ElementType, LabelHTMLAttributes, ReactNode } from 'react';
2
2
  import { BreakpointSupport } from '../../../helpers';
3
3
  type LabelBreakpointProps = {
4
4
  /**
@@ -27,10 +27,11 @@ export interface LabelProps extends BreakpointSupport<LabelBreakpointProps>, Lab
27
27
  */
28
28
  required?: boolean;
29
29
  /**
30
- * Tooltip content to display when hovering over the info button.
30
+ * Tooltip content to display when hovering over the info button. Accepts rich
31
+ * content (e.g. bold text, links), not just a plain string.
31
32
  * If provided, an info button with a tooltip will be rendered.
32
33
  */
33
- tooltip?: string;
34
+ tooltip?: ReactNode;
34
35
  }
35
36
  export declare const Label: import('react').ForwardRefExoticComponent<LabelProps & import('react').RefAttributes<HTMLLabelElement | HTMLSpanElement>>;
36
37
  export {};
@@ -1,35 +1,32 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import B from "../../../../../external/classnames/index.es.js";
1
+ import { jsxs as i, jsx as l } from "react/jsx-runtime";
2
+ import h from "../../../../../external/classnames/index.es.js";
3
3
  import { forwardRef as N } from "react";
4
- import { InfoButton as g } from "../../buttons/info-button/info-button.es.js";
5
- import { Tooltip as l } from "../../overlays/tooltip/tooltip.es.js";
6
- import r from "./label.module.scss.es.js";
7
- import { useBreakpointProps as L } from "../../../helpers/hooks/use-breakpoint-props.es.js";
8
- import { useLabels as _ } from "../../../providers/label-provider/use-labels.es.js";
9
- const k = N((o, s) => {
10
- const { getCurrentBreakpointProps: n } = L(o.defaultServerBreakpoint), {
4
+ import { InfoTooltip as _ } from "../../overlays/tooltip/info-tooltip.es.js";
5
+ import e from "./label.module.scss.es.js";
6
+ import { useBreakpointProps as B } from "../../../helpers/hooks/use-breakpoint-props.es.js";
7
+ const k = N((r, o) => {
8
+ const { getCurrentBreakpointProps: n } = B(r.defaultServerBreakpoint), {
11
9
  as: m = "label",
12
10
  children: d,
13
- className: c,
14
- isBold: p,
15
- isSmall: t,
16
- required: f,
17
- tooltip: a,
18
- ...b
19
- } = n(o), { getLabel: u } = _(), h = B(
20
- r["tedi-label"],
21
- p && r["tedi-label--bold"],
22
- t && r["tedi-label--small"],
23
- c
24
- );
25
- return /* @__PURE__ */ i(m, { ref: s, className: h, ...b, children: [
11
+ className: p,
12
+ isBold: c,
13
+ isSmall: a,
14
+ required: b,
15
+ tooltip: s,
16
+ ...f
17
+ } = n(r), u = h(
18
+ e["tedi-label"],
19
+ c && e["tedi-label--bold"],
20
+ a && e["tedi-label--small"],
21
+ p
22
+ ), t = /* @__PURE__ */ i(m, { ref: o, className: u, ...f, children: [
26
23
  d,
27
- f && /* @__PURE__ */ e("span", { className: r["tedi-label__required"], "aria-hidden": "true", children: "*" }),
28
- a && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: r["tedi-label__info"], children: /* @__PURE__ */ i(l, { children: [
29
- /* @__PURE__ */ e(l.Trigger, { children: /* @__PURE__ */ e(g, { isSmall: t, "aria-label": u("infoButton.moreInformation") }) }),
30
- /* @__PURE__ */ e(l.Content, { children: a })
31
- ] }) })
24
+ b && /* @__PURE__ */ l("span", { className: e["tedi-label__required"], "aria-hidden": "true", children: "*" })
32
25
  ] });
26
+ return s ? /* @__PURE__ */ i("span", { className: e["tedi-label__wrapper"], children: [
27
+ t,
28
+ /* @__PURE__ */ l("span", { className: e["tedi-label__info"], children: /* @__PURE__ */ l(_, { isSmall: a, children: s }) })
29
+ ] }) : t;
33
30
  });
34
31
  k.displayName = "Label";
35
32
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-label":"tedi-label-473ab627","tedi-label--small":"tedi-label--small-20e328dc","tedi-label--bold":"tedi-label--bold-9d758835","tedi-label__required":"tedi-label__required-414e3f9d","tedi-label__info":"tedi-label__info-c9df19b4"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-label":"tedi-label-473ab627","tedi-label--small":"tedi-label--small-20e328dc","tedi-label--bold":"tedi-label--bold-9d758835","tedi-label__required":"tedi-label__required-414e3f9d","tedi-label__info":"tedi-label__info-c9df19b4","tedi-label__wrapper":"tedi-label__wrapper-db98e7da"};exports.default=e;
@@ -3,7 +3,8 @@ const e = {
3
3
  "tedi-label--small": "tedi-label--small-20e328dc",
4
4
  "tedi-label--bold": "tedi-label--bold-9d758835",
5
5
  "tedi-label__required": "tedi-label__required-414e3f9d",
6
- "tedi-label__info": "tedi-label__info-c9df19b4"
6
+ "tedi-label__info": "tedi-label__info-c9df19b4",
7
+ "tedi-label__wrapper": "tedi-label__wrapper-db98e7da"
7
8
  };
8
9
  export {
9
10
  e as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),h=require("react"),p=require("../../base/icon/icon.cjs.js"),$=require("../feedback-text/feedback-text.cjs.js"),B=require("../form-label/form-label.cjs.js"),e=require("./checkbox.module.scss.cjs.js"),F=require("../../layout/grid/row.cjs.js"),j=require("../../layout/grid/col.cjs.js"),q=C=>{const{id:l,label:f,value:b,className:N,disabled:r=!1,onChange:i,hideLabel:g=!1,helper:a,checked:o,defaultChecked:y,indeterminate:n,hover:I,name:R,tooltip:x,invalid:v,size:s="default",required:w,...z}=C,[k,L]=h.useState(y||!1),_=h.useRef(null),u=h.useMemo(()=>n?"mixed":i&&typeof o<"u"?o:k,[n,i,o,k]),M=t=>{typeof o>"u"&&L(t==null?void 0:t.target.checked),i==null||i(b,t==null?void 0:t.target.checked)},m=a?a.id??`${l}-helper`:void 0,S=x?`${l}-tooltip`:void 0,T=d.default(e.default["tedi-checkbox__label"],{[e.default["tedi-checkbox--disabled"]]:r});return c.jsxs("div",{className:d.default(e.default["tedi-checkbox"],{[e.default["tedi-checkbox--disabled"]]:r}),"data-name":"check",...z,children:[c.jsxs(F.Row,{gutter:0,children:[c.jsx(j.Col,{width:"auto",children:c.jsxs("div",{className:e.default["tedi-checkbox__outer-indicator-wrapper"],children:[c.jsx("input",{id:l,value:b,name:R,type:"checkbox",disabled:r,checked:u!=="mixed"?u:!1,"aria-checked":u,onChange:M,className:e.default["tedi-checkbox__input"],"aria-describedby":[m,S].filter(Boolean).join(" ")}),c.jsxs("div",{"aria-hidden":"true",onClick:()=>{var t;return(t=_.current)==null?void 0:t.click()},className:d.default(e.default["tedi-checkbox__indicator"],{[e.default["tedi-checkbox__indicator--hover"]]:I,[e.default["tedi-checkbox__indicator--indeterminate"]]:n,[e.default[`tedi-checkbox__indicator--size-${s}`]]:s,[e.default["tedi-checkbox__indicator--invalid"]]:v},N),"data-testid":"checkbox-indicator",children:[c.jsx(p.Icon,{size:s==="default"?16:18,name:"remove",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--indeterminate"])}),c.jsx(p.Icon,{size:s==="default"?16:18,name:"check",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--check"])})]})]})}),f&&c.jsx(j.Col,{children:c.jsx(B.FormLabel,{ref:_,className:T,id:l,"data-testid":"checkbox-label",hideLabel:g,label:f,tooltip:x,required:w})})]}),a&&c.jsx($.FeedbackText,{id:m,...a,className:d.default(e.default["tedi-checkbox__helper"],a.className)})]})};exports.Checkbox=q;exports.default=q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),j=require("../../base/icon/icon.cjs.js"),B=require("../feedback-text/feedback-text.cjs.js"),E=require("../form-label/form-label.cjs.js"),e=require("./checkbox.module.scss.cjs.js"),F=require("../../layout/grid/row.cjs.js"),q=require("../../layout/grid/col.cjs.js"),C=N=>{const{id:a,label:h,value:b,className:R,disabled:n=!1,onChange:l,hideLabel:g=!1,helper:i,checked:u,defaultChecked:v,indeterminate:o,hover:y,name:I,tooltip:k,invalid:x,size:s="default",required:_,...w}=N,[z,L]=r.useState(v||!1),m=r.useRef(null),f=r.useRef(null),M=l&&typeof u<"u"?u:z;r.useEffect(()=>{f.current&&(f.current.indeterminate=!!o)},[o]);const S=t=>{typeof u>"u"&&L(t==null?void 0:t.target.checked),l==null||l(b,t==null?void 0:t.target.checked)},p=i?i.id??`${a}-helper`:void 0,T=k?`${a}-tooltip`:void 0,$=d.default(e.default["tedi-checkbox__label"],{[e.default["tedi-checkbox--disabled"]]:n});return c.jsxs("div",{className:d.default(e.default["tedi-checkbox"],{[e.default["tedi-checkbox--disabled"]]:n}),"data-name":"check",...w,children:[c.jsxs(F.Row,{gutter:0,children:[c.jsx(q.Col,{width:"auto",children:c.jsxs("div",{className:e.default["tedi-checkbox__outer-indicator-wrapper"],children:[c.jsx("input",{ref:f,id:a,value:b,name:I,type:"checkbox",disabled:n,checked:o?!1:M,onChange:S,className:e.default["tedi-checkbox__input"],"aria-describedby":[p,T].filter(Boolean).join(" "),required:_,"aria-invalid":x||void 0}),c.jsxs("div",{"aria-hidden":"true",onClick:()=>{var t;return(t=m.current)==null?void 0:t.click()},className:d.default(e.default["tedi-checkbox__indicator"],{[e.default["tedi-checkbox__indicator--hover"]]:y,[e.default["tedi-checkbox__indicator--indeterminate"]]:o,[e.default[`tedi-checkbox__indicator--size-${s}`]]:s,[e.default["tedi-checkbox__indicator--invalid"]]:x},R),"data-testid":"checkbox-indicator",children:[c.jsx(j.Icon,{size:s==="default"?16:18,name:"remove",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--indeterminate"])}),c.jsx(j.Icon,{size:s==="default"?16:18,name:"check",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--check"])})]})]})}),h&&c.jsx(q.Col,{children:c.jsx(E.FormLabel,{ref:m,className:$,id:a,"data-testid":"checkbox-label",hideLabel:g,label:h,tooltip:k,required:_})})]}),i&&c.jsx(B.FeedbackText,{id:p,...i,className:d.default(e.default["tedi-checkbox__helper"],i.className)})]})};exports.Checkbox=C;exports.default=C;
@@ -1,57 +1,63 @@
1
1
  import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
- import d from "../../../../../external/classnames/index.es.js";
3
- import k from "react";
4
- import { Icon as N } from "../../base/icon/icon.es.js";
5
- import { FeedbackText as q } from "../feedback-text/feedback-text.es.js";
6
- import { FormLabel as E } from "../form-label/form-label.es.js";
2
+ import t from "../../../../../external/classnames/index.es.js";
3
+ import n from "react";
4
+ import { Icon as C } from "../../base/icon/icon.es.js";
5
+ import { FeedbackText as H } from "../feedback-text/feedback-text.es.js";
6
+ import { FormLabel as M } from "../form-label/form-label.es.js";
7
7
  import e from "./checkbox.module.scss.es.js";
8
- import { Row as H } from "../../layout/grid/row.es.js";
9
- import { Col as C } from "../../layout/grid/col.es.js";
10
- const Q = (g) => {
8
+ import { Row as S } from "../../layout/grid/row.es.js";
9
+ import { Col as R } from "../../layout/grid/col.es.js";
10
+ const U = (y) => {
11
11
  const {
12
- id: a,
13
- label: b,
14
- value: f,
15
- className: y,
16
- disabled: n = !1,
17
- onChange: t,
18
- hideLabel: z = !1,
19
- helper: o,
20
- checked: r,
21
- defaultChecked: I,
22
- indeterminate: h,
23
- hover: R,
12
+ id: o,
13
+ label: k,
14
+ value: b,
15
+ className: g,
16
+ disabled: h = !1,
17
+ onChange: a,
18
+ hideLabel: v = !1,
19
+ helper: d,
20
+ checked: m,
21
+ defaultChecked: z,
22
+ indeterminate: r,
23
+ hover: I,
24
24
  name: j,
25
25
  tooltip: _,
26
- invalid: w,
26
+ invalid: u,
27
27
  size: l = "default",
28
- required: L,
29
- ...$
30
- } = g, [x, v] = k.useState(I || !1), p = k.useRef(null), m = k.useMemo(() => h ? "mixed" : t && typeof r < "u" ? r : x, [h, t, r, x]), B = (c) => {
31
- typeof r > "u" && v(c == null ? void 0 : c.target.checked), t == null || t(f, c == null ? void 0 : c.target.checked);
32
- }, u = o ? o.id ?? `${a}-helper` : void 0, F = _ ? `${a}-tooltip` : void 0, M = d(e["tedi-checkbox__label"], { [e["tedi-checkbox--disabled"]]: n });
28
+ required: p,
29
+ ...w
30
+ } = y, [L, $] = n.useState(z || !1), x = n.useRef(null), f = n.useRef(null), B = a && typeof m < "u" ? m : L;
31
+ n.useEffect(() => {
32
+ f.current && (f.current.indeterminate = !!r);
33
+ }, [r]);
34
+ const E = (c) => {
35
+ typeof m > "u" && $(c == null ? void 0 : c.target.checked), a == null || a(b, c == null ? void 0 : c.target.checked);
36
+ }, N = d ? d.id ?? `${o}-helper` : void 0, F = _ ? `${o}-tooltip` : void 0, q = t(e["tedi-checkbox__label"], { [e["tedi-checkbox--disabled"]]: h });
33
37
  return /* @__PURE__ */ s(
34
38
  "div",
35
39
  {
36
- className: d(e["tedi-checkbox"], { [e["tedi-checkbox--disabled"]]: n }),
40
+ className: t(e["tedi-checkbox"], { [e["tedi-checkbox--disabled"]]: h }),
37
41
  "data-name": "check",
38
- ...$,
42
+ ...w,
39
43
  children: [
40
- /* @__PURE__ */ s(H, { gutter: 0, children: [
41
- /* @__PURE__ */ i(C, { width: "auto", children: /* @__PURE__ */ s("div", { className: e["tedi-checkbox__outer-indicator-wrapper"], children: [
44
+ /* @__PURE__ */ s(S, { gutter: 0, children: [
45
+ /* @__PURE__ */ i(R, { width: "auto", children: /* @__PURE__ */ s("div", { className: e["tedi-checkbox__outer-indicator-wrapper"], children: [
42
46
  /* @__PURE__ */ i(
43
47
  "input",
44
48
  {
45
- id: a,
46
- value: f,
49
+ ref: f,
50
+ id: o,
51
+ value: b,
47
52
  name: j,
48
53
  type: "checkbox",
49
- disabled: n,
50
- checked: m !== "mixed" ? m : !1,
51
- "aria-checked": m,
52
- onChange: B,
54
+ disabled: h,
55
+ checked: r ? !1 : B,
56
+ onChange: E,
53
57
  className: e["tedi-checkbox__input"],
54
- "aria-describedby": [u, F].filter(Boolean).join(" ")
58
+ "aria-describedby": [N, F].filter(Boolean).join(" "),
59
+ required: p,
60
+ "aria-invalid": u || void 0
55
61
  }
56
62
  ),
57
63
  /* @__PURE__ */ s(
@@ -60,60 +66,60 @@ const Q = (g) => {
60
66
  "aria-hidden": "true",
61
67
  onClick: () => {
62
68
  var c;
63
- return (c = p.current) == null ? void 0 : c.click();
69
+ return (c = x.current) == null ? void 0 : c.click();
64
70
  },
65
- className: d(
71
+ className: t(
66
72
  e["tedi-checkbox__indicator"],
67
73
  {
68
- [e["tedi-checkbox__indicator--hover"]]: R,
69
- [e["tedi-checkbox__indicator--indeterminate"]]: h,
74
+ [e["tedi-checkbox__indicator--hover"]]: I,
75
+ [e["tedi-checkbox__indicator--indeterminate"]]: r,
70
76
  [e[`tedi-checkbox__indicator--size-${l}`]]: l,
71
- [e["tedi-checkbox__indicator--invalid"]]: w
77
+ [e["tedi-checkbox__indicator--invalid"]]: u
72
78
  },
73
- y
79
+ g
74
80
  ),
75
81
  "data-testid": "checkbox-indicator",
76
82
  children: [
77
83
  /* @__PURE__ */ i(
78
- N,
84
+ C,
79
85
  {
80
86
  size: l === "default" ? 16 : 18,
81
87
  name: "remove",
82
- className: d(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--indeterminate"])
88
+ className: t(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--indeterminate"])
83
89
  }
84
90
  ),
85
91
  /* @__PURE__ */ i(
86
- N,
92
+ C,
87
93
  {
88
94
  size: l === "default" ? 16 : 18,
89
95
  name: "check",
90
- className: d(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--check"])
96
+ className: t(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--check"])
91
97
  }
92
98
  )
93
99
  ]
94
100
  }
95
101
  )
96
102
  ] }) }),
97
- b && /* @__PURE__ */ i(C, { children: /* @__PURE__ */ i(
98
- E,
103
+ k && /* @__PURE__ */ i(R, { children: /* @__PURE__ */ i(
104
+ M,
99
105
  {
100
- ref: p,
101
- className: M,
102
- id: a,
106
+ ref: x,
107
+ className: q,
108
+ id: o,
103
109
  "data-testid": "checkbox-label",
104
- hideLabel: z,
105
- label: b,
110
+ hideLabel: v,
111
+ label: k,
106
112
  tooltip: _,
107
- required: L
113
+ required: p
108
114
  }
109
115
  ) })
110
116
  ] }),
111
- o && /* @__PURE__ */ i(q, { id: u, ...o, className: d(e["tedi-checkbox__helper"], o.className) })
117
+ d && /* @__PURE__ */ i(H, { id: N, ...d, className: t(e["tedi-checkbox__helper"], d.className) })
112
118
  ]
113
119
  }
114
120
  );
115
121
  };
116
122
  export {
117
- Q as Checkbox,
118
- Q as default
123
+ U as Checkbox,
124
+ U as default
119
125
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),_=require("../../../../../external/classnames/index.cjs.js"),h=require("react"),Z=require("../feedback-text/feedback-text.cjs.js"),ee=require("../form-label/form-label.cjs.js"),te=require("../checkbox/checkbox.cjs.js"),j=require("./choice-group.module.scss.cjs.js"),re=require("./choice-group-context.cjs.js"),N=require("./components/choice-group-item/choice-group-item.cjs.js"),ne=require("../../../providers/label-provider/use-labels.cjs.js"),v=require("../../../helpers/hooks/use-breakpoint.cjs.js"),oe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=require("../../layout/grid/row.cjs.js"),ie=require("../../layout/grid/col.cjs.js"),B=f=>{const{getLabel:m}=ne.useLabels(),I=v.default(f.defaultServerBreakpoint),{getCurrentBreakpointProps:R}=oe.useBreakpointProps(f.defaultServerBreakpoint),{id:d,className:T,label:p,required:H,helper:u,items:n,variant:k="default",direction:C=k==="default"||v.isBreakpointBelow(I,"md")?"column":"row",rowProps:b,name:S,inputType:i="radio",value:G,defaultValue:w,onChange:a,hideLabel:P,indeterminateCheck:s,indeterminateCheckProps:x={},color:E,layout:y="separated",showIndicator:$,...O}=R(f),{...W}=x,X=(x==null?void 0:x.indented)??!0,L=(u==null?void 0:u.id)??`${d}-helper`,M=s&&i==="checkbox",[Y,A]=h.useState(()=>{if(w)return w;if(i==="radio"){const e=n.find(l=>l.defaultChecked);return e?e.value:null}return i==="checkbox"?n.filter(e=>e.defaultChecked).map(e=>e.value):null}),q=(e=f.value)=>!!a&&typeof e<"u",r=q(G)?G:Y,g=h.useMemo(()=>(r==null?void 0:r.length)===0,[r==null?void 0:r.length]),c=h.useMemo(()=>{var e;return(r==null?void 0:r.length)===((e=n==null?void 0:n.filter(l=>!l.disabled))==null?void 0:e.length)},[r==null?void 0:r.length,n]),z=h.useMemo(()=>!g&&!c,[c,g]),D=h.useMemo(()=>{const e=c?"all":g?"none":"some";return typeof s=="string"?s:typeof s=="function"?s(e):s?m(e==="all"?"table.filter.remove-all":"table.filter.select-all"):""},[m,s,c,g]),J={name:S,inputType:i,onChange:(e,l)=>{let t=r;i==="checkbox"&&t?t=l?Array.isArray(t)?[...t,e]:[e]:Array.isArray(t)?t.filter(V=>V!==e):t:t=e,q()||A(Array.isArray(t)?[...t]:t),a==null||a(t)},currentValue:r},K=_.default(j.default["tedi-choice-group"],T),Q=_.default(j.default["tedi-choice-group__inner"],b==null?void 0:b.className,{[j.default["tedi-choice-group__inner--indented"]]:M&&X}),U=()=>{var l;const e=c?[]:(l=n==null?void 0:n.filter(t=>!t.disabled))==null?void 0:l.map(t=>t.value);q()||A([...e]),a==null||a(e)};return o.jsx(re.ChoiceGroupContext.Provider,{value:J,children:o.jsxs("fieldset",{...O,className:K,id:d,name:S,"aria-describedby":L,children:[p&&typeof p=="string"?o.jsx(ee.FormLabel,{id:d,label:p,required:H,hideLabel:P,renderWithoutLabel:!0}):o.jsx("label",{htmlFor:d,children:p}),o.jsx(F.Row,{children:o.jsx(ie.Col,{children:n!=null&&n.length?o.jsxs(o.Fragment,{children:[M&&o.jsx(te.Checkbox,{id:`${d}-indeterminate`,value:"indeterminate",name:"indeterminate",...W,label:D,indeterminate:z,checked:c,onChange:U}),o.jsx(F.Row,{direction:C,gutterX:y==="segmented"?0:2,gutterY:y==="segmented"?0:1,gap:k==="default"&&(v.isBreakpointBelow(I,"md")||C==="row")?1:0,...b,className:Q,role:i==="radio"?"radiogroup":void 0,"aria-labelledby":i==="radio"?d:void 0,children:n.map(e=>o.jsx(N.ChoiceGroupItem,{...e,color:E,variant:k,type:i,layout:y,showIndicator:$,direction:C},e.id))})]}):o.jsx("p",{children:m("table.filter.no-options")})})}),u&&o.jsx(Z.FeedbackText,{...u,id:L})]})})};B.Item=N.ChoiceGroupItem;exports.ChoiceGroup=B;exports.default=B;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),F=require("../../../../../external/classnames/index.cjs.js"),f=require("react"),Z=require("../feedback-text/feedback-text.cjs.js"),ee=require("../form-label/form-label.cjs.js"),te=require("../checkbox/checkbox.cjs.js"),j=require("./choice-group.module.scss.cjs.js"),re=require("./choice-group-context.cjs.js"),R=require("./components/choice-group-item/choice-group-item.cjs.js"),oe=require("../../../providers/label-provider/use-labels.cjs.js"),B=require("../../../helpers/hooks/use-breakpoint.cjs.js"),ne=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),N=require("../../layout/grid/row.cjs.js"),ie=require("../../layout/grid/col.cjs.js"),I=h=>{const{getLabel:m}=oe.useLabels(),S=B.default(h.defaultServerBreakpoint),{getCurrentBreakpointProps:T}=ne.useBreakpointProps(h.defaultServerBreakpoint),{id:c,className:H,label:p,required:G,helper:a,items:o,variant:k="default",direction:v=k==="default"||B.isBreakpointBelow(S,"md")?"column":"row",rowProps:b,name:w,inputType:i="radio",value:L,defaultValue:M,onChange:d,hideLabel:P,indeterminateCheck:s,indeterminateCheckProps:x={},color:E,layout:y="separated",showIndicator:$,...O}=T(h),{...W}=x,X=(x==null?void 0:x.indented)??!0,C=(a==null?void 0:a.id)??`${c}-helper`,A=s&&i==="checkbox",[Y,_]=f.useState(()=>{if(M)return M;if(i==="radio"){const e=o.find(l=>l.defaultChecked);return e?e.value:null}return i==="checkbox"?o.filter(e=>e.defaultChecked).map(e=>e.value):null}),q=(e=h.value)=>!!d&&typeof e<"u",r=q(L)?L:Y,g=f.useMemo(()=>(r==null?void 0:r.length)===0,[r==null?void 0:r.length]),u=f.useMemo(()=>{var e;return(r==null?void 0:r.length)===((e=o==null?void 0:o.filter(l=>!l.disabled))==null?void 0:e.length)},[r==null?void 0:r.length,o]),z=f.useMemo(()=>!g&&!u,[u,g]),D=f.useMemo(()=>{const e=u?"all":g?"none":"some";return typeof s=="string"?s:typeof s=="function"?s(e):s?m(e==="all"?"table.filter.remove-all":"table.filter.select-all"):""},[m,s,u,g]),J={name:w,inputType:i,onChange:(e,l)=>{let t=r;i==="checkbox"&&t?t=l?Array.isArray(t)?[...t,e]:[e]:Array.isArray(t)?t.filter(V=>V!==e):t:t=e,q()||_(Array.isArray(t)?[...t]:t),d==null||d(t)},currentValue:r},K=F.default(j.default["tedi-choice-group"],H),Q=F.default(j.default["tedi-choice-group__inner"],b==null?void 0:b.className,{[j.default["tedi-choice-group__inner--indented"]]:A&&X}),U=()=>{var l;const e=u?[]:(l=o==null?void 0:o.filter(t=>!t.disabled))==null?void 0:l.map(t=>t.value);q()||_([...e]),d==null||d(e)};return n.jsx(re.ChoiceGroupContext.Provider,{value:J,children:n.jsxs("fieldset",{...O,className:K,id:c,name:w,"aria-describedby":a&&i!=="radio"?C:void 0,children:[p&&typeof p=="string"?n.jsx(ee.FormLabel,{id:c,label:p,required:G,hideLabel:P,renderWithoutLabel:!0}):n.jsx("label",{htmlFor:c,children:p}),n.jsx(N.Row,{children:n.jsx(ie.Col,{children:o!=null&&o.length?n.jsxs(n.Fragment,{children:[A&&n.jsx(te.Checkbox,{id:`${c}-indeterminate`,value:"indeterminate",name:"indeterminate",...W,label:D,indeterminate:z,checked:u,onChange:U}),n.jsx(N.Row,{direction:v,gutterX:y==="segmented"?0:2,gutterY:y==="segmented"?0:1,gap:k==="default"&&(B.isBreakpointBelow(S,"md")||v==="row")?1:0,...b,className:Q,role:i==="radio"?"radiogroup":void 0,"aria-labelledby":i==="radio"?c:void 0,"aria-describedby":i==="radio"&&a?C:void 0,"aria-required":i==="radio"&&G?!0:void 0,"aria-invalid":i==="radio"&&(a==null?void 0:a.type)==="error"?!0:void 0,children:o.map(e=>n.jsx(R.ChoiceGroupItem,{...e,color:E,variant:k,type:i,layout:y,showIndicator:$,direction:v},e.id))})]}):n.jsx("p",{children:m("table.filter.no-options")})})}),a&&n.jsx(Z.FeedbackText,{...a,id:C})]})})};I.Item=R.ChoiceGroupItem;exports.ChoiceGroup=I;exports.default=I;
@@ -1,118 +1,131 @@
1
- import { jsx as n, jsxs as w, Fragment as Z } from "react/jsx-runtime";
2
- import F from "../../../../../external/classnames/index.es.js";
3
- import k, { useState as ee } from "react";
1
+ import { jsx as a, jsxs as F, Fragment as Z } from "react/jsx-runtime";
2
+ import G from "../../../../../external/classnames/index.es.js";
3
+ import y, { useState as ee } from "react";
4
4
  import { FeedbackText as te } from "../feedback-text/feedback-text.es.js";
5
5
  import { FormLabel as re } from "../form-label/form-label.es.js";
6
6
  import { Checkbox as oe } from "../checkbox/checkbox.es.js";
7
- import I from "./choice-group.module.scss.es.js";
8
- import { ChoiceGroupContext as ne } from "./choice-group-context.es.js";
9
- import { ChoiceGroupItem as j } from "./components/choice-group-item/choice-group-item.es.js";
10
- import { useLabels as ie } from "../../../providers/label-provider/use-labels.es.js";
11
- import ae, { isBreakpointBelow as G } from "../../../helpers/hooks/use-breakpoint.es.js";
7
+ import B from "./choice-group.module.scss.es.js";
8
+ import { ChoiceGroupContext as ie } from "./choice-group-context.es.js";
9
+ import { ChoiceGroupItem as q } from "./components/choice-group-item/choice-group-item.es.js";
10
+ import { useLabels as ne } from "../../../providers/label-provider/use-labels.es.js";
11
+ import ae, { isBreakpointBelow as H } from "../../../helpers/hooks/use-breakpoint.es.js";
12
12
  import { useBreakpointProps as le } from "../../../helpers/hooks/use-breakpoint-props.es.js";
13
- import { Row as H } from "../../layout/grid/row.es.js";
13
+ import { Row as j } from "../../layout/grid/row.es.js";
14
14
  import { Col as de } from "../../layout/grid/col.es.js";
15
- const se = (f) => {
16
- const { getLabel: u } = ie(), B = ae(f.defaultServerBreakpoint), { getCurrentBreakpointProps: E } = le(f.defaultServerBreakpoint), {
17
- id: s,
15
+ const se = (u) => {
16
+ const { getLabel: f } = ne(), S = ae(u.defaultServerBreakpoint), { getCurrentBreakpointProps: E } = le(u.defaultServerBreakpoint), {
17
+ id: c,
18
18
  className: R,
19
19
  label: p,
20
- required: T,
21
- helper: m,
20
+ required: A,
21
+ helper: n,
22
22
  items: o,
23
- variant: y = "default",
24
- direction: C = y === "default" || G(B, "md") ? "column" : "row",
23
+ variant: k = "default",
24
+ direction: v = k === "default" || H(S, "md") ? "column" : "row",
25
25
  rowProps: h,
26
- name: S,
26
+ name: L,
27
27
  inputType: i = "radio",
28
- value: A,
29
- defaultValue: L,
30
- onChange: l,
31
- hideLabel: $,
32
- indeterminateCheck: d,
28
+ value: M,
29
+ defaultValue: N,
30
+ onChange: d,
31
+ hideLabel: T,
32
+ indeterminateCheck: s,
33
33
  indeterminateCheckProps: b = {},
34
- color: q,
35
- layout: x = "separated",
34
+ color: $,
35
+ layout: C = "separated",
36
36
  showIndicator: P,
37
37
  ...W
38
- } = E(f), { ...X } = b, Y = (b == null ? void 0 : b.indented) ?? !0, M = (m == null ? void 0 : m.id) ?? `${s}-helper`, N = d && i === "checkbox", [z, _] = ee(() => {
39
- if (L) return L;
38
+ } = E(u), { ...X } = b, Y = (b == null ? void 0 : b.indented) ?? !0, x = (n == null ? void 0 : n.id) ?? `${c}-helper`, _ = s && i === "checkbox", [z, w] = ee(() => {
39
+ if (N) return N;
40
40
  if (i === "radio") {
41
- const e = o.find((a) => a.defaultChecked);
41
+ const e = o.find((l) => l.defaultChecked);
42
42
  return e ? e.value : null;
43
43
  }
44
44
  return i === "checkbox" ? o.filter((e) => e.defaultChecked).map((e) => e.value) : null;
45
- }), v = (e = f.value) => !!l && typeof e < "u", r = v(A) ? A : z, g = k.useMemo(() => (r == null ? void 0 : r.length) === 0, [r == null ? void 0 : r.length]), c = k.useMemo(
45
+ }), I = (e = u.value) => !!d && typeof e < "u", r = I(M) ? M : z, g = y.useMemo(() => (r == null ? void 0 : r.length) === 0, [r == null ? void 0 : r.length]), m = y.useMemo(
46
46
  () => {
47
47
  var e;
48
- return (r == null ? void 0 : r.length) === ((e = o == null ? void 0 : o.filter((a) => !a.disabled)) == null ? void 0 : e.length);
48
+ return (r == null ? void 0 : r.length) === ((e = o == null ? void 0 : o.filter((l) => !l.disabled)) == null ? void 0 : e.length);
49
49
  },
50
50
  [r == null ? void 0 : r.length, o]
51
- ), D = k.useMemo(() => !g && !c, [c, g]), J = k.useMemo(() => {
52
- const e = c ? "all" : g ? "none" : "some";
53
- return typeof d == "string" ? d : typeof d == "function" ? d(e) : d ? u(e === "all" ? "table.filter.remove-all" : "table.filter.select-all") : "";
54
- }, [u, d, c, g]), K = {
55
- name: S,
51
+ ), D = y.useMemo(() => !g && !m, [m, g]), J = y.useMemo(() => {
52
+ const e = m ? "all" : g ? "none" : "some";
53
+ return typeof s == "string" ? s : typeof s == "function" ? s(e) : s ? f(e === "all" ? "table.filter.remove-all" : "table.filter.select-all") : "";
54
+ }, [f, s, m, g]), K = {
55
+ name: L,
56
56
  inputType: i,
57
- onChange: (e, a) => {
57
+ onChange: (e, l) => {
58
58
  let t = r;
59
- i === "checkbox" && t ? t = a ? Array.isArray(t) ? [...t, e] : [e] : Array.isArray(t) ? t.filter((V) => V !== e) : t : t = e, v() || _(Array.isArray(t) ? [...t] : t), l == null || l(t);
59
+ i === "checkbox" && t ? t = l ? Array.isArray(t) ? [...t, e] : [e] : Array.isArray(t) ? t.filter((V) => V !== e) : t : t = e, I() || w(Array.isArray(t) ? [...t] : t), d == null || d(t);
60
60
  },
61
61
  currentValue: r
62
- }, O = F(I["tedi-choice-group"], R), Q = F(I["tedi-choice-group__inner"], h == null ? void 0 : h.className, {
63
- [I["tedi-choice-group__inner--indented"]]: N && Y
62
+ }, O = G(B["tedi-choice-group"], R), Q = G(B["tedi-choice-group__inner"], h == null ? void 0 : h.className, {
63
+ [B["tedi-choice-group__inner--indented"]]: _ && Y
64
64
  }), U = () => {
65
- var a;
66
- const e = c ? [] : (a = o == null ? void 0 : o.filter((t) => !t.disabled)) == null ? void 0 : a.map((t) => t.value);
67
- v() || _([...e]), l == null || l(e);
65
+ var l;
66
+ const e = m ? [] : (l = o == null ? void 0 : o.filter((t) => !t.disabled)) == null ? void 0 : l.map((t) => t.value);
67
+ I() || w([...e]), d == null || d(e);
68
68
  };
69
- return /* @__PURE__ */ n(ne.Provider, { value: K, children: /* @__PURE__ */ w("fieldset", { ...W, className: O, id: s, name: S, "aria-describedby": M, children: [
70
- p && typeof p == "string" ? /* @__PURE__ */ n(re, { id: s, label: p, required: T, hideLabel: $, renderWithoutLabel: !0 }) : /* @__PURE__ */ n("label", { htmlFor: s, children: p }),
71
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(de, { children: o != null && o.length ? /* @__PURE__ */ w(Z, { children: [
72
- N && /* @__PURE__ */ n(
73
- oe,
74
- {
75
- id: `${s}-indeterminate`,
76
- value: "indeterminate",
77
- name: "indeterminate",
78
- ...X,
79
- label: J,
80
- indeterminate: D,
81
- checked: c,
82
- onChange: U
83
- }
84
- ),
85
- /* @__PURE__ */ n(
86
- H,
87
- {
88
- direction: C,
89
- gutterX: x === "segmented" ? 0 : 2,
90
- gutterY: x === "segmented" ? 0 : 1,
91
- gap: y === "default" && (G(B, "md") || C === "row") ? 1 : 0,
92
- ...h,
93
- className: Q,
94
- role: i === "radio" ? "radiogroup" : void 0,
95
- "aria-labelledby": i === "radio" ? s : void 0,
96
- children: o.map((e) => /* @__PURE__ */ n(
69
+ return /* @__PURE__ */ a(ie.Provider, { value: K, children: /* @__PURE__ */ F(
70
+ "fieldset",
71
+ {
72
+ ...W,
73
+ className: O,
74
+ id: c,
75
+ name: L,
76
+ "aria-describedby": n && i !== "radio" ? x : void 0,
77
+ children: [
78
+ p && typeof p == "string" ? /* @__PURE__ */ a(re, { id: c, label: p, required: A, hideLabel: T, renderWithoutLabel: !0 }) : /* @__PURE__ */ a("label", { htmlFor: c, children: p }),
79
+ /* @__PURE__ */ a(j, { children: /* @__PURE__ */ a(de, { children: o != null && o.length ? /* @__PURE__ */ F(Z, { children: [
80
+ _ && /* @__PURE__ */ a(
81
+ oe,
82
+ {
83
+ id: `${c}-indeterminate`,
84
+ value: "indeterminate",
85
+ name: "indeterminate",
86
+ ...X,
87
+ label: J,
88
+ indeterminate: D,
89
+ checked: m,
90
+ onChange: U
91
+ }
92
+ ),
93
+ /* @__PURE__ */ a(
97
94
  j,
98
95
  {
99
- ...e,
100
- color: q,
101
- variant: y,
102
- type: i,
103
- layout: x,
104
- showIndicator: P,
105
- direction: C
106
- },
107
- e.id
108
- ))
109
- }
110
- )
111
- ] }) : /* @__PURE__ */ n("p", { children: u("table.filter.no-options") }) }) }),
112
- m && /* @__PURE__ */ n(te, { ...m, id: M })
113
- ] }) });
96
+ direction: v,
97
+ gutterX: C === "segmented" ? 0 : 2,
98
+ gutterY: C === "segmented" ? 0 : 1,
99
+ gap: k === "default" && (H(S, "md") || v === "row") ? 1 : 0,
100
+ ...h,
101
+ className: Q,
102
+ role: i === "radio" ? "radiogroup" : void 0,
103
+ "aria-labelledby": i === "radio" ? c : void 0,
104
+ "aria-describedby": i === "radio" && n ? x : void 0,
105
+ "aria-required": i === "radio" && A ? !0 : void 0,
106
+ "aria-invalid": i === "radio" && (n == null ? void 0 : n.type) === "error" ? !0 : void 0,
107
+ children: o.map((e) => /* @__PURE__ */ a(
108
+ q,
109
+ {
110
+ ...e,
111
+ color: $,
112
+ variant: k,
113
+ type: i,
114
+ layout: C,
115
+ showIndicator: P,
116
+ direction: v
117
+ },
118
+ e.id
119
+ ))
120
+ }
121
+ )
122
+ ] }) : /* @__PURE__ */ a("p", { children: f("table.filter.no-options") }) }) }),
123
+ n && /* @__PURE__ */ a(te, { ...n, id: x })
124
+ ]
125
+ }
126
+ ) });
114
127
  };
115
- se.Item = j;
128
+ se.Item = q;
116
129
  export {
117
130
  se as ChoiceGroup,
118
131
  se as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),h=require("../../../../../../../external/classnames/index.cjs.js"),S=require("react"),A=require("../../../checkbox/checkbox.cjs.js"),H=require("../../../feedback-text/feedback-text.cjs.js"),L=require("../../../radio/radio.cjs.js"),O=require("../../choice-group-context.cjs.js"),e=require("./choice-group-item.module.scss.cjs.js"),V=require("../../../../../helpers/hooks/use-breakpoint-props.cjs.js"),z=require("../../../../layout/grid/col.cjs.js"),_=n=>{const{getCurrentBreakpointProps:q}=V.useBreakpointProps(n.defaultServerBreakpoint),{id:a,label:C,value:d,className:N,direction:m,disabled:r,colProps:I=m==="column"?{width:12}:{width:"auto"},onChange:p,hideLabel:B,helper:u,tooltip:$,type:o="radio",variant:s="default",color:G="primary",layout:P,showIndicator:x,justifyContent:b="start"}=q(n),{currentValue:l,name:v,onChange:f,inputType:M}=S.useContext(O.ChoiceGroupContext),i=Array.isArray(l)?l.includes(d):d===l,R=l===void 0?n.defaultChecked:i,y=(c,k)=>{f==null||f(c,k),p==null||p(c,k)},T=h.default(e.default[`tedi-choice-group-item--${P==="separated"?"separated":"segmented"}`],m&&e.default[`tedi-choice-group-item--${m}`]),w=h.default(e.default["tedi-choice-group-item"],e.default[`tedi-choice-group-item--${s}`],e.default[`tedi-choice-group-item--${s}-${G}`],x&&e.default["tedi-choice-group-item--indicator"],o&&e.default[`tedi-choice-group-item--${o}`],{[e.default["tedi-choice-group-item--disabled"]]:r},{[e.default["tedi-choice-group-item--checked"]]:i},{[`justify-content-${b}`]:b}),E=o==="radio"?L.Radio:A.Checkbox,F=c=>{var j;r||s!=="card"||c.target.closest("input, label")||(j=document.getElementById(a))==null||j.click()},g=o==="radio";return t.jsx(z.Col,{...I,className:T,children:t.jsx("div",{className:w,tabIndex:g||r?-1:0,onClick:F,role:g?void 0:o,"aria-checked":g?void 0:i,children:s==="default"||x?t.jsx(E,{id:a,label:C,value:d,name:v,className:h.default(e.default["tedi-choice-group-item__indicator"],N),disabled:r,checked:i,defaultChecked:R,onChange:y,hideLabel:B,helper:u?{...u,className:h.default(e.default["tedi-choice-group-item__feedback-text"],u.className)}:void 0,tooltip:$,"data-testid":"choice-group-item-indicator","aria-checked":i}):t.jsxs(t.Fragment,{children:[t.jsx("input",{id:a,value:d,name:v,type:M,disabled:r,checked:i,defaultChecked:l===void 0?n.defaultChecked:void 0,onChange:c=>{y(d,c.target.checked)},className:"visually-hidden",role:o==="radio"?"radio":void 0,"aria-checked":i,tabIndex:-1}),t.jsxs("label",{htmlFor:a,className:e.default["tedi-choice-group-item__label"],children:[C,u&&t.jsx(H.FeedbackText,{...u,id:a,className:e.default["tedi-choice-group-item__feedback-text"]})]})]})})})};exports.ChoiceGroupItem=_;exports.default=_;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),h=require("../../../../../../../external/classnames/index.cjs.js"),S=require("react"),A=require("../../../checkbox/checkbox.cjs.js"),H=require("../../../feedback-text/feedback-text.cjs.js"),L=require("../../../radio/radio.cjs.js"),O=require("../../choice-group-context.cjs.js"),e=require("./choice-group-item.module.scss.cjs.js"),V=require("../../../../../helpers/hooks/use-breakpoint-props.cjs.js"),z=require("../../../../layout/grid/col.cjs.js"),_=n=>{const{getCurrentBreakpointProps:q}=V.useBreakpointProps(n.defaultServerBreakpoint),{id:a,label:C,value:d,className:N,direction:m,disabled:r,colProps:I=m==="column"?{width:12}:{width:"auto"},onChange:p,hideLabel:B,helper:u,tooltip:$,type:i="radio",variant:s="default",color:G="primary",layout:P,showIndicator:x,justifyContent:b="start"}=q(n),{currentValue:l,name:v,onChange:f,inputType:M}=S.useContext(O.ChoiceGroupContext),o=Array.isArray(l)?l.includes(d):d===l,R=l===void 0?n.defaultChecked:o,y=(c,k)=>{f==null||f(c,k),p==null||p(c,k)},T=h.default(e.default[`tedi-choice-group-item--${P==="separated"?"separated":"segmented"}`],m&&e.default[`tedi-choice-group-item--${m}`]),w=h.default(e.default["tedi-choice-group-item"],e.default[`tedi-choice-group-item--${s}`],e.default[`tedi-choice-group-item--${s}-${G}`],x&&e.default["tedi-choice-group-item--indicator"],i&&e.default[`tedi-choice-group-item--${i}`],{[e.default["tedi-choice-group-item--disabled"]]:r},{[e.default["tedi-choice-group-item--checked"]]:o},{[`justify-content-${b}`]:b}),E=i==="radio"?L.Radio:A.Checkbox,F=c=>{var j;r||s!=="card"||c.target.closest("input, label")||(j=document.getElementById(a))==null||j.click()},g=i==="radio";return t.jsx(z.Col,{...I,className:T,children:t.jsx("div",{className:w,tabIndex:g||r?-1:0,onClick:F,role:g?void 0:i,"aria-checked":g?void 0:o,children:s==="default"||x?t.jsx(E,{id:a,label:C,value:d,name:v,className:h.default(e.default["tedi-choice-group-item__indicator"],N),disabled:r,checked:o,defaultChecked:R,onChange:y,hideLabel:B,helper:u?{...u,className:h.default(e.default["tedi-choice-group-item__feedback-text"],u.className)}:void 0,tooltip:$,"data-testid":"choice-group-item-indicator"}):t.jsxs(t.Fragment,{children:[t.jsx("input",{id:a,value:d,name:v,type:M,disabled:r,checked:o,defaultChecked:l===void 0?n.defaultChecked:void 0,onChange:c=>{y(d,c.target.checked)},className:"visually-hidden",role:i==="radio"?"radio":void 0,"aria-checked":o,tabIndex:-1}),t.jsxs("label",{htmlFor:a,className:e.default["tedi-choice-group-item__label"],children:[C,u&&t.jsx(H.FeedbackText,{...u,id:a,className:e.default["tedi-choice-group-item__feedback-text"]})]})]})})})};exports.ChoiceGroupItem=_;exports.default=_;