@coreui/react 4.0.0 → 4.0.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 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.0.1.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/).
@@ -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,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 {};
package/dist/index.es.js CHANGED
@@ -5928,7 +5928,14 @@ CFormLabel.displayName = 'CFormLabel';
5928
5928
 
5929
5929
  var CFormCheck = forwardRef(function (_a, ref) {
5930
5930
  var _b;
5931
- var className = _a.className, button = _a.button, hitArea = _a.hitArea, id = _a.id, inline = _a.inline, invalid = _a.invalid, label = _a.label, _c = _a.type, type = _c === void 0 ? 'checkbox' : _c, valid = _a.valid, rest = __rest(_a, ["className", "button", "hitArea", "id", "inline", "invalid", "label", "type", "valid"]);
5931
+ var className = _a.className, button = _a.button, hitArea = _a.hitArea, id = _a.id, indeterminate = _a.indeterminate, inline = _a.inline, invalid = _a.invalid, label = _a.label, _c = _a.type, type = _c === void 0 ? 'checkbox' : _c, valid = _a.valid, rest = __rest(_a, ["className", "button", "hitArea", "id", "indeterminate", "inline", "invalid", "label", "type", "valid"]);
5932
+ var inputRef = useRef(null);
5933
+ var forkedRef = useForkedRef(ref, inputRef);
5934
+ useEffect(function () {
5935
+ if (inputRef.current && indeterminate) {
5936
+ inputRef.current.indeterminate = indeterminate;
5937
+ }
5938
+ }, [indeterminate]);
5932
5939
  var _className = classNames('form-check', {
5933
5940
  'form-check-inline': inline,
5934
5941
  'is-invalid': invalid,
@@ -5945,7 +5952,7 @@ var CFormCheck = forwardRef(function (_a, ref) {
5945
5952
  _b), "" + button.shape)
5946
5953
  : 'form-check-label');
5947
5954
  var formControl = function () {
5948
- return React__default.createElement("input", __assign({ type: type, className: inputClassName, id: id }, rest, { ref: ref }));
5955
+ return React__default.createElement("input", __assign({ type: type, className: inputClassName, id: id }, rest, { ref: forkedRef }));
5949
5956
  };
5950
5957
  var formLabel = function () {
5951
5958
  return (React__default.createElement(CFormLabel, __assign({ customClassName: labelClassName }, (id && { htmlFor: id })), label));
@@ -5963,6 +5970,7 @@ CFormCheck.propTypes = {
5963
5970
  className: PropTypes.string,
5964
5971
  hitArea: PropTypes.oneOf(['full']),
5965
5972
  id: PropTypes.string,
5973
+ indeterminate: PropTypes.bool,
5966
5974
  inline: PropTypes.bool,
5967
5975
  invalid: PropTypes.bool,
5968
5976
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
@@ -6035,19 +6043,25 @@ CFormRange.displayName = 'CFormRange';
6035
6043
 
6036
6044
  var CFormSelect = forwardRef(function (_a, ref) {
6037
6045
  var _b;
6038
- var children = _a.children, className = _a.className, htmlSize = _a.htmlSize, invalid = _a.invalid, size = _a.size, valid = _a.valid, rest = __rest(_a, ["children", "className", "htmlSize", "invalid", "size", "valid"]);
6046
+ var children = _a.children, className = _a.className, htmlSize = _a.htmlSize, invalid = _a.invalid, options = _a.options, size = _a.size, valid = _a.valid, rest = __rest(_a, ["children", "className", "htmlSize", "invalid", "options", "size", "valid"]);
6039
6047
  var _className = classNames('form-select', (_b = {},
6040
6048
  _b["form-select-" + size] = size,
6041
6049
  _b['is-invalid'] = invalid,
6042
6050
  _b['is-valid'] = valid,
6043
6051
  _b), className);
6044
- return (React__default.createElement("select", __assign({ className: _className, size: htmlSize }, rest, { ref: ref }), children));
6052
+ return (React__default.createElement("select", __assign({ className: _className, size: htmlSize }, rest, { ref: ref }), options
6053
+ ? options.map(function (option, index) {
6054
+ return (React__default.createElement("option", __assign({}, (typeof option === 'object' &&
6055
+ option.disabled && { disabled: option.disabled }), (typeof option === 'object' && option.value && { value: option.value }), { key: index }), typeof option === 'string' ? option : option.label));
6056
+ })
6057
+ : children));
6045
6058
  });
6046
6059
  CFormSelect.propTypes = {
6047
6060
  children: PropTypes.node,
6048
6061
  className: PropTypes.string,
6049
6062
  htmlSize: PropTypes.number,
6050
6063
  invalid: PropTypes.bool,
6064
+ options: PropTypes.array,
6051
6065
  size: PropTypes.oneOf(['sm', 'lg']),
6052
6066
  valid: PropTypes.bool,
6053
6067
  };