schummar-table 1.0.0-beta.7 → 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
@@ -1606,19 +1631,22 @@ function SortComponent({ children }) {
1606
1631
  display: "grid",
1607
1632
  gridTemplateColumns: "minmax(0, 1fr) max-content",
1608
1633
  alignItems: "center",
1609
- cursor: "pointer",
1610
- "& > div": {
1611
- overflow: "hidden",
1612
- textOverflow: "ellipsis"
1613
- }
1634
+ cursor: "pointer"
1614
1635
  },
1615
1636
  onClick: (event) => toggle(event),
1616
1637
  onContextMenu: (event) => toggle(event, true),
1617
- children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { children }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Badge, {
1638
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
1639
+ css: {
1640
+ overflow: "hidden",
1641
+ textOverflow: "ellipsis"
1642
+ },
1643
+ children
1644
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Badge, {
1618
1645
  badgeContent: sortDisabled ? 0 : index,
1619
1646
  children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
1620
1647
  css: [
1621
1648
  {
1649
+ display: "inline-flex",
1622
1650
  transition: "all 300ms",
1623
1651
  fontSize: "0.8em"
1624
1652
  },