zaman-backoffice 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +26 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/git_toolbox_prj.xml +15 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/material_theme_project_new.xml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/zaman-backoffice2.iml +12 -0
- package/.prettierrc +9 -0
- package/.travis.yml +10 -0
- package/client/index.html +12 -0
- package/client/main.tsx +84 -0
- package/client/style.css +62 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/support/commands.ts +38 -0
- package/cypress/support/component-index.html +12 -0
- package/cypress/support/component.ts +39 -0
- package/cypress/videos/Calendar/CalendarComponent.cy.tsx.mp4 +0 -0
- package/cypress/videos/DatePicker/DatePicker.cy.tsx.mp4 +0 -0
- package/cypress.config.ts +10 -0
- package/help/banner.png +0 -0
- package/jest.config.ts +47 -0
- package/package.json +1 -1
- package/src/components/CalendarItem/CalendarItem.styled.tsx +96 -0
- package/src/components/CalendarItem/CalendarItem.types.ts +7 -0
- package/src/components/CalendarItem/index.ts +1 -0
- package/src/components/CalendarWrapper/CalendarWrapper.styled.tsx +19 -0
- package/src/components/CalendarWrapper/index.ts +1 -0
- package/src/components/FloatingElement/FloatingElement.styled.tsx +8 -0
- package/src/components/FloatingElement/FloatingElement.tsx +83 -0
- package/src/components/FloatingElement/FloatingElement.types.ts +8 -0
- package/src/components/FloatingElement/index.tsx +1 -0
- package/src/components/Header/Header.styled.tsx +40 -0
- package/src/components/Header/Header.tsx +46 -0
- package/src/components/Header/Header.types.ts +6 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/IconButton/IconButton.styled.tsx +22 -0
- package/src/components/IconButton/IconButton.tsx +3 -0
- package/src/components/IconButton/index.tsx +1 -0
- package/src/components/Icons/ChevronLeft/index.tsx +22 -0
- package/src/components/Icons/ChevronRight/index.tsx +22 -0
- package/src/components/Modal/Modal.styled.tsx +23 -0
- package/src/components/Modal/Modal.tsx +29 -0
- package/src/components/Modal/index.tsx +1 -0
- package/src/components/Modal/types.ts +7 -0
- package/src/components/MonthPicker/Month.styled.tsx +11 -0
- package/src/components/MonthPicker/MonthPicker.tsx +35 -0
- package/src/components/MonthPicker/MonthPicker.types.ts +4 -0
- package/src/components/MonthPicker/index.ts +1 -0
- package/src/components/RenderCalendar/RenderCalendar.tsx +31 -0
- package/src/components/RenderCalendar/RenderCalendar.types.ts +10 -0
- package/src/components/RenderCalendar/index.ts +1 -0
- package/src/components/YearPicker/YearPicker.styled.tsx +14 -0
- package/src/components/YearPicker/YearPicker.tsx +49 -0
- package/src/components/YearPicker/YearPicker.types.ts +4 -0
- package/src/components/YearPicker/index.ts +1 -0
- package/src/constants.ts +6 -0
- package/src/hooks/__tests__/useClickOutside.test.tsx +32 -0
- package/src/hooks/useCalendarHandlers.tsx +113 -0
- package/src/hooks/useClickOutside.tsx +23 -0
- package/src/hooks/useSlideCalendar.tsx +95 -0
- package/src/hooks/useTimePicker.tsx +95 -0
- package/src/index.tsx +4 -0
- package/src/packages/Calendar/Calendar.styled.tsx +42 -0
- package/src/packages/Calendar/Calendar.tsx +159 -0
- package/src/packages/Calendar/Calendar.types.ts +31 -0
- package/src/packages/Calendar/CalendarComponent.cy.tsx +69 -0
- package/src/packages/Calendar/index.ts +2 -0
- package/src/packages/CalendarProvider/CalendarProvider.tsx +30 -0
- package/src/packages/CalendarProvider/CalendarProvider.types.ts +6 -0
- package/src/packages/CalendarProvider/index.ts +2 -0
- package/src/packages/DatePicker/DatePicker.cy.tsx +54 -0
- package/src/packages/DatePicker/DatePicker.tsx +127 -0
- package/src/packages/DatePicker/DatePicker.types.ts +26 -0
- package/src/packages/DatePicker/index.ts +2 -0
- package/src/packages/TimePicker/TimePicker.styled.tsx +77 -0
- package/src/packages/TimePicker/TimePicker.tsx +121 -0
- package/src/packages/TimePicker/TimePicker.types.ts +16 -0
- package/src/packages/TimePicker/components/Numbers/Numbers.styled.tsx +36 -0
- package/src/packages/TimePicker/components/Numbers/Numbers.tsx +58 -0
- package/src/packages/TimePicker/components/Numbers/Numbers.types.ts +14 -0
- package/src/packages/TimePicker/components/Numbers/index.ts +1 -0
- package/src/packages/TimePicker/index.ts +2 -0
- package/src/style/animation.ts +23 -0
- package/src/style/classNames.ts +8 -0
- package/src/style/colorPallete.ts +16 -0
- package/src/style/colors.ts +15 -0
- package/src/style/hexToHSL.ts +52 -0
- package/src/style/radius.ts +28 -0
- package/src/types.ts +75 -0
- package/src/utils/dateHelper/dateHelper.ts +67 -0
- package/src/utils/dateHelper/index.ts +1 -0
- package/src/utils/dateTimeFormat/dateTimeFormat.ts +43 -0
- package/src/utils/dateTimeFormat/index.ts +1 -0
- package/src/utils/format/format.test.ts +37 -0
- package/src/utils/format/format.ts +56 -0
- package/src/utils/format/format.types.ts +11 -0
- package/src/utils/format/index.ts +1 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/locale.ts +13 -0
- package/src/utils/locales/en.ts +89 -0
- package/src/utils/locales/fa.ts +89 -0
- package/src/utils/locales/index.ts +10 -0
- package/src/utils/locales/locales.types.ts +11 -0
- package/src/utils/month/index.ts +1 -0
- package/src/utils/month/month.ts +54 -0
- package/src/utils/month/month.types.ts +11 -0
- package/src/utils/timePicker.ts +107 -0
- package/src/utils/type.ts +0 -0
- package/tsconfig.json +22 -0
- package/tsconfig.test.json +7 -0
- package/vite.config.ts +7 -0
package/.eslintrc.cjs
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module.exports = {
|
2
|
+
env: {
|
3
|
+
browser: true,
|
4
|
+
es2021: true
|
5
|
+
},
|
6
|
+
extends: [
|
7
|
+
'plugin:react/recommended',
|
8
|
+
'standard-with-typescript',
|
9
|
+
'plugin:prettier/recommended'
|
10
|
+
],
|
11
|
+
overrides: [],
|
12
|
+
parserOptions: {
|
13
|
+
ecmaVersion: 'latest',
|
14
|
+
sourceType: 'module',
|
15
|
+
project: './tsconfig.json'
|
16
|
+
},
|
17
|
+
plugins: ['react', 'prettier'],
|
18
|
+
rules: {
|
19
|
+
'@typescript-eslint/ban-ts-comment': [
|
20
|
+
'error',
|
21
|
+
{ 'ts-ignore': 'allow-with-description' }
|
22
|
+
],
|
23
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
24
|
+
'@typescript-eslint/no-confusing-void-expression': 'off'
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="GitToolBoxProjectSettings">
|
4
|
+
<option name="commitMessageIssueKeyValidationOverride">
|
5
|
+
<BoolValueOverride>
|
6
|
+
<option name="enabled" value="true" />
|
7
|
+
</BoolValueOverride>
|
8
|
+
</option>
|
9
|
+
<option name="commitMessageValidationEnabledOverride">
|
10
|
+
<BoolValueOverride>
|
11
|
+
<option name="enabled" value="true" />
|
12
|
+
</BoolValueOverride>
|
13
|
+
</option>
|
14
|
+
</component>
|
15
|
+
</project>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="MaterialThemeProjectNewConfig">
|
4
|
+
<option name="metadata">
|
5
|
+
<MTProjectMetadataState>
|
6
|
+
<option name="migrated" value="true" />
|
7
|
+
<option name="pristineConfig" value="false" />
|
8
|
+
<option name="userId" value="21014733:192000173b2:-7ffe" />
|
9
|
+
</MTProjectMetadataState>
|
10
|
+
</option>
|
11
|
+
</component>
|
12
|
+
</project>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/zaman-backoffice2.iml" filepath="$PROJECT_DIR$/.idea/zaman-backoffice2.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="WEB_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager">
|
4
|
+
<content url="file://$MODULE_DIR$">
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
8
|
+
</content>
|
9
|
+
<orderEntry type="inheritedJdk" />
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
+
</component>
|
12
|
+
</module>
|
package/.prettierrc
ADDED
package/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en" dir="rtl">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<title>Vite + React + TS | React Jalali DatePicker</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id="root"></div>
|
10
|
+
<script type="module" src="./main.tsx"></script>
|
11
|
+
</body>
|
12
|
+
</html>
|
package/client/main.tsx
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Calendar, CalendarProvider, DatePicker } from '../src'
|
3
|
+
import { createRoot } from 'react-dom/client'
|
4
|
+
import './style.css'
|
5
|
+
import TimePicker from '../src/packages/TimePicker'
|
6
|
+
const container = document.getElementById('root')
|
7
|
+
const root = createRoot(container as HTMLElement)
|
8
|
+
|
9
|
+
const App = () => {
|
10
|
+
const [view, setView] = useState<string>('cal')
|
11
|
+
const [calendarValue, setCalendarValue] = useState(new Date())
|
12
|
+
|
13
|
+
return (
|
14
|
+
<section className="wrapper">
|
15
|
+
<div className="tab">
|
16
|
+
<div
|
17
|
+
className={`tabItem tabItem${view === 'cal' ? '--selected' : ''}`}
|
18
|
+
onClick={() => setView('cal')}
|
19
|
+
>
|
20
|
+
Calendar
|
21
|
+
</div>
|
22
|
+
<div
|
23
|
+
className={`tabItem tabItem${view === 'day' ? '--selected' : ''}`}
|
24
|
+
onClick={() => setView('day')}
|
25
|
+
>
|
26
|
+
Date picker
|
27
|
+
</div>
|
28
|
+
<div
|
29
|
+
className={`tabItem tabItem${view === 'time' ? '--selected' : ''}`}
|
30
|
+
onClick={() => setView('time')}
|
31
|
+
>
|
32
|
+
Time picker
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
{view === 'cal' ? (
|
36
|
+
<div className="libWrapper">
|
37
|
+
<CalendarProvider locale="fa" round="x2">
|
38
|
+
<Calendar
|
39
|
+
defaultValue={calendarValue}
|
40
|
+
onChange={({ value }) => setCalendarValue(value)}
|
41
|
+
weekends={[6]}
|
42
|
+
/>
|
43
|
+
</CalendarProvider>
|
44
|
+
<CalendarProvider locale="fa" round="x4" accentColor="#6374ae">
|
45
|
+
<Calendar
|
46
|
+
defaultValue={new Date()}
|
47
|
+
onChange={({ from, to }) => console.log(from, '---', to)}
|
48
|
+
weekends={[6]}
|
49
|
+
from={new Date()}
|
50
|
+
to={new Date().setDate(new Date().getDate() + 3)}
|
51
|
+
range
|
52
|
+
/>
|
53
|
+
</CalendarProvider>
|
54
|
+
</div>
|
55
|
+
) : null}
|
56
|
+
{view === 'day' ? (
|
57
|
+
<div className="libWrapper">
|
58
|
+
<DatePicker
|
59
|
+
round="x4"
|
60
|
+
position="center"
|
61
|
+
onChange={(e) => console.log(e)}
|
62
|
+
/>
|
63
|
+
<DatePicker
|
64
|
+
round="x2"
|
65
|
+
accentColor="#6374ae"
|
66
|
+
range
|
67
|
+
from={new Date()}
|
68
|
+
to={new Date().setDate(new Date().getDate() + 3)}
|
69
|
+
onChange={(e) => console.log(e)}
|
70
|
+
/>
|
71
|
+
</div>
|
72
|
+
) : null}
|
73
|
+
{view === 'time' ? (
|
74
|
+
<div className="libWrapper">
|
75
|
+
<TimePicker
|
76
|
+
accentColor="#6374ae"
|
77
|
+
onChange={(py) => console.log(py)}
|
78
|
+
/>
|
79
|
+
</div>
|
80
|
+
) : null}
|
81
|
+
</section>
|
82
|
+
)
|
83
|
+
}
|
84
|
+
root.render(<App />)
|
package/client/style.css
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
@import url("https://fonts.googleapis.com/css?family=Vazirmatn");
|
2
|
+
|
3
|
+
* {
|
4
|
+
box-sizing: border-box;
|
5
|
+
}
|
6
|
+
body {
|
7
|
+
font-family: Vazirmatn, sans-serif;
|
8
|
+
text-align: center;
|
9
|
+
margin-top: 4rem;
|
10
|
+
}
|
11
|
+
input {
|
12
|
+
font-family: Vazirmatn, sans-serif;
|
13
|
+
text-align: center;
|
14
|
+
width: 280px;
|
15
|
+
outline: 0;
|
16
|
+
border-radius: 8px;
|
17
|
+
height: 45px;
|
18
|
+
border: 1px solid #dedede;
|
19
|
+
}
|
20
|
+
.wrapper {
|
21
|
+
display: flex;
|
22
|
+
flex-direction: column;
|
23
|
+
align-items: center;
|
24
|
+
justify-content: center;
|
25
|
+
gap: 12px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.tab {
|
29
|
+
flex-direction: column;
|
30
|
+
display: flex;
|
31
|
+
justify-content: center;
|
32
|
+
border-radius: 8px;
|
33
|
+
background-color: #f5f5f5;
|
34
|
+
gap: 16px;
|
35
|
+
padding: 8px;
|
36
|
+
}
|
37
|
+
.tabItem {
|
38
|
+
cursor: pointer;
|
39
|
+
padding: 4px 8px;
|
40
|
+
border-radius: 8px;
|
41
|
+
transition: all 0.2s ease;
|
42
|
+
}
|
43
|
+
.tabItem:hover {
|
44
|
+
color: #3f5152;
|
45
|
+
}
|
46
|
+
.tabItem--selected {
|
47
|
+
background-color: #ffffff;
|
48
|
+
}
|
49
|
+
|
50
|
+
.libWrapper {
|
51
|
+
display: flex;
|
52
|
+
justify-content: center;
|
53
|
+
flex-direction: column;
|
54
|
+
gap: 14px;
|
55
|
+
}
|
56
|
+
|
57
|
+
@media only screen and (min-width: 600px) {
|
58
|
+
.tab,
|
59
|
+
.libWrapper {
|
60
|
+
flex-direction: row;
|
61
|
+
}
|
62
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import '@testing-library/cypress/add-commands'
|
2
|
+
/// <reference types="cypress" />
|
3
|
+
// ***********************************************
|
4
|
+
// This example commands.ts shows you how to
|
5
|
+
// create various custom commands and overwrite
|
6
|
+
// existing commands.
|
7
|
+
//
|
8
|
+
// For more comprehensive examples of custom
|
9
|
+
// commands please read more here:
|
10
|
+
// https://on.cypress.io/custom-commands
|
11
|
+
// ***********************************************
|
12
|
+
//
|
13
|
+
//
|
14
|
+
// -- This is a parent command --
|
15
|
+
// Cypress.Commands.add('login', (email, password) => { ... })
|
16
|
+
//
|
17
|
+
//
|
18
|
+
// -- This is a child command --
|
19
|
+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
20
|
+
//
|
21
|
+
//
|
22
|
+
// -- This is a dual command --
|
23
|
+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
24
|
+
//
|
25
|
+
//
|
26
|
+
// -- This will overwrite an existing command --
|
27
|
+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
28
|
+
//
|
29
|
+
// declare global {
|
30
|
+
// namespace Cypress {
|
31
|
+
// interface Chainable {
|
32
|
+
// login(email: string, password: string): Chainable<void>
|
33
|
+
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
34
|
+
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
35
|
+
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
36
|
+
// }
|
37
|
+
// }
|
38
|
+
// }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
7
|
+
<title>Components App</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div data-cy-root></div>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// ***********************************************************
|
2
|
+
// This example support/component.ts is processed and
|
3
|
+
// loaded automatically before your test files.
|
4
|
+
//
|
5
|
+
// This is a great place to put global configuration and
|
6
|
+
// behavior that modifies Cypress.
|
7
|
+
//
|
8
|
+
// You can change the location of this file or turn off
|
9
|
+
// automatically serving support files with the
|
10
|
+
// 'supportFile' configuration option.
|
11
|
+
//
|
12
|
+
// You can read more here:
|
13
|
+
// https://on.cypress.io/configuration
|
14
|
+
// ***********************************************************
|
15
|
+
|
16
|
+
// Import commands.js using ES2015 syntax:
|
17
|
+
import './commands'
|
18
|
+
|
19
|
+
// Alternatively you can use CommonJS syntax:
|
20
|
+
// require('./commands')
|
21
|
+
|
22
|
+
import { mount } from 'cypress/react18'
|
23
|
+
|
24
|
+
// Augment the Cypress namespace to include type definitions for
|
25
|
+
// your custom command.
|
26
|
+
// Alternatively, can be defined in cypress/support/component.d.ts
|
27
|
+
// with a <reference path="./component" /> at the top of your spec.
|
28
|
+
declare global {
|
29
|
+
namespace Cypress {
|
30
|
+
interface Chainable {
|
31
|
+
mount: typeof mount
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
Cypress.Commands.add('mount', mount)
|
37
|
+
|
38
|
+
// Example use:
|
39
|
+
// cy.mount(<MyComponent />)
|
Binary file
|
Binary file
|
package/help/banner.png
ADDED
Binary file
|
package/jest.config.ts
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
export default {
|
2
|
+
// Stop running tests after `n` failures
|
3
|
+
// bail: 4,
|
4
|
+
|
5
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
6
|
+
clearMocks: true,
|
7
|
+
|
8
|
+
// An array of file extensions your modules use
|
9
|
+
moduleFileExtensions: [
|
10
|
+
'ts',
|
11
|
+
'tsx',
|
12
|
+
'js',
|
13
|
+
'mjs',
|
14
|
+
'cjs',
|
15
|
+
'jsx',
|
16
|
+
'ts',
|
17
|
+
'tsx',
|
18
|
+
'json',
|
19
|
+
'node'
|
20
|
+
],
|
21
|
+
|
22
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
23
|
+
// moduleNameMapper: {},
|
24
|
+
|
25
|
+
// A list of paths to directories that Jest should use to search for files in
|
26
|
+
roots: ['<rootDir>/src'],
|
27
|
+
|
28
|
+
// The test environment that will be used for testing
|
29
|
+
testEnvironment: 'jsdom',
|
30
|
+
|
31
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
32
|
+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
|
33
|
+
|
34
|
+
// A map from regular expressions to paths to transformers
|
35
|
+
transform: {
|
36
|
+
'^.+\\.(tsx|ts)?$': 'ts-jest'
|
37
|
+
},
|
38
|
+
|
39
|
+
// Whether to use watchman for file crawling
|
40
|
+
watchman: true,
|
41
|
+
|
42
|
+
globals: {
|
43
|
+
'ts-jest': {
|
44
|
+
tsConfig: 'tsconfig.test.json'
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
package/package.json
CHANGED
@@ -0,0 +1,96 @@
|
|
1
|
+
import styled from '@emotion/styled'
|
2
|
+
import type { CalendarItemProps } from './CalendarItem.types'
|
3
|
+
import { radius } from '../../style/radius'
|
4
|
+
|
5
|
+
export const CalendarText = styled.div`
|
6
|
+
color: inherit;
|
7
|
+
`
|
8
|
+
|
9
|
+
export const CalendarItem = styled.button<CalendarItemProps>`
|
10
|
+
position: relative;
|
11
|
+
outline: none;
|
12
|
+
background-color: transparent;
|
13
|
+
display: flex;
|
14
|
+
font-family: inherit;
|
15
|
+
align-items: center;
|
16
|
+
justify-content: center;
|
17
|
+
width: ${(props) => props.width}px;
|
18
|
+
height: ${(props) => props.height}px;
|
19
|
+
border: 1px solid transparent;
|
20
|
+
user-select: none;
|
21
|
+
color: ${(props) => props.theme.colors.gray[600]};
|
22
|
+
border-radius: ${(props) => radius[props.theme.round].calendarItem}px;
|
23
|
+
|
24
|
+
// pseudos
|
25
|
+
&:hover,
|
26
|
+
&:focus {
|
27
|
+
border-color: ${(props) => props.theme.colors.gray[50]};
|
28
|
+
}
|
29
|
+
&:active {
|
30
|
+
background-color: ${(props) => props.theme.colors.primary[40]};
|
31
|
+
border-color: transparent;
|
32
|
+
color: ${(props) => props.theme.colors.gray[0]};
|
33
|
+
}
|
34
|
+
// days picker
|
35
|
+
&[data-selected='true'] {
|
36
|
+
background-color: ${(props) => props.theme.colors.primary[50]};
|
37
|
+
border-color: transparent;
|
38
|
+
color: ${(props) => props.theme.colors.gray[0]};
|
39
|
+
}
|
40
|
+
&[data-disabled='true'] {
|
41
|
+
border-color: transparent;
|
42
|
+
}
|
43
|
+
&[data-disabled='true'] .cl-text {
|
44
|
+
opacity: 0.5;
|
45
|
+
}
|
46
|
+
&:not([data-range='true']) {
|
47
|
+
transition: all 0.1s linear;
|
48
|
+
border-radius: ${(props) => radius[props.theme.round].calendarItem}px;
|
49
|
+
}
|
50
|
+
&:not([data-selected='true'])&[data-weekend='true'] {
|
51
|
+
color: #ff4d4d;
|
52
|
+
}
|
53
|
+
&:not([data-disabled='true']) {
|
54
|
+
cursor: pointer;
|
55
|
+
}
|
56
|
+
// range picker
|
57
|
+
&[data-in-range='true'] {
|
58
|
+
background-color: ${(props) => props.theme.colors.primary[90]};
|
59
|
+
border-color: transparent;
|
60
|
+
}
|
61
|
+
&[data-start-range='true'] {
|
62
|
+
background-color: ${(props) => props.theme.colors.primary[40]};
|
63
|
+
color: ${(props) => props.theme.colors.gray[0]};
|
64
|
+
border-radius: ${(props) => radius[props.theme.round].calendarItem}px;
|
65
|
+
border-color: transparent;
|
66
|
+
}
|
67
|
+
&[data-end-range='true'] {
|
68
|
+
background-color: ${(props) => props.theme.colors.primary[40]};
|
69
|
+
color: ${(props) => props.theme.colors.gray[0]};
|
70
|
+
border-radius: ${(props) => radius[props.theme.round].calendarItem}px;
|
71
|
+
border-color: transparent;
|
72
|
+
}
|
73
|
+
&[data-in-range='true']:before,
|
74
|
+
&[data-end-range='true']:before {
|
75
|
+
content: ' ';
|
76
|
+
display: block;
|
77
|
+
position: absolute;
|
78
|
+
width: 40px;
|
79
|
+
height: 40px;
|
80
|
+
top: -1px;
|
81
|
+
left: ${(props) => (props.theme.direction === 'rtl' ? '20px' : 'unset')};
|
82
|
+
right: ${(props) => (props.theme.direction === 'rtl' ? 'unset' : '20px')};
|
83
|
+
background-color: ${(props) => props.theme.colors.primary[90]};
|
84
|
+
z-index: -1;
|
85
|
+
}
|
86
|
+
&[data-in-range='true']:nth-of-type(1):before,
|
87
|
+
&[data-start-range='true']:before {
|
88
|
+
display: none;
|
89
|
+
}
|
90
|
+
`
|
91
|
+
|
92
|
+
CalendarItem.defaultProps = {
|
93
|
+
width: 40,
|
94
|
+
height: 40
|
95
|
+
}
|
96
|
+
export default CalendarItem
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './CalendarItem.styled'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import styled from '@emotion/styled'
|
2
|
+
import { CALENDAR_HEIGHT, CALENDAR_WIDTH } from '../../constants'
|
3
|
+
import { radius } from '../../style/radius'
|
4
|
+
|
5
|
+
export const CalendarWrapper = styled.div`
|
6
|
+
overflow: hidden;
|
7
|
+
position: relative;
|
8
|
+
display: flex;
|
9
|
+
flex-direction: column;
|
10
|
+
justify-content: center;
|
11
|
+
align-items: center;
|
12
|
+
width: ${CALENDAR_WIDTH}px;
|
13
|
+
min-height: ${CALENDAR_HEIGHT}px;
|
14
|
+
border: 1px solid ${(props) => props.theme.colors.gray[40]};
|
15
|
+
background-color: #fff;
|
16
|
+
border-radius: ${(props) => radius[props.theme.round].wrapper}px;
|
17
|
+
`
|
18
|
+
|
19
|
+
export default CalendarWrapper
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './CalendarWrapper.styled'
|