-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DateInput): new prop input (#4737)
* feat: new prop input dateinput * fix: feedback and add prop to DateField * fix: tests * fix: rebase
- Loading branch information
Showing
18 changed files
with
5,132 additions
and
3,304 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 | ||
--- | ||
|
||
`<DateInput />`: new prop `input` to show calendar as a card, with no input |
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 | ||
--- | ||
|
||
Add prop `input` to `<DateInputFieldV2 />` |
18 changes: 18 additions & 0 deletions
18
packages/form/src/components/DateField/__stories__/Input.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 { Stack } from '@ultraviolet/ui' | ||
import type { ComponentProps } from 'react' | ||
import { DateField } from '..' | ||
import { Submit } from '../../Submit' | ||
|
||
export const Input: StoryFn<ComponentProps<typeof DateField>> = args => ( | ||
<Stack gap={1}> | ||
<DateField {...args} /> | ||
<Submit>Submit</Submit> | ||
</Stack> | ||
) | ||
|
||
Input.args = { | ||
name: 'date', | ||
required: true, | ||
input: 'calendar', | ||
} |
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
44 changes: 44 additions & 0 deletions
44
packages/ui/src/components/DateInput/__stories__/Calendar.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,44 @@ | ||
import type { StoryFn } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
import { useState } from 'react' | ||
import { DateInput } from '..' | ||
import { Stack } from '../../Stack' | ||
|
||
export const Calendar: StoryFn<ComponentProps<typeof DateInput>> = args => { | ||
const [value, setValue] = useState<Date | null>() | ||
|
||
return ( | ||
<Stack gap={2}> | ||
<DateInput | ||
{...args} | ||
label="As a calendar" | ||
value={value} | ||
onChange={setValue} | ||
input="calendar" | ||
selectsRange={false} | ||
/> | ||
Selected date: {value?.toDateString()} | ||
</Stack> | ||
) | ||
} | ||
|
||
Calendar.args = { | ||
input: 'calendar', | ||
} | ||
|
||
Calendar.decorators = [ | ||
StoryComponent => ( | ||
<div style={{ height: '350px' }}> | ||
<StoryComponent /> | ||
</div> | ||
), | ||
] | ||
|
||
Calendar.parameters = { | ||
docs: { | ||
description: { | ||
story: | ||
'Set prop `input` to "calendar" in order to only display the calendar part of the component (no popover, no text input).', | ||
}, | ||
}, | ||
} |
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
Oops, something went wrong.