@ecohouse/ui 0.1.52 → 0.1.54
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 +196 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +196 -103
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DatePicker/DatePicker.tsx +104 -15
- package/src/components/Select/Select.tsx +163 -105
package/dist/index.cjs
CHANGED
|
@@ -27561,7 +27561,7 @@ var require_react_dom_development = __commonJS({
|
|
|
27561
27561
|
return root2;
|
|
27562
27562
|
}
|
|
27563
27563
|
var ReactVersion = "18.3.1";
|
|
27564
|
-
function
|
|
27564
|
+
function createPortal4(children, containerInfo, implementation) {
|
|
27565
27565
|
var key = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
|
|
27566
27566
|
{
|
|
27567
27567
|
checkKeyStringCoercion(key);
|
|
@@ -28417,7 +28417,7 @@ var require_react_dom_development = __commonJS({
|
|
|
28417
28417
|
if (!isValidContainer(container)) {
|
|
28418
28418
|
throw new Error("Target container is not a DOM element.");
|
|
28419
28419
|
}
|
|
28420
|
-
return
|
|
28420
|
+
return createPortal4(children, container, null, key);
|
|
28421
28421
|
}
|
|
28422
28422
|
function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
|
|
28423
28423
|
return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback);
|
|
@@ -34246,6 +34246,16 @@ var DEFAULT_MONTH_NAMES = [
|
|
|
34246
34246
|
"\u0534\u0565\u056F\u057F\u0565\u0574\u0562\u0565\u0580"
|
|
34247
34247
|
];
|
|
34248
34248
|
var DEFAULT_WEEKDAY_LABELS = ["\u0535\u0550", "\u0535\u0554", "\u0549\u0550", "\u0540\u0546", "\u0548\u0552\u0550", "\u0547\u0532", "\u053F\u0550"];
|
|
34249
|
+
function rangeIncludesUnavailable(start, end, isUnavailable) {
|
|
34250
|
+
const cursor = startOfDay(start);
|
|
34251
|
+
const last = startOfDay(end);
|
|
34252
|
+
const step = isBefore(last, cursor) ? -1 : 1;
|
|
34253
|
+
while (true) {
|
|
34254
|
+
if (isUnavailable(cursor)) return true;
|
|
34255
|
+
if (isSameDay(cursor, last)) return false;
|
|
34256
|
+
cursor.setDate(cursor.getDate() + step);
|
|
34257
|
+
}
|
|
34258
|
+
}
|
|
34249
34259
|
var EMPTY_RANGE = { start: null, end: null };
|
|
34250
34260
|
var DEFAULT_WIDTH = 320;
|
|
34251
34261
|
var DEFAULT_MENU_HEIGHT = 388;
|
|
@@ -34299,6 +34309,9 @@ var DatePicker = react.forwardRef(
|
|
|
34299
34309
|
closeOnSelect = true,
|
|
34300
34310
|
minDate,
|
|
34301
34311
|
maxDate,
|
|
34312
|
+
unavailableDates,
|
|
34313
|
+
unavailableDateLabel = "Booked",
|
|
34314
|
+
blockUnavailableDates = false,
|
|
34302
34315
|
defaultVisibleMonth,
|
|
34303
34316
|
monthNames = DEFAULT_MONTH_NAMES,
|
|
34304
34317
|
weekdayLabels = DEFAULT_WEEKDAY_LABELS,
|
|
@@ -34317,6 +34330,17 @@ var DatePicker = react.forwardRef(
|
|
|
34317
34330
|
onValueChange: _onValueChange,
|
|
34318
34331
|
...rest
|
|
34319
34332
|
} = props;
|
|
34333
|
+
const unavailableDayKeys = react.useMemo(() => {
|
|
34334
|
+
const keys = /* @__PURE__ */ new Set();
|
|
34335
|
+
for (const date of unavailableDates ?? []) {
|
|
34336
|
+
keys.add(startOfDay(date).getTime());
|
|
34337
|
+
}
|
|
34338
|
+
return keys;
|
|
34339
|
+
}, [unavailableDates]);
|
|
34340
|
+
const isUnavailable = react.useCallback(
|
|
34341
|
+
(day) => unavailableDayKeys.has(startOfDay(day).getTime()),
|
|
34342
|
+
[unavailableDayKeys]
|
|
34343
|
+
);
|
|
34320
34344
|
const isRange = props.range === true;
|
|
34321
34345
|
const usesRangeTrigger = isRange && variant !== "default";
|
|
34322
34346
|
const formatValue = formatValueProp ?? (usesRangeTrigger ? (date) => formatDateDayShortMonth(date, monthNames) : formatDate);
|
|
@@ -34419,6 +34443,7 @@ var DatePicker = react.forwardRef(
|
|
|
34419
34443
|
const handleDayPress = react.useCallback(
|
|
34420
34444
|
(day) => {
|
|
34421
34445
|
if (disabled || isDateDisabled(day, minDate, maxDate)) return;
|
|
34446
|
+
if (blockUnavailableDates && isUnavailable(day)) return;
|
|
34422
34447
|
const picked = startOfDay(day);
|
|
34423
34448
|
if (!isRange) {
|
|
34424
34449
|
if (!isValueControlled) setUncontrolledSingle(picked);
|
|
@@ -34429,14 +34454,19 @@ var DatePicker = react.forwardRef(
|
|
|
34429
34454
|
const { start, end } = rangeValue;
|
|
34430
34455
|
const startingNewRange = !start || start && end;
|
|
34431
34456
|
const nextRange = startingNewRange ? { start: picked, end: null } : isBefore(picked, start) ? { start: picked, end: null } : { start, end: picked };
|
|
34457
|
+
if (blockUnavailableDates && nextRange.start && nextRange.end && rangeIncludesUnavailable(nextRange.start, nextRange.end, isUnavailable)) {
|
|
34458
|
+
return;
|
|
34459
|
+
}
|
|
34432
34460
|
if (!isValueControlled) setUncontrolledRange(nextRange);
|
|
34433
34461
|
props.onValueChange?.(nextRange);
|
|
34434
34462
|
if (closeOnSelect && nextRange.start && nextRange.end) setOpen(false);
|
|
34435
34463
|
},
|
|
34436
34464
|
[
|
|
34465
|
+
blockUnavailableDates,
|
|
34437
34466
|
closeOnSelect,
|
|
34438
34467
|
disabled,
|
|
34439
34468
|
isRange,
|
|
34469
|
+
isUnavailable,
|
|
34440
34470
|
isValueControlled,
|
|
34441
34471
|
maxDate,
|
|
34442
34472
|
minDate,
|
|
@@ -34515,7 +34545,8 @@ var DatePicker = react.forwardRef(
|
|
|
34515
34545
|
styles26.menu,
|
|
34516
34546
|
usesRangeTrigger && styles26.rangeMenu,
|
|
34517
34547
|
hideTrigger ? styles26.menuInline : menuAlignEnd ? styles26.menuAlignEnd : styles26.menuAlignStart,
|
|
34518
|
-
calendarStyle
|
|
34548
|
+
calendarStyle,
|
|
34549
|
+
styles26.menuFitContent
|
|
34519
34550
|
],
|
|
34520
34551
|
children: [
|
|
34521
34552
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles26.calendarHeader, children: [
|
|
@@ -34547,7 +34578,7 @@ var DatePicker = react.forwardRef(
|
|
|
34547
34578
|
}
|
|
34548
34579
|
)
|
|
34549
34580
|
] }),
|
|
34550
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
|
|
34581
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles26.calendarGrid, children: [
|
|
34551
34582
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles26.weekdayRow, children: weekdayLabels.map((weekdayLabel, index) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles26.weekdayCell, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles26.weekdayText, children: weekdayLabel }) }, `${weekdayLabel}-${index}`)) }),
|
|
34552
34583
|
weeks.map((week, weekIndex) => {
|
|
34553
34584
|
let rangeHighlightStyle = null;
|
|
@@ -34602,24 +34633,26 @@ var DatePicker = react.forwardRef(
|
|
|
34602
34633
|
const isRangeStart = isRange && isSameDay(day, rangeValue.start);
|
|
34603
34634
|
const isRangeEnd = isRange && isSameDay(day, rangeValue.end);
|
|
34604
34635
|
const isSelectedEndpoint = isSelectedSingle || isRangeStart || isRangeEnd;
|
|
34636
|
+
const dayUnavailable = isUnavailable(day);
|
|
34637
|
+
const dayBlocked = blockUnavailableDates && dayUnavailable;
|
|
34605
34638
|
const dayDisabled = disabled || isDateDisabled(day, minDate, maxDate);
|
|
34606
34639
|
const dayKey = startOfDay(day).getTime();
|
|
34607
|
-
const isHovered = !dayDisabled && !isSelectedEndpoint && hoveredDayKey === dayKey;
|
|
34640
|
+
const isHovered = !dayDisabled && !dayBlocked && !isSelectedEndpoint && hoveredDayKey === dayKey;
|
|
34608
34641
|
const dayTextColor = isSelectedEndpoint ? colors.white : dayDisabled ? colors.grey400 : isToday ? colors.primary : !inCurrentMonth ? colors.grey300 : colors.white;
|
|
34609
34642
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
34610
34643
|
reactNative.Pressable,
|
|
34611
34644
|
{
|
|
34612
34645
|
onPress: () => handleDayPress(day),
|
|
34613
|
-
disabled: dayDisabled,
|
|
34646
|
+
disabled: dayDisabled || dayBlocked,
|
|
34614
34647
|
onHoverIn: () => setHoveredDayKey(dayKey),
|
|
34615
34648
|
onHoverOut: () => setHoveredDayKey((current) => current === dayKey ? null : current),
|
|
34616
34649
|
onPressIn: () => setHoveredDayKey(dayKey),
|
|
34617
34650
|
onPressOut: () => setHoveredDayKey((current) => current === dayKey ? null : current),
|
|
34618
34651
|
style: styles26.dayCellWrap,
|
|
34619
34652
|
accessibilityRole: "button",
|
|
34620
|
-
accessibilityLabel: formatValue(day),
|
|
34653
|
+
accessibilityLabel: dayUnavailable ? `${formatValue(day)}, ${unavailableDateLabel}` : formatValue(day),
|
|
34621
34654
|
accessibilityState: {
|
|
34622
|
-
disabled: dayDisabled,
|
|
34655
|
+
disabled: dayDisabled || dayBlocked,
|
|
34623
34656
|
selected: isSelectedEndpoint
|
|
34624
34657
|
},
|
|
34625
34658
|
children: [
|
|
@@ -34629,9 +34662,20 @@ var DatePicker = react.forwardRef(
|
|
|
34629
34662
|
style: [
|
|
34630
34663
|
styles26.dayCircle,
|
|
34631
34664
|
isSelectedEndpoint && styles26.dayCircleSelected,
|
|
34665
|
+
dayUnavailable && styles26.dayCircleBooked,
|
|
34632
34666
|
isHovered && styles26.dayCircleHovered
|
|
34633
34667
|
],
|
|
34634
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
34668
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
34669
|
+
reactNative.Text,
|
|
34670
|
+
{
|
|
34671
|
+
style: [
|
|
34672
|
+
styles26.dayText,
|
|
34673
|
+
{ color: dayTextColor },
|
|
34674
|
+
dayUnavailable && styles26.dayTextBooked
|
|
34675
|
+
],
|
|
34676
|
+
children: day.getDate()
|
|
34677
|
+
}
|
|
34678
|
+
)
|
|
34635
34679
|
}
|
|
34636
34680
|
),
|
|
34637
34681
|
isToday && !isSelectedEndpoint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles26.todayDot }) : null
|
|
@@ -34769,7 +34813,7 @@ var styles26 = reactNative.StyleSheet.create({
|
|
|
34769
34813
|
menu: {
|
|
34770
34814
|
position: "absolute",
|
|
34771
34815
|
top: "100%",
|
|
34772
|
-
|
|
34816
|
+
alignSelf: "flex-start",
|
|
34773
34817
|
height: DEFAULT_MENU_HEIGHT,
|
|
34774
34818
|
marginTop: 8,
|
|
34775
34819
|
zIndex: 10,
|
|
@@ -34803,10 +34847,26 @@ var styles26 = reactNative.StyleSheet.create({
|
|
|
34803
34847
|
right: "auto",
|
|
34804
34848
|
marginTop: 0
|
|
34805
34849
|
},
|
|
34806
|
-
rangeMenu: {
|
|
34807
|
-
|
|
34850
|
+
rangeMenu: {},
|
|
34851
|
+
menuFitContent: {
|
|
34852
|
+
width: MENU_CONTENT_WIDTH + MENU_PADDING * 2,
|
|
34853
|
+
maxWidth: MENU_CONTENT_WIDTH + MENU_PADDING * 2,
|
|
34854
|
+
alignSelf: "flex-start",
|
|
34855
|
+
alignItems: "flex-start",
|
|
34856
|
+
...reactNative.Platform.select({
|
|
34857
|
+
web: {
|
|
34858
|
+
width: "fit-content",
|
|
34859
|
+
maxWidth: "fit-content"
|
|
34860
|
+
},
|
|
34861
|
+
default: {}
|
|
34862
|
+
})
|
|
34863
|
+
},
|
|
34864
|
+
calendarGrid: {
|
|
34865
|
+
width: MENU_CONTENT_WIDTH,
|
|
34866
|
+
alignSelf: "flex-start"
|
|
34808
34867
|
},
|
|
34809
34868
|
calendarHeader: {
|
|
34869
|
+
width: MENU_CONTENT_WIDTH,
|
|
34810
34870
|
height: HEADER_HEIGHT3,
|
|
34811
34871
|
paddingTop: 8,
|
|
34812
34872
|
paddingBottom: 8,
|
|
@@ -34840,9 +34900,8 @@ var styles26 = reactNative.StyleSheet.create({
|
|
|
34840
34900
|
weekdayCell: {
|
|
34841
34901
|
width: DAY_CELL_WIDTH,
|
|
34842
34902
|
height: WEEKDAY_ROW_HEIGHT,
|
|
34843
|
-
flexGrow:
|
|
34844
|
-
flexShrink:
|
|
34845
|
-
flexBasis: 0,
|
|
34903
|
+
flexGrow: 0,
|
|
34904
|
+
flexShrink: 0,
|
|
34846
34905
|
alignItems: "center",
|
|
34847
34906
|
justifyContent: "center"
|
|
34848
34907
|
},
|
|
@@ -34870,9 +34929,8 @@ var styles26 = reactNative.StyleSheet.create({
|
|
|
34870
34929
|
dayCellWrap: {
|
|
34871
34930
|
width: DAY_CELL_WIDTH,
|
|
34872
34931
|
height: DAY_CELL_HEIGHT,
|
|
34873
|
-
flexGrow:
|
|
34874
|
-
flexShrink:
|
|
34875
|
-
flexBasis: 0,
|
|
34932
|
+
flexGrow: 0,
|
|
34933
|
+
flexShrink: 0,
|
|
34876
34934
|
alignItems: "center",
|
|
34877
34935
|
justifyContent: "center",
|
|
34878
34936
|
opacity: 1
|
|
@@ -34889,6 +34947,12 @@ var styles26 = reactNative.StyleSheet.create({
|
|
|
34889
34947
|
dayCircleSelected: {
|
|
34890
34948
|
backgroundColor: colors.primary
|
|
34891
34949
|
},
|
|
34950
|
+
dayCircleBooked: {
|
|
34951
|
+
backgroundColor: colors.grey700
|
|
34952
|
+
},
|
|
34953
|
+
dayTextBooked: {
|
|
34954
|
+
textDecorationLine: "line-through"
|
|
34955
|
+
},
|
|
34892
34956
|
dayCircleHovered: {
|
|
34893
34957
|
backgroundColor: colors.grey600
|
|
34894
34958
|
},
|
|
@@ -36150,6 +36214,9 @@ var styles32 = reactNative.StyleSheet.create({
|
|
|
36150
36214
|
color: colors.red
|
|
36151
36215
|
}
|
|
36152
36216
|
});
|
|
36217
|
+
|
|
36218
|
+
// src/components/Select/Select.tsx
|
|
36219
|
+
var import_react_dom3 = __toESM(require_react_dom());
|
|
36153
36220
|
var DEFAULT_WIDTH4 = 308;
|
|
36154
36221
|
var TRIGGER_HEIGHT2 = 44;
|
|
36155
36222
|
var TRIGGER_RADIUS2 = 60;
|
|
@@ -36159,6 +36226,9 @@ var ITEM_RADIUS2 = 12;
|
|
|
36159
36226
|
var ICON_SIZE13 = 20;
|
|
36160
36227
|
var CHIP_GAP = 6;
|
|
36161
36228
|
var FALLBACK_ELLIPSIS_WIDTH = 20;
|
|
36229
|
+
var WEB_MENU_Z_INDEX = 600;
|
|
36230
|
+
var WEB_VIEWPORT_PADDING = 8;
|
|
36231
|
+
var WEB_MENU_GAP = 8;
|
|
36162
36232
|
function itemBackground(state) {
|
|
36163
36233
|
switch (state) {
|
|
36164
36234
|
case "hover":
|
|
@@ -36305,6 +36375,7 @@ var Select = react.forwardRef(
|
|
|
36305
36375
|
const valueProp = props.value;
|
|
36306
36376
|
const rootRef = react.useRef(null);
|
|
36307
36377
|
const triggerRef = react.useRef(null);
|
|
36378
|
+
const menuRef = react.useRef(null);
|
|
36308
36379
|
const searchInputRef = react.useRef(null);
|
|
36309
36380
|
const setRootRef = react.useMemo(() => mergeRefs(rootRef, forwardedRef), [forwardedRef]);
|
|
36310
36381
|
const isOpenControlled = typeof openProp === "boolean";
|
|
@@ -36320,6 +36391,7 @@ var Select = react.forwardRef(
|
|
|
36320
36391
|
const [hoveredValue, setHoveredValue] = react.useState(null);
|
|
36321
36392
|
const [menuAlignEnd, setMenuAlignEnd] = react.useState(false);
|
|
36322
36393
|
const [menuPlaceAbove, setMenuPlaceAbove] = react.useState(false);
|
|
36394
|
+
const [webMenuPosition, setWebMenuPosition] = react.useState(null);
|
|
36323
36395
|
const selectedValues = react.useMemo(() => {
|
|
36324
36396
|
const current = isValueControlled ? valueProp : multiple ? uncontrolledMultiple : uncontrolledSingle;
|
|
36325
36397
|
return toArray(current);
|
|
@@ -36373,6 +36445,7 @@ var Select = react.forwardRef(
|
|
|
36373
36445
|
setHoveredValue(null);
|
|
36374
36446
|
setMenuAlignEnd(false);
|
|
36375
36447
|
setMenuPlaceAbove(false);
|
|
36448
|
+
setWebMenuPosition(null);
|
|
36376
36449
|
onSearchChange?.("");
|
|
36377
36450
|
}
|
|
36378
36451
|
},
|
|
@@ -36384,15 +36457,18 @@ var Select = react.forwardRef(
|
|
|
36384
36457
|
const trigger = triggerRef.current;
|
|
36385
36458
|
const rect = trigger?.getBoundingClientRect?.();
|
|
36386
36459
|
if (!rect) return;
|
|
36387
|
-
const viewportPadding = 8;
|
|
36388
|
-
const gap = 8;
|
|
36389
36460
|
const menuWidth = Math.max(rect.width, resolvedMenuWidth ?? 0);
|
|
36390
|
-
const overflowsRight = rect.left + menuWidth > window.innerWidth -
|
|
36461
|
+
const overflowsRight = rect.left + menuWidth > window.innerWidth - WEB_VIEWPORT_PADDING;
|
|
36391
36462
|
setMenuAlignEnd(overflowsRight);
|
|
36392
|
-
const spaceBelow = window.innerHeight -
|
|
36393
|
-
const spaceAbove = rect.top -
|
|
36394
|
-
const needsAbove = estimatedMenuHeight +
|
|
36463
|
+
const spaceBelow = window.innerHeight - WEB_VIEWPORT_PADDING - rect.bottom;
|
|
36464
|
+
const spaceAbove = rect.top - WEB_VIEWPORT_PADDING;
|
|
36465
|
+
const needsAbove = estimatedMenuHeight + WEB_MENU_GAP > spaceBelow && spaceAbove > spaceBelow;
|
|
36395
36466
|
setMenuPlaceAbove(needsAbove);
|
|
36467
|
+
const available = Math.max(0, (needsAbove ? spaceAbove : spaceBelow) - WEB_MENU_GAP);
|
|
36468
|
+
const maxHeight = Math.min(estimatedMenuHeight, Math.max(available, TRIGGER_HEIGHT2));
|
|
36469
|
+
const left = overflowsRight ? Math.max(WEB_VIEWPORT_PADDING, rect.right - menuWidth) : Math.min(rect.left, window.innerWidth - WEB_VIEWPORT_PADDING - menuWidth);
|
|
36470
|
+
const top = needsAbove ? Math.max(WEB_VIEWPORT_PADDING, rect.top - WEB_MENU_GAP - maxHeight) : rect.bottom + WEB_MENU_GAP;
|
|
36471
|
+
setWebMenuPosition({ top, left, width: menuWidth, maxHeight });
|
|
36396
36472
|
};
|
|
36397
36473
|
updateMenuPlacement();
|
|
36398
36474
|
window.addEventListener("resize", updateMenuPlacement);
|
|
@@ -36409,11 +36485,12 @@ var Select = react.forwardRef(
|
|
|
36409
36485
|
react.useEffect(() => {
|
|
36410
36486
|
if (reactNative.Platform.OS !== "web" || !isOpen) return;
|
|
36411
36487
|
const handlePointerDown = (event) => {
|
|
36412
|
-
const root = rootRef.current;
|
|
36413
36488
|
const target = event.target;
|
|
36414
|
-
if (
|
|
36415
|
-
|
|
36416
|
-
|
|
36489
|
+
if (!(target instanceof Node)) return;
|
|
36490
|
+
const root = rootRef.current;
|
|
36491
|
+
const menu = menuRef.current;
|
|
36492
|
+
if (root?.contains?.(target) || menu?.contains?.(target)) return;
|
|
36493
|
+
setOpen(false);
|
|
36417
36494
|
};
|
|
36418
36495
|
document.addEventListener("mousedown", handlePointerDown);
|
|
36419
36496
|
document.addEventListener("touchstart", handlePointerDown);
|
|
@@ -36527,7 +36604,7 @@ var Select = react.forwardRef(
|
|
|
36527
36604
|
]);
|
|
36528
36605
|
const leftIconNode = renderStatefulIcon(leftIcon, UserIcon, {
|
|
36529
36606
|
size: ICON_SIZE13,
|
|
36530
|
-
color: error ? colors.red : colors.primary
|
|
36607
|
+
color: error ? colors.red : isOpen ? colors.primary : colors.grey100
|
|
36531
36608
|
});
|
|
36532
36609
|
const hasLeftIcon = showLeftIcon || leftIcon != null;
|
|
36533
36610
|
const triggerBorderColor = error ? colors.redMuted : isOpen ? colors.primaryMuted : colors.grey700;
|
|
@@ -36536,6 +36613,95 @@ var Select = react.forwardRef(
|
|
|
36536
36613
|
const hintColor = error ? colors.red : colors.grey100;
|
|
36537
36614
|
const singleLabel = selectedOptions[0]?.label ?? placeholder;
|
|
36538
36615
|
const resolvedAccessibilityLabel = accessibilityLabel ?? (typeof label === "string" ? label : void 0);
|
|
36616
|
+
const optionListMaxHeight = reactNative.Platform.OS === "web" && webMenuPosition != null ? Math.max(43, webMenuPosition.maxHeight - (24 + (showSearch ? 48 : 0))) : resolvedOptionListMaxHeight;
|
|
36617
|
+
const menuNode = isOpen ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36618
|
+
reactNative.View,
|
|
36619
|
+
{
|
|
36620
|
+
ref: menuRef,
|
|
36621
|
+
style: [
|
|
36622
|
+
styles33.menu,
|
|
36623
|
+
reactNative.Platform.OS === "web" && webMenuPosition != null ? {
|
|
36624
|
+
position: "fixed",
|
|
36625
|
+
top: webMenuPosition.top,
|
|
36626
|
+
left: webMenuPosition.left,
|
|
36627
|
+
width: webMenuPosition.width,
|
|
36628
|
+
minWidth: webMenuPosition.width,
|
|
36629
|
+
maxHeight: webMenuPosition.maxHeight,
|
|
36630
|
+
zIndex: WEB_MENU_Z_INDEX,
|
|
36631
|
+
marginTop: 0,
|
|
36632
|
+
marginBottom: 0
|
|
36633
|
+
} : reactNative.Platform.OS === "web" ? { position: "fixed", opacity: 0, pointerEvents: "none" } : [
|
|
36634
|
+
menuAlignEnd ? styles33.menuAlignEnd : styles33.menuAlignStart,
|
|
36635
|
+
menuPlaceAbove ? styles33.menuAbove : styles33.menuBelow
|
|
36636
|
+
],
|
|
36637
|
+
menuStyle
|
|
36638
|
+
],
|
|
36639
|
+
children: [
|
|
36640
|
+
showSearch ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles33.searchField, children: [
|
|
36641
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles33.iconSlot, children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, { size: ICON_SIZE13, color: colors.grey100 }) }),
|
|
36642
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36643
|
+
reactNative.TextInput,
|
|
36644
|
+
{
|
|
36645
|
+
ref: searchInputRef,
|
|
36646
|
+
value: searchQuery,
|
|
36647
|
+
onChangeText: handleSearchChange,
|
|
36648
|
+
editable: !disabled,
|
|
36649
|
+
placeholder: searchPlaceholder,
|
|
36650
|
+
placeholderTextColor: colors.grey100,
|
|
36651
|
+
style: [
|
|
36652
|
+
styles33.searchInput,
|
|
36653
|
+
reactNative.Platform.OS === "web" ? styles33.searchInputWeb : null,
|
|
36654
|
+
reactNative.Platform.OS === "android" ? styles33.searchInputAndroid : null
|
|
36655
|
+
],
|
|
36656
|
+
accessibilityLabel: searchPlaceholder
|
|
36657
|
+
}
|
|
36658
|
+
)
|
|
36659
|
+
] }) : null,
|
|
36660
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
36661
|
+
reactNative.ScrollView,
|
|
36662
|
+
{
|
|
36663
|
+
style: [styles33.optionList, { maxHeight: optionListMaxHeight }],
|
|
36664
|
+
contentContainerStyle: styles33.optionListContent,
|
|
36665
|
+
keyboardShouldPersistTaps: "handled",
|
|
36666
|
+
showsVerticalScrollIndicator: false,
|
|
36667
|
+
children: [
|
|
36668
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles33.statusRow, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles33.statusText, children: "Loading..." }) }) : filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles33.statusRow, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles33.statusText, children: emptyText }) }) : null,
|
|
36669
|
+
!loading && filteredOptions.map((option) => {
|
|
36670
|
+
const isSelected = selectedValues.includes(option.value);
|
|
36671
|
+
const isHovered = hoveredValue === option.value;
|
|
36672
|
+
const visualState = isSelected ? "selected" : isHovered ? "hover" : "default";
|
|
36673
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36674
|
+
reactNative.Pressable,
|
|
36675
|
+
{
|
|
36676
|
+
onPress: () => handleSelect(option.value),
|
|
36677
|
+
disabled,
|
|
36678
|
+
onHoverIn: () => setHoveredValue(option.value),
|
|
36679
|
+
onHoverOut: () => setHoveredValue((current) => current === option.value ? null : current),
|
|
36680
|
+
onPressIn: () => setHoveredValue(option.value),
|
|
36681
|
+
onPressOut: () => setHoveredValue((current) => current === option.value ? null : current),
|
|
36682
|
+
accessibilityRole: multiple ? "checkbox" : "button",
|
|
36683
|
+
accessibilityState: { selected: isSelected, checked: isSelected, disabled },
|
|
36684
|
+
style: [
|
|
36685
|
+
styles33.item,
|
|
36686
|
+
{
|
|
36687
|
+
backgroundColor: itemBackground(visualState)
|
|
36688
|
+
}
|
|
36689
|
+
],
|
|
36690
|
+
children: [
|
|
36691
|
+
multiple ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles33.itemCheckbox, { pointerEvents: "none" }], children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, { value: isSelected, variant: "light" }) }) : null,
|
|
36692
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles33.itemLabel, numberOfLines: 1, children: option.label })
|
|
36693
|
+
]
|
|
36694
|
+
},
|
|
36695
|
+
option.value
|
|
36696
|
+
);
|
|
36697
|
+
})
|
|
36698
|
+
]
|
|
36699
|
+
}
|
|
36700
|
+
)
|
|
36701
|
+
]
|
|
36702
|
+
}
|
|
36703
|
+
) : null;
|
|
36704
|
+
const webMenuPortal = reactNative.Platform.OS === "web" && isOpen && typeof document !== "undefined" ? (0, import_react_dom3.createPortal)(menuNode, document.body) : null;
|
|
36539
36705
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36540
36706
|
reactNative.View,
|
|
36541
36707
|
{
|
|
@@ -36576,80 +36742,7 @@ var Select = react.forwardRef(
|
|
|
36576
36742
|
]
|
|
36577
36743
|
}
|
|
36578
36744
|
),
|
|
36579
|
-
|
|
36580
|
-
reactNative.View,
|
|
36581
|
-
{
|
|
36582
|
-
style: [
|
|
36583
|
-
styles33.menu,
|
|
36584
|
-
menuAlignEnd ? styles33.menuAlignEnd : styles33.menuAlignStart,
|
|
36585
|
-
menuPlaceAbove ? styles33.menuAbove : styles33.menuBelow,
|
|
36586
|
-
menuStyle
|
|
36587
|
-
],
|
|
36588
|
-
children: [
|
|
36589
|
-
showSearch ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles33.searchField, children: [
|
|
36590
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles33.iconSlot, children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, { size: ICON_SIZE13, color: colors.grey100 }) }),
|
|
36591
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36592
|
-
reactNative.TextInput,
|
|
36593
|
-
{
|
|
36594
|
-
ref: searchInputRef,
|
|
36595
|
-
value: searchQuery,
|
|
36596
|
-
onChangeText: handleSearchChange,
|
|
36597
|
-
editable: !disabled,
|
|
36598
|
-
placeholder: searchPlaceholder,
|
|
36599
|
-
placeholderTextColor: colors.grey100,
|
|
36600
|
-
style: [
|
|
36601
|
-
styles33.searchInput,
|
|
36602
|
-
reactNative.Platform.OS === "web" ? styles33.searchInputWeb : null,
|
|
36603
|
-
reactNative.Platform.OS === "android" ? styles33.searchInputAndroid : null
|
|
36604
|
-
],
|
|
36605
|
-
accessibilityLabel: searchPlaceholder
|
|
36606
|
-
}
|
|
36607
|
-
)
|
|
36608
|
-
] }) : null,
|
|
36609
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
36610
|
-
reactNative.ScrollView,
|
|
36611
|
-
{
|
|
36612
|
-
style: [styles33.optionList, { maxHeight: resolvedOptionListMaxHeight }],
|
|
36613
|
-
contentContainerStyle: styles33.optionListContent,
|
|
36614
|
-
keyboardShouldPersistTaps: "handled",
|
|
36615
|
-
showsVerticalScrollIndicator: false,
|
|
36616
|
-
children: [
|
|
36617
|
-
loading ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles33.statusRow, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles33.statusText, children: "Loading..." }) }) : filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles33.statusRow, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles33.statusText, children: emptyText }) }) : null,
|
|
36618
|
-
!loading && filteredOptions.map((option) => {
|
|
36619
|
-
const isSelected = selectedValues.includes(option.value);
|
|
36620
|
-
const isHovered = hoveredValue === option.value;
|
|
36621
|
-
const visualState = isSelected ? "selected" : isHovered ? "hover" : "default";
|
|
36622
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36623
|
-
reactNative.Pressable,
|
|
36624
|
-
{
|
|
36625
|
-
onPress: () => handleSelect(option.value),
|
|
36626
|
-
disabled,
|
|
36627
|
-
onHoverIn: () => setHoveredValue(option.value),
|
|
36628
|
-
onHoverOut: () => setHoveredValue((current) => current === option.value ? null : current),
|
|
36629
|
-
onPressIn: () => setHoveredValue(option.value),
|
|
36630
|
-
onPressOut: () => setHoveredValue((current) => current === option.value ? null : current),
|
|
36631
|
-
accessibilityRole: multiple ? "checkbox" : "button",
|
|
36632
|
-
accessibilityState: { selected: isSelected, checked: isSelected, disabled },
|
|
36633
|
-
style: [
|
|
36634
|
-
styles33.item,
|
|
36635
|
-
{
|
|
36636
|
-
backgroundColor: itemBackground(visualState)
|
|
36637
|
-
}
|
|
36638
|
-
],
|
|
36639
|
-
children: [
|
|
36640
|
-
multiple ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles33.itemCheckbox, { pointerEvents: "none" }], children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, { value: isSelected, variant: "light" }) }) : null,
|
|
36641
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles33.itemLabel, numberOfLines: 1, children: option.label })
|
|
36642
|
-
]
|
|
36643
|
-
},
|
|
36644
|
-
option.value
|
|
36645
|
-
);
|
|
36646
|
-
})
|
|
36647
|
-
]
|
|
36648
|
-
}
|
|
36649
|
-
)
|
|
36650
|
-
]
|
|
36651
|
-
}
|
|
36652
|
-
) : null
|
|
36745
|
+
reactNative.Platform.OS === "web" ? webMenuPortal : menuNode
|
|
36653
36746
|
] }),
|
|
36654
36747
|
showHint && hint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles33.hint, { color: hintColor }], children: hint }) : null
|
|
36655
36748
|
]
|