zaman-backoffice 1.0.2 → 1.0.3

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 (114) hide show
  1. package/package.json +1 -1
  2. package/.eslintrc.cjs +0 -26
  3. package/.husky/commit-msg +0 -4
  4. package/.husky/pre-commit +0 -4
  5. package/.idea/git_toolbox_blame.xml +0 -6
  6. package/.idea/git_toolbox_prj.xml +0 -15
  7. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  8. package/.idea/material_theme_project_new.xml +0 -12
  9. package/.idea/modules.xml +0 -8
  10. package/.idea/vcs.xml +0 -6
  11. package/.idea/zaman-backoffice2.iml +0 -12
  12. package/.prettierrc +0 -9
  13. package/.travis.yml +0 -10
  14. package/client/index.html +0 -12
  15. package/client/main.tsx +0 -84
  16. package/client/style.css +0 -62
  17. package/cypress/fixtures/example.json +0 -5
  18. package/cypress/support/commands.ts +0 -38
  19. package/cypress/support/component-index.html +0 -12
  20. package/cypress/support/component.ts +0 -39
  21. package/cypress/videos/Calendar/CalendarComponent.cy.tsx.mp4 +0 -0
  22. package/cypress/videos/DatePicker/DatePicker.cy.tsx.mp4 +0 -0
  23. package/cypress.config.ts +0 -10
  24. package/help/banner.png +0 -0
  25. package/jest.config.ts +0 -47
  26. package/src/components/CalendarItem/CalendarItem.styled.tsx +0 -96
  27. package/src/components/CalendarItem/CalendarItem.types.ts +0 -7
  28. package/src/components/CalendarItem/index.ts +0 -1
  29. package/src/components/CalendarWrapper/CalendarWrapper.styled.tsx +0 -19
  30. package/src/components/CalendarWrapper/index.ts +0 -1
  31. package/src/components/FloatingElement/FloatingElement.styled.tsx +0 -8
  32. package/src/components/FloatingElement/FloatingElement.tsx +0 -83
  33. package/src/components/FloatingElement/FloatingElement.types.ts +0 -8
  34. package/src/components/FloatingElement/index.tsx +0 -1
  35. package/src/components/Header/Header.styled.tsx +0 -40
  36. package/src/components/Header/Header.tsx +0 -46
  37. package/src/components/Header/Header.types.ts +0 -6
  38. package/src/components/Header/index.ts +0 -1
  39. package/src/components/IconButton/IconButton.styled.tsx +0 -22
  40. package/src/components/IconButton/IconButton.tsx +0 -3
  41. package/src/components/IconButton/index.tsx +0 -1
  42. package/src/components/Icons/ChevronLeft/index.tsx +0 -22
  43. package/src/components/Icons/ChevronRight/index.tsx +0 -22
  44. package/src/components/Modal/Modal.styled.tsx +0 -23
  45. package/src/components/Modal/Modal.tsx +0 -29
  46. package/src/components/Modal/index.tsx +0 -1
  47. package/src/components/Modal/types.ts +0 -7
  48. package/src/components/MonthPicker/Month.styled.tsx +0 -11
  49. package/src/components/MonthPicker/MonthPicker.tsx +0 -35
  50. package/src/components/MonthPicker/MonthPicker.types.ts +0 -4
  51. package/src/components/MonthPicker/index.ts +0 -1
  52. package/src/components/RenderCalendar/RenderCalendar.tsx +0 -31
  53. package/src/components/RenderCalendar/RenderCalendar.types.ts +0 -10
  54. package/src/components/RenderCalendar/index.ts +0 -1
  55. package/src/components/YearPicker/YearPicker.styled.tsx +0 -14
  56. package/src/components/YearPicker/YearPicker.tsx +0 -49
  57. package/src/components/YearPicker/YearPicker.types.ts +0 -4
  58. package/src/components/YearPicker/index.ts +0 -1
  59. package/src/constants.ts +0 -6
  60. package/src/hooks/__tests__/useClickOutside.test.tsx +0 -32
  61. package/src/hooks/useCalendarHandlers.tsx +0 -113
  62. package/src/hooks/useClickOutside.tsx +0 -23
  63. package/src/hooks/useSlideCalendar.tsx +0 -95
  64. package/src/hooks/useTimePicker.tsx +0 -95
  65. package/src/index.tsx +0 -4
  66. package/src/packages/Calendar/Calendar.styled.tsx +0 -42
  67. package/src/packages/Calendar/Calendar.tsx +0 -159
  68. package/src/packages/Calendar/Calendar.types.ts +0 -31
  69. package/src/packages/Calendar/CalendarComponent.cy.tsx +0 -69
  70. package/src/packages/Calendar/index.ts +0 -2
  71. package/src/packages/CalendarProvider/CalendarProvider.tsx +0 -30
  72. package/src/packages/CalendarProvider/CalendarProvider.types.ts +0 -6
  73. package/src/packages/CalendarProvider/index.ts +0 -2
  74. package/src/packages/DatePicker/DatePicker.cy.tsx +0 -54
  75. package/src/packages/DatePicker/DatePicker.tsx +0 -127
  76. package/src/packages/DatePicker/DatePicker.types.ts +0 -26
  77. package/src/packages/DatePicker/index.ts +0 -2
  78. package/src/packages/TimePicker/TimePicker.styled.tsx +0 -77
  79. package/src/packages/TimePicker/TimePicker.tsx +0 -121
  80. package/src/packages/TimePicker/TimePicker.types.ts +0 -16
  81. package/src/packages/TimePicker/components/Numbers/Numbers.styled.tsx +0 -36
  82. package/src/packages/TimePicker/components/Numbers/Numbers.tsx +0 -58
  83. package/src/packages/TimePicker/components/Numbers/Numbers.types.ts +0 -14
  84. package/src/packages/TimePicker/components/Numbers/index.ts +0 -1
  85. package/src/packages/TimePicker/index.ts +0 -2
  86. package/src/style/animation.ts +0 -23
  87. package/src/style/classNames.ts +0 -8
  88. package/src/style/colorPallete.ts +0 -16
  89. package/src/style/colors.ts +0 -15
  90. package/src/style/hexToHSL.ts +0 -52
  91. package/src/style/radius.ts +0 -28
  92. package/src/types.ts +0 -75
  93. package/src/utils/dateHelper/dateHelper.ts +0 -67
  94. package/src/utils/dateHelper/index.ts +0 -1
  95. package/src/utils/dateTimeFormat/dateTimeFormat.ts +0 -43
  96. package/src/utils/dateTimeFormat/index.ts +0 -1
  97. package/src/utils/format/format.test.ts +0 -37
  98. package/src/utils/format/format.ts +0 -56
  99. package/src/utils/format/format.types.ts +0 -11
  100. package/src/utils/format/index.ts +0 -1
  101. package/src/utils/index.ts +0 -21
  102. package/src/utils/locale.ts +0 -13
  103. package/src/utils/locales/en.ts +0 -89
  104. package/src/utils/locales/fa.ts +0 -89
  105. package/src/utils/locales/index.ts +0 -10
  106. package/src/utils/locales/locales.types.ts +0 -11
  107. package/src/utils/month/index.ts +0 -1
  108. package/src/utils/month/month.ts +0 -54
  109. package/src/utils/month/month.types.ts +0 -11
  110. package/src/utils/timePicker.ts +0 -107
  111. package/src/utils/type.ts +0 -0
  112. package/tsconfig.json +0 -22
  113. package/tsconfig.test.json +0 -7
  114. package/vite.config.ts +0 -7
