@pie-lib/config-ui 13.0.3-next.3 → 13.0.4-next.0

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 (188) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/alert-dialog.d.ts +44 -0
  3. package/dist/alert-dialog.js +47 -0
  4. package/dist/checkbox.d.ts +34 -0
  5. package/dist/checkbox.js +57 -0
  6. package/dist/choice-configuration/feedback-menu.d.ts +32 -0
  7. package/dist/choice-configuration/feedback-menu.js +85 -0
  8. package/dist/choice-configuration/index.d.ts +62 -0
  9. package/dist/choice-configuration/index.js +240 -0
  10. package/dist/choice-utils.d.ts +21 -0
  11. package/dist/choice-utils.js +15 -0
  12. package/dist/feedback-config/feedback-selector.d.ts +33 -0
  13. package/dist/feedback-config/feedback-selector.js +92 -0
  14. package/dist/feedback-config/group.d.ts +21 -0
  15. package/dist/feedback-config/group.js +33 -0
  16. package/dist/feedback-config/index.d.ts +48 -0
  17. package/dist/feedback-config/index.js +96 -0
  18. package/dist/form-section.d.ts +25 -0
  19. package/dist/form-section.js +25 -0
  20. package/dist/help.d.ts +41 -0
  21. package/dist/help.js +61 -0
  22. package/dist/index.d.ts +31 -0
  23. package/dist/index.js +34 -0
  24. package/dist/input.d.ts +29 -0
  25. package/dist/input.js +65 -0
  26. package/dist/inputs.d.ts +63 -0
  27. package/dist/inputs.js +70 -0
  28. package/dist/langs.d.ts +41 -0
  29. package/dist/langs.js +76 -0
  30. package/dist/layout/config-layout.d.ts +10 -0
  31. package/dist/layout/config-layout.js +75 -0
  32. package/dist/layout/index.d.ts +11 -0
  33. package/dist/layout/index.js +10 -0
  34. package/dist/layout/layout-contents.d.ts +21 -0
  35. package/dist/layout/layout-contents.js +70 -0
  36. package/dist/layout/settings-box.d.ts +19 -0
  37. package/dist/layout/settings-box.js +31 -0
  38. package/dist/mui-box/index.d.ts +21 -0
  39. package/dist/mui-box/index.js +47 -0
  40. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  41. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  42. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  43. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  44. package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +122 -0
  45. package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +276 -0
  46. package/dist/number-text-field-custom.d.ts +51 -0
  47. package/dist/number-text-field-custom.js +192 -0
  48. package/dist/number-text-field.d.ts +47 -0
  49. package/dist/number-text-field.js +122 -0
  50. package/dist/radio-with-label.d.ts +25 -0
  51. package/dist/radio-with-label.js +27 -0
  52. package/dist/settings/display-size.d.ts +26 -0
  53. package/dist/settings/display-size.js +45 -0
  54. package/dist/settings/index.d.ts +45 -0
  55. package/dist/settings/index.js +63 -0
  56. package/dist/settings/panel.d.ts +27 -0
  57. package/dist/settings/panel.js +201 -0
  58. package/dist/settings/settings-radio-label.d.ts +25 -0
  59. package/dist/settings/settings-radio-label.js +29 -0
  60. package/dist/settings/toggle.d.ts +25 -0
  61. package/dist/settings/toggle.js +33 -0
  62. package/dist/tabs/index.d.ts +22 -0
  63. package/dist/tabs/index.js +39 -0
  64. package/dist/tags-input/index.d.ts +21 -0
  65. package/dist/tags-input/index.js +83 -0
  66. package/dist/two-choice.d.ts +43 -0
  67. package/dist/two-choice.js +79 -0
  68. package/dist/with-stateful-model.d.ts +42 -0
  69. package/dist/with-stateful-model.js +32 -0
  70. package/package.json +30 -18
  71. package/CHANGELOG.json +0 -32
  72. package/CHANGELOG.md +0 -2415
  73. package/LICENSE.md +0 -5
  74. package/lib/alert-dialog.js +0 -68
  75. package/lib/alert-dialog.js.map +0 -1
  76. package/lib/checkbox.js +0 -84
  77. package/lib/checkbox.js.map +0 -1
  78. package/lib/choice-configuration/feedback-menu.js +0 -129
  79. package/lib/choice-configuration/feedback-menu.js.map +0 -1
  80. package/lib/choice-configuration/index.js +0 -381
  81. package/lib/choice-configuration/index.js.map +0 -1
  82. package/lib/choice-utils.js +0 -42
  83. package/lib/choice-utils.js.map +0 -1
  84. package/lib/feedback-config/feedback-selector.js +0 -155
  85. package/lib/feedback-config/feedback-selector.js.map +0 -1
  86. package/lib/feedback-config/group.js +0 -61
  87. package/lib/feedback-config/group.js.map +0 -1
  88. package/lib/feedback-config/index.js +0 -146
  89. package/lib/feedback-config/index.js.map +0 -1
  90. package/lib/form-section.js +0 -44
  91. package/lib/form-section.js.map +0 -1
  92. package/lib/help.js +0 -106
  93. package/lib/help.js.map +0 -1
  94. package/lib/index.js +0 -186
  95. package/lib/index.js.map +0 -1
  96. package/lib/input.js +0 -106
  97. package/lib/input.js.map +0 -1
  98. package/lib/inputs.js +0 -105
  99. package/lib/inputs.js.map +0 -1
  100. package/lib/langs.js +0 -136
  101. package/lib/langs.js.map +0 -1
  102. package/lib/layout/config-layout.js +0 -137
  103. package/lib/layout/config-layout.js.map +0 -1
  104. package/lib/layout/index.js +0 -21
  105. package/lib/layout/index.js.map +0 -1
  106. package/lib/layout/layout-contents.js +0 -160
  107. package/lib/layout/layout-contents.js.map +0 -1
  108. package/lib/layout/settings-box.js +0 -57
  109. package/lib/layout/settings-box.js.map +0 -1
  110. package/lib/mui-box/index.js +0 -63
  111. package/lib/mui-box/index.js.map +0 -1
  112. package/lib/number-text-field-custom.js +0 -376
  113. package/lib/number-text-field-custom.js.map +0 -1
  114. package/lib/number-text-field.js +0 -229
  115. package/lib/number-text-field.js.map +0 -1
  116. package/lib/radio-with-label.js +0 -48
  117. package/lib/radio-with-label.js.map +0 -1
  118. package/lib/settings/display-size.js +0 -61
  119. package/lib/settings/display-size.js.map +0 -1
  120. package/lib/settings/index.js +0 -110
  121. package/lib/settings/index.js.map +0 -1
  122. package/lib/settings/panel.js +0 -392
  123. package/lib/settings/panel.js.map +0 -1
  124. package/lib/settings/settings-radio-label.js +0 -51
  125. package/lib/settings/settings-radio-label.js.map +0 -1
  126. package/lib/settings/toggle.js +0 -63
  127. package/lib/settings/toggle.js.map +0 -1
  128. package/lib/tabs/index.js +0 -75
  129. package/lib/tabs/index.js.map +0 -1
  130. package/lib/tags-input/index.js +0 -149
  131. package/lib/tags-input/index.js.map +0 -1
  132. package/lib/two-choice.js +0 -136
  133. package/lib/two-choice.js.map +0 -1
  134. package/lib/with-stateful-model.js +0 -61
  135. package/lib/with-stateful-model.js.map +0 -1
  136. package/src/__tests__/alert-dialog.test.jsx +0 -183
  137. package/src/__tests__/checkbox.test.jsx +0 -152
  138. package/src/__tests__/choice-utils.test.js +0 -12
  139. package/src/__tests__/form-section.test.jsx +0 -328
  140. package/src/__tests__/help.test.jsx +0 -184
  141. package/src/__tests__/input.test.jsx +0 -156
  142. package/src/__tests__/langs.test.jsx +0 -376
  143. package/src/__tests__/number-text-field-custom.test.jsx +0 -255
  144. package/src/__tests__/number-text-field.test.jsx +0 -263
  145. package/src/__tests__/radio-with-label.test.jsx +0 -155
  146. package/src/__tests__/settings-panel.test.js +0 -187
  147. package/src/__tests__/settings.test.jsx +0 -452
  148. package/src/__tests__/tabs.test.jsx +0 -188
  149. package/src/__tests__/two-choice.test.js +0 -110
  150. package/src/__tests__/with-stateful-model.test.jsx +0 -139
  151. package/src/alert-dialog.jsx +0 -75
  152. package/src/checkbox.jsx +0 -61
  153. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +0 -151
  154. package/src/choice-configuration/__tests__/index.test.jsx +0 -234
  155. package/src/choice-configuration/feedback-menu.jsx +0 -96
  156. package/src/choice-configuration/index.jsx +0 -357
  157. package/src/choice-utils.js +0 -30
  158. package/src/feedback-config/__tests__/feedback-config.test.jsx +0 -141
  159. package/src/feedback-config/__tests__/feedback-selector.test.jsx +0 -97
  160. package/src/feedback-config/feedback-selector.jsx +0 -112
  161. package/src/feedback-config/group.jsx +0 -51
  162. package/src/feedback-config/index.jsx +0 -111
  163. package/src/form-section.jsx +0 -31
  164. package/src/help.jsx +0 -79
  165. package/src/index.js +0 -55
  166. package/src/input.jsx +0 -72
  167. package/src/inputs.jsx +0 -69
  168. package/src/langs.jsx +0 -111
  169. package/src/layout/__tests__/config.layout.test.jsx +0 -59
  170. package/src/layout/__tests__/layout-content.test.jsx +0 -3
  171. package/src/layout/config-layout.jsx +0 -103
  172. package/src/layout/index.js +0 -4
  173. package/src/layout/layout-contents.jsx +0 -117
  174. package/src/layout/settings-box.jsx +0 -32
  175. package/src/mui-box/index.jsx +0 -56
  176. package/src/number-text-field-custom.jsx +0 -333
  177. package/src/number-text-field.jsx +0 -215
  178. package/src/radio-with-label.jsx +0 -30
  179. package/src/settings/display-size.jsx +0 -53
  180. package/src/settings/index.js +0 -83
  181. package/src/settings/panel.jsx +0 -333
  182. package/src/settings/settings-radio-label.jsx +0 -32
  183. package/src/settings/toggle.jsx +0 -46
  184. package/src/tabs/index.jsx +0 -47
  185. package/src/tags-input/__tests__/index.test.jsx +0 -113
  186. package/src/tags-input/index.jsx +0 -116
  187. package/src/two-choice.jsx +0 -90
  188. package/src/with-stateful-model.jsx +0 -36
