kahuna-base-react-components 1.4.1 → 1.4.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.
- package/dist/components/KSelectRangeDate/KSelectRangeDate.d.ts +1 -0
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/languages/index.d.ts +6 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/KSelectRangeDate/KSelectRangeDate.stories.tsx +3 -1
- package/src/components/KSelectRangeDate/KSelectRangeDate.tsx +10 -6
- package/src/languages/en.json +3 -0
- package/src/languages/tr.json +3 -0
|
@@ -24,6 +24,9 @@ export declare const getLanguageJson: () => {
|
|
|
24
24
|
last_three_days: string;
|
|
25
25
|
last_week: string;
|
|
26
26
|
last_two_weeks: string;
|
|
27
|
+
last_seven_days: string;
|
|
28
|
+
last_fourteen_days: string;
|
|
29
|
+
last_twenty_eight_days: string;
|
|
27
30
|
last_month: string;
|
|
28
31
|
last_three_months: string;
|
|
29
32
|
last_six_months: string;
|
|
@@ -60,6 +63,9 @@ export declare const lang: {
|
|
|
60
63
|
last_three_days: string;
|
|
61
64
|
last_week: string;
|
|
62
65
|
last_two_weeks: string;
|
|
66
|
+
last_seven_days: string;
|
|
67
|
+
last_fourteen_days: string;
|
|
68
|
+
last_twenty_eight_days: string;
|
|
63
69
|
last_month: string;
|
|
64
70
|
last_three_months: string;
|
|
65
71
|
last_six_months: string;
|
package/dist/types.d.ts
CHANGED
|
@@ -347,6 +347,7 @@ interface KSelectRangeDateProps {
|
|
|
347
347
|
popupCalendarBackground?: string;
|
|
348
348
|
hideBackdrop?: boolean;
|
|
349
349
|
weeklyMode?: boolean;
|
|
350
|
+
shorthandEndDateOffsetDays?: number;
|
|
350
351
|
}
|
|
351
352
|
type DateRangeType = Date | null | [Date | null, Date | null];
|
|
352
353
|
declare const KSelectRangeDate: React.FC<KSelectRangeDateProps>;
|
package/package.json
CHANGED
|
@@ -71,6 +71,7 @@ KSelectRangePrimary.args = {
|
|
|
71
71
|
align: "center",
|
|
72
72
|
hideBackdrop: true,
|
|
73
73
|
anchorToButton: true,
|
|
74
|
+
shorthandEndDateOffsetDays: 5,
|
|
74
75
|
|
|
75
76
|
onChange: (value) => {
|
|
76
77
|
if (value) {
|
|
@@ -113,7 +114,8 @@ KSelectRangeDateMinimumDate.args = {
|
|
|
113
114
|
anchorToButton: true,
|
|
114
115
|
position: "top",
|
|
115
116
|
align: "center",
|
|
116
|
-
minimumDate: new Date(new Date().getTime()
|
|
117
|
+
minimumDate: new Date(new Date().getTime() - 2 * 24 * 60 * 60 * 1000),
|
|
118
|
+
maximumDate: new Date(new Date().getTime() - 2 * 24 * 60 * 60 * 1000),
|
|
117
119
|
|
|
118
120
|
onChange: (value) => {
|
|
119
121
|
if (value) {
|
|
@@ -32,6 +32,7 @@ export interface KSelectRangeDateProps {
|
|
|
32
32
|
popupCalendarBackground?: string
|
|
33
33
|
hideBackdrop?: boolean
|
|
34
34
|
weeklyMode?: boolean
|
|
35
|
+
shorthandEndDateOffsetDays?: number
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export type DateRangeType = Date | null | [Date | null, Date | null]
|
|
@@ -111,8 +112,11 @@ const KSelectRangeDate: React.FC<KSelectRangeDateProps> = (props) => {
|
|
|
111
112
|
const month = theDate.getMonth()
|
|
112
113
|
const day = theDate.getDate()
|
|
113
114
|
|
|
114
|
-
const
|
|
115
|
-
|
|
115
|
+
const delta = props.shorthandEndDateOffsetDays ?? 0
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const endDate = new Date(year, month, day - delta)
|
|
119
|
+
const startDate = new Date(year, month, day - delta - (range - 1))
|
|
116
120
|
setRange([startDate, endDate])
|
|
117
121
|
}
|
|
118
122
|
|
|
@@ -305,7 +309,7 @@ const KSelectRangeDate: React.FC<KSelectRangeDateProps> = (props) => {
|
|
|
305
309
|
width="140px"
|
|
306
310
|
background={shorthandIndex.current === 2 ? "#F7F7F7" : "#FFF"}
|
|
307
311
|
textColor={shorthandIndex.current === 2 ? "#000" : "#999"}
|
|
308
|
-
text={lang.button_text.
|
|
312
|
+
text={lang.button_text.last_seven_days}
|
|
309
313
|
borderRadius={8}
|
|
310
314
|
shadowDisabled
|
|
311
315
|
hoverBackground="#F0F0F0"
|
|
@@ -319,7 +323,7 @@ const KSelectRangeDate: React.FC<KSelectRangeDateProps> = (props) => {
|
|
|
319
323
|
width="140px"
|
|
320
324
|
background={shorthandIndex.current === 3 ? "#F7F7F7" : "#FFF"}
|
|
321
325
|
textColor={shorthandIndex.current === 3 ? "#000" : "#999"}
|
|
322
|
-
text={lang.button_text.
|
|
326
|
+
text={lang.button_text.last_fourteen_days}
|
|
323
327
|
borderRadius={8}
|
|
324
328
|
shadowDisabled
|
|
325
329
|
hoverBackground="#F0F0F0"
|
|
@@ -327,13 +331,13 @@ const KSelectRangeDate: React.FC<KSelectRangeDateProps> = (props) => {
|
|
|
327
331
|
/>
|
|
328
332
|
<KButton
|
|
329
333
|
onClick={() => {
|
|
330
|
-
shorthandDateSelection(
|
|
334
|
+
shorthandDateSelection(28)
|
|
331
335
|
setShorthandIndex({ ...shorthandIndex, current: 4 })
|
|
332
336
|
}}
|
|
333
337
|
width="140px"
|
|
334
338
|
background={shorthandIndex.current === 4 ? "#F7F7F7" : "#FFF"}
|
|
335
339
|
textColor={shorthandIndex.current === 4 ? "#000" : "#999"}
|
|
336
|
-
text={lang.button_text.
|
|
340
|
+
text={lang.button_text.last_twenty_eight_days}
|
|
337
341
|
borderRadius={8}
|
|
338
342
|
shadowDisabled
|
|
339
343
|
hoverBackground="#F0F0F0"
|
package/src/languages/en.json
CHANGED
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
"last_three_days": "Last 3 days",
|
|
23
23
|
"last_week": "Last week",
|
|
24
24
|
"last_two_weeks": "Last 2 weeks",
|
|
25
|
+
"last_seven_days": "Last 7 days",
|
|
26
|
+
"last_fourteen_days": "Last 14 days",
|
|
27
|
+
"last_twenty_eight_days": "Last 28 days",
|
|
25
28
|
"last_month": "Last Month",
|
|
26
29
|
"last_three_months": "Last 3 months",
|
|
27
30
|
"last_six_months": "Last 6 months",
|
package/src/languages/tr.json
CHANGED
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
"last_three_days": "Son 3 gün",
|
|
23
23
|
"last_week": "Son hafta",
|
|
24
24
|
"last_two_weeks": "Son 2 hafta",
|
|
25
|
+
"last_seven_days": "Son 7 gün",
|
|
26
|
+
"last_fourteen_days": "Son 14 gün",
|
|
27
|
+
"last_twenty_eight_days": "Son 28 gün",
|
|
25
28
|
"last_month": "Son ay",
|
|
26
29
|
"last_three_months": "Son 3 ay",
|
|
27
30
|
"last_six_months": "Son 6 ay",
|