@commonsku/styles 1.17.25 → 1.17.27
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.cjs +38 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +38 -34
- package/dist/index.mjs.map +1 -1
- package/dist/styles/DateRangeDropdown.d.ts +4 -4
- package/dist/styles/DateRangeDropdown.d.ts.map +1 -1
- package/dist/styles/Popup.d.ts +2 -2
- package/dist/styles/Popup.d.ts.map +1 -1
- package/dist/styles/tables/VirtualTable.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -945,7 +945,7 @@ declare const Overlay: styled_components.StyledComponent<"div", any, {
|
|
|
945
945
|
}, never>;
|
|
946
946
|
declare const PopupHeader: styled_components.StyledComponent<"div", any, SharedStyleTypes & SizerTypes, never>;
|
|
947
947
|
type PopupProps = React__default.PropsWithChildren<{
|
|
948
|
-
header?: React__default.
|
|
948
|
+
header?: React__default.ReactNode;
|
|
949
949
|
noHeader?: boolean;
|
|
950
950
|
title?: string | React__default.Component;
|
|
951
951
|
controls?: Array<React__default.ReactNode>;
|
|
@@ -963,7 +963,7 @@ type PopupProps = React__default.PropsWithChildren<{
|
|
|
963
963
|
PopupWindowComponent?: React__default.ComponentType<React__default.ComponentPropsWithRef<any>>;
|
|
964
964
|
} & SharedStyleTypes> & React__default.HTMLAttributes<HTMLDivElement>;
|
|
965
965
|
declare const Popup: React__default.ForwardRefExoticComponent<{
|
|
966
|
-
header?: React__default.
|
|
966
|
+
header?: React__default.ReactNode;
|
|
967
967
|
noHeader?: boolean | undefined;
|
|
968
968
|
title?: string | React__default.Component<{}, {}, any> | undefined;
|
|
969
969
|
controls?: React__default.ReactNode[] | undefined;
|
|
@@ -2517,7 +2517,7 @@ declare const DateRangePicker: React__default.ForwardRefExoticComponent<Omit<Dat
|
|
|
2517
2517
|
presets?: DateRangePreset[] | undefined;
|
|
2518
2518
|
} & React__default.RefAttributes<HTMLDivElement>>;
|
|
2519
2519
|
|
|
2520
|
-
interface DateRangeInputProps extends Omit<InputProps,
|
|
2520
|
+
interface DateRangeInputProps extends Omit<InputProps, "onChange"> {
|
|
2521
2521
|
isClearable: boolean;
|
|
2522
2522
|
selected: DateRange;
|
|
2523
2523
|
dateFormat: string;
|
package/dist/index.mjs
CHANGED
|
@@ -7285,7 +7285,7 @@ function InputStepper(props) {
|
|
|
7285
7285
|
var templateObject_1$c, templateObject_2$1, templateObject_3, templateObject_4;
|
|
7286
7286
|
|
|
7287
7287
|
var VirtualTable = function (props) {
|
|
7288
|
-
var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ?
|
|
7288
|
+
var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ? "" : _j, NoRowsFound = props.NoRowsFound, renderRowSubComponent = props.renderRowSubComponent; props.onResize; var rowGroupStyles = props.rowGroupStyles, rowStyles = props.rowStyles, _k = props.gutterSize, gutterSize = _k === void 0 ? 0 : _k, _l = props.customTableFooterProps, customTableFooterProps = _l === void 0 ? {} : _l, TableFooter = props.TableFooter, onSortChange = props.onSortChange;
|
|
7289
7289
|
var defaultColumn = useMemo(function () { return ({
|
|
7290
7290
|
minWidth: minWidth,
|
|
7291
7291
|
maxWidth: maxWidth,
|
|
@@ -7398,7 +7398,7 @@ var VirtualTable = function (props) {
|
|
|
7398
7398
|
var sortIconDirection = function (column) { return column.isSorted
|
|
7399
7399
|
? sortDirection(column)
|
|
7400
7400
|
: "updown"; };
|
|
7401
|
-
return (React.createElement("div", __assign({}, tableHeaderProps, { className: "thead ".concat(tableHeaderProps.className || ""), style: __assign(__assign({}, (tableHeaderProps.style || {})), (hideHeader ? { display: "none" } : {})) }), headerGroups.map(function (headerGroup) { return (React.createElement("div", __assign({}, getHeaderGroupProps(headerGroup, false), { ref: headerRef, style: { width: tableWidth } }), headerGroup.headers.map(function (column) { return (React.createElement("div", __assign({}, getHeaderProps(column, false), {
|
|
7401
|
+
return (React.createElement("div", __assign({}, tableHeaderProps, { className: "thead ".concat(tableHeaderProps.className || ""), style: __assign(__assign({}, (tableHeaderProps.style || {})), (hideHeader ? { display: "none" } : {})) }), headerGroups.map(function (headerGroup) { return (React.createElement("div", __assign({}, getHeaderGroupProps(headerGroup, false), { ref: headerRef, style: { width: tableWidth } }), headerGroup.headers.map(function (column) { return (React.createElement("div", __assign({}, getHeaderProps(column, false), { onClick: function () { return handleSort(column); } }),
|
|
7402
7402
|
column.render("Header"),
|
|
7403
7403
|
React.createElement("span", null, column.canSort && (React.createElement(FilledChevronIcon, { direction: sortIconDirection(column), size: "medium", style: { verticalAlign: "middle" } }))))); }))); })));
|
|
7404
7404
|
}, [
|
|
@@ -7413,6 +7413,12 @@ var VirtualTable = function (props) {
|
|
|
7413
7413
|
useEffect(function () {
|
|
7414
7414
|
onSortChange && onSortChange({ sortBy: sortBy });
|
|
7415
7415
|
}, [sortBy]);
|
|
7416
|
+
var scrollToTop = useCallback(function () {
|
|
7417
|
+
listRef.current && listRef.current.scrollTo(0);
|
|
7418
|
+
}, []);
|
|
7419
|
+
useEffect(function () {
|
|
7420
|
+
scrollToTop();
|
|
7421
|
+
}, [data, scrollToTop]);
|
|
7416
7422
|
return (React.createElement("div", __assign({}, getTableProps(), { className: "table ".concat(className || '') }),
|
|
7417
7423
|
renderTableHeader(),
|
|
7418
7424
|
React.createElement("div", __assign({ className: "tbody" }, getTableBodyProps()), rows.length === 0 && NoRowsFound ? React.createElement(NoRowsFound, null) :
|
|
@@ -7576,21 +7582,21 @@ var DateRangePicker = forwardRef(function (_a, ref) {
|
|
|
7576
7582
|
});
|
|
7577
7583
|
|
|
7578
7584
|
var dropdownStyles = {
|
|
7579
|
-
position:
|
|
7580
|
-
marginTop:
|
|
7581
|
-
padding:
|
|
7582
|
-
background:
|
|
7583
|
-
border:
|
|
7584
|
-
borderRadius:
|
|
7585
|
-
borderColor:
|
|
7585
|
+
position: "absolute",
|
|
7586
|
+
marginTop: "1rem",
|
|
7587
|
+
padding: "1rem",
|
|
7588
|
+
background: "#fff",
|
|
7589
|
+
border: "2px solid",
|
|
7590
|
+
borderRadius: "5px",
|
|
7591
|
+
borderColor: "var(--color-primary1-60)",
|
|
7586
7592
|
zIndex: 1,
|
|
7587
7593
|
};
|
|
7588
7594
|
var inputStyles = {
|
|
7589
|
-
fontStyle:
|
|
7590
|
-
cursor:
|
|
7591
|
-
position:
|
|
7592
|
-
top:
|
|
7593
|
-
right:
|
|
7595
|
+
fontStyle: "normal",
|
|
7596
|
+
cursor: "pointer",
|
|
7597
|
+
position: "absolute",
|
|
7598
|
+
top: "8px",
|
|
7599
|
+
right: "4px",
|
|
7594
7600
|
};
|
|
7595
7601
|
var formatDateRange = function (_a, dateFormat) {
|
|
7596
7602
|
var startDate = _a.startDate, endDate = _a.endDate;
|
|
@@ -7603,23 +7609,32 @@ var formatDateRange = function (_a, dateFormat) {
|
|
|
7603
7609
|
else if (endDate != null) {
|
|
7604
7610
|
return "Until ".concat(format(endDate, dateFormat));
|
|
7605
7611
|
}
|
|
7606
|
-
return
|
|
7612
|
+
return "";
|
|
7613
|
+
};
|
|
7614
|
+
var getDateInputText = function (dateRange, dateFormat, presets) {
|
|
7615
|
+
if (presets != null) {
|
|
7616
|
+
var preset = presets.find(function (preset) { return preset.name === dateRange.category; });
|
|
7617
|
+
if (preset) {
|
|
7618
|
+
return preset.label;
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
return formatDateRange(dateRange, dateFormat);
|
|
7607
7622
|
};
|
|
7608
7623
|
var DateRangeInput = function (_a) {
|
|
7609
7624
|
var value = _a.value, error = _a.error, noMargin = _a.noMargin, onClick = _a.onClick, isClearable = _a.isClearable; _a.selected; _a.dateFormat; var onInputSelect = _a.onInputSelect, props = __rest(_a, ["value", "error", "noMargin", "onClick", "isClearable", "selected", "dateFormat", "onInputSelect"]);
|
|
7610
|
-
return (React.createElement("div", { style: { position:
|
|
7625
|
+
return (React.createElement("div", { style: { position: "relative" } },
|
|
7611
7626
|
React.createElement(Input, __assign({ readOnly: true, onFocus: onInputSelect, value: value, onClick: onClick, noMargin: noMargin, error: error, type: "text", autoComplete: "off" }, props)),
|
|
7612
|
-
React.createElement("span", { style: inputStyles, onClick: onClick }, !isClearable &&
|
|
7613
|
-
React.createElement(CalendarIcon, { style: { width: '1.9rem', verticalAlign: 'middle' } }))));
|
|
7627
|
+
React.createElement("span", { style: inputStyles, onClick: onClick }, !isClearable && (React.createElement(CalendarIcon, { style: { width: "1.9rem", verticalAlign: "middle" } })))));
|
|
7614
7628
|
};
|
|
7615
7629
|
var DateRangeDropdown = function (props) {
|
|
7616
|
-
var onChange = props.onChange, presets = props.presets, dateText = props.dateText, range = props.range, error = props.error, _a = props.isClearable, isClearable = _a === void 0 ? false : _a, _b = props.dateFormat, dateFormat = _b === void 0 ?
|
|
7630
|
+
var onChange = props.onChange, presets = props.presets, dateText = props.dateText, range = props.range, error = props.error, _a = props.isClearable, isClearable = _a === void 0 ? false : _a, _b = props.dateFormat, dateFormat = _b === void 0 ? "yyyy-MM-dd" : _b, placeholder = props.placeholder, placeholderText = props.placeholderText, _c = props.style, style = _c === void 0 ? dropdownStyles : _c;
|
|
7617
7631
|
var _d = useState(false), open = _d[0], setOpen = _d[1];
|
|
7618
|
-
var _e = useState(), defaultDateText = _e[0], setDefaultDateText = _e[1];
|
|
7632
|
+
var _e = useState(getDateInputText(range, dateFormat, presets)), defaultDateText = _e[0], setDefaultDateText = _e[1];
|
|
7619
7633
|
var datepickerRef = useRef(null);
|
|
7620
7634
|
useEffect(function () {
|
|
7621
7635
|
var handleExternalClick = function (e) {
|
|
7622
|
-
if (datepickerRef.current != null &&
|
|
7636
|
+
if (datepickerRef.current != null &&
|
|
7637
|
+
!datepickerRef.current.contains(e.target)) {
|
|
7623
7638
|
setOpen(false);
|
|
7624
7639
|
}
|
|
7625
7640
|
};
|
|
@@ -7630,22 +7645,11 @@ var DateRangeDropdown = function (props) {
|
|
|
7630
7645
|
if (onChange != null) {
|
|
7631
7646
|
onChange(range, event);
|
|
7632
7647
|
}
|
|
7633
|
-
|
|
7634
|
-
presets.find(function (preset) { return preset.name === range.category; });
|
|
7635
|
-
if (preset && preset != null) {
|
|
7636
|
-
setDefaultDateText(preset.label);
|
|
7637
|
-
}
|
|
7638
|
-
else if (range.category === 'custom') {
|
|
7639
|
-
setDefaultDateText(formatDateRange(range, dateFormat));
|
|
7640
|
-
}
|
|
7641
|
-
else {
|
|
7642
|
-
setDefaultDateText('');
|
|
7643
|
-
}
|
|
7648
|
+
setDefaultDateText(getDateInputText(range, dateFormat, presets));
|
|
7644
7649
|
}, [dateFormat, onChange, presets]);
|
|
7645
7650
|
return (React.createElement(React.Fragment, null,
|
|
7646
7651
|
React.createElement(DateRangeInput, { noMargin: true, value: dateText != null ? dateText : defaultDateText, onInputSelect: function () { return setOpen(true); }, error: error, isClearable: isClearable, selected: range, dateFormat: dateFormat, placeholder: placeholder || placeholderText || "Select a date range..." }),
|
|
7647
|
-
open &&
|
|
7648
|
-
React.createElement(DateRangePicker, __assign({}, props, { ref: datepickerRef, style: style, onChange: handleChange }))));
|
|
7652
|
+
open && (React.createElement(DateRangePicker, __assign({}, props, { ref: datepickerRef, style: style, onChange: handleChange })))));
|
|
7649
7653
|
};
|
|
7650
7654
|
|
|
7651
7655
|
var psuedoSelectors = {
|