@@ -1,127 +0,0 @@
1
- import React, {useEffect, useMemo, useRef, useState} from 'react'
2
- import RenderCalendar from '../../components/RenderCalendar'
3
- import Calendar from '../Calendar'
4
- import useClickOutside from '../../hooks/useClickOutside'
5
- import formatDate from '../../utils/format'
6
- import locales from '../../utils/locales'
7
- import type { DatePickerProps } from './DatePicker.types'
8
- import CalendarProvider from '../CalendarProvider/CalendarProvider'
9
- import localeCache from '../../utils/locale'
10
- import type { OnChangePayload } from '../Calendar/Calendar.types'
11
-
12
- export const DatePicker = (props: DatePickerProps) => {
13
- const {
14
- defaultValue,
15
- locale = 'fa',
16
- weekends = [],
17
- direction = 'rtl',
18
- accentColor,
19
- controlledValue
20
- } = props
21
- useMemo(() => localeCache.setLocale(locale), [locale])
22
- // refs
23
- const inputRef = useRef<HTMLInputElement>(null)
24
- const containerRef = useRef<HTMLDivElement>(null)
25
- // states
26
- const [value, setValue] = useState<Date | undefined>(
27
- defaultValue !== undefined ? new Date(defaultValue) : undefined
28
- )
29
- const [from, setFrom] = useState<Date | undefined>(
30
- props.range === true && props.from !== undefined
31
- ? new Date(props.from)
32
- : undefined
33
- )
34
- const [to, setTo] = useState<Date | undefined>(
35
- props.range === true && props.to !== undefined
36
- ? new Date(props.to)
37
- : undefined
38
- )
39
- const [showCalendar, setShowCalendar] = useState<boolean>(false)
40
- // hooks
41
- useEffect(() => {
42
- if(!controlledValue || controlledValue === value) return;
43
- setValue(controlledValue as Date)
44
- }, [controlledValue]);
45
-
46
- useClickOutside(containerRef, () => setShowCalendar(false))
47
- // handlers
48
- const toggleShowCalendar = () => {
49
- setShowCalendar(!showCalendar)
50
- }
51
-
52
- const handleChangeDay = (e: OnChangePayload) => {
53
- if (props.range === true && typeof props.onChange === 'function') {
54
- const from = 'from' in e ? e.from : new Date()
55
- const to = 'to' in e ? e.to : new Date()
56
- setFrom(from)
57
- setTo(to)
58
-
59
- props.onChange({
60
- from,
61
- to
62
- })
63
- } else if (
64
- (props.range === false || props.range === undefined) &&
65
- typeof props.onChange === 'function'
66
- ) {
67
- const value = 'value' in e ? e.value : new Date()
68
- setValue(value)
69
-
70
- props.onChange({
71
- value
72
- })
73
- }
74
- }
75
-
76
- const getInputValue = useMemo(() => {
77
- const format = props?.customShowDateFormat ?? locales[locale].format
78
- if (props.range === undefined && value !== undefined) {
79
- return formatDate(value, format)
80
- }
81
- console.log('from >>', from)
82
- if (from !== undefined && to !== undefined) {
83
- return `
84
- ${formatDate(from, format)}
85
- -
86
- ${formatDate(to, format)}
87
- `
88
- }
89
- return ''
90
- }, [value, from, to])
91
- return (
92
- <CalendarProvider
93
- accentColor={accentColor}
94
- round={props.round}
95
- direction={direction}
96
- >
97
- <input
98
- ref={inputRef}
99
- {...props?.inputAttributes}
100
- onClick={toggleShowCalendar}
101
- type="text"
102
- value={getInputValue}
103
- className={props.inputClass !== null ? props.inputClass : ''}
104
- readOnly
105
- />
106
- <RenderCalendar
107
- toggleOpen={toggleShowCalendar}
108
- showCalendar={showCalendar}
109
- destinationRef={inputRef}
110
- position={props.position}
111
- >
112
- <Calendar
113
- defaultValue={value}
114
- ref={containerRef}
115
- className={props.className}
116
- weekends={weekends}
117
- onChange={handleChangeDay}
118
- range={props.range}
119
- from={props.range === true ? props.from : undefined}
120
- to={props.range === true ? props.to : undefined}
121
- />
122
- </RenderCalendar>
123
- </CalendarProvider>
124
- )
125
- }
126
-
127
- export default DatePicker
@@ -1,26 +0,0 @@
1
- import type { InputHTMLAttributes } from 'react'
2
- import type {
3
- BaseProps,
4
- DatePickerValue,
5
- DaysRange,
6
- Positions
7
- } from '../../types'
8
- import type {
9
- CalendarDefaultProps,
10
- CalendarRangeProps
11
- } from '../Calendar/Calendar.types'
12
-
13
- export interface DatePickerBaseProps extends BaseProps {
14
- defaultValue?: DatePickerValue
15
- weekends?: DaysRange[]
16
- show?: boolean
17
- inputClass?: string
18
- className?: string
19
- inputAttributes?: InputHTMLAttributes<HTMLInputElement>
20
- position?: Positions
21
- customShowDateFormat?: string
22
- controlledValue? : DatePickerValue
23
- }
24
-
25
- export type DatePickerProps = DatePickerBaseProps &
26
- (CalendarRangeProps | CalendarDefaultProps)
@@ -1,2 +0,0 @@
1
- export { default } from './DatePicker'
2
- export type { DatePickerProps } from './DatePicker.types'
@@ -1,77 +0,0 @@
1
- import styled from '@emotion/styled'
2
- import { radius } from '../../style/radius'
3
-
4
- export const Clock = styled.div`
5
- width: 260px;
6
- height: 260px;
7
- position: relative;
8
- z-index: 1;
9
- border-radius: 50%;
10
- background-color: ${(props) => props.theme.colors.primary[95]};
11
- `
12
-
13
- export interface IStyledHandProps {
14
- hour: number
15
- minute: number
16
- value: number
17
- isInsideHour: boolean
18
- isSelectingHour: boolean
19
- }
20
-
21
- export const Hand = styled('div')<IStyledHandProps>`
22
- left: 50%;
23
- width: 1.5px;
24
- bottom: 50%;
25
- height: ${(props) => (props.isInsideHour ? '26%' : '40%')};
26
- position: absolute;
27
- background-color: ${(props) => props.theme.colors.primary[85]};
28
- transform-origin: center bottom 0;
29
- transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
30
- pointer-events: none;
31
- ${(props) =>
32
- props.isSelectingHour
33
- ? `transform: ${`rotateZ(${(props.value / 12) * 360}deg)`}; `
34
- : `transform: ${`rotateZ(${(props.value / 60) * 360}deg)`}; `}
35
- `
36
-
37
- export const HandCircle = styled('div')<{ isSelectingHour: boolean }>`
38
- top: -22px;
39
- right: -16px;
40
- border: 16px solid ${(props) => props.theme.colors.primary[85]};
41
- position: absolute;
42
- box-sizing: content-box;
43
- border-radius: 100%;
44
- background-color: ${(props) => props.theme.colors.primary[85]};
45
- pointer-events: none;
46
- `
47
-
48
- export const TimeWrapper = styled.div`
49
- position: absolute;
50
- top: 16px;
51
- left: 16px;
52
- display: flex;
53
- align-items: center;
54
- gap: 8px;
55
- `
56
-
57
- export const Time = styled.div`
58
- padding: 4px 8px;
59
- border-radius: ${(props) => radius[props.theme.round].calendarItem}px;
60
- background-color: ${(props) => props.theme.colors.gray[20]};
61
- `
62
-
63
- export const ClockTimeWrapper = styled.div`
64
- display: flex;
65
- gap: 4px;
66
- `
67
-
68
- export const ClockTime = styled.div`
69
- cursor: pointer;
70
- font-size: 12px;
71
- padding: 4px;
72
- border-radius: 4px;
73
-
74
- &.cl_selected {
75
- background-color: ${(props) => props.theme.colors.gray[20]};
76
- }
77
- `
@@ -1,121 +0,0 @@
1
- import React, { useMemo, useRef, useState } from 'react'
2
- import RenderCalendar from '../../components/RenderCalendar'
3
- import {
4
- Clock,
5
- ClockTime,
6
- ClockTimeWrapper,
7
- Hand,
8
- HandCircle,
9
- Time,
10
- TimeWrapper
11
- } from './TimePicker.styled'
12
- import CalendarProvider from '../CalendarProvider/CalendarProvider'
13
- import Numbers from './components/Numbers'
14
- import type { TimePickerProps } from './TimePicker.types'
15
- import localeCache from '../../utils/locale'
16
- import CalendarWrapper from '../../components/CalendarWrapper'
17
- import { localizeNumber } from '../../utils'
18
- import locales from '../../utils/locales'
19
- import useClickOutside from '../../hooks/useClickOutside'
20
- import { useTimePicker } from '../../hooks/useTimePicker'
21
-
22
- export const TimePicker = (props: TimePickerProps) => {
23
- const {
24
- defaultValue,
25
- onChange,
26
- round = 'x2',
27
- locale = 'fa',
28
- clockTime = 24
29
- } = props
30
- useMemo(() => localeCache.setLocale(locale), [locale])
31
-
32
- const inputRef = useRef<HTMLInputElement>(null)
33
- const containerRef = useRef<HTMLDivElement>(null)
34
-
35
- const [showCalendar, setShowCalendar] = useState<boolean>(false)
36
- const [timeConvention, setTimeConvention] = useState<'am' | 'pm'>('am')
37
-
38
- useClickOutside(containerRef, () => setShowCalendar(false))
39
- const toggleShowCalendar = () => {
40
- setShowCalendar(!showCalendar)
41
- }
42
- const {
43
- hour,
44
- minute,
45
- isInsideHour,
46
- selectingHour,
47
- handleMouseMove,
48
- handleMouseUp,
49
- handleSelecting
50
- } = useTimePicker({ defaultValue, clockTime, timeConvention, onChange })
51
-
52
- const getInputValue = useMemo(() => {
53
- return `${hour}:${minute}`
54
- }, [hour, minute])
55
- return (
56
- <CalendarProvider accentColor={props.accentColor} round={round}>
57
- <input
58
- ref={inputRef}
59
- {...props?.inputAttributes}
60
- onClick={toggleShowCalendar}
61
- type="text"
62
- value={getInputValue}
63
- className={props.inputClass !== null ? props.inputClass : ''}
64
- readOnly
65
- />
66
- <RenderCalendar
67
- toggleOpen={toggleShowCalendar}
68
- showCalendar={showCalendar}
69
- destinationRef={inputRef}
70
- >
71
- <CalendarWrapper ref={containerRef}>
72
- <TimeWrapper>
73
- {clockTime === 12 ? (
74
- <ClockTimeWrapper>
75
- <ClockTime
76
- className={timeConvention === 'am' ? 'cl_selected' : ''}
77
- onClick={() => setTimeConvention('am')}
78
- >
79
- {locales[locale].am}
80
- </ClockTime>
81
- <ClockTime
82
- className={timeConvention === 'pm' ? 'cl_selected' : ''}
83
- onClick={() => setTimeConvention('pm')}
84
- >
85
- {locales[locale].pm}
86
- </ClockTime>
87
- </ClockTimeWrapper>
88
- ) : null}
89
- <Time>
90
- {localizeNumber(hour)}:{localizeNumber(minute)}
91
- </Time>
92
- </TimeWrapper>
93
- <Clock
94
- onMouseMove={handleMouseMove}
95
- onMouseUp={handleMouseUp}
96
- onMouseDown={handleSelecting}
97
- onTouchMove={handleSelecting}
98
- onTouchEnd={handleMouseUp}
99
- >
100
- <Hand
101
- value={selectingHour ? hour : minute}
102
- hour={hour}
103
- minute={minute}
104
- isSelectingHour={selectingHour}
105
- isInsideHour={isInsideHour}
106
- >
107
- <HandCircle isSelectingHour={selectingHour} />
108
- </Hand>
109
- <Numbers
110
- insideHour={isInsideHour}
111
- hourSelecting={selectingHour}
112
- clockTime={clockTime}
113
- />
114
- </Clock>
115
- </CalendarWrapper>
116
- </RenderCalendar>
117
- </CalendarProvider>
118
- )
119
- }
120
-
121
- export default TimePicker
@@ -1,16 +0,0 @@
1
- import type { InputHTMLAttributes } from 'react'
2
- import type { BaseProps, DatePickerValue } from '../../types'
3
-
4
- export interface onChangePayload {
5
- hour: number
6
- minute: number
7
- timeConvention?: 'am' | 'pm'
8
- }
9
-
10
- export interface TimePickerProps extends BaseProps {
11
- defaultValue?: DatePickerValue
12
- clockTime?: 12 | 24
13
- onChange?: (payload: onChangePayload) => void
14
- inputClass?: string
15
- inputAttributes?: InputHTMLAttributes<HTMLInputElement>
16
- }
@@ -1,36 +0,0 @@
1
- import styled from '@emotion/styled'
2
- import { numberPositionX, numberPositionY } from '../../../../utils/timePicker'
3
- import { fade } from '../../../../style/animation'
4
- import type { NumbersItemProps } from './Numbers.types'
5
-
6
- export const MinuteWithAnimation = styled('div')`
7
- animation: ${fade} 0.7s linear alternate;
8
- `
9
-
10
- export const NumbersItem = styled.span<NumbersItemProps>`
11
- left: calc(50% - 16px);
12
- top: ${(props) => props.top};
13
- width: 32px;
14
- height: 32px;
15
- display: inline-flex;
16
- position: absolute;
17
- align-items: center;
18
- border-radius: 32px;
19
- justify-content: center;
20
- user-select: none;
21
- pointer-events: none;
22
- color: black;
23
- transform: ${(props) =>
24
- `translate(${numberPositionX(
25
- props.idx,
26
- props.clockHalfWidth,
27
- props.numbersPadd
28
- )}px,
29
- ${numberPositionY(props.idx, props.clockHalfWidth, props.numbersPadd)}px)`};
30
- `
31
-
32
- NumbersItem.defaultProps = {
33
- clockHalfWidth: 130,
34
- numbersPadd: 24,
35
- top: '2%'
36
- }
@@ -1,58 +0,0 @@
1
- import React from 'react'
2
- import { hours, hours24, minutes } from '../../../../utils/timePicker'
3
- import { MinuteWithAnimation, NumbersItem } from './Numbers.styled'
4
- import { localizeNumber } from '../../../../utils'
5
- import type { NumbersProps } from './Numbers.types'
6
-
7
- export const Hours = (props: NumbersProps) => {
8
- const { insideHour, hourSelecting, clockTime } = props
9
- if (!hourSelecting) {
10
- return (
11
- <MinuteWithAnimation>
12
- {minutes.map((m, i) => (
13
- <NumbersItem key={m} idx={i}>
14
- {localizeNumber(m)}
15
- </NumbersItem>
16
- ))}
17
- </MinuteWithAnimation>
18
- )
19
- }
20
- if (clockTime === 12) {
21
- return (
22
- <>
23
- {hours.map((h, i) => (
24
- <NumbersItem
25
- key={h}
26
- idx={i}
27
- style={{ opacity: !insideHour ? 1 : 0.3 }}
28
- >
29
- {localizeNumber(h)}
30
- </NumbersItem>
31
- ))}
32
- </>
33
- )
34
- }
35
- return (
36
- <>
37
- {hours.map((h, i) => (
38
- <NumbersItem
39
- key={h}
40
- idx={i}
41
- top="15%"
42
- clockHalfWidth={85}
43
- numbersPadd={10}
44
- style={{ opacity: insideHour ? 1 : 0.3 }}
45
- >
46
- {localizeNumber(h)}
47
- </NumbersItem>
48
- ))}
49
- {hours24.map((h, i) => (
50
- <NumbersItem key={h} idx={i} style={{ opacity: !insideHour ? 1 : 0.3 }}>
51
- {localizeNumber(h)}
52
- </NumbersItem>
53
- ))}
54
- </>
55
- )
56
- }
57
-
58
- export default Hours
@@ -1,14 +0,0 @@
1
- export interface NumbersProps {
2
- insideHour: boolean
3
- hourSelecting: boolean
4
- clockTime: 12 | 24
5
- }
6
-
7
- export interface NumbersItemProps {
8
- idx: number
9
- clockHalfWidth?: number
10
- numbersPadd?: number
11
- top?: string
12
- insideHour?: boolean
13
- isSelectedNumber?: boolean
14
- }
@@ -1 +0,0 @@
1
- export { default } from './Numbers'
@@ -1,2 +0,0 @@
1
- export { default } from './TimePicker'
2
- export type { TimePickerProps } from './TimePicker.types'
@@ -1,23 +0,0 @@
1
- import { keyframes } from '@emotion/react'
2
-
3
- export const slideDown = keyframes`
4
- from {
5
- visibility: hidden;
6
- opacity: 0;
7
- transform: translateY(-4px);
8
- }
9
- to {
10
- visibility: visible;
11
- opacity: 1;
12
- transform: translateY(0px);
13
- }
14
- `
15
-
16
- export const fade = keyframes`
17
- from {
18
- opacity: 0;
19
- }
20
- to {
21
- opacity: 1;
22
- }
23
- `
@@ -1,8 +0,0 @@
1
- export const MonthYearButton = 'zm-MonthYearButton'
2
- export const IconNextButton = 'zm-IconNextButton'
3
- export const IconPrevButton = 'zm-IconPrevButton'
4
- export const HeaderClass = 'zm-Header'
5
- export const DaysButton = 'zm-DaysButton'
6
-
7
- export const MonthPickerButton = 'zm-MonthPickerButton'
8
- export const YearPickerButton = 'zm-YearPickerButton'
@@ -1,16 +0,0 @@
1
- import hexToHSL from './hexToHSL'
2
- const getHsl = (h: number, s: number, l: number) => {
3
- return `hsl(${h}deg ${s}% ${l}%)`
4
- }
5
- export const makeColorPallet = (accentColor: string) => {
6
- const { h, s, l } = hexToHSL(accentColor)
7
- const result: Record<number, string> = {}
8
-
9
- result[40] = getHsl(h, s, l - 10)
10
- result[50] = getHsl(h, s, l)
11
- result[85] = getHsl(h, s, 85)
12
- result[90] = getHsl(h, s, 90)
13
- result[95] = getHsl(h, s, 95)
14
-
15
- return result
16
- }
@@ -1,15 +0,0 @@
1
- export const gray: Record<number, string> = {
2
- 0: '#FFFFFF',
3
- 20: '#F5F5F5',
4
- 30: '#EBEBEB',
5
- 40: '#DEDEDE',
6
- 50: '#BFBFBF',
7
- 60: '#B0B0B0',
8
- 70: '#575757',
9
- 80: '#666666',
10
- 600: '#2E2E2E'
11
- }
12
-
13
- export default {
14
- gray
15
- }
@@ -1,52 +0,0 @@
1
- export function hexToHSL(hex: string): { h: number; s: number; l: number } {
2
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
3
-
4
- if (result == null) {
5
- throw new Error('Could not parse Hex Color')
6
- }
7
-
8
- const rHex = parseInt(result[1], 16)
9
- const gHex = parseInt(result[2], 16)
10
- const bHex = parseInt(result[3], 16)
11
-
12
- const r = rHex / 255
13
- const g = gHex / 255
14
- const b = bHex / 255
15
-
16
- const max = Math.max(r, g, b)
17
- const min = Math.min(r, g, b)
18
-
19
- let h = (max + min) / 2
20
- let s = h
21
- let l = h
22
-
23
- if (max === min) {
24
- // Achromatic
25
- return { h: 0, s: 0, l }
26
- }
27
-
28
- const d = max - min
29
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
30
- switch (max) {
31
- case r:
32
- h = (g - b) / d + (g < b ? 6 : 0)
33
- break
34
- case g:
35
- h = (b - r) / d + 2
36
- break
37
- case b:
38
- h = (r - g) / d + 4
39
- break
40
- }
41
- h /= 6
42
-
43
- s = s * 100
44
- s = Math.round(s)
45
- l = l * 100
46
- l = Math.round(l)
47
- h = Math.round(360 * h)
48
-
49
- return { h, s, l }
50
- }
51
-
52
- export default hexToHSL
@@ -1,28 +0,0 @@
1
- export type Radius = 'thin' | 'x1' | 'x2' | 'x3' | 'x4'
2
-
3
- interface radiusObject {
4
- wrapper: number
5
- calendarItem: number
6
- }
7
- export const radius: Record<Radius, radiusObject> = {
8
- thin: {
9
- wrapper: 0,
10
- calendarItem: 0
11
- },
12
- x1: {
13
- wrapper: 8,
14
- calendarItem: 4
15
- },
16
- x2: {
17
- wrapper: 16,
18
- calendarItem: 8
19
- },
20
- x3: {
21
- wrapper: 24,
22
- calendarItem: 16
23
- },
24
- x4: {
25
- wrapper: 24,
26
- calendarItem: 20
27
- }
28
- }