-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into renovate/react-hook-form-7.x
- Loading branch information
Showing
53 changed files
with
8,573 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ultraviolet/ui": patch | ||
--- | ||
|
||
New components `SelectableCardGroup` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@ultraviolet/plus": minor | ||
--- | ||
|
||
- New component `<SteppedListContainer>` | ||
- New props `prominence` and `onClick` to `<StepList>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ultraviolet/form": patch | ||
--- | ||
|
||
New component ultraviolet/ui and `SelectableCardGroupField` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ultraviolet/illustrations": patch | ||
--- | ||
|
||
New various illustrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/form/src/components/SelectableCardGroupField/__stories__/Checkbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { StoryFn } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
import { SelectableCardGroupField } from '../..' | ||
|
||
export const Checkbox: StoryFn< | ||
ComponentProps<typeof SelectableCardGroupField> | ||
> = args => ( | ||
<SelectableCardGroupField {...args} type="checkbox"> | ||
<SelectableCardGroupField.Card value="radio 1" label="Radio 1" /> | ||
<SelectableCardGroupField.Card value="radio 2" label="Radio 2" /> | ||
</SelectableCardGroupField> | ||
) | ||
|
||
Checkbox.args = { | ||
name: 'mySelectableCardGroup', | ||
legend: 'Checkbox', | ||
showTick: true, | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/form/src/components/SelectableCardGroupField/__stories__/Error.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { StoryFn } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
import { SelectableCardGroupField } from '../..' | ||
|
||
export const Error: StoryFn< | ||
ComponentProps<typeof SelectableCardGroupField> | ||
> = args => ( | ||
<SelectableCardGroupField {...args} error="This is an error"> | ||
<SelectableCardGroupField.Card value="radio 1" label="Radio 1" /> | ||
<SelectableCardGroupField.Card value="radio 2" label="Radio 2" /> | ||
</SelectableCardGroupField> | ||
) | ||
|
||
Error.args = { | ||
name: 'mySelectableCardGroup', | ||
legend: 'Legend label', | ||
columns: 2, | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/form/src/components/SelectableCardGroupField/__stories__/Playground.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Template } from './Template.stories' | ||
|
||
export const Playground = Template.bind({}) | ||
|
||
Playground.args = { ...Template.args } |
28 changes: 28 additions & 0 deletions
28
packages/form/src/components/SelectableCardGroupField/__stories__/Required.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { StoryFn } from '@storybook/react' | ||
import { Stack } from '@ultraviolet/ui' | ||
import type { ComponentProps } from 'react' | ||
import { SelectableCardGroupField } from '..' | ||
import { Submit } from '../..' | ||
|
||
export const Required: StoryFn< | ||
ComponentProps<typeof SelectableCardGroupField> | ||
> = args => ( | ||
<Stack gap={1}> | ||
<SelectableCardGroupField {...args}> | ||
<SelectableCardGroupField.Card value="checkbox-1" label="Checkbox 1" /> | ||
<SelectableCardGroupField.Card value="checkbox-2" label="Checkbox 2" /> | ||
<SelectableCardGroupField.Card value="checkbox-3" label="Checkbox 3" /> | ||
<SelectableCardGroupField.Card value="checkbox-4" label="Checkbox 4" /> | ||
</SelectableCardGroupField> | ||
<Submit>Submit</Submit> | ||
</Stack> | ||
) | ||
|
||
Required.args = { | ||
name: 'mySelectableCardGroup', | ||
legend: 'Checkbox', | ||
showTick: true, | ||
required: true, | ||
type: 'checkbox', | ||
columns: 2, | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/form/src/components/SelectableCardGroupField/__stories__/Template.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { StoryFn } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
import { SelectableCardGroupField } from '../..' | ||
|
||
export const Template: StoryFn< | ||
ComponentProps<typeof SelectableCardGroupField> | ||
> = args => ( | ||
<SelectableCardGroupField {...args}> | ||
<SelectableCardGroupField.Card value="radio 1" label="Radio 1" /> | ||
<SelectableCardGroupField.Card value="radio 2" label="Radio 2" /> | ||
</SelectableCardGroupField> | ||
) | ||
|
||
Template.args = { | ||
name: 'mySelectableCardGroup', | ||
legend: 'Legend label', | ||
showTick: true, | ||
} |
83 changes: 83 additions & 0 deletions
83
packages/form/src/components/SelectableCardGroupField/__stories__/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import type { Meta } from '@storybook/react' | ||
import { Snippet, Stack, Text } from '@ultraviolet/ui' | ||
import { useForm } from 'react-hook-form' | ||
import { Form, SelectableCardGroupField } from '../..' | ||
import { mockErrors } from '../../../mocks' | ||
|
||
export default { | ||
component: SelectableCardGroupField, | ||
subcomponents: { | ||
'SelectableCardGroupField.Card': SelectableCardGroupField.Card, | ||
}, | ||
decorators: [ | ||
ChildStory => { | ||
const methods = useForm() | ||
const { | ||
errors, | ||
isDirty, | ||
isSubmitting, | ||
touchedFields, | ||
submitCount, | ||
dirtyFields, | ||
isValid, | ||
isLoading, | ||
isSubmitted, | ||
isValidating, | ||
isSubmitSuccessful, | ||
} = methods.formState | ||
|
||
return ( | ||
<Form onRawSubmit={() => {}} errors={mockErrors} methods={methods}> | ||
<Stack gap={2}> | ||
{ChildStory()} | ||
<Stack gap={1}> | ||
<Text variant="bodyStrong" as="p"> | ||
Form input values: | ||
</Text> | ||
<Snippet prefix="lines" initiallyExpanded> | ||
{JSON.stringify(methods.watch(), null, 1)} | ||
</Snippet> | ||
</Stack> | ||
<Stack gap={1}> | ||
<Text variant="bodyStrong" as="p"> | ||
Form values: | ||
</Text> | ||
<Snippet prefix="lines"> | ||
{JSON.stringify( | ||
{ | ||
errors, | ||
isDirty, | ||
isSubmitting, | ||
touchedFields, | ||
submitCount, | ||
dirtyFields, | ||
isValid, | ||
isLoading, | ||
isSubmitted, | ||
isValidating, | ||
isSubmitSuccessful, | ||
}, | ||
null, | ||
1, | ||
)} | ||
</Snippet> | ||
</Stack> | ||
</Stack> | ||
</Form> | ||
) | ||
}, | ||
], | ||
parameters: { | ||
docs: { | ||
description: { | ||
component: 'A group of Selectable cards field', | ||
}, | ||
}, | ||
}, | ||
title: 'Form/Components/Fields/SelectableCardGroupField', | ||
} as Meta | ||
|
||
export { Playground } from './Playground.stories' | ||
export { Checkbox } from './Checkbox' | ||
export { Required } from './Required.stories' | ||
export { Error } from './Error.stories' |
Oops, something went wrong.