@salutejs/plasma-new-hope 0.186.0-canary.1542.11725164051.0 → 0.186.0-canary.1542.11727809479.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,14 +5,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
6
6
  var React = require('react');
7
7
  var syntheticEvent = require('./syntheticEvent.js');
8
+ var setRefList = require('../../../../utils/setRefList.js');
8
9
 
9
- var _excluded = ["onChange", "component"],
10
- _excluded2 = ["onChange", "component"];
11
- var SingleForm = function SingleForm(args) {
10
+ var _excluded = ["onChange", "name", "defaultValue", "component"],
11
+ _excluded2 = ["onChange", "name", "defaultValue", "component"];
12
+ var SingleForm = /*#__PURE__*/React.forwardRef(function (args, ref) {
12
13
  var onChange = args.onChange,
14
+ name = args.name,
15
+ defaultValue = args.defaultValue,
13
16
  Component = args.component,
14
17
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(args, _excluded);
15
- var _useState = React.useState(),
18
+ var _useState = React.useState(String(defaultValue)),
16
19
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
17
20
  value = _useState2[0],
18
21
  setValue = _useState2[1];
@@ -25,8 +28,9 @@ var SingleForm = function SingleForm(args) {
25
28
  onChange && onChange(event);
26
29
  }, [value]);
27
30
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
28
- ref: selectRef,
31
+ ref: setRefList.mergeRefs(selectRef, ref),
29
32
  value: value,
33
+ name: name,
30
34
  hidden: true
31
35
  }, /*#__PURE__*/React.createElement("option", {
32
36
  value: value
@@ -34,12 +38,14 @@ var SingleForm = function SingleForm(args) {
34
38
  value: value,
35
39
  onChange: handleChange
36
40
  })));
37
- };
38
- var MultipleForm = function MultipleForm(args) {
41
+ });
42
+ var MultipleForm = /*#__PURE__*/React.forwardRef(function (args, ref) {
39
43
  var onChange = args.onChange,
44
+ name = args.name,
45
+ defaultValue = args.defaultValue,
40
46
  Component = args.component,
41
47
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(args, _excluded2);
42
- var _useState3 = React.useState([]),
48
+ var _useState3 = React.useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
43
49
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
44
50
  values = _useState4[0],
45
51
  setValues = _useState4[1];
@@ -52,8 +58,9 @@ var MultipleForm = function MultipleForm(args) {
52
58
  onChange && onChange(event);
53
59
  }, [values]);
54
60
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
55
- ref: selectRef,
61
+ ref: setRefList.mergeRefs(selectRef, ref),
56
62
  value: values,
63
+ name: name,
57
64
  multiple: true,
58
65
  hidden: true
59
66
  }, values.map(function (value) {
@@ -65,15 +72,17 @@ var MultipleForm = function MultipleForm(args) {
65
72
  value: values,
66
73
  onChange: handleChange
67
74
  })));
68
- };
75
+ });
69
76
  var getFormComponentGenerator = function getFormComponentGenerator(Component) {
70
- return function (args) {
77
+ return /*#__PURE__*/React.forwardRef(function (args, ref) {
71
78
  return args.multiple ? /*#__PURE__*/React.createElement(MultipleForm, _rollupPluginBabelHelpers.extends({}, args, {
79
+ ref: ref,
72
80
  component: Component
73
81
  })) : /*#__PURE__*/React.createElement(SingleForm, _rollupPluginBabelHelpers.extends({}, args, {
82
+ ref: ref,
74
83
  component: Component
75
84
  }));
76
- };
85
+ });
77
86
  };
78
87
 
