zaman-backoffice 1.0.2 → 1.0.4

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.
Files changed (196) hide show
  1. package/dist/components/CalendarItem/CalendarItem.styled.d.ts +10 -0
  2. package/dist/components/CalendarItem/CalendarItem.types.d.ts +7 -0
  3. package/dist/components/CalendarItem/index.d.ts +1 -0
  4. package/dist/components/CalendarWrapper/CalendarWrapper.styled.d.ts +5 -0
  5. package/dist/components/CalendarWrapper/index.d.ts +1 -0
  6. package/dist/components/FloatingElement/FloatingElement.d.ts +4 -0
  7. package/dist/components/FloatingElement/FloatingElement.styled.d.ts +4 -0
  8. package/dist/components/FloatingElement/FloatingElement.types.d.ts +7 -0
  9. package/dist/components/FloatingElement/index.d.ts +1 -0
  10. package/dist/components/Header/Header.d.ts +3 -0
  11. package/dist/components/Header/Header.styled.d.ts +12 -0
  12. package/dist/components/Header/Header.types.d.ts +6 -0
  13. package/dist/components/Header/index.d.ts +1 -0
  14. package/dist/components/IconButton/IconButton.d.ts +2 -0
  15. package/dist/components/IconButton/IconButton.styled.d.ts +4 -0
  16. package/dist/components/IconButton/index.d.ts +1 -0
  17. package/dist/components/Icons/ChevronLeft/index.d.ts +2 -0
  18. package/dist/components/Icons/ChevronRight/index.d.ts +2 -0
  19. package/dist/components/Modal/Modal.d.ts +3 -0
  20. package/dist/components/Modal/Modal.styled.d.ts +4 -0
  21. package/dist/components/Modal/index.d.ts +1 -0
  22. package/dist/components/Modal/types.d.ts +6 -0
  23. package/dist/components/MonthPicker/Month.styled.d.ts +4 -0
  24. package/dist/components/MonthPicker/MonthPicker.d.ts +3 -0
  25. package/dist/components/MonthPicker/MonthPicker.types.d.ts +4 -0
  26. package/dist/components/MonthPicker/index.d.ts +1 -0
  27. package/dist/components/RenderCalendar/RenderCalendar.d.ts +3 -0
  28. package/dist/components/RenderCalendar/RenderCalendar.types.d.ts +9 -0
  29. package/dist/components/RenderCalendar/index.d.ts +1 -0
  30. package/dist/components/YearPicker/YearPicker.d.ts +3 -0
  31. package/dist/components/YearPicker/YearPicker.styled.d.ts +4 -0
  32. package/dist/components/YearPicker/YearPicker.types.d.ts +4 -0
  33. package/dist/components/YearPicker/index.d.ts +1 -0
  34. package/dist/constants.d.ts +5 -0
  35. package/dist/hooks/useCalendarHandlers.d.ts +19 -0
  36. package/dist/hooks/useClickOutside.d.ts +3 -0
  37. package/dist/hooks/useSlideCalendar.d.ts +12 -0
  38. package/dist/hooks/useTimePicker.d.ts +19 -0
  39. package/dist/index.cjs.js +303 -0
  40. package/dist/index.d.ts +4 -0
  41. package/dist/index.js +303 -0
  42. package/dist/packages/Calendar/Calendar.d.ts +4 -0
  43. package/dist/packages/Calendar/Calendar.styled.d.ts +20 -0
  44. package/dist/packages/Calendar/Calendar.types.d.ts +19 -0
  45. package/dist/packages/Calendar/index.d.ts +2 -0
  46. package/dist/packages/CalendarProvider/CalendarProvider.d.ts +3 -0
  47. package/dist/packages/CalendarProvider/CalendarProvider.types.d.ts +5 -0
  48. package/{src/packages/CalendarProvider/index.ts → dist/packages/CalendarProvider/index.d.ts} +2 -2
  49. package/dist/packages/DatePicker/DatePicker.d.ts +3 -0
  50. package/dist/packages/DatePicker/DatePicker.types.d.ts +15 -0
  51. package/dist/packages/DatePicker/index.d.ts +2 -0
  52. package/dist/packages/TimePicker/TimePicker.d.ts +3 -0
  53. package/dist/packages/TimePicker/TimePicker.styled.d.ts +37 -0
  54. package/dist/packages/TimePicker/TimePicker.types.d.ts +14 -0
  55. package/dist/packages/TimePicker/components/Numbers/Numbers.d.ts +3 -0
  56. package/dist/packages/TimePicker/components/Numbers/Numbers.styled.d.ts +9 -0
  57. package/dist/packages/TimePicker/components/Numbers/Numbers.types.d.ts +13 -0
  58. package/dist/packages/TimePicker/components/Numbers/index.d.ts +1 -0
  59. package/dist/packages/TimePicker/index.d.ts +2 -0
  60. package/dist/style/animation.d.ts +2 -0
  61. package/dist/style/classNames.d.ts +7 -0
  62. package/dist/style/colorPallete.d.ts +1 -0
  63. package/dist/style/colors.d.ts +5 -0
  64. package/dist/style/hexToHSL.d.ts +6 -0
  65. package/dist/style/radius.d.ts +7 -0
  66. package/dist/types.d.ts +41 -0
  67. package/dist/utils/dateHelper/dateHelper.d.ts +15 -0
  68. package/dist/utils/dateHelper/index.d.ts +1 -0
  69. package/dist/utils/dateTimeFormat/dateTimeFormat.d.ts +13 -0
  70. package/dist/utils/dateTimeFormat/index.d.ts +1 -0
  71. package/dist/utils/format/format.d.ts +4 -0
  72. package/dist/utils/format/format.types.d.ts +10 -0
  73. package/dist/utils/format/index.d.ts +1 -0
  74. package/dist/utils/index.d.ts +3 -0
  75. package/dist/utils/locale.d.ts +6 -0
  76. package/dist/utils/locales/en.d.ts +3 -0
  77. package/dist/utils/locales/fa.d.ts +3 -0
  78. package/dist/utils/locales/index.d.ts +3 -0
  79. package/dist/utils/locales/locales.types.d.ts +12 -0
  80. package/dist/utils/month/index.d.ts +1 -0
  81. package/dist/utils/month/month.d.ts +5 -0
  82. package/dist/utils/month/month.types.d.ts +10 -0
  83. package/dist/utils/timePicker.d.ts +36 -0
  84. package/package.json +1 -1
  85. package/.eslintrc.cjs +0 -26
  86. package/.husky/commit-msg +0 -4
  87. package/.husky/pre-commit +0 -4
  88. package/.idea/git_toolbox_blame.xml +0 -6
  89. package/.idea/git_toolbox_prj.xml +0 -15
  90. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  91. package/.idea/material_theme_project_new.xml +0 -12
  92. package/.idea/modules.xml +0 -8
  93. package/.idea/vcs.xml +0 -6
  94. package/.idea/zaman-backoffice2.iml +0 -12
  95. package/.prettierrc +0 -9
  96. package/.travis.yml +0 -10
  97. package/client/index.html +0 -12
  98. package/client/main.tsx +0 -84
  99. package/client/style.css +0 -62
  100. package/cypress/fixtures/example.json +0 -5
  101. package/cypress/support/commands.ts +0 -38
  102. package/cypress/support/component-index.html +0 -12
  103. package/cypress/support/component.ts +0 -39
  104. package/cypress/videos/Calendar/CalendarComponent.cy.tsx.mp4 +0 -0
  105. package/cypress/videos/DatePicker/DatePicker.cy.tsx.mp4 +0 -0
  106. package/cypress.config.ts +0 -10
  107. package/help/banner.png +0 -0
  108. package/jest.config.ts +0 -47
  109. package/src/components/CalendarItem/CalendarItem.styled.tsx +0 -96
  110. package/src/components/CalendarItem/CalendarItem.types.ts +0 -7
  111. package/src/components/CalendarItem/index.ts +0 -1
  112. package/src/components/CalendarWrapper/CalendarWrapper.styled.tsx +0 -19
  113. package/src/components/CalendarWrapper/index.ts +0 -1
  114. package/src/components/FloatingElement/FloatingElement.styled.tsx +0 -8
  115. package/src/components/FloatingElement/FloatingElement.tsx +0 -83
  116. package/src/components/FloatingElement/FloatingElement.types.ts +0 -8
  117. package/src/components/FloatingElement/index.tsx +0 -1
  118. package/src/components/Header/Header.styled.tsx +0 -40
  119. package/src/components/Header/Header.tsx +0 -46
  120. package/src/components/Header/Header.types.ts +0 -6
  121. package/src/components/Header/index.ts +0 -1
  122. package/src/components/IconButton/IconButton.styled.tsx +0 -22
  123. package/src/components/IconButton/IconButton.tsx +0 -3
  124. package/src/components/IconButton/index.tsx +0 -1
  125. package/src/components/Icons/ChevronLeft/index.tsx +0 -22
  126. package/src/components/Icons/ChevronRight/index.tsx +0 -22
  127. package/src/components/Modal/Modal.styled.tsx +0 -23
  128. package/src/components/Modal/Modal.tsx +0 -29
  129. package/src/components/Modal/index.tsx +0 -1
  130. package/src/components/Modal/types.ts +0 -7
  131. package/src/components/MonthPicker/Month.styled.tsx +0 -11
  132. package/src/components/MonthPicker/MonthPicker.tsx +0 -35
  133. package/src/components/MonthPicker/MonthPicker.types.ts +0 -4
  134. package/src/components/MonthPicker/index.ts +0 -1
  135. package/src/components/RenderCalendar/RenderCalendar.tsx +0 -31
  136. package/src/components/RenderCalendar/RenderCalendar.types.ts +0 -10
  137. package/src/components/RenderCalendar/index.ts +0 -1
  138. package/src/components/YearPicker/YearPicker.styled.tsx +0 -14
  139. package/src/components/YearPicker/YearPicker.tsx +0 -49
  140. package/src/components/YearPicker/YearPicker.types.ts +0 -4
  141. package/src/components/YearPicker/index.ts +0 -1
  142. package/src/constants.ts +0 -6
  143. package/src/hooks/__tests__/useClickOutside.test.tsx +0 -32
  144. package/src/hooks/useCalendarHandlers.tsx +0 -113
  145. package/src/hooks/useClickOutside.tsx +0 -23
  146. package/src/hooks/useSlideCalendar.tsx +0 -95
  147. package/src/hooks/useTimePicker.tsx +0 -95
  148. package/src/index.tsx +0 -4
  149. package/src/packages/Calendar/Calendar.styled.tsx +0 -42
  150. package/src/packages/Calendar/Calendar.tsx +0 -159
  151. package/src/packages/Calendar/Calendar.types.ts +0 -31
  152. package/src/packages/Calendar/CalendarComponent.cy.tsx +0 -69
  153. package/src/packages/Calendar/index.ts +0 -2
  154. package/src/packages/CalendarProvider/CalendarProvider.tsx +0 -30
  155. package/src/packages/CalendarProvider/CalendarProvider.types.ts +0 -6
  156. package/src/packages/DatePicker/DatePicker.cy.tsx +0 -54
  157. package/src/packages/DatePicker/DatePicker.tsx +0 -127
  158. package/src/packages/DatePicker/DatePicker.types.ts +0 -26
  159. package/src/packages/DatePicker/index.ts +0 -2
  160. package/src/packages/TimePicker/TimePicker.styled.tsx +0 -77
  161. package/src/packages/TimePicker/TimePicker.tsx +0 -121
  162. package/src/packages/TimePicker/TimePicker.types.ts +0 -16
  163. package/src/packages/TimePicker/components/Numbers/Numbers.styled.tsx +0 -36
  164. package/src/packages/TimePicker/components/Numbers/Numbers.tsx +0 -58
  165. package/src/packages/TimePicker/components/Numbers/Numbers.types.ts +0 -14
  166. package/src/packages/TimePicker/components/Numbers/index.ts +0 -1
  167. package/src/packages/TimePicker/index.ts +0 -2
  168. package/src/style/animation.ts +0 -23
  169. package/src/style/classNames.ts +0 -8
  170. package/src/style/colorPallete.ts +0 -16
  171. package/src/style/colors.ts +0 -15
  172. package/src/style/hexToHSL.ts +0 -52
  173. package/src/style/radius.ts +0 -28
  174. package/src/types.ts +0 -75
  175. package/src/utils/dateHelper/dateHelper.ts +0 -67
  176. package/src/utils/dateHelper/index.ts +0 -1
  177. package/src/utils/dateTimeFormat/dateTimeFormat.ts +0 -43
  178. package/src/utils/dateTimeFormat/index.ts +0 -1
  179. package/src/utils/format/format.test.ts +0 -37
  180. package/src/utils/format/format.ts +0 -56
  181. package/src/utils/format/format.types.ts +0 -11
  182. package/src/utils/format/index.ts +0 -1
  183. package/src/utils/index.ts +0 -21
  184. package/src/utils/locale.ts +0 -13
  185. package/src/utils/locales/en.ts +0 -89
  186. package/src/utils/locales/fa.ts +0 -89
  187. package/src/utils/locales/index.ts +0 -10
  188. package/src/utils/locales/locales.types.ts +0 -11
  189. package/src/utils/month/index.ts +0 -1
  190. package/src/utils/month/month.ts +0 -54
  191. package/src/utils/month/month.types.ts +0 -11
  192. package/src/utils/timePicker.ts +0 -107
  193. package/src/utils/type.ts +0 -0
  194. package/tsconfig.json +0 -22
  195. package/tsconfig.test.json +0 -7
  196. package/vite.config.ts +0 -7
