@monolith-forensics/monolith-ui 1.8.1-dev.1 → 1.8.1-dev.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 (107) hide show
  1. package/dist/Calendar/Calendar.d.ts +4 -1
  2. package/dist/Calendar/Calendar.js +126 -50
  3. package/dist/Calendar/CalendarStyles.d.ts +3 -2
  4. package/dist/Calendar/CalendarStyles.js +67 -25
  5. package/dist/Calendar/calendarHelpers.d.ts +1 -1
  6. package/dist/CheckBox/CheckBox.js +35 -4
  7. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +41 -0
  8. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +363 -0
  9. package/dist/DateTimeRangePicker/index.d.ts +2 -0
  10. package/dist/DateTimeRangePicker/index.js +2 -0
  11. package/dist/DropDownMenu/DropDownMenu.js +25 -15
  12. package/dist/DropDownMenu/components/MenuComponent.js +6 -1
  13. package/dist/DropDownMenu/components/MenuItem.d.ts +2 -0
  14. package/dist/DropDownMenu/components/MenuItem.js +22 -9
  15. package/dist/DropDownMenu/components/MenuItemList.d.ts +3 -0
  16. package/dist/DropDownMenu/components/MenuItemList.js +186 -63
  17. package/dist/DropDownMenu/components/StyledContent.js +1 -2
  18. package/dist/DropDownMenu/types.d.ts +3 -0
  19. package/dist/FileViewer/viewers/ImageViewer.js +75 -18
  20. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +1 -0
  21. package/dist/QueryFilter/DefaultOperators.d.ts +1 -76
  22. package/dist/QueryFilter/DefaultOperators.js +1 -21
  23. package/dist/QueryFilter/QueryFilter.constants.d.ts +134 -0
  24. package/dist/QueryFilter/QueryFilter.constants.js +39 -0
  25. package/dist/QueryFilter/QueryFilter.d.ts +1 -1
  26. package/dist/QueryFilter/QueryFilter.js +3 -303
  27. package/dist/QueryFilter/QueryFilter.lib.d.ts +14 -0
  28. package/dist/QueryFilter/QueryFilter.lib.js +84 -0
  29. package/dist/QueryFilter/QueryFilter.styled.d.ts +89 -0
  30. package/dist/QueryFilter/QueryFilter.styled.js +184 -0
  31. package/dist/QueryFilter/QueryFilter.types.d.ts +61 -0
  32. package/dist/QueryFilter/QueryFilter.types.js +1 -0
  33. package/dist/QueryFilter/components/MultiSelectEditor.d.ts +7 -0
  34. package/dist/QueryFilter/components/MultiSelectEditor.js +44 -0
  35. package/dist/QueryFilter/components/RuleChip.d.ts +8 -0
  36. package/dist/QueryFilter/components/RuleChip.js +37 -0
  37. package/dist/QueryFilter/components/Rules.d.ts +11 -0
  38. package/dist/QueryFilter/components/Rules.js +41 -0
  39. package/dist/QueryFilter/components/UnavailableRuleChip.d.ts +5 -0
  40. package/dist/QueryFilter/components/UnavailableRuleChip.js +7 -0
  41. package/dist/QueryFilter/components/ValueEditor.d.ts +7 -0
  42. package/dist/QueryFilter/components/ValueEditor.js +45 -0
  43. package/dist/QueryFilter/components/ValueSelector.d.ts +7 -0
  44. package/dist/QueryFilter/components/ValueSelector.js +34 -0
  45. package/dist/QueryFilter/components/index.d.ts +6 -0
  46. package/dist/QueryFilter/components/index.js +6 -0
  47. package/dist/QueryFilter/index.d.ts +3 -2
  48. package/dist/QueryFilter/index.js +3 -2
  49. package/dist/QueryFilter/types.d.ts +1 -52
  50. package/dist/QueryFilter/types.js +1 -1
  51. package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
  52. package/dist/QueryFilter/useQueryFilter.js +23 -19
  53. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +5 -15
  54. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.d.ts +3 -0
  55. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +241 -0
  56. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +15 -0
  57. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +115 -51
  58. package/dist/RichTextEditor/Plugins/index.d.ts +1 -0
  59. package/dist/RichTextEditor/Plugins/index.js +1 -0
  60. package/dist/RichTextEditor/RichTextEditor.d.ts +3 -2
  61. package/dist/RichTextEditor/RichTextEditor.js +302 -35
  62. package/dist/SuperDatePicker/SuperDatePicker.constants.d.ts +24 -0
  63. package/dist/SuperDatePicker/SuperDatePicker.constants.js +30 -0
  64. package/dist/SuperDatePicker/SuperDatePicker.d.ts +3 -0
  65. package/dist/SuperDatePicker/SuperDatePicker.js +31 -0
  66. package/dist/SuperDatePicker/SuperDatePicker.lib.d.ts +17 -0
  67. package/dist/SuperDatePicker/SuperDatePicker.lib.js +206 -0
  68. package/dist/SuperDatePicker/SuperDatePicker.styled.d.ts +60 -0
  69. package/dist/SuperDatePicker/SuperDatePicker.styled.js +256 -0
  70. package/dist/SuperDatePicker/SuperDatePicker.types.d.ts +48 -0
  71. package/dist/SuperDatePicker/SuperDatePicker.types.js +1 -0
  72. package/dist/SuperDatePicker/components/CommonPresetGroups.d.ts +7 -0
  73. package/dist/SuperDatePicker/components/CommonPresetGroups.js +6 -0
  74. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.d.ts +10 -0
  75. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.js +9 -0
  76. package/dist/SuperDatePicker/components/EndpointDateInput.d.ts +16 -0
  77. package/dist/SuperDatePicker/components/EndpointDateInput.js +26 -0
  78. package/dist/SuperDatePicker/components/EndpointPopover.d.ts +18 -0
  79. package/dist/SuperDatePicker/components/EndpointPopover.js +11 -0
  80. package/dist/SuperDatePicker/components/QuickRangeDropdown.d.ts +14 -0
  81. package/dist/SuperDatePicker/components/QuickRangeDropdown.js +19 -0
  82. package/dist/SuperDatePicker/components/QuickRangePopover.d.ts +18 -0
  83. package/dist/SuperDatePicker/components/QuickRangePopover.js +12 -0
  84. package/dist/SuperDatePicker/components/index.d.ts +6 -0
  85. package/dist/SuperDatePicker/components/index.js +6 -0
  86. package/dist/SuperDatePicker/index.d.ts +3 -0
  87. package/dist/SuperDatePicker/index.js +3 -0
  88. package/dist/SuperDatePicker/useSuperDatePicker.d.ts +32 -0
  89. package/dist/SuperDatePicker/useSuperDatePicker.js +125 -0
  90. package/dist/Table/ColumnResizer.d.ts +6 -9
  91. package/dist/Table/ColumnResizer.js +30 -10
  92. package/dist/Table/TableComponents.js +14 -10
  93. package/dist/Table/TableHeader.js +31 -16
  94. package/dist/Table/TableMenu/TableMenu.js +1 -1
  95. package/dist/Table/TableProvider.js +91 -4
  96. package/dist/Table/TableRow.js +19 -12
  97. package/dist/Table/Utils/index.d.ts +0 -1
  98. package/dist/Table/Utils/index.js +0 -1
  99. package/dist/Table/types.d.ts +6 -19
  100. package/dist/TagBox/TagBox.d.ts +1 -1
  101. package/dist/TagBox/TagBox.js +6 -6
  102. package/dist/TagBox/types.d.ts +1 -0
  103. package/dist/TextArea/TextArea.js +5 -0
  104. package/dist/index.d.ts +2 -0
  105. package/dist/index.js +1 -0
  106. package/dist/theme/variants.js +2 -0
  107. package/package.json +22 -18
