@ntbjs/react-components 2.0.2-rc.3 → 2.0.2-rc.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.
Files changed (27) hide show
  1. package/build/inputs/ActionButton/ActionButton.js +5 -9
  2. package/build/inputs/ActionButton/ActionButton.js.map +1 -1
  3. package/build/inputs/ActionButton/ActionButton.styled.js +13 -16
  4. package/build/inputs/ActionButton/ActionButton.styled.js.map +1 -1
  5. package/build/inputs/CompactTextInput/CompactTextInput.js +71 -58
  6. package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
  7. package/build/inputs/CompactTextInput/CompactTextInput.styled.js +208 -133
  8. package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
  9. package/build/inputs/MultiSelect/MultiSelect.js +94 -202
  10. package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
  11. package/build/inputs/MultiSelect/MultiSelect.styled.js +162 -68
  12. package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
  13. package/build/inputs/TextArea/TextArea.js +77 -67
  14. package/build/inputs/TextArea/TextArea.js.map +1 -1
  15. package/build/inputs/TextArea/TextArea.styled.js +204 -171
  16. package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
  17. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +26 -20
  18. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
  19. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +15 -19
  20. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
  21. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js +16 -18
  22. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js.map +1 -1
  23. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js +34 -75
  24. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js.map +1 -1
  25. package/build/widgets/Instructions/Instructions.js +9 -0
  26. package/build/widgets/Instructions/Instructions.js.map +1 -1
  27. package/package.json +3 -3
