@salutejs/plasma-new-hope 0.193.1-canary.1561.11839785759.0 → 0.194.0-canary.1552.11858023676.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/Combobox.css +2 -0
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +38 -6
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.css +2 -0
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +2 -0
- package/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.css +1 -0
- package/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js +39 -0
- package/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js.map +1 -0
- package/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js +15 -0
- package/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js.map +1 -0
- package/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles_18yw2bf.css +1 -0
- package/cjs/components/Pagination/Pagination.css +2 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
- package/cjs/components/Select/Select.css +2 -2
- package/cjs/components/Select/Select.js +4 -11
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.tokens.js +1 -11
- package/cjs/components/Select/Select.tokens.js.map +1 -1
- package/cjs/components/Select/ui/Inner/Inner.css +2 -2
- package/cjs/components/Select/ui/Inner/ui/Item/Item.css +2 -2
- package/cjs/components/Select/ui/Target/Target.css +2 -2
- package/cjs/components/Select/ui/Target/Target.js +4 -5
- package/cjs/components/Select/ui/Target/Target.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.css +2 -2
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +2 -3
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +7 -7
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles_q4kc1p.css +3 -0
- package/cjs/index.css +4 -2
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +1 -1
- package/cjs/utils/createEvent.js +54 -0
- package/cjs/utils/createEvent.js.map +1 -0
- package/cjs/utils/index.js.map +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +39 -7
- package/emotion/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js +40 -0
- package/emotion/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js +13 -0
- package/emotion/cjs/components/Select/Select.js +4 -11
- package/emotion/cjs/components/Select/Select.tokens.js +1 -11
- package/emotion/cjs/components/Select/ui/Target/Target.js +4 -5
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +2 -3
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +3 -3
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Select/Select.config.js +20 -20
- package/emotion/cjs/examples/plasma_b2c/components/Select/Select.stories.tsx +0 -25
- package/emotion/cjs/examples/plasma_web/components/Select/Select.config.js +20 -20
- package/emotion/cjs/examples/plasma_web/components/Select/Select.stories.tsx +0 -24
- package/emotion/cjs/utils/createEvent.js +53 -0
- package/emotion/cjs/utils/index.js +10 -1
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +40 -7
- package/emotion/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js +31 -0
- package/emotion/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js +6 -0
- package/emotion/es/components/Select/Select.js +4 -11
- package/emotion/es/components/Select/Select.tokens.js +1 -11
- package/emotion/es/components/Select/ui/Target/Target.js +4 -5
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +2 -3
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +3 -3
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -1
- package/emotion/es/examples/plasma_b2c/components/Select/Select.config.js +20 -20
- package/emotion/es/examples/plasma_b2c/components/Select/Select.stories.tsx +0 -25
- package/emotion/es/examples/plasma_web/components/Select/Select.config.js +20 -20
- package/emotion/es/examples/plasma_web/components/Select/Select.stories.tsx +0 -24
- package/emotion/es/utils/createEvent.js +47 -0
- package/emotion/es/utils/index.js +1 -0
- package/es/components/Combobox/ComboboxNew/Combobox.css +2 -0
- package/es/components/Combobox/ComboboxNew/Combobox.js +40 -8
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.css +2 -0
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +2 -0
- package/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.css +1 -0
- package/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js +35 -0
- package/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js.map +1 -0
- package/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js +11 -0
- package/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js.map +1 -0
- package/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles_18yw2bf.css +1 -0
- package/es/components/Pagination/Pagination.css +2 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
- package/es/components/Select/Select.css +2 -2
- package/es/components/Select/Select.js +4 -11
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/Select.tokens.js +1 -11
- package/es/components/Select/Select.tokens.js.map +1 -1
- package/es/components/Select/ui/Inner/Inner.css +2 -2
- package/es/components/Select/ui/Inner/ui/Item/Item.css +2 -2
- package/es/components/Select/ui/Target/Target.css +2 -2
- package/es/components/Select/ui/Target/Target.js +4 -5
- package/es/components/Select/ui/Target/Target.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.css +2 -2
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +2 -3
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +7 -7
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles_q4kc1p.css +3 -0
- package/es/index.css +4 -2
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/utils/createEvent.js +50 -0
- package/es/utils/createEvent.js.map +1 -0
- package/es/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +39 -7
- package/styled-components/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js +40 -0
- package/styled-components/cjs/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js +12 -0
- package/styled-components/cjs/components/Select/Select.js +4 -11
- package/styled-components/cjs/components/Select/Select.tokens.js +1 -11
- package/styled-components/cjs/components/Select/ui/Target/Target.js +4 -5
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +2 -3
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +2 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Select/Select.config.js +8 -8
- package/styled-components/cjs/examples/plasma_b2c/components/Select/Select.stories.tsx +0 -25
- package/styled-components/cjs/examples/plasma_web/components/Select/Select.config.js +8 -8
- package/styled-components/cjs/examples/plasma_web/components/Select/Select.stories.tsx +0 -24
- package/styled-components/cjs/utils/createEvent.js +53 -0
- package/styled-components/cjs/utils/index.js +10 -1
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +40 -7
- package/styled-components/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.js +31 -0
- package/styled-components/es/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.js +5 -0
- package/styled-components/es/components/Select/Select.js +4 -11
- package/styled-components/es/components/Select/Select.tokens.js +1 -11
- package/styled-components/es/components/Select/ui/Target/Target.js +4 -5
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +2 -3
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Select/Select.config.js +8 -8
- package/styled-components/es/examples/plasma_b2c/components/Select/Select.stories.tsx +0 -25
- package/styled-components/es/examples/plasma_web/components/Select/Select.config.js +8 -8
- package/styled-components/es/examples/plasma_web/components/Select/Select.stories.tsx +0 -24
- package/styled-components/es/utils/createEvent.js +47 -0
- package/styled-components/es/utils/index.js +1 -0
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +24 -2
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.d.ts +6 -0
- package/types/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.d.ts.map +1 -0
- package/types/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.d.ts +3 -0
- package/types/components/Combobox/ComboboxNew/ui/SelectNative/SelectNative.styles.d.ts.map +1 -0
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +0 -96
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts.map +1 -1
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.tokens.d.ts +1 -11
- package/types/components/Select/Select.tokens.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +2 -4
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.d.ts +1 -2
- package/types/components/Select/ui/Target/Target.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.types.d.ts +2 -3
- package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.types.d.ts +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.types.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +1076 -116
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Select/Select.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Select/Select.d.ts +0 -96
- package/types/examples/plasma_b2c/components/Select/Select.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +1076 -116
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Select/Select.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Select/Select.d.ts +0 -96
- package/types/examples/plasma_web/components/Select/Select.d.ts.map +1 -1
- package/types/utils/createEvent.d.ts +3 -0
- package/types/utils/createEvent.d.ts.map +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/index.d.ts.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles_1b7iij0.css +0 -3
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles_1b7iij0.css +0 -3
@@ -79,24 +79,6 @@ const meta: Meta<StorySelectProps> = {
|
|
79
79
|
eq: 'textfield-like',
|
80
80
|
},
|
81
81
|
},
|
82
|
-
requiredPlacement: {
|
83
|
-
options: ['left', 'right'],
|
84
|
-
control: {
|
85
|
-
type: 'select',
|
86
|
-
},
|
87
|
-
},
|
88
|
-
required: {
|
89
|
-
control: {
|
90
|
-
type: 'boolean',
|
91
|
-
},
|
92
|
-
if: { arg: 'optional', truthy: false },
|
93
|
-
},
|
94
|
-
optional: {
|
95
|
-
control: {
|
96
|
-
type: 'boolean',
|
97
|
-
},
|
98
|
-
if: { arg: 'required', truthy: false },
|
99
|
-
},
|
100
82
|
},
|
101
83
|
args: {
|
102
84
|
target: 'textfield-like',
|
@@ -111,9 +93,6 @@ const meta: Meta<StorySelectProps> = {
|
|
111
93
|
isTargetAmount: false,
|
112
94
|
variant: 'normal',
|
113
95
|
disabled: false,
|
114
|
-
optional: false,
|
115
|
-
required: false,
|
116
|
-
requiredPlacement: 'right',
|
117
96
|
},
|
118
97
|
parameters: {
|
119
98
|
controls: {
|
@@ -134,9 +113,6 @@ const meta: Meta<StorySelectProps> = {
|
|
134
113
|
'listWidth',
|
135
114
|
'listOverflow',
|
136
115
|
'listHeight',
|
137
|
-
'optional',
|
138
|
-
'required',
|
139
|
-
'requiredPlacement',
|
140
116
|
],
|
141
117
|
},
|
142
118
|
},
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createEvent = void 0;
|
7
|
+
var createEvent = exports.createEvent = function createEvent(ref) {
|
8
|
+
if (ref.current) {
|
9
|
+
var event = new Event('change', {
|
10
|
+
bubbles: true
|
11
|
+
});
|
12
|
+
Object.defineProperty(event, 'target', {
|
13
|
+
writable: false,
|
14
|
+
value: ref.current
|
15
|
+
});
|
16
|
+
var syntheticEvent = createSyntheticEvent(event);
|
17
|
+
return syntheticEvent;
|
18
|
+
}
|
19
|
+
return null;
|
20
|
+
};
|
21
|
+
var createSyntheticEvent = function createSyntheticEvent(event) {
|
22
|
+
var _isDefaultPrevented = false;
|
23
|
+
var _isPropagationStopped = false;
|
24
|
+
var preventDefault = function preventDefault() {
|
25
|
+
_isDefaultPrevented = true;
|
26
|
+
event.preventDefault();
|
27
|
+
};
|
28
|
+
var stopPropagation = function stopPropagation() {
|
29
|
+
_isPropagationStopped = true;
|
30
|
+
event.stopPropagation();
|
31
|
+
};
|
32
|
+
return {
|
33
|
+
nativeEvent: event,
|
34
|
+
currentTarget: event.currentTarget,
|
35
|
+
target: event.target,
|
36
|
+
bubbles: event.bubbles,
|
37
|
+
cancelable: event.cancelable,
|
38
|
+
defaultPrevented: event.defaultPrevented,
|
39
|
+
eventPhase: event.eventPhase,
|
40
|
+
isTrusted: event.isTrusted,
|
41
|
+
preventDefault: preventDefault,
|
42
|
+
isDefaultPrevented: function isDefaultPrevented() {
|
43
|
+
return _isDefaultPrevented;
|
44
|
+
},
|
45
|
+
stopPropagation: stopPropagation,
|
46
|
+
isPropagationStopped: function isPropagationStopped() {
|
47
|
+
return _isPropagationStopped;
|
48
|
+
},
|
49
|
+
persist: function persist() {},
|
50
|
+
timeStamp: event.timeStamp,
|
51
|
+
type: event.type
|
52
|
+
};
|
53
|
+
};
|
@@ -16,6 +16,7 @@ var _exportNames = {
|
|
16
16
|
mergeRefs: true,
|
17
17
|
setRefList: true,
|
18
18
|
isEmpty: true,
|
19
|
+
createEvent: true,
|
19
20
|
constants: true,
|
20
21
|
noop: true,
|
21
22
|
fixedForwardRef: true
|
@@ -32,7 +33,14 @@ Object.defineProperty(exports, "canUseDOM", {
|
|
32
33
|
return _canUseDOM.canUseDOM;
|
33
34
|
}
|
34
35
|
});
|
35
|
-
exports.
|
36
|
+
exports.constants = exports.composableStyle = void 0;
|
37
|
+
Object.defineProperty(exports, "createEvent", {
|
38
|
+
enumerable: true,
|
39
|
+
get: function get() {
|
40
|
+
return _createEvent.createEvent;
|
41
|
+
}
|
42
|
+
});
|
43
|
+
exports.cx = void 0;
|
36
44
|
Object.defineProperty(exports, "extractTextFrom", {
|
37
45
|
enumerable: true,
|
38
46
|
get: function get() {
|
@@ -94,6 +102,7 @@ var _react = /*#__PURE__*/require("./react");
|
|
94
102
|
var _isNumber = /*#__PURE__*/require("./isNumber");
|
95
103
|
var _setRefList = /*#__PURE__*/require("./setRefList");
|
96
104
|
var _isEmpty = /*#__PURE__*/require("./isEmpty");
|
105
|
+
var _createEvent = /*#__PURE__*/require("./createEvent");
|
97
106
|
var _constants = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./constants"));
|
98
107
|
exports.constants = _constants;
|
99
108
|
var _getPopoverPlacement = /*#__PURE__*/require("./getPopoverPlacement");
|
@@ -1,5 +1,6 @@
|
|
1
|
-
var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "targetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect", "renderValue"];
|
1
|
+
var _excluded = ["name", "multiple", "value", "onChange", "defaultValue", "isTargetAmount", "targetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect", "renderValue"];
|
2
2
|
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); }
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
3
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
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."); }
|
5
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -8,7 +9,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
8
9
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
9
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; }
|
10
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; }
|
11
|
-
import React, { forwardRef, useState, useReducer, useMemo, createContext, useLayoutEffect, useRef } from 'react';
|
12
|
+
import React, { forwardRef, useState, useReducer, useMemo, createContext, useLayoutEffect, useRef, useEffect } from 'react';
|
12
13
|
import { safeUseId, useForkRef } from '@salutejs/plasma-core';
|
13
14
|
import { isEmpty } from '../../../utils';
|
14
15
|
import { useOutsideClick } from '../../../hooks';
|
@@ -23,17 +24,21 @@ import { getPathMap, getTreeMaps } from './hooks/getPathMaps';
|
|
23
24
|
import { Ul, base, StyledArrow, IconArrowWrapper, StyledEmptyState } from './Combobox.styles';
|
24
25
|
import { base as viewCSS } from './variations/_view/base';
|
25
26
|
import { base as sizeCSS } from './variations/_size/base';
|
27
|
+
import { SelectNative } from './ui/SelectNative/SelectNative';
|
26
28
|
export var Context = /*#__PURE__*/createContext({});
|
27
29
|
|
28
30
|
/**
|
29
31
|
* Поле ввода с выпадающим списком и возможностью фильтрации и выбора элементов.
|
30
32
|
*/
|
33
|
+
|
31
34
|
export var comboboxRoot = function comboboxRoot(Root) {
|
32
35
|
return /*#__PURE__*/forwardRef(function (props, ref) {
|
33
36
|
var _valueToItemMap$get, _valueToItemMap$get2, _getItemByFocused;
|
34
|
-
var
|
37
|
+
var name = props.name,
|
38
|
+
multiple = props.multiple,
|
35
39
|
outerValue = props.value,
|
36
40
|
outerOnChange = props.onChange,
|
41
|
+
defaultValue = props.defaultValue,
|
37
42
|
isTargetAmount = props.isTargetAmount,
|
38
43
|
targetAmount = props.targetAmount,
|
39
44
|
items = props.items,
|
@@ -65,6 +70,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
65
70
|
outerCloseAfterSelect = props.closeAfterSelect,
|
66
71
|
renderValue = props.renderValue,
|
67
72
|
rest = _objectWithoutProperties(props, _excluded);
|
73
|
+
console.log('render');
|
68
74
|
var transformedItems = useMemo(function () {
|
69
75
|
return initialItemsTransform(items || []);
|
70
76
|
}, [items]);
|
@@ -140,11 +146,27 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
140
146
|
}
|
141
147
|
}
|
142
148
|
}, floatingPopoverRef);
|
149
|
+
|
150
|
+
// Эта функция срабатывает при изменении Combobox и
|
151
|
+
// при изменении нативного Select для формы (срабатывает только после изменения internalValue и рендера).
|
143
152
|
var onChange = function onChange(newValue) {
|
153
|
+
// Условие для отправки изменений наружу
|
144
154
|
if (outerOnChange) {
|
145
|
-
|
155
|
+
// Условие для отправки если комбобокс используется без формы.
|
156
|
+
if (!name && (typeof newValue === 'string' || Array.isArray(newValue))) {
|
157
|
+
outerOnChange(newValue);
|
158
|
+
}
|
159
|
+
|
160
|
+
// Условие для отправки если комбобокс используется с формой.
|
161
|
+
if (name && _typeof(newValue) === 'object' && !Array.isArray(newValue)) {
|
162
|
+
outerOnChange(newValue);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
// Условие для изменения внутреннего значения (только если newValue строка или массив строк).
|
167
|
+
if (typeof newValue === 'string' || Array.isArray(newValue)) {
|
168
|
+
setInternalValue(newValue);
|
146
169
|
}
|
147
|
-
setInternalValue(newValue);
|
148
170
|
};
|
149
171
|
var handleClickArrow = function handleClickArrow() {
|
150
172
|
if (disabled || readOnly) {
|
@@ -332,13 +354,24 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
332
354
|
// Т.к. вначале нужно отфильтровать и провалидировать outerValue и результат положить в переменную.
|
333
355
|
// А переменную, содержащую сложные типы данных, нельзя помещать в deps.
|
334
356
|
}, [outerValue, internalValue, items]);
|
357
|
+
useEffect(function () {
|
358
|
+
if (defaultValue) {
|
359
|
+
setInternalValue(defaultValue);
|
360
|
+
}
|
361
|
+
}, [defaultValue]);
|
335
362
|
return /*#__PURE__*/React.createElement(Root, {
|
336
363
|
size: size,
|
337
364
|
view: view,
|
338
365
|
labelPlacement: labelPlacement,
|
339
366
|
disabled: disabled,
|
340
367
|
readOnly: readOnly
|
341
|
-
},
|
368
|
+
}, name && /*#__PURE__*/React.createElement(SelectNative, {
|
369
|
+
name: name,
|
370
|
+
value: internalValue,
|
371
|
+
multiple: multiple,
|
372
|
+
onChange: onChange,
|
373
|
+
ref: ref
|
374
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Context.Provider, {
|
342
375
|
value: {
|
343
376
|
focusedPath: focusedPath,
|
344
377
|
checked: checked,
|
@@ -362,7 +395,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
362
395
|
listWidth: listWidth,
|
363
396
|
target: function target(referenceRef) {
|
364
397
|
return /*#__PURE__*/React.createElement(StyledTextField, _extends({
|
365
|
-
ref: inputForkRef,
|
398
|
+
ref: name ? inputRef : inputForkRef,
|
366
399
|
inputWrapperRef: referenceRef,
|
367
400
|
value: textValue,
|
368
401
|
onChange: handleTextValueChange,
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React, { forwardRef, useEffect, useRef } from 'react';
|
2
|
+
import { useForkRef } from '@salutejs/plasma-core';
|
3
|
+
import { createEvent } from '../../../../../utils';
|
4
|
+
import { SelectHidden } from './SelectNative.styles';
|
5
|
+
export var SelectNative = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
6
|
+
var name = _ref.name,
|
7
|
+
multiple = _ref.multiple,
|
8
|
+
value = _ref.value,
|
9
|
+
onChange = _ref.onChange;
|
10
|
+
var values = multiple ? value : [value];
|
11
|
+
var selectRef = useRef(null);
|
12
|
+
var forkRef = useForkRef(selectRef, ref);
|
13
|
+
useEffect(function () {
|
14
|
+
var event = createEvent(selectRef);
|
15
|
+
if (onChange) {
|
16
|
+
onChange(event);
|
17
|
+
}
|
18
|
+
}, [values]);
|
19
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SelectHidden, {
|
20
|
+
ref: forkRef,
|
21
|
+
multiple: multiple,
|
22
|
+
name: name,
|
23
|
+
hidden: true,
|
24
|
+
value: multiple ? values : values[0]
|
25
|
+
}, values.map(function (v) {
|
26
|
+
return /*#__PURE__*/React.createElement("option", {
|
27
|
+
key: v,
|
28
|
+
value: v
|
29
|
+
}, v);
|
30
|
+
})));
|
31
|
+
});
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
2
|
+
import { applyHidden } from '../../../../../mixins';
|
3
|
+
export var SelectHidden = /*#__PURE__*/_styled("select", {
|
4
|
+
target: "eywcm6j0",
|
5
|
+
label: "plasma-new-hope__SelectHidden"
|
6
|
+
})( /*#__PURE__*/applyHidden(), ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29tYm9ib3gvQ29tYm9ib3hOZXcvdWkvU2VsZWN0TmF0aXZlL1NlbGVjdE5hdGl2ZS5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSXlDIiwiZmlsZSI6Ii4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29tYm9ib3gvQ29tYm9ib3hOZXcvdWkvU2VsZWN0TmF0aXZlL1NlbGVjdE5hdGl2ZS5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB7IGFwcGx5SGlkZGVuIH0gZnJvbSAnLi4vLi4vLi4vLi4vLi4vbWl4aW5zJztcblxuZXhwb3J0IGNvbnN0IFNlbGVjdEhpZGRlbiA9IHN0eWxlZC5zZWxlY3RgXG4gICAgJHthcHBseUhpZGRlbigpfTtcbmA7XG4iXX0= */"));
|
@@ -30,7 +30,7 @@ export var selectRoot = function selectRoot(Root) {
|
|
30
30
|
var outerValue = props.value,
|
31
31
|
outerOnChange = props.onChange,
|
32
32
|
_props$target = props.target,
|
33
|
-
|
33
|
+
_target = _props$target === void 0 ? 'textfield-like' : _props$target,
|
34
34
|
items = props.items,
|
35
35
|
_props$placement = props.placement,
|
36
36
|
placement = _props$placement === void 0 ? 'bottom' : _props$placement,
|
@@ -95,14 +95,7 @@ export var selectRoot = function selectRoot(Root) {
|
|
95
95
|
var activeDescendantItemValue = ((_getItemByFocused = getItemByFocused(focusedPath, focusedToValueMap)) === null || _getItemByFocused === void 0 ? void 0 : _getItemByFocused.value.toString()) || '';
|
96
96
|
var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
|
97
97
|
var treeId = safeUseId();
|
98
|
-
var view =
|
99
|
-
|
100
|
-
// Собираем объект с пропсами для required и прокидываем их напрямую в компонент Textfield.
|
101
|
-
var requiredProps = props.target === 'button-like' ? undefined : {
|
102
|
-
required: props.required,
|
103
|
-
requiredPlacement: props.requiredPlacement,
|
104
|
-
optional: props.optional
|
105
|
-
};
|
98
|
+
var view = _target === 'textfield-like' && disabled ? 'default' : getView(status, outerView);
|
106
99
|
var targetRef = useOutsideClick(function () {
|
107
100
|
if (!isCurrentListOpen) {
|
108
101
|
return;
|
@@ -294,6 +287,7 @@ export var selectRoot = function selectRoot(Root) {
|
|
294
287
|
target: function target(referenceRef) {
|
295
288
|
return /*#__PURE__*/React.createElement(Target, {
|
296
289
|
ref: ref,
|
290
|
+
target: _target,
|
297
291
|
value: value,
|
298
292
|
opened: isCurrentListOpen,
|
299
293
|
valueToItemMap: valueToItemMap,
|
@@ -317,8 +311,7 @@ export var selectRoot = function selectRoot(Root) {
|
|
317
311
|
onChange: onChange,
|
318
312
|
labelToItemMap: labelToItemMap,
|
319
313
|
chipView: chipView,
|
320
|
-
separator: separator
|
321
|
-
requiredProps: requiredProps
|
314
|
+
separator: separator
|
322
315
|
});
|
323
316
|
}
|
324
317
|
}, /*#__PURE__*/React.createElement(Root, _extends({
|
@@ -71,6 +71,7 @@ export var tokens = {
|
|
71
71
|
textFieldBorderColorFocus: '--plasma-select-textfield-border-color-focus',
|
72
72
|
textFieldPlaceholderColor: '--plasma-select-textfield-placeholder-color',
|
73
73
|
textFieldPlaceholderColorFocus: '--plasma-select-textfield-placeholder-color-focus',
|
74
|
+
textFieldOptionalColor: '--plasma-select-textfield-optional-color',
|
74
75
|
textFieldHeight: '--plasma-select-textfield-height',
|
75
76
|
textFieldBorderWidth: '--plasma-select-textfield-border-width',
|
76
77
|
textFieldBorderRadius: '--plasma-select-textfield-border-radius',
|
@@ -154,17 +155,6 @@ export var tokens = {
|
|
154
155
|
textFieldChipLineHeight: '--plasma-select-textfield-chip-line-height',
|
155
156
|
textFieldChipClearContentMarginLeft: '--plasma-select-textfield-chip-clear-content-margin-left',
|
156
157
|
textFieldChipClearContentMarginRight: '--plasma-select-textfield-chip-clear-content-margin-right',
|
157
|
-
textFieldIndicatorColor: '--plasma-select-new-textfield-indicator-color',
|
158
|
-
textFieldIndicatorSizeInner: '--plasma-select-new-textfield-indicator-size-inner',
|
159
|
-
textFieldIndicatorSizeOuter: '--plasma-select-new-textfield-indicator-size-outer',
|
160
|
-
textFieldIndicatorLabelPlacementInner: '--plasma-select-new-textfield-indicator-placement-inner',
|
161
|
-
textFieldIndicatorLabelPlacementOuter: '--plasma-select-new-textfield-indicator-placement-outer',
|
162
|
-
textFieldIndicatorLabelPlacementInnerRight: '--plasma-select-new-textfield-indicator-placement-inner-right',
|
163
|
-
textFieldIndicatorLabelPlacementOuterRight: '--plasma-select-new-textfield-indicator-placement-outer-right',
|
164
|
-
textFieldClearIndicatorLabelPlacementInner: '--plasma-select-new-textfield-clear-indicator-placement-inner',
|
165
|
-
textFieldClearIndicatorLabelPlacementInnerRight: '--plasma-select-new-textfield-clear-indicator-placement-inner-right',
|
166
|
-
textFieldClearIndicatorHintInnerRight: '--plasma-select-new-textfield-clear-indicator-hint-placement-inner-right',
|
167
|
-
textFieldOptionalColor: '--plasma-select-new-textfield-optional-color',
|
168
158
|
textFieldFocusColor: '--plasma-select-textfield-focus-color',
|
169
159
|
disclosureIconColor: '--plasma-select-disclosure-icon-color',
|
170
160
|
disclosureIconColorHover: '--plasma-select-disclosure-icon-color-hover'
|
@@ -3,6 +3,7 @@ import { useForkRef } from '@salutejs/plasma-core';
|
|
3
3
|
import { Button, Textfield } from './ui';
|
4
4
|
export var Target = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
5
5
|
var value = _ref.value,
|
6
|
+
target = _ref.target,
|
6
7
|
opened = _ref.opened,
|
7
8
|
valueToItemMap = _ref.valueToItemMap,
|
8
9
|
label = _ref.label,
|
@@ -25,8 +26,7 @@ export var Target = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
25
26
|
onChange = _ref.onChange,
|
26
27
|
labelToItemMap = _ref.labelToItemMap,
|
27
28
|
chipView = _ref.chipView,
|
28
|
-
separator = _ref.separator
|
29
|
-
requiredProps = _ref.requiredProps;
|
29
|
+
separator = _ref.separator;
|
30
30
|
var buttonRef = useForkRef(ref, inputWrapperRef);
|
31
31
|
if (selectProps.renderTarget) {
|
32
32
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -35,7 +35,7 @@ export var Target = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
35
35
|
return valueToItemMap.get(value);
|
36
36
|
}) : valueToItemMap.get(value)));
|
37
37
|
}
|
38
|
-
return
|
38
|
+
return target === 'button-like' ? /*#__PURE__*/React.createElement(Button, {
|
39
39
|
ref: buttonRef,
|
40
40
|
opened: opened,
|
41
41
|
value: value,
|
@@ -72,7 +72,6 @@ export var Target = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
72
72
|
renderValue: renderValue,
|
73
73
|
onChange: onChange,
|
74
74
|
labelToItemMap: labelToItemMap,
|
75
|
-
chipView: chipView
|
76
|
-
requiredProps: requiredProps
|
75
|
+
chipView: chipView
|
77
76
|
});
|
78
77
|
});
|
@@ -26,8 +26,7 @@ export var Textfield = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
26
26
|
renderValue = _ref.renderValue,
|
27
27
|
onChange = _ref.onChange,
|
28
28
|
labelToItemMap = _ref.labelToItemMap,
|
29
|
-
chipView = _ref.chipView
|
30
|
-
requiredProps = _ref.requiredProps;
|
29
|
+
chipView = _ref.chipView;
|
31
30
|
var withArrowInverse = opened ? classes.arrowInverse : undefined;
|
32
31
|
var getChips = function getChips() {
|
33
32
|
if (multiselect && Array.isArray(value)) {
|
@@ -93,5 +92,5 @@ export var Textfield = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
93
92
|
// TODO: #1547
|
94
93
|
,
|
95
94
|
_forceChipManipulationWithReadonly: true
|
96
|
-
}
|
95
|
+
}));
|
97
96
|
});
|