@underverse-ui/underverse 1.0.130 → 1.0.131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -924,6 +924,7 @@ interface DateRangePickerProps {
924
924
  maxDate?: Date;
925
925
  /** Size variant */
926
926
  size?: "sm" | "md" | "lg";
927
+ disabled?: boolean;
927
928
  }
928
929
  declare const DateRangePicker: React$1.FC<DateRangePickerProps>;
929
930
  declare const CompactDatePicker: React$1.FC<{
@@ -2867,6 +2868,10 @@ declare function formatDateWithDay(date: string | Date | null | undefined, local
2867
2868
  * // "25/12/2024 14:30" (older)
2868
2869
  */
2869
2870
  declare function formatDateSmart(date: string | Date | null | undefined, locale?: SupportedLocale): string;
2871
+ /**
2872
+ * Parse date string based on locale
2873
+ */
2874
+ declare function parseDateString(str: string, locale?: SupportedLocale): Date | null;
2870
2875
 
2871
2876
  type date_SupportedLocale = SupportedLocale;
2872
2877
  declare const date_formatDate: typeof formatDate;
@@ -2881,8 +2886,9 @@ declare const date_formatTimeAgo: typeof formatTimeAgo;
2881
2886
  declare const date_getDayOfWeek: typeof getDayOfWeek;
2882
2887
  declare const date_isToday: typeof isToday;
2883
2888
  declare const date_isYesterday: typeof isYesterday;
2889
+ declare const date_parseDateString: typeof parseDateString;
2884
2890
  declare namespace date {
2885
- export { type date_SupportedLocale as SupportedLocale, date_formatDate as formatDate, date_formatDateForInput as formatDateForInput, date_formatDateShort as formatDateShort, date_formatDateSmart as formatDateSmart, date_formatDateTime as formatDateTime, date_formatDateTimeForInput as formatDateTimeForInput, date_formatDateWithDay as formatDateWithDay, date_formatTime as formatTime, date_formatTimeAgo as formatTimeAgo, date_getDayOfWeek as getDayOfWeek, date_isToday as isToday, date_isYesterday as isYesterday };
2891
+ export { type date_SupportedLocale as SupportedLocale, date_formatDate as formatDate, date_formatDateForInput as formatDateForInput, date_formatDateShort as formatDateShort, date_formatDateSmart as formatDateSmart, date_formatDateTime as formatDateTime, date_formatDateTimeForInput as formatDateTimeForInput, date_formatDateWithDay as formatDateWithDay, date_formatTime as formatTime, date_formatTimeAgo as formatTimeAgo, date_getDayOfWeek as getDayOfWeek, date_isToday as isToday, date_isYesterday as isYesterday, date_parseDateString as parseDateString };
2886
2892
  }
2887
2893
 
2888
2894
  /**
package/dist/index.d.ts CHANGED
@@ -924,6 +924,7 @@ interface DateRangePickerProps {
924
924
  maxDate?: Date;
925
925
  /** Size variant */
926
926
  size?: "sm" | "md" | "lg";
927
+ disabled?: boolean;
927
928
  }
928
929
  declare const DateRangePicker: React$1.FC<DateRangePickerProps>;
929
930
  declare const CompactDatePicker: React$1.FC<{
@@ -2867,6 +2868,10 @@ declare function formatDateWithDay(date: string | Date | null | undefined, local
2867
2868
  * // "25/12/2024 14:30" (older)
2868
2869
  */
2869
2870
  declare function formatDateSmart(date: string | Date | null | undefined, locale?: SupportedLocale): string;
2871
+ /**
2872
+ * Parse date string based on locale
2873
+ */
2874
+ declare function parseDateString(str: string, locale?: SupportedLocale): Date | null;
2870
2875
 
2871
2876
  type date_SupportedLocale = SupportedLocale;
2872
2877
  declare const date_formatDate: typeof formatDate;
@@ -2881,8 +2886,9 @@ declare const date_formatTimeAgo: typeof formatTimeAgo;
2881
2886
  declare const date_getDayOfWeek: typeof getDayOfWeek;
2882
2887
  declare const date_isToday: typeof isToday;
2883
2888
  declare const date_isYesterday: typeof isYesterday;
2889
+ declare const date_parseDateString: typeof parseDateString;
2884
2890
  declare namespace date {
2885
- export { type date_SupportedLocale as SupportedLocale, date_formatDate as formatDate, date_formatDateForInput as formatDateForInput, date_formatDateShort as formatDateShort, date_formatDateSmart as formatDateSmart, date_formatDateTime as formatDateTime, date_formatDateTimeForInput as formatDateTimeForInput, date_formatDateWithDay as formatDateWithDay, date_formatTime as formatTime, date_formatTimeAgo as formatTimeAgo, date_getDayOfWeek as getDayOfWeek, date_isToday as isToday, date_isYesterday as isYesterday };
2891
+ export { type date_SupportedLocale as SupportedLocale, date_formatDate as formatDate, date_formatDateForInput as formatDateForInput, date_formatDateShort as formatDateShort, date_formatDateSmart as formatDateSmart, date_formatDateTime as formatDateTime, date_formatDateTimeForInput as formatDateTimeForInput, date_formatDateWithDay as formatDateWithDay, date_formatTime as formatTime, date_formatTimeAgo as formatTimeAgo, date_getDayOfWeek as getDayOfWeek, date_isToday as isToday, date_isYesterday as isYesterday, date_parseDateString as parseDateString };
2886
2892
  }
2887
2893
 
2888
2894
  /**
package/dist/index.js CHANGED
@@ -8331,7 +8331,8 @@ __export(date_exports, {
8331
8331
  formatTimeAgo: () => formatTimeAgo,
8332
8332
  getDayOfWeek: () => getDayOfWeek,
8333
8333
  isToday: () => isToday,
8334
- isYesterday: () => isYesterday
8334
+ isYesterday: () => isYesterday,
8335
+ parseDateString: () => parseDateString
8335
8336
  });
8336
8337
  var localeMap = {
8337
8338
  en: "en-US",
@@ -8530,6 +8531,44 @@ function formatDateSmart(date, locale = "en") {
8530
8531
  }
8531
8532
  return formatDateTime(date, locale);
8532
8533
  }
8534
+ function parseDateString(str, locale = "en") {
8535
+ if (!str) return null;
8536
+ const cleaned = str.trim();
8537
+ if (!cleaned) return null;
8538
+ const parts = cleaned.split(/[\/\-\.\s]+/).filter(Boolean);
8539
+ if (parts.length !== 3) return null;
8540
+ let day = 0;
8541
+ let month = 0;
8542
+ let year = 0;
8543
+ if (locale === "vi") {
8544
+ day = parseInt(parts[0], 10);
8545
+ month = parseInt(parts[1], 10);
8546
+ year = parseInt(parts[2], 10);
8547
+ } else if (locale === "ja" || locale === "ko") {
8548
+ year = parseInt(parts[0], 10);
8549
+ month = parseInt(parts[1], 10);
8550
+ day = parseInt(parts[2], 10);
8551
+ } else {
8552
+ if (parts[0].length === 4) {
8553
+ year = parseInt(parts[0], 10);
8554
+ month = parseInt(parts[1], 10);
8555
+ day = parseInt(parts[2], 10);
8556
+ } else {
8557
+ month = parseInt(parts[0], 10);
8558
+ day = parseInt(parts[1], 10);
8559
+ year = parseInt(parts[2], 10);
8560
+ }
8561
+ }
8562
+ if (isNaN(day) || isNaN(month) || isNaN(year)) return null;
8563
+ if (year < 100) {
8564
+ year += year >= 50 ? 1900 : 2e3;
8565
+ }
8566
+ const parsedDate = new Date(year, month - 1, day);
8567
+ if (parsedDate.getFullYear() === year && parsedDate.getMonth() === month - 1 && parsedDate.getDate() === day) {
8568
+ return parsedDate;
8569
+ }
8570
+ return null;
8571
+ }
8533
8572
 
8534
8573
  // src/components/DatePicker.tsx
8535
8574
  import { Calendar, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3, Sparkles, X as XIcon } from "lucide-react";
@@ -8562,8 +8601,83 @@ var DatePicker = ({
8562
8601
  const [viewMode, setViewMode] = React30.useState("calendar");
8563
8602
  const [localRequiredError, setLocalRequiredError] = React30.useState();
8564
8603
  const triggerRef = React30.useRef(null);
8604
+ const inputRef = React30.useRef(null);
8565
8605
  const wheelContainerRef = React30.useRef(null);
8566
8606
  const wheelDeltaRef = React30.useRef(0);
8607
+ const [isFocused, setIsFocused] = React30.useState(false);
8608
+ const [inputValue, setInputValue] = React30.useState("");
8609
+ React30.useEffect(() => {
8610
+ if (value) {
8611
+ const parsed = parseDateString(inputValue, locale);
8612
+ const isSame = parsed && parsed.getTime() === value.getTime();
8613
+ if (!isSame) {
8614
+ setInputValue(formatDateShort(value, locale));
8615
+ }
8616
+ } else if (!isFocused) {
8617
+ setInputValue("");
8618
+ }
8619
+ }, [value, locale, isFocused]);
8620
+ const handleInputChange = (e) => {
8621
+ const text = e.target.value;
8622
+ setInputValue(text);
8623
+ const parsedDate = parseDateString(text, locale);
8624
+ if (parsedDate) {
8625
+ if (!isDateDisabled(parsedDate)) {
8626
+ onChange(parsedDate);
8627
+ setViewDate(parsedDate);
8628
+ setLocalRequiredError(void 0);
8629
+ }
8630
+ }
8631
+ };
8632
+ const handleInputBlur = () => {
8633
+ setIsFocused(false);
8634
+ if (!inputValue.trim()) {
8635
+ if (required) {
8636
+ setLocalRequiredError(tv("required"));
8637
+ } else {
8638
+ onChange(void 0);
8639
+ setLocalRequiredError(void 0);
8640
+ }
8641
+ } else {
8642
+ const parsedDate = parseDateString(inputValue, locale);
8643
+ if (parsedDate && !isDateDisabled(parsedDate)) {
8644
+ onChange(parsedDate);
8645
+ setInputValue(formatDateShort(parsedDate, locale));
8646
+ setLocalRequiredError(void 0);
8647
+ } else {
8648
+ if (value) {
8649
+ setInputValue(formatDateShort(value, locale));
8650
+ setLocalRequiredError(void 0);
8651
+ } else {
8652
+ setInputValue("");
8653
+ if (required) {
8654
+ setLocalRequiredError(tv("required"));
8655
+ }
8656
+ }
8657
+ }
8658
+ }
8659
+ };
8660
+ const handleInputKeyDown = (e) => {
8661
+ if (e.key === "Enter") {
8662
+ e.preventDefault();
8663
+ const parsedDate = parseDateString(inputValue, locale);
8664
+ if (parsedDate && !isDateDisabled(parsedDate)) {
8665
+ onChange(parsedDate);
8666
+ setInputValue(formatDateShort(parsedDate, locale));
8667
+ setViewDate(parsedDate);
8668
+ setIsOpen(false);
8669
+ setLocalRequiredError(void 0);
8670
+ } else if (!inputValue.trim() && !required) {
8671
+ onChange(void 0);
8672
+ setIsOpen(false);
8673
+ setLocalRequiredError(void 0);
8674
+ } else {
8675
+ setIsOpen(false);
8676
+ }
8677
+ } else if (e.key === "Escape") {
8678
+ setIsOpen(false);
8679
+ }
8680
+ };
8567
8681
  const normalizeToLocalDay = React30.useCallback((date) => {
8568
8682
  if (!date) return null;
8569
8683
  return new Date(date.getFullYear(), date.getMonth(), date.getDate());
@@ -8954,7 +9068,7 @@ var DatePicker = ({
8954
9068
  {
8955
9069
  id: labelId,
8956
9070
  htmlFor: resolvedId,
8957
- onClick: () => triggerRef.current?.focus(),
9071
+ onClick: () => inputRef.current?.focus(),
8958
9072
  className: cn(
8959
9073
  labelSize,
8960
9074
  "font-semibold transition-colors duration-300 cursor-pointer",
@@ -9003,12 +9117,12 @@ var DatePicker = ({
9003
9117
  "animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
9004
9118
  ),
9005
9119
  trigger: /* @__PURE__ */ jsxs24(
9006
- "button",
9120
+ "div",
9007
9121
  {
9008
9122
  ref: triggerRef,
9009
- type: "button",
9010
- disabled,
9011
9123
  id: resolvedId,
9124
+ role: "button",
9125
+ "aria-label": value ? formatDateDisplay(value) : placeholder || t("placeholder"),
9012
9126
  "aria-labelledby": labelId,
9013
9127
  "aria-required": required,
9014
9128
  "aria-invalid": !!effectiveError,
@@ -9016,17 +9130,18 @@ var DatePicker = ({
9016
9130
  "group flex w-full items-center justify-between border bg-background/80 backdrop-blur-sm",
9017
9131
  "rounded-full",
9018
9132
  sizeStyles8[size].trigger,
9019
- "border-border/60 hover:border-primary/40",
9020
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
9021
- "disabled:opacity-50 disabled:cursor-not-allowed",
9022
- "hover:bg-accent/10 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",
9133
+ disabled ? "border-border/40 opacity-50 cursor-not-allowed" : [
9134
+ "border-border/60 hover:border-primary/40",
9135
+ "focus-within:ring-2 focus-within:ring-primary/50 focus-within:ring-offset-2 focus-within:ring-offset-background focus-within:border-transparent focus-within:hover:border-transparent",
9136
+ "hover:bg-accent/10 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5"
9137
+ ],
9023
9138
  "transition-all duration-300 ease-out",
9024
- isOpen && "ring-2 ring-primary/30 border-primary/50 shadow-lg shadow-primary/10",
9025
- effectiveError && "border-destructive/60 focus-visible:ring-destructive/50 bg-destructive/5",
9139
+ isOpen && !isFocused && "ring-2 ring-primary/30 border-primary/50 shadow-lg shadow-primary/10",
9140
+ effectiveError && "border-destructive/60 focus-within:ring-destructive/50 bg-destructive/5",
9026
9141
  className
9027
9142
  ),
9028
9143
  children: [
9029
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2.5", children: [
9144
+ /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2.5 flex-1 min-w-0", children: [
9030
9145
  /* @__PURE__ */ jsx35(
9031
9146
  "div",
9032
9147
  {
@@ -9038,14 +9153,31 @@ var DatePicker = ({
9038
9153
  }
9039
9154
  ),
9040
9155
  /* @__PURE__ */ jsx35(
9041
- "span",
9156
+ "input",
9042
9157
  {
9043
- className: cn("truncate font-medium transition-colors duration-200", !value && "text-muted-foreground", value && "text-foreground"),
9044
- children: value ? formatDateDisplay(value) : placeholder || t("placeholder")
9158
+ ref: inputRef,
9159
+ type: "text",
9160
+ disabled,
9161
+ placeholder: placeholder || t("placeholder"),
9162
+ value: isFocused ? inputValue : value ? formatDateDisplay(value) : "",
9163
+ onChange: handleInputChange,
9164
+ onFocus: () => {
9165
+ setIsFocused(true);
9166
+ if (!disabled) setIsOpen(true);
9167
+ },
9168
+ onBlur: handleInputBlur,
9169
+ onKeyDown: handleInputKeyDown,
9170
+ onClick: (e) => {
9171
+ if (isOpen) {
9172
+ e.stopPropagation();
9173
+ }
9174
+ },
9175
+ className: "w-full bg-transparent border-none outline-none focus:outline-none p-0 text-foreground font-medium placeholder-muted-foreground/60 min-w-0"
9045
9176
  }
9046
- )
9177
+ ),
9178
+ /* @__PURE__ */ jsx35("span", { className: "sr-only", children: value ? formatDateDisplay(value) : placeholder || t("placeholder") })
9047
9179
  ] }),
9048
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1", children: [
9180
+ /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1 shrink-0", children: [
9049
9181
  value && /* @__PURE__ */ jsx35(
9050
9182
  "span",
9051
9183
  {
@@ -9105,7 +9237,8 @@ var DateRangePicker = ({
9105
9237
  disablePastDates = false,
9106
9238
  minDate,
9107
9239
  maxDate,
9108
- size = "md"
9240
+ size = "md",
9241
+ disabled = false
9109
9242
  }) => {
9110
9243
  const locale = useSmartLocale();
9111
9244
  const t = useSmartTranslations("DatePicker");
@@ -9115,6 +9248,165 @@ var DateRangePicker = ({
9115
9248
  const [localRequiredError, setLocalRequiredError] = React30.useState();
9116
9249
  const wheelContainerRef = React30.useRef(null);
9117
9250
  const wheelDeltaRef = React30.useRef(0);
9251
+ const triggerRef = React30.useRef(null);
9252
+ const inputRef = React30.useRef(null);
9253
+ const [isFocused, setIsFocused] = React30.useState(false);
9254
+ const [inputValue, setInputValue] = React30.useState("");
9255
+ const todayDate = React30.useMemo(() => {
9256
+ const today = /* @__PURE__ */ new Date();
9257
+ return new Date(today.getFullYear(), today.getMonth(), today.getDate());
9258
+ }, []);
9259
+ const getRangeString = React30.useCallback((s, e) => {
9260
+ if (!s) return "";
9261
+ const startStr = formatDateShort(s, locale);
9262
+ if (!e) return `${startStr} - `;
9263
+ return `${startStr} - ${formatDateShort(e, locale)}`;
9264
+ }, [locale]);
9265
+ React30.useEffect(() => {
9266
+ if (startDate) {
9267
+ const parts = inputValue.split(/\s*-\s*/);
9268
+ const inputStart = parts[0] ? parseDateString(parts[0], locale) : null;
9269
+ const inputEnd = parts[1] ? parseDateString(parts[1], locale) : null;
9270
+ const startSame = inputStart && startDate && inputStart.getTime() === startDate.getTime();
9271
+ const endSame = !endDate && !inputEnd || endDate && inputEnd && endDate.getTime() === inputEnd.getTime();
9272
+ if (!(startSame && endSame)) {
9273
+ setInputValue(getRangeString(startDate, endDate));
9274
+ }
9275
+ } else if (!isFocused) {
9276
+ setInputValue("");
9277
+ }
9278
+ }, [startDate, endDate, locale, isFocused, getRangeString]);
9279
+ const handleInputChange = (e) => {
9280
+ const text = e.target.value;
9281
+ setInputValue(text);
9282
+ const parts = text.split(/\s*-\s*/);
9283
+ if (parts.length === 2) {
9284
+ const s = parseDateString(parts[0], locale);
9285
+ const eVal = parseDateString(parts[1], locale);
9286
+ if (s) {
9287
+ const isStartDisabled = disablePastDates && s < todayDate || !!minDay && s < minDay || !!maxDay && s > maxDay;
9288
+ if (!isStartDisabled) {
9289
+ setTempStart(s);
9290
+ if (eVal) {
9291
+ const isEndDisabled = disablePastDates && eVal < todayDate || !!minDay && eVal < minDay || !!maxDay && eVal > maxDay;
9292
+ if (!isEndDisabled && s <= eVal) {
9293
+ setTempEnd(eVal);
9294
+ onChange(s, eVal);
9295
+ setViewDate(s);
9296
+ setLocalRequiredError(void 0);
9297
+ } else {
9298
+ setTempEnd(null);
9299
+ onChange(s, null);
9300
+ }
9301
+ } else {
9302
+ setTempEnd(null);
9303
+ onChange(s, null);
9304
+ }
9305
+ }
9306
+ }
9307
+ } else if (parts.length === 1 && parts[0].trim()) {
9308
+ const s = parseDateString(parts[0], locale);
9309
+ if (s) {
9310
+ const isStartDisabled = disablePastDates && s < todayDate || !!minDay && s < minDay || !!maxDay && s > maxDay;
9311
+ if (!isStartDisabled) {
9312
+ setTempStart(s);
9313
+ setTempEnd(null);
9314
+ onChange(s, null);
9315
+ }
9316
+ }
9317
+ }
9318
+ };
9319
+ const handleInputBlur = () => {
9320
+ setIsFocused(false);
9321
+ if (!inputValue.trim()) {
9322
+ if (required) {
9323
+ setLocalRequiredError(tv("required"));
9324
+ } else {
9325
+ setTempStart(null);
9326
+ setTempEnd(null);
9327
+ onChange(void 0, void 0);
9328
+ setLocalRequiredError(void 0);
9329
+ }
9330
+ } else {
9331
+ const parts = inputValue.split(/\s*-\s*/);
9332
+ const s = parts[0] ? parseDateString(parts[0], locale) : null;
9333
+ const eVal = parts[1] ? parseDateString(parts[1], locale) : null;
9334
+ if (s) {
9335
+ const isStartDisabled = disablePastDates && s < todayDate || !!minDay && s < minDay || !!maxDay && s > maxDay;
9336
+ if (!isStartDisabled) {
9337
+ if (eVal) {
9338
+ const isEndDisabled = disablePastDates && eVal < todayDate || !!minDay && eVal < minDay || !!maxDay && eVal > maxDay;
9339
+ if (!isEndDisabled && s <= eVal) {
9340
+ setTempStart(s);
9341
+ setTempEnd(eVal);
9342
+ onChange(s, eVal);
9343
+ setInputValue(getRangeString(s, eVal));
9344
+ setLocalRequiredError(void 0);
9345
+ return;
9346
+ }
9347
+ } else {
9348
+ setTempStart(s);
9349
+ setTempEnd(null);
9350
+ onChange(s, null);
9351
+ setInputValue(getRangeString(s, null));
9352
+ setLocalRequiredError(void 0);
9353
+ return;
9354
+ }
9355
+ }
9356
+ }
9357
+ if (startDate) {
9358
+ setTempStart(normalizeToLocal(startDate));
9359
+ setTempEnd(normalizeToLocal(endDate));
9360
+ setInputValue(getRangeString(startDate, endDate));
9361
+ setLocalRequiredError(void 0);
9362
+ } else {
9363
+ setTempStart(null);
9364
+ setTempEnd(null);
9365
+ setInputValue("");
9366
+ if (required) {
9367
+ setLocalRequiredError(tv("required"));
9368
+ }
9369
+ }
9370
+ }
9371
+ };
9372
+ const handleInputKeyDown = (e) => {
9373
+ if (e.key === "Enter") {
9374
+ e.preventDefault();
9375
+ const parts = inputValue.split(/\s*-\s*/);
9376
+ const s = parts[0] ? parseDateString(parts[0], locale) : null;
9377
+ const eVal = parts[1] ? parseDateString(parts[1], locale) : null;
9378
+ if (s) {
9379
+ const isStartDisabled = disablePastDates && s < todayDate || !!minDay && s < minDay || !!maxDay && s > maxDay;
9380
+ if (!isStartDisabled) {
9381
+ if (eVal) {
9382
+ const isEndDisabled = disablePastDates && eVal < todayDate || !!minDay && eVal < minDay || !!maxDay && eVal > maxDay;
9383
+ if (!isEndDisabled && s <= eVal) {
9384
+ setTempStart(s);
9385
+ setTempEnd(eVal);
9386
+ onChange(s, eVal);
9387
+ setInputValue(getRangeString(s, eVal));
9388
+ setViewDate(s);
9389
+ setIsOpen(false);
9390
+ setLocalRequiredError(void 0);
9391
+ return;
9392
+ }
9393
+ } else {
9394
+ setTempStart(s);
9395
+ setTempEnd(null);
9396
+ onChange(s, null);
9397
+ setInputValue(getRangeString(s, null));
9398
+ setViewDate(s);
9399
+ setIsOpen(false);
9400
+ setLocalRequiredError(void 0);
9401
+ return;
9402
+ }
9403
+ }
9404
+ }
9405
+ setIsOpen(false);
9406
+ } else if (e.key === "Escape") {
9407
+ setIsOpen(false);
9408
+ }
9409
+ };
9118
9410
  const sizeStyles8 = {
9119
9411
  sm: {
9120
9412
  trigger: "px-2.5 py-1.5 text-sm h-8 md:h-7 md:text-xs md:py-1",
@@ -9393,10 +9685,6 @@ var DateRangePicker = ({
9393
9685
  );
9394
9686
  }) });
9395
9687
  };
9396
- const todayDate = React30.useMemo(() => {
9397
- const today = /* @__PURE__ */ new Date();
9398
- return new Date(today.getFullYear(), today.getMonth(), today.getDate());
9399
- }, []);
9400
9688
  const isTodayUnavailable = !!minDay && todayDate < minDay || !!maxDay && todayDate > maxDay;
9401
9689
  const panel = /* @__PURE__ */ jsxs24("div", { ref: wheelContainerRef, className: "w-full", children: [
9402
9690
  /* @__PURE__ */ jsxs24("div", { className: cn("flex items-center justify-between px-1", sizeStyles8[size].headerMargin), children: [
@@ -9531,7 +9819,14 @@ var DateRangePicker = ({
9531
9819
  {
9532
9820
  id: labelId,
9533
9821
  htmlFor: resolvedId,
9534
- className: cn(size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm", "font-medium text-foreground", effectiveError && "text-destructive", labelClassName),
9822
+ onClick: () => inputRef.current?.focus(),
9823
+ className: cn(
9824
+ size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm",
9825
+ "font-medium transition-colors duration-300",
9826
+ disabled ? "text-muted-foreground cursor-not-allowed" : "text-foreground group-focus-within:text-primary hover:text-primary cursor-pointer",
9827
+ effectiveError && "text-destructive",
9828
+ labelClassName
9829
+ ),
9535
9830
  children: [
9536
9831
  label,
9537
9832
  required && /* @__PURE__ */ jsx35("span", { className: "text-destructive ml-1", children: "*" })
@@ -9547,6 +9842,7 @@ var DateRangePicker = ({
9547
9842
  onChange: () => {
9548
9843
  },
9549
9844
  required,
9845
+ disabled,
9550
9846
  onInvalid: (e) => {
9551
9847
  e.preventDefault();
9552
9848
  setLocalRequiredError(tv("required"));
@@ -9560,6 +9856,7 @@ var DateRangePicker = ({
9560
9856
  open: isOpen,
9561
9857
  onOpenChange: setIsOpen,
9562
9858
  placement: "bottom-start",
9859
+ disabled,
9563
9860
  contentWidth: sizeStyles8[size].contentWidth,
9564
9861
  contentClassName: cn(
9565
9862
  "p-0",
@@ -9570,25 +9867,29 @@ var DateRangePicker = ({
9570
9867
  "animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
9571
9868
  ),
9572
9869
  trigger: /* @__PURE__ */ jsxs24(
9573
- "button",
9870
+ "div",
9574
9871
  {
9872
+ ref: triggerRef,
9575
9873
  id: resolvedId,
9576
- type: "button",
9874
+ role: "button",
9875
+ "aria-label": tempStart ? displayLabel : placeholder,
9577
9876
  "aria-labelledby": labelId,
9578
9877
  "aria-required": required,
9579
9878
  "aria-invalid": !!effectiveError,
9580
9879
  className: cn(
9581
9880
  "group flex w-full items-center justify-between rounded-full border bg-background/80 backdrop-blur-sm",
9582
9881
  sizeStyles8[size].trigger,
9583
- "border-border/60 hover:border-primary/40",
9584
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
9585
- "hover:bg-accent/10 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",
9882
+ disabled ? "border-border/40 opacity-50 cursor-not-allowed" : [
9883
+ "border-border/60 hover:border-primary/40",
9884
+ "focus-within:ring-2 focus-within:ring-primary/50 focus-within:ring-offset-2 focus-within:ring-offset-background focus-within:border-transparent focus-within:hover:border-transparent",
9885
+ "hover:bg-accent/10 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5"
9886
+ ],
9586
9887
  "transition-all duration-300 ease-out",
9587
- isOpen && "ring-2 ring-primary/30 border-primary/50 shadow-lg shadow-primary/10",
9588
- effectiveError && "border-destructive/60 focus-visible:ring-destructive/50 bg-destructive/5"
9888
+ isOpen && !isFocused && "ring-2 ring-primary/30 border-primary/50 shadow-lg shadow-primary/10",
9889
+ effectiveError && "border-destructive/60 focus-within:ring-destructive/50 bg-destructive/5"
9589
9890
  ),
9590
9891
  children: [
9591
- /* @__PURE__ */ jsxs24("div", { className: cn("flex items-center", size === "sm" ? "gap-1.5" : "gap-2.5"), children: [
9892
+ /* @__PURE__ */ jsxs24("div", { className: cn("flex items-center flex-1 min-w-0", size === "sm" ? "gap-1.5" : "gap-2.5"), children: [
9592
9893
  /* @__PURE__ */ jsx35(
9593
9894
  "div",
9594
9895
  {
@@ -9600,16 +9901,29 @@ var DateRangePicker = ({
9600
9901
  }
9601
9902
  ),
9602
9903
  /* @__PURE__ */ jsx35(
9603
- "span",
9904
+ "input",
9604
9905
  {
9605
- className: cn(
9606
- "truncate font-medium transition-colors duration-200",
9607
- !tempStart && !tempEnd && "text-muted-foreground",
9608
- (tempStart || tempEnd) && "text-foreground"
9609
- ),
9610
- children: displayLabel
9906
+ ref: inputRef,
9907
+ type: "text",
9908
+ disabled,
9909
+ placeholder,
9910
+ value: isFocused ? inputValue : tempStart ? displayLabel : "",
9911
+ onChange: handleInputChange,
9912
+ onFocus: () => {
9913
+ setIsFocused(true);
9914
+ if (!disabled) setIsOpen(true);
9915
+ },
9916
+ onBlur: handleInputBlur,
9917
+ onKeyDown: handleInputKeyDown,
9918
+ onClick: (e) => {
9919
+ if (isOpen) {
9920
+ e.stopPropagation();
9921
+ }
9922
+ },
9923
+ className: "w-full bg-transparent border-none outline-none focus:outline-none p-0 text-foreground font-medium placeholder-muted-foreground/60 min-w-0"
9611
9924
  }
9612
- )
9925
+ ),
9926
+ /* @__PURE__ */ jsx35("span", { className: "sr-only", children: tempStart ? displayLabel : placeholder })
9613
9927
  ] }),
9614
9928
  /* @__PURE__ */ jsx35("span", { className: cn("transition-all duration-300 text-muted-foreground group-hover:text-foreground", isOpen && "rotate-180 text-primary"), children: /* @__PURE__ */ jsx35("svg", { className: cn(sizeStyles8[size].navIcon), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ jsx35("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
9615
9929
  ]