79
88
  exports.getFormComponentGenerator = getFormComponentGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"getForm.js","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/getForm.tsx"],"sourcesContent":["import React, { ComponentType, useEffect, useRef, useState } from 'react';\n\nimport { ComboboxProps, ComboboxFormProps } from '../Combobox.types';\n\nimport { createEvent } from './syntheticEvent';\n\ntype ComboboxWithComponent = ComboboxFormProps & {\n component: ComponentType<ComboboxProps>;\n};\n\nconst SingleForm = (args: ComboboxWithComponent) => {\n const { onChange, component: Component, ...rest } = args;\n const [value, setValue] = useState<string | undefined>();\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string) => {\n setValue(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [value]);\n\n return (\n <>\n <select ref={selectRef} value={value} hidden>\n <option value={value}>{value}</option>\n </select>\n <Component {...(rest as any)} value={value} onChange={handleChange} />\n </>\n );\n};\n\nconst MultipleForm = (args: ComboboxWithComponent) => {\n const { onChange, component: Component, ...rest } = args;\n const [values, setValues] = useState<string[]>([]);\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string[]) => {\n setValues(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [values]);\n\n return (\n <>\n <select ref={selectRef} value={values} multiple hidden>\n {values.map((value) => (\n <option key={value} value={value}>\n {value}\n </option>\n ))}\n </select>\n <Component {...(rest as any)} value={values} onChange={handleChange} />\n </>\n );\n};\n\nexport const getFormComponentGenerator = (Component: ComponentType<ComboboxProps>) => {\n return (args: ComboboxFormProps) => {\n return args.multiple ? (\n <MultipleForm {...args} component={Component} />\n ) : (\n <SingleForm {...args} component={Component} />\n );\n };\n};\n"],"names":["SingleForm","args","onChange","Component","component","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","value","setValue","selectRef","useRef","handleChange","useEffect","event","createEvent","React","createElement","Fragment","ref","hidden","_extends","MultipleForm","_excluded2","_useState3","_useState4","values","setValues","multiple","map","key","getFormComponentGenerator"],"mappings":";;;;;;;;;;AAUA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA2B,EAAK;AAChD,EAAA,IAAQC,QAAQ,GAAoCD,IAAI,CAAhDC,QAAQ;IAAaC,SAAS,GAAcF,IAAI,CAAtCG,SAAS;AAAgBC,IAAAA,IAAI,GAAAC,iDAAA,CAAKL,IAAI,EAAAM,SAAA,CAAA,CAAA;AACxD,EAAA,I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,KAAA,CAAAC,aAAA,CAAClB,SAAS,EAAAsB,iCAAA,CAAA,EAAA,EAAMpB,IAAI,EAAA;AAAUO,IAAAA,KAAK,EAAEkB,MAAO;AAAC5B,IAAAA,QAAQ,EAAEc,YAAAA;AAAa,GAAA,CAAE,CACxE,CAAC,CAAA;AAEX,CAAC,CAAA;IAEYmB,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAIhC,SAAuC,EAAK;EAClF,OAAO,UAACF,IAAuB,EAAK;AAChC,IAAA,OAAOA,IAAI,CAAC+B,QAAQ,gBAChBZ,KAAA,CAAAC,aAAA,CAACK,YAAY,EAAAD,iCAAA,CAAA,EAAA,EAAKxB,IAAI,EAAA;AAAEG,MAAAA,SAAS,EAAED,SAAAA;KAAY,CAAA,CAAC,gBAEhDiB,KAAA,CAAAC,aAAA,CAACrB,UAAU,EAAAyB,iCAAA,CAAA,EAAA,EAAKxB,IAAI,EAAA;AAAEG,MAAAA,SAAS,EAAED,SAAAA;AAAU,KAAA,CAAE,CAChD,CAAA;GACJ,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"getForm.js","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/getForm.tsx"],"sourcesContent":["import React, { ComponentType, forwardRef, useEffect, useRef, useState } from 'react';\n\nimport { ComboboxProps, ComboboxFormProps } from '../Combobox.types';\nimport { mergeRefs } from '../../../../utils';\n\nimport { createEvent } from './syntheticEvent';\n\ntype ComboboxWithComponent = ComboboxFormProps & {\n component: ComponentType<ComboboxProps>;\n};\n\nconst SingleForm = forwardRef<HTMLSelectElement, ComboboxWithComponent>((args, ref) => {\n const { onChange, name, defaultValue, component: Component, ...rest } = args;\n const [value, setValue] = useState<string | undefined>(String(defaultValue));\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string) => {\n setValue(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [value]);\n\n return (\n <>\n <select ref={mergeRefs(selectRef, ref)} value={value} name={name} hidden>\n <option value={value}>{value}</option>\n </select>\n <Component {...(rest as any)} value={value} onChange={handleChange} />\n </>\n );\n});\n\nconst MultipleForm = forwardRef<HTMLSelectElement, ComboboxWithComponent>((args, ref) => {\n const { onChange, name, defaultValue, component: Component, ...rest } = args;\n const [values, setValues] = useState<string[]>(defaultValue && Array.isArray(defaultValue) ? defaultValue : []);\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string[]) => {\n setValues(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [values]);\n\n return (\n <>\n <select ref={mergeRefs(selectRef, ref)} value={values} name={name} multiple hidden>\n {values.map((value) => (\n <option key={value} value={value}>\n {value}\n </option>\n ))}\n </select>\n <Component {...(rest as any)} value={values} onChange={handleChange} />\n </>\n );\n});\n\nexport const getFormComponentGenerator = (Component: ComponentType<ComboboxProps>) => {\n return forwardRef<HTMLSelectElement, ComboboxFormProps>((args, ref) => {\n return args.multiple ? (\n <MultipleForm {...args} ref={ref} component={Component} />\n ) : (\n <SingleForm {...args} ref={ref} component={Component} />\n );\n });\n};\n"],"names":["SingleForm","forwardRef","args","ref","onChange","name","defaultValue","Component","component","rest","_objectWithoutProperties","_excluded","_useState","useState","String","_useState2","_slicedToArray","value","setValue","selectRef","useRef","handleChange","useEffect","event","createEvent","React","createElement","Fragment","mergeRefs","hidden","_extends","MultipleForm","_excluded2","_useState3","Array","isArray","_useState4","values","setValues","multiple","map","key","getFormComponentGenerator"],"mappings":";;;;;;;;;;;AAWA,IAAMA,UAAU,gBAAGC,gBAAU,CAA2C,UAACC,IAAI,EAAEC,GAAG,EAAK;AACnF,EAAA,IAAQC,QAAQ,GAAwDF,IAAI,CAApEE,QAAQ;IAAEC,IAAI,GAAkDH,IAAI,CAA1DG,IAAI;IAAEC,YAAY,GAAoCJ,IAAI,CAApDI,YAAY;IAAaC,SAAS,GAAcL,IAAI,CAAtCM,SAAS;AAAgBC,IAAAA,IAAI,GAAAC,i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
