@ntbjs/react-components 2.0.2-rc.4 → 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.
@@ -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,IAA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M,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,EAAAA,sBAAsB,GAAG,IAAI;EAC7BC,oBAAoB;EACpB,GAAGC,KAAAA;AACL,CAAC,EACDC,YAAY,EACZ;EACA,MAAM,CAACC,QAAQ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ACQ,SAAS,CAAC,CAACR,SAAS,CAACM,IAAI,EAAEN,SAAS,CAACC,MAAM,CAAC,CAAC;AAS9DxG,EAAAA,OAAO,EAAEuG,SAAS,CAACQ,SAAS,CAAC,CAACR,SAAS,CAACM,IAAI,EAAEN,SAAS,CAACC,MAAM,CAAC,CAAA;AACjE,CAAC,GAAA,EAAA,CAAA;AAEDvH,WAAW,CAAC+H,YAAY,GAAG;EACzB3G,oBAAoB,EAAEc,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;AACDjB,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,35 +1,22 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { applyDefaultTheme } from '../../utils/defaultTheme.js';
3
3
  import { ReactComponent as SvgClose } from '../../icons/close.svg.js';
4
- import Select from 'react-select';
4
+ import Select, { components } from 'react-select';
5
5
  import CreatableSelect from 'react-select/creatable';
6
6
  import { withAsyncPaginate, AsyncPaginate } from 'react-select-async-paginate';
7
7
 
8
- const AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);
9
8
  const showMoreHeight = 114;
10
- const MultiSelectWrapper = styled.div`
9
+ const AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);
10
+ const sharedStyle = css`
11
+ font-family: ${props => props.theme.primaryFontFamily};
12
+ font-size: 12px;
13
+ font-weight: 400;
11
14
  position: relative;
