@trackunit/react-date-and-time-components 1.13.38 → 1.14.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/index.cjs.js +84 -84
- package/index.esm.js +84 -84
- package/package.json +9 -9
- package/src/index.d.ts +10 -3
- package/translation.cjs6.js +1 -1
- package/translation.esm6.js +1 -1
- package/src/DayRangeSelect/index.d.ts +0 -6
- package/src/Timeline/index.d.ts +0 -2
- package/src/dateTime/index.d.ts +0 -2
package/index.cjs.js
CHANGED
|
@@ -137,6 +137,90 @@ const DateTimeHumanized = ({ value }) => {
|
|
|
137
137
|
return (jsxRuntime.jsx(reactComponents.Tooltip, { label: jsxRuntime.jsx(DateTime, { format: tooltipFormat, value: value }), children: jsxRuntime.jsx(DateTime, { className: "underline decoration-neutral-300 decoration-dotted", fromNow: true, value: value }) }));
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
+
const temporalArithmeticTypeMapping = {
|
|
141
|
+
day: "days",
|
|
142
|
+
days: "days",
|
|
143
|
+
hour: "hours",
|
|
144
|
+
hours: "hours",
|
|
145
|
+
month: "months",
|
|
146
|
+
months: "months",
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Calculate a date range based on a temporal period.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* getDataRange({ direction: "next", count: 7, unit: "days" }); // { from: 2025-06-01, to: 2025-07-01 }
|
|
154
|
+
* getDataRange({ direction: "last", count: 14, unit: "days" }); // { from: 2025-05-24, to: 2025-06-01 }
|
|
155
|
+
*/
|
|
156
|
+
const useCalculateDateRange = () => {
|
|
157
|
+
const { nowDate, startOf, endOf, subtract, add } = reactDateAndTimeHooks.useDateAndTime();
|
|
158
|
+
return react.useCallback(({ direction, count, unit }) => {
|
|
159
|
+
const unitType = temporalArithmeticTypeMapping[unit];
|
|
160
|
+
if (direction === "next") {
|
|
161
|
+
// To get the right number of days, calculate the end date and subtract 1 day
|
|
162
|
+
const endDate = add(nowDate, count, unitType);
|
|
163
|
+
const adjustedEndDate = subtract(endDate, 1, "days");
|
|
164
|
+
return {
|
|
165
|
+
start: startOf(nowDate, "day"),
|
|
166
|
+
end: endOf(adjustedEndDate, "day"),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// To get the right number of days, calculate the start date and add 1 day
|
|
171
|
+
const startDate = subtract(nowDate, count, unitType);
|
|
172
|
+
const adjustedStartDate = add(startDate, 1, "days");
|
|
173
|
+
return {
|
|
174
|
+
start: startOf(adjustedStartDate, "day"),
|
|
175
|
+
end: endOf(nowDate, "day"),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}, [nowDate, startOf, endOf, subtract, add]);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The DayPicker component is used when the user needs to select a date.
|
|
183
|
+
|
|
184
|
+
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
185
|
+
* @returns {ReactElement} DayPicker component
|
|
186
|
+
*/
|
|
187
|
+
const DayPicker = ({ onDaySelect, disabledDays, selectedDay, language, className, "data-testid": dataTestId, }) => {
|
|
188
|
+
const { subtract } = reactDateAndTimeHooks.useDateAndTime();
|
|
189
|
+
const calculateDateRange = useCalculateDateRange();
|
|
190
|
+
return (jsxRuntime.jsx("div", { "data-testid": dataTestId, children: jsxRuntime.jsx(Calendar, { activeStartDate: selectedDay ?? undefined, allowPartialRange: true, className: tailwindMerge.twMerge("custom-day-picker", "range-picker", className, "p-0"), locale: language, onChange: value => {
|
|
191
|
+
if (value) {
|
|
192
|
+
onDaySelect?.(value);
|
|
193
|
+
}
|
|
194
|
+
}, selectRange: false, tileDisabled: ({ date, view }) => {
|
|
195
|
+
if (view === "month") {
|
|
196
|
+
if (typeof disabledDays === "function") {
|
|
197
|
+
return disabledDays(date);
|
|
198
|
+
}
|
|
199
|
+
if (Array.isArray(disabledDays)) {
|
|
200
|
+
return disabledDays.some(dateToCheck => {
|
|
201
|
+
return dateToCheck instanceof Date && dateToCheck.toDateString() === date.toDateString();
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
if (typeof disabledDays === "object" && "after" in disabledDays && "before" in disabledDays) {
|
|
205
|
+
return !(date.getTime() >
|
|
206
|
+
(disabledDays.before ? subtract(disabledDays.before, 1, "days").getTime() : date.getTime()) &&
|
|
207
|
+
date.getTime() < (disabledDays.after?.getTime() ?? date.getTime()));
|
|
208
|
+
}
|
|
209
|
+
if (typeof disabledDays === "object" && "furtherBackThanDays" in disabledDays) {
|
|
210
|
+
const dateRange = calculateDateRange({
|
|
211
|
+
direction: "last",
|
|
212
|
+
count: disabledDays.furtherBackThanDays,
|
|
213
|
+
unit: "day",
|
|
214
|
+
});
|
|
215
|
+
if (dateRange.start && dateRange.end) {
|
|
216
|
+
return date < dateRange.start || date > dateRange.end;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
}, value: selectedDay ?? null }) }));
|
|
222
|
+
};
|
|
223
|
+
|
|
140
224
|
/**
|
|
141
225
|
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
142
226
|
*
|
|
@@ -216,47 +300,6 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, "data-testi
|
|
|
216
300
|
newRange.end ? [newRange.start ?? null, newRange.end ?? null] : (newRange.start ?? null) }), jsxRuntime.jsx("hr", {}), jsxRuntime.jsxs("div", { className: "flex w-full justify-between gap-2 px-4 py-3", children: [jsxRuntime.jsx(reactComponents.Button, { className: "mr-auto", "data-testid": "range-popover-clear-button", onClick: clearSelectedDays, size: "small", variant: "secondary", children: t("layout.actions.clear") }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Button, { "data-testid": "range-popover-cancel-button", onClick: () => handleCancel(), size: "small", variant: "ghost-neutral", children: cancelButtonLabel ? cancelButtonLabel : t("layout.actions.cancel") }), jsxRuntime.jsx(reactComponents.Button, { "data-testid": "range-popover-apply-button", disabled: !newRange.start || !newRange.end, onClick: () => handleApply(), size: "small", children: t("layout.actions.apply") })] })] })] }));
|
|
217
301
|
};
|
|
218
302
|
|
|
219
|
-
const temporalArithmeticTypeMapping = {
|
|
220
|
-
day: "days",
|
|
221
|
-
days: "days",
|
|
222
|
-
hour: "hours",
|
|
223
|
-
hours: "hours",
|
|
224
|
-
month: "months",
|
|
225
|
-
months: "months",
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Calculate a date range based on a temporal period.
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* getDataRange({ direction: "next", count: 7, unit: "days" }); // { from: 2025-06-01, to: 2025-07-01 }
|
|
233
|
-
* getDataRange({ direction: "last", count: 14, unit: "days" }); // { from: 2025-05-24, to: 2025-06-01 }
|
|
234
|
-
*/
|
|
235
|
-
const useCalculateDateRange = () => {
|
|
236
|
-
const { nowDate, startOf, endOf, subtract, add } = reactDateAndTimeHooks.useDateAndTime();
|
|
237
|
-
return react.useCallback(({ direction, count, unit }) => {
|
|
238
|
-
const unitType = temporalArithmeticTypeMapping[unit];
|
|
239
|
-
if (direction === "next") {
|
|
240
|
-
// To get the right number of days, calculate the end date and subtract 1 day
|
|
241
|
-
const endDate = add(nowDate, count, unitType);
|
|
242
|
-
const adjustedEndDate = subtract(endDate, 1, "days");
|
|
243
|
-
return {
|
|
244
|
-
start: startOf(nowDate, "day"),
|
|
245
|
-
end: endOf(adjustedEndDate, "day"),
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
// To get the right number of days, calculate the start date and add 1 day
|
|
250
|
-
const startDate = subtract(nowDate, count, unitType);
|
|
251
|
-
const adjustedStartDate = add(startDate, 1, "days");
|
|
252
|
-
return {
|
|
253
|
-
start: startOf(adjustedStartDate, "day"),
|
|
254
|
-
end: endOf(nowDate, "day"),
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
}, [nowDate, startOf, endOf, subtract, add]);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
303
|
/**
|
|
261
304
|
* Format a temporal period into a label.
|
|
262
305
|
*
|
|
@@ -650,49 +693,6 @@ const DayRangeSelect = ({ className, "data-testid": dataTestId, disabled, select
|
|
|
650
693
|
} })] }));
|
|
651
694
|
};
|
|
652
695
|
|
|
653
|
-
/**
|
|
654
|
-
* The DayPicker component is used when the user needs to select a date.
|
|
655
|
-
|
|
656
|
-
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
657
|
-
* @returns {ReactElement} DayPicker component
|
|
658
|
-
*/
|
|
659
|
-
const DayPicker = ({ onDaySelect, disabledDays, selectedDay, language, className, "data-testid": dataTestId, }) => {
|
|
660
|
-
const { subtract } = reactDateAndTimeHooks.useDateAndTime();
|
|
661
|
-
const calculateDateRange = useCalculateDateRange();
|
|
662
|
-
return (jsxRuntime.jsx("div", { "data-testid": dataTestId, children: jsxRuntime.jsx(Calendar, { activeStartDate: selectedDay ?? undefined, allowPartialRange: true, className: tailwindMerge.twMerge("custom-day-picker", "range-picker", className, "p-0"), locale: language, onChange: value => {
|
|
663
|
-
if (value) {
|
|
664
|
-
onDaySelect?.(value);
|
|
665
|
-
}
|
|
666
|
-
}, selectRange: false, tileDisabled: ({ date, view }) => {
|
|
667
|
-
if (view === "month") {
|
|
668
|
-
if (typeof disabledDays === "function") {
|
|
669
|
-
return disabledDays(date);
|
|
670
|
-
}
|
|
671
|
-
if (Array.isArray(disabledDays)) {
|
|
672
|
-
return disabledDays.some(dateToCheck => {
|
|
673
|
-
return dateToCheck instanceof Date && dateToCheck.toDateString() === date.toDateString();
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
if (typeof disabledDays === "object" && "after" in disabledDays && "before" in disabledDays) {
|
|
677
|
-
return !(date.getTime() >
|
|
678
|
-
(disabledDays.before ? subtract(disabledDays.before, 1, "days").getTime() : date.getTime()) &&
|
|
679
|
-
date.getTime() < (disabledDays.after?.getTime() ?? date.getTime()));
|
|
680
|
-
}
|
|
681
|
-
if (typeof disabledDays === "object" && "furtherBackThanDays" in disabledDays) {
|
|
682
|
-
const dateRange = calculateDateRange({
|
|
683
|
-
direction: "last",
|
|
684
|
-
count: disabledDays.furtherBackThanDays,
|
|
685
|
-
unit: "day",
|
|
686
|
-
});
|
|
687
|
-
if (dateRange.start && dateRange.end) {
|
|
688
|
-
return date < dateRange.start || date > dateRange.end;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
return false;
|
|
693
|
-
}, value: selectedDay ?? null }) }));
|
|
694
|
-
};
|
|
695
|
-
|
|
696
696
|
const cvaTimelineElement = cssClassVarianceUtilities.cvaMerge(["flex", "group/timeline"], {
|
|
697
697
|
variants: {
|
|
698
698
|
selected: {
|
package/index.esm.js
CHANGED
|
@@ -135,6 +135,90 @@ const DateTimeHumanized = ({ value }) => {
|
|
|
135
135
|
return (jsx(Tooltip, { label: jsx(DateTime, { format: tooltipFormat, value: value }), children: jsx(DateTime, { className: "underline decoration-neutral-300 decoration-dotted", fromNow: true, value: value }) }));
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
const temporalArithmeticTypeMapping = {
|
|
139
|
+
day: "days",
|
|
140
|
+
days: "days",
|
|
141
|
+
hour: "hours",
|
|
142
|
+
hours: "hours",
|
|
143
|
+
month: "months",
|
|
144
|
+
months: "months",
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Calculate a date range based on a temporal period.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* getDataRange({ direction: "next", count: 7, unit: "days" }); // { from: 2025-06-01, to: 2025-07-01 }
|
|
152
|
+
* getDataRange({ direction: "last", count: 14, unit: "days" }); // { from: 2025-05-24, to: 2025-06-01 }
|
|
153
|
+
*/
|
|
154
|
+
const useCalculateDateRange = () => {
|
|
155
|
+
const { nowDate, startOf, endOf, subtract, add } = useDateAndTime();
|
|
156
|
+
return useCallback(({ direction, count, unit }) => {
|
|
157
|
+
const unitType = temporalArithmeticTypeMapping[unit];
|
|
158
|
+
if (direction === "next") {
|
|
159
|
+
// To get the right number of days, calculate the end date and subtract 1 day
|
|
160
|
+
const endDate = add(nowDate, count, unitType);
|
|
161
|
+
const adjustedEndDate = subtract(endDate, 1, "days");
|
|
162
|
+
return {
|
|
163
|
+
start: startOf(nowDate, "day"),
|
|
164
|
+
end: endOf(adjustedEndDate, "day"),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
// To get the right number of days, calculate the start date and add 1 day
|
|
169
|
+
const startDate = subtract(nowDate, count, unitType);
|
|
170
|
+
const adjustedStartDate = add(startDate, 1, "days");
|
|
171
|
+
return {
|
|
172
|
+
start: startOf(adjustedStartDate, "day"),
|
|
173
|
+
end: endOf(nowDate, "day"),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}, [nowDate, startOf, endOf, subtract, add]);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The DayPicker component is used when the user needs to select a date.
|
|
181
|
+
|
|
182
|
+
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
183
|
+
* @returns {ReactElement} DayPicker component
|
|
184
|
+
*/
|
|
185
|
+
const DayPicker = ({ onDaySelect, disabledDays, selectedDay, language, className, "data-testid": dataTestId, }) => {
|
|
186
|
+
const { subtract } = useDateAndTime();
|
|
187
|
+
const calculateDateRange = useCalculateDateRange();
|
|
188
|
+
return (jsx("div", { "data-testid": dataTestId, children: jsx(Calendar, { activeStartDate: selectedDay ?? undefined, allowPartialRange: true, className: twMerge("custom-day-picker", "range-picker", className, "p-0"), locale: language, onChange: value => {
|
|
189
|
+
if (value) {
|
|
190
|
+
onDaySelect?.(value);
|
|
191
|
+
}
|
|
192
|
+
}, selectRange: false, tileDisabled: ({ date, view }) => {
|
|
193
|
+
if (view === "month") {
|
|
194
|
+
if (typeof disabledDays === "function") {
|
|
195
|
+
return disabledDays(date);
|
|
196
|
+
}
|
|
197
|
+
if (Array.isArray(disabledDays)) {
|
|
198
|
+
return disabledDays.some(dateToCheck => {
|
|
199
|
+
return dateToCheck instanceof Date && dateToCheck.toDateString() === date.toDateString();
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (typeof disabledDays === "object" && "after" in disabledDays && "before" in disabledDays) {
|
|
203
|
+
return !(date.getTime() >
|
|
204
|
+
(disabledDays.before ? subtract(disabledDays.before, 1, "days").getTime() : date.getTime()) &&
|
|
205
|
+
date.getTime() < (disabledDays.after?.getTime() ?? date.getTime()));
|
|
206
|
+
}
|
|
207
|
+
if (typeof disabledDays === "object" && "furtherBackThanDays" in disabledDays) {
|
|
208
|
+
const dateRange = calculateDateRange({
|
|
209
|
+
direction: "last",
|
|
210
|
+
count: disabledDays.furtherBackThanDays,
|
|
211
|
+
unit: "day",
|
|
212
|
+
});
|
|
213
|
+
if (dateRange.start && dateRange.end) {
|
|
214
|
+
return date < dateRange.start || date > dateRange.end;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
}, value: selectedDay ?? null }) }));
|
|
220
|
+
};
|
|
221
|
+
|
|
138
222
|
/**
|
|
139
223
|
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
140
224
|
*
|
|
@@ -214,47 +298,6 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, "data-testi
|
|
|
214
298
|
newRange.end ? [newRange.start ?? null, newRange.end ?? null] : (newRange.start ?? null) }), jsx("hr", {}), jsxs("div", { className: "flex w-full justify-between gap-2 px-4 py-3", children: [jsx(Button, { className: "mr-auto", "data-testid": "range-popover-clear-button", onClick: clearSelectedDays, size: "small", variant: "secondary", children: t("layout.actions.clear") }), jsxs("div", { children: [jsx(Button, { "data-testid": "range-popover-cancel-button", onClick: () => handleCancel(), size: "small", variant: "ghost-neutral", children: cancelButtonLabel ? cancelButtonLabel : t("layout.actions.cancel") }), jsx(Button, { "data-testid": "range-popover-apply-button", disabled: !newRange.start || !newRange.end, onClick: () => handleApply(), size: "small", children: t("layout.actions.apply") })] })] })] }));
|
|
215
299
|
};
|
|
216
300
|
|
|
217
|
-
const temporalArithmeticTypeMapping = {
|
|
218
|
-
day: "days",
|
|
219
|
-
days: "days",
|
|
220
|
-
hour: "hours",
|
|
221
|
-
hours: "hours",
|
|
222
|
-
month: "months",
|
|
223
|
-
months: "months",
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Calculate a date range based on a temporal period.
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* getDataRange({ direction: "next", count: 7, unit: "days" }); // { from: 2025-06-01, to: 2025-07-01 }
|
|
231
|
-
* getDataRange({ direction: "last", count: 14, unit: "days" }); // { from: 2025-05-24, to: 2025-06-01 }
|
|
232
|
-
*/
|
|
233
|
-
const useCalculateDateRange = () => {
|
|
234
|
-
const { nowDate, startOf, endOf, subtract, add } = useDateAndTime();
|
|
235
|
-
return useCallback(({ direction, count, unit }) => {
|
|
236
|
-
const unitType = temporalArithmeticTypeMapping[unit];
|
|
237
|
-
if (direction === "next") {
|
|
238
|
-
// To get the right number of days, calculate the end date and subtract 1 day
|
|
239
|
-
const endDate = add(nowDate, count, unitType);
|
|
240
|
-
const adjustedEndDate = subtract(endDate, 1, "days");
|
|
241
|
-
return {
|
|
242
|
-
start: startOf(nowDate, "day"),
|
|
243
|
-
end: endOf(adjustedEndDate, "day"),
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
// To get the right number of days, calculate the start date and add 1 day
|
|
248
|
-
const startDate = subtract(nowDate, count, unitType);
|
|
249
|
-
const adjustedStartDate = add(startDate, 1, "days");
|
|
250
|
-
return {
|
|
251
|
-
start: startOf(adjustedStartDate, "day"),
|
|
252
|
-
end: endOf(nowDate, "day"),
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
}, [nowDate, startOf, endOf, subtract, add]);
|
|
256
|
-
};
|
|
257
|
-
|
|
258
301
|
/**
|
|
259
302
|
* Format a temporal period into a label.
|
|
260
303
|
*
|
|
@@ -648,49 +691,6 @@ const DayRangeSelect = ({ className, "data-testid": dataTestId, disabled, select
|
|
|
648
691
|
} })] }));
|
|
649
692
|
};
|
|
650
693
|
|
|
651
|
-
/**
|
|
652
|
-
* The DayPicker component is used when the user needs to select a date.
|
|
653
|
-
|
|
654
|
-
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
655
|
-
* @returns {ReactElement} DayPicker component
|
|
656
|
-
*/
|
|
657
|
-
const DayPicker = ({ onDaySelect, disabledDays, selectedDay, language, className, "data-testid": dataTestId, }) => {
|
|
658
|
-
const { subtract } = useDateAndTime();
|
|
659
|
-
const calculateDateRange = useCalculateDateRange();
|
|
660
|
-
return (jsx("div", { "data-testid": dataTestId, children: jsx(Calendar, { activeStartDate: selectedDay ?? undefined, allowPartialRange: true, className: twMerge("custom-day-picker", "range-picker", className, "p-0"), locale: language, onChange: value => {
|
|
661
|
-
if (value) {
|
|
662
|
-
onDaySelect?.(value);
|
|
663
|
-
}
|
|
664
|
-
}, selectRange: false, tileDisabled: ({ date, view }) => {
|
|
665
|
-
if (view === "month") {
|
|
666
|
-
if (typeof disabledDays === "function") {
|
|
667
|
-
return disabledDays(date);
|
|
668
|
-
}
|
|
669
|
-
if (Array.isArray(disabledDays)) {
|
|
670
|
-
return disabledDays.some(dateToCheck => {
|
|
671
|
-
return dateToCheck instanceof Date && dateToCheck.toDateString() === date.toDateString();
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
if (typeof disabledDays === "object" && "after" in disabledDays && "before" in disabledDays) {
|
|
675
|
-
return !(date.getTime() >
|
|
676
|
-
(disabledDays.before ? subtract(disabledDays.before, 1, "days").getTime() : date.getTime()) &&
|
|
677
|
-
date.getTime() < (disabledDays.after?.getTime() ?? date.getTime()));
|
|
678
|
-
}
|
|
679
|
-
if (typeof disabledDays === "object" && "furtherBackThanDays" in disabledDays) {
|
|
680
|
-
const dateRange = calculateDateRange({
|
|
681
|
-
direction: "last",
|
|
682
|
-
count: disabledDays.furtherBackThanDays,
|
|
683
|
-
unit: "day",
|
|
684
|
-
});
|
|
685
|
-
if (dateRange.start && dateRange.end) {
|
|
686
|
-
return date < dateRange.start || date > dateRange.end;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return false;
|
|
691
|
-
}, value: selectedDay ?? null }) }));
|
|
692
|
-
};
|
|
693
|
-
|
|
694
694
|
const cvaTimelineElement = cvaMerge(["flex", "group/timeline"], {
|
|
695
695
|
variants: {
|
|
696
696
|
selected: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-date-and-time-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react": "19.0.0",
|
|
11
|
-
"@trackunit/react-components": "1.
|
|
12
|
-
"@trackunit/date-and-time-utils": "1.
|
|
13
|
-
"@trackunit/react-date-and-time-hooks": "1.
|
|
14
|
-
"@trackunit/css-class-variance-utilities": "1.
|
|
15
|
-
"@trackunit/ui-icons": "1.
|
|
16
|
-
"@trackunit/shared-utils": "1.
|
|
17
|
-
"@trackunit/i18n-library-translation": "1.
|
|
18
|
-
"@trackunit/react-form-components": "1.
|
|
11
|
+
"@trackunit/react-components": "1.15.0",
|
|
12
|
+
"@trackunit/date-and-time-utils": "1.11.0",
|
|
13
|
+
"@trackunit/react-date-and-time-hooks": "1.11.0",
|
|
14
|
+
"@trackunit/css-class-variance-utilities": "1.11.0",
|
|
15
|
+
"@trackunit/ui-icons": "1.11.0",
|
|
16
|
+
"@trackunit/shared-utils": "1.13.0",
|
|
17
|
+
"@trackunit/i18n-library-translation": "1.11.0",
|
|
18
|
+
"@trackunit/react-form-components": "1.12.0",
|
|
19
19
|
"string-ts": "^2.0.0",
|
|
20
20
|
"tailwind-merge": "^2.0.0",
|
|
21
21
|
"react-calendar": "^6.0.0"
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export * from "./dateTime";
|
|
1
|
+
export * from "./dateTime/DateTime";
|
|
2
|
+
export * from "./dateTime/DateTimeHumanized";
|
|
2
3
|
export * from "./DayPicker";
|
|
3
|
-
export * from "./DayRangeSelect";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./DayRangeSelect/DayRangeSelect";
|
|
5
|
+
export * from "./DayRangeSelect/hooks/useCalculateDateRange/useCalculateDateRange";
|
|
6
|
+
export * from "./DayRangeSelect/hooks/useFormatTemporalPeriodLabel/useFormatTemporalPeriodLabel";
|
|
7
|
+
export * from "./DayRangeSelect/types";
|
|
8
|
+
export * from "./DayRangeSelect/utils/formatCustomDateRangeLabel/formatCustomDateRangeLabel";
|
|
9
|
+
export * from "./DayRangeSelect/utils/isTemporalPeriod/isTemporalPeriod";
|
|
10
|
+
export * from "./Timeline/Timeline";
|
|
11
|
+
export * from "./Timeline/TimelineElement";
|
package/translation.cjs6.js
CHANGED
|
@@ -13,7 +13,7 @@ var translation = {
|
|
|
13
13
|
"input.unit.day": "päivä",
|
|
14
14
|
"input.unit.days": "päivää",
|
|
15
15
|
"input.unit.hour": "tuntiin",
|
|
16
|
-
"input.unit.hours": "
|
|
16
|
+
"input.unit.hours": "tuntia",
|
|
17
17
|
"input.unit.month": "kuukausi",
|
|
18
18
|
"input.unit.months": "kuukautta",
|
|
19
19
|
"input.unit.week": "viikko",
|
package/translation.esm6.js
CHANGED
|
@@ -11,7 +11,7 @@ var translation = {
|
|
|
11
11
|
"input.unit.day": "päivä",
|
|
12
12
|
"input.unit.days": "päivää",
|
|
13
13
|
"input.unit.hour": "tuntiin",
|
|
14
|
-
"input.unit.hours": "
|
|
14
|
+
"input.unit.hours": "tuntia",
|
|
15
15
|
"input.unit.month": "kuukausi",
|
|
16
16
|
"input.unit.months": "kuukautta",
|
|
17
17
|
"input.unit.week": "viikko",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from "./DayRangeSelect";
|
|
2
|
-
export * from "./hooks/useCalculateDateRange/useCalculateDateRange";
|
|
3
|
-
export * from "./hooks/useFormatTemporalPeriodLabel/useFormatTemporalPeriodLabel";
|
|
4
|
-
export * from "./types";
|
|
5
|
-
export * from "./utils/formatCustomDateRangeLabel/formatCustomDateRangeLabel";
|
|
6
|
-
export * from "./utils/isTemporalPeriod/isTemporalPeriod";
|
package/src/Timeline/index.d.ts
DELETED
package/src/dateTime/index.d.ts
DELETED