@@ -9,9 +9,12 @@ interface CalendarProps {
9
9
  clearable?: boolean;
10
10
  min?: Date;
11
11
  max?: Date;
12
+ timeIntervalMinutes?: number;
13
+ minuteStep?: number;
14
+ timeZoneLabel?: string;
12
15
  }
13
16
  declare const Calendar: {
14
- ({ defaultValue, value, onChange, hourFormat, includeTime, clearable, min, max, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
17
+ ({ defaultValue, value, onChange, hourFormat, includeTime, clearable, min, max, timeIntervalMinutes, minuteStep, timeZoneLabel, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
15
18
  displayName: string;
16
19
  };
17
20
  export default Calendar;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fragment, useEffect, useRef, useState } from "react";
2
+ import { Fragment, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
4
- import { CalendarContainer, CalendarHeader, CalendarHeaderControls, CalendarHeaderSelect, CalendarNavButton, CalendarGrid, CalendarMonth, CalendarDay, CalendarDate, HighlightedCalendarDate, TodayCalendarDate, TimeContainer, MainContainer, TimePickerContainer, TimeHourSelect, TimeHeader, TimeMinuteSelect, TimeItem, TimeItemActive, NoValueButton, } from "./CalendarStyles";
4
+ import { CalendarContainer, CalendarHeader, CalendarHeaderControls, CalendarHeaderSelect, CalendarNavButton, CalendarGrid, CalendarMonth, CalendarDay, CalendarDate, HighlightedCalendarDate, TodayCalendarDate, TimeContainer, MainContainer, TimePickerContainer, TimeHeader, TimeHeaderValue, TimeItem, TimeItemActive, TimeSelectList, TimeZoneBadge, NoValueButton, } from "./CalendarStyles";
5
5
  import { DropDownMenu } from "../DropDownMenu";
6
- import calendar, { createLocalDate, isDate, isSameDay, isSameMonth, getDateISO, getMonthDays, getNextMonth, getPreviousMonth, WEEK_DAYS, CALENDAR_MONTHS, HOURS24, HOURS12, MINUTES, } from "./calendarHelpers";
6
+ import calendar, { createLocalDate, isDate, isSameDay, isSameMonth, getDateISO, getMonthDays, getNextMonth, getPreviousMonth, WEEK_DAYS, CALENDAR_MONTHS, } from "./calendarHelpers";
7
7
  import moment from "moment";
8
8
  const checkValidRange = (value, min, max) => {
9
9
  if (min && moment(value).startOf("day").isBefore(moment(min).startOf("day")))
@@ -25,8 +25,10 @@ const MONTH_OPTIONS = Object.keys(CALENDAR_MONTHS).map((monthName, index) => ({
25
25
  label: monthName,
26
26
  value: index + 1,
27
27
  }));
28
- const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hourFormat = "24", includeTime = true, clearable = true, min, max, }) => {
28
+ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hourFormat = "24", includeTime = true, clearable = true, min, max, timeIntervalMinutes, minuteStep = 1, timeZoneLabel = "Local", }) => {
29
29
  const isControlled = useRef(value !== undefined);
30
+ const activeTimeRef = useRef(null);
31
+ const hasScrolledInitialTimeIntoView = useRef(false);
30
32
  const [valueState, setValueState] = useState(defaultValue);
31
33
  const _value = isControlled.current
32
34
  ? value
@@ -38,6 +40,36 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
38
40
  let pressureTimer;
39
41
  let pressureTimeout;
40
42
  let dayTimeout;
43
+ const normalizedTimeInterval = Math.max(1, Math.min(1440, timeIntervalMinutes || minuteStep || 1));
44
+ const selectedMinutesOfDay = calendarState.hours * 60 + calendarState.minutes;
45
+ const timeOptions = useMemo(() => {
46
+ const steppedTimes = Array.from({ length: Math.ceil(1440 / normalizedTimeInterval) }, (_, index) => index * normalizedTimeInterval).filter((minutesOfDay) => minutesOfDay < 1440);
47
+ if (!steppedTimes.includes(selectedMinutesOfDay)) {
48
+ steppedTimes.push(selectedMinutesOfDay);
49
+ }
50
+ return steppedTimes
51
+ .sort((a, b) => a - b)
52
+ .map((minutesOfDay) => {
53
+ const hours = Math.floor(minutesOfDay / 60);
54
+ const minutes = minutesOfDay % 60;
55
+ return {
56
+ value: minutesOfDay,
57
+ hours,
58
+ minutes,
59
+ label: `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`,
60
+ };
61
+ });
62
+ }, [normalizedTimeInterval, selectedMinutesOfDay]);
63
+ useEffect(() => {
64
+ var _a;
65
+ if (!includeTime || hasScrolledInitialTimeIntoView.current)
66
+ return;
67
+ (_a = activeTimeRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
68
+ block: "center",
69
+ inline: "nearest",
70
+ });
71
+ hasScrolledInitialTimeIntoView.current = true;
72
+ }, [includeTime]);
41
73
  const syncCalendarState = (date) => {
42
74
  setCalendarState({
43
75
  month: +date.getMonth() + 1,
@@ -110,13 +142,15 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
110
142
  const { month, year } = calendarState;
111
143
  const monthName = Object.keys(CALENDAR_MONTHS)[Math.max(0, Math.min(month - 1, 11))];
112
144
  const yearOptions = getYearOptions();
113
- return (_jsxs(CalendarHeader, { children: [_jsx(CalendarNavButton, { type: "button", onClick: handlePrevious, onMouseUp: clearPressureTimer, "aria-label": "Go to previous month", title: "Previous month. Hold Shift to jump by year.", children: _jsx(ChevronLeftIcon, { "aria-hidden": "true" }) }), _jsxs(CalendarHeaderControls, { children: [_jsx(CalendarHeaderSelect, { children: _jsx(DropDownMenu, { data: MONTH_OPTIONS, variant: "outlined", size: "xs", arrow: true, onItemSelect: (item) => commitMonthOrYearSelection(Number(item.value), year, "month"), dropDownProps: {
114
- style: { width: 75, maxHeight: 260 },
145
+ const selectedMonthOption = MONTH_OPTIONS.find((option) => option.value === month);
146
+ const selectedYearOption = yearOptions.find((option) => option.value === year);
147
+ return (_jsxs(CalendarHeader, { children: [_jsx(CalendarNavButton, { type: "button", onClick: handlePrevious, onMouseUp: clearPressureTimer, "aria-label": "Go to previous month", title: "Previous month. Hold Shift to jump by year.", children: _jsx(ChevronLeftIcon, { "aria-hidden": "true" }) }), _jsxs(CalendarHeaderControls, { children: [_jsx(CalendarHeaderSelect, { children: _jsx(DropDownMenu, { data: MONTH_OPTIONS, value: selectedMonthOption ? [selectedMonthOption] : [], variant: "outlined", size: "xs", arrow: true, onItemSelect: (item) => commitMonthOrYearSelection(Number(item.value), year, "month"), dropDownProps: {
148
+ style: { maxHeight: 260, width: 125 },
115
149
  }, buttonProps: {
116
150
  title: "Select month",
117
151
  size: "xxs",
118
152
  style: { minWidth: 95 },
119
- }, children: _jsx(CalendarMonth, { children: monthName }) }) }), _jsx(CalendarHeaderSelect, { children: _jsx(DropDownMenu, { data: yearOptions, variant: "outlined", size: "xs", arrow: true, searchable: true, onItemSelect: (item) => commitMonthOrYearSelection(month, Number(item.value), "year"), dropDownProps: {
153
+ }, children: _jsx(CalendarMonth, { children: monthName }) }) }), _jsx(CalendarHeaderSelect, { children: _jsx(DropDownMenu, { data: yearOptions, value: selectedYearOption ? [selectedYearOption] : [], variant: "outlined", size: "xs", arrow: true, searchable: true, onItemSelect: (item) => commitMonthOrYearSelection(month, Number(item.value), "year"), dropDownProps: {
120
154
  style: { width: 120, maxHeight: 260 },
121
155
  }, buttonProps: {
122
156
  title: "Select year",
@@ -151,6 +185,10 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
151
185
  const inMonth = month && year && isSameMonth(_date, createLocalDate(year, month, 1));
152
186
  const isDisabled = !checkValidRange(getDateISO(_date), min || null, max || null);
153
187
  const ariaCurrent = isToday ? "date" : undefined;
188
+ const handleDisabledAction = (evt) => {
189
+ evt.preventDefault();
190
+ evt.stopPropagation();
191
+ };
154
192
  // The click handler
155
193
  const props = {
156
194
  "data-disabled": isDisabled,
@@ -160,8 +198,10 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
160
198
  "aria-pressed": Boolean(isCurrent),
161
199
  index,
162
200
  key: getDateISO(_date),
163
- onClick: gotoDate(_date),
164
- onKeyDown: handleActionKeyDown(() => gotoDate(_date)(undefined)),
201
+ onClick: isDisabled ? handleDisabledAction : gotoDate(_date),
202
+ onKeyDown: isDisabled
203
+ ? handleDisabledAction
204
+ : handleActionKeyDown(() => gotoDate(_date)(undefined)),
165
205
  role: "button",
166
206
  tabIndex: isDisabled ? -1 : 0,
167
207
  title: _date.toDateString(),
@@ -170,49 +210,85 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
170
210
  // Conditionally render a styled date component
171
211
  return isCurrent ? (_jsx(HighlightedCalendarDate, Object.assign({}, props, { children: _date.getDate() }))) : isToday ? (_jsx(TodayCalendarDate, Object.assign({}, props, { children: _date.getDate() }))) : (_jsx(CalendarDate, Object.assign({}, props, { children: _date.getDate() })));
172
212
  };
173
- const renderHours = () => {
174
- const { hours } = calendarState;
175
- const hoursArray = hourFormat === "24" ? HOURS24 : HOURS12;
176
- return hoursArray.map((hour, index) => {
177
- const HourComponent = hour.value === hours ? TimeItemActive : TimeItem;
178
- return (_jsx(HourComponent, { role: "button", tabIndex: 0, "aria-label": `Select ${hour.label}`, "aria-pressed": hour.value === hours,
179
- // value={hour.value}
180
- onClick: (e) => {
181
- const newTime = moment(getWorkingDate())
182
- .hours(hour.value)
183
- .minutes(calendarState.minutes)
184
- .toDate();
185
- commitDate(newTime, "time");
186
- }, onKeyDown: handleActionKeyDown(() => {
187
- const newTime = moment(getWorkingDate())
188
- .hours(hour.value)
189
- .minutes(calendarState.minutes)
190
- .toDate();
191
- commitDate(newTime, "time");
192
- }), children: hour.label }, hour.value));
193
- });
213
+ const isTimeOptionDisabled = (hours, minutes) => {
214
+ const candidate = moment(getWorkingDate())
215
+ .hours(hours)
216
+ .minutes(minutes)
217
+ .seconds(0)
218
+ .milliseconds(0);
219
+ if (min && candidate.isBefore(moment(min)))
220
+ return true;
221
+ if (max && candidate.isAfter(moment(max)))
222
+ return true;
223
+ return false;
194
224
  };
195
- const renderMinutes = () => {
196
- const { minutes } = calendarState;
197
- return MINUTES.map((minute) => {
198
- const MinuteComponent = minute.value === minutes ? TimeItemActive : TimeItem;
199
- return (_jsx(MinuteComponent, { role: "button", tabIndex: 0, "aria-label": `Select ${minute.label} minutes`, "aria-pressed": minute.value === minutes,
200
- // value={minute}
201
- onClick: (e) => {
202
- const newTime = moment(getWorkingDate())
203
- .hours(calendarState.hours)
204
- .minutes(minute.value)
205
- .toDate();
206
- commitDate(newTime, "time");
207
- }, onKeyDown: handleActionKeyDown(() => {
208
- const newTime = moment(getWorkingDate())
209
- .hours(calendarState.hours)
210
- .minutes(minute.value)
211
- .toDate();
212
- commitDate(newTime, "time");
213
- }), children: minute.label }, minute.value));
225
+ const renderTimeOptions = () => {
226
+ return timeOptions.map((timeOption, index) => {
227
+ const isActive = timeOption.value === selectedMinutesOfDay;
228
+ const isDisabled = isTimeOptionDisabled(timeOption.hours, timeOption.minutes);
229
+ const TimeComponent = isActive ? TimeItemActive : TimeItem;
230
+ const commitTime = () => {
231
+ if (isDisabled)
232
+ return;
233
+ const newTime = moment(getWorkingDate())
234
+ .hours(timeOption.hours)
235
+ .minutes(timeOption.minutes)
236
+ .seconds(0)
237
+ .milliseconds(0)
238
+ .toDate();
239
+ commitDate(newTime, "time");
240
+ };
241
+ return (_jsx(TimeComponent, { ref: isActive ? activeTimeRef : undefined, role: "button", tabIndex: isDisabled ? -1 : 0, "data-disabled": isDisabled, "aria-disabled": isDisabled, "aria-label": `Select ${timeOption.label}`, "aria-pressed": isActive, onClick: commitTime, onKeyDown: handleTimeKeyDown(index, commitTime), children: timeOption.label }, timeOption.value));
214
242
  });
215
243
  };
244
+ const handleTimeKeyDown = (index, selectCurrent) => (evt) => {
245
+ const findEnabledIndex = (nextIndex, direction) => {
246
+ let boundedIndex = Math.max(0, Math.min(timeOptions.length - 1, nextIndex));
247
+ while (boundedIndex >= 0 &&
248
+ boundedIndex < timeOptions.length &&
249
+ isTimeOptionDisabled(timeOptions[boundedIndex].hours, timeOptions[boundedIndex].minutes)) {
250
+ boundedIndex += direction;
251
+ }
252
+ if (boundedIndex < 0 || boundedIndex >= timeOptions.length) {
253
+ return null;
254
+ }
255
+ return boundedIndex;
256
+ };
257
+ const commitOption = (nextIndex, direction) => {
258
+ const enabledIndex = findEnabledIndex(nextIndex, direction);
259
+ if (enabledIndex === null)
260
+ return;
261
+ const nextOption = timeOptions[enabledIndex];
262
+ const newTime = moment(getWorkingDate())
263
+ .hours(nextOption.hours)
264
+ .minutes(nextOption.minutes)
265
+ .seconds(0)
266
+ .milliseconds(0)
267
+ .toDate();
268
+ commitDate(newTime, "time");
269
+ };
270
+ if (evt.key === "Enter" || evt.key === " ") {
271
+ evt.preventDefault();
272
+ selectCurrent();
273
+ return;
274
+ }
275
+ if (evt.key === "ArrowDown") {
276
+ evt.preventDefault();
277
+ commitOption(index + 1, 1);
278
+ }
279
+ if (evt.key === "ArrowUp") {
280
+ evt.preventDefault();
281
+ commitOption(index - 1, -1);
282
+ }
283
+ if (evt.key === "Home") {
284
+ evt.preventDefault();
285
+ commitOption(0, 1);
286
+ }
287
+ if (evt.key === "End") {
288
+ evt.preventDefault();
289
+ commitOption(timeOptions.length - 1, -1);
290
+ }
291
+ };
216
292
  // new 2
217
293
  const gotoDate = (date) => (evt) => {
218
294
  evt && evt.preventDefault();
@@ -303,7 +379,7 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
303
379
  // const clearDayTimeout = () => {
304
380
  // dayTimeout && clearTimeout(dayTimeout);
305
381
  // };
306
- return (_jsxs(MainContainer, { children: [_jsxs(CalendarContainer, { children: [renderMonthAndYear(), _jsxs(CalendarGrid, { role: "grid", "aria-label": `Calendar view for ${Object.keys(CALENDAR_MONTHS)[calendarState.month - 1]} ${calendarState.year}`, children: [_jsx(Fragment, { children: Object.keys(WEEK_DAYS).map(renderDayLabel) }), _jsx(Fragment, { children: getCalendarDates().map(renderCalendarDate) })] }), clearable && (_jsx("div", { style: { textAlign: "center", marginTop: 3 }, children: _jsx(NoValueButton, { type: "button", onClick: () => commitDate(null, "clear"), "aria-label": "Clear selected date", children: "Clear Date" }) }))] }), includeTime && (_jsxs(TimeContainer, { children: [_jsx(TimeHeader, { children: "Select Time" }), _jsxs(TimePickerContainer, { children: [_jsx(TimeHourSelect, { children: renderHours() }), _jsx(TimeMinuteSelect, { children: renderMinutes() })] })] }))] }));
382
+ return (_jsxs(MainContainer, { children: [_jsxs(CalendarContainer, { children: [renderMonthAndYear(), _jsxs(CalendarGrid, { role: "grid", "aria-label": `Calendar view for ${Object.keys(CALENDAR_MONTHS)[calendarState.month - 1]} ${calendarState.year}`, children: [_jsx(Fragment, { children: Object.keys(WEEK_DAYS).map(renderDayLabel) }), _jsx(Fragment, { children: getCalendarDates().map(renderCalendarDate) })] }), clearable && (_jsx("div", { style: { textAlign: "center", marginTop: 3 }, children: _jsx(NoValueButton, { type: "button", onClick: () => commitDate(null, "clear"), "aria-label": "Clear selected date", children: "Clear Date" }) }))] }), includeTime && (_jsxs(TimeContainer, { children: [_jsxs(TimeHeader, { children: [_jsx(TimeHeaderValue, { children: `${String(calendarState.hours).padStart(2, "0")}:${String(calendarState.minutes).padStart(2, "0")}` }), timeZoneLabel && _jsx(TimeZoneBadge, { children: timeZoneLabel })] }), _jsx(TimePickerContainer, { children: _jsx(TimeSelectList, { children: renderTimeOptions() }) })] }))] }));
307
383
  };
308
384
  Calendar.displayName = "Calendar";
309
385
  export default Calendar;
@@ -21,8 +21,9 @@ export declare const TodayCalendarDate: import("styled-components/dist/types").I
21
21
  export declare const TimeContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
22
22
  export declare const TimePickerContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
23
23
  export declare const TimeHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
24
- export declare const TimeHourSelect: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
25
- export declare const TimeMinuteSelect: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
24
+ export declare const TimeHeaderValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
25
+ export declare const TimeZoneBadge: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
26
+ export declare const TimeSelectList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
26
27
  export declare const TimeItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
27
28
  export declare const TimeItemActive: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, never>> & string;
28
29
  export declare const NoValueButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
@@ -5,7 +5,7 @@ export const MainContainer = styled.div `
5
5
  gap: 8px;
6
6
  `;
7
7
  export const CalendarContainer = styled.div `
8
- width: 264px;
8
+ width: 268px;
9
9
  border-radius: 4px;
10
10
  overflow: hidden;
11
11
  box-sizing: border-box;
@@ -48,8 +48,10 @@ export const CalendarNavButton = styled.button `
48
48
  `;
49
49
  export const CalendarGrid = styled.div `
50
50
  display: grid;
51
- grid-template: repeat(7, auto) / repeat(7, auto);
51
+ grid-template: repeat(7, auto) / repeat(7, 32px);
52
52
  gap: 3px;
53
+ justify-content: center;
54
+ justify-items: center;
53
55
  `;
54
56
  export const CalendarMonth = styled.div `
55
57
  font-weight: 500;
@@ -74,7 +76,9 @@ export const CalendarCell = styled.div `
74
76
  align-self: center;
75
77
  letter-spacing: 0.1rem;
76
78
  min-width: 32px;
79
+ width: 32px;
77
80
  min-height: 32px;
81
+ height: 32px;
78
82
  padding: 6px 4px;
79
83
  user-select: none;
80
84
  border-radius: 5px;
@@ -112,11 +116,18 @@ export const CalendarDate = styled(CalendarCell) `
112
116
  }
113
117
 
114
118
  &[data-disabled="true"] {
115
- pointer-events: none;
116
- color: ${({ theme }) => theme.palette.text.disabled};
117
- background: ${({ theme }) => `${theme.palette.action.hover}99`};
118
- opacity: 0.45;
119
- border-style: dashed;
119
+ cursor: not-allowed;
120
+ color: ${({ theme }) => theme.palette.text.secondary};
121
+
122
+ opacity: 0.62;
123
+ font-weight: 500;
124
+ text-decoration: line-through;
125
+ text-decoration-thickness: 1px;
126
+
127
+ &:hover {
128
+ background: transparent;
129
+ opacity: 0.62;
130
+ }
120
131
  }
121
132
  `;
122
133
  export const HighlightedCalendarDate = styled(CalendarDate) `
@@ -126,7 +137,8 @@ export const HighlightedCalendarDate = styled(CalendarDate) `
126
137
  font-weight: 700;
127
138
  opacity: 1;
128
139
  position: relative;
129
- box-shadow: inset 0 0 0 1px ${(props) => props.theme.palette.primary.main},
140
+ box-shadow:
141
+ inset 0 0 0 1px ${(props) => props.theme.palette.primary.main},
130
142
  0 4px 10px ${(props) => `${props.theme.palette.primary.main}33`};
131
143
  ::before {
132
144
  content: "";
@@ -160,49 +172,67 @@ export const TodayCalendarDate = styled(HighlightedCalendarDate) `
160
172
  }
161
173
  `;
162
174
  export const TimeContainer = styled.div `
175
+ position: relative;
176
+ flex: 0 0 132px;
163
177
  font-size: 12px;
164
- width: 152px;
165
- height: 100%;
178
+ width: 132px;
179
+ height: auto;
180
+ box-sizing: border-box;
166
181
  border: 1px solid ${(props) => props.theme.palette.divider};
167
- border-left: none;
168
182
  border-radius: 4px;
183
+ background: ${(props) => props.theme.palette.input.background};
169
184
  overflow: hidden;
170
185
  `;
171
186
  export const TimePickerContainer = styled.div `
172
187
  display: flex;
173
- height: 100%;
188
+ height: 238px;
174
189
  `;
175
190
  export const TimeHeader = styled.div `
176
- font-weight: 500;
191
+ box-sizing: border-box;
192
+ font-weight: 600;
177
193
  font-size: 12px;
178
194
  color: ${(props) => props.theme.palette.text.primary};
179
195
  border-bottom: 1px solid ${(props) => props.theme.palette.divider};
180
196
  text-align: center;
181
- padding: 5px;
182
- line-height: 2.3;
197
+ padding: 6px 5px;
198
+ line-height: 1.25;
183
199
  height: 40px;
184
200
  user-select: none;
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: center;
204
+ gap: 6px;
185
205
  `;
186
- export const TimeHourSelect = styled.div `
187
- border-right: 1px solid ${(props) => props.theme.palette.divider};
188
- width: 50%;
189
- height: 250px;
190
- overflow-y: auto;
206
+ export const TimeHeaderValue = styled.span `
207
+ color: ${(props) => props.theme.palette.text.primary};
191
208
  `;
192
- export const TimeMinuteSelect = styled.div `
193
- width: 50%;
194
- height: 250px;
209
+ export const TimeZoneBadge = styled.span `
210
+ padding: 2px 5px;
211
+ border-radius: 4px;
212
+ background: ${(props) => props.theme.palette.action.hover};
213
+ color: ${(props) => props.theme.palette.text.secondary};
214
+ font-size: 10px;
215
+ font-weight: 700;
216
+ line-height: 1;
217
+ text-transform: uppercase;
218
+ `;
219
+ export const TimeSelectList = styled.div `
220
+ flex: 1 1 auto;
221
+ min-height: 0;
222
+ width: 100%;
195
223
  overflow-y: auto;
196
224
  `;
197
225
  export const TimeItem = styled.div `
198
226
  font-weight: 500;
199
- font-size: 10px;
227
+ font-size: 11px;
200
228
  color: ${(props) => props.theme.palette.text.primary};
201
229
  text-align: center;
202
- padding: 5px;
230
+ padding: 6px 5px;
203
231
  user-select: none;
204
232
  cursor: pointer;
205
233
  transition: all 0.2s ease-out;
234
+ border-radius: 4px;
235
+ margin: 1px 4px;
206
236
  :hover {
207
237
  background: ${(props) => props.theme.palette.action.hover};
208
238
  }
@@ -211,10 +241,22 @@ export const TimeItem = styled.div `
211
241
  outline: 2px solid ${(props) => props.theme.palette.primary.main};
212
242
  outline-offset: -2px;
213
243
  }
244
+
245
+ &[data-disabled="true"] {
246
+ cursor: not-allowed;
247
+ color: ${({ theme }) => theme.palette.text.secondary};
248
+ opacity: 0.62;
249
+ text-decoration: line-through;
250
+
251
+ &:hover {
252
+ background: transparent;
253
+ }
254
+ }
214
255
  `;
215
256
  export const TimeItemActive = styled(TimeItem) `
216
257
  background: ${(props) => props.theme.palette.primary.main};
217
258
  color: white;
259
+ font-weight: 700;
218
260
  &:hover {
219
261
  background: ${(props) => props.theme.palette.primary.main};
220
262
  }
@@ -39,7 +39,7 @@ export declare const CALENDAR_MONTHS: {
39
39
  export declare const CALENDAR_WEEKS = 6;
40
40
  export declare const zeroPad: (value: number, length: number) => string;
41
41
  export declare const createLocalDate: (year: number, month: number, day: number) => Date;
42
- export declare const getMonthDays: (month?: number, year?: number) => 28 | 29 | 30 | 31;
42
+ export declare const getMonthDays: (month?: number, year?: number) => 28 | 30 | 29 | 31;
43
43
  export declare const getMonthFirstDay: (month?: number, year?: number) => number;
44
44
  export declare const isDate: (date: Date) => boolean;
45
45
  export declare const isSameMonth: (date: Date, basedate?: Date) => boolean;
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import styled from "styled-components";
3
3
  import { useState, useEffect } from "react";
4
- import { FaCheckSquare, FaRegSquare, FaRegMinusSquare } from "react-icons/fa";
5
4
  import { getControlSizeTokens } from "../core";
6
5
  const CheckBox = styled(({ className, defaultValue = false, value, partialCheck = false, onChange = () => { }, }) => {
7
6
  const [checkedState, setCheckedState] = useState(defaultValue);
@@ -15,15 +14,47 @@ const CheckBox = styled(({ className, defaultValue = false, value, partialCheck
15
14
  setCheckedState(value);
16
15
  }, [value]);
17
16
  const _checked = value === undefined ? checkedState : value;
18
- return (_jsx("div", { className: className, onClick: handleChange, children: partialCheck === true ? (_jsx(FaRegMinusSquare, { className: "checkbox partial" })) : _checked === true ? (_jsx(FaCheckSquare, { className: "checkbox checked" })) : (_jsx(FaRegSquare, { className: "checkbox unchecked" })) }));
17
+ return (_jsx("div", { className: className, onClick: handleChange, children: partialCheck === true ? (_jsx("span", { className: "checkbox partial" })) : _checked === true ? (_jsx("span", { className: "checkbox checked" })) : (_jsx("span", { className: "checkbox unchecked" })) }));
19
18
  }) `
20
19
  display: flex;
21
20
  align-items: center;
22
21
  cursor: pointer;
23
22
 
24
23
  .checkbox {
25
- color: ${(props) => props.theme.palette.primary.main};
26
- font-size: ${({ size }) => `${getControlSizeTokens(size).checkboxIconSize}px`};
24
+ position: relative;
25
+ display: inline-flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ box-sizing: border-box;
29
+ width: ${({ size }) => `${getControlSizeTokens(size).checkboxIconSize}px`};
30
+ height: ${({ size }) => `${getControlSizeTokens(size).checkboxIconSize}px`};
31
+ border: 1px solid ${(props) => props.theme.palette.primary.main};
32
+ border-radius: 2px;
33
+ }
34
+
35
+ .checked,
36
+ .partial {
37
+ background-color: ${(props) => props.theme.palette.primary.main};
38
+ }
39
+
40
+ .checked::after {
41
+ content: "";
42
+ position: absolute;
43
+ left: 50%;
44
+ top: 45%;
45
+ width: 32%;
46
+ height: 56%;
47
+ border: solid #fff;
48
+ border-width: 0 2px 2px 0;
49
+ transform: translate(-50%, -50%) rotate(45deg);
50
+ transform-origin: center;
51
+ }
52
+
53
+ .partial::after {
54
+ content: "";
55
+ width: 60%;
56
+ height: 2px;
57
+ background-color: #fff;
27
58
  }
28
59
  `;
29
60
  export default CheckBox;
@@ -0,0 +1,41 @@
1
+ import { ReactNode } from "react";
2
+ import type { FormatOptions } from "../DateInput/DateInput";
3
+ import { Size, Variant } from "../core";
4
+ export type DateTimeRangeValue = {
5
+ start?: string | null;
6
+ end?: string | null;
7
+ };
8
+ export type DateTimeRangePreset = {
9
+ label: string;
10
+ getRange: () => Required<DateTimeRangeValue>;
11
+ };
12
+ export type DateTimeRangePickerChangeMeta = {
13
+ source: "apply" | "clear" | "preset";
14
+ preset?: DateTimeRangePreset;
15
+ };
16
+ export type DateTimeRangePickerProps = {
17
+ className?: string;
18
+ style?: React.CSSProperties;
19
+ defaultValue?: DateTimeRangeValue;
20
+ value?: DateTimeRangeValue;
21
+ onChange?: (value: DateTimeRangeValue, meta: DateTimeRangePickerChangeMeta) => void;
22
+ label?: string;
23
+ description?: ReactNode;
24
+ placeholder?: string;
25
+ startLabel?: string;
26
+ endLabel?: string;
27
+ format?: FormatOptions;
28
+ size?: Size;
29
+ variant?: Variant;
30
+ required?: boolean;
31
+ clearable?: boolean;
32
+ disabled?: boolean;
33
+ error?: string;
34
+ width?: string | number;
35
+ min?: Date;
36
+ max?: Date;
37
+ utc?: boolean;
38
+ presets?: DateTimeRangePreset[];
39
+ };
40
+ declare const DateTimeRangePicker: import("react").ForwardRefExoticComponent<DateTimeRangePickerProps & import("react").RefAttributes<HTMLElement>>;
41
+ export default DateTimeRangePicker;