@@ -3,272 +3,164 @@ import React__default, { useState, useEffect, useMemo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { nanoid } from 'nanoid';
5
5
  import { components } from 'react-select';
6
- import { useTheme } from 'styled-components';
7
- import { MultiSelectWrapper, AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, MultiSelect as MultiSelect$1, ShowMoreWrapper, ShowMoreOverlay, ShowMoreText, ErrorMessage, Control as Control$1, Label, ValueContainer as ValueContainer$1, MultiValueWrapper, MultiValueRemoveIcon, InputWrapper, OptionContent, DropdownOptionDeleteIcon } from './MultiSelect.styled.js';
6
+ import { MultiSelectWrapper, Label, InnerWrapper, AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, MultiSelect as MultiSelect$1, ShowMoreWrapper, ShowMoreOverlay, ShowMoreText, ErrorMessage, MultiValue, InputWrapper, DropdownMenu, SelectedOption, DropdownOptionDeleteIcon, Option } from './MultiSelect.styled.js';
7
+ import { ReactComponent as SvgClose } from '../../icons/close.svg.js';
8
8
 
9
- const Control = props => {
10
- return React__default.createElement(Control$1, {
11
- $readOnly: props.selectProps.readOnly
12
- }, React__default.createElement(components.Control, props));
13
- };
14
- Control.propTypes = process.env.NODE_ENV !== "production" ? {
15
- selectProps: PropTypes.shape({
16
- readOnly: PropTypes.bool
17
- }).isRequired
18
- } : {};
19
- const ValueContainer = props => {
20
- const {
21
- children,
22
- selectProps
23
- } = props;
24
- return React__default.createElement(components.ValueContainer, props, selectProps.label && React__default.createElement(Label, {
25
- htmlFor: selectProps.uniqueId
26
- }, selectProps.label), React__default.createElement(ValueContainer$1, {
27
- $showMore: selectProps.displayShowMore,
28
- $error: selectProps.error,
29
- $warning: selectProps.warning
30
- }, children));
31
- };
32
- ValueContainer.propTypes = process.env.NODE_ENV !== "production" ? {
33
- children: PropTypes.node,
34
- selectProps: PropTypes.shape({
35
- label: PropTypes.string,
36
- uniqueId: PropTypes.string,
37
- displayShowMore: PropTypes.bool,
38
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
39
- warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
40
- }).isRequired
41
- } : {};
42
- const MultiValue = props => {
43
- const {
44
- selectProps,
45
- data
46
- } = props;
47
- const handleMouseDown = e => {
48
- const isRemoveClick = e.target.closest('[role="button"]') || e.target.closest('svg');
49
- if (isRemoveClick) {
50
- return;
51
- }
52
- if (selectProps.onMultiValueClick && data) {
53
- e.stopPropagation();
54
- selectProps.onMultiValueClick(data);
55
- }
56
- };
57
- return React__default.createElement(MultiValueWrapper, {
58
- onMouseDown: handleMouseDown
59
- }, React__default.createElement(components.MultiValue, props));
60
- };
61
- MultiValue.propTypes = process.env.NODE_ENV !== "production" ? {
62
- data: PropTypes.object.isRequired,
63
- selectProps: PropTypes.shape({
64
- onMultiValueClick: PropTypes.func
65
- }).isRequired
66
- } : {};
67
- const MultiValueRemove = props => {
68
- if (props.selectProps.readOnly || props.selectProps.disabled) return null;
69
- return React__default.createElement(components.MultiValueRemove, props, React__default.createElement(MultiValueRemoveIcon, null));
70
- };
71
- MultiValueRemove.propTypes = process.env.NODE_ENV !== "production" ? {
72
- selectProps: PropTypes.shape({
73
- readOnly: PropTypes.bool,
74
- disabled: PropTypes.bool
75
- }).isRequired
76
- } : {};
77
- const Input = props => React__default.createElement(InputWrapper, {
78
- $focused: props.selectProps.focused,
79
- $editText: props.selectProps.editText
80
- }, React__default.createElement(components.Input, _extends({}, props, {
81
- isDisabled: props.selectProps.readOnly || props.selectProps.disabled
82
- })));
83
- Input.propTypes = process.env.NODE_ENV !== "production" ? {
84
- selectProps: PropTypes.shape({
85
- focused: PropTypes.bool,
86
- editText: PropTypes.string,
87
- readOnly: PropTypes.bool,
88
- disabled: PropTypes.bool
89
- }).isRequired
90
- } : {};
91
- const Option = props => {
92
- const {
93
- isSelected,
94
- label,
95
- isFocused
96
- } = props;
97
- return React__default.createElement(components.Option, props, React__default.createElement(OptionContent, {
98
- $isFocused: isFocused
99
- }, label, isSelected && React__default.createElement(DropdownOptionDeleteIcon, null)));
100
- };
101
- Option.propTypes = process.env.NODE_ENV !== "production" ? {
102
- isSelected: PropTypes.bool,
103
- label: PropTypes.string,
104
- isFocused: PropTypes.bool
105
- } : {};
106
9
  const MultiSelect = React__default.forwardRef(function MultiSelect({
107
10
  label,
108
- selectedOptions,
11
+ selectedOptions = [],
109
12
  availableOptions,
110
13
  loadOptions,
111
14
  loadingMessageFunc,
112
15
  onUpdateCallback,
113
16
  editText,
114
- createNewOptionMessageFunc,
115
- onMultiValueClick,
116
- showMore,
117
- showMoreText,
118
- displayTotalOnShowMore,
119
17
  creatable,
120
18
  readOnly,
121
19
  hidden,
122
20
  disabled,
123
21
  error,
124
22
  warning,
125
- noOptionsMessageFunc = val => val ? `No matches for "${val}"` : 'No options',
23
+ onMultiValueClick,
24
+ showMore,
25
+ showMoreText = 'Show more',
26
+ displayTotalOnShowMore = true,
27
+ noOptionsMessageFunc,
126
28
  ...props
127
29
  }, forwardedRef) {
128
30
  const [uniqueId] = useState(nanoid());
129
- const [selected, setSelected] = useState(selectedOptions || []);
31
+ const [selected, setSelected] = useState(selectedOptions);
130
32
  const [focused, setFocused] = useState(false);
131
33
  const [displayShowMore, setDisplayShowMore] = useState(error || warning ? false : showMore);
132
- const [cacheUnique, setCacheUnique] = useState(0);
133
- const theme = useTheme();
134
34
  useEffect(() => {
135
- setSelected(selectedOptions || []);
35
+ setSelected(selectedOptions);
136
36
  }, [selectedOptions]);
137
- const isDark = theme?.isDark || document.body.classList.contains('dark-theme');
138
- const getC = key => theme.getColor(key);
139
- const getP = (dark, light) => {
140
- const themeFn = theme.themeProp(dark, light);
141
- return typeof themeFn === 'function' ? themeFn({
142
- theme
143
- }) : themeFn;
37
+ const getNoOptionsMessage = inputValue => {
38
+ if (typeof noOptionsMessageFunc === 'function') {
39
+ return noOptionsMessageFunc(inputValue);
40
+ }
41
+ return inputValue ? `No matches for "${inputValue}"` : 'No available options';
42
+ };
43
+ const innerComponents = {
44
+ DropdownIndicator: null,
45
+ MultiValue: ({
46
+ data,
47
+ ...props
48
+ }) => {
49
+ return React__default.createElement("div", {
50
+ className: "multi-value-wrapper",
51
+ onMouseDown: e => {
52
+ e.stopPropagation();
53
+ if (onMultiValueClick && data && !(e.target.role === 'button' || e.target instanceof SVGElement)) {
54
+ onMultiValueClick(data);
55
+ }
56
+ }
57
+ }, React__default.createElement(MultiValue, _extends({
58
+ data: data,
59
+ isDisabled: disabled,
60
+ isReadOnly: readOnly
61
+ }, props)));
62
+ },
63
+ MultiValueRemove: props => {
64
+ if (readOnly || disabled) return null;
65
+ return React__default.createElement(components.MultiValueRemove, props, React__default.createElement(SvgClose, null));
66
+ },
67
+ Input: inputProps => React__default.createElement(InputWrapper, {
68
+ $focused: focused,
69
+ $editText: !readOnly && !disabled ? editText : '',
70
+ isDisabled: readOnly || disabled
71
+ }, React__default.createElement(components.Input, inputProps)),
72
+ Menu: menuProps => React__default.createElement(DropdownMenu, menuProps),
73
+ Option: optProps => optProps.isSelected ? React__default.createElement(SelectedOption, optProps, React__default.createElement("span", null, optProps.label), React__default.createElement(DropdownOptionDeleteIcon, null)) : React__default.createElement(Option, optProps)
144
74
  };
145
75
  const selectStyles = useMemo(() => ({
146
76
  control: base => ({
147
77
  ...base,
78
+ alignItems: 'flex-start',
79
+ background: 'transparent',
148
80
  border: 'none',
149
81
  boxShadow: 'none',
150
- background: 'transparent',
151
82
  minHeight: 'unset'
152
83
  }),
153
84
  valueContainer: base => ({
154
85
  ...base,
155
86
  padding: 0,
156
- overflow: 'visible'
87
+ gap: '8px',
88
+ maxHeight: displayShowMore && !(error || warning) ? '130px' : '100%'
157
89
  }),
158
- multiValue: base => ({
159
- ...base,
160
- margin: 0,
161
- borderRadius: '3px',
162
- backgroundColor: isDark ? getC('gray-600') : getC('gray-800')
163
- }),
164
- multiValueLabel: (base, {
165
- selectProps
166
- }) => ({
90
+ menu: base => ({
167
91
  ...base,
168
- color: getC('gray-100'),
169
- fontSize: '12px',
170
- paddingLeft: '8px',
171
- paddingTop: '8px',
172
- paddingBottom: '8px',
173
- paddingRight: selectProps.readOnly ? '8px' : '4px'
92
+ backgroundColor: 'transparent',
93
+ boxShadow: 'none'
174
94
  }),
175
- multiValueRemove: base => ({
95
+ menuList: base => ({
176
96
  ...base,
177
- color: 'white',
178
- padding: '0 8px',
179
- cursor: 'pointer',
180
- '&:hover': {
181
- backgroundColor: getC('red-500'),
182
- color: 'white',
183
- borderRadius: '0 3px 3px 0'
184
- }
97
+ backgroundColor: 'transparent'
185
98
  }),
186
- option: (base, state) => ({
99
+ option: base => ({
187
100
  ...base,
188
- padding: 0,
189
- cursor: 'pointer',
190
- backgroundColor: state.isFocused ? getC('gray-100') : 'transparent',
191
- '&:active': {
192
- backgroundColor: getC('gray-100')
193
- }
101
+ backgroundColor: 'transparent',
102
+ color: 'inherit'
194
103
  }),
195
- menu: base => ({
104
+ multiValue: base => ({
196
105
  ...base,
197
- zIndex: 9999,
198
- backgroundColor: getP(getC('gray-600'), getC('white')),
199
- marginTop: '4px'
106
+ margin: 0,
107
+ border: 'none',
108
+ background: 'none'
200
109
  }),
201
- input: base => ({
110
+ multiValueLabel: base => ({
202
111
  ...base,
203
- margin: 0,
204
112
  padding: 0
205
113
  }),
206
- placeholder: base => ({
114
+ multiValueRemove: base => ({
207
115
  ...base,
208
- display: 'none'
116
+ padding: 0,
117
+ cursor: 'pointer'
209
118
  })
210
- }), [theme, isDark]);
211
- const sharedSelectProps = {
119
+ }), [error, warning, displayShowMore]);
120
+ const sharedProps = {
121
+ ...props,
212
122
  ref: forwardedRef,
123
+ classNamePrefix: 'multi-select',
213
124
  value: selected,
214
125
  options: loadOptions ? undefined : availableOptions,
215
126
  loadOptions,
127
+ loadingMessage: loadingMessageFunc,
128
+ styles: selectStyles,
129
+ components: innerComponents,
216
130
  isMulti: true,
217
131
  isClearable: false,
218
132
  placeholder: null,
219
- label,
220
- uniqueId,
221
- displayShowMore,
222
- error,
223
- warning,
224
- readOnly,
225
- disabled,
226
- focused,
227
- editText,
228
- onMultiValueClick,
229
- key: cacheUnique,
230
- loadingMessage: loadingMessageFunc,
231
- formatCreateLabel: createNewOptionMessageFunc,
232
- components: {
233
- DropdownIndicator: null,
234
- Control,
235
- MultiValue,
236
- MultiValueRemove,
237
- ValueContainer,
238
- Input,
239
- Option
240
- },
241
- styles: selectStyles,
242
- theme: rsTheme => ({
243
- ...rsTheme,
244
- spacing: {
245
- ...rsTheme.spacing,
246
- baseUnit: 4
247
- }
248
- }),
249
- noOptionsMessage: input => noOptionsMessageFunc(input.inputValue),
133
+ isDisabled: disabled,
134
+ readOnly: readOnly,
135
+ closeMenuOnSelect: false,
136
+ hideSelectedOptions: false,
137
+ openMenuOnClick: !disabled && !readOnly,
138
+ openMenuOnFocus: !disabled && !readOnly,
250
139
  onFocus: () => setFocused(true),
251
140
  onBlur: () => setFocused(false),
141
+ noOptionsMessage: ({
142
+ inputValue
143
+ }) => getNoOptionsMessage(inputValue),
252
144
  onChange: (newValue, actionMeta) => {
253
- if (actionMeta.action === 'create-option' && loadOptions) {
254
- setCacheUnique(c => c + 1);
255
- }
256
- const nextValue = newValue || [];
257
- setSelected(nextValue);
258
145
  if (onUpdateCallback) {
259
146
  onUpdateCallback(actionMeta.action, actionMeta.option || actionMeta.removedValue);
260
147
  }
148
+ setSelected(newValue);
261
149
  }
262
150
  };
263
151
  if (hidden) return null;
264
- return React__default.createElement(MultiSelectWrapper, null, loadOptions ? creatable ? React__default.createElement(AsyncCreatableMultiSelect, _extends({}, sharedSelectProps, props)) : React__default.createElement(AsyncMultiSelect, _extends({}, sharedSelectProps, props)) : creatable ? React__default.createElement(CreatableMultiSelect, _extends({}, sharedSelectProps, props)) : React__default.createElement(MultiSelect$1, _extends({}, sharedSelectProps, props)), displayShowMore && !(error || warning) && React__default.createElement(ShowMoreWrapper, {
152
+ return React__default.createElement(MultiSelectWrapper, null, label && React__default.createElement(Label, {
153
+ htmlFor: uniqueId
154
+ }, label), React__default.createElement(InnerWrapper, {
155
+ $error: error,
156
+ $warning: warning
157
+ }, loadOptions ? creatable ? React__default.createElement(AsyncCreatableMultiSelect, sharedProps) : React__default.createElement(AsyncMultiSelect, sharedProps) : creatable ? React__default.createElement(CreatableMultiSelect, sharedProps) : React__default.createElement(MultiSelect$1, sharedProps)), displayShowMore && !(error || warning) && React__default.createElement(ShowMoreWrapper, {
265
158
  onClick: () => setDisplayShowMore(false)
266
- }, React__default.createElement(ShowMoreOverlay, null), React__default.createElement(ShowMoreText, null, showMoreText, " ", displayTotalOnShowMore && `(${selected?.length || 0})`)), (error || warning) && React__default.createElement(ErrorMessage, {
267
- $error: !!error,
268
- $warning: !!warning
269
- }, typeof error === 'string' ? error : warning));
159
+ }, React__default.createElement(ShowMoreOverlay, null), React__default.createElement(ShowMoreText, null, showMoreText, " ", displayTotalOnShowMore && `(${selected.length})`)), (typeof error === 'string' || typeof warning === 'string') && React__default.createElement(ErrorMessage, {
160
+ $error: error,
161
+ $warning: warning
162
+ }, error ? error : warning));
270
163
  });
271
- MultiSelect.displayName = 'MultiSelect';
272
164
  MultiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
273
165
  label: PropTypes.string,
274
166
  availableOptions: PropTypes.arrayOf(PropTypes.object),
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.js"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { nanoid } from 'nanoid';\nimport { components } from 'react-select';\nimport { useTheme } from 'styled-components';\nimport * as S from './MultiSelect.styled';\n\n/**\n * HELPER COMPONENTS\n */\nconst Control = props => {\n return (\n <S.Control $readOnly={props.selectProps.readOnly}>\n <components.Control {...props} />\n </S.Control>\n );\n};\n\nControl.propTypes = {\n selectProps: PropTypes.shape({\n readOnly: PropTypes.bool\n }).isRequired\n};\n\nconst ValueContainer = props => {\n const { children, selectProps } = props;\n return (\n <components.ValueContainer {...props}>\n {selectProps.label && <S.Label htmlFor={selectProps.uniqueId}>{selectProps.label}</S.Label>}\n <S.ValueContainer\n $showMore={selectProps.displayShowMore}\n $error={selectProps.error}\n $warning={selectProps.warning}\n >\n {children}\n </S.ValueContainer>\n </components.ValueContainer>\n );\n};\n\nValueContainer.propTypes = {\n children: PropTypes.node,\n selectProps: PropTypes.shape({\n label: PropTypes.string,\n uniqueId: PropTypes.string,\n displayShowMore: PropTypes.bool,\n error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])\n }).isRequired\n};\n\nconst MultiValue = props => {\n const { selectProps, data } = props;\n\n const handleMouseDown = e => {\n const isRemoveClick = e.target.closest('[role=\"button\"]') || e.target.closest('svg');\n\n if (isRemoveClick) {\n return;\n }\n\n if (selectProps.onMultiValueClick && data) {\n e.stopPropagation();\n selectProps.onMultiValueClick(data);\n }\n };\n\n return (\n <S.MultiValueWrapper onMouseDown={handleMouseDown}>\n <components.MultiValue {...props} />\n </S.MultiValueWrapper>\n );\n};\n\nMultiValue.propTypes = {\n data: PropTypes.object.isRequired,\n selectProps: PropTypes.shape({\n onMultiValueClick: PropTypes.func\n }).isRequired\n};\n\nconst MultiValueRemove = props => {\n if (props.selectProps.readOnly || props.selectProps.disabled) return null;\n return (\n <components.MultiValueRemove {...props}>\n <S.MultiValueRemoveIcon />\n </components.MultiValueRemove>\n );\n};\n\nMultiValueRemove.propTypes = {\n selectProps: PropTypes.shape({\n readOnly: PropTypes.bool,\n disabled: PropTypes.bool\n }).isRequired\n};\n\nconst Input = props => (\n <S.InputWrapper $focused={props.selectProps.focused} $editText={props.selectProps.editText}>\n <components.Input\n {...props}\n isDisabled={props.selectProps.readOnly || props.selectProps.disabled}\n />\n </S.InputWrapper>\n);\n\nInput.propTypes = {\n selectProps: PropTypes.shape({\n focused: PropTypes.bool,\n editText: PropTypes.string,\n readOnly: PropTypes.bool,\n disabled: PropTypes.bool\n }).isRequired\n};\n\nconst Option = props => {\n const { isSelected, label, isFocused } = props;\n return (\n <components.Option {...props}>\n <S.OptionContent $isFocused={isFocused}>\n {label}\n {isSelected && <S.DropdownOptionDeleteIcon />}\n </S.OptionContent>\n </components.Option>\n );\n};\n\nOption.propTypes = {\n isSelected: PropTypes.bool,\n label: PropTypes.string,\n isFocused: PropTypes.bool\n};\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\nconst MultiSelect = React.forwardRef(function MultiSelect(\n {\n label,\n selectedOptions,\n availableOptions,\n loadOptions,\n loadingMessageFunc,\n onUpdateCallback,\n editText,\n createNewOptionMessageFunc,\n onMultiValueClick,\n showMore,\n showMoreText,\n displayTotalOnShowMore,\n creatable,\n readOnly,\n hidden,\n disabled,\n error,\n warning,\n noOptionsMessageFunc = val => (val ? `No matches for \"${val}\"` : 'No options'),\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\n const theme = useTheme();\n\n useEffect(() => {\n setSelected(selectedOptions || []);\n }, [selectedOptions]);\n\n const isDark = theme?.isDark || document.body.classList.contains('dark-theme');\n const getC = key => theme.getColor(key);\n const getP = (dark, light) => {\n const themeFn = theme.themeProp(dark, light);\n return typeof themeFn === 'function' ? themeFn({ theme }) : themeFn;\n };\n\n const selectStyles = useMemo(\n () => ({\n control: base => ({\n ...base,\n border: 'none',\n boxShadow: 'none',\n background: 'transparent',\n minHeight: 'unset'\n }),\n valueContainer: base => ({\n ...base,\n padding: 0,\n overflow: 'visible'\n }),\n multiValue: base => ({\n ...base,\n margin: 0,\n borderRadius: '3px',\n backgroundColor: isDark ? getC('gray-600') : getC('gray-800')\n }),\n multiValueLabel: (base, { selectProps }) => ({\n ...base,\n color: getC('gray-100'),\n fontSize: '12px',\n paddingLeft: '8px',\n paddingTop: '8px',\n paddingBottom: '8px',\n paddingRight: selectProps.readOnly ? '8px' : '4px'\n }),\n multiValueRemove: base => ({\n ...base,\n color: 'white',\n padding: '0 8px',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: getC('red-500'),\n color: 'white',\n borderRadius: '0 3px 3px 0'\n }\n }),\n option: (base, state) => ({\n ...base,\n padding: 0,\n cursor: 'pointer',\n backgroundColor: state.isFocused ? getC('gray-100') : 'transparent',\n '&:active': {\n backgroundColor: getC('gray-100')\n }\n }),\n menu: base => ({\n ...base,\n zIndex: 9999,\n backgroundColor: getP(getC('gray-600'), getC('white')),\n marginTop: '4px'\n }),\n input: base => ({ ...base, margin: 0, padding: 0 }),\n placeholder: base => ({ ...base, display: 'none' })\n }),\n [theme, isDark]\n );\n\n const sharedSelectProps = {\n ref: forwardedRef,\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions,\n isMulti: true,\n isClearable: false,\n placeholder: null,\n label,\n uniqueId,\n displayShowMore,\n error,\n warning,\n readOnly,\n disabled,\n focused,\n editText,\n onMultiValueClick,\n key: cacheUnique,\n loadingMessage: loadingMessageFunc,\n formatCreateLabel: createNewOptionMessageFunc,\n components: {\n DropdownIndicator: null,\n Control,\n MultiValue,\n MultiValueRemove,\n ValueContainer,\n Input,\n Option\n },\n styles: selectStyles,\n theme: rsTheme => ({ ...rsTheme, spacing: { ...rsTheme.spacing, baseUnit: 4 } }),\n noOptionsMessage: input => noOptionsMessageFunc(input.inputValue),\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n onChange: (newValue, actionMeta) => {\n if (actionMeta.action === 'create-option' && loadOptions) {\n setCacheUnique(c => c + 1);\n }\n\n const nextValue = newValue || [];\n setSelected(nextValue);\n\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.option || actionMeta.removedValue);\n }\n }\n };\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper>\n {loadOptions ? (\n creatable ? (\n <S.AsyncCreatableMultiSelect {...sharedSelectProps} {...props} />\n ) : (\n <S.AsyncMultiSelect {...sharedSelectProps} {...props} />\n )\n ) : creatable ? (\n <S.CreatableMultiSelect {...sharedSelectProps} {...props} />\n ) : (\n <S.MultiSelect {...sharedSelectProps} {...props} />\n )}\n\n {displayShowMore && !(error || warning) && (\n <S.ShowMoreWrapper onClick={() => setDisplayShowMore(false)}>\n <S.ShowMoreOverlay />\n <S.ShowMoreText>\n {showMoreText} {displayTotalOnShowMore && `(${selected?.length || 0})`}\n </S.ShowMoreText>\n </S.ShowMoreWrapper>\n )}\n\n {(error || warning) && (\n <S.ErrorMessage $error={!!error} $warning={!!warning}>\n {typeof error === 'string' ? error : warning}\n </S.ErrorMessage>\n )}\n </S.MultiSelectWrapper>\n );\n});\n\nMultiSelect.displayName = 'MultiSelect';\n\nMultiSelect.propTypes = {\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":["Control","props","React","createElement","S","$readOnly","selectProps","readOnly","components","propTypes","process","env","NODE_ENV","PropTypes","shape","bool","isRequired","ValueContainer","children","label","htmlFor","uniqueId","$showMore","displayShowMore","$error","error","$warning","warning","node","string","oneOfType","MultiValue","data","handleMouseDown","e","isRemoveClick","target","closest","onMultiValueClick","stopPropagation","onMouseDown","object","func","MultiValueRemove","disabled","Input","$focused","focused","$editText","editText","_extends","isDisabled","Option","isSelected","isFocused","$isFocused","MultiSelect","forwardRef","selectedOptions","availableOptions","loadOptions","loadingMessageFunc","onUpdateCallback","createNewOptionMessageFunc","showMore","showMoreText","displayTotalOnShowMore","creatable","hidden","noOptionsMessageFunc","val","forwardedRef","useState","nanoid","selected","setSelected","setFocused","setDisplayShowMore","cacheUnique","setCacheUnique","theme","useTheme","useEffect","isDark","document","body","classList","contains","getC","key","getColor","getP","dark","light","themeFn","themeProp","selectStyles","useMemo","control","base","border","boxShadow","background","minHeight","valueContainer","padding","overflow","multiValue","margin","borderRadius","backgroundColor","multiValueLabel","color","fontSize","paddingLeft","paddingTop","paddingBottom","paddingRight","multiValueRemove","cursor","option","state","menu","zIndex","marginTop","input","placeholder","display","sharedSelectProps","ref","value","options","undefined","isMulti","isClearable","loadingMessage","formatCreateLabel","DropdownIndicator","styles","rsTheme","spacing","baseUnit","noOptionsMessage","inputValue","onFocus","onBlur","onChange","newValue","actionMeta","action","c","nextValue","removedValue","onClick","length","displayName","arrayOf","defaultProps"],"mappings":";;;;;;;;AAUA,MAAMA,OAAO,GAAGC,KAAK,IAAI;AACvB,EAAA,OACEC,cAAA,CAAAC,aAAA,CAACC,SAAS,EAAA;AAACC,IAAAA,SAAS,EAAEJ,KAAK,CAACK,WAAW,CAACC,QAAAA;GACtCL,EAAAA,cAAA,CAAAC,aAAA,CAACK,UAAU,CAACR,OAAO,EAAKC,KAAQ,CACvB,CAAC,CAAA;AAEhB,CAAC,CAAA;AAEDD,OAAO,CAACS,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAG,YAAA,GAAA;AAClBN,EAAAA,WAAW,EAAEO,SAAS,CAACC,KAAK,CAAC;IAC3BP,QAAQ,EAAEM,SAAS,CAACE,IAAAA;AACtB,GAAC,CAAC,CAACC,UAAAA;AACL,CAAC,GAAA,EAAA,CAAA;AAED,MAAMC,cAAc,GAAGhB,KAAK,IAAI;EAC9B,MAAM;IAAEiB,QAAQ;AAAEZ,IAAAA,WAAAA;AAAY,GAAC,GAAGL,KAAK,CAAA;EACvC,OACEC,cAAA,CAAAC,aAAA,CAACK,UAAU,CAACS,cAAc,EAAKhB,KAAK,EACjCK,WAAW,CAACa,KAAK,IAAIjB,cAAA,CAAAC,aAAA,CAACC,KAAO,EAAA;IAACgB,OAAO,EAAEd,WAAW,CAACe,QAAAA;GAAWf,EAAAA,WAAW,CAACa,KAAe,CAAC,EAC3FjB,cAAA,CAAAC,aAAA,CAACC,gBAAgB,EAAA;IACfkB,SAAS,EAAEhB,WAAW,CAACiB,eAAgB;IACvCC,MAAM,EAAElB,WAAW,CAACmB,KAAM;IAC1BC,QAAQ,EAAEpB,WAAW,CAACqB,OAAAA;GAErBT,EAAAA,QACe,CACO,CAAC,CAAA;AAEhC,CAAC,CAAA;AAEDD,cAAc,CAACR,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAG,YAAA,GAAA;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,IAAI;EAKxBkD,YAAY,EAAEpD,SAAS,CAACgB,MAAM;EAK9BqC,sBAAsB,EAAErD,SAAS,CAACE,IAAI;EAMtCR,QAAQ,EAAEM,SAAS,CAACE,IAAI;EAIxBqD,MAAM,EAAEvD,SAAS,CAACE,IAAI;EAMtB6B,QAAQ,EAAE/B,SAAS,CAACE,IAAI;AASxBU,EAAAA,KAAK,EAAEZ,SAAS,CAACiB,SAAS,CAAC,CAACjB,SAAS,CAACE,IAAI,EAAEF,SAAS,CAACgB,MAAM,CAAC,CAAC;AAS9DF,EAAAA,OAAO,EAAEd,SAAS,CAACiB,SAAS,CAAC,CAACjB,SAAS,CAACE,IAAI,EAAEF,SAAS,CAACgB,MAAM,CAAC,CAAA;AACjE,CAAC,GAAA,EAAA,CAAA;AAED2B,WAAW,CAACqG,YAAY,GAAG;EACzBxF,oBAAoB,EAAE0E,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;AACD/E,EAAAA,QAAQ,EAAE,KAAK;AACfE,EAAAA,sBAAsB,EAAE,IAAI;AAC5B3D,EAAAA,QAAQ,EAAE,KAAK;AACfqC,EAAAA,QAAQ,EAAE,KAAK;AACfuB,EAAAA,SAAS,EAAE,KAAK;AAChB1C,EAAAA,KAAK,EAAE,KAAK;AACZE,EAAAA,OAAO,EAAE,KAAK;AACdsC,EAAAA,YAAY,EAAE,WAAW;AACzBG,EAAAA,MAAM,EAAE,KAAA;AACV,CAAC;;;;"}
1
+ {"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.js"],"sourcesContent":["import React, { useState, useMemo, useEffect } 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 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\n useEffect(() => {\n setSelected(selectedOptions);\n }, [selectedOptions]);\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 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 e.stopPropagation();\n\n if (\n onMultiValueClick &&\n data &&\n !(e.target.role === 'button' || e.target instanceof SVGElement)\n ) {\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 >\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 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 }),\n valueContainer: base => ({\n ...base,\n padding: 0,\n gap: '8px',\n maxHeight: displayShowMore && !(error || warning) ? '130px' : '100%'\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 => ({ ...base, margin: 0, border: 'none', background: 'none' }),\n multiValueLabel: base => ({ ...base, padding: 0 }),\n multiValueRemove: base => ({ ...base, padding: 0, cursor: 'pointer' })\n }),\n [error, warning, displayShowMore]\n );\n\n const sharedProps = {\n ...props,\n ref: forwardedRef,\n classNamePrefix: 'multi-select',\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions,\n loadingMessage: loadingMessageFunc,\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: !disabled && !readOnly,\n openMenuOnFocus: !disabled && !readOnly,\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n noOptionsMessage: ({ inputValue }) => getNoOptionsMessage(inputValue),\n onChange: (newValue, actionMeta) => {\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.option || actionMeta.removedValue);\n }\n setSelected(newValue);\n }\n };\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper>\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 onClick={() => setDisplayShowMore(false)}>\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\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":["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","useEffect","getNoOptionsMessage","inputValue","innerComponents","DropdownIndicator","MultiValue","data","createElement","className","onMouseDown","e","stopPropagation","target","role","SVGElement","S","_extends","isDisabled","isReadOnly","MultiValueRemove","components","CloseIcon","Input","inputProps","$focused","$editText","Menu","menuProps","Option","optProps","isSelected","selectStyles","useMemo","control","base","alignItems","background","border","boxShadow","minHeight","valueContainer","padding","gap","maxHeight","menu","backgroundColor","menuList","option","color","multiValue","margin","multiValueLabel","multiValueRemove","cursor","sharedProps","ref","classNamePrefix","value","options","undefined","loadingMessage","styles","isMulti","isClearable","placeholder","closeMenuOnSelect","hideSelectedOptions","openMenuOnClick","openMenuOnFocus","onFocus","onBlur","noOptionsMessage","onChange","newValue","actionMeta","action","removedValue","htmlFor","$error","$warning","onClick","length","propTypes","process","env","NODE_ENV","PropTypes","string","arrayOf","object","func","isRequired","bool","createNewOptionMessageFunc","oneOfType","defaultProps"],"mappings":";;;;;;;;AAkKMA,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,E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