@tenancy.nz/ui 1.3.6 → 1.3.7

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.
@@ -18,8 +18,6 @@ function BooleanInput(_ref) {
18
18
  fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
19
19
  _ref$helperText = _ref.helperText,
20
20
  helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
21
- _ref$helperTextPlacem = _ref.helperTextPlacement,
22
- helperTextPlacement = _ref$helperTextPlacem === void 0 ? "below" : _ref$helperTextPlacem,
23
21
  _ref$label = _ref.label,
24
22
  label = _ref$label === void 0 ? "" : _ref$label,
25
23
  _ref$required = _ref.required,
@@ -54,7 +52,6 @@ function BooleanInput(_ref) {
54
52
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
55
53
  checked = _useState4[0],
56
54
  setChecked = _useState4[1];
57
- var hasError = showError && errorMessage;
58
55
  React.useEffect(function () {
59
56
  if (value !== null && value !== "" && value !== void 0) {
60
57
  setIndeterminate(false);
@@ -70,11 +67,10 @@ function BooleanInput(_ref) {
70
67
  label: label,
71
68
  name: name,
72
69
  helperText: helperText,
73
- helperTextPlacement: helperTextPlacement,
74
70
  disabled: disabled,
75
71
  required: required,
76
72
  showError: showError,
77
- errorMessage: errorMessage,
73
+ message: errorMessage,
78
74
  edges: edges
79
75
  }, /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(FormFocus.default, {
80
76
  name: name
@@ -94,7 +90,7 @@ function BooleanInput(_ref) {
94
90
  checked: checked,
95
91
  required: required,
96
92
  selected: !indeterminate && checked,
97
- error: hasError ? "yes" : "no"
93
+ error: showError ? "yes" : "no"
98
94
  }, trueLabel), /* @__PURE__ */React.createElement(BooleanInput_styled.StyledButton, {
99
95
  variant: indeterminate || checked ? "outlined" : "contained",
100
96
  onClick: function onClick(e) {
@@ -109,7 +105,7 @@ function BooleanInput(_ref) {
109
105
  checked: checked,
110
106
  required: required,
111
107
  selected: !indeterminate && !checked,
112
- error: hasError ? "yes" : "no"
108
+ error: showError ? "yes" : "no"
113
109
  }, falseLabel))));
114
110
  }
115
111
  BooleanInput.propTypes = {
@@ -145,10 +141,6 @@ BooleanInput.propTypes = {
145
141
  * The helper text content.
146
142
  */
147
143
  helperText: PropTypes.string,
148
- /**
149
- * Placed the helper text above or below the input.
150
- */
151
- helperTextPlacement: PropTypes.oneOf(["above", "below"]),
152
144
  /**
153
145
  * The label content.
154
146
  */
@@ -7,24 +7,24 @@ var ButtonGroup = require('@mui/material/ButtonGroup');
7
7
 
8
8
  var selectedStyles = function selectedStyles(hasError, theme) {
9
9
  return {
10
- borderColor: hasError === "yes" ? theme.palette.secondary.main : theme.palette.primary.main,
10
+ borderColor: hasError === "yes" ? theme.palette.error.main : theme.palette.primary.main,
11
11
  color: "#fff",
12
- background: hasError === "yes" ? theme.palette.secondary.main : theme.palette.primary.main,
12
+ background: hasError === "yes" ? theme.palette.error.main : theme.palette.primary.main,
13
13
  "&:hover": {
14
- background: hasError === "yes" ? theme.palette.secondary.dark : theme.palette.primary.dark
14
+ background: hasError === "yes" ? theme.palette.error.dark : theme.palette.primary.dark
15
15
  }
16
16
  };
17
17
  };
18
18
  var unselectedStyles = function unselectedStyles(error, theme) {
19
19
  return {
20
- borderColor: error === "yes" ? theme.palette.secondary.main : theme.palette.primary.main,
21
- color: error === "yes" ? theme.palette.secondary.main : theme.palette.primary.main
20
+ borderColor: error === "yes" ? theme.palette.error.main : theme.palette.primary.main,
21
+ color: error === "yes" ? theme.palette.error.main : theme.palette.primary.main
22
22
  };
23
23
  };
24
- var requiredUnselectedStyles = function requiredUnselectedStyles(selected, theme) {
24
+ var requiredUnselectedStyles = function requiredUnselectedStyles(selected, error, theme) {
25
25
  return {
26
- borderColor: !selected ? theme.palette.secondary.main : theme.palette.primary.main,
27
- color: !selected ? theme.palette.secondary.main : theme.palette.primary.main
26
+ borderColor: error === "yes" ? theme.palette.error.main : theme.palette.primary.main,
27
+ color: error === "yes" ? theme.palette.error.main : theme.palette.primary.main
28
28
  };
29
29
  };
30
30
  var borderRadiusStyles = function borderRadiusStyles(edges, theme) {
@@ -42,8 +42,8 @@ var StyledButton = styles.styled(Button)(function (_ref) {
42
42
  required = _ref.required,
43
43
  selected = _ref.selected,
44
44
  theme = _ref.theme;
45
- return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, !selected && required && _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, requiredUnselectedStyles(selected, theme)), {}, {
46
- "&:hover, &:active, &:focus": _rollupPluginBabelHelpers.objectSpread2({}, requiredUnselectedStyles(selected, theme))
45
+ return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, !selected && required && _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, requiredUnselectedStyles(selected, error, theme)), {}, {
46
+ "&:hover, &:active, &:focus": _rollupPluginBabelHelpers.objectSpread2({}, requiredUnselectedStyles(selected, error, theme))
47
47
  })), !selected && !required && _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, unselectedStyles(error, theme)), {}, {
48
48
  "&:hover, &:active, &:focus": _rollupPluginBabelHelpers.objectSpread2({}, unselectedStyles(error, theme))
49
49
  })), selected && indeterminate === "no" && selectedStyles(error, theme));
@@ -22,6 +22,7 @@ function StatusMessage(_ref) {
22
22
  }
23
23
  }, sx);
24
24
  return /* @__PURE__ */React.createElement(Alert.default, {
25
+ color: color,
25
26
  variant: "standard",
26
27
  sx: styles
27
28
  }, children);
@@ -14,8 +14,6 @@ function BooleanInput(_ref) {
14
14
  fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
15
15
  _ref$helperText = _ref.helperText,
16
16
  helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
17
- _ref$helperTextPlacem = _ref.helperTextPlacement,
18
- helperTextPlacement = _ref$helperTextPlacem === void 0 ? "below" : _ref$helperTextPlacem,
19
17
  _ref$label = _ref.label,
20
18
  label = _ref$label === void 0 ? "" : _ref$label,
21
19
  _ref$required = _ref.required,
@@ -50,7 +48,6 @@ function BooleanInput(_ref) {
50
48
  _useState4 = _slicedToArray(_useState3, 2),
51
49
  checked = _useState4[0],
52
50
  setChecked = _useState4[1];
53
- var hasError = showError && errorMessage;
54
51
  useEffect(function () {
55
52
  if (value !== null && value !== "" && value !== void 0) {
56
53
  setIndeterminate(false);
@@ -66,11 +63,10 @@ function BooleanInput(_ref) {
66
63
  label: label,
67
64
  name: name,
68
65
  helperText: helperText,
69
- helperTextPlacement: helperTextPlacement,
70
66
  disabled: disabled,
71
67
  required: required,
72
68
  showError: showError,
73
- errorMessage: errorMessage,
69
+ message: errorMessage,
74
70
  edges: edges
75
71
  }, /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(FormFocus, {
76
72
  name: name
@@ -90,7 +86,7 @@ function BooleanInput(_ref) {
90
86
  checked: checked,
91
87
  required: required,
92
88
  selected: !indeterminate && checked,
93
- error: hasError ? "yes" : "no"
89
+ error: showError ? "yes" : "no"
94
90
  }, trueLabel), /* @__PURE__ */React.createElement(StyledButton, {
95
91
  variant: indeterminate || checked ? "outlined" : "contained",
96
92
  onClick: function onClick(e) {
@@ -105,7 +101,7 @@ function BooleanInput(_ref) {
105
101
  checked: checked,
106
102
  required: required,
107
103
  selected: !indeterminate && !checked,
108
- error: hasError ? "yes" : "no"
104
+ error: showError ? "yes" : "no"
109
105
  }, falseLabel))));
110
106
  }
111
107
  BooleanInput.propTypes = {
@@ -141,10 +137,6 @@ BooleanInput.propTypes = {
141
137
  * The helper text content.
142
138
  */
143
139
  helperText: PropTypes.string,
144
- /**
145
- * Placed the helper text above or below the input.
146
- */
147
- helperTextPlacement: PropTypes.oneOf(["above", "below"]),
148
140
  /**
149
141
  * The label content.
150
142
  */
@@ -5,24 +5,24 @@ import ButtonGroup from '@mui/material/ButtonGroup';
5
5
 
6
6
  var selectedStyles = function selectedStyles(hasError, theme) {
7
7
  return {
8
- borderColor: hasError === "yes" ? theme.palette.secondary.main : theme.palette.primary.main,
8
+ borderColor: hasError === "yes" ? theme.palette.error.main : theme.palette.primary.main,
9
9
  color: "#fff",
10
- background: hasError === "yes" ? theme.palette.secondary.main : theme.palette.primary.main,
10
+ background: hasError === "yes" ? theme.palette.error.main : theme.palette.primary.main,
11
11
  "&:hover": {
12
- background: hasError === "yes" ? theme.palette.secondary.dark : theme.palette.primary.dark
12
+ background: hasError === "yes" ? theme.palette.error.dark : theme.palette.primary.dark
13
13
  }
14
14
  };
15
15
  };
16
16
  var unselectedStyles = function unselectedStyles(error, theme) {
17
17
  return {
18
- borderColor: error === "yes" ? theme.palette.secondary.main : theme.palette.primary.main,
19
- color: error === "yes" ? theme.palette.secondary.main : theme.palette.primary.main
18
+ borderColor: error === "yes" ? theme.palette.error.main : theme.palette.primary.main,
19
+ color: error === "yes" ? theme.palette.error.main : theme.palette.primary.main
20
20
  };
21
21
  };
22
- var requiredUnselectedStyles = function requiredUnselectedStyles(selected, theme) {
22
+ var requiredUnselectedStyles = function requiredUnselectedStyles(selected, error, theme) {
23
23
  return {
24
- borderColor: !selected ? theme.palette.secondary.main : theme.palette.primary.main,
25
- color: !selected ? theme.palette.secondary.main : theme.palette.primary.main
24
+ borderColor: error === "yes" ? theme.palette.error.main : theme.palette.primary.main,
25
+ color: error === "yes" ? theme.palette.error.main : theme.palette.primary.main
26
26
  };
27
27
  };
28
28
  var borderRadiusStyles = function borderRadiusStyles(edges, theme) {
@@ -40,8 +40,8 @@ var StyledButton = styled(Button)(function (_ref) {
40
40
  required = _ref.required,
41
41
  selected = _ref.selected,
42
42
  theme = _ref.theme;
43
- return _objectSpread2(_objectSpread2(_objectSpread2({}, !selected && required && _objectSpread2(_objectSpread2({}, requiredUnselectedStyles(selected, theme)), {}, {
44
- "&:hover, &:active, &:focus": _objectSpread2({}, requiredUnselectedStyles(selected, theme))
43
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, !selected && required && _objectSpread2(_objectSpread2({}, requiredUnselectedStyles(selected, error, theme)), {}, {
44
+ "&:hover, &:active, &:focus": _objectSpread2({}, requiredUnselectedStyles(selected, error, theme))
45
45
  })), !selected && !required && _objectSpread2(_objectSpread2({}, unselectedStyles(error, theme)), {}, {
46
46
  "&:hover, &:active, &:focus": _objectSpread2({}, unselectedStyles(error, theme))
47
47
  })), selected && indeterminate === "no" && selectedStyles(error, theme));
@@ -18,6 +18,7 @@ function StatusMessage(_ref) {
18
18
  }
19
19
  }, sx);
20
20
  return /* @__PURE__ */React.createElement(Alert, {
21
+ color: color,
21
22
  variant: "standard",
22
23
  sx: styles
23
24
  }, children);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenancy.nz/ui",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "Library of React UI components for tenancy.co.nz apps.",
5
5
  "author": "Tenancy.co.nz <monty@tenancy.co.nz>",
6
6
  "keywords": [