@ballistix.digital/react-components 0.5.3 → 0.5.5

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
@@ -140,11 +140,13 @@ var toClassName = function () {
140
140
  }
141
141
  return values.filter(Boolean).join(' ');
142
142
  };
143
- var fromSelectMenuOptionToStringValue = function (options) {
144
- if (options === null || options === void 0 ? void 0 : options.length) {
145
- return options === null || options === void 0 ? void 0 : options.map(function (option) { return option === null || option === void 0 ? void 0 : option.value; });
143
+ var fromSelectMenuOptionToStringValue = function (value) {
144
+ if (value === null)
145
+ return null;
146
+ if (lodash.isArray(value)) {
147
+ return lodash.map(value, 'value');
146
148
  }
147
- return options === null || options === void 0 ? void 0 : options.value;
149
+ return value === null || value === void 0 ? void 0 : value.value;
148
150
  };
149
151
 
150
152
  var deepCopyObject = function (object) {
@@ -716,7 +718,7 @@ var InputGroupForm = function (props) {
716
718
  var styles = handleGenerateStyle();
717
719
  var invalidIcon = (jsxRuntime.jsx(solid.ExclamationCircleIcon, { className: "h-5 w-5 text-red-500", "aria-hidden": "true" }));
718
720
  return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsxs("div", { className: styles.head, children: [label && (jsxRuntime.jsx("label", { htmlFor: name, className: styles.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsxRuntime.jsx("span", { className: styles.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxRuntime.jsxs("div", { className: styles.body, children: [leading && jsxRuntime.jsx("div", { className: styles.leading, children: leading }), !htmlType ||
719
- (htmlType !== 'area' && (jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx("input", { type: mask$1 !== undefined ? 'text' : htmlType, ref: mask$1 && 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 && (jsxRuntime.jsx("div", { className: "right-5 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsxRuntime.jsx(IconElement, { accessor: "times", className: "text-gray-500" }) }))] }))), htmlType === 'area' && (jsxRuntime.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' && (jsxRuntime.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 && (jsxRuntime.jsx("div", { className: styles.trailing, children: trailing })), isTouched && !isValid && (jsxRuntime.jsx("div", { className: styles.trailing, children: invalidIcon }))] }), jsxRuntime.jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsxRuntime.jsx("p", { className: styles.description, children: description })), error && isTouched && jsxRuntime.jsx("p", { className: styles.error, children: error })] })] }));
721
+ (htmlType !== 'area' && (jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx("input", { type: mask$1 !== undefined ? 'text' : htmlType, ref: mask$1 && 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 && (jsxRuntime.jsx("div", { className: "right-5 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsxRuntime.jsx(IconElement, { accessor: "times", className: "text-gray-500" }) })), htmlType === 'date' && !trailing && isValid && onClear && (jsxRuntime.jsx("div", { className: "right-10 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsxRuntime.jsx(IconElement, { accessor: "times", className: "text-gray-500" }) }))] }))), htmlType === 'area' && (jsxRuntime.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' && (jsxRuntime.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 && (jsxRuntime.jsx("div", { className: styles.trailing, children: trailing })), isTouched && !isValid && (jsxRuntime.jsx("div", { className: styles.trailing, children: invalidIcon }))] }), jsxRuntime.jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsxRuntime.jsx("p", { className: styles.description, children: description })), error && isTouched && jsxRuntime.jsx("p", { className: styles.error, children: error })] })] }));
720
722
  };
721
723
 
722
724
  var base$k = {
@@ -1516,8 +1518,16 @@ var styles$g = {
1516
1518
 
1517
1519
  var getTableState = function (tableName) {
1518
1520
  var savedState = localStorage.getItem("TableList.".concat(tableName, ".state"));
1519
- if (savedState && isValidState(JSON.parse(savedState))) {
1520
- return JSON.parse(savedState);
1521
+ try {
1522
+ if (savedState && isValidState(JSON.parse(savedState))) {
1523
+ return JSON.parse(savedState);
1524
+ }
1525
+ }
1526
+ catch (e) {
1527
+ // Something went wrong with parsing the saved state; remove it and let the table use the default state
1528
+ console.error(e);
1529
+ localStorage.removeItem("TableList.".concat(tableName, ".state"));
1530
+ return undefined;
1521
1531
  }
1522
1532
  };
1523
1533
  var setTableState = function (tableName, state) {
@@ -1545,9 +1555,7 @@ var isValidState = function (state) {
1545
1555
 
1546
1556
  var TableList2 = function (props) {
1547
1557
  var _a, _b, _c, _d;
1548
- var id = props.id, config = props.table, head = props.head, foot = props.foot, isLoading = props.isLoading,
1549
- //onRowClick,
1550
- onChange = props.onChange, stylesOverrides = props.styles;
1558
+ 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;
1551
1559
  var _e = React.useState([]), sorting = _e[0], setSorting = _e[1];
1552
1560
  var _f = React.useState({}), columnVisibility = _f[0], setColumnVisibility = _f[1];
1553
1561
  var _g = React.useState([]), columnOrder = _g[0], setColumnOrder = _g[1];
@@ -1667,9 +1675,7 @@ var TableList2 = function (props) {
1667
1675
  .icon.container), "aria-hidden": "true" }) }))] }) }, header.id));
1668
1676
  }) }, headerGroup.id)); }) }), !isLoading && (jsxRuntime.jsx("tbody", { className: "border", children: table === null || table === void 0 ? void 0 : table.getRowModel().rows.map(function (row, index) {
1669
1677
  var _a;
1670
- return (jsxRuntime.jsx("tr", {
1671
- //onClick={() => onRowClick && onRowClick(row)}
1672
- className: toClassName(styles.body.table.body.row, ((_a = config.options) === null || _a === void 0 ? void 0 : _a.isStriped) &&
1678
+ return (jsxRuntime.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) &&
1673
1679
  index % 2 === 0 &&
1674
1680
  'bg-gray-50'), children: row.getVisibleCells().map(function (cell) {
1675
1681
  var _a, _b, _c;