@chekinapp/ui 0.0.117 → 0.0.118
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 +111 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -9
- package/dist/index.d.ts +1 -9
- package/dist/index.js +111 -107
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -14678,7 +14678,14 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14678
14678
|
if (synthetic) list = [synthetic, ...list];
|
|
14679
14679
|
}
|
|
14680
14680
|
return list;
|
|
14681
|
-
}, [
|
|
14681
|
+
}, [
|
|
14682
|
+
rawOptions,
|
|
14683
|
+
inputValue,
|
|
14684
|
+
filterOption,
|
|
14685
|
+
getFullSearchOption,
|
|
14686
|
+
rest.getValueLabel,
|
|
14687
|
+
props
|
|
14688
|
+
]);
|
|
14682
14689
|
const contextValue = React52.useMemo(
|
|
14683
14690
|
() => ({
|
|
14684
14691
|
canLoadMore,
|
|
@@ -18024,7 +18031,6 @@ var import_jsx_runtime184 = require("react/jsx-runtime");
|
|
|
18024
18031
|
var AirbnbFieldTrigger = React72.forwardRef(
|
|
18025
18032
|
({
|
|
18026
18033
|
as = "button",
|
|
18027
|
-
variant = "airbnb",
|
|
18028
18034
|
id,
|
|
18029
18035
|
label,
|
|
18030
18036
|
topLabel,
|
|
@@ -18077,7 +18083,6 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18077
18083
|
)
|
|
18078
18084
|
] }) : visibleLabelText;
|
|
18079
18085
|
const animatedLabel = forceLabelText ? resolvedLabelText ?? placeholder : isRaised ? resolvedLabelText : label ?? placeholder;
|
|
18080
|
-
const isAirbnbVariant = variant === "airbnb";
|
|
18081
18086
|
const hasInvalidState = Boolean(error);
|
|
18082
18087
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
18083
18088
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
@@ -18092,11 +18097,11 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18092
18097
|
)
|
|
18093
18098
|
] }) : void 0;
|
|
18094
18099
|
const sharedClasses = cn(
|
|
18095
|
-
"relative flex w-full items-center border bg-
|
|
18096
|
-
|
|
18097
|
-
|
|
18098
|
-
hasInvalidState ?
|
|
18099
|
-
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" :
|
|
18100
|
+
"relative flex w-full items-center border bg-transparent text-left transition-colors focus-visible:outline-none",
|
|
18101
|
+
"rounded-[12px] border-[#8c8c8c] pl-4 pr-4 focus-visible:ring-2 focus-visible:ring-[#222222] focus-visible:ring-offset-2",
|
|
18102
|
+
isRaised ? "min-h-[60px]" : "h-[60px]",
|
|
18103
|
+
hasInvalidState ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[#8c8c8c]",
|
|
18104
|
+
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : "cursor-pointer",
|
|
18100
18105
|
className
|
|
18101
18106
|
);
|
|
18102
18107
|
const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_jsx_runtime184.Fragment, { children: [
|
|
@@ -18105,7 +18110,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18105
18110
|
{
|
|
18106
18111
|
className: cn(
|
|
18107
18112
|
"relative min-w-0 flex-1 pr-2",
|
|
18108
|
-
|
|
18113
|
+
isRaised ? "h-[42px]" : "h-[28px]",
|
|
18109
18114
|
contentClassName
|
|
18110
18115
|
),
|
|
18111
18116
|
children: [
|
|
@@ -18116,8 +18121,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18116
18121
|
className: cn(
|
|
18117
18122
|
"absolute left-0 origin-left transition-all duration-200 ease-out",
|
|
18118
18123
|
hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
|
|
18119
|
-
|
|
18120
|
-
hasInvalidState ? "text-[var(--error-message-color)]" :
|
|
18124
|
+
isRaised ? "top-[-1px] translate-y-0 text-xs leading-5" : "top-1/2 -translate-y-1/2 text-[16px] leading-7",
|
|
18125
|
+
hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#6c6c6c]"
|
|
18121
18126
|
),
|
|
18122
18127
|
children: animatedLabel
|
|
18123
18128
|
}
|
|
@@ -18128,7 +18133,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18128
18133
|
id: valueId,
|
|
18129
18134
|
className: cn(
|
|
18130
18135
|
"absolute left-0 block truncate transition-all duration-200 ease-out",
|
|
18131
|
-
|
|
18136
|
+
"bottom-0 translate-y-0 text-[16px] leading-6 opacity-100",
|
|
18132
18137
|
hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#222222]"
|
|
18133
18138
|
),
|
|
18134
18139
|
children: valueText
|
|
@@ -18141,10 +18146,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18141
18146
|
"span",
|
|
18142
18147
|
{
|
|
18143
18148
|
"aria-hidden": "true",
|
|
18144
|
-
className:
|
|
18145
|
-
"pointer-events-none absolute top-1/2 -translate-y-1/2",
|
|
18146
|
-
isAirbnbVariant ? "right-5" : "right-4"
|
|
18147
|
-
),
|
|
18149
|
+
className: "pointer-events-none absolute right-5 top-1/2 -translate-y-1/2",
|
|
18148
18150
|
children: resolvedTrailingAdornment
|
|
18149
18151
|
}
|
|
18150
18152
|
)
|
|
@@ -18196,7 +18198,6 @@ var import_jsx_runtime185 = require("react/jsx-runtime");
|
|
|
18196
18198
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
18197
18199
|
var AirbnbDatePicker = React73.forwardRef(
|
|
18198
18200
|
({
|
|
18199
|
-
variant = "default",
|
|
18200
18201
|
label,
|
|
18201
18202
|
topLabel,
|
|
18202
18203
|
value,
|
|
@@ -18323,7 +18324,6 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
18323
18324
|
{
|
|
18324
18325
|
id: triggerId,
|
|
18325
18326
|
ref: combinedRef,
|
|
18326
|
-
variant,
|
|
18327
18327
|
label,
|
|
18328
18328
|
topLabel,
|
|
18329
18329
|
labelId,
|
|
@@ -18389,7 +18389,6 @@ var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
|
18389
18389
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
18390
18390
|
var AirbnbInput = React74.forwardRef(
|
|
18391
18391
|
({
|
|
18392
|
-
variant = "default",
|
|
18393
18392
|
label,
|
|
18394
18393
|
topLabel,
|
|
18395
18394
|
helperText,
|
|
@@ -18485,7 +18484,6 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18485
18484
|
AirbnbFieldTrigger,
|
|
18486
18485
|
{
|
|
18487
18486
|
as: "div",
|
|
18488
|
-
variant,
|
|
18489
18487
|
id: fieldId,
|
|
18490
18488
|
label: accessibleLabel ?? "",
|
|
18491
18489
|
topLabel,
|
|
@@ -18501,14 +18499,11 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18501
18499
|
tooltip,
|
|
18502
18500
|
describedBy: error && renderErrorMessage ? errorId : void 0,
|
|
18503
18501
|
className: cn(
|
|
18504
|
-
|
|
18502
|
+
"px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2",
|
|
18505
18503
|
disabled ? "cursor-not-allowed" : "cursor-text",
|
|
18506
18504
|
fieldClassName
|
|
18507
18505
|
),
|
|
18508
|
-
contentClassName: cn(
|
|
18509
|
-
variant === "airbnb" ? "h-[42px]" : "h-[48px]",
|
|
18510
|
-
contentClassName
|
|
18511
|
-
),
|
|
18506
|
+
contentClassName: cn("h-[42px]", contentClassName),
|
|
18512
18507
|
trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
|
|
18513
18508
|
forceFloatingLabel: shouldShowLabel,
|
|
18514
18509
|
forceLabelText: hasLabelMeta,
|
|
@@ -18535,7 +18530,7 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18535
18530
|
"aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
|
|
18536
18531
|
className: cn(
|
|
18537
18532
|
"absolute left-0 h-6 w-full border-0 bg-transparent p-0 text-[16px] leading-6 text-[#1F1F1B] outline-none placeholder:text-[#7A8399]",
|
|
18538
|
-
|
|
18533
|
+
"bottom-0",
|
|
18539
18534
|
hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
|
|
18540
18535
|
disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
|
|
18541
18536
|
shouldShowPasswordReveal ? "pr-8" : "",
|
|
@@ -18550,10 +18545,7 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18550
18545
|
type: "button",
|
|
18551
18546
|
onClick: togglePasswordReveal,
|
|
18552
18547
|
disabled: isBlocked,
|
|
18553
|
-
className:
|
|
18554
|
-
"absolute right-0 flex h-6 w-6 items-center justify-center border-0 bg-transparent p-0 text-[#7A8399] hover:text-[#1F1F1B] hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-50",
|
|
18555
|
-
variant === "airbnb" ? "bottom-0" : "bottom-[12px]"
|
|
18556
|
-
),
|
|
18548
|
+
className: "absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center border-0 bg-transparent p-0 text-[#7A8399] hover:text-[#1F1F1B] hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-50",
|
|
18557
18549
|
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
18558
18550
|
children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18559
18551
|
import_lucide_react54.Eye,
|
|
@@ -18929,7 +18921,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
|
|
|
18929
18921
|
({
|
|
18930
18922
|
id,
|
|
18931
18923
|
open,
|
|
18932
|
-
variant,
|
|
18933
18924
|
label,
|
|
18934
18925
|
topLabel,
|
|
18935
18926
|
helperText,
|
|
@@ -18955,7 +18946,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
|
|
|
18955
18946
|
{
|
|
18956
18947
|
id,
|
|
18957
18948
|
ref,
|
|
18958
|
-
variant,
|
|
18959
18949
|
"aria-haspopup": "listbox",
|
|
18960
18950
|
"aria-expanded": open,
|
|
18961
18951
|
"aria-controls": listboxId,
|
|
@@ -19347,7 +19337,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19347
19337
|
value,
|
|
19348
19338
|
onChange,
|
|
19349
19339
|
onBlur,
|
|
19350
|
-
variant = "default",
|
|
19351
19340
|
label,
|
|
19352
19341
|
topLabel,
|
|
19353
19342
|
placeholder,
|
|
@@ -19366,11 +19355,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19366
19355
|
doneLabel = "Done",
|
|
19367
19356
|
mobileTitle,
|
|
19368
19357
|
name,
|
|
19369
|
-
noOptionsMessage
|
|
19358
|
+
noOptionsMessage,
|
|
19359
|
+
filterOption
|
|
19370
19360
|
}, ref) {
|
|
19371
19361
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
19372
19362
|
const [isOpen, setIsOpen] = React79.useState(false);
|
|
19373
19363
|
const containerRef = React79.useRef(null);
|
|
19364
|
+
const filteredOptions = filterOption ? options.filter(filterOption) : options;
|
|
19374
19365
|
const hasValue = Boolean(value);
|
|
19375
19366
|
const helperText = placeholder ?? label;
|
|
19376
19367
|
const shouldDescribeHelperText = !hasValue && helperText !== label;
|
|
@@ -19401,7 +19392,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19401
19392
|
} = useMobileSelectWheel({
|
|
19402
19393
|
isMobile: isMobile3,
|
|
19403
19394
|
isOpen,
|
|
19404
|
-
options,
|
|
19395
|
+
options: filteredOptions,
|
|
19405
19396
|
value,
|
|
19406
19397
|
disabled: isBlocked
|
|
19407
19398
|
});
|
|
@@ -19418,13 +19409,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19418
19409
|
} = useDesktopSelect({
|
|
19419
19410
|
isMobile: isMobile3,
|
|
19420
19411
|
isOpen,
|
|
19421
|
-
options,
|
|
19412
|
+
options: filteredOptions,
|
|
19422
19413
|
value,
|
|
19423
19414
|
disabled: isBlocked,
|
|
19424
19415
|
onChange
|
|
19425
19416
|
});
|
|
19426
19417
|
const combinedRef = useCombinedRef(ref, desktopTriggerRef);
|
|
19427
|
-
const activeMobileIndex = getOptionIndex2(
|
|
19418
|
+
const activeMobileIndex = getOptionIndex2(filteredOptions, pendingValue);
|
|
19428
19419
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
19429
19420
|
useOutsideClick({
|
|
19430
19421
|
elementRef: containerRef,
|
|
@@ -19441,12 +19432,12 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19441
19432
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
19442
19433
|
return;
|
|
19443
19434
|
}
|
|
19444
|
-
const validOption =
|
|
19435
|
+
const validOption = filteredOptions.find((option) => option.value === value.value);
|
|
19445
19436
|
if (validOption) {
|
|
19446
19437
|
onChange(validOption);
|
|
19447
19438
|
}
|
|
19448
19439
|
},
|
|
19449
|
-
[onChange,
|
|
19440
|
+
[onChange, filteredOptions, value]
|
|
19450
19441
|
);
|
|
19451
19442
|
const handleMobileOpenChange = React79.useCallback(
|
|
19452
19443
|
(nextOpen) => {
|
|
@@ -19531,7 +19522,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19531
19522
|
renderTrigger ? renderTrigger({
|
|
19532
19523
|
id: triggerId,
|
|
19533
19524
|
open: isOpen,
|
|
19534
|
-
variant,
|
|
19535
19525
|
label,
|
|
19536
19526
|
topLabel,
|
|
19537
19527
|
helperText,
|
|
@@ -19555,7 +19545,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19555
19545
|
id: triggerId,
|
|
19556
19546
|
ref: combinedRef,
|
|
19557
19547
|
open: isOpen,
|
|
19558
|
-
variant,
|
|
19559
19548
|
label,
|
|
19560
19549
|
topLabel,
|
|
19561
19550
|
helperText,
|
|
@@ -19589,7 +19578,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19589
19578
|
mobileTitle,
|
|
19590
19579
|
doneLabel,
|
|
19591
19580
|
errorId: describedErrorId,
|
|
19592
|
-
options,
|
|
19581
|
+
options: filteredOptions,
|
|
19593
19582
|
disabled: isBlocked,
|
|
19594
19583
|
menuClassName,
|
|
19595
19584
|
scrollTop: mobileScrollTop,
|
|
@@ -19609,7 +19598,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19609
19598
|
listboxId,
|
|
19610
19599
|
labelId,
|
|
19611
19600
|
errorId: describedErrorId,
|
|
19612
|
-
options,
|
|
19601
|
+
options: filteredOptions,
|
|
19613
19602
|
value,
|
|
19614
19603
|
highlightedIndex,
|
|
19615
19604
|
onOptionClick: (option) => {
|
|
@@ -19644,7 +19633,6 @@ function formatPhoneCodeOptionLabel2(option) {
|
|
|
19644
19633
|
}
|
|
19645
19634
|
var AirbnbPhoneField = React80.forwardRef(
|
|
19646
19635
|
({
|
|
19647
|
-
variant = "default",
|
|
19648
19636
|
label,
|
|
19649
19637
|
topLabel,
|
|
19650
19638
|
value,
|
|
@@ -19716,7 +19704,6 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19716
19704
|
AirbnbSelect,
|
|
19717
19705
|
{
|
|
19718
19706
|
ref,
|
|
19719
|
-
variant,
|
|
19720
19707
|
options: codeOptions,
|
|
19721
19708
|
value: selectedCodeOption,
|
|
19722
19709
|
onChange: (option) => onChange({
|
|
@@ -19735,7 +19722,6 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19735
19722
|
renderTrigger: ({
|
|
19736
19723
|
id,
|
|
19737
19724
|
open,
|
|
19738
|
-
variant: selectVariant,
|
|
19739
19725
|
disabled: triggerDisabled,
|
|
19740
19726
|
loading: triggerLoading,
|
|
19741
19727
|
listboxId,
|
|
@@ -19759,9 +19745,8 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19759
19745
|
onClick,
|
|
19760
19746
|
onKeyDown,
|
|
19761
19747
|
className: cn(
|
|
19762
|
-
"flex w-full items-center justify-center gap-2 border border-r-0 text-[16px] font-medium leading-6 transition-colors focus-visible:outline-none",
|
|
19763
|
-
|
|
19764
|
-
hasInvalidState ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : selectVariant === "airbnb" ? "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]" : "border-[#A8A8A4] bg-white text-[#1F1F1B]",
|
|
19748
|
+
"flex h-full min-h-[60px] w-full items-center justify-center gap-2 rounded-l-[16px] rounded-r-none border border-r-0 px-4 text-[16px] font-medium leading-6 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1F1F1B] focus-visible:ring-offset-2",
|
|
19749
|
+
hasInvalidState ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]",
|
|
19765
19750
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
19766
19751
|
),
|
|
19767
19752
|
children: [
|
|
@@ -19782,7 +19767,6 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19782
19767
|
AirbnbInput,
|
|
19783
19768
|
{
|
|
19784
19769
|
id: inputId,
|
|
19785
|
-
variant,
|
|
19786
19770
|
type: "tel",
|
|
19787
19771
|
inputMode: "tel",
|
|
19788
19772
|
label,
|
|
@@ -19797,10 +19781,8 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19797
19781
|
tooltip,
|
|
19798
19782
|
renderErrorMessage: false,
|
|
19799
19783
|
wrapperClassName: "min-w-0 flex-1",
|
|
19800
|
-
fieldClassName:
|
|
19801
|
-
|
|
19802
|
-
),
|
|
19803
|
-
contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
|
|
19784
|
+
fieldClassName: "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0",
|
|
19785
|
+
contentClassName: "h-[40px] py-2",
|
|
19804
19786
|
inputClassName: "text-[16px] leading-7",
|
|
19805
19787
|
onChange: (event) => onChange({
|
|
19806
19788
|
code: value?.code ?? "",
|
|
@@ -19841,7 +19823,6 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19841
19823
|
loading,
|
|
19842
19824
|
hasNextPage,
|
|
19843
19825
|
onLoadMore,
|
|
19844
|
-
variant = "default",
|
|
19845
19826
|
label,
|
|
19846
19827
|
topLabel,
|
|
19847
19828
|
placeholder,
|
|
@@ -20025,7 +20006,6 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20025
20006
|
{
|
|
20026
20007
|
id: `${reactId}-trigger`,
|
|
20027
20008
|
ref: triggerRef,
|
|
20028
|
-
variant,
|
|
20029
20009
|
"aria-haspopup": "listbox",
|
|
20030
20010
|
"aria-expanded": open,
|
|
20031
20011
|
"aria-controls": listboxId,
|
|
@@ -20308,59 +20288,83 @@ var React83 = __toESM(require("react"), 1);
|
|
|
20308
20288
|
var SwitchPrimitives2 = __toESM(require("@radix-ui/react-switch"), 1);
|
|
20309
20289
|
var import_lucide_react59 = require("lucide-react");
|
|
20310
20290
|
var import_jsx_runtime196 = require("react/jsx-runtime");
|
|
20311
|
-
var AirbnbSwitch = React83.forwardRef(
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20333
|
-
|
|
20334
|
-
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
className
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20291
|
+
var AirbnbSwitch = React83.forwardRef(
|
|
20292
|
+
({
|
|
20293
|
+
className,
|
|
20294
|
+
value,
|
|
20295
|
+
onChange,
|
|
20296
|
+
disabled,
|
|
20297
|
+
loading,
|
|
20298
|
+
readOnly,
|
|
20299
|
+
id,
|
|
20300
|
+
label,
|
|
20301
|
+
error,
|
|
20302
|
+
wrapperClassName,
|
|
20303
|
+
...props
|
|
20304
|
+
}, ref) => {
|
|
20305
|
+
const generatedId = React83.useId();
|
|
20306
|
+
const fieldId = id || generatedId;
|
|
20307
|
+
const switchElement = /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20308
|
+
SwitchPrimitives2.Root,
|
|
20309
|
+
{
|
|
20310
|
+
ref,
|
|
20311
|
+
className: cn(
|
|
20312
|
+
"group inline-flex h-[24px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border border-solid border-transparent p-[2px] transition-colors duration-200",
|
|
20313
|
+
"focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
|
|
20314
|
+
"disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
|
|
20315
|
+
"aria-readonly:cursor-default aria-readonly:opacity-100",
|
|
20316
|
+
"data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
|
|
20317
|
+
className
|
|
20318
|
+
),
|
|
20319
|
+
id: fieldId,
|
|
20320
|
+
disabled,
|
|
20321
|
+
checked: value,
|
|
20322
|
+
value: String(value),
|
|
20323
|
+
onCheckedChange: !disabled && !readOnly ? onChange : void 0,
|
|
20324
|
+
"aria-busy": loading,
|
|
20325
|
+
"aria-readonly": readOnly,
|
|
20326
|
+
...props,
|
|
20327
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20328
|
+
SwitchPrimitives2.Thumb,
|
|
20329
|
+
{
|
|
20330
|
+
className: cn(
|
|
20331
|
+
"flex h-[20px] w-[20px] items-center justify-center rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,0.22)] transition-transform duration-200",
|
|
20332
|
+
"data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
|
|
20333
|
+
),
|
|
20334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20335
|
+
import_lucide_react59.Check,
|
|
20336
|
+
{
|
|
20337
|
+
"aria-hidden": "true",
|
|
20338
|
+
className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
|
|
20339
|
+
strokeWidth: 3
|
|
20340
|
+
}
|
|
20341
|
+
)
|
|
20342
|
+
}
|
|
20343
|
+
)
|
|
20344
|
+
}
|
|
20345
|
+
);
|
|
20346
|
+
if (!label && !error) {
|
|
20347
|
+
return switchElement;
|
|
20351
20348
|
}
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
|
|
20349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
|
|
20350
|
+
/* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
|
|
20351
|
+
switchElement,
|
|
20352
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20353
|
+
Label,
|
|
20354
|
+
{
|
|
20355
|
+
htmlFor: fieldId,
|
|
20356
|
+
className: cn(
|
|
20357
|
+
"text-base font-medium",
|
|
20358
|
+
readOnly ? "cursor-default" : "cursor-pointer"
|
|
20359
|
+
),
|
|
20360
|
+
children: label
|
|
20361
|
+
}
|
|
20362
|
+
)
|
|
20363
|
+
] }),
|
|
20364
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(ErrorMessage, { disabled, children: error })
|
|
20365
|
+
] });
|
|
20355
20366
|
}
|
|
20356
|
-
|
|
20357
|
-
/* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
|
|
20358
|
-
switchElement,
|
|
20359
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Label, { htmlFor: fieldId, className: "cursor-pointer text-base font-medium", children: label })
|
|
20360
|
-
] }),
|
|
20361
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(ErrorMessage, { disabled, children: error })
|
|
20362
|
-
] });
|
|
20363
|
-
});
|
|
20367
|
+
);
|
|
20364
20368
|
AirbnbSwitch.displayName = "AirbnbSwitch";
|
|
20365
20369
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20366
20370
|
0 && (module.exports = {
|