@talixo-ds/options-input 0.0.21 → 0.0.23
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/__snapshots__/options-input.spec.tsx.snap +251 -0
- package/dist/components/min-max-value-label.d.ts +6 -0
- package/dist/components/min-max-value-label.js +4 -0
- package/dist/components/min-max-value-label.js.map +1 -0
- package/dist/components/options-input-content-item.d.ts +8 -0
- package/dist/components/options-input-content-item.js +14 -0
- package/dist/components/options-input-content-item.js.map +1 -0
- package/dist/components/options-input-dropdown-item.d.ts +10 -0
- package/dist/components/options-input-dropdown-item.js +60 -0
- package/dist/components/options-input-dropdown-item.js.map +1 -0
- package/dist/components/tests/__snapshots__/min-max-value-label.spec.tsx.snap +17 -0
- package/dist/components/tests/__snapshots__/options-input-content-item.spec.tsx.snap +138 -0
- package/dist/components/tests/__snapshots__/options-input-dropdown-item.spec.tsx.snap +134 -0
- package/dist/components/tests/min-max-value-label.spec.d.ts +1 -0
- package/dist/components/tests/min-max-value-label.spec.js +21 -0
- package/dist/components/tests/min-max-value-label.spec.js.map +1 -0
- package/dist/components/tests/options-input-content-item.spec.d.ts +1 -0
- package/dist/components/tests/options-input-content-item.spec.js +43 -0
- package/dist/components/tests/options-input-content-item.spec.js.map +1 -0
- package/dist/components/tests/options-input-dropdown-item.spec.d.ts +1 -0
- package/dist/components/tests/options-input-dropdown-item.spec.js +61 -0
- package/dist/components/tests/options-input-dropdown-item.spec.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/options-input.composition.d.ts +4 -0
- package/dist/options-input.composition.js +42 -0
- package/dist/options-input.composition.js.map +1 -0
- package/dist/options-input.d.ts +36 -0
- package/dist/options-input.docs.mdx +157 -0
- package/dist/options-input.js +130 -0
- package/dist/options-input.js.map +1 -0
- package/dist/options-input.spec.d.ts +1 -0
- package/dist/options-input.spec.js +162 -0
- package/dist/options-input.spec.js.map +1 -0
- package/dist/preview-1718288241661.js +7 -0
- package/dist/styles.scss +54 -0
- package/dist/tsconfig.json +40 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`OptionsInput snapshots should match snapshot 1`] = `
|
|
4
|
+
<React.Fragment>
|
|
5
|
+
<ForwardRef(Box)
|
|
6
|
+
className="options-input__container 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
|
+
false,
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
tabIndex={0}
|
|
23
|
+
>
|
|
24
|
+
<ForwardRef(Box)
|
|
25
|
+
display="flex"
|
|
26
|
+
gap={1}
|
|
27
|
+
>
|
|
28
|
+
<OptionsInputContentItem
|
|
29
|
+
disabled={false}
|
|
30
|
+
displayMinMax={false}
|
|
31
|
+
item={
|
|
32
|
+
{
|
|
33
|
+
"details": "This is your luggage",
|
|
34
|
+
"icon": "luggage",
|
|
35
|
+
"id": "luggage",
|
|
36
|
+
"inputQuantity": 1,
|
|
37
|
+
"label": "luggage",
|
|
38
|
+
"max": 9,
|
|
39
|
+
"min": 0,
|
|
40
|
+
"quantity": 1,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
44
|
+
<OptionsInputContentItem
|
|
45
|
+
disabled={false}
|
|
46
|
+
displayMinMax={false}
|
|
47
|
+
item={
|
|
48
|
+
{
|
|
49
|
+
"icon": "football",
|
|
50
|
+
"id": "sport-equipment",
|
|
51
|
+
"inputQuantity": 1,
|
|
52
|
+
"label": "sport equipment",
|
|
53
|
+
"max": 1,
|
|
54
|
+
"min": 0,
|
|
55
|
+
"quantity": 1,
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/>
|
|
59
|
+
</ForwardRef(Box)>
|
|
60
|
+
<Memo
|
|
61
|
+
sx={
|
|
62
|
+
{
|
|
63
|
+
"color": [Function],
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
</ForwardRef(Box)>
|
|
68
|
+
<ClickAwayListener
|
|
69
|
+
onClickAway={[Function]}
|
|
70
|
+
>
|
|
71
|
+
<ForwardRef(Popper)
|
|
72
|
+
open={false}
|
|
73
|
+
placement="bottom-start"
|
|
74
|
+
sx={[Function]}
|
|
75
|
+
>
|
|
76
|
+
<ForwardRef(List)
|
|
77
|
+
className="options-input__dropdown-items-list"
|
|
78
|
+
data-testid="options-dropdown-list"
|
|
79
|
+
disablePadding={true}
|
|
80
|
+
sx={
|
|
81
|
+
{
|
|
82
|
+
"bgcolor": "Background",
|
|
83
|
+
"border": [Function],
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
<OptionsInputDropdownItem
|
|
88
|
+
displayMinMax={false}
|
|
89
|
+
index={0}
|
|
90
|
+
item={
|
|
91
|
+
{
|
|
92
|
+
"details": "This is your luggage",
|
|
93
|
+
"icon": "luggage",
|
|
94
|
+
"id": "luggage",
|
|
95
|
+
"inputQuantity": 1,
|
|
96
|
+
"label": "luggage",
|
|
97
|
+
"max": 9,
|
|
98
|
+
"min": 0,
|
|
99
|
+
"quantity": 1,
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
onBlur={[Function]}
|
|
103
|
+
onChange={[Function]}
|
|
104
|
+
/>
|
|
105
|
+
<OptionsInputDropdownItem
|
|
106
|
+
displayMinMax={false}
|
|
107
|
+
index={1}
|
|
108
|
+
item={
|
|
109
|
+
{
|
|
110
|
+
"icon": "football",
|
|
111
|
+
"id": "sport-equipment",
|
|
112
|
+
"inputQuantity": 1,
|
|
113
|
+
"label": "sport equipment",
|
|
114
|
+
"max": 1,
|
|
115
|
+
"min": 0,
|
|
116
|
+
"quantity": 1,
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
onBlur={[Function]}
|
|
120
|
+
onChange={[Function]}
|
|
121
|
+
/>
|
|
122
|
+
</ForwardRef(List)>
|
|
123
|
+
</ForwardRef(Popper)>
|
|
124
|
+
</ClickAwayListener>
|
|
125
|
+
</React.Fragment>
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
exports[`OptionsInput snapshots should render disabled input properly 1`] = `
|
|
129
|
+
<React.Fragment>
|
|
130
|
+
<ForwardRef(Box)
|
|
131
|
+
className="options-input__container options-input__container--disabled test-class"
|
|
132
|
+
data-testid="options-input-container"
|
|
133
|
+
id="test-id"
|
|
134
|
+
onBlur={[Function]}
|
|
135
|
+
onClick={[Function]}
|
|
136
|
+
onFocus={[Function]}
|
|
137
|
+
sx={
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
"&:hover": {
|
|
141
|
+
"borderColor": "#d3d3d3",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
false,
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
tabIndex={0}
|
|
148
|
+
>
|
|
149
|
+
<ForwardRef(Box)
|
|
150
|
+
display="flex"
|
|
151
|
+
gap={1}
|
|
152
|
+
>
|
|
153
|
+
<OptionsInputContentItem
|
|
154
|
+
disabled={true}
|
|
155
|
+
displayMinMax={false}
|
|
156
|
+
item={
|
|
157
|
+
{
|
|
158
|
+
"details": "This is your luggage",
|
|
159
|
+
"icon": "luggage",
|
|
160
|
+
"id": "luggage",
|
|
161
|
+
"inputQuantity": 1,
|
|
162
|
+
"label": "luggage",
|
|
163
|
+
"max": 9,
|
|
164
|
+
"min": 0,
|
|
165
|
+
"quantity": 1,
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/>
|
|
169
|
+
<OptionsInputContentItem
|
|
170
|
+
disabled={true}
|
|
171
|
+
displayMinMax={false}
|
|
172
|
+
item={
|
|
173
|
+
{
|
|
174
|
+
"icon": "football",
|
|
175
|
+
"id": "sport-equipment",
|
|
176
|
+
"inputQuantity": 1,
|
|
177
|
+
"label": "sport equipment",
|
|
178
|
+
"max": 1,
|
|
179
|
+
"min": 0,
|
|
180
|
+
"quantity": 1,
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/>
|
|
184
|
+
</ForwardRef(Box)>
|
|
185
|
+
<Memo
|
|
186
|
+
sx={
|
|
187
|
+
{
|
|
188
|
+
"color": [Function],
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/>
|
|
192
|
+
</ForwardRef(Box)>
|
|
193
|
+
<ClickAwayListener
|
|
194
|
+
onClickAway={[Function]}
|
|
195
|
+
>
|
|
196
|
+
<ForwardRef(Popper)
|
|
197
|
+
open={false}
|
|
198
|
+
placement="bottom-start"
|
|
199
|
+
sx={[Function]}
|
|
200
|
+
>
|
|
201
|
+
<ForwardRef(List)
|
|
202
|
+
className="options-input__dropdown-items-list"
|
|
203
|
+
data-testid="options-dropdown-list"
|
|
204
|
+
disablePadding={true}
|
|
205
|
+
sx={
|
|
206
|
+
{
|
|
207
|
+
"bgcolor": "Background",
|
|
208
|
+
"border": [Function],
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
>
|
|
212
|
+
<OptionsInputDropdownItem
|
|
213
|
+
displayMinMax={false}
|
|
214
|
+
index={0}
|
|
215
|
+
item={
|
|
216
|
+
{
|
|
217
|
+
"details": "This is your luggage",
|
|
218
|
+
"icon": "luggage",
|
|
219
|
+
"id": "luggage",
|
|
220
|
+
"inputQuantity": 1,
|
|
221
|
+
"label": "luggage",
|
|
222
|
+
"max": 9,
|
|
223
|
+
"min": 0,
|
|
224
|
+
"quantity": 1,
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
onBlur={[Function]}
|
|
228
|
+
onChange={[Function]}
|
|
229
|
+
/>
|
|
230
|
+
<OptionsInputDropdownItem
|
|
231
|
+
displayMinMax={false}
|
|
232
|
+
index={1}
|
|
233
|
+
item={
|
|
234
|
+
{
|
|
235
|
+
"icon": "football",
|
|
236
|
+
"id": "sport-equipment",
|
|
237
|
+
"inputQuantity": 1,
|
|
238
|
+
"label": "sport equipment",
|
|
239
|
+
"max": 1,
|
|
240
|
+
"min": 0,
|
|
241
|
+
"quantity": 1,
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
onBlur={[Function]}
|
|
245
|
+
onChange={[Function]}
|
|
246
|
+
/>
|
|
247
|
+
</ForwardRef(List)>
|
|
248
|
+
</ForwardRef(Popper)>
|
|
249
|
+
</ClickAwayListener>
|
|
250
|
+
</React.Fragment>
|
|
251
|
+
`;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
3
|
+
export const MinMaxValueLabel = ({ min, max, color, }) => (_jsxs(Typography, { variant: "caption", color: color, sx: { my: 0 }, children: [!Number.isNaN(Number(min)) && `min: ${min}`, !Number.isNaN(Number(max)) && !Number.isNaN(Number(min)) && ', ', !Number.isNaN(Number(max)) && `max: ${max}`] }));
|
|
4
|
+
//# sourceMappingURL=min-max-value-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"min-max-value-label.js","sourceRoot":"","sources":["../../components/min-max-value-label.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAQlD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,GAAG,EACH,GAAG,EACH,KAAK,GACiB,EAAE,EAAE,CAAC,CAC3B,MAAC,UAAU,IAAC,OAAO,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,aACtD,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,GAAG,EAAE,EAC3C,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,EAChE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,GAAG,EAAE,IACjC,CACd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OptionsInputOption } from '../types';
|
|
2
|
+
export type OptionsInputContentItemProps = {
|
|
3
|
+
item: OptionsInputOption;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
displayMinMax?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const OptionsInputContentItem: ({ item: { quantity, details, label, max, min, icon }, displayMinMax, disabled, }: OptionsInputContentItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default OptionsInputContentItem;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import * as MuiIcons from '@mui/icons-material';
|
|
6
|
+
import * as DesignSystemIcons from '@talixo-ds/icons';
|
|
7
|
+
import { MinMaxValueLabel } from './min-max-value-label';
|
|
8
|
+
const OptionsInputContentItem = ({ item: { quantity, details, label, max, min, icon }, displayMinMax = false, disabled = false, }) => {
|
|
9
|
+
const Icon = DesignSystemIcons[icon] || MuiIcons[icon];
|
|
10
|
+
const itemsColor = quantity === 0 || disabled ? '#a4a5b2' : '#000000';
|
|
11
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", gap: 0.5, color: itemsColor, "data-testid": "option-item", children: [label ? (_jsx(Tooltip, { title: _jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsx(Typography, { variant: "caption", fontWeight: 600, sx: { my: 0 }, children: label }), details && (_jsx(Typography, { variant: "caption", sx: { my: 0 }, children: details })), displayMinMax && _jsx(MinMaxValueLabel, { min: min, max: max })] }), placement: "top", arrow: true, children: _jsx("span", { children: _jsx(Icon, { fontSize: "medium", color: itemsColor }) }) })) : (_jsx(Icon, { fontSize: "medium", color: itemsColor })), _jsx(Typography, { variant: "h6", color: itemsColor, children: quantity })] }));
|
|
12
|
+
};
|
|
13
|
+
export default OptionsInputContentItem;
|
|
14
|
+
//# sourceMappingURL=options-input-content-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-input-content-item.js","sourceRoot":"","sources":["../../components/options-input-content-item.tsx"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AASzD,MAAM,uBAAuB,GAAG,CAAC,EAC/B,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAClD,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,KAAK,GACa,EAAE,EAAE;IACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,QAAQ,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAEtE,OAAO,CACL,MAAC,GAAG,IACF,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,QAAQ,EACnB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,UAAU,iBACL,aAAa,aAExB,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,OAAO,IACN,KAAK,EACH,MAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,aAAa,EAAC,QAAQ,aACxC,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,EAAC,UAAU,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,YACzD,KAAK,GACK,EACZ,OAAO,IAAI,CACV,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,YACxC,OAAO,GACG,CACd,EACA,aAAa,IAAI,KAAC,gBAAgB,IAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAI,IACtD,EAER,SAAS,EAAC,KAAK,EACf,KAAK,kBAEL,yBACE,KAAC,IAAI,IAAC,QAAQ,EAAC,QAAQ,EAAC,KAAK,EAAE,UAAU,GAAI,GACxC,GACC,CACX,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,QAAQ,EAAC,QAAQ,EAAC,KAAK,EAAE,UAAU,GAAI,CAC9C,EACD,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,EAAC,KAAK,EAAE,UAAU,YACvC,QAAQ,GACE,IACT,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OptionsInputOption } from '../types';
|
|
2
|
+
export type OptionsInputDropdownItemProps = {
|
|
3
|
+
item: OptionsInputOption;
|
|
4
|
+
onBlur: () => void;
|
|
5
|
+
onChange: (id: string, value: number | string) => void;
|
|
6
|
+
index: number;
|
|
7
|
+
displayMinMax?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const OptionsInputDropdownItem: ({ item: { id, quantity, label, max, min, icon, details, inputQuantity }, onChange, onBlur, index, displayMinMax, }: OptionsInputDropdownItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default OptionsInputDropdownItem;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
7
|
+
import Divider from '@mui/material/Divider';
|
|
8
|
+
import TextField from '@mui/material/TextField';
|
|
9
|
+
import ListItem from '@mui/material/ListItem';
|
|
10
|
+
import Button from '@mui/material/Button';
|
|
11
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
12
|
+
import RemoveIcon from '@mui/icons-material/Remove';
|
|
13
|
+
import * as MuiIcons from '@mui/icons-material';
|
|
14
|
+
import * as DesignSystemIcons from '@talixo-ds/icons';
|
|
15
|
+
import { MinMaxValueLabel } from './min-max-value-label';
|
|
16
|
+
const OptionsInputDropdownItem = ({ item: { id, quantity = 0, label, max, min, icon, details, inputQuantity }, onChange, onBlur, index, displayMinMax, }) => {
|
|
17
|
+
const [shouldDisplayFullDetails, setShouldDisplayFullDetails] = useState(false);
|
|
18
|
+
const Icon = DesignSystemIcons[icon] || MuiIcons[icon];
|
|
19
|
+
return (_jsxs(_Fragment, {
|
|
20
|
+
children: [!!index && (_jsx(Divider, { sx: { color: (theme) => theme.palette.primary.main } })), _jsxs(ListItem, {
|
|
21
|
+
sx: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
justifyContent: 'space-between',
|
|
24
|
+
}, className: classNames('options-input__dropdown-item', {
|
|
25
|
+
'options-input__dropdown-item--empty': !quantity,
|
|
26
|
+
}), children: [_jsxs(Box, {
|
|
27
|
+
display: "flex", alignItems: "center", children: [_jsx(Icon, { fontSize: "small", color: "black" }), _jsx(TextField, {
|
|
28
|
+
onChange: ({ target }) => onChange(id, target.value), onBlur: onBlur, value: inputQuantity, variant: "standard", inputProps: {
|
|
29
|
+
inputMode: 'numeric',
|
|
30
|
+
pattern: '-?[0-9]*',
|
|
31
|
+
style: {
|
|
32
|
+
textAlign: 'center',
|
|
33
|
+
},
|
|
34
|
+
'data-testid': 'dropdown-item-input',
|
|
35
|
+
},
|
|
36
|
+
// eslint-disable-next-line react/jsx-no-duplicate-props
|
|
37
|
+
InputProps: { disableUnderline: true }, className: "options-input__dropdown-item-input"
|
|
38
|
+
}), _jsxs(Box, {
|
|
39
|
+
display: "flex", flexDirection: "column", justifyContent: "center", paddingRight: 2, paddingLeft: 1, minWidth: "5rem", children: [_jsx(Typography, { variant: "caption", fontWeight: 600, fontSize: 13, sx: { my: 0 }, color: "black", children: label || id }), details && (_jsx(Box, {
|
|
40
|
+
position: "relative", height: "1rem", "data-testid": "option-details-container", onMouseEnter: () => setShouldDisplayFullDetails(true), onMouseLeave: () => setShouldDisplayFullDetails(false), children: _jsx(Typography, {
|
|
41
|
+
variant: "caption", color: "gray", sx: {
|
|
42
|
+
my: 0,
|
|
43
|
+
zIndex: 10000,
|
|
44
|
+
position: 'fixed',
|
|
45
|
+
...(shouldDisplayFullDetails && {
|
|
46
|
+
backgroundColor: quantity ? '#ffffff' : '#eeeeee',
|
|
47
|
+
border: 'thin solid #d3d3d3',
|
|
48
|
+
}),
|
|
49
|
+
}, "data-testid": "option-details", children: details?.length <= 15 || shouldDisplayFullDetails
|
|
50
|
+
? details
|
|
51
|
+
: `${details?.slice(0, 15)}...`
|
|
52
|
+
})
|
|
53
|
+
})), displayMinMax && (_jsx(MinMaxValueLabel, { min: min, max: max, color: "gray" }))]
|
|
54
|
+
})]
|
|
55
|
+
}), _jsxs(ButtonGroup, { variant: "outlined", size: "small", className: "options-input__dropdown-item-buttons", children: [_jsx(Button, { onClick: () => onChange(id, quantity + 1), disabled: quantity === max, className: "options-input__dropdown-item-button", role: "button", color: "primary", children: _jsx(AddIcon, { sx: { color: 'primary' } }) }), _jsx(Button, { onClick: () => onChange(id, quantity - 1), disabled: quantity === min, className: "options-input__dropdown-item-button", role: "button", color: "primary", children: _jsx(RemoveIcon, { sx: { color: 'primary' } }) })] })]
|
|
56
|
+
})]
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
export default OptionsInputDropdownItem;
|
|
60
|
+
//# sourceMappingURL=options-input-dropdown-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-input-dropdown-item.js","sourceRoot":"","sources":["../../components/options-input-dropdown-item.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAWzD,MAAM,wBAAwB,GAAG,CAAC,EAChC,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,EACzE,QAAQ,EACR,MAAM,EACN,KAAK,EACL,aAAa,GACiB,EAAE,E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AAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC,EACzC,QAAQ,EAAE,QAAQ,KAAK,GAAG,EAC1B,SAAS,EAAC,qCAAqC,EAC/C,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,SAAS,YAEf,KAAC,OAAO,IAAC,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAI,GAC9B,EACT,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC,EACzC,QAAQ,EAAE,QAAQ,KAAK,GAAG,EAC1B,SAAS,EAAC,qCAAqC,EAC/C,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,SAAS,YAEf,KAAC,UAAU,IAAC,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAI,GACjC,IACG,IACL,IACV,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`MinMaxValueLabel should match snapshot 1`] = `
|
|
4
|
+
<ForwardRef(Typography)
|
|
5
|
+
color="black"
|
|
6
|
+
sx={
|
|
7
|
+
{
|
|
8
|
+
"my": 0,
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
variant="caption"
|
|
12
|
+
>
|
|
13
|
+
min: 0
|
|
14
|
+
,
|
|
15
|
+
max: 100
|
|
16
|
+
</ForwardRef(Typography)>
|
|
17
|
+
`;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`OptionsInputDropdownItem should match snapshot 1`] = `
|
|
4
|
+
<ForwardRef(Box)
|
|
5
|
+
alignItems="center"
|
|
6
|
+
color="#a4a5b2"
|
|
7
|
+
data-testid="option-item"
|
|
8
|
+
display="flex"
|
|
9
|
+
gap={0.5}
|
|
10
|
+
>
|
|
11
|
+
<ForwardRef(Tooltip)
|
|
12
|
+
arrow={true}
|
|
13
|
+
placement="top"
|
|
14
|
+
title={
|
|
15
|
+
<ForwardRef(Box)
|
|
16
|
+
display="flex"
|
|
17
|
+
flexDirection="column"
|
|
18
|
+
>
|
|
19
|
+
<ForwardRef(Typography)
|
|
20
|
+
fontWeight={600}
|
|
21
|
+
sx={
|
|
22
|
+
{
|
|
23
|
+
"my": 0,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
variant="caption"
|
|
27
|
+
>
|
|
28
|
+
luggage
|
|
29
|
+
</ForwardRef(Typography)>
|
|
30
|
+
<ForwardRef(Typography)
|
|
31
|
+
sx={
|
|
32
|
+
{
|
|
33
|
+
"my": 0,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
variant="caption"
|
|
37
|
+
>
|
|
38
|
+
This is your luggage
|
|
39
|
+
</ForwardRef(Typography)>
|
|
40
|
+
<MinMaxValueLabel
|
|
41
|
+
max={10}
|
|
42
|
+
min={-10}
|
|
43
|
+
/>
|
|
44
|
+
</ForwardRef(Box)>
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
<span>
|
|
48
|
+
<div
|
|
49
|
+
color="#a4a5b2"
|
|
50
|
+
fontSize="medium"
|
|
51
|
+
/>
|
|
52
|
+
</span>
|
|
53
|
+
</ForwardRef(Tooltip)>
|
|
54
|
+
<ForwardRef(Typography)
|
|
55
|
+
color="#a4a5b2"
|
|
56
|
+
variant="h6"
|
|
57
|
+
>
|
|
58
|
+
0
|
|
59
|
+
</ForwardRef(Typography)>
|
|
60
|
+
</ForwardRef(Box)>
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
exports[`OptionsInputDropdownItem should not render tooltip when there is no label 1`] = `
|
|
64
|
+
<ForwardRef(Box)
|
|
65
|
+
alignItems="center"
|
|
66
|
+
color="#a4a5b2"
|
|
67
|
+
data-testid="option-item"
|
|
68
|
+
display="flex"
|
|
69
|
+
gap={0.5}
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
color="#a4a5b2"
|
|
73
|
+
fontSize="medium"
|
|
74
|
+
/>
|
|
75
|
+
<ForwardRef(Typography)
|
|
76
|
+
color="#a4a5b2"
|
|
77
|
+
variant="h6"
|
|
78
|
+
>
|
|
79
|
+
0
|
|
80
|
+
</ForwardRef(Typography)>
|
|
81
|
+
</ForwardRef(Box)>
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
exports[`OptionsInputDropdownItem should render proper alternative styling 1`] = `
|
|
85
|
+
<ForwardRef(Box)
|
|
86
|
+
alignItems="center"
|
|
87
|
+
color="#000000"
|
|
88
|
+
data-testid="option-item"
|
|
89
|
+
display="flex"
|
|
90
|
+
gap={0.5}
|
|
91
|
+
>
|
|
92
|
+
<ForwardRef(Tooltip)
|
|
93
|
+
arrow={true}
|
|
94
|
+
placement="top"
|
|
95
|
+
title={
|
|
96
|
+
<ForwardRef(Box)
|
|
97
|
+
display="flex"
|
|
98
|
+
flexDirection="column"
|
|
99
|
+
>
|
|
100
|
+
<ForwardRef(Typography)
|
|
101
|
+
fontWeight={600}
|
|
102
|
+
sx={
|
|
103
|
+
{
|
|
104
|
+
"my": 0,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
variant="caption"
|
|
108
|
+
>
|
|
109
|
+
luggage
|
|
110
|
+
</ForwardRef(Typography)>
|
|
111
|
+
<ForwardRef(Typography)
|
|
112
|
+
sx={
|
|
113
|
+
{
|
|
114
|
+
"my": 0,
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
variant="caption"
|
|
118
|
+
>
|
|
119
|
+
This is your luggage
|
|
120
|
+
</ForwardRef(Typography)>
|
|
121
|
+
</ForwardRef(Box)>
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
<span>
|
|
125
|
+
<div
|
|
126
|
+
color="#000000"
|
|
127
|
+
fontSize="medium"
|
|
128
|
+
/>
|
|
129
|
+
</span>
|
|
130
|
+
</ForwardRef(Tooltip)>
|
|
131
|
+
<ForwardRef(Typography)
|
|
132
|
+
color="#000000"
|
|
133
|
+
variant="h6"
|
|
134
|
+
>
|
|
135
|
+
1
|
|
136
|
+
</ForwardRef(Typography)>
|
|
137
|
+
</ForwardRef(Box)>
|
|
138
|
+
`;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`OptionsInputDropdownItem should match snapshot 1`] = `
|
|
4
|
+
<React.Fragment>
|
|
5
|
+
<ForwardRef(Divider)
|
|
6
|
+
sx={
|
|
7
|
+
{
|
|
8
|
+
"color": [Function],
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/>
|
|
12
|
+
<ForwardRef(ListItem)
|
|
13
|
+
className="options-input__dropdown-item options-input__dropdown-item--empty"
|
|
14
|
+
sx={
|
|
15
|
+
{
|
|
16
|
+
"display": "flex",
|
|
17
|
+
"justifyContent": "space-between",
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
>
|
|
21
|
+
<ForwardRef(Box)
|
|
22
|
+
alignItems="center"
|
|
23
|
+
display="flex"
|
|
24
|
+
>
|
|
25
|
+
<div
|
|
26
|
+
color="black"
|
|
27
|
+
fontSize="small"
|
|
28
|
+
/>
|
|
29
|
+
<ForwardRef(TextField)
|
|
30
|
+
InputProps={
|
|
31
|
+
{
|
|
32
|
+
"disableUnderline": true,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
className="options-input__dropdown-item-input"
|
|
36
|
+
inputProps={
|
|
37
|
+
{
|
|
38
|
+
"data-testid": "dropdown-item-input",
|
|
39
|
+
"inputMode": "numeric",
|
|
40
|
+
"pattern": "-?[0-9]*",
|
|
41
|
+
"style": {
|
|
42
|
+
"textAlign": "center",
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
onBlur={[MockFunction]}
|
|
47
|
+
onChange={[Function]}
|
|
48
|
+
value={0}
|
|
49
|
+
variant="standard"
|
|
50
|
+
/>
|
|
51
|
+
<ForwardRef(Box)
|
|
52
|
+
display="flex"
|
|
53
|
+
flexDirection="column"
|
|
54
|
+
justifyContent="center"
|
|
55
|
+
minWidth="5rem"
|
|
56
|
+
paddingLeft={1}
|
|
57
|
+
paddingRight={2}
|
|
58
|
+
>
|
|
59
|
+
<ForwardRef(Typography)
|
|
60
|
+
color="black"
|
|
61
|
+
fontSize={13}
|
|
62
|
+
fontWeight={600}
|
|
63
|
+
sx={
|
|
64
|
+
{
|
|
65
|
+
"my": 0,
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
variant="caption"
|
|
69
|
+
>
|
|
70
|
+
luggage-id
|
|
71
|
+
</ForwardRef(Typography)>
|
|
72
|
+
<ForwardRef(Box)
|
|
73
|
+
data-testid="option-details-container"
|
|
74
|
+
height="1rem"
|
|
75
|
+
onMouseEnter={[Function]}
|
|
76
|
+
onMouseLeave={[Function]}
|
|
77
|
+
position="relative"
|
|
78
|
+
>
|
|
79
|
+
<ForwardRef(Typography)
|
|
80
|
+
color="gray"
|
|
81
|
+
data-testid="option-details"
|
|
82
|
+
sx={
|
|
83
|
+
{
|
|
84
|
+
"my": 0,
|
|
85
|
+
"position": "fixed",
|
|
86
|
+
"zIndex": 10000,
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
variant="caption"
|
|
90
|
+
>
|
|
91
|
+
This is your lu...
|
|
92
|
+
</ForwardRef(Typography)>
|
|
93
|
+
</ForwardRef(Box)>
|
|
94
|
+
</ForwardRef(Box)>
|
|
95
|
+
</ForwardRef(Box)>
|
|
96
|
+
<ForwardRef(ButtonGroup)
|
|
97
|
+
className="options-input__dropdown-item-buttons"
|
|
98
|
+
size="small"
|
|
99
|
+
variant="outlined"
|
|
100
|
+
>
|
|
101
|
+
<ForwardRef(Button)
|
|
102
|
+
className="options-input__dropdown-item-button"
|
|
103
|
+
color="primary"
|
|
104
|
+
disabled={false}
|
|
105
|
+
onClick={[Function]}
|
|
106
|
+
role="button"
|
|
107
|
+
>
|
|
108
|
+
<Memo
|
|
109
|
+
sx={
|
|
110
|
+
{
|
|
111
|
+
"color": "primary",
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
115
|
+
</ForwardRef(Button)>
|
|
116
|
+
<ForwardRef(Button)
|
|
117
|
+
className="options-input__dropdown-item-button"
|
|
118
|
+
color="primary"
|
|
119
|
+
disabled={false}
|
|
120
|
+
onClick={[Function]}
|
|
121
|
+
role="button"
|
|
122
|
+
>
|
|
123
|
+
<Memo
|
|
124
|
+
sx={
|
|
125
|
+
{
|
|
126
|
+
"color": "primary",
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/>
|
|
130
|
+
</ForwardRef(Button)>
|
|
131
|
+
</ForwardRef(ButtonGroup)>
|
|
132
|
+
</ForwardRef(ListItem)>
|
|
133
|
+
</React.Fragment>
|
|
134
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|