@tedi-design-system/react 19.1.2-rc.1 → 19.1.2-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,104 +1,98 @@
1
- import { jsx as s, jsxs as _, Fragment as H } from "react/jsx-runtime";
2
- import u from "../../../../../../../external/classnames/index.es.js";
3
- import L from "react";
4
- import { Checkbox as S } from "../../../checkbox/checkbox.es.js";
5
- import { FeedbackText as V } from "../../../feedback-text/feedback-text.es.js";
6
- import { Radio as q } from "../../../radio/radio.es.js";
7
- import { ChoiceGroupContext as z } from "../../choice-group-context.es.js";
1
+ import { jsx as d, jsxs as v, Fragment as M } from "react/jsx-runtime";
2
+ import m from "../../../../../../../external/classnames/index.es.js";
3
+ import R from "react";
4
+ import { Checkbox as T } from "../../../checkbox/checkbox.es.js";
5
+ import { FeedbackText as H } from "../../../feedback-text/feedback-text.es.js";
6
+ import { Radio as L } from "../../../radio/radio.es.js";
7
+ import { ChoiceGroupContext as S } from "../../choice-group-context.es.js";
8
8
  import e from "./choice-group-item.module.scss.es.js";
9
- import { useBreakpointProps as D } from "../../../../../helpers/hooks/use-breakpoint-props.es.js";
10
- import { Col as J } from "../../../../layout/grid/col.es.js";
11
- const oe = (l) => {
12
- const { getCurrentBreakpointProps: $ } = D(l.defaultServerBreakpoint), {
13
- id: c,
9
+ import { useBreakpointProps as V } from "../../../../../helpers/hooks/use-breakpoint-props.es.js";
10
+ import { Col as q } from "../../../../layout/grid/col.es.js";
11
+ const te = (n) => {
12
+ const { getCurrentBreakpointProps: x } = V(n.defaultServerBreakpoint), {
13
+ id: o,
14
14
  label: C,
15
- value: r,
16
- className: B,
17
- direction: h,
18
- disabled: a,
19
- colProps: I = h === "column" ? { width: 12 } : { width: "auto" },
15
+ value: c,
16
+ className: $,
17
+ direction: u,
18
+ disabled: r,
19
+ colProps: B = u === "column" ? { width: 12 } : { width: "auto" },
20
20
  onChange: p,
21
- hideLabel: j,
22
- helper: d,
23
- tooltip: w,
24
- type: t = "radio",
25
- variant: m = "default",
26
- color: E = "primary",
27
- layout: F,
28
- showIndicator: b,
29
- justifyContent: y = "start"
30
- } = $(l), { currentValue: n, name: v, onChange: f, inputType: G } = L.useContext(z), o = Array.isArray(n) ? n.includes(r) : r === n, P = n === void 0 ? l.defaultChecked : o, x = (i, k) => {
31
- f == null || f(i, k), p == null || p(i, k);
32
- }, R = u(
33
- e[`tedi-choice-group-item--${F === "separated" ? "separated" : "segmented"}`],
34
- h && e[`tedi-choice-group-item--${h}`]
35
- ), A = u(
21
+ hideLabel: I,
22
+ helper: t,
23
+ tooltip: j,
24
+ type: h = "radio",
25
+ variant: l = "default",
26
+ color: w = "primary",
27
+ layout: E,
28
+ showIndicator: k,
29
+ justifyContent: b = "start"
30
+ } = x(n), { currentValue: a, name: y, onChange: f, inputType: F } = R.useContext(S), s = Array.isArray(a) ? a.includes(c) : c === a, G = a === void 0 ? n.defaultChecked : s, N = (i, g) => {
31
+ f == null || f(i, g), p == null || p(i, g);
32
+ }, P = m(
33
+ e[`tedi-choice-group-item--${E === "separated" ? "separated" : "segmented"}`],
34
+ u && e[`tedi-choice-group-item--${u}`]
35
+ ), A = m(
36
36
  e["tedi-choice-group-item"],
37
- e[`tedi-choice-group-item--${m}`],
38
- e[`tedi-choice-group-item--${m}-${E}`],
39
- b && e["tedi-choice-group-item--indicator"],
40
- t && e[`tedi-choice-group-item--${t}`],
41
- { [e["tedi-choice-group-item--disabled"]]: a },
42
- { [e["tedi-choice-group-item--checked"]]: o },
43
- { [`justify-content-${y}`]: y }
44
- ), M = t === "radio" ? q : S, T = (i) => {
45
- var N;
46
- a || m !== "card" || i.target.closest("input, label") || (N = document.getElementById(c)) == null || N.click();
47
- }, g = t === "radio";
48
- return /* @__PURE__ */ s(J, { ...I, className: R, children: /* @__PURE__ */ s(
49
- "div",
37
+ e[`tedi-choice-group-item--${l}`],
38
+ e[`tedi-choice-group-item--${l}-${w}`],
39
+ k && e["tedi-choice-group-item--indicator"],
40
+ h && e[`tedi-choice-group-item--${h}`],
41
+ { [e["tedi-choice-group-item--disabled"]]: r },
42
+ { [e["tedi-choice-group-item--checked"]]: s },
43
+ { [`justify-content-${b}`]: b }
44
+ );
45
+ return /* @__PURE__ */ d(q, { ...B, className: P, children: /* @__PURE__ */ d("div", { className: A, onClick: (i) => {
46
+ var _;
47
+ r || l !== "card" || i.target.closest("input, label") || (_ = document.getElementById(o)) == null || _.click();
48
+ }, "aria-disabled": r || void 0, children: l === "default" || k ? /* @__PURE__ */ d(
49
+ h === "radio" ? L : T,
50
50
  {
51
- className: A,
52
- tabIndex: g || a ? -1 : 0,
53
- onClick: T,
54
- role: g ? void 0 : t,
55
- "aria-checked": g ? void 0 : o,
56
- children: m === "default" || b ? /* @__PURE__ */ s(
57
- M,
51
+ id: o,
52
+ label: C,
53
+ value: c,
54
+ name: y,
55
+ className: m(e["tedi-choice-group-item__indicator"], $),
56
+ disabled: r,
57
+ checked: s,
58
+ defaultChecked: G,
59
+ onChange: N,
60
+ hideLabel: I,
61
+ helper: t ? { ...t, className: m(e["tedi-choice-group-item__feedback-text"], t.className) } : void 0,
62
+ tooltip: j,
63
+ "data-testid": "choice-group-item-indicator"
64
+ }
65
+ ) : /* @__PURE__ */ v(M, { children: [
66
+ /* @__PURE__ */ d(
67
+ "input",
68
+ {
69
+ id: o,
70
+ value: c,
71
+ name: y,
72
+ type: F,
73
+ disabled: r,
74
+ checked: s,
75
+ defaultChecked: a === void 0 ? n.defaultChecked : void 0,
76
+ onChange: (i) => {
77
+ N(c, i.target.checked);
78
+ },
79
+ className: "visually-hidden"
80
+ }
81
+ ),
82
+ /* @__PURE__ */ v("label", { htmlFor: o, className: e["tedi-choice-group-item__label"], children: [
83
+ C,
84
+ t && /* @__PURE__ */ d(
85
+ H,
58
86
  {
59
- id: c,
60
- label: C,
61
- value: r,
62
- name: v,
63
- className: u(e["tedi-choice-group-item__indicator"], B),
64
- disabled: a,
65
- checked: o,
66
- defaultChecked: P,
67
- onChange: x,
68
- hideLabel: j,
69
- helper: d ? { ...d, className: u(e["tedi-choice-group-item__feedback-text"], d.className) } : void 0,
70
- tooltip: w,
71
- "data-testid": "choice-group-item-indicator"
87
+ ...t,
88
+ id: t.id ?? `${o}-helper`,
89
+ className: e["tedi-choice-group-item__feedback-text"]
72
90
  }
73
- ) : /* @__PURE__ */ _(H, { children: [
74
- /* @__PURE__ */ s(
75
- "input",
76
- {
77
- id: c,
78
- value: r,
79
- name: v,
80
- type: G,
81
- disabled: a,
82
- checked: o,
83
- defaultChecked: n === void 0 ? l.defaultChecked : void 0,
84
- onChange: (i) => {
85
- x(r, i.target.checked);
86
- },
87
- className: "visually-hidden",
88
- role: t === "radio" ? "radio" : void 0,
89
- "aria-checked": o,
90
- tabIndex: -1
91
- }
92
- ),
93
- /* @__PURE__ */ _("label", { htmlFor: c, className: e["tedi-choice-group-item__label"], children: [
94
- C,
95
- d && /* @__PURE__ */ s(V, { ...d, id: c, className: e["tedi-choice-group-item__feedback-text"] })
96
- ] })
97
- ] })
98
- }
99
- ) });
91
+ )
92
+ ] })
93
+ ] }) }) });
100
94
  };
101
95
  export {
102
- oe as ChoiceGroupItem,
103
- oe as default
96
+ te as ChoiceGroupItem,
97
+ te as default
104
98
  };