@talixo-ds/options-input 1.0.0 → 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.
Files changed (43) hide show
  1. package/dist/components/min-max-value-label.d.ts +3 -2
  2. package/dist/components/min-max-value-label.js +2 -2
  3. package/dist/components/min-max-value-label.js.map +1 -1
  4. package/dist/components/options-input-content-item.d.ts +2 -2
  5. package/dist/components/options-input-content-item.js +10 -10
  6. package/dist/components/options-input-content-item.js.map +1 -1
  7. package/dist/components/options-input-dropdown-item.d.ts +4 -3
  8. package/dist/components/options-input-dropdown-item.js +31 -31
  9. package/dist/components/options-input-dropdown-item.js.map +1 -1
  10. package/dist/options-input.d.ts +9 -9
  11. package/dist/options-input.js +44 -47
  12. package/dist/options-input.js.map +1 -1
  13. package/dist/utils.d.ts +1 -0
  14. package/dist/utils.js +2 -0
  15. package/dist/utils.js.map +1 -0
  16. package/package.json +15 -19
  17. package/src/__tests__/options-input.spec.tsx +147 -0
  18. package/src/__tests__/utils.spec.ts +12 -0
  19. package/src/components/__tests__/min-max-value-label.spec.tsx +19 -19
  20. package/src/components/__tests__/options-input-content-item.spec.tsx +52 -60
  21. package/src/components/__tests__/options-input-dropdown-item.spec.tsx +74 -85
  22. package/src/components/min-max-value-label.tsx +10 -15
  23. package/src/components/options-input-content-item.tsx +47 -54
  24. package/src/components/options-input-dropdown-item.tsx +133 -138
  25. package/src/options-input.tsx +247 -251
  26. package/src/utils.ts +1 -0
  27. package/tsconfig.build.json +8 -0
  28. package/__tests__/__snapshots__/options-input.spec.tsx.snap +0 -119
  29. package/__tests__/options-input.spec.tsx +0 -242
  30. package/dist/components/__tests__/min-max-value-label.spec.d.ts +0 -1
  31. package/dist/components/__tests__/min-max-value-label.spec.js +0 -21
  32. package/dist/components/__tests__/min-max-value-label.spec.js.map +0 -1
  33. package/dist/components/__tests__/options-input-content-item.spec.d.ts +0 -1
  34. package/dist/components/__tests__/options-input-content-item.spec.js +0 -49
  35. package/dist/components/__tests__/options-input-content-item.spec.js.map +0 -1
  36. package/dist/components/__tests__/options-input-dropdown-item.spec.d.ts +0 -1
  37. package/dist/components/__tests__/options-input-dropdown-item.spec.js +0 -67
  38. package/dist/components/__tests__/options-input-dropdown-item.spec.js.map +0 -1
  39. package/jest.config.js +0 -9
  40. package/src/components/__tests__/__snapshots__/min-max-value-label.spec.tsx.snap +0 -17
  41. package/src/components/__tests__/__snapshots__/options-input-content-item.spec.tsx.snap +0 -138
  42. package/src/components/__tests__/__snapshots__/options-input-dropdown-item.spec.tsx.snap +0 -134
  43. package/tsconfig.json +0 -8
