├── _config.yml ├── dist ├── index.test.d.ts ├── types.js ├── types.js.map ├── Left.d.ts ├── Right.d.ts ├── ColumnDate.d.ts ├── RowHeader.d.ts ├── index.test.js ├── defaults.d.ts ├── context.d.ts ├── context.js ├── Left.js.map ├── Right.js.map ├── index.test.js.map ├── context.js.map ├── Left.js ├── Right.js ├── CheckBox │ ├── index.d.ts │ ├── index.js.map │ └── index.js ├── defaults.js ├── defaults.js.map ├── ColumnDate.js.map ├── helpers.d.ts ├── index.d.ts ├── ColumnDate.js ├── RowHeader.js.map ├── RowHeader.js ├── helpers.js.map ├── helpers.js ├── types.d.ts ├── index.css ├── index.modern.js ├── index.js ├── index.modern.js.map └── index.js.map ├── .travis.yml ├── src ├── .eslintrc ├── index.test.tsx ├── context.tsx ├── Left.tsx ├── Right.tsx ├── typings.d.ts ├── defaults.ts ├── ColumnDate.tsx ├── RowHeader.tsx ├── helpers.ts ├── CheckBox │ ├── index.tsx │ └── checkbox.css ├── types.ts ├── styles.css └── index.tsx ├── .eslintignore ├── .gitignore ├── example ├── public │ ├── favicon.ico │ ├── images │ │ └── exemple.jpg │ ├── manifest.json │ └── index.html ├── src │ ├── index.js │ ├── App.test.js │ ├── Content │ │ ├── introduction.jsx │ │ ├── installation.jsx │ │ ├── index.jsx │ │ ├── basic.jsx │ │ ├── controlled.jsx │ │ └── parameters.jsx │ ├── Header │ │ ├── index.jsx │ │ ├── header.css │ │ └── GitHub.jsx │ ├── App.jsx │ ├── Nav │ │ └── index.jsx │ ├── Code │ │ └── index.jsx │ └── index.css ├── README.md ├── package.json └── report.20200501.142912.12428.0.001.json ├── tsconfig.test.json ├── .editorconfig ├── .prettierrc ├── tsconfig.json ├── .eslintrc ├── package.json └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /dist/index.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/types.js: -------------------------------------------------------------------------------- 1 | //# sourceMappingURL=types.js.map -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 12 4 | - 10 5 | -------------------------------------------------------------------------------- /src/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/ 2 | dist/ 3 | node_modules/ 4 | .snapshots/ 5 | *.min.js -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | *.log 4 | build 5 | yarn.lock 6 | .vscode 7 | .idea 8 | sizes.csv 9 | -------------------------------------------------------------------------------- /example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polqk/react-check-calendar/HEAD/example/public/favicon.ico -------------------------------------------------------------------------------- /dist/types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /example/public/images/exemple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polqk/react-check-calendar/HEAD/example/public/images/exemple.jpg -------------------------------------------------------------------------------- /tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /dist/Left.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | interface Props { 3 | } 4 | declare const Left: React.FC; 5 | export default Left; 6 | -------------------------------------------------------------------------------- /dist/Right.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | interface Props { 3 | } 4 | declare const Right: React.FC; 5 | export default Right; 6 | -------------------------------------------------------------------------------- /src/index.test.tsx: -------------------------------------------------------------------------------- 1 | import { ExampleComponent } from '.' 2 | 3 | describe('ExampleComponent', () => { 4 | it('is truthy', () => { 5 | expect(ExampleComponent).toBeTruthy() 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /dist/ColumnDate.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as moment from "moment"; 3 | interface Props { 4 | date: moment.Moment; 5 | } 6 | declare const ColumnDate: React.FC; 7 | export default ColumnDate; 8 | -------------------------------------------------------------------------------- /dist/RowHeader.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { HourInterval } from "./types"; 3 | interface Props { 4 | interval: HourInterval; 5 | } 6 | declare const RowHeader: React.FC; 7 | export default RowHeader; 8 | -------------------------------------------------------------------------------- /dist/index.test.js: -------------------------------------------------------------------------------- 1 | import { ExampleComponent } from '.'; 2 | describe('ExampleComponent', function () { 3 | it('is truthy', function () { 4 | expect(ExampleComponent).toBeTruthy(); 5 | }); 6 | }); 7 | //# sourceMappingURL=index.test.js.map -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "jsxSingleQuote": true, 4 | "semi": false, 5 | "tabWidth": 2, 6 | "bracketSpacing": true, 7 | "jsxBracketSameLine": false, 8 | "arrowParens": "always", 9 | "trailingComma": "none" 10 | } 11 | -------------------------------------------------------------------------------- /dist/defaults.d.ts: -------------------------------------------------------------------------------- 1 | import { CheckCalendarContext, CheckCalendarProps, DatesFormats } from "./types"; 2 | export declare const defaultProps: CheckCalendarProps; 3 | export declare const defaultContext: CheckCalendarContext; 4 | export declare const defaultDatesFormats: DatesFormats; 5 | -------------------------------------------------------------------------------- /dist/context.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { CheckCalendarContext } from "./types"; 3 | declare const CheckContext: React.Context; 4 | export declare const CheckContextProvider: React.Provider; 5 | export default CheckContext; 6 | -------------------------------------------------------------------------------- /dist/context.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { defaultContext } from "./defaults"; 3 | var CheckContext = React.createContext(defaultContext); 4 | export var CheckContextProvider = CheckContext.Provider; 5 | export default CheckContext; 6 | //# sourceMappingURL=context.js.map -------------------------------------------------------------------------------- /example/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import App from './App' 4 | import './index.css' 5 | import 'antd/dist/antd.css'; 6 | console.log(document.getElementById('root')); 7 | 8 | ReactDOM.render(, document.getElementById('root')); 9 | -------------------------------------------------------------------------------- /dist/Left.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Left.js","sourceRoot":"","sources":["../src/Left.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,IAAM,IAAI,GAAoB,cAAM,OAAA,CAClC,6BACE,MAAM,EAAE,EAAE,EACV,OAAO,EAAC,aAAa;IAErB,8BACE,CAAC,EAAC,+PAE4B,GAC9B,CACE,CACP,EAXmC,CAWnC,CAAC;AAEF,eAAe,IAAI,CAAC"} -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | This example was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | It is linked to the react-check-calendar package in the parent directory for development purposes. 4 | 5 | You can run `yarn install` and then `yarn start` to test your package. 6 | -------------------------------------------------------------------------------- /example/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import App from './App' 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div') 7 | ReactDOM.render(, div) 8 | ReactDOM.unmountComponentAtNode(div) 9 | }) 10 | -------------------------------------------------------------------------------- /dist/Right.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Right.js","sourceRoot":"","sources":["../src/Right.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,IAAM,KAAK,GAAoB,cAAM,OAAA,CACnC,6BACE,MAAM,EAAE,EAAE,EACV,OAAO,EAAC,aAAa;IAErB,8BACE,CAAC,EAAC,2SAE4D,GAC9D,CACE,CACP,EAXoC,CAWpC,CAAC;AAEF,eAAe,KAAK,CAAC"} -------------------------------------------------------------------------------- /dist/index.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAA;AAEpC,QAAQ,CAAC,kBAAkB,EAAE;IAC3B,EAAE,CAAC,WAAW,EAAE;QACd,MAAM,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /dist/context.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,IAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAAuB,cAAc,CAAC,CAAC;AAC/E,MAAM,CAAC,IAAM,oBAAoB,GAAG,YAAY,CAAC,QAAQ,CAAC;AAC1D,eAAe,YAAY,CAAC"} -------------------------------------------------------------------------------- /src/context.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { CheckCalendarContext } from "./types"; 3 | import {defaultContext} from "./defaults"; 4 | 5 | const CheckContext = React.createContext(defaultContext); 6 | export const CheckContextProvider = CheckContext.Provider; 7 | export default CheckContext; 8 | -------------------------------------------------------------------------------- /example/src/Content/introduction.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Introduction = () => ( 4 |
5 |

Introduction

6 |

7 | Configurable and customisable week calendar with checkboxes for React. 8 |

9 |
10 | ); 11 | 12 | export default Introduction; 13 | -------------------------------------------------------------------------------- /example/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "react-check-calendar", 3 | "name": "react-check-calendar", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /example/src/Content/installation.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Code from '../Code'; 3 | 4 | const Installation = () => ( 5 |
6 |

Installation

7 |

Npm

8 | npm install react-check-calendar --save 9 |

Yarn

10 | yarn add react-check-calendar 11 |
12 | ); 13 | 14 | export default Installation; 15 | -------------------------------------------------------------------------------- /example/src/Header/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { CheckCalendar } from 'react-check-calendar'; 3 | import GitHubLogo from './GitHub' 4 | 5 | import './header.css'; 6 | 7 | export default () => ( 8 |
9 |

React check calendar

10 | 11 |
12 | 16 |
17 |
18 | ); 19 | -------------------------------------------------------------------------------- /dist/Left.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | var Left = function () { return (React.createElement("svg", { height: 30, viewBox: "0 0 320 512" }, 3 | React.createElement("path", { d: "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49\n 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-\n 9.37-9.37-9.37-24.57 0-33.94z" }))); }; 4 | export default Left; 5 | //# sourceMappingURL=Left.js.map -------------------------------------------------------------------------------- /example/src/App.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import 'react-check-calendar/dist/index.css'; 3 | import Header from './Header'; 4 | import Nav from './Nav'; 5 | import Content from './Content'; 6 | import { BackTop } from 'antd'; 7 | 8 | const App = () => { 9 | return ( 10 |
11 |
12 |
13 |
16 | 17 |
18 | ) 19 | }; 20 | 21 | export default App 22 | -------------------------------------------------------------------------------- /example/src/Content/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import Installation from './installation'; 4 | import Introduction from './introduction'; 5 | import Basic from './basic'; 6 | import Parameters from './parameters'; 7 | import Controlled from './controlled'; 8 | 9 | const Content = () => { 10 | return ( 11 |
12 | 13 | 14 | 15 | 16 | 17 |
18 | ); 19 | }; 20 | 21 | export default Content; 22 | -------------------------------------------------------------------------------- /dist/Right.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | var Right = function () { return (React.createElement("svg", { height: 30, viewBox: "0 0 320 512" }, 3 | React.createElement("path", { d: "M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522\n -.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373\n 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" }))); }; 4 | export default Right; 5 | //# sourceMappingURL=Right.js.map -------------------------------------------------------------------------------- /src/Left.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | interface Props { 4 | } 5 | 6 | const Left: React.FC = () => ( 7 | 11 | 16 | 17 | ); 18 | 19 | export default Left; 20 | -------------------------------------------------------------------------------- /dist/CheckBox/index.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import './checkbox.css'; 3 | import { MomentRange } from "../types"; 4 | export declare type CheckBoxChangeHandler = (value: boolean, props: Props) => void; 5 | declare type CheckboxProps = { 6 | ref?: any; 7 | onChange: CheckBoxChangeHandler; 8 | interval: MomentRange; 9 | }; 10 | declare type InputProps = Omit, 'onChange'>; 11 | declare type Props = CheckboxProps & InputProps; 12 | declare const Checkbox: React.FC; 13 | export default Checkbox; 14 | -------------------------------------------------------------------------------- /src/Right.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | interface Props { 4 | } 5 | 6 | const Right: React.FC = () => ( 7 | 11 | 16 | 17 | ); 18 | 19 | export default Right; 20 | -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Default CSS definition for typescript, 3 | * will be overridden with file-specific definitions by rollup 4 | */ 5 | import * as moment from "moment"; 6 | 7 | declare module '*.css' { 8 | const content: { [className: string]: string }; 9 | export default content; 10 | } 11 | 12 | interface SvgrComponent extends React.StatelessComponent> {} 13 | 14 | declare module '*.svg' { 15 | const svgUrl: string; 16 | const svgComponent: SvgrComponent; 17 | export default svgUrl; 18 | export { svgComponent as ReactComponent } 19 | } 20 | -------------------------------------------------------------------------------- /dist/defaults.js: -------------------------------------------------------------------------------- 1 | export var defaultProps = { 2 | startWeekDay: 1, 3 | locale: 'en', 4 | hoursIntervals: [ 5 | { start: 8, end: 10 }, 6 | { start: 10, end: 12 }, 7 | { start: 13, end: 15 }, 8 | { start: 15, end: 17 } 9 | ], 10 | hideDays: [0, 6] 11 | }; 12 | export var defaultContext = { 13 | props: defaultProps 14 | }; 15 | export var defaultDatesFormats = { 16 | fromHour: '[from] []h:mm[][]a[]', 17 | toHour: ' [to] []h:mm[][]a[]' 18 | }; 19 | //# sourceMappingURL=defaults.js.map -------------------------------------------------------------------------------- /dist/defaults.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,YAAY,GAAuB;IAC9C,YAAY,EAAE,CAAC;IACf,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE;QACd,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;QACrB,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACtB,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACtB,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;KACvB;IACD,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,IAAM,cAAc,GAAyB;IAClD,KAAK,EAAE,YAAY;CACpB,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAiB;IAC/C,QAAQ,EAAE,sDAAsD;IAChE,MAAM,EAAE,qDAAqD;CAC9D,CAAC"} -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "dist", 4 | "module": "esnext", 5 | "lib": ["dom", "esnext"], 6 | "moduleResolution": "node", 7 | "jsx": "react", 8 | "sourceMap": true, 9 | "declaration": true, 10 | "esModuleInterop": true, 11 | "noImplicitReturns": true, 12 | "noImplicitThis": true, 13 | "noImplicitAny": true, 14 | "strictNullChecks": true, 15 | "suppressImplicitAnyIndexErrors": true, 16 | "noUnusedLocals": true, 17 | "noUnusedParameters": true, 18 | "allowSyntheticDefaultImports": true 19 | }, 20 | "include": ["src"], 21 | "exclude": ["node_modules", "dist", "example"] 22 | } 23 | -------------------------------------------------------------------------------- /src/defaults.ts: -------------------------------------------------------------------------------- 1 | import {CheckCalendarContext, CheckCalendarProps, DatesFormats} from "./types"; 2 | 3 | export const defaultProps: CheckCalendarProps = { 4 | startWeekDay: 1, 5 | locale: 'en', 6 | hoursIntervals: [ 7 | { start: 8, end: 10 }, 8 | { start: 10, end: 12 }, 9 | { start: 13, end: 15 }, 10 | { start: 15, end: 17 } 11 | ], 12 | hideDays: [0, 6] 13 | }; 14 | 15 | export const defaultContext: CheckCalendarContext = { 16 | props: defaultProps 17 | }; 18 | 19 | export const defaultDatesFormats: DatesFormats = { 20 | fromHour: '[from] []h:mm[][]a[]', 21 | toHour: ' [to] []h:mm[][]a[]' 22 | }; 23 | -------------------------------------------------------------------------------- /example/src/Header/header.css: -------------------------------------------------------------------------------- 1 | header { 2 | max-width: 100vw; 3 | position: relative; 4 | height: 400px; 5 | background: rgb(91, 169, 255); 6 | color: white; 7 | text-align: center; 8 | border-bottom: 1px solid #e2e2e2; 9 | box-shadow: 0 -10px 50px 0 rgb(91, 169, 255); 10 | } 11 | 12 | header > div { 13 | margin: 0 auto; 14 | width: 700px; 15 | } 16 | 17 | header > h1 { 18 | color: white; 19 | font-size: 45px; 20 | } 21 | 22 | button.white svg { 23 | fill: white; 24 | } 25 | 26 | .github { 27 | position: absolute; 28 | right: 10px; 29 | top: 10px; 30 | } 31 | 32 | .github > span { 33 | color: white; 34 | 35 | } 36 | 37 | .github > svg { 38 | fill: white; 39 | } 40 | -------------------------------------------------------------------------------- /example/src/Content/basic.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { CheckCalendar } from 'react-check-calendar'; 3 | import Code from '../Code'; 4 | 5 | const basic = `import React from 'react'; 6 | import { CheckCalendar } from 'react-check-calendar'; 7 | import 'react-check-calendar/dist/index.css'; 8 | 9 | const Basic = () => ( 10 | 11 | ); 12 | 13 | export default Basic; 14 | `; 15 | 16 | const Basic = () => ( 17 |
18 |

Basic Example

