@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,162 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import ShallowRenderer from 'react-test-renderer/shallow';
|
|
4
|
+
import { render, screen, fireEvent, waitFor, act, } from '@testing-library/react';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
import { OptionsInput } from './options-input';
|
|
7
|
+
jest.mock('@mui/icons-material', () => ({
|
|
8
|
+
luggage: 'div',
|
|
9
|
+
dog: 'div',
|
|
10
|
+
}));
|
|
11
|
+
jest.mock('@talixo-ds/component.icons', () => ({
|
|
12
|
+
football: 'div',
|
|
13
|
+
}));
|
|
14
|
+
jest.mock('react', () => ({
|
|
15
|
+
...jest.requireActual('react'),
|
|
16
|
+
useState: jest.fn(() => []),
|
|
17
|
+
}));
|
|
18
|
+
const props = {
|
|
19
|
+
options: [
|
|
20
|
+
{
|
|
21
|
+
id: 'luggage',
|
|
22
|
+
icon: 'luggage',
|
|
23
|
+
label: 'luggage',
|
|
24
|
+
details: 'This is your luggage',
|
|
25
|
+
min: 0,
|
|
26
|
+
max: 9,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'dog',
|
|
30
|
+
icon: 'this icon does not exist',
|
|
31
|
+
label: 'dog',
|
|
32
|
+
min: 0,
|
|
33
|
+
max: 3,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'sport-equipment',
|
|
37
|
+
icon: 'football',
|
|
38
|
+
label: 'sport equipment',
|
|
39
|
+
min: 0,
|
|
40
|
+
max: 1,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
id: 'test-id',
|
|
44
|
+
defaultValue: { luggage: 2, 'sport-equipment': 5 },
|
|
45
|
+
persistentOptions: ['sport-equipment'],
|
|
46
|
+
className: 'test-class',
|
|
47
|
+
onChange: jest.fn(),
|
|
48
|
+
onFocus: jest.fn(),
|
|
49
|
+
onBlur: jest.fn(),
|
|
50
|
+
};
|
|
51
|
+
const mockOptions = props.options.map((option) => ({
|
|
52
|
+
...option,
|
|
53
|
+
quantity: 1,
|
|
54
|
+
inputQuantity: 1,
|
|
55
|
+
}));
|
|
56
|
+
describe('OptionsInput', () => {
|
|
57
|
+
describe('snapshots', () => {
|
|
58
|
+
let component;
|
|
59
|
+
const shallowRenderer = ShallowRenderer.createRenderer();
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
useState.mockImplementationOnce(() => [
|
|
62
|
+
mockOptions,
|
|
63
|
+
jest.fn(),
|
|
64
|
+
]);
|
|
65
|
+
});
|
|
66
|
+
it('should match snapshot', () => {
|
|
67
|
+
shallowRenderer.render(_jsx(OptionsInput, { ...props }));
|
|
68
|
+
component = shallowRenderer.getRenderOutput();
|
|
69
|
+
expect(component).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
it('should render disabled input properly', () => {
|
|
72
|
+
shallowRenderer.render(_jsx(OptionsInput, { ...props, disabled: true }));
|
|
73
|
+
component = shallowRenderer.getRenderOutput();
|
|
74
|
+
expect(component).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('events', () => {
|
|
78
|
+
beforeAll(() => {
|
|
79
|
+
useState.mockImplementation(jest.requireActual('react').useState);
|
|
80
|
+
});
|
|
81
|
+
it('should open input dropdown properly', async () => {
|
|
82
|
+
const { getAllByTestId } = render(_jsx(OptionsInput, { ...props }));
|
|
83
|
+
const optionsInputContainer = getAllByTestId('options-input-container')[0];
|
|
84
|
+
act(() => {
|
|
85
|
+
fireEvent.click(optionsInputContainer);
|
|
86
|
+
});
|
|
87
|
+
await waitFor(() => {
|
|
88
|
+
expect(screen.queryByTestId('options-dropdown-list')).toBeInTheDocument();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
it('should not open dropdown when input is disabled', async () => {
|
|
92
|
+
const { getAllByTestId } = render(_jsx(OptionsInput, { ...props, disabled: true }));
|
|
93
|
+
const optionsInputContainer = getAllByTestId('options-input-container')[0];
|
|
94
|
+
act(() => {
|
|
95
|
+
fireEvent.click(optionsInputContainer);
|
|
96
|
+
});
|
|
97
|
+
await waitFor(() => {
|
|
98
|
+
expect(screen.queryByTestId('options-dropdown-list')).not.toBeInTheDocument();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
it('should handle input focus properly', () => {
|
|
102
|
+
const { getAllByTestId } = render(_jsx(OptionsInput, { ...props }));
|
|
103
|
+
const optionsInputContainer = getAllByTestId('options-input-container')[0];
|
|
104
|
+
act(() => {
|
|
105
|
+
fireEvent.focus(optionsInputContainer);
|
|
106
|
+
});
|
|
107
|
+
expect(props.onFocus).toHaveBeenCalledWith({
|
|
108
|
+
dog: 0,
|
|
109
|
+
luggage: 2,
|
|
110
|
+
'sport-equipment': 1,
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
it('should handle input blur properly', () => {
|
|
114
|
+
const { getAllByTestId } = render(_jsx(OptionsInput, { ...props }));
|
|
115
|
+
const optionsInputContainer = getAllByTestId('options-input-container')[0];
|
|
116
|
+
act(() => {
|
|
117
|
+
fireEvent.blur(optionsInputContainer);
|
|
118
|
+
});
|
|
119
|
+
expect(props.onBlur).toHaveBeenCalledWith({
|
|
120
|
+
dog: 0,
|
|
121
|
+
luggage: 2,
|
|
122
|
+
'sport-equipment': 1,
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
it('should handle input option change properly', async () => {
|
|
126
|
+
const { getAllByTestId } = render(_jsx(OptionsInput, { ...props }));
|
|
127
|
+
const optionsInputContainer = getAllByTestId('options-input-container')[0];
|
|
128
|
+
act(() => {
|
|
129
|
+
fireEvent.click(optionsInputContainer);
|
|
130
|
+
});
|
|
131
|
+
await waitFor(() => {
|
|
132
|
+
const optionCountInput = screen.getAllByTestId('dropdown-item-input')[0];
|
|
133
|
+
act(() => {
|
|
134
|
+
fireEvent.change(optionCountInput, { target: { value: 9 } });
|
|
135
|
+
});
|
|
136
|
+
expect(props.onChange).toHaveBeenCalledWith({
|
|
137
|
+
dog: 0,
|
|
138
|
+
luggage: 9,
|
|
139
|
+
'sport-equipment': 1,
|
|
140
|
+
});
|
|
141
|
+
expect(screen.getAllByTestId('option-item')[0]).toHaveTextContent('9');
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
it('should handle input option blur properly', async () => {
|
|
145
|
+
const { getAllByTestId } = render(_jsx(OptionsInput, { ...props }));
|
|
146
|
+
const optionsInputContainer = getAllByTestId('options-input-container')[0];
|
|
147
|
+
fireEvent.click(optionsInputContainer);
|
|
148
|
+
await waitFor(() => {
|
|
149
|
+
const optionCountInput = screen.getAllByTestId('dropdown-item-input')[0];
|
|
150
|
+
act(() => {
|
|
151
|
+
fireEvent.change(optionCountInput, { target: { value: 500 } });
|
|
152
|
+
});
|
|
153
|
+
expect(optionCountInput).toHaveAttribute('value', '500');
|
|
154
|
+
act(() => {
|
|
155
|
+
fireEvent.blur(optionCountInput);
|
|
156
|
+
});
|
|
157
|
+
expect(optionCountInput).toHaveAttribute('value', '9');
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
//# sourceMappingURL=options-input.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-input.spec.js","sourceRoot":"","sources":["../options-input.spec.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,MAAM,EACN,MAAM,EACN,SAAS,EACT,OAAO,EACP,GAAG,GACJ,MAAM,wBAAwB,CAAC;AAChC,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB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AC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACnC,CAAC,CAAC,CAAC;gBAEH,MAAM,CAAC,gBAAgB,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/586096eb9/talixo-ds.component_options-input@0.0.22/dist/options-input.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/586096eb9/talixo-ds.component_options-input@0.0.22/dist/options-input.docs.mdx';
|
|
3
|
+
|
|
4
|
+
export const compositions = [compositions_0];
|
|
5
|
+
export const overview = [overview_0];
|
|
6
|
+
|
|
7
|
+
export const compositions_metadata = {"compositions":[{"displayName":"Basic options input","identifier":"BasicOptionsInput"},{"displayName":"Options input with default values","identifier":"OptionsInputWithDefaultValues"},{"displayName":"Options input with persistent options","identifier":"OptionsInputWithPersistentOptions"},{"displayName":"Options input disabled","identifier":"OptionsInputDisabled"}]};
|
package/dist/styles.scss
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.options-input {
|
|
2
|
+
&__container {
|
|
3
|
+
border: thin solid transparent;
|
|
4
|
+
border-radius: 0.25rem;
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
align-items: center;
|
|
8
|
+
padding: 0.25rem;
|
|
9
|
+
gap: 1rem;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
width: fit-content;
|
|
12
|
+
|
|
13
|
+
&--open {
|
|
14
|
+
border-bottom-width: 0;
|
|
15
|
+
border-bottom-left-radius: 0;
|
|
16
|
+
border-bottom-right-radius: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&--disabled {
|
|
20
|
+
cursor: unset;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&--read-only {
|
|
24
|
+
cursor: unset;
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
border-color: transparent;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__dropdown-item {
|
|
33
|
+
gap: 1rem;
|
|
34
|
+
|
|
35
|
+
&--empty {
|
|
36
|
+
background-color: #eeeeee;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__dropdown-item-input {
|
|
41
|
+
width: 2rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&__dropdown-item-buttons {
|
|
45
|
+
& > button[role="button"] {
|
|
46
|
+
min-width: 2rem;
|
|
47
|
+
padding: 0;
|
|
48
|
+
|
|
49
|
+
&[disabled] > svg {
|
|
50
|
+
color: #0000001f;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
7
|
+
],
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"experimentalDecorators": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"paths": {
|
|
21
|
+
"react": [
|
|
22
|
+
"./node_modules/@types/react"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"exclude": [
|
|
27
|
+
"artifacts",
|
|
28
|
+
"public",
|
|
29
|
+
"dist",
|
|
30
|
+
"node_modules",
|
|
31
|
+
"package.json",
|
|
32
|
+
"**/*.cjs",
|
|
33
|
+
"./dist",
|
|
34
|
+
"./dist"
|
|
35
|
+
],
|
|
36
|
+
"include": [
|
|
37
|
+
"**/*",
|
|
38
|
+
"**/*.json"
|
|
39
|
+
]
|
|
40
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface OptionsInputOption {
|
|
2
|
+
id: string;
|
|
3
|
+
icon: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
details?: string;
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
quantity?: number;
|
|
9
|
+
inputQuantity?: string | number;
|
|
10
|
+
}
|
|
11
|
+
export interface OptionsInputValue {
|
|
12
|
+
[key: string]: number;
|
|
13
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":""}
|