revdev-components 0.112.0 → 0.113.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.
@@ -6,6 +6,7 @@ export * from "./inputNumber";
6
6
  export * from "./radioButton";
7
7
  export * from "./rangePicker";
8
8
  export * from "./select";
9
+ export * from "./searchSelect";
9
10
  export * from "./text-area";
10
11
  export * from "./checkbox";
11
12
  export * from "./switch";
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { SelectProps } from "antd";
3
+ import { FormLineProps } from "../line";
4
+ export interface SearchSelectFieldProps extends FormLineProps, Omit<SelectProps, "name" | "showSearch"> {
5
+ onAdd?: (search?: string) => void;
6
+ text?: {
7
+ notFound?: string;
8
+ addNew?: string;
9
+ enterToSearch?: string;
10
+ };
11
+ }
12
+ export declare const SearchSelectField: React.FC<SearchSelectFieldProps>;
package/build/index.js CHANGED
@@ -25,46 +25,46 @@ function _interopNamespaceDefault(e) {
25
25
 
26
26
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
27
27
 
28
- var s$z = {"root":"index-module_root__oU85z"};
28
+ var s$A = {"root":"index-module_root__oU85z"};
29
29
 
30
30
  var ContentHeader1 = function (_a) {
31
31
  var children = _a.children, className = _a.className;
32
- return React.createElement("h1", { className: classNames(s$z.root, className) }, children);
32
+ return React.createElement("h1", { className: classNames(s$A.root, className) }, children);
33
33
  };
34
34
 
35
- var s$y = {"root":"index-module_root__51YHj"};
35
+ var s$z = {"root":"index-module_root__51YHj"};
36
36
 
37
37
  var ContentHeader2 = function (_a) {
38
38
  var children = _a.children, className = _a.className;
39
- return React.createElement("h2", { className: classNames(s$y.root, className) }, children);
39
+ return React.createElement("h2", { className: classNames(s$z.root, className) }, children);
40
40
  };
41
41
 
42
- var s$x = {"root":"index-module_root__Fq-q1"};
42
+ var s$y = {"root":"index-module_root__Fq-q1"};
43
43
 
44
44
  var Paragraph = function (_a) {
45
45
  var children = _a.children, className = _a.className;
46
- return React.createElement("p", { className: classNames(s$x.root, className) }, children);
46
+ return React.createElement("p", { className: classNames(s$y.root, className) }, children);
47
47
  };
48
48
 
49
- var s$w = {"root":"index-module_root__VIFF-"};
49
+ var s$x = {"root":"index-module_root__VIFF-"};
50
50
 
51
51
  var PageTitle = function (_a) {
52
52
  var children = _a.children, className = _a.className;
53
- return React.createElement("h1", { className: classNames(s$w.root, className) }, children);
53
+ return React.createElement("h1", { className: classNames(s$x.root, className) }, children);
54
54
  };
55
55
 
56
- var s$v = {"root":"index-module_root__p0I0n"};
56
+ var s$w = {"root":"index-module_root__p0I0n"};
57
57
 
58
58
  var CentralDivision = function (_a) {
59
59
  var children = _a.children, className = _a.className;
60
- return React.createElement("div", { className: classNames(s$v.root, className) }, children);
60
+ return React.createElement("div", { className: classNames(s$w.root, className) }, children);
61
61
  };
62
62
 
63
- var s$u = {"root":"index-module_root__yiKO0"};
63
+ var s$v = {"root":"index-module_root__yiKO0"};
64
64
 
65
65
  var RowDivision = function (_a) {
66
66
  var children = _a.children, className = _a.className;
67
- return React.createElement("div", { className: classNames(s$u.root, className) }, children);
67
+ return React.createElement("div", { className: classNames(s$v.root, className) }, children);
68
68
  };
69
69
 
70
70
  var _path$2r;
@@ -1629,13 +1629,13 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1629
1629
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1630
1630
  };
1631
1631
 
1632
- var s$t = {"root":"index-module_root__-LDR1"};
1632
+ var s$u = {"root":"index-module_root__-LDR1"};
1633
1633
 
1634
1634
  // https://www.svgrepo.com/
