@chekinapp/ui 0.0.129 → 0.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.cjs +211 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +211 -63
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -12488,7 +12488,14 @@ var Input = React44.forwardRef(
|
|
|
12488
12488
|
"div",
|
|
12489
12489
|
{
|
|
12490
12490
|
className: cn(
|
|
12491
|
-
"
|
|
12491
|
+
"input",
|
|
12492
|
+
disabled && "input--disabled",
|
|
12493
|
+
loading && "input--loading",
|
|
12494
|
+
readOnly && "input--readonly",
|
|
12495
|
+
isFocused && "input--focused",
|
|
12496
|
+
isEmpty && "input--empty",
|
|
12497
|
+
hasInvalidState && "input--invalid",
|
|
12498
|
+
"relative block w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)] min-h-[var(--field-min-height,48px)]",
|
|
12492
12499
|
disabled && "cursor-not-allowed opacity-50",
|
|
12493
12500
|
loading && "cursor-progress opacity-50",
|
|
12494
12501
|
wrapperClassName,
|
|
@@ -12499,20 +12506,16 @@ var Input = React44.forwardRef(
|
|
|
12499
12506
|
"label",
|
|
12500
12507
|
{
|
|
12501
12508
|
htmlFor: inputId,
|
|
12502
|
-
className: "mb-2 block text-[14px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
12509
|
+
className: "input__top-label mb-2 block text-[14px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
12503
12510
|
children: topLabel
|
|
12504
12511
|
}
|
|
12505
12512
|
),
|
|
12506
|
-
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
"relative
|
|
12511
|
-
|
|
12512
|
-
fieldClassName
|
|
12513
|
-
),
|
|
12514
|
-
children: [
|
|
12515
|
-
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: cn("relative w-full cursor-text", contentClassName), children: [
|
|
12513
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: cn("input__field", "relative block w-full", fieldClassName), children: [
|
|
12514
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
12515
|
+
"div",
|
|
12516
|
+
{
|
|
12517
|
+
className: cn("input__content relative w-full cursor-text", contentClassName),
|
|
12518
|
+
children: [
|
|
12516
12519
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12517
12520
|
Fieldset,
|
|
12518
12521
|
{
|
|
@@ -12529,12 +12532,14 @@ var Input = React44.forwardRef(
|
|
|
12529
12532
|
legend: typeof label === "string" ? label : void 0,
|
|
12530
12533
|
label,
|
|
12531
12534
|
tooltip,
|
|
12535
|
+
className: "input__fieldset",
|
|
12532
12536
|
labelClassName: cn({
|
|
12537
|
+
input__label: true,
|
|
12533
12538
|
"pl-[28px]": !!leftIcon
|
|
12534
12539
|
})
|
|
12535
12540
|
}
|
|
12536
12541
|
),
|
|
12537
|
-
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12542
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "input__left-icon pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "input__left-icon-inner flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12538
12543
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12539
12544
|
"input",
|
|
12540
12545
|
{
|
|
@@ -12558,6 +12563,7 @@ var Input = React44.forwardRef(
|
|
|
12558
12563
|
onFocus: handleFocus,
|
|
12559
12564
|
onBlur: handleBlur,
|
|
12560
12565
|
className: cn(
|
|
12566
|
+
"input__control",
|
|
12561
12567
|
"m-0 box-border h-12 w-full rounded-[6px] border-0 px-4 text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-navy)] outline-none transition-colors duration-200 [text-overflow:ellipsis] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
12562
12568
|
"placeholder:font-medium placeholder:text-[var(--chekin-color-gray-1)] placeholder:opacity-100",
|
|
12563
12569
|
isEmpty && !isFocused ? "bg-[var(--empty-field-background)]" : "bg-transparent",
|
|
@@ -12572,15 +12578,15 @@ var Input = React44.forwardRef(
|
|
|
12572
12578
|
)
|
|
12573
12579
|
}
|
|
12574
12580
|
),
|
|
12575
|
-
sign && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center text-[18px] font-medium leading-6 text-[var(--chekin-color-brand-navy)]", children: sign }),
|
|
12576
|
-
trailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center", children: trailingAdornment }),
|
|
12581
|
+
sign && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "input__sign pointer-events-none absolute right-[14px] top-0 flex h-full items-center text-[18px] font-medium leading-6 text-[var(--chekin-color-brand-navy)]", children: sign }),
|
|
12582
|
+
trailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "input__trailing-adornment pointer-events-none absolute right-[14px] top-0 flex h-full items-center", children: trailingAdornment }),
|
|
12577
12583
|
onReset && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12578
12584
|
"button",
|
|
12579
12585
|
{
|
|
12580
12586
|
type: "button",
|
|
12581
12587
|
onClick: onReset,
|
|
12582
12588
|
disabled,
|
|
12583
|
-
className: "absolute right-0 top-0 flex h-full w-10 items-center justify-center border-0 bg-transparent p-0 text-[#9696b9] hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",
|
|
12589
|
+
className: "input__reset-button absolute right-0 top-0 flex h-full w-10 items-center justify-center border-0 bg-transparent p-0 text-[#9696b9] hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",
|
|
12584
12590
|
"aria-label": t("reset"),
|
|
12585
12591
|
children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_lucide_react42.X, { size: 14 })
|
|
12586
12592
|
}
|
|
@@ -12590,61 +12596,62 @@ var Input = React44.forwardRef(
|
|
|
12590
12596
|
{
|
|
12591
12597
|
type: "button",
|
|
12592
12598
|
onClick: togglePasswordReveal,
|
|
12593
|
-
className: "absolute right-[14px] top-[18px] flex h-[13px] w-[21px] cursor-pointer items-center justify-center border-0 bg-transparent p-0 hover:opacity-85",
|
|
12599
|
+
className: "input__password-button absolute right-[14px] top-[18px] flex h-[13px] w-[21px] cursor-pointer items-center justify-center border-0 bg-transparent p-0 hover:opacity-85",
|
|
12594
12600
|
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
12595
12601
|
children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12596
12602
|
import_lucide_react42.Eye,
|
|
12597
12603
|
{
|
|
12598
12604
|
size: 20,
|
|
12599
12605
|
className: cn(
|
|
12606
|
+
"input__password-icon",
|
|
12600
12607
|
isPasswordRevealed ? "text-[#fc98dd]" : "text-[var(--chekin-color-gray-2)]"
|
|
12601
12608
|
)
|
|
12602
12609
|
}
|
|
12603
12610
|
)
|
|
12604
12611
|
}
|
|
12605
12612
|
)
|
|
12606
|
-
]
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
|
|
12617
|
-
),
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
|
|
12627
|
-
)
|
|
12628
|
-
|
|
12629
|
-
|
|
12630
|
-
}
|
|
12631
|
-
),
|
|
12613
|
+
]
|
|
12614
|
+
}
|
|
12615
|
+
),
|
|
12616
|
+
type === "number" && showNumberButtons && /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "input__number-controls absolute right-[18px] top-[13px] inline-flex items-center text-right", children: [
|
|
12617
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12618
|
+
"button",
|
|
12619
|
+
{
|
|
12620
|
+
type: "button",
|
|
12621
|
+
onClick: onDecrement,
|
|
12622
|
+
className: "input__decrement-button mr-2 inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
12623
|
+
"aria-label": t("decrement"),
|
|
12624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_lucide_react42.Minus, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
12625
|
+
}
|
|
12626
|
+
),
|
|
12627
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12628
|
+
"button",
|
|
12629
|
+
{
|
|
12630
|
+
type: "button",
|
|
12631
|
+
onClick: onIncrement,
|
|
12632
|
+
className: "input__increment-button inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
12633
|
+
"aria-label": t("increment"),
|
|
12634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_lucide_react42.Plus, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
12635
|
+
}
|
|
12636
|
+
)
|
|
12637
|
+
] })
|
|
12638
|
+
] }),
|
|
12632
12639
|
!errorMessage && optional && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12633
12640
|
"span",
|
|
12634
12641
|
{
|
|
12635
12642
|
"data-testid": `${name}-optional`,
|
|
12636
|
-
className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]",
|
|
12643
|
+
className: "input__optional mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]",
|
|
12637
12644
|
children: typeof optional === "string" ? optional : t("optional")
|
|
12638
12645
|
}
|
|
12639
12646
|
),
|
|
12640
|
-
!errorMessage && helperText && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12647
|
+
!errorMessage && helperText && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "input__helper-text mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12641
12648
|
errorMessage && renderErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
12642
12649
|
FieldErrorMessage,
|
|
12643
12650
|
{
|
|
12644
12651
|
id: errorId,
|
|
12645
12652
|
message: errorMessage,
|
|
12646
12653
|
"data-testid": name ? `${name}-error` : void 0,
|
|
12647
|
-
className: "mt-[1px] text-[14px]"
|
|
12654
|
+
className: "input__error mt-[1px] text-[14px]"
|
|
12648
12655
|
}
|
|
12649
12656
|
),
|
|
12650
12657
|
footer
|
|
@@ -12698,7 +12705,7 @@ function SelectFieldShell({
|
|
|
12698
12705
|
onBlur,
|
|
12699
12706
|
onFocus: handleContainerFocus,
|
|
12700
12707
|
className: cn(
|
|
12701
|
-
"relative w-
|
|
12708
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)] outline-none",
|
|
12702
12709
|
disabled && !loading && "cursor-not-allowed opacity-50",
|
|
12703
12710
|
loading && "cursor-progress opacity-50",
|
|
12704
12711
|
className
|
|
@@ -13444,15 +13451,19 @@ function useSelectMenuState({
|
|
|
13444
13451
|
}) {
|
|
13445
13452
|
const containerRef = React47.useRef(null);
|
|
13446
13453
|
const [internalIsOpen, setInternalIsOpen] = React47.useState(false);
|
|
13447
|
-
const
|
|
13448
|
-
const isOpen =
|
|
13454
|
+
const [hasClosedControlledOpen, setHasClosedControlledOpen] = React47.useState(false);
|
|
13455
|
+
const isOpen = controlledIsOpen === false ? false : controlledIsOpen === true ? !hasClosedControlledOpen : internalIsOpen;
|
|
13456
|
+
React47.useEffect(() => {
|
|
13457
|
+
if (controlledIsOpen !== true) setHasClosedControlledOpen(false);
|
|
13458
|
+
}, [controlledIsOpen]);
|
|
13449
13459
|
const setIsOpen = React47.useCallback(
|
|
13450
13460
|
(next) => {
|
|
13451
13461
|
const value = typeof next === "function" ? next(isOpen) : next;
|
|
13452
|
-
if (
|
|
13462
|
+
if (controlledIsOpen === true) setHasClosedControlledOpen(!value);
|
|
13463
|
+
if (controlledIsOpen !== false) setInternalIsOpen(value);
|
|
13453
13464
|
onMenuOpenChange?.(value);
|
|
13454
13465
|
},
|
|
13455
|
-
[isOpen,
|
|
13466
|
+
[isOpen, controlledIsOpen, onMenuOpenChange]
|
|
13456
13467
|
);
|
|
13457
13468
|
const openMenu = React47.useCallback(() => {
|
|
13458
13469
|
setIsOpen(true);
|
|
@@ -14602,7 +14613,7 @@ var PhoneInput = React50.forwardRef(function PhoneInput2({
|
|
|
14602
14613
|
"div",
|
|
14603
14614
|
{
|
|
14604
14615
|
className: cn(
|
|
14605
|
-
"relative w-
|
|
14616
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
14606
14617
|
disabled && "cursor-not-allowed opacity-50",
|
|
14607
14618
|
loading && "cursor-progress",
|
|
14608
14619
|
className
|
|
@@ -14653,7 +14664,7 @@ var PhoneInput = React50.forwardRef(function PhoneInput2({
|
|
|
14653
14664
|
filterOption: countriesFilter,
|
|
14654
14665
|
clearable: false,
|
|
14655
14666
|
getValueLabel: (option) => option.value,
|
|
14656
|
-
className: "
|
|
14667
|
+
className: "max-w-none w-auto",
|
|
14657
14668
|
dropdownClassName: "right-auto w-[280px]"
|
|
14658
14669
|
}
|
|
14659
14670
|
),
|
|
@@ -14678,7 +14689,7 @@ var PhoneInput = React50.forwardRef(function PhoneInput2({
|
|
|
14678
14689
|
onFocus,
|
|
14679
14690
|
onBlur,
|
|
14680
14691
|
renderErrorMessage: false,
|
|
14681
|
-
wrapperClassName: "
|
|
14692
|
+
wrapperClassName: "max-w-none w-auto",
|
|
14682
14693
|
contentClassName: readOnly ? "!cursor-default" : void 0,
|
|
14683
14694
|
inputClassName: readOnly ? "!cursor-default" : void 0
|
|
14684
14695
|
}
|
|
@@ -15520,7 +15531,7 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15520
15531
|
"div",
|
|
15521
15532
|
{
|
|
15522
15533
|
className: cn(
|
|
15523
|
-
"relative block min-h-[88px] w-
|
|
15534
|
+
"relative block min-h-[88px] w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
15524
15535
|
isBlocked && "cursor-not-allowed opacity-50",
|
|
15525
15536
|
loading && "cursor-progress opacity-50",
|
|
15526
15537
|
className
|
|
@@ -16590,7 +16601,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16590
16601
|
{
|
|
16591
16602
|
ref: containerRef,
|
|
16592
16603
|
className: cn(
|
|
16593
|
-
"relative w-
|
|
16604
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
16594
16605
|
disabled && "cursor-not-allowed opacity-50",
|
|
16595
16606
|
loading && "cursor-progress opacity-50",
|
|
16596
16607
|
className
|
|
@@ -16951,19 +16962,130 @@ function useRangeValue({
|
|
|
16951
16962
|
|
|
16952
16963
|
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
16953
16964
|
var React64 = __toESM(require("react"), 1);
|
|
16965
|
+
|
|
16966
|
+
// src/dashboard/date-range-picker/utils/inputFormat.ts
|
|
16967
|
+
function parseDateInputFormat(format2) {
|
|
16968
|
+
const tokens = [];
|
|
16969
|
+
let i = 0;
|
|
16970
|
+
while (i < format2.length) {
|
|
16971
|
+
const ch = format2[i];
|
|
16972
|
+
if (/[a-zA-Z]/.test(ch)) {
|
|
16973
|
+
let len = 1;
|
|
16974
|
+
while (i + len < format2.length && format2[i + len] === ch) len++;
|
|
16975
|
+
tokens.push({ type: "digits", length: len });
|
|
16976
|
+
i += len;
|
|
16977
|
+
} else {
|
|
16978
|
+
tokens.push({ type: "separator", char: ch });
|
|
16979
|
+
i += 1;
|
|
16980
|
+
}
|
|
16981
|
+
}
|
|
16982
|
+
return tokens;
|
|
16983
|
+
}
|
|
16984
|
+
function getMaxDigits(tokens) {
|
|
16985
|
+
return tokens.reduce(
|
|
16986
|
+
(sum, token) => token.type === "digits" ? sum + token.length : sum,
|
|
16987
|
+
0
|
|
16988
|
+
);
|
|
16989
|
+
}
|
|
16990
|
+
function autoFormatDateInput(raw, tokens) {
|
|
16991
|
+
const digitTokens = tokens.filter(
|
|
16992
|
+
(token) => token.type === "digits"
|
|
16993
|
+
);
|
|
16994
|
+
const sepToken = tokens.find(
|
|
16995
|
+
(token) => token.type === "separator"
|
|
16996
|
+
);
|
|
16997
|
+
const sepChar = sepToken?.char ?? "-";
|
|
16998
|
+
const segments = [];
|
|
16999
|
+
let segIdx = 0;
|
|
17000
|
+
let current = "";
|
|
17001
|
+
let endedWithSeparator = false;
|
|
17002
|
+
for (let i = 0; i < raw.length; i++) {
|
|
17003
|
+
if (segIdx >= digitTokens.length) break;
|
|
17004
|
+
const ch = raw[i];
|
|
17005
|
+
const segLen = digitTokens[segIdx].length;
|
|
17006
|
+
if (/\d/.test(ch)) {
|
|
17007
|
+
if (current.length >= segLen) {
|
|
17008
|
+
segments.push(current);
|
|
17009
|
+
segIdx++;
|
|
17010
|
+
if (segIdx >= digitTokens.length) {
|
|
17011
|
+
current = "";
|
|
17012
|
+
endedWithSeparator = false;
|
|
17013
|
+
break;
|
|
17014
|
+
}
|
|
17015
|
+
current = ch;
|
|
17016
|
+
} else {
|
|
17017
|
+
current += ch;
|
|
17018
|
+
}
|
|
17019
|
+
endedWithSeparator = false;
|
|
17020
|
+
} else if (current.length > 0) {
|
|
17021
|
+
if (current.length < segLen) {
|
|
17022
|
+
if (segLen > 2) continue;
|
|
17023
|
+
current = current.padStart(segLen, "0");
|
|
17024
|
+
}
|
|
17025
|
+
segments.push(current);
|
|
17026
|
+
current = "";
|
|
17027
|
+
segIdx++;
|
|
17028
|
+
endedWithSeparator = true;
|
|
17029
|
+
}
|
|
17030
|
+
}
|
|
17031
|
+
if (current.length > 0) {
|
|
17032
|
+
segments.push(current);
|
|
17033
|
+
endedWithSeparator = false;
|
|
17034
|
+
}
|
|
17035
|
+
let result = segments.join(sepChar);
|
|
17036
|
+
if (endedWithSeparator && segments.length < digitTokens.length) {
|
|
17037
|
+
result += sepChar;
|
|
17038
|
+
}
|
|
17039
|
+
return result;
|
|
17040
|
+
}
|
|
17041
|
+
|
|
17042
|
+
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
17043
|
+
var countDigits = (text) => text.replace(/\D/g, "").length;
|
|
16954
17044
|
function useRangeTextInputs({
|
|
16955
17045
|
value,
|
|
16956
17046
|
format: format2,
|
|
16957
17047
|
parse: parse3,
|
|
17048
|
+
displayFormat,
|
|
16958
17049
|
onCommit,
|
|
16959
|
-
onBlur
|
|
17050
|
+
onBlur,
|
|
17051
|
+
onFromComplete,
|
|
17052
|
+
onToComplete
|
|
16960
17053
|
}) {
|
|
17054
|
+
const tokens = React64.useMemo(
|
|
17055
|
+
() => parseDateInputFormat(displayFormat),
|
|
17056
|
+
[displayFormat]
|
|
17057
|
+
);
|
|
17058
|
+
const maxDigits = React64.useMemo(() => getMaxDigits(tokens), [tokens]);
|
|
16961
17059
|
const [fromText, setFromText] = React64.useState(value?.from ? format2(value.from) : "");
|
|
16962
17060
|
const [toText, setToText] = React64.useState(value?.to ? format2(value.to) : "");
|
|
16963
17061
|
React64.useEffect(() => {
|
|
16964
17062
|
setFromText(value?.from ? format2(value.from) : "");
|
|
16965
17063
|
setToText(value?.to ? format2(value.to) : "");
|
|
16966
17064
|
}, [format2, value?.from, value?.to]);
|
|
17065
|
+
const handleFromChange = React64.useCallback(
|
|
17066
|
+
(raw) => {
|
|
17067
|
+
const formatted = autoFormatDateInput(raw, tokens);
|
|
17068
|
+
const wasComplete = countDigits(fromText) === maxDigits;
|
|
17069
|
+
const isComplete = countDigits(formatted) === maxDigits;
|
|
17070
|
+
setFromText(formatted);
|
|
17071
|
+
if (!wasComplete && isComplete && parse3(formatted)) {
|
|
17072
|
+
setTimeout(() => onFromComplete?.(), 0);
|
|
17073
|
+
}
|
|
17074
|
+
},
|
|
17075
|
+
[fromText, maxDigits, onFromComplete, parse3, tokens]
|
|
17076
|
+
);
|
|
17077
|
+
const handleToChange = React64.useCallback(
|
|
17078
|
+
(raw) => {
|
|
17079
|
+
const formatted = autoFormatDateInput(raw, tokens);
|
|
17080
|
+
const wasComplete = countDigits(toText) === maxDigits;
|
|
17081
|
+
const isComplete = countDigits(formatted) === maxDigits;
|
|
17082
|
+
setToText(formatted);
|
|
17083
|
+
if (!wasComplete && isComplete && parse3(formatted)) {
|
|
17084
|
+
setTimeout(() => onToComplete?.(), 0);
|
|
17085
|
+
}
|
|
17086
|
+
},
|
|
17087
|
+
[maxDigits, onToComplete, parse3, toText, tokens]
|
|
17088
|
+
);
|
|
16967
17089
|
const handleFromBlur = React64.useCallback(() => {
|
|
16968
17090
|
if (!fromText) {
|
|
16969
17091
|
const next = { from: void 0, to: value?.to };
|
|
@@ -17002,6 +17124,8 @@ function useRangeTextInputs({
|
|
|
17002
17124
|
toText,
|
|
17003
17125
|
setFromText,
|
|
17004
17126
|
setToText,
|
|
17127
|
+
handleFromChange,
|
|
17128
|
+
handleToChange,
|
|
17005
17129
|
handleFromBlur,
|
|
17006
17130
|
handleToBlur
|
|
17007
17131
|
};
|
|
@@ -17106,6 +17230,7 @@ function DateRangeInputs({
|
|
|
17106
17230
|
id: fromId,
|
|
17107
17231
|
name: name ? `${name}-from` : void 0,
|
|
17108
17232
|
type: "text",
|
|
17233
|
+
inputMode: "numeric",
|
|
17109
17234
|
autoComplete: "off",
|
|
17110
17235
|
placeholder: fromPlaceholder,
|
|
17111
17236
|
value: fromText,
|
|
@@ -17141,6 +17266,7 @@ function DateRangeInputs({
|
|
|
17141
17266
|
id: toId,
|
|
17142
17267
|
name: name ? `${name}-to` : void 0,
|
|
17143
17268
|
type: "text",
|
|
17269
|
+
inputMode: "numeric",
|
|
17144
17270
|
autoComplete: "off",
|
|
17145
17271
|
placeholder: toPlaceholder,
|
|
17146
17272
|
value: toText,
|
|
@@ -17342,12 +17468,33 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17342
17468
|
const normalizedMaxDate = React66.useMemo(() => toDate(maxDate), [maxDate]);
|
|
17343
17469
|
const formatter = React66.useMemo(() => formatDate(displayFormat), [displayFormat]);
|
|
17344
17470
|
const parser = React66.useMemo(() => parseDate(displayFormat), [displayFormat]);
|
|
17345
|
-
const
|
|
17471
|
+
const closeCalendarRef = React66.useRef(() => {
|
|
17472
|
+
});
|
|
17473
|
+
const handleFromComplete = React66.useCallback(() => {
|
|
17474
|
+
toInputRef.current?.focus();
|
|
17475
|
+
}, []);
|
|
17476
|
+
const handleToComplete = React66.useCallback(() => {
|
|
17477
|
+
toInputRef.current?.blur();
|
|
17478
|
+
closeCalendarRef.current();
|
|
17479
|
+
}, []);
|
|
17480
|
+
const {
|
|
17481
|
+
fromText,
|
|
17482
|
+
toText,
|
|
17483
|
+
setFromText,
|
|
17484
|
+
setToText,
|
|
17485
|
+
handleFromChange,
|
|
17486
|
+
handleToChange,
|
|
17487
|
+
handleFromBlur,
|
|
17488
|
+
handleToBlur
|
|
17489
|
+
} = useRangeTextInputs({
|
|
17346
17490
|
value,
|
|
17347
17491
|
format: formatter,
|
|
17348
17492
|
parse: parser,
|
|
17493
|
+
displayFormat,
|
|
17349
17494
|
onCommit: commit,
|
|
17350
|
-
onBlur
|
|
17495
|
+
onBlur,
|
|
17496
|
+
onFromComplete: handleFromComplete,
|
|
17497
|
+
onToComplete: handleToComplete
|
|
17351
17498
|
});
|
|
17352
17499
|
const { month, setMonth, syncMonthToValue } = useRangeMonthSync(value);
|
|
17353
17500
|
const [isOpen, setIsOpen] = React66.useState(false);
|
|
@@ -17369,6 +17516,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17369
17516
|
setAutoFocus(false);
|
|
17370
17517
|
if (value?.from) setMonth(value.from);
|
|
17371
17518
|
}, [setMonth, value?.from]);
|
|
17519
|
+
closeCalendarRef.current = closeCalendar;
|
|
17372
17520
|
const openCalendar = React66.useCallback(() => {
|
|
17373
17521
|
if (isBlocked || readOnly) return;
|
|
17374
17522
|
setIsOpen(true);
|
|
@@ -17446,7 +17594,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17446
17594
|
{
|
|
17447
17595
|
ref: containerRef,
|
|
17448
17596
|
className: cn(
|
|
17449
|
-
"relative w-
|
|
17597
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
17450
17598
|
disabled && "cursor-not-allowed opacity-50",
|
|
17451
17599
|
loading && "cursor-progress opacity-50",
|
|
17452
17600
|
className
|
|
@@ -17479,8 +17627,8 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17479
17627
|
focusedInput,
|
|
17480
17628
|
clearLabel: t("clear_dates"),
|
|
17481
17629
|
openCalendarLabel: t("open_calendar"),
|
|
17482
|
-
onFromTextChange:
|
|
17483
|
-
onToTextChange:
|
|
17630
|
+
onFromTextChange: handleFromChange,
|
|
17631
|
+
onToTextChange: handleToChange,
|
|
17484
17632
|
onFromFocus: (event) => {
|
|
17485
17633
|
onFocus?.(event);
|
|
17486
17634
|
setFocusedInput("from");
|
|
@@ -17796,7 +17944,7 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17796
17944
|
{
|
|
17797
17945
|
htmlFor: inputId,
|
|
17798
17946
|
className: cn(
|
|
17799
|
-
"relative block w-
|
|
17947
|
+
"relative block w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)] cursor-pointer text-left",
|
|
17800
17948
|
(disabled || readOnly) && "cursor-not-allowed",
|
|
17801
17949
|
loading && "cursor-progress opacity-50",
|
|
17802
17950
|
disabled && "opacity-50",
|