Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"lint-staged": "12.1.2",
"lodash.isempty": "4.4.0",
"lodash.isobject": "3.0.2",
"prettier": "2.3.2",
"prettier": "2.7.1",
"react": "17.0.2",
"react-dnd": "14.0.4",
"react-dnd-html5-backend": "14.0.2",
Expand Down
47 changes: 24 additions & 23 deletions src/__tests__/deprecated/ChoiceFieldset.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,32 @@ import userEvent from '@testing-library/user-event'
import ChoiceFieldset, {Item, ChoiceFieldsetProps} from '../../deprecated/ChoiceFieldset'
import {ChoiceFieldsetListProps} from '../../deprecated/ChoiceFieldset/ChoiceFieldsetList'

const SelectableChoicelistFieldset: React.FC<React.PropsWithChildren<ChoiceFieldsetProps & ChoiceFieldsetListProps>> =
({onSelect, selectionVariant, selected = []}) => {
const [selectionVals, setSelectionVals] = React.useState<string[]>(selected)
const SelectableChoicelistFieldset: React.FC<
React.PropsWithChildren<ChoiceFieldsetProps & ChoiceFieldsetListProps>
> = ({onSelect, selectionVariant, selected = []}) => {
const [selectionVals, setSelectionVals] = React.useState<string[]>(selected)

React.useEffect(() => {
onSelect && onSelect(selectionVals)
}, [onSelect, selectionVals])
React.useEffect(() => {
onSelect && onSelect(selectionVals)
}, [onSelect, selectionVals])

return (
<SSRProvider>
<ChoiceFieldset
onSelect={selectedVals => {
setSelectionVals(selectedVals)
}}
selected={selectionVals}
>
<ChoiceFieldset.Legend>Legend</ChoiceFieldset.Legend>
<ChoiceFieldset.List selectionVariant={selectionVariant}>
<ChoiceFieldset.Item value="labelOne">Label one</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="labelTwo">Label two</ChoiceFieldset.Item>
</ChoiceFieldset.List>
</ChoiceFieldset>
</SSRProvider>
)
}
return (
<SSRProvider>
<ChoiceFieldset
onSelect={selectedVals => {
setSelectionVals(selectedVals)
}}
selected={selectionVals}
>
<ChoiceFieldset.Legend>Legend</ChoiceFieldset.Legend>
<ChoiceFieldset.List selectionVariant={selectionVariant}>
<ChoiceFieldset.Item value="labelOne">Label one</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="labelTwo">Label two</ChoiceFieldset.Item>
</ChoiceFieldset.List>
</ChoiceFieldset>
</SSRProvider>
)
}

describe('ChoiceFieldset', () => {
it('renders default', () => {
Expand Down
7 changes: 3 additions & 4 deletions src/utils/types/MandateProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ where 'id' and 'label' required:
type DatumWithRequiredIdAndLabel = MandateProps<Datum, 'id' | 'label'>
*/

export type MandateProps<T extends unknown, K extends keyof T> = Omit<T, K> &
{
[MK in K]-?: NonNullable<T[MK]>
}
export type MandateProps<T extends unknown, K extends keyof T> = Omit<T, K> & {
[MK in K]-?: NonNullable<T[MK]>
}