@salutejs/plasma-new-hope 0.186.0-canary.1542.11725164051.0 → 0.186.0-canary.1542.11726237853.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/utils/getForm.js +10 -4
- package/cjs/components/Combobox/ComboboxNew/utils/getForm.js.map +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/getForm.js +10 -4
- package/emotion/es/components/Combobox/ComboboxNew/utils/getForm.js +10 -4
- package/es/components/Combobox/ComboboxNew/utils/getForm.js +10 -4
- package/es/components/Combobox/ComboboxNew/utils/getForm.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getForm.js +10 -4
- package/styled-components/es/components/Combobox/ComboboxNew/utils/getForm.js +10 -4
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +2 -0
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
@@ -6,13 +6,15 @@ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabel
|
|
6
6
|
var React = require('react');
|
7
7
|
var syntheticEvent = require('./syntheticEvent.js');
|
8
8
|
|
9
|
-
var _excluded = ["onChange", "component"],
|
10
|
-
_excluded2 = ["onChange", "component"];
|
9
|
+
var _excluded = ["onChange", "name", "defaultValue", "component"],
|
10
|
+
_excluded2 = ["onChange", "name", "defaultValue", "component"];
|
11
11
|
var SingleForm = function SingleForm(args) {
|
12
12
|
var onChange = args.onChange,
|
13
|
+
name = args.name,
|
14
|
+
defaultValue = args.defaultValue,
|
13
15
|
Component = args.component,
|
14
16
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(args, _excluded);
|
15
|
-
var _useState = React.useState(),
|
17
|
+
var _useState = React.useState(String(defaultValue)),
|
16
18
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
17
19
|
value = _useState2[0],
|
18
20
|
setValue = _useState2[1];
|
@@ -27,6 +29,7 @@ var SingleForm = function SingleForm(args) {
|
|
27
29
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
28
30
|
ref: selectRef,
|
29
31
|
value: value,
|
32
|
+
name: name,
|
30
33
|
hidden: true
|
31
34
|
}, /*#__PURE__*/React.createElement("option", {
|
32
35
|
value: value
|
@@ -37,9 +40,11 @@ var SingleForm = function SingleForm(args) {
|
|
37
40
|
};
|
38
41
|
var MultipleForm = function MultipleForm(args) {
|
39
42
|
var onChange = args.onChange,
|
43
|
+
name = args.name,
|
44
|
+
defaultValue = args.defaultValue,
|
40
45
|
Component = args.component,
|
41
46
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(args, _excluded2);
|
42
|
-
var _useState3 = React.useState([]),
|
47
|
+
var _useState3 = React.useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
|
43
48
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
44
49
|
values = _useState4[0],
|
45
50
|
setValues = _useState4[1];
|
@@ -54,6 +59,7 @@ var MultipleForm = function MultipleForm(args) {
|
|
54
59
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
55
60
|
ref: selectRef,
|
56
61
|
value: values,
|
62
|
+
name: name,
|
57
63
|
multiple: true,
|
58
64
|
hidden: true
|
59
65
|
}, values.map(function (value) {
|
@@ -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,
|
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, 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={selectRef} 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 = (args: ComboboxWithComponent) => {\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={selectRef} 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 (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","name","defaultValue","Component","component","rest","_objectWithoutProperties","_excluded","_useState","useState","String","_useState2","_slicedToArray","value","setValue","selectRef","useRef","handleChange","useEffect","event","createEvent","React","createElement","Fragment","ref","hidden","_extends","MultipleForm","_excluded2","_useState3","Array","isArray","_useState4","values","setValues","multiple","map","key","getFormComponentGenerator"],"mappings":";;;;;;;;;;AAUA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA2B,EAAK;AAChD,EAAA,IAAQC,QAAQ,GAAwDD,IAAI,CAApEC,QAAQ;IAAEC,IAAI,GAAkDF,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*#__PURE__*/require("react"));
|
9
9
|
var _syntheticEvent = /*#__PURE__*/require("./syntheticEvent");
|
10
|
-
var _excluded = ["onChange", "component"],
|
11
|
-
_excluded2 = ["onChange", "component"];
|
10
|
+
var _excluded = ["onChange", "name", "defaultValue", "component"],
|
11
|
+
_excluded2 = ["onChange", "name", "defaultValue", "component"];
|
12
12
|
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
13
|
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
14
|
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); }
|
@@ -22,9 +22,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
22
22
|
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
23
|
var SingleForm = function SingleForm(args) {
|
24
24
|
var onChange = args.onChange,
|
25
|
+
name = args.name,
|
26
|
+
defaultValue = args.defaultValue,
|
25
27
|
Component = args.component,
|
26
28
|
rest = _objectWithoutProperties(args, _excluded);
|
27
|
-
var _useState = (0, _react.useState)(),
|
29
|
+
var _useState = (0, _react.useState)(String(defaultValue)),
|
28
30
|
_useState2 = _slicedToArray(_useState, 2),
|
29
31
|
value = _useState2[0],
|
30
32
|
setValue = _useState2[1];
|
@@ -39,6 +41,7 @@ var SingleForm = function SingleForm(args) {
|
|
39
41
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
|
40
42
|
ref: selectRef,
|
41
43
|
value: value,
|
44
|
+
name: name,
|
42
45
|
hidden: true
|
43
46
|
}, /*#__PURE__*/_react["default"].createElement("option", {
|
44
47
|
value: value
|
@@ -49,9 +52,11 @@ var SingleForm = function SingleForm(args) {
|
|
49
52
|
};
|
50
53
|
var MultipleForm = function MultipleForm(args) {
|
51
54
|
var onChange = args.onChange,
|
55
|
+
name = args.name,
|
56
|
+
defaultValue = args.defaultValue,
|
52
57
|
Component = args.component,
|
53
58
|
rest = _objectWithoutProperties(args, _excluded2);
|
54
|
-
var _useState3 = (0, _react.useState)([]),
|
59
|
+
var _useState3 = (0, _react.useState)(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
|
55
60
|
_useState4 = _slicedToArray(_useState3, 2),
|
56
61
|
values = _useState4[0],
|
57
62
|
setValues = _useState4[1];
|
@@ -66,6 +71,7 @@ var MultipleForm = function MultipleForm(args) {
|
|
66
71
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
|
67
72
|
ref: selectRef,
|
68
73
|
value: values,
|
74
|
+
name: name,
|
69
75
|
multiple: true,
|
70
76
|
hidden: true
|
71
77
|
}, values.map(function (value) {
|
@@ -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."); }
|
@@ -13,9 +13,11 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
13
13
|
import { createEvent } from './syntheticEvent';
|
14
14
|
var SingleForm = function SingleForm(args) {
|
15
15
|
var onChange = args.onChange,
|
16
|
+
name = args.name,
|
17
|
+
defaultValue = args.defaultValue,
|
16
18
|
Component = args.component,
|
17
19
|
rest = _objectWithoutProperties(args, _excluded);
|
18
|
-
var _useState = useState(),
|
20
|
+
var _useState = useState(String(defaultValue)),
|
19
21
|
_useState2 = _slicedToArray(_useState, 2),
|
20
22
|
value = _useState2[0],
|
21
23
|
setValue = _useState2[1];
|
@@ -30,6 +32,7 @@ var SingleForm = function SingleForm(args) {
|
|
30
32
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
31
33
|
ref: selectRef,
|
32
34
|
value: value,
|
35
|
+
name: name,
|
33
36
|
hidden: true
|
34
37
|
}, /*#__PURE__*/React.createElement("option", {
|
35
38
|
value: value
|
@@ -40,9 +43,11 @@ var SingleForm = function SingleForm(args) {
|
|
40
43
|
};
|
41
44
|
var MultipleForm = function MultipleForm(args) {
|
42
45
|
var onChange = args.onChange,
|
46
|
+
name = args.name,
|
47
|
+
defaultValue = args.defaultValue,
|
43
48
|
Component = args.component,
|
44
49
|
rest = _objectWithoutProperties(args, _excluded2);
|
45
|
-
var _useState3 = useState([]),
|
50
|
+
var _useState3 = useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
|
46
51
|
_useState4 = _slicedToArray(_useState3, 2),
|
47
52
|
values = _useState4[0],
|
48
53
|
setValues = _useState4[1];
|
@@ -57,6 +62,7 @@ var MultipleForm = function MultipleForm(args) {
|
|
57
62
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
58
63
|
ref: selectRef,
|
59
64
|
value: values,
|
65
|
+
name: name,
|
60
66
|
multiple: true,
|
61
67
|
hidden: true
|
62
68
|
}, values.map(function (value) {
|
@@ -2,13 +2,15 @@ import { extends as _extends, objectWithoutProperties as _objectWithoutPropertie
|
|
2
2
|
import React, { useState, useRef, useEffect } from 'react';
|
3
3
|
import { createEvent } from './syntheticEvent.js';
|
4
4
|
|
5
|
-
var _excluded = ["onChange", "component"],
|
6
|
-
_excluded2 = ["onChange", "component"];
|
5
|
+
var _excluded = ["onChange", "name", "defaultValue", "component"],
|
6
|
+
_excluded2 = ["onChange", "name", "defaultValue", "component"];
|
7
7
|
var SingleForm = function SingleForm(args) {
|
8
8
|
var onChange = args.onChange,
|
9
|
+
name = args.name,
|
10
|
+
defaultValue = args.defaultValue,
|
9
11
|
Component = args.component,
|
10
12
|
rest = _objectWithoutProperties(args, _excluded);
|
11
|
-
var _useState = useState(),
|
13
|
+
var _useState = useState(String(defaultValue)),
|
12
14
|
_useState2 = _slicedToArray(_useState, 2),
|
13
15
|
value = _useState2[0],
|
14
16
|
setValue = _useState2[1];
|
@@ -23,6 +25,7 @@ var SingleForm = function SingleForm(args) {
|
|
23
25
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
24
26
|
ref: selectRef,
|
25
27
|
value: value,
|
28
|
+
name: name,
|
26
29
|
hidden: true
|
27
30
|
}, /*#__PURE__*/React.createElement("option", {
|
28
31
|
value: value
|
@@ -33,9 +36,11 @@ var SingleForm = function SingleForm(args) {
|
|
33
36
|
};
|
34
37
|
var MultipleForm = function MultipleForm(args) {
|
35
38
|
var onChange = args.onChange,
|
39
|
+
name = args.name,
|
40
|
+
defaultValue = args.defaultValue,
|
36
41
|
Component = args.component,
|
37
42
|
rest = _objectWithoutProperties(args, _excluded2);
|
38
|
-
var _useState3 = useState([]),
|
43
|
+
var _useState3 = useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
|
39
44
|
_useState4 = _slicedToArray(_useState3, 2),
|
40
45
|
values = _useState4[0],
|
41
46
|
setValues = _useState4[1];
|
@@ -50,6 +55,7 @@ var MultipleForm = function MultipleForm(args) {
|
|
50
55
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
51
56
|
ref: selectRef,
|
52
57
|
value: values,
|
58
|
+
name: name,
|
53
59
|
multiple: true,
|
54
60
|
hidden: true
|
55
61
|
}, values.map(function (value) {
|
@@ -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,
|
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, 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={selectRef} 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 = (args: ComboboxWithComponent) => {\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={selectRef} 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 (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","name","defaultValue","Component","component","rest","_objectWithoutProperties","_excluded","_useState","useState","String","_useState2","_slicedToArray","value","setValue","selectRef","useRef","handleChange","useEffect","event","createEvent","React","createElement","Fragment","ref","hidden","_extends","MultipleForm","_excluded2","_useState3","Array","isArray","_useState4","values","setValues","multiple","map","key","getFormComponentGenerator"],"mappings":";;;;;;AAUA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA2B,EAAK;AAChD,EAAA,IAAQC,QAAQ,GAAwDD,IAAI,CAApEC,QAAQ;IAAEC,IAAI,GAAkDF,IAAI,CAA1DE,IAAI;IAAEC,YAAY,GAAoCH,IAAI,CAApDG,YAAY;IAAaC,SAAS,GAAcJ,IAAI,CAAtCK,SAAS;AAAgBC,IAAAA,IAAI,GAAAC,wBAAA,CAAKP,IAAI,EAAAQ,SAAA,CAAA,CAAA;EAC5E,IAAAC,SAAA,GAA0BC,QAAQ,CAAqBC,MAAM,CAACR,YAAY,CAAC,CAAC;IAAAS,UAAA,GAAAC,cAAA,CAAAJ,SAAA,EAAA,CAAA,CAAA;AAArEK,IA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,MAAAA,GAAG,EAAExB,KAAM;AAACA,MAAAA,KAAK,EAAEA,KAAAA;AAAM,KAAA,EAC5BA,KACG,CAAC,CAAA;GACZ,CACG,CAAC,eACTQ,KAAA,CAAAC,aAAA,CAACnB,SAAS,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,CAAA;IAEYqB,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAInC,SAAuC,EAAK;EAClF,OAAO,UAACJ,IAAuB,EAAK;AAChC,IAAA,OAAOA,IAAI,CAACoC,QAAQ,gBAChBd,KAAA,CAAAC,aAAA,CAACK,YAAY,EAAAD,QAAA,CAAA,EAAA,EAAK3B,IAAI,EAAA;AAAEK,MAAAA,SAAS,EAAED,SAAAA;KAAY,CAAA,CAAC,gBAEhDkB,KAAA,CAAAC,aAAA,CAACxB,UAAU,EAAA4B,QAAA,CAAA,EAAA,EAAK3B,IAAI,EAAA;AAAEK,MAAAA,SAAS,EAAED,SAAAA;AAAU,KAAA,CAAE,CAChD,CAAA;GACJ,CAAA;AACL;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.186.0-canary.1542.
|
3
|
+
"version": "0.186.0-canary.1542.11726237853.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": "
|
131
|
+
"gitHead": "49f8f690dcf9719d488c8b7c920c245fb77a9194"
|
132
132
|
}
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.getFormComponentGenerator = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
9
|
var _syntheticEvent = /*#__PURE__*/require("./syntheticEvent");
|
10
|
-
var _excluded = ["onChange", "component"],
|
11
|
-
_excluded2 = ["onChange", "component"];
|
10
|
+
var _excluded = ["onChange", "name", "defaultValue", "component"],
|
11
|
+
_excluded2 = ["onChange", "name", "defaultValue", "component"];
|
12
12
|
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
13
|
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
14
|
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); }
|
@@ -22,9 +22,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
22
22
|
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
23
|
var SingleForm = function SingleForm(args) {
|
24
24
|
var onChange = args.onChange,
|
25
|
+
name = args.name,
|
26
|
+
defaultValue = args.defaultValue,
|
25
27
|
Component = args.component,
|
26
28
|
rest = _objectWithoutProperties(args, _excluded);
|
27
|
-
var _useState = (0, _react.useState)(),
|
29
|
+
var _useState = (0, _react.useState)(String(defaultValue)),
|
28
30
|
_useState2 = _slicedToArray(_useState, 2),
|
29
31
|
value = _useState2[0],
|
30
32
|
setValue = _useState2[1];
|
@@ -39,6 +41,7 @@ var SingleForm = function SingleForm(args) {
|
|
39
41
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
|
40
42
|
ref: selectRef,
|
41
43
|
value: value,
|
44
|
+
name: name,
|
42
45
|
hidden: true
|
43
46
|
}, /*#__PURE__*/_react["default"].createElement("option", {
|
44
47
|
value: value
|
@@ -49,9 +52,11 @@ var SingleForm = function SingleForm(args) {
|
|
49
52
|
};
|
50
53
|
var MultipleForm = function MultipleForm(args) {
|
51
54
|
var onChange = args.onChange,
|
55
|
+
name = args.name,
|
56
|
+
defaultValue = args.defaultValue,
|
52
57
|
Component = args.component,
|
53
58
|
rest = _objectWithoutProperties(args, _excluded2);
|
54
|
-
var _useState3 = (0, _react.useState)([]),
|
59
|
+
var _useState3 = (0, _react.useState)(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
|
55
60
|
_useState4 = _slicedToArray(_useState3, 2),
|
56
61
|
values = _useState4[0],
|
57
62
|
setValues = _useState4[1];
|
@@ -66,6 +71,7 @@ var MultipleForm = function MultipleForm(args) {
|
|
66
71
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("select", {
|
67
72
|
ref: selectRef,
|
68
73
|
value: values,
|
74
|
+
name: name,
|
69
75
|
multiple: true,
|
70
76
|
hidden: true
|
71
77
|
}, values.map(function (value) {
|
@@ -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."); }
|
@@ -13,9 +13,11 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
13
13
|
import { createEvent } from './syntheticEvent';
|
14
14
|
var SingleForm = function SingleForm(args) {
|
15
15
|
var onChange = args.onChange,
|
16
|
+
name = args.name,
|
17
|
+
defaultValue = args.defaultValue,
|
16
18
|
Component = args.component,
|
17
19
|
rest = _objectWithoutProperties(args, _excluded);
|
18
|
-
var _useState = useState(),
|
20
|
+
var _useState = useState(String(defaultValue)),
|
19
21
|
_useState2 = _slicedToArray(_useState, 2),
|
20
22
|
value = _useState2[0],
|
21
23
|
setValue = _useState2[1];
|
@@ -30,6 +32,7 @@ var SingleForm = function SingleForm(args) {
|
|
30
32
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
31
33
|
ref: selectRef,
|
32
34
|
value: value,
|
35
|
+
name: name,
|
33
36
|
hidden: true
|
34
37
|
}, /*#__PURE__*/React.createElement("option", {
|
35
38
|
value: value
|
@@ -40,9 +43,11 @@ var SingleForm = function SingleForm(args) {
|
|
40
43
|
};
|
41
44
|
var MultipleForm = function MultipleForm(args) {
|
42
45
|
var onChange = args.onChange,
|
46
|
+
name = args.name,
|
47
|
+
defaultValue = args.defaultValue,
|
43
48
|
Component = args.component,
|
44
49
|
rest = _objectWithoutProperties(args, _excluded2);
|
45
|
-
var _useState3 = useState([]),
|
50
|
+
var _useState3 = useState(defaultValue && Array.isArray(defaultValue) ? defaultValue : []),
|
46
51
|
_useState4 = _slicedToArray(_useState3, 2),
|
47
52
|
values = _useState4[0],
|
48
53
|
setValues = _useState4[1];
|
@@ -57,6 +62,7 @@ var MultipleForm = function MultipleForm(args) {
|
|
57
62
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", {
|
58
63
|
ref: selectRef,
|
59
64
|
value: values,
|
65
|
+
name: name,
|
60
66
|
multiple: true,
|
61
67
|
hidden: true
|
62
68
|
}, values.map(function (value) {
|
@@ -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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