@chekinapp/ui 0.0.3 → 0.0.4
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 +343 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +347 -333
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5033,37 +5033,42 @@ var SelectLabel = React19.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5033
5033
|
}
|
|
5034
5034
|
));
|
|
5035
5035
|
SelectLabel.displayName = "SelectLabel";
|
|
5036
|
-
var Select = (
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
}
|
|
5036
|
+
var Select = React19.forwardRef(
|
|
5037
|
+
({
|
|
5038
|
+
placeholder,
|
|
5039
|
+
label,
|
|
5040
|
+
supportingText,
|
|
5041
|
+
errorText,
|
|
5042
|
+
containerClassName,
|
|
5043
|
+
triggerClassName,
|
|
5044
|
+
children,
|
|
5045
|
+
...props
|
|
5046
|
+
}, ref) => {
|
|
5047
|
+
const reactId = React19.useId();
|
|
5048
|
+
const triggerId = props.name ?? reactId;
|
|
5049
|
+
const internalRef = React19.useRef(null);
|
|
5050
|
+
const combinedRef = useCombinedRef(ref, internalRef);
|
|
5051
|
+
return /* @__PURE__ */ jsxs46("div", { className: cn("flex flex-col gap-chekin-1 w-[300px]", containerClassName), children: [
|
|
5052
|
+
label && /* @__PURE__ */ jsx74(
|
|
5053
|
+
"label",
|
|
5054
|
+
{
|
|
5055
|
+
htmlFor: triggerId,
|
|
5056
|
+
className: "text-chekin-navy font-sans font-medium text-[14px] leading-5",
|
|
5057
|
+
children: label
|
|
5058
|
+
}
|
|
5059
|
+
),
|
|
5060
|
+
/* @__PURE__ */ jsxs46(SelectRoot, { ...props, children: [
|
|
5061
|
+
/* @__PURE__ */ jsx74(SelectTrigger, { ref: combinedRef, id: triggerId, className: triggerClassName, children: /* @__PURE__ */ jsx74(RadixSelect.Value, { placeholder }) }),
|
|
5062
|
+
/* @__PURE__ */ jsx74(SelectContent, { children })
|
|
5063
|
+
] }),
|
|
5064
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex justify-between min-h-[15px]", children: [
|
|
5065
|
+
supportingText && !errorText && /* @__PURE__ */ jsx74("span", { className: "text-chekin-gray-2 font-sans italic text-[12px] leading-[15px]", children: supportingText }),
|
|
5066
|
+
errorText && /* @__PURE__ */ jsx74("span", { className: "ml-auto text-chekin-red font-sans font-medium text-[12px] leading-4 text-right", children: errorText })
|
|
5067
|
+
] })
|
|
5068
|
+
] });
|
|
5069
|
+
}
|
|
5070
|
+
);
|
|
5071
|
+
Select.displayName = "Select";
|
|
5067
5072
|
|
|
5068
5073
|
// src/pagination/Pagination.tsx
|
|
5069
5074
|
import { jsx as jsx75, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
@@ -7249,10 +7254,10 @@ var TASK_VARIANTS = {
|
|
|
7249
7254
|
import { Toaster, toast as toast2 } from "sonner";
|
|
7250
7255
|
|
|
7251
7256
|
// src/toaster/useUpdateToast.ts
|
|
7252
|
-
import { useCallback as useCallback9, useRef as
|
|
7257
|
+
import { useCallback as useCallback9, useRef as useRef9 } from "react";
|
|
7253
7258
|
import { toast } from "sonner";
|
|
7254
7259
|
function useUpdateToast({ id }) {
|
|
7255
|
-
const toastIdRef =
|
|
7260
|
+
const toastIdRef = useRef9("");
|
|
7256
7261
|
const getToastOptions = useCallback9(
|
|
7257
7262
|
(options) => ({
|
|
7258
7263
|
id: toastIdRef.current,
|
|
@@ -8843,154 +8848,158 @@ FieldTrigger.displayName = "FieldTrigger";
|
|
|
8843
8848
|
// src/datepicker/DatePicker.tsx
|
|
8844
8849
|
import { jsx as jsx121, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
8845
8850
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
onChange,
|
|
8853
|
-
placeholder = "Select a date",
|
|
8854
|
-
disabled,
|
|
8855
|
-
error,
|
|
8856
|
-
className,
|
|
8857
|
-
name,
|
|
8858
|
-
minDate,
|
|
8859
|
-
maxDate,
|
|
8860
|
-
locale = "en-US",
|
|
8861
|
-
mobileTitle,
|
|
8862
|
-
doneLabel = "Done",
|
|
8863
|
-
formatValue = formatDateValue
|
|
8864
|
-
}) {
|
|
8865
|
-
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
8866
|
-
const [isOpen, setIsOpen] = React30.useState(false);
|
|
8867
|
-
const triggerId = React30.useId();
|
|
8868
|
-
const pickerId = React30.useId();
|
|
8869
|
-
const labelId = React30.useId();
|
|
8870
|
-
const valueId = React30.useId();
|
|
8871
|
-
const helperTextId = React30.useId();
|
|
8872
|
-
const errorId = React30.useId();
|
|
8873
|
-
const triggerRef = React30.useRef(null);
|
|
8874
|
-
const monthLabels = React30.useMemo(() => getMonthLabels(locale), [locale]);
|
|
8875
|
-
const resolvedMinDate = React30.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
8876
|
-
const resolvedMaxDate = React30.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
8877
|
-
const resolvedValue = React30.useMemo(
|
|
8878
|
-
() => value ? clampDate(value, resolvedMinDate, resolvedMaxDate) : null,
|
|
8879
|
-
[resolvedMaxDate, resolvedMinDate, value]
|
|
8880
|
-
);
|
|
8881
|
-
const hasValue = Boolean(resolvedValue);
|
|
8882
|
-
const {
|
|
8883
|
-
dayIndex,
|
|
8884
|
-
dayListRef,
|
|
8885
|
-
dayScrollTop,
|
|
8886
|
-
days,
|
|
8887
|
-
draftDate,
|
|
8888
|
-
handleColumnKeyDown,
|
|
8889
|
-
handleColumnScroll,
|
|
8890
|
-
handleOptionSelect,
|
|
8891
|
-
monthIndex,
|
|
8892
|
-
monthListRef,
|
|
8893
|
-
months,
|
|
8894
|
-
monthScrollTop,
|
|
8895
|
-
yearIndex,
|
|
8896
|
-
yearListRef,
|
|
8897
|
-
yearScrollTop,
|
|
8898
|
-
years
|
|
8899
|
-
} = useDatePickerWheel({
|
|
8900
|
-
isOpen,
|
|
8901
|
-
value: resolvedValue,
|
|
8851
|
+
var DatePicker = React30.forwardRef(
|
|
8852
|
+
({
|
|
8853
|
+
variant = "default",
|
|
8854
|
+
label,
|
|
8855
|
+
topLabel,
|
|
8856
|
+
value,
|
|
8902
8857
|
defaultValue,
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
},
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
(
|
|
8858
|
+
onChange,
|
|
8859
|
+
placeholder = "Select a date",
|
|
8860
|
+
disabled,
|
|
8861
|
+
error,
|
|
8862
|
+
className,
|
|
8863
|
+
name,
|
|
8864
|
+
minDate,
|
|
8865
|
+
maxDate,
|
|
8866
|
+
locale = "en-US",
|
|
8867
|
+
mobileTitle,
|
|
8868
|
+
doneLabel = "Done",
|
|
8869
|
+
formatValue = formatDateValue
|
|
8870
|
+
}, ref) => {
|
|
8871
|
+
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
8872
|
+
const [isOpen, setIsOpen] = React30.useState(false);
|
|
8873
|
+
const triggerId = React30.useId();
|
|
8874
|
+
const pickerId = React30.useId();
|
|
8875
|
+
const labelId = React30.useId();
|
|
8876
|
+
const valueId = React30.useId();
|
|
8877
|
+
const helperTextId = React30.useId();
|
|
8878
|
+
const errorId = React30.useId();
|
|
8879
|
+
const internalRef = React30.useRef(null);
|
|
8880
|
+
const combinedRef = useCombinedRef(ref, internalRef);
|
|
8881
|
+
const monthLabels = React30.useMemo(() => getMonthLabels(locale), [locale]);
|
|
8882
|
+
const resolvedMinDate = React30.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
8883
|
+
const resolvedMaxDate = React30.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
8884
|
+
const resolvedValue = React30.useMemo(
|
|
8885
|
+
() => value ? clampDate(value, resolvedMinDate, resolvedMaxDate) : null,
|
|
8886
|
+
[resolvedMaxDate, resolvedMinDate, value]
|
|
8887
|
+
);
|
|
8888
|
+
const hasValue = Boolean(resolvedValue);
|
|
8889
|
+
const {
|
|
8890
|
+
dayIndex,
|
|
8891
|
+
dayListRef,
|
|
8892
|
+
dayScrollTop,
|
|
8893
|
+
days,
|
|
8894
|
+
draftDate,
|
|
8895
|
+
handleColumnKeyDown,
|
|
8896
|
+
handleColumnScroll,
|
|
8897
|
+
handleOptionSelect,
|
|
8898
|
+
monthIndex,
|
|
8899
|
+
monthListRef,
|
|
8900
|
+
months,
|
|
8901
|
+
monthScrollTop,
|
|
8902
|
+
yearIndex,
|
|
8903
|
+
yearListRef,
|
|
8904
|
+
yearScrollTop,
|
|
8905
|
+
years
|
|
8906
|
+
} = useDatePickerWheel({
|
|
8907
|
+
isOpen,
|
|
8908
|
+
value: resolvedValue,
|
|
8909
|
+
defaultValue,
|
|
8910
|
+
minDate: resolvedMinDate,
|
|
8911
|
+
maxDate: resolvedMaxDate
|
|
8912
|
+
});
|
|
8913
|
+
const handleOpenChange = React30.useCallback((nextOpen) => {
|
|
8914
|
+
setIsOpen(nextOpen);
|
|
8915
|
+
if (!nextOpen) {
|
|
8916
|
+
internalRef.current?.focus();
|
|
8917
|
+
}
|
|
8918
|
+
}, []);
|
|
8919
|
+
const handleDone = React30.useCallback(() => {
|
|
8920
|
+
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
8921
|
+
handleOpenChange(false);
|
|
8922
|
+
}, [draftDate, handleOpenChange, onChange, resolvedMaxDate, resolvedMinDate]);
|
|
8923
|
+
const handleTriggerClick = React30.useCallback(() => {
|
|
8922
8924
|
if (disabled) return;
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8925
|
+
setIsOpen(true);
|
|
8926
|
+
}, [disabled]);
|
|
8927
|
+
const handleTriggerKeyDown = React30.useCallback(
|
|
8928
|
+
(event) => {
|
|
8929
|
+
if (disabled) return;
|
|
8930
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
8931
|
+
event.preventDefault();
|
|
8932
|
+
setIsOpen(true);
|
|
8933
|
+
}
|
|
8934
|
+
},
|
|
8935
|
+
[disabled]
|
|
8936
|
+
);
|
|
8937
|
+
return /* @__PURE__ */ jsxs78("div", { className: cn("relative w-full max-w-[425px]", className), children: [
|
|
8938
|
+
name && /* @__PURE__ */ jsx121(
|
|
8939
|
+
"input",
|
|
8940
|
+
{
|
|
8941
|
+
type: "hidden",
|
|
8942
|
+
name,
|
|
8943
|
+
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
8944
|
+
}
|
|
8945
|
+
),
|
|
8946
|
+
/* @__PURE__ */ jsx121(
|
|
8947
|
+
FieldTrigger,
|
|
8948
|
+
{
|
|
8949
|
+
id: triggerId,
|
|
8950
|
+
ref: combinedRef,
|
|
8951
|
+
variant,
|
|
8952
|
+
label,
|
|
8953
|
+
topLabel,
|
|
8954
|
+
labelId,
|
|
8955
|
+
valueId: hasValue ? valueId : void 0,
|
|
8956
|
+
helperTextId: !hasValue ? helperTextId : void 0,
|
|
8957
|
+
errorId: error ? errorId : void 0,
|
|
8958
|
+
describedBy: error ? errorId : void 0,
|
|
8959
|
+
labelText: topLabel ? placeholder : void 0,
|
|
8960
|
+
valueText: resolvedValue ? formatValue(resolvedValue) : void 0,
|
|
8961
|
+
placeholder,
|
|
8962
|
+
disabled,
|
|
8963
|
+
error,
|
|
8964
|
+
"aria-haspopup": "dialog",
|
|
8965
|
+
"aria-expanded": isOpen,
|
|
8966
|
+
onClick: handleTriggerClick,
|
|
8967
|
+
onKeyDown: handleTriggerKeyDown,
|
|
8968
|
+
trailingAdornment: /* @__PURE__ */ jsx121(Calendar2, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
8969
|
+
}
|
|
8970
|
+
),
|
|
8971
|
+
/* @__PURE__ */ jsx121(
|
|
8972
|
+
DatePickerContent,
|
|
8973
|
+
{
|
|
8974
|
+
baseId: pickerId,
|
|
8975
|
+
open: isOpen,
|
|
8976
|
+
isMobile,
|
|
8977
|
+
label,
|
|
8978
|
+
title: mobileTitle ?? label,
|
|
8979
|
+
doneLabel,
|
|
8980
|
+
monthLabels: months.map((month) => monthLabels[month] ?? ""),
|
|
8981
|
+
days,
|
|
8982
|
+
years,
|
|
8983
|
+
monthIndex,
|
|
8984
|
+
dayIndex,
|
|
8985
|
+
yearIndex,
|
|
8986
|
+
monthScrollTop,
|
|
8987
|
+
dayScrollTop,
|
|
8988
|
+
yearScrollTop,
|
|
8989
|
+
monthListRef,
|
|
8990
|
+
dayListRef,
|
|
8991
|
+
yearListRef,
|
|
8992
|
+
onOpenChange: handleOpenChange,
|
|
8993
|
+
onDone: handleDone,
|
|
8994
|
+
onColumnScroll: handleColumnScroll,
|
|
8995
|
+
onColumnKeyDown: handleColumnKeyDown,
|
|
8996
|
+
onOptionSelect: handleOptionSelect
|
|
8997
|
+
}
|
|
8998
|
+
)
|
|
8999
|
+
] });
|
|
9000
|
+
}
|
|
9001
|
+
);
|
|
9002
|
+
DatePicker.displayName = "DatePicker";
|
|
8994
9003
|
|
|
8995
9004
|
// src/responsive-sheet/ResponsiveSheet.tsx
|
|
8996
9005
|
import { jsx as jsx122, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
@@ -9998,9 +10007,9 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
9998
10007
|
}
|
|
9999
10008
|
|
|
10000
10009
|
// src/lib/use-outside-click.ts
|
|
10001
|
-
import { useCallback as useCallback18, useEffect as useEffect16, useRef as
|
|
10010
|
+
import { useCallback as useCallback18, useEffect as useEffect16, useRef as useRef16 } from "react";
|
|
10002
10011
|
function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
10003
|
-
const handleOutsideClick =
|
|
10012
|
+
const handleOutsideClick = useRef16(onOutsideClick);
|
|
10004
10013
|
handleOutsideClick.current = onOutsideClick;
|
|
10005
10014
|
const checkNestedElements = useCallback18(
|
|
10006
10015
|
(event) => {
|
|
@@ -10051,7 +10060,7 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
|
10051
10060
|
|
|
10052
10061
|
// src/airbnb/select/Select.tsx
|
|
10053
10062
|
import { jsx as jsx129, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
10054
|
-
|
|
10063
|
+
var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
10055
10064
|
options,
|
|
10056
10065
|
value,
|
|
10057
10066
|
onChange,
|
|
@@ -10071,7 +10080,7 @@ function AirbnbSelect({
|
|
|
10071
10080
|
mobileTitle,
|
|
10072
10081
|
name,
|
|
10073
10082
|
noOptionsMessage
|
|
10074
|
-
}) {
|
|
10083
|
+
}, ref) {
|
|
10075
10084
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
10076
10085
|
const [isOpen, setIsOpen] = React36.useState(false);
|
|
10077
10086
|
const containerRef = React36.useRef(null);
|
|
@@ -10109,7 +10118,7 @@ function AirbnbSelect({
|
|
|
10109
10118
|
listRef: desktopListRef,
|
|
10110
10119
|
setHighlightedIndex,
|
|
10111
10120
|
setOptionRef,
|
|
10112
|
-
triggerRef,
|
|
10121
|
+
triggerRef: desktopTriggerRef,
|
|
10113
10122
|
focusTrigger,
|
|
10114
10123
|
handleSelect: handleDesktopSelect,
|
|
10115
10124
|
handleMenuKeyDown,
|
|
@@ -10122,6 +10131,7 @@ function AirbnbSelect({
|
|
|
10122
10131
|
disabled,
|
|
10123
10132
|
onChange
|
|
10124
10133
|
});
|
|
10134
|
+
const combinedRef = useCombinedRef(ref, desktopTriggerRef);
|
|
10125
10135
|
const activeMobileIndex = getOptionIndex(options, pendingValue);
|
|
10126
10136
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
10127
10137
|
useOutsideClick(containerRef, isOpen && !isMobile ? () => setIsOpen(false) : null);
|
|
@@ -10208,7 +10218,7 @@ function AirbnbSelect({
|
|
|
10208
10218
|
handleMobileOpenChange(false);
|
|
10209
10219
|
}
|
|
10210
10220
|
};
|
|
10211
|
-
return /* @__PURE__ */ jsxs83("div", { ref: containerRef, className: cn("relative w-full max-w-[
|
|
10221
|
+
return /* @__PURE__ */ jsxs83("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
10212
10222
|
name && /* @__PURE__ */ jsx129("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
10213
10223
|
renderTrigger ? renderTrigger({
|
|
10214
10224
|
id: triggerId,
|
|
@@ -10223,14 +10233,14 @@ function AirbnbSelect({
|
|
|
10223
10233
|
error,
|
|
10224
10234
|
listboxId,
|
|
10225
10235
|
describedBy,
|
|
10226
|
-
triggerRef,
|
|
10236
|
+
triggerRef: combinedRef,
|
|
10227
10237
|
onClick: handleTriggerClick,
|
|
10228
10238
|
onKeyDown: handleRootTriggerKeyDown
|
|
10229
10239
|
}) : /* @__PURE__ */ jsx129(
|
|
10230
10240
|
SelectTrigger2,
|
|
10231
10241
|
{
|
|
10232
10242
|
id: triggerId,
|
|
10233
|
-
ref:
|
|
10243
|
+
ref: combinedRef,
|
|
10234
10244
|
open: isOpen,
|
|
10235
10245
|
variant,
|
|
10236
10246
|
label,
|
|
@@ -10304,160 +10314,164 @@ function AirbnbSelect({
|
|
|
10304
10314
|
}
|
|
10305
10315
|
)
|
|
10306
10316
|
] });
|
|
10307
|
-
}
|
|
10317
|
+
});
|
|
10308
10318
|
|
|
10309
10319
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
10310
10320
|
import { jsx as jsx130, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
type: "hidden",
|
|
10348
|
-
name: codeName,
|
|
10349
|
-
value: value?.code ?? "",
|
|
10350
|
-
disabled
|
|
10351
|
-
}
|
|
10352
|
-
),
|
|
10353
|
-
numberName && /* @__PURE__ */ jsx130(
|
|
10354
|
-
"input",
|
|
10355
|
-
{
|
|
10356
|
-
type: "hidden",
|
|
10357
|
-
name: numberName,
|
|
10358
|
-
value: value?.number ?? "",
|
|
10359
|
-
disabled
|
|
10360
|
-
}
|
|
10361
|
-
),
|
|
10362
|
-
topLabel && /* @__PURE__ */ jsx130(
|
|
10363
|
-
"label",
|
|
10364
|
-
{
|
|
10365
|
-
htmlFor: inputId,
|
|
10366
|
-
className: "mb-3 block text-[16px] font-medium leading-5 text-[#1F1F1B]",
|
|
10367
|
-
children: topLabel
|
|
10368
|
-
}
|
|
10369
|
-
),
|
|
10370
|
-
/* @__PURE__ */ jsxs84("div", { className: "flex items-stretch", children: [
|
|
10371
|
-
/* @__PURE__ */ jsx130(
|
|
10372
|
-
AirbnbSelect,
|
|
10321
|
+
var PhoneField = React37.forwardRef(
|
|
10322
|
+
({
|
|
10323
|
+
variant = "default",
|
|
10324
|
+
label,
|
|
10325
|
+
topLabel,
|
|
10326
|
+
value,
|
|
10327
|
+
onChange,
|
|
10328
|
+
options,
|
|
10329
|
+
placeholder = "Phone number",
|
|
10330
|
+
disabled,
|
|
10331
|
+
error,
|
|
10332
|
+
className,
|
|
10333
|
+
name,
|
|
10334
|
+
codeName,
|
|
10335
|
+
numberName,
|
|
10336
|
+
mobileTitle,
|
|
10337
|
+
codePlaceholder = "+00"
|
|
10338
|
+
}, ref) => {
|
|
10339
|
+
const inputId = React37.useId();
|
|
10340
|
+
const codeOptions = React37.useMemo(
|
|
10341
|
+
() => options.map((option) => ({
|
|
10342
|
+
value: option.value,
|
|
10343
|
+
label: option.label,
|
|
10344
|
+
disabled: option.disabled
|
|
10345
|
+
})),
|
|
10346
|
+
[options]
|
|
10347
|
+
);
|
|
10348
|
+
const selectedCodeOption = React37.useMemo(
|
|
10349
|
+
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
10350
|
+
[codeOptions, value?.code]
|
|
10351
|
+
);
|
|
10352
|
+
const combinedValue = value?.code || value?.number ? `${value?.code ?? ""}${value?.number ?? ""}` : "";
|
|
10353
|
+
return /* @__PURE__ */ jsxs84("div", { className: cn("w-full max-w-[425px]", className), children: [
|
|
10354
|
+
name && /* @__PURE__ */ jsx130("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
10355
|
+
codeName && /* @__PURE__ */ jsx130(
|
|
10356
|
+
"input",
|
|
10373
10357
|
{
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
value:
|
|
10377
|
-
|
|
10378
|
-
code: String(option.value),
|
|
10379
|
-
number: value?.number ?? ""
|
|
10380
|
-
}),
|
|
10381
|
-
label: `${label} country code`,
|
|
10382
|
-
placeholder: codePlaceholder,
|
|
10383
|
-
disabled,
|
|
10384
|
-
className: "max-w-none shrink-0 basis-[96px]",
|
|
10385
|
-
mobileTitle: mobileTitle ?? "Select country code",
|
|
10386
|
-
dropdownClassName: "right-auto w-[280px]",
|
|
10387
|
-
getValueLabel: (option) => String(option.value),
|
|
10388
|
-
renderTrigger: ({
|
|
10389
|
-
id,
|
|
10390
|
-
open,
|
|
10391
|
-
variant: selectVariant,
|
|
10392
|
-
disabled: triggerDisabled,
|
|
10393
|
-
listboxId,
|
|
10394
|
-
triggerRef,
|
|
10395
|
-
onClick,
|
|
10396
|
-
onKeyDown,
|
|
10397
|
-
valueLabel
|
|
10398
|
-
}) => /* @__PURE__ */ jsxs84(
|
|
10399
|
-
"button",
|
|
10400
|
-
{
|
|
10401
|
-
id,
|
|
10402
|
-
ref: triggerRef,
|
|
10403
|
-
type: "button",
|
|
10404
|
-
"aria-label": `${label} country code`,
|
|
10405
|
-
"aria-haspopup": "listbox",
|
|
10406
|
-
"aria-expanded": open,
|
|
10407
|
-
"aria-controls": listboxId,
|
|
10408
|
-
disabled: triggerDisabled,
|
|
10409
|
-
onClick,
|
|
10410
|
-
onKeyDown,
|
|
10411
|
-
className: cn(
|
|
10412
|
-
"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",
|
|
10413
|
-
selectVariant === "airbnb" ? "h-full min-h-[60px] rounded-l-[16px] rounded-r-none px-4 focus-visible:ring-2 focus-visible:ring-[#1F1F1B] focus-visible:ring-offset-2" : "min-h-[48px] rounded-l-[10px] rounded-r-none px-3.5 focus-visible:border-[#315EFB]",
|
|
10414
|
-
error ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : selectVariant === "airbnb" ? "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]" : "border-[#A8A8A4] bg-white text-[#1F1F1B]",
|
|
10415
|
-
triggerDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
10416
|
-
),
|
|
10417
|
-
children: [
|
|
10418
|
-
/* @__PURE__ */ jsx130("span", { children: valueLabel ?? codePlaceholder }),
|
|
10419
|
-
/* @__PURE__ */ jsx130(
|
|
10420
|
-
ChevronDown2,
|
|
10421
|
-
{
|
|
10422
|
-
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
10423
|
-
strokeWidth: 2
|
|
10424
|
-
}
|
|
10425
|
-
)
|
|
10426
|
-
]
|
|
10427
|
-
}
|
|
10428
|
-
)
|
|
10358
|
+
type: "hidden",
|
|
10359
|
+
name: codeName,
|
|
10360
|
+
value: value?.code ?? "",
|
|
10361
|
+
disabled
|
|
10429
10362
|
}
|
|
10430
10363
|
),
|
|
10431
|
-
/* @__PURE__ */ jsx130(
|
|
10432
|
-
|
|
10364
|
+
numberName && /* @__PURE__ */ jsx130(
|
|
10365
|
+
"input",
|
|
10433
10366
|
{
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
type: "tel",
|
|
10437
|
-
inputMode: "tel",
|
|
10438
|
-
label,
|
|
10439
|
-
helperText: placeholder,
|
|
10367
|
+
type: "hidden",
|
|
10368
|
+
name: numberName,
|
|
10440
10369
|
value: value?.number ?? "",
|
|
10441
|
-
|
|
10442
|
-
disabled,
|
|
10443
|
-
error,
|
|
10444
|
-
renderErrorMessage: false,
|
|
10445
|
-
wrapperClassName: "min-w-0 flex-1",
|
|
10446
|
-
fieldClassName: cn(
|
|
10447
|
-
variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
|
|
10448
|
-
),
|
|
10449
|
-
contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
|
|
10450
|
-
inputClassName: "text-[16px] leading-7",
|
|
10451
|
-
onChange: (event) => onChange({
|
|
10452
|
-
code: value?.code ?? "",
|
|
10453
|
-
number: event.target.value
|
|
10454
|
-
})
|
|
10370
|
+
disabled
|
|
10455
10371
|
}
|
|
10456
|
-
)
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10372
|
+
),
|
|
10373
|
+
topLabel && /* @__PURE__ */ jsx130(
|
|
10374
|
+
"label",
|
|
10375
|
+
{
|
|
10376
|
+
htmlFor: inputId,
|
|
10377
|
+
className: "mb-3 block text-[16px] font-medium leading-5 text-[#1F1F1B]",
|
|
10378
|
+
children: topLabel
|
|
10379
|
+
}
|
|
10380
|
+
),
|
|
10381
|
+
/* @__PURE__ */ jsxs84("div", { className: "flex items-stretch", children: [
|
|
10382
|
+
/* @__PURE__ */ jsx130(
|
|
10383
|
+
AirbnbSelect,
|
|
10384
|
+
{
|
|
10385
|
+
ref,
|
|
10386
|
+
variant,
|
|
10387
|
+
options: codeOptions,
|
|
10388
|
+
value: selectedCodeOption,
|
|
10389
|
+
onChange: (option) => onChange({
|
|
10390
|
+
code: String(option.value),
|
|
10391
|
+
number: value?.number ?? ""
|
|
10392
|
+
}),
|
|
10393
|
+
label: `${label} country code`,
|
|
10394
|
+
placeholder: codePlaceholder,
|
|
10395
|
+
disabled,
|
|
10396
|
+
className: "max-w-none shrink-0 basis-[96px]",
|
|
10397
|
+
mobileTitle: mobileTitle ?? "Select country code",
|
|
10398
|
+
dropdownClassName: "right-auto w-[280px]",
|
|
10399
|
+
getValueLabel: (option) => String(option.value),
|
|
10400
|
+
renderTrigger: ({
|
|
10401
|
+
id,
|
|
10402
|
+
open,
|
|
10403
|
+
variant: selectVariant,
|
|
10404
|
+
disabled: triggerDisabled,
|
|
10405
|
+
listboxId,
|
|
10406
|
+
triggerRef,
|
|
10407
|
+
onClick,
|
|
10408
|
+
onKeyDown,
|
|
10409
|
+
valueLabel
|
|
10410
|
+
}) => /* @__PURE__ */ jsxs84(
|
|
10411
|
+
"button",
|
|
10412
|
+
{
|
|
10413
|
+
id,
|
|
10414
|
+
ref: triggerRef,
|
|
10415
|
+
type: "button",
|
|
10416
|
+
"aria-label": `${label} country code`,
|
|
10417
|
+
"aria-haspopup": "listbox",
|
|
10418
|
+
"aria-expanded": open,
|
|
10419
|
+
"aria-controls": listboxId,
|
|
10420
|
+
disabled: triggerDisabled,
|
|
10421
|
+
onClick,
|
|
10422
|
+
onKeyDown,
|
|
10423
|
+
className: cn(
|
|
10424
|
+
"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",
|
|
10425
|
+
selectVariant === "airbnb" ? "h-full min-h-[60px] rounded-l-[16px] rounded-r-none px-4 focus-visible:ring-2 focus-visible:ring-[#1F1F1B] focus-visible:ring-offset-2" : "min-h-[48px] rounded-l-[10px] rounded-r-none px-3.5 focus-visible:border-[#315EFB]",
|
|
10426
|
+
error ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : selectVariant === "airbnb" ? "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]" : "border-[#A8A8A4] bg-white text-[#1F1F1B]",
|
|
10427
|
+
triggerDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
10428
|
+
),
|
|
10429
|
+
children: [
|
|
10430
|
+
/* @__PURE__ */ jsx130("span", { children: valueLabel ?? codePlaceholder }),
|
|
10431
|
+
/* @__PURE__ */ jsx130(
|
|
10432
|
+
ChevronDown2,
|
|
10433
|
+
{
|
|
10434
|
+
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
10435
|
+
strokeWidth: 2
|
|
10436
|
+
}
|
|
10437
|
+
)
|
|
10438
|
+
]
|
|
10439
|
+
}
|
|
10440
|
+
)
|
|
10441
|
+
}
|
|
10442
|
+
),
|
|
10443
|
+
/* @__PURE__ */ jsx130(
|
|
10444
|
+
AirbnbInput,
|
|
10445
|
+
{
|
|
10446
|
+
id: inputId,
|
|
10447
|
+
variant,
|
|
10448
|
+
type: "tel",
|
|
10449
|
+
inputMode: "tel",
|
|
10450
|
+
label,
|
|
10451
|
+
helperText: placeholder,
|
|
10452
|
+
value: value?.number ?? "",
|
|
10453
|
+
placeholder,
|
|
10454
|
+
disabled,
|
|
10455
|
+
error,
|
|
10456
|
+
renderErrorMessage: false,
|
|
10457
|
+
wrapperClassName: "min-w-0 flex-1",
|
|
10458
|
+
fieldClassName: cn(
|
|
10459
|
+
variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
|
|
10460
|
+
),
|
|
10461
|
+
contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
|
|
10462
|
+
inputClassName: "text-[16px] leading-7",
|
|
10463
|
+
onChange: (event) => onChange({
|
|
10464
|
+
code: value?.code ?? "",
|
|
10465
|
+
number: event.target.value
|
|
10466
|
+
})
|
|
10467
|
+
}
|
|
10468
|
+
)
|
|
10469
|
+
] }),
|
|
10470
|
+
error && /* @__PURE__ */ jsx130(FieldErrorMessage, { message: error })
|
|
10471
|
+
] });
|
|
10472
|
+
}
|
|
10473
|
+
);
|
|
10474
|
+
PhoneField.displayName = "PhoneField";
|
|
10461
10475
|
|
|
10462
10476
|
// src/airbnb/search-input/SearchInput.tsx
|
|
10463
10477
|
import * as React38 from "react";
|
|
@@ -10684,7 +10698,7 @@ var SearchableSelectInternal = ({
|
|
|
10684
10698
|
}
|
|
10685
10699
|
);
|
|
10686
10700
|
React39.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
10687
|
-
return /* @__PURE__ */ jsxs86("div", { ref: containerRef, className: cn("relative w-full max-w-[
|
|
10701
|
+
return /* @__PURE__ */ jsxs86("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
10688
10702
|
name && /* @__PURE__ */ jsx132("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
10689
10703
|
/* @__PURE__ */ jsx132(
|
|
10690
10704
|
FieldTrigger,
|