12
- /* Targets internal container to ensure overlay is visible even if library tries to clip it */
13
- & [class*='ValueContainer'] {
14
- overflow: visible !important;
15
- }
16
- `;
17
- const Label = styled.label.attrs(applyDefaultTheme)`
18
- ${props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700'))};
19
- font-size: 0.875rem;
20
- margin-bottom: 4px;
21
- display: block;
22
15
  `;
23
- const Control = styled.div`
24
- & > div {
25
- cursor: ${props => props.$readOnly ? 'default' : 'pointer'};
26
- }
16
+ const MultiSelectWrapper = styled.div.attrs(applyDefaultTheme)`
17
+ position: relative;
27
18
  `;
28
- const ValueContainer = styled.div.attrs(applyDefaultTheme)`
29
- display: flex;
30
- flex-wrap: wrap;
31
- gap: 8px;
32
- max-height: ${props => props.$showMore ? props.$error || props.$warning ? 'none' : `${showMoreHeight + 16}px` : 'none'};
19
+ const InnerWrapper = styled.div`
33
20
  ${props => (props.$error || props.$warning) && css`
34
21
  border: 1px solid;
35
22
  border-radius: 3px;
@@ -37,85 +24,192 @@ const ValueContainer = styled.div.attrs(applyDefaultTheme)`
37
24
  border-color: ${props.$error ? props.theme.getColor('red-500') : props.theme.getColor('orange-500')};
38
25
  `}
39
26
  `;
40
- const MultiValueWrapper = styled.div`
41
- margin: 0;
27
+ const Label = styled.label.attrs(applyDefaultTheme)`
28
+ ${props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700'))};
29
+ flex-basis: 33.33%;
30
+ font-size: 0.875rem;
31
+ line-height: 1rem;
32
+ cursor: pointer;
33
+ height: 19px;
34
+ display: flex;
35
+ align-items: center;
42
36
  `;
43
- const MultiValueRemoveIcon = styled(SvgClose)`
44
- width: 8px;
45
- stroke: white;
46
- stroke-width: 2px;
37
+ const MultiValue = styled(components.MultiValue).attrs(applyDefaultTheme)`
38
+ && {
39
+ border-radius: 3px;
40
+ margin: 0;
41
+ display: flex;
42
+ align-items: center;
43
+ border: none;
44
+
45
+ ${props => props.theme.themeProp('background-color', props.theme.getColor('gray-600'), props.theme.getColor('gray-800'))}
46
+
47
+ ${props => props.isDisabled && css`
48
+ opacity: 0.6;
49
+ cursor: not-allowed !important;
50
+
51
+ & > * {
52
+ pointer-events: none;
53
+ cursor: not-allowed !important;
54
+ }
55
+ `}
56
+
57
+ ${props => props.isReadOnly && !props.isDisabled && css`
58
+ cursor: default !important;
59
+ `}
60
+
61
+
62
+ & > div:first-of-type {
63
+ font-size: 12px;
64
+ min-height: 26px;
65
+ display: flex;
66
+ align-items: center;
67
+ padding: ${props => props.isDisabled || props.isReadOnly ? '0 8px' : '0 3px 0 8px'};
68
+ color: ${props => props.theme.getColor('gray-100')};
69
+ cursor: ${props => props.isDisabled ? 'not-allowed' : props.isReadOnly ? 'default' : 'pointer'};
70
+ }
71
+
72
+ /* Target the Remove Button */
73
+ .multi-select__multi-value__remove,
74
+ & > div:last-of-type {
75
+ display: flex;
76
+ align-items: center;
77
+ padding: 0 8px 0 5px;
78
+ height: 26px;
79
+ width: fit-content;
80
+ cursor: pointer;
81
+ background-color: transparent;
82
+
83
+ ${props => !props.isDisabled && !props.isReadOnly && css`
84
+ &:hover {
85
+ background-color: ${props.theme.getColor('red-500')} !important;
86
+ border-radius: 0 3px 3px 0;
87
+ }
88
+ `}
89
+
90
+ svg {
91
+ stroke: white;
92
+ stroke-width: 2px;
93
+ width: 8px;
94
+ }
95
+ }
96
+ }
47
97
  `;
48
- const InputWrapper = styled.div.attrs(applyDefaultTheme)`
49
- min-width: 150px;
98
+ const MultiSelect = styled(Select)`
99
+ ${sharedStyle}
100
+ `;
101
+ const CreatableMultiSelect = styled(CreatableSelect)`
102
+ ${sharedStyle}
103
+ `;
104
+ const AsyncMultiSelect = styled(AsyncPaginate)`
105
+ ${sharedStyle}
106
+ `;
107
+ const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate)`
108
+ ${sharedStyle}
109
+ `;
110
+ const InputWrapper = styled.div`
50
111
  position: relative;
51
- ${props => !props.$focused && props.$editText && css`
52
- &::before {
112
+ display: flex;
113
+ align-items: center;
114
+ min-width: 150px;
115
+
116
+ input {
117
+ color: ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))} !important;
118
+ font-size: ${props => props.$focused ? '14px' : '12px'} !important;
119
+ }
120
+
121
+ ${props => !props.$focused && css`
122
+ &:before {
53
123
  content: '${props.$editText}';
54
- color: ${p => p.theme.getColor('gray-400')};
55
- font-size: 12px;
56
124
  position: absolute;
57
- top: 50%;
58
- transform: translateY(-50%);
125
+ left: 2px;
126
+ color: ${props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
59
127
  pointer-events: none;
128
+ font-size: 12px;
60
129
  }
61
130
  `}
62
- input {
63
- color: ${props => props.theme.themeProp(props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))} !important;
131
+
132
+ ${props => props.isDisabled && css`
133
+ opacity: 0.5;
134
+ cursor: not-allowed;
135
+ pointer-events: none;
136
+ `};
137
+ `;
138
+ const DropdownMenu = styled(components.Menu).attrs(applyDefaultTheme)`
139
+ font-size: 14px;
140
+
141
+ ${props => props.theme.themeProp('background-color', props.theme.getColor('gray-600'), props.theme.getColor('white'))}
142
+
143
+ ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
144
+ `;
145
+ const sharedOptionStyle = css`
146
+ ${props => props.isFocused && css`
147
+ ${props.theme.themeProp('background-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-200'))}
148
+ `}
149
+
150
+ ${props => props.isSelected && css`
151
+ ${props.theme.themeProp('background-color', 'transparent', 'transparent')}
152
+
153
+ ${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
154
+ `}
155
+
156
+ ${props => props.isFocused && props.isSelected && css`
157
+ ${props.theme.themeProp('background-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-200'))}
158
+ `}
159
+
160
+ :hover {
161
+ cursor: pointer;
64
162
  }
65
163
  `;
66
- const OptionContent = styled.div`
67
- display: flex;
164
+ const Option = styled(components.Option).attrs(applyDefaultTheme)`
165
+ ${sharedOptionStyle}
166
+ padding: 8px 12px;
167
+ `;
168
+ const SelectedOption = styled(components.Option).attrs(applyDefaultTheme)`
169
+ ${sharedOptionStyle}
170
+ display: flex !important;
68
171
  justify-content: space-between;
69
172
  align-items: center;
70
173
  padding: 8px 12px;
71
- width: 100%;
72
- font-size: 14px;
73
- color: inherit;
74
- `;
75
- styled.div`
76
- [class*='menu'] {
77
- z-index: 9999 !important;
78
- border-radius: 4px;
79
- }
80
174
  `;
81
175
  const DropdownOptionDeleteIcon = styled(SvgClose).attrs(applyDefaultTheme)`
176
+ stroke-width: 1px;
82
177
  width: 8px;
83
- stroke: ${props => props.theme.themeProp(props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))};
178
+ ${props => props.theme.themeProp('stroke', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
84
179
  `;
85
180
  const ShowMoreWrapper = styled.div.attrs(applyDefaultTheme)`
181
+ align-items: end;
182
+ display: flex;
183
+ flex-direction: column;
184
+ height: 100%;
185
+ left: 0;
86
186
  position: absolute;
187
+ max-height: ${showMoreHeight + 16}px;
87
188
  top: 0;
88
- left: 0;
89
189
  width: 100%;
90
- height: 100%;
91
- display: flex;
92
- flex-direction: column;
93
- justify-content: flex-end;
94
- z-index: 50;
95
- color: ${props => props.theme.themeProp(props.theme.getColor('gray-100'), props.theme.getColor('emerald-500'))};
190
+ z-index: 2;
191
+ cursor: pointer;
192
+ color: ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('emerald-500'))};
96
193
  &:hover {
97
- cursor: pointer;
98
194
  text-decoration: underline;
99
195
  }
100
196
  `;
101
197
  const ShowMoreOverlay = styled.div.attrs(applyDefaultTheme)`
102
- flex: 1;
103
- background: ${props => props.theme.themeProp('linear-gradient(180deg, #12121200 0%, #121212 100%)', 'linear-gradient(180deg, #fefefe00 0%, #fefefe 100%)')};
198
+ height: 100%;
199
+ max-height: ${showMoreHeight}px;
200
+ ${props => props.theme.themeProp('background', 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box', 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box')}
104
201
  `;
105
202
  const ShowMoreText = styled.div.attrs(applyDefaultTheme)`
106
- background-color: ${props => props.theme.themeProp('#121212', '#fefefe')};
107
- text-align: right;
108
203
  font-size: 0.875rem;
204
+ width: 100%;
205
+ background-color: ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')};
109
206
  `;
110
207
  const ErrorMessage = styled.div.attrs(applyDefaultTheme)`
111
- color: ${props => props.$error ? props.theme.getColor('red-500') : props.theme.getColor('orange-500')};
208
+ color: ${props => props.$error ? props.theme.getColor('red-500') : props.$warning ? props.theme.getColor('orange-500') : 'inherit'};
112
209
  font-size: 0.75rem;
113
210
  margin-top: 8px;
211
+ padding: 0 12px;
114
212
  `;
115
- const MultiSelect = styled(Select).attrs(applyDefaultTheme)``;
116
- const CreatableMultiSelect = styled(CreatableSelect).attrs(applyDefaultTheme)``;
117
- const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate).attrs(applyDefaultTheme)``;
118
- const AsyncMultiSelect = styled(AsyncPaginate).attrs(applyDefaultTheme)``;
119
213
 
120
- export { AsyncCreatableMultiSelect, AsyncMultiSelect, Control, CreatableMultiSelect, DropdownOptionDeleteIcon, ErrorMessage, InputWrapper, Label, MultiSelect, MultiSelectWrapper, MultiValueRemoveIcon, MultiValueWrapper, OptionContent, ShowMoreOverlay, ShowMoreText, ShowMoreWrapper, ValueContainer };
214
+ export { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, DropdownMenu, DropdownOptionDeleteIcon, ErrorMessage, InnerWrapper, InputWrapper, Label, MultiSelect, MultiSelectWrapper, MultiValue, Option, SelectedOption, ShowMoreOverlay, ShowMoreText, ShowMoreWrapper };
121
215
  //# sourceMappingURL=MultiSelect.styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.styled.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\nimport Select from 'react-select';\nimport CreatableSelect from 'react-select/creatable';\nimport { AsyncPaginate, withAsyncPaginate } from 'react-select-async-paginate';\n\nconst AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);\nconst showMoreHeight = 114;\n\nexport const MultiSelectWrapper = styled.div`\n position: relative;\n /* Targets internal container to ensure overlay is visible even if library tries to clip it */\n & [class*='ValueContainer'] {\n overflow: visible !important;\n }\n`;\n\nexport const Label = styled.label.attrs(applyDefaultTheme)`\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('white'),\n props.theme.getColor('gray-700')\n )};\n font-size: 0.875rem;\n margin-bottom: 4px;\n display: block;\n`;\n\nexport const Control = styled.div`\n & > div {\n cursor: ${props => (props.$readOnly ? 'default' : 'pointer')};\n }\n`;\n\nexport const ValueContainer = styled.div.attrs(applyDefaultTheme)`\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-height: ${props =>\n props.$showMore\n ? props.$error || props.$warning\n ? 'none'\n : `${showMoreHeight + 16}px`\n : 'none'};\n ${props =>\n (props.$error || props.$warning) &&\n css`\n border: 1px solid;\n border-radius: 3px;\n padding: 4px;\n border-color: ${props.$error\n ? props.theme.getColor('red-500')\n : props.theme.getColor('orange-500')};\n `}\n`;\n\nexport const MultiValueWrapper = styled.div`\n margin: 0;\n`;\n\nexport const MultiValueRemoveIcon = styled(CloseIcon)`\n width: 8px;\n stroke: white;\n stroke-width: 2px;\n`;\n\nexport const InputWrapper = styled.div.attrs(applyDefaultTheme)`\n min-width: 150px;\n position: relative;\n ${props =>\n !props.$focused &&\n props.$editText &&\n css`\n &::before {\n content: '${props.$editText}';\n color: ${p => p.theme.getColor('gray-400')};\n font-size: 12px;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n pointer-events: none;\n }\n `}\n input {\n color: ${props =>\n props.theme.themeProp(\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )} !important;\n }\n`;\n\nexport const OptionContent = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n width: 100%;\n font-size: 14px;\n color: inherit;\n`;\n\nexport const DropdownMenu = styled.div`\n [class*='menu'] {\n z-index: 9999 !important;\n border-radius: 4px;\n }\n`;\n\nexport const DropdownOptionDeleteIcon = styled(CloseIcon).attrs(applyDefaultTheme)`\n width: 8px;\n stroke: ${props =>\n props.theme.themeProp(props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))};\n`;\n\nexport const ShowMoreWrapper = styled.div.attrs(applyDefaultTheme)`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n z-index: 50;\n color: ${props =>\n props.theme.themeProp(props.theme.getColor('gray-100'), props.theme.getColor('emerald-500'))};\n &:hover {\n cursor: pointer;\n text-decoration: underline;\n }\n`;\n\nexport const ShowMoreOverlay = styled.div.attrs(applyDefaultTheme)`\n flex: 1;\n background: ${props =>\n props.theme.themeProp(\n 'linear-gradient(180deg, #12121200 0%, #121212 100%)',\n 'linear-gradient(180deg, #fefefe00 0%, #fefefe 100%)'\n )};\n`;\n\nexport const ShowMoreText = styled.div.attrs(applyDefaultTheme)`\n background-color: ${props => props.theme.themeProp('#121212', '#fefefe')};\n text-align: right;\n font-size: 0.875rem;\n`;\n\nexport const ErrorMessage = styled.div.attrs(applyDefaultTheme)`\n color: ${props =>\n props.$error ? props.theme.getColor('red-500') : props.theme.getColor('orange-500')};\n font-size: 0.75rem;\n margin-top: 8px;\n`;\n\nexport const MultiSelect = styled(Select).attrs(applyDefaultTheme)``;\nexport const CreatableMultiSelect = styled(CreatableSelect).attrs(applyDefaultTheme)``;\nexport const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate).attrs(\n applyDefaultTheme\n)``;\nexport const AsyncMultiSelect = styled(AsyncPaginate).attrs(applyDefaultTheme)``;\n"],"names":["AsyncCreatableSelectPaginate","withAsyncPaginate","CreatableSelect","showMoreHeight","MultiSelectWrapper","styled","div","Label","label","attrs","applyDefaultTheme","props","theme","themeProp","getColor","Control","$readOnly","ValueContainer","$showMore","$error","$warning","css","MultiValueWrapper","MultiValueRemoveIcon","CloseIcon","InputWrapper","$focused","$editText","p","OptionContent","DropdownOptionDeleteIcon","ShowMoreWrapper","ShowMoreOverlay","ShowMoreText","ErrorMessage","MultiSelect","Select","CreatableMultiSelect","AsyncCreatableMultiSelect","AsyncMultiSelect","AsyncPaginate"],"mappings":";;;;;;;AAOA,MAAMA,4BAA4B,GAAGC,iBAAiB,CAACC,eAAe,CAAC,CAAA;AACvE,MAAMC,cAAc,GAAG,GAAG,CAAA;AAEbC,MAAAA,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CAAA;AAC5C;AACA;AACA;AACA;AACA;AACA,EAAC;AAEM,MAAMC,KAAK,GAAGF,MAAM,CAACG,KAAK,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC1D,EAAIC,EAAAA,KAAK,IACLA,KAAK,CAACC,KAAK,CAACC,SAAS,CACnB,OAAO,EACPF,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,OAAO,CAAC,EAC7BH,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,UAAU,CACjC,CAAC,CAAA;AACL;AACA;AACA;AACA,EAAC;AAEYC,MAAAA,OAAO,GAAGV,MAAM,CAACC,GAAG,CAAA;AACjC;AACA,YAAcK,EAAAA,KAAK,IAAKA,KAAK,CAACK,SAAS,GAAG,SAAS,GAAG,SAAU,CAAA;AAChE;AACA,EAAC;AAE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BAAsBC,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAC1E;AACA;AACA,EAAC;AAEM,MAAMqB,YAAY,GAAG7B,MAAM,CAACC,GAAG,CAACG,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC/D,SAAWC,EAAAA,KAAK,IACZA,KAAK,CAACQ,MAAM,GAAGR,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,SAAS,CAAC,GAAGH,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,YAAY,CAAC,CAAA;AACvF;AACA;AACA,EAAC;AAEYqB,MAAAA,WAAW,GAAG9B,MAAM,CAAC+B,MAAM,CAAC,CAAC3B,KAAK,CAACC,iBAAiB,CAAC,CAAE,EAAA;AACvD2B,MAAAA,oBAAoB,GAAGhC,MAAM,CAACH,eAAe,CAAC,CAACO,KAAK,CAACC,iBAAiB,CAAC,CAAE,EAAA;AACzE4B,MAAAA,yBAAyB,GAAGjC,MAAM,CAACL,4BAA4B,CAAC,CAACS,KAAK,CACjFC,iBACF,CAAC,CAAE,EAAA;AACU6B,MAAAA,gBAAgB,GAAGlC,MAAM,CAACmC,aAAa,CAAC,CAAC/B,KAAK,CAACC,iBAAiB,CAAC,CAAE;;;;"}
