@telia/teddy 0.7.30 → 0.7.31
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.
|
@@ -146,6 +146,12 @@ const Item$2 = React.forwardRef(
|
|
|
146
146
|
const context = React.useContext(ItemContext$1);
|
|
147
147
|
const ref = utils_composeRefs.useComposedRefs(forwardedRef, context == null ? void 0 : context.triggerRef);
|
|
148
148
|
const id = props.id || (context == null ? void 0 : context.id);
|
|
149
|
+
const handleCardClick = (event) => {
|
|
150
|
+
if (disabled || !onCheckedChange) return;
|
|
151
|
+
const target = event.target;
|
|
152
|
+
if (target.closest("input, button, a")) return;
|
|
153
|
+
onCheckedChange(!checked);
|
|
154
|
+
};
|
|
149
155
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
150
156
|
"div",
|
|
151
157
|
{
|
|
@@ -156,6 +162,16 @@ const Item$2 = React.forwardRef(
|
|
|
156
162
|
"data-state": checked ? "checked" : "unchecked",
|
|
157
163
|
"data-disabled": disabled ? "" : void 0,
|
|
158
164
|
"aria-checked": checked,
|
|
165
|
+
onClick: handleCardClick,
|
|
166
|
+
role: "checkbox",
|
|
167
|
+
tabIndex: disabled ? -1 : 0,
|
|
168
|
+
onKeyDown: (event) => {
|
|
169
|
+
if (disabled || !onCheckedChange) return;
|
|
170
|
+
if (event.key === " " || event.key === "Enter") {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
onCheckedChange(!checked);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
159
175
|
children: [
|
|
160
176
|
imageUrl ? /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { className: clsx([components_checkboxCardGroup_checkboxCardGroupRoot.styles[`${components_checkboxCardGroup_checkboxCardGroupRoot.rootClassName}__illustration`]], className), justify: "center", align: "center", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: imageUrl, alt: value }) }) : null,
|
|
161
177
|
/* @__PURE__ */ jsxRuntime.jsx(Content$2, { children: React.Children.map(children, (child) => {
|
|
@@ -125,6 +125,12 @@ const Item$2 = React__default.forwardRef(
|
|
|
125
125
|
const context = React__default.useContext(ItemContext$1);
|
|
126
126
|
const ref = useComposedRefs(forwardedRef, context == null ? void 0 : context.triggerRef);
|
|
127
127
|
const id = props.id || (context == null ? void 0 : context.id);
|
|
128
|
+
const handleCardClick = (event) => {
|
|
129
|
+
if (disabled || !onCheckedChange) return;
|
|
130
|
+
const target = event.target;
|
|
131
|
+
if (target.closest("input, button, a")) return;
|
|
132
|
+
onCheckedChange(!checked);
|
|
133
|
+
};
|
|
128
134
|
return /* @__PURE__ */ jsxs(
|
|
129
135
|
"div",
|
|
130
136
|
{
|
|
@@ -135,6 +141,16 @@ const Item$2 = React__default.forwardRef(
|
|
|
135
141
|
"data-state": checked ? "checked" : "unchecked",
|
|
136
142
|
"data-disabled": disabled ? "" : void 0,
|
|
137
143
|
"aria-checked": checked,
|
|
144
|
+
onClick: handleCardClick,
|
|
145
|
+
role: "checkbox",
|
|
146
|
+
tabIndex: disabled ? -1 : 0,
|
|
147
|
+
onKeyDown: (event) => {
|
|
148
|
+
if (disabled || !onCheckedChange) return;
|
|
149
|
+
if (event.key === " " || event.key === "Enter") {
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
onCheckedChange(!checked);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
138
154
|
children: [
|
|
139
155
|
imageUrl ? /* @__PURE__ */ jsx(Flex, { className: clsx([styles$2[`${rootClassName$2}__illustration`]], className), justify: "center", align: "center", children: /* @__PURE__ */ jsx("img", { src: imageUrl, alt: value }) }) : null,
|
|
140
156
|
/* @__PURE__ */ jsx(Content$2, { children: React__default.Children.map(children, (child) => {
|