1635
1635
  function useBasicIcon(_a, icons) {
1636
1636
  var className = _a.className, name = _a.name, props = __rest(_a, ["className", "name"]);
1637
1637
  var svgAttrs = React.useMemo(function () {
1638
- return __assign({ className: classNames(s$t.root, className), fill: "currentColor" }, props);
1638
+ return __assign({ className: classNames(s$u.root, className), fill: "currentColor" }, props);
1639
1639
  }, [className, props]);
1640
1640
  var Icon = icons[name];
1641
1641
  return Icon ? React.createElement(Icon, __assign({}, svgAttrs)) : undefined;
@@ -4734,7 +4734,7 @@ var SocialIcon = function (props) {
4734
4734
  return useBasicIcon(props, icons);
4735
4735
  };
4736
4736
 
4737
- var s$s = {"root":"index-module_root__gtTIa","action":"index-module_action__pOSde"};
4737
+ var s$t = {"root":"index-module_root__gtTIa","action":"index-module_action__pOSde"};
4738
4738
 
4739
4739
  var CONSOLE_COLOR = "background:rgb(28, 46, 82); color:rgb(231, 231, 231)";
4740
4740
 
@@ -4851,10 +4851,10 @@ function AppForm(_a) {
4851
4851
  setValues(changedValues, values);
4852
4852
  onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(changedValues, values);
4853
4853
  }, [setValues, onValuesChange]);
4854
- return (React.createElement(antd.Form, { form: form, onFinish: onFinish, className: classNames(s$s.root, className), layout: "vertical", onValuesChange: handleValuesChange, onFieldsChange: onFieldsChange, initialValues: initialValues }, typeof children === "function" ? children({ valid: valid }) : children));
4854
+ return (React.createElement(antd.Form, { form: form, onFinish: onFinish, className: classNames(s$t.root, className), layout: "vertical", onValuesChange: handleValuesChange, onFieldsChange: onFieldsChange, initialValues: initialValues }, typeof children === "function" ? children({ valid: valid }) : children));
4855
4855
  }
4856
4856
 
4857
- var s$r = {"root":"index-module_root__2S1Jp"};
4857
+ var s$s = {"root":"index-module_root__2S1Jp"};
4858
4858
 
4859
4859
  function useLineProps(_a) {
4860
4860
  var lineClassName = _a.lineClassName, name = _a.name, label = _a.label, rules = _a.rules, valuePropName = _a.valuePropName, noStyle = _a.noStyle, hasFeedback = _a.hasFeedback, dependencies = _a.dependencies, rest = __rest(_a, ["lineClassName", "name", "label", "rules", "valuePropName", "noStyle", "hasFeedback", "dependencies"]);
@@ -4868,7 +4868,7 @@ var FormLine = function (_a) {
4868
4868
  }
4869
4869
  return [];
4870
4870
  }, [validateRules]);
4871
- return React.createElement(antd.Form.Item, __assign({ className: classNames(s$r.root, className), rules: rules }, props));
4871
+ return React.createElement(antd.Form.Item, __assign({ className: classNames(s$s.root, className), rules: rules }, props));
4872
4872
  };
4873
4873
 
4874
4874
  var DatePickerField = function (props) {
@@ -4889,12 +4889,12 @@ var InputField = function (props) {
4889
4889
  React.createElement(antd.Input, __assign({}, controlProps))));
4890
4890
  };
4891
4891
 
4892
- var s$q = {"input":"index-module_input__71iJw"};
4892
+ var s$r = {"input":"index-module_input__71iJw"};
4893
4893
 
4894
4894
  var InputNumberField = function (props) {
4895
4895
  var _a = useLineProps(props), lineProps = _a[0], _b = _a[1], className = _b.className, controlProps = __rest(_b, ["className"]);
4896
4896
  return (React.createElement(FormLine, __assign({}, lineProps),
4897
- React.createElement(antd.InputNumber, __assign({ className: classNames(s$q.input, className) }, controlProps))));
4897
+ React.createElement(antd.InputNumber, __assign({ className: classNames(s$r.input, className) }, controlProps))));
4898
4898
  };
4899
4899
 
4900
4900
  var RadioButtonField = function (props) {
@@ -4903,13 +4903,13 @@ var RadioButtonField = function (props) {
4903
4903
  React.createElement(antd.Radio.Group, __assign({ buttonStyle: buttonStyle, optionType: optionType }, controlProps))));
4904
4904
  };
4905
4905
 
