Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Storybook 8 doesn't add implicit fn() on actions anymore
- Add missinng component type type annotations
  • Loading branch information
CharString committed Dec 5, 2023
1 parent 06817a1 commit 9613441
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/ComponentConfiguration.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {SupportedLocales} from '@open-formulieren/types';
import {expect} from '@storybook/jest';
import {expect, jest} from '@storybook/jest';
import {Meta, StoryFn, StoryObj} from '@storybook/react';
import {fireEvent, userEvent, waitFor, within} from '@storybook/testing-library';
import React from 'react';
Expand Down Expand Up @@ -72,6 +72,7 @@ export default {
schema: {placeholder: ''},
weight: 0,
},
onSubmit: jest.fn(),
},
} as Meta<typeof ComponentConfiguration>;

Expand Down
2 changes: 1 addition & 1 deletion src/components/JSONEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ const JSONEdit: React.FC<JSONEditProps & TextareaHTMLAttributes<HTMLTextAreaElem
setJsonLogicError(error.toString());
return;
}
updateValue(updatedData); // valid JSON
const error = validateLogic(updatedData);
if (error) {
setJsonLogicError(error);
return;
}
updateValue(updatedData); // valid JSON
};

const errorMessageId = JsonLogicError ? uniqueId() : '';
Expand Down
10 changes: 9 additions & 1 deletion src/utils/jsonlogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ const dataTypeForComponent = (
// For now return example values as accepted by InferNoLogic
// But example values cannot distinguish arrays from tuples!
const value = {
address: {
postcode: '',
houseNumber: '',
houseLetter: '',
houseNumberAddition: '',
},
currency: 1,
number: 1,
checkbox: true,
Expand All @@ -129,10 +135,12 @@ const dataTypeForComponent = (
npFamilyMembers: {}, // TODO record type
map: [1, 1], // TODO tuple type
bsn: 'string',
content: null,
columns: null, // layout component
content: null, // layout component
date: 'date', // TODO string for now
datetime: 'datetime', // TODO string for now
editgrid: [{}], // TODO inspect the component
fieldset: null, // layout component
email: 'string',
file: [
{
Expand Down

0 comments on commit 9613441

Please sign in to comment.