@jobber/components 6.46.0 → 6.47.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.
@@ -244,7 +244,7 @@ interface BaseDataListItemActionsProps<T extends DataListObject> {
244
244
  /**
245
245
  * Callback when an item is clicked.
246
246
  */
247
- readonly onClick?: (item: T) => void;
247
+ readonly onClick?: (item: T, event?: React.MouseEvent<HTMLElement>) => void;
248
248
  }
249
249
  export interface DataListBulkActionsProps {
250
250
  /**
@@ -30,8 +30,8 @@ function DataListItemClickableInternal({ onClick, url, to, children, }) {
30
30
  } }, children));
31
31
  }
32
32
  return React.createElement(React.Fragment, null, children);
33
- function handleClick() {
34
- activeItem && (onClick === null || onClick === void 0 ? void 0 : onClick(activeItem));
33
+ function handleClick(evt) {
34
+ activeItem && (onClick === null || onClick === void 0 ? void 0 : onClick(activeItem, evt));
35
35
  }
36
36
  }
37
37
 
@@ -28,8 +28,8 @@ function DataListItemClickableInternal({ onClick, url, to, children, }) {
28
28
  } }, children));
29
29
  }
30
30
  return React__default.createElement(React__default.Fragment, null, children);
31
- function handleClick() {
32
- activeItem && (onClick === null || onClick === void 0 ? void 0 : onClick(activeItem));
31
+ function handleClick(evt) {
32
+ activeItem && (onClick === null || onClick === void 0 ? void 0 : onClick(activeItem, evt));
33
33
  }
34
34
  }
35
35
 
package/dist/index.cjs CHANGED
@@ -187,7 +187,18 @@ require('./AtlantisPortalContent-cjs.js');
187
187
  require('@jobber/formatters');
188
188
  require('react-dom/client');
189
189
 
190
-
190
+ /**
191
+ * Checks if the event is a plain left click
192
+ * @param evt - The event to check
193
+ * @returns True if the event is a plain left click, false otherwise
194
+ */
195
+ function isNormalClick(evt) {
196
+ return (evt.button === 0 &&
197
+ !evt.metaKey &&
198
+ !evt.ctrlKey &&
199
+ !evt.shiftKey &&
200
+ !evt.altKey);
201
+ }
191
202
 
192
203
  exports.AnimatedPresence = AnimatedPresence.AnimatedPresence;
193
204
  exports.AnimatedSwitcher = AnimatedSwitcher.AnimatedSwitcher;
@@ -229,8 +240,8 @@ exports.DataDump = DataDump.DataDump;
229
240
  exports.DataList = DataList.DataList;
230
241
  exports.DataTable = DataTable.DataTable;
231
242
  Object.defineProperty(exports, "createColumnHelper", {
232
- enumerable: true,
233
- get: function () { return reactTable.createColumnHelper; }
243
+ enumerable: true,
244
+ get: function () { return reactTable.createColumnHelper; }
234
245
  });
235
246
  exports.DatePicker = DatePicker.DatePicker;
236
247
  exports.DescriptionList = DescriptionList.DescriptionList;
@@ -303,12 +314,12 @@ exports.RadioGroup = RadioGroup.RadioGroup;
303
314
  exports.RadioOption = RadioGroup.RadioOption;
304
315
  exports.RecurringSelect = RecurringSelect.RecurringSelect;
305
316
  Object.defineProperty(exports, "DurationPeriod", {
306
- enumerable: true,
307
- get: function () { return DayOfMonthSelect.DurationPeriod; }
317
+ enumerable: true,
318
+ get: function () { return DayOfMonthSelect.DurationPeriod; }
308
319
  });
309
320
  Object.defineProperty(exports, "WeekDay", {
310
- enumerable: true,
311
- get: function () { return DayOfMonthSelect.WeekDay; }
321
+ enumerable: true,
322
+ get: function () { return DayOfMonthSelect.WeekDay; }
312
323
  });
313
324
  exports.ResponsiveSwitcher = ResponsiveSwitcher.ResponsiveSwitcher;
314
325
  exports.Option = Select_index.Option;
@@ -339,3 +350,4 @@ exports.Toast = showToast.Toast;
339
350
  exports.showToast = showToast.showToast;
340
351
  exports.Tooltip = Tooltip.Tooltip;
341
352
  exports.Typography = Typography.Typography;
353
+ exports.isNormalClick = isNormalClick;
package/dist/index.d.mts CHANGED
@@ -85,3 +85,4 @@ export * from "./Tiles";
85
85
  export * from "./Toast";
86
86
  export * from "./Tooltip";
87
87
  export * from "./Typography";
88
+ export * from "./utils/isNormalClick";
package/dist/index.d.ts CHANGED
@@ -85,3 +85,4 @@ export * from "./Tiles";
85
85
  export * from "./Toast";
86
86
  export * from "./Tooltip";
87
87
  export * from "./Typography";
88
+ export * from "./utils/isNormalClick";
package/dist/index.mjs CHANGED
@@ -184,3 +184,18 @@ import 'axios';
184
184
  import './AtlantisPortalContent-es.js';
185
185
  import '@jobber/formatters';
186
186
  import 'react-dom/client';
187
+
188
+ /**
189
+ * Checks if the event is a plain left click
190
+ * @param evt - The event to check
191
+ * @returns True if the event is a plain left click, false otherwise
192
+ */
193
+ function isNormalClick(evt) {
194
+ return (evt.button === 0 &&
195
+ !evt.metaKey &&
196
+ !evt.ctrlKey &&
197
+ !evt.shiftKey &&
198
+ !evt.altKey);
199
+ }
200
+
201
+ export { isNormalClick };