@commercetools-uikit/select-utils 12.2.1 → 12.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,20 +10,20 @@ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object
|
|
|
10
10
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
11
11
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
12
12
|
import { customProperties, designTokens } from '@commercetools-uikit/design-system';
|
|
13
|
-
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
14
13
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
15
|
-
import React from 'react';
|
|
16
14
|
import PropTypes from 'prop-types';
|
|
17
|
-
import {
|
|
15
|
+
import { css } from '@emotion/react';
|
|
18
16
|
import { CloseIcon, CloseBoldIcon, CaretDownIcon, SearchIcon } from '@commercetools-uikit/icons';
|
|
17
|
+
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
19
18
|
import omit from 'lodash/omit';
|
|
20
19
|
import AccessibleButton from '@commercetools-uikit/accessible-button';
|
|
21
20
|
import { components } from 'react-select';
|
|
21
|
+
import { cloneElement, Fragment as Fragment$1 } from 'react';
|
|
22
22
|
import _Object$values from '@babel/runtime-corejs3/core-js-stable/object/values';
|
|
23
23
|
import Spacings from '@commercetools-uikit/spacings';
|
|
24
24
|
import Text from '@commercetools-uikit/text';
|
|
25
25
|
|
|
26
|
-
var messages = defineMessages({
|
|
26
|
+
var messages$1 = defineMessages({
|
|
27
27
|
clearButtonLabel: {
|
|
28
28
|
id: 'UIKit.ClearButton.clearButtonLabel',
|
|
29
29
|
description: 'Label for the clear button',
|
|
@@ -31,7 +31,11 @@ var messages = defineMessages({
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
var _excluded = ["ref"];
|
|
34
|
+
var _excluded$1 = ["ref"];
|
|
35
|
+
|
|
36
|
+
function ownKeys$6(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
+
|
|
38
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$6(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$6(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35
39
|
|
|
36
40
|
var ClearIndicator = function ClearIndicator(props) {
|
|
37
41
|
var intl = useIntl();
|
|
@@ -39,17 +43,18 @@ var ClearIndicator = function ClearIndicator(props) {
|
|
|
39
43
|
var getStyles = props.getStyles,
|
|
40
44
|
_props$innerProps = props.innerProps,
|
|
41
45
|
ref = _props$innerProps.ref,
|
|
42
|
-
restInnerProps = _objectWithoutProperties(_props$innerProps, _excluded);
|
|
46
|
+
restInnerProps = _objectWithoutProperties(_props$innerProps, _excluded$1);
|
|
43
47
|
|
|
44
|
-
return jsx("button",
|
|
48
|
+
return jsx("button", _objectSpread$6(_objectSpread$6({}, restInnerProps), {}, {
|
|
45
49
|
ref: ref,
|
|
46
|
-
css: /*#__PURE__*/css("border:none;cursor:pointer;background:none;box-sizing:border-box;text-decoration:none;:hover svg *{fill:", customProperties.colorWarning, ";}" + (process.env.NODE_ENV === "production" ? "" : ";label:ClearIndicator;")),
|
|
50
|
+
css: /*#__PURE__*/css("border:none;cursor:pointer;background:none;box-sizing:border-box;text-decoration:none;:hover svg *{fill:", customProperties.colorWarning, ";}" + (process.env.NODE_ENV === "production" ? "" : ";label:ClearIndicator;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNsZWFyLWluZGljYXRvci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpQmMiLCJmaWxlIjoiY2xlYXItaW5kaWNhdG9yLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFByb3BUeXBlcyBmcm9tICdwcm9wLXR5cGVzJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCB7IHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJztcbmltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgYXMgdmFycyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLXVpa2l0L2Rlc2lnbi1zeXN0ZW0nO1xuaW1wb3J0IHsgQ2xvc2VJY29uIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvaWNvbnMnO1xuaW1wb3J0IG1lc3NhZ2VzIGZyb20gJy4vbWVzc2FnZXMnO1xuXG5jb25zdCBDbGVhckluZGljYXRvciA9IChwcm9wcykgPT4ge1xuICBjb25zdCBpbnRsID0gdXNlSW50bCgpO1xuICBjb25zdCB7XG4gICAgZ2V0U3R5bGVzLFxuICAgIGlubmVyUHJvcHM6IHsgcmVmLCAuLi5yZXN0SW5uZXJQcm9wcyB9LFxuICB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPGJ1dHRvblxuICAgICAgey4uLnJlc3RJbm5lclByb3BzfVxuICAgICAgcmVmPXtyZWZ9XG4gICAgICBjc3M9e2Nzc2BcbiAgICAgICAgYm9yZGVyOiBub25lO1xuICAgICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgICAgIGJhY2tncm91bmQ6IG5vbmU7XG4gICAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XG4gICAgICAgIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcbiAgICAgICAgOmhvdmVyIHN2ZyAqIHtcbiAgICAgICAgICBmaWxsOiAke3ZhcnMuY29sb3JXYXJuaW5nfTtcbiAgICAgICAgfVxuICAgICAgYH1cbiAgICAgIHN0eWxlPXtnZXRTdHlsZXMoJ2NsZWFySW5kaWNhdG9yJywgcHJvcHMpfVxuICAgICAgdGl0bGU9e2ludGwuZm9ybWF0TWVzc2FnZShtZXNzYWdlcy5jbGVhckJ1dHRvbkxhYmVsKX1cbiAgICAgIGFyaWEtbGFiZWw9e2ludGwuZm9ybWF0TWVzc2FnZShtZXNzYWdlcy5jbGVhckJ1dHRvbkxhYmVsKX1cbiAgICA+XG4gICAgICA8Q2xvc2VJY29uIGNvbG9yPVwic29saWRcIiBzaXplPVwibWVkaXVtXCIgLz5cbiAgICA8L2J1dHRvbj5cbiAgKTtcbn07XG5cbkNsZWFySW5kaWNhdG9yLmRpc3BsYXlOYW1lID0gJ0NsZWFySW5kaWNhdG9yJztcbkNsZWFySW5kaWNhdG9yLnByb3BUeXBlcyA9IHtcbiAgaW5uZXJQcm9wczogUHJvcFR5cGVzLm9iamVjdCxcbiAgZ2V0U3R5bGVzOiBQcm9wVHlwZXMuZnVuYy5pc1JlcXVpcmVkLFxufTtcblxuZXhwb3J0IGRlZmF1bHQgQ2xlYXJJbmRpY2F0b3I7XG4iXX0= */"),
|
|
47
51
|
style: getStyles('clearIndicator', props),
|
|
48
|
-
title: intl.formatMessage(messages.clearButtonLabel),
|
|
49
|
-
"aria-label": intl.formatMessage(messages.clearButtonLabel)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
title: intl.formatMessage(messages$1.clearButtonLabel),
|
|
53
|
+
"aria-label": intl.formatMessage(messages$1.clearButtonLabel),
|
|
54
|
+
children: jsx(CloseIcon, {
|
|
55
|
+
color: "solid",
|
|
56
|
+
size: "medium"
|
|
57
|
+
})
|
|
53
58
|
}));
|
|
54
59
|
};
|
|
55
60
|
|
|
@@ -58,7 +63,11 @@ ClearIndicator.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
58
63
|
innerProps: PropTypes.object,
|
|
59
64
|
getStyles: PropTypes.func.isRequired
|
|
60
65
|
} : {};
|
|
66
|
+
var ClearIndicator$1 = ClearIndicator;
|
|
67
|
+
|
|
68
|
+
function ownKeys$5(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
61
69
|
|
|
70
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$5(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$5(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
62
71
|
var removeProps = ['onClick', 'onTouchEnd', 'onMouseDown'];
|
|
63
72
|
|
|
64
73
|
var TagRemove = function TagRemove(props) {
|
|
@@ -66,11 +75,13 @@ var TagRemove = function TagRemove(props) {
|
|
|
66
75
|
// we don't want to spread the removeProp event handlers
|
|
67
76
|
|
|
68
77
|
var innerProps = isDisabled ? omit(props.innerProps, removeProps) : props.innerProps;
|
|
69
|
-
return jsx(AccessibleButton,
|
|
78
|
+
return jsx(AccessibleButton, _objectSpread$5(_objectSpread$5({
|
|
70
79
|
label: "Remove"
|
|
71
|
-
}, innerProps),
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
}, innerProps), {}, {
|
|
81
|
+
children: jsx(CloseBoldIcon, {
|
|
82
|
+
color: isDisabled ? 'neutral60' : 'solid',
|
|
83
|
+
size: "medium"
|
|
84
|
+
})
|
|
74
85
|
}));
|
|
75
86
|
};
|
|
76
87
|
|
|
@@ -82,11 +93,18 @@ TagRemove.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
82
93
|
}).isRequired,
|
|
83
94
|
innerProps: PropTypes.object
|
|
84
95
|
} : {};
|
|
96
|
+
var TagRemove$1 = TagRemove;
|
|
97
|
+
|
|
98
|
+
function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
99
|
+
|
|
100
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$4(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
85
101
|
|
|
86
102
|
var DropdownIndicator = function DropdownIndicator(props) {
|
|
87
|
-
return jsx(components.DropdownIndicator, props,
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
return jsx(components.DropdownIndicator, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
104
|
+
children: jsx(CaretDownIcon, {
|
|
105
|
+
color: props.isDisabled ? 'neutral60' : undefined,
|
|
106
|
+
size: "small"
|
|
107
|
+
})
|
|
90
108
|
}));
|
|
91
109
|
};
|
|
92
110
|
|
|
@@ -94,37 +112,54 @@ DropdownIndicator.displayName = 'DropdownIndicator';
|
|
|
94
112
|
DropdownIndicator.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
95
113
|
isDisabled: PropTypes.bool
|
|
96
114
|
} : {};
|
|
115
|
+
var DropdownIndicator$1 = DropdownIndicator;
|
|
116
|
+
|
|
117
|
+
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
118
|
+
|
|
119
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$3(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$3(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
97
120
|
|
|
98
121
|
var SearchIconDropdownIndicator = function SearchIconDropdownIndicator(props) {
|
|
99
|
-
return jsx(components.DropdownIndicator, props,
|
|
100
|
-
|
|
101
|
-
|
|
122
|
+
return jsx(components.DropdownIndicator, _objectSpread$3(_objectSpread$3({}, props), {}, {
|
|
123
|
+
children: jsx(SearchIcon, {
|
|
124
|
+
color: 'neutral60',
|
|
125
|
+
size: "big"
|
|
126
|
+
})
|
|
102
127
|
}));
|
|
103
128
|
};
|
|
104
129
|
|
|
105
130
|
SearchIconDropdownIndicator.displayName = 'SearchIconDropdownIndicator';
|
|
131
|
+
var SearchIconDropdownIndicator$1 = SearchIconDropdownIndicator;
|
|
132
|
+
|
|
133
|
+
var _excluded = ["children"];
|
|
134
|
+
|
|
135
|
+
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
106
136
|
|
|
107
|
-
var
|
|
137
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
108
138
|
|
|
109
139
|
var getDefaultComponent = function getDefaultComponent(type) {
|
|
110
140
|
if (type === 'singleValue') return components.SingleValue;
|
|
111
141
|
if (type === 'placeholder') return components.Placeholder;
|
|
112
|
-
return
|
|
142
|
+
return Fragment$1;
|
|
113
143
|
};
|
|
114
144
|
|
|
115
145
|
var WrapperWithIcon = function WrapperWithIcon(_ref) {
|
|
116
146
|
var children = _ref.children,
|
|
117
|
-
props = _objectWithoutProperties(_ref, _excluded
|
|
147
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
118
148
|
|
|
119
149
|
var Component = getDefaultComponent(props.type);
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
150
|
+
return jsxs(Fragment, {
|
|
151
|
+
children: [props.selectProps.iconLeft && /*#__PURE__*/cloneElement(props.selectProps.iconLeft, {
|
|
152
|
+
size: 'big'
|
|
153
|
+
}), jsx("span", {
|
|
154
|
+
// react-select uses absolute positioning for the SingleValue/Placeholder
|
|
155
|
+
// the icon has a fixed size of 24px (== SpacingsXl), therefore we can use a fixed margin
|
|
156
|
+
// spacingsXs is the margin between the icon and value
|
|
157
|
+
css: /*#__PURE__*/css("margin-left:", customProperties.spacingXl + customProperties.spacingXs, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:WrapperWithIcon;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndyYXBwZXItd2l0aC1pY29uLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCZ0IiLCJmaWxlIjoid3JhcHBlci13aXRoLWljb24uanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBGcmFnbWVudCwgY2xvbmVFbGVtZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IFByb3BUeXBlcyBmcm9tICdwcm9wLXR5cGVzJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy11aWtpdC9kZXNpZ24tc3lzdGVtJztcbmltcG9ydCB7IGNvbXBvbmVudHMgYXMgZGVmYXVsdENvbXBvbmVudHMgfSBmcm9tICdyZWFjdC1zZWxlY3QnO1xuXG5jb25zdCBnZXREZWZhdWx0Q29tcG9uZW50ID0gKHR5cGUpID0+IHtcbiAgaWYgKHR5cGUgPT09ICdzaW5nbGVWYWx1ZScpIHJldHVybiBkZWZhdWx0Q29tcG9uZW50cy5TaW5nbGVWYWx1ZTtcbiAgaWYgKHR5cGUgPT09ICdwbGFjZWhvbGRlcicpIHJldHVybiBkZWZhdWx0Q29tcG9uZW50cy5QbGFjZWhvbGRlcjtcbiAgcmV0dXJuIEZyYWdtZW50O1xufTtcblxuY29uc3QgV3JhcHBlcldpdGhJY29uID0gKHsgY2hpbGRyZW4sIC4uLnByb3BzIH0pID0+IHtcbiAgY29uc3QgQ29tcG9uZW50ID0gZ2V0RGVmYXVsdENvbXBvbmVudChwcm9wcy50eXBlKTtcblxuICByZXR1cm4gKFxuICAgIDw+XG4gICAgICB7cHJvcHMuc2VsZWN0UHJvcHMuaWNvbkxlZnQgJiZcbiAgICAgICAgY2xvbmVFbGVtZW50KHByb3BzLnNlbGVjdFByb3BzLmljb25MZWZ0LCB7XG4gICAgICAgICAgc2l6ZTogJ2JpZycsXG4gICAgICAgIH0pfVxuICAgICAgPHNwYW5cbiAgICAgICAgLy8gcmVhY3Qtc2VsZWN0IHVzZXMgYWJzb2x1dGUgcG9zaXRpb25pbmcgZm9yIHRoZSBTaW5nbGVWYWx1ZS9QbGFjZWhvbGRlclxuICAgICAgICAvLyB0aGUgaWNvbiBoYXMgYSBmaXhlZCBzaXplIG9mIDI0cHggKD09IFNwYWNpbmdzWGwpLCB0aGVyZWZvcmUgd2UgY2FuIHVzZSBhIGZpeGVkIG1hcmdpblxuICAgICAgICAvLyBzcGFjaW5nc1hzIGlzIHRoZSBtYXJnaW4gYmV0d2VlbiB0aGUgaWNvbiBhbmQgdmFsdWVcbiAgICAgICAgY3NzPXtjc3NgXG4gICAgICAgICAgbWFyZ2luLWxlZnQ6ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nWGwgK1xuICAgICAgICAgIGN1c3RvbVByb3BlcnRpZXMuc3BhY2luZ1hzfTtcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPENvbXBvbmVudCB7Li4ucHJvcHN9PntjaGlsZHJlbn08L0NvbXBvbmVudD5cbiAgICAgIDwvc3Bhbj5cbiAgICA8Lz5cbiAgKTtcbn07XG5XcmFwcGVyV2l0aEljb24ucHJvcFR5cGVzID0ge1xuICBjaGlsZHJlbjogUHJvcFR5cGVzLm5vZGUsXG4gIHR5cGU6IFByb3BUeXBlcy5vbmVPZihbJ3NpbmdsZVZhbHVlJywgJ3BsYWNlaG9sZGVyJ10pLFxuICBzZWxlY3RQcm9wczogUHJvcFR5cGVzLnNoYXBlKHtcbiAgICBpY29uTGVmdDogUHJvcFR5cGVzLm5vZGUsXG4gIH0pLFxufTtcbldyYXBwZXJXaXRoSWNvbi5kaXNwbGF5TmFtZSA9ICdXcmFwcGVyV2l0aEljb24nO1xuXG5leHBvcnQgZGVmYXVsdCBXcmFwcGVyV2l0aEljb247XG5cbi8qIGVzbGludC1kaXNhYmxlIHJlYWN0L2Rpc3BsYXktbmFtZSAqL1xuY29uc3QgY3VzdG9tQ29tcG9uZW50cyA9IHtcbiAgU2luZ2xlVmFsdWU6IChwcm9wcykgPT4gPFdyYXBwZXJXaXRoSWNvbiB7Li4ucHJvcHN9IHR5cGU9XCJzaW5nbGVWYWx1ZVwiIC8+LFxuICBQbGFjZWhvbGRlcjogKHByb3BzKSA9PiA8V3JhcHBlcldpdGhJY29uIHsuLi5wcm9wc30gdHlwZT1cInBsYWNlaG9sZGVyXCIgLz4sXG59O1xuLyogZXNsaW50LWVuYWJsZSByZWFjdC9kaXNwbGF5LW5hbWUgKi9cblxuZXhwb3J0IHsgY3VzdG9tQ29tcG9uZW50cyB9O1xuIl19 */"),
|
|
158
|
+
children: jsx(Component, _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
159
|
+
children: children
|
|
160
|
+
}))
|
|
161
|
+
})]
|
|
162
|
+
});
|
|
128
163
|
};
|
|
129
164
|
|
|
130
165
|
WrapperWithIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -135,16 +170,17 @@ WrapperWithIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
135
170
|
})
|
|
136
171
|
} : {};
|
|
137
172
|
WrapperWithIcon.displayName = 'WrapperWithIcon';
|
|
173
|
+
var WrapperWithIcon$1 = WrapperWithIcon;
|
|
138
174
|
/* eslint-disable react/display-name */
|
|
139
175
|
|
|
140
176
|
var customComponents = {
|
|
141
177
|
SingleValue: function SingleValue(props) {
|
|
142
|
-
return jsx(WrapperWithIcon,
|
|
178
|
+
return jsx(WrapperWithIcon, _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
143
179
|
type: "singleValue"
|
|
144
180
|
}));
|
|
145
181
|
},
|
|
146
182
|
Placeholder: function Placeholder(props) {
|
|
147
|
-
return jsx(WrapperWithIcon,
|
|
183
|
+
return jsx(WrapperWithIcon, _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
148
184
|
type: "placeholder"
|
|
149
185
|
}));
|
|
150
186
|
}
|
|
@@ -157,14 +193,25 @@ var SELECT_DROPDOWN_OPTION_TYPES = {
|
|
|
157
193
|
MULTIPLE_PROPERTIES: 'multiple-properties'
|
|
158
194
|
};
|
|
159
195
|
|
|
196
|
+
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
197
|
+
|
|
198
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$1(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
160
199
|
var MultiplePropertiesSelectInputOption = function MultiplePropertiesSelectInputOption(props) {
|
|
161
200
|
var data = props.data;
|
|
162
201
|
var noValueFallback = props.noValueFallback || NO_VALUE_FALLBACK;
|
|
163
|
-
return jsx(components.Option, props,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
202
|
+
return jsx(components.Option, _objectSpread$1(_objectSpread$1({}, props), {}, {
|
|
203
|
+
children: jsxs(Spacings.Stack, {
|
|
204
|
+
scale: "xs",
|
|
205
|
+
children: [jsx(Text.Detail, {
|
|
206
|
+
isBold: true,
|
|
207
|
+
children: data.label || noValueFallback
|
|
208
|
+
}), jsxs(Text.Detail, {
|
|
209
|
+
children: ["Key: ", data.key || noValueFallback]
|
|
210
|
+
}), jsxs(Text.Detail, {
|
|
211
|
+
children: ["ID: ", data.id || noValueFallback]
|
|
212
|
+
})]
|
|
213
|
+
})
|
|
214
|
+
}));
|
|
168
215
|
};
|
|
169
216
|
MultiplePropertiesSelectInputOption.displayName = 'MultiplePropertiesSelectInputOption';
|
|
170
217
|
MultiplePropertiesSelectInputOption.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -178,11 +225,17 @@ MultiplePropertiesSelectInputOption.propTypes = process.env.NODE_ENV !== "produc
|
|
|
178
225
|
var DoublePropertySelectInputOption = function DoublePropertySelectInputOption(props) {
|
|
179
226
|
var data = props.data;
|
|
180
227
|
var noValueFallback = props.noValueFallback || NO_VALUE_FALLBACK;
|
|
181
|
-
return jsx(components.Option, props,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
228
|
+
return jsx(components.Option, _objectSpread$1(_objectSpread$1({}, props), {}, {
|
|
229
|
+
children: jsxs(Spacings.Stack, {
|
|
230
|
+
scale: "xs",
|
|
231
|
+
children: [jsx(Text.Detail, {
|
|
232
|
+
isBold: true,
|
|
233
|
+
children: data.label || noValueFallback
|
|
234
|
+
}), jsxs(Text.Detail, {
|
|
235
|
+
children: ["Key: ", data.key || noValueFallback]
|
|
236
|
+
})]
|
|
237
|
+
})
|
|
238
|
+
}));
|
|
186
239
|
};
|
|
187
240
|
DoublePropertySelectInputOption.displayName = 'DoublePropertySelectInputOption';
|
|
188
241
|
DoublePropertySelectInputOption.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -197,17 +250,21 @@ var CustomSelectInputOption = function CustomSelectInputOption(props) {
|
|
|
197
250
|
|
|
198
251
|
switch (props.optionType) {
|
|
199
252
|
case SELECT_DROPDOWN_OPTION_TYPES.MULTIPLE_PROPERTIES:
|
|
200
|
-
return jsx(MultiplePropertiesSelectInputOption,
|
|
253
|
+
return jsx(MultiplePropertiesSelectInputOption, _objectSpread$1(_objectSpread$1({}, props.optionInnerProps), {}, {
|
|
201
254
|
noValueFallback: noValueFallback
|
|
202
255
|
}));
|
|
203
256
|
|
|
204
257
|
case SELECT_DROPDOWN_OPTION_TYPES.DOUBLE_PROPERTY:
|
|
205
|
-
return jsx(DoublePropertySelectInputOption,
|
|
258
|
+
return jsx(DoublePropertySelectInputOption, _objectSpread$1(_objectSpread$1({}, props.optionInnerProps), {}, {
|
|
206
259
|
noValueFallback: noValueFallback
|
|
207
260
|
}));
|
|
208
261
|
|
|
209
262
|
default:
|
|
210
|
-
return jsx(components.Option,
|
|
263
|
+
return jsx(components.Option, _objectSpread$1(_objectSpread$1({}, props.optionInnerProps), {}, {
|
|
264
|
+
children: jsx(Text.Detail, {
|
|
265
|
+
children: props.optionInnerProps.data.label || noValueFallback
|
|
266
|
+
})
|
|
267
|
+
}));
|
|
211
268
|
}
|
|
212
269
|
};
|
|
213
270
|
CustomSelectInputOption.displayName = 'CustomSelectInputOption';
|
|
@@ -223,7 +280,7 @@ CustomSelectInputOption.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
223
280
|
}).isRequired
|
|
224
281
|
} : {};
|
|
225
282
|
|
|
226
|
-
var messages
|
|
283
|
+
var messages = defineMessages({
|
|
227
284
|
createLabel: {
|
|
228
285
|
id: 'UIKit.CreatableSelectInput.createLabel',
|
|
229
286
|
description: 'Text of dropdown when creating option',
|
|
@@ -251,7 +308,7 @@ var messages$1 = defineMessages({
|
|
|
251
308
|
}
|
|
252
309
|
});
|
|
253
310
|
|
|
254
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
311
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
255
312
|
|
|
256
313
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context8; _forEachInstanceProperty(_context8 = ownKeys(Object(source), true)).call(_context8, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context9; _forEachInstanceProperty(_context9 = ownKeys(Object(source))).call(_context9, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
257
314
|
|
|
@@ -589,13 +646,13 @@ function createSelectStyles(props, theme) {
|
|
|
589
646
|
menu: menuStyles(props, theme),
|
|
590
647
|
indicatorSeparator: indicatorSeparatorStyles(props, theme),
|
|
591
648
|
dropdownIndicator: dropdownIndicatorStyles(props, theme),
|
|
592
|
-
clearIndicator: clearIndicatorStyles(),
|
|
649
|
+
clearIndicator: clearIndicatorStyles(props, theme),
|
|
593
650
|
menuList: menuListStyles(props, theme),
|
|
594
|
-
menuPortal: menuPortalStyles(props),
|
|
651
|
+
menuPortal: menuPortalStyles(props, theme),
|
|
595
652
|
multiValue: multiValueStyles(props, theme),
|
|
596
653
|
multiValueLabel: multiValueLabelStyles(props, theme),
|
|
597
654
|
multiValueRemove: multiValueRemoveStyles(props, theme),
|
|
598
|
-
indicatorsContainer: indicatorsContainerStyles(),
|
|
655
|
+
indicatorsContainer: indicatorsContainerStyles(props, theme),
|
|
599
656
|
option: optionStyles(props, theme),
|
|
600
657
|
placeholder: placeholderStyles(props, theme),
|
|
601
658
|
valueContainer: valueContainerStyles(props, theme),
|
|
@@ -606,7 +663,7 @@ function createSelectStyles(props, theme) {
|
|
|
606
663
|
};
|
|
607
664
|
}
|
|
608
665
|
|
|
609
|
-
// NOTE: This string will be replaced
|
|
610
|
-
var version =
|
|
666
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
667
|
+
var version = "12.2.5";
|
|
611
668
|
|
|
612
|
-
export { ClearIndicator, CustomSelectInputOption, DoublePropertySelectInputOption, DropdownIndicator, MultiplePropertiesSelectInputOption, SELECT_DROPDOWN_OPTION_TYPES, SearchIconDropdownIndicator, TagRemove, WrapperWithIcon as ValueWrapperWithIcon, createSelectStyles, customComponents as customComponentsWithIcons, messages
|
|
669
|
+
export { ClearIndicator$1 as ClearIndicator, CustomSelectInputOption, DoublePropertySelectInputOption, DropdownIndicator$1 as DropdownIndicator, MultiplePropertiesSelectInputOption, SELECT_DROPDOWN_OPTION_TYPES, SearchIconDropdownIndicator$1 as SearchIconDropdownIndicator, TagRemove$1 as TagRemove, WrapperWithIcon$1 as ValueWrapperWithIcon, createSelectStyles, customComponents as customComponentsWithIcons, messages, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/select-utils",
|
|
3
3
|
"description": "Utilities for working with select components.",
|
|
4
|
-
"version": "12.2.
|
|
4
|
+
"version": "12.2.5",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,28 +9,31 @@
|
|
|
9
9
|
"directory": "packages/components/inputs/select-utils"
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://uikit.commercetools.com",
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"javascript",
|
|
14
|
+
"design system",
|
|
15
|
+
"react",
|
|
16
|
+
"uikit"
|
|
17
|
+
],
|
|
13
18
|
"license": "MIT",
|
|
14
|
-
"private": false,
|
|
15
19
|
"publishConfig": {
|
|
16
20
|
"access": "public"
|
|
17
21
|
},
|
|
18
22
|
"sideEffects": false,
|
|
19
23
|
"main": "dist/commercetools-uikit-select-utils.cjs.js",
|
|
20
24
|
"module": "dist/commercetools-uikit-select-utils.esm.js",
|
|
21
|
-
"files": [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@babel/runtime": "7.
|
|
27
|
-
"@babel/runtime-corejs3": "7.
|
|
28
|
-
"@commercetools-uikit/accessible-button": "12.2.
|
|
29
|
-
"@commercetools-uikit/design-system": "12.
|
|
30
|
-
"@commercetools-uikit/icons": "12.2.
|
|
31
|
-
"@commercetools-uikit/spacings": "12.2.
|
|
32
|
-
"@commercetools-uikit/text": "12.2.
|
|
33
|
-
"@commercetools-uikit/utils": "12.2.
|
|
29
|
+
"@babel/runtime": "7.16.3",
|
|
30
|
+
"@babel/runtime-corejs3": "7.16.3",
|
|
31
|
+
"@commercetools-uikit/accessible-button": "12.2.5",
|
|
32
|
+
"@commercetools-uikit/design-system": "12.2.5",
|
|
33
|
+
"@commercetools-uikit/icons": "12.2.5",
|
|
34
|
+
"@commercetools-uikit/spacings": "12.2.5",
|
|
35
|
+
"@commercetools-uikit/text": "12.2.5",
|
|
36
|
+
"@commercetools-uikit/utils": "12.2.5",
|
|
34
37
|
"@emotion/react": "^11.4.0",
|
|
35
38
|
"@emotion/styled": "^11.3.0",
|
|
36
39
|
"lodash": "4.17.21",
|
|
@@ -39,7 +42,7 @@
|
|
|
39
42
|
},
|
|
40
43
|
"devDependencies": {
|
|
41
44
|
"react": "17.0.2",
|
|
42
|
-
"react-intl": "5.
|
|
45
|
+
"react-intl": "5.21.2"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
48
|
"react": "17.x",
|