@multiplatform.one/forms 7.80.0 → 7.81.1
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/cjs/AdaptivePopup/index.cjs +2 -1
- package/dist/cjs/AdaptivePopup/index.native.js +2 -1
- package/dist/cjs/AdaptivePopup/index.native.js.map +1 -1
- package/dist/cjs/Button/index.cjs +12 -5
- package/dist/cjs/Button/index.native.js +14 -6
- package/dist/cjs/Button/index.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/PanelHeader.cjs +3 -8
- package/dist/cjs/FloatingPanel/PanelHeader.native.js +3 -8
- package/dist/cjs/FloatingPanel/PanelHeader.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/coverRect.cjs +0 -8
- package/dist/cjs/FloatingPanel/coverRect.native.js +0 -8
- package/dist/cjs/FloatingPanel/coverRect.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/echoContext.cjs +5 -27
- package/dist/cjs/FloatingPanel/echoContext.native.js +5 -28
- package/dist/cjs/FloatingPanel/echoContext.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/index.cjs +49 -131
- package/dist/cjs/FloatingPanel/index.native.js +216 -135
- package/dist/cjs/FloatingPanel/index.native.js.map +1 -1
- package/dist/cjs/fields/Combobox/index.cjs +3 -10
- package/dist/cjs/fields/Combobox/index.native.js +3 -10
- package/dist/cjs/fields/Combobox/index.native.js.map +1 -1
- package/dist/cjs/fields/Select/InlineChoices.cjs +4 -8
- package/dist/cjs/fields/Select/InlineChoices.native.js +4 -8
- package/dist/cjs/fields/Select/InlineChoices.native.js.map +1 -1
- package/dist/cjs/fields/Select/index.cjs +65 -201
- package/dist/cjs/fields/Select/index.native.js +74 -209
- package/dist/cjs/fields/Select/index.native.js.map +1 -1
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.cjs +2 -2
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.native.js +2 -2
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/index.native.js +4 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared/CheckGlyph.cjs +40 -0
- package/dist/cjs/shared/CheckGlyph.native.js +44 -0
- package/dist/cjs/shared/CheckGlyph.native.js.map +1 -0
- package/dist/cjs/shared/checkedOnField.cjs +104 -0
- package/dist/cjs/shared/checkedOnField.native.js +117 -0
- package/dist/cjs/shared/checkedOnField.native.js.map +1 -0
- package/dist/cjs/shared/floatingList.cjs +12 -5
- package/dist/cjs/shared/floatingList.native.js +15 -7
- package/dist/cjs/shared/floatingList.native.js.map +1 -1
- package/dist/esm/AdaptivePopup/index.mjs +3 -2
- package/dist/esm/AdaptivePopup/index.mjs.map +1 -1
- package/dist/esm/AdaptivePopup/index.native.js +3 -2
- package/dist/esm/AdaptivePopup/index.native.js.map +1 -1
- package/dist/esm/Button/index.mjs +12 -5
- package/dist/esm/Button/index.mjs.map +1 -1
- package/dist/esm/Button/index.native.js +14 -6
- package/dist/esm/Button/index.native.js.map +1 -1
- package/dist/esm/FloatingPanel/PanelHeader.mjs +3 -8
- package/dist/esm/FloatingPanel/PanelHeader.mjs.map +1 -1
- package/dist/esm/FloatingPanel/PanelHeader.native.js +3 -8
- package/dist/esm/FloatingPanel/PanelHeader.native.js.map +1 -1
- package/dist/esm/FloatingPanel/coverRect.mjs +1 -8
- package/dist/esm/FloatingPanel/coverRect.mjs.map +1 -1
- package/dist/esm/FloatingPanel/coverRect.native.js +1 -8
- package/dist/esm/FloatingPanel/coverRect.native.js.map +1 -1
- package/dist/esm/FloatingPanel/echoContext.mjs +4 -24
- package/dist/esm/FloatingPanel/echoContext.mjs.map +1 -1
- package/dist/esm/FloatingPanel/echoContext.native.js +4 -25
- package/dist/esm/FloatingPanel/echoContext.native.js.map +1 -1
- package/dist/esm/FloatingPanel/index.mjs +53 -135
- package/dist/esm/FloatingPanel/index.mjs.map +1 -1
- package/dist/esm/FloatingPanel/index.native.js +180 -99
- package/dist/esm/FloatingPanel/index.native.js.map +1 -1
- package/dist/esm/fields/Combobox/index.mjs +4 -11
- package/dist/esm/fields/Combobox/index.mjs.map +1 -1
- package/dist/esm/fields/Combobox/index.native.js +4 -11
- package/dist/esm/fields/Combobox/index.native.js.map +1 -1
- package/dist/esm/fields/Select/InlineChoices.mjs +2 -6
- package/dist/esm/fields/Select/InlineChoices.mjs.map +1 -1
- package/dist/esm/fields/Select/InlineChoices.native.js +2 -6
- package/dist/esm/fields/Select/InlineChoices.native.js.map +1 -1
- package/dist/esm/fields/Select/index.mjs +68 -204
- package/dist/esm/fields/Select/index.mjs.map +1 -1
- package/dist/esm/fields/Select/index.native.js +77 -212
- package/dist/esm/fields/Select/index.native.js.map +1 -1
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.mjs +3 -3
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.mjs.map +1 -1
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.native.js +3 -3
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/esm/index.mjs +3 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/shared/CheckGlyph.mjs +15 -0
- package/dist/esm/shared/CheckGlyph.mjs.map +1 -0
- package/dist/esm/shared/CheckGlyph.native.js +16 -0
- package/dist/esm/shared/CheckGlyph.native.js.map +1 -0
- package/dist/esm/shared/checkedOnField.mjs +76 -0
- package/dist/esm/shared/checkedOnField.mjs.map +1 -0
- package/dist/esm/shared/checkedOnField.native.js +86 -0
- package/dist/esm/shared/checkedOnField.native.js.map +1 -0
- package/dist/esm/shared/floatingList.mjs +9 -5
- package/dist/esm/shared/floatingList.mjs.map +1 -1
- package/dist/esm/shared/floatingList.native.js +12 -7
- package/dist/esm/shared/floatingList.native.js.map +1 -1
- package/dist/jsx/AdaptivePopup/index.mjs +3 -2
- package/dist/jsx/AdaptivePopup/index.mjs.map +1 -1
- package/dist/jsx/AdaptivePopup/index.native.js +2 -1
- package/dist/jsx/AdaptivePopup/index.native.js.map +1 -1
- package/dist/jsx/Button/index.mjs +12 -5
- package/dist/jsx/Button/index.mjs.map +1 -1
- package/dist/jsx/Button/index.native.js +14 -6
- package/dist/jsx/Button/index.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/PanelHeader.mjs +3 -8
- package/dist/jsx/FloatingPanel/PanelHeader.mjs.map +1 -1
- package/dist/jsx/FloatingPanel/PanelHeader.native.js +3 -8
- package/dist/jsx/FloatingPanel/PanelHeader.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/coverRect.mjs +1 -8
- package/dist/jsx/FloatingPanel/coverRect.mjs.map +1 -1
- package/dist/jsx/FloatingPanel/coverRect.native.js +0 -8
- package/dist/jsx/FloatingPanel/coverRect.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/echoContext.mjs +4 -24
- package/dist/jsx/FloatingPanel/echoContext.mjs.map +1 -1
- package/dist/jsx/FloatingPanel/echoContext.native.js +5 -28
- package/dist/jsx/FloatingPanel/echoContext.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/index.mjs +53 -135
- package/dist/jsx/FloatingPanel/index.mjs.map +1 -1
- package/dist/jsx/FloatingPanel/index.native.js +216 -135
- package/dist/jsx/FloatingPanel/index.native.js.map +1 -1
- package/dist/jsx/fields/Combobox/index.mjs +4 -11
- package/dist/jsx/fields/Combobox/index.mjs.map +1 -1
- package/dist/jsx/fields/Combobox/index.native.js +3 -10
- package/dist/jsx/fields/Combobox/index.native.js.map +1 -1
- package/dist/jsx/fields/Select/InlineChoices.mjs +2 -6
- package/dist/jsx/fields/Select/InlineChoices.mjs.map +1 -1
- package/dist/jsx/fields/Select/InlineChoices.native.js +4 -8
- package/dist/jsx/fields/Select/InlineChoices.native.js.map +1 -1
- package/dist/jsx/fields/Select/index.mjs +68 -204
- package/dist/jsx/fields/Select/index.mjs.map +1 -1
- package/dist/jsx/fields/Select/index.native.js +74 -209
- package/dist/jsx/fields/Select/index.native.js.map +1 -1
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.mjs +3 -3
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.mjs.map +1 -1
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.native.js +2 -2
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/jsx/index.js +3 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +3 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +4 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared/CheckGlyph.mjs +15 -0
- package/dist/jsx/shared/CheckGlyph.mjs.map +1 -0
- package/dist/jsx/shared/CheckGlyph.native.js +44 -0
- package/dist/jsx/shared/CheckGlyph.native.js.map +1 -0
- package/dist/jsx/shared/checkedOnField.mjs +76 -0
- package/dist/jsx/shared/checkedOnField.mjs.map +1 -0
- package/dist/jsx/shared/checkedOnField.native.js +117 -0
- package/dist/jsx/shared/checkedOnField.native.js.map +1 -0
- package/dist/jsx/shared/floatingList.mjs +9 -5
- package/dist/jsx/shared/floatingList.mjs.map +1 -1
- package/dist/jsx/shared/floatingList.native.js +15 -7
- package/dist/jsx/shared/floatingList.native.js.map +1 -1
- package/package.json +8 -8
- package/src/AdaptivePopup/index.tsx +6 -3
- package/src/Button/Button.iconButton.spec.tsx +39 -0
- package/src/Button/index.tsx +20 -8
- package/src/FloatingPanel/FloatingPanel.iconCover.spec.tsx +279 -0
- package/src/FloatingPanel/FloatingPanel.menuFace.native.spec.tsx +78 -69
- package/src/FloatingPanel/FloatingPanel.seamlessCover.spec.tsx +12 -0
- package/src/FloatingPanel/PanelHeader.tsx +4 -12
- package/src/FloatingPanel/coverRect.ts +2 -15
- package/src/FloatingPanel/echoContext.ts +6 -40
- package/src/FloatingPanel/index.native.tsx +209 -144
- package/src/FloatingPanel/index.tsx +71 -187
- package/src/FloatingPanel/pointAnchor.spec.ts +1 -1
- package/src/FloatingPanel/pointAnchor.ts +4 -4
- package/src/FloatingPanel/sheetGrabber.spec.tsx +53 -0
- package/src/fields/Combobox/index.tsx +4 -9
- package/src/fields/Select/InlineChoices.tsx +2 -2
- package/src/fields/Select/Select.containingBlock.spec.tsx +131 -130
- package/src/fields/Select/Select.popUp.native.spec.tsx +276 -0
- package/src/fields/Select/Select.stories.tsx +26 -0
- package/src/fields/Select/index.tsx +84 -255
- package/src/fields/nativeDateTime/OsDateTimeSheet.tsx +3 -3
- package/src/index.ts +2 -1
- package/src/shared/CheckGlyph.tsx +12 -0
- package/src/shared/checkedOnField.ts +116 -0
- package/src/shared/floatingList.spec.tsx +154 -1
- package/src/shared/floatingList.tsx +18 -9
- package/types/AdaptivePopup/index.d.ts.map +1 -1
- package/types/Button/index.d.ts.map +1 -1
- package/types/FloatingPanel/PanelHeader.d.ts +1 -6
- package/types/FloatingPanel/PanelHeader.d.ts.map +1 -1
- package/types/FloatingPanel/coverRect.d.ts +2 -11
- package/types/FloatingPanel/coverRect.d.ts.map +1 -1
- package/types/FloatingPanel/echoContext.d.ts +5 -22
- package/types/FloatingPanel/echoContext.d.ts.map +1 -1
- package/types/FloatingPanel/index.d.ts +22 -9
- package/types/FloatingPanel/index.d.ts.map +1 -1
- package/types/FloatingPanel/index.native.d.ts +8 -1
- package/types/FloatingPanel/index.native.d.ts.map +1 -1
- package/types/FloatingPanel/pointAnchor.d.ts +4 -4
- package/types/fields/Combobox/index.d.ts.map +1 -1
- package/types/fields/Select/index.d.ts.map +1 -1
- package/types/index.d.ts +2 -1
- package/types/index.d.ts.map +1 -1
- package/types/shared/CheckGlyph.d.ts +10 -0
- package/types/shared/CheckGlyph.d.ts.map +1 -0
- package/types/shared/checkedOnField.d.ts +54 -0
- package/types/shared/checkedOnField.d.ts.map +1 -0
- package/types/shared/floatingList.d.ts +5 -2
- package/types/shared/floatingList.d.ts.map +1 -1
- package/dist/cjs/FloatingPanel/iconEcho.cjs +0 -106
- package/dist/cjs/FloatingPanel/iconEcho.native.js +0 -116
- package/dist/cjs/FloatingPanel/iconEcho.native.js.map +0 -1
- package/dist/esm/FloatingPanel/iconEcho.mjs +0 -79
- package/dist/esm/FloatingPanel/iconEcho.mjs.map +0 -1
- package/dist/esm/FloatingPanel/iconEcho.native.js +0 -86
- package/dist/esm/FloatingPanel/iconEcho.native.js.map +0 -1
- package/dist/jsx/FloatingPanel/iconEcho.mjs +0 -79
- package/dist/jsx/FloatingPanel/iconEcho.mjs.map +0 -1
- package/dist/jsx/FloatingPanel/iconEcho.native.js +0 -116
- package/dist/jsx/FloatingPanel/iconEcho.native.js.map +0 -1
- package/src/FloatingPanel/FloatingPanel.iconEcho.spec.tsx +0 -357
- package/src/FloatingPanel/iconEcho.tsx +0 -124
- package/types/FloatingPanel/iconEcho.d.ts +0 -29
- package/types/FloatingPanel/iconEcho.d.ts.map +0 -1
|
@@ -37,6 +37,7 @@ __export(Select_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(Select_exports);
|
|
39
39
|
var import_theme = require("@multiplatform.one/theme");
|
|
40
|
+
var import_CheckGlyph = require("../../shared/CheckGlyph.cjs");
|
|
40
41
|
var import_react = require("react");
|
|
41
42
|
var import_react2 = require("@phosphor-icons/react");
|
|
42
43
|
var import_react3 = require("@floating-ui/react");
|
|
@@ -364,11 +365,7 @@ const SelectItem = (0, import_react.memo)(function SelectItem2({
|
|
|
364
365
|
numberOfLines: 1,
|
|
365
366
|
flex: 1,
|
|
366
367
|
children: option.label
|
|
367
|
-
}), isSelected && /* @__PURE__ */(0, import_jsx_runtime.jsx)(
|
|
368
|
-
size: 14,
|
|
369
|
-
weight: "bold",
|
|
370
|
-
color: ctx.markColor
|
|
371
|
-
})]
|
|
368
|
+
}), isSelected && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_CheckGlyph.CheckGlyph, {})]
|
|
372
369
|
});
|
|
373
370
|
});
|
|
374
371
|
function FloatingSelectCore({
|
|
@@ -455,38 +452,23 @@ function FloatingSelectCore({
|
|
|
455
452
|
sortedOptionsRef.current = (0, import_selectedOrder.orderOptionsBySelected)(options, selected, selectedOrder);
|
|
456
453
|
}, [options, value, multiple, selectedOrder]);
|
|
457
454
|
const programmaticScrollRef = (0, import_react.useRef)(0);
|
|
458
|
-
const pinnedTopRef = (0, import_react.useRef)(0);
|
|
459
|
-
const pinnedHeightRef = (0, import_react.useRef)(0);
|
|
460
|
-
const grownRef = (0, import_react.useRef)(false);
|
|
461
|
-
const growUpOnlyRef = (0, import_react.useRef)(false);
|
|
462
|
-
const growDownOnlyRef = (0, import_react.useRef)(false);
|
|
463
455
|
const lastScrollTopRef = (0, import_react.useRef)(0);
|
|
464
|
-
const
|
|
465
|
-
const
|
|
466
|
-
const
|
|
467
|
-
const coverTrimRef = (0, import_react.useRef)(0);
|
|
468
|
-
const echoed = !beside && !coverScroll;
|
|
456
|
+
const onFieldRef = (0, import_react.useRef)(null);
|
|
457
|
+
const opensUpRef = (0, import_react.useRef)(false);
|
|
458
|
+
const arrowBand = (0, import_floatingList.scrollArrowBand)(knobProps.menuRow.minHeight);
|
|
469
459
|
const repositionRef = (0, import_react.useRef)(null);
|
|
470
460
|
const panel = (0, import_FloatingPanel.useFloatingPanel)({
|
|
471
461
|
open,
|
|
472
462
|
onOpenChange: setOpen,
|
|
473
463
|
disabled,
|
|
474
464
|
repositionRef,
|
|
475
|
-
wheelGrowRef: selectedIndex >= 0 ? grownRef : void 0,
|
|
476
465
|
onBeforeOpen: () => {
|
|
477
466
|
computeSortedOptions();
|
|
478
467
|
overlayStyle.current = null;
|
|
479
|
-
pinnedTopRef.current = 0;
|
|
480
|
-
pinnedHeightRef.current = 0;
|
|
481
|
-
grownRef.current = false;
|
|
482
|
-
growUpOnlyRef.current = false;
|
|
483
|
-
growDownOnlyRef.current = false;
|
|
484
468
|
lastScrollTopRef.current = 0;
|
|
485
469
|
programmaticScrollRef.current = 0;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
coverTrimRef.current = 0;
|
|
489
|
-
setCoverScroll(false);
|
|
470
|
+
onFieldRef.current = null;
|
|
471
|
+
opensUpRef.current = false;
|
|
490
472
|
},
|
|
491
473
|
panelWidth
|
|
492
474
|
});
|
|
@@ -549,10 +531,6 @@ function FloatingSelectCore({
|
|
|
549
531
|
if (!selectedItem) return;
|
|
550
532
|
const isInitial = panel.initializingRef.current;
|
|
551
533
|
if (isInitial) dropdownElement.style.transition = "none";
|
|
552
|
-
if (pinnedTopRef.current === 0 && pinnedHeightRef.current === 0) {
|
|
553
|
-
programmaticScrollRef.current++;
|
|
554
|
-
dropdownElement.scrollTop = 0;
|
|
555
|
-
}
|
|
556
534
|
const triggerBounds = trigger.getBoundingClientRect();
|
|
557
535
|
const viewportHeight = window.innerHeight;
|
|
558
536
|
const originTop = (0, import_containingBlock.fixedContainingBlockOrigin)(dropdownElement).top;
|
|
@@ -561,126 +539,34 @@ function FloatingSelectCore({
|
|
|
561
539
|
const borderBottomWidth = parseFloat(computedStyle.borderBottomWidth) || 0;
|
|
562
540
|
const totalBorderWidth = borderTopWidth + borderBottomWidth;
|
|
563
541
|
const scrollContentHeight = dropdownElement.scrollHeight;
|
|
564
|
-
const
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
if (!overlayStyle.current || overlayStyle.current.top !== top2 - originTop || overlayStyle.current.maxHeight !== height2) {
|
|
587
|
-
dropdownElement.style.top = `${top2 - originTop}px`;
|
|
588
|
-
dropdownElement.style.maxHeight = `${height2}px`;
|
|
589
|
-
dropdownElement.style.height = "";
|
|
590
|
-
overlayStyle.current = {
|
|
591
|
-
top: top2 - originTop,
|
|
592
|
-
maxHeight: height2
|
|
593
|
-
};
|
|
594
|
-
void dropdownElement.offsetHeight;
|
|
595
|
-
}
|
|
596
|
-
pinnedTopRef.current = top2;
|
|
597
|
-
pinnedHeightRef.current = height2;
|
|
598
|
-
if (grown && previousTop > top2 && dropdownElement.scrollTop > 0) {
|
|
599
|
-
programmaticScrollRef.current++;
|
|
600
|
-
dropdownElement.scrollTop = Math.max(0, dropdownElement.scrollTop - (previousTop - top2));
|
|
601
|
-
}
|
|
602
|
-
if (echoRow) return;
|
|
603
|
-
const rowHeight = selectedItem.offsetHeight || 1;
|
|
604
|
-
if (isInitial && selectedIndex >= 0) {
|
|
605
|
-
const maxScrollTop = dropdownElement.scrollHeight - dropdownElement.clientHeight;
|
|
606
|
-
let scrollTop;
|
|
607
|
-
if (growsUpRef.current) {
|
|
608
|
-
scrollTop = selectedItem.offsetTop + rowHeight - (triggerBounds.bottom - top2);
|
|
609
|
-
} else {
|
|
610
|
-
const short = Math.max(0, selectedItem.offsetTop - maxScrollTop - 2);
|
|
611
|
-
scrollTop = selectedItem.offsetTop - Math.ceil(short / rowHeight) * rowHeight;
|
|
612
|
-
}
|
|
613
|
-
programmaticScrollRef.current++;
|
|
614
|
-
dropdownElement.scrollTop = Math.min(maxScrollTop, Math.max(0, scrollTop));
|
|
615
|
-
}
|
|
616
|
-
if (isInitial && !grown) {
|
|
617
|
-
const firstRow = listItemsRef.current[0];
|
|
618
|
-
const visibleBottom = dropdownElement.scrollTop + dropdownElement.clientHeight;
|
|
619
|
-
if (firstRow && visibleBottom < dropdownElement.scrollHeight - 2) {
|
|
620
|
-
const cut = (visibleBottom - firstRow.offsetTop) % rowHeight;
|
|
621
|
-
if (cut > 3 && cut < rowHeight - 3) {
|
|
622
|
-
coverTrimRef.current = cut;
|
|
623
|
-
const trimmedHeight = height2 - cut;
|
|
624
|
-
const trimmedTop = growsUpRef.current ? top2 + cut : top2;
|
|
625
|
-
dropdownElement.style.top = `${trimmedTop - originTop}px`;
|
|
626
|
-
dropdownElement.style.maxHeight = `${trimmedHeight}px`;
|
|
627
|
-
overlayStyle.current = {
|
|
628
|
-
top: trimmedTop - originTop,
|
|
629
|
-
maxHeight: trimmedHeight
|
|
630
|
-
};
|
|
631
|
-
pinnedTopRef.current = trimmedTop;
|
|
632
|
-
pinnedHeightRef.current = trimmedHeight;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
panel.initializingRef.current = false;
|
|
637
|
-
void dropdownElement.offsetHeight;
|
|
638
|
-
if (isInitial) dropdownElement.style.transition = panel.panelTransition;
|
|
639
|
-
requestAnimationFrame(() => {
|
|
640
|
-
if (dropdownElement) panel.updateArrows(dropdownElement);
|
|
542
|
+
const boundsTop = import_FloatingPanel.panelViewportPadding + borderTopWidth;
|
|
543
|
+
const boundsBottom = viewportHeight - import_FloatingPanel.panelViewportPadding - borderBottomWidth;
|
|
544
|
+
if (!onFieldRef.current) {
|
|
545
|
+
const fit = (0, import_floatingList.placeCheckedOnField)({
|
|
546
|
+
fieldTop: triggerBounds.top,
|
|
547
|
+
fieldBottom: triggerBounds.bottom,
|
|
548
|
+
rowTop: selectedItem.offsetTop,
|
|
549
|
+
rowHeight: selectedItem.offsetHeight || 1,
|
|
550
|
+
contentHeight: scrollContentHeight,
|
|
551
|
+
boundsTop,
|
|
552
|
+
boundsBottom,
|
|
553
|
+
band: arrowBand
|
|
554
|
+
});
|
|
555
|
+
onFieldRef.current = fit;
|
|
556
|
+
opensUpRef.current = fit.top + fit.height / 2 < (triggerBounds.top + triggerBounds.bottom) / 2;
|
|
557
|
+
} else if (!isInitial) {
|
|
558
|
+
onFieldRef.current = (0, import_floatingList.growOnScroll)({
|
|
559
|
+
...onFieldRef.current,
|
|
560
|
+
scrollTop: dropdownElement.scrollTop,
|
|
561
|
+
contentHeight: scrollContentHeight,
|
|
562
|
+
boundsTop,
|
|
563
|
+
boundsBottom
|
|
641
564
|
});
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
const idealTop = triggerBounds.top;
|
|
645
|
-
const idealBottom = idealTop + totalContentHeight;
|
|
646
|
-
const pinnedTop = Math.max(import_FloatingPanel.panelViewportPadding, idealTop);
|
|
647
|
-
const pinnedBottom = Math.min(viewportHeight - import_FloatingPanel.panelViewportPadding, idealBottom);
|
|
648
|
-
const pinnedHeight = Math.max(120, pinnedBottom - pinnedTop);
|
|
649
|
-
if (firstPlacement) {
|
|
650
|
-
pinnedTopRef.current = pinnedTop;
|
|
651
|
-
pinnedHeightRef.current = pinnedHeight;
|
|
652
|
-
}
|
|
653
|
-
let top = pinnedTopRef.current;
|
|
654
|
-
let height = pinnedHeightRef.current;
|
|
655
|
-
if (grownRef.current) {
|
|
656
|
-
const canGrowDown = Math.max(0, viewportHeight - import_FloatingPanel.panelViewportPadding - (top + height));
|
|
657
|
-
height += canGrowDown;
|
|
658
|
-
const canGrowUp = Math.max(0, top - import_FloatingPanel.panelViewportPadding);
|
|
659
|
-
top -= canGrowUp;
|
|
660
|
-
height += canGrowUp;
|
|
661
|
-
}
|
|
662
|
-
if (growUpOnlyRef.current) {
|
|
663
|
-
const canGrowUp = Math.max(0, top - import_FloatingPanel.panelViewportPadding);
|
|
664
|
-
top -= canGrowUp;
|
|
665
|
-
height += canGrowUp;
|
|
666
|
-
}
|
|
667
|
-
if (growDownOnlyRef.current) {
|
|
668
|
-
const canGrowDown = Math.max(0, viewportHeight - import_FloatingPanel.panelViewportPadding - (top + height));
|
|
669
|
-
height += canGrowDown;
|
|
670
|
-
}
|
|
671
|
-
height = Math.min(height, viewportHeight - top - import_FloatingPanel.panelViewportPadding);
|
|
672
|
-
height = Math.min(height, totalContentHeight);
|
|
673
|
-
height = Math.max(120, height);
|
|
674
|
-
const availableViewport = viewportHeight - 2 * import_FloatingPanel.panelViewportPadding;
|
|
675
|
-
if ((grownRef.current || growUpOnlyRef.current || growDownOnlyRef.current) && height < availableViewport) {
|
|
676
|
-
if (panel.placement.startsWith("top")) {
|
|
677
|
-
top = import_FloatingPanel.panelViewportPadding;
|
|
678
|
-
} else {
|
|
679
|
-
top = viewportHeight - import_FloatingPanel.panelViewportPadding - height;
|
|
680
|
-
}
|
|
681
565
|
}
|
|
682
|
-
const
|
|
683
|
-
|
|
566
|
+
const placed = onFieldRef.current;
|
|
567
|
+
const top = placed.top - borderTopWidth;
|
|
568
|
+
const height = placed.height + totalBorderWidth;
|
|
569
|
+
if (!overlayStyle.current || overlayStyle.current.top !== top - originTop || overlayStyle.current.maxHeight !== height) {
|
|
684
570
|
dropdownElement.style.top = `${top - originTop}px`;
|
|
685
571
|
dropdownElement.style.maxHeight = `${height}px`;
|
|
686
572
|
dropdownElement.style.height = "";
|
|
@@ -690,35 +576,17 @@ function FloatingSelectCore({
|
|
|
690
576
|
};
|
|
691
577
|
void dropdownElement.offsetHeight;
|
|
692
578
|
}
|
|
693
|
-
if (
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
const maxScrollTop = dropdownElement.scrollHeight - dropdownElement.clientHeight;
|
|
697
|
-
programmaticScrollRef.current++;
|
|
698
|
-
dropdownElement.scrollTop = Math.max(0, Math.min(selectedItem.offsetTop - echoHeight, maxScrollTop));
|
|
699
|
-
}
|
|
579
|
+
if (Math.abs(dropdownElement.scrollTop - placed.scrollTop) >= 0.5) {
|
|
580
|
+
programmaticScrollRef.current++;
|
|
581
|
+
dropdownElement.scrollTop = placed.scrollTop;
|
|
700
582
|
}
|
|
701
|
-
(0, import_FloatingPanel.placeEchoOverTrigger)(dropdownElement, {
|
|
702
|
-
triggerLeft: triggerBounds.left,
|
|
703
|
-
triggerRight: triggerBounds.right,
|
|
704
|
-
panelLeft: dropdownElement.getBoundingClientRect().left,
|
|
705
|
-
panelWidth: dropdownElement.offsetWidth,
|
|
706
|
-
rtl: getComputedStyle(trigger).direction === "rtl"
|
|
707
|
-
}, {
|
|
708
|
-
stretch: panelWidth !== void 0
|
|
709
|
-
});
|
|
710
583
|
panel.initializingRef.current = false;
|
|
711
584
|
void dropdownElement.offsetHeight;
|
|
712
585
|
if (isInitial) dropdownElement.style.transition = panel.panelTransition;
|
|
713
586
|
requestAnimationFrame(() => {
|
|
714
|
-
if (dropdownElement)
|
|
715
|
-
panel.updateArrows(dropdownElement);
|
|
716
|
-
requestAnimationFrame(() => {
|
|
717
|
-
if (dropdownElement) panel.updateArrows(dropdownElement);
|
|
718
|
-
});
|
|
719
|
-
}
|
|
587
|
+
if (dropdownElement) panel.updateArrows(dropdownElement);
|
|
720
588
|
});
|
|
721
|
-
}, [selectedIndex, panel.refs, panel.updateArrows, panel.
|
|
589
|
+
}, [selectedIndex, panel.refs, panel.updateArrows, panel.panelTransition, options.length, beside, arrowBand]);
|
|
722
590
|
repositionRef.current = repositionOverlay;
|
|
723
591
|
(0, import_react.useLayoutEffect)(() => {
|
|
724
592
|
if (!open || !panel.mounted) return;
|
|
@@ -886,23 +754,10 @@ function FloatingSelectCore({
|
|
|
886
754
|
return;
|
|
887
755
|
}
|
|
888
756
|
const arrowDir = panel.arrowScrollDirRef.current;
|
|
889
|
-
if (arrowDir)
|
|
890
|
-
panel.arrowScrollDirRef.current = null;
|
|
891
|
-
lastScrollTopRef.current = el.scrollTop;
|
|
892
|
-
if (arrowDir === "down") {
|
|
893
|
-
growUpOnlyRef.current = true;
|
|
894
|
-
} else {
|
|
895
|
-
growDownOnlyRef.current = true;
|
|
896
|
-
}
|
|
897
|
-
repositionOverlay();
|
|
898
|
-
return;
|
|
899
|
-
}
|
|
757
|
+
if (arrowDir) panel.arrowScrollDirRef.current = null;
|
|
900
758
|
const delta = el.scrollTop - lastScrollTopRef.current;
|
|
901
759
|
lastScrollTopRef.current = el.scrollTop;
|
|
902
|
-
if (delta !== 0)
|
|
903
|
-
grownRef.current = true;
|
|
904
|
-
repositionOverlay();
|
|
905
|
-
}
|
|
760
|
+
if (delta !== 0) repositionOverlay();
|
|
906
761
|
}, [panel.updateArrows, repositionOverlay]);
|
|
907
762
|
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
908
763
|
children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_InputParts.Input.Box, {
|
|
@@ -1005,7 +860,7 @@ function FloatingSelectCore({
|
|
|
1005
860
|
opacity: panel.visible ? 1 : 0,
|
|
1006
861
|
transform: panel.visible ? "scale(1)" : "scale(0.96)",
|
|
1007
862
|
transition: panel.panelTransition,
|
|
1008
|
-
transformOrigin:
|
|
863
|
+
transformOrigin: opensUpRef.current ? "bottom left" : "top left",
|
|
1009
864
|
...dragProps.style
|
|
1010
865
|
},
|
|
1011
866
|
onPointerDown: dragProps.onPointerDown,
|
|
@@ -1045,17 +900,12 @@ function FloatingSelectCore({
|
|
|
1045
900
|
"data-testid": "select-dropdown",
|
|
1046
901
|
paddingVertical: 0,
|
|
1047
902
|
paddingBottom: panel.coverCornerInset || 0,
|
|
1048
|
-
children: [
|
|
1049
|
-
sourceRef: panel.triggerRef,
|
|
1050
|
-
source: selectedOption?.label ?? placeholder,
|
|
1051
|
-
onPress: () => setOpen(false),
|
|
1052
|
-
presentational: true
|
|
1053
|
-
}) : null, /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_floatingList.ScrollArrow, {
|
|
903
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_floatingList.ScrollArrow, {
|
|
1054
904
|
direction: "up",
|
|
1055
905
|
scrollRef: panel.refs.floating,
|
|
1056
906
|
visible: panel.arrowUp,
|
|
1057
907
|
arrowScrollDirRef: panel.arrowScrollDirRef,
|
|
1058
|
-
|
|
908
|
+
band: arrowBand
|
|
1059
909
|
}), groupLabel && /* @__PURE__ */(0, import_jsx_runtime.jsx)(GroupHeader, {
|
|
1060
910
|
color: textColor,
|
|
1061
911
|
paddingHorizontal: knobProps.panelPadding.padding,
|
|
@@ -1088,7 +938,8 @@ function FloatingSelectCore({
|
|
|
1088
938
|
direction: "down",
|
|
1089
939
|
scrollRef: panel.refs.floating,
|
|
1090
940
|
visible: panel.arrowDown,
|
|
1091
|
-
arrowScrollDirRef: panel.arrowScrollDirRef
|
|
941
|
+
arrowScrollDirRef: panel.arrowScrollDirRef,
|
|
942
|
+
band: arrowBand
|
|
1092
943
|
})]
|
|
1093
944
|
})
|
|
1094
945
|
})
|
|
@@ -1116,6 +967,7 @@ function NativeSelectCore({
|
|
|
1116
967
|
const insideOverlay = (0, import_overlayStack.useInsideOverlay)();
|
|
1117
968
|
const compactFace = (0, import_compactFace.pickerCompactFace)(options.length);
|
|
1118
969
|
const asMenu = (0, import_compactFace.resolveCompactFace)(compactFace, insideOverlay) === "menu";
|
|
970
|
+
const beside = asMenu && insideOverlay && (0, import_shouldInlineChoices.opensBesideTrigger)(options.length);
|
|
1119
971
|
const hydrationTouch = (0, import_theme.useTouchSurface)();
|
|
1120
972
|
const describedBy = (0, import_fieldLayout.useFieldDescribedBy)();
|
|
1121
973
|
const fieldA11y = (0, import_fieldLayout.useFieldA11y)();
|
|
@@ -1166,6 +1018,10 @@ function NativeSelectCore({
|
|
|
1166
1018
|
requestAnimationFrame(() => listRef.current?.focus());
|
|
1167
1019
|
}
|
|
1168
1020
|
}, [open, selectedIndex]);
|
|
1021
|
+
const [onFieldRow, setOnFieldRow] = (0, import_react.useState)(null);
|
|
1022
|
+
(0, import_react.useEffect)(() => {
|
|
1023
|
+
if (!open) setOnFieldRow(null);
|
|
1024
|
+
}, [open]);
|
|
1169
1025
|
const handleSelect = (0, import_react.useCallback)(optionValue => {
|
|
1170
1026
|
if (multiple) {
|
|
1171
1027
|
const current = Array.isArray(value) ? value : value ? [value] : [];
|
|
@@ -1276,11 +1132,7 @@ function NativeSelectCore({
|
|
|
1276
1132
|
numberOfLines: 1,
|
|
1277
1133
|
flex: 1,
|
|
1278
1134
|
children: option.label
|
|
1279
|
-
}), selected && /* @__PURE__ */(0, import_jsx_runtime.jsx)(
|
|
1280
|
-
size: 14,
|
|
1281
|
-
weight: "bold",
|
|
1282
|
-
color: markColor
|
|
1283
|
-
})]
|
|
1135
|
+
}), selected && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_CheckGlyph.CheckGlyph, {})]
|
|
1284
1136
|
}, import_tamagui.isWeb ? option.value : void 0);
|
|
1285
1137
|
if (import_tamagui.isWeb) return row;
|
|
1286
1138
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Pressable, {
|
|
@@ -1290,6 +1142,14 @@ function NativeSelectCore({
|
|
|
1290
1142
|
accessibilityState: {
|
|
1291
1143
|
selected
|
|
1292
1144
|
},
|
|
1145
|
+
onLayout: i === Math.max(selectedIndex, 0) ? ({
|
|
1146
|
+
nativeEvent: {
|
|
1147
|
+
layout
|
|
1148
|
+
}
|
|
1149
|
+
}) => setOnFieldRow({
|
|
1150
|
+
top: layout.y,
|
|
1151
|
+
height: layout.height
|
|
1152
|
+
}) : void 0,
|
|
1293
1153
|
children: row
|
|
1294
1154
|
}, option.value);
|
|
1295
1155
|
})]
|
|
@@ -1374,10 +1234,14 @@ function NativeSelectCore({
|
|
|
1374
1234
|
sheet: true,
|
|
1375
1235
|
compactFace,
|
|
1376
1236
|
panelWidth,
|
|
1377
|
-
...(
|
|
1237
|
+
...(beside ? {
|
|
1378
1238
|
anchorMode: "attach",
|
|
1379
1239
|
triggerEcho: false
|
|
1380
|
-
} : null
|
|
1240
|
+
} : import_tamagui.isWeb || displayOptions.length === 0 ? null : {
|
|
1241
|
+
popUp: {
|
|
1242
|
+
row: onFieldRow
|
|
1243
|
+
}
|
|
1244
|
+
}),
|
|
1381
1245
|
triggerA11y: {
|
|
1382
1246
|
label: ariaLabel ?? fieldA11y?.label,
|
|
1383
1247
|
value: triggerValueText,
|