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