Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
update dep version
Browse files Browse the repository at this point in the history
  • Loading branch information
javadbat committed Sep 28, 2024
1 parent 88ff4ba commit cc7a2d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,13 @@ document.querySelector('jb-date-input').setMonthList('GREGORIAN',['1','2','3','4
## overflow handler

sometimes you place date input inside modal or end of the pages so when user open the input picker it overflow the page and some part of picker will be invisible.
to fix this we add a feature called `overflowHandler` by set this to `JUMP` the picker will move, on mouse enter it's territory so user can easily pick date
to fix this we add a feature called `overflowHandler` by set this to `SLIDE` the picker will move, on mouse enter it's territory so user can easily pick date
```jsx
<JBDateInput overflowHandler="JUMP" />
<JBDateInput overflowHandler="SLIDE" />
//if you want to check your overflow base on another dom and not window for example when you put date input in a modal
<div ref={ref} style={{ height: "12rem", border: "solid 1px #666", overflow:"hidden" }}>
<JBDateInput {...args} overflowRef={ref} />
</div>
```

### set custom style
Expand Down
10 changes: 8 additions & 2 deletions lib/JBDateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export type JBDateInputProps = {
placeholder?: string | null | undefined,
jalaliMonthList?: string[] | null | undefined,
gregorianMonthList?: string[] | null | undefined,
overflowHandler?:"NONE" | "JUMP"
overflowHandler?:"NONE" | "SLIDE",
overflowRef?:React.RefObject<HTMLElement> | null,
children?: React.ReactNode | React.ReactNode[],
}

Expand Down Expand Up @@ -141,9 +142,14 @@ export const JBDateInput = React.forwardRef((props: JBDateInputProps, ref) => {
}, [props.placeholder]);
useEffect(() => {
if (element.current && props.overflowHandler !== undefined) {
element.current.overflowHandler = props.overflowHandler;
element.current.elements.popover.overflowHandler = props.overflowHandler;
}
}, [props.overflowHandler]);
useEffect(() => {
if (element.current && props.overflowRef !== undefined) {
element.current.elements.popover.overflowDom = props.overflowRef.current;
}
}, [props.overflowRef]);
useEffect(() => {
if (element.current) {
if (typeof props.style == "string") {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"react component",
"react"
],
"version": "3.0.0",
"version": "5.0.0-beta.0",
"bugs": "https://github.com/javadbat/jb-date-input-react/issues",
"license": "MIT",
"files": [
Expand All @@ -37,6 +37,6 @@
"url": "https://github.com/javadbat/jb-date-input-react"
},
"dependencies": {
"jb-date-input": ">=4.0.0"
"jb-date-input": ">=5.0.0-beta.0"
}
}

0 comments on commit cc7a2d5

Please sign in to comment.