6
  });
7
7
  exports.getFormComponentGenerator = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
+ var _utils = /*#__PURE__*/require("../../../../utils");
9
10
  var _syntheticEvent = /*#__PURE__*/require("./syntheticEvent");
10
- var _excluded = ["onChange", "component"],
11
- _excluded2 = ["onChange", "component"];
11
+ var _excluded = ["onChange", "name", "defaultValue", "component"],
12
+ _excluded2 = ["onChange", "name", "defaultValue", "component"];
12
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
14
15
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -20,11 +21,13 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
20
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
22
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
22
23
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
23
- var SingleForm = function SingleForm(args) {
24
+ var SingleForm = /*#__PURE__*/(0, _react.forwardRef)(function (args, ref) {
24
25
  var onChange = args.onChange,
26
+ name = args.name,
27
+ defaultValue = args.defaultValue,
25
28
  Component = args.component,
26
29
  rest = _objectWithoutProperties(args, _excluded);
27
- var _useState = (0, _react.useState)(),
30
+ var _useState = (0, _react.useState)(String(defaultValue)),
28
31
  _useState2 = _slicedToArray(_useState, 2),
29
32
  value = _useState2[0],
30
33
  setValue = _useState2[1];
@@ -37,8 +40,9 @@ var SingleForm = function SingleForm(args) {
37
40
  onChange && onChange(event);
38
41
  }, [value]);
39
42
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
40
- ref: selectRef,
43
+ ref: (0, _utils.mergeRefs)(selectRef, ref),
41
44
  value: value,
45
+ name: name,
42
46
  hidden: true
43
47
  }, /*#__PURE__*/_react["default"].createElement("option", {
44
48
  value: value
@@ -46,12 +50,14 @@ var SingleForm = function SingleForm(args) {
46
50
  value: value,
47
51
  onChange: handleChange
48
52
  })));
49
- };
50
- var MultipleForm = function MultipleForm(args) {
53
+ });
54
+ var MultipleForm = /*#__PURE__*/(0, _react.forwardRef)(function (args, ref) {
51
55
  var onChange = args.onChange,
56
+ name = args.name,
57
+ defaultValue = args.defaultValue,
52
58
  Component = args.component,
53
59
  rest = _objectWithoutProperties(args, _excluded2);
54
- var _useState3 = (0, _react.useState)([]),
60
+ var _useState3 = (0, _react.useState)(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
55
61
  _useState4 = _slicedToArray(_useState3, 2),
56
62
  values = _useState4[0],
57
63
  setValues = _useState4[1];
@@ -64,8 +70,9 @@ var MultipleForm = function MultipleForm(args) {
64
70
  onChange && onChange(event);
65
71
  }, [values]);
66
72
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
67
- ref: selectRef,
73
+ ref: (0, _utils.mergeRefs)(selectRef, ref),
68
74
  value: values,
75
+ name: name,
69
76
  multiple: true,
70
77
  hidden: true
71
78
  }, values.map(function (value) {
@@ -77,13 +84,15 @@ var MultipleForm = function MultipleForm(args) {
77
84
  value: values,
78
85
  onChange: handleChange
79
86
  })));
80
- };
87
+ });
81
88
  var getFormComponentGenerator = exports.getFormComponentGenerator = function getFormComponentGenerator(Component) {
82
- return function (args) {
89
+ return /*#__PURE__*/(0, _react.forwardRef)(function (args, ref) {
83
90
  return args.multiple ? /*#__PURE__*/_react["default"].createElement(MultipleForm, _extends({}, args, {
91
+ ref: ref,
84
92
  component: Component
85
93
  })) : /*#__PURE__*/_react["default"].createElement(SingleForm, _extends({}, args, {
94
+ ref: ref,
86
95
  component: Component
87
96
  }));
88
- };
97
+ });
89
98
  };
