-
-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(datepicker): accepts dateValue as value This issue was found in a scenario where I needed to update the selectedDate without clicking into the component, just by passing a value to the Datepicker, and actually it just accepts changes by clicking which I don't believe covers the use cases. * chore(lint/prettier): cleaning code Cleaning code * removed unecessary debug * test(fixing tests): finding why tests are not running Tests stopped running locally, running it on the pipe * chore: fixed testing for the use case scenario * fix: removing commments Comments removal * chore(reducing complexity for datevalue): assertive state/context management according view/date * chore: linting * feat: added necessary documentation * Update Datepicker.spec.tsx chore: removing screen.debug * chore: pipeline build fixes * fix(clear button): fixed datepicker clear button to not displaying any selected date by using null" Attributed null as a acceptable value to the selectedDate, also removed default args for weekstart which was crashing the app due to an overlap with the component props 1039 * Update Datepicker.spec.tsx * test(datepicker): clear Clear should affect dateValue * docs(datepicker): it should have right type for the new empty date case scenario texting property Updated datepicker component storybook file controls, added the new property and its type so the dev can simulate scenarios on storybook * chore: removing unecessary console * docs(datepicker): label naming Changed the name from labelempty to label * feat(datepicker): datevalue expects null to clear date Now datevalue expects null to clear date, also a diff mechanism was added on the dateValue useffect to prevent mass re-renders. g * feat(datepicker): datepicker should expect value and defaultValue Now datepicker component accepts value and defaultValue as props comes from this is the most intuitive pattern. BREAKING CHANGE: A breaking change which affects the old property defaultDate being named now defaultValue. * feat(datepicker): datepicker default value and sideeffects Setting defaultvalue to empty when the component loads, therefore updating its sideffects on mounting considering dateview initialization | Added test cases to these scenarios | Added propper naming and default values according flowbite patterns BREAKING CHANGE: New defaultValue initialization value | Migrating from defaultDate to defaultValue * feat: adding datevalue property * feat: handling date value with propper test cases * feat: handling date value with propper test cases * feat: removed default value and renamed onchange prop * feat: solved comments | updated tests and parameters * feat: ts compiling * feat: added null as a type reference for selectedDate * feat: prettier * feat: added value as a modifier * feat: updated storybook to reflect controlled and uncontrolled model * feat: removed debugger and renamed defaultDate to defaultValue * feat: removed debugger and renamed defaultDate to defaultValue * feat: format check * feat: addressing hook dependencies * feat: controlled component setup | clearn functionality * feat: remove debugger statement * feat: defaultDate empty and side-effects addressed * feat: added changeset * feat - changset to patch --------- Co-authored-by: Dias, Diego <diasd@ae.com>
- Loading branch information
1 parent
38913e5
commit 25bb353
Showing
10 changed files
with
179 additions
and
46 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,22 @@ | ||
--- | ||
"flowbite-react": patch | ||
--- | ||
|
||
### Datepicker Component Updates | ||
|
||
The Datepicker has been enhanced with several improvements: | ||
|
||
1. **Controlled Inputs**: Supports controlled inputs via `value` and `defaultValue` props, enabling programmatic date updates without manual clicks. | ||
2. **State Management**: Optimized internal state management using `useMemo` and `useEffect`. | ||
3. **Documentation**: Added sections in documentation for controlled usage and handling `null` values. | ||
4. **Test Cases**: Comprehensive unit tests added for date handling. | ||
5. **Storybook**: Improved stories, showcasing different states (controlled/uncontrolled). | ||
|
||
### Files Updated: | ||
|
||
- `apps/web/content/docs/components/datepicker.mdx`: Added controlled usage section. | ||
- `Datepicker.spec.tsx`: Added unit tests. | ||
- `Datepicker.stories.tsx`: Enhanced story variants. | ||
- `Datepicker.tsx`: Expanded `DatepickerProps`. | ||
- `DatepickerContext.tsx`: Adjusted `selectedDate` type. | ||
- `Decades.tsx`, `Months.tsx`, `Years.tsx`: Updated logic to check for `selectedDate`. |
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
Oops, something went wrong.