cloudmr-ux 4.1.3 → 4.1.4

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.
@@ -19,6 +19,7 @@ export interface CmrSelectProps {
19
19
  className?: string;
20
20
  /** Pass-through kept for compatibility */
21
21
  SelectProps?: Record<string, any>;
22
+ primaryColor?: string;
22
23
  }
23
24
  declare const CmrSelect: React.FC<CmrSelectProps>;
24
25
  export default CmrSelect;
@@ -14,18 +14,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useEffect, useId, useMemo, useState } from 'react';
15
15
  import ReactSelect from 'react-select';
16
16
  import './CmrSelect.css';
17
- var baseStyles = {
18
- control: function (base, state) { return (__assign(__assign({}, base), { minHeight: 40, borderColor: state.isFocused ? '#580F8B' : base.borderColor, boxShadow: state.isFocused ? '0 0 0 1px #580F8B' : 'none', '&:hover': { borderColor: '#580F8B' }, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif', borderRadius: 4 })); },
17
+ var createStyles = function (primaryColor) { return ({
18
+ control: function (base, state) { return (__assign(__assign({}, base), { minHeight: 40, borderColor: state.isFocused ? primaryColor : base.borderColor, boxShadow: state.isFocused ? "0 0 0 1px ".concat(primaryColor) : 'none', '&:hover': { borderColor: primaryColor }, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif', borderRadius: 4 })); },
19
19
  placeholder: function (base) { return (__assign(__assign({}, base), { color: 'rgba(0,0,0,0.6)' })); },
20
- singleValue: function (base) { return (__assign(__assign({}, base), { color: '#580F8B', fontWeight: 400, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif' })); },
20
+ singleValue: function (base) { return (__assign(__assign({}, base), { color: primaryColor, fontWeight: 400, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif' })); },
21
21
  option: function (base, state) { return (__assign(__assign({}, base), { backgroundColor: state.isFocused || state.isSelected ? '#F3E5F5' : 'white', color: '#000', fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif', cursor: state.isDisabled ? 'not-allowed' : 'pointer' })); },
22
22
  menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: 2000 })); },
23
23
  menu: function (base) { return (__assign(__assign({}, base), { zIndex: 1300 })); }
24
- };
24
+ }); };
25
25
  var CmrSelect = function (_a) {
26
- var options = _a.options, disabled = _a.disabled, value = _a.value, onChange = _a.onChange, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, fullWidth = _a.fullWidth, sx = _a.sx, className = _a.className;
26
+ var options = _a.options, disabled = _a.disabled, value = _a.value, onChange = _a.onChange, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, fullWidth = _a.fullWidth, sx = _a.sx, className = _a.className, _c = _a.primaryColor, primaryColor = _c === void 0 ? '#580F8B' : _c;
27
27
  var isControlled = value !== undefined;
28
- var _c = useState(defaultValue), internal = _c[0], setInternal = _c[1];
28
+ var _d = useState(defaultValue), internal = _d[0], setInternal = _d[1];
29
29
  var currentValue = isControlled ? value : internal;
30
30
  useEffect(function () {
31
31
  if (isControlled)
@@ -41,6 +41,6 @@ var CmrSelect = function (_a) {
41
41
  onChange === null || onChange === void 0 ? void 0 : onChange(next);
42
42
  };
43
43
  var wrapperStyle = __assign({ minWidth: 200, maxWidth: 400, width: fullWidth ? '100%' : 'auto' }, sx);
44
- return (_jsx("div", __assign({ className: className !== null && className !== void 0 ? className : 'dropdown-select', style: wrapperStyle }, { children: _jsx(ReactSelect, { inputId: id, isDisabled: !!disabled, options: options.map(function (o) { return (__assign(__assign({}, o), { isDisabled: o.disabled })); }), value: rsValue, onChange: handleChange, placeholder: "Select", isClearable: true, styles: baseStyles, menuPortalTarget: document.body }) })));
44
+ return (_jsx("div", __assign({ className: className !== null && className !== void 0 ? className : 'dropdown-select', style: wrapperStyle }, { children: _jsx(ReactSelect, { inputId: id, isDisabled: !!disabled, options: options.map(function (o) { return (__assign(__assign({}, o), { isDisabled: o.disabled })); }), value: rsValue, onChange: handleChange, placeholder: "Select", isClearable: true, styles: createStyles(primaryColor), menuPortalTarget: document.body }) })));
45
45
  };
46
46
  export default CmrSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",