@@ -1,5 +1,5 @@
1
- var _excluded = ["onChange", "component"],
2
- _excluded2 = ["onChange", "component"];
1
+ var _excluded = ["onChange", "name", "defaultValue", "component"],
2
+ _excluded2 = ["onChange", "name", "defaultValue", "component"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
5
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -9,13 +9,16 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
9
9
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
10
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
- import React, { useEffect, useRef, useState } from 'react';
12
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
13
+ import { mergeRefs } from '../../../../utils';
13
14
  import { createEvent } from './syntheticEvent';
14
- var SingleForm = function SingleForm(args) {
15
+ var SingleForm = /*#__PURE__*/forwardRef(function (args, ref) {
15
16
  var onChange = args.onChange,
17
+ name = args.name,
18
+ defaultValue = args.defaultValue,
16
19
  Component = args.component,
17
20
  rest = _objectWithoutProperties(args, _excluded);
18
- var _useState = useState(),
21
+ var _useState = useState(String(defaultValue)),
19
22
  _useState2 = _slicedToArray(_useState, 2),
20
23
  value = _useState2[0],
21
24
  setValue = _useState2[1];
@@ -28,8 +31,9 @@ var SingleForm = function SingleForm(args) {
28
31
  onChange && onChange(event);
29
32
  }, [value]);
30
33
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
31
- ref: selectRef,
34
+ ref: mergeRefs(selectRef, ref),
32
35
  value: value,
36
+ name: name,
33
37
  hidden: true
34
38
  }, /*#__PURE__*/React.createElement("option", {
35
39
  value: value
@@ -37,12 +41,14 @@ var SingleForm = function SingleForm(args) {
37
41
  value: value,
38
42
  onChange: handleChange
39
43
  })));
40
- };
41
- var MultipleForm = function MultipleForm(args) {
44
+ });
45
+ var MultipleForm = /*#__PURE__*/forwardRef(function (args, ref) {
42
46
  var onChange = args.onChange,
47
+ name = args.name,
48
+ defaultValue = args.defaultValue,
43
49
  Component = args.component,
44
50
  rest = _objectWithoutProperties(args, _excluded2);
45
- var _useState3 = useState([]),
51
+ var _useState3 = useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
46
52
  _useState4 = _slicedToArray(_useState3, 2),
47
53
  values = _useState4[0],
48
54
  setValues = _useState4[1];
@@ -55,8 +61,9 @@ var MultipleForm = function MultipleForm(args) {
55
61
  onChange && onChange(event);
56
62
  }, [values]);
57
63
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
58
- ref: selectRef,
64
+ ref: mergeRefs(selectRef, ref),
59
65
  value: values,
66
+ name: name,
60
67
  multiple: true,
61
68
  hidden: true
62
69
  }, values.map(function (value) {
@@ -68,13 +75,15 @@ var MultipleForm = function MultipleForm(args) {
68
75
  value: values,
69
76
  onChange: handleChange
70
77
  })));
71
- };
78
+ });
72
79
  export var getFormComponentGenerator = function getFormComponentGenerator(Component) {
73
- return function (args) {
80
+ return /*#__PURE__*/forwardRef(function (args, ref) {
74
81
  return args.multiple ? /*#__PURE__*/React.createElement(MultipleForm, _extends({}, args, {
82
+ ref: ref,
75
83
  component: Component
76
84
  })) : /*#__PURE__*/React.createElement(SingleForm, _extends({}, args, {
85
+ ref: ref,
77
86
  component: Component
78
87
  }));
79
- };
88
+ });
80
89
  };
@@ -1,14 +1,17 @@
1
1
  import { extends as _extends, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import React, { useState, useRef, useEffect } from 'react';
2
+ import React, { forwardRef, useState, useRef, useEffect } from 'react';
3
3
  import { createEvent } from './syntheticEvent.js';
4
+ import { mergeRefs } from '../../../../utils/setRefList.js';
4
5
 
5
- var _excluded = ["onChange", "component"],
6
- _excluded2 = ["onChange", "component"];
7
- var SingleForm = function SingleForm(args) {
6
+ var _excluded = ["onChange", "name", "defaultValue", "component"],
7
+ _excluded2 = ["onChange", "name", "defaultValue", "component"];
8
+ var SingleForm = /*#__PURE__*/forwardRef(function (args, ref) {
8
9
  var onChange = args.onChange,
10
+ name = args.name,
11
+ defaultValue = args.defaultValue,
9
12
  Component = args.component,
10
13
  rest = _objectWithoutProperties(args, _excluded);
11
- var _useState = useState(),
14
+ var _useState = useState(String(defaultValue)),
12
15
  _useState2 = _slicedToArray(_useState, 2),
13
16
  value = _useState2[0],
14
17
  setValue = _useState2[1];
@@ -21,8 +24,9 @@ var SingleForm = function SingleForm(args) {
21
24
  onChange && onChange(event);
22
25
  }, [value]);
23
26
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
24
- ref: selectRef,
27
+ ref: mergeRefs(selectRef, ref),
25
28
  value: value,
29
+ name: name,
26
30
  hidden: true
27
31
  }, /*#__PURE__*/React.createElement("option", {
28
32
  value: value
@@ -30,12 +34,14 @@ var SingleForm = function SingleForm(args) {
30
34
  value: value,
31
35
  onChange: handleChange
32
36
  })));
33
- };
34
- var MultipleForm = function MultipleForm(args) {
37
+ });
38
+ var MultipleForm = /*#__PURE__*/forwardRef(function (args, ref) {
35
39
  var onChange = args.onChange,
40
+ name = args.name,
41
+ defaultValue = args.defaultValue,
36
42
  Component = args.component,
37
43
  rest = _objectWithoutProperties(args, _excluded2);
38
- var _useState3 = useState([]),
44
+ var _useState3 = useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
39
45
  _useState4 = _slicedToArray(_useState3, 2),
40
46
  values = _useState4[0],
41
47
  setValues = _useState4[1];
@@ -48,8 +54,9 @@ var MultipleForm = function MultipleForm(args) {
48
54
  onChange && onChange(event);
49
55
  }, [values]);
50
56
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
51
- ref: selectRef,
57
+ ref: mergeRefs(selectRef, ref),
52
58
  value: values,
59
+ name: name,
53
60
  multiple: true,
54
61
  hidden: true
55
62
  }, values.map(function (value) {
@@ -61,15 +68,17 @@ var MultipleForm = function MultipleForm(args) {
61
68
  value: values,
62
69
  onChange: handleChange
63
70
  })));