@@ -1,184 +0,0 @@
1
- import React from 'react';
2
- import { render, screen, waitFor } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
4
- import Help, { HelpButton, HelpDialog } from '../help';
5
-
6
- describe('HelpButton', () => {
7
- it('renders help icon button', () => {
8
- render(<HelpButton />);
9
- const button = screen.getByRole('button');
10
- expect(button).toBeInTheDocument();
11
- });
12
-
13
- it('calls onClick when clicked', async () => {
14
- const user = userEvent.setup();
15
- const onClick = jest.fn();
16
- render(<HelpButton onClick={onClick} />);
17
-
18
- const button = screen.getByRole('button');
19
- await user.click(button);
20
-
21
- expect(onClick).toHaveBeenCalledTimes(1);
22
- });
23
-
24
- it('renders with large size', () => {
25
- const { container } = render(<HelpButton />);
26
- const button = container.querySelector('button[class*="sizeLarge"]');
27
- expect(button || screen.getByRole('button')).toBeInTheDocument();
28
- });
29
- });
30
-
31
- describe('HelpDialog', () => {
32
- const defaultProps = {
33
- open: true,
34
- onClose: jest.fn(),
35
- title: 'Help Title',
36
- children: 'Help content here',
37
- };
38
-
39
- beforeEach(() => {
40
- jest.clearAllMocks();
41
- });
42
-
43
- it('renders when open is true', () => {
44
- render(<HelpDialog {...defaultProps} />);
45
- expect(screen.getByText('Help Title')).toBeInTheDocument();
46
- expect(screen.getByText('Help content here')).toBeInTheDocument();
47
- });
48
-
49
- it('does not render when open is false', () => {
50
- render(<HelpDialog {...defaultProps} open={false} />);
51
- expect(screen.queryByText('Help Title')).not.toBeInTheDocument();
52
- });
53
-
54
- it('displays title correctly', () => {
55
- render(<HelpDialog {...defaultProps} title="Custom Help" />);
56
- expect(screen.getByText('Custom Help')).toBeInTheDocument();
57
- });
58
-
59
- it('displays children content', () => {
60
- const content = 'This is helpful information';
61
- render(<HelpDialog {...defaultProps} children={content} />);
62
- expect(screen.getByText(content)).toBeInTheDocument();
63
- });
64
-
65
- it('calls onClose when OK button is clicked', async () => {
66
- const user = userEvent.setup();
67
- const onClose = jest.fn();
68
- render(<HelpDialog {...defaultProps} onClose={onClose} />);
69
-
70
- const okButton = screen.getByRole('button', { name: /OK/i });
71
- await user.click(okButton);
72
-
73
- expect(onClose).toHaveBeenCalledTimes(1);
74
- });
75
-
76
- it('calls onClose when dialog is closed via backdrop', async () => {
77
- const user = userEvent.setup();
78
- const onClose = jest.fn();
79
- render(<HelpDialog {...defaultProps} onClose={onClose} />);
80
-
81
- // Simulate backdrop click by calling onClose (MUI Dialog prop)
82
- const dialog = screen.getByRole('dialog', { hidden: true });
83
- expect(dialog).toBeInTheDocument();
84
- });
85
-
86
- it('renders OK button', () => {
87
- render(<HelpDialog {...defaultProps} />);
88
- const okButton = screen.getByRole('button', { name: /OK/i });
89
- expect(okButton).toBeInTheDocument();
90
- });
91
-
92
- it('handles multiline children content', () => {
93
- const content = ['Line 1', 'Line 2', 'Line 3'];
94
- render(
95
- <HelpDialog {...defaultProps}>
96
- {content.map((line, i) => (
97
- <div key={i}>{line}</div>
98
- ))}
99
- </HelpDialog>,
100
- );
101
- expect(screen.getByText('Line 1')).toBeInTheDocument();
102
- expect(screen.getByText('Line 2')).toBeInTheDocument();
103
- expect(screen.getByText('Line 3')).toBeInTheDocument();
104
- });
105
- });
106
-
107
- describe('Help Component', () => {
108
- const defaultProps = {
109
- title: 'Help Title',
110
- children: 'Help content',
111
- };
112
-
113
- beforeEach(() => {
114
- jest.clearAllMocks();
115
- });
116
-
117
- it('renders help button initially', () => {
118
- render(<Help {...defaultProps} />);
119
- const button = screen.getByRole('button');
120
- expect(button).toBeInTheDocument();
121
- });
122
-
123
- it('opens dialog when help button is clicked', async () => {
124
- const user = userEvent.setup();
125
- render(<Help {...defaultProps} />);
126
-
127
- const button = screen.getByRole('button');
128
- await user.click(button);
129
-
130
- expect(screen.getByText('Help Title')).toBeInTheDocument();
131
- expect(screen.getByText('Help content')).toBeInTheDocument();
132
- });
133
-
134
- it('closes dialog when OK button is clicked', async () => {
135
- const user = userEvent.setup();
136
- render(<Help {...defaultProps} />);
137
-
138
- const helpButton = screen.getByRole('button', { name: '' });
139
- await user.click(helpButton);
140
-
141
- const okButton = screen.getByRole('button', { name: /OK/i });
142
- await user.click(okButton);
143
-
144
- await waitFor(() => {
145
- expect(screen.queryByText('Help Title')).not.toBeInTheDocument();
146
- });
147
- });
148
-
149
- it('displays title prop', () => {
150
- render(<Help title="Custom Title" children="content" />);
151
- const button = screen.getByRole('button');
152
- expect(button).toBeInTheDocument();
153
- });
154
-
155
- it('displays children prop', async () => {
156
- const user = userEvent.setup();
157
- render(<Help {...defaultProps} children="Custom help content" />);
158
-
159
- const button = screen.getByRole('button');
160
- await user.click(button);
161
-
162
- expect(screen.getByText('Custom help content')).toBeInTheDocument();
163
- });
164
-
165
- it('can open and close dialog multiple times', async () => {
166
- const user = userEvent.setup();
167
- render(<Help {...defaultProps} />);
168
-
169
- const helpButton = screen.getByRole('button', { name: '' });
170
-
171
- await user.click(helpButton);
172
- expect(screen.getByText('Help Title')).toBeInTheDocument();
173
-
174
- let okButton = screen.getByRole('button', { name: /OK/i });
175
- await user.click(okButton);
176
-
177
- await waitFor(() => {
178
- expect(screen.queryByText('Help Title')).not.toBeInTheDocument();
179
- });
180
-
181
- await user.click(helpButton);
182
- expect(screen.getByText('Help Title')).toBeInTheDocument();
183
- });
184
- });
@@ -1,156 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
4
- import Input from '../input';
5
-
6
- describe('Input Component', () => {
7
- const onChange = jest.fn();
8
-
9
- beforeEach(() => {
10
- onChange.mockClear();
11
- });
12
-
13
- describe('Rendering', () => {
14
- it('should render input without label', () => {
15
- const { container } = render(<Input type="text" value="test" onChange={onChange} />);
16
-
17
- const input = container.querySelector('input');
18
- expect(input).toBeInTheDocument();
19
- expect(input.value).toBe('test');
20
- });
21
-
22
- it('should render input with label', () => {
23
- render(<Input type="text" label="Email" value="test@example.com" onChange={onChange} />);
24
-
25
- expect(screen.getByText('Email')).toBeInTheDocument();
26
- const input = screen.getByDisplayValue('test@example.com');
27
- expect(input).toBeInTheDocument();
28
- });
29
-
30
- it('should render input with different types', () => {
31
- const { container: numberContainer } = render(<Input type="number" value={123} onChange={onChange} />);
32
- expect(numberContainer.querySelector('input[type="number"]')).toBeInTheDocument();
33
-
34
- const { container: emailContainer } = render(<Input type="email" value="test@example.com" onChange={onChange} />);
35
- expect(emailContainer.querySelector('input[type="email"]')).toBeInTheDocument();
36
-
37
- const { container: passwordContainer } = render(<Input type="password" value="secret" onChange={onChange} />);
38
- expect(passwordContainer.querySelector('input[type="password"]')).toBeInTheDocument();
39
- });
40
- });
41
-
42
- describe('Value handling', () => {
43
- it('should handle string values', () => {
44
- const { container } = render(<Input type="text" value="hello" onChange={onChange} />);
45
- expect(container.querySelector('input').value).toBe('hello');
46
- });
47
-
48
- it('should handle number values', () => {
49
- const { container } = render(<Input type="number" value={42} onChange={onChange} />);
50
- expect(container.querySelector('input').value).toBe('42');
51
- });
52
-
53
- it('should handle empty values', () => {
54
- const { container } = render(<Input type="text" value="" onChange={onChange} />);
55
- expect(container.querySelector('input').value).toBe('');
56
- });
57
-
58
- it('should update when prop changes', () => {
59
- const { container, rerender } = render(<Input type="text" value="initial" onChange={onChange} />);
60
- expect(container.querySelector('input').value).toBe('initial');
61
-
62
- rerender(<Input type="text" value="updated" onChange={onChange} />);
63
- expect(container.querySelector('input').value).toBe('updated');
64
- });
65
- });
66
-
67
- describe('onChange behavior', () => {
68
- it('should call onChange on input change', async () => {
69
- const user = userEvent.setup();
70
- const { container } = render(<Input type="text" value="" onChange={onChange} />);
71
-
72
- const input = container.querySelector('input');
73
- await user.type(input, 'hello');
74
-
75
- expect(onChange).toHaveBeenCalled();
76
- });
77
-
78
- it('should handle custom error function', async () => {
79
- const user = userEvent.setup();
80
- const customError = jest.fn((value) => value.length < 3);
81
-
82
- const { container } = render(<Input type="text" value="" onChange={onChange} error={customError} />);
83
-
84
- const input = container.querySelector('input');
85
- await user.type(input, 'ab');
86
-
87
- expect(customError).toHaveBeenCalled();
88
- });
89
- });
90
-
91
- describe('Error state', () => {
92
- it('should display error state when validation fails', async () => {
93
- const user = userEvent.setup();
94
- const customError = jest.fn(() => true);
95
-
96
- const { container } = render(<Input type="text" value="" onChange={onChange} error={customError} />);
97
-
98
- const input = container.querySelector('input');
99
- await user.type(input, 'test');
100
-
101
- expect(customError).toHaveBeenCalled();
102
- });
103
-
104
- it('should clear error state when validation passes', async () => {
105
- const user = userEvent.setup();
106
- const customError = jest.fn((value) => !value);
107
-
108
- const { container } = render(<Input type="text" value="" onChange={onChange} error={customError} />);
109
-
110
- const input = container.querySelector('input');
111
- await user.type(input, 'test');
112
-
113
- // After typing valid content, error should be false
114
- expect(customError).toHaveBeenCalled();
115
- });
116
- });
117
-
118
- describe('Props spreading', () => {
119
- it('should handle disabled state', () => {
120
- const { container } = render(<Input type="text" value="" onChange={onChange} disabled />);
121
-
122
- const input = container.querySelector('input');
123
- expect(input).toBeDisabled();
124
- });
125
-
126
- it('should handle readonly state', () => {
127
- const { container } = render(<Input type="text" value="readonly" onChange={onChange} readOnly />);
128
-
129
- const input = container.querySelector('input');
130
- expect(input).toHaveAttribute('readonly');
131
- });
132
- });
133
-
134
- describe('Default props', () => {
135
- it('should use default type of text', () => {
136
- const { container } = render(<Input value="" onChange={onChange} />);
137
-
138
- const input = container.querySelector('input');
139
- expect(input.type).toBe('text');
140
- });
141
-
142
- it('should use default error function that validates number type', () => {
143
- const { container } = render(<Input type="number" value="" onChange={onChange} />);
144
-
145
- const input = container.querySelector('input');
146
- expect(input).toBeInTheDocument();
147
- });
148
-
149
- it('should have noModelUpdateOnError default to false', () => {
150
- const { container } = render(<Input type="text" value="" onChange={onChange} />);
151
-
152
- const input = container.querySelector('input');
153
- expect(input).toBeInTheDocument();
154
- });
155
- });
156
- });