@@ -1,96 +0,0 @@
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
@@ -1,7 +0,0 @@
1
- export interface CalendarItemProps {
2
- selected?: boolean
3
- range?: boolean
4
- disabled?: boolean
5
- width?: number
6
- height?: number
7
- }
@@ -1 +0,0 @@
1
- export { default } from './CalendarItem.styled'
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
1
- export { default } from './CalendarWrapper.styled'
@@ -1,8 +0,0 @@
1
- import styled from '@emotion/styled'
2
- import { ANIMATE_FUNC } from '../../constants'
3
- import { slideDown } from '../../style/animation'
4
-
5
- export const Wrapper = styled.div`
6
- position: absolute;
7
- animation: ${slideDown} 0.3s ${ANIMATE_FUNC} alternate;
8
- `
@@ -1,83 +0,0 @@
1
- import React, { useEffect, useRef } from 'react'
2
- import { createPortal } from 'react-dom'
3
- import debounce from 'lodash.debounce'
4
- import type { FloatingElementProps } from './FloatingElement.types'
5
- import type { Positions } from '../../types'
6
- import { Wrapper } from './FloatingElement.styled'
7
-
8
- const FloatingElement: React.FC<FloatingElementProps> = (props) => {
9
- const { children, destinationRef, position } = props
10
- const floatWrapperRef = useRef<HTMLDivElement>(null)
11
-
12
- const calcPlacement = () => {
13
- const gap = 4
14
- let top = 0
15
-
16
- if (destinationRef != null && floatWrapperRef !== null) {
17
- const floatWrapper = floatWrapperRef.current
18
- if (floatWrapper === null) {
19
- return
20
- }
21
- const {
22
- top: destTop,
23
- bottom: destBottom,
24
- right: destRight,
25
- left: destLeft,
26
- width: destWidth
27
- } = destinationRef?.current?.getBoundingClientRect() as DOMRect
28
- const { height: itemsHeight, width: floatWidth } =
29
- floatWrapper?.getBoundingClientRect()
30
- const isThereSpaceBelowDest =
31
- window.innerHeight - destBottom > itemsHeight
32
-
33
- if (isThereSpaceBelowDest) {
34
- top = destBottom + window.scrollY
35
- } else {
36
- top = destTop + window.scrollY - itemsHeight - gap * 2
37
- }
38
- floatWrapper.style.top = `${top + gap}px`
39
-
40
- const positionsCalc: Record<Positions, () => void> = {
41
- right: () => {
42
- floatWrapper.style.right = `${
43
- Math.abs(document.body.clientWidth - destRight) + 16
44
- }px`
45
- },
46
- left: () => {
47
- floatWrapper.style.left = `${destLeft}px`
48
- },
49
- center: () => {
50
- const isDestBiggerThanFloatElement = floatWidth > destWidth
51
- const remainWidth = isDestBiggerThanFloatElement
52
- ? 0
53
- : Math.abs(floatWidth - destWidth) / 2 + 16
54
- floatWrapper.style.right = `${
55
- Math.abs(document.body.clientWidth - destRight) + remainWidth
56
- }px`
57
- }
58
- }
59
-
60
- positionsCalc[position]()
61
- }
62
- }
63
-
64
- useEffect(() => {
65
- calcPlacement()
66
- window.addEventListener('resize', debounce(calcPlacement, 500))
67
-
68
- return () => {
69
- window.removeEventListener('resize', calcPlacement)
70
- }
71
- }, [destinationRef])
72
-
73
- return (
74
- <>
75
- {createPortal(
76
- <Wrapper ref={floatWrapperRef}>{children}</Wrapper>,
77
- document.body
78
- )}
79
- </>
80
- )
81
- }
82
-
83
- export default FloatingElement
@@ -1,8 +0,0 @@
1
- import type React from 'react'
2
- import type { Positions } from '../../types'
3
-
4
- export interface FloatingElementProps {
5
- children: React.ReactNode
6
- destinationRef: React.RefObject<HTMLInputElement>
7
- position: Positions
8
- }
@@ -1 +0,0 @@
1
- export { default } from './FloatingElement'
@@ -1,40 +0,0 @@
1
- import styled from '@emotion/styled'
2
- import { radius } from '../../style/radius'
3
-
4
- export const Wrapper = styled.div`
5
- display: flex;
6
- justify-content: space-between;
7
- align-items: center;
8
- height: 56px;
9
- padding-right: 8px;
10
- padding-left: 8px;
11
- background-color: ${(props) => props.theme.colors.primary[95]};
12
- border-bottom: 2px solid ${(props) => props.theme.colors.primary[85]};
13
- `
14
- export const HeaderTitle = styled.button`
15
- will-change: auto;
16
- min-width: 100px;
17
- outline: none;
18
- border: 0;
19
- font-family: inherit;
20
- background-color: transparent;
21
- cursor: pointer;
22
- color: ${(props) => props.theme.colors.primary[50]};
23
- padding: 8px 16px;
24
- font-weight: 500;
25
- transition: background-color 0.2s ease-in;
26
- border-radius: ${(props) => radius[props.theme.round].calendarItem}px;
27
-
28
- &:hover,
29
- &:focus {
30
- background-color: ${(props) => props.theme.colors.primary[90]};
31
- }
32
- `
33
- export const DayName = styled.div`
34
- display: flex;
35
- justify-content: center;
36
- align-items: center;
37
- font-size: 14px;
38
- width: 40px;
39
- color: #8c8c8c;
40
- `
@@ -1,46 +0,0 @@
1
- import React from 'react'
2
- import IconButton from '../IconButton'
3
- import ChevronRight from '../Icons/ChevronRight'
4
- import ChevronLeft from '../Icons/ChevronLeft'
5
- import { Wrapper, HeaderTitle } from './Header.styled'
6
- import type { HeaderProps } from './Header.types'
7
- import {
8
- HeaderClass,
9
- IconNextButton,
10
- IconPrevButton,
11
- MonthYearButton
12
- } from '../../style/classNames'
13
-
14
- export const Header = (props: HeaderProps) => {
15
- return (
16
- <Wrapper className={HeaderClass}>
17
- <IconButton
18
- aria-label="Previous month"
19
- onClick={props.onPrevClick}
20
- className={IconPrevButton}
21
- tabIndex={0}
22
- >
23
- <ChevronRight />
24
- </IconButton>
25
- <HeaderTitle
26
- className={MonthYearButton}
27
- role="presentation"
28
- onClick={props.onClickOnTitle}
29
- aria-label="calendar view is open, switch to year and month view"
30
- tabIndex={0}
31
- >
32
- {props.monthName}
33
- </HeaderTitle>
34
- <IconButton
35
- aria-label="Next month"
36
- onClick={props.onNextClick}
37
- className={IconNextButton}
38
- tabIndex={0}
39
- >
40
- <ChevronLeft />
41
- </IconButton>
42
- </Wrapper>
43
- )
44
- }
45
-
46
- export default Header
@@ -1,6 +0,0 @@
1
- export interface HeaderProps {
2
- monthName: string
3
- onNextClick: () => void
4
- onPrevClick: () => void
5
- onClickOnTitle: () => void
6
- }
@@ -1 +0,0 @@
1
- export { default } from './Header'
@@ -1,22 +0,0 @@
1
- import styled from '@emotion/styled'
2
- import { radius } from '../../style/radius'
3
-
4
- export const IconButton = styled.button`
5
- cursor: pointer;
6
- outline: none;
7
- border: none;
8
- display: flex;
9
- justify-content: center;
10
- align-items: center;
11
- width: 40px;
12
- height: 40px;
13
- transition: background-color 0.2s ease-in;
14
- color: ${(props) => props.theme.colors.primary[50]};
15
- background-color: transparent;
16
- border-radius: ${(props) => radius[props.theme.round].calendarItem}px;
17
-
18
- &:hover,
19
- &:focus {
20
- background-color: ${(props) => props.theme.colors.primary[90]};
21
- }
22
- `
@@ -1,3 +0,0 @@
1
- import { IconButton } from './IconButton.styled'
2
-
3
- export default IconButton
@@ -1 +0,0 @@
1
- export { default } from './IconButton'
@@ -1,22 +0,0 @@
1
- import React from 'react'
2
- import { isRtl } from '../../../utils'
3
-
4
- export const ChevronLeft = () => (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="20"
8
- height="20"
9
- viewBox="0 0 24 24"
10
- fill="none"
11
- stroke="currentColor"
12
- strokeWidth="2"
13
- strokeLinecap="round"
14
- strokeLinejoin="round"
15
- className="feather feather-chevron-left"
16
- style={{ transform: isRtl() ? 'unset' : 'rotate(180deg)' }}
17
- >
18
- <polyline points="15 18 9 12 15 6"></polyline>
19
- </svg>
20
- )
21
-
22
- export default ChevronLeft
@@ -1,22 +0,0 @@
1
- import React from 'react'
2
- import { isRtl } from '../../../utils'
3
-
4
- export const ChevronRight = () => (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="20"
8
- height="20"
9
- viewBox="0 0 24 24"
10
- fill="none"
11
- stroke="currentColor"
12
- strokeWidth="2"
13
- strokeLinecap="round"
14
- strokeLinejoin="round"
15
- className="feather feather-chevron-right"
16
- style={{ transform: isRtl() ? 'unset' : 'rotate(180deg)' }}
17
- >
18
- <polyline points="9 18 15 12 9 6"></polyline>
19
- </svg>
20
- )
21
-
22
- export default ChevronRight
@@ -1,23 +0,0 @@
1
- import styled from '@emotion/styled'
2
-
3
- export const ModalDiv = styled.div`
4
- position: fixed;
5
- display: flex;
6
- justify-content: center;
7
- align-items: center;
8
- top: 0;
9
- right: 0;
10
- width: 100%;
11
- height: 100%;
12
- z-index: 10;
13
-
14
- .rdp__overlay {
15
- position: absolute;
16
- top: 0;
17
- right: 0;
18
- width: 100%;
19
- height: 100%;
20
- z-index: -10;
21
- background-color: rgba(86, 86, 86, 0.4);
22
- }
23
- `
@@ -1,29 +0,0 @@
1
- import React from 'react'
2
- import type { IModalProps } from './types'
3
- import { ModalDiv } from './Modal.styled'
4
- import { createPortal } from 'react-dom'
5
-
6
- export const Modal = (props: IModalProps) => {
7
- const { open, toggleOpen, children } = props
8
-
9
- if (open === false) {
10
- return null
11
- }
12
- return (
13
- <>
14
- {createPortal(
15
- <ModalDiv className="rdp__modal">
16
- {children}
17
- <div
18
- data-testid="overlay"
19
- className="rdp__overlay"
20
- onClick={toggleOpen}
21
- />
22
- </ModalDiv>,
23
- document.body
24
- )}
25
- </>
26
- )
27
- }
28
-
29
- export default Modal
@@ -1 +0,0 @@
1
- export { default } from './Modal'
@@ -1,7 +0,0 @@
1
- import type * as React from 'react'
2
-
3
- export interface IModalProps {
4
- open?: boolean
5
- children: React.ReactNode
6
- toggleOpen: () => void
7
- }
@@ -1,11 +0,0 @@
1
- import styled from '@emotion/styled'
2
- import { CALENDAR_WIDTH } from '../../constants'
3
-
4
- export const Wrapper = styled.div`
5
- display: flex;
6
- justify-content: center;
7
- align-items: center;
8
- flex-wrap: wrap;
9
- gap: 4px;
10
- height: ${CALENDAR_WIDTH}px;
11
- `
@@ -1,35 +0,0 @@
1
- import React from 'react'
2
- import localeCache from '../../utils/locale'
3
- import locales from '../../utils/locales'
4
- import CalendarItem from '../CalendarItem'
5
- import { Wrapper } from './Month.styled'
6
- import formatDate from '../../utils/format'
7
- import type { MonthPickerProps } from './MonthPicker.types'
8
- import { MonthPickerButton } from '../../style/classNames'
9
-
10
- export const MonthPicker = (props: MonthPickerProps) => {
11
- const { locale } = localeCache
12
- const currentMonth = formatDate(props.value, 'MM', 'latn')
13
-
14
- return (
15
- <Wrapper>
16
- {locales[locale].months.map((month) => (
17
- <CalendarItem
18
- key={month.key}
19
- className={MonthPickerButton}
20
- width={90}
21
- height={48}
22
- data-selected={month.key === parseInt(currentMonth, 10)}
23
- onClick={() => props.onMonthSelect(month.key)}
24
- aria-current="date"
25
- type="button"
26
- tabIndex={0}
27
- >
28
- {month.name}
29
- </CalendarItem>
30
- ))}
31
- </Wrapper>
32
- )
33
- }
34
-
35
- export default MonthPicker
@@ -1,4 +0,0 @@
1
- export interface MonthPickerProps {
2
- value: Date
3
- onMonthSelect: (month: number) => void
4
- }
@@ -1 +0,0 @@
1
- export { default } from './MonthPicker'
@@ -1,31 +0,0 @@
1
- import React from 'react'
2
- import { type RenderCalendarProps } from './RenderCalendar.types'
3
- import FloatingElement from '../FloatingElement'
4
- import Modal from '../Modal'
5
-
6
- export const RenderCalendar = (props: RenderCalendarProps) => {
7
- const { position = 'right' } = props
8
- if (!props.showCalendar) {
9
- return null
10
- }
11
- const { matches: isDesktop } = window.matchMedia('(min-width: 640px)')
12
-
13
- if (isDesktop) {
14
- return (
15
- <FloatingElement
16
- destinationRef={props.destinationRef}
17
- position={position}
18
- >
19
- {props.children}
20
- </FloatingElement>
21
- )
22
- }
23
-
24
- return (
25
- <Modal toggleOpen={props.toggleOpen} open={props.showCalendar}>
26
- {props.children}
27
- </Modal>
28
- )
29
- }
30
-
31
- export default RenderCalendar
@@ -1,10 +0,0 @@
1
- import type React from 'react'
2
- import type { Positions } from '../../types'
3
-
4
- export interface RenderCalendarProps {
5
- showCalendar: boolean
6
- toggleOpen: () => void
7
- children: React.ReactNode
8
- destinationRef: React.RefObject<HTMLInputElement>
9
- position?: Positions
10
- }
@@ -1 +0,0 @@
1
- export { default } from './RenderCalendar'
@@ -1,14 +0,0 @@
1
- import styled from '@emotion/styled'
2
- import { CALENDAR_WIDTH } from '../../constants'
3
-
4
- export const Wrapper = styled.div`
5
- display: grid;
6
- grid-template-columns: repeat(3, 92px);
7
- grid-template-rows: auto;
8
- justify-content: center;
9
- gap: 4px;
10
- max-height: ${CALENDAR_WIDTH}px;
11
- overflow: auto;
12
- padding-top: 8px;
13
- padding-bottom: 8px;
14
- `
@@ -1,49 +0,0 @@
1
- import React, { useMemo } from 'react'
2
- import CalendarItem from '../CalendarItem'
3
- import { Wrapper } from './YearPicker.styled'
4
- import { getYears } from '../../utils/dateHelper/dateHelper'
5
- import formatDate from '../../utils/format'
6
- import type { YearPickerProps } from './YearPicker.types'
7
- import { localizeNumber } from '../../utils'
8
- import { YearPickerButton } from '../../style/classNames'
9
-
10
- export const YearPicker = (props: YearPickerProps) => {
11
- const currentYear = parseInt(formatDate(props.value, 'YYYY', 'latn'), 10)
12
- const years: number[] = useMemo(() => getYears(props.value), [])
13
-
14
- const wrapperRef = React.useCallback((wrapper: HTMLDivElement) => {
15
- if (wrapper === null) {
16
- return
17
- }
18
- const qu = wrapper.querySelector('button[data-selected=true]')
19
- if (qu != null) {
20
- const { height: wrapperHeight, top: wrapperTop } =
21
- wrapper.getBoundingClientRect()
22
- const { top } = qu.getBoundingClientRect()
23
- wrapper.scrollTop = Math.abs(wrapperTop - top) - wrapperHeight / 2
24
- }
25
- }, [])
26
-
27
- return (
28
- <Wrapper ref={wrapperRef}>
29
- {years.map((year) => (
30
- <CalendarItem
31
- className={YearPickerButton}
32
- key={year}
33
- width={90}
34
- height={48}
35
- data-selected={currentYear === year}
36
- aria-selected={currentYear === year}
37
- aria-current="date"
38
- type="button"
39
- tabIndex={0}
40
- onClick={() => props.onYearSelect(year)}
41
- >
42
- {localizeNumber(year)}
43
- </CalendarItem>
44
- ))}
45
- </Wrapper>
46
- )
47
- }
48
-
49
- export default YearPicker
@@ -1,4 +0,0 @@
1
- export interface YearPickerProps {
2
- value: Date
3
- onYearSelect: (year: number) => void
4
- }
@@ -1 +0,0 @@
1
- export { default } from './YearPicker'
package/src/constants.ts DELETED
@@ -1,6 +0,0 @@
1
- export const TIME = 250
2
- export const CALENDAR_WIDTH = 320
3
- export const CALENDAR_HEIGHT = 372
4
- export const ANIMATE_FUNC = 'cubic-bezier(0.4, 0, 0.2, 1)'
5
-
6
- export const ACCENT_COLOR = '#0D59F2'