64
- };
71
+ });
65
72
  var getFormComponentGenerator = function getFormComponentGenerator(Component) {
66
- return function (args) {
73
+ return /*#__PURE__*/forwardRef(function (args, ref) {
67
74
  return args.multiple ? /*#__PURE__*/React.createElement(MultipleForm, _extends({}, args, {
75
+ ref: ref,
68
76
  component: Component
69
77
  })) : /*#__PURE__*/React.createElement(SingleForm, _extends({}, args, {
78
+ ref: ref,
70
79
  component: Component
71
80
  }));
72
- };
81
+ });
73
82
  };
74
83
 
75
84
  export { getFormComponentGenerator };
@@ -1 +1 @@
1
- {"version":3,"file":"getForm.js","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/getForm.tsx"],"sourcesContent":["import React, { ComponentType, useEffect, useRef, useState } from 'react';\n\nimport { ComboboxProps, ComboboxFormProps } from '../Combobox.types';\n\nimport { createEvent } from './syntheticEvent';\n\ntype ComboboxWithComponent = ComboboxFormProps & {\n component: ComponentType<ComboboxProps>;\n};\n\nconst SingleForm = (args: ComboboxWithComponent) => {\n const { onChange, component: Component, ...rest } = args;\n const [value, setValue] = useState<string | undefined>();\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string) => {\n setValue(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [value]);\n\n return (\n <>\n <select ref={selectRef} value={value} hidden>\n <option value={value}>{value}</option>\n </select>\n <Component {...(rest as any)} value={value} onChange={handleChange} />\n </>\n );\n};\n\nconst MultipleForm = (args: ComboboxWithComponent) => {\n const { onChange, component: Component, ...rest } = args;\n const [values, setValues] = useState<string[]>([]);\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string[]) => {\n setValues(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [values]);\n\n return (\n <>\n <select ref={selectRef} value={values} multiple hidden>\n {values.map((value) => (\n <option key={value} value={value}>\n {value}\n </option>\n ))}\n </select>\n <Component {...(rest as any)} value={values} onChange={handleChange} />\n </>\n );\n};\n\nexport const getFormComponentGenerator = (Component: ComponentType<ComboboxProps>) => {\n return (args: ComboboxFormProps) => {\n return args.multiple ? (\n <MultipleForm {...args} component={Component} />\n ) : (\n <SingleForm {...args} component={Component} />\n );\n };\n};\n"],"names":["SingleForm","args","onChange","Component","component","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","value","setValue","selectRef","useRef","handleChange","useEffect","event","createEvent","React","createElement","Fragment","ref","hidden","_extends","MultipleForm","_excluded2","_useState3","_useState4","values","setValues","multiple","map","key","getFormComponentGenerator"],"mappings":";;;;;;AAUA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA2B,EAAK;AAChD,EAAA,IAAQC,QAAQ,GAAoCD,IAAI,CAAhDC,QAAQ;IAAaC,SAAS,GAAcF,IAAI,CAAtCG,SAAS;AAAgBC,IAAAA,IAAI,GAAAC,wBAAA,CAAKL,IAAI,EAAAM,SAAA,CAAA,CAAA;AACxD,EAAA,IAAAC,SAAA,GAA0BC,QAAQ,EAAsB;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAjDI,IAAAA,KAAK,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,QAAQ,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AACtB,EAAA,IAAMI,SAAS,GAAGC,MAAM,CAA2B,IAAI,CAAC,CAAA;AAExD,EAAA,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIJ,KAAa,EAAK;IACpCC,QAAQ,CAACD,KAAK,CAAC,CAAA;GAClB,CAAA;AAEDK,EAAAA,SAAS,CAAC,YAAM;A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AAA;AAAEG,MAAAA,SAAS,EAAED,SAAAA;KAAY,CAAA,CAAC,gBAEhDiB,KAAA,CAAAC,aAAA,CAACrB,UAAU,EAAAyB,QAAA,CAAA,EAAA,EAAKxB,IAAI,EAAA;AAAEG,MAAAA,SAAS,EAAED,SAAAA;AAAU,KAAA,CAAE,CAChD,CAAA;GACJ,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"getForm.js","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/getForm.tsx"],"sourcesContent":["import React, { ComponentType, forwardRef, useEffect, useRef, useState } from 'react';\n\nimport { ComboboxProps, ComboboxFormProps } from '../Combobox.types';\nimport { mergeRefs } from '../../../../utils';\n\nimport { createEvent } from './syntheticEvent';\n\ntype ComboboxWithComponent = ComboboxFormProps & {\n component: ComponentType<ComboboxProps>;\n};\n\nconst SingleForm = forwardRef<HTMLSelectElement, ComboboxWithComponent>((args, ref) => {\n const { onChange, name, defaultValue, component: Component, ...rest } = args;\n const [value, setValue] = useState<string | undefined>(String(defaultValue));\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string) => {\n setValue(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [value]);\n\n return (\n <>\n <select ref={mergeRefs(selectRef, ref)} value={value} name={name} hidden>\n <option value={value}>{value}</option>\n </select>\n <Component {...(rest as any)} value={value} onChange={handleChange} />\n </>\n );\n});\n\nconst MultipleForm = forwardRef<HTMLSelectElement, ComboboxWithComponent>((args, ref) => {\n const { onChange, name, defaultValue, component: Component, ...rest } = args;\n const [values, setValues] = useState<string[]>(defaultValue && Array.isArray(defaultValue) ? defaultValue : []);\n const selectRef = useRef<HTMLSelectElement | null>(null);\n\n const handleChange = (value: string[]) => {\n setValues(value);\n };\n\n useEffect(() => {\n const event = createEvent(selectRef);\n onChange && onChange(event);\n }, [values]);\n\n return (\n <>\n <select ref={mergeRefs(selectRef, ref)} value={values} name={name} multiple hidden>\n {values.map((value) => (\n <option key={value} value={value}>\n {value}\n </option>\n ))}\n </select>\n <Component {...(rest as any)} value={values} onChange={handleChange} />\n </>\n );\n});\n\nexport const getFormComponentGenerator = (Component: ComponentType<ComboboxProps>) => {\n return forwardRef<HTMLSelectElement, ComboboxFormProps>((args, ref) => {\n return args.multiple ? (\n <MultipleForm {...args} ref={ref} component={Component} />\n ) : (\n <SingleForm {...args} ref={ref} component={Component} />\n );\n });\n};\n"],"names":["SingleForm","forwardRef","args","ref","onChange","name","defaultValue","Component","component","rest","_objectWithoutProperties","_excluded","_useState","useState","String","_useState2","_slicedToArray","value","setValue","selectRef","useRef","handleChange","useEffect","event","createEvent","React","createElement","Fragment","mergeRefs","hidden","_extends","MultipleForm","_excluded2","_useState3","Array","isArray","_useState4","values","setValues","multiple","map","key","getFormComponentGenerator"],"mappings":";;;;;;;AAWA,IAAMA,UAAU,gBAAGC,UAAU,CAA2C,UAACC,IAAI,EAAEC,GAAG,EAAK;AACnF,EAAA,IAAQC,QAAQ,GAAwDF,IAAI,CAApEE,QAAQ;IAAEC,IAAI,GAAkDH,IAAI,CAA1DG,IAAI;IAAEC,YAAY,GAAoCJ,IAAI,CAApDI,YAAY;IAAaC,SAAS,GAAcL,IAAI,CAAtCM,SAAS;AAAgBC,IAAAA,IAAI,GAAAC,wBAAA,CAAKR,IAAI,EAAAS,SAAA,CAAA,CAAA;EAC5E,IAAAC,SAAA,GAA0BC,QAAQ,CAAqBC,MAAM,CAACR,YAAY,CAAC,CAAC;IAAAS,UAAA,GAAAC,cAAA,CAAAJ,SAAA,EAAA,CAAA,CAAA;AAArEK,IAAAA,KAAK,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,QAAQ,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AACtB,EAAA,IAAMI,SAAS,GAAGC,MAAM,CAA2B,IAAI,CAAC,CAAA;AAExD,EAAA,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIJ,KAAa,EAAK;IACpCC,QAAQ,C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EAAAuB,QAAA,CAAA,EAAA,EAAMrB,IAAI,EAAA;AAAUQ,IAAAA,KAAK,EAAEoB,MAAO;AAACjC,IAAAA,QAAQ,EAAEiB,YAAAA;AAAa,GAAA,CAAE,CACxE,CAAC,CAAA;AAEX,CAAC,CAAC,CAAA;IAEWqB,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAInC,SAAuC,EAAK;AAClF,EAAA,oBAAON,UAAU,CAAuC,UAACC,IAAI,EAAEC,GAAG,EAAK;AACnE,IAAA,OAAOD,IAAI,CAACqC,QAAQ,gBAChBd,KAAA,CAAAC,aAAA,CAACK,YAAY,EAAAD,QAAA,CAAA,EAAA,EAAK5B,IAAI,EAAA;AAAEC,MAAAA,GAAG,EAAEA,GAAI;AAACK,MAAAA,SAAS,EAAED,SAAAA;KAAY,CAAA,CAAC,gBAE1DkB,KAAA,CAAAC,aAAA,CAAC1B,UAAU,EAAA8B,QAAA,CAAA,EAAA,EAAK5B,IAAI,EAAA;AAAEC,MAAAA,GAAG,EAAEA,GAAI;AAACK,MAAAA,SAAS,EAAED,SAAAA;AAAU,KAAA,CAAE,CAC1D,CAAA;AACL,GAAC,CAAC,CAAA;AACN;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.186.0-canary.1542.11725164051.0",
3
+ "version": "0.186.0-canary.1542.11727809479.0",
4
4
  "description": "Salute Design System blueprint",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -128,5 +128,5 @@
