@agility/plenum-ui 1.3.18 → 1.3.21

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.
@@ -3,7 +3,7 @@ export interface CheckboxProps {
3
3
  /** Checkbox label */
4
4
  label: string;
5
5
  /** Checkbox ID */
6
- id: string;
6
+ id?: string;
7
7
  /** Disabled state */
8
8
  isDisabled?: boolean;
9
9
  /** value */
@@ -21,6 +21,7 @@ export interface SimpleSelectProps {
21
21
  /** Select required state */
22
22
  isRequired?: boolean;
23
23
  value?: string;
24
+ className?: string;
24
25
  }
25
26
  /** Comment */
26
27
  export declare const Select: FC<SimpleSelectProps>;
package/lib/index.esm.js CHANGED
@@ -12739,7 +12739,7 @@ var _Textarea = forwardRef(Textarea);
12739
12739
 
12740
12740
  /** Comment */
12741
12741
  var Select = function (_a) {
12742
- var label = _a.label, id = _a.id, name = _a.name, options = _a.options, onChange = _a.onChange, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, value = _a.value;
12742
+ var label = _a.label, id = _a.id, name = _a.name, options = _a.options, onChange = _a.onChange, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, value = _a.value, className = _a.className;
12743
12743
  var _b = useState(value || options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
12744
12744
  var uniqueID = useId();
12745
12745
  if (!id)
@@ -12756,11 +12756,10 @@ var Select = function (_a) {
12756
12756
  typeof onChange == "function" && onChange(targetValue);
12757
12757
  setSelectedOption(targetValue);
12758
12758
  };
12759
- var selectStyles = cn("block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none", "focus:ring-purple-500 focus:border-purple-500 sm:text-sm rounded", { "border-red-500": isError }, { "border-gray-300": !isError });
12760
12759
  var wrapperStyle = cn({ "opacity-50": isDisabled });
12761
12760
  return (React__default.createElement("div", { className: wrapperStyle },
12762
12761
  label && (React__default.createElement(InputLabel, { isPlaceholder: true, isActive: true, label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled })),
12763
- React__default.createElement("select", { id: id, name: name, className: selectStyles, onChange: handleChange, disabled: isDisabled, value: selectedOption }, options.map(function (_a) {
12762
+ React__default.createElement("select", { id: id, name: name, className: cn("block w-full border-gray-300 py-2 pl-3 pr-10 text-base focus:outline-none", "rounded focus:border-purple-500 focus:ring-purple-500 sm:text-sm", { "border-red-500": isError }, { "border-gray-300": !isError }, className), onChange: handleChange, disabled: isDisabled, value: selectedOption }, options.map(function (_a) {
12764
12763
  var value = _a.value, label = _a.label;
12765
12764
  return (React__default.createElement("option", { key: value, value: value }, label));
12766
12765
  }))));
@@ -12769,6 +12768,9 @@ var Select = function (_a) {
12769
12768
  /** Comment */
12770
12769
  var Checkbox = function (_a) {
12771
12770
  var label = _a.label, id = _a.id, isDisabled = _a.isDisabled, isChecked = _a.isChecked, isRequired = _a.isRequired, isError = _a.isError, message = _a.message, value = _a.value, onChange = _a.onChange;
12771
+ var uniqueID = useId();
12772
+ if (!id)
12773
+ id = "cb-".concat(uniqueID);
12772
12774
  var checboxStyles = cn('focus:ring-purple-500 h-4 w-4 text-purple-600 border-gray-300 rounded', { 'border-red-500 shadow-none': isError });
12773
12775
  var wrapperStyles = cn('relative flex items-start', { 'opacity-50': isDisabled });
12774
12776
  var handleChange = function (e) {
@@ -12778,7 +12780,7 @@ var Checkbox = function (_a) {
12778
12780
  };
12779
12781
  return (React__default.createElement("div", { className: wrapperStyles },
12780
12782
  React__default.createElement("div", { className: "flex items-center h-5" },
12781
- React__default.createElement("input", { id: id, "aria-describedby": "".concat(id, "-description"), name: id, value: value, type: "checkbox", className: checboxStyles, disabled: isDisabled, defaultChecked: isChecked, onChange: function (e) {
12783
+ React__default.createElement("input", { id: id, "aria-describedby": "".concat(id, "-description"), name: id, value: value, type: "checkbox", className: checboxStyles, disabled: isDisabled, checked: isChecked, onChange: function (e) {
12782
12784
  handleChange(e);
12783
12785
  } })),
12784
12786
  React__default.createElement("div", { className: "ml-3 text-sm" },