@coreui/react 4.0.0-rc.5 → 4.0.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.
package/dist/index.js CHANGED
@@ -5955,7 +5955,14 @@ CFormLabel.displayName = 'CFormLabel';
5955
5955
 
5956
5956
  var CFormCheck = React.forwardRef(function (_a, ref) {
5957
5957
  var _b;
5958
- 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"]);
5958
+ 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"]);
5959
+ var inputRef = React.useRef(null);
5960
+ var forkedRef = useForkedRef(ref, inputRef);
5961
+ React.useEffect(function () {
5962
+ if (inputRef.current && indeterminate) {
5963
+ inputRef.current.indeterminate = indeterminate;
5964
+ }
5965
+ }, [indeterminate]);
5959
5966
  var _className = classNames('form-check', {
5960
5967
  'form-check-inline': inline,
5961
5968
  'is-invalid': invalid,
@@ -5972,7 +5979,7 @@ var CFormCheck = React.forwardRef(function (_a, ref) {
5972
5979
  _b), "" + button.shape)
5973
5980
  : 'form-check-label');
5974
5981
  var formControl = function () {
5975
- return React__default["default"].createElement("input", __assign({ type: type, className: inputClassName, id: id }, rest, { ref: ref }));
5982
+ return React__default["default"].createElement("input", __assign({ type: type, className: inputClassName, id: id }, rest, { ref: forkedRef }));
5976
5983
  };
5977
5984
  var formLabel = function () {
5978
5985
  return (React__default["default"].createElement(CFormLabel, __assign({ customClassName: labelClassName }, (id && { htmlFor: id })), label));
@@ -5990,6 +5997,7 @@ CFormCheck.propTypes = {
5990
5997
  className: PropTypes.string,
5991
5998
  hitArea: PropTypes.oneOf(['full']),
5992
5999
  id: PropTypes.string,
6000
+ indeterminate: PropTypes.bool,
5993
6001
  inline: PropTypes.bool,
5994
6002
  invalid: PropTypes.bool,
5995
6003
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
@@ -6062,19 +6070,25 @@ CFormRange.displayName = 'CFormRange';
6062
6070
 
6063
6071
  var CFormSelect = React.forwardRef(function (_a, ref) {
6064
6072
  var _b;
6065
- 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"]);
6073
+ 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"]);
6066
6074
  var _className = classNames('form-select', (_b = {},
6067
6075
  _b["form-select-" + size] = size,
6068
6076
  _b['is-invalid'] = invalid,
6069
6077
  _b['is-valid'] = valid,
6070
6078
  _b), className);
6071
- return (React__default["default"].createElement("select", __assign({ className: _className, size: htmlSize }, rest, { ref: ref }), children));
6079
+ return (React__default["default"].createElement("select", __assign({ className: _className, size: htmlSize }, rest, { ref: ref }), options
6080
+ ? options.map(function (option, index) {
6081
+ return (React__default["default"].createElement("option", __assign({}, (typeof option === 'object' &&
6082
+ option.disabled && { disabled: option.disabled }), (typeof option === 'object' && option.value && { value: option.value }), { key: index }), typeof option === 'string' ? option : option.label));
6083
+ })
6084
+ : children));
6072
6085
  });
6073
6086
  CFormSelect.propTypes = {
6074
6087
  children: PropTypes.node,
6075
6088
  className: PropTypes.string,
6076
6089
  htmlSize: PropTypes.number,
6077
6090
  invalid: PropTypes.bool,
6091
+ options: PropTypes.array,
6078
6092
  size: PropTypes.oneOf(['sm', 'lg']),
6079
6093
  valid: PropTypes.bool,
6080
6094
  };