@coveord/plasma-mantine 48.6.0 → 48.9.1
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +6 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/modal-wizard/ModalWizard.js +24 -21
- package/dist/cjs/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/cjs/theme/Theme.js +0 -6
- package/dist/cjs/theme/Theme.js.map +1 -1
- package/dist/definitions/components/modal-wizard/ModalWizard.d.ts +3 -14
- package/dist/definitions/components/modal-wizard/ModalWizard.d.ts.map +1 -1
- package/dist/definitions/theme/Theme.d.ts.map +1 -1
- package/dist/esm/components/modal-wizard/ModalWizard.js +25 -22
- package/dist/esm/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/esm/theme/Theme.js +0 -6
- package/dist/esm/theme/Theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/modal-wizard/ModalWizard.tsx +14 -42
- package/src/components/modal-wizard/__tests__/ModalWizard.spec.tsx +45 -39
- package/src/theme/Theme.tsx +0 -6
- package/dist/cjs/components/collection/Collection.example.js +0 -64
- package/dist/cjs/components/collection/Collection.example.js.map +0 -1
- package/dist/definitions/components/collection/Collection.example.d.ts +0 -4
- package/dist/definitions/components/collection/Collection.example.d.ts.map +0 -1
- package/dist/esm/components/collection/Collection.example.js +0 -54
- package/dist/esm/components/collection/Collection.example.js.map +0 -1
- package/src/components/collection/Collection.example.tsx +0 -37
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {Button,
|
|
1
|
+
import {Button, Modal, ModalProps, Progress} from '@mantine/core';
|
|
2
2
|
import {Children, ReactElement, useMemo, useState} from 'react';
|
|
3
3
|
import {StickyFooter} from '../sticky-footer';
|
|
4
4
|
import {ModalWizardStep} from './ModalWizardStep';
|
|
5
5
|
import {Header} from '../header';
|
|
6
6
|
|
|
7
|
-
interface ModalWizardProps {
|
|
7
|
+
interface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {
|
|
8
8
|
/**
|
|
9
9
|
* The label of the cancel button
|
|
10
10
|
*
|
|
@@ -17,20 +17,20 @@ interface ModalWizardProps {
|
|
|
17
17
|
*
|
|
18
18
|
* @default "Next"
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
20
|
nextButtonLabel?: string;
|
|
21
|
+
|
|
22
22
|
/**
|
|
23
23
|
* The label of the previous button
|
|
24
24
|
*
|
|
25
25
|
* @default "Previous"
|
|
26
26
|
*/
|
|
27
27
|
previousButtonLabel?: string;
|
|
28
|
+
|
|
28
29
|
/**
|
|
29
30
|
* The label of the finish button
|
|
30
31
|
*
|
|
31
32
|
* @default "Finish"
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
34
|
finishButtonLabel?: string;
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -43,12 +43,6 @@ interface ModalWizardProps {
|
|
|
43
43
|
*/
|
|
44
44
|
onPrevious?: () => unknown;
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
* A callback function that is executed when the user clicks on the cancel button
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
onClose?: () => unknown;
|
|
51
|
-
|
|
52
46
|
/**
|
|
53
47
|
* A function that is executed when user completes all the steps.
|
|
54
48
|
*
|
|
@@ -59,7 +53,6 @@ interface ModalWizardProps {
|
|
|
59
53
|
/**
|
|
60
54
|
* Determine if user interacted with any steps in the modal wizard
|
|
61
55
|
*/
|
|
62
|
-
|
|
63
56
|
isDirty?: () => boolean;
|
|
64
57
|
|
|
65
58
|
/**
|
|
@@ -67,32 +60,14 @@ interface ModalWizardProps {
|
|
|
67
60
|
*/
|
|
68
61
|
handleDirtyState?: () => boolean;
|
|
69
62
|
|
|
70
|
-
/**
|
|
71
|
-
* Props to pass to each modal
|
|
72
|
-
*/
|
|
73
|
-
modalProps?: any;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Label for close button
|
|
77
|
-
*/
|
|
78
|
-
closeButtonLabel?: string;
|
|
79
|
-
|
|
80
63
|
/**
|
|
81
64
|
* Children to display in modal wizard
|
|
82
65
|
* */
|
|
83
66
|
children?: Array<ReturnType<typeof ModalWizardStep>>;
|
|
84
67
|
}
|
|
85
68
|
|
|
86
|
-
const useStyles = createStyles(() => ({
|
|
87
|
-
modal: {
|
|
88
|
-
height: '70%',
|
|
89
|
-
display: 'flex',
|
|
90
|
-
flexDirection: 'column',
|
|
91
|
-
},
|
|
92
|
-
}));
|
|
93
|
-
|
|
94
69
|
interface ModalWizardType {
|
|
95
|
-
|
|
70
|
+
(props: ModalWizardProps): ReactElement;
|
|
96
71
|
|
|
97
72
|
Step: typeof ModalWizardStep;
|
|
98
73
|
}
|
|
@@ -102,15 +77,16 @@ export const ModalWizard: ModalWizardType = ({
|
|
|
102
77
|
nextButtonLabel = 'Next',
|
|
103
78
|
previousButtonLabel = 'Previous',
|
|
104
79
|
finishButtonLabel = 'Finish',
|
|
80
|
+
opened,
|
|
105
81
|
onNext,
|
|
106
82
|
onPrevious,
|
|
107
83
|
onClose,
|
|
108
84
|
onFinish,
|
|
109
85
|
isDirty,
|
|
110
|
-
modalProps,
|
|
111
86
|
handleDirtyState,
|
|
112
|
-
|
|
87
|
+
classNames,
|
|
113
88
|
children,
|
|
89
|
+
...modalProps
|
|
114
90
|
}) => {
|
|
115
91
|
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
|
116
92
|
const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);
|
|
@@ -124,8 +100,6 @@ export const ModalWizard: ModalWizardType = ({
|
|
|
124
100
|
const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};
|
|
125
101
|
const isModalDirty = isDirty && isDirty();
|
|
126
102
|
|
|
127
|
-
const {classes} = useStyles();
|
|
128
|
-
|
|
129
103
|
const closeModalWizard = () => {
|
|
130
104
|
if (isModalDirty && handleDirtyState) {
|
|
131
105
|
handleDirtyState() && onClose?.();
|
|
@@ -145,14 +119,12 @@ export const ModalWizard: ModalWizardType = ({
|
|
|
145
119
|
|
|
146
120
|
return (
|
|
147
121
|
<Modal
|
|
148
|
-
opened
|
|
149
|
-
classNames={
|
|
122
|
+
opened={opened}
|
|
123
|
+
classNames={classNames}
|
|
150
124
|
centered
|
|
151
|
-
closeButtonLabel={closeButtonLabel}
|
|
152
|
-
padding="xl"
|
|
153
125
|
title={
|
|
154
126
|
<Header
|
|
155
|
-
docLink={currentStep.props.
|
|
127
|
+
docLink={currentStep.props.docLink}
|
|
156
128
|
description={
|
|
157
129
|
typeof currentStep.props.description === 'function'
|
|
158
130
|
? currentStep.props.description(currentStepIndex + 1, numberOfSteps)
|
|
@@ -169,13 +141,13 @@ export const ModalWizard: ModalWizardType = ({
|
|
|
169
141
|
onClose={closeModalWizard}
|
|
170
142
|
{...modalProps}
|
|
171
143
|
>
|
|
172
|
-
{currentStep.props.showProgressBar && <Progress value={getProgressMemo} />}
|
|
144
|
+
{currentStep.props.showProgressBar && <Progress color="teal" size="lg" value={getProgressMemo} />}
|
|
173
145
|
{currentStep}
|
|
174
146
|
<StickyFooter borderTop py={null} px={null} pt="md">
|
|
175
147
|
<Button
|
|
176
148
|
name={isFirstStep ? cancelButtonLabel : previousButtonLabel}
|
|
177
149
|
disabled={false}
|
|
178
|
-
size="
|
|
150
|
+
size="sm"
|
|
179
151
|
variant="outline"
|
|
180
152
|
onClick={() => {
|
|
181
153
|
if (isFirstStep) {
|
|
@@ -191,7 +163,7 @@ export const ModalWizard: ModalWizardType = ({
|
|
|
191
163
|
|
|
192
164
|
<Button
|
|
193
165
|
disabled={!isValid}
|
|
194
|
-
size="
|
|
166
|
+
size="sm"
|
|
195
167
|
onClick={() => {
|
|
196
168
|
if (isLastStep) {
|
|
197
169
|
onFinish ? onFinish() : onClose();
|
|
@@ -2,31 +2,32 @@ import {render, screen, userEvent} from '@test-utils';
|
|
|
2
2
|
import {ModalWizard} from '../ModalWizard';
|
|
3
3
|
|
|
4
4
|
describe('ModalWizard', () => {
|
|
5
|
-
it('navigate
|
|
6
|
-
const user = userEvent.setup(
|
|
5
|
+
it('navigate modal steps using footer buttons', async () => {
|
|
6
|
+
const user = userEvent.setup();
|
|
7
|
+
|
|
7
8
|
const modelSteps = [
|
|
8
9
|
{
|
|
9
10
|
docLink: 'https://google.com',
|
|
10
|
-
title: (currentStep
|
|
11
|
-
validateStep: (
|
|
11
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
12
|
+
validateStep: () => ({isValid: true}),
|
|
12
13
|
element: <div> Slide 1</div>,
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
docLink: 'https://google.com',
|
|
16
|
-
title: (currentStep
|
|
17
|
-
validateStep: (
|
|
17
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
18
|
+
validateStep: () => ({isValid: true}),
|
|
18
19
|
element: <div> Slide 2</div>,
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
docLink: 'https://google.com',
|
|
22
|
-
title: (currentStep
|
|
23
|
-
validateStep: (
|
|
23
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
24
|
+
validateStep: () => ({isValid: false}),
|
|
24
25
|
element: <div> Slide 3</div>,
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
28
|
docLink: 'https://google.com',
|
|
28
|
-
title: (currentStep
|
|
29
|
-
validateStep: (
|
|
29
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
30
|
+
validateStep: () => ({isValid: false}),
|
|
30
31
|
element: <div> Unreachable slide</div>,
|
|
31
32
|
},
|
|
32
33
|
];
|
|
@@ -38,11 +39,13 @@ describe('ModalWizard', () => {
|
|
|
38
39
|
closeButtonLabel="closebuttonlabel"
|
|
39
40
|
isDirty={isDirty}
|
|
40
41
|
handleDirtyState={() => confirm('Are you sure you want to close?')}
|
|
42
|
+
opened={true}
|
|
43
|
+
onClose={undefined}
|
|
41
44
|
>
|
|
42
45
|
{modelSteps.map((model_item) => (
|
|
43
46
|
<ModalWizard.Step
|
|
44
47
|
docLink={model_item.docLink}
|
|
45
|
-
title={(currentStep
|
|
48
|
+
title={(currentStep) => 'Current Step is: ' + currentStep}
|
|
46
49
|
validateStep={model_item.validateStep}
|
|
47
50
|
>
|
|
48
51
|
{model_item.element}
|
|
@@ -153,13 +156,14 @@ describe('ModalWizard', () => {
|
|
|
153
156
|
).toBeInTheDocument();
|
|
154
157
|
});
|
|
155
158
|
|
|
156
|
-
it('
|
|
157
|
-
const user = userEvent.setup(
|
|
159
|
+
it('calls the onClose prop when closing the modal', async () => {
|
|
160
|
+
const user = userEvent.setup();
|
|
161
|
+
|
|
158
162
|
const modelSteps = [
|
|
159
163
|
{
|
|
160
164
|
docLink: 'https://google.com',
|
|
161
|
-
title: (currentStep
|
|
162
|
-
validateStep: (
|
|
165
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
166
|
+
validateStep: () => ({isValid: true}),
|
|
163
167
|
element: <div> Slide 1</div>,
|
|
164
168
|
},
|
|
165
169
|
];
|
|
@@ -168,11 +172,11 @@ describe('ModalWizard', () => {
|
|
|
168
172
|
const onClose = jest.fn();
|
|
169
173
|
|
|
170
174
|
render(
|
|
171
|
-
<ModalWizard isDirty={isDirty} onClose={onClose} closeButtonLabel="closebuttonlabel">
|
|
175
|
+
<ModalWizard isDirty={isDirty} onClose={onClose} closeButtonLabel="closebuttonlabel" opened={true}>
|
|
172
176
|
{modelSteps.map((model_item) => (
|
|
173
177
|
<ModalWizard.Step
|
|
174
178
|
docLink={model_item.docLink}
|
|
175
|
-
title={(currentStep
|
|
179
|
+
title={(currentStep) => 'Current Step is: ' + currentStep}
|
|
176
180
|
validateStep={model_item.validateStep}
|
|
177
181
|
>
|
|
178
182
|
{model_item.element}
|
|
@@ -189,13 +193,13 @@ describe('ModalWizard', () => {
|
|
|
189
193
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
190
194
|
});
|
|
191
195
|
|
|
192
|
-
it('modal
|
|
193
|
-
const user = userEvent.setup(
|
|
196
|
+
it('closes the modal when clicking on cancel', async () => {
|
|
197
|
+
const user = userEvent.setup();
|
|
194
198
|
const modelSteps = [
|
|
195
199
|
{
|
|
196
200
|
docLink: 'https://google.com',
|
|
197
|
-
title: (currentStep
|
|
198
|
-
validateStep: (
|
|
201
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
202
|
+
validateStep: () => ({isValid: true}),
|
|
199
203
|
element: <div> Slide 1</div>,
|
|
200
204
|
},
|
|
201
205
|
];
|
|
@@ -204,11 +208,11 @@ describe('ModalWizard', () => {
|
|
|
204
208
|
const onClose = jest.fn();
|
|
205
209
|
|
|
206
210
|
render(
|
|
207
|
-
<ModalWizard isDirty={isDirty} onClose={onClose}>
|
|
211
|
+
<ModalWizard isDirty={isDirty} onClose={onClose} opened={true}>
|
|
208
212
|
{modelSteps.map((model_item) => (
|
|
209
213
|
<ModalWizard.Step
|
|
210
214
|
docLink={model_item.docLink}
|
|
211
|
-
title={(currentStep
|
|
215
|
+
title={(currentStep) => 'Current Step is: ' + currentStep}
|
|
212
216
|
validateStep={model_item.validateStep}
|
|
213
217
|
>
|
|
214
218
|
{model_item.element}
|
|
@@ -225,13 +229,13 @@ describe('ModalWizard', () => {
|
|
|
225
229
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
226
230
|
});
|
|
227
231
|
|
|
228
|
-
it('
|
|
229
|
-
const user = userEvent.setup(
|
|
232
|
+
it('calls onFinish prop when clicking on finish button', async () => {
|
|
233
|
+
const user = userEvent.setup();
|
|
230
234
|
const modelSteps = [
|
|
231
235
|
{
|
|
232
236
|
docLink: 'https://google.com',
|
|
233
|
-
title: (currentStep
|
|
234
|
-
validateStep: (
|
|
237
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
238
|
+
validateStep: () => ({isValid: true}),
|
|
235
239
|
element: <div> Slide 1</div>,
|
|
236
240
|
},
|
|
237
241
|
];
|
|
@@ -241,11 +245,11 @@ describe('ModalWizard', () => {
|
|
|
241
245
|
const onFinish = jest.fn();
|
|
242
246
|
|
|
243
247
|
render(
|
|
244
|
-
<ModalWizard isDirty={isDirty} onClose={onClose} onFinish={onFinish}>
|
|
248
|
+
<ModalWizard isDirty={isDirty} onClose={onClose} onFinish={onFinish} opened={true}>
|
|
245
249
|
{modelSteps.map((model_item) => (
|
|
246
250
|
<ModalWizard.Step
|
|
247
251
|
docLink={model_item.docLink}
|
|
248
|
-
title={(currentStep
|
|
252
|
+
title={(currentStep) => 'Current Step is: ' + currentStep}
|
|
249
253
|
validateStep={model_item.validateStep}
|
|
250
254
|
>
|
|
251
255
|
{model_item.element}
|
|
@@ -262,13 +266,13 @@ describe('ModalWizard', () => {
|
|
|
262
266
|
expect(onFinish).toHaveBeenCalledTimes(1);
|
|
263
267
|
});
|
|
264
268
|
|
|
265
|
-
it('
|
|
266
|
-
const user = userEvent.setup(
|
|
269
|
+
it('triggers handleDirty callback when the modal wizard has dirty state', async () => {
|
|
270
|
+
const user = userEvent.setup();
|
|
267
271
|
const modelSteps = [
|
|
268
272
|
{
|
|
269
273
|
docLink: 'https://google.com',
|
|
270
|
-
title: (currentStep
|
|
271
|
-
validateStep: (
|
|
274
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
275
|
+
validateStep: () => ({isValid: true}),
|
|
272
276
|
element: <div> Slide 1</div>,
|
|
273
277
|
},
|
|
274
278
|
];
|
|
@@ -283,11 +287,12 @@ describe('ModalWizard', () => {
|
|
|
283
287
|
onClose={onClose}
|
|
284
288
|
handleDirtyState={handleDirtyState}
|
|
285
289
|
closeButtonLabel="closebuttonlabel"
|
|
290
|
+
opened={true}
|
|
286
291
|
>
|
|
287
292
|
{modelSteps.map((model_item) => (
|
|
288
293
|
<ModalWizard.Step
|
|
289
294
|
docLink={model_item.docLink}
|
|
290
|
-
title={(currentStep
|
|
295
|
+
title={(currentStep) => 'Current Step is: ' + currentStep}
|
|
291
296
|
validateStep={model_item.validateStep}
|
|
292
297
|
>
|
|
293
298
|
{model_item.element}
|
|
@@ -306,13 +311,13 @@ describe('ModalWizard', () => {
|
|
|
306
311
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
307
312
|
});
|
|
308
313
|
|
|
309
|
-
it('
|
|
310
|
-
const user = userEvent.setup(
|
|
314
|
+
it('close the modal if user confirms close when the modal wizard has dirty state', async () => {
|
|
315
|
+
const user = userEvent.setup();
|
|
311
316
|
const modelSteps = [
|
|
312
317
|
{
|
|
313
318
|
docLink: 'https://google.com',
|
|
314
|
-
title: (currentStep
|
|
315
|
-
validateStep: (
|
|
319
|
+
title: (currentStep: string) => 'Current Step is: ' + currentStep,
|
|
320
|
+
validateStep: () => ({isValid: true}),
|
|
316
321
|
element: <div> Slide 1</div>,
|
|
317
322
|
},
|
|
318
323
|
];
|
|
@@ -327,11 +332,12 @@ describe('ModalWizard', () => {
|
|
|
327
332
|
onClose={onClose}
|
|
328
333
|
handleDirtyState={handleDirtyState}
|
|
329
334
|
closeButtonLabel="closebuttonlabel"
|
|
335
|
+
opened={true}
|
|
330
336
|
>
|
|
331
337
|
{modelSteps.map((model_item) => (
|
|
332
338
|
<ModalWizard.Step
|
|
333
339
|
docLink={model_item.docLink}
|
|
334
|
-
title={(currentStep
|
|
340
|
+
title={(currentStep) => 'Current Step is: ' + currentStep}
|
|
335
341
|
validateStep={model_item.validateStep}
|
|
336
342
|
>
|
|
337
343
|
{model_item.element}
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _objectSpread = require("@swc/helpers/lib/_object_spread.js").default;
|
|
12
|
-
var _objectSpreadProps = require("@swc/helpers/lib/_object_spread_props.js").default;
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _core = require("@mantine/core");
|
|
15
|
-
var _form = require("@mantine/form");
|
|
16
|
-
var _collection = require("./Collection");
|
|
17
|
-
var _default = function() {
|
|
18
|
-
var form = (0, _form.useForm)({
|
|
19
|
-
initialValues: {
|
|
20
|
-
todoList: [
|
|
21
|
-
{
|
|
22
|
-
name: "wash the dishes",
|
|
23
|
-
done: true
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "take out the trash",
|
|
27
|
-
done: false
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "vacuum the floors",
|
|
31
|
-
done: true
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_collection.Collection, _objectSpreadProps(_objectSpread({
|
|
37
|
-
draggable: true,
|
|
38
|
-
addLabel: "Add task",
|
|
39
|
-
newItem: {
|
|
40
|
-
name: "",
|
|
41
|
-
done: false
|
|
42
|
-
}
|
|
43
|
-
}, form.getInputProps("todoList")), {
|
|
44
|
-
children: function(task, index) {
|
|
45
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
46
|
-
children: [
|
|
47
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.TextInput, _objectSpreadProps(_objectSpread({
|
|
48
|
-
autoFocus: true,
|
|
49
|
-
placeholder: "Do something ..."
|
|
50
|
-
}, form.getInputProps("todoList.".concat(index, ".name"))), {
|
|
51
|
-
styles: {
|
|
52
|
-
flex: 1
|
|
53
|
-
}
|
|
54
|
-
})),
|
|
55
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Checkbox, _objectSpread({}, form.getInputProps("todoList.".concat(index, ".done"), {
|
|
56
|
-
type: "checkbox"
|
|
57
|
-
})))
|
|
58
|
-
]
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
//# sourceMappingURL=Collection.example.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/collection/Collection.example.tsx"],"sourcesContent":["import {Checkbox, TextInput} from '@mantine/core';\nimport {useForm} from '@mantine/form';\n\nimport {Collection} from './Collection';\n\nexport default () => {\n const form = useForm({\n initialValues: {\n todoList: [\n {name: 'wash the dishes', done: true},\n {name: 'take out the trash', done: false},\n {name: 'vacuum the floors', done: true},\n ],\n },\n });\n\n return (\n <Collection<{name: string; done: boolean}>\n draggable\n addLabel=\"Add task\"\n newItem={{name: '', done: false}}\n {...form.getInputProps('todoList')}\n >\n {(task, index) => (\n <>\n <TextInput\n autoFocus\n placeholder=\"Do something ...\"\n {...form.getInputProps(`todoList.${index}.name`)}\n styles={{flex: 1}}\n />\n <Checkbox {...form.getInputProps(`todoList.${index}.done`, {type: 'checkbox'})} />\n </>\n )}\n </Collection>\n );\n};\n"],"names":["form","useForm","initialValues","todoList","name","done","Collection","draggable","addLabel","newItem","getInputProps","task","index","TextInput","autoFocus","placeholder","styles","flex","Checkbox","type"],"mappings":"AAAA;;;;+BAKA,SA+BE;;;eA/BF,QA+BE;;;;;;oBApCgC,eAAe;oBAC3B,eAAe;0BAEZ,cAAc;IAEvC,QA+BE,GA/Ba,WAAM;IACjB,IAAMA,IAAI,GAAGC,IAAAA,KAAO,QAAA,EAAC;QACjBC,aAAa,EAAE;YACXC,QAAQ,EAAE;gBACN;oBAACC,IAAI,EAAE,iBAAiB;oBAAEC,IAAI,EAAE,IAAI;iBAAC;gBACrC;oBAACD,IAAI,EAAE,oBAAoB;oBAAEC,IAAI,EAAE,KAAK;iBAAC;gBACzC;oBAACD,IAAI,EAAE,mBAAmB;oBAAEC,IAAI,EAAE,IAAI;iBAAC;aAC1C;SACJ;KACJ,CAAC,AAAC;IAEH,qBACI,qBAACC,WAAU,WAAA;QACPC,SAAS;QACTC,QAAQ,EAAC,UAAU;QACnBC,OAAO,EAAE;YAACL,IAAI,EAAE,EAAE;YAAEC,IAAI,EAAE,KAAK;SAAC;OAC5BL,IAAI,CAACU,aAAa,CAAC,UAAU,CAAC;kBAEjC,SAACC,IAAI,EAAEC,KAAK;iCACT;;kCACI,qBAACC,KAAS,UAAA;wBACNC,SAAS;wBACTC,WAAW,EAAC,kBAAkB;uBAC1Bf,IAAI,CAACU,aAAa,CAAC,AAAC,WAAS,CAAQ,MAAK,CAAXE,KAAK,EAAC,OAAK,CAAC,CAAC;wBAChDI,MAAM,EAAE;4BAACC,IAAI,EAAE,CAAC;yBAAC;uBACnB;kCACF,qBAACC,KAAQ,SAAA,oBAAKlB,IAAI,CAACU,aAAa,CAAC,AAAC,WAAS,CAAQ,MAAK,CAAXE,KAAK,EAAC,OAAK,CAAC,EAAE;wBAACO,IAAI,EAAE,UAAU;qBAAC,CAAC,EAAI;;cACnF;SACN;OACQ,CACf;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.example.d.ts","sourceRoot":"","sources":["../../../../src/components/collection/Collection.example.tsx"],"names":[],"mappings":";;AAKA,wBA+BE"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
|
-
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
3
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
-
import { Checkbox, TextInput } from "@mantine/core";
|
|
5
|
-
import { useForm } from "@mantine/form";
|
|
6
|
-
import { Collection } from "./Collection";
|
|
7
|
-
export default function() {
|
|
8
|
-
var form = useForm({
|
|
9
|
-
initialValues: {
|
|
10
|
-
todoList: [
|
|
11
|
-
{
|
|
12
|
-
name: "wash the dishes",
|
|
13
|
-
done: true
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "take out the trash",
|
|
17
|
-
done: false
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "vacuum the floors",
|
|
21
|
-
done: true
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return /*#__PURE__*/ _jsx(Collection, _object_spread_props(_object_spread({
|
|
27
|
-
draggable: true,
|
|
28
|
-
addLabel: "Add task",
|
|
29
|
-
newItem: {
|
|
30
|
-
name: "",
|
|
31
|
-
done: false
|
|
32
|
-
}
|
|
33
|
-
}, form.getInputProps("todoList")), {
|
|
34
|
-
children: function(task, index) {
|
|
35
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
36
|
-
children: [
|
|
37
|
-
/*#__PURE__*/ _jsx(TextInput, _object_spread_props(_object_spread({
|
|
38
|
-
autoFocus: true,
|
|
39
|
-
placeholder: "Do something ..."
|
|
40
|
-
}, form.getInputProps("todoList.".concat(index, ".name"))), {
|
|
41
|
-
styles: {
|
|
42
|
-
flex: 1
|
|
43
|
-
}
|
|
44
|
-
})),
|
|
45
|
-
/*#__PURE__*/ _jsx(Checkbox, _object_spread({}, form.getInputProps("todoList.".concat(index, ".done"), {
|
|
46
|
-
type: "checkbox"
|
|
47
|
-
})))
|
|
48
|
-
]
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=Collection.example.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/collection/Collection.example.tsx"],"sourcesContent":["import {Checkbox, TextInput} from '@mantine/core';\nimport {useForm} from '@mantine/form';\n\nimport {Collection} from './Collection';\n\nexport default () => {\n const form = useForm({\n initialValues: {\n todoList: [\n {name: 'wash the dishes', done: true},\n {name: 'take out the trash', done: false},\n {name: 'vacuum the floors', done: true},\n ],\n },\n });\n\n return (\n <Collection<{name: string; done: boolean}>\n draggable\n addLabel=\"Add task\"\n newItem={{name: '', done: false}}\n {...form.getInputProps('todoList')}\n >\n {(task, index) => (\n <>\n <TextInput\n autoFocus\n placeholder=\"Do something ...\"\n {...form.getInputProps(`todoList.${index}.name`)}\n styles={{flex: 1}}\n />\n <Checkbox {...form.getInputProps(`todoList.${index}.done`, {type: 'checkbox'})} />\n </>\n )}\n </Collection>\n );\n};\n"],"names":["Checkbox","TextInput","useForm","Collection","form","initialValues","todoList","name","done","draggable","addLabel","newItem","getInputProps","task","index","autoFocus","placeholder","styles","flex","type"],"mappings":"AAAA;;;AAAA,SAAQA,QAAQ,EAAEC,SAAS,QAAO,eAAe,CAAC;AAClD,SAAQC,OAAO,QAAO,eAAe,CAAC;AAEtC,SAAQC,UAAU,QAAO,cAAc,CAAC;AAExC,eAAe,WAAM;IACjB,IAAMC,IAAI,GAAGF,OAAO,CAAC;QACjBG,aAAa,EAAE;YACXC,QAAQ,EAAE;gBACN;oBAACC,IAAI,EAAE,iBAAiB;oBAAEC,IAAI,EAAE,IAAI;iBAAC;gBACrC;oBAACD,IAAI,EAAE,oBAAoB;oBAAEC,IAAI,EAAE,KAAK;iBAAC;gBACzC;oBAACD,IAAI,EAAE,mBAAmB;oBAAEC,IAAI,EAAE,IAAI;iBAAC;aAC1C;SACJ;KACJ,CAAC,AAAC;IAEH,qBACI,KAACL,UAAU;QACPM,SAAS;QACTC,QAAQ,EAAC,UAAU;QACnBC,OAAO,EAAE;YAACJ,IAAI,EAAE,EAAE;YAAEC,IAAI,EAAE,KAAK;SAAC;OAC5BJ,IAAI,CAACQ,aAAa,CAAC,UAAU,CAAC;kBAEjC,SAACC,IAAI,EAAEC,KAAK;iCACT;;kCACI,KAACb,SAAS;wBACNc,SAAS;wBACTC,WAAW,EAAC,kBAAkB;uBAC1BZ,IAAI,CAACQ,aAAa,CAAC,AAAC,WAAS,CAAQ,MAAK,CAAXE,KAAK,EAAC,OAAK,CAAC,CAAC;wBAChDG,MAAM,EAAE;4BAACC,IAAI,EAAE,CAAC;yBAAC;uBACnB;kCACF,KAAClB,QAAQ,qBAAKI,IAAI,CAACQ,aAAa,CAAC,AAAC,WAAS,CAAQ,MAAK,CAAXE,KAAK,EAAC,OAAK,CAAC,EAAE;wBAACK,IAAI,EAAE,UAAU;qBAAC,CAAC,EAAI;;cACnF;SACN;OACQ,CACf;AACN,CAAC,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {Checkbox, TextInput} from '@mantine/core';
|
|
2
|
-
import {useForm} from '@mantine/form';
|
|
3
|
-
|
|
4
|
-
import {Collection} from './Collection';
|
|
5
|
-
|
|
6
|
-
export default () => {
|
|
7
|
-
const form = useForm({
|
|
8
|
-
initialValues: {
|
|
9
|
-
todoList: [
|
|
10
|
-
{name: 'wash the dishes', done: true},
|
|
11
|
-
{name: 'take out the trash', done: false},
|
|
12
|
-
{name: 'vacuum the floors', done: true},
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Collection<{name: string; done: boolean}>
|
|
19
|
-
draggable
|
|
20
|
-
addLabel="Add task"
|
|
21
|
-
newItem={{name: '', done: false}}
|
|
22
|
-
{...form.getInputProps('todoList')}
|
|
23
|
-
>
|
|
24
|
-
{(task, index) => (
|
|
25
|
-
<>
|
|
26
|
-
<TextInput
|
|
27
|
-
autoFocus
|
|
28
|
-
placeholder="Do something ..."
|
|
29
|
-
{...form.getInputProps(`todoList.${index}.name`)}
|
|
30
|
-
styles={{flex: 1}}
|
|
31
|
-
/>
|
|
32
|
-
<Checkbox {...form.getInputProps(`todoList.${index}.done`, {type: 'checkbox'})} />
|
|
33
|
-
</>
|
|
34
|
-
)}
|
|
35
|
-
</Collection>
|
|
36
|
-
);
|
|
37
|
-
};
|