schummar-table 1.0.0-beta.8 → 1.0.0

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