@ntbjs/react-components 2.0.2-rc.4 → 2.0.2-rc.6

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,173 @@ 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
- } : {};
9
+ const reactSelectTheme = theme => ({
10
+ ...theme,
11
+ spacing: {
12
+ baseUnit: 4,
13
+ controlHeight: 38,
14
+ menuGutter: 8
15
+ }
16
+ });
106
17
  const MultiSelect = React__default.forwardRef(function MultiSelect({
107
18
  label,
108
- selectedOptions,
19
+ selectedOptions = [],
109
20
  availableOptions,
110
21
  loadOptions,
111
22
  loadingMessageFunc,
112
23
  onUpdateCallback,
113
24
  editText,
114
- createNewOptionMessageFunc,
115
- onMultiValueClick,
116
- showMore,
117
- showMoreText,
118
- displayTotalOnShowMore,
119
25
  creatable,
120
26
  readOnly,
121
27
  hidden,
122
28
  disabled,
123
29
  error,
124
30
  warning,
125
- noOptionsMessageFunc = val => val ? `No matches for "${val}"` : 'No options',
31
+ onMultiValueClick,
32
+ showMore,
33
+ showMoreText = 'Show more',
34
+ displayTotalOnShowMore = true,
35
+ noOptionsMessageFunc,
126
36
  ...props
127
37
  }, forwardedRef) {
128
38
  const [uniqueId] = useState(nanoid());
129
- const [selected, setSelected] = useState(selectedOptions || []);
39
+ const [selected, setSelected] = useState(selectedOptions);
130
40
  const [focused, setFocused] = useState(false);
131
41
  const [displayShowMore, setDisplayShowMore] = useState(error || warning ? false : showMore);
132
- const [cacheUnique, setCacheUnique] = useState(0);
133
- const theme = useTheme();
134
42
  useEffect(() => {
135
- setSelected(selectedOptions || []);
43
+ setSelected(selectedOptions);
136
44
  }, [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;
45
+ const getNoOptionsMessage = inputValue => {
46
+ if (typeof noOptionsMessageFunc === 'function') {
47
+ return noOptionsMessageFunc(inputValue);
48
+ }
49
+ return inputValue ? `No matches for "${inputValue}"` : 'No available options';
50
+ };
51
+ const innerComponents = {
52
+ DropdownIndicator: null,
53
+ MultiValue: ({
54
+ data,
55
+ ...props
56
+ }) => {
57
+ return React__default.createElement("div", {
58
+ className: "multi-value-wrapper",
59
+ onMouseDown: e => {
60
+ e.stopPropagation();
61
+ if (onMultiValueClick && data && !(e.target.role === 'button' || e.target instanceof SVGElement)) {
62
+ onMultiValueClick(data);
63
+ }
64
+ }
65
+ }, React__default.createElement(MultiValue, _extends({
66
+ data: data,
67
+ $isDisabled: disabled,
68
+ $isReadOnly: readOnly
69
+ }, props)));
70
+ },
71
+ MultiValueRemove: props => {
72
+ if (readOnly || disabled) return null;
73
+ return React__default.createElement(components.MultiValueRemove, props, React__default.createElement(SvgClose, null));
74
+ },
75
+ Input: inputProps => React__default.createElement(InputWrapper, {
76
+ $focused: focused,
77
+ $editText: !readOnly && !disabled ? editText : '',
78
+ $isDisabled: readOnly || disabled
79
+ }, React__default.createElement(components.Input, inputProps)),
80
+ Menu: menuProps => React__default.createElement(DropdownMenu, menuProps),
81
+ 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
82
  };
145
83
  const selectStyles = useMemo(() => ({
146
84
  control: base => ({
147
85
  ...base,
86
+ alignItems: 'flex-start',
87
+ background: 'transparent',
148
88
  border: 'none',
149
89
  boxShadow: 'none',
150
- background: 'transparent',
151
90
  minHeight: 'unset'
152
91
  }),
153
92
  valueContainer: base => ({
154
93
  ...base,
155
94
  padding: 0,
156
- overflow: 'visible'
95
+ gap: '8px',
96
+ maxHeight: displayShowMore && !(error || warning) ? '130px' : '100%'
157
97
  }),
158
- multiValue: base => ({
98
+ menu: base => ({
159
99
  ...base,
160
- margin: 0,
161
- borderRadius: '3px',
162
- backgroundColor: isDark ? getC('gray-600') : getC('gray-800')
100
+ backgroundColor: 'transparent',
101
+ boxShadow: 'none'
163
102
  }),
164
- multiValueLabel: (base, {
165
- selectProps
166
- }) => ({
103
+ menuList: base => ({
167
104
  ...base,
168
- color: getC('gray-100'),
169
- fontSize: '12px',
170
- paddingLeft: '8px',
171
- paddingTop: '8px',
172
- paddingBottom: '8px',
173
- paddingRight: selectProps.readOnly ? '8px' : '4px'
105
+ backgroundColor: 'transparent'
174
106
  }),
175
- multiValueRemove: base => ({
107
+ option: base => ({
176
108
  ...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
- }
109
+ backgroundColor: 'transparent',
110
+ color: 'inherit'
185
111
  }),
186
- option: (base, state) => ({
187
- ...base,
188
- padding: 0,
189
- cursor: 'pointer',
190
- backgroundColor: state.isFocused ? getC('gray-100') : 'transparent',
191
- '&:active': {
192
- backgroundColor: getC('gray-100')
193
- }
194
- }),
195
- menu: base => ({
112
+ multiValue: base => ({
196
113
  ...base,
197
- zIndex: 9999,
198
- backgroundColor: getP(getC('gray-600'), getC('white')),
199
- marginTop: '4px'
114
+ margin: 0,
115
+ border: 'none',
116
+ background: 'none'
200
117
  }),
201
- input: base => ({
118
+ multiValueLabel: base => ({
202
119
  ...base,
203
- margin: 0,
204
120
  padding: 0
205
121
  }),
206
- placeholder: base => ({
122
+ multiValueRemove: base => ({
207
123
  ...base,
208
- display: 'none'
124
+ padding: 0,
125
+ cursor: 'pointer'
209
126
  })
210
- }), [theme, isDark]);
211
- const sharedSelectProps = {
127
+ }), [error, warning, displayShowMore]);
128
+ const sharedProps = {
129
+ ...props,
212
130
  ref: forwardedRef,
131
+ classNamePrefix: 'multi-select',
213
132
  value: selected,
214
133
  options: loadOptions ? undefined : availableOptions,
215
134
  loadOptions,
135
+ loadingMessage: loadingMessageFunc,
136
+ theme: reactSelectTheme,
137
+ styles: selectStyles,
138
+ components: innerComponents,
216
139
  isMulti: true,
217
140
  isClearable: false,
218
141
  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),
142
+ isDisabled: disabled,
143
+ readOnly: readOnly,
144
+ closeMenuOnSelect: false,
145
+ hideSelectedOptions: false,
146
+ openMenuOnClick: !disabled && !readOnly,
147
+ openMenuOnFocus: !disabled && !readOnly,
250
148
  onFocus: () => setFocused(true),
251
149
  onBlur: () => setFocused(false),
150
+ noOptionsMessage: ({
151
+ inputValue
152
+ }) => getNoOptionsMessage(inputValue),
252
153
  onChange: (newValue, actionMeta) => {
253
- if (actionMeta.action === 'create-option' && loadOptions) {
254
- setCacheUnique(c => c + 1);
255
- }
256
- const nextValue = newValue || [];
257
- setSelected(nextValue);
258
154
  if (onUpdateCallback) {
259
155
  onUpdateCallback(actionMeta.action, actionMeta.option || actionMeta.removedValue);
260
156
  }
157
+ setSelected(newValue);
261
158
  }
262
159
  };
263
160
  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, {
161
+ return React__default.createElement(MultiSelectWrapper, null, label && React__default.createElement(Label, {
162
+ htmlFor: uniqueId
163
+ }, label), React__default.createElement(InnerWrapper, {
164
+ $error: error,
165
+ $warning: warning
166
+ }, 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
167
  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));
168
+ }, React__default.createElement(ShowMoreOverlay, null), React__default.createElement(ShowMoreText, null, showMoreText, " ", displayTotalOnShowMore && `(${selected.length})`)), (typeof error === 'string' || typeof warning === 'string') && React__default.createElement(ErrorMessage, {
169
+ $error: error,
170
+ $warning: warning
171
+ }, error ? error : warning));
270
172
  });
271
- MultiSelect.displayName = 'MultiSelect';
272
173
  MultiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
273
174
  label: PropTypes.string,
274
175
  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,QA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,EAAEnD,SAAS,CAACE,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 reactSelectTheme = theme => ({\n ...theme,\n spacing: {\n baseUnit: 4,\n controlHeight: 38,\n menuGutter: 8\n }\n});\n\nconst MultiSelect = React.forwardRef(function MultiSelect(\n {\n label,\n selectedOptions = [],\n availableOptions,\n loadOptions,\n loadingMessageFunc,\n onUpdateCallback,\n editText,\n creatable,\n readOnly,\n hidden,\n disabled,\n error,\n warning,\n onMultiValueClick,\n showMore,\n showMoreText = 'Show more',\n displayTotalOnShowMore = true,\n noOptionsMessageFunc,\n ...props\n },\n forwardedRef\n) {\n const [uniqueId] = useState(nanoid());\n const [selected, setSelected] = useState(selectedOptions);\n const [focused, setFocused] = useState(false);\n const [displayShowMore, setDisplayShowMore] = useState(error || warning ? false : showMore);\n\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 theme: reactSelectTheme,\n styles: selectStyles,\n components: innerComponents,\n isMulti: true,\n isClearable: false,\n placeholder: null,\n isDisabled: disabled,\n readOnly: readOnly,\n closeMenuOnSelect: false,\n hideSelectedOptions: false,\n openMenuOnClick: !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":["reactSelectTheme","theme","spacing","baseUnit","controlHeight","menuGutter","MultiSelect","React","forwardRef","label","selectedOptions","availableOptions","loadOptions","loadingMessageFunc","onUpdateCallback","editText","creatable","readOnly","hidden","disabled","error","warning","onMultiValueClick","showMore","showMoreText","displayTotalOnShowMore","noOptionsMessageFunc","props","forwardedRef","uniqueId","useState","nanoid","selected","setSelected","focused","setFocused","displayShowMore","setDisplayShowMore","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","isDisabled","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":";;;;;;;;AAkKA,MAAMA,gBAAgB,GAAGC,KAAK,KAAK;AACjC,EAAA,GAAGA,KAAK;AACRC,EAAAA,OAAO,EAAE;AACPC,IAAAA,QAAQ,EAAE,CAAC;AACXC,IAAAA,aAAa,EAAE,EAA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AACdG,EAAAA,YAAY,EAAE,WAAW;AACzBN,EAAAA,MAAM,EAAE,KAAA;AACV,CAAC;;;;"}
@@ -1,35 +1,29 @@
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 shouldForwardProp = prop => {
11
+ return prop !== 'theme' && !prop.startsWith('$');
12
+ };
13
+ const sharedStyle = css`
14
+ font-family: ${props => props.theme?.primaryFontFamily || 'Arial, sans-serif'};
15
+ font-size: 12px;
16
+ font-weight: 400;
11
17
  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
18
  `;
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
- `;
23
- const Control = styled.div`
24
- & > div {
25
- cursor: ${props => props.$readOnly ? 'default' : 'pointer'};
26
- }
19
+ const MultiSelectWrapper = styled.div.withConfig({
20
+ shouldForwardProp
21
+ }).attrs(applyDefaultTheme)`
22
+ position: relative;
27
23
  `;
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'};
24
+ const InnerWrapper = styled.div.withConfig({
25
+ shouldForwardProp
26
+ }).attrs(applyDefaultTheme)`
33
27
  ${props => (props.$error || props.$warning) && css`
34
28
  border: 1px solid;
35
29
  border-radius: 3px;
@@ -37,85 +31,206 @@ const ValueContainer = styled.div.attrs(applyDefaultTheme)`
37
31
  border-color: ${props.$error ? props.theme.getColor('red-500') : props.theme.getColor('orange-500')};
38
32
  `}
39
33
  `;
40
- const MultiValueWrapper = styled.div`
41
- margin: 0;
34
+ const Label = styled.label.withConfig({
35
+ shouldForwardProp
36
+ }).attrs(applyDefaultTheme)`
37
+ ${props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700'))};
38
+ flex-basis: 33.33%;
39
+ font-size: 0.875rem;
40
+ line-height: 1rem;
41
+ cursor: pointer;
42
+ height: 19px;
43
+ display: flex;
44
+ align-items: center;
42
45
  `;
43
- const MultiValueRemoveIcon = styled(SvgClose)`
44
- width: 8px;
45
- stroke: white;
46
- stroke-width: 2px;
46
+ const MultiValue = styled(components.MultiValue).attrs(applyDefaultTheme)`
47
+ && {
48
+ border-radius: 3px;
49
+ margin: 0;
50
+ display: flex;
51
+ align-items: center;
52
+ border: none;
53
+
54
+ ${props => props.theme.themeProp('background-color', props.theme.getColor('gray-600'), props.theme.getColor('gray-800'))}
55
+
56
+ ${props => props.$isDisabled && css`
57
+ opacity: 0.6;
58
+ cursor: not-allowed !important;
59
+
60
+ & > * {
61
+ pointer-events: none;
62
+ cursor: not-allowed !important;
63
+ }
64
+ `}
65
+
66
+ ${props => props.$isReadOnly && !props.$isDisabled && css`
67
+ cursor: default !important;
68
+ `}
69
+
70
+
71
+ & > div:first-of-type {
72
+ font-size: 12px;
73
+ min-height: 26px;
74
+ display: flex;
75
+ align-items: center;
76
+ padding: ${props => props.$isDisabled || props.$isReadOnly ? '0 8px' : '0 3px 0 8px'};
77
+ color: ${props => props.theme.getColor('gray-100')};
78
+ cursor: ${props => props.$isDisabled ? 'not-allowed' : props.$isReadOnly ? 'default' : 'pointer'};
79
+ }
80
+
81
+ /* Target the Remove Button */
82
+ .multi-select__multi-value__remove,
83
+ & > div:last-of-type {
84
+ display: flex;
85
+ align-items: center;
86
+ padding: 0 8px 0 5px;
87
+ height: 26px;
88
+ width: fit-content;
89
+ cursor: pointer;
90
+ background-color: transparent;
91
+
92
+ ${props => !props.$isDisabled && !props.$isReadOnly && css`
93
+ &:hover {
94
+ background-color: ${props.theme.getColor('red-500')} !important;
95
+ border-radius: 0 3px 3px 0;
96
+ }
97
+ `}
98
+
99
+ svg {
100
+ stroke: white;
101
+ stroke-width: 2px;
102
+ width: 8px;
103
+ }
104
+ }
105
+ }
47
106
  `;
48
- const InputWrapper = styled.div.attrs(applyDefaultTheme)`
49
- min-width: 150px;
107
+ const MultiSelect = styled(Select)`
108
+ ${sharedStyle}
109
+ `;
110
+ const CreatableMultiSelect = styled(CreatableSelect)`
111
+ ${sharedStyle}
112
+ `;
113
+ const AsyncMultiSelect = styled(AsyncPaginate)`
114
+ ${sharedStyle}
115
+ `;
116
+ const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate)`
117
+ ${sharedStyle}
118
+ `;
119
+ const InputWrapper = styled.div.withConfig({
120
+ shouldForwardProp
121
+ }).attrs(applyDefaultTheme)`
50
122
  position: relative;
51
- ${props => !props.$focused && props.$editText && css`
52
- &::before {
123
+ display: flex;
124
+ align-items: center;
125
+ min-width: 150px;
126
+
127
+ input {
128
+ color: ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))} !important;
129
+ font-size: ${props => props.$focused ? '14px' : '12px'} !important;
130
+ }
131
+
132
+ ${props => !props.$focused && css`
133
+ &:before {
53
134
  content: '${props.$editText}';
54
- color: ${p => p.theme.getColor('gray-400')};
55
- font-size: 12px;
56
135
  position: absolute;
57
- top: 50%;
58
- transform: translateY(-50%);
136
+ left: 2px;
137
+ color: ${props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
59
138
  pointer-events: none;
139
+ font-size: 12px;
60
140
  }
61
141
  `}
62
- input {
63
- color: ${props => props.theme.themeProp(props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))} !important;
142
+
143
+ ${props => props.$isDisabled && css`
144
+ opacity: 0.5;
145
+ cursor: not-allowed;
146
+ pointer-events: none;
147
+ `};
148
+ `;
149
+ const DropdownMenu = styled(components.Menu).attrs(applyDefaultTheme)`
150
+ font-size: 14px;
151
+
152
+ ${props => props.theme.themeProp('background-color', props.theme.getColor('gray-600'), props.theme.getColor('white'))}
153
+
154
+ ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
155
+ `;
156
+ const sharedOptionStyle = css`
157
+ ${props => props.isFocused && css`
158
+ ${props.theme.themeProp('background-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-200'))}
159
+ `}
160
+
161
+ ${props => props.isSelected && css`
162
+ ${props.theme.themeProp('background-color', 'transparent', 'transparent')}
163
+
164
+ ${props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
165
+ `}
166
+
167
+ ${props => props.isFocused && props.isSelected && css`
168
+ ${props.theme.themeProp('background-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-200'))}
169
+ `}
170
+
171
+ :hover {
172
+ cursor: pointer;
64
173
  }
65
174
  `;
66
- const OptionContent = styled.div`
67
- display: flex;
175
+ const Option = styled(components.Option).attrs(applyDefaultTheme)`
176
+ ${sharedOptionStyle}
177
+ padding: 8px 12px;
178
+ `;
179
+ const SelectedOption = styled(components.Option).attrs(applyDefaultTheme)`
180
+ ${sharedOptionStyle}
181
+ display: flex !important;
68
182
  justify-content: space-between;
69
183
  align-items: center;
70
184
  padding: 8px 12px;
71
- width: 100%;
72
- font-size: 14px;
73
- color: inherit;
74
185
  `;
75
- styled.div`
76
- [class*='menu'] {
77
- z-index: 9999 !important;
78
- border-radius: 4px;
79
- }
80
- `;
81
- const DropdownOptionDeleteIcon = styled(SvgClose).attrs(applyDefaultTheme)`
186
+ const DropdownOptionDeleteIcon = styled(SvgClose).withConfig({
187
+ shouldForwardProp
188
+ }).attrs(applyDefaultTheme)`
189
+ stroke-width: 1px;
82
190
  width: 8px;
83
- stroke: ${props => props.theme.themeProp(props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))};
191
+ ${props => props.theme.themeProp('stroke', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
84
192
  `;
85
- const ShowMoreWrapper = styled.div.attrs(applyDefaultTheme)`
193
+ const ShowMoreWrapper = styled.div.withConfig({
194
+ shouldForwardProp
195
+ }).attrs(applyDefaultTheme)`
196
+ align-items: end;
197
+ display: flex;
198
+ flex-direction: column;
199
+ height: 100%;
200
+ left: 0;
86
201
  position: absolute;
202
+ max-height: ${showMoreHeight + 16}px;
87
203
  top: 0;
88
- left: 0;
89
204
  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'))};
205
+ z-index: 2;
206
+ cursor: pointer;
207
+ color: ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('emerald-500'))};
96
208
  &:hover {
97
- cursor: pointer;
98
209
  text-decoration: underline;
99
210
  }
100
211
  `;
101
- 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%)')};
212
+ const ShowMoreOverlay = styled.div.withConfig({
213
+ shouldForwardProp
214
+ }).attrs(applyDefaultTheme)`
215
+ height: 100%;
216
+ max-height: ${showMoreHeight}px;
217
+ ${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
218
  `;
105
- const ShowMoreText = styled.div.attrs(applyDefaultTheme)`
106
- background-color: ${props => props.theme.themeProp('#121212', '#fefefe')};
107
- text-align: right;
219
+ const ShowMoreText = styled.div.withConfig({
220
+ shouldForwardProp
221
+ }).attrs(applyDefaultTheme)`
108
222
  font-size: 0.875rem;
223
+ width: 100%;
224
+ background-color: ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')};
109
225
  `;
110
- const ErrorMessage = styled.div.attrs(applyDefaultTheme)`
111
- color: ${props => props.$error ? props.theme.getColor('red-500') : props.theme.getColor('orange-500')};
226
+ const ErrorMessage = styled.div.withConfig({
227
+ shouldForwardProp
228
+ }).attrs(applyDefaultTheme)`
229
+ color: ${props => props.$error ? props.theme.getColor('red-500') : props.$warning ? props.theme.getColor('orange-500') : 'inherit'};
112
230
  font-size: 0.75rem;
113
231
  margin-top: 8px;
232
+ padding: 0 12px;
114
233
  `;
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
234
 
120
- export { AsyncCreatableMultiSelect, AsyncMultiSelect, Control, CreatableMultiSelect, DropdownOptionDeleteIcon, ErrorMessage, InputWrapper, Label, MultiSelect, MultiSelectWrapper, MultiValueRemoveIcon, MultiValueWrapper, OptionContent, ShowMoreOverlay, ShowMoreText, ShowMoreWrapper, ValueContainer };
235
+ export { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, DropdownMenu, DropdownOptionDeleteIcon, ErrorMessage, InnerWrapper, InputWrapper, Label, MultiSelect, MultiSelectWrapper, MultiValue, Option, SelectedOption, ShowMoreOverlay, ShowMoreText, ShowMoreWrapper };
121
236
  //# 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;AAEM,MAAMC,cAAc,GAAGZ,MAAM,CAACC,GAAG,CAACG,KAAK,CAACC,iBAAiB,CAAC,CA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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 shouldForwardProp = prop => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nconst sharedStyle = css`\n font-family: ${props => props.theme?.primaryFontFamily || 'Arial, sans-serif'};\n font-size: 12px;\n font-weight: 400;\n position: relative;\n`;\n\nexport const MultiSelectWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n position: relative;\n`;\n\nexport const InnerWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\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\n .withConfig({\n shouldForwardProp\n })\n .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 .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\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\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)\n .withConfig({\n shouldForwardProp\n })\n .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\n .withConfig({\n shouldForwardProp\n })\n .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\n .withConfig({\n shouldForwardProp\n })\n .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\n .withConfig({\n shouldForwardProp\n })\n .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\n .withConfig({\n shouldForwardProp\n })\n .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","shouldForwardProp","prop","startsWith","sharedStyle","css","props","theme","primaryFontFamily","MultiSelectWrapper","styled","div","withConfig","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,iBAAiB,GAAGC,IAAI,IAAI;EAChC,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AAClD,CAAC,CAAA;AAED,MAAMC,WAAW,GAAGC,GAAG,CAAA;AACvB,eAAiBC,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,EAAEC,iBAAiB,IAAI,mBAAmB,CAAA;AAC/E;AACA;AACA;AACA,CAAC,CAAA;AAE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A;AACA;AACA;;;;"}
@@ -59,7 +59,16 @@ function applyDefaultTheme({
59
59
  }) {
60
60
  return {
61
61
  ...props,
62
- theme: Object.assign({}, defaultTheme, theme)
62
+ theme: {
63
+ ...defaultTheme,
64
+ ...theme,
65
+ getColor: typeof theme.getColor === 'function' ? theme.getColor : defaultTheme.getColor,
66
+ themeProp: typeof theme.themeProp === 'function' ? theme.themeProp : defaultTheme.themeProp,
67
+ primaryFontFamily: theme.primaryFontFamily || defaultTheme.primaryFontFamily,
68
+ secondaryFontFamily: theme.secondaryFontFamily || defaultTheme.secondaryFontFamily,
69
+ spacing: theme.spacing || defaultTheme.spacing,
70
+ colors: theme.colors || defaultTheme.colors
71
+ }
63
72
  };
64
73
  }
65
74
 
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTheme.js","sources":["../../src/utils/defaultTheme.js"],"sourcesContent":["import { colors } from '../styles/utils/colors-export';\nimport { css } from 'styled-components';\n\nexport const defaultTheme = {\n getColor: name => {\n if (!colors[name]) throw Error(`The color \"${name}\" is not registered.`);\n return colors[name];\n },\n primaryFontFamily: \"'Roboto', sans-serif\",\n secondaryFontFamily: \"'Overpass', sans-serif\",\n themeProp,\n spacing: {\n baseUnit: 4,\n controlHeight: 38,\n menuGutter: 8\n },\n colors: {\n // MINIMUM REQUIRED COLORS FOR REACT-SELECT\n primary: colors['emerald-500'],\n primary75: colors['emerald-400'],\n primary50: colors['emerald-300'],\n primary25: colors['emerald-200'],\n danger: colors['red-500'],\n neutral0: colors['white'],\n neutral5: colors['gray-50'],\n neutral10: colors['gray-100'],\n neutral20: colors['gray-300'],\n neutral30: colors['gray-400'],\n neutral40: colors['gray-500'],\n neutral50: colors['gray-600'],\n neutral60: colors['gray-700'],\n neutral70: colors['gray-800'],\n neutral80: colors['gray-900'],\n neutral90: colors['black']\n }\n};\n\n/**\n * Applies a different css property value for dark and light mode\n * @param {string} property - The css property to apply - Eg: `color`, `background`\n * @param {string} darkMode - The value that will be applied in dark mode\n * @param {string} lightMode - The value that will be applied in light mode - Will also be used if either dark or light mode is set\n * @param specificity\n */\nfunction themeProp(property, darkMode, lightMode, specificity = 2) {\n const specificityString = Array(specificity).fill('&').join('');\n\n return css`\n body.dark-theme ${specificityString} {\n ${property}: ${darkMode};\n }\n\n body.light-theme ${specificityString} {\n ${property}: ${lightMode};\n }\n\n body:not(.light-theme):not(.dark-theme) ${specificityString} {\n ${property}: ${lightMode};\n\n @media (prefers-color-scheme: dark) {\n ${property}: ${darkMode};\n }\n }\n `;\n}\n\nexport function applyDefaultTheme({ theme = {}, ...props }) {\n return {\n ...props,\n theme: Object.assign({}, defaultTheme, theme)\n };\n}\n"],"names":["defaultTheme","getColor","name","colors","Error","primaryFontFamily","secondaryFontFamily","themeProp","spacing","baseUnit","controlHeight","menuGutter","primary","primary75","primary50","primary25","danger","neutral0","neutral5","neutral10","neutral20","neutral30","neutral40","neutral50","neutral60","neutral70","neutral80","neutral90","property","darkMode","lightMode","specificity","specificityString","Array","fill","join","css","applyDefaultTheme","theme","props","Object","assign"],"mappings":";;;AAGO,MAAMA,YAAY,GAAG;EAC1BC,QAAQ,EAAEC,IAAI,IAAI;AAChB,IAAA,IAAI,CAACC,MAAM,CAACD,IAAI,CAAC,EAAE,MAAME,KAAK,CAAC,CAAA,WAAA,EAAcF,IAAI,CAAA,oBAAA,CAAsB,CAAC,CAAA;IACxE,OAAOC,MAAM,CAACD,IAAI,CAAC,CAAA;GACpB;AACDG,EAAAA,iBAAiB,EAAE,sBAAsB;AACzCC,EAAAA,mBAAmB,EAAE,wBAAwB;EAC7CC,SAAS;AACTC,EAAAA,OAAO,EAAE;AACPC,IAAAA,QAAQ,EAAE,CAAC;AACXC,IAAAA,aAAa,EAAE,EAAE;AACjBC,IAAAA,UAAU,EAAE,CAAA;GACb;AACDR,EAAAA,MAAM,EAAE;AAENS,IAAAA,OAAO,EAAET,MAAM,CAAC,aAAa,CAAC;AAC9BU,IAAAA,SAAS,EAAEV,MAAM,CAAC,aAAa,CAAC;AA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,iBAAiB,CAAA;AAC/D,MAAQJ,EAAAA,QAAQ,KAAKE,SAAS,CAAA;AAC9B;AACA;AACA,QAAUF,EAAAA,QAAQ,KAAKC,QAAQ,CAAA;AAC/B;AACA;AACA,EAAG,CAAA,CAAA;AACH,CAAA;AAEO,SAASQ,iBAAiBA,CAAC;EAAEC,KAAK,GAAG,EAAE;EAAE,GAAGC,KAAAA;AAAM,CAAC,EAAE;EAC1D,OAAO;AACL,IAAA,GAAGA,KAAK;IACRD,KAAK,EAAEE,MAAM,CAACC,MAAM,CAAC,EAAE,EAAEzC,YAAY,EAAEsC,KAAK,CAAA;GAC7C,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"defaultTheme.js","sources":["../../src/utils/defaultTheme.js"],"sourcesContent":["import { colors } from '../styles/utils/colors-export';\nimport { css } from 'styled-components';\n\nexport const defaultTheme = {\n getColor: name => {\n if (!colors[name]) throw Error(`The color \"${name}\" is not registered.`);\n return colors[name];\n },\n primaryFontFamily: \"'Roboto', sans-serif\",\n secondaryFontFamily: \"'Overpass', sans-serif\",\n themeProp,\n spacing: {\n baseUnit: 4,\n controlHeight: 38,\n menuGutter: 8\n },\n colors: {\n primary: colors['emerald-500'],\n primary75: colors['emerald-400'],\n primary50: colors['emerald-300'],\n primary25: colors['emerald-200'],\n danger: colors['red-500'],\n neutral0: colors['white'],\n neutral5: colors['gray-50'],\n neutral10: colors['gray-100'],\n neutral20: colors['gray-300'],\n neutral30: colors['gray-400'],\n neutral40: colors['gray-500'],\n neutral50: colors['gray-600'],\n neutral60: colors['gray-700'],\n neutral70: colors['gray-800'],\n neutral80: colors['gray-900'],\n neutral90: colors['black']\n }\n};\n\n/**\n * Applies a different css property value for dark and light mode\n * @param {string} property - The css property to apply - Eg: `color`, `background`\n * @param {string} darkMode - The value that will be applied in dark mode\n * @param {string} lightMode - The value that will be applied in light mode - Will also be used if either dark or light mode is set\n * @param specificity\n */\nfunction themeProp(property, darkMode, lightMode, specificity = 2) {\n const specificityString = Array(specificity).fill('&').join('');\n\n return css`\n body.dark-theme ${specificityString} {\n ${property}: ${darkMode};\n }\n\n body.light-theme ${specificityString} {\n ${property}: ${lightMode};\n }\n\n body:not(.light-theme):not(.dark-theme) ${specificityString} {\n ${property}: ${lightMode};\n\n @media (prefers-color-scheme: dark) {\n ${property}: ${darkMode};\n }\n }\n `;\n}\n\nexport function applyDefaultTheme({ theme = {}, ...props }) {\n return {\n ...props,\n theme: {\n ...defaultTheme,\n ...theme,\n getColor: typeof theme.getColor === 'function' ? theme.getColor : defaultTheme.getColor,\n themeProp: typeof theme.themeProp === 'function' ? theme.themeProp : defaultTheme.themeProp,\n primaryFontFamily: theme.primaryFontFamily || defaultTheme.primaryFontFamily,\n secondaryFontFamily: theme.secondaryFontFamily || defaultTheme.secondaryFontFamily,\n spacing: theme.spacing || defaultTheme.spacing,\n colors: theme.colors || defaultTheme.colors\n }\n };\n}\n"],"names":["defaultTheme","getColor","name","colors","Error","primaryFontFamily","secondaryFontFamily","themeProp","spacing","baseUnit","controlHeight","menuGutter","primary","primary75","primary50","primary25","danger","neutral0","neutral5","neutral10","neutral20","neutral30","neutral40","neutral50","neutral60","neutral70","neutral80","neutral90","property","darkMode","lightMode","specificity","specificityString","Array","fill","join","css","applyDefaultTheme","theme","props"],"mappings":";;;AAGO,MAAMA,YAAY,GAAG;EAC1BC,QAAQ,EAAEC,IAAI,IAAI;AAChB,IAAA,IAAI,CAACC,MAAM,CAACD,IAAI,CAAC,EAAE,MAAME,KAAK,CAAC,CAAA,WAAA,EAAcF,IAAI,CAAA,oBAAA,CAAsB,CAAC,CAAA;IACxE,OAAOC,MAAM,CAACD,IAAI,CAAC,CAAA;GACpB;AACDG,EAAAA,iBAAiB,EAAE,sBAAsB;AACzCC,EAAAA,mBAAmB,EAAE,wBAAwB;EAC7CC,SAAS;AACTC,EAAAA,OAAO,EAAE;AACPC,IAAAA,QAAQ,EAAE,CAAC;AACXC,IAAAA,aAAa,EAAE,EAAE;AACjBC,IAAAA,UAA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
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",