@paubox/ui 0.16.0 → 0.16.1

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/index.esm.js CHANGED
@@ -22275,6 +22275,10 @@ var DatePicker = function(_param) {
22275
22275
  });
22276
22276
  };
22277
22277
 
22278
+ var formatForId = function(str) {
22279
+ return str.replace(' ', '-').replace(/[^a-zA-Z0-9\s]/g, '').toLowerCase();
22280
+ };
22281
+
22278
22282
  function _array_like_to_array$h(arr, len) {
22279
22283
  if (len == null || len > arr.length) len = arr.length;
22280
22284
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -22369,7 +22373,7 @@ function _unsupported_iterable_to_array$h(o, minLen) {
22369
22373
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$h(o, minLen);
22370
22374
  }
22371
22375
  var DropdownMenu = function(param) {
22372
- var label = param.label, _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, iconLeft = param.iconLeft, align = param.align, _param_color = param.color, color = _param_color === void 0 ? 'primary' : _param_color;
22376
+ var label = param.label, _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, iconLeft = param.iconLeft, align = param.align, _param_color = param.color, color = _param_color === void 0 ? 'primary' : _param_color, _param_testId = param.testId, testId = _param_testId === void 0 ? 'dropdown' : _param_testId;
22373
22377
  var _useState = _sliced_to_array$e(useState(false), 2), open = _useState[0], setOpen = _useState[1];
22374
22378
  var buttonRef = useRef(null);
22375
22379
  return /*#__PURE__*/ jsxs(Fragment, {
@@ -22384,6 +22388,7 @@ var DropdownMenu = function(param) {
22384
22388
  return !prev;
22385
22389
  });
22386
22390
  },
22391
+ "data-testid": "".concat(testId, "-button"),
22387
22392
  children: label
22388
22393
  }),
22389
22394
  /*#__PURE__*/ jsx(Popper, {
@@ -22405,7 +22410,8 @@ var DropdownMenu = function(param) {
22405
22410
  item.onClick(e);
22406
22411
  }
22407
22412
  setOpen(false);
22408
- }
22413
+ },
22414
+ "data-testid": "".concat(testId, "-").concat(formatForId(item.label), "-menu-item")
22409
22415
  }), item.label);
22410
22416
  })
22411
22417
  })
@@ -28798,7 +28804,7 @@ function _templateObject2$5() {
28798
28804
  }
28799
28805
  function _templateObject3$4() {
28800
28806
  var data = _tagged_template_literal$9([
28801
- "\n overflow-y: visible;\n"
28807
+ "\n overflow-y: scroll;\n"
28802
28808
  ]);
28803
28809
  _templateObject3$4 = function _templateObject() {
28804
28810
  return data;
@@ -28870,7 +28876,7 @@ var Modal = function(param) {
28870
28876
  "label"
28871
28877
  ]);
28872
28878
  return /*#__PURE__*/ jsx(Button, _object_spread_props$7(_object_spread$9({
28873
- "data-testid": "".concat(testId, "-").concat(label.replace(' ', '-').toLowerCase(), "-button")
28879
+ "data-testid": "".concat(testId, "-").concat(formatForId(label), "-button")
28874
28880
  }, rest), {
28875
28881
  children: label
28876
28882
  }));
@@ -33577,7 +33583,7 @@ var TableHeader = function(param) {
33577
33583
  width: (actionHeaders === null || actionHeaders === void 0 ? void 0 : actionHeaders.includes(header === null || header === void 0 ? void 0 : header.id)) ? "".concat(header.getSize(), "px") : '100%',
33578
33584
  cursor: header.column.getCanSort() ? 'pointer' : 'default'
33579
33585
  },
33580
- "data-testid": header.column.getCanSort() ? "".concat(testId, "-column-header-").concat(header.id.replace(' ', '-').toLowerCase(), "-sort-button") : undefined,
33586
+ "data-testid": header.column.getCanSort() ? "".concat(testId, "-column-header-").concat(formatForId(header.id), "-sort-button") : undefined,
33581
33587
  children: [
33582
33588
  flexRender(header.column.columnDef.header, header.getContext()),
33583
33589
  header.column.getCanSort() && /*#__PURE__*/ jsxs(SortIcon, {
@@ -33798,7 +33804,7 @@ var ContextMenuCell = function(param) {
33798
33804
  }
33799
33805
  },
33800
33806
  label: action.label,
33801
- "data-testid": "".concat(testId, "-row-").concat(row.id, "-context-menu-").concat(action.label.replace(' ', '-').toLowerCase(), "-button")
33807
+ "data-testid": "".concat(testId, "-row-").concat(row.id, "-context-menu-").concat(formatForId(action.label), "-button")
33802
33808
  }, index);
33803
33809
  })
33804
33810
  })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@paubox/ui",
3
3
  "author": "Paubox, Inc.",
4
4
  "description": "Paubox Component Library",
5
- "version": "0.16.0",
5
+ "version": "0.16.1",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "publishConfig": {
@@ -5,5 +5,6 @@ export interface DropdownMenuProps {
5
5
  iconLeft?: React.ElementType;
6
6
  align?: 'left' | 'center' | 'right';
7
7
  color?: 'primary' | 'secondary';
8
+ testId?: string;
8
9
  }
9
- export declare const DropdownMenu: ({ label, items, iconLeft, align, color, }: DropdownMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
10
+ export declare const DropdownMenu: ({ label, items, iconLeft, align, color, testId, }: DropdownMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './string';
@@ -0,0 +1 @@
1
+ export declare const formatForId: (str: string) => string;