-
Notifications
You must be signed in to change notification settings - Fork 94
refactor: move input to app #18819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
refactor: move input to app #18819
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0666d9a
moved Datepicker to lib
adamhaeger a09dac2
merge
adamhaeger 6aa43c2
fix
adamhaeger ba1ac3c
changed paths update
adamhaeger 4cdd85b
extracted mocks to __mocks__
adamhaeger 0a0d7b6
Merge branch 'main' into refactor/move-Datepicker-to-app
adamhaeger 731f2a2
importing from @app
adamhaeger 3124efd
cleanup after code review
adamhaeger cca3019
Merge branch 'main' into refactor/move-Datepicker-to-app
adamhaeger d4e361d
fixed broken imports
adamhaeger ca3d464
moved Input to lib
adamhaeger 5402916
Merge branch 'refactor/move-Datepicker-to-app' into refactor/move-Inp…
adamhaeger da05e62
merge
adamhaeger 789ae87
Merge branch 'refactor/move-Datepicker-to-app' into refactor/move-Inp…
adamhaeger fe95528
removed unused IGridStyling.xl size
adamhaeger bf79f00
moved constants to layout component
adamhaeger 061cf17
merge and fix broken test
adamhaeger 4d707fc
fixed unused
adamhaeger 1bfea13
Merge branch 'main' into refactor/move-Input-to-app
adamhaeger 2bc469d
Merge branch 'main' into refactor/move-Input-to-app
adamhaeger e2248b9
Merge branch 'main' into refactor/move-Input-to-app
adamhaeger 610ef1c
merge
adamhaeger 0828395
cleanup after code review
adamhaeger 7c93f76
Merge branch 'refactor/move-Input-to-app' of https://github.com/Altin…
adamhaeger 69fab81
Merge branch 'main' into refactor/move-Input-to-app
adamhaeger 2232c5e
moved FormattedInput and NumericInput to sepearate files
adamhaeger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
File renamed without changes.
5 changes: 2 additions & 3 deletions
5
...ponents/Datepicker/DatePickerCalendar.tsx → ...ponents/Datepicker/DatePickerCalendar.tsx
This file contains hidden or 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 hidden or 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
58 changes: 58 additions & 0 deletions
58
libs/form-component/src/app-components/Datepicker/Datepicker.stories.tsx
This file contains hidden or 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,58 @@ | ||
| import { useState } from 'react'; | ||
| import type { MonthCaptionProps } from 'react-day-picker'; | ||
|
|
||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||
|
|
||
| import 'react-day-picker/style.css'; | ||
|
|
||
| import { DatePickerControl } from './Datepicker'; | ||
|
|
||
| const NoopDropdownCaption = ({ calendarMonth }: MonthCaptionProps) => ( | ||
| <div style={{ padding: 8, fontWeight: 600 }}> | ||
| {calendarMonth.date.toLocaleString('en', { month: 'long', year: 'numeric' })} | ||
| </div> | ||
| ); | ||
|
|
||
| const meta = { | ||
| title: 'AppComponents/DatePickerControl', | ||
| component: DatePickerControl, | ||
| } satisfies Meta<typeof DatePickerControl>; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| const Wrapper = (args: React.ComponentProps<typeof DatePickerControl>) => { | ||
| const [value, setValue] = useState(args.value); | ||
| return <DatePickerControl {...args} value={value} onValueChange={setValue} />; | ||
| }; | ||
|
|
||
| export const Preview: Story = { | ||
| args: { | ||
| id: 'datepicker-preview', | ||
| value: '2025-03-15', | ||
| dateFormat: 'dd.MM.yyyy', | ||
| locale: 'nb', | ||
| buttonAriaLabel: 'Open date picker', | ||
| calendarIconTitle: 'Calendar', | ||
| DropdownCaption: NoopDropdownCaption, | ||
| }, | ||
| render: (args) => <Wrapper {...args} />, | ||
| }; | ||
|
|
||
| export const ReadOnly: Story = { | ||
| args: { | ||
| ...Preview.args, | ||
| readOnly: true, | ||
| }, | ||
| render: (args) => <Wrapper {...args} />, | ||
| }; | ||
|
|
||
| export const WithMinMax: Story = { | ||
| args: { | ||
| ...Preview.args, | ||
| minDate: new Date('2025-01-01'), | ||
| maxDate: new Date('2025-12-31'), | ||
| }, | ||
| render: (args) => <Wrapper {...args} />, | ||
| }; |
This file contains hidden or 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
7 changes: 3 additions & 4 deletions
7
...omponents/Datepicker/DatepickerDialog.tsx → ...omponents/Datepicker/DatepickerDialog.tsx
This file contains hidden or 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
28 changes: 28 additions & 0 deletions
28
libs/form-component/src/app-components/Datepicker/index.ts
This file contains hidden or 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 @@ | ||
| export { DatePickerControl } from './Datepicker'; | ||
| export type { DatePickerControlProps } from './Datepicker'; | ||
| export { DatePickerCalendar } from './DatePickerCalendar'; | ||
| export type { CalendarDialogProps } from './DatePickerCalendar'; | ||
| export { DatePickerInput } from './DatePickerInput'; | ||
| export type { DatePickerInputProps } from './DatePickerInput'; | ||
| export { DatePickerDialog, useDatePickerClose } from './DatepickerDialog'; | ||
| export { | ||
| DateFlags, | ||
| DatepickerMinDateDefault, | ||
| DatepickerMaxDateDefault, | ||
| DatepickerFormatDefault, | ||
| PrettyDateAndTime, | ||
| getDateFormat, | ||
| getSaveFormattedDateString, | ||
| getDateConstraint, | ||
| formatISOString, | ||
| isDate, | ||
| getLocale, | ||
| getDateLib, | ||
| strictParseISO, | ||
| strictParseFormat, | ||
| dateFormatCanBeNumericInReactPatternFormat, | ||
| getFormatAsPatternFormat, | ||
| getMonths, | ||
| getYears, | ||
| } from './utils/dateHelpers'; | ||
| export type { Token } from './utils/dateHelpers'; |
This file contains hidden or 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 hidden or 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
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 hidden or 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,2 @@ | ||
| export { Flex } from './Flex'; | ||
| export type { IGridStyling } from './Flex'; |
11 changes: 11 additions & 0 deletions
11
libs/form-component/src/app-components/Input/FormattedInput.tsx
This file contains hidden or 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,11 @@ | ||
| import { PatternFormat } from 'react-number-format'; | ||
| import type { PatternFormatProps } from 'react-number-format'; | ||
|
|
||
| import { Input } from './Input'; | ||
| import type { InputProps } from './Input'; | ||
|
|
||
| export function FormattedInput( | ||
| props: Omit<PatternFormatProps, 'customInput' | 'size'> & InputProps, | ||
| ) { | ||
| return <PatternFormat {...props} customInput={Input} />; | ||
| } |
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.