@sustaina/shared-ui 1.65.5 → 1.67.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.js CHANGED
@@ -4897,6 +4897,14 @@ var ClearButton = ({
4897
4897
  event.stopPropagation();
4898
4898
  triggerClear();
4899
4899
  };
4900
+ const handlePointerDown = (event) => {
4901
+ event.preventDefault();
4902
+ event.stopPropagation();
4903
+ };
4904
+ const handleMouseDown = (event) => {
4905
+ event.preventDefault();
4906
+ event.stopPropagation();
4907
+ };
4900
4908
  const handleKeyDown = (event) => {
4901
4909
  if (event.key === "Enter" || event.key === " ") {
4902
4910
  event.preventDefault();
@@ -4909,6 +4917,8 @@ var ClearButton = ({
4909
4917
  {
4910
4918
  role: "button",
4911
4919
  tabIndex: 0,
4920
+ onPointerDown: handlePointerDown,
4921
+ onMouseDown: handleMouseDown,
4912
4922
  onClick: handleClick,
4913
4923
  onKeyDown: handleKeyDown,
4914
4924
  className: `clear-button ${className}`.trim(),
@@ -10020,6 +10030,291 @@ var DataTable = ({
10020
10030
  );
10021
10031
  };
10022
10032
  var DataTable_default = DataTable;
10033
+ var defaultValueFormatter3 = (date) => dateFns.format(date, "yyyy-MM-dd'T'HH:mm:ss");
10034
+ var parseWithPatterns = (value) => {
10035
+ const patterns = ["yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd"];
10036
+ for (const pattern of patterns) {
10037
+ const parsed = dateFns.parse(value, pattern, /* @__PURE__ */ new Date());
10038
+ if (dateFns.isValid(parsed)) return parsed;
10039
+ }
10040
+ return void 0;
10041
+ };
10042
+ var defaultValueParser3 = (value) => {
10043
+ const isoParsed = dateFns.parseISO(value);
10044
+ if (dateFns.isValid(isoParsed)) return isoParsed;
10045
+ return parseWithPatterns(value);
10046
+ };
10047
+ var DateTimePicker = ({
10048
+ value,
10049
+ onChange,
10050
+ onValueChange,
10051
+ disabled = false,
10052
+ invalid = false,
10053
+ allowClear = true,
10054
+ use24Hour = false,
10055
+ placeholderDate = "Select date",
10056
+ placeholderTime = "Select time",
10057
+ className,
10058
+ datePickerClassName,
10059
+ timePickerClassName,
10060
+ popoverContentClassName,
10061
+ clearAriaLabel = "Clear date time",
10062
+ minuteStep = 5,
10063
+ minDateTime,
10064
+ maxDateTime,
10065
+ valueFormatter,
10066
+ valueParser,
10067
+ datePickerProps,
10068
+ timePickerProps
10069
+ }) => {
10070
+ const [open, setOpen] = React__namespace.default.useState(false);
10071
+ const hourListRef = React__namespace.default.useRef(null);
10072
+ const minuteListRef = React__namespace.default.useRef(null);
10073
+ const parser = React__namespace.default.useMemo(() => valueParser ?? defaultValueParser3, [valueParser]);
10074
+ const outputFormatter = React__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter3, [valueFormatter]);
10075
+ const parseInput = React__namespace.default.useCallback(
10076
+ (input) => {
10077
+ if (input === null || input === void 0) return void 0;
10078
+ if (input instanceof Date) return dateFns.isValid(input) ? input : void 0;
10079
+ const parsed = parser(input);
10080
+ return parsed && dateFns.isValid(parsed) ? parsed : void 0;
10081
+ },
10082
+ [parser]
10083
+ );
10084
+ const isControlled = value !== void 0;
10085
+ const parsedValue = React__namespace.default.useMemo(() => parseInput(value), [parseInput, value]);
10086
+ const [internalValue, setInternalValue] = React__namespace.default.useState(() => parsedValue);
10087
+ React__namespace.default.useEffect(() => {
10088
+ if (isControlled) {
10089
+ setInternalValue(parsedValue);
10090
+ }
10091
+ }, [isControlled, parsedValue]);
10092
+ const currentValue = isControlled ? parsedValue : internalValue;
10093
+ const emitChange = React__namespace.default.useCallback(
10094
+ (next) => {
10095
+ if (!isControlled) {
10096
+ setInternalValue(next);
10097
+ }
10098
+ onChange?.(next);
10099
+ onValueChange?.(next ? outputFormatter(next) : void 0);
10100
+ },
10101
+ [isControlled, onChange, onValueChange, outputFormatter]
10102
+ );
10103
+ const makeDateTime = React__namespace.default.useCallback((baseDate, hour, minute) => {
10104
+ const clampedHour = Math.min(23, Math.max(0, hour));
10105
+ const clampedMinute = Math.min(59, Math.max(0, minute));
10106
+ return new Date(
10107
+ baseDate.getFullYear(),
10108
+ baseDate.getMonth(),
10109
+ baseDate.getDate(),
10110
+ clampedHour,
10111
+ clampedMinute,
10112
+ 0,
10113
+ 0
10114
+ );
10115
+ }, []);
10116
+ const handleDateChange = React__namespace.default.useCallback(
10117
+ (nextDate) => {
10118
+ if (!nextDate) {
10119
+ emitChange(void 0);
10120
+ return;
10121
+ }
10122
+ emitChange(new Date(nextDate.getFullYear(), nextDate.getMonth(), nextDate.getDate(), 0, 0, 0, 0));
10123
+ },
10124
+ [emitChange]
10125
+ );
10126
+ const handleTimeApply = React__namespace.default.useCallback(
10127
+ (hour, minute) => {
10128
+ const baseDate = currentValue;
10129
+ if (!baseDate) return;
10130
+ emitChange(makeDateTime(baseDate, hour, minute));
10131
+ },
10132
+ [currentValue, emitChange, makeDateTime]
10133
+ );
10134
+ const currentHour = currentValue?.getHours();
10135
+ const currentMinute = currentValue?.getMinutes();
10136
+ const handleHourSelect = React__namespace.default.useCallback(
10137
+ (hour) => {
10138
+ handleTimeApply(hour, currentMinute ?? 0);
10139
+ },
10140
+ [currentMinute, handleTimeApply]
10141
+ );
10142
+ const handleMinuteSelect = React__namespace.default.useCallback(
10143
+ (minute) => {
10144
+ handleTimeApply(currentHour ?? 0, minute);
10145
+ setOpen(false);
10146
+ },
10147
+ [currentHour, handleTimeApply]
10148
+ );
10149
+ const hours = React__namespace.default.useMemo(() => Array.from({ length: 24 }, (_, index) => 23 - index), []);
10150
+ const minuteInterval = React__namespace.default.useMemo(() => {
10151
+ const safeStep = Math.min(60, Math.max(1, minuteStep));
10152
+ return Array.from({ length: Math.ceil(60 / safeStep) }, (_, index) => index * safeStep).filter(
10153
+ (value2) => value2 < 60
10154
+ );
10155
+ }, [minuteStep]);
10156
+ const displayLabel = React__namespace.default.useMemo(() => {
10157
+ if (!currentValue) return `${placeholderDate} ${placeholderTime}`;
10158
+ return dateFns.format(currentValue, use24Hour ? "dd/MM/yyyy HH:mm" : "dd/MM/yyyy hh:mm a");
10159
+ }, [currentValue, placeholderDate, placeholderTime, use24Hour]);
10160
+ const canSelectTime = !disabled && !!currentValue;
10161
+ const isHourDisabled = React__namespace.default.useCallback(
10162
+ (hour) => {
10163
+ if (!currentValue) return true;
10164
+ const testDateTime = new Date(
10165
+ currentValue.getFullYear(),
10166
+ currentValue.getMonth(),
10167
+ currentValue.getDate(),
10168
+ hour,
10169
+ 0,
10170
+ 0,
10171
+ 0
10172
+ );
10173
+ if (minDateTime && testDateTime < minDateTime) return true;
10174
+ if (maxDateTime && testDateTime > maxDateTime) return true;
10175
+ return false;
10176
+ },
10177
+ [currentValue, minDateTime, maxDateTime]
10178
+ );
10179
+ const isMinuteDisabled = React__namespace.default.useCallback(
10180
+ (minute) => {
10181
+ if (!currentValue || typeof currentHour === "undefined") return true;
10182
+ const testDateTime = new Date(
10183
+ currentValue.getFullYear(),
10184
+ currentValue.getMonth(),
10185
+ currentValue.getDate(),
10186
+ currentHour,
10187
+ minute,
10188
+ 0,
10189
+ 0
10190
+ );
10191
+ if (minDateTime && testDateTime < minDateTime) return true;
10192
+ if (maxDateTime && testDateTime > maxDateTime) return true;
10193
+ return false;
10194
+ },
10195
+ [currentValue, currentHour, minDateTime, maxDateTime]
10196
+ );
10197
+ const scrollToSelected = React__namespace.default.useCallback((container, selector) => {
10198
+ if (!container) return;
10199
+ const element = container.querySelector(selector);
10200
+ if (!element) return;
10201
+ const target = element.offsetTop - container.clientHeight / 2 + element.clientHeight / 2;
10202
+ container.scrollTo({ top: Math.max(0, target), behavior: "smooth" });
10203
+ }, []);
10204
+ React__namespace.default.useEffect(() => {
10205
+ if (!open) return;
10206
+ if (typeof currentHour === "number") {
10207
+ scrollToSelected(hourListRef.current, `[data-hour="${currentHour}"]`);
10208
+ }
10209
+ if (typeof currentMinute === "number") {
10210
+ scrollToSelected(minuteListRef.current, `[data-minute="${currentMinute}"]`);
10211
+ }
10212
+ }, [currentHour, currentMinute, open, scrollToSelected]);
10213
+ const handleClear = React__namespace.default.useCallback(() => {
10214
+ emitChange(void 0);
10215
+ setOpen(false);
10216
+ }, [emitChange]);
10217
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative w-full", className), children: [
10218
+ /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
10219
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
10220
+ Button,
10221
+ {
10222
+ type: "button",
10223
+ variant: "outline",
10224
+ disabled,
10225
+ "aria-invalid": invalid || void 0,
10226
+ className: cn(
10227
+ "group relative flex! w-full items-center justify-between rounded-md bg-white! pl-4 text-left text-sm font-medium shadow-none border border-sus-secondary-gray-8 focus-visible:ring-0 focus-visible:ring-offset-0 data-[state=open]:border-black disabled:bg-sus-secondary-gray-3!",
10228
+ "min-h-9",
10229
+ currentValue ? "text-gray-700" : "text-gray-400",
10230
+ invalid && "border-destructive focus-visible:border-destructive focus-visible:ring-destructive/30",
10231
+ allowClear && currentValue ? "pr-8" : "pr-4"
10232
+ ),
10233
+ children: [
10234
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate font-light", children: displayLabel }),
10235
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center gap-2 text-black group-disabled:text-sus-secondary-gray-8 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(SuiCalendarIcon2, { className: "h-4 w-4" }) })
10236
+ ]
10237
+ }
10238
+ ) }),
10239
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: cn("w-auto p-0", popoverContentClassName), align: "start", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sm:flex", children: [
10240
+ /* @__PURE__ */ jsxRuntime.jsx(
10241
+ DatePicker,
10242
+ {
10243
+ ...datePickerProps,
10244
+ className: cn(datePickerProps?.className, datePickerClassName),
10245
+ selectionMode: "single",
10246
+ selectedDate: currentValue,
10247
+ onDateSelect: handleDateChange,
10248
+ minDate: minDateTime,
10249
+ maxDate: maxDateTime
10250
+ }
10251
+ ),
10252
+ /* @__PURE__ */ jsxRuntime.jsx(
10253
+ "div",
10254
+ {
10255
+ className: cn(
10256
+ "flex border-t sm:border-t-0 sm:border-l p-2",
10257
+ !canSelectTime && "opacity-60",
10258
+ timePickerClassName,
10259
+ timePickerProps?.panelClassName
10260
+ ),
10261
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full", children: [
10262
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-14 border-r pr-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: hourListRef, className: "h-[300px] overflow-y-auto space-y-1", children: hours.map((hour) => {
10263
+ const selected = currentHour === hour;
10264
+ const hourDisabled = isHourDisabled(hour);
10265
+ return /* @__PURE__ */ jsxRuntime.jsx(
10266
+ "button",
10267
+ {
10268
+ type: "button",
10269
+ "data-hour": hour,
10270
+ disabled: !canSelectTime || hourDisabled,
10271
+ onClick: () => handleHourSelect(hour),
10272
+ className: cn(
10273
+ "h-8 w-full rounded-md text-sm transition-colors",
10274
+ selected ? "bg-[#379a2a] text-white hover:bg-[#379a2a]" : "text-foreground hover:bg-sus-secondary-gray-3",
10275
+ (!canSelectTime || hourDisabled) && "cursor-not-allowed opacity-50"
10276
+ ),
10277
+ children: String(hour).padStart(2, "0")
10278
+ },
10279
+ hour
10280
+ );
10281
+ }) }) }),
10282
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-14 pl-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: minuteListRef, className: "h-[300px] overflow-y-auto space-y-1", children: minuteInterval.map((minute) => {
10283
+ const selected = currentMinute === minute;
10284
+ const minuteDisabled = isMinuteDisabled(minute);
10285
+ return /* @__PURE__ */ jsxRuntime.jsx(
10286
+ "button",
10287
+ {
10288
+ type: "button",
10289
+ "data-minute": minute,
10290
+ disabled: !canSelectTime || minuteDisabled,
10291
+ onClick: () => handleMinuteSelect(minute),
10292
+ className: cn(
10293
+ "h-8 w-full rounded-md text-sm transition-colors",
10294
+ selected ? "bg-[#379a2a] text-white hover:bg-[#379a2a]" : "text-foreground hover:bg-sus-secondary-gray-3",
10295
+ (!canSelectTime || minuteDisabled) && "cursor-not-allowed opacity-50"
10296
+ ),
10297
+ children: String(minute).padStart(2, "0")
10298
+ },
10299
+ minute
10300
+ );
10301
+ }) }) })
10302
+ ] })
10303
+ }
10304
+ )
10305
+ ] }) })
10306
+ ] }),
10307
+ allowClear && !!currentValue && !disabled && /* @__PURE__ */ jsxRuntime.jsx(
10308
+ ClearButton,
10309
+ {
10310
+ onClick: handleClear,
10311
+ ariaLabel: clearAriaLabel,
10312
+ title: clearAriaLabel,
10313
+ className: "absolute right-3 top-1/2 z-10 -translate-y-1/2"
10314
+ }
10315
+ )
10316
+ ] });
10317
+ };
10023
10318
  function Dialog2(props) {
10024
10319
  return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Root, { "data-slot": "dialog", ...props });