128
128
  "sideEffects": [
129
129
  "*.css"
130
130
  ],
131
- "gitHead": "a55398233d55dab7e7b88e27f2fcef2bf69982e2"
131
+ "gitHead": "5c4545f3624df440cd89a35c507bdd6ba1dbc0db"
132
132
  }
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getFormComponentGenerator = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
+ var _utils = /*#__PURE__*/require("../../../../utils");
9
10
  var _syntheticEvent = /*#__PURE__*/require("./syntheticEvent");
10
- var _excluded = ["onChange", "component"],
11
- _excluded2 = ["onChange", "component"];
11
+ var _excluded = ["onChange", "name", "defaultValue", "component"],
12
+ _excluded2 = ["onChange", "name", "defaultValue", "component"];
12
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
14
15
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -20,11 +21,13 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
20
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
22
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
22
23
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
23
- var SingleForm = function SingleForm(args) {
24
+ var SingleForm = /*#__PURE__*/(0, _react.forwardRef)(function (args, ref) {
24
25
  var onChange = args.onChange,
26
+ name = args.name,
27
+ defaultValue = args.defaultValue,
25
28
  Component = args.component,
26
29
  rest = _objectWithoutProperties(args, _excluded);
27
- var _useState = (0, _react.useState)(),
30
+ var _useState = (0, _react.useState)(String(defaultValue)),
28
31
  _useState2 = _slicedToArray(_useState, 2),
29
32
  value = _useState2[0],
30
33
  setValue = _useState2[1];
@@ -37,8 +40,9 @@ var SingleForm = function SingleForm(args) {
37
40
  onChange && onChange(event);
38
41
  }, [value]);
39
42
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
40
- ref: selectRef,
43
+ ref: (0, _utils.mergeRefs)(selectRef, ref),
41
44
  value: value,
45
+ name: name,
42
46
  hidden: true
43
47
  }, /*#__PURE__*/_react["default"].createElement("option", {
44
48
  value: value
@@ -46,12 +50,14 @@ var SingleForm = function SingleForm(args) {
46
50
  value: value,
47
51
  onChange: handleChange
48
52
  })));