@@ -0,0 +1,147 @@
1
+ import { render, screen, fireEvent, waitFor, act } from "@testing-library/react";
2
+ import { OptionsInput } from "../options-input";
3
+
4
+ const props = {
5
+ options: [
6
+ {
7
+ id: "luggage",
8
+ icon: "luggage",
9
+ label: "luggage",
10
+ details: "This is your luggage",
11
+ min: 0,
12
+ max: 9
13
+ },
14
+ {
15
+ id: "dog",
16
+ icon: "this icon does not exist",
17
+ label: "dog",
18
+ min: 0,
19
+ max: 3
20
+ },
21
+ {
22
+ id: "sport-equipment",
23
+ icon: "football",
24
+ label: "sport equipment",
25
+ min: 0,
26
+ max: 1
27
+ }
28
+ ],
29
+ id: "test-id",
30
+ defaultValue: { luggage: 2, "sport-equipment": 5 },
31
+ persistentOptions: ["sport-equipment"],
32
+ className: "test-class",
33
+ onChange: vi.fn(),
34
+ onFocus: vi.fn(),
35
+ onBlur: vi.fn()
36
+ };
37
+
38
+ describe("OptionsInput", () => {
39
+ describe("events", () => {
40
+ it("should open input dropdown properly", async () => {
41
+ const { getAllByTestId } = render(<OptionsInput {...props} />);
42
+ const optionsInputContainer = getAllByTestId("options-input-container")[0];
43
+
44
+ act(() => {
45
+ fireEvent.click(optionsInputContainer!);
46
+ });
47
+
48
+ await waitFor(() => {
49
+ expect(screen.queryByTestId("options-dropdown-list")).toBeInTheDocument();
50
+ });
51
+ });
52
+
53
+ it("should not open dropdown when input is disabled", async () => {
54
+ const { getAllByTestId } = render(<OptionsInput {...props} disabled />);
55
+
56
+ const optionsInputContainer = getAllByTestId("options-input-container")[0];
57
+
58
+ act(() => {
59
+ fireEvent.click(optionsInputContainer!);
60
+ });
61
+
62
+ await waitFor(() => {
63
+ expect(screen.queryByTestId("options-dropdown-list")).not.toBeInTheDocument();
64
+ });
65
+ });
66
+
67
+ it("should handle input focus properly", () => {
68
+ const { getAllByTestId } = render(<OptionsInput {...props} />);
69
+
70
+ const optionsInputContainer = getAllByTestId("options-input-container")[0];
71
+
72
+ act(() => {
73
+ fireEvent.focus(optionsInputContainer!);
74
+ });
75
+
76
+ expect(props.onFocus).toHaveBeenCalledWith({
77
+ dog: 0,
78
+ luggage: 2,
79
+ "sport-equipment": 1
80
+ });
81
+ });
82
+
83
+ it("should handle input blur properly", () => {
84
+ const { getAllByTestId } = render(<OptionsInput {...props} />);
85
+
86
+ const optionsInputContainer = getAllByTestId("options-input-container")[0];
87
+
88
+ act(() => {
89
+ fireEvent.blur(optionsInputContainer!);
90
+ });
91
+
92
+ expect(props.onBlur).toHaveBeenCalledWith({
93
+ dog: 0,
94
+ luggage: 2,
95
+ "sport-equipment": 1
96
+ });
97
+ });
98
+
99
+ it("should handle input option change properly", async () => {
100
+ const { getByTestId } = render(<OptionsInput {...props} />);
101
+
102
+ const optionsInputContainer = getByTestId("options-input-container");
103
+
104
+ fireEvent.click(optionsInputContainer);
105
+
106
+ await waitFor(() => screen.findAllByTestId("dropdown-item-input"));
107
+
108
+ const optionCountInput = screen.getAllByTestId("dropdown-item-input")[0];
109
+
110
+ act(() => {
111
+ fireEvent.change(optionCountInput!, { target: { value: 9 } });
112
+ });
113
+
114
+ expect(props.onChange).toHaveBeenCalledWith({
115
+ dog: 0,
116
+ luggage: 9,
117
+ "sport-equipment": 1
118
+ });
119
+
120
+ expect(screen.getAllByTestId("option-item")[0]).toHaveTextContent("9");
121
+ });
122
+
123
+ it("should handle input option blur properly", async () => {
124
+ const { getAllByTestId } = render(<OptionsInput {...props} />);
125
+
126
+ const optionsInputContainer = getAllByTestId("options-input-container")[0];
127
+
128
+ fireEvent.click(optionsInputContainer!);
129
+
130
+ await waitFor(() => {
131
+ const optionCountInput = screen.getAllByTestId("dropdown-item-input")[0];
132
+
133
+ act(() => {
134
+ fireEvent.change(optionCountInput!, { target: { value: 500 } });
135
+ });
136
+
137
+ expect(optionCountInput).toHaveAttribute("value", "500");
138
+
139
+ act(() => {
140
+ fireEvent.blur(optionCountInput!);
141
+ });
142
+
143
+ expect(optionCountInput).toHaveAttribute("value", "9");
144
+ });
145
+ });
146
+ });
147
+ });
@@ -0,0 +1,12 @@
1
+ import { capitalize } from "../utils";
2
+
3
+ test("capitalize util converts string properly", () => {
4
+ const example = "hello world";
5
+ const expected = "Hello world";
6
+
7
+ const result1 = capitalize(example);
8
+ expect(result1).toBe(expected);
9
+
10
+ const result2 = capitalize(expected);
11
+ expect(result2).toBe(expected);
12
+ });
@@ -1,24 +1,24 @@
1
- import React from 'react';
2
- import ShallowRenderer from 'react-test-renderer/shallow';
3
- import '@testing-library/jest-dom';
4
- import { MinMaxValueLabel } from '../min-max-value-label';
1
+ import { render } from "@testing-library/react";
2
+ import { MinMaxValueLabel } from "../min-max-value-label";
5
3
 
