@npm_leadtech/legal-lib-components 4.1.18 → 4.1.20
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/dist/css/styles.css +0 -801
- package/dist/index.js +0 -14679
- package/dist/index.js.map +4 -4
- package/dist/src/components/atoms/index.d.ts +0 -1
- package/dist/src/components/atoms/index.js +0 -1
- package/dist/src/components/atoms/index.ts +0 -1
- package/dist/src/globalStyles/styles.scss +2 -2
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +1 -2
- package/dist/src/index.ts +0 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/src/components/atoms/DatePickerCustom/DatePickerCustom.d.ts +0 -4
- package/dist/src/components/atoms/DatePickerCustom/DatePickerCustom.js +0 -79
- package/dist/src/components/atoms/DatePickerCustom/DatePickerCustom.scss +0 -116
- package/dist/src/components/atoms/DatePickerCustom/DatePickerCustom.tsx +0 -178
- package/dist/src/components/atoms/DatePickerCustom/DatePickerCustomProps.types.d.ts +0 -17
- package/dist/src/components/atoms/DatePickerCustom/DatePickerCustomProps.types.js +0 -1
- package/dist/src/components/atoms/DatePickerCustom/DatePickerCustomProps.types.ts +0 -17
- package/dist/src/components/atoms/DatePickerCustom/DatepickerPlugin.scss +0 -842
- package/dist/src/components/atoms/DatePickerCustom/index.d.ts +0 -2
- package/dist/src/components/atoms/DatePickerCustom/index.js +0 -1
- package/dist/src/components/atoms/DatePickerCustom/index.js.map +0 -7
- package/dist/src/components/atoms/DatePickerCustom/index.ts +0 -2
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import DatePicker, { registerLocale } from 'react-datepicker'
|
|
2
|
-
import React, { type FC, useState } from 'react'
|
|
3
|
-
import { de } from 'date-fns/locale'
|
|
4
|
-
|
|
5
|
-
import { type DatePickerCustomProps } from './DatePickerCustomProps.types'
|
|
6
|
-
// import './DatePickerCustom.scss'
|
|
7
|
-
// import './DatepickerPlugin.scss'
|
|
8
|
-
|
|
9
|
-
registerLocale('de', de)
|
|
10
|
-
|
|
11
|
-
const DatePickerCustom: FC<DatePickerCustomProps> = ({
|
|
12
|
-
class: className,
|
|
13
|
-
dateFormat = 'MM/dd/yyyy',
|
|
14
|
-
isStartDate = false,
|
|
15
|
-
isValidGroup = false,
|
|
16
|
-
label,
|
|
17
|
-
locale = 'en',
|
|
18
|
-
name,
|
|
19
|
-
onChange,
|
|
20
|
-
relatedDate,
|
|
21
|
-
tooltip,
|
|
22
|
-
type,
|
|
23
|
-
validate = false,
|
|
24
|
-
value
|
|
25
|
-
}): React.JSX.Element => {
|
|
26
|
-
const [date, setDate] = useState(() => {
|
|
27
|
-
return typeof value === 'string' && value !== '' ? new Date(value) : null
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const returnYears = (currentYear: number): React.JSX.Element[] => {
|
|
31
|
-
const years: React.JSX.Element[] = []
|
|
32
|
-
const minYear = new Date().getFullYear() - 100
|
|
33
|
-
const maxYear = new Date().getFullYear() + 500
|
|
34
|
-
|
|
35
|
-
for (let i = minYear; i <= maxYear; i++) {
|
|
36
|
-
years.push(
|
|
37
|
-
<option key={i} value={i} defaultValue={currentYear}>
|
|
38
|
-
{i}
|
|
39
|
-
</option>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return years
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const handleChange = (date: Date | null): void => {
|
|
47
|
-
setDate(date)
|
|
48
|
-
if (onChange != null) {
|
|
49
|
-
const dateObject = {
|
|
50
|
-
target: {
|
|
51
|
-
name,
|
|
52
|
-
value: date
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
onChange(dateObject)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const addDays = (date, days): Date => {
|
|
60
|
-
const result = new Date(date)
|
|
61
|
-
result.setDate(result.getDate() + days)
|
|
62
|
-
return result
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const classStyle = `${validate ? 'e-datepicker' : 'e-datepicker is-invalid'} ${className ?? ''} e-${type} ${
|
|
66
|
-
!isValidGroup ? '--group-invalid' : ''
|
|
67
|
-
}\``
|
|
68
|
-
|
|
69
|
-
let minDate
|
|
70
|
-
let maxDate
|
|
71
|
-
if (relatedDate != null) {
|
|
72
|
-
if (isStartDate) {
|
|
73
|
-
maxDate = relatedDate
|
|
74
|
-
maxDate = addDays(maxDate, -1)
|
|
75
|
-
} else {
|
|
76
|
-
minDate = relatedDate
|
|
77
|
-
minDate = addDays(minDate, 1)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const TooltipObject = tooltip !== undefined ? <p className='tooltip-form sans-serif --small'>{tooltip}</p> : ''
|
|
82
|
-
|
|
83
|
-
const actualYear = new Date().getFullYear()
|
|
84
|
-
|
|
85
|
-
const intlForMonths = new Intl.DateTimeFormat(locale, { month: 'long' })
|
|
86
|
-
const months = [...Array(12).keys()].map((monthIndex) => {
|
|
87
|
-
const monthName = intlForMonths.format(new Date(actualYear, monthIndex))
|
|
88
|
-
return {
|
|
89
|
-
monthName
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<div className={classStyle} data-qa={name}>
|
|
95
|
-
{TooltipObject}
|
|
96
|
-
<DatePicker
|
|
97
|
-
locale={locale}
|
|
98
|
-
dateFormat={dateFormat}
|
|
99
|
-
renderCustomHeader={({
|
|
100
|
-
date,
|
|
101
|
-
changeYear,
|
|
102
|
-
changeMonth,
|
|
103
|
-
decreaseMonth,
|
|
104
|
-
increaseMonth,
|
|
105
|
-
prevMonthButtonDisabled,
|
|
106
|
-
nextMonthButtonDisabled
|
|
107
|
-
}) => (
|
|
108
|
-
<div
|
|
109
|
-
style={{
|
|
110
|
-
margin: 10,
|
|
111
|
-
display: 'flex',
|
|
112
|
-
justifyContent: 'center'
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
<button
|
|
116
|
-
className='DayPickerNavigation_leftButton'
|
|
117
|
-
onClick={decreaseMonth}
|
|
118
|
-
disabled={prevMonthButtonDisabled}
|
|
119
|
-
>
|
|
120
|
-
{'<'}
|
|
121
|
-
</button>
|
|
122
|
-
<select
|
|
123
|
-
className='CalendarYear'
|
|
124
|
-
value={date.getFullYear()}
|
|
125
|
-
onChange={({ target: { value } }) => {
|
|
126
|
-
changeYear(Number(value))
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
{returnYears(date.getFullYear())}
|
|
130
|
-
</select>
|
|
131
|
-
|
|
132
|
-
<select
|
|
133
|
-
className='CalendarMonth'
|
|
134
|
-
value={date.getMonth()}
|
|
135
|
-
onChange={({ target: { value } }) => {
|
|
136
|
-
changeMonth(Number(value))
|
|
137
|
-
}}
|
|
138
|
-
>
|
|
139
|
-
{months.map(({ monthName }, value) => (
|
|
140
|
-
<option key={monthName} value={value} defaultValue={date.getMonth()}>
|
|
141
|
-
{monthName}
|
|
142
|
-
</option>
|
|
143
|
-
))}
|
|
144
|
-
</select>
|
|
145
|
-
|
|
146
|
-
<button
|
|
147
|
-
className='DayPickerNavigation_rightButton'
|
|
148
|
-
onClick={increaseMonth}
|
|
149
|
-
disabled={nextMonthButtonDisabled}
|
|
150
|
-
>
|
|
151
|
-
{'>'}
|
|
152
|
-
</button>
|
|
153
|
-
</div>
|
|
154
|
-
)}
|
|
155
|
-
selected={date}
|
|
156
|
-
minDate={minDate}
|
|
157
|
-
maxDate={maxDate}
|
|
158
|
-
onChange={(date: Date | null) => {
|
|
159
|
-
handleChange(date)
|
|
160
|
-
}}
|
|
161
|
-
popperPlacement='bottom'
|
|
162
|
-
popperModifiers={[
|
|
163
|
-
{
|
|
164
|
-
name: 'flip',
|
|
165
|
-
options: {
|
|
166
|
-
fallbackPlacements: ['bottom']
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
]}
|
|
170
|
-
/>
|
|
171
|
-
<div className={'e-datepicker__inner'}>
|
|
172
|
-
<label className={'e-datepicker__label'}>{label}</label>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export default DatePickerCustom
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface DatePickerCustomProps {
|
|
2
|
-
id?: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
class?: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
focused?: boolean;
|
|
7
|
-
validate?: boolean;
|
|
8
|
-
tooltip?: string;
|
|
9
|
-
isValidGroup?: boolean;
|
|
10
|
-
label?: string;
|
|
11
|
-
locale: string;
|
|
12
|
-
isStartDate?: boolean;
|
|
13
|
-
relatedDate?: Date;
|
|
14
|
-
type?: string;
|
|
15
|
-
dateFormat?: string;
|
|
16
|
-
onChange?: (dateObject: any) => void;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface DatePickerCustomProps {
|
|
2
|
-
id?: string
|
|
3
|
-
name?: string
|
|
4
|
-
class?: string
|
|
5
|
-
value?: string
|
|
6
|
-
focused?: boolean
|
|
7
|
-
validate?: boolean
|
|
8
|
-
tooltip?: string
|
|
9
|
-
isValidGroup?: boolean
|
|
10
|
-
label?: string
|
|
11
|
-
locale: string
|
|
12
|
-
isStartDate?: boolean
|
|
13
|
-
relatedDate?: Date
|
|
14
|
-
type?: string
|
|
15
|
-
dateFormat?: string
|
|
16
|
-
onChange?: (dateObject: any) => void
|
|
17
|
-
}
|