@ballistix.digital/react-components 0.4.2 → 0.4.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 +11 -2
- package/dist/index.esm.js +19 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -338,7 +338,7 @@ var ButtonElement = function (props) {
|
|
|
338
338
|
return result;
|
|
339
339
|
};
|
|
340
340
|
var styles = handleGenerateStyle();
|
|
341
|
-
return (jsxRuntime.jsxs("button", __assign({ type: htmlType, className: styles.container, disabled: isDisabled || status !== 'idle', onClick: onClick, ref: innerRef }, { children: [status === 'idle' && children, status === 'loading' && (jsxRuntime.jsxs("div", __assign({ className: styles.content }, { children: [jsxRuntime.jsx(solid.ArrowPathIcon, { className: styles.spinner }), jsxRuntime.jsx("
|
|
341
|
+
return (jsxRuntime.jsxs("button", __assign({ type: htmlType, className: styles.container, disabled: isDisabled || status !== 'idle', onClick: onClick, ref: innerRef }, { children: [status === 'idle' && children, status === 'loading' && (jsxRuntime.jsxs("div", __assign({ className: styles.content }, { children: [jsxRuntime.jsx(solid.ArrowPathIcon, { className: styles.spinner }), jsxRuntime.jsx("div", { children: children })] }))), status === 'error' && (jsxRuntime.jsxs("div", __assign({ className: styles.content }, { children: [jsxRuntime.jsx(solid.ExclamationCircleIcon, { className: styles.icon }), jsxRuntime.jsx("div", { children: children })] }))), status === 'success' && (jsxRuntime.jsxs("div", __assign({ className: styles.content }, { children: [jsxRuntime.jsx(solid.CheckIcon, { className: styles.icon }), jsxRuntime.jsx("div", { children: children })] })))] })));
|
|
342
342
|
};
|
|
343
343
|
|
|
344
344
|
var base$g = {
|
|
@@ -547,7 +547,7 @@ var InputGroupForm = function (props) {
|
|
|
547
547
|
};
|
|
548
548
|
var styles = handleGenerateStyle();
|
|
549
549
|
var invalidIcon = (jsxRuntime.jsx(solid.ExclamationCircleIcon, { className: "h-5 w-5 text-red-500", "aria-hidden": "true" }));
|
|
550
|
-
return (jsxRuntime.jsxs("div", __assign({ className: styles.container }, { children: [jsxRuntime.jsxs("div", __assign({ className: styles.head }, { children: [label && (jsxRuntime.jsx("label", __assign({ htmlFor: name, className: styles.label }, { children: label }))), !required && !isRequired && (jsxRuntime.jsx("span", __assign({ className: styles.hint }, { children: "Optional" }))), required && required({ isRequired: isRequired })] })), jsxRuntime.jsxs("div", __assign({ className: styles.body }, { children: [leading && jsxRuntime.jsx("div", __assign({ className: styles.leading }, { children: leading })), jsxRuntime.jsx("input", { type: mask !== '' ? 'text' : htmlType, ref: mask && ref, name: name, id: name, className: styles.input, placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, 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", __assign({ className: styles.trailing }, { children: trailing }))), !isValid && jsxRuntime.jsx("div", __assign({ className: styles.trailing }, { children: invalidIcon }))] })), jsxRuntime.jsxs("div", __assign({ className: styles.foot }, { children: [description && !error && (jsxRuntime.jsx("p", __assign({ className: styles.description }, { children: description }))), error && isTouched && jsxRuntime.jsx("p", __assign({ className: styles.error }, { children: error }))] }))] })));
|
|
550
|
+
return (jsxRuntime.jsxs("div", __assign({ className: styles.container }, { children: [jsxRuntime.jsxs("div", __assign({ className: styles.head }, { children: [label && (jsxRuntime.jsx("label", __assign({ htmlFor: name, className: styles.label }, { children: label }))), !required && !isRequired && typeof label === 'string' && (jsxRuntime.jsx("span", __assign({ className: styles.hint }, { children: "Optional" }))), required && required({ isRequired: isRequired })] })), jsxRuntime.jsxs("div", __assign({ className: styles.body }, { children: [leading && jsxRuntime.jsx("div", __assign({ className: styles.leading }, { children: leading })), jsxRuntime.jsx("input", { type: mask !== '' ? 'text' : htmlType, ref: mask && ref, name: name, id: name, className: styles.input, placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, 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", __assign({ className: styles.trailing }, { children: trailing }))), !isValid && jsxRuntime.jsx("div", __assign({ className: styles.trailing }, { children: invalidIcon }))] })), jsxRuntime.jsxs("div", __assign({ className: styles.foot }, { children: [description && !error && (jsxRuntime.jsx("p", __assign({ className: styles.description }, { children: description }))), error && isTouched && jsxRuntime.jsx("p", __assign({ className: styles.error }, { children: error }))] }))] })));
|
|
551
551
|
};
|
|
552
552
|
|
|
553
553
|
var base$d = {
|
|
@@ -16878,7 +16878,7 @@ var PanelPaginationNavigation = function (props) {
|
|
|
16878
16878
|
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", __assign({ className: toClassName(styles.button.default, current === min && styles.button.active), onClick: function () { return handleChangeCurrent(min); } }, { children: min })), jsxRuntime.jsx("button", __assign({ className: toClassName(styles.button.default, current === min + 1 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 1); } }, { children: min + 1 })), jsxRuntime.jsx("button", __assign({ className: toClassName(styles.button.default, current === min + 2 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 2); } }, { children: min + 2 }))] }));
|
|
16879
16879
|
break;
|
|
16880
16880
|
}
|
|
16881
|
-
return (jsxRuntime.jsxs("div", __assign({ className: styles.container }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-1 justify-between sm:hidden" }, { children: [jsxRuntime.jsx("button", __assign({ className: toClassName(styles.mobile.button, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); } }, { children: "Previous" })), jsxRuntime.jsx("button", __assign({ className: toClassName(styles.mobile.button, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); } }, { children: "Next" }))] })), jsxRuntime.jsxs("div", __assign({ className: styles.desktop.container }, { children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx("
|
|
16881
|
+
return (jsxRuntime.jsxs("div", __assign({ className: styles.container }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-1 justify-between sm:hidden" }, { children: [jsxRuntime.jsx("button", __assign({ className: toClassName(styles.mobile.button, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); } }, { children: "Previous" })), jsxRuntime.jsx("button", __assign({ className: toClassName(styles.mobile.button, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); } }, { children: "Next" }))] })), jsxRuntime.jsxs("div", __assign({ className: styles.desktop.container }, { children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", __assign({ className: "text-sm text-gray-700" }, { children: children({ min: min, max: max, current: current }) })) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("nav", __assign({ className: styles.desktop.navigation, "aria-label": "Pagination" }, { children: [jsxRuntime.jsxs("button", __assign({ className: toClassName(styles.desktop.leftButton, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); } }, { children: [jsxRuntime.jsx("span", __assign({ className: styles.label }, { children: "Previous" })), jsxRuntime.jsx(solid.ChevronLeftIcon, { className: styles.icon, "aria-hidden": "true" })] })), component, jsxRuntime.jsxs("button", __assign({ className: toClassName(styles.desktop.rightButton, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); } }, { children: [jsxRuntime.jsx("span", __assign({ className: styles.label }, { children: "Next" })), jsxRuntime.jsx(solid.ChevronRightIcon, { className: styles.icon, "aria-hidden": "true" })] }))] })) })] }))] })));
|
|
16882
16882
|
};
|
|
16883
16883
|
|
|
16884
16884
|
var base$7 = {
|
|
@@ -16907,7 +16907,7 @@ var styles$8 = {
|
|
|
16907
16907
|
};
|
|
16908
16908
|
|
|
16909
16909
|
var TableList = function (props) {
|
|
16910
|
-
var id = props.id, columns = props.columns, data = props.data, page = props.page, children = props.children, _a = props.type, type = _a === void 0 ? 'normal' : _a, _b = props.isStriped, isStriped = _b === void 0 ? false : _b, _c = props.hasStickyHeader, hasStickyHeader = _c === void 0 ? false : _c, _d = props.hasVerticalSeparators, hasVerticalSeparators = _d === void 0 ? false : _d, _e = props.areControlsVisible, areControlsVisible = _e === void 0 ? true : _e, stylesOverrides = props.styles;
|
|
16910
|
+
var id = props.id, columns = props.columns, data = props.data, page = props.page, children = props.children, defaultOrder = props.defaultOrder, _a = props.type, type = _a === void 0 ? 'normal' : _a, _b = props.isStriped, isStriped = _b === void 0 ? false : _b, _c = props.hasStickyHeader, hasStickyHeader = _c === void 0 ? false : _c, _d = props.hasVerticalSeparators, hasVerticalSeparators = _d === void 0 ? false : _d, _e = props.areControlsVisible, areControlsVisible = _e === void 0 ? true : _e, stylesOverrides = props.styles, onChange = props.onChange;
|
|
16911
16911
|
var write = useExcel().write;
|
|
16912
16912
|
var handleGenerateStyle = function () {
|
|
16913
16913
|
var result = deepCopyObject(styles$7.base);
|
|
@@ -16936,6 +16936,12 @@ var TableList = function (props) {
|
|
|
16936
16936
|
onColumnVisibilityChange: setVisibility,
|
|
16937
16937
|
onColumnOrderChange: setOrder,
|
|
16938
16938
|
});
|
|
16939
|
+
n.useEffect(function () {
|
|
16940
|
+
if (sorting || visibility || order) {
|
|
16941
|
+
onChange && onChange({ sorting: sorting, visibility: visibility, order: order });
|
|
16942
|
+
}
|
|
16943
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16944
|
+
}, [sorting || visibility || order]);
|
|
16939
16945
|
var handleCalculateExcelTypeFromValue = function (value) {
|
|
16940
16946
|
var _a;
|
|
16941
16947
|
var result = 'string';
|
|
@@ -16982,8 +16988,7 @@ var TableList = function (props) {
|
|
|
16982
16988
|
var handleUpdateColumnOrder = n.useCallback(function (column, location) {
|
|
16983
16989
|
var _a;
|
|
16984
16990
|
var ids = (_a = table
|
|
16985
|
-
.getAllLeafColumns()
|
|
16986
|
-
.filter(function (column) { return column === null || column === void 0 ? void 0 : column.getCanSort(); })) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
16991
|
+
.getAllLeafColumns()) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
16987
16992
|
var currentIndexOfId = ids.findIndex(function (id) { return id === column.id; });
|
|
16988
16993
|
// Remove id from array.
|
|
16989
16994
|
ids.splice(currentIndexOfId, 1);
|
|
@@ -16996,6 +17001,9 @@ var TableList = function (props) {
|
|
|
16996
17001
|
var _a;
|
|
16997
17002
|
var state = window === null || window === void 0 ? void 0 : window.localStorage.getItem("TableList.".concat(id, ".state"));
|
|
16998
17003
|
if (!state) {
|
|
17004
|
+
if (defaultOrder && (defaultOrder === null || defaultOrder === void 0 ? void 0 : defaultOrder.length) > 0) {
|
|
17005
|
+
return setOrder(defaultOrder);
|
|
17006
|
+
}
|
|
16999
17007
|
return setOrder(columns.map(function (column) { var _a; return (_a = column === null || column === void 0 ? void 0 : column.id) !== null && _a !== void 0 ? _a : ''; }));
|
|
17000
17008
|
}
|
|
17001
17009
|
var savedColumnOrder = (_a = state === null || state === void 0 ? void 0 : state.split(',').map(function (id) { return id.replace('-', ''); })) !== null && _a !== void 0 ? _a : [];
|
|
@@ -17005,7 +17013,7 @@ var TableList = function (props) {
|
|
|
17005
17013
|
});
|
|
17006
17014
|
setOrder(savedColumnOrder);
|
|
17007
17015
|
setVisibility(savedColumnVisibility);
|
|
17008
|
-
}, [columns, id]);
|
|
17016
|
+
}, [columns, defaultOrder, id]);
|
|
17009
17017
|
// Save state to local storage when column visibility or order updates.
|
|
17010
17018
|
n.useEffect(function () {
|
|
17011
17019
|
var _a;
|
|
@@ -17013,8 +17021,7 @@ var TableList = function (props) {
|
|
|
17013
17021
|
var isMounted = order.length > 0;
|
|
17014
17022
|
if (isMounted && (order || visibility)) {
|
|
17015
17023
|
var ids = (_a = table
|
|
17016
|
-
.getAllLeafColumns()
|
|
17017
|
-
.filter(function (column) { return column === null || column === void 0 ? void 0 : column.getCanSort(); })) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
17024
|
+
.getAllLeafColumns()) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
17018
17025
|
var idsWithVisibilityIndicator = ids.map(function (id) {
|
|
17019
17026
|
// Hardcoding `false` here since `undefined` is allowed.
|
|
17020
17027
|
if (visibility[id] === false) {
|
|
@@ -17027,9 +17034,10 @@ var TableList = function (props) {
|
|
|
17027
17034
|
}, [id, table, order, visibility]);
|
|
17028
17035
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", __assign({ className: styles.container }, { children: [jsxRuntime.jsxs("div", __assign({ className: styles.controls.container }, { children: [jsxRuntime.jsx(DropdownElement.Container, __assign({ styles: stylesOverrides === null || stylesOverrides === void 0 ? void 0 : stylesOverrides.components.dropdownElement, label: jsxRuntime.jsx(outline$2.ViewColumnsIcon, { className: "w-6 h-6" }) }, { children: jsxRuntime.jsx("div", __assign({ className: styles.controls.content }, { children: table
|
|
17029
17036
|
.getAllLeafColumns()
|
|
17030
|
-
.filter(
|
|
17037
|
+
// .filter((column) => column?.getCanSort())
|
|
17031
17038
|
.map(function (column, index) {
|
|
17032
|
-
|
|
17039
|
+
var canSort = column === null || column === void 0 ? void 0 : column.getCanSort();
|
|
17040
|
+
return (jsxRuntime.jsx(DropdownElement.Item, { children: function () { return (jsxRuntime.jsxs("div", __assign({ className: toClassName(styles.controls.dropdown.container, !canSort && 'hidden') }, { children: [jsxRuntime.jsx("input", { className: styles.controls.dropdown.input, type: "checkbox", checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler() }), jsxRuntime.jsx("label", __assign({ className: styles.controls.dropdown.label }, { children: column.columnDef.header })), jsxRuntime.jsxs("div", __assign({ className: styles.controls.dropdown.actions }, { children: [jsxRuntime.jsx(outline$2.ChevronDownIcon, { className: styles.controls.dropdown.upIcon, onClick: function () {
|
|
17033
17041
|
return handleUpdateColumnOrder(column, index - 1);
|
|
17034
17042
|
} }), jsxRuntime.jsx(outline$2.ChevronDownIcon, { className: styles.controls.dropdown.downIcon, onClick: function () {
|
|
17035
17043
|
return handleUpdateColumnOrder(column, index + 1);
|