49
- };
50
- var MultipleForm = function MultipleForm(args) {
53
+ });
54
+ var MultipleForm = /*#__PURE__*/(0, _react.forwardRef)(function (args, ref) {
51
55
  var onChange = args.onChange,
56
+ name = args.name,
57
+ defaultValue = args.defaultValue,
52
58
  Component = args.component,
53
59
  rest = _objectWithoutProperties(args, _excluded2);
54
- var _useState3 = (0, _react.useState)([]),
60
+ var _useState3 = (0, _react.useState)(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
55
61
  _useState4 = _slicedToArray(_useState3, 2),
56
62
  values = _useState4[0],
57
63
  setValues = _useState4[1];
@@ -64,8 +70,9 @@ var MultipleForm = function MultipleForm(args) {
64
70
  onChange && onChange(event);
65
71
  }, [values]);
66
72
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
67
- ref: selectRef,
73
+ ref: (0, _utils.mergeRefs)(selectRef, ref),
68
74
  value: values,
75
+ name: name,
69
76
  multiple: true,
70
77
  hidden: true
71
78
  }, values.map(function (value) {
@@ -77,13 +84,15 @@ var MultipleForm = function MultipleForm(args) {
77
84
  value: values,
78
85
  onChange: handleChange
79
86
  })));
80
- };
87
+ });
81
88
  var getFormComponentGenerator = exports.getFormComponentGenerator = function getFormComponentGenerator(Component) {
82
- return function (args) {
89
+ return /*#__PURE__*/(0, _react.forwardRef)(function (args, ref) {
83
90
  return args.multiple ? /*#__PURE__*/_react["default"].createElement(MultipleForm, _extends({}, args, {
91
+ ref: ref,
84
92
  component: Component
85
93
  })) : /*#__PURE__*/_react["default"].createElement(SingleForm, _extends({}, args, {
94
+ ref: ref,
86
95
  component: Component
87
96
  }));
88
- };
97
+ });
89
98
  };
@@ -1,5 +1,5 @@
1
- var _excluded = ["onChange", "component"],
2
- _excluded2 = ["onChange", "component"];
1
+ var _excluded = ["onChange", "name", "defaultValue", "component"],
2
+ _excluded2 = ["onChange", "name", "defaultValue", "component"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
5
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -9,13 +9,16 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
9
9
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
10
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
- import React, { useEffect, useRef, useState } from 'react';
12
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
13
+ import { mergeRefs } from '../../../../utils';
13
14
  import { createEvent } from './syntheticEvent';
14
- var SingleForm = function SingleForm(args) {
15
+ var SingleForm = /*#__PURE__*/forwardRef(function (args, ref) {
15
16
  var onChange = args.onChange,
17
+ name = args.name,
18
+ defaultValue = args.defaultValue,
16
19
  Component = args.component,
17
20
  rest = _objectWithoutProperties(args, _excluded);
18
- var _useState = useState(),
21
+ var _useState = useState(String(defaultValue)),
19
22
  _useState2 = _slicedToArray(_useState, 2),
20
23
  value = _useState2[0],
21
24
  setValue = _useState2[1];
@@ -28,8 +31,9 @@ var SingleForm = function SingleForm(args) {
28
31
  onChange && onChange(event);
29
32
  }, [value]);
30
33
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
31
- ref: selectRef,
34
+ ref: mergeRefs(selectRef, ref),
32
35
  value: value,
36
+ name: name,
33
37
  hidden: true
34
38
  }, /*#__PURE__*/React.createElement("option", {
35
39
  value: value
@@ -37,12 +41,14 @@ var SingleForm = function SingleForm(args) {
37
41
  value: value,
38
42
  onChange: handleChange
39
43
  })));
40
- };
41
- var MultipleForm = function MultipleForm(args) {
44
+ });
45
+ var MultipleForm = /*#__PURE__*/forwardRef(function (args, ref) {
42
46
  var onChange = args.onChange,
47
+ name = args.name,
48
+ defaultValue = args.defaultValue,
43
49
  Component = args.component,
44
50
  rest = _objectWithoutProperties(args, _excluded2);
45
- var _useState3 = useState([]),
51
+ var _useState3 = useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
46
52
  _useState4 = _slicedToArray(_useState3, 2),
47
53
  values = _useState4[0],
48
54
  setValues = _useState4[1];
@@ -55,8 +61,9 @@ var MultipleForm = function MultipleForm(args) {
55
61
  onChange && onChange(event);
56
62
  }, [values]);
57
63
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
58
- ref: selectRef,
64
+ ref: mergeRefs(selectRef, ref),
59
65
  value: values,
66
+ name: name,
60
67
  multiple: true,
61
68
  hidden: true
62
69
  }, values.map(function (value) {
@@ -68,13 +75,15 @@ var MultipleForm = function MultipleForm(args) {
68
75
  value: values,
69
76
  onChange: handleChange
70
77
  })));