10025
10320
  }
@@ -10505,6 +10800,18 @@ var DIALOG_ALERT_TEMPLATES = {
10505
10800
  title: "confirm.logout.title",
10506
10801
  description: "confirm.logout.description",
10507
10802
  confirmText: "confirm.logout.confirm_text"
10803
+ },
10804
+ "confirm.set_default": {
10805
+ variant: "confirm",
10806
+ title: "confirm.set_default.title",
10807
+ description: "confirm.set_default.description",
10808
+ confirmText: "confirm.set_default.confirm_text"
10809
+ },
10810
+ "confirm.unset_default": {
10811
+ variant: "confirm",
10812
+ title: "confirm.unset_default.title",
10813
+ description: "confirm.unset_default.description",
10814
+ confirmText: "confirm.unset_default.confirm_text"
10508
10815
  }
10509
10816
  };
10510
10817
 
@@ -10634,6 +10941,16 @@ var defaultResource = {
10634
10941
  title: "Confirmation",
10635
10942
  description: "Do you want to log out?",
10636
10943
  confirm_text: "Logout"
10944
+ },
10945
+ "confirm.set_default": {
10946
+ title: "Confirmation",
10947
+ description: "Set this item as the default?",
10948
+ confirm_text: "Confirm"
10949
+ },
10950
+ "confirm.unset_default": {
10951
+ title: "Confirmation",
10952
+ description: "Remove default status from this item?",
10953
+ confirm_text: "Confirm"
10637
10954
  }
