revdev-components 0.156.0 → 0.158.0

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.
@@ -11,3 +11,4 @@ export * from "./textArea";
11
11
  export * from "./checkbox";
12
12
  export * from "./switch";
13
13
  export * from "./autocomplete";
14
+ export * from "./switchButton";
package/build/index.js CHANGED
@@ -5043,6 +5043,25 @@ var AutoCompleteField = function (props) {
5043
5043
  React.createElement(antd.AutoComplete, __assign({}, controlProps))));
5044
5044
  };
5045
5045
 
5046
+ var SwitchButtonControl = function (_a) {
5047
+ var onChange = _a.onChange, value = _a.value, options = _a.options, rest = __rest(_a, ["onChange", "value", "options"]);
5048
+ var handleChange = React.useCallback(function (newValue) {
5049
+ if (value == newValue) {
5050
+ onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
5051
+ }
5052
+ else {
5053
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
5054
+ }
5055
+ }, [onChange, value]);
5056
+ return (React.createElement(antd.Radio.Group, __assign({ value: value }, rest), options.map(function (option) { return (React.createElement(antd.Radio.Button, { key: option.value, value: option.value, onClick: function () { return handleChange(option.value); } }, option.label)); })));
5057
+ };
5058
+
5059
+ var SwitchButtonField = function (props) {
5060
+ var _a = useLineProps(props), lineProps = _a[0], _b = _a[1], _c = _b.buttonStyle, buttonStyle = _c === void 0 ? "solid" : _c, _d = _b.optionType, optionType = _d === void 0 ? "button" : _d, controlProps = __rest(_b, ["buttonStyle", "optionType"]);
5061
+ return (React.createElement(FormLine, __assign({}, lineProps),
5062
+ React.createElement(SwitchButtonControl, __assign({ buttonStyle: buttonStyle, optionType: optionType }, controlProps))));
5063
+ };
5064
+
5046
5065
  var s$l = {"root":"index-module_root__9GQDU"};
5047
5066
 
5048
5067
  var FormButton = function (_a) {
@@ -5412,6 +5431,7 @@ var s$3 = {"root":"index-module_root__AUcgm","separator":"index-module_separator
5412
5431
 
5413
5432
  var TextUtil = {
5414
5433
  maxTextEllipsis: function (text, maxLength) {
5434
+ if (text === void 0) { text = ""; }
5415
5435
  if (text.length <= maxLength) {
5416
5436
  return text;
5417
5437
  }
@@ -5623,6 +5643,7 @@ exports.SelectField = SelectField;
5623
5643
  exports.SocialIcon = SocialIcon;
5624
5644
  exports.SocialIconNameList = SocialIconNameList;
5625
5645
  exports.SplitLine = SplitLine;
5646
+ exports.SwitchButtonField = SwitchButtonField;
5626
5647
  exports.SwitchField = SwitchField;
5627
5648
  exports.TextAreaField = TextAreaField;
5628
5649
  exports.TextUtil = TextUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev-components",
3
- "version": "0.156.0",
3
+ "version": "0.158.0",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.esm.js",
6
6
  "scripts": {