schummar-table 1.0.0-beta.8 → 1.0.0-beta.9

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.
package/dist/index.cjs CHANGED
@@ -1294,6 +1294,25 @@ function ExpandControl({ itemId, expanded, hasChildren, hasDeferredChildren }) {
1294
1294
  });
1295
1295
  }
1296
1296
  //#endregion
1297
+ //#region src/components/catchClicks.tsx
1298
+ const wrapperCss = (0, _emotion_react.css)({ display: "contents" });
1299
+ /** Rows may be wrapped in links. Theme checkboxes only guarantee that clicks on the input itself
1300
+ * toggle; a click on their padding would reach the link instead. */
1301
+ function CatchClicks({ onToggle, children }) {
1302
+ const libraryClass = require_useTheme.useLibraryClassName();
1303
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
1304
+ className: libraryClass(wrapperCss),
1305
+ onClick: (event) => {
1306
+ event.stopPropagation();
1307
+ if (!(event.target instanceof HTMLInputElement)) {
1308
+ event.preventDefault();
1309
+ onToggle(event);
1310
+ }
1311
+ },
1312
+ children
1313
+ });
1314
+ }
1315
+ //#endregion
1297
1316
  //#region src/components/selectComponent.tsx
1298
1317
  const checkboxCss = (0, _emotion_react.css)({
1299
1318
  justifySelf: "start",
@@ -1304,10 +1323,13 @@ const SelectComponent = (0, react.memo)(function SelectComponent({ itemId }) {
1304
1323
  const Checkbox = require_useTheme.useTheme((t) => t.components.Checkbox);
1305
1324
  const overrideClass = require_useTheme.useUserClassName();
1306
1325
  const actions = useTableActions();
1307
- return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Checkbox, {
1308
- className: overrideClass(checkboxCss),
1309
- checked: selected,
1310
- onChange: (event) => actions.toggleSelection(itemId, { range: event.nativeEvent.shiftKey })
1326
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(CatchClicks, {
1327
+ onToggle: (event) => actions.toggleSelection(itemId, { range: event.shiftKey }),
1328
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Checkbox, {
1329
+ className: overrideClass(checkboxCss),
1330
+ checked: selected,
1331
+ onChange: (event) => actions.toggleSelection(itemId, { range: event.nativeEvent.shiftKey })
1332
+ })
1311
1333
  });
1312
1334
  });
1313
1335
  function SelectAll() {
@@ -1315,10 +1337,13 @@ function SelectAll() {
1315
1337
  const overrideClass = require_useTheme.useUserClassName();
1316
1338
  const { activeItems, selection, actions } = useTableContext();
1317
1339
  const selected = activeItems.length > 0 && activeItems.every((item) => selection.has(item.id));
1318
- return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Checkbox, {
1319
- className: overrideClass(checkboxCss),
1320
- checked: selected,
1321
- onChange: () => actions.toggleSelection(void 0)
1340
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(CatchClicks, {
1341
+ onToggle: () => actions.toggleSelection(void 0),
1342
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Checkbox, {
1343
+ className: overrideClass(checkboxCss),
1344
+ checked: selected,
1345
+ onChange: () => actions.toggleSelection(void 0)
1346
+ })
1322
1347
  });
1323
1348
  }
1324
1349
  //#endregion