6
- const props = {
7
- min: 0,
8
- max: 100,
9
- color: 'black',
10
- };
4
+ describe("MinMaxValueLabel", () => {
5
+ it("should render with min value", () => {
6
+ const { queryByText } = render(<MinMaxValueLabel min={0} color="black" />);
11
7
 
12
- describe('MinMaxValueLabel', () => {
13
- let component: JSX.Element;
14
- const renderer = ShallowRenderer.createRenderer();
8
+ expect(queryByText("min: 0")).toBeInTheDocument();
9
+ });
15
10
 
16
- beforeEach(() => {
17
- renderer.render(<MinMaxValueLabel {...props} />);
18
- component = renderer.getRenderOutput();
19
- });
11
+ it("should render with max value", () => {
12
+ const { queryByText } = render(
13
+ <MinMaxValueLabel max={100} color={(theme) => theme.palette.primary.main} />
14
+ );
20
15
 
21
- it('should match snapshot', () => {
22
- expect(component).toMatchSnapshot();
23
- });
16
+ expect(queryByText("max: 100")).toBeInTheDocument();
17
+ });
18
+
19
+ it("should render with min and max value", () => {
20
+ const { queryByText } = render(<MinMaxValueLabel max={100} min={0} />);
21
+
22
+ expect(queryByText("min: 0, max: 100")).toBeInTheDocument();
23
+ });
24
24
  });
@@ -1,63 +1,55 @@
1
- import React from 'react';
2
- import ShallowRenderer from 'react-test-renderer/shallow';
3
- import OptionsInputContentItem from '../options-input-content-item';
4
- import { vi } from 'vitest';
5
-
6
-
7
- vi.mock('@mui/icons-material', async (importOriginal) => {
8
- return {
9
- ...await importOriginal<typeof import('@mui/icons-material')>(),
10
- luggage: 'div',
11
- }
12
- })
13
-
14
- vi.mock('@talixo-ds/icons', async (importOriginal) => {
15
- return {
16
- ...await importOriginal<typeof import('@talixo-ds/icons')>(),
17
- football: 'div',
18
- }
19
- })
1
+ import { fireEvent, render, waitFor } from "@testing-library/react";
2
+ import OptionsInputContentItem, {
3
+ type OptionsInputContentItemProps
4
+ } from "../options-input-content-item";
20
5
 
21
6
  const props = {
22
- item: {
23
- id: 'luggage',
24
- icon: 'luggage',
25
- label: 'luggage',
26
- details: 'This is your luggage',
27
- min: -10,
28
- max: 10,
29
- quantity: 0,
30
- inputQuantity: 0,
31
- },
32
- displayMinMax: true,
33
- };
34
-
35
- describe('OptionsInputDropdownItem', () => {
36
- let component: JSX.Element;
37
- const renderer = ShallowRenderer.createRenderer();
38
-
39
- it('should match snapshot', () => {
40
- renderer.render(<OptionsInputContentItem {...props} />);
41
-
42
- component = renderer.getRenderOutput();
43
- expect(component).toMatchSnapshot();
44
- });
45
-
46
- it('should render proper alternative styling', () => {
47
- renderer.render(
48
- <OptionsInputContentItem item={{ ...props.item, quantity: 1 }} />
49
- );
50
-
51
- component = renderer.getRenderOutput();
52
- expect(component).toMatchSnapshot();
53
- });
54
-
55
- it('should not render tooltip when there is no label', () => {
56
- renderer.render(
57
- <OptionsInputContentItem item={{ ...props.item, label: undefined }} />
58
- );
59
-
60
- component = renderer.getRenderOutput();
61
- expect(component).toMatchSnapshot();
62
- });
7
+ item: {
8
+ id: "luggage",
9
+ icon: "luggage",
10
+ label: "luggage",
11
+ details: "This is your luggage",
12
+ min: -10,
13
+ max: 10,
14
+ quantity: 0,
15
+ inputQuantity: 0
16
+ },
17
+ displayMinMax: true
18
+ } satisfies OptionsInputContentItemProps;
19
+
20
+ describe("OptionsInputDropdownItem", () => {
21
+ it("should render properly and show tooltip with proper content on hover", async () => {
22
+ const { queryByTestId, queryByText, getByTestId } = render(
23
+ <OptionsInputContentItem {...props} />
24
+ );
25
+
26
+ expect(queryByTestId("LuggageIcon")).toBeInTheDocument();
27
+ expect(queryByText("0")).toBeInTheDocument();
28
+
29
+ const icon = getByTestId("LuggageIcon");
30
+
31
+ fireEvent.mouseOver(icon);
32
+
33
+ await waitFor(() => {
34
+ expect(queryByText("This is your luggage")).toBeInTheDocument();
35
+ expect(queryByText("luggage")).toBeInTheDocument();
36
+ });
37
+ });
38
+
39
+ it("should not render tooltip when there is no label", async () => {
40
+ const { queryByTestId, queryByText, getByTestId } = render(
41
+ <OptionsInputContentItem item={{ ...props.item, label: undefined, quantity: 1 }} />
42
+ );
43
+
44
+ expect(queryByTestId("LuggageIcon")).toBeInTheDocument();
45
+ expect(queryByText("1")).toBeInTheDocument();
46
+
47
+ const icon = getByTestId("LuggageIcon");
48
+
49
+ fireEvent.mouseOver(icon);
50
+
51
+ await waitFor(() => {
52
+ expect(queryByText("This is your luggage")).not.toBeInTheDocument();
53
+ });
54
+ });
63
55
  });
@@ -1,91 +1,80 @@
1
- import React from 'react';
2
- import ShallowRenderer from 'react-test-renderer/shallow';
3
- import { render, screen, fireEvent } from '@testing-library/react';
4
- import { vi } from 'vitest';
5
- import OptionsInputDropdownItem from '../options-input-dropdown-item';
6
-
7
-
8
- vi.mock('@mui/icons-material', async (importOriginal) => {
9
- return {
10
- ...await importOriginal<typeof import('@mui/icons-material')>(),
11
- luggage: 'div',
12
- }
13
- })
14
-
15
- vi.mock('@talixo-ds/icons', async (importOriginal) => {
16
- return {
17
- ...await importOriginal<typeof import('@talixo-ds/icons')>(),
18
- football: 'div',
19
- }
20
- })
1
+ import { render, fireEvent } from "@testing-library/react";
2
+ import OptionsInputDropdownItem, {
3
+ type OptionsInputDropdownItemProps
4
+ } from "../options-input-dropdown-item";
21
5
 
22
6
  const onChangeMock = vi.fn();
23
7
  const onBlurMock = vi.fn();
24
8
 
25
9
  const props = {
26
- item: {
27
- id: 'luggage-id',
28
- icon: 'luggage',
29
- details:
30
- 'This is your luggage. Please, keep your attention not to lose it.',
31
- min: -10,
32
- max: 10,
33
- quantity: 0,
34
- inputQuantity: 0,
35
- },
36
- onBlur: onBlurMock,
37
- onChange: onChangeMock,
38
- index: 1,
39
- };
40
-
41
- describe('OptionsInputDropdownItem', () => {
42
- let component: JSX.Element;
43
- const renderer = ShallowRenderer.createRenderer();
44
-
45
- it('should match snapshot', () => {
46
- renderer.render(<OptionsInputDropdownItem {...props} />);
47
- component = renderer.getRenderOutput();
48
-
49
- expect(component).toMatchSnapshot();
50
- });
51
-
52
- describe('events', () => {
53
- beforeEach(() => render(<OptionsInputDropdownItem {...props} />));
54
-
55
- it('should call onChange on text field edit', async () => {
56
- const input = screen.getByTestId('dropdown-item-input');
57
-
58
- await fireEvent.change(input, { target: { value: '10' } });
59
- expect(onChangeMock).toHaveBeenCalledWith('luggage-id', '10');
60
- });
61
-
62
- it('should call onChange on increment button click', () => {
63
- const buttons = screen.getAllByRole('button');
64
-
65
- fireEvent.click(buttons[0]);
66
- expect(onChangeMock).toHaveBeenCalledWith('luggage-id', 1);
67
- });
68
-
69
- it('should call onChange on decrement button click', () => {
70
- const buttons = screen.getAllByRole('button');
71
-
72
- fireEvent.click(buttons[1]);
73
- expect(onChangeMock).toHaveBeenCalledWith('luggage-id', -1);
74
- });
75
-
76
- it('should expand details content', () => {
77
- expect(screen.getByTestId('option-details')).toHaveTextContent(
78
- props.item.details.slice(0, 15)
79
- );
80
-
81
- const optionDetailsContainer = screen.getByTestId(
82
- 'option-details-container'
83
- );
84
-
85
- fireEvent.mouseEnter(optionDetailsContainer);
86
- expect(screen.getByTestId('option-details')).toHaveTextContent(
87
- props.item.details
88
- );
89
- });
90
- });
10
+ item: {
11
+ id: "luggage-id",
12
+ icon: "luggage",
13
+ details: "This is your luggage. Please, keep your attention not to lose it.",
14
+ min: -10,
15
+ max: 10,
16
+ quantity: 0,
17
+ inputQuantity: 0
18
+ },
19
+ onBlur: onBlurMock,
20
+ onChange: onChangeMock,
21
+ index: 1
22
+ } satisfies OptionsInputDropdownItemProps;
23
+
24
+ describe("OptionsInputDropdownItem", () => {
25
+ afterEach(() => {
26
+ vi.clearAllMocks();
27
+ });
28
+
29
+ afterAll(() => {
30
+ vi.restoreAllMocks();
31
+ });
32
+
33
+ it("should call onChange on text field edit", () => {
34
+ const { getByTestId } = render(<OptionsInputDropdownItem {...props} />);
35
+
36
+ const input = getByTestId("dropdown-item-input");
37
+
38
+ fireEvent.change(input, { target: { value: "10" } });
39
+
40
+ expect(onChangeMock).toHaveBeenCalledTimes(1);
41
+ expect(onChangeMock).toHaveBeenCalledWith("luggage-id", "10");
42
+
43
+ fireEvent.blur(input);
44
+ expect(onBlurMock).toHaveBeenCalledTimes(1);
45
+ });
46
+
47
+ it("should call onChange on increment button click", () => {
48
+ const { getAllByRole } = render(<OptionsInputDropdownItem {...props} />);
49
+
50
+ const buttons = getAllByRole("button");
51
+
52
+ fireEvent.click(buttons[0]!);
53
+
54
+ expect(onChangeMock).toHaveBeenCalledTimes(1);
55
+ expect(onChangeMock).toHaveBeenCalledWith("luggage-id", 1);
56
+ });
57
+
58
+ it("should call onChange on decrement button click", () => {
59
+ const { getAllByRole } = render(<OptionsInputDropdownItem {...props} />);
60
+
61
+ const buttons = getAllByRole("button");
62
+
63
+ fireEvent.click(buttons[1]!);
64
+
65
+ expect(onChangeMock).toHaveBeenCalledTimes(1);
66
+ expect(onChangeMock).toHaveBeenCalledWith("luggage-id", -1);
67
+ });
68
+
69
+ it("should expand details content", () => {
70
+ const { getByTestId } = render(<OptionsInputDropdownItem {...props} />);
71
+
72
+ expect(getByTestId("option-details")).toHaveTextContent(props.item.details.slice(0, 15));
73
+
74
+ const optionDetailsContainer = getByTestId("option-details-container");
75
+
76
+ fireEvent.mouseEnter(optionDetailsContainer);
77
+
78
+ expect(getByTestId("option-details")).toHaveTextContent(props.item.details);
79
+ });
91
80
  });
@@ -1,20 +1,15 @@
1
- import React from 'react';
2
- import Typography from '@mui/material/Typography';
1
+ import Typography, { type TypographyProps } from "@mui/material/Typography";
3
2
 
4
3
  export type MinMaxValueLabelProps = {
5
- min?: number;
6
- max?: number;
7
- color?: string;
4
+ min?: number;
5
+ max?: number;
6
+ color?: TypographyProps["color"];
8
7
  };
9
8
 
10
- export const MinMaxValueLabel = ({
11
- min,
12
- max,
13
- color,
14
- }: MinMaxValueLabelProps) => (
15
- <Typography variant="caption" color={color} sx={{ my: 0 }}>
16
- {!Number.isNaN(Number(min)) && `min: ${min}`}
17
- {!Number.isNaN(Number(max)) && !Number.isNaN(Number(min)) && ', '}
18
- {!Number.isNaN(Number(max)) && `max: ${max}`}
19
- </Typography>
9
+ export const MinMaxValueLabel = ({ min, max, color }: MinMaxValueLabelProps) => (
10
+ <Typography variant="caption" color={color} sx={{ my: 0 }}>
11
+ {!Number.isNaN(Number(min)) && `min: ${min}`}
12
+ {!Number.isNaN(Number(max)) && !Number.isNaN(Number(min)) && ", "}
13
+ {!Number.isNaN(Number(max)) && `max: ${max}`}
14
+ </Typography>
20
15
  );
@@ -1,64 +1,57 @@
1
- import React from 'react';
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
- import { OptionsInputOption } from '../types';
1
+ import Tooltip from "@mui/material/Tooltip";
2
+ import Box from "@mui/material/Box";
3
+ import Typography from "@mui/material/Typography";
4
+ import * as DesignSystemIcons from "@talixo-ds/icons/src";
5
+ import { MinMaxValueLabel } from "./min-max-value-label";
6
+ import { capitalize } from "../utils";
7
+ import type { OptionsInputOption } from "../types";
9
8
 
10
9
  export type OptionsInputContentItemProps = {
11
- item: OptionsInputOption;
12
- disabled?: boolean;
13
- displayMinMax?: boolean;
10
+ item: OptionsInputOption;
11
+ disabled?: boolean;
12
+ displayMinMax?: boolean;
14
13
  };
15
14
 
16
15
  const OptionsInputContentItem = ({
17
- item: { quantity, details, label, max, min, icon },
18
- displayMinMax = false,
19
- disabled = false,
16
+ item: { quantity, details, label, max, min, icon },
17
+ displayMinMax = false,
18
+ disabled = false
20
19
  }: OptionsInputContentItemProps) => {
21
- const Icon = DesignSystemIcons[icon] || MuiIcons[icon];
22
- const itemsColor = quantity === 0 || disabled ? '#a4a5b2' : '#000000';
20
+ const Icon = DesignSystemIcons[capitalize(icon) as keyof typeof DesignSystemIcons] || null;
21
+ const itemsColor = quantity === 0 || disabled ? "#a4a5b2" : "#000000";
23
22
 
24
- return (
25
- <Box
26
- display="flex"
27
- alignItems="center"
28
- gap={0.5}
29
- color={itemsColor}
30
- data-testid="option-item"
31
- >
32
- {label ? (
33
- <Tooltip
34
- title={
35
- <Box display="flex" flexDirection="column">
36
- <Typography variant="caption" fontWeight={600} sx={{ my: 0 }}>
37
- {label}
38
- </Typography>
39
- {details && (
40
- <Typography variant="caption" sx={{ my: 0 }}>
41
- {details}
42
- </Typography>
43
- )}
44
- {displayMinMax && <MinMaxValueLabel min={min} max={max} />}
45
- </Box>
46
- }
47
- placement="top"
48
- arrow
49
- >
50
- <span>
51
- <Icon fontSize="medium" color={itemsColor} />
52
- </span>
53
- </Tooltip>
54
- ) : (
55
- <Icon fontSize="medium" color={itemsColor} />
56
- )}
57
- <Typography variant="h6" color={itemsColor}>
58
- {quantity}
59
- </Typography>
60
- </Box>
61
- );
23
+ return (
24
+ <Box display="flex" alignItems="center" gap={0.5} color={itemsColor} data-testid="option-item">
25
+ {label ? (
26
+ <Tooltip
27
+ title={
28
+ <Box display="flex" flexDirection="column">
29
+ <Typography variant="caption" fontWeight={600} sx={{ my: 0 }}>
30
+ {label}
31
+ </Typography>
32
+ {details && (
33
+ <Typography variant="caption" sx={{ my: 0 }}>
34
+ {details}
35
+ </Typography>
36
+ )}
37
+ {displayMinMax && <MinMaxValueLabel min={min} max={max} />}
38
+ </Box>
39
+ }
40
+ placement="top"
41
+ arrow
42
+ >
43
+ <span>
44
+ <Icon fontSize="medium" sx={{ color: itemsColor }} />
45
+ </span>
46
+ </Tooltip>
47
+ ) : (
48
+ <Icon fontSize="medium" sx={{ color: itemsColor }} />
49
+ )}
50
+ <Typography variant="h6" color={itemsColor}>
51
+ {quantity}
52
+ </Typography>
53
+ </Box>
54
+ );
62
55
  };
63
56
 
64
57
  export default OptionsInputContentItem;