@ntbjs/react-components 2.0.2-rc.11 → 2.0.2-rc.12
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.
- package/build/data/Badge/Badge.js +6 -6
- package/build/data/Badge/Badge.js.map +1 -1
- package/build/data/Badge/Badge.styled.js +11 -10
- package/build/data/Badge/Badge.styled.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.js +209 -209
- package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.styled.js +38 -187
- package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +8 -8
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +2 -2
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,240 +1,241 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import React__default, { useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import { useTheme } from 'styled-components';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { nanoid } from 'nanoid';
|
|
5
5
|
import { components } from 'react-select';
|
|
6
|
-
import {
|
|
7
|
-
import { ReactComponent as SvgClose } from '../../icons/close.svg.js';
|
|
6
|
+
import { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, MultiSelect as MultiSelect$1, MultiSelectWrapper, Label, InnerWrapper, ShowMoreWrapper, ShowMoreOverlay, ShowMoreText, ErrorMessage, DropdownOptionDeleteIcon, MultiValueWrapper } from './MultiSelect.styled.js';
|
|
8
7
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onMultiValueClick,
|
|
32
|
-
showMore,
|
|
33
|
-
showMoreText = 'Show more',
|
|
34
|
-
displayTotalOnShowMore = true,
|
|
35
|
-
noOptionsMessageFunc,
|
|
36
|
-
...props
|
|
37
|
-
}, forwardedRef) {
|
|
8
|
+
const showMoreHeight = 114;
|
|
9
|
+
const MultiSelect = React__default.forwardRef((props, forwardedRef) => {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const {
|
|
12
|
+
label,
|
|
13
|
+
selectedOptions = [],
|
|
14
|
+
availableOptions,
|
|
15
|
+
loadOptions,
|
|
16
|
+
onUpdateCallback,
|
|
17
|
+
editText,
|
|
18
|
+
creatable,
|
|
19
|
+
readOnly,
|
|
20
|
+
disabled,
|
|
21
|
+
error,
|
|
22
|
+
warning,
|
|
23
|
+
onMultiValueClick,
|
|
24
|
+
showMore,
|
|
25
|
+
showMoreText = 'Show more',
|
|
26
|
+
displayTotalOnShowMore = true,
|
|
27
|
+
hidden,
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
38
30
|
const [uniqueId] = useState(nanoid());
|
|
39
31
|
const [selected, setSelected] = useState(selectedOptions);
|
|
40
|
-
const [focused, setFocused] = useState(false);
|
|
41
|
-
const [displayShowMore, setDisplayShowMore] = useState(error || warning ? false : showMore);
|
|
42
32
|
const [cacheUnique, setCacheUnique] = useState(0);
|
|
43
|
-
const [
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
useEffect(() =>
|
|
47
|
-
setSelected(selectedOptions);
|
|
48
|
-
}, [selectedOptions]);
|
|
33
|
+
const [displayShowMore, setDisplayShowMore] = useState(showMore && !error && !warning);
|
|
34
|
+
const [focused, setFocused] = useState(false);
|
|
35
|
+
const [isDarkMode, setIsDarkMode] = useState(() => document.body.classList.contains('dark-theme'));
|
|
36
|
+
useEffect(() => setSelected(selectedOptions), [selectedOptions]);
|
|
49
37
|
useEffect(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
38
|
+
const observer = new MutationObserver(() => {
|
|
39
|
+
setIsDarkMode(document.body.classList.contains('dark-theme'));
|
|
40
|
+
});
|
|
41
|
+
observer.observe(document.body, {
|
|
42
|
+
attributes: true,
|
|
43
|
+
attributeFilter: ['class']
|
|
44
|
+
});
|
|
45
|
+
return () => observer.disconnect();
|
|
59
46
|
}, []);
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
47
|
+
const selectStyles = useMemo(() => {
|
|
48
|
+
const color = key => theme?.getColor?.(key) || '#888';
|
|
49
|
+
const getThemeColor = (darkKey, lightKey) => {
|
|
50
|
+
const prefersDark = !document.body.classList.contains('light-theme') && !document.body.classList.contains('dark-theme') && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
51
|
+
return isDarkMode || prefersDark ? color(darkKey) : color(lightKey);
|
|
52
|
+
};
|
|
53
|
+
const errorColor = color('red-500');
|
|
54
|
+
const warningColor = color('orange-500');
|
|
55
|
+
const menuBg = getThemeColor('gray-600', 'white');
|
|
56
|
+
const textColor = getThemeColor('gray-100', 'gray-900');
|
|
57
|
+
const placeholderColor = getThemeColor('gray-400', 'gray-500');
|
|
58
|
+
const multiValueBg = getThemeColor('gray-600', 'gray-800');
|
|
59
|
+
console.log('Theme in selectStyles:', {
|
|
60
|
+
menuBg,
|
|
61
|
+
textColor,
|
|
62
|
+
placeholderColor,
|
|
63
|
+
multiValueBg,
|
|
64
|
+
isDarkMode
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
control: base => ({
|
|
68
|
+
...base,
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
background: 'transparent',
|
|
71
|
+
border: error ? `1px solid ${errorColor}` : warning ? `1px solid ${warningColor}` : 'none',
|
|
72
|
+
borderRadius: '3px',
|
|
73
|
+
boxShadow: 'none',
|
|
74
|
+
minHeight: '38px',
|
|
75
|
+
cursor: disabled || readOnly ? 'default' : 'pointer',
|
|
76
|
+
'&:hover': {
|
|
77
|
+
border: error ? `1px solid ${errorColor}` : warning ? `1px solid ${warningColor}` : 'none'
|
|
89
78
|
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}),
|
|
130
|
-
menu: base => ({
|
|
131
|
-
...base,
|
|
132
|
-
backgroundColor: 'transparent',
|
|
133
|
-
boxShadow: 'none'
|
|
134
|
-
}),
|
|
135
|
-
menuList: base => ({
|
|
136
|
-
...base,
|
|
137
|
-
backgroundColor: 'transparent'
|
|
138
|
-
}),
|
|
139
|
-
option: base => ({
|
|
140
|
-
...base,
|
|
141
|
-
backgroundColor: 'transparent',
|
|
142
|
-
color: 'inherit'
|
|
143
|
-
}),
|
|
144
|
-
multiValue: base => ({
|
|
145
|
-
...base,
|
|
146
|
-
margin: 0,
|
|
147
|
-
border: 'none',
|
|
148
|
-
background: 'none',
|
|
149
|
-
cursor: readOnly || disabled ? 'default' : 'pointer'
|
|
150
|
-
}),
|
|
151
|
-
multiValueLabel: base => ({
|
|
152
|
-
...base,
|
|
153
|
-
padding: 0,
|
|
154
|
-
cursor: readOnly || disabled ? 'default' : 'pointer'
|
|
155
|
-
}),
|
|
156
|
-
multiValueRemove: base => ({
|
|
157
|
-
...base,
|
|
158
|
-
padding: 0,
|
|
159
|
-
cursor: readOnly || disabled ? 'default' : 'pointer'
|
|
160
|
-
})
|
|
161
|
-
}), [error, warning, displayShowMore, readOnly, disabled]);
|
|
162
|
-
const sharedProps = {
|
|
163
|
-
...props,
|
|
164
|
-
ref: node => {
|
|
165
|
-
selectRef.current = node;
|
|
166
|
-
if (forwardedRef) {
|
|
167
|
-
if (typeof forwardedRef === 'function') {
|
|
168
|
-
forwardedRef(node);
|
|
169
|
-
} else {
|
|
170
|
-
forwardedRef.current = node;
|
|
79
|
+
}),
|
|
80
|
+
valueContainer: base => ({
|
|
81
|
+
...base,
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
gap: '8px',
|
|
84
|
+
padding: '0 8px',
|
|
85
|
+
maxHeight: displayShowMore ? error || warning ? '100%' : `${showMoreHeight + 16}px` : '100%',
|
|
86
|
+
overflow: 'hidden'
|
|
87
|
+
}),
|
|
88
|
+
multiValue: base => ({
|
|
89
|
+
...base,
|
|
90
|
+
backgroundColor: multiValueBg,
|
|
91
|
+
borderRadius: '3px',
|
|
92
|
+
margin: '0',
|
|
93
|
+
display: 'flex',
|
|
94
|
+
alignItems: 'stretch',
|
|
95
|
+
minHeight: '26px',
|
|
96
|
+
overflow: 'hidden'
|
|
97
|
+
}),
|
|
98
|
+
multiValueLabel: base => ({
|
|
99
|
+
...base,
|
|
100
|
+
color: color('white'),
|
|
101
|
+
fontSize: '12px',
|
|
102
|
+
padding: disabled || readOnly ? '0 8px' : '0 3px 0 8px',
|
|
103
|
+
display: 'flex',
|
|
104
|
+
alignItems: 'center'
|
|
105
|
+
}),
|
|
106
|
+
multiValueRemove: base => ({
|
|
107
|
+
...base,
|
|
108
|
+
color: 'white',
|
|
109
|
+
padding: '0 8px 0 5px',
|
|
110
|
+
display: disabled || readOnly ? 'none' : 'flex',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
alignSelf: 'stretch',
|
|
113
|
+
borderRadius: '0',
|
|
114
|
+
cursor: 'pointer',
|
|
115
|
+
'&:hover': {
|
|
116
|
+
backgroundColor: errorColor,
|
|
117
|
+
color: 'white'
|
|
171
118
|
}
|
|
119
|
+
}),
|
|
120
|
+
menu: base => ({
|
|
121
|
+
...base,
|
|
122
|
+
backgroundColor: menuBg,
|
|
123
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.5)',
|
|
124
|
+
zIndex: 999,
|
|
125
|
+
marginTop: '4px',
|
|
126
|
+
border: `1px solid ${getThemeColor('gray-500', 'gray-300')}`
|
|
127
|
+
}),
|
|
128
|
+
menuList: base => ({
|
|
129
|
+
...base,
|
|
130
|
+
backgroundColor: 'transparent',
|
|
131
|
+
padding: 0
|
|
132
|
+
}),
|
|
133
|
+
option: (base, state) => ({
|
|
134
|
+
...base,
|
|
135
|
+
backgroundColor: state.isFocused ? getThemeColor('gray-500', 'gray-100') : 'transparent',
|
|
136
|
+
color: textColor,
|
|
137
|
+
cursor: 'pointer',
|
|
138
|
+
fontSize: '14px',
|
|
139
|
+
padding: '8px 12px',
|
|
140
|
+
':active': {
|
|
141
|
+
backgroundColor: getThemeColor('gray-400', 'gray-200')
|
|
142
|
+
}
|
|
143
|
+
}),
|
|
144
|
+
input: (base, state) => ({
|
|
145
|
+
...base,
|
|
146
|
+
display: 'inline-grid',
|
|
147
|
+
whiteSpace: 'nowrap',
|
|
148
|
+
color: textColor,
|
|
149
|
+
margin: 0,
|
|
150
|
+
padding: 0,
|
|
151
|
+
':before': !focused && editText && !state.value ? {
|
|
152
|
+
content: `"${editText}"`,
|
|
153
|
+
color: placeholderColor,
|
|
154
|
+
marginRight: '8px',
|
|
155
|
+
lineHeight: '26px',
|
|
156
|
+
gridArea: '1 / 1'
|
|
157
|
+
} : {}
|
|
158
|
+
}),
|
|
159
|
+
noOptionsMessage: base => ({
|
|
160
|
+
...base,
|
|
161
|
+
color: textColor,
|
|
162
|
+
backgroundColor: 'transparent'
|
|
163
|
+
}),
|
|
164
|
+
loadingMessage: base => ({
|
|
165
|
+
...base,
|
|
166
|
+
color: textColor,
|
|
167
|
+
backgroundColor: 'transparent'
|
|
168
|
+
}),
|
|
169
|
+
placeholder: () => ({
|
|
170
|
+
display: 'none'
|
|
171
|
+
}),
|
|
172
|
+
indicatorsContainer: () => ({
|
|
173
|
+
display: 'none'
|
|
174
|
+
})
|
|
175
|
+
};
|
|
176
|
+
}, [theme, error, warning, displayShowMore, disabled, readOnly, editText, focused, isDarkMode]);
|
|
177
|
+
const innerComponents = {
|
|
178
|
+
Option: optProps => React__default.createElement(components.Option, optProps, React__default.createElement("div", {
|
|
179
|
+
style: {
|
|
180
|
+
display: 'flex',
|
|
181
|
+
justifyContent: 'space-between',
|
|
182
|
+
width: '100%',
|
|
183
|
+
alignItems: 'center'
|
|
172
184
|
}
|
|
173
|
-
},
|
|
185
|
+
}, React__default.createElement("span", null, optProps.label), optProps.isSelected && React__default.createElement(DropdownOptionDeleteIcon, null))),
|
|
186
|
+
MultiValue: mvProps => React__default.createElement(MultiValueWrapper, {
|
|
187
|
+
onMouseDown: e => {
|
|
188
|
+
if (onMultiValueClick && !readOnly && !disabled && !e.target.closest('.multi-select__multi-value__remove')) {
|
|
189
|
+
e.stopPropagation();
|
|
190
|
+
onMultiValueClick(mvProps.data);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}, React__default.createElement(components.MultiValue, mvProps))
|
|
194
|
+
};
|
|
195
|
+
const sharedSelectProps = {
|
|
196
|
+
...rest,
|
|
197
|
+
ref: forwardedRef,
|
|
198
|
+
id: uniqueId,
|
|
174
199
|
classNamePrefix: 'multi-select',
|
|
200
|
+
styles: selectStyles,
|
|
201
|
+
components: innerComponents,
|
|
175
202
|
value: selected,
|
|
176
203
|
options: loadOptions ? undefined : availableOptions,
|
|
177
204
|
loadOptions,
|
|
178
|
-
loadingMessage: loadingMessageFunc,
|
|
179
|
-
theme: reactSelectTheme,
|
|
180
|
-
styles: selectStyles,
|
|
181
|
-
components: innerComponents,
|
|
182
205
|
isMulti: true,
|
|
183
|
-
|
|
184
|
-
placeholder: null,
|
|
185
|
-
isDisabled: disabled,
|
|
186
|
-
readOnly: readOnly,
|
|
206
|
+
isDisabled: disabled || readOnly,
|
|
187
207
|
closeMenuOnSelect: false,
|
|
188
208
|
hideSelectedOptions: false,
|
|
189
209
|
openMenuOnClick: true,
|
|
190
|
-
openMenuOnFocus: true,
|
|
191
|
-
blurInputOnSelect: false,
|
|
192
|
-
menuIsOpen: isMenuOpen ? true : undefined,
|
|
193
|
-
cacheUniqs: loadOptions ? [cacheUnique] : undefined,
|
|
194
|
-
onMenuOpen: () => {
|
|
195
|
-
setIsMenuOpen(true);
|
|
196
|
-
},
|
|
197
|
-
onMenuClose: () => {
|
|
198
|
-
setIsMenuOpen(false);
|
|
199
|
-
},
|
|
200
210
|
onFocus: () => setFocused(true),
|
|
201
211
|
onBlur: () => setFocused(false),
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}) => getNoOptionsMessage(inputValue),
|
|
205
|
-
onChange: (selectedOptions, actionMeta) => {
|
|
206
|
-
if (props.onChange) {
|
|
207
|
-
props.onChange(selectedOptions, actionMeta);
|
|
208
|
-
}
|
|
212
|
+
onChange: (newValue, actionMeta) => {
|
|
213
|
+
setSelected(newValue);
|
|
209
214
|
if (onUpdateCallback) {
|
|
210
|
-
const
|
|
211
|
-
onUpdateCallback(actionMeta.action,
|
|
215
|
+
const item = actionMeta.option || actionMeta.removedValue;
|
|
216
|
+
onUpdateCallback(actionMeta.action, item);
|
|
212
217
|
}
|
|
213
|
-
setSelected(selectedOptions);
|
|
214
218
|
if (actionMeta.action === 'create-option' && loadOptions) {
|
|
215
|
-
setCacheUnique(
|
|
219
|
+
setCacheUnique(c => c + 1);
|
|
216
220
|
}
|
|
217
|
-
}
|
|
221
|
+
},
|
|
222
|
+
cacheUniqs: loadOptions ? [cacheUnique] : undefined
|
|
218
223
|
};
|
|
224
|
+
const SelectComponent = useMemo(() => {
|
|
225
|
+
if (loadOptions) return creatable ? AsyncCreatableMultiSelect : AsyncMultiSelect;
|
|
226
|
+
return creatable ? CreatableMultiSelect : MultiSelect$1;
|
|
227
|
+
}, [loadOptions, creatable]);
|
|
219
228
|
if (hidden) return null;
|
|
220
|
-
return React__default.createElement(MultiSelectWrapper, {
|
|
221
|
-
ref: wrapperRef,
|
|
222
|
-
onClick: handleWrapperClick
|
|
223
|
-
}, label && React__default.createElement(Label, {
|
|
229
|
+
return React__default.createElement(MultiSelectWrapper, null, label && React__default.createElement(Label, {
|
|
224
230
|
htmlFor: uniqueId
|
|
225
|
-
}, label), React__default.createElement(InnerWrapper, {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
setDisplayShowMore(false);
|
|
232
|
-
}
|
|
233
|
-
}, React__default.createElement(ShowMoreOverlay, null), React__default.createElement(ShowMoreText, null, showMoreText, " ", displayTotalOnShowMore && `(${selected.length})`)), (typeof error === 'string' || typeof warning === 'string') && React__default.createElement(ErrorMessage, {
|
|
234
|
-
$error: error,
|
|
235
|
-
$warning: warning
|
|
236
|
-
}, error ? error : warning));
|
|
231
|
+
}, label), React__default.createElement(InnerWrapper, null, React__default.createElement(SelectComponent, sharedSelectProps)), displayShowMore && React__default.createElement(ShowMoreWrapper, {
|
|
232
|
+
onClick: () => setDisplayShowMore(false)
|
|
233
|
+
}, React__default.createElement(ShowMoreOverlay, null), React__default.createElement(ShowMoreText, null, showMoreText, " ", displayTotalOnShowMore && `(${selected.length})`)), (error || warning) && React__default.createElement(ErrorMessage, {
|
|
234
|
+
$error: !!error,
|
|
235
|
+
$warning: !!warning
|
|
236
|
+
}, error || warning));
|
|
237
237
|
});
|
|
238
|
+
MultiSelect.displayName = 'MultiSelect';
|
|
238
239
|
MultiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
239
240
|
label: PropTypes.string,
|
|
240
241
|
availableOptions: PropTypes.arrayOf(PropTypes.object),
|
|
@@ -254,8 +255,7 @@ MultiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
254
255
|
hidden: PropTypes.bool,
|
|
255
256
|
disabled: PropTypes.bool,
|
|
256
257
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
257
|
-
warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
|
258
|
-
onChange: PropTypes.func
|
|
258
|
+
warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
|
259
259
|
} : {};
|
|
260
260
|
MultiSelect.defaultProps = {
|
|
261
261
|
noOptionsMessageFunc: inputValue => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.js"],"sourcesContent":["import React, { useState, useMemo, useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { nanoid } from 'nanoid';\nimport { components } from 'react-select';\nimport * as S from './MultiSelect.styled';\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\n\n/**\n * Multi-select with autocomplete and support for asynchronous fetching/filtering of\n * available options with pagination, update handling with callback,\n * and the ability for the end-user to create new options.\n *\n * The component uses [react-select](https://react-select.com/) for the main select functionality,\n * with [react-select-async-paginate](https://www.npmjs.com/package/react-select-async-paginate) for pagination.\n *\n *\n * <br />### Import\n *\n * ``` js\n * import { MultiSelect } from '@ntbjs/react-components/inputs'\n * // or\n * import MultiSelect from '@ntbjs/react-components/inputs/MultiSelect'\n * ```\n *\n * <br />## Option `object` format\n * Options are represented by an `Array` of `objects` with the following format:\n *\n * ``` js\n * {\n * value: \"Example\",\n * label: \"Example\"\n * }\n * ```\n *\n * The `label` is what will visible to the end-user. Whether `value` and `label`\n * should be different will depend on your use-case, but they are not required to.\n *\n *\n * <br />## Update handling\n * Changes from the end-user to the selected/available options can be handled with a callback function\n * passed through the `onUpdateCallback` prop, which is triggered any time the selected values change.\n *\n * The callback function will be passed two arguments:\n * * `action: string`\n * * `updatedOption: object`\n *\n * <br />#### `action`\n * A `string` indicating what kind of update was made.\n *\n * The possible values of `action` are:\n * * `create-option`: an option that didn't exist in the original list of available options were added\n * * `select-option`: an option was selected\n * * `deselect-option`: an option was de-selected by clicking the X in the dropdown menu\n * * `remove-value`: an option was de-selected by clicking the X on the option label/box\n * * `pop-value`: an option was de-selected with backspace\n * * `clear`: all options were de-selected by clicking the clear indicator (not currently in use)\n *\n * <br />#### `updatedOption`\n * Option `object`of the updated option:\n *\n * In addition to the default `value` and `label` keys, an `__isNew__` flag will be present if the option was\n * not part of the original list of available options, i.e. created by the user in the current \"session\".\n * This is the case regardless of whether the list is provided through `availableOptions` or\n * asynchronously through `loadOptions`.\n *\n *\n * <br />## Asynchronous fetching/filtering with pagination\n * The list of available options can be fetched and filtered asynchronously with a `Promise`\n * passed through the `loadOptions` prop.\n *\n * It will be passed two arguments:\n *\n * * `inputValue: string`: current input value/search\n * * `prevOptions: Array`: previously loaded options for the current search\n *\n * The function is triggered and the first page is fetched when the dropdown menu opens.\n * Whenever the user scrolls down to the bottom of the list, `loadOptions` will\n * be triggered again to fetch the next page.\n *\n * The `Promise` should return an `object` with the following keys:\n *\n * ``` js\n * {\n * options: Array,\n * hasMore: boolean\n * }\n * ```\n *\n * `options` should contain the current page of options. It will be concatenated to the previous\n * set of options automatically. The `hasMore` flag indicates whether there is another page to be fetched.\n *\n * **Example:**\n *\n * ``` js\n *\n * const availableOptions = [\n * { value: \"Example 1\", label: \"Example 1\" },\n * ...\n * { value: \"Example N\", label: \"Example N\" }\n * ];\n *\n * const filterOptions = inputValue => {\n * return availableOptions.filter(option => {\n * return option.label.toLowerCase().includes(inputValue.toLowerCase());\n * });\n * };\n *\n * const loadOptionsFunc = (inputValue, prevOptions) => {\n * const currentLength = prevOptions.length;\n * const pageLength = 10;\n *\n * let filteredOptions;\n *\n * if (inputValue) {\n * filteredOptions = filterOptions(inputValue);\n * } else {\n * filteredOptions = availableOptions;\n * }\n *\n * const hasMore = filteredOptions.length > currentLength + pageLength;\n * const slicedOptions = filteredOptions.slice(currentLength, currentLength + pageLength);\n *\n * return {\n * options: slicedOptions,\n * hasMore\n * };\n * };\n *\n * const loadOptions = (inputValue, prevOptions) => {\n * return new Promise(resolve => {\n * resolve(loadOptionsFunc(inputValue, prevOptions));\n * });\n * };\n * ```\n *\n * While waiting for the `Promise` to resolve, the component will be in a loading state.\n * The loading state is showcased in the \"Primary With Fetching Timeout\" Story.\n *\n * <br />#### Without asynchronous fetching/filtering\n * If you wish to not use asynchronous fetching/filtering, leave the `loadOptions` prop undefined\n * and pass the `Array` of all available options to the `availableOptions` prop instead.\n * The component will use the built-in filtering on `label` from `react-select`, and the options\n * will not be paginated.\n *\n *\n * <br />## \"Show more\" overlay\n * The \"Show more\" overlay must be set manually with the `showMore` prop.\n *\n * By default, the total number\n * of selected options will be displayed in parenthesis after the \"Show more\" text. This can be\n * disabled with the `displayTotalOnShowMore` prop.\n *\n * **Note:**\n * <br />The component has been given a max-width in these Stories.\n * This is because the \"Show more\" overlay does not work well visually when there are\n * fewer than three rows of selected options. The component itself does not have\n * a max-width, so keep this in mind when using it.\n *\n * <br />\n */\n\nconst reactSelectTheme = theme => ({\n ...theme,\n spacing: {\n baseUnit: 4,\n controlHeight: 38,\n menuGutter: 8\n }\n});\n\nconst MultiSelect = React.forwardRef(function MultiSelect(\n {\n label,\n selectedOptions = [],\n availableOptions,\n loadOptions,\n loadingMessageFunc,\n onUpdateCallback,\n editText,\n creatable,\n readOnly,\n hidden,\n disabled,\n error,\n warning,\n onMultiValueClick,\n showMore,\n showMoreText = 'Show more',\n displayTotalOnShowMore = true,\n noOptionsMessageFunc,\n ...props\n },\n forwardedRef\n) {\n const [uniqueId] = useState(nanoid());\n const [selected, setSelected] = useState(selectedOptions);\n const [focused, setFocused] = useState(false);\n const [displayShowMore, setDisplayShowMore] = useState(error || warning ? false : showMore);\n const [cacheUnique, setCacheUnique] = useState(0);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const wrapperRef = useRef(null);\n const selectRef = useRef(null);\n\n useEffect(() => {\n setSelected(selectedOptions);\n }, [selectedOptions]);\n\n // Handle clicks outside the component to close the menu\n useEffect(() => {\n function handleClickOutside(event) {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {\n setIsMenuOpen(false);\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n\n // Handle clicks inside the wrapper to open the menu\n const handleWrapperClick = event => {\n if (readOnly || disabled) return;\n\n // Check if clicking on a remove button\n const isRemoveButton =\n event.target.closest('.multi-select__multi-value__remove') ||\n event.target.closest('[role=\"button\"]') ||\n event.target instanceof SVGElement ||\n event.target.closest('svg');\n\n if (!isRemoveButton && !isMenuOpen) {\n // Open the menu by focusing the select\n if (selectRef.current) {\n selectRef.current.focus();\n }\n setIsMenuOpen(true);\n }\n };\n\n const getNoOptionsMessage = inputValue => {\n if (typeof noOptionsMessageFunc === 'function') {\n return noOptionsMessageFunc(inputValue);\n }\n return inputValue ? `No matches for \"${inputValue}\"` : 'No available options';\n };\n\n /**\n * Inner components to replace the default components of 'react-select'.\n * This is to add classnames, custom styling and functionality.\n */\n const innerComponents = {\n DropdownIndicator: null,\n /* eslint-disable react/prop-types */\n MultiValue: ({ data, ...props }) => {\n return (\n <div\n className=\"multi-value-wrapper\"\n onMouseDown={e => {\n if (\n onMultiValueClick &&\n data &&\n !(e.target.role === 'button' || e.target instanceof SVGElement)\n ) {\n e.stopPropagation();\n onMultiValueClick(data);\n }\n }}\n >\n <S.MultiValue data={data} $isDisabled={disabled} $isReadOnly={readOnly} {...props} />\n </div>\n );\n },\n /* eslint-enable react/prop-types */\n MultiValueRemove: props => {\n if (readOnly || disabled) return null;\n return (\n <components.MultiValueRemove {...props}>\n <CloseIcon />\n </components.MultiValueRemove>\n );\n },\n Input: inputProps => (\n <S.InputWrapper\n $focused={focused}\n $editText={!readOnly && !disabled ? editText : ''}\n $isDisabled={readOnly || disabled}\n $isMenuOpen={isMenuOpen}\n >\n <components.Input {...inputProps} />\n </S.InputWrapper>\n ),\n Menu: menuProps => <S.DropdownMenu {...menuProps} />,\n Option: optProps =>\n optProps.isSelected ? (\n <S.SelectedOption {...optProps}>\n <span>{optProps.label}</span>\n <S.DropdownOptionDeleteIcon />\n </S.SelectedOption>\n ) : (\n <S.Option {...optProps} />\n )\n };\n\n /**\n * Custom styles for react-select components\n */\n const selectStyles = useMemo(\n () => ({\n control: base => ({\n ...base,\n alignItems: 'flex-start',\n background: 'transparent',\n border: 'none',\n boxShadow: 'none',\n minHeight: 'unset',\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n valueContainer: base => ({\n ...base,\n padding: 0,\n gap: '8px',\n maxHeight: displayShowMore && !(error || warning) ? '130px' : '100%',\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n input: base => ({\n ...base,\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n menu: base => ({\n ...base,\n backgroundColor: 'transparent',\n boxShadow: 'none'\n }),\n menuList: base => ({\n ...base,\n backgroundColor: 'transparent'\n }),\n option: base => ({\n ...base,\n backgroundColor: 'transparent',\n color: 'inherit'\n }),\n multiValue: base => ({\n ...base,\n margin: 0,\n border: 'none',\n background: 'none',\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n multiValueLabel: base => ({\n ...base,\n padding: 0,\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n multiValueRemove: base => ({\n ...base,\n padding: 0,\n cursor: readOnly || disabled ? 'default' : 'pointer'\n })\n }),\n [error, warning, displayShowMore, readOnly, disabled]\n );\n\n /**\n * Props from 'react-select'/'react-select-async-paginate' shared by the different Select versions\n */\n const sharedProps = {\n ...props,\n ref: node => {\n selectRef.current = node;\n if (forwardedRef) {\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else {\n forwardedRef.current = node;\n }\n }\n },\n classNamePrefix: 'multi-select',\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions,\n loadingMessage: loadingMessageFunc,\n theme: reactSelectTheme,\n styles: selectStyles,\n components: innerComponents,\n isMulti: true,\n isClearable: false,\n placeholder: null,\n isDisabled: disabled,\n readOnly: readOnly,\n closeMenuOnSelect: false,\n hideSelectedOptions: false,\n openMenuOnClick: true,\n openMenuOnFocus: true,\n blurInputOnSelect: false,\n menuIsOpen: isMenuOpen ? true : undefined,\n cacheUniqs: loadOptions ? [cacheUnique] : undefined,\n onMenuOpen: () => {\n setIsMenuOpen(true);\n },\n onMenuClose: () => {\n setIsMenuOpen(false);\n },\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n noOptionsMessage: ({ inputValue }) => getNoOptionsMessage(inputValue),\n onChange: (selectedOptions, actionMeta) => {\n if (props.onChange) {\n props.onChange(selectedOptions, actionMeta);\n }\n\n if (onUpdateCallback) {\n const updatedItem = actionMeta.option || actionMeta.removedValue;\n onUpdateCallback(actionMeta.action, updatedItem);\n }\n\n setSelected(selectedOptions);\n\n if (actionMeta.action === 'create-option' && loadOptions) {\n setCacheUnique(cacheUnique + 1);\n }\n }\n };\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper ref={wrapperRef} onClick={handleWrapperClick}>\n {label && <S.Label htmlFor={uniqueId}>{label}</S.Label>}\n <S.InnerWrapper $error={error} $warning={warning}>\n {loadOptions ? (\n creatable ? (\n <S.AsyncCreatableMultiSelect {...sharedProps} />\n ) : (\n <S.AsyncMultiSelect {...sharedProps} />\n )\n ) : creatable ? (\n <S.CreatableMultiSelect {...sharedProps} />\n ) : (\n <S.MultiSelect {...sharedProps} />\n )}\n </S.InnerWrapper>\n {displayShowMore && !(error || warning) && (\n <S.ShowMoreWrapper\n onClick={e => {\n e.stopPropagation();\n setDisplayShowMore(false);\n }}\n >\n <S.ShowMoreOverlay />\n <S.ShowMoreText>\n {showMoreText} {displayTotalOnShowMore && `(${selected.length})`}\n </S.ShowMoreText>\n </S.ShowMoreWrapper>\n )}\n {(typeof error === 'string' || typeof warning === 'string') && (\n <S.ErrorMessage $error={error} $warning={warning}>\n {error ? error : warning}\n </S.ErrorMessage>\n )}\n </S.MultiSelectWrapper>\n );\n});\n\nMultiSelect.propTypes = {\n /**\n *\n * The label of the input field — leave `undefined` to hide the label\n */\n label: PropTypes.string,\n /**\n * `Array` of `objects` containing the default options. This is only needed\n * when asynchronous option fetching with the `loadOptions` prop is not used.\n *\n * **Note:**\n * <br />This will be overridden by the `loadOptions` prop if both props are set.\n */\n availableOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * `Array` of `objects` containing the selected options.\n */\n selectedOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n loadOptions: PropTypes.func,\n\n /**\n * Function for custom \"Loading...\" message while waiting for the first page\n * from `loadOptions` to resolve. Defaults to \"Loading...\" if no function is provided.\n */\n loadingMessageFunc: PropTypes.func,\n\n /**\n * Callback function for sending updates to the backend whenever the selected values are updated.\n * See [Update handling](#update-handling) for details.\n */\n onUpdateCallback: PropTypes.func,\n\n /**\n * Text to be displayed on the input element when the component\n * is enabled and not focused — e.g. \"Add a keyword...\"\n */\n editText: PropTypes.string.isRequired,\n\n /**\n * Whether the user can create new options.\n */\n creatable: PropTypes.bool,\n\n /**\n * Callback function for formatting the message displayed in the dropdown when there\n * are no matching options, and the user has permission to create new options.\n * The callback function will be given the current input value as an argument.\n */\n createNewOptionMessageFunc: PropTypes.func,\n\n /**\n * If the list of options is empty, or if the current input value doesn't match\n * any of the available options and the user doesn't have permission to add options,\n * this function will be called and passed the current input value as an argument.\n */\n noOptionsMessageFunc: PropTypes.func,\n\n /**\n * Optional callback function to be trigger when clicking a selected option's label — e.g. opening\n * a search filtered on the given multi-value's `label`.\n *\n * The callback function will be passed the option `object` as an argument.\n */\n onMultiValueClick: PropTypes.func,\n\n /**\n * Display an overlay which the user needs to click in order to\n * show the selected options list in its entirety and edit it.\n */\n showMore: PropTypes.bool,\n\n /**\n * Text displayed on the \"Show more\" overlay.\n */\n showMoreText: PropTypes.string,\n\n /**\n * Whether to display the total number of selected options after the show more text.\n */\n displayTotalOnShowMore: PropTypes.bool,\n\n /**\n * Whether the multi-select should be displayed in read-only mode.\n * The user can still click the selected options to trigger their on-click effect.\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n\n /**\n * Whether the multi-select should be disabled.\n * The user will not be able to trigger the on-click effect of the selected options.\n */\n disabled: PropTypes.bool,\n\n /**\n * Set to `true` to display a red border indicating an error.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n\n /**\n * Set to `true` to display an orange border.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n\n /**\n * Optional onChange handler that receives the selected options and action metadata.\n */\n onChange: PropTypes.func\n};\n\nMultiSelect.defaultProps = {\n noOptionsMessageFunc: inputValue => {\n if (inputValue) {\n return `No matches for \"${inputValue}\"`;\n } else {\n return 'No available options';\n }\n },\n showMore: false,\n displayTotalOnShowMore: true,\n readOnly: false,\n disabled: false,\n creatable: false,\n error: false,\n warning: false,\n showMoreText: 'Show more',\n hidden: false\n};\n\nexport default MultiSelect;\n"],"names":["reactSelectTheme","theme","spacing","baseUnit","controlHeight","menuGutter","MultiSelect","React","forwardRef","label","selectedOptions","availableOptions","loadOptions","loadingMessageFunc","onUpdateCallback","editText","creatable","readOnly","hidden","disabled","error","warning","onMultiValueClick","showMore","showMoreText","displayTotalOnShowMore","noOptionsMessageFunc","props","forwardedRef","uniqueId","useState","nanoid","selected","setSelected","focused","setFocused","displayShowMore","setDisplayShowMore","cacheUnique","setCacheUnique","isMenuOpen","setIsMenuOpen","wrapperRef","useRef","selectRef","useEffect","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","handleWrapperClick","isRemoveButton","closest","SVGElement","focus","getNoOptionsMessage","inputValue","innerComponents","DropdownIndicator","MultiValue","data","createElement","className","onMouseDown","e","role","stopPropagation","S","_extends","$isDisabled","$isReadOnly","MultiValueRemove","components","CloseIcon","Input","inputProps","$focused","$editText","$isMenuOpen","Menu","menuProps","Option","optProps","isSelected","selectStyles","useMemo","control","base","alignItems","background","border","boxShadow","minHeight","cursor","valueContainer","padding","gap","maxHeight","input","menu","backgroundColor","menuList","option","color","multiValue","margin","multiValueLabel","multiValueRemove","sharedProps","ref","node","classNamePrefix","value","options","undefined","loadingMessage","styles","isMulti","isClearable","placeholder","isDisabled","closeMenuOnSelect","hideSelectedOptions","openMenuOnClick","openMenuOnFocus","blurInputOnSelect","menuIsOpen","cacheUniqs","onMenuOpen","onMenuClose","onFocus","onBlur","noOptionsMessage","onChange","actionMeta","updatedItem","removedValue","action","onClick","htmlFor","$error","$warning","length","propTypes","process","env","NODE_ENV","PropTypes","string","arrayOf","object","func","isRequired","bool","createNewOptionMessageFunc","oneOfType","defaultProps"],"mappings":";;;;;;;;AAkKA,MAAMA,gBAAgB,GAAGC,KAAK,KAAK;AACjC,EAAA,GAAGA,KAAK;AACRC,EAAAA,OAAO,EAAE;AACPC,IAAAA,QAAQ,EAAE,CAAC;AACXC,IAAAA,aAAa,EAAE,EAAE;AACjBC,IAAAA,UAAU,EAAE,CAAA;AACd,GAAA;AACF,CAAC,CAAC,CAAA;AAEIC,MAAAA,WAAW,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,WAAWA,CACvD;EACEG,KAAK;AACLC,EAAAA,eAAe,GAAG,EAAE;EACpBC,gBAAgB;EAChBC,WAAW;EACXC,kBAAkB;EAClBC,gBAAgB;EAChBC,QAAQ;EACRC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,OAAO;EACPC,iBAAiB;EACjBC,QAAQ;AACRC,EAAAA,YAAY,GAAG,WAAW;AAC1BC,EAAAA,sBAAsB,GAAG,IAAI;EAC7BC,oBAAoB;EACpB,GAAGC,KAAAA;AACL,CAAC,EACDC,YAAY,EACZ;EACA,MAAM,CAACC,QAAQ,CAAC,GAAGC,QAAQ,CAACC,MAAM,EAAE,CAAC,CAAA;EACrC,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGH,QAAQ,CAACpB,eAAe,CAAC,CAAA;EACzD,MAAM,CAACwB,OAAO,EAAEC,UAAU,CAAC,GAAGL,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC7C,EAAA,MAAM,CAACM,eAAe,EAAEC,kBAAkB,CAAC,GAAGP,QAAQ,CAACV,KAAK,IAAIC,OAAO,GAAG,KAAK,GAAGE,QAAQ,CAAC,CAAA;EAC3F,MAAM,CAACe,WAAW,EAAEC,cAAc,CAAC,GAAGT,QAAQ,CAAC,CAAC,CAAC,CAAA;EACjD,MAAM,CAACU,UAAU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AS,CAACC,MAAM,CAAC,CAAC;AAS9DnI,EAAAA,OAAO,EAAEkI,SAAS,CAACQ,SAAS,CAAC,CAACR,SAAS,CAACM,IAAI,EAAEN,SAAS,CAACC,MAAM,CAAC,CAAC;EAKhEf,QAAQ,EAAEc,SAAS,CAACI,IAAAA;AACtB,CAAC,GAAA,EAAA,CAAA;AAEDrJ,WAAW,CAAC0J,YAAY,GAAG;EACzBtI,oBAAoB,EAAEkC,UAAU,IAAI;AAClC,IAAA,IAAIA,UAAU,EAAE;MACd,OAAO,CAAA,gBAAA,EAAmBA,UAAU,CAAG,CAAA,CAAA,CAAA;AACzC,KAAC,MAAM;AACL,MAAA,OAAO,sBAAsB,CAAA;AAC/B,KAAA;GACD;AACDrC,EAAAA,QAAQ,EAAE,KAAK;AACfE,EAAAA,sBAAsB,EAAE,IAAI;AAC5BR,EAAAA,QAAQ,EAAE,KAAK;AACfE,EAAAA,QAAQ,EAAE,KAAK;AACfH,EAAAA,SAAS,EAAE,KAAK;AAChBI,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,OAAO,EAAE,KAAK;AACdG,EAAAA,YAAY,EAAE,WAAW;AACzBN,EAAAA,MAAM,EAAE,KAAA;AACV,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.js"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\nimport { useTheme } from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { nanoid } from 'nanoid';\nimport { components } from 'react-select';\nimport * as S from './MultiSelect.styled';\n\n/**\n * Multi-select with autocomplete and support for asynchronous fetching/filtering of\n * available options with pagination, update handling with callback,\n * and the ability for the end-user to create new options.\n *\n * The component uses [react-select](https://react-select.com/) for the main select functionality,\n * with [react-select-async-paginate](https://www.npmjs.com/package/react-select-async-paginate) for pagination.\n *\n *\n * <br />### Import\n *\n * ``` js\n * import { MultiSelect } from '@ntbjs/react-components/inputs'\n * // or\n * import MultiSelect from '@ntbjs/react-components/inputs/MultiSelect'\n * ```\n *\n * <br />## Option `object` format\n * Options are represented by an `Array` of `objects` with the following format:\n *\n * ``` js\n * {\n * value: \"Example\",\n * label: \"Example\"\n * }\n * ```\n *\n * The `label` is what will visible to the end-user. Whether `value` and `label`\n * should be different will depend on your use-case, but they are not required to.\n *\n *\n * <br />## Update handling\n * Changes from the end-user to the selected/available options can be handled with a callback function\n * passed through the `onUpdateCallback` prop, which is triggered any time the selected values change.\n *\n * The callback function will be passed two arguments:\n * * `action: string`\n * * `updatedOption: object`\n *\n * <br />#### `action`\n * A `string` indicating what kind of update was made.\n *\n * The possible values of `action` are:\n * * `create-option`: an option that didn't exist in the original list of available options were added\n * * `select-option`: an option was selected\n * * `deselect-option`: an option was de-selected by clicking the X in the dropdown menu\n * * `remove-value`: an option was de-selected by clicking the X on the option label/box\n * * `pop-value`: an option was de-selected with backspace\n * * `clear`: all options were de-selected by clicking the clear indicator (not currently in use)\n *\n * <br />#### `updatedOption`\n * Option `object`of the updated option:\n *\n * In addition to the default `value` and `label` keys, an `__isNew__` flag will be present if the option was\n * not part of the original list of available options, i.e. created by the user in the current \"session\".\n * This is the case regardless of whether the list is provided through `availableOptions` or\n * asynchronously through `loadOptions`.\n *\n *\n * <br />## Asynchronous fetching/filtering with pagination\n * The list of available options can be fetched and filtered asynchronously with a `Promise`\n * passed through the `loadOptions` prop.\n *\n * It will be passed two arguments:\n *\n * * `inputValue: string`: current input value/search\n * * `prevOptions: Array`: previously loaded options for the current search\n *\n * The function is triggered and the first page is fetched when the dropdown menu opens.\n * Whenever the user scrolls down to the bottom of the list, `loadOptions` will\n * be triggered again to fetch the next page.\n *\n * The `Promise` should return an `object` with the following keys:\n *\n * ``` js\n * {\n * options: Array,\n * hasMore: boolean\n * }\n * ```\n *\n * `options` should contain the current page of options. It will be concatenated to the previous\n * set of options automatically. The `hasMore` flag indicates whether there is another page to be fetched.\n *\n * **Example:**\n *\n * ``` js\n *\n * const availableOptions = [\n * { value: \"Example 1\", label: \"Example 1\" },\n * ...\n * { value: \"Example N\", label: \"Example N\" }\n * ];\n *\n * const filterOptions = inputValue => {\n * return availableOptions.filter(option => {\n * return option.label.toLowerCase().includes(inputValue.toLowerCase());\n * });\n * };\n *\n * const loadOptionsFunc = (inputValue, prevOptions) => {\n * const currentLength = prevOptions.length;\n * const pageLength = 10;\n *\n * let filteredOptions;\n *\n * if (inputValue) {\n * filteredOptions = filterOptions(inputValue);\n * } else {\n * filteredOptions = availableOptions;\n * }\n *\n * const hasMore = filteredOptions.length > currentLength + pageLength;\n * const slicedOptions = filteredOptions.slice(currentLength, currentLength + pageLength);\n *\n * return {\n * options: slicedOptions,\n * hasMore\n * };\n * };\n *\n * const loadOptions = (inputValue, prevOptions) => {\n * return new Promise(resolve => {\n * resolve(loadOptionsFunc(inputValue, prevOptions));\n * });\n * };\n * ```\n *\n * While waiting for the `Promise` to resolve, the component will be in a loading state.\n * The loading state is showcased in the \"Primary With Fetching Timeout\" Story.\n *\n * <br />#### Without asynchronous fetching/filtering\n * If you wish to not use asynchronous fetching/filtering, leave the `loadOptions` prop undefined\n * and pass the `Array` of all available options to the `availableOptions` prop instead.\n * The component will use the built-in filtering on `label` from `react-select`, and the options\n * will not be paginated.\n *\n *\n * <br />## \"Show more\" overlay\n * The \"Show more\" overlay must be set manually with the `showMore` prop.\n *\n * By default, the total number\n * of selected options will be displayed in parenthesis after the \"Show more\" text. This can be\n * disabled with the `displayTotalOnShowMore` prop.\n *\n * **Note:**\n * <br />The component has been given a max-width in these Stories.\n * This is because the \"Show more\" overlay does not work well visually when there are\n * fewer than three rows of selected options. The component itself does not have\n * a max-width, so keep this in mind when using it.\n *\n * <br />\n */\n\nconst showMoreHeight = 114;\n\nconst MultiSelect = React.forwardRef((props, forwardedRef) => {\n const theme = useTheme();\n const {\n label,\n selectedOptions = [],\n availableOptions,\n loadOptions,\n onUpdateCallback,\n editText,\n creatable,\n readOnly,\n disabled,\n error,\n warning,\n onMultiValueClick,\n showMore,\n showMoreText = 'Show more',\n displayTotalOnShowMore = true,\n hidden,\n ...rest\n } = props;\n\n const [uniqueId] = useState(nanoid());\n const [selected, setSelected] = useState(selectedOptions);\n const [cacheUnique, setCacheUnique] = useState(0);\n const [displayShowMore, setDisplayShowMore] = useState(showMore && !error && !warning);\n const [focused, setFocused] = useState(false);\n\n // Track theme changes by checking the DOM\n const [isDarkMode, setIsDarkMode] = useState(() =>\n document.body.classList.contains('dark-theme')\n );\n\n useEffect(() => setSelected(selectedOptions), [selectedOptions]);\n\n useEffect(() => {\n const observer = new MutationObserver(() => {\n setIsDarkMode(document.body.classList.contains('dark-theme'));\n });\n\n observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['class']\n });\n\n return () => observer.disconnect();\n }, []);\n\n const selectStyles = useMemo(() => {\n const color = key => theme?.getColor?.(key) || '#888';\n\n const getThemeColor = (darkKey, lightKey) => {\n const prefersDark =\n !document.body.classList.contains('light-theme') &&\n !document.body.classList.contains('dark-theme') &&\n window.matchMedia('(prefers-color-scheme: dark)').matches;\n\n return isDarkMode || prefersDark ? color(darkKey) : color(lightKey);\n };\n\n const errorColor = color('red-500');\n const warningColor = color('orange-500');\n\n const menuBg = getThemeColor('gray-600', 'white');\n const textColor = getThemeColor('gray-100', 'gray-900');\n const placeholderColor = getThemeColor('gray-400', 'gray-500');\n const multiValueBg = getThemeColor('gray-600', 'gray-800');\n\n console.log('Theme in selectStyles:', {\n menuBg,\n textColor,\n placeholderColor,\n multiValueBg,\n isDarkMode\n });\n\n return {\n control: base => ({\n ...base,\n alignItems: 'center',\n background: 'transparent',\n border: error ? `1px solid ${errorColor}` : warning ? `1px solid ${warningColor}` : 'none',\n borderRadius: '3px',\n boxShadow: 'none',\n minHeight: '38px',\n cursor: disabled || readOnly ? 'default' : 'pointer',\n '&:hover': {\n border: error ? `1px solid ${errorColor}` : warning ? `1px solid ${warningColor}` : 'none'\n }\n }),\n valueContainer: base => ({\n ...base,\n alignItems: 'center',\n gap: '8px',\n padding: '0 8px',\n maxHeight: displayShowMore\n ? error || warning\n ? '100%'\n : `${showMoreHeight + 16}px`\n : '100%',\n overflow: 'hidden'\n }),\n multiValue: base => ({\n ...base,\n backgroundColor: multiValueBg,\n borderRadius: '3px',\n margin: '0',\n display: 'flex',\n alignItems: 'stretch',\n minHeight: '26px',\n overflow: 'hidden'\n }),\n multiValueLabel: base => ({\n ...base,\n color: color('white'),\n fontSize: '12px',\n padding: disabled || readOnly ? '0 8px' : '0 3px 0 8px',\n display: 'flex',\n alignItems: 'center'\n }),\n multiValueRemove: base => ({\n ...base,\n color: 'white',\n padding: '0 8px 0 5px',\n display: disabled || readOnly ? 'none' : 'flex',\n alignItems: 'center',\n alignSelf: 'stretch',\n borderRadius: '0',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: errorColor,\n color: 'white'\n }\n }),\n menu: base => ({\n ...base,\n backgroundColor: menuBg,\n boxShadow: '0 4px 12px rgba(0,0,0,0.5)',\n zIndex: 999,\n marginTop: '4px',\n border: `1px solid ${getThemeColor('gray-500', 'gray-300')}`\n }),\n menuList: base => ({\n ...base,\n backgroundColor: 'transparent',\n padding: 0\n }),\n option: (base, state) => ({\n ...base,\n backgroundColor: state.isFocused ? getThemeColor('gray-500', 'gray-100') : 'transparent',\n color: textColor,\n cursor: 'pointer',\n fontSize: '14px',\n padding: '8px 12px',\n ':active': {\n backgroundColor: getThemeColor('gray-400', 'gray-200')\n }\n }),\n input: (base, state) => ({\n ...base,\n display: 'inline-grid',\n whiteSpace: 'nowrap',\n color: textColor,\n margin: 0,\n padding: 0,\n ':before':\n !focused && editText && !state.value\n ? {\n content: `\"${editText}\"`,\n color: placeholderColor,\n marginRight: '8px',\n lineHeight: '26px',\n gridArea: '1 / 1'\n }\n : {}\n }),\n noOptionsMessage: base => ({ ...base, color: textColor, backgroundColor: 'transparent' }),\n loadingMessage: base => ({ ...base, color: textColor, backgroundColor: 'transparent' }),\n placeholder: () => ({ display: 'none' }),\n indicatorsContainer: () => ({ display: 'none' })\n };\n }, [theme, error, warning, displayShowMore, disabled, readOnly, editText, focused, isDarkMode]);\n\n const innerComponents = {\n Option: optProps => (\n <components.Option {...optProps}>\n <div\n style={{\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n alignItems: 'center'\n }}\n >\n <span>{optProps.label}</span>\n {optProps.isSelected && <S.DropdownOptionDeleteIcon />}\n </div>\n </components.Option>\n ),\n MultiValue: mvProps => (\n <S.MultiValueWrapper\n onMouseDown={e => {\n if (\n onMultiValueClick &&\n !readOnly &&\n !disabled &&\n !e.target.closest('.multi-select__multi-value__remove')\n ) {\n e.stopPropagation();\n onMultiValueClick(mvProps.data);\n }\n }}\n >\n <components.MultiValue {...mvProps} />\n </S.MultiValueWrapper>\n )\n };\n\n const sharedSelectProps = {\n ...rest,\n ref: forwardedRef,\n id: uniqueId,\n classNamePrefix: 'multi-select',\n styles: selectStyles,\n components: innerComponents,\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions,\n isMulti: true,\n isDisabled: disabled || readOnly,\n closeMenuOnSelect: false,\n hideSelectedOptions: false,\n openMenuOnClick: true,\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n onChange: (newValue, actionMeta) => {\n setSelected(newValue);\n if (onUpdateCallback) {\n const item = actionMeta.option || actionMeta.removedValue;\n onUpdateCallback(actionMeta.action, item);\n }\n if (actionMeta.action === 'create-option' && loadOptions) {\n setCacheUnique(c => c + 1);\n }\n },\n cacheUniqs: loadOptions ? [cacheUnique] : undefined\n };\n\n const SelectComponent = useMemo(() => {\n if (loadOptions) return creatable ? S.AsyncCreatableMultiSelect : S.AsyncMultiSelect;\n return creatable ? S.CreatableMultiSelect : S.MultiSelect;\n }, [loadOptions, creatable]);\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper>\n {label && <S.Label htmlFor={uniqueId}>{label}</S.Label>}\n <S.InnerWrapper>\n <SelectComponent {...sharedSelectProps} />\n </S.InnerWrapper>\n {displayShowMore && (\n <S.ShowMoreWrapper onClick={() => setDisplayShowMore(false)}>\n <S.ShowMoreOverlay />\n <S.ShowMoreText>\n {showMoreText} {displayTotalOnShowMore && `(${selected.length})`}\n </S.ShowMoreText>\n </S.ShowMoreWrapper>\n )}\n {(error || warning) && (\n <S.ErrorMessage $error={!!error} $warning={!!warning}>\n {error || warning}\n </S.ErrorMessage>\n )}\n </S.MultiSelectWrapper>\n );\n});\n\nMultiSelect.displayName = 'MultiSelect';\n\nMultiSelect.propTypes = {\n /**\n *\n * The label of the input field – leave `undefined` to hide the label\n */\n label: PropTypes.string,\n /**\n * `Array` of `objects` containing the default options. This is only needed\n * when asynchronous option fetching with the `loadOptions` prop is not used.\n *\n * **Note:**\n * <br />This will be overridden by the `loadOptions` prop if both props are set.\n */\n availableOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * `Array` of `objects` containing the selected options.\n */\n selectedOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n loadOptions: PropTypes.func,\n\n /**\n * Function for custom \"Loading...\" message while waiting for the first page\n * from `loadOptions` to resolve. Defaults to \"Loading...\" if no function is provided.\n */\n loadingMessageFunc: PropTypes.func,\n\n /**\n * Callback function for sending updates to the backend whenever the selected values are updated.\n * See [Update handling](#update-handling) for details.\n */\n onUpdateCallback: PropTypes.func,\n\n /**\n * Text to be displayed on the input element when the component\n * is enabled and not focused – e.g. \"Add a keyword...\"\n */\n editText: PropTypes.string.isRequired,\n\n /**\n * Whether the user can create new options.\n */\n creatable: PropTypes.bool,\n\n /**\n * Callback function for formatting the message displayed in the dropdown when there\n * are no matching options, and the user has permission to create new options.\n * The callback function will be given the current input value as an argument.\n */\n createNewOptionMessageFunc: PropTypes.func,\n\n /**\n * If the list of options is empty, or if the current input value doesn't match\n * any of the available options and the user doesn't have permission to add options,\n * this function will be called and passed the current input value as an argument.\n */\n noOptionsMessageFunc: PropTypes.func,\n\n /**\n * Optional callback function to be trigger when clicking a selected option's label – e.g. opening\n * a search filtered on the given multi-value's `label`.\n *\n * The callback function will be passed the option `object` as an argument.\n */\n onMultiValueClick: PropTypes.func,\n\n /**\n * Display an overlay which the user needs to click in order to\n * show the selected options list in its entirety and edit it.\n */\n showMore: PropTypes.bool,\n\n /**\n * Text displayed on the \"Show more\" overlay.\n */\n showMoreText: PropTypes.string,\n\n /**\n * Whether to display the total number of selected options after the show more text.\n */\n displayTotalOnShowMore: PropTypes.bool,\n\n /**\n * Whether the multi-select should be displayed in read-only mode.\n * The user can still click the selected options to trigger their on-click effect.\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n\n /**\n * Whether the multi-select should be disabled.\n * The user will not be able to trigger the on-click effect of the selected options.\n */\n disabled: PropTypes.bool,\n\n /**\n * Set to `true` to display a red border indicating an error.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n\n /**\n * Set to `true` to display an orange border.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])\n};\n\nMultiSelect.defaultProps = {\n noOptionsMessageFunc: inputValue => {\n if (inputValue) {\n return `No matches for \"${inputValue}\"`;\n } else {\n return 'No available options';\n }\n },\n showMore: false,\n displayTotalOnShowMore: true,\n readOnly: false,\n disabled: false,\n creatable: false,\n error: false,\n warning: false,\n showMoreText: 'Show more',\n hidden: false\n};\n\nexport default MultiSelect;\n"],"names":["showMoreHeight","MultiSelect","React","forwardRef","props","forwardedRef","theme","useTheme","label","selectedOptions","availableOptions","loadOptions","onUpdateCallback","editText","creatable","readOnly","disabled","error","warning","onMultiValueClick","showMore","showMoreText","displayTotalOnShowMore","hidden","rest","uniqueId","useState","nanoid","selected","setSelected","cacheUnique","setCacheUnique","displayShowMore","setDisplayShowMore","focused","setFocused","isDarkMode","setIsDarkMode","document","body","classList","contains","useEffect","observer","MutationObserver","observe","attributes","attributeFilter","disconnect","selectStyles","useMemo","color","key","getColor","getThemeColor","darkKey","lightKey","prefersDark","window","matchMedia","matches","errorColor","warningColor","menuBg","textColor","placeholderColor","multiValueBg","console","log","control","base","alignItems","background","border","borderRadius","boxShadow","minHeight","cursor","valueContainer","gap","padding","maxHeight","overflow","multiValue","backgroundColor","margin","display","multiValueLabel","fontSize","multiValueRemove","alignSelf","menu","zIndex","marginTop","menuList","option","state","isFocused","input","whiteSpace","value","content","marginRight","lineHeight","gridArea","noOptionsMessage","loadingMessage","placeholder","indicatorsContainer","innerComponents","Option","optProps","createElement","components","style","justifyContent","width","isSelected","S","MultiValue","mvProps","onMouseDown","e","target","closest","stopPropagation","data","sharedSelectProps","ref","id","classNamePrefix","styles","options","undefined","isMulti","isDisabled","closeMenuOnSelect","hideSelectedOptions","openMenuOnClick","onFocus","onBlur","onChange","newValue","actionMeta","item","removedValue","action","c","cacheUniqs","SelectComponent","htmlFor","onClick","length","$error","$warning","displayName","propTypes","process","env","NODE_ENV","PropTypes","string","arrayOf","object","func","loadingMessageFunc","isRequired","bool","createNewOptionMessageFunc","noOptionsMessageFunc","oneOfType","defaultProps","inputValue"],"mappings":";;;;;;;AAkKA,MAAMA,cAAc,GAAG,GAAG,CAAA;AAEpBC,MAAAA,WAAW,GAAGC,cAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,YAAY,KAAK;AAC5D,EAAA,MAAMC,KAAK,GAAGC,QAAQ,EAAE,CAAA;EACxB,MAAM;IACJC,KAAK;AACLC,IAAAA,eAAe,GAAG,EAAE;IACpBC,gBAAgB;IAChBC,WAAW;IACXC,gBAAgB;IAChBC,QAAQ;IACR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