@coreui/react 4.3.0 → 4.3.1
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/README.md +1 -1
- package/dist/components/table/CTable.d.ts +1 -1
- package/dist/components/table/CTableDataCell.d.ts +5 -1
- package/dist/components/table/CTableResponsiveWrapper.d.ts +9 -0
- package/dist/components/table/CTableRow.d.ts +1 -1
- package/dist/index.es.js +40 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +40 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/alert/__tests__/__snapshots__/CAlert.spec.tsx.snap +1 -0
- package/src/components/button/__tests__/__snapshots__/CButtonClose.spec.tsx.snap +2 -0
- package/src/components/close-button/__tests__/__snapshots__/CCloseButton.spec.tsx.snap +2 -0
- package/src/components/form/__tests__/__snapshots__/CFormTextarea.spec.tsx.snap +1 -0
- package/src/components/modal/__tests__/__snapshots__/CModalHeader.spec.tsx.snap +2 -0
- package/src/components/table/CTable.tsx +56 -65
- package/src/components/table/CTableDataCell.tsx +5 -1
- package/src/components/table/CTableResponsiveWrapper.tsx +39 -0
- package/src/components/table/CTableRow.tsx +1 -1
- package/src/components/table/__tests__/CTable.spec.tsx +45 -0
- package/src/components/table/__tests__/__snapshots__/CTable.spec.tsx.snap +86 -2
- package/src/components/toast/CToast.tsx +1 -1
- package/src/components/toast/__tests__/__snapshots__/CToast.spec.tsx.snap +0 -13
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
Several quick start options are available:
|
|
48
48
|
|
|
49
|
-
- [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.
|
|
49
|
+
- [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.3.1.zip)
|
|
50
50
|
- Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
|
|
51
51
|
- Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
|
|
52
52
|
- Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
|
|
@@ -9,7 +9,7 @@ export interface CTableProps extends Omit<TableHTMLAttributes<HTMLTableElement>,
|
|
|
9
9
|
/**
|
|
10
10
|
* Set the vertical aligment.
|
|
11
11
|
*/
|
|
12
|
-
align?: 'bottom' | 'middle' | 'top';
|
|
12
|
+
align?: 'bottom' | 'middle' | 'top' | string;
|
|
13
13
|
/**
|
|
14
14
|
* Sets the border color of the component to one of CoreUI’s themed colors.
|
|
15
15
|
*
|
|
@@ -8,7 +8,7 @@ export interface CTableDataCellProps extends Omit<TdHTMLAttributes<HTMLTableCell
|
|
|
8
8
|
/**
|
|
9
9
|
* Set the vertical aligment.
|
|
10
10
|
*/
|
|
11
|
-
align?: 'bottom' | 'middle' | 'top';
|
|
11
|
+
align?: 'bottom' | 'middle' | 'top' | string;
|
|
12
12
|
/**
|
|
13
13
|
* A string of all className you want applied to the component.
|
|
14
14
|
*/
|
|
@@ -19,5 +19,9 @@ export interface CTableDataCellProps extends Omit<TdHTMLAttributes<HTMLTableCell
|
|
|
19
19
|
* @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
|
|
20
20
|
*/
|
|
21
21
|
color?: Colors;
|
|
22
|
+
/**
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
colSpan?: number;
|
|
22
26
|
}
|
|
23
27
|
export declare const CTableDataCell: React.ForwardRefExoticComponent<CTableDataCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
export interface CTableResponsiveWrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: any;
|
|
4
|
+
/**
|
|
5
|
+
* Make any table responsive across all viewports or pick a maximum breakpoint with which to have a responsive table up to.
|
|
6
|
+
*/
|
|
7
|
+
responsive?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
8
|
+
}
|
|
9
|
+
export declare const CTableResponsiveWrapper: FC<CTableResponsiveWrapperProps>;
|
|
@@ -8,7 +8,7 @@ export interface CTableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
|
8
8
|
/**
|
|
9
9
|
* Set the vertical aligment.
|
|
10
10
|
*/
|
|
11
|
-
align?: 'bottom' | 'middle' | 'top';
|
|
11
|
+
align?: 'bottom' | 'middle' | 'top' | string;
|
|
12
12
|
/**
|
|
13
13
|
* A string of all className you want applied to the component.
|
|
14
14
|
*/
|
package/dist/index.es.js
CHANGED
|
@@ -1334,7 +1334,7 @@ CAccordionItem.propTypes = {
|
|
|
1334
1334
|
CAccordionItem.displayName = 'CAccordionItem';
|
|
1335
1335
|
|
|
1336
1336
|
function _extends() {
|
|
1337
|
-
_extends = Object.assign
|
|
1337
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1338
1338
|
for (var i = 1; i < arguments.length; i++) {
|
|
1339
1339
|
var source = arguments[i];
|
|
1340
1340
|
|
|
@@ -1347,7 +1347,6 @@ function _extends() {
|
|
|
1347
1347
|
|
|
1348
1348
|
return target;
|
|
1349
1349
|
};
|
|
1350
|
-
|
|
1351
1350
|
return _extends.apply(this, arguments);
|
|
1352
1351
|
}
|
|
1353
1352
|
|
|
@@ -1367,11 +1366,10 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
1367
1366
|
}
|
|
1368
1367
|
|
|
1369
1368
|
function _setPrototypeOf(o, p) {
|
|
1370
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
1369
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
1371
1370
|
o.__proto__ = p;
|
|
1372
1371
|
return o;
|
|
1373
1372
|
};
|
|
1374
|
-
|
|
1375
1373
|
return _setPrototypeOf(o, p);
|
|
1376
1374
|
}
|
|
1377
1375
|
|
|
@@ -1448,6 +1446,10 @@ var classNamesShape = process.env.NODE_ENV !== 'production' ? propTypes.exports.
|
|
|
1448
1446
|
|
|
1449
1447
|
var TransitionGroupContext = React__default.createContext(null);
|
|
1450
1448
|
|
|
1449
|
+
var forceReflow = function forceReflow(node) {
|
|
1450
|
+
return node.scrollTop;
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1451
1453
|
var UNMOUNTED = 'unmounted';
|
|
1452
1454
|
var EXITED = 'exited';
|
|
1453
1455
|
var ENTERING = 'entering';
|
|
@@ -1667,6 +1669,14 @@ var Transition = /*#__PURE__*/function (_React$Component) {
|
|
|
1667
1669
|
this.cancelNextCallback();
|
|
1668
1670
|
|
|
1669
1671
|
if (nextStatus === ENTERING) {
|
|
1672
|
+
if (this.props.unmountOnExit || this.props.mountOnEnter) {
|
|
1673
|
+
var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM__default.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
|
|
1674
|
+
// With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
|
|
1675
|
+
// To make the animation happen, we have to separate each rendering and avoid being processed as batched.
|
|
1676
|
+
|
|
1677
|
+
if (node) forceReflow(node);
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1670
1680
|
this.performEnter(mounting);
|
|
1671
1681
|
} else {
|
|
1672
1682
|
this.performExit();
|
|
@@ -2275,8 +2285,7 @@ var CSSTransition = /*#__PURE__*/function (_React$Component) {
|
|
|
2275
2285
|
|
|
2276
2286
|
|
|
2277
2287
|
if (phase === 'active') {
|
|
2278
|
-
|
|
2279
|
-
node && node.scrollTop;
|
|
2288
|
+
if (node) forceReflow(node);
|
|
2280
2289
|
}
|
|
2281
2290
|
|
|
2282
2291
|
if (className) {
|
|
@@ -8244,6 +8253,19 @@ CTableCaption.propTypes = {
|
|
|
8244
8253
|
};
|
|
8245
8254
|
CTableCaption.displayName = 'CTableCaption';
|
|
8246
8255
|
|
|
8256
|
+
var CTableResponsiveWrapper = function (_a) {
|
|
8257
|
+
var children = _a.children, responsive = _a.responsive, rest = __rest(_a, ["children", "responsive"]);
|
|
8258
|
+
return responsive ? (React__default.createElement("div", __assign({ className: typeof responsive === 'boolean' ? 'table-responsive' : "table-responsive-".concat(responsive) }, rest), children)) : (children);
|
|
8259
|
+
};
|
|
8260
|
+
CTableResponsiveWrapper.propTypes = {
|
|
8261
|
+
children: propTypes.exports.any,
|
|
8262
|
+
responsive: propTypes.exports.oneOfType([
|
|
8263
|
+
propTypes.exports.bool,
|
|
8264
|
+
propTypes.exports.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
|
|
8265
|
+
]),
|
|
8266
|
+
};
|
|
8267
|
+
CTableResponsiveWrapper.displayName = 'CTableResponsiveWrapper';
|
|
8268
|
+
|
|
8247
8269
|
var CTable = forwardRef(function (_a, ref) {
|
|
8248
8270
|
var _b;
|
|
8249
8271
|
var children = _a.children, align = _a.align, borderColor = _a.borderColor, bordered = _a.bordered, borderless = _a.borderless, caption = _a.caption, captionTop = _a.captionTop, className = _a.className, color = _a.color, columns = _a.columns, footer = _a.footer, hover = _a.hover, _c = _a.items, items = _c === void 0 ? [] : _c, responsive = _a.responsive, small = _a.small, striped = _a.striped, stripedColumns = _a.stripedColumns, tableFootProps = _a.tableFootProps, tableHeadProps = _a.tableHeadProps, rest = __rest(_a, ["children", "align", "borderColor", "bordered", "borderless", "caption", "captionTop", "className", "color", "columns", "footer", "hover", "items", "responsive", "small", "striped", "stripedColumns", "tableFootProps", "tableHeadProps"]);
|
|
@@ -8283,18 +8305,17 @@ var CTable = forwardRef(function (_a, ref) {
|
|
|
8283
8305
|
: pretifyName(column.key)
|
|
8284
8306
|
: pretifyName(column);
|
|
8285
8307
|
};
|
|
8286
|
-
|
|
8287
|
-
((
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
React__default.createElement(Table, null))) : (React__default.createElement(Table, null));
|
|
8308
|
+
return (React__default.createElement(CTableResponsiveWrapper, { responsive: responsive },
|
|
8309
|
+
React__default.createElement("table", __assign({ className: _className }, rest, { ref: ref }),
|
|
8310
|
+
((caption && caption !== 'top') || captionTop) && (React__default.createElement(CTableCaption, null, caption || captionTop)),
|
|
8311
|
+
columns && (React__default.createElement(CTableHead, __assign({}, tableHeadProps),
|
|
8312
|
+
React__default.createElement(CTableRow, null, columns.map(function (column, index) { return (React__default.createElement(CTableHeaderCell, __assign({}, (column._props && __assign({}, column._props)), (column._style && { style: __assign({}, column._style) }), { key: index }), label(column))); })))),
|
|
8313
|
+
items && (React__default.createElement(CTableBody, null, items.map(function (item, index) { return (React__default.createElement(CTableRow, __assign({}, (item._props && __assign({}, item._props)), { key: index }), rawColumnNames.map(function (colName, index) {
|
|
8314
|
+
return item[colName] ? (React__default.createElement(CTableDataCell, __assign({}, (item._cellProps && __assign(__assign({}, (item._cellProps['all'] && __assign({}, item._cellProps['all']))), (item._cellProps[colName] && __assign({}, item._cellProps[colName])))), { key: index }), item[colName])) : null;
|
|
8315
|
+
}))); }))),
|
|
8316
|
+
children,
|
|
8317
|
+
footer && (React__default.createElement(CTableFoot, __assign({}, tableFootProps),
|
|
8318
|
+
React__default.createElement(CTableRow, null, footer.map(function (item, index) { return (React__default.createElement(CTableDataCell, __assign({}, (item._props && __assign({}, item._props)), { key: index }), typeof item === 'object' ? item.label : item)); })))))));
|
|
8298
8319
|
});
|
|
8299
8320
|
CTable.propTypes = {
|
|
8300
8321
|
align: propTypes.exports.oneOf(['bottom', 'middle', 'top']),
|
|
@@ -8403,7 +8424,7 @@ var CToast = forwardRef(function (_a, ref) {
|
|
|
8403
8424
|
return (React__default.createElement(Transition, { in: _visible, nodeRef: toastRef, onEnter: function () { return onShow && onShow(index ? index : null); }, onExited: function () { return onClose && onClose(index ? index : null); }, timeout: 250, unmountOnExit: true }, function (state) {
|
|
8404
8425
|
var transitionClass = getTransitionClass(state);
|
|
8405
8426
|
return (React__default.createElement(CToastContext.Provider, { value: contextValues },
|
|
8406
|
-
React__default.createElement("div", __assign({ className: classNames(_className, transitionClass), "aria-live": "assertive", "aria-atomic": "true", role: "alert", onMouseEnter: function () { return clearTimeout(timeout.current); }, onMouseLeave: function () { return _autohide; } }, rest, { key: key, ref: forkedRef }), children)));
|
|
8427
|
+
React__default.createElement("div", __assign({ className: classNames(_className, transitionClass), "aria-live": "assertive", "aria-atomic": "true", role: "alert", onMouseEnter: function () { return clearTimeout(timeout.current); }, onMouseLeave: function () { return _autohide(); } }, rest, { key: key, ref: forkedRef }), children)));
|
|
8407
8428
|
}));
|
|
8408
8429
|
});
|
|
8409
8430
|
CToast.propTypes = {
|