@coreui/react 4.0.0 → 4.1.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.
Files changed (35) 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/CFormCheck.d.ts +4 -0
  5. package/dist/components/form/CFormLabel.d.ts +2 -2
  6. package/dist/components/form/CFormSelect.d.ts +13 -0
  7. package/dist/components/placeholder/CPlaceholder.d.ts +51 -0
  8. package/dist/components/popover/CPopover.d.ts +2 -2
  9. package/dist/components/tooltip/CTooltip.d.ts +1 -1
  10. package/dist/index.d.ts +2 -1
  11. package/dist/index.es.js +291 -181
  12. package/dist/index.es.js.map +1 -1
  13. package/dist/index.js +291 -180
  14. package/dist/index.js.map +1 -1
  15. package/package.json +10 -10
  16. package/src/components/accordion/CAccordionCollapse.tsx +1 -1
  17. package/src/components/collapse/CCollapse.tsx +36 -3
  18. package/src/components/form/CFormCheck.tsx +30 -3
  19. package/src/components/form/CFormLabel.tsx +2 -2
  20. package/src/components/form/CFormSelect.tsx +28 -2
  21. package/src/components/form/__tests__/CFormLabel.spec.tsx +8 -0
  22. package/src/components/form/__tests__/__snapshots__/CFormLabel.spec.tsx.snap +11 -0
  23. package/src/components/grid/CCol.tsx +8 -8
  24. package/src/components/grid/CContainer.tsx +3 -3
  25. package/src/components/grid/CRow.tsx +6 -6
  26. package/src/components/offcanvas/COffcanvas.tsx +15 -2
  27. package/src/components/offcanvas/__tests__/COffcanvas.spec.tsx +1 -1
  28. package/src/components/offcanvas/__tests__/__snapshots__/COffcanvas.spec.tsx.snap +2 -2
  29. package/src/components/placeholder/CPlaceholder.tsx +114 -0
  30. package/src/components/placeholder/__tests__/CPlaceholder.spec.tsx +21 -0
  31. package/src/components/placeholder/__tests__/__snapshots__/CPlaceholder.spec.tsx.snap +17 -0
  32. package/src/components/popover/CPopover.tsx +4 -4
  33. package/src/components/tooltip/CTooltip.tsx +2 -2
  34. package/src/index.ts +2 -0
  35. 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.0.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
  */
@@ -39,6 +39,10 @@ export interface CFormCheckProps extends InputHTMLAttributes<HTMLInputElement> {
39
39
  * The id global attribute defines an identifier (ID) that must be unique in the whole document.
40
40
  */
41
41
  id?: string;
42
+ /**
43
+ * Input Checkbox indeterminate Property.
44
+ */
45
+ indeterminate?: boolean;
42
46
  /**
43
47
  * Group checkboxes or radios on the same horizontal row by adding.
44
48
  */
@@ -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
  */
@@ -1,4 +1,9 @@
1
1
  import React, { ChangeEventHandler, InputHTMLAttributes } from 'react';
2
+ declare type Option = {
3
+ disabled?: boolean;
4
+ label?: string;
5
+ value?: string;
6
+ };
2
7
  export interface CFormSelectProps extends Omit<InputHTMLAttributes<HTMLSelectElement>, 'size'> {
3
8
  /**
4
9
  * A string of all className you want applied to the component.
@@ -16,6 +21,13 @@ export interface CFormSelectProps extends Omit<InputHTMLAttributes<HTMLSelectEle
16
21
  * Method called immediately after the `value` prop changes.
17
22
  */
18
23
  onChange?: ChangeEventHandler<HTMLSelectElement>;
24
+ /**
25
+ * Options list of the select component. Available keys: `label`, `value`, `disabled`.
26
+ * Examples:
27
+ * - `options={[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]}`
28
+ * - `options={['js', 'html']}`
29
+ */
30
+ options?: Option[] | string[];
19
31
  /**
20
32
  * Size the component small or large.
21
33
  */
@@ -32,3 +44,4 @@ export interface CFormSelectProps extends Omit<InputHTMLAttributes<HTMLSelectEle
32
44
  value?: string | string[] | number;
33
45
  }
34
46
  export declare const CFormSelect: React.ForwardRefExoticComponent<CFormSelectProps & React.RefAttributes<HTMLSelectElement>>;
47
+ export {};
@@ -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
  *
@@ -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
@@ -86,6 +86,7 @@ import { CNavbarText } from './components/navbar/CNavbarText';
86
86
  import { CNavbarToggler } from './components/navbar/CNavbarToggler';
87
87
  import { CPagination } from './components/pagination/CPagination';
88
88
  import { CPaginationItem } from './components/pagination/CPaginationItem';
89
+ import { CPlaceholder } from './components/placeholder/CPlaceholder';
89
90
  import { CPopover } from './components/popover/CPopover';
90
91
  import { CProgress } from './components/progress/CProgress';
91
92
  import { CProgressBar } from './components/progress/CProgressBar';
@@ -116,5 +117,5 @@ import { CToastClose } from './components/toast/CToastClose';
116
117
  import { CToastHeader } from './components/toast/CToastHeader';
117
118
  import { CToaster } from './components/toast/CToaster';
118
119
  import { CTooltip } from './components/tooltip/CTooltip';
119
- 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, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, CPagination, CPaginationItem, CPopover, CProgress, CProgressBar, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarToggler, CSidebarHeader, CSidebarNav, CSpinner, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CTabContent, CTabPane, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, };
120
+ 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, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, CPagination, CPaginationItem, CPlaceholder, CPopover, CProgress, CProgressBar, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarToggler, CSidebarHeader, CSidebarNav, CSpinner, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CTabContent, CTabPane, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, };
120
121
  export * from './components/';