19 |
20 |
21 | 22 |
23 |
24 | 25 |
26 |
27 |
28 | ); 29 | 30 | export default Basic; 31 | -------------------------------------------------------------------------------- /dist/ColumnDate.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ColumnDate.js","sourceRoot":"","sources":["../src/ColumnDate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,OAAO,YAAY,MAAM,WAAW,CAAC;AAMrC,IAAM,UAAU,GAAoB,UAAC,EAAQ;QAAN,cAAI;IACjC,IAAA,4CAAK,CAAoC;IAEjD,IAAI,KAAK,CAAC,kBAAkB,EAAE;QAC5B,OAAO,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KACvC;IAED,OAAO,CACL;QACE;YACE,oBAAC,MAAM,IACL,SAAS,EAAC,oBAAoB,EAC9B,MAAM,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,EACrB,MAAM,EAAC,KAAK,IAEX,IAAI,CACE,CACL;QACN;YACE,oBAAC,MAAM,IACL,SAAS,EAAC,4BAA4B,EACtC,MAAM,EAAC,IAAI,EACX,MAAM,EAAC,IAAI,IAEV,IAAI,CACE,CACL;QACN;YACE,oBAAC,MAAM,IACL,SAAS,EAAC,uBAAuB,EACjC,MAAM,EAAC,IAAI,EACX,MAAM,EAAC,KAAK,IAEX,IAAI,CACE,CACL;QACN,gCAEE,CACE,CACP,CAAC;AACJ,CAAC,CAAA;AAED,eAAe,UAAU,CAAC"} -------------------------------------------------------------------------------- /dist/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import moment from 'moment'; 2 | import { CheckCalendarProps, MomentOrDateRange, MomentRange } from "./types"; 3 | export declare const getMomentFromNumber: (date: moment.Moment, value: number) => moment.Moment; 4 | export declare const getDatesFormats: (props: CheckCalendarProps) => { 5 | fromHour: string; 6 | toHour: string; 7 | } | { 8 | fromHour: string; 9 | toHour: string; 10 | }; 11 | export declare const getArrayDates: (start: moment.Moment, count: number) => moment.Moment[]; 12 | export declare const isInInterval: (interval1: MomentOrDateRange, interval2: MomentOrDateRange) => boolean; 13 | export declare const getMomentsFromRange: (interval: MomentOrDateRange) => MomentRange; 14 | export declare const getMomentFromDate: (date: Date | moment.Moment | string) => moment.Moment; 15 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "extends": [ 4 | "standard", 5 | "standard-react", 6 | "plugin:prettier/recommended", 7 | "prettier/standard", 8 | "prettier/react", 9 | "plugin:@typescript-eslint/eslint-recommended" 10 | ], 11 | "env": { 12 | "node": true 13 | }, 14 | "parserOptions": { 15 | "ecmaVersion": 2020, 16 | "ecmaFeatures": { 17 | "legacyDecorators": true, 18 | "jsx": true 19 | } 20 | }, 21 | "settings": { 22 | "react": { 23 | "version": "16" 24 | } 25 | }, 26 | "rules": { 27 | "space-before-function-paren": 0, 28 | "react/prop-types": 0, 29 | "react/jsx-handler-names": 0, 30 | "react/jsx-fragments": 0, 31 | "react/no-unused-prop-types": 0, 32 | "import/export": 0 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { CheckCalendarProps, CheckCalendarState } from "./types"; 3 | import LeftIcon from "./Left"; 4 | import RightIcon from "./Right"; 5 | import { defaultProps } from "./defaults"; 6 | import moment from "moment"; 7 | import Checkbox, { CheckBoxChangeHandler } from "./CheckBox"; 8 | import './styles.css'; 9 | declare class CheckCalendar extends React.Component { 10 | static defaultProps: CheckCalendarProps; 11 | state: { 12 | loading: boolean; 13 | currentDate: moment.Moment; 14 | checkedRanges: never[]; 15 | }; 16 | render(): JSX.Element; 17 | _handlePrevious: () => void; 18 | _handleNext: () => void; 19 | _handleChange: CheckBoxChangeHandler; 20 | } 21 | export { CheckCalendar as default, CheckCalendar, CheckCalendarProps, defaultProps, LeftIcon, RightIcon, Checkbox }; 22 | -------------------------------------------------------------------------------- /example/src/Nav/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Menu } from 'antd'; 3 | 4 | export default () => { 5 | const [sections, setSections] = React.useState([]); 6 | React.useEffect(() => { 7 | const found = Array.from(document.getElementsByTagName('section')); 8 | if (found.length !== sections.length) { 9 | setSections(found); 10 | } 11 | }) 12 | 13 | return ( 14 | 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /dist/ColumnDate.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import Moment from "react-moment"; 3 | import CheckContext from "./context"; 4 | var ColumnDate = function (_a) { 5 | var date = _a.date; 6 | var props = React.useContext(CheckContext).props; 7 | if (props.renderColumnHeader) { 8 | return props.renderColumnHeader(date); 9 | } 10 | return (React.createElement("div", null, 11 | React.createElement("div", null, 12 | React.createElement(Moment, { className: "check-calendar_day", locale: props === null || props === void 0 ? void 0 : props.locale, format: "ddd" }, date)), 13 | React.createElement("div", null, 14 | React.createElement(Moment, { className: "check-calendar__day-number", locale: "fr", format: "DD" }, date)), 15 | React.createElement("div", null, 16 | React.createElement(Moment, { className: "check-calendar__month", locale: "fr", format: "MMM" }, date)), 17 | React.createElement("div", null))); 18 | }; 19 | export default ColumnDate; 20 | //# sourceMappingURL=ColumnDate.js.map -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-check-calendar-example", 3 | "homepage": "https://Polqk.github.io/react-check-calendar", 4 | "version": "0.0.0", 5 | "private": true, 6 | "dependencies": { 7 | "@tenon-io/tenon-codeblock": "^1.0.0", 8 | "antd": "^4.2.0", 9 | "react": "link:../node_modules/react", 10 | "react-check-calendar": "link:..", 11 | "react-dom": "link:../node_modules/react-dom", 12 | "react-scripts": "link:../node_modules/react-scripts", 13 | "react-syntax-highlighter": "^12.2.1" 14 | }, 15 | "scripts": { 16 | "start": "node ../node_modules/react-scripts/bin/react-scripts.js start", 17 | "build": "node ../node_modules/react-scripts/bin/react-scripts.js build", 18 | "test": "node ../node_modules/react-scripts/bin/react-scripts.js test", 19 | "eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject" 20 | }, 21 | "eslintConfig": { 22 | "extends": "react-app" 23 | }, 24 | "browserslist": [ 25 | ">0.2%", 26 | "not dead", 27 | "not ie <= 11", 28 | "not op_mini all" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /dist/RowHeader.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"RowHeader.js","sourceRoot":"","sources":["../src/RowHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC/D,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,YAAY,MAAM,WAAW,CAAC;AACrC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AAMpC,IAAM,SAAS,GAAoB,UAAC,EAAY;QAAV,sBAAQ;IACpC,IAAA,4CAAK,CAAoC;IACzC,IAAA,sBAAK,EAAE,kBAAG,CAAc;IAC1B,IAAA,2BAA6C,EAA3C,sBAAQ,EAAE,kBAAiC,CAAC;IAEpD,IAAI,KAAK,CAAC,eAAe,EAAE;QACzB,OAAO,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;KACxC;IAED,OAAO,CACH,4BAAI,SAAS,EAAE,UAAU,CAAC,4BAA4B,EAAE,KAAK,CAAC,kBAAkB,CAAC;QAC/E,6BAAK,SAAS,EAAC,sBAAsB;YAClC,KAAK,IAAI,UAAU,CAAC,YACnB,mBAAmB,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;iBAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,aAAS,CAAC;YACnF,GAAG,IAAI,UAAU,CAAC,YACjB,mBAAmB,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;iBAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,aACjE,CAAC,CACN,CACH,CACR,CAAA;AACH,CAAC,CAAA;AAED,eAAe,SAAS,CAAC"} -------------------------------------------------------------------------------- /src/ColumnDate.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import Moment from "react-moment"; 3 | import * as moment from "moment"; 4 | import CheckContext from "./context"; 5 | 6 | interface Props { 7 | date: moment.Moment; 8 | } 9 | 10 | const ColumnDate: React.FC = ({ date }) => { 11 | const { props } = React.useContext(CheckContext); 12 | 13 | if (props.renderColumnHeader) { 14 | return props.renderColumnHeader(date); 15 | } 16 | 17 | return ( 18 |
19 |
20 | 25 | {date} 26 | 27 |
28 |
29 | 34 | {date} 35 | 36 |
37 |
38 | 43 | {date} 44 | 45 |
46 |
49 |
50 | ); 51 | } 52 | 53 | export default ColumnDate; 54 | -------------------------------------------------------------------------------- /dist/RowHeader.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { getDatesFormats, getMomentFromNumber } from "./helpers"; 3 | import HTMLParser from "html-react-parser"; 4 | import CheckContext from "./context"; 5 | import moment from "moment"; 6 | import classNames from "classnames"; 7 | var RowHeader = function (_a) { 8 | var interval = _a.interval; 9 | var props = React.useContext(CheckContext).props; 10 | var start = interval.start, end = interval.end; 11 | var _b = getDatesFormats(props), fromHour = _b.fromHour, toHour = _b.toHour; 12 | if (props.renderRowHeader) { 13 | return props.renderRowHeader(interval); 14 | } 15 | return (React.createElement("td", { className: classNames('check-calendar__row-header', props.headerRowClassName) }, 16 | React.createElement("div", { className: "check-calendar__hour" }, 17 | start && HTMLParser("" + (getMomentFromNumber(moment(), start).format(fromHour) 18 | .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || '') + ""), 19 | end && HTMLParser("" + (getMomentFromNumber(moment(), end).format(toHour) 20 | .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || '') + "")))); 21 | }; 22 | export default RowHeader; 23 | //# sourceMappingURL=RowHeader.js.map -------------------------------------------------------------------------------- /src/RowHeader.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {HourInterval} from "./types"; 3 | import {getDatesFormats, getMomentFromNumber} from "./helpers"; 4 | import HTMLParser from "html-react-parser"; 5 | import CheckContext from "./context"; 6 | import moment from "moment"; 7 | import classNames from "classnames"; 8 | 9 | interface Props { 10 | interval: HourInterval; 11 | } 12 | 13 | const RowHeader: React.FC = ({ interval }) => { 14 | const { props } = React.useContext(CheckContext); 15 | const { start, end } = interval; 16 | const { fromHour, toHour } = getDatesFormats(props); 17 | 18 | if (props.renderRowHeader) { 19 | return props.renderRowHeader(interval); 20 | } 21 | 22 | return ( 23 | 24 |
25 | {start && HTMLParser(`${ 26 | getMomentFromNumber(moment(), start).format(fromHour) 27 | .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || ''}`)} 28 | {end && HTMLParser(`${ 29 | getMomentFromNumber(moment(), end).format(toHour) 30 | .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || '' 31 | }`)} 32 |
33 | 34 | ) 35 | } 36 | 37 | export default RowHeader; 38 | -------------------------------------------------------------------------------- /dist/CheckBox/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/CheckBox/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,gBAAgB,CAAC;AACxB,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,YAAY,MAAM,YAAY,CAAC;AAYtC,IAAM,QAAQ,GAAoB,UAAC,EAAoB;IAAnB,IAAA,sBAAQ,EAAE,gCAAQ;IAC7C,IAAA,yCAAqD,EAA5C,gCAAa,EAAE,8BAAY,EAAE,gCAAe,CAAoC;IAEhG,IAAM,aAAa,GAAG,UAAC,CAAsC;QAC3D,IAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QAC/B,KAAK,CAAC,QAAQ,CAAC,KAAK,wBAAM,KAAK,KAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,UAAA,IAAG,CAAA;IACpF,CAAC,CAAC;IAEF,IAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,IAAM,eAAe,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvG,IAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;QACjD,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAA5D,CAA4D,CAAC;QACvF,CAAC,CAAC,KAAK,CAAC;IAEV,IAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,gBAAgB,IAAI,eAAe,IAAI,cAAc,CAAC;IACzF,OAAO,CACL,+BAAO,SAAS,EAAE,UAAU,CAAC,kCAAkC,EAAE,EAAE,QAAQ,UAAA,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC;QAC7F,8BAAM,SAAS,EAAC,yBAAyB;YACvC,0CACM,KAAK,IACT,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,UAAU,CAAC,gCAAgC,CAAC,EACvD,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,QAAQ,IAClB;YACJ,8BAAM,SAAS,EAAC,gCAAgC,GAAG,CAC9C,CACC,CACT,CAAC;AACJ,CAAC,CAAA;AAED,eAAe,QAAQ,CAAC"} -------------------------------------------------------------------------------- /example/src/Code/index.jsx: -------------------------------------------------------------------------------- 1 | import SyntaxHighlighter from 'react-syntax-highlighter'; 2 | import { nord } from 'react-syntax-highlighter/dist/esm/styles/hljs'; 3 | import React from 'react'; 4 | import { message } from 'antd'; 5 | 6 | const successMessage = () => message.success('Code copied to clipboard'); 7 | 8 | const Code = ({ children, text, language, title }) => { 9 | const lang = language || 'jsx'; 10 | const code = (text || children); 11 | const inputRef = React.createRef(); 12 | 13 | const _handleCopy = () => { 14 | if ( navigator.clipboard ) { 15 | navigator.clipboard.writeText(code).then(function() { 16 | successMessage(); 17 | }, function(err) { 18 | console.error('Async: Could not copy text: ', err); 19 | }); 20 | 21 | return; 22 | } 23 | 24 | const input = inputRef.current; 25 | if (!input) { 26 | return; 27 | } 28 | 29 | input.focus(); 30 | input.select(); 31 | input.setSelectionRange(0, 99999); 32 | document.execCommand('copy'); 33 | 34 | successMessage(); 35 | }; 36 | 37 | return ( 38 |
39 | {title &&

{title}

} 40 |
41 | 42 | 43 |
44 | false} style={{ display: 'none' }} /> 45 | 46 | { code} 47 | 48 |
49 | ); 50 | } 51 | 52 | 53 | 54 | export default Code; 55 | -------------------------------------------------------------------------------- /src/helpers.ts: -------------------------------------------------------------------------------- 1 | import moment from 'moment'; 2 | import {CheckCalendarProps, MomentOrDateRange, MomentRange} from "./types"; 3 | import { defaultDatesFormats } from "./defaults"; 4 | 5 | export const getMomentFromNumber = (date: moment.Moment, value: number) => { 6 | const trunced = Math.trunc(value); 7 | return date.clone() 8 | .set('hour', trunced) 9 | .set('minutes', (value - trunced) * 60) 10 | .set('second', 0) 11 | .set('millisecond', 0); 12 | }; 13 | 14 | export const getDatesFormats = (props: CheckCalendarProps) => 15 | ({ ...defaultDatesFormats, ...props.datesFormats }); 16 | 17 | export const getArrayDates = (start: moment.Moment, count: number) => { 18 | const dates = [] 19 | 20 | const clonedStart = start.clone().set('hour', 0).set('minute', 0).set('second', 1).set('millisecond', 0); 21 | 22 | for (let i = 0; i < count; i++) { 23 | dates.push(clonedStart.clone().add(i, 'day')); 24 | } 25 | 26 | return dates; 27 | }; 28 | 29 | export const isInInterval = (interval1: MomentOrDateRange, interval2: MomentOrDateRange) => { 30 | const { start, end } = getMomentsFromRange(interval1); 31 | const { start: start2, end: end2 } = getMomentsFromRange(interval2); 32 | 33 | return start.isSame(start2, "minute") || 34 | end.isSame(end2, "minute") || 35 | start.isBetween(start2, end2, 'minutes', '()') || 36 | end.isBetween(start2, end2, 'minutes', '()'); 37 | } 38 | 39 | export const getMomentsFromRange = (interval: MomentOrDateRange): MomentRange => ({ 40 | start: getMomentFromDate(interval.start), 41 | end: getMomentFromDate(interval.end) 42 | }) 43 | 44 | export const getMomentFromDate = (date: Date | moment.Moment | string) => 45 | date instanceof moment ? date as moment.Moment : moment(date); 46 | -------------------------------------------------------------------------------- /dist/helpers.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAC,IAAmB,EAAE,KAAa;IACpE,IAAM,OAAO,GAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,KAAK,EAAE;SAChB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;SACpB,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;SACtC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SAChB,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,eAAe,GAAG,UAAC,KAAyB;IACvD,OAAA,uBAAM,mBAAmB,GAAK,KAAK,CAAC,YAAY,EAAG;AAAnD,CAAmD,CAAC;AAEtD,MAAM,CAAC,IAAM,aAAa,GAAG,UA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AAC,IAAM,iBAAiB,GAAG,UAAC,IAAmC;IACnE,OAAA,IAAI,YAAY,MAAM,CAAC,CAAC,CAAC,IAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;AAA7D,CAA6D,CAAC"} -------------------------------------------------------------------------------- /example/src/index.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | body { 6 | margin: 0; 7 | padding: 0; 8 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 9 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 10 | sans-serif; 11 | -webkit-font-smoothing: antialiased; 12 | -moz-osx-font-smoothing: grayscale; 13 | } 14 | 15 | code { 16 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 17 | monospace; 18 | } 19 | 20 | main { 21 | width: auto; 22 | margin-left: 300px; 23 | } 24 | 25 | nav { 26 | position: -webkit-sticky; 27 | position: sticky; 28 | top: 0; 29 | width: 300px; 30 | height: calc(100vh - 400px); 31 | overflow: hidden; 32 | float: left; 33 | } 34 | 35 | nav > ul { 36 | height: 100%; 37 | } 38 | 39 | h2 { 40 | font-size: 32px; 41 | } 42 | 43 | p { 44 | font-size: 16px; 45 | } 46 | 47 | section { 48 | width: 100%; 49 | padding: 4em 5em; 50 | } 51 | 52 | section:nth-child(even) { 53 | background: rgba(0, 136, 255, 0.03); 54 | } 55 | 56 | .example-container { 57 | display: flex; 58 | width: 100%; 59 | justify-content: center; 60 | align-items: center; 61 | } 62 | 63 | .example-container > div { 64 | flex: 1; 65 | padding: 20px; 66 | } 67 | 68 | .code { 69 | position: relative; 70 | } 71 | 72 | .code > .actions { 73 | position: absolute; 74 | right: 6px; 75 | top: 6px; 76 | display: inline-block; 77 | } 78 | 79 | .actions > .copy { 80 | cursor: pointer; 81 | } 82 | 83 | .actions > .lang, .actions > .copy { 84 | border: white; 85 | background: rgba(255, 255, 255, .8); 86 | color: inherit; 87 | border-radius: 5px; 88 | } 89 | 90 | .actions > .lang { 91 | outline: none; 92 | cursor: help; 93 | margin-right: 4px; 94 | } 95 | -------------------------------------------------------------------------------- /example/src/Content/controlled.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import Code from '../Code' 3 | import CheckCalendar from 'react-check-calendar'; 4 | import moment from 'moment'; 5 | 6 | const code = `import React from 'react'; 7 | import CheckCalendar from 'react-check-calendar'; 8 | import 'react-check-calendar/dist/index.css'; 9 | import moment from 'moment'; 10 | 11 | const Controlled = () => { 12 | const [selected, setSelected] = React.useState([]); 13 | 14 | const nextWeek = moment().add(1, 'week'); 15 | const prevWeek = moment().subtract(1, 'week'); 16 | return ( 17 | setSelected(moments)} 20 | max={ nextWeek } 21 | min={ nextWeek } 22 | disableAfter={ nextWeek } 23 | disableBefore={ prevWeek } 24 | /> 25 | ); 26 | }; 27 | 28 | export default Controlled; 29 | ` 30 | 31 | const Controlled = () => { 32 | const [selected, setSelected] = React.useState([]); 33 | const nextWeek = moment().add(1, 'week'); 34 | const prevWeek = moment().subtract(1, 'week'); 35 | 36 | return ( 37 |
38 |

Controlled

