@talixo-ds/options-input 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/min-max-value-label.d.ts +3 -2
- package/dist/components/min-max-value-label.js +2 -2
- package/dist/components/min-max-value-label.js.map +1 -1
- package/dist/components/options-input-content-item.d.ts +2 -2
- package/dist/components/options-input-content-item.js +10 -10
- package/dist/components/options-input-content-item.js.map +1 -1
- package/dist/components/options-input-dropdown-item.d.ts +4 -3
- package/dist/components/options-input-dropdown-item.js +31 -31
- package/dist/components/options-input-dropdown-item.js.map +1 -1
- package/dist/options-input.d.ts +9 -9
- package/dist/options-input.js +44 -47
- package/dist/options-input.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/options-input.spec.tsx +147 -0
- package/src/__tests__/utils.spec.ts +12 -0
- package/src/components/__tests__/min-max-value-label.spec.tsx +19 -19
- package/src/components/__tests__/options-input-content-item.spec.tsx +52 -60
- package/src/components/__tests__/options-input-dropdown-item.spec.tsx +74 -85
- package/src/components/min-max-value-label.tsx +10 -15
- package/src/components/options-input-content-item.tsx +47 -54
- package/src/components/options-input-dropdown-item.tsx +133 -138
- package/src/options-input.tsx +247 -251
- package/src/utils.ts +1 -0
- package/tsconfig.build.json +8 -0
- package/__tests__/__snapshots__/options-input.spec.tsx.snap +0 -119
- package/__tests__/options-input.spec.tsx +0 -242
- package/dist/components/__tests__/min-max-value-label.spec.d.ts +0 -1
- package/dist/components/__tests__/min-max-value-label.spec.js +0 -21
- package/dist/components/__tests__/min-max-value-label.spec.js.map +0 -1
- package/dist/components/__tests__/options-input-content-item.spec.d.ts +0 -1
- package/dist/components/__tests__/options-input-content-item.spec.js +0 -49
- package/dist/components/__tests__/options-input-content-item.spec.js.map +0 -1
- package/dist/components/__tests__/options-input-dropdown-item.spec.d.ts +0 -1
- package/dist/components/__tests__/options-input-dropdown-item.spec.js +0 -67
- package/dist/components/__tests__/options-input-dropdown-item.spec.js.map +0 -1
- package/src/components/__tests__/__snapshots__/min-max-value-label.spec.tsx.snap +0 -17
- package/src/components/__tests__/__snapshots__/options-input-content-item.spec.tsx.snap +0 -138
- package/src/components/__tests__/__snapshots__/options-input-dropdown-item.spec.tsx.snap +0 -134
- package/tsconfig.json +0 -8
package/src/options-input.tsx
CHANGED
|
@@ -1,274 +1,270 @@
|
|
|
1
|
-
import React, { useState, useEffect } from
|
|
2
|
-
import classNames from
|
|
3
|
-
import Box from
|
|
4
|
-
import List from
|
|
5
|
-
import Popper from
|
|
6
|
-
import ClickAwayListener from
|
|
7
|
-
import KeyboardArrowDownIcon from
|
|
8
|
-
import KeyboardArrowUpIcon from
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import type {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import './styles.scss';
|
|
1
|
+
import React, { useState, useEffect, useCallback } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import List from "@mui/material/List";
|
|
5
|
+
import Popper from "@mui/material/Popper";
|
|
6
|
+
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
7
|
+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
8
|
+
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
9
|
+
import * as DesignSystemIcons from "@talixo-ds/icons/src";
|
|
10
|
+
import type { SxProps } from "@mui/material";
|
|
11
|
+
import type { OptionsInputOption, OptionsInputValue } from "./types";
|
|
12
|
+
import OptionsInputContentItem from "./components/options-input-content-item";
|
|
13
|
+
import OptionsInputDropdownItem from "./components/options-input-dropdown-item";
|
|
14
|
+
import "./styles.scss";
|
|
16
15
|
|
|
17
|
-
import
|
|
18
|
-
import
|
|
16
|
+
import "@emotion/react";
|
|
17
|
+
import "@emotion/styled";
|
|
18
|
+
import { capitalize } from "./utils";
|
|
19
19
|
|
|
20
20
|
export type OptionsInputProps = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
21
|
+
/** Array of objects representing options available to choose from */
|
|
22
|
+
options: OptionsInputOption[];
|
|
23
|
+
/** Object with default values of some options */
|
|
24
|
+
defaultValue?: OptionsInputValue;
|
|
25
|
+
/** Array with ids of options which should remain displayed even if value is 0 */
|
|
26
|
+
persistentOptions?: string[];
|
|
27
|
+
/** Boolean to determine if input is disabled */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Boolean to determine if input is readOnly */
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
/** Boolean to determine if min and max input values should be displayed */
|
|
32
|
+
displayMinMax?: boolean;
|
|
33
|
+
/** Function which handles options input value change */
|
|
34
|
+
onChange?: (OptionsInputValue: OptionsInputValue) => void;
|
|
35
|
+
/** Function which handles options input focus event */
|
|
36
|
+
onFocus?: (OptionsInputValue: OptionsInputValue) => void;
|
|
37
|
+
/** Function which handles options input blur event */
|
|
38
|
+
onBlur?: (OptionsInputValue: OptionsInputValue) => void;
|
|
39
|
+
/** className attached to an input container */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** id attached to an input container */
|
|
42
|
+
id?: string;
|
|
43
|
+
/** data test id attached to an input container */
|
|
44
|
+
"data-testid"?: string;
|
|
45
|
+
/** Gap between input items */
|
|
46
|
+
itemsGap?: string | number;
|
|
47
|
+
/** Custom styles for container */
|
|
48
|
+
containerSx?: SxProps;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export const OptionsInput = ({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
options,
|
|
53
|
+
onChange,
|
|
54
|
+
onFocus,
|
|
55
|
+
onBlur,
|
|
56
|
+
persistentOptions = [],
|
|
57
|
+
defaultValue,
|
|
58
|
+
displayMinMax = false,
|
|
59
|
+
disabled = false,
|
|
60
|
+
readOnly = false,
|
|
61
|
+
id,
|
|
62
|
+
className,
|
|
63
|
+
itemsGap = 1,
|
|
64
|
+
containerSx = [],
|
|
65
|
+
...rest
|
|
66
66
|
}: OptionsInputProps) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
const [anchorEl, setAnchorEl] = useState<undefined | HTMLElement>();
|
|
72
|
-
const open = !!anchorEl;
|
|
67
|
+
const [currentOptions, setCurrentOptions] = useState<OptionsInputOption[]>([]);
|
|
68
|
+
const [anchorEl, setAnchorEl] = useState<undefined | HTMLElement>();
|
|
69
|
+
const open = !!anchorEl;
|
|
73
70
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
useEffect(
|
|
72
|
+
() =>
|
|
73
|
+
setCurrentOptions(
|
|
74
|
+
options.map((option) => {
|
|
75
|
+
const defaultQuantity = defaultValue?.[option.id] ?? 0;
|
|
76
|
+
const minQuantity =
|
|
77
|
+
typeof option?.min === "number" && defaultQuantity < option.min
|
|
78
|
+
? option.min
|
|
79
|
+
: defaultQuantity;
|
|
80
|
+
const quantity =
|
|
81
|
+
typeof option?.max === "number" && minQuantity > option.max ? option.max : minQuantity;
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
return {
|
|
84
|
+
...option,
|
|
85
|
+
quantity,
|
|
86
|
+
inputQuantity: quantity
|
|
87
|
+
};
|
|
88
|
+
})
|
|
89
|
+
),
|
|
90
|
+
[options, defaultValue]
|
|
91
|
+
);
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
const toggleInput = useCallback(
|
|
94
|
+
(event: React.MouseEvent<HTMLElement>) => {
|
|
95
|
+
const { currentTarget } = event;
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
if (!disabled && !readOnly) {
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
setAnchorEl((currentAnchor) => (currentAnchor ? undefined : currentTarget));
|
|
100
|
+
}, 0);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
[disabled, readOnly, setAnchorEl]
|
|
104
|
+
);
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
const onInputFocus = () => {
|
|
107
|
+
if (onFocus) {
|
|
108
|
+
onFocus(
|
|
109
|
+
currentOptions.reduce(
|
|
110
|
+
(currentValues, currentOption) => ({
|
|
111
|
+
...currentValues,
|
|
112
|
+
[currentOption.id]: currentOption.quantity
|
|
113
|
+
}),
|
|
114
|
+
{}
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
const onInputBlur = () => {
|
|
121
|
+
if (onBlur) {
|
|
122
|
+
onBlur(
|
|
123
|
+
currentOptions.reduce(
|
|
124
|
+
(currentValues, currentOption) => ({
|
|
125
|
+
...currentValues,
|
|
126
|
+
[currentOption.id]: currentOption.quantity
|
|
127
|
+
}),
|
|
128
|
+
{}
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
const onValueChange = (optionId: string, newValue: string | number) => {
|
|
135
|
+
const newQuantity = Number.isNaN(Number(newValue)) ? 0 : Number(newValue);
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
newQuantity > (option.max || Infinity) ? option.max : newQuantity;
|
|
137
|
+
const newCurrentOptions = currentOptions.map((option) => {
|
|
138
|
+
const maxQuantity = newQuantity > (option.max || Infinity) ? option.max : newQuantity;
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
});
|
|
140
|
+
return {
|
|
141
|
+
...option,
|
|
142
|
+
...(optionId === option.id && {
|
|
143
|
+
quantity: newQuantity < (option.min || -Infinity) ? option.min : maxQuantity,
|
|
144
|
+
inputQuantity: newValue
|
|
145
|
+
})
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
149
|
+
if (onChange) {
|
|
150
|
+
onChange(
|
|
151
|
+
newCurrentOptions.reduce(
|
|
152
|
+
(currentValues, currentOption) => ({
|
|
153
|
+
...currentValues,
|
|
154
|
+
[currentOption.id]: currentOption.quantity
|
|
155
|
+
}),
|
|
156
|
+
{}
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
setCurrentOptions(newCurrentOptions);
|
|
162
|
+
};
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
const onDropdownItemBlur = (optionId: string) => () =>
|
|
165
|
+
setCurrentOptions(
|
|
166
|
+
currentOptions.map((option) => {
|
|
167
|
+
if (optionId !== option.id) return option;
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
finalQuantity > (option.max || Infinity) ? option.max : finalQuantity;
|
|
169
|
+
const finalQuantity = Number.isNaN(Number(option.inputQuantity))
|
|
170
|
+
? 0
|
|
171
|
+
: Number(option.inputQuantity);
|
|
172
|
+
const maxQuantity = finalQuantity > (option.max || Infinity) ? option.max : finalQuantity;
|
|
174
173
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
};
|
|
182
|
-
})
|
|
183
|
-
);
|
|
174
|
+
return {
|
|
175
|
+
...option,
|
|
176
|
+
inputQuantity: finalQuantity < (option.min || -Infinity) ? option.min : maxQuantity
|
|
177
|
+
};
|
|
178
|
+
})
|
|
179
|
+
);
|
|
184
180
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
181
|
+
return (
|
|
182
|
+
<>
|
|
183
|
+
<Box
|
|
184
|
+
id={id}
|
|
185
|
+
onClick={toggleInput}
|
|
186
|
+
onBlur={onInputBlur}
|
|
187
|
+
onFocus={onInputFocus}
|
|
188
|
+
className={classNames("options-input__container", {
|
|
189
|
+
"options-input__container--open": open,
|
|
190
|
+
"options-input__container--disabled": disabled,
|
|
191
|
+
"options-input__container--read-only": readOnly,
|
|
192
|
+
className
|
|
193
|
+
})}
|
|
194
|
+
sx={[
|
|
195
|
+
{ "&:hover": { borderColor: "#d3d3d3" } },
|
|
196
|
+
...(Array.isArray(containerSx) ? containerSx : [containerSx]),
|
|
197
|
+
open && {
|
|
198
|
+
borderColor: (theme) => theme.palette.primary.main,
|
|
199
|
+
"&:hover": { borderColor: (theme) => theme.palette.primary.main }
|
|
200
|
+
}
|
|
201
|
+
]}
|
|
202
|
+
data-testid={rest["data-testid"] || "options-input-container"}
|
|
203
|
+
tabIndex={0}
|
|
204
|
+
>
|
|
205
|
+
<Box display="flex" gap={itemsGap}>
|
|
206
|
+
{currentOptions
|
|
207
|
+
.filter(
|
|
208
|
+
({ quantity, id: optionId, icon }) =>
|
|
209
|
+
!!(
|
|
210
|
+
DesignSystemIcons[capitalize(icon) as keyof typeof DesignSystemIcons] &&
|
|
211
|
+
(quantity !== 0 || persistentOptions.includes(optionId))
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
.map((option) => (
|
|
215
|
+
<OptionsInputContentItem
|
|
216
|
+
key={option.id}
|
|
217
|
+
item={option}
|
|
218
|
+
disabled={disabled}
|
|
219
|
+
displayMinMax={displayMinMax}
|
|
220
|
+
/>
|
|
221
|
+
))}
|
|
222
|
+
</Box>
|
|
223
|
+
{!readOnly &&
|
|
224
|
+
(open ? (
|
|
225
|
+
<KeyboardArrowUpIcon color="primary" />
|
|
226
|
+
) : (
|
|
227
|
+
<KeyboardArrowDownIcon
|
|
228
|
+
sx={{
|
|
229
|
+
color: (theme) => (disabled ? theme.palette.grey[400] : theme.palette.action.focus)
|
|
230
|
+
}}
|
|
231
|
+
/>
|
|
232
|
+
))}
|
|
233
|
+
</Box>
|
|
234
|
+
<ClickAwayListener onClickAway={() => open && setAnchorEl(undefined)}>
|
|
235
|
+
<Popper
|
|
236
|
+
open={open}
|
|
237
|
+
placement="bottom-start"
|
|
238
|
+
anchorEl={anchorEl}
|
|
239
|
+
sx={(theme) => ({ zIndex: theme.zIndex.modal })}
|
|
240
|
+
>
|
|
241
|
+
<List
|
|
242
|
+
disablePadding
|
|
243
|
+
data-testid="options-dropdown-list"
|
|
244
|
+
className="options-input__dropdown-items-list"
|
|
245
|
+
sx={{
|
|
246
|
+
bgcolor: "Background",
|
|
247
|
+
border: (theme) => `thin solid ${theme.palette.primary.main}`
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
{currentOptions
|
|
251
|
+
.filter(
|
|
252
|
+
({ icon }) =>
|
|
253
|
+
!!DesignSystemIcons[capitalize(icon) as keyof typeof DesignSystemIcons]
|
|
254
|
+
)
|
|
255
|
+
.map((option, index) => (
|
|
256
|
+
<OptionsInputDropdownItem
|
|
257
|
+
key={option.id}
|
|
258
|
+
item={option}
|
|
259
|
+
onBlur={onDropdownItemBlur(option.id)}
|
|
260
|
+
onChange={onValueChange}
|
|
261
|
+
index={index}
|
|
262
|
+
displayMinMax={displayMinMax}
|
|
263
|
+
/>
|
|
264
|
+
))}
|
|
265
|
+
</List>
|
|
266
|
+
</Popper>
|
|
267
|
+
</ClickAwayListener>
|
|
268
|
+
</>
|
|
269
|
+
);
|
|
274
270
|
};
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`OptionsInput > snapshots > should match snapshot 1`] = `
|
|
4
|
-
<React.Fragment>
|
|
5
|
-
<ForwardRef(Box)
|
|
6
|
-
className="options-input__container options-input__container--open test-class"
|
|
7
|
-
data-testid="options-input-container"
|
|
8
|
-
id="test-id"
|
|
9
|
-
onBlur={[Function]}
|
|
10
|
-
onClick={[Function]}
|
|
11
|
-
onFocus={[Function]}
|
|
12
|
-
sx={
|
|
13
|
-
[
|
|
14
|
-
{
|
|
15
|
-
"&:hover": {
|
|
16
|
-
"borderColor": "#d3d3d3",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"&:hover": {
|
|
21
|
-
"borderColor": [Function],
|
|
22
|
-
},
|
|
23
|
-
"borderColor": [Function],
|
|
24
|
-
},
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
tabIndex={0}
|
|
28
|
-
>
|
|
29
|
-
<ForwardRef(Box)
|
|
30
|
-
display="flex"
|
|
31
|
-
gap={1}
|
|
32
|
-
/>
|
|
33
|
-
<Memo
|
|
34
|
-
color="primary"
|
|
35
|
-
/>
|
|
36
|
-
</ForwardRef(Box)>
|
|
37
|
-
<ClickAwayListener
|
|
38
|
-
onClickAway={[Function]}
|
|
39
|
-
>
|
|
40
|
-
<ForwardRef(Popper)
|
|
41
|
-
anchorEl={[]}
|
|
42
|
-
open={true}
|
|
43
|
-
placement="bottom-start"
|
|
44
|
-
sx={[Function]}
|
|
45
|
-
>
|
|
46
|
-
<ForwardRef(List)
|
|
47
|
-
className="options-input__dropdown-items-list"
|
|
48
|
-
data-testid="options-dropdown-list"
|
|
49
|
-
disablePadding={true}
|
|
50
|
-
sx={
|
|
51
|
-
{
|
|
52
|
-
"bgcolor": "Background",
|
|
53
|
-
"border": [Function],
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/>
|
|
57
|
-
</ForwardRef(Popper)>
|
|
58
|
-
</ClickAwayListener>
|
|
59
|
-
</React.Fragment>
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
exports[`OptionsInput > snapshots > should render disabled input properly 1`] = `
|
|
63
|
-
<React.Fragment>
|
|
64
|
-
<ForwardRef(Box)
|
|
65
|
-
className="options-input__container options-input__container--open options-input__container--disabled test-class"
|
|
66
|
-
data-testid="options-input-container"
|
|
67
|
-
id="test-id"
|
|
68
|
-
onBlur={[Function]}
|
|
69
|
-
onClick={[Function]}
|
|
70
|
-
onFocus={[Function]}
|
|
71
|
-
sx={
|
|
72
|
-
[
|
|
73
|
-
{
|
|
74
|
-
"&:hover": {
|
|
75
|
-
"borderColor": "#d3d3d3",
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"&:hover": {
|
|
80
|
-
"borderColor": [Function],
|
|
81
|
-
},
|
|
82
|
-
"borderColor": [Function],
|
|
83
|
-
},
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
tabIndex={0}
|
|
87
|
-
>
|
|
88
|
-
<ForwardRef(Box)
|
|
89
|
-
display="flex"
|
|
90
|
-
gap={1}
|
|
91
|
-
/>
|
|
92
|
-
<Memo
|
|
93
|
-
color="primary"
|
|
94
|
-
/>
|
|
95
|
-
</ForwardRef(Box)>
|
|
96
|
-
<ClickAwayListener
|
|
97
|
-
onClickAway={[Function]}
|
|
98
|
-
>
|
|
99
|
-
<ForwardRef(Popper)
|
|
100
|
-
anchorEl={[]}
|
|
101
|
-
open={true}
|
|
102
|
-
placement="bottom-start"
|
|
103
|
-
sx={[Function]}
|
|
104
|
-
>
|
|
105
|
-
<ForwardRef(List)
|
|
106
|
-
className="options-input__dropdown-items-list"
|
|
107
|
-
data-testid="options-dropdown-list"
|
|
108
|
-
disablePadding={true}
|
|
109
|
-
sx={
|
|
110
|
-
{
|
|
111
|
-
"bgcolor": "Background",
|
|
112
|
-
"border": [Function],
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/>
|
|
116
|
-
</ForwardRef(Popper)>
|
|
117
|
-
</ClickAwayListener>
|
|
118
|
-
</React.Fragment>
|
|
119
|
-
`;
|