@teselagen/ui 0.4.2 → 0.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -828,8 +828,8 @@ export const renderSelect = props => {
828
828
  placeholder && value === ""
829
829
  ? "__placeholder__"
830
830
  : typeof value !== "string"
831
- ? sortify(value) //deterministically sort and stringify the object/number coming in because select fields only support string values
832
- : value
831
+ ? sortify(value) //deterministically sort and stringify the object/number coming in because select fields only support string values
832
+ : value
833
833
  }
834
834
  disabled={disabled}
835
835
  {...(hideValue ? { value: "" } : {})}
@@ -947,15 +947,37 @@ export const renderBlueprintRadioGroup = ({
947
947
  ...rest
948
948
  }) => {
949
949
  const optionsToUse = getOptions(options);
950
+ if (
951
+ options.some(opt => {
952
+ if (opt.value === "true") {
953
+ return true;
954
+ }
955
+ return false;
956
+ })
957
+ ) {
958
+ throw new Error(
959
+ 'RadioGroup values cannot be strings of "true" or "false", they must be actual booleans'
960
+ );
961
+ }
950
962
  return (
951
963
  <RadioGroup
952
964
  {...input}
953
965
  {...removeUnwantedProps(rest)}
954
966
  selectedValue={input.value}
955
967
  label={undefined} //removing label from radio group because our label already handles it
956
- onChange={function (e, val, ...args) {
957
- input.onChange(e, val, ...args);
958
- onFieldSubmit(e.target ? e.target.value : val);
968
+ onChange={function (e) {
969
+ let val = e.target.value;
970
+ if (val === "true") {
971
+ val = true;
972
+ }
973
+ if (val === "false") {
974
+ val = false;
975
+ }
976
+ if (val === "") {
977
+ val = false;
978
+ }
979
+ input.onChange(val);
980
+ onFieldSubmit(val);
959
981
  }}
960
982
  options={optionsToUse}
961
983
  />