forstok-ui-lib 5.6.10 → 5.7.0
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/index.d.ts +144 -1
- package/dist/index.js +1422 -320
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1453 -351
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/rollup.config.js +4 -1
- package/src/assets/javascripts/function.ts +158 -1
- package/src/assets/javascripts/helper.ts +126 -0
- package/src/assets/stylesheets/shares.styles.ts +3112 -341
- package/src/components/date/daterange.tsx +45 -0
- package/src/components/date/daterangepicker.css +100 -0
- package/src/components/date/{styles.ts → styles.tsx} +16 -1
- package/src/components/date/typed.ts +3 -0
- package/src/components/select/index.tsx +1 -2
- package/src/assets/images/icons/filter copy.svg +0 -16
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import DateRangePicker from '@wojtekmaj/react-daterange-picker';
|
|
4
|
+
import { configDateRange } from '../../maps';
|
|
5
|
+
import '@wojtekmaj/react-daterange-picker/dist/DateRangePicker.css';
|
|
6
|
+
import 'react-calendar/dist/Calendar.css';
|
|
7
|
+
import './daterangepicker.css';
|
|
8
|
+
import { DateRangeWrapper } from './styles';
|
|
9
|
+
import { TValueDateRange } from './typed';
|
|
10
|
+
|
|
11
|
+
type TDateRangeComponent = {
|
|
12
|
+
$mode?: string;
|
|
13
|
+
startDate?: Date | null;
|
|
14
|
+
endDate?: Date | null;
|
|
15
|
+
evChange: (value: TValueDateRange) => void;
|
|
16
|
+
portalId?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const DateRangeComponent = ({ $mode, startDate, endDate, evChange, portalId }: TDateRangeComponent) => {
|
|
20
|
+
const _startDate: Date | null = startDate || moment(configDateRange.startDate, 'YYYY-MM-DD').toDate();
|
|
21
|
+
const _endDate: Date | null = endDate || moment(configDateRange.endDate, 'YYYY-MM-DD').toDate();
|
|
22
|
+
const minDate = moment(configDateRange.minDate, 'YYYY-MM-DD').toDate();
|
|
23
|
+
const maxDate = moment().toDate();
|
|
24
|
+
|
|
25
|
+
const [value, setValue] = useState<TValueDateRange>([_startDate, _endDate]);
|
|
26
|
+
|
|
27
|
+
const onChange = (value: TValueDateRange) => {
|
|
28
|
+
setValue(value);
|
|
29
|
+
evChange && evChange(value);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<DateRangeWrapper $mode={$mode}>
|
|
34
|
+
<DateRangePicker
|
|
35
|
+
minDate={minDate}
|
|
36
|
+
maxDate={maxDate}
|
|
37
|
+
onChange={onChange}
|
|
38
|
+
value={value}
|
|
39
|
+
clearIcon={null}
|
|
40
|
+
{...portalId && { portalContainer: document.getElementById(portalId) }} />
|
|
41
|
+
</DateRangeWrapper>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default DateRangeComponent;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
.react-daterange-picker {
|
|
2
|
+
font-family: var(--pri-ft-fm);
|
|
3
|
+
font-size: var(--pri-ft-sz);
|
|
4
|
+
color: var(--pri-clr);
|
|
5
|
+
background-color: var(--ter-clr-bg);
|
|
6
|
+
align-items: center;
|
|
7
|
+
border: 0;
|
|
8
|
+
border-radius: var(--sec-rd);
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
height: 30px;
|
|
11
|
+
padding: 0 26px 0 16px;
|
|
12
|
+
position: relative;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
.react-daterange-picker__wrapper {
|
|
16
|
+
border: 0;
|
|
17
|
+
width: 100%;
|
|
18
|
+
justify-content: left;
|
|
19
|
+
display: inline-grid;
|
|
20
|
+
grid-auto-flow: column;
|
|
21
|
+
}
|
|
22
|
+
.react-calendar {
|
|
23
|
+
background-color: var(--pri-clr-bg);
|
|
24
|
+
border: 1px solid var(--sec-clr-ln);
|
|
25
|
+
box-shadow: var(--sec-shd-bx);
|
|
26
|
+
border-radius: var(--sec-rd);
|
|
27
|
+
border: 1px solid #a0a096;
|
|
28
|
+
font-family: var(--pri-ft-fm);
|
|
29
|
+
font-size: var(--pri-ft-sz);
|
|
30
|
+
color: var(--pri-clr);
|
|
31
|
+
line-height: 1.125em;
|
|
32
|
+
padding: 10px 15px;
|
|
33
|
+
}
|
|
34
|
+
.react-calendar__navigation__label__labelText {
|
|
35
|
+
color: #000;
|
|
36
|
+
font-size: 1em;
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
height: 35px;
|
|
39
|
+
line-height: 35px;
|
|
40
|
+
position: relative;
|
|
41
|
+
text-align: center;
|
|
42
|
+
}
|
|
43
|
+
.react-calendar__tile {
|
|
44
|
+
font-size: 1em;
|
|
45
|
+
line-height: 1;
|
|
46
|
+
border-radius: 0;
|
|
47
|
+
}
|
|
48
|
+
.react-calendar__tile--now {
|
|
49
|
+
border-radius: 10px !important;
|
|
50
|
+
}
|
|
51
|
+
.react-calendar__tile--now.react-calendar__tile--active {
|
|
52
|
+
border-radius: 0 !important;
|
|
53
|
+
}
|
|
54
|
+
.react-calendar__tile--now.react-calendar__tile--rangeEnd.react-calendar__tile--active {
|
|
55
|
+
border-radius: 0 10px 10px 0 !important;
|
|
56
|
+
}
|
|
57
|
+
.react-calendar__tile--hover {
|
|
58
|
+
border-radius: 0;
|
|
59
|
+
}
|
|
60
|
+
.react-calendar__tile--active {
|
|
61
|
+
background-color: #fc5c64;
|
|
62
|
+
border: 1px solid #ec5b62;
|
|
63
|
+
}
|
|
64
|
+
.react-calendar__tile--active:enabled:hover, .react-calendar__tile--active:enabled:focus {
|
|
65
|
+
background-color: #fc5c64;
|
|
66
|
+
border: 1px solid #ec5b62;
|
|
67
|
+
}
|
|
68
|
+
.react-calendar__tile--rangeStart.react-calendar__tile--rangeEnd {
|
|
69
|
+
border-radius: 10px !important;
|
|
70
|
+
}
|
|
71
|
+
.react-calendar__tile--now.react-calendar__tile--rangeStart.react-calendar__tile--rangeEnd.react-calendar__tile--active {
|
|
72
|
+
border-radius: 10px !important;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
.react-calendar__tile--rangeStart, .react-calendar__tile--hoverStart {
|
|
77
|
+
border-radius: 10px 0px 0 10px !important;
|
|
78
|
+
}
|
|
79
|
+
.react-calendar__tile--rangeEnd, .react-calendar__tile--hoverEnd {
|
|
80
|
+
border-radius: 0 10px 10px 0 !important;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
.react-calendar__month-view__days {
|
|
85
|
+
gap: 1px 0;
|
|
86
|
+
}
|
|
87
|
+
.react-calendar__month-view__weekdays {
|
|
88
|
+
font-size: 1em;
|
|
89
|
+
}
|
|
90
|
+
.react-calendar__navigation__arrow {
|
|
91
|
+
font-size: 1.5em;
|
|
92
|
+
}
|
|
93
|
+
.react-daterange-picker__calendar {
|
|
94
|
+
z-index: 100;
|
|
95
|
+
}
|
|
96
|
+
.react-daterange-picker__button {
|
|
97
|
+
position: absolute;
|
|
98
|
+
right: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
@@ -398,4 +398,19 @@ export const DateRangePortalContainer = styled.div`
|
|
|
398
398
|
export const DateRangeIconContainer = styled.div`
|
|
399
399
|
display: flex;
|
|
400
400
|
padding: 0 0 0 12px;
|
|
401
|
-
`
|
|
401
|
+
`
|
|
402
|
+
export const DateRangeWrapper = styled.div<{ $mode?: string }>`
|
|
403
|
+
position: relative;
|
|
404
|
+
${({ $mode }: { $mode?: string }) => $mode === 'input' && css`
|
|
405
|
+
border: 1px solid var(--ck-clr-ln);
|
|
406
|
+
cursor: pointer;
|
|
407
|
+
height: 30px;
|
|
408
|
+
border-radius: var(--ter-rd);
|
|
409
|
+
background-color: rgb(255, 255, 255);
|
|
410
|
+
padding: 0px 2px 0px 8px;
|
|
411
|
+
.react-daterange-picker {
|
|
412
|
+
background-color: transparent;
|
|
413
|
+
padding: 0px;
|
|
414
|
+
}
|
|
415
|
+
`}
|
|
416
|
+
`;
|
|
@@ -280,8 +280,6 @@ const SelectComponent = ({ type, isError=false, mode, customOption, customLabel,
|
|
|
280
280
|
} as CSSObjectWithLabel),
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
console.log(customOption, "customOption")
|
|
284
|
-
|
|
285
283
|
let SelectEl = isCreateable ?
|
|
286
284
|
<CreatableSelect
|
|
287
285
|
options={options}
|
|
@@ -324,6 +322,7 @@ const SelectComponent = ({ type, isError=false, mode, customOption, customLabel,
|
|
|
324
322
|
{...mode === 'paymentReceiveStore' && { components: { Option: customOption, SingleValue: customLabel } }}
|
|
325
323
|
{...customLabel && { components: { SingleValue: customLabel } }}
|
|
326
324
|
{...MenuList && { components: { MenuList, Option: customOption } }}
|
|
325
|
+
{...(customLabel && customOption) && { components: { SingleValue: customLabel, Option: customOption } }}
|
|
327
326
|
{...selectKey && { key: selectKey }}
|
|
328
327
|
{...disabled && { isDisabled: disabled }}
|
|
329
328
|
{...isMulti && { closeMenuOnSelect: false }}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
|
|
3
|
-
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
4
|
-
<svg width="auto" height="auto" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
-
<title>filter-horizontal-solid</title>
|
|
6
|
-
<g id="Layer_2" data-name="Layer 2">
|
|
7
|
-
<g id="invisible_box" data-name="invisible box">
|
|
8
|
-
<rect width="48" height="48" fill="none"/>
|
|
9
|
-
</g>
|
|
10
|
-
<g id="icons_Q2" data-name="icons Q2">
|
|
11
|
-
<path d="M41.8,8H21.7A6.2,6.2,0,0,0,16,4a6,6,0,0,0-5.6,4H6.2A2.1,2.1,0,0,0,4,10a2.1,2.1,0,0,0,2.2,2h4.2A6,6,0,0,0,16,16a6.2,6.2,0,0,0,5.7-4H41.8A2.1,2.1,0,0,0,44,10,2.1,2.1,0,0,0,41.8,8Z"/>
|
|
12
|
-
<path d="M41.8,22H37.7A6.2,6.2,0,0,0,32,18a6,6,0,0,0-5.6,4H6.2a2,2,0,1,0,0,4H26.4A6,6,0,0,0,32,30a6.2,6.2,0,0,0,5.7-4h4.1a2,2,0,1,0,0-4Z"/>
|
|
13
|
-
<path d="M41.8,36H24.7A6.2,6.2,0,0,0,19,32a6,6,0,0,0-5.6,4H6.2a2,2,0,1,0,0,4h7.2A6,6,0,0,0,19,44a6.2,6.2,0,0,0,5.7-4H41.8a2,2,0,1,0,0-4Z"/>
|
|
14
|
-
</g>
|
|
15
|
-
</g>
|
|
16
|
-
</svg>
|