@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.js
CHANGED
|
@@ -12124,7 +12124,14 @@ var Input = React44.forwardRef(
|
|
|
12124
12124
|
"div",
|
|
12125
12125
|
{
|
|
12126
12126
|
className: cn(
|
|
12127
|
-
"
|
|
12127
|
+
"input",
|
|
12128
|
+
disabled && "input--disabled",
|
|
12129
|
+
loading && "input--loading",
|
|
12130
|
+
readOnly && "input--readonly",
|
|
12131
|
+
isFocused && "input--focused",
|
|
12132
|
+
isEmpty && "input--empty",
|
|
12133
|
+
hasInvalidState && "input--invalid",
|
|
12134
|
+
"relative block w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)] min-h-[var(--field-min-height,48px)]",
|
|
12128
12135
|
disabled && "cursor-not-allowed opacity-50",
|
|
12129
12136
|
loading && "cursor-progress opacity-50",
|
|
12130
12137
|
wrapperClassName,
|
|
@@ -12135,20 +12142,16 @@ var Input = React44.forwardRef(
|
|
|
12135
12142
|
"label",
|
|
12136
12143
|
{
|
|
12137
12144
|
htmlFor: inputId,
|
|
12138
|
-
className: "mb-2 block text-[14px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
12145
|
+
className: "input__top-label mb-2 block text-[14px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
12139
12146
|
children: topLabel
|
|
12140
12147
|
}
|
|
12141
12148
|
),
|
|
12142
|
-
/* @__PURE__ */ jsxs89(
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
"relative
|
|
12147
|
-
|
|
12148
|
-
fieldClassName
|
|
12149
|
-
),
|
|
12150
|
-
children: [
|
|
12151
|
-
/* @__PURE__ */ jsxs89("div", { className: cn("relative w-full cursor-text", contentClassName), children: [
|
|
12149
|
+
/* @__PURE__ */ jsxs89("div", { className: cn("input__field", "relative block w-full", fieldClassName), children: [
|
|
12150
|
+
/* @__PURE__ */ jsxs89(
|
|
12151
|
+
"div",
|
|
12152
|
+
{
|
|
12153
|
+
className: cn("input__content relative w-full cursor-text", contentClassName),
|
|
12154
|
+
children: [
|
|
12152
12155
|
/* @__PURE__ */ jsx142(
|
|
12153
12156
|
Fieldset,
|
|
12154
12157
|
{
|
|
@@ -12165,12 +12168,14 @@ var Input = React44.forwardRef(
|
|
|
12165
12168
|
legend: typeof label === "string" ? label : void 0,
|
|
12166
12169
|
label,
|
|
12167
12170
|
tooltip,
|
|
12171
|
+
className: "input__fieldset",
|
|
12168
12172
|
labelClassName: cn({
|
|
12173
|
+
input__label: true,
|
|
12169
12174
|
"pl-[28px]": !!leftIcon
|
|
12170
12175
|
})
|
|
12171
12176
|
}
|
|
12172
12177
|
),
|
|
12173
|
-
leftIcon && /* @__PURE__ */ jsx142("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__ */ jsx142("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12178
|
+
leftIcon && /* @__PURE__ */ jsx142("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__ */ jsx142("span", { className: "input__left-icon-inner flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12174
12179
|
/* @__PURE__ */ jsx142(
|
|
12175
12180
|
"input",
|
|
12176
12181
|
{
|
|
@@ -12194,6 +12199,7 @@ var Input = React44.forwardRef(
|
|
|
12194
12199
|
onFocus: handleFocus,
|
|
12195
12200
|
onBlur: handleBlur,
|
|
12196
12201
|
className: cn(
|
|
12202
|
+
"input__control",
|
|
12197
12203
|
"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",
|
|
12198
12204
|
"placeholder:font-medium placeholder:text-[var(--chekin-color-gray-1)] placeholder:opacity-100",
|
|
12199
12205
|
isEmpty && !isFocused ? "bg-[var(--empty-field-background)]" : "bg-transparent",
|
|
@@ -12208,15 +12214,15 @@ var Input = React44.forwardRef(
|
|
|
12208
12214
|
)
|
|
12209
12215
|
}
|
|
12210
12216
|
),
|
|
12211
|
-
sign && /* @__PURE__ */ jsx142("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 }),
|
|
12212
|
-
trailingAdornment && /* @__PURE__ */ jsx142("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center", children: trailingAdornment }),
|
|
12217
|
+
sign && /* @__PURE__ */ jsx142("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 }),
|
|
12218
|
+
trailingAdornment && /* @__PURE__ */ jsx142("span", { className: "input__trailing-adornment pointer-events-none absolute right-[14px] top-0 flex h-full items-center", children: trailingAdornment }),
|
|
12213
12219
|
onReset && !isEmpty && /* @__PURE__ */ jsx142(
|
|
12214
12220
|
"button",
|
|
12215
12221
|
{
|
|
12216
12222
|
type: "button",
|
|
12217
12223
|
onClick: onReset,
|
|
12218
12224
|
disabled,
|
|
12219
|
-
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",
|
|
12225
|
+
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",
|
|
12220
12226
|
"aria-label": t("reset"),
|
|
12221
12227
|
children: /* @__PURE__ */ jsx142(X9, { size: 14 })
|
|
12222
12228
|
}
|
|
@@ -12226,61 +12232,62 @@ var Input = React44.forwardRef(
|
|
|
12226
12232
|
{
|
|
12227
12233
|
type: "button",
|
|
12228
12234
|
onClick: togglePasswordReveal,
|
|
12229
|
-
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",
|
|
12235
|
+
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",
|
|
12230
12236
|
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
12231
12237
|
children: /* @__PURE__ */ jsx142(
|
|
12232
12238
|
Eye,
|
|
12233
12239
|
{
|
|
12234
12240
|
size: 20,
|
|
12235
12241
|
className: cn(
|
|
12242
|
+
"input__password-icon",
|
|
12236
12243
|
isPasswordRevealed ? "text-[#fc98dd]" : "text-[var(--chekin-color-gray-2)]"
|
|
12237
12244
|
)
|
|
12238
12245
|
}
|
|
12239
12246
|
)
|
|
12240
12247
|
}
|
|
12241
12248
|
)
|
|
12242
|
-
]
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
)
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
)
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
}
|
|
12267
|
-
),
|
|
12249
|
+
]
|
|
12250
|
+
}
|
|
12251
|
+
),
|
|
12252
|
+
type === "number" && showNumberButtons && /* @__PURE__ */ jsxs89("div", { className: "input__number-controls absolute right-[18px] top-[13px] inline-flex items-center text-right", children: [
|
|
12253
|
+
/* @__PURE__ */ jsx142(
|
|
12254
|
+
"button",
|
|
12255
|
+
{
|
|
12256
|
+
type: "button",
|
|
12257
|
+
onClick: onDecrement,
|
|
12258
|
+
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",
|
|
12259
|
+
"aria-label": t("decrement"),
|
|
12260
|
+
children: /* @__PURE__ */ jsx142(Minus4, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
12261
|
+
}
|
|
12262
|
+
),
|
|
12263
|
+
/* @__PURE__ */ jsx142(
|
|
12264
|
+
"button",
|
|
12265
|
+
{
|
|
12266
|
+
type: "button",
|
|
12267
|
+
onClick: onIncrement,
|
|
12268
|
+
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",
|
|
12269
|
+
"aria-label": t("increment"),
|
|
12270
|
+
children: /* @__PURE__ */ jsx142(Plus3, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
12271
|
+
}
|
|
12272
|
+
)
|
|
12273
|
+
] })
|
|
12274
|
+
] }),
|
|
12268
12275
|
!errorMessage && optional && /* @__PURE__ */ jsx142(
|
|
12269
12276
|
"span",
|
|
12270
12277
|
{
|
|
12271
12278
|
"data-testid": `${name}-optional`,
|
|
12272
|
-
className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]",
|
|
12279
|
+
className: "input__optional mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]",
|
|
12273
12280
|
children: typeof optional === "string" ? optional : t("optional")
|
|
12274
12281
|
}
|
|
12275
12282
|
),
|
|
12276
|
-
!errorMessage && helperText && /* @__PURE__ */ jsx142("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12283
|
+
!errorMessage && helperText && /* @__PURE__ */ jsx142("span", { className: "input__helper-text mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12277
12284
|
errorMessage && renderErrorMessage && /* @__PURE__ */ jsx142(
|
|
12278
12285
|
FieldErrorMessage,
|
|
12279
12286
|
{
|
|
12280
12287
|
id: errorId,
|
|
12281
12288
|
message: errorMessage,
|
|
12282
12289
|
"data-testid": name ? `${name}-error` : void 0,
|
|
12283
|
-
className: "mt-[1px] text-[14px]"
|
|
12290
|
+
className: "input__error mt-[1px] text-[14px]"
|
|
12284
12291
|
}
|
|
12285
12292
|
),
|
|
12286
12293
|
footer
|
|
@@ -12334,7 +12341,7 @@ function SelectFieldShell({
|
|
|
12334
12341
|
onBlur,
|
|
12335
12342
|
onFocus: handleContainerFocus,
|
|
12336
12343
|
className: cn(
|
|
12337
|
-
"relative w-
|
|
12344
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)] outline-none",
|
|
12338
12345
|
disabled && !loading && "cursor-not-allowed opacity-50",
|
|
12339
12346
|
loading && "cursor-progress opacity-50",
|
|
12340
12347
|
className
|
|
@@ -13080,15 +13087,19 @@ function useSelectMenuState({
|
|
|
13080
13087
|
}) {
|
|
13081
13088
|
const containerRef = React47.useRef(null);
|
|
13082
13089
|
const [internalIsOpen, setInternalIsOpen] = React47.useState(false);
|
|
13083
|
-
const
|
|
13084
|
-
const isOpen =
|
|
13090
|
+
const [hasClosedControlledOpen, setHasClosedControlledOpen] = React47.useState(false);
|
|
13091
|
+
const isOpen = controlledIsOpen === false ? false : controlledIsOpen === true ? !hasClosedControlledOpen : internalIsOpen;
|
|
13092
|
+
React47.useEffect(() => {
|
|
13093
|
+
if (controlledIsOpen !== true) setHasClosedControlledOpen(false);
|
|
13094
|
+
}, [controlledIsOpen]);
|
|
13085
13095
|
const setIsOpen = React47.useCallback(
|
|
13086
13096
|
(next) => {
|
|
13087
13097
|
const value = typeof next === "function" ? next(isOpen) : next;
|
|
13088
|
-
if (
|
|
13098
|
+
if (controlledIsOpen === true) setHasClosedControlledOpen(!value);
|
|
13099
|
+
if (controlledIsOpen !== false) setInternalIsOpen(value);
|
|
13089
13100
|
onMenuOpenChange?.(value);
|
|
13090
13101
|
},
|
|
13091
|
-
[isOpen,
|
|
13102
|
+
[isOpen, controlledIsOpen, onMenuOpenChange]
|
|
13092
13103
|
);
|
|
13093
13104
|
const openMenu = React47.useCallback(() => {
|
|
13094
13105
|
setIsOpen(true);
|
|
@@ -14238,7 +14249,7 @@ var PhoneInput = React50.forwardRef(function PhoneInput2({
|
|
|
14238
14249
|
"div",
|
|
14239
14250
|
{
|
|
14240
14251
|
className: cn(
|
|
14241
|
-
"relative w-
|
|
14252
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
14242
14253
|
disabled && "cursor-not-allowed opacity-50",
|
|
14243
14254
|
loading && "cursor-progress",
|
|
14244
14255
|
className
|
|
@@ -14289,7 +14300,7 @@ var PhoneInput = React50.forwardRef(function PhoneInput2({
|
|
|
14289
14300
|
filterOption: countriesFilter,
|
|
14290
14301
|
clearable: false,
|
|
14291
14302
|
getValueLabel: (option) => option.value,
|
|
14292
|
-
className: "
|
|
14303
|
+
className: "max-w-none w-auto",
|
|
14293
14304
|
dropdownClassName: "right-auto w-[280px]"
|
|
14294
14305
|
}
|
|
14295
14306
|
),
|
|
@@ -14314,7 +14325,7 @@ var PhoneInput = React50.forwardRef(function PhoneInput2({
|
|
|
14314
14325
|
onFocus,
|
|
14315
14326
|
onBlur,
|
|
14316
14327
|
renderErrorMessage: false,
|
|
14317
|
-
wrapperClassName: "
|
|
14328
|
+
wrapperClassName: "max-w-none w-auto",
|
|
14318
14329
|
contentClassName: readOnly ? "!cursor-default" : void 0,
|
|
14319
14330
|
inputClassName: readOnly ? "!cursor-default" : void 0
|
|
14320
14331
|
}
|
|
@@ -15156,7 +15167,7 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15156
15167
|
"div",
|
|
15157
15168
|
{
|
|
15158
15169
|
className: cn(
|
|
15159
|
-
"relative block min-h-[88px] w-
|
|
15170
|
+
"relative block min-h-[88px] w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
15160
15171
|
isBlocked && "cursor-not-allowed opacity-50",
|
|
15161
15172
|
loading && "cursor-progress opacity-50",
|
|
15162
15173
|
className
|
|
@@ -16226,7 +16237,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16226
16237
|
{
|
|
16227
16238
|
ref: containerRef,
|
|
16228
16239
|
className: cn(
|
|
16229
|
-
"relative w-
|
|
16240
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
16230
16241
|
disabled && "cursor-not-allowed opacity-50",
|
|
16231
16242
|
loading && "cursor-progress opacity-50",
|
|
16232
16243
|
className
|
|
@@ -16587,19 +16598,130 @@ function useRangeValue({
|
|
|
16587
16598
|
|
|
16588
16599
|
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
16589
16600
|
import * as React64 from "react";
|
|
16601
|
+
|
|
16602
|
+
// src/dashboard/date-range-picker/utils/inputFormat.ts
|
|
16603
|
+
function parseDateInputFormat(format2) {
|
|
16604
|
+
const tokens = [];
|
|
16605
|
+
let i = 0;
|
|
16606
|
+
while (i < format2.length) {
|
|
16607
|
+
const ch = format2[i];
|
|
16608
|
+
if (/[a-zA-Z]/.test(ch)) {
|
|
16609
|
+
let len = 1;
|
|
16610
|
+
while (i + len < format2.length && format2[i + len] === ch) len++;
|
|
16611
|
+
tokens.push({ type: "digits", length: len });
|
|
16612
|
+
i += len;
|
|
16613
|
+
} else {
|
|
16614
|
+
tokens.push({ type: "separator", char: ch });
|
|
16615
|
+
i += 1;
|
|
16616
|
+
}
|
|
16617
|
+
}
|
|
16618
|
+
return tokens;
|
|
16619
|
+
}
|
|
16620
|
+
function getMaxDigits(tokens) {
|
|
16621
|
+
return tokens.reduce(
|
|
16622
|
+
(sum, token) => token.type === "digits" ? sum + token.length : sum,
|
|
16623
|
+
0
|
|
16624
|
+
);
|
|
16625
|
+
}
|
|
16626
|
+
function autoFormatDateInput(raw, tokens) {
|
|
16627
|
+
const digitTokens = tokens.filter(
|
|
16628
|
+
(token) => token.type === "digits"
|
|
16629
|
+
);
|
|
16630
|
+
const sepToken = tokens.find(
|
|
16631
|
+
(token) => token.type === "separator"
|
|
16632
|
+
);
|
|
16633
|
+
const sepChar = sepToken?.char ?? "-";
|
|
16634
|
+
const segments = [];
|
|
16635
|
+
let segIdx = 0;
|
|
16636
|
+
let current = "";
|
|
16637
|
+
let endedWithSeparator = false;
|
|
16638
|
+
for (let i = 0; i < raw.length; i++) {
|
|
16639
|
+
if (segIdx >= digitTokens.length) break;
|
|
16640
|
+
const ch = raw[i];
|
|
16641
|
+
const segLen = digitTokens[segIdx].length;
|
|
16642
|
+
if (/\d/.test(ch)) {
|
|
16643
|
+
if (current.length >= segLen) {
|
|
16644
|
+
segments.push(current);
|
|
16645
|
+
segIdx++;
|
|
16646
|
+
if (segIdx >= digitTokens.length) {
|
|
16647
|
+
current = "";
|
|
16648
|
+
endedWithSeparator = false;
|
|
16649
|
+
break;
|
|
16650
|
+
}
|
|
16651
|
+
current = ch;
|
|
16652
|
+
} else {
|
|
16653
|
+
current += ch;
|
|
16654
|
+
}
|
|
16655
|
+
endedWithSeparator = false;
|
|
16656
|
+
} else if (current.length > 0) {
|
|
16657
|
+
if (current.length < segLen) {
|
|
16658
|
+
if (segLen > 2) continue;
|
|
16659
|
+
current = current.padStart(segLen, "0");
|
|
16660
|
+
}
|
|
16661
|
+
segments.push(current);
|
|
16662
|
+
current = "";
|
|
16663
|
+
segIdx++;
|
|
16664
|
+
endedWithSeparator = true;
|
|
16665
|
+
}
|
|
16666
|
+
}
|
|
16667
|
+
if (current.length > 0) {
|
|
16668
|
+
segments.push(current);
|
|
16669
|
+
endedWithSeparator = false;
|
|
16670
|
+
}
|
|
16671
|
+
let result = segments.join(sepChar);
|
|
16672
|
+
if (endedWithSeparator && segments.length < digitTokens.length) {
|
|
16673
|
+
result += sepChar;
|
|
16674
|
+
}
|
|
16675
|
+
return result;
|
|
16676
|
+
}
|
|
16677
|
+
|
|
16678
|
+
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
16679
|
+
var countDigits = (text) => text.replace(/\D/g, "").length;
|
|
16590
16680
|
function useRangeTextInputs({
|
|
16591
16681
|
value,
|
|
16592
16682
|
format: format2,
|
|
16593
16683
|
parse: parse3,
|
|
16684
|
+
displayFormat,
|
|
16594
16685
|
onCommit,
|
|
16595
|
-
onBlur
|
|
16686
|
+
onBlur,
|
|
16687
|
+
onFromComplete,
|
|
16688
|
+
onToComplete
|
|
16596
16689
|
}) {
|
|
16690
|
+
const tokens = React64.useMemo(
|
|
16691
|
+
() => parseDateInputFormat(displayFormat),
|
|
16692
|
+
[displayFormat]
|
|
16693
|
+
);
|
|
16694
|
+
const maxDigits = React64.useMemo(() => getMaxDigits(tokens), [tokens]);
|
|
16597
16695
|
const [fromText, setFromText] = React64.useState(value?.from ? format2(value.from) : "");
|
|
16598
16696
|
const [toText, setToText] = React64.useState(value?.to ? format2(value.to) : "");
|
|
16599
16697
|
React64.useEffect(() => {
|
|
16600
16698
|
setFromText(value?.from ? format2(value.from) : "");
|
|
16601
16699
|
setToText(value?.to ? format2(value.to) : "");
|
|
16602
16700
|
}, [format2, value?.from, value?.to]);
|
|
16701
|
+
const handleFromChange = React64.useCallback(
|
|
16702
|
+
(raw) => {
|
|
16703
|
+
const formatted = autoFormatDateInput(raw, tokens);
|
|
16704
|
+
const wasComplete = countDigits(fromText) === maxDigits;
|
|
16705
|
+
const isComplete = countDigits(formatted) === maxDigits;
|
|
16706
|
+
setFromText(formatted);
|
|
16707
|
+
if (!wasComplete && isComplete && parse3(formatted)) {
|
|
16708
|
+
setTimeout(() => onFromComplete?.(), 0);
|
|
16709
|
+
}
|
|
16710
|
+
},
|
|
16711
|
+
[fromText, maxDigits, onFromComplete, parse3, tokens]
|
|
16712
|
+
);
|
|
16713
|
+
const handleToChange = React64.useCallback(
|
|
16714
|
+
(raw) => {
|
|
16715
|
+
const formatted = autoFormatDateInput(raw, tokens);
|
|
16716
|
+
const wasComplete = countDigits(toText) === maxDigits;
|
|
16717
|
+
const isComplete = countDigits(formatted) === maxDigits;
|
|
16718
|
+
setToText(formatted);
|
|
16719
|
+
if (!wasComplete && isComplete && parse3(formatted)) {
|
|
16720
|
+
setTimeout(() => onToComplete?.(), 0);
|
|
16721
|
+
}
|
|
16722
|
+
},
|
|
16723
|
+
[maxDigits, onToComplete, parse3, toText, tokens]
|
|
16724
|
+
);
|
|
16603
16725
|
const handleFromBlur = React64.useCallback(() => {
|
|
16604
16726
|
if (!fromText) {
|
|
16605
16727
|
const next = { from: void 0, to: value?.to };
|
|
@@ -16638,6 +16760,8 @@ function useRangeTextInputs({
|
|
|
16638
16760
|
toText,
|
|
16639
16761
|
setFromText,
|
|
16640
16762
|
setToText,
|
|
16763
|
+
handleFromChange,
|
|
16764
|
+
handleToChange,
|
|
16641
16765
|
handleFromBlur,
|
|
16642
16766
|
handleToBlur
|
|
16643
16767
|
};
|
|
@@ -16742,6 +16866,7 @@ function DateRangeInputs({
|
|
|
16742
16866
|
id: fromId,
|
|
16743
16867
|
name: name ? `${name}-from` : void 0,
|
|
16744
16868
|
type: "text",
|
|
16869
|
+
inputMode: "numeric",
|
|
16745
16870
|
autoComplete: "off",
|
|
16746
16871
|
placeholder: fromPlaceholder,
|
|
16747
16872
|
value: fromText,
|
|
@@ -16777,6 +16902,7 @@ function DateRangeInputs({
|
|
|
16777
16902
|
id: toId,
|
|
16778
16903
|
name: name ? `${name}-to` : void 0,
|
|
16779
16904
|
type: "text",
|
|
16905
|
+
inputMode: "numeric",
|
|
16780
16906
|
autoComplete: "off",
|
|
16781
16907
|
placeholder: toPlaceholder,
|
|
16782
16908
|
value: toText,
|
|
@@ -16978,12 +17104,33 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
16978
17104
|
const normalizedMaxDate = React66.useMemo(() => toDate(maxDate), [maxDate]);
|
|
16979
17105
|
const formatter = React66.useMemo(() => formatDate(displayFormat), [displayFormat]);
|
|
16980
17106
|
const parser = React66.useMemo(() => parseDate(displayFormat), [displayFormat]);
|
|
16981
|
-
const
|
|
17107
|
+
const closeCalendarRef = React66.useRef(() => {
|
|
17108
|
+
});
|
|
17109
|
+
const handleFromComplete = React66.useCallback(() => {
|
|
17110
|
+
toInputRef.current?.focus();
|
|
17111
|
+
}, []);
|
|
17112
|
+
const handleToComplete = React66.useCallback(() => {
|
|
17113
|
+
toInputRef.current?.blur();
|
|
17114
|
+
closeCalendarRef.current();
|
|
17115
|
+
}, []);
|
|
17116
|
+
const {
|
|
17117
|
+
fromText,
|
|
17118
|
+
toText,
|
|
17119
|
+
setFromText,
|
|
17120
|
+
setToText,
|
|
17121
|
+
handleFromChange,
|
|
17122
|
+
handleToChange,
|
|
17123
|
+
handleFromBlur,
|
|
17124
|
+
handleToBlur
|
|
17125
|
+
} = useRangeTextInputs({
|
|
16982
17126
|
value,
|
|
16983
17127
|
format: formatter,
|
|
16984
17128
|
parse: parser,
|
|
17129
|
+
displayFormat,
|
|
16985
17130
|
onCommit: commit,
|
|
16986
|
-
onBlur
|
|
17131
|
+
onBlur,
|
|
17132
|
+
onFromComplete: handleFromComplete,
|
|
17133
|
+
onToComplete: handleToComplete
|
|
16987
17134
|
});
|
|
16988
17135
|
const { month, setMonth, syncMonthToValue } = useRangeMonthSync(value);
|
|
16989
17136
|
const [isOpen, setIsOpen] = React66.useState(false);
|
|
@@ -17005,6 +17152,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17005
17152
|
setAutoFocus(false);
|
|
17006
17153
|
if (value?.from) setMonth(value.from);
|
|
17007
17154
|
}, [setMonth, value?.from]);
|
|
17155
|
+
closeCalendarRef.current = closeCalendar;
|
|
17008
17156
|
const openCalendar = React66.useCallback(() => {
|
|
17009
17157
|
if (isBlocked || readOnly) return;
|
|
17010
17158
|
setIsOpen(true);
|
|
@@ -17082,7 +17230,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17082
17230
|
{
|
|
17083
17231
|
ref: containerRef,
|
|
17084
17232
|
className: cn(
|
|
17085
|
-
"relative w-
|
|
17233
|
+
"relative w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)]",
|
|
17086
17234
|
disabled && "cursor-not-allowed opacity-50",
|
|
17087
17235
|
loading && "cursor-progress opacity-50",
|
|
17088
17236
|
className
|
|
@@ -17115,8 +17263,8 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17115
17263
|
focusedInput,
|
|
17116
17264
|
clearLabel: t("clear_dates"),
|
|
17117
17265
|
openCalendarLabel: t("open_calendar"),
|
|
17118
|
-
onFromTextChange:
|
|
17119
|
-
onToTextChange:
|
|
17266
|
+
onFromTextChange: handleFromChange,
|
|
17267
|
+
onToTextChange: handleToChange,
|
|
17120
17268
|
onFromFocus: (event) => {
|
|
17121
17269
|
onFocus?.(event);
|
|
17122
17270
|
setFocusedInput("from");
|
|
@@ -17435,7 +17583,7 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17435
17583
|
{
|
|
17436
17584
|
htmlFor: inputId,
|
|
17437
17585
|
className: cn(
|
|
17438
|
-
"relative block w-
|
|
17586
|
+
"relative block w-[var(--field-width,100%)] max-w-[var(--field-max-width,296px)] cursor-pointer text-left",
|
|
17439
17587
|
(disabled || readOnly) && "cursor-not-allowed",
|
|
17440
17588
|
loading && "cursor-progress opacity-50",
|
|
17441
17589
|
disabled && "opacity-50",
|