-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * WIP * WIP * WIP * WIP * WIP * WIP * FIx yarn.lcok * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * inline date picker * WIP * added bg white for calendar * WIP * update docz * WIP * wip * WIP * WIP * WIP * WIP * docz doc * doc renaming * WIP * WIP * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
- Loading branch information
1 parent
03d8a7d
commit 0f398bb
Showing
80 changed files
with
4,494 additions
and
2,723 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
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
30 changes: 14 additions & 16 deletions
30
...ts/components/date-range-picker/README.md → ...mponents/components/date-picker/README.md
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
6 changes: 3 additions & 3 deletions
6
...components/date-range-picker/package.json → ...nents/components/date-picker/package.json
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
File renamed without changes
File renamed without changes
2 changes: 2 additions & 0 deletions
2
packages/react-components/components/date-picker/src/assets/index.js
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,2 @@ | ||
export { ReactComponent as InputCalendarIcon } from "./icon-input-calendar.svg"; | ||
export { ReactComponent as PresetsCalendarIcon } from "./icon-presets-calendar.svg"; |
90 changes: 90 additions & 0 deletions
90
packages/react-components/components/date-picker/src/date-picker-anchor.jsx
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,90 @@ | ||
import { BOTTOM_LEFT, POSITIONS, isBottom, isCenter, isLeft, isRight, isTop } from "./positions"; | ||
import { FadeIn } from "./fade-in"; | ||
import { Popup } from "@orbit-ui/react-popup"; | ||
import { PureComponent } from "react"; | ||
import { arrayOf, bool, func, node, number, oneOf, string } from "prop-types"; | ||
import { isNil } from "lodash"; | ||
import { useHandlerProxy } from "@orbit-ui/react-components-shared"; | ||
|
||
export class DatePickerAnchor extends PureComponent { | ||
static propTypes = { | ||
input: node.isRequired, | ||
inputHeight: number, | ||
calendar: node.isRequired, | ||
open: bool.isRequired, | ||
position: oneOf(POSITIONS), | ||
offsets: arrayOf(string), | ||
onOutsideClick: func.isRequired, | ||
onEscapeKeyDown: func.isRequired, | ||
disabled: bool.isRequired | ||
}; | ||
|
||
static defaultProps = { | ||
position: BOTTOM_LEFT, | ||
offsets: ["0px", "10px"] | ||
}; | ||
|
||
handleOutsideClick = useHandlerProxy(this, "onOutsideClick"); | ||
handleEscapeKeyDown = useHandlerProxy(this, "onEscapeKeyDown"); | ||
|
||
getHorizontalPosition() { | ||
const { position, offsets } = this.props; | ||
|
||
if (isLeft(position)) { | ||
return { left: "0px", offsetX: offsets[0] }; | ||
} | ||
else if (isRight(position)) { | ||
return { right: "0px", offsetX: offsets[0] }; | ||
|
||
} | ||
else if (isCenter(position)) { | ||
return { left: "50%", offsetX: `calc(-50% + ${offsets[0]})` }; | ||
} | ||
|
||
return {}; | ||
} | ||
|
||
getVerticalPosition() { | ||
const { position, offsets, inputHeight } = this.props; | ||
|
||
if (isBottom(position)) { | ||
return { top: `${inputHeight}px`, offsetY: offsets[1] }; | ||
} | ||
else if (isTop(position)) { | ||
return { bottom: `${inputHeight}px`, offsetY: `-${offsets[1].startsWith("-") ? offsets[1].substring(1) : offsets[1]}` }; | ||
} | ||
|
||
return {}; | ||
} | ||
|
||
getCssClasses() { | ||
const { className } = this.props; | ||
|
||
const defaultClasses = "relative"; | ||
|
||
return isNil(className) ? defaultClasses : `${defaultClasses} ${className}`; | ||
} | ||
|
||
render() { | ||
const { input, inputHeight, calendar, open, disabled } = this.props; | ||
|
||
return ( | ||
<div className={this.getCssClasses()}> | ||
{input} | ||
<If condition={!isNil(inputHeight) && !disabled}> | ||
<FadeIn active={open}> | ||
<Popup | ||
visible={open} | ||
onOutsideClick={this.handleOutsideClick} | ||
onEscapeKeyDown={this.handleEscapeKeyDown} | ||
{...this.getHorizontalPosition()} | ||
{...this.getVerticalPosition()} | ||
> | ||
{calendar} | ||
</Popup> | ||
</FadeIn> | ||
</If> | ||
</div> | ||
); | ||
} | ||
} |
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.