71
- };
78
+ });
72
79
  export var getFormComponentGenerator = function getFormComponentGenerator(Component) {
73
- return function (args) {
80
+ return /*#__PURE__*/forwardRef(function (args, ref) {
74
81
  return args.multiple ? /*#__PURE__*/React.createElement(MultipleForm, _extends({}, args, {
82
+ ref: ref,
75
83
  component: Component
76
84
  })) : /*#__PURE__*/React.createElement(SingleForm, _extends({}, args, {
85
+ ref: ref,
77
86
  component: Component
78
87
  }));
79
- };
88
+ });
80
89
  };
@@ -180,10 +180,12 @@ export declare type ItemContext = {
180
180
  declare type ComboboxFormBaseProps = {
181
181
  onChange?: (event: React.ChangeEvent<HTMLSelectElement> | null) => void;
182
182
  defaultValue?: string;
183
+ name?: string;
183
184
  multiple?: false;
184
185
  } | {
185
186
  onChange?: (event: React.ChangeEvent<HTMLSelectElement> | null) => void;
186
187
  defaultValue?: string[];
188
+ name?: string;
187
189
  multiple?: true;
188
190
  };
189
191
  export declare type ComboboxFormProps = Omit<ComboboxProps, 'onChange' | 'defaultValue' | 'multiple'> & ComboboxFormBaseProps;
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Combobox/ComboboxNew/Combobox.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAErF,aAAK,SAAS,GACR,KAAK,GACL,WAAW,GACX,SAAS,GACT,OAAO,GACP,aAAa,GACb,WAAW,GACX,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,CAAC;AAEjB,aAAK,aAAa,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAC9C;IACI,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,WAAW,CAAC,EAAE,KAAK,CAAC;CACvB,GACD;IACI,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC1C,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,YAAY,C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AoB,CAAC,CAAC;CAC5C,CAAC;AAEF,oBAAY,oBAAoB,GAAG,iBAAiB,GAAG;IACnD,QAAQ,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,oBAAY,gBAAgB,GAAG,aAAa,GAAG;IAC3C,QAAQ,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,oBAAY,8BAA8B,GAAG,oBAAoB,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"Combobox.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Combobox/ComboboxNew/Combobox.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAErF,aAAK,SAAS,GACR,KAAK,GACL,WAAW,GACX,SAAS,GACT,OAAO,GACP,aAAa,GACb,WAAW,GACX,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,CAAC;AAEjB,aAAK,aAAa,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAC9C;IACI,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,WAAW,CAAC,EAAE,KAAK,CAAC;CACvB,GACD;IACI,QAAQ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AAC,EAAE,IAAI,CAAC;CACnB,CAAC;AAER,oBAAY,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC,GAAG,qBAAqB,CAAC;AAEtH,oBAAY,qBAAqB,GAAG;IAChC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC;CAC5C,CAAC;AAEF,oBAAY,oBAAoB,GAAG,iBAAiB,GAAG;IACnD,QAAQ,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,oBAAY,gBAAgB,GAAG,aAAa,GAAG;IAC3C,QAAQ,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,oBAAY,8BAA8B,GAAG,oBAAoB,GAAG,gBAAgB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ComponentType } from 'react';
1
+ import React, { ComponentType } from 'react';
2
2
  import { ComboboxProps, ComboboxFormProps } from '../Combobox.types';
3
- export declare const getFormComponentGenerator: (Component: ComponentType<ComboboxProps>) => (args: ComboboxFormProps) => JSX.Element;
3
+ export declare const getFormComponentGenerator: (Component: ComponentType<ComboboxProps>) => React.ForwardRefExoticComponent<ComboboxFormProps & React.RefAttributes<HTMLSelectElement>>;
4
4
  //# sourceMappingURL=getForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/getForm.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAA+B,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA4DrE,eAAO,MAAM,yBAAyB,cAAe,cAAc,aAAa,CAAC,YAC/D,iBAAiB,gBAOlC,CAAC"}
1
+ {"version":3,"file":"getForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/getForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAA2C,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA6DrE,eAAO,MAAM,yBAAyB,cAAe,cAAc,aAAa,CAAC,gGAQhF,CAAC"}