@chekinapp/ui 0.0.123 → 0.0.125
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 +78 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.js +78 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12854,7 +12854,8 @@ function SelectFieldShell({
|
|
|
12854
12854
|
{
|
|
12855
12855
|
id: errorId,
|
|
12856
12856
|
message: errorMessage,
|
|
12857
|
-
className: "mt-[1px] text-[14px]"
|
|
12857
|
+
className: "mt-[1px] text-[14px]",
|
|
12858
|
+
"data-testid": name ? `${name}-error` : void 0
|
|
12858
12859
|
}
|
|
12859
12860
|
)
|
|
12860
12861
|
] })
|
|
@@ -13562,6 +13563,7 @@ function useSelectState(params) {
|
|
|
13562
13563
|
closeMenuOnSelect,
|
|
13563
13564
|
openMenuOnFocus = true,
|
|
13564
13565
|
onKeyDown,
|
|
13566
|
+
onFocus,
|
|
13565
13567
|
onBlur,
|
|
13566
13568
|
isSearchInDropdown
|
|
13567
13569
|
} = params;
|
|
@@ -13578,9 +13580,7 @@ function useSelectState(params) {
|
|
|
13578
13580
|
[singleSelected, getValueLabel]
|
|
13579
13581
|
);
|
|
13580
13582
|
const isSearchOnlyInput = isMulti || Boolean(isSearchInDropdown);
|
|
13581
|
-
const [inputValue, setInputValue] = React48.useState(
|
|
13582
|
-
isSearchOnlyInput ? "" : valueLabel
|
|
13583
|
-
);
|
|
13583
|
+
const [inputValue, setInputValue] = React48.useState(isSearchOnlyInput ? "" : valueLabel);
|
|
13584
13584
|
const hasValue = selectedOptions.length > 0;
|
|
13585
13585
|
const isBlocked = Boolean(disabled) || Boolean(loading) || Boolean(readOnly);
|
|
13586
13586
|
const hasInvalidState = Boolean(error);
|
|
@@ -13739,14 +13739,18 @@ function useSelectState(params) {
|
|
|
13739
13739
|
},
|
|
13740
13740
|
[isOpen, setIsOpen]
|
|
13741
13741
|
);
|
|
13742
|
-
const handleInputFocus = React48.useCallback(
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13749
|
-
|
|
13742
|
+
const handleInputFocus = React48.useCallback(
|
|
13743
|
+
(event) => {
|
|
13744
|
+
if (isBlocked) return;
|
|
13745
|
+
onFocus?.(event);
|
|
13746
|
+
setIsFocused(true);
|
|
13747
|
+
if (openMenuOnFocus) setIsOpen(true);
|
|
13748
|
+
if (!isMulti) {
|
|
13749
|
+
requestAnimationFrame(() => inputRef.current?.select());
|
|
13750
|
+
}
|
|
13751
|
+
},
|
|
13752
|
+
[isBlocked, onFocus, openMenuOnFocus, setIsOpen, isMulti]
|
|
13753
|
+
);
|
|
13750
13754
|
const handleContainerClick = React48.useCallback(() => {
|
|
13751
13755
|
if (isBlocked) return;
|
|
13752
13756
|
inputRef.current?.focus();
|
|
@@ -14180,6 +14184,7 @@ function SelectInternal(props, ref) {
|
|
|
14180
14184
|
const {
|
|
14181
14185
|
options = [],
|
|
14182
14186
|
onBlur,
|
|
14187
|
+
onFocus,
|
|
14183
14188
|
label,
|
|
14184
14189
|
topLabel,
|
|
14185
14190
|
placeholder,
|
|
@@ -14281,6 +14286,7 @@ function SelectInternal(props, ref) {
|
|
|
14281
14286
|
closeMenuOnSelect,
|
|
14282
14287
|
openMenuOnFocus,
|
|
14283
14288
|
onKeyDown,
|
|
14289
|
+
onFocus,
|
|
14284
14290
|
onBlur,
|
|
14285
14291
|
isSearchInDropdown
|
|
14286
14292
|
});
|
|
@@ -14507,6 +14513,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14507
14513
|
options,
|
|
14508
14514
|
value,
|
|
14509
14515
|
onChange,
|
|
14516
|
+
onFocus,
|
|
14510
14517
|
onBlur,
|
|
14511
14518
|
name,
|
|
14512
14519
|
codeName,
|
|
@@ -14646,6 +14653,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14646
14653
|
tooltip,
|
|
14647
14654
|
"aria-label": resolvedLabel || name,
|
|
14648
14655
|
onChange: handleNumberChange,
|
|
14656
|
+
onFocus,
|
|
14649
14657
|
onBlur,
|
|
14650
14658
|
renderErrorMessage: false,
|
|
14651
14659
|
wrapperClassName: "!max-w-none"
|
|
@@ -16235,6 +16243,9 @@ var Datepicker = React62.forwardRef(
|
|
|
16235
16243
|
value,
|
|
16236
16244
|
defaultValue,
|
|
16237
16245
|
onChange,
|
|
16246
|
+
onFocus,
|
|
16247
|
+
onFieldFocus,
|
|
16248
|
+
onFieldBlur,
|
|
16238
16249
|
name,
|
|
16239
16250
|
invalid,
|
|
16240
16251
|
error,
|
|
@@ -16298,9 +16309,30 @@ var Datepicker = React62.forwardRef(
|
|
|
16298
16309
|
const [monthInputValue, setMonthInputValue] = React62.useState("");
|
|
16299
16310
|
const [monthHighlightIndex, setMonthHighlightIndex] = React62.useState(-1);
|
|
16300
16311
|
const isMobile3 = useIsMobile();
|
|
16312
|
+
const emitChangeRef = React62.useRef(() => {
|
|
16313
|
+
});
|
|
16314
|
+
const dayStateRef = React62.useRef(day);
|
|
16315
|
+
const yearStateRef = React62.useRef(year);
|
|
16316
|
+
const monthIndexRef = React62.useRef(monthIndex);
|
|
16317
|
+
dayStateRef.current = day;
|
|
16318
|
+
yearStateRef.current = year;
|
|
16319
|
+
monthIndexRef.current = monthIndex;
|
|
16301
16320
|
React62.useImperativeHandle(
|
|
16302
16321
|
ref,
|
|
16303
|
-
() =>
|
|
16322
|
+
() => ({
|
|
16323
|
+
getDayValue: () => dayStateRef.current,
|
|
16324
|
+
getYearValue: () => yearStateRef.current,
|
|
16325
|
+
setDayValue: (next) => {
|
|
16326
|
+
if (!PARTIAL_DAY_PATTERN.test(next)) return;
|
|
16327
|
+
setDay(next);
|
|
16328
|
+
emitChangeRef.current(next, monthIndexRef.current, yearStateRef.current);
|
|
16329
|
+
},
|
|
16330
|
+
setYearValue: (next) => {
|
|
16331
|
+
if (!PARTIAL_YEAR_PATTERN.test(next)) return;
|
|
16332
|
+
setYear(next);
|
|
16333
|
+
emitChangeRef.current(dayStateRef.current, monthIndexRef.current, next);
|
|
16334
|
+
}
|
|
16335
|
+
}),
|
|
16304
16336
|
[]
|
|
16305
16337
|
);
|
|
16306
16338
|
React62.useEffect(() => {
|
|
@@ -16361,6 +16393,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16361
16393
|
},
|
|
16362
16394
|
[name, onChange]
|
|
16363
16395
|
);
|
|
16396
|
+
emitChangeRef.current = emitChange;
|
|
16364
16397
|
const handleDayChange = (event) => {
|
|
16365
16398
|
const next = event.target.value;
|
|
16366
16399
|
if (!PARTIAL_DAY_PATTERN.test(next)) return;
|
|
@@ -16548,6 +16581,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16548
16581
|
"aria-busy": loading,
|
|
16549
16582
|
disabled: isBlocked || readOnly,
|
|
16550
16583
|
onClick: openWheel,
|
|
16584
|
+
onFocus,
|
|
16551
16585
|
className: cn(
|
|
16552
16586
|
"relative m-0 box-border flex h-12 w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] border-0 px-4 text-left text-[16px] font-medium leading-5 outline-none transition-colors duration-200",
|
|
16553
16587
|
triggerText ? "bg-transparent text-[var(--chekin-color-brand-navy)]" : "bg-[var(--empty-field-background)] text-[var(--chekin-color-gray-1)]",
|
|
@@ -16590,8 +16624,15 @@ var Datepicker = React62.forwardRef(
|
|
|
16590
16624
|
"aria-invalid": isInvalid,
|
|
16591
16625
|
"aria-labelledby": labelId,
|
|
16592
16626
|
onChange: handleDayChange,
|
|
16593
|
-
onFocus: () =>
|
|
16594
|
-
|
|
16627
|
+
onFocus: (event) => {
|
|
16628
|
+
onFocus?.(event);
|
|
16629
|
+
onFieldFocus?.("day");
|
|
16630
|
+
setFocusedField("day");
|
|
16631
|
+
},
|
|
16632
|
+
onBlur: () => {
|
|
16633
|
+
onFieldBlur?.("day");
|
|
16634
|
+
setFocusedField(null);
|
|
16635
|
+
},
|
|
16595
16636
|
maxLength: 2,
|
|
16596
16637
|
className: subInputClass
|
|
16597
16638
|
}
|
|
@@ -16618,7 +16659,9 @@ var Datepicker = React62.forwardRef(
|
|
|
16618
16659
|
disabled: isBlocked,
|
|
16619
16660
|
readOnly,
|
|
16620
16661
|
onChange: handleMonthInputChange,
|
|
16621
|
-
onFocus: () => {
|
|
16662
|
+
onFocus: (event) => {
|
|
16663
|
+
onFocus?.(event);
|
|
16664
|
+
onFieldFocus?.("month");
|
|
16622
16665
|
setFocusedField("month");
|
|
16623
16666
|
if (!isBlocked && !readOnly) {
|
|
16624
16667
|
setIsMonthOpen(true);
|
|
@@ -16626,6 +16669,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16626
16669
|
}
|
|
16627
16670
|
},
|
|
16628
16671
|
onBlur: () => {
|
|
16672
|
+
onFieldBlur?.("month");
|
|
16629
16673
|
setFocusedField(null);
|
|
16630
16674
|
commitMonthInput();
|
|
16631
16675
|
},
|
|
@@ -16673,8 +16717,15 @@ var Datepicker = React62.forwardRef(
|
|
|
16673
16717
|
"aria-invalid": isInvalid,
|
|
16674
16718
|
"aria-labelledby": labelId,
|
|
16675
16719
|
onChange: handleYearChange,
|
|
16676
|
-
onFocus: () =>
|
|
16677
|
-
|
|
16720
|
+
onFocus: (event) => {
|
|
16721
|
+
onFocus?.(event);
|
|
16722
|
+
onFieldFocus?.("year");
|
|
16723
|
+
setFocusedField("year");
|
|
16724
|
+
},
|
|
16725
|
+
onBlur: () => {
|
|
16726
|
+
onFieldBlur?.("year");
|
|
16727
|
+
setFocusedField(null);
|
|
16728
|
+
},
|
|
16678
16729
|
maxLength: 4,
|
|
16679
16730
|
className: subInputClass
|
|
16680
16731
|
}
|
|
@@ -17204,6 +17255,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17204
17255
|
value: externalValue,
|
|
17205
17256
|
defaultValue,
|
|
17206
17257
|
onChange,
|
|
17258
|
+
onFocus,
|
|
17207
17259
|
onBlur,
|
|
17208
17260
|
name,
|
|
17209
17261
|
invalid,
|
|
@@ -17399,11 +17451,13 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17399
17451
|
openCalendarLabel: t("open_calendar"),
|
|
17400
17452
|
onFromTextChange: setFromText,
|
|
17401
17453
|
onToTextChange: setToText,
|
|
17402
|
-
onFromFocus: () => {
|
|
17454
|
+
onFromFocus: (event) => {
|
|
17455
|
+
onFocus?.(event);
|
|
17403
17456
|
setFocusedInput("from");
|
|
17404
17457
|
if (!readOnly && !isBlocked) setIsOpen(true);
|
|
17405
17458
|
},
|
|
17406
|
-
onToFocus: () => {
|
|
17459
|
+
onToFocus: (event) => {
|
|
17460
|
+
onFocus?.(event);
|
|
17407
17461
|
setFocusedInput("to");
|
|
17408
17462
|
if (!readOnly && !isBlocked) setIsOpen(true);
|
|
17409
17463
|
},
|
|
@@ -17657,6 +17711,7 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17657
17711
|
label,
|
|
17658
17712
|
value,
|
|
17659
17713
|
onChange,
|
|
17714
|
+
onFocus,
|
|
17660
17715
|
onDownload = defaultDownload,
|
|
17661
17716
|
name = "file",
|
|
17662
17717
|
placeholder,
|
|
@@ -17730,6 +17785,7 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17730
17785
|
multiple,
|
|
17731
17786
|
disabled: isBlocked || readOnly,
|
|
17732
17787
|
onChange: handleFileChange,
|
|
17788
|
+
onFocus,
|
|
17733
17789
|
className: "absolute h-[0.1px] w-[0.1px] opacity-0",
|
|
17734
17790
|
"aria-labelledby": labelId,
|
|
17735
17791
|
"aria-invalid": isInvalid
|
|
@@ -17830,6 +17886,7 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
17830
17886
|
isOpen: controlledOpen,
|
|
17831
17887
|
defaultOpen = false,
|
|
17832
17888
|
onOpenChange,
|
|
17889
|
+
onFocus,
|
|
17833
17890
|
position = "left",
|
|
17834
17891
|
className,
|
|
17835
17892
|
boxClassName
|
|
@@ -17857,6 +17914,7 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
17857
17914
|
setOpen(false);
|
|
17858
17915
|
};
|
|
17859
17916
|
const handleContainerFocus = (event) => {
|
|
17917
|
+
onFocus?.(event);
|
|
17860
17918
|
if (event.target !== event.currentTarget) return;
|
|
17861
17919
|
const focusable = event.currentTarget.querySelector(
|
|
17862
17920
|
FOCUSABLE_TRIGGER_SELECTOR2
|