@ballistix.digital/react-components 0.5.5 → 0.5.6
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.esm.js +21 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +21 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -717,8 +717,9 @@ var InputGroupForm = function (props) {
|
|
|
717
717
|
};
|
|
718
718
|
var styles = handleGenerateStyle();
|
|
719
719
|
var invalidIcon = (jsxRuntime.jsx(solid.ExclamationCircleIcon, { className: "h-5 w-5 text-red-500", "aria-hidden": "true" }));
|
|
720
|
+
var isClearable = !trailing && isValid && onClear && value !== '' && value;
|
|
720
721
|
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 ||
|
|
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' &&
|
|
722
|
+
(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' && isClearable && (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' && isClearable && (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 })] })] }));
|
|
722
723
|
};
|
|
723
724
|
|
|
724
725
|
var base$k = {
|
|
@@ -1207,13 +1208,13 @@ var PanelPaginationNavigation = function (props) {
|
|
|
1207
1208
|
}, [onChange]);
|
|
1208
1209
|
var pageType = React.useMemo(function () {
|
|
1209
1210
|
var result = 'center';
|
|
1210
|
-
if (current < min +
|
|
1211
|
+
if (current < min + 2) {
|
|
1211
1212
|
result = 'first';
|
|
1212
1213
|
}
|
|
1213
|
-
if (current > max -
|
|
1214
|
+
if (current > max - 2) {
|
|
1214
1215
|
result = 'last';
|
|
1215
1216
|
}
|
|
1216
|
-
if (max <=
|
|
1217
|
+
if (max <= 4) {
|
|
1217
1218
|
result = 'simple';
|
|
1218
1219
|
}
|
|
1219
1220
|
return result;
|
|
@@ -1224,13 +1225,13 @@ var PanelPaginationNavigation = function (props) {
|
|
|
1224
1225
|
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min && styles.button.active), onClick: function () { return handleChangeCurrent(min); }, children: min }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 1 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 1); }, children: min + 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 2 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 2); }, children: min + 2 }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(max); }, children: max })] }));
|
|
1225
1226
|
break;
|
|
1226
1227
|
case 'center':
|
|
1227
|
-
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(min); }, children: min }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(current - 1); }, children: current - 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, styles.button.active), onClick: function () { return handleChangeCurrent(current); }, children: current }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(current + 1); }, children: current + 1 }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(max); }, children: max })] }));
|
|
1228
|
+
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(min); }, children: min }), current - 2 !== min && jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(current - 1); }, children: current - 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, styles.button.active), onClick: function () { return handleChangeCurrent(current); }, children: current }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(current + 1); }, children: current + 1 }), current + 2 !== max && jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(max); }, children: max })] }));
|
|
1228
1229
|
break;
|
|
1229
1230
|
case 'last':
|
|
1230
1231
|
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return handleChangeCurrent(min); }, children: min }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === max - 2 && styles.button.active), onClick: function () { return handleChangeCurrent(max - 2); }, children: max - 2 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === max - 1 && styles.button.active), onClick: function () { return handleChangeCurrent(max - 1); }, children: max - 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === max && styles.button.active), onClick: function () { return handleChangeCurrent(max); }, children: max })] }));
|
|
1231
1232
|
break;
|
|
1232
1233
|
case 'simple':
|
|
1233
|
-
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min && styles.button.active), onClick: function () { return handleChangeCurrent(min); }, children: min }), max >= min + 1 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 1 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 1); }, children: min + 1 })), max >= min + 2 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 2 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 2); }, children: min + 2 }))] }));
|
|
1234
|
+
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min && styles.button.active), onClick: function () { return handleChangeCurrent(min); }, children: min }), max >= min + 1 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 1 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 1); }, children: min + 1 })), max >= min + 2 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 2 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 2); }, children: min + 2 })), max >= min + 3 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 3 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 3); }, children: min + 3 }))] }));
|
|
1234
1235
|
break;
|
|
1235
1236
|
}
|
|
1236
1237
|
return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsxs("div", { className: "flex flex-1 justify-between sm:hidden", children: [jsxRuntime.jsx("button", { className: toClassName(styles.mobile.button, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); }, children: "Previous" }), jsxRuntime.jsx("button", { className: toClassName(styles.mobile.button, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); }, children: "Next" })] }), jsxRuntime.jsxs("div", { className: styles.desktop.container, children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: children && children({ min: min, max: max, current: current }) }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("nav", { className: styles.desktop.navigation, "aria-label": "Pagination", children: [jsxRuntime.jsxs("button", { className: toClassName(styles.desktop.leftButton, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); }, children: [jsxRuntime.jsx("span", { className: styles.label, children: "Previous" }), jsxRuntime.jsx(solid.ChevronLeftIcon, { className: styles.icon, "aria-hidden": "true" })] }), component, jsxRuntime.jsxs("button", { className: toClassName(styles.desktop.rightButton, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); }, children: [jsxRuntime.jsx("span", { className: styles.label, children: "Next" }), jsxRuntime.jsx(solid.ChevronRightIcon, { className: styles.icon, "aria-hidden": "true" })] })] }) })] })] }));
|
|
@@ -1883,12 +1884,15 @@ var PagePaginationNavigation = function (props) {
|
|
|
1883
1884
|
var styles = handleGenerateStyle();
|
|
1884
1885
|
var pageType = React.useMemo(function () {
|
|
1885
1886
|
var result = 'center';
|
|
1886
|
-
if (current < min +
|
|
1887
|
+
if (current < min + 2) {
|
|
1887
1888
|
result = 'first';
|
|
1888
1889
|
}
|
|
1889
|
-
if (current > max -
|
|
1890
|
+
if (current > max - 2) {
|
|
1890
1891
|
result = 'last';
|
|
1891
1892
|
}
|
|
1893
|
+
if (max <= 4) {
|
|
1894
|
+
result = 'simple';
|
|
1895
|
+
}
|
|
1892
1896
|
return result;
|
|
1893
1897
|
}, [current, min, max]);
|
|
1894
1898
|
var component;
|
|
@@ -1897,11 +1901,14 @@ var PagePaginationNavigation = function (props) {
|
|
|
1897
1901
|
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min && styles.button.active), onClick: function () { return setCurrent(min); }, children: min }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 1 && styles.button.active), onClick: function () { return setCurrent(min + 1); }, children: min + 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 2 && styles.button.active), onClick: function () { return setCurrent(min + 2); }, children: min + 2 }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(max); }, children: max })] }));
|
|
1898
1902
|
break;
|
|
1899
1903
|
case 'center':
|
|
1900
|
-
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(min); }, children: min }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(current - 1); }, children: current - 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, styles.button.active), onClick: function () { return setCurrent(current); }, children: current }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(current + 1); }, children: current + 1 }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(max); }, children: max })] }));
|
|
1904
|
+
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(min); }, children: min }), current - 2 !== min && jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(current - 1); }, children: current - 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, styles.button.active), onClick: function () { return setCurrent(current); }, children: current }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(current + 1); }, children: current + 1 }), current + 2 !== max && jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(max); }, children: max })] }));
|
|
1901
1905
|
break;
|
|
1902
1906
|
case 'last':
|
|
1903
1907
|
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: styles.button.default, onClick: function () { return setCurrent(min); }, children: min }), jsxRuntime.jsx("span", { className: styles.divider, children: "..." }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === max - 2 && styles.button.active), onClick: function () { return setCurrent(max - 2); }, children: max - 2 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === max - 1 && styles.button.active), onClick: function () { return setCurrent(max - 1); }, children: max - 1 }), jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === max && styles.button.active), onClick: function () { return setCurrent(max); }, children: max })] }));
|
|
1904
1908
|
break;
|
|
1909
|
+
case 'simple':
|
|
1910
|
+
component = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min && styles.button.active), onClick: function () { return setCurrent(min); }, children: min }), max >= min + 1 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 1 && styles.button.active), onClick: function () { return setCurrent(min + 1); }, children: min + 1 })), max >= min + 2 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 2 && styles.button.active), onClick: function () { return setCurrent(min + 2); }, children: min + 2 })), max >= min + 3 && (jsxRuntime.jsx("button", { className: toClassName(styles.button.default, current === min + 3 && styles.button.active), onClick: function () { return setCurrent(min + 3); }, children: min + 3 }))] }));
|
|
1911
|
+
break;
|
|
1905
1912
|
}
|
|
1906
1913
|
React.useEffect(function () {
|
|
1907
1914
|
if (current) {
|
|
@@ -2618,15 +2625,16 @@ var DateMenuForm = function (props) {
|
|
|
2618
2625
|
return isEmpty ? (jsxRuntime.jsx(IconElement, { accessor: "calendar" })) : (jsxRuntime.jsx(IconElement, { accessor: "xmark", className: "text-black" }));
|
|
2619
2626
|
} : _h, required = props.required, defaultValue = props.value, error = props.error, _j = props.type, type = _j === void 0 ? 'normal' : _j, _k = props.isRequired, isRequired = _k === void 0 ? false : _k, _l = props.isTouched, isTouched = _l === void 0 ? false : _l, isDisabled = props.isDisabled, _m = props.isSolo, isSolo = _m === void 0 ? false : _m, _o = props.isRanged, isRanged = _o === void 0 ? false : _o, onChange = props.onChange, onClear = props.onClear, onBlur = props.onBlur, stylesOverrides = props.styles;
|
|
2620
2627
|
var isValid = error === undefined;
|
|
2621
|
-
var _p = React.useState(
|
|
2622
|
-
var _q = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : {
|
|
2628
|
+
var _p = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : {
|
|
2623
2629
|
startDate: null,
|
|
2624
2630
|
endDate: null,
|
|
2625
|
-
}), state =
|
|
2631
|
+
}), state = _p[0], setState = _p[1];
|
|
2626
2632
|
var handleValueChange = function (newValue) {
|
|
2627
2633
|
setState(newValue);
|
|
2628
2634
|
onChange && onChange(newValue);
|
|
2629
|
-
|
|
2635
|
+
setTimeout(function () {
|
|
2636
|
+
onBlur && onBlur();
|
|
2637
|
+
}, 50);
|
|
2630
2638
|
};
|
|
2631
2639
|
var handleGenerateStyle = function () {
|
|
2632
2640
|
var result = deepCopyObject(styles$5.base);
|
|
@@ -2644,13 +2652,6 @@ var DateMenuForm = function (props) {
|
|
|
2644
2652
|
}
|
|
2645
2653
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2646
2654
|
}, [state]);
|
|
2647
|
-
// Simulate onBlur event.
|
|
2648
|
-
React.useEffect(function () {
|
|
2649
|
-
if (!isFocus) {
|
|
2650
|
-
onBlur && onBlur();
|
|
2651
|
-
}
|
|
2652
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2653
|
-
}, [isFocus]);
|
|
2654
2655
|
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.container, children: [jsxRuntime.jsx(Datepicker, { inputName: name, inputId: name, i18n: i18n, useRange: size === 'expanded', placeholder: placeholder, asSingle: !isRanged, separator: separator, startFrom: startFrom, displayFormat: displayFormat, disabled: isDisabled, popoverDirection: direction, minDate: minDate, maxDate: maxDate, toggleIcon: icon,
|
|
2655
2656
|
//
|
|
2656
2657
|
value: state,
|