@coreui/react-pro 4.0.1 → 4.1.2

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.
Files changed (38) hide show
  1. package/README.md +157 -0
  2. package/dist/components/accordion/CAccordionCollapse.d.ts +1 -1
  3. package/dist/components/collapse/CCollapse.d.ts +4 -0
  4. package/dist/components/form/CFormLabel.d.ts +2 -2
  5. package/dist/components/placeholder/CPlaceholder.d.ts +51 -0
  6. package/dist/components/popover/CPopover.d.ts +2 -2
  7. package/dist/components/smart-table/CSmartTableBody.d.ts +3 -3
  8. package/dist/components/smart-table/CSmartTableHead.d.ts +2 -1
  9. package/dist/components/smart-table/CSmartTableInterface.d.ts +9 -6
  10. package/dist/components/tooltip/CTooltip.d.ts +1 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.es.js +341 -211
  13. package/dist/index.es.js.map +1 -1
  14. package/dist/index.js +341 -210
  15. package/dist/index.js.map +1 -1
  16. package/package.json +8 -8
  17. package/src/components/accordion/CAccordionCollapse.tsx +1 -1
  18. package/src/components/collapse/CCollapse.tsx +36 -3
  19. package/src/components/form/CFormLabel.tsx +2 -2
  20. package/src/components/form/__tests__/CFormLabel.spec.tsx +8 -0
  21. package/src/components/form/__tests__/__snapshots__/CFormLabel.spec.tsx.snap +11 -0
  22. package/src/components/grid/CCol.tsx +8 -8
  23. package/src/components/grid/CContainer.tsx +3 -3
  24. package/src/components/grid/CRow.tsx +6 -6
  25. package/src/components/offcanvas/COffcanvas.tsx +15 -2
  26. package/src/components/offcanvas/__tests__/COffcanvas.spec.tsx +1 -1
  27. package/src/components/offcanvas/__tests__/__snapshots__/COffcanvas.spec.tsx.snap +2 -2
  28. package/src/components/placeholder/CPlaceholder.tsx +114 -0
  29. package/src/components/placeholder/__tests__/CPlaceholder.spec.tsx +21 -0
  30. package/src/components/placeholder/__tests__/__snapshots__/CPlaceholder.spec.tsx.snap +17 -0
  31. package/src/components/popover/CPopover.tsx +4 -4
  32. package/src/components/smart-table/CSmartTable.tsx +25 -12
  33. package/src/components/smart-table/CSmartTableBody.tsx +9 -4
  34. package/src/components/smart-table/CSmartTableHead.tsx +16 -3
  35. package/src/components/smart-table/CSmartTableInterface.tsx +10 -6
  36. package/src/components/tooltip/CTooltip.tsx +2 -2
  37. package/src/index.ts +2 -0
  38. package/src/utils/hooks/useForkedRef.ts +5 -0
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ <p align="center">
2
+ <a href="https://coreui.io/">
3
+ <img
4
+ src="https://coreui.io/images/brand/coreui-signet.svg"
5
+ alt="CoreUI logo"
6
+ width="200"
7
+ />
8
+ </a>
9
+ </p>
10
+
11
+ <h3 align="center">CoreUI for React.js</h3>
12
+
13
+ <p align="center">
14
+ React.js Components Library built on top of Bootstrap 5 and TypeScript.
15
+ <br>
16
+ <a href="https://coreui.io/react/docs/getting-started/introduction"><strong>Explore CoreUI for React.js docs »</strong></a>
17
+ <br>
18
+ <br>
19
+ <a href="https://github.com/coreui/coreui-react/issues/new?template=bug_report.md">Report bug</a>
20
+ ·
21
+ <a href="https://github.com/coreui/coreui-react/issues/new?template=feature_request.md">Request feature</a>
22
+ ·
23
+ <a href="https://blog.coreui.io/">Blog</a>
24
+ </p>
25
+
26
+
27
+ ## Table of contents
28
+
29
+ - [Quick start](#quick-start)
30
+ - [Status](#status)
31
+ - [What's included](#whats-included)
32
+ - [Bugs and feature requests](#bugs-and-feature-requests)
33
+ - [Documentation](#documentation)
34
+ - [Contributing](#contributing)
35
+ - [Community](#community)
36
+ - [Versioning](#versioning)
37
+ - [Creators](#creators)
38
+ - [Copyright and license](#copyright-and-license)
39
+
40
+ ## Quick start
41
+
42
+ ### Instalation
43
+
44
+ Several quick start options are available:
45
+
46
+ - [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.1.2.zip)
47
+ - Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
48
+ - Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
49
+ - Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
50
+
51
+ Read the [Getting started page](https://coreui.io/react/docs/getting-started/introduction/) for information on the framework contents, templates and examples, and more.
52
+
53
+ ### Stylesheets
54
+
55
+ React components are styled using `@coreui/coreui` CSS library, but you can use them also with bootstrap CSS library. That is possible because `@coreui/coreui` library is compatible with bootstrap, it just extends its functionalities. The only exception are custom CoreUI components, which don't exist in the Bootstrap ecosystem.
56
+
57
+ #### CoreUI CSS files
58
+
59
+ ##### Installation
60
+
61
+ ```bash
62
+ yarn add @coreui/coreui
63
+ ```
64
+
65
+ or
66
+
67
+ ```bash
68
+ npm install @coreui/coreui --save
69
+ ```
70
+
71
+ ##### Basic usage
72
+
73
+ ```js
74
+ import '@coreui/coreui/dist/css/coreui.min.css'
75
+ ```
76
+
77
+ #### Bootstrap CSS files
78
+
79
+ ##### Installation
80
+
81
+ ```bash
82
+ yarn add bootstrap
83
+ ```
84
+
85
+ or
86
+
87
+ ```bash
88
+ npm install bootstrap
89
+ ```
90
+
91
+ ##### Basic usage
92
+
93
+ ```js
94
+ import "bootstrap/dist/css/bootstrap.min.css";
95
+ ```
96
+
97
+ ## Status
98
+
99
+ [![Build Status](https://github.com/coreui/coreui-react/workflows/JS%20Tests/badge.svg?branch=main)](https://github.com/coreui/coreui-react/actions?query=workflow%3AJS+Tests+branch%3Amain)
100
+ [![npm version](https://img.shields.io/npm/v/@coreui/react)](https://www.npmjs.com/package/@coreui/react)
101
+ [![peerDependencies Status](https://img.shields.io/david/peer/coreui/coreui)](https://david-dm.org/coreui/coreui?type=peer)
102
+ [![devDependency Status](https://img.shields.io/david/dev/coreui/coreui)](https://david-dm.org/coreui/coreui?type=dev)
103
+ [![Coverage Status](https://img.shields.io/coveralls/github/coreui/coreui-react/v4)](https://coveralls.io/github/coreui/coreui-react?branch=v4)
104
+
105
+ ## Bugs and feature requests
106
+
107
+ Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/coreui/coreui-react/blob/v4/.github/CONTRIBUTING.md#using-the-issue-tracker) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/coreui/coreui-react/issues/new).
108
+
109
+ ## Documentation
110
+
111
+ The documentation for the CoreUI & CoreUI PRO is hosted at our website [CoreUI for React](https://coreui.io/react/docs/getting-started/introduction)
112
+
113
+ ### Running documentation locally
114
+
115
+ 1. Run `yarn install` or `npm install` to install the Node.js dependencies.
116
+ 2. Run `yarn bootstrap` or `npm run bootstrap` to link local packages together and install remaining package dependencies.
117
+ 3. From the root directory, run `yarn docs:dev` or `npm run docs:dev` (or a specific npm script) to rebuild distributed CSS and JavaScript files, as well as our docs assets.
118
+ 4. Open `http://localhost:8000/` in your browser, and voilà.
119
+
120
+ ## Contributing
121
+
122
+ Please read through our [contributing guidelines](https://github.com/coreui/coreui-react/blob/v4/.github/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
123
+
124
+ Editor preferences are available in the [editor config](https://github.com/coreui/coreui-react/blob/v4/.editorconfig) for easy use in common text editors. Read more and download plugins at <https://editorconfig.org/>.
125
+
126
+ ## Community
127
+
128
+ Stay up to date on the development of CoreUI and reach out to the community with these helpful resources.
129
+
130
+ - Read and subscribe to [The Official CoreUI Blog](https://blog.coreui.io/).
131
+
132
+ You can also follow [@core_ui on Twitter](https://twitter.com/core_ui).
133
+
134
+ ## Versioning
135
+
136
+ For transparency into our release cycle and in striving to maintain backward compatibility, CoreUI is maintained under [the Semantic Versioning guidelines](http://semver.org/).
137
+
138
+ See [the Releases section of our project](https://github.com/coreui/coreui-react/releases) for changelogs for each release version.
139
+
140
+ ## Creators
141
+
142
+ **Łukasz Holeczek**
143
+
144
+ - <https://twitter.com/lukaszholeczek>
145
+ - <https://github.com/mrholek>
146
+
147
+ **Andrzej Kopański**
148
+
149
+ - <https://github.com/xidedix>
150
+
151
+ **The CoreUI Team**
152
+
153
+ - <https://github.com/orgs/coreui/people>
154
+
155
+ ## Copyright and license
156
+
157
+ Copyright 2021 creativeLabs Łukasz Holeczek. Code released under the [MIT License](https://github.com/coreui/coreui-react/blob/main/LICENSE). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/).
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { CCollapseProps } from '../collapse/CCollapse';
3
- export declare const CAccordionCollapse: React.ForwardRefExoticComponent<CCollapseProps & React.RefAttributes<HTMLDivElement>>;
3
+ export declare const CAccordionCollapse: React.ForwardRefExoticComponent<Omit<CCollapseProps, "horizontal"> & React.RefAttributes<HTMLDivElement>>;
@@ -4,6 +4,10 @@ export interface CCollapseProps extends HTMLAttributes<HTMLDivElement> {
4
4
  * A string of all className you want applied to the base component.
5
5
  */
6
6
  className?: string;
7
+ /**
8
+ * Set horizontal collapsing to transition the width instead of height.
9
+ */
10
+ horizontal?: boolean;
7
11
  /**
8
12
  * Callback fired when the component requests to be hidden.
9
13
  */
@@ -1,5 +1,5 @@
1
- import React, { HTMLAttributes } from 'react';
2
- export interface CFormLabelProps extends HTMLAttributes<HTMLLabelElement> {
1
+ import React, { AllHTMLAttributes } from 'react';
2
+ export interface CFormLabelProps extends AllHTMLAttributes<HTMLLabelElement> {
3
3
  /**
4
4
  * A string of all className you want applied to the component.
5
5
  */
@@ -0,0 +1,51 @@
1
+ import React, { ElementType, HTMLAttributes } from 'react';
2
+ import { Colors } from '../Types';
3
+ export interface CPlaceholderProps extends HTMLAttributes<HTMLSpanElement> {
4
+ /**
5
+ * Set animation type to better convey the perception of something being actively loaded.
6
+ */
7
+ animation?: 'glow' | 'wave';
8
+ /**
9
+ * A string of all className you want applied to the component.
10
+ */
11
+ className?: string;
12
+ /**
13
+ * Sets the color context of the component to one of CoreUI’s themed colors.
14
+ *
15
+ * @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
16
+ */
17
+ color?: Colors;
18
+ /**
19
+ * Component used for the root node. Either a string to use a HTML element or a component.
20
+ */
21
+ component?: string | ElementType;
22
+ /**
23
+ * Size the component extra small, small, or large.
24
+ */
25
+ size?: 'xs' | 'sm' | 'lg';
26
+ /**
27
+ * The number of columns on extra small devices (<576px).
28
+ */
29
+ xs?: number;
30
+ /**
31
+ * The number of columns on small devices (<768px).
32
+ */
33
+ sm?: number;
34
+ /**
35
+ * The number of columns on medium devices (<992px).
36
+ */
37
+ md?: number;
38
+ /**
39
+ * The number of columns on large devices (<1200px).
40
+ */
41
+ lg?: number;
42
+ /**
43
+ * The number of columns on X-Large devices (<1400px).
44
+ */
45
+ xl?: number;
46
+ /**
47
+ * The number of columns on XX-Large devices (≥1400px).
48
+ */
49
+ xxl?: number;
50
+ }
51
+ export declare const CPlaceholder: React.ForwardRefExoticComponent<CPlaceholderProps & React.RefAttributes<HTMLSpanElement>>;
@@ -5,7 +5,7 @@ export interface CPopoverProps {
5
5
  /**
6
6
  * Content node for your component.
7
7
  */
8
- content: ReactNode;
8
+ content: ReactNode | string;
9
9
  /**
10
10
  * Offset of the popover relative to its target.
11
11
  */
@@ -21,7 +21,7 @@ export interface CPopoverProps {
21
21
  /**
22
22
  * Title node for your component.
23
23
  */
24
- title?: ReactNode;
24
+ title?: ReactNode | string;
25
25
  /**
26
26
  * Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
27
27
  *
@@ -1,13 +1,13 @@
1
1
  import React, { MouseEvent, ReactNode } from 'react';
2
2
  import { CTableBodyProps } from '../table/CTableBody';
3
- import { Item, ScopedColumns } from './CSmartTableInterface';
3
+ import { ItemInternal, ScopedColumns } from './CSmartTableInterface';
4
4
  export interface CSmartTableBodyProps extends CTableBodyProps {
5
5
  clickableRows?: boolean;
6
- currentItems: Item[];
6
+ currentItems: ItemInternal[];
7
7
  firstItemOnActivePageIndex: number;
8
8
  noItemsLabel?: string | ReactNode;
9
9
  onRowChecked?: (id: number, value: boolean) => void;
10
- onRowClick?: (item: Item, index: number, columnName: string, event: MouseEvent | boolean) => void;
10
+ onRowClick?: (item: ItemInternal, index: number, columnName: string, event: MouseEvent | boolean) => void;
11
11
  rawColumnNames: string[];
12
12
  scopedColumns?: ScopedColumns;
13
13
  selectable?: boolean;
@@ -1,8 +1,9 @@
1
1
  import React, { ElementType, ReactNode } from 'react';
2
- import { ColumnFilter, Column, Sorter, SorterValue } from './CSmartTableInterface';
2
+ import { ColumnFilter, ColumnFilterValue, Column, Sorter, SorterValue } from './CSmartTableInterface';
3
3
  import { CTableHeadProps } from '../table/CTableHead';
4
4
  export interface CSmartTableHeadProps extends CTableHeadProps {
5
5
  columnFilter?: boolean | ColumnFilter;
6
+ columnFilterState?: ColumnFilterValue;
6
7
  columnSorter?: boolean | Sorter;
7
8
  component?: string | ElementType;
8
9
  columns: (Column | string)[];
@@ -7,10 +7,10 @@ import { CTableHeaderCellProps } from '../table/CTableHeaderCell';
7
7
  import { CTableRowProps } from '../table/CTableRow';
8
8
  import { CTableHeadProps } from '../table/CTableHead';
9
9
  export interface Column {
10
- sorter?: boolean;
11
- key: string;
12
- label?: string;
13
10
  filter?: boolean;
11
+ label?: string;
12
+ key: string;
13
+ sorter?: boolean;
14
14
  _style?: any;
15
15
  _props?: CTableHeaderCellProps;
16
16
  }
@@ -23,9 +23,11 @@ export interface ColumnFilterValue {
23
23
  }
24
24
  export interface Item {
25
25
  [key: string]: number | string | any;
26
+ _props?: CTableRowProps;
27
+ _selected?: boolean;
28
+ }
29
+ export interface ItemInternal extends Item {
26
30
  _id: number;
27
- _props: CTableRowProps;
28
- _selected: boolean;
29
31
  }
30
32
  export interface ItemsPerPageSelect {
31
33
  external?: boolean;
@@ -37,6 +39,7 @@ export interface Sorter {
37
39
  external?: boolean;
38
40
  }
39
41
  export interface ScopedColumns {
42
+ [key: string]: any;
40
43
  details?: (a: Item, b: number) => ReactNode;
41
44
  }
42
45
  export interface SorterValue {
@@ -104,7 +107,7 @@ export interface CSmartTableProps extends HTMLAttributes<HTMLDivElement> {
104
107
  * - sorter (Boolean) - disables sorting of the column when set to false
105
108
  * - filter (Boolean) - removes filter from column when set to false.
106
109
  */
107
- columns?: Column[] | string[];
110
+ columns?: (string | Column)[];
108
111
  /**
109
112
  * Enables table sorting by column value. Sorting will be performed corectly only if values in column are of one type: string (case insensitive) or number.
110
113
  *
@@ -5,7 +5,7 @@ export interface CTooltipProps {
5
5
  /**
6
6
  * Content node for your component.
7
7
  */
8
- content: ReactNode;
8
+ content: ReactNode | string;
9
9
  /**
10
10
  * Callback fired when the component requests to be hidden.
11
11
  */
package/dist/index.d.ts CHANGED
@@ -89,6 +89,7 @@ import { CNavbarToggler } from './components/navbar/CNavbarToggler';
89
89
  import { CPagination } from './components/pagination/CPagination';
90
90
  import { CPaginationItem } from './components/pagination/CPaginationItem';
91
91
  import { CSmartPagination } from './components/pagination/CSmartPagination';
92
+ import { CPlaceholder } from './components/placeholder/CPlaceholder';
92
93
  import { CPopover } from './components/popover/CPopover';
93
94
  import { CProgress } from './components/progress/CProgress';
94
95
  import { CProgressBar } from './components/progress/CProgressBar';
@@ -120,5 +121,5 @@ import { CToastClose } from './components/toast/CToastClose';
120
121
  import { CToastHeader } from './components/toast/CToastHeader';
121
122
  import { CToaster } from './components/toast/CToaster';
122
123
  import { CTooltip } from './components/tooltip/CTooltip';
123
- export { CAccordion, CAccordionBody, CAccordionButton, CAccordionCollapse, CAccordionHeader, CAccordionItem, CAlert, CAlertHeading, CAlertLink, CAvatar, CBadge, CBackdrop, CBreadcrumb, CBreadcrumbItem, CButton, CButtonGroup, CButtonToolbar, CCallout, CCard, CCardBody, CCardFooter, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCloseButton, CCollapse, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownItemPlain, CDropdownMenu, CDropdownToggle, CCol, CContainer, CRow, CFooter, CCardGroup, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CImage, CInputGroup, CInputGroupText, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler, CLink, CListGroup, CListGroupItem, CLoadingButton, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CMultiSelect, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, CPagination, CPaginationItem, CPopover, CProgress, CProgressBar, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CSmartPagination, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarToggler, CSidebarHeader, CSidebarNav, CSmartTable, CSpinner, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CTabContent, CTabPane, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, };
124
+ export { CAccordion, CAccordionBody, CAccordionButton, CAccordionCollapse, CAccordionHeader, CAccordionItem, CAlert, CAlertHeading, CAlertLink, CAvatar, CBadge, CBackdrop, CBreadcrumb, CBreadcrumbItem, CButton, CButtonGroup, CButtonToolbar, CCallout, CCard, CCardBody, CCardFooter, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCloseButton, CCollapse, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownItemPlain, CDropdownMenu, CDropdownToggle, CCol, CContainer, CRow, CFooter, CCardGroup, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CImage, CInputGroup, CInputGroupText, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler, CLink, CListGroup, CListGroupItem, CLoadingButton, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CMultiSelect, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, CPagination, CPaginationItem, CPlaceholder, CPopover, CProgress, CProgressBar, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CSmartPagination, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarToggler, CSidebarHeader, CSidebarNav, CSmartTable, CSpinner, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CTabContent, CTabPane, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, };
124
125
  export * from './components/';