@ballistix.digital/react-components 0.5.3 → 0.5.4

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.d.ts CHANGED
@@ -182,13 +182,13 @@ type TInputGroupFormProps = {
182
182
  onClear?: never;
183
183
  trailing?: string | ReactNode;
184
184
  } | {
185
- htmlType: 'text';
185
+ htmlType: 'text' | 'date';
186
186
  onChange: ChangeEventHandler<HTMLInputElement>;
187
187
  onBlur: FocusEventHandler<HTMLInputElement>;
188
188
  onClear?: () => void;
189
189
  trailing?: never;
190
190
  } | {
191
- htmlType: Exclude<HTMLInputTypeAttribute, 'text'>;
191
+ htmlType: Exclude<HTMLInputTypeAttribute, 'text' | 'date'>;
192
192
  onChange: ChangeEventHandler<HTMLInputElement>;
193
193
  onBlur: FocusEventHandler<HTMLInputElement>;
194
194
  onClear?: never;
package/dist/index.esm.js CHANGED
@@ -714,7 +714,7 @@ var InputGroupForm = function (props) {
714
714
  var styles = handleGenerateStyle();
715
715
  var invalidIcon = (jsx(ExclamationCircleIcon, { className: "h-5 w-5 text-red-500", "aria-hidden": "true" }));
716
716
  return (jsxs("div", { className: styles.container, children: [jsxs("div", { className: styles.head, children: [label && (jsx("label", { htmlFor: name, className: styles.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsx("span", { className: styles.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxs("div", { className: styles.body, children: [leading && jsx("div", { className: styles.leading, children: leading }), !htmlType ||
717
- (htmlType !== 'area' && (jsxs("div", { className: "flex items-center", children: [jsx("input", { type: mask !== undefined ? 'text' : htmlType, ref: mask && ref, name: name, id: name, className: toClassName(styles.input, htmlType === 'color' && '!h-10'), placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, min: min, max: max, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur }), htmlType === 'text' && !trailing && isValid && onClear && (jsx("div", { className: "right-5 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsx(IconElement, { accessor: "times", className: "text-gray-500" }) }))] }))), htmlType === 'area' && (jsx("textarea", { rows: rows, name: name, id: name, className: styles.input, placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur })), type === 'floored' && (jsx("div", { className: "absolute inset-x-0 bottom-0 border-t border-gray-300 peer-focus:border-t-2 peer-focus:border-primary-600", "aria-hidden": "true" })), trailing && isValid && (jsx("div", { className: styles.trailing, children: trailing })), isTouched && !isValid && (jsx("div", { className: styles.trailing, children: invalidIcon }))] }), jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsx("p", { className: styles.description, children: description })), error && isTouched && jsx("p", { className: styles.error, children: error })] })] }));
717
+ (htmlType !== 'area' && (jsxs("div", { className: "flex items-center", children: [jsx("input", { type: mask !== undefined ? 'text' : htmlType, ref: mask && ref, name: name, id: name, className: toClassName(styles.input, htmlType === 'color' && '!h-10'), placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, min: min, max: max, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur }), htmlType === 'text' && !trailing && isValid && onClear && (jsx("div", { className: "right-5 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsx(IconElement, { accessor: "times", className: "text-gray-500" }) })), htmlType === 'date' && !trailing && isValid && onClear && (jsx("div", { className: "right-10 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsx(IconElement, { accessor: "times", className: "text-gray-500" }) }))] }))), htmlType === 'area' && (jsx("textarea", { rows: rows, name: name, id: name, className: styles.input, placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur })), type === 'floored' && (jsx("div", { className: "absolute inset-x-0 bottom-0 border-t border-gray-300 peer-focus:border-t-2 peer-focus:border-primary-600", "aria-hidden": "true" })), trailing && isValid && (jsx("div", { className: styles.trailing, children: trailing })), isTouched && !isValid && (jsx("div", { className: styles.trailing, children: invalidIcon }))] }), jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsx("p", { className: styles.description, children: description })), error && isTouched && jsx("p", { className: styles.error, children: error })] })] }));
718
718
  };
719
719
 
720
720
  var base$k = {
@@ -1514,8 +1514,16 @@ var styles$g = {
1514
1514
 
1515
1515
  var getTableState = function (tableName) {
1516
1516
  var savedState = localStorage.getItem("TableList.".concat(tableName, ".state"));
1517
- if (savedState && isValidState(JSON.parse(savedState))) {
1518
- return JSON.parse(savedState);
1517
+ try {
1518
+ if (savedState && isValidState(JSON.parse(savedState))) {
1519
+ return JSON.parse(savedState);
1520
+ }
1521
+ }
1522
+ catch (e) {
1523
+ // Something went wrong with parsing the saved state; remove it and let the table use the default state
1524
+ console.error(e);
1525
+ localStorage.removeItem("TableList.".concat(tableName, ".state"));
1526
+ return undefined;
1519
1527
  }
1520
1528
  };
1521
1529
  var setTableState = function (tableName, state) {
@@ -1543,9 +1551,7 @@ var isValidState = function (state) {
1543
1551
 
1544
1552
  var TableList2 = function (props) {
1545
1553
  var _a, _b, _c, _d;
1546
- var id = props.id, config = props.table, head = props.head, foot = props.foot, isLoading = props.isLoading,
1547
- //onRowClick,
1548
- onChange = props.onChange, stylesOverrides = props.styles;
1554
+ var id = props.id, config = props.table, head = props.head, foot = props.foot, isLoading = props.isLoading, onRowClick = props.onRowClick, onChange = props.onChange, stylesOverrides = props.styles;
1549
1555
  var _e = useState([]), sorting = _e[0], setSorting = _e[1];
1550
1556
  var _f = useState({}), columnVisibility = _f[0], setColumnVisibility = _f[1];
1551
1557
  var _g = useState([]), columnOrder = _g[0], setColumnOrder = _g[1];
@@ -1665,9 +1671,7 @@ var TableList2 = function (props) {
1665
1671
  .icon.container), "aria-hidden": "true" }) }))] }) }, header.id));
1666
1672
  }) }, headerGroup.id)); }) }), !isLoading && (jsx("tbody", { className: "border", children: table === null || table === void 0 ? void 0 : table.getRowModel().rows.map(function (row, index) {
1667
1673
  var _a;
1668
- return (jsx("tr", {
1669
- //onClick={() => onRowClick && onRowClick(row)}
1670
- className: toClassName(styles.body.table.body.row, ((_a = config.options) === null || _a === void 0 ? void 0 : _a.isStriped) &&
1674
+ return (jsx("tr", { onClick: function () { return onRowClick && onRowClick(row); }, className: toClassName(styles.body.table.body.row, ((_a = config.options) === null || _a === void 0 ? void 0 : _a.isStriped) &&
1671
1675
  index % 2 === 0 &&
1672
1676
  'bg-gray-50'), children: row.getVisibleCells().map(function (cell) {
1673
1677
  var _a, _b, _c;