@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.d.ts +2 -2
- package/dist/index.esm.js +20 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
2
|
import { ArrowPathIcon, ChevronDownIcon, EllipsisVerticalIcon, ExclamationCircleIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronUpDownIcon, HomeIcon, ArrowLongLeftIcon, ArrowLongRightIcon } from '@heroicons/react/20/solid';
|
|
3
|
-
import { set, get, noop as noop$1, indexOf, pick, isEmpty, some, forEach, assign
|
|
3
|
+
import { isArray, map, set, get, noop as noop$1, indexOf, pick, isEmpty, some, forEach, assign } from 'lodash';
|
|
4
4
|
import get$1 from 'lodash/get';
|
|
5
5
|
import React, { useState, useMemo, Children, Fragment, useEffect, useCallback, forwardRef, useImperativeHandle, useRef, useReducer, createElement, PureComponent, Component } from 'react';
|
|
6
6
|
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
@@ -138,11 +138,13 @@ var toClassName = function () {
|
|
|
138
138
|
}
|
|
139
139
|
return values.filter(Boolean).join(' ');
|
|
140
140
|
};
|
|
141
|
-
var fromSelectMenuOptionToStringValue = function (
|
|
142
|
-
if (
|
|
143
|
-
return
|
|
141
|
+
var fromSelectMenuOptionToStringValue = function (value) {
|
|
142
|
+
if (value === null)
|
|
143
|
+
return null;
|
|
144
|
+
if (isArray(value)) {
|
|
145
|
+
return map(value, 'value');
|
|
144
146
|
}
|
|
145
|
-
return
|
|
147
|
+
return value === null || value === void 0 ? void 0 : value.value;
|
|
146
148
|
};
|
|
147
149
|
|
|
148
150
|
var deepCopyObject = function (object) {
|
|
@@ -714,7 +716,7 @@ var InputGroupForm = function (props) {
|
|
|
714
716
|
var styles = handleGenerateStyle();
|
|
715
717
|
var invalidIcon = (jsx(ExclamationCircleIcon, { className: "h-5 w-5 text-red-500", "aria-hidden": "true" }));
|
|
716
718
|
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 })] })] }));
|
|
719
|
+
(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
720
|
};
|
|
719
721
|
|
|
720
722
|
var base$k = {
|
|
@@ -1514,8 +1516,16 @@ var styles$g = {
|
|
|
1514
1516
|
|
|
1515
1517
|
var getTableState = function (tableName) {
|
|
1516
1518
|
var savedState = localStorage.getItem("TableList.".concat(tableName, ".state"));
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
+
try {
|
|
1520
|
+
if (savedState && isValidState(JSON.parse(savedState))) {
|
|
1521
|
+
return JSON.parse(savedState);
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
catch (e) {
|
|
1525
|
+
// Something went wrong with parsing the saved state; remove it and let the table use the default state
|
|
1526
|
+
console.error(e);
|
|
1527
|
+
localStorage.removeItem("TableList.".concat(tableName, ".state"));
|
|
1528
|
+
return undefined;
|
|
1519
1529
|
}
|
|
1520
1530
|
};
|
|
1521
1531
|
var setTableState = function (tableName, state) {
|
|
@@ -1543,9 +1553,7 @@ var isValidState = function (state) {
|
|
|
1543
1553
|
|
|
1544
1554
|
var TableList2 = function (props) {
|
|
1545
1555
|
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;
|
|
1556
|
+
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
1557
|
var _e = useState([]), sorting = _e[0], setSorting = _e[1];
|
|
1550
1558
|
var _f = useState({}), columnVisibility = _f[0], setColumnVisibility = _f[1];
|
|
1551
1559
|
var _g = useState([]), columnOrder = _g[0], setColumnOrder = _g[1];
|
|
@@ -1665,9 +1673,7 @@ var TableList2 = function (props) {
|
|
|
1665
1673
|
.icon.container), "aria-hidden": "true" }) }))] }) }, header.id));
|
|
1666
1674
|
}) }, headerGroup.id)); }) }), !isLoading && (jsx("tbody", { className: "border", children: table === null || table === void 0 ? void 0 : table.getRowModel().rows.map(function (row, index) {
|
|
1667
1675
|
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) &&
|
|
1676
|
+
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
1677
|
index % 2 === 0 &&
|
|
1672
1678
|
'bg-gray-50'), children: row.getVisibleCells().map(function (cell) {
|
|
1673
1679
|
var _a, _b, _c;
|