4906
- var s$p = {"popup":"index-module_popup__Im5Y-"};
4906
+ var s$q = {"popup":"index-module_popup__Im5Y-"};
4907
4907
 
4908
4908
  var RangePicker = antd.DatePicker.RangePicker;
4909
4909
  var RangePickerField = function (props) {
4910
4910
  var _a = useLineProps(props), lineProps = _a[0], _b = _a[1], oneMonth = _b.oneMonth, controlProps = __rest(_b, ["oneMonth"]);
4911
4911
  return (React.createElement(FormLine, __assign({}, lineProps),
4912
- React.createElement(RangePicker, __assign({}, controlProps, { popupClassName: oneMonth ? s$p.popup : undefined }))));
4912
+ React.createElement(RangePicker, __assign({}, controlProps, { popupClassName: oneMonth ? s$q.popup : undefined }))));
4913
4913
  };
4914
4914
 
4915
4915
  var SelectField = function (props) {
@@ -4918,6 +4918,24 @@ var SelectField = function (props) {
4918
4918
  React.createElement(antd.Select, __assign({}, controlProps))));
4919
4919
  };
4920
4920
 
4921
+ var s$p = {"empty":"index-module_empty__sV0Gg","add":"index-module_add__f03vM"};
4922
+
4923
+ var SearchSelectField = function (props) {
4924
+ var _a = useLineProps(props), lineProps = _a[0], _b = _a[1], onSearch = _b.onSearch, onAdd = _b.onAdd, loading = _b.loading, text = _b.text, controlProps = __rest(_b, ["onSearch", "onAdd", "loading", "text"]);
4925
+ var _c = React.useState(""), searchText = _c[0], setSearchText = _c[1];
4926
+ var handleSearch = React.useCallback(function (search) {
4927
+ setSearchText(search);
4928
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(search);
4929
+ }, [onSearch]);
4930
+ var handleAdd = React.useCallback(function () {
4931
+ onAdd === null || onAdd === void 0 ? void 0 : onAdd(searchText);
4932
+ }, [searchText, onAdd]);
4933
+ return (React.createElement(FormLine, __assign({}, lineProps),
4934
+ React.createElement(antd.Select, __assign({}, controlProps, { showSearch: true, onSearch: handleSearch, loading: loading, notFoundContent: loading ? null : (React.createElement("div", { className: s$p.empty }, searchText ? (React.createElement(React.Fragment, null,
4935
+ (text === null || text === void 0 ? void 0 : text.notFound) || "Not found",
4936
+ React.createElement(antd.Button, { size: "small", className: s$p.add, onClick: handleAdd }, (text === null || text === void 0 ? void 0 : text.addNew) || "Add New"))) : ((text === null || text === void 0 ? void 0 : text.enterToSearch) || "Enter text to start search"))) }))));
4937
+ };
4938
+
4921
4939
  var TextArea = antd.Input.TextArea;
4922
4940
  var TextAreaField = function (props) {
4923
4941
  var _a = useLineProps(props), lineProps = _a[0], controlProps = _a[1];
@@ -5523,6 +5541,7 @@ exports.RegularDialog = RegularDialog;
5523
5541
  exports.RegularIcon = RegularIcon;
5524
5542
  exports.RegularIconNameList = RegularIconNameList;
5525
5543
  exports.RowDivision = RowDivision;
5544
+ exports.SearchSelectField = SearchSelectField;
5526
5545
  exports.SelectField = SelectField;
5527
5546
  exports.SocialIcon = SocialIcon;
5528
5547
  exports.SocialIconNameList = SocialIconNameList;
package/build/styles.css CHANGED
@@ -106,6 +106,15 @@ body {
106
106
  .index-module_popup__Im5Y-.ant-picker-panel:nth-child(1) button {
107
107
  visibility: visible !important;
108
108
  }
109
+ .index-module_empty__sV0Gg {
110
+ text-align: center;
111
+ padding: 15px 0;
112
+ }
113
+
114
+ .index-module_add__f03vM {
115
+ margin-top: 10px;
116
+ width: 100%;
117
+ }
109
118
  .index-module_root__GGl-p {
110
119
  display: flex;
111
120
  flex-direction: row;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev-components",
3
- "version": "0.112.0",
3
+ "version": "0.113.0",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.esm.js",
6
6
  "scripts": {