39 |
40 |
41 | setSelected(moments)} 44 | max={ nextWeek } 45 | min={ prevWeek } 46 | disableAfter={ nextWeek } 47 | disableBefore={ prevWeek } 48 | // TODO: disabled dates modification, ranges accept 49 | /> 50 |
51 |
52 | 53 |
54 |
55 |
56 | ) 57 | } 58 | 59 | export default Controlled 60 | -------------------------------------------------------------------------------- /example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 26 | react-check-calendar 27 | 28 | 29 | 30 | 33 | 34 |
35 | 36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/src/Header/GitHub.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const GitHubLogo = () => ( 4 | 5 | 17 |
18 | View on Github 19 |
20 | ); 21 | 22 | export default GitHubLogo; 23 | -------------------------------------------------------------------------------- /src/CheckBox/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import './checkbox.css'; 3 | import classNames from 'classnames'; 4 | import {MomentRange} from "../types"; 5 | import {getMomentFromDate} from "../helpers"; 6 | import CheckContext from "../context"; 7 | 8 | export type CheckBoxChangeHandler = (value: boolean, props: Props) => void; 9 | type CheckboxProps = { 10 | ref?: any; 11 | onChange: CheckBoxChangeHandler; 12 | interval: MomentRange; 13 | } 14 | 15 | type InputProps = Omit, 'onChange'>; 16 | type Props = CheckboxProps & InputProps; 17 | 18 | const Checkbox: React.FC = ({interval, ...props}) => { 19 | const {props: { disableBefore, disableAfter, disabledDates } } = React.useContext(CheckContext); 20 | 21 | const _handleChange = (e: React.ChangeEvent) => { 22 | const value = e.target.checked; 23 | props.onChange(value, {...props, checked: value, value: value ? 0 : 1, interval }) 24 | }; 25 | 26 | const isBeforeDisabled = disableBefore ? interval.end.isBefore(getMomentFromDate(disableBefore)) : false; 27 | const isAfterDisabled = disableAfter ? interval.start.isAfter(getMomentFromDate(disableAfter)) : false; 28 | const isDisabledDate = Array.isArray(disabledDates) 29 | ? disabledDates.some(d => getMomentFromDate(d).isBetween(interval.start, interval.end)) 30 | : false; 31 | 32 | const disabled = props.disabled || isBeforeDisabled || isAfterDisabled || isDisabledDate; 33 | return ( 34 | 46 | ); 47 | } 48 | 49 | export default Checkbox; 50 | -------------------------------------------------------------------------------- /dist/helpers.js: -------------------------------------------------------------------------------- 1 | var __assign = (this && this.__assign) || function () { 2 | __assign = Object.assign || function(t) { 3 | for (var s, i = 1, n = arguments.length; i < n; i++) { 4 | s = arguments[i]; 5 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 6 | t[p] = s[p]; 7 | } 8 | return t; 9 | }; 10 | return __assign.apply(this, arguments); 11 | }; 12 | import moment from 'moment'; 13 | import { defaultDatesFormats } from "./defaults"; 14 | export var getMomentFromNumber = function (date, value) { 15 | var trunced = Math.trunc(value); 16 | return date.clone() 17 | .set('hour', trunced) 18 | .set('minutes', (value - trunced) * 60) 19 | .set('second', 0) 20 | .set('millisecond', 0); 21 | }; 22 | export var getDatesFormats = function (props) { 23 | return (__assign(__assign({}, defaultDatesFormats), props.datesFormats)); 24 | }; 25 | export var getArrayDates = function (start, count) { 26 | var dates = []; 27 | var clonedStart = start.clone().set('hour', 0).set('minute', 0).set('second', 0).set('millisecond', 0); 28 | for (var i = 0; i < count; i++) { 29 | dates.push(clonedStart.clone().add(i, 'day')); 30 | } 31 | return dates; 32 | }; 33 | export var isInInterval = function (interval1, interval2) { 34 | var _a = getMomentsFromRange(interval1), start = _a.start, end = _a.end; 35 | var _b = getMomentsFromRange(interval2), start2 = _b.start, end2 = _b.end; 36 | return start.isSame(start2, "minute") || 37 | end.isSame(end2, "minute") || 38 | start.isBetween(start2, end2, 'minutes', '()') || 39 | end.isBetween(start2, end2, 'minutes', '()'); 40 | }; 41 | export var getMomentsFromRange = function (interval) { return ({ 42 | start: getMomentFromDate(interval.start), 43 | end: getMomentFromDate(interval.end) 44 | }); }; 45 | export var getMomentFromDate = function (date) { 46 | return date instanceof moment ? date : moment(date); 47 | }; 48 | //# sourceMappingURL=helpers.js.map -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | import moment from 'moment'; 2 | import {ReactElement, ReactNode} from "react"; 3 | 4 | export interface DateRange { 5 | start: Date; 6 | end: Date; 7 | } 8 | 9 | export interface MomentRange { 10 | start: moment.Moment, 11 | end: moment.Moment 12 | } 13 | 14 | export type MomentOrDateRange = DateRange | MomentRange; 15 | 16 | export type WeekDays = 0 | 1 | 2 | 3 | 4 | 5 | 6; 17 | export interface CheckCalendarProps { 18 | start?: Date | moment.Moment | string; 19 | startWeekDay?: WeekDays; 20 | locale?: string; 21 | disableBefore?: Date | moment.Moment | string; 22 | disableAfter?: Date | moment.Moment | string; 23 | disabledDates?: (moment.Moment | Date | string)[]; 24 | checkedDates?: MomentOrDateRange[]; 25 | hoursIntervals?: HourInterval[]; 26 | datesFormats?: Partial; 27 | max?: Date | moment.Moment | string; 28 | min?: Date | moment.Moment | string; 29 | hideDays?: number[]; 30 | onChange?: (checkedIntervals: { moments: Partial[], dates: Partial[] }) => void; 31 | onNextClick?: () => void; 32 | onPreviousClick?: () => void; 33 | leftButton?: { 34 | content?: ReactNode; 35 | className?: string; 36 | }; 37 | rightButton?: { 38 | content?: ReactNode; 39 | className?: string; 40 | }; 41 | containerClassName?: string; 42 | tableClassName?: string; 43 | headerClassName?: string; 44 | contentClassName?: string; 45 | headerRowClassName?: string; 46 | renderColumnHeader?: (date: moment.Moment) => ReactElement; 47 | renderRowHeader?: (interval: HourInterval) => ReactElement; 48 | } 49 | 50 | export interface CheckCalendarState { 51 | loading: boolean; 52 | currentDate: moment.Moment; 53 | checkedRanges: MomentRange[]; 54 | } 55 | 56 | export interface DatesFormats { 57 | fromHour: string; 58 | toHour: string; 59 | } 60 | 61 | export interface CheckCalendarContext { 62 | props: CheckCalendarProps 63 | } 64 | 65 | export interface HourInterval { 66 | start: number; 67 | end: number; 68 | break?: { start: number, end: number }; 69 | } 70 | -------------------------------------------------------------------------------- /dist/types.d.ts: -------------------------------------------------------------------------------- 1 | import moment from 'moment'; 2 | import { ReactElement, ReactNode } from "react"; 3 | export interface DateRange { 4 | start: Date; 5 | end: Date; 6 | } 7 | export interface MomentRange { 8 | start: moment.Moment; 9 | end: moment.Moment; 10 | } 11 | export declare type MomentOrDateRange = DateRange | MomentRange; 12 | export declare type WeekDays = 0 | 1 | 2 | 3 | 4 | 5 | 6; 13 | export interface CheckCalendarProps { 14 | start?: Date | moment.Moment | string; 15 | startWeekDay?: WeekDays; 16 | locale?: string; 17 | disableBefore?: Date | moment.Moment | string; 18 | disableAfter?: Date | moment.Moment | string; 19 | disabledDates?: (moment.Moment | Date | string)[]; 20 | checkedDates?: MomentOrDateRange[]; 21 | hoursIntervals?: HourInterval[]; 22 | datesFormats?: Partial; 23 | max?: Date | moment.Moment | string; 24 | min?: Date | moment.Moment | string; 25 | hideDays?: number[]; 26 | onChange?: (checkedIntervals: { 27 | moments: Partial[]; 28 | dates: Partial[]; 29 | }) => void; 30 | onNextClick?: () => void; 31 | onPreviousClick?: () => void; 32 | leftButton?: { 33 | content?: ReactNode; 34 | className?: string; 35 | }; 36 | rightButton?: { 37 | content?: ReactNode; 38 | className?: string; 39 | }; 40 | containerClassName?: string; 41 | tableClassName?: string; 42 | headerClassName?: string; 43 | contentClassName?: string; 44 | headerRowClassName?: string; 45 | renderColumnHeader?: (date: moment.Moment) => ReactElement; 46 | renderRowHeader?: (interval: HourInterval) => ReactElement; 47 | } 48 | export interface CheckCalendarState { 49 | loading: boolean; 50 | currentDate: moment.Moment; 51 | checkedRanges: MomentRange[]; 52 | } 53 | export interface DatesFormats { 54 | fromHour: string; 55 | toHour: string; 56 | } 57 | export interface CheckCalendarContext { 58 | props: CheckCalendarProps; 59 | } 60 | export interface HourInterval { 61 | start: number; 62 | end: number; 63 | break?: { 64 | start: number; 65 | end: number; 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-check-calendar", 3 | "version": "1.0.1", 4 | "description": "Checkbox calendar for react", 5 | "author": "Polqk", 6 | "license": "MIT", 7 | "repository": "Polqk/react-check-calendar", 8 | "main": "dist/index.js", 9 | "module": "dist/index.modern.js", 10 | "source": "src/index.tsx", 11 | "engines": { 12 | "node": ">=10" 13 | }, 14 | "scripts": { 15 | "build": "microbundle-crl --no-compress --format modern,cjs --css-modules false", 16 | "start": "microbundle-crl watch --no-compress --format modern,cjs --css-modules false", 17 | "prepublish": "run-s build", 18 | "test": "run-s test:unit test:lint test:build", 19 | "test:build": "run-s build", 20 | "test:lint": "eslint .", 21 | "test:unit": "cross-env CI=1 react-scripts test --env=jsdom", 22 | "test:watch": "react-scripts test --env=jsdom", 23 | "predeploy": "cd example && yarn install && yarn run build", 24 | "deploy": "gh-pages -d example/build" 25 | }, 26 | "peerDependencies": { 27 | "react": "^16.0.0" 28 | }, 29 | "devDependencies": { 30 | "@types/classnames": "^2.2.10", 31 | "@types/jest": "^25.1.4", 32 | "@types/react": "^16.9.27", 33 | "@typescript-eslint/eslint-plugin": "^2.26.0", 34 | "@typescript-eslint/parser": "^2.26.0", 35 | "babel-eslint": "^10.0.3", 36 | "cross-env": "^7.0.2", 37 | "eslint": "^6.8.0", 38 | "eslint-config-prettier": "^6.7.0", 39 | "eslint-config-standard": "^14.1.0", 40 | "eslint-config-standard-react": "^9.2.0", 41 | "eslint-plugin-import": "^2.18.2", 42 | "eslint-plugin-node": "^11.0.0", 43 | "eslint-plugin-prettier": "^3.1.1", 44 | "eslint-plugin-promise": "^4.2.1", 45 | "eslint-plugin-react": "^7.17.0", 46 | "eslint-plugin-standard": "^4.0.1", 47 | "gh-pages": "^2.2.0", 48 | "microbundle-crl": "^0.13.8", 49 | "npm-run-all": "^4.1.5", 50 | "prettier": "^2.0.4", 51 | "react": "^16.13.1", 52 | "react-dom": "^16.13.1", 53 | "react-scripts": "^3.4.1", 54 | "typescript": "^3.8.3" 55 | }, 56 | "files": [ 57 | "dist" 58 | ], 59 | "dependencies": { 60 | "@babel/plugin-proposal-decorators": "^7.8.3", 61 | "classnames": "^2.2.6", 62 | "html-react-parser": "^0.10.3", 63 | "moment": "^2.24.0", 64 | "react-moment": "^0.9.7" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /dist/CheckBox/index.js: -------------------------------------------------------------------------------- 1 | var __assign = (this && this.__assign) || function () { 2 | __assign = Object.assign || function(t) { 3 | for (var s, i = 1, n = arguments.length; i < n; i++) { 4 | s = arguments[i]; 5 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 6 | t[p] = s[p]; 7 | } 8 | return t; 9 | }; 10 | return __assign.apply(this, arguments); 11 | }; 12 | var __rest = (this && this.__rest) || function (s, e) { 13 | var t = {}; 14 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 15 | t[p] = s[p]; 16 | if (s != null && typeof Object.getOwnPropertySymbols === "function") 17 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 18 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 19 | t[p[i]] = s[p[i]]; 20 | } 21 | return t; 22 | }; 23 | import * as React from 'react'; 24 | import './checkbox.css'; 25 | import classNames from 'classnames'; 26 | import { getMomentFromDate } from "../helpers"; 27 | import CheckContext from "../context"; 28 | var Checkbox = function (_a) { 29 | var interval = _a.interval, props = __rest(_a, ["interval"]); 30 | var _b = React.useContext(CheckContext).props, disableBefore = _b.disableBefore, disableAfter = _b.disableAfter, disabledDates = _b.disabledDates; 31 | var _handleChange = function (e) { 32 | var value = e.target.checked; 33 | props.onChange(value, __assign(__assign({}, props), { checked: value, value: value ? 0 : 1, interval: interval })); 34 | }; 35 | var isBeforeDisabled = disableBefore ? interval.end.isBefore(getMomentFromDate(disableBefore)) : false; 36 | var isAfterDisabled = disableAfter ? interval.start.isAfter(getMomentFromDate(disableAfter)) : false; 37 | var isDisabledDate = Array.isArray(disabledDates) 38 | ? disabledDates.some(function (d) { return getMomentFromDate(d).isBetween(interval.start, interval.end); }) 39 | : false; 40 | var disabled = props.disabled || isBeforeDisabled || isAfterDisabled || isDisabledDate; 41 | return (React.createElement("label", { className: classNames('check-calendar-checkbox__wrapper', { disabled: disabled }, props.className) }, 42 | React.createElement("span", { className: "check-calendar-checkbox" }, 43 | React.createElement("input", __assign({}, props, { onChange: _handleChange, className: classNames('check-calendar-checkbox__input'), type: "checkbox", disabled: disabled })), 44 | React.createElement("span", { className: "check-calendar-checkbox__inner" })))); 45 | }; 46 | export default Checkbox; 47 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | .check-calendar__day-number { 2 | font-size: 19px; 3 | font-weight: bold; 4 | } 5 | 6 | .check-calendar__month, .check-calendar_day { 7 | color: #272847; 8 | } 9 | 10 | /* add css module styles here (optional) */ 11 | .check-calendar { 12 | position: relative; 13 | padding: 0 35px; 14 | } 15 | 16 | .check-calendar > button { 17 | position: absolute; 18 | cursor: pointer; 19 | height: 100%; 20 | top: 50%; 21 | transform: translateY(-50%); 22 | color: var(--check-calendar-main-color); 23 | border: none; 24 | background: transparent; 25 | outline: none; 26 | } 27 | 28 | .check-calendar > button:hover { 29 | 30 | } 31 | 32 | .check-calendar > button svg { 33 | fill: var(--check-calendar-main-color); 34 | } 35 | 36 | .check-calendar__prev { 37 | left: 0; 38 | } 39 | 40 | .check-calendar__next { 41 | right: 0; 42 | } 43 | 44 | .btnNextAvCalendar { 45 | float: right; 46 | } 47 | 48 | tbody tr:last-child td:first-child { 49 | border-radius: 0 0 0 7px; 50 | } 51 | tbody tr:last-child td:last-child { 52 | border-radius: 0 0 7px 0; 53 | } 54 | tbody tr:first-child { 55 | border-radius: 7px 7px 0 0; 56 | background-color: transparent; 57 | } 58 | tbody tr:first-child td:first-child { 59 | border-radius: 7px 0 0 0; 60 | width: 35%; 61 | } 62 | tbody tr:first-child td:last-child { 63 | border-radius: 0 7px 0 0; 64 | } 65 | 66 | tbody td, tbody th { 67 | min-width: 72px; 68 | max-width: 72px; 69 | height: 50px; 70 | min-height: 50px; 71 | border-left: 1px solid #b1bcc3; 72 | border-bottom: 1px solid #f5f5f5; 73 | } 74 | 75 | tbody td:first-of-type, tbody th:first-of-type { 76 | border-left: none; 77 | } 78 | 79 | .check-calendar__table { 80 | box-shadow: 0 15px 24px rgba(0, 0, 0, 0.22), 0 19px 76px rgba(0, 0, 0, 0.3); 81 | position: relative; 82 | width: 100%; 83 | border-spacing: 0; 84 | border-collapse: separate; 85 | background: #fff; 86 | color: #272847; 87 | border-radius: 7px; 88 | border-color: #3d464d; 89 | font-size: 14px; 90 | line-height: inherit; 91 | text-align: center; 92 | margin-bottom: 20px; 93 | } 94 | 95 | .biggerCheckbox { 96 | -ms-transform: scale(1.5); 97 | /* IE */ 98 | -moz-transform: scale(1.5); 99 | /* FF */ 100 | -webkit-transform: scale(1.5); 101 | /* Safari and Chrome */ 102 | -o-transform: scale(1.5); 103 | /* Opera */ 104 | } 105 | 106 | .check-calendar__header { 107 | padding: 16px 0 16px 0; 108 | color: #272847; 109 | font-size: 16px; 110 | background-color: #fff; 111 | } 112 | 113 | .check-calendar__header td { 114 | border-bottom: 2px solid #e2e6e9; 115 | } 116 | 117 | .hSpan { 118 | font-size: 12px; 119 | font-weight: bold; 120 | } 121 | 122 | .hoverHourRow { 123 | background: rgba(24, 144, 255, 0.22); 124 | } 125 | 126 | .check-calendar__row-header { 127 | cursor: pointer; 128 | } 129 | 130 | .check-calendar__container { 131 | width: 100%; 132 | transition: opacity .4s; 133 | opacity: 1; 134 | } 135 | 136 | .check-calendar__container--hide { 137 | opacity: 0; 138 | } 139 | 140 | .check-calendar__hour small { 141 | margin-left: 1px; 142 | } 143 | 144 | .check-calendar__hidden { 145 | display: none; 146 | } 147 | 148 | .display { 149 | display: block; 150 | } 151 | 152 | .check-calendar__button:disabled { 153 | opacity: .4; 154 | cursor: not-allowed; 155 | } 156 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-check-calendar 2 | 3 | > Checkbox calendar for react 4 | 5 | [![NPM](https://img.shields.io/npm/v/react-check-calendar.svg)](https://www.npmjs.com/package/react-check-calendar) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) 6 | 7 | React Checkbox Calendar 8 | 9 | 10 | ## Install 11 | 12 | ```bash 13 | npm install --save react-check-calendar 14 | ``` 15 | 16 | 17 | ## Documentation 18 | See [Documentation](https://polqk.github.io/react-check-calendar/) 19 | 20 | ## Usage 21 | 22 | ```tsx 23 | import React, { Component } from 'react' 24 | 25 | import { CheckCalendar } from 'react-check-calendar' 26 | import 'react-check-calendar/dist/index.css' 27 | 28 | class Example extends Component { 29 | render() { 30 | return 31 | } 32 | } 33 | ``` 34 | 35 | ## Properties 36 | 37 | | Property name | type | default | description | 38 | |---------------|--------------|---------|-----------------------| 39 | | `start` | `Moment, Date, string` | `moment()` | start date | 40 | | `startWeekDay`| `number` | `1` | first calendar column day, 1 = monday | 41 | | `locale` | `string` | `en` | moment locale | 42 | | `max` | `Moment, Date, string` | | max calendar limit, disable next button after this date | 43 | | `min` | `Moment, Date, string` | | min calendar limit, disable prev button before this date | 44 | | `disableBefore` | `Moment, Date, string` | | disable checkboxes before this date | 45 | | `disableAfter` | `Moment, Date, string` | | disable checkboxes after this date | 46 | | `disabledDates` | `[Moment, Date, string]` | `[]` | list of disabled checkboxes dates | 47 | | `checkedDates` | `[{ start: Date, Moment, end: Date, Moment }]` | | list of checked checkboxes | 48 | | `hoursIntervals` | `[{ start: number, end: number }]` | `[{ start: 8, end: 10 }, { start: 10, end: 12 }, { start: 13, end: 15 }, { start: 15, end: 17 }]` | list of rows, decimals will be converted 12.25 => 12:15 (12 + 0.25 * 60) | 49 | | `datesFormats` | `{ fromHour?: string, toHour?: string }` | `{fromHour: '[from] []h:mm[][]a[]', toHour: ' [to] []h:mm[][]a[]' }` | intervals dates format, accepted by moment | 50 | | `hideDays` | `[number]` | `[0, 6]` | hide colums, default `[sunday, saturday]` | 51 | | `onChange` | `({ moments: [{ start: Moment, end: Moment}] , dates: [[ start: Date, end: Date}] }) => void` | | callback on checkbox click, with list of checked dates | 52 | | `onNextClick` | `() => void` | | next button click callback, after calendar appear | 53 | | `onPreviousClick` | `() => void` | `moment()` (`Date`) | start date | 54 | | `leftButton` | `{ content?: ReactNode, className?: string }` | `{ content: }` | prev button props | 55 | | `rightButton` | `{ content?: ReactNode, className?: string }` | `{ content: }` | next button props | 56 | | `containerClassName` | `string` | | container additional class | 57 | | `tableClassName` | `string` | | table additional class | 58 | | `headerClassName` | `string` | | table header additional class | 59 | | `contentClassName` | `string` | | table content additional class | 60 | | `headerRowClassName` | `string` | | row interval additional class | 61 | | `renderColumnHeader` | `(date: Moment) => ReactElement` | | callback to render column header | 62 | | `renderRowHeader` | ` (date: Moment) => ReactElement` | | callback to render intervals | 63 | 64 | 65 | 66 | ## License 67 | 68 | MIT © [Polqk](https://github.com/Polqk) 69 | -------------------------------------------------------------------------------- /src/CheckBox/checkbox.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --check-calendar-main-color: #3a91ff; 3 | } 4 | 5 | .check-calendar-checkbox { 6 | -webkit-box-sizing: border-box; 7 | box-sizing: border-box; 8 | margin: 0; 9 | padding: 0; 10 | color: rgba(0,0,0,.65); 11 | font-size: 14px; 12 | font-variant: tabular-nums; 13 | line-height: 1.5715; 14 | list-style: none; 15 | -webkit-font-feature-settings: "tnum"; 16 | font-feature-settings: "tnum"; 17 | position: relative; 18 | top: -.09em; 19 | display: inline-block; 20 | white-space: nowrap; 21 | vertical-align: middle; 22 | outline: none; 23 | cursor: pointer; 24 | } 25 | 26 | .check-calendar-checkbox::after { 27 | position: absolute; 28 | top: 0; 29 | left: 0; 30 | width: 100%; 31 | height: 100%; 32 | border: 1px solid var(--check-calendar-main-color); 33 | border-radius: 2px; 34 | visibility: hidden; 35 | -webkit-animation: antCheckboxEffect .36s ease-in-out; 36 | animation: antCheckboxEffect .36s ease-in-out; 37 | -webkit-animation-fill-mode: backwards; 38 | animation-fill-mode: backwards; 39 | content: ""; 40 | } 41 | 42 | .check-calendar-checkbox__input { 43 | position: absolute; 44 | top: 0; 45 | right: 0; 46 | bottom: 0; 47 | left: 0; 48 | z-index: 1; 49 | width: 100%; 50 | height: 100%; 51 | cursor: pointer; 52 | opacity: 0; 53 | margin: 0; 54 | } 55 | 56 | .check-calendar-checkbox__input:checked + .check-calendar-checkbox__inner { 57 | background: var(--check-calendar-main-color); 58 | border-color: var(--check-calendar-main-color); 59 | } 60 | 61 | .check-calendar-checkbox__input:disabled + .check-calendar-checkbox__inner { 62 | background: #f3f3f3; 63 | } 64 | 65 | .disabled { 66 | cursor: not-allowed; 67 | } 68 | 69 | .disabled .check-calendar-checkbox { 70 | cursor: not-allowed; 71 | } 72 | 73 | .disabled .check-calendar-checkbox__input { 74 | cursor: not-allowed; 75 | } 76 | 77 | .check-calendar-checkbox__wrapper.disabled:hover .check-calendar-checkbox__inner { 78 | border-color: #d9d9d9; 79 | } 80 | 81 | .check-calendar-checkbox__wrapper { 82 | -webkit-box-sizing: border-box; 83 | box-sizing: border-box; 84 | margin: 0; 85 | padding: 0; 86 | color: rgba(0,0,0,.65); 87 | font-size: 14px; 88 | font-variant: tabular-nums; 89 | line-height: 1.5715; 90 | list-style: none; 91 | -webkit-font-feature-settings: "tnum"; 92 | font-feature-settings: "tnum"; 93 | display: inline-block; 94 | cursor: pointer; 95 | -ms-transform: scale(1.5); 96 | /* IE */ 97 | -moz-transform: scale(1.5); 98 | /* FF */ 99 | -webkit-transform: scale(1.5); 100 | /* Safari and Chrome */ 101 | -o-transform: scale(1.5); 102 | /* Opera */ 103 | } 104 | 105 | .check-calendar-checkbox__inner { 106 | position: relative; 107 | top: 0; 108 | left: 0; 109 | display: block; 110 | width: 16px; 111 | height: 16px; 112 | direction: ltr; 113 | background-color: #fff; 114 | border: 1px solid #d9d9d9; 115 | border-radius: 2px; 116 | border-collapse: separate; 117 | -webkit-transition: all .3s; 118 | transition: all .3s; 119 | } 120 | 121 | .check-calendar-checkbox__input:checked + .check-calendar-checkbox__inner::after { 122 | position: absolute; 123 | display: table; 124 | border: 2px solid #fff; 125 | border-top: 0; 126 | border-left: 0; 127 | -webkit-transform: rotate(45deg) scale(1) translate(-50%,-50%); 128 | transform: rotate(45deg) scale(1) translate(-50%,-50%); 129 | opacity: 1; 130 | -webkit-transition: all .2s cubic-bezier(.12,.4,.29,1.46) .1s; 131 | transition: all .2s cubic-bezier(.12,.4,.29,1.46) .1s; 132 | content: " "; 133 | } 134 | 135 | .check-calendar-checkbox__inner::after { 136 | position: absolute; 137 | top: 43%; 138 | left: 21%; 139 | display: table; 140 | width: 5.7px; 141 | height: 9.14px; 142 | border: 2px solid #fff; 143 | border-top: 0; 144 | border-left: 0; 145 | -webkit-transform: rotate(45deg) scale(0) translate(-50%,-50%); 146 | transform: rotate(45deg) scale(0) translate(-50%,-50%); 147 | opacity: 0; 148 | -webkit-transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s; 149 | transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s; 150 | content: " "; 151 | } 152 | 153 | .check-calendar-checkbox__wrapper:hover .check-calendar-checkbox__inner { 154 | border-color: var(--check-calendar-main-color); 155 | } 156 | -------------------------------------------------------------------------------- /example/src/Content/parameters.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Table } from 'antd' 3 | import 'antd/dist/antd.css' 4 | 5 | const cols = [ 6 | { title: 'Parameter name', key: 'name', dataIndex: 'name', maxWidth: 150 }, 7 | { title: 'Type', key: 'type', dataIndex: 'type' }, 8 | { title: 'Default', key: 'default', dataIndex: 'default' }, 9 | { title: 'Description', key: 'description', dataIndex: 'description' } 10 | /*{ title: 'Required', key: 'required', dataIndex: 'required', 11 | render: (required) => ( 12 | 13 | )},*/ 14 | ] 15 | 16 | const dateOrMoment = 'Date | Moment'; 17 | const dateMomentString = dateOrMoment + ' | string'; 18 | const data = [ 19 | { name: 'start', required: false, type: dateMomentString, default: 'Date.now()', description: 'start date' }, 20 | { name: 'startWeekDay', required: false, type: 'number', default: '1', description: 'first calendar column day, 1 = monday' }, 21 | { name: 'locale', required: false, type: 'string', default: 'en', description: 'moment locale' }, 22 | { name: 'max', required: false, type: dateMomentString, default: '', description: 'max calendar limit, disable next button after this date' }, 23 | { name: 'min', required: false, type: dateMomentString, default: '', description: 'min calendar limit, disable prev button before this date' }, 24 | { name: 'disableBefore', required: false, type: dateMomentString, default: '', description: 'disable checkboxes before this date' }, 25 | { name: 'disableAfter', required: false, type: dateMomentString, default: '', description: 'disable checkboxes after this date' }, 26 | { name: 'disabledDates', required: false, type: `[${dateMomentString}]`, default: '[]', description: 'list of disabled checkboxes dates' }, 27 | { 28 | name: 'checkedDates', 29 | required: false, 30 | type: ` 31 | [{ 32 | start: ${dateOrMoment}, 33 | end: ${dateOrMoment} 34 | }] 35 | `, 36 | default: '', 37 | description: 'list of checked checkboxes' 38 | }, 39 | { 40 | name: 'hoursIntervals', 41 | required: false, 42 | type: ` 43 | [{ 44 | start: number, 45 | end: number 46 | }] 47 | `, 48 | default: (
49 |
[{`{ start: 8, end: 10 },`}
50 |
{`{ start: 10, end: 12 },`}
51 |
{`{ start: 13, end: 15 },`}
52 |
{`{ start: 15, end: 17 }`}]
53 |
), 54 | description:
list of rows, decimals will be converted
12.25 { '->' } 12:15 (12 + 0.25 * 60)
55 | }, 56 | { 57 | name: 'datesFormats', 58 | required: false, 59 | type: '{ fromHour?: string, toHour?: string }', 60 | default: (
61 | {'{'}
62 | {`fromHour: '[from] []h:mm[][]a[]'`},
63 | {`toHour: ' [to] []h:mm[][]a[]'`}
64 | { '}' } 65 |
), 66 | description: 'intervals dates format, accepted by moment' 67 | }, 68 | { name: 'hideDays', required: false, type: '[number]', default: '[0, 6]', description: 'hide colums, default [sunday, saturday]' }, 69 | { name: 'onChange', required: false, type: `({ moments: [{ start: Moment, end: Moment}] , dates: [[ start: Date, end: Date}] }) => void`, default: '', description: 'callback on checkbox click, with list of checked dates' }, 70 | { name: 'onNextClick', required: false, type: '() => void', default: '', description: 'next button click callback, after calendar appear' }, 71 | { name: 'onPreviousClick', required: false, type: '() => void', default: '', description: 'prev button click callbakc, after calendar appear' }, 72 | { name: 'leftButton', required: false, type: '{ content?: ReactNode, className?: string }', default: '{ content: }', description: 'prev button props' }, 73 | { name: 'rightButton', required: false, type: '{ content?: ReactNode, className?: string }', default: '{ content: }', description: 'next button props' }, 74 | { name: 'containerClassName', required: false, type: 'string', default: '', description: 'container additional class' }, 75 | { name: 'tableClassName', required: false, type: 'string', default: '', description: 'table additional class' }, 76 | { name: 'headerClassName', required: false, type: 'string', default: '', description: 'table header additional class' }, 77 | { name: 'contentClassName', required: false, type: 'string', default: '', description: 'table content additional class' }, 78 | { name: 'headerRowClassName', required: false, type: 'string', default: '', description: 'row interval additional class' }, 79 | { name: 'renderColumnHeader', required: false, type: '(date: Moment) => ReactElement', default: '', description: 'callback to render column header' }, 80 | { name: 'renderRowHeader', required: false, type: '(date: Moment) => ReactElement', default: '', description: 'callback to render intervals' }, 81 | ] 82 | 83 | const Parameters = () => ( 84 |
85 |

Properties

86 | ({ ...d, key: d.name}))} 88 | columns={cols} 89 | pagination={false} 90 | /> 91 | 92 | ); 93 | 94 | export default Parameters; 95 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {CheckCalendarProps, CheckCalendarState, MomentRange} from "./types"; 3 | import LeftIcon from "./Left"; 4 | import RightIcon from "./Right"; 5 | import classNames from "classnames"; 6 | import { defaultProps } from "./defaults"; 7 | import { CheckContextProvider } from "./context"; 8 | import RowHeader from "./RowHeader"; 9 | import moment from "moment"; 10 | import ColumnDate from "./ColumnDate"; 11 | import {getArrayDates, getMomentFromNumber, getMomentsFromRange, isInInterval} from "./helpers"; 12 | import Checkbox, {CheckBoxChangeHandler} from "./CheckBox"; 13 | 14 | import './styles.css'; 15 | 16 | class CheckCalendar extends React.Component { 17 | static defaultProps = defaultProps; 18 | 19 | state = { 20 | loading: false, 21 | currentDate: moment(this.props.start).set('day', this.props.startWeekDay || 1), 22 | checkedRanges: [] 23 | }; 24 | 25 | render() { 26 | const { 27 | hoursIntervals, 28 | hideDays, 29 | max, 30 | min, 31 | checkedDates, 32 | leftButton, 33 | rightButton, 34 | containerClassName, 35 | tableClassName, 36 | headerClassName, 37 | contentClassName 38 | } = this.props; 39 | 40 | const { loading, currentDate, checkedRanges } = this.state; 41 | const dates = getArrayDates(currentDate, 7); 42 | const checked = Array.isArray(checkedDates) ? checkedDates : checkedRanges; 43 | 44 | const prevDisabled = loading || (!!min && dates[0].clone().set('hour', 0).isBefore(moment(min))); 45 | const nextDisabled = loading || (!!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max))); 46 | 47 | console.log('max', (!!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max))), 'min', !!min && dates[0].clone().set('hour', 0).isBefore(moment(min))); 48 | 49 | return ( 50 | 51 |
52 | 62 | 72 |
78 |
79 | 80 | 81 | 82 | 93 | ))} 94 | 95 | {hoursIntervals && hoursIntervals.map((row) => ( 96 | 97 | 98 | {dates.map(day => { 99 | const interval = { 100 | start: getMomentFromNumber(day, row.start), 101 | end: getMomentFromNumber(day, row.end) 102 | }; 103 | 104 | return ( 105 | 116 | ) 117 | })} 118 | 119 | ))} 120 | 121 |
86 | {dates.map((current) => ( 87 | 91 | 92 |
109 | isInInterval(c, interval))} 113 | value="off" 114 | /> 115 |
122 |
123 | 124 | 125 | ); 126 | } 127 | 128 | _handlePrevious = () => { 129 | this.setState({ loading:true }); 130 | setTimeout(() => { 131 | this.setState({ 132 | loading:false, 133 | currentDate: this.state.currentDate.subtract(7, 'days') 134 | }, this.props.onPreviousClick); 135 | 136 | }, 400); 137 | 138 | }; 139 | 140 | _handleNext = () => { 141 | this.setState({ loading: true }); 142 | 143 | setTimeout(() => { 144 | this.setState({ 145 | loading: false, 146 | currentDate: this.state.currentDate.add(7, 'days') 147 | }, this.props.onNextClick); 148 | }, 400); 149 | }; 150 | 151 | _handleChange: CheckBoxChangeHandler = ( value, props) => { 152 | const { checkedRanges } = this.state; 153 | const { interval } = props; 154 | const { onChange, checkedDates } = this.props; 155 | let newChecked = [...(Array.isArray(checkedDates) ? checkedDates : checkedRanges)]; 156 | 157 | if (value) { 158 | newChecked.push(interval); 159 | } else { 160 | const foundIndex = newChecked.findIndex((c) => isInInterval(c, interval)); 161 | 162 | if (foundIndex > -1) { 163 | newChecked.splice(foundIndex, 1); 164 | } 165 | } 166 | 167 | newChecked = newChecked.map(i => getMomentsFromRange(i)); 168 | 169 | if (onChange) { 170 | onChange({ 171 | dates: (newChecked as MomentRange[]).map(i => ({ start: i.start.toDate(), end: i.end.toDate() })) , 172 | moments: newChecked as MomentRange[] 173 | }) 174 | } 175 | 176 | if (!Array.isArray(checkedDates)) { 177 | this.setState({ checkedRanges: newChecked as MomentRange[] }); 178 | } 179 | }; 180 | 181 | } 182 | 183 | export { 184 | CheckCalendar as default, 185 | CheckCalendar, 186 | CheckCalendarProps, 187 | defaultProps, 188 | LeftIcon, 189 | RightIcon, 190 | Checkbox 191 | } 192 | -------------------------------------------------------------------------------- /dist/index.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --check-calendar-main-color: #3a91ff; 3 | } 4 | 5 | .check-calendar-checkbox { 6 | box-sizing: border-box; 7 | margin: 0; 8 | padding: 0; 9 | color: rgba(0,0,0,.65); 10 | font-size: 14px; 11 | font-variant: tabular-nums; 12 | line-height: 1.5715; 13 | list-style: none; 14 | font-feature-settings: "tnum"; 15 | position: relative; 16 | top: -.09em; 17 | display: inline-block; 18 | white-space: nowrap; 19 | vertical-align: middle; 20 | outline: none; 21 | cursor: pointer; 22 | } 23 | 24 | .check-calendar-checkbox::after { 25 | position: absolute; 26 | top: 0; 27 | left: 0; 28 | width: 100%; 29 | height: 100%; 30 | border: 1px solid var(--check-calendar-main-color); 31 | border-radius: 2px; 32 | visibility: hidden; 33 | -webkit-animation: antCheckboxEffect .36s ease-in-out; 34 | animation: antCheckboxEffect .36s ease-in-out; 35 | -webkit-animation-fill-mode: backwards; 36 | animation-fill-mode: backwards; 37 | content: ""; 38 | } 39 | 40 | .check-calendar-checkbox__input { 41 | position: absolute; 42 | top: 0; 43 | right: 0; 44 | bottom: 0; 45 | left: 0; 46 | z-index: 1; 47 | width: 100%; 48 | height: 100%; 49 | cursor: pointer; 50 | opacity: 0; 51 | margin: 0; 52 | } 53 | 54 | .check-calendar-checkbox__input:checked + .check-calendar-checkbox__inner { 55 | background: var(--check-calendar-main-color); 56 | border-color: var(--check-calendar-main-color); 57 | } 58 | 59 | .check-calendar-checkbox__input:disabled + .check-calendar-checkbox__inner { 60 | background: #f3f3f3; 61 | } 62 | 63 | .disabled { 64 | cursor: not-allowed; 65 | } 66 | 67 | .disabled .check-calendar-checkbox { 68 | cursor: not-allowed; 69 | } 70 | 71 | .disabled .check-calendar-checkbox__input { 72 | cursor: not-allowed; 73 | } 74 | 75 | .check-calendar-checkbox__wrapper.disabled:hover .check-calendar-checkbox__inner { 76 | border-color: #d9d9d9; 77 | } 78 | 79 | .check-calendar-checkbox__wrapper { 80 | box-sizing: border-box; 81 | margin: 0; 82 | padding: 0; 83 | color: rgba(0,0,0,.65); 84 | font-size: 14px; 85 | font-variant: tabular-nums; 86 | line-height: 1.5715; 87 | list-style: none; 88 | font-feature-settings: "tnum"; 89 | display: inline-block; 90 | cursor: pointer; 91 | -ms-transform: scale(1.5); 92 | /* IE */ 93 | -moz-transform: scale(1.5); 94 | /* FF */ 95 | -webkit-transform: scale(1.5); 96 | /* Safari and Chrome */ 97 | -o-transform: scale(1.5); 98 | /* Opera */ 99 | } 100 | 101 | .check-calendar-checkbox__inner { 102 | position: relative; 103 | top: 0; 104 | left: 0; 105 | display: block; 106 | width: 16px; 107 | height: 16px; 108 | direction: ltr; 109 | background-color: #fff; 110 | border: 1px solid #d9d9d9; 111 | border-radius: 2px; 112 | border-collapse: separate; 113 | transition: all .3s; 114 | } 115 | 116 | .check-calendar-checkbox__input:checked + .check-calendar-checkbox__inner::after { 117 | position: absolute; 118 | display: table; 119 | border: 2px solid #fff; 120 | border-top: 0; 121 | border-left: 0; 122 | transform: rotate(45deg) scale(1) translate(-50%,-50%); 123 | opacity: 1; 124 | transition: all .2s cubic-bezier(.12,.4,.29,1.46) .1s; 125 | content: " "; 126 | } 127 | 128 | .check-calendar-checkbox__inner::after { 129 | position: absolute; 130 | top: 43%; 131 | left: 21%; 132 | display: table; 133 | width: 5.7px; 134 | height: 9.14px; 135 | border: 2px solid #fff; 136 | border-top: 0; 137 | border-left: 0; 138 | transform: rotate(45deg) scale(0) translate(-50%,-50%); 139 | opacity: 0; 140 | transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s; 141 | content: " "; 142 | } 143 | 144 | .check-calendar-checkbox__wrapper:hover .check-calendar-checkbox__inner { 145 | border-color: var(--check-calendar-main-color); 146 | } 147 | 148 | .check-calendar__day-number { 149 | font-size: 19px; 150 | font-weight: bold; 151 | } 152 | 153 | .check-calendar__month, .check-calendar_day { 154 | color: #272847; 155 | } 156 | 157 | /* add css module styles here (optional) */ 158 | .check-calendar { 159 | position: relative; 160 | padding: 0 35px; 161 | } 162 | 163 | .check-calendar > button { 164 | position: absolute; 165 | cursor: pointer; 166 | height: 100%; 167 | top: 50%; 168 | transform: translateY(-50%); 169 | color: var(--check-calendar-main-color); 170 | border: none; 171 | background: transparent; 172 | outline: none; 173 | } 174 | 175 | .check-calendar > button:hover { 176 | 177 | } 178 | 179 | .check-calendar > button svg { 180 | fill: var(--check-calendar-main-color); 181 | } 182 | 183 | .check-calendar__prev { 184 | left: 0; 185 | } 186 | 187 | .check-calendar__next { 188 | right: 0; 189 | } 190 | 191 | .btnNextAvCalendar { 192 | float: right; 193 | } 194 | 195 | tbody tr:last-child td:first-child { 196 | border-radius: 0 0 0 7px; 197 | } 198 | tbody tr:last-child td:last-child { 199 | border-radius: 0 0 7px 0; 200 | } 201 | tbody tr:first-child { 202 | border-radius: 7px 7px 0 0; 203 | background-color: transparent; 204 | } 205 | tbody tr:first-child td:first-child { 206 | border-radius: 7px 0 0 0; 207 | width: 35%; 208 | } 209 | tbody tr:first-child td:last-child { 210 | border-radius: 0 7px 0 0; 211 | } 212 | 213 | tbody td, tbody th { 214 | min-width: 72px; 215 | max-width: 72px; 216 | height: 50px; 217 | min-height: 50px; 218 | border-left: 1px solid #b1bcc3; 219 | border-bottom: 1px solid #f5f5f5; 220 | } 221 | 222 | tbody td:first-of-type, tbody th:first-of-type { 223 | border-left: none; 224 | } 225 | 226 | .check-calendar__table { 227 | box-shadow: 0 15px 24px rgba(0, 0, 0, 0.22), 0 19px 76px rgba(0, 0, 0, 0.3); 228 | position: relative; 229 | width: 100%; 230 | border-spacing: 0; 231 | border-collapse: separate; 232 | background: #fff; 233 | color: #272847; 234 | border-radius: 7px; 235 | border-color: #3d464d; 236 | font-size: 14px; 237 | line-height: inherit; 238 | text-align: center; 239 | margin-bottom: 20px; 240 | } 241 | 242 | .biggerCheckbox { 243 | -ms-transform: scale(1.5); 244 | /* IE */ 245 | -moz-transform: scale(1.5); 246 | /* FF */ 247 | -webkit-transform: scale(1.5); 248 | /* Safari and Chrome */ 249 | -o-transform: scale(1.5); 250 | /* Opera */ 251 | } 252 | 253 | .check-calendar__header { 254 | padding: 16px 0 16px 0; 255 | color: #272847; 256 | font-size: 16px; 257 | background-color: #fff; 258 | } 259 | 260 | .check-calendar__header td { 261 | border-bottom: 2px solid #e2e6e9; 262 | } 263 | 264 | .hSpan { 265 | font-size: 12px; 266 | font-weight: bold; 267 | } 268 | 269 | .hoverHourRow { 270 | background: rgba(24, 144, 255, 0.22); 271 | } 272 | 273 | .check-calendar__row-header { 274 | cursor: pointer; 275 | } 276 | 277 | .check-calendar__container { 278 | width: 100%; 279 | transition: opacity .4s; 280 | opacity: 1; 281 | } 282 | 283 | .check-calendar__container--hide { 284 | opacity: 0; 285 | } 286 | 287 | .check-calendar__hour small { 288 | margin-left: 1px; 289 | } 290 | 291 | .check-calendar__hidden { 292 | display: none; 293 | } 294 | 295 | .display { 296 | display: block; 297 | } 298 | 299 | .check-calendar__button:disabled { 300 | opacity: .4; 301 | cursor: not-allowed; 302 | } 303 | -------------------------------------------------------------------------------- /dist/index.modern.js: -------------------------------------------------------------------------------- 1 | import { createElement, createContext, useContext, Component } from 'react'; 2 | import classNames from 'classnames'; 3 | import moment from 'moment'; 4 | import HTMLParser from 'html-react-parser'; 5 | import Moment from 'react-moment'; 6 | 7 | const Left = () => createElement("svg", { 8 | height: 30, 9 | viewBox: "0 0 320 512" 10 | }, createElement("path", { 11 | d: "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49\r\n 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-\r\n 9.37-9.37-9.37-24.57 0-33.94z" 12 | })); 13 | 14 | const Right = () => createElement("svg", { 15 | height: 30, 16 | viewBox: "0 0 320 512" 17 | }, createElement("path", { 18 | d: "M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522\r\n -.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373\r\n 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" 19 | })); 20 | 21 | const defaultProps = { 22 | startWeekDay: 1, 23 | locale: 'en', 24 | hoursIntervals: [{ 25 | start: 8, 26 | end: 10 27 | }, { 28 | start: 10, 29 | end: 12 30 | }, { 31 | start: 13, 32 | end: 15 33 | }, { 34 | start: 15, 35 | end: 17 36 | }], 37 | hideDays: [0, 6] 38 | }; 39 | const defaultContext = { 40 | props: defaultProps 41 | }; 42 | const defaultDatesFormats = { 43 | fromHour: '[from] []h:mm[][]a[]', 44 | toHour: ' [to] []h:mm[][]a[]' 45 | }; 46 | 47 | const CheckContext = createContext(defaultContext); 48 | const CheckContextProvider = CheckContext.Provider; 49 | 50 | const getMomentFromNumber = (date, value) => { 51 | const trunced = Math.trunc(value); 52 | return date.clone().set('hour', trunced).set('minutes', (value - trunced) * 60).set('second', 0).set('millisecond', 0); 53 | }; 54 | const getDatesFormats = props => ({ ...defaultDatesFormats, 55 | ...props.datesFormats 56 | }); 57 | const getArrayDates = (start, count) => { 58 | const dates = []; 59 | const clonedStart = start.clone().set('hour', 0).set('minute', 0).set('second', 1).set('millisecond', 0); 60 | 61 | for (let i = 0; i < count; i++) { 62 | dates.push(clonedStart.clone().add(i, 'day')); 63 | } 64 | 65 | return dates; 66 | }; 67 | const isInInterval = (interval1, interval2) => { 68 | const { 69 | start, 70 | end 71 | } = getMomentsFromRange(interval1); 72 | const { 73 | start: start2, 74 | end: end2 75 | } = getMomentsFromRange(interval2); 76 | return start.isSame(start2, "minute") || end.isSame(end2, "minute") || start.isBetween(start2, end2, 'minutes', '()') || end.isBetween(start2, end2, 'minutes', '()'); 77 | }; 78 | const getMomentsFromRange = interval => ({ 79 | start: getMomentFromDate(interval.start), 80 | end: getMomentFromDate(interval.end) 81 | }); 82 | const getMomentFromDate = date => date instanceof moment ? date : moment(date); 83 | 84 | const RowHeader = ({ 85 | interval 86 | }) => { 87 | const { 88 | props 89 | } = useContext(CheckContext); 90 | const { 91 | start, 92 | end 93 | } = interval; 94 | const { 95 | fromHour, 96 | toHour 97 | } = getDatesFormats(props); 98 | 99 | if (props.renderRowHeader) { 100 | return props.renderRowHeader(interval); 101 | } 102 | 103 | return createElement("td", { 104 | className: classNames('check-calendar__row-header', props.headerRowClassName) 105 | }, createElement("div", { 106 | className: "check-calendar__hour" 107 | }, start && HTMLParser(`${getMomentFromNumber(moment(), start).format(fromHour).replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || ''}`), end && HTMLParser(`${getMomentFromNumber(moment(), end).format(toHour).replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || ''}`))); 108 | }; 109 | 110 | const ColumnDate = ({ 111 | date 112 | }) => { 113 | const { 114 | props 115 | } = useContext(CheckContext); 116 | 117 | if (props.renderColumnHeader) { 118 | return props.renderColumnHeader(date); 119 | } 120 | 121 | return createElement("div", null, createElement("div", null, createElement(Moment, { 122 | className: "check-calendar_day", 123 | locale: props === null || props === void 0 ? void 0 : props.locale, 124 | format: "ddd" 125 | }, date)), createElement("div", null, createElement(Moment, { 126 | className: "check-calendar__day-number", 127 | locale: "fr", 128 | format: "DD" 129 | }, date)), createElement("div", null, createElement(Moment, { 130 | className: "check-calendar__month", 131 | locale: "fr", 132 | format: "MMM" 133 | }, date)), createElement("div", null)); 134 | }; 135 | 136 | const Checkbox = ({ 137 | interval, 138 | ...props 139 | }) => { 140 | const { 141 | props: { 142 | disableBefore, 143 | disableAfter, 144 | disabledDates 145 | } 146 | } = useContext(CheckContext); 147 | 148 | const _handleChange = e => { 149 | const value = e.target.checked; 150 | props.onChange(value, { ...props, 151 | checked: value, 152 | value: value ? 0 : 1, 153 | interval 154 | }); 155 | }; 156 | 157 | const isBeforeDisabled = disableBefore ? interval.end.isBefore(getMomentFromDate(disableBefore)) : false; 158 | const isAfterDisabled = disableAfter ? interval.start.isAfter(getMomentFromDate(disableAfter)) : false; 159 | const isDisabledDate = Array.isArray(disabledDates) ? disabledDates.some(d => getMomentFromDate(d).isBetween(interval.start, interval.end)) : false; 160 | const disabled = props.disabled || isBeforeDisabled || isAfterDisabled || isDisabledDate; 161 | return createElement("label", { 162 | className: classNames('check-calendar-checkbox__wrapper', { 163 | disabled 164 | }, props.className) 165 | }, createElement("span", { 166 | className: "check-calendar-checkbox" 167 | }, createElement("input", Object.assign({}, props, { 168 | onChange: _handleChange, 169 | className: classNames('check-calendar-checkbox__input'), 170 | type: "checkbox", 171 | disabled: disabled 172 | })), createElement("span", { 173 | className: "check-calendar-checkbox__inner" 174 | }))); 175 | }; 176 | 177 | let CheckCalendar = (() => { 178 | class CheckCalendar extends Component { 179 | constructor() { 180 | super(...arguments); 181 | this.state = { 182 | loading: false, 183 | currentDate: moment(this.props.start).set('day', this.props.startWeekDay || 1), 184 | checkedRanges: [] 185 | }; 186 | 187 | this._handlePrevious = () => { 188 | this.setState({ 189 | loading: true 190 | }); 191 | setTimeout(() => { 192 | this.setState({ 193 | loading: false, 194 | currentDate: this.state.currentDate.subtract(7, 'days') 195 | }, this.props.onPreviousClick); 196 | }, 400); 197 | }; 198 | 199 | this._handleNext = () => { 200 | this.setState({ 201 | loading: true 202 | }); 203 | setTimeout(() => { 204 | this.setState({ 205 | loading: false, 206 | currentDate: this.state.currentDate.add(7, 'days') 207 | }, this.props.onNextClick); 208 | }, 400); 209 | }; 210 | 211 | this._handleChange = (value, props) => { 212 | const { 213 | checkedRanges 214 | } = this.state; 215 | const { 216 | interval 217 | } = props; 218 | const { 219 | onChange, 220 | checkedDates 221 | } = this.props; 222 | let newChecked = [...(Array.isArray(checkedDates) ? checkedDates : checkedRanges)]; 223 | 224 | if (value) { 225 | newChecked.push(interval); 226 | } else { 227 | const foundIndex = newChecked.findIndex(c => isInInterval(c, interval)); 228 | 229 | if (foundIndex > -1) { 230 | newChecked.splice(foundIndex, 1); 231 | } 232 | } 233 | 234 | newChecked = newChecked.map(i => getMomentsFromRange(i)); 235 | 236 | if (onChange) { 237 | onChange({ 238 | dates: newChecked.map(i => ({ 239 | start: i.start.toDate(), 240 | end: i.end.toDate() 241 | })), 242 | moments: newChecked 243 | }); 244 | } 245 | 246 | if (!Array.isArray(checkedDates)) { 247 | this.setState({ 248 | checkedRanges: newChecked 249 | }); 250 | } 251 | }; 252 | } 253 | 254 | render() { 255 | const { 256 | hoursIntervals, 257 | hideDays, 258 | max, 259 | min, 260 | checkedDates, 261 | leftButton, 262 | rightButton, 263 | containerClassName, 264 | tableClassName, 265 | headerClassName, 266 | contentClassName 267 | } = this.props; 268 | const { 269 | loading, 270 | currentDate, 271 | checkedRanges 272 | } = this.state; 273 | const dates = getArrayDates(currentDate, 7); 274 | const checked = Array.isArray(checkedDates) ? checkedDates : checkedRanges; 275 | const prevDisabled = loading || !!min && dates[0].clone().set('hour', 0).isBefore(moment(min)); 276 | const nextDisabled = loading || !!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max)); 277 | console.log('max', !!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max)), 'min', !!min && dates[0].clone().set('hour', 0).isBefore(moment(min))); 278 | return createElement(CheckContextProvider, { 279 | value: { 280 | props: this.props 281 | } 282 | }, createElement("div", { 283 | className: classNames('check-calendar', containerClassName) 284 | }, createElement("button", { 285 | className: classNames('check-calendar__button check-calendar__prev', leftButton === null || leftButton === void 0 ? void 0 : leftButton.className), 286 | disabled: prevDisabled, 287 | onClick: this._handlePrevious 288 | }, (leftButton === null || leftButton === void 0 ? void 0 : leftButton.content) || createElement(Left, null)), createElement("button", { 289 | className: classNames('check-calendar__button check-calendar__next', rightButton === null || rightButton === void 0 ? void 0 : rightButton.className), 290 | disabled: nextDisabled, 291 | onClick: this._handleNext 292 | }, (rightButton === null || rightButton === void 0 ? void 0 : rightButton.content) || createElement(Right, null)), createElement("div", { 293 | className: classNames('check-calendar__container', { 294 | 'check-calendar__container--hide': loading 295 | }), 296 | ref: "calendar" 297 | }, createElement("table", { 298 | className: classNames('check-calendar__table', tableClassName) 299 | }, createElement("thead", null), createElement("tbody", null, createElement("tr", { 300 | className: "check-calendar__header" 301 | }, createElement("td", { 302 | key: "header_empty", 303 | className: classNames(headerClassName) 304 | }), dates.map(current => createElement("td", { 305 | key: `check-calendar-header-${current.format('YYYY_MM_DD')}`, 306 | className: classNames(headerClassName, { 307 | 'check-calendar__hidden': hideDays === null || hideDays === void 0 ? void 0 : hideDays.includes(current.day()) 308 | }) 309 | }, createElement(ColumnDate, { 310 | date: current 311 | })))), hoursIntervals && hoursIntervals.map(row => createElement("tr", { 312 | key: `${row.start}_${row.end}` 313 | }, createElement(RowHeader, { 314 | interval: row 315 | }), dates.map(day => { 316 | const interval = { 317 | start: getMomentFromNumber(day, row.start), 318 | end: getMomentFromNumber(day, row.end) 319 | }; 320 | return createElement("td", { 321 | key: `${day.format('YYYY_MM_DD')}_${interval.start}_${interval.end}`, 322 | className: classNames(contentClassName, { 323 | 'check-calendar__hidden': hideDays === null || hideDays === void 0 ? void 0 : hideDays.includes(day.day()) 324 | }) 325 | }, createElement(Checkbox, { 326 | interval: interval, 327 | onChange: this._handleChange, 328 | checked: !!checked.find(c => isInInterval(c, interval)), 329 | value: "off" 330 | })); 331 | })))))))); 332 | } 333 | 334 | } 335 | 336 | CheckCalendar.defaultProps = defaultProps; 337 | return CheckCalendar; 338 | })(); 339 | 340 | export default CheckCalendar; 341 | export { CheckCalendar, Checkbox, Left as LeftIcon, Right as RightIcon, defaultProps }; 342 | //# sourceMappingURL=index.modern.js.map 343 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 2 | 3 | var React = require('react'); 4 | var classNames = _interopDefault(require('classnames')); 5 | var moment = _interopDefault(require('moment')); 6 | var HTMLParser = _interopDefault(require('html-react-parser')); 7 | var Moment = _interopDefault(require('react-moment')); 8 | 9 | function _extends() { 10 | _extends = Object.assign || function (target) { 11 | for (var i = 1; i < arguments.length; i++) { 12 | var source = arguments[i]; 13 | 14 | for (var key in source) { 15 | if (Object.prototype.hasOwnProperty.call(source, key)) { 16 | target[key] = source[key]; 17 | } 18 | } 19 | } 20 | 21 | return target; 22 | }; 23 | 24 | return _extends.apply(this, arguments); 25 | } 26 | 27 | function _inheritsLoose(subClass, superClass) { 28 | subClass.prototype = Object.create(superClass.prototype); 29 | subClass.prototype.constructor = subClass; 30 | subClass.__proto__ = superClass; 31 | } 32 | 33 | function _objectWithoutPropertiesLoose(source, excluded) { 34 | if (source == null) return {}; 35 | var target = {}; 36 | var sourceKeys = Object.keys(source); 37 | var key, i; 38 | 39 | for (i = 0; i < sourceKeys.length; i++) { 40 | key = sourceKeys[i]; 41 | if (excluded.indexOf(key) >= 0) continue; 42 | target[key] = source[key]; 43 | } 44 | 45 | return target; 46 | } 47 | 48 | var Left = function Left() { 49 | return React.createElement("svg", { 50 | height: 30, 51 | viewBox: "0 0 320 512" 52 | }, React.createElement("path", { 53 | d: "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49\r\n 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-\r\n 9.37-9.37-9.37-24.57 0-33.94z" 54 | })); 55 | }; 56 | 57 | var Right = function Right() { 58 | return React.createElement("svg", { 59 | height: 30, 60 | viewBox: "0 0 320 512" 61 | }, React.createElement("path", { 62 | d: "M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522\r\n -.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373\r\n 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" 63 | })); 64 | }; 65 | 66 | var defaultProps = { 67 | startWeekDay: 1, 68 | locale: 'en', 69 | hoursIntervals: [{ 70 | start: 8, 71 | end: 10 72 | }, { 73 | start: 10, 74 | end: 12 75 | }, { 76 | start: 13, 77 | end: 15 78 | }, { 79 | start: 15, 80 | end: 17 81 | }], 82 | hideDays: [0, 6] 83 | }; 84 | var defaultContext = { 85 | props: defaultProps 86 | }; 87 | var defaultDatesFormats = { 88 | fromHour: '[from] []h:mm[][]a[]', 89 | toHour: ' [to] []h:mm[][]a[]' 90 | }; 91 | 92 | var CheckContext = React.createContext(defaultContext); 93 | var CheckContextProvider = CheckContext.Provider; 94 | 95 | var getMomentFromNumber = function getMomentFromNumber(date, value) { 96 | var trunced = Math.trunc(value); 97 | return date.clone().set('hour', trunced).set('minutes', (value - trunced) * 60).set('second', 0).set('millisecond', 0); 98 | }; 99 | var getDatesFormats = function getDatesFormats(props) { 100 | return _extends(_extends({}, defaultDatesFormats), props.datesFormats); 101 | }; 102 | var getArrayDates = function getArrayDates(start, count) { 103 | var dates = []; 104 | var clonedStart = start.clone().set('hour', 0).set('minute', 0).set('second', 1).set('millisecond', 0); 105 | 106 | for (var i = 0; i < count; i++) { 107 | dates.push(clonedStart.clone().add(i, 'day')); 108 | } 109 | 110 | return dates; 111 | }; 112 | var isInInterval = function isInInterval(interval1, interval2) { 113 | var _getMomentsFromRange = getMomentsFromRange(interval1), 114 | start = _getMomentsFromRange.start, 115 | end = _getMomentsFromRange.end; 116 | 117 | var _getMomentsFromRange2 = getMomentsFromRange(interval2), 118 | start2 = _getMomentsFromRange2.start, 119 | end2 = _getMomentsFromRange2.end; 120 | 121 | return start.isSame(start2, "minute") || end.isSame(end2, "minute") || start.isBetween(start2, end2, 'minutes', '()') || end.isBetween(start2, end2, 'minutes', '()'); 122 | }; 123 | var getMomentsFromRange = function getMomentsFromRange(interval) { 124 | return { 125 | start: getMomentFromDate(interval.start), 126 | end: getMomentFromDate(interval.end) 127 | }; 128 | }; 129 | var getMomentFromDate = function getMomentFromDate(date) { 130 | return date instanceof moment ? date : moment(date); 131 | }; 132 | 133 | var RowHeader = function RowHeader(_ref) { 134 | var interval = _ref.interval; 135 | 136 | var _React$useContext = React.useContext(CheckContext), 137 | props = _React$useContext.props; 138 | 139 | var start = interval.start, 140 | end = interval.end; 141 | 142 | var _getDatesFormats = getDatesFormats(props), 143 | fromHour = _getDatesFormats.fromHour, 144 | toHour = _getDatesFormats.toHour; 145 | 146 | if (props.renderRowHeader) { 147 | return props.renderRowHeader(interval); 148 | } 149 | 150 | return React.createElement("td", { 151 | className: classNames('check-calendar__row-header', props.headerRowClassName) 152 | }, React.createElement("div", { 153 | className: "check-calendar__hour" 154 | }, start && HTMLParser("" + (getMomentFromNumber(moment(), start).format(fromHour).replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || '') + ""), end && HTMLParser("" + (getMomentFromNumber(moment(), end).format(toHour).replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || '') + ""))); 155 | }; 156 | 157 | var ColumnDate = function ColumnDate(_ref) { 158 | var date = _ref.date; 159 | 160 | var _React$useContext = React.useContext(CheckContext), 161 | props = _React$useContext.props; 162 | 163 | if (props.renderColumnHeader) { 164 | return props.renderColumnHeader(date); 165 | } 166 | 167 | return React.createElement("div", null, React.createElement("div", null, React.createElement(Moment, { 168 | className: "check-calendar_day", 169 | locale: props === null || props === void 0 ? void 0 : props.locale, 170 | format: "ddd" 171 | }, date)), React.createElement("div", null, React.createElement(Moment, { 172 | className: "check-calendar__day-number", 173 | locale: "fr", 174 | format: "DD" 175 | }, date)), React.createElement("div", null, React.createElement(Moment, { 176 | className: "check-calendar__month", 177 | locale: "fr", 178 | format: "MMM" 179 | }, date)), React.createElement("div", null)); 180 | }; 181 | 182 | var Checkbox = function Checkbox(_ref) { 183 | var interval = _ref.interval, 184 | props = _objectWithoutPropertiesLoose(_ref, ["interval"]); 185 | 186 | var _React$useContext = React.useContext(CheckContext), 187 | _React$useContext$pro = _React$useContext.props, 188 | disableBefore = _React$useContext$pro.disableBefore, 189 | disableAfter = _React$useContext$pro.disableAfter, 190 | disabledDates = _React$useContext$pro.disabledDates; 191 | 192 | var _handleChange = function _handleChange(e) { 193 | var value = e.target.checked; 194 | props.onChange(value, _extends(_extends({}, props), {}, { 195 | checked: value, 196 | value: value ? 0 : 1, 197 | interval: interval 198 | })); 199 | }; 200 | 201 | var isBeforeDisabled = disableBefore ? interval.end.isBefore(getMomentFromDate(disableBefore)) : false; 202 | var isAfterDisabled = disableAfter ? interval.start.isAfter(getMomentFromDate(disableAfter)) : false; 203 | var isDisabledDate = Array.isArray(disabledDates) ? disabledDates.some(function (d) { 204 | return getMomentFromDate(d).isBetween(interval.start, interval.end); 205 | }) : false; 206 | var disabled = props.disabled || isBeforeDisabled || isAfterDisabled || isDisabledDate; 207 | return React.createElement("label", { 208 | className: classNames('check-calendar-checkbox__wrapper', { 209 | disabled: disabled 210 | }, props.className) 211 | }, React.createElement("span", { 212 | className: "check-calendar-checkbox" 213 | }, React.createElement("input", Object.assign({}, props, { 214 | onChange: _handleChange, 215 | className: classNames('check-calendar-checkbox__input'), 216 | type: "checkbox", 217 | disabled: disabled 218 | })), React.createElement("span", { 219 | className: "check-calendar-checkbox__inner" 220 | }))); 221 | }; 222 | 223 | var CheckCalendar = function () { 224 | var CheckCalendar = /*#__PURE__*/function (_React$Component) { 225 | _inheritsLoose(CheckCalendar, _React$Component); 226 | 227 | function CheckCalendar() { 228 | var _this; 229 | 230 | _this = _React$Component.apply(this, arguments) || this; 231 | _this.state = { 232 | loading: false, 233 | currentDate: moment(_this.props.start).set('day', _this.props.startWeekDay || 1), 234 | checkedRanges: [] 235 | }; 236 | 237 | _this._handlePrevious = function () { 238 | _this.setState({ 239 | loading: true 240 | }); 241 | 242 | setTimeout(function () { 243 | _this.setState({ 244 | loading: false, 245 | currentDate: _this.state.currentDate.subtract(7, 'days') 246 | }, _this.props.onPreviousClick); 247 | }, 400); 248 | }; 249 | 250 | _this._handleNext = function () { 251 | _this.setState({ 252 | loading: true 253 | }); 254 | 255 | setTimeout(function () { 256 | _this.setState({ 257 | loading: false, 258 | currentDate: _this.state.currentDate.add(7, 'days') 259 | }, _this.props.onNextClick); 260 | }, 400); 261 | }; 262 | 263 | _this._handleChange = function (value, props) { 264 | var checkedRanges = _this.state.checkedRanges; 265 | var interval = props.interval; 266 | var _this$props = _this.props, 267 | onChange = _this$props.onChange, 268 | checkedDates = _this$props.checkedDates; 269 | var newChecked = [].concat(Array.isArray(checkedDates) ? checkedDates : checkedRanges); 270 | 271 | if (value) { 272 | newChecked.push(interval); 273 | } else { 274 | var foundIndex = newChecked.findIndex(function (c) { 275 | return isInInterval(c, interval); 276 | }); 277 | 278 | if (foundIndex > -1) { 279 | newChecked.splice(foundIndex, 1); 280 | } 281 | } 282 | 283 | newChecked = newChecked.map(function (i) { 284 | return getMomentsFromRange(i); 285 | }); 286 | 287 | if (onChange) { 288 | onChange({ 289 | dates: newChecked.map(function (i) { 290 | return { 291 | start: i.start.toDate(), 292 | end: i.end.toDate() 293 | }; 294 | }), 295 | moments: newChecked 296 | }); 297 | } 298 | 299 | if (!Array.isArray(checkedDates)) { 300 | _this.setState({ 301 | checkedRanges: newChecked 302 | }); 303 | } 304 | }; 305 | 306 | return _this; 307 | } 308 | 309 | var _proto = CheckCalendar.prototype; 310 | 311 | _proto.render = function render() { 312 | var _this2 = this; 313 | 314 | var _this$props2 = this.props, 315 | hoursIntervals = _this$props2.hoursIntervals, 316 | hideDays = _this$props2.hideDays, 317 | max = _this$props2.max, 318 | min = _this$props2.min, 319 | checkedDates = _this$props2.checkedDates, 320 | leftButton = _this$props2.leftButton, 321 | rightButton = _this$props2.rightButton, 322 | containerClassName = _this$props2.containerClassName, 323 | tableClassName = _this$props2.tableClassName, 324 | headerClassName = _this$props2.headerClassName, 325 | contentClassName = _this$props2.contentClassName; 326 | var _this$state = this.state, 327 | loading = _this$state.loading, 328 | currentDate = _this$state.currentDate, 329 | checkedRanges = _this$state.checkedRanges; 330 | var dates = getArrayDates(currentDate, 7); 331 | var checked = Array.isArray(checkedDates) ? checkedDates : checkedRanges; 332 | var prevDisabled = loading || !!min && dates[0].clone().set('hour', 0).isBefore(moment(min)); 333 | var nextDisabled = loading || !!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max)); 334 | console.log('max', !!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max)), 'min', !!min && dates[0].clone().set('hour', 0).isBefore(moment(min))); 335 | return React.createElement(CheckContextProvider, { 336 | value: { 337 | props: this.props 338 | } 339 | }, React.createElement("div", { 340 | className: classNames('check-calendar', containerClassName) 341 | }, React.createElement("button", { 342 | className: classNames('check-calendar__button check-calendar__prev', leftButton === null || leftButton === void 0 ? void 0 : leftButton.className), 343 | disabled: prevDisabled, 344 | onClick: this._handlePrevious 345 | }, (leftButton === null || leftButton === void 0 ? void 0 : leftButton.content) || React.createElement(Left, null)), React.createElement("button", { 346 | className: classNames('check-calendar__button check-calendar__next', rightButton === null || rightButton === void 0 ? void 0 : rightButton.className), 347 | disabled: nextDisabled, 348 | onClick: this._handleNext 349 | }, (rightButton === null || rightButton === void 0 ? void 0 : rightButton.content) || React.createElement(Right, null)), React.createElement("div", { 350 | className: classNames('check-calendar__container', { 351 | 'check-calendar__container--hide': loading 352 | }), 353 | ref: "calendar" 354 | }, React.createElement("table", { 355 | className: classNames('check-calendar__table', tableClassName) 356 | }, React.createElement("thead", null), React.createElement("tbody", null, React.createElement("tr", { 357 | className: "check-calendar__header" 358 | }, React.createElement("td", { 359 | key: "header_empty", 360 | className: classNames(headerClassName) 361 | }), dates.map(function (current) { 362 | return React.createElement("td", { 363 | key: "check-calendar-header-" + current.format('YYYY_MM_DD'), 364 | className: classNames(headerClassName, { 365 | 'check-calendar__hidden': hideDays === null || hideDays === void 0 ? void 0 : hideDays.includes(current.day()) 366 | }) 367 | }, React.createElement(ColumnDate, { 368 | date: current 369 | })); 370 | })), hoursIntervals && hoursIntervals.map(function (row) { 371 | return React.createElement("tr", { 372 | key: row.start + "_" + row.end 373 | }, React.createElement(RowHeader, { 374 | interval: row 375 | }), dates.map(function (day) { 376 | var interval = { 377 | start: getMomentFromNumber(day, row.start), 378 | end: getMomentFromNumber(day, row.end) 379 | }; 380 | return React.createElement("td", { 381 | key: day.format('YYYY_MM_DD') + "_" + interval.start + "_" + interval.end, 382 | className: classNames(contentClassName, { 383 | 'check-calendar__hidden': hideDays === null || hideDays === void 0 ? void 0 : hideDays.includes(day.day()) 384 | }) 385 | }, React.createElement(Checkbox, { 386 | interval: interval, 387 | onChange: _this2._handleChange, 388 | checked: !!checked.find(function (c) { 389 | return isInInterval(c, interval); 390 | }), 391 | value: "off" 392 | })); 393 | })); 394 | })))))); 395 | }; 396 | 397 | return CheckCalendar; 398 | }(React.Component); 399 | 400 | CheckCalendar.defaultProps = defaultProps; 401 | return CheckCalendar; 402 | }(); 403 | 404 | exports.CheckCalendar = CheckCalendar; 405 | exports.Checkbox = Checkbox; 406 | exports.LeftIcon = Left; 407 | exports.RightIcon = Right; 408 | exports.default = CheckCalendar; 409 | exports.defaultProps = defaultProps; 410 | //# sourceMappingURL=index.js.map 411 | -------------------------------------------------------------------------------- /example/report.20200501.142912.12428.0.001.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "header": { 4 | "reportVersion": 1, 5 | "event": "Allocation failed - JavaScript heap out of memory", 6 | "trigger": "FatalError", 7 | "filename": "report.20200501.142912.12428.0.001.json", 8 | "dumpEventTime": "2020-05-01T14:29:12Z", 9 | "dumpEventTimeStamp": "1588336152758", 10 | "processId": 12428, 11 | "cwd": "C:\\Users\\polak\\Web\\react-check-calendar\\example", 12 | "commandLine": [ 13 | "node", 14 | "C:\\Users\\polak\\Web\\react-check-calendar\\node_modules\\react-scripts\\scripts\\start.js" 15 | ], 16 | "nodejsVersion": "v12.11.0", 17 | "wordSize": 64, 18 | "arch": "x64", 19 | "platform": "win32", 20 | "componentVersions": { 21 | "node": "12.11.0", 22 | "v8": "7.7.299.11-node.12", 23 | "uv": "1.32.0", 24 | "zlib": "1.2.11", 25 | "brotli": "1.0.7", 26 | "ares": "1.15.0", 27 | "modules": "72", 28 | "nghttp2": "1.39.2", 29 | "napi": "5", 30 | "llhttp": "1.1.4", 31 | "http_parser": "2.8.0", 32 | "openssl": "1.1.1c", 33 | "cldr": "35.1", 34 | "icu": "64.2", 35 | "tz": "2019a", 36 | "unicode": "12.1" 37 | }, 38 | "release": { 39 | "name": "node", 40 | "headersUrl": "https://nodejs.org/download/release/v12.11.0/node-v12.11.0-headers.tar.gz", 41 | "sourceUrl": "https://nodejs.org/download/release/v12.11.0/node-v12.11.0.tar.gz", 42 | "libUrl": "https://nodejs.org/download/release/v12.11.0/win-x64/node.lib" 43 | }, 44 | "osName": "Windows_NT", 45 | "osRelease": "10.0.18362", 46 | "osVersion": "Windows 10 Pro", 47 | "osMachine": "x86_64", 48 | "cpus": [ 49 | { 50 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 51 | "speed": 3408, 52 | "user": 410921, 53 | "nice": 0, 54 | "sys": 244312, 55 | "idle": 1536218, 56 | "irq": 26734 57 | }, 58 | { 59 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 60 | "speed": 3408, 61 | "user": 353890, 62 | "nice": 0, 63 | "sys": 248031, 64 | "idle": 1589343, 65 | "irq": 1437 66 | }, 67 | { 68 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 69 | "speed": 3408, 70 | "user": 556531, 71 | "nice": 0, 72 | "sys": 208375, 73 | "idle": 1426359, 74 | "irq": 1843 75 | }, 76 | { 77 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 78 | "speed": 3408, 79 | "user": 378781, 80 | "nice": 0, 81 | "sys": 208750, 82 | "idle": 1603734, 83 | "irq": 1125 84 | }, 85 | { 86 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 87 | "speed": 3408, 88 | "user": 463843, 89 | "nice": 0, 90 | "sys": 273468, 91 | "idle": 1453953, 92 | "irq": 1859 93 | }, 94 | { 95 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 96 | "speed": 3408, 97 | "user": 385265, 98 | "nice": 0, 99 | "sys": 148796, 100 | "idle": 1657203, 101 | "irq": 1218 102 | }, 103 | { 104 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 105 | "speed": 3408, 106 | "user": 421843, 107 | "nice": 0, 108 | "sys": 260312, 109 | "idle": 1509109, 110 | "irq": 1843 111 | }, 112 | { 113 | "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", 114 | "speed": 3408, 115 | "user": 457203, 116 | "nice": 0, 117 | "sys": 189093, 118 | "idle": 1544968, 119 | "irq": 1359 120 | } 121 | ], 122 | "networkInterfaces": [ 123 | { 124 | "name": "Ethernet", 125 | "internal": false, 126 | "mac": "70:8b:cd:a6:1c:c7", 127 | "address": "fe80::78f6:b048:b074:781f", 128 | "netmask": "ffff:ffff:ffff:ffff::", 129 | "family": "IPv6", 130 | "scopeid": 3 131 | }, 132 | { 133 | "name": "Ethernet", 134 | "internal": false, 135 | "mac": "70:8b:cd:a6:1c:c7", 136 | "address": "192.168.0.103", 137 | "netmask": "255.255.255.0", 138 | "family": "IPv4" 139 | }, 140 | { 141 | "name": "VirtualBox Host-Only Network", 142 | "internal": false, 143 | "mac": "0a:00:27:00:00:0d", 144 | "address": "fe80::c89e:139c:4840:a225", 145 | "netmask": "ffff:ffff:ffff:ffff::", 146 | "family": "IPv6", 147 | "scopeid": 13 148 | }, 149 | { 150 | "name": "VirtualBox Host-Only Network", 151 | "internal": false, 152 | "mac": "0a:00:27:00:00:0d", 153 | "address": "192.168.56.1", 154 | "netmask": "255.255.255.0", 155 | "family": "IPv4" 156 | }, 157 | { 158 | "name": "Loopback Pseudo-Interface 1", 159 | "internal": true, 160 | "mac": "00:00:00:00:00:00", 161 | "address": "::1", 162 | "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", 163 | "family": "IPv6", 164 | "scopeid": 0 165 | }, 166 | { 167 | "name": "Loopback Pseudo-Interface 1", 168 | "internal": true, 169 | "mac": "00:00:00:00:00:00", 170 | "address": "127.0.0.1", 171 | "netmask": "255.0.0.0", 172 | "family": "IPv4" 173 | } 174 | ], 175 | "host": "DESKTOP-GNT2MN8" 176 | }, 177 | "javascriptStack": { 178 | "message": "No stack.", 179 | "stack": [ 180 | "Unavailable." 181 | ] 182 | }, 183 | "nativeStack": [ 184 | { 185 | "pc": "0x00007ff6136a7539", 186 | "symbol": "std::basic_ostream >::operator<<+10873" 187 | }, 188 | { 189 | "pc": "0x00007ff6136ab8cc", 190 | "symbol": "std::basic_ostream >::operator<<+28172" 191 | }, 192 | { 193 | "pc": "0x00007ff6136aa878", 194 | "symbol": "std::basic_ostream >::operator<<+23992" 195 | }, 196 | { 197 | "pc": "0x00007ff613798c0b", 198 | "symbol": "v8::base::CPU::has_sse+37563" 199 | }, 200 | { 201 | "pc": "0x00007ff613f99aee", 202 | "symbol": "v8::Isolate::ReportExternalAllocationLimitReached+94" 203 | }, 204 | { 205 | "pc": "0x00007ff613f81b31", 206 | "symbol": "v8::SharedArrayBuffer::Externalize+833" 207 | }, 208 | { 209 | "pc": "0x00007ff613e4f4bc", 210 | "symbol": "v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436" 211 | }, 212 | { 213 | "pc": "0x00007ff613e5a860", 214 | "symbol": "v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312" 215 | }, 216 | { 217 | "pc": "0x00007ff613e57394", 218 | "symbol": "v8::internal::Heap::PageFlagsAreConsistent+3204" 219 | }, 220 | { 221 | "pc": "0x00007ff613e4cc23", 222 | "symbol": "v8::internal::Heap::CollectGarbage+1283" 223 | }, 224 | { 225 | "pc": "0x00007ff613e4b3f4", 226 | "symbol": "v8::internal::Heap::AddRetainedMap+2356" 227 | }, 228 | { 229 | "pc": "0x00007ff613e6c6c5", 230 | "symbol": "v8::internal::Factory::NewFillerObject+53" 231 | }, 232 | { 233 | "pc": "0x00007ff613bd8e99", 234 | "symbol": "v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+4057" 235 | }, 236 | { 237 | "pc": "0x00007ff6143c580d", 238 | "symbol": "v8::internal::SetupIsolateDelegate::SetupHeap+567949" 239 | }, 240 | { 241 | "pc": "0x00007ff614417e32", 242 | "symbol": "v8::internal::SetupIsolateDelegate::SetupHeap+905394" 243 | }, 244 | { 245 | "pc": "0x000000c655e5306b", 246 | "symbol": "" 247 | } 248 | ], 249 | "javascriptHeap": { 250 | "totalMemory": 2161283072, 251 | "totalCommittedMemory": 2161283072, 252 | "usedMemory": 1813706888, 253 | "availableMemory": 121032008, 254 | "memoryLimit": 2197815296, 255 | "heapSpaces": { 256 | "read_only_space": { 257 | "memorySize": 262144, 258 | "committedMemory": 262144, 259 | "capacity": 261872, 260 | "used": 32296, 261 | "available": 229576 262 | }, 263 | "new_space": { 264 | "memorySize": 33554432, 265 | "committedMemory": 33554432, 266 | "capacity": 16759808, 267 | "used": 636568, 268 | "available": 16123240 269 | }, 270 | "old_space": { 271 | "memorySize": 2001580032, 272 | "committedMemory": 2001580032, 273 | "capacity": 1739726744, 274 | "used": 1688339584, 275 | "available": 51387160 276 | }, 277 | "code_space": { 278 | "memorySize": 1474560, 279 | "committedMemory": 1474560, 280 | "capacity": 1301984, 281 | "used": 1301984, 282 | "available": 0 283 | }, 284 | "map_space": { 285 | "memorySize": 3674112, 286 | "committedMemory": 3674112, 287 | "capacity": 2839120, 288 | "used": 2839120, 289 | "available": 0 290 | }, 291 | "large_object_space": { 292 | "memorySize": 120115200, 293 | "committedMemory": 120115200, 294 | "capacity": 120006936, 295 | "used": 120006936, 296 | "available": 0 297 | }, 298 | "code_large_object_space": { 299 | "memorySize": 622592, 300 | "committedMemory": 622592, 301 | "capacity": 550400, 302 | "used": 550400, 303 | "available": 0 304 | }, 305 | "new_large_object_space": { 306 | "memorySize": 0, 307 | "committedMemory": 0, 308 | "capacity": 16759808, 309 | "used": 0, 310 | "available": 16759808 311 | } 312 | } 313 | }, 314 | "resourceUsage": { 315 | "userCpuSeconds": 250.781, 316 | "kernelCpuSeconds": 504.062, 317 | "cpuConsumptionPercent": 375.544, 318 | "maxRss": 2379800576, 319 | "pageFaults": { 320 | "IORequired": 2429215, 321 | "IONotRequired": 0 322 | }, 323 | "fsActivity": { 324 | "reads": 5846, 325 | "writes": 8 326 | } 327 | }, 328 | "libuv": [ 329 | ], 330 | "environmentVariables": { 331 | "ALLUSERSPROFILE": "C:\\ProgramData", 332 | "APPDATA": "C:\\Users\\polak\\AppData\\Roaming", 333 | "asl.log": "Destination=file", 334 | "BABEL_ENV": "development", 335 | "BREAKPAD_DUMP_LOCATION": "C:\\Program Files (x86)\\Google\\Chrome", 336 | "ChocolateyInstall": "C:\\ProgramData\\chocolatey", 337 | "ChocolateyLastPathUpdate": "132056208972477653", 338 | "CommonProgramFiles": "C:\\Program Files\\Common Files", 339 | "CommonProgramFiles(x86)": "C:\\Program Files (x86)\\Common Files", 340 | "CommonProgramW6432": "C:\\Program Files\\Common Files", 341 | "COMPUTERNAME": "DESKTOP-GNT2MN8", 342 | "ComSpec": "C:\\WINDOWS\\system32\\cmd.exe", 343 | "DriverData": "C:\\Windows\\System32\\Drivers\\DriverData", 344 | "GOOGLE_API_KEY": "no", 345 | "GOOGLE_DEFAULT_CLIENT_ID": "no", 346 | "GOOGLE_DEFAULT_CLIENT_SECRET": "no", 347 | "HOMEDRIVE": "C:", 348 | "HOMEPATH": "\\Users\\polak", 349 | "IDEA_INITIAL_DIRECTORY": "C:\\Program Files\\JetBrains\\WebStorm 2020.1.1\\jbr\\bin", 350 | "INIT_CWD": "C:\\Users\\polak\\Web\\react-check-calendar\\example", 351 | "LOCALAPPDATA": "C:\\Users\\polak\\AppData\\Local", 352 | "LOGONSERVER": "\\\\DESKTOP-GNT2MN8", 353 | "NODE": "C:\\Program Files\\nodejs\\node.exe", 354 | "NODE_ENV": "development", 355 | "NODE_PATH": "", 356 | "npm_config_argv": "{\"remain\":[],\"cooked\":[\"run\",\"start\"],\"original\":[\"start\"]}", 357 | "npm_config_bin_links": "true", 358 | "npm_config_browser": "firefox", 359 | "npm_config_ignore_optional": "", 360 | "npm_config_ignore_scripts": "", 361 | "npm_config_init_license": "MIT", 362 | "npm_config_init_version": "1.0.0", 363 | "npm_config_registry": "https://registry.yarnpkg.com", 364 | "npm_config_save_prefix": "^", 365 | "npm_config_strict_ssl": "true", 366 | "npm_config_user_agent": "yarn/1.9.4 npm/? node/v12.11.0 win32 x64", 367 | "npm_config_version_commit_hooks": "true", 368 | "npm_config_version_git_message": "v%s", 369 | "npm_config_version_git_sign": "", 370 | "npm_config_version_git_tag": "true", 371 | "npm_config_version_tag_prefix": "v", 372 | "npm_config_viewer": "firefox", 373 | "npm_execpath": "C:\\Users\\polak\\AppData\\Roaming\\npm\\node_modules\\yarn\\bin\\yarn.js", 374 | "npm_lifecycle_event": "start", 375 | "npm_lifecycle_script": "node ../node_modules/react-scripts/bin/react-scripts.js start", 376 | "npm_node_execpath": "C:\\Program Files\\nodejs\\node.exe", 377 | "npm_package_browserslist_0": ">0.2%", 378 | "npm_package_browserslist_1": "not dead", 379 | "npm_package_browserslist_2": "not ie <= 11", 380 | "npm_package_browserslist_3": "not op_mini all", 381 | "npm_package_dependencies_react": "link:../node_modules/react", 382 | "npm_package_dependencies_react_check_calendar": "link:..", 383 | "npm_package_dependencies_react_dom": "link:../node_modules/react-dom", 384 | "npm_package_dependencies_react_scripts": "link:../node_modules/react-scripts", 385 | "npm_package_eslintConfig_extends": "react-app", 386 | "npm_package_homepage": "https://polqk.github.io/react-check-calendar", 387 | "npm_package_name": "react-check-calendar-example", 388 | "npm_package_private": "true", 389 | "npm_package_readmeFilename": "README.md", 390 | "npm_package_scripts_build": "node ../node_modules/react-scripts/bin/react-scripts.js build", 391 | "npm_package_scripts_eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject", 392 | "npm_package_scripts_start": "node ../node_modules/react-scripts/bin/react-scripts.js start", 393 | "npm_package_scripts_test": "node ../node_modules/react-scripts/bin/react-scripts.js test", 394 | "npm_package_version": "0.0.0", 395 | "NUMBER_OF_PROCESSORS": "8", 396 | "NVM_HOME": "C:\\Users\\polak\\AppData\\Roaming\\nvm", 397 | "NVM_SYMLINK": "C:\\Program Files\\nodejs", 398 | "OneDrive": "C:\\Users\\polak\\OneDrive", 399 | "OneDriveConsumer": "C:\\Users\\polak\\OneDrive", 400 | "OS": "Windows_NT", 401 | "PATH": "C:\\Users\\polak\\Web\\react-check-calendar\\example\\node_modules\\.bin;C:\\Users\\polak\\AppData\\Local\\Yarn\\Data\\link\\node_modules\\.bin;C:\\Users\\polak\\Web\\react-check-calendar\\example\\node_modules\\.bin;C:\\Users\\polak\\AppData\\Local\\Yarn\\Data\\link\\node_modules\\.bin;C:\\Users\\polak\\AppData\\Local\\Yarn\\bin;C:\\Program Files\\libexec\\lib\\node_modules\\npm\\bin\\node-gyp-bin;C:\\Program Files\\lib\\node_modules\\npm\\bin\\node-gyp-bin;C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\node-gyp-bin;C:\\Users\\polak\\Web\\react-check-calendar\\node_modules\\.bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\WinTask\\Bin;C:\\xampp\\php;C:\\ProgramData\\ComposerSetup\\bin;C:\\PhantomJs\\bin\\phantomjs;C:\\casperjs\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\PuTTY\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Users\\polak\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\nodejs\\;C:\\Program Files\\Amazon\\AWSCLI\\bin\\;C:\\ProgramData\\chocolatey\\bin;;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Users\\polak\\AppData\\Local\\Programs\\Python\\Python37-32\\Scripts\\;C:\\Users\\polak\\AppData\\Local\\Programs\\Python\\Python37-32\\;C:\\Users\\polak\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\polak\\AppData\\Local\\atom\\bin;%DASHLANE_DLL_DIR%;C:\\Users\\polak\\AppData\\Roaming\\Composer\\vendor\\bin;C:\\PhantomJs\\bin\\phantomjs;C:\\casperjs\\bin\\;C:\\Program Files\\MongoDB\\Server\\3.6\\bin;C:\\Program Files\\Heroku\\bin;C:\\Users\\polak\\AppData\\Local\\GitHubDesktop\\bin;C:\\Users\\polak\\AppData\\Roaming\\npm;C:\\Users\\polak\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Users\\polak\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\polak\\AppData\\Local\\.meteor;;C:\\Users\\polak\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\JetBrains\\WebStorm 2020.1.1\\bin;", 402 | "PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC", 403 | "PROCESSOR_ARCHITECTURE": "AMD64", 404 | "PROCESSOR_IDENTIFIER": "Intel64 Family 6 Model 94 Stepping 3, GenuineIntel", 405 | "PROCESSOR_LEVEL": "6", 406 | "PROCESSOR_REVISION": "5e03", 407 | "ProgramData": "C:\\ProgramData", 408 | "ProgramFiles": "C:\\Program Files", 409 | "ProgramFiles(x86)": "C:\\Program Files (x86)", 410 | "ProgramW6432": "C:\\Program Files", 411 | "PROMPT": "$P$G", 412 | "PSModulePath": "C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules", 413 | "PUBLIC": "C:\\Users\\Public", 414 | "PYTHON": "C:\\Users\\polak\\AppData\\Local\\Programs\\Python\\Python37\\python.exe", 415 | "SESSIONNAME": "Console", 416 | "SystemDrive": "C:", 417 | "SystemRoot": "C:\\WINDOWS", 418 | "TEMP": "E:\\TEMP\\TEMP", 419 | "TERMINAL_EMULATOR": "JetBrains-JediTerm", 420 | "TMP": "E:\\TEMP\\TEMP", 421 | "USERDOMAIN": "DESKTOP-GNT2MN8", 422 | "USERDOMAIN_ROAMINGPROFILE": "DESKTOP-GNT2MN8", 423 | "USERNAME": "polak", 424 | "USERPROFILE": "C:\\Users\\polak", 425 | "VBOX_MSI_INSTALL_PATH": "C:\\Program Files\\Oracle\\VirtualBox\\", 426 | "WEBPACK_DEV_SERVER": "true", 427 | "WebStorm": "C:\\Program Files\\JetBrains\\WebStorm 2020.1.1\\bin;", 428 | "windir": "C:\\WINDOWS", 429 | "YARN_WRAP_OUTPUT": "false", 430 | "__INTELLIJ_COMMAND_HISTFILE__": "C:\\Users\\polak\\AppData\\Roaming\\JetBrains\\WebStorm2020.1\\terminal\\history\\history-828" 431 | }, 432 | "sharedObjects": [ 433 | "C:\\Program Files\\nodejs\\node.exe", 434 | "C:\\WINDOWS\\SYSTEM32\\ntdll.dll", 435 | "C:\\Program Files\\AVAST Software\\Avast\\aswhook.dll", 436 | "C:\\WINDOWS\\System32\\KERNEL32.DLL", 437 | "C:\\WINDOWS\\System32\\KERNELBASE.dll", 438 | "C:\\WINDOWS\\System32\\WS2_32.dll", 439 | "C:\\WINDOWS\\System32\\RPCRT4.dll", 440 | "C:\\WINDOWS\\System32\\ADVAPI32.dll", 441 | "C:\\WINDOWS\\System32\\msvcrt.dll", 442 | "C:\\WINDOWS\\System32\\sechost.dll", 443 | "C:\\WINDOWS\\System32\\USER32.dll", 444 | "C:\\WINDOWS\\System32\\win32u.dll", 445 | "C:\\WINDOWS\\System32\\GDI32.dll", 446 | "C:\\WINDOWS\\System32\\gdi32full.dll", 447 | "C:\\WINDOWS\\System32\\msvcp_win.dll", 448 | "C:\\WINDOWS\\System32\\ucrtbase.dll", 449 | "C:\\WINDOWS\\System32\\PSAPI.DLL", 450 | "C:\\WINDOWS\\System32\\CRYPT32.dll", 451 | "C:\\WINDOWS\\System32\\MSASN1.dll", 452 | "C:\\WINDOWS\\System32\\bcrypt.dll", 453 | "C:\\WINDOWS\\SYSTEM32\\dbghelp.dll", 454 | "C:\\WINDOWS\\SYSTEM32\\IPHLPAPI.DLL", 455 | "C:\\WINDOWS\\SYSTEM32\\USERENV.dll", 456 | "C:\\WINDOWS\\System32\\profapi.dll", 457 | "C:\\WINDOWS\\SYSTEM32\\WINMM.dll", 458 | "C:\\WINDOWS\\SYSTEM32\\WINMMBASE.dll", 459 | "C:\\WINDOWS\\System32\\cfgmgr32.dll", 460 | "C:\\WINDOWS\\System32\\bcryptPrimitives.dll", 461 | "C:\\WINDOWS\\System32\\IMM32.DLL", 462 | "C:\\WINDOWS\\System32\\powrprof.dll", 463 | "C:\\WINDOWS\\System32\\UMPDC.dll", 464 | "C:\\WINDOWS\\system32\\uxtheme.dll", 465 | "C:\\WINDOWS\\System32\\combase.dll", 466 | "C:\\WINDOWS\\system32\\mswsock.dll", 467 | "C:\\WINDOWS\\System32\\kernel.appcore.dll", 468 | "C:\\WINDOWS\\SYSTEM32\\CRYPTBASE.DLL", 469 | "C:\\WINDOWS\\System32\\NSI.dll", 470 | "C:\\WINDOWS\\SYSTEM32\\dhcpcsvc6.DLL", 471 | "C:\\WINDOWS\\SYSTEM32\\dhcpcsvc.DLL", 472 | "C:\\WINDOWS\\SYSTEM32\\DNSAPI.dll", 473 | "C:\\WINDOWS\\system32\\napinsp.dll", 474 | "C:\\WINDOWS\\system32\\pnrpnsp.dll", 475 | "C:\\WINDOWS\\System32\\winrnr.dll", 476 | "C:\\WINDOWS\\system32\\NLAapi.dll", 477 | "C:\\WINDOWS\\system32\\wshbth.dll", 478 | "C:\\Windows\\System32\\rasadhlp.dll", 479 | "C:\\WINDOWS\\System32\\fwpuclnt.dll" 480 | ] 481 | } -------------------------------------------------------------------------------- /dist/index.modern.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.modern.js","sources":["../src/Left.tsx","../src/Right.tsx","../src/defaults.ts","../src/context.tsx","../src/helpers.ts","../src/RowHeader.tsx","../src/ColumnDate.tsx","../src/CheckBox/index.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\ninterface Props {\r\n}\r\n\r\nconst Left: React.FC = () => (\r\n \r\n \r\n \r\n);\r\n\r\nexport default Left;\r\n","import * as React from 'react';\r\n\r\ninterface Props {\r\n}\r\n\r\nconst Right: React.FC = () => (\r\n \r\n \r\n \r\n);\r\n\r\nexport default Right;\r\n","import {CheckCalendarContext, CheckCalendarProps, DatesFormats} from \"./types\";\r\n\r\nexport const defaultProps: CheckCalendarProps = {\r\n startWeekDay: 1,\r\n locale: 'en',\r\n hoursIntervals: [\r\n { start: 8, end: 10 },\r\n { start: 10, end: 12 },\r\n { start: 13, end: 15 },\r\n { start: 15, end: 17 }\r\n ],\r\n hideDays: [0, 6]\r\n};\r\n\r\nexport const defaultContext: CheckCalendarContext = {\r\n props: defaultProps\r\n};\r\n\r\nexport const defaultDatesFormats: DatesFormats = {\r\n fromHour: '[from] []h:mm[][]a[]',\r\n toHour: ' [to] []h:mm[][]a[]'\r\n};\r\n","import * as React from 'react';\r\nimport { CheckCalendarContext } from \"./types\";\r\nimport {defaultContext} from \"./defaults\";\r\n\r\nconst CheckContext = React.createContext(defaultContext);\r\nexport const CheckContextProvider = CheckContext.Provider;\r\nexport default CheckContext;\r\n","import moment from 'moment';\nimport {CheckCalendarProps, MomentOrDateRange, MomentRange} from \"./types\";\nimport { defaultDatesFormats } from \"./defaults\";\n\nexport const getMomentFromNumber = (date: moment.Moment, value: number) => {\n const trunced = Math.trunc(value);\n return date.clone()\n .set('hour', trunced)\n .set('minutes', (value - trunced) * 60)\n .set('second', 0)\n .set('millisecond', 0);\n};\n\nexport const getDatesFormats = (props: CheckCalendarProps) =>\n ({ ...defaultDatesFormats, ...props.datesFormats });\n\nexport const getArrayDates = (start: moment.Moment, count: number) => {\n const dates = []\n\n const clonedStart = start.clone().set('hour', 0).set('minute', 0).set('second', 1).set('millisecond', 0);\n\n for (let i = 0; i < count; i++) {\n dates.push(clonedStart.clone().add(i, 'day'));\n }\n\n return dates;\n};\n\nexport const isInInterval = (interval1: MomentOrDateRange, interval2: MomentOrDateRange) => {\n const { start, end } = getMomentsFromRange(interval1);\n const { start: start2, end: end2 } = getMomentsFromRange(interval2);\n\n return start.isSame(start2, \"minute\") ||\n end.isSame(end2, \"minute\") ||\n start.isBetween(start2, end2, 'minutes', '()') ||\n end.isBetween(start2, end2, 'minutes', '()');\n}\n\nexport const getMomentsFromRange = (interval: MomentOrDateRange): MomentRange => ({\n start: getMomentFromDate(interval.start),\n end: getMomentFromDate(interval.end)\n})\n\nexport const getMomentFromDate = (date: Date | moment.Moment | string) =>\n date instanceof moment ? date as moment.Moment : moment(date);\n","import * as React from 'react';\r\nimport {HourInterval} from \"./types\";\r\nimport {getDatesFormats, getMomentFromNumber} from \"./helpers\";\r\nimport HTMLParser from \"html-react-parser\";\r\nimport CheckContext from \"./context\";\r\nimport moment from \"moment\";\r\nimport classNames from \"classnames\";\r\n\r\ninterface Props {\r\n interval: HourInterval;\r\n}\r\n\r\nconst RowHeader: React.FC = ({ interval }) => {\r\n const { props } = React.useContext(CheckContext);\r\n const { start, end } = interval;\r\n const { fromHour, toHour } = getDatesFormats(props);\r\n\r\n if (props.renderRowHeader) {\r\n return props.renderRowHeader(interval);\r\n }\r\n\r\n return (\r\n \r\n
\r\n {start && HTMLParser(`${\r\n getMomentFromNumber(moment(), start).format(fromHour)\r\n .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || ''}`)}\r\n {end && HTMLParser(`${\r\n getMomentFromNumber(moment(), end).format(toHour)\r\n .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || ''\r\n }`)}\r\n
\r\n \r\n )\r\n}\r\n\r\nexport default RowHeader;\r\n","import * as React from 'react';\r\nimport Moment from \"react-moment\";\r\nimport * as moment from \"moment\";\r\nimport CheckContext from \"./context\";\r\n\r\ninterface Props {\r\n date: moment.Moment;\r\n}\r\n\r\nconst ColumnDate: React.FC = ({ date }) => {\r\n const { props } = React.useContext(CheckContext);\r\n\r\n if (props.renderColumnHeader) {\r\n return props.renderColumnHeader(date);\r\n }\r\n\r\n return (\r\n
\r\n
\r\n \r\n {date}\r\n \r\n
\r\n
\r\n \r\n {date}\r\n \r\n
\r\n
\r\n \r\n {date}\r\n \r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default ColumnDate;\r\n","import * as React from 'react';\r\nimport './checkbox.css';\r\nimport classNames from 'classnames';\r\nimport {MomentRange} from \"../types\";\r\nimport {getMomentFromDate} from \"../helpers\";\r\nimport CheckContext from \"../context\";\r\n\r\nexport type CheckBoxChangeHandler = (value: boolean, props: Props) => void;\r\ntype CheckboxProps = {\r\n ref?: any;\r\n onChange: CheckBoxChangeHandler;\r\n interval: MomentRange;\r\n}\r\n\r\ntype InputProps = Omit, 'onChange'>;\r\ntype Props = CheckboxProps & InputProps;\r\n\r\nconst Checkbox: React.FC = ({interval, ...props}) => {\r\n const {props: { disableBefore, disableAfter, disabledDates } } = React.useContext(CheckContext);\r\n\r\n const _handleChange = (e: React.ChangeEvent) => {\r\n const value = e.target.checked;\r\n props.onChange(value, {...props, checked: value, value: value ? 0 : 1, interval })\r\n };\r\n\r\n const isBeforeDisabled = disableBefore ? interval.end.isBefore(getMomentFromDate(disableBefore)) : false;\r\n const isAfterDisabled = disableAfter ? interval.start.isAfter(getMomentFromDate(disableAfter)) : false;\r\n const isDisabledDate = Array.isArray(disabledDates)\r\n ? disabledDates.some(d => getMomentFromDate(d).isBetween(interval.start, interval.end))\r\n : false;\r\n\r\n const disabled = props.disabled || isBeforeDisabled || isAfterDisabled || isDisabledDate;\r\n return (\r\n \r\n );\r\n}\r\n\r\nexport default Checkbox;\r\n","import * as React from 'react';\nimport {CheckCalendarProps, CheckCalendarState, MomentRange} from \"./types\";\nimport LeftIcon from \"./Left\";\nimport RightIcon from \"./Right\";\nimport classNames from \"classnames\";\nimport { defaultProps } from \"./defaults\";\nimport { CheckContextProvider } from \"./context\";\nimport RowHeader from \"./RowHeader\";\nimport moment from \"moment\";\nimport ColumnDate from \"./ColumnDate\";\nimport {getArrayDates, getMomentFromNumber, getMomentsFromRange, isInInterval} from \"./helpers\";\nimport Checkbox, {CheckBoxChangeHandler} from \"./CheckBox\";\n\nimport './styles.css';\n\nclass CheckCalendar extends React.Component {\n static defaultProps = defaultProps;\n\n state = {\n loading: false,\n currentDate: moment(this.props.start).set('day', this.props.startWeekDay || 1),\n checkedRanges: []\n };\n\n render() {\n const {\n hoursIntervals,\n hideDays,\n max,\n min,\n checkedDates,\n leftButton,\n rightButton,\n containerClassName,\n tableClassName,\n headerClassName,\n contentClassName\n } = this.props;\n\n const { loading, currentDate, checkedRanges } = this.state;\n const dates = getArrayDates(currentDate, 7);\n const checked = Array.isArray(checkedDates) ? checkedDates : checkedRanges;\n\n const prevDisabled = loading || (!!min && dates[0].clone().set('hour', 0).isBefore(moment(min)));\n const nextDisabled = loading || (!!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max)));\n\n console.log('max', (!!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max))), 'min', !!min && dates[0].clone().set('hour', 0).isBefore(moment(min)));\n\n return (\n \n
\n \n {leftButton?.content || }\n \n \n {rightButton?.content || }\n \n \n \n \n \n \n \n {dates.map((current) => (\n \n \n \n ))}\n \n {hoursIntervals && hoursIntervals.map((row) => (\n \n \n {dates.map(day => {\n const interval = {\n start: getMomentFromNumber(day, row.start),\n end: getMomentFromNumber(day, row.end)\n };\n\n return (\n \n isInInterval(c, interval))}\n value=\"off\"\n />\n \n )\n })}\n \n ))}\n \n
\n
\n \n
\n );\n }\n\n _handlePrevious = () => {\n this.setState({ loading:true });\n setTimeout(() => {\n this.setState({\n loading:false,\n currentDate: this.state.currentDate.subtract(7, 'days')\n }, this.props.onPreviousClick);\n\n }, 400);\n\n };\n\n _handleNext = () => {\n this.setState({ loading: true });\n\n setTimeout(() => {\n this.setState({\n loading: false,\n currentDate: this.state.currentDate.add(7, 'days')\n }, this.props.onNextClick);\n }, 400);\n };\n\n _handleChange: CheckBoxChangeHandler = ( value, props) => {\n const { checkedRanges } = this.state;\n const { interval } = props;\n const { onChange, checkedDates } = this.props;\n let newChecked = [...(Array.isArray(checkedDates) ? checkedDates : checkedRanges)];\n\n if (value) {\n newChecked.push(interval);\n } else {\n const foundIndex = newChecked.findIndex((c) => isInInterval(c, interval));\n\n if (foundIndex > -1) {\n newChecked.splice(foundIndex, 1);\n }\n }\n\n newChecked = newChecked.map(i => getMomentsFromRange(i));\n\n if (onChange) {\n onChange({\n dates: (newChecked as MomentRange[]).map(i => ({ start: i.start.toDate(), end: i.end.toDate() })) ,\n moments: newChecked as MomentRange[]\n })\n }\n\n if (!Array.isArray(checkedDates)) {\n this.setState({ checkedRanges: newChecked as MomentRange[] });\n }\n };\n\n}\n\nexport {\n CheckCalendar as default,\n CheckCalendar,\n CheckCalendarProps,\n defaultProps,\n LeftIcon,\n RightIcon,\n Checkbox\n}\n"],"names":["Left","React","height","viewBox","d","Right","defaultProps","startWeekDay","locale","hoursIntervals","start","end","hideDays","defaultContext","props","defaultDatesFormats","fromHour","toHour","CheckContext","CheckContextProvider","Provider","getMomentFromNumber","date","value","trunced","Math","trunc","clone","set","getDatesFormats","datesFormats","getArrayDates","count","dates","clonedStart","i","push","add","isInInterval","interval1","interval2","getMomentsFromRange","start2","end2","isSame","isBetween","interval","getMomentFromDate","moment","RowHeader","renderRowHeader","className","classNames","headerRowClassName","HTMLParser","format","replace","charAt","indexOf","ColumnDate","renderColumnHeader","Moment","Checkbox","disableBefore","disableAfter","disabledDates","_handleChange","e","target","checked","onChange","isBeforeDisabled","isBefore","isAfterDisabled","isAfter","isDisabledDate","Array","isArray","some","disabled","type","CheckCalendar","constructor","loading","currentDate","checkedRanges","setState","setTimeout","state","subtract","onPreviousClick","onNextClick","checkedDates","newChecked","foundIndex","findIndex","c","splice","map","toDate","moments","render","max","min","leftButton","rightButton","containerClassName","tableClassName","headerClassName","contentClassName","prevDisabled","nextDisabled","length","console","log","onClick","_handlePrevious","content","LeftIcon","_handleNext","RightIcon","ref","key","current","includes","day","row","find"],"mappings":";;;;;;AAKA,MAAMA,IAAI,GAAoB,MAC5BC,aAAA,MAAA;AACEC,EAAAA,MAAM,EAAE;AACRC,EAAAA,OAAO,EAAC;CAFV,EAIEF,aAAA,OAAA;AACEG,EAAAA,CAAC,EAAC;CADJ,CAJF,CADF;;ACAA,MAAMC,KAAK,GAAoB,MAC7BJ,aAAA,MAAA;AACEC,EAAAA,MAAM,EAAE;AACRC,EAAAA,OAAO,EAAC;CAFV,EAIEF,aAAA,OAAA;AACEG,EAAAA,CAAC,EAAC;CAD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AA1B,aAA0BA,QAA1B,uBAA0BA,QAAQ,CAAEgH,QAAV,CAAmBC,GAAG,CAACA,GAAJ,EAAnB;AAA5B,WAAnB;SAFvB,EAIE5H,aAAA,CAAC6D,QAAD;AACEhB,UAAAA,QAAQ,EAAEA;AACVwB,UAAAA,QAAQ,EAAE,KAAKJ;AACfG,UAAAA,OAAO,EAAE,CAAC,CAAEA,OAAD,CAAU0D,IAAV,CAAe/B,CAAC,IAAI1D,YAAY,CAAC0D,CAAD,EAAIlD,QAAJ,CAAhC;AACXvB,UAAAA,KAAK,EAAC;SAJR,CAJF,CADF;AAaD,OAnBA,CAFH,CADiB,CAfnB,CAFF,CANF,CArBF,CADF,CADF;AA6ED;;;;AA7GM0D,EAAAA,0BAAA,GAAe3E,YAAf;AAoKT,sBAAA;IArKA;;;;;"} -------------------------------------------------------------------------------- /dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sources":["../src/Left.tsx","../src/Right.tsx","../src/defaults.ts","../src/context.tsx","../src/helpers.ts","../src/RowHeader.tsx","../src/ColumnDate.tsx","../src/CheckBox/index.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\ninterface Props {\r\n}\r\n\r\nconst Left: React.FC = () => (\r\n \r\n \r\n \r\n);\r\n\r\nexport default Left;\r\n","import * as React from 'react';\r\n\r\ninterface Props {\r\n}\r\n\r\nconst Right: React.FC = () => (\r\n \r\n \r\n \r\n);\r\n\r\nexport default Right;\r\n","import {CheckCalendarContext, CheckCalendarProps, DatesFormats} from \"./types\";\r\n\r\nexport const defaultProps: CheckCalendarProps = {\r\n startWeekDay: 1,\r\n locale: 'en',\r\n hoursIntervals: [\r\n { start: 8, end: 10 },\r\n { start: 10, end: 12 },\r\n { start: 13, end: 15 },\r\n { start: 15, end: 17 }\r\n ],\r\n hideDays: [0, 6]\r\n};\r\n\r\nexport const defaultContext: CheckCalendarContext = {\r\n props: defaultProps\r\n};\r\n\r\nexport const defaultDatesFormats: DatesFormats = {\r\n fromHour: '[from] []h:mm[][]a[]',\r\n toHour: ' [to] []h:mm[][]a[]'\r\n};\r\n","import * as React from 'react';\r\nimport { CheckCalendarContext } from \"./types\";\r\nimport {defaultContext} from \"./defaults\";\r\n\r\nconst CheckContext = React.createContext(defaultContext);\r\nexport const CheckContextProvider = CheckContext.Provider;\r\nexport default CheckContext;\r\n","import moment from 'moment';\nimport {CheckCalendarProps, MomentOrDateRange, MomentRange} from \"./types\";\nimport { defaultDatesFormats } from \"./defaults\";\n\nexport const getMomentFromNumber = (date: moment.Moment, value: number) => {\n const trunced = Math.trunc(value);\n return date.clone()\n .set('hour', trunced)\n .set('minutes', (value - trunced) * 60)\n .set('second', 0)\n .set('millisecond', 0);\n};\n\nexport const getDatesFormats = (props: CheckCalendarProps) =>\n ({ ...defaultDatesFormats, ...props.datesFormats });\n\nexport const getArrayDates = (start: moment.Moment, count: number) => {\n const dates = []\n\n const clonedStart = start.clone().set('hour', 0).set('minute', 0).set('second', 1).set('millisecond', 0);\n\n for (let i = 0; i < count; i++) {\n dates.push(clonedStart.clone().add(i, 'day'));\n }\n\n return dates;\n};\n\nexport const isInInterval = (interval1: MomentOrDateRange, interval2: MomentOrDateRange) => {\n const { start, end } = getMomentsFromRange(interval1);\n const { start: start2, end: end2 } = getMomentsFromRange(interval2);\n\n return start.isSame(start2, \"minute\") ||\n end.isSame(end2, \"minute\") ||\n start.isBetween(start2, end2, 'minutes', '()') ||\n end.isBetween(start2, end2, 'minutes', '()');\n}\n\nexport const getMomentsFromRange = (interval: MomentOrDateRange): MomentRange => ({\n start: getMomentFromDate(interval.start),\n end: getMomentFromDate(interval.end)\n})\n\nexport const getMomentFromDate = (date: Date | moment.Moment | string) =>\n date instanceof moment ? date as moment.Moment : moment(date);\n","import * as React from 'react';\r\nimport {HourInterval} from \"./types\";\r\nimport {getDatesFormats, getMomentFromNumber} from \"./helpers\";\r\nimport HTMLParser from \"html-react-parser\";\r\nimport CheckContext from \"./context\";\r\nimport moment from \"moment\";\r\nimport classNames from \"classnames\";\r\n\r\ninterface Props {\r\n interval: HourInterval;\r\n}\r\n\r\nconst RowHeader: React.FC = ({ interval }) => {\r\n const { props } = React.useContext(CheckContext);\r\n const { start, end } = interval;\r\n const { fromHour, toHour } = getDatesFormats(props);\r\n\r\n if (props.renderRowHeader) {\r\n return props.renderRowHeader(interval);\r\n }\r\n\r\n return (\r\n \r\n
\r\n {start && HTMLParser(`${\r\n getMomentFromNumber(moment(), start).format(fromHour)\r\n .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || ''}`)}\r\n {end && HTMLParser(`${\r\n getMomentFromNumber(moment(), end).format(toHour)\r\n .replace(fromHour.charAt(fromHour.indexOf('mm') - 1) + '00', '') || ''\r\n }`)}\r\n
\r\n \r\n )\r\n}\r\n\r\nexport default RowHeader;\r\n","import * as React from 'react';\r\nimport Moment from \"react-moment\";\r\nimport * as moment from \"moment\";\r\nimport CheckContext from \"./context\";\r\n\r\ninterface Props {\r\n date: moment.Moment;\r\n}\r\n\r\nconst ColumnDate: React.FC = ({ date }) => {\r\n const { props } = React.useContext(CheckContext);\r\n\r\n if (props.renderColumnHeader) {\r\n return props.renderColumnHeader(date);\r\n }\r\n\r\n return (\r\n
\r\n
\r\n \r\n {date}\r\n \r\n
\r\n
\r\n \r\n {date}\r\n \r\n
\r\n
\r\n \r\n {date}\r\n \r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default ColumnDate;\r\n","import * as React from 'react';\r\nimport './checkbox.css';\r\nimport classNames from 'classnames';\r\nimport {MomentRange} from \"../types\";\r\nimport {getMomentFromDate} from \"../helpers\";\r\nimport CheckContext from \"../context\";\r\n\r\nexport type CheckBoxChangeHandler = (value: boolean, props: Props) => void;\r\ntype CheckboxProps = {\r\n ref?: any;\r\n onChange: CheckBoxChangeHandler;\r\n interval: MomentRange;\r\n}\r\n\r\ntype InputProps = Omit, 'onChange'>;\r\ntype Props = CheckboxProps & InputProps;\r\n\r\nconst Checkbox: React.FC = ({interval, ...props}) => {\r\n const {props: { disableBefore, disableAfter, disabledDates } } = React.useContext(CheckContext);\r\n\r\n const _handleChange = (e: React.ChangeEvent) => {\r\n const value = e.target.checked;\r\n props.onChange(value, {...props, checked: value, value: value ? 0 : 1, interval })\r\n };\r\n\r\n const isBeforeDisabled = disableBefore ? interval.end.isBefore(getMomentFromDate(disableBefore)) : false;\r\n const isAfterDisabled = disableAfter ? interval.start.isAfter(getMomentFromDate(disableAfter)) : false;\r\n const isDisabledDate = Array.isArray(disabledDates)\r\n ? disabledDates.some(d => getMomentFromDate(d).isBetween(interval.start, interval.end))\r\n : false;\r\n\r\n const disabled = props.disabled || isBeforeDisabled || isAfterDisabled || isDisabledDate;\r\n return (\r\n \r\n );\r\n}\r\n\r\nexport default Checkbox;\r\n","import * as React from 'react';\nimport {CheckCalendarProps, CheckCalendarState, MomentRange} from \"./types\";\nimport LeftIcon from \"./Left\";\nimport RightIcon from \"./Right\";\nimport classNames from \"classnames\";\nimport { defaultProps } from \"./defaults\";\nimport { CheckContextProvider } from \"./context\";\nimport RowHeader from \"./RowHeader\";\nimport moment from \"moment\";\nimport ColumnDate from \"./ColumnDate\";\nimport {getArrayDates, getMomentFromNumber, getMomentsFromRange, isInInterval} from \"./helpers\";\nimport Checkbox, {CheckBoxChangeHandler} from \"./CheckBox\";\n\nimport './styles.css';\n\nclass CheckCalendar extends React.Component {\n static defaultProps = defaultProps;\n\n state = {\n loading: false,\n currentDate: moment(this.props.start).set('day', this.props.startWeekDay || 1),\n checkedRanges: []\n };\n\n render() {\n const {\n hoursIntervals,\n hideDays,\n max,\n min,\n checkedDates,\n leftButton,\n rightButton,\n containerClassName,\n tableClassName,\n headerClassName,\n contentClassName\n } = this.props;\n\n const { loading, currentDate, checkedRanges } = this.state;\n const dates = getArrayDates(currentDate, 7);\n const checked = Array.isArray(checkedDates) ? checkedDates : checkedRanges;\n\n const prevDisabled = loading || (!!min && dates[0].clone().set('hour', 0).isBefore(moment(min)));\n const nextDisabled = loading || (!!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max)));\n\n console.log('max', (!!max && dates[dates.length - 1].clone().set('hour', 23).isAfter(moment(max))), 'min', !!min && dates[0].clone().set('hour', 0).isBefore(moment(min)));\n\n return (\n \n
\n \n {leftButton?.content || }\n \n \n {rightButton?.content || }\n \n \n \n \n \n \n \n {dates.map((current) => (\n \n \n \n ))}\n \n {hoursIntervals && hoursIntervals.map((row) => (\n \n \n {dates.map(day => {\n const interval = {\n start: getMomentFromNumber(day, row.start),\n end: getMomentFromNumber(day, row.end)\n };\n\n return (\n \n isInInterval(c, interval))}\n value=\"off\"\n />\n \n )\n })}\n \n ))}\n \n
\n
\n \n
\n );\n }\n\n _handlePrevious = () => {\n this.setState({ loading:true });\n setTimeout(() => {\n this.setState({\n loading:false,\n currentDate: this.state.currentDate.subtract(7, 'days')\n }, this.props.onPreviousClick);\n\n }, 400);\n\n };\n\n _handleNext = () => {\n this.setState({ loading: true });\n\n setTimeout(() => {\n this.setState({\n loading: false,\n currentDate: this.state.currentDate.add(7, 'days')\n }, this.props.onNextClick);\n }, 400);\n };\n\n _handleChange: CheckBoxChangeHandler = ( value, props) => {\n const { checkedRanges } = this.state;\n const { interval } = props;\n const { onChange, checkedDates } = this.props;\n let newChecked = [...(Array.isArray(checkedDates) ? checkedDates : checkedRanges)];\n\n if (value) {\n newChecked.push(interval);\n } else {\n const foundIndex = newChecked.findIndex((c) => isInInterval(c, interval));\n\n if (foundIndex > -1) {\n newChecked.splice(foundIndex, 1);\n }\n }\n\n newChecked = newChecked.map(i => getMomentsFromRange(i));\n\n if (onChange) {\n onChange({\n dates: (newChecked as MomentRange[]).map(i => ({ start: i.start.toDate(), end: i.end.toDate() })) ,\n moments: newChecked as MomentRange[]\n })\n }\n\n if (!Array.isArray(checkedDates)) {\n this.setState({ checkedRanges: newChecked as MomentRange[] });\n }\n };\n\n}\n\nexport {\n CheckCalendar as default,\n CheckCalendar,\n CheckCalendarProps,\n defaultProps,\n LeftIcon,\n RightIcon,\n Checkbox\n}\n"],"names":["Left","React","height","viewBox","d","Right","defaultProps","startWeekDay","locale","hoursIntervals","start","end","hideDays","defaultContext","props","defaultDatesFormats","fromHour","toHour","CheckContext","CheckContextProvider","Provider","getMomentFromNumber","date","value","trunced","Math","trunc","clone","set","getDatesFormats","datesFormats","getArrayDates","count","dates","clonedStart","i","push","add","isInInterval","interval1","interval2","getMomentsFromRange","start2","end2","isSame","isBetween","interval","getMomentFromDate","moment","RowHeader","renderRowHeader","className","classNames","headerRowClassName","HTMLParser","format","replace","charAt","indexOf","ColumnDate","renderColumnHeader","Moment","Checkbox","disableBefore","disableAfter","disabledDates","_handleChange","e","target","checked","onChange","isBeforeDisabled","isBefore","isAfterDisabled","isAfter","isDisabledDate","Array","isArray","some","disabled","type","CheckCalendar","loading","currentDate","checkedRanges","setState","setTimeout","state","subtract","onPreviousClick","onNextClick","checkedDates","newChecked","foundIndex","findIndex","c","splice","map","toDate","moments","render","max","min","leftButton","rightButton","containerClassName","tableClassName","headerClassName","contentClassName","prevDisabled","nextDisabled","length","console","log","onClick","_handlePrevious","content","LeftIcon","_handleNext","RightIcon","ref","key","current","includes","day","row","find"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,IAAI,GAAoB,SAAxBA,IAAwB;AAAA,SAC5BC,mBAAA,MAAA;AACEC,IAAAA,MAAM,EAAE;AACRC,IAAAA,OAAO,EAAC;GAFV,EAIEF,mBAAA,OAAA;AACEG,IAAAA,CAAC,EAAC;GADJ,CAJF,CAD4B;AAAA,CAA9B;;ACAA,IAAMC,KAAK,GAAoB,SAAzBA,KAAyB;AAAA,SAC7BJ,mBAAA,MAAA;AACEC,IAAAA,MAAM,EAAE;AACRC,IAAAA,OAAO,EAAC;GAFV,EAIEF,mBAAA,OAAA;AACEG,IAAAA,CAAC,EAAC;GADJ,CAJF,CAD6B;AAAA,CAA/B;;ICHaE,YAAY,GAAuB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