10638
10955
  }
10639
10956
  }
@@ -16376,351 +16693,6 @@ var RightPanelContainer = ({
16376
16693
  );
16377
16694
  };
16378
16695
  var RightPanelContainer_default = RightPanelContainer;
16379
- var defaultDisplayFormatter3 = (date, use24Hour) => use24Hour ? dateFns.format(date, "HH:mm") : dateFns.format(date, "hh:mm a");
16380
- var defaultValueFormatter3 = (date) => dateFns.format(date, "HH:mm");
16381
- var defaultValueParser3 = (value) => {
16382
- let parsed = dateFns.parse(value, "HH:mm", /* @__PURE__ */ new Date());
16383
- if (dateFns.isValid(parsed)) return parsed;
16384
- parsed = dateFns.parse(value, "HH:mm:ss", /* @__PURE__ */ new Date());
16385
- if (dateFns.isValid(parsed)) return parsed;
16386
- parsed = dateFns.parse(value, "hh:mm a", /* @__PURE__ */ new Date());
16387
- if (dateFns.isValid(parsed)) return parsed;
16388
- return void 0;
16389
- };
16390
- var TimePicker = React__namespace.forwardRef(
16391
- ({
16392
- value,
16393
- onChange,
16394
- onValueChange,
16395
- disabled = false,
16396
- className,
16397
- buttonClassName,
16398
- wrapperClassName,
16399
- placeholder: placeholder2,
16400
- use24Hour = false,
16401
- iconPosition = "start",
16402
- icon,
16403
- allowClear = true,
16404
- clearAriaLabel = "Clear time",
16405
- displayFormatter,
16406
- valueFormatter,
16407
- valueParser,
16408
- invalid = false
16409
- }, ref) => {
16410
- const [open, setOpen] = React__namespace.useState(false);
16411
- const [hours, setHours] = React__namespace.useState("12");
16412
- const [minutes, setMinutes] = React__namespace.useState("00");
16413
- const [period, setPeriod] = React__namespace.useState("AM");
16414
- const parser = React__namespace.useMemo(() => valueParser ?? defaultValueParser3, [valueParser]);
16415
- const outputFormatter = React__namespace.useMemo(
16416
- () => valueFormatter ?? defaultValueFormatter3,
16417
- [valueFormatter]
16418
- );
16419
- const labelFormatter = React__namespace.useMemo(
16420
- () => displayFormatter ?? defaultDisplayFormatter3,
16421
- [displayFormatter]
16422
- );
16423
- const parseInput = React__namespace.useCallback(
16424
- (input) => {
16425
- if (input === null || input === void 0) return void 0;
16426
- if (input instanceof Date) return dateFns.isValid(input) ? input : void 0;
16427
- const parsed = parser(input);
16428
- return parsed && dateFns.isValid(parsed) ? parsed : void 0;
16429
- },
16430
- [parser]
16431
- );
16432
- const parsedValue = React__namespace.useMemo(() => parseInput(value), [parseInput, value]);
16433
- const hasValue = parsedValue !== void 0;
16434
- React__namespace.useEffect(() => {
16435
- if (parsedValue) {
16436
- const hour24 = parsedValue.getHours();
16437
- const minute = parsedValue.getMinutes();
16438
- if (use24Hour) {
16439
- setHours(String(hour24).padStart(2, "0"));
16440
- } else {
16441
- const newPeriod = hour24 >= 12 ? "PM" : "AM";
16442
- const hour12 = hour24 === 0 ? 12 : hour24 > 12 ? hour24 - 12 : hour24;
16443
- setHours(String(hour12).padStart(2, "0"));
16444
- setPeriod(newPeriod);
16445
- }
16446
- setMinutes(String(minute).padStart(2, "0"));
16447
- } else {
16448
- setHours(use24Hour ? "00" : "12");
16449
- setMinutes("00");
16450
- setPeriod("AM");
16451
- }
16452
- }, [parsedValue, use24Hour]);
16453
- const createTimeDate = (h, m, p) => {
16454
- let hour = parseInt(h) || 0;
16455
- const minute = parseInt(m) || 0;
16456
- if (!use24Hour) {
16457
- if (p === "PM" && hour !== 12) {
16458
- hour += 12;
16459
- } else if (p === "AM" && hour === 12) {
16460
- hour = 0;
16461
- }
16462
- }
16463
- const today = /* @__PURE__ */ new Date();
16464
- return new Date(today.getFullYear(), today.getMonth(), today.getDate(), hour, minute, 0, 0);
16465
- };
16466
- const emitChange = (date) => {
16467
- onChange?.(date);
16468
- onValueChange?.(outputFormatter(date));
16469
- };
16470
- const handleClear = () => {
16471
- onChange?.(void 0);
16472
- onValueChange?.(void 0);
16473
- };
16474
- const handleHourChange = (newHour) => {
16475
- const hour = parseInt(newHour) || 0;
16476
- const maxHour = use24Hour ? 23 : 12;
16477
- const minHour = use24Hour ? 0 : 1;
16478
- if (hour <= maxHour && hour >= minHour) {
16479
- setHours(newHour.padStart(2, "0"));
16480
- emitChange(createTimeDate(newHour, minutes, period));
16481
- }
16482
- };
16483
- const handleMinuteChange = (newMinute) => {
16484
- const minute = parseInt(newMinute) || 0;
16485
- if (minute <= 59 && minute >= 0) {
16486
- setMinutes(newMinute.padStart(2, "0"));
16487
- emitChange(createTimeDate(hours, newMinute, period));
16488
- }
16489
- };
16490
- const handlePeriodToggle = () => {
16491
- const newPeriod = period === "AM" ? "PM" : "AM";
16492
- setPeriod(newPeriod);
16493
- emitChange(createTimeDate(hours, minutes, newPeriod));
16494
- };
16495
- const incrementHour = () => {
16496
- const hour = parseInt(hours) || 0;
16497
- const maxHour = use24Hour ? 23 : 12;
16498
- const minHour = use24Hour ? 0 : 1;
16499
- const newHour = hour >= maxHour ? minHour : hour + 1;
16500
- handleHourChange(String(newHour));
16501
- };
16502
- const decrementHour = () => {
16503
- const hour = parseInt(hours) || 0;
16504
- const maxHour = use24Hour ? 23 : 12;
16505
- const minHour = use24Hour ? 0 : 1;
16506
- const newHour = hour <= minHour ? maxHour : hour - 1;
16507
- handleHourChange(String(newHour));
16508
- };
16509
- const incrementMinute = () => {
16510
- const minute = parseInt(minutes) || 0;
16511
- const newMinute = minute >= 59 ? 0 : minute + 1;
16512
- handleMinuteChange(String(newMinute));
16513
- };
16514
- const decrementMinute = () => {
16515
- const minute = parseInt(minutes) || 0;
16516
- const newMinute = minute <= 0 ? 59 : minute - 1;
16517
- handleMinuteChange(String(newMinute));
16518
- };
16519
- const displayValue = parsedValue ? labelFormatter(parsedValue, use24Hour) : placeholder2;
16520
- const displayIcon = icon || /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-4 w-4" });
16521
- const showClear = allowClear && hasValue && !disabled;
16522
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative inline-flex w-full", wrapperClassName), children: [
16523
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
16524
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
16525
- Button,
16526
- {
16527
- variant: "outline",
16528
- disabled,
16529
- className: cn(
16530
- "w-full justify-between text-left font-normal",
16531
- !hasValue && "text-muted-foreground",
16532
- invalid && "border-destructive focus-visible:ring-destructive",
16533
- showClear && "pr-8",
16534
- buttonClassName,
16535
- className
16536
- ),
16537
- children: [
16538
- iconPosition === "start" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: displayIcon }),
16539
- /* @__PURE__ */ jsxRuntime.jsx(
16540
- "span",
16541
- {
16542
- className: cn(
16543
- "flex-1 truncate",
16544
- iconPosition === "start" && "ml-2",
16545
- iconPosition === "end" && "mr-2"
16546
- ),
16547
- children: displayValue || placeholder2 || "Select time"
16548
- }
16549
- ),
16550
- iconPosition === "end" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: displayIcon })
16551
- ]
16552
- }
16553
- ) }),
16554
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-4", align: "start", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
16555
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-1", children: [
16556
- /* @__PURE__ */ jsxRuntime.jsx(
16557
- Button,
16558
- {
16559
- variant: "ghost",
16560
- size: "icon",
16561
- className: "h-8 w-8",
16562
- onClick: incrementHour,
16563
- type: "button",
16564
- children: /* @__PURE__ */ jsxRuntime.jsx(
16565
- "svg",
16566
- {
16567
- xmlns: "http://www.w3.org/2000/svg",
16568
- width: "16",
16569
- height: "16",
16570
- viewBox: "0 0 24 24",
16571
- fill: "none",
16572
- stroke: "currentColor",
16573
- strokeWidth: "2",
16574
- strokeLinecap: "round",
16575
- strokeLinejoin: "round",
16576
- children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "18 15 12 9 6 15" })
16577
- }
16578
- )
16579
- }
16580
- ),
16581
- /* @__PURE__ */ jsxRuntime.jsx(
16582
- Input,
16583
- {
16584
- ref,
16585
- type: "text",
16586
- inputMode: "numeric",
16587
- value: hours,
16588
- onChange: (e) => handleHourChange(e.target.value),
16589
- className: "w-16 text-center",
16590
- maxLength: 2
16591
- }
16592
- ),
16593
- /* @__PURE__ */ jsxRuntime.jsx(
16594
- Button,
16595
- {
16596
- variant: "ghost",
16597
- size: "icon",
16598
- className: "h-8 w-8",
16599
- onClick: decrementHour,
16600
- type: "button",
16601
- children: /* @__PURE__ */ jsxRuntime.jsx(
16602
- "svg",
16603
- {
16604
- xmlns: "http://www.w3.org/2000/svg",
16605
- width: "16",
16606
- height: "16",
16607
- viewBox: "0 0 24 24",
16608
- fill: "none",
16609
- stroke: "currentColor",
16610
- strokeWidth: "2",
16611
- strokeLinecap: "round",
16612
- strokeLinejoin: "round",
16613
- children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "6 9 12 15 18 9" })
16614
- }
16615
- )
16616
- }
16617
- )
16618
- ] }),
16619
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-2xl font-semibold", children: ":" }),
16620
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-1", children: [
16621
- /* @__PURE__ */ jsxRuntime.jsx(
16622
- Button,
16623
- {
16624
- variant: "ghost",
16625
- size: "icon",
16626
- className: "h-8 w-8",
16627
- onClick: incrementMinute,
16628
- type: "button",
16629
- children: /* @__PURE__ */ jsxRuntime.jsx(
16630
- "svg",
16631
- {
16632
- xmlns: "http://www.w3.org/2000/svg",
16633
- width: "16",
16634
- height: "16",
16635
- viewBox: "0 0 24 24",
16636
- fill: "none",
16637
- stroke: "currentColor",
16638
- strokeWidth: "2",
16639
- strokeLinecap: "round",
16640
- strokeLinejoin: "round",
16641
- children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "18 15 12 9 6 15" })
16642
- }
16643
- )
16644
- }
16645
- ),
16646
- /* @__PURE__ */ jsxRuntime.jsx(
16647
- Input,
16648
- {
16649
- type: "text",
16650
- inputMode: "numeric",
16651
- value: minutes,
16652
- onChange: (e) => handleMinuteChange(e.target.value),
16653
- className: "w-16 text-center",
16654
- maxLength: 2
16655
- }
16656
- ),
16657
- /* @__PURE__ */ jsxRuntime.jsx(
16658
- Button,
16659
- {
16660
- variant: "ghost",
16661
- size: "icon",
16662
- className: "h-8 w-8",
16663
- onClick: decrementMinute,
16664
- type: "button",
16665
- children: /* @__PURE__ */ jsxRuntime.jsx(
16666
- "svg",
16667
- {
16668
- xmlns: "http://www.w3.org/2000/svg",
16669
- width: "16",
16670
- height: "16",
16671
- viewBox: "0 0 24 24",
16672
- fill: "none",
16673
- stroke: "currentColor",
16674
- strokeWidth: "2",
16675
- strokeLinecap: "round",
16676
- strokeLinejoin: "round",
16677
- children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "6 9 12 15 18 9" })
16678
- }
16679
- )
16680
- }
16681
- )
16682
- ] }),
16683
- !use24Hour && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16684
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-16 bg-border mx-1" }),
16685
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-1", children: [
16686
- /* @__PURE__ */ jsxRuntime.jsx(
16687
- Button,
16688
- {
16689
- variant: period === "AM" ? "default" : "outline",
16690
- size: "sm",
16691
- className: "w-14 h-12",
16692
- onClick: handlePeriodToggle,
16693
- type: "button",
16694
- children: "AM"
16695
- }
16696
- ),
16697
- /* @__PURE__ */ jsxRuntime.jsx(
16698
- Button,
16699
- {
16700
- variant: period === "PM" ? "default" : "outline",
16701
- size: "sm",
16702
- className: "w-14 h-12",
16703
- onClick: handlePeriodToggle,
16704
- type: "button",
16705
- children: "PM"
16706
- }
16707
- )
16708
- ] })
16709
- ] })
16710
- ] }) })
16711
- ] }),
16712
- showClear && /* @__PURE__ */ jsxRuntime.jsx(
16713
- ClearButton,
16714
- {
16715
- onClick: handleClear,
16716
- ariaLabel: clearAriaLabel,
16717
- className: "absolute right-2 top-1/2 -translate-y-1/2"
16718
- }
16719
- )
16720
- ] });
16721
- }
16722
- );
16723
- TimePicker.displayName = "TimePicker";
16724
16696
 
16725
16697
  // src/components/cropperModal/type.ts
16726
16698
  var CropperModalError = class extends Error {
@@ -18724,6 +18696,7 @@ exports.DashboardIcon = DashboardIcon;
18724
18696
  exports.DataEntryIcon = DataEntryIcon;
18725
18697
  exports.DataTable = DataTable_default;
18726
18698
  exports.DatePicker = DatePicker2;
18699
+ exports.DateTimePicker = DateTimePicker;
18727
18700
  exports.DecreaseIcon = DecreaseIcon;
18728
18701
  exports.Dialog = Dialog2;
18729
18702
  exports.DialogAlert = DialogAlert;
@@ -18888,7 +18861,6 @@ exports.TableOfContents = TableOfContents;
18888
18861
  exports.TableRow = TableRow;
18889
18862
  exports.TagListViewIcon = TagListViewIcon;
18890
18863
  exports.TextArea = TextArea;
18891
- exports.TimePicker = TimePicker;
18892
18864
  exports.ToolBoxIcon = ToolBoxIcon;
18893
18865
  exports.Tooltip = Tooltip2;
18894
18866
  exports.TooltipArrow = TooltipArrow;