1
+ {"version":3,"file":"MultiSelect.styled.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\nimport { components } from 'react-select';\nimport Select from 'react-select';\nimport CreatableSelect from 'react-select/creatable';\nimport { AsyncPaginate, withAsyncPaginate } from 'react-select-async-paginate';\n\nconst showMoreHeight = 114;\nconst AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);\n\nconst sharedStyle = css`\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 12px;\n font-weight: 400;\n position: relative;\n`;\n\nexport const MultiSelectWrapper = styled.div.attrs(applyDefaultTheme)`\n position: relative;\n`;\n\nexport const InnerWrapper = styled.div`\n ${props =>\n (props.$error || props.$warning) &&\n css`\n border: 1px solid;\n border-radius: 3px;\n padding: 4px;\n border-color: ${props.$error\n ? props.theme.getColor('red-500')\n : props.theme.getColor('orange-500')};\n `}\n`;\n\nexport const Label = styled.label.attrs(applyDefaultTheme)`\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('white'),\n props.theme.getColor('gray-700')\n )};\n flex-basis: 33.33%;\n font-size: 0.875rem;\n line-height: 1rem;\n cursor: pointer;\n height: 19px;\n display: flex;\n align-items: center;\n`;\n\nexport const MultiValue = styled(components.MultiValue).attrs(applyDefaultTheme)`\n && {\n border-radius: 3px;\n margin: 0;\n display: flex;\n align-items: center;\n border: none;\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-600'),\n props.theme.getColor('gray-800')\n )}\n\n ${props =>\n props.isDisabled &&\n css`\n opacity: 0.6;\n cursor: not-allowed !important;\n\n & > * {\n pointer-events: none;\n cursor: not-allowed !important;\n }\n `}\n\n ${props =>\n props.isReadOnly &&\n !props.isDisabled &&\n css`\n cursor: default !important;\n `}\n\n \n & > div:first-of-type {\n font-size: 12px;\n min-height: 26px;\n display: flex;\n align-items: center;\n padding: ${props => (props.isDisabled || props.isReadOnly ? '0 8px' : '0 3px 0 8px')};\n color: ${props => props.theme.getColor('gray-100')};\n cursor: ${props =>\n props.isDisabled ? 'not-allowed' : props.isReadOnly ? 'default' : 'pointer'};\n }\n\n /* Target the Remove Button */\n .multi-select__multi-value__remove,\n & > div:last-of-type {\n display: flex;\n align-items: center;\n padding: 0 8px 0 5px;\n height: 26px;\n width: fit-content;\n cursor: pointer;\n background-color: transparent;\n\n ${props =>\n !props.isDisabled &&\n !props.isReadOnly &&\n css`\n &:hover {\n background-color: ${props.theme.getColor('red-500')} !important;\n border-radius: 0 3px 3px 0;\n }\n `}\n\n svg {\n stroke: white;\n stroke-width: 2px;\n width: 8px;\n }\n }\n }\n`;\n\nexport const MultiSelect = styled(Select)`\n ${sharedStyle}\n`;\nexport const CreatableMultiSelect = styled(CreatableSelect)`\n ${sharedStyle}\n`;\nexport const AsyncMultiSelect = styled(AsyncPaginate)`\n ${sharedStyle}\n`;\nexport const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate)`\n ${sharedStyle}\n`;\n\nexport const InputWrapper = styled.div`\n position: relative;\n display: flex;\n align-items: center;\n min-width: 150px;\n\n input {\n color: ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )} !important;\n font-size: ${props => (props.$focused ? '14px' : '12px')} !important;\n }\n\n ${props =>\n !props.$focused &&\n css`\n &:before {\n content: '${props.$editText}';\n position: absolute;\n left: 2px;\n color: ${props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-500')\n )};\n pointer-events: none;\n font-size: 12px;\n }\n `}\n\n ${props =>\n props.isDisabled &&\n css`\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n `};\n`;\n\n/* MultiSelect.styled.js */\n\n/* MultiSelect.styled.js */\n\nexport const DropdownMenu = styled(components.Menu).attrs(applyDefaultTheme)`\n font-size: 14px;\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-600'),\n props.theme.getColor('white')\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n`;\n\nconst sharedOptionStyle = css`\n ${props =>\n props.isFocused &&\n css`\n ${props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n `}\n\n ${props =>\n props.isSelected &&\n css`\n ${props.theme.themeProp('background-color', 'transparent', 'transparent')}\n\n ${props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n `}\n\n ${props =>\n props.isFocused &&\n props.isSelected &&\n css`\n ${props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n `}\n\n :hover {\n cursor: pointer;\n }\n`;\n\nexport const Option = styled(components.Option).attrs(applyDefaultTheme)`\n ${sharedOptionStyle}\n padding: 8px 12px;\n`;\n\nexport const SelectedOption = styled(components.Option).attrs(applyDefaultTheme)`\n ${sharedOptionStyle}\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n`;\n\nexport const DropdownOptionDeleteIcon = styled(CloseIcon).attrs(applyDefaultTheme)`\n stroke-width: 1px;\n width: 8px;\n ${props =>\n props.theme.themeProp(\n 'stroke',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n`;\n\nexport const ShowMoreWrapper = styled.div.attrs(applyDefaultTheme)`\n align-items: end;\n display: flex;\n flex-direction: column;\n height: 100%;\n left: 0;\n position: absolute;\n max-height: ${showMoreHeight + 16}px;\n top: 0;\n width: 100%;\n z-index: 2;\n cursor: pointer;\n color: ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('emerald-500')\n )};\n &:hover {\n text-decoration: underline;\n }\n`;\n\nexport const ShowMoreOverlay = styled.div.attrs(applyDefaultTheme)`\n height: 100%;\n max-height: ${showMoreHeight}px;\n ${props =>\n props.theme.themeProp(\n 'background',\n 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box',\n 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box'\n )}\n`;\n\nexport const ShowMoreText = styled.div.attrs(applyDefaultTheme)`\n font-size: 0.875rem;\n width: 100%;\n background-color: ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')};\n`;\n\nexport const ErrorMessage = styled.div.attrs(applyDefaultTheme)`\n color: ${props =>\n props.$error\n ? props.theme.getColor('red-500')\n : props.$warning\n ? props.theme.getColor('orange-500')\n : 'inherit'};\n font-size: 0.75rem;\n margin-top: 8px;\n padding: 0 12px;\n`;\n"],"names":["showMoreHeight","AsyncCreatableSelectPaginate","withAsyncPaginate","CreatableSelect","sharedStyle","css","props","theme","primaryFontFamily","MultiSelectWrapper","styled","div","attrs","applyDefaultTheme","InnerWrapper","$error","$warning","getColor","Label","label","themeProp","MultiValue","components","isDisabled","isReadOnly","MultiSelect","Select","CreatableMultiSelect","AsyncMultiSelect","AsyncPaginate","AsyncCreatableMultiSelect","InputWrapper","$focused","$editText","DropdownMenu","Menu","sharedOptionStyle","isFocused","isSelected","Option","SelectedOption","DropdownOptionDeleteIcon","CloseIcon","ShowMoreWrapper","ShowMoreOverlay","ShowMoreText","ErrorMessage"],"mappings":";;;;;;;AAQA,MAAMA,cAAc,GAAG,GAAG,CAAA;AAC1B,MAAMC,4BAA4B,GAAGC,iBAAiB,CAACC,eAAe,CAAC,CAAA;AAEvE,MAAMC,WAAW,GAAGC,GAAG,CAAA;AACvB,eAAA,EAAiBC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB,CAAA;AACvD;AACA;AACA;AACA,CAAC,CAAA;AAEM,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AACrE;AACA,EAAC;AAEYC,MAAAA,YAAY,GAAGJ,MAAM,CAACC,GAAG,CAAA;AACtC,EAAIL,EAAAA,KAAK,IACL,CAACA,KAAK,CAACS,MAAM,IAAIT,KAAK,CAACU,QAAQ,KAC/BX,GAAG,CAAA;AACP;AACA;AACA;AACA,oBAAsBC,EAAAA,KAAK,CAACS,MAAM,GACxBT,KAAK,CAACC,KAAK,CAACU,QAAQ,CAAC,SAAS,CAAC,GAC/BX,KAAK,CAACC,KAAK,CAACU,QAAQ,CAAC,YAAY,CAAC,CAAA;AAC5C,IAAK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ACS,MAAM,GACRT,KAAK,CAACC,KAAK,CAACU,QAAQ,CAAC,SAAS,CAAC,GAC/BX,KAAK,CAACU,QAAQ,GACZV,KAAK,CAACC,KAAK,CAACU,QAAQ,CAAC,YAAY,CAAC,GAClC,SAAS,CAAA;AACnB;AACA;AACA;AACA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntbjs/react-components",
3
- "version": "2.0.2-rc.4",
3
+ "version": "2.0.2-rc.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -85,8 +85,8 @@
85
85
  "madge": "^8.0.0",
86
86
  "postcss": "^8.3.0",
87
87
  "prop-types": "^15.7.2",
88
- "react": "^18.3.1",
89
- "react-dom": "^18.3.1",
88
+ "react": "^19.2.4",
89
+ "react-dom": "^19.2.4",
90
90
  "rollup": "^2.50.6",
91
91
  "rollup-plugin-copy": "^3.3.0",
92
92
  "rollup-plugin-delete": "^2.0.0",