@acusti/dropdown 1.0.0-alpha.0 → 1.0.0-alpha.2

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/README.md CHANGED
@@ -709,12 +709,22 @@ The default rule, shown here for reference:
709
709
  }
710
710
  ```
711
711
 
712
- ### Nested non-menu dropdowns
712
+ ### Nested independent dropdowns
713
713
 
714
- Nesting means submenu only for menus. A nested `Dropdown` with
715
- `hasItems={false}` isn’t a menu, so it renders as an independent anchored
716
- dropdown instead of a parent item for example, an ℹ️ button next to an
717
- input in a form dropdown that opens an info popover about the input:
714
+ Submenus are a menu concept: a `Dropdown` becomes a submenu only when it’s
715
+ a menu nested inside another menu. Anything else nests as an
716
+ **independent** anchored dropdownopening on click and selecting items on
717
+ click (no hover-disclosed parent item), with its interactions never
718
+ touching the outer dropdown. Two cases qualify:
719
+
720
+ - a `hasItems={false}` `Dropdown` (a dialog/popover) nested anywhere — e.g.
721
+ an ℹ️ info popover next to an input in a form dropdown (below);
722
+ - any `Dropdown` nested inside a `hasItems={false}` dropdown — e.g. a
723
+ self-contained picker embedded in a larger dialog, which keeps full
724
+ click-to-select on its `data-ukt-value` items.
725
+
726
+ For example, an ℹ️ button next to an input in a form dropdown that opens an
727
+ info popover about the input:
718
728
 
719
729
  ```tsx
720
730
  <Dropdown hasItems={false}>
@@ -756,8 +766,16 @@ Menubar behaviors:
756
766
 
757
767
  - renders `role="menubar"`; each dropdown trigger is a menubar item
758
768
  - at most one menu in the bar is open at a time
759
- - once any menu is open, hovering another trigger switches to that menu
760
- without a click (matching macOS menubar behavior)
769
+ - opening a trigger’s menu (by click or keyboard) engages the bar
770
+ (menu-mode). While engaged, hovering or focusing another trigger switches
771
+ to that menu without a click, matching the macOS menu bar
772
+ - while engaged, hovering a non-menu control in the bar (e.g. a plain
773
+ button placed alongside the dropdowns) closes the open menu but keeps the
774
+ bar engaged, so hovering back onto a trigger reopens a menu; sliding
775
+ across the gaps between triggers leaves the open menu alone
776
+ - a deliberate dismissal — **Escape**, a click outside the bar, or
777
+ selecting an item — leaves menu-mode, after which hovering a trigger no
778
+ longer opens its menu until a menu is opened again to re-engage the bar
761
779
  - **←/→** move between menus, wrapping at the ends: with the bar focused
762
780
  they move focus between triggers, and while a menu is open they slide the
763
781
  open menu to the adjacent trigger — unless the active item is a parent
package/dist/Dropdown.js CHANGED
@@ -225,6 +225,7 @@ var compareDocumentOrder = (a, b) => {
225
225
  if ((position & Node.DOCUMENT_POSITION_PRECEDING) !== 0) return 1;
226
226
  return 0;
227
227
  };
228
+ var NON_MENU_CONTROL_SELECTOR = "a[href], button, input, select, textarea, [tabindex]";
228
229
  function Menubar(t0) {
229
230
  const $ = c(15);
230
231
  const { children, className, style } = t0;
@@ -234,6 +235,7 @@ function Menubar(t0) {
234
235
  $[0] = t1;
235
236
  } else t1 = $[0];
236
237
  const membersRef = useRef(t1);
238
+ const engagedMemberRef = useRef(null);
237
239
  let t2;
238
240
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
239
241
  t2 = () => Array.from(membersRef.current).sort(compareDocumentOrder);
@@ -254,8 +256,12 @@ function Menubar(t0) {
254
256
  members[nextIndex].open();
255
257
  members[nextIndex].focusTrigger();
256
258
  },
257
- notifyOpened(element) {
258
- for (const member_0 of membersRef.current) if (member_0.element !== element && member_0.isOpen()) member_0.close();
259
+ notifyClosed(element) {
260
+ if (engagedMemberRef.current === element) engagedMemberRef.current = null;
261
+ },
262
+ notifyOpened(element_0) {
263
+ engagedMemberRef.current = element_0;
264
+ for (const member_0 of membersRef.current) if (member_0.element !== element_0 && member_0.isOpen()) member_0.close();
259
265
  },
260
266
  registerMember(member_1) {
261
267
  membersRef.current.add(member_1);
@@ -288,11 +294,19 @@ function Menubar(t0) {
288
294
  let t5;
289
295
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
290
296
  t5 = (eventTarget_0) => {
297
+ if (engagedMemberRef.current == null) return;
291
298
  const members_1 = getOrderedMembers();
292
- if (!members_1.some(_temp2)) return;
293
- const member_5 = members_1.find((m) => m.element.contains(eventTarget_0));
294
- if (!member_5 || member_5.isOpen()) return;
295
- member_5.open();
299
+ if (!members_1.some((m) => m.element === engagedMemberRef.current)) {
300
+ engagedMemberRef.current = null;
301
+ return;
302
+ }
303
+ const member_4 = members_1.find((m_0) => m_0.element.contains(eventTarget_0));
304
+ if (member_4) {
305
+ if (!member_4.isOpen()) member_4.open();
306
+ return;
307
+ }
308
+ if (!eventTarget_0.closest(NON_MENU_CONTROL_SELECTOR)) return;
309
+ for (const openMember of members_1) if (openMember.isOpen()) openMember.close();
296
310
  };
297
311
  $[4] = t5;
298
312
  } else t5 = $[4];
@@ -346,9 +360,6 @@ function Menubar(t0) {
346
360
  } else t10 = $[14];
347
361
  return t10;
348
362
  }
349
- function _temp2(member_4) {
350
- return member_4.isOpen();
351
- }
352
363
  function _temp$1(member_2) {
353
364
  return member_2.isOpen();
354
365
  }
@@ -385,7 +396,7 @@ function Dropdown(props) {
385
396
  return t0;
386
397
  }
387
398
  function RootDropdown(t0) {
388
- const $ = c(130);
399
+ const $ = c(137);
389
400
  const { allowCreate, allowEmpty: t1, children, className, disabled, hasItems: t2, isOpenOnMount, isSearchable, keepOpenOnSubmit: t3, label, name, onActiveItem, onClick, onClose, onMouseDown, onMouseUp, onOpen, onSubmitItem, placeholder, style: styleFromProps, tabIndex, value } = t0;
390
401
  const allowEmpty = t1 === void 0 ? true : t1;
391
402
  const hasItems = t2 === void 0 ? true : t2;
@@ -699,8 +710,8 @@ function RootDropdown(t0) {
699
710
  } else t22 = $[36];
700
711
  const trackSafeArea = t22;
701
712
  let t23;
702
- if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
703
- t23 = () => {
713
+ if ($[37] !== dropdownElement || $[38] !== menubar) {
714
+ t23 = (options) => {
704
715
  setIsOpen(false);
705
716
  setIsOpening(false);
706
717
  mouseDownPositionRef.current = null;
@@ -712,42 +723,46 @@ function RootDropdown(t0) {
712
723
  clearTimeout(closingTimerRef.current);
713
724
  closingTimerRef.current = null;
714
725
  }
726
+ if (menubar && dropdownElement && !options?.keepMenubarEngaged) menubar.notifyClosed(dropdownElement);
715
727
  };
716
- $[37] = t23;
717
- } else t23 = $[37];
728
+ $[37] = dropdownElement;
729
+ $[38] = menubar;
730
+ $[39] = t23;
731
+ } else t23 = $[39];
718
732
  const closeDropdown = t23;
719
733
  let t24;
720
- if ($[38] !== dropdownElement?.firstElementChild) {
734
+ if ($[40] !== dropdownElement?.firstElementChild) {
721
735
  t24 = () => {
722
736
  const firstChild = dropdownElement?.firstElementChild;
723
737
  if (!firstChild) return;
724
738
  (firstChild.matches(FOCUSABLE_SELECTOR) ? firstChild : firstChild.querySelector(FOCUSABLE_SELECTOR))?.focus();
725
739
  };
726
- $[38] = dropdownElement?.firstElementChild;
727
- $[39] = t24;
728
- } else t24 = $[39];
740
+ $[40] = dropdownElement?.firstElementChild;
741
+ $[41] = t24;
742
+ } else t24 = $[41];
729
743
  const focusTrigger = t24;
730
744
  let t25;
731
- if ($[40] !== dropdownElement || $[41] !== focusTrigger || $[42] !== menubar) {
745
+ if ($[42] !== closeDropdown || $[43] !== dropdownElement || $[44] !== focusTrigger || $[45] !== menubar) {
732
746
  t25 = () => {
733
747
  if (!menubar || !dropdownElement) return;
734
748
  return menubar.registerMember({
735
- close: closeDropdown,
749
+ close: () => closeDropdown({ keepMenubarEngaged: true }),
736
750
  element: dropdownElement,
737
751
  focusTrigger,
738
752
  isOpen: () => isOpenRef.current,
739
753
  open: () => setIsOpen(true)
740
754
  });
741
755
  };
742
- $[40] = dropdownElement;
743
- $[41] = focusTrigger;
744
- $[42] = menubar;
745
- $[43] = t25;
746
- } else t25 = $[43];
756
+ $[42] = closeDropdown;
757
+ $[43] = dropdownElement;
758
+ $[44] = focusTrigger;
759
+ $[45] = menubar;
760
+ $[46] = t25;
761
+ } else t25 = $[46];
747
762
  useEffect(t25);
748
763
  let t26;
749
764
  let t27;
750
- if ($[44] !== dropdownElement || $[45] !== isOpen || $[46] !== menubar) {
765
+ if ($[47] !== dropdownElement || $[48] !== isOpen || $[49] !== menubar) {
751
766
  t26 = () => {
752
767
  if (isOpen && menubar && dropdownElement) menubar.notifyOpened(dropdownElement);
753
768
  };
@@ -756,18 +771,18 @@ function RootDropdown(t0) {
756
771
  isOpen,
757
772
  menubar
758
773
  ];
759
- $[44] = dropdownElement;
760
- $[45] = isOpen;
761
- $[46] = menubar;
762
- $[47] = t26;
763
- $[48] = t27;
774
+ $[47] = dropdownElement;
775
+ $[48] = isOpen;
776
+ $[49] = menubar;
777
+ $[50] = t26;
778
+ $[51] = t27;
764
779
  } else {
765
- t26 = $[47];
766
- t27 = $[48];
780
+ t26 = $[50];
781
+ t27 = $[51];
767
782
  }
768
783
  useEffect(t26, t27);
769
784
  let t28;
770
- if ($[49] !== dropdownElement || $[50] !== handleActiveItem) {
785
+ if ($[52] !== closeDropdown || $[53] !== dropdownElement || $[54] !== handleActiveItem) {
771
786
  t28 = (event_1) => {
772
787
  const element = hasItemsRef.current ? getActiveItemElement(dropdownElement) : null;
773
788
  const submenuOfActive = element ? getSubmenuOfItem(element) : null;
@@ -823,13 +838,14 @@ function RootDropdown(t0) {
823
838
  onSubmitItemRef.current?.(payload_1);
824
839
  dispatchToSubmenus("onSubmitItem", payload_1);
825
840
  };
826
- $[49] = dropdownElement;
827
- $[50] = handleActiveItem;
828
- $[51] = t28;
829
- } else t28 = $[51];
841
+ $[52] = closeDropdown;
842
+ $[53] = dropdownElement;
843
+ $[54] = handleActiveItem;
844
+ $[55] = t28;
845
+ } else t28 = $[55];
830
846
  const handleSubmitItem = t28;
831
847
  let t29;
832
- if ($[52] !== trackSafeArea) {
848
+ if ($[56] !== trackSafeArea) {
833
849
  t29 = (event_2) => {
834
850
  const { clientX, clientY } = event_2;
835
851
  currentInputMethodRef.current = "mouse";
@@ -839,12 +855,12 @@ function RootDropdown(t0) {
839
855
  if (Math.abs(initialPosition.clientX - clientX) < 12 && Math.abs(initialPosition.clientY - clientY) < 12) return;
840
856
  setIsOpening(false);
841
857
  };
842
- $[52] = trackSafeArea;
843
- $[53] = t29;
844
- } else t29 = $[53];
858
+ $[56] = trackSafeArea;
859
+ $[57] = t29;
860
+ } else t29 = $[57];
845
861
  const handleMouseMove = t29;
846
862
  let t30;
847
- if ($[54] !== dropdownElement || $[55] !== handleActiveItem || $[56] !== syncSubmenuDisclosure) {
863
+ if ($[58] !== dropdownElement || $[59] !== handleActiveItem || $[60] !== syncSubmenuDisclosure) {
848
864
  t30 = (event_3) => {
849
865
  if (!hasItemsRef.current) return;
850
866
  if (currentInputMethodRef.current !== "mouse") return;
@@ -864,14 +880,14 @@ function RootDropdown(t0) {
864
880
  });
865
881
  syncSubmenuDisclosure();
866
882
  };
867
- $[54] = dropdownElement;
868
- $[55] = handleActiveItem;
869
- $[56] = syncSubmenuDisclosure;
870
- $[57] = t30;
871
- } else t30 = $[57];
883
+ $[58] = dropdownElement;
884
+ $[59] = handleActiveItem;
885
+ $[60] = syncSubmenuDisclosure;
886
+ $[61] = t30;
887
+ } else t30 = $[61];
872
888
  const handleMouseOver = t30;
873
889
  let t31;
874
- if ($[58] !== dropdownElement || $[59] !== syncSubmenuDisclosure) {
890
+ if ($[62] !== dropdownElement || $[63] !== syncSubmenuDisclosure) {
875
891
  t31 = (event_4) => {
876
892
  if (!hasItemsRef.current) return;
877
893
  const relatedTarget = event_4.relatedTarget;
@@ -888,13 +904,13 @@ function RootDropdown(t0) {
888
904
  delete activeItem.dataset.uktActive;
889
905
  syncSubmenuDisclosure();
890
906
  };
891
- $[58] = dropdownElement;
892
- $[59] = syncSubmenuDisclosure;
893
- $[60] = t31;
894
- } else t31 = $[60];
907
+ $[62] = dropdownElement;
908
+ $[63] = syncSubmenuDisclosure;
909
+ $[64] = t31;
910
+ } else t31 = $[64];
895
911
  const handleMouseOut = t31;
896
912
  let t32;
897
- if ($[61] !== onMouseDown) {
913
+ if ($[65] !== onMouseDown) {
898
914
  t32 = (event_5) => {
899
915
  if (onMouseDown) onMouseDown(event_5);
900
916
  if (isOpenRef.current) return;
@@ -909,12 +925,12 @@ function RootDropdown(t0) {
909
925
  isOpeningTimerRef.current = null;
910
926
  }, 1e3);
911
927
  };
912
- $[61] = onMouseDown;
913
- $[62] = t32;
914
- } else t32 = $[62];
928
+ $[65] = onMouseDown;
929
+ $[66] = t32;
930
+ } else t32 = $[66];
915
931
  const handleMouseDown = t32;
916
932
  let t33;
917
- if ($[63] !== dropdownElement || $[64] !== handleActiveItem || $[65] !== handleSubmitItem || $[66] !== onMouseUp) {
933
+ if ($[67] !== closeDropdown || $[68] !== dropdownElement || $[69] !== handleActiveItem || $[70] !== handleSubmitItem || $[71] !== onMouseUp) {
918
934
  t33 = (event_6) => {
919
935
  if (onMouseUp) onMouseUp(event_6);
920
936
  if (isOpeningRef.current || !isOpenRef.current || closingTimerRef.current != null) return;
@@ -939,15 +955,16 @@ function RootDropdown(t0) {
939
955
  }
940
956
  handleSubmitItem(event_6);
941
957
  };
942
- $[63] = dropdownElement;
943
- $[64] = handleActiveItem;
944
- $[65] = handleSubmitItem;
945
- $[66] = onMouseUp;
946
- $[67] = t33;
947
- } else t33 = $[67];
958
+ $[67] = closeDropdown;
959
+ $[68] = dropdownElement;
960
+ $[69] = handleActiveItem;
961
+ $[70] = handleSubmitItem;
962
+ $[71] = onMouseUp;
963
+ $[72] = t33;
964
+ } else t33 = $[72];
948
965
  const handleMouseUp = t33;
949
966
  let t34;
950
- if ($[68] !== dropdownElement || $[69] !== focusTrigger || $[70] !== handleActiveItem || $[71] !== handleSubmitItem || $[72] !== menubar || $[73] !== syncSubmenuDisclosure) {
967
+ if ($[73] !== closeDropdown || $[74] !== dropdownElement || $[75] !== focusTrigger || $[76] !== handleActiveItem || $[77] !== handleSubmitItem || $[78] !== menubar || $[79] !== syncSubmenuDisclosure) {
951
968
  t34 = (event_7) => {
952
969
  const { altKey, ctrlKey, key: key_0, metaKey } = event_7;
953
970
  const eventTarget_2 = event_7.target;
@@ -1081,27 +1098,28 @@ function RootDropdown(t0) {
1081
1098
  }
1082
1099
  }
1083
1100
  };
1084
- $[68] = dropdownElement;
1085
- $[69] = focusTrigger;
1086
- $[70] = handleActiveItem;
1087
- $[71] = handleSubmitItem;
1088
- $[72] = menubar;
1089
- $[73] = syncSubmenuDisclosure;
1090
- $[74] = t34;
1091
- } else t34 = $[74];
1101
+ $[73] = closeDropdown;
1102
+ $[74] = dropdownElement;
1103
+ $[75] = focusTrigger;
1104
+ $[76] = handleActiveItem;
1105
+ $[77] = handleSubmitItem;
1106
+ $[78] = menubar;
1107
+ $[79] = syncSubmenuDisclosure;
1108
+ $[80] = t34;
1109
+ } else t34 = $[80];
1092
1110
  const handleKeyDown = t34;
1093
1111
  let t35;
1094
- if ($[75] !== handleKeyDown) {
1112
+ if ($[81] !== handleKeyDown) {
1095
1113
  t35 = {
1096
1114
  ignoreUsedKeyboardEvents: false,
1097
1115
  onKeyDown: handleKeyDown
1098
1116
  };
1099
- $[75] = handleKeyDown;
1100
- $[76] = t35;
1101
- } else t35 = $[76];
1117
+ $[81] = handleKeyDown;
1118
+ $[82] = t35;
1119
+ } else t35 = $[82];
1102
1120
  useKeyboardEvents(t35);
1103
1121
  let t36;
1104
- if ($[77] !== handleActiveItem || $[78] !== isOpenOnMount) {
1122
+ if ($[83] !== closeDropdown || $[84] !== handleActiveItem || $[85] !== isOpenOnMount) {
1105
1123
  t36 = (ref) => {
1106
1124
  setDropdownElement(ref);
1107
1125
  if (!ref) return;
@@ -1136,7 +1154,7 @@ function RootDropdown(t0) {
1136
1154
  if (!isOpenRef.current) return;
1137
1155
  const eventTarget_5 = target_3;
1138
1156
  if (ref.contains(eventTarget_5) || eventTarget_5.contains(ref)) return;
1139
- closeDropdown();
1157
+ closeDropdown({ keepMenubarEngaged: true });
1140
1158
  };
1141
1159
  document.addEventListener("focusin", handleGlobalFocusIn);
1142
1160
  document.addEventListener("mousedown", handleGlobalMouseDown);
@@ -1174,21 +1192,22 @@ function RootDropdown(t0) {
1174
1192
  if (inputElement) inputElement.removeEventListener("input", handleInput);
1175
1193
  };
1176
1194
  };
1177
- $[77] = handleActiveItem;
1178
- $[78] = isOpenOnMount;
1179
- $[79] = t36;
1180
- } else t36 = $[79];
1195
+ $[83] = closeDropdown;
1196
+ $[84] = handleActiveItem;
1197
+ $[85] = isOpenOnMount;
1198
+ $[86] = t36;
1199
+ } else t36 = $[86];
1181
1200
  const handleRef = t36;
1182
1201
  const handleBodyRef = _temp;
1183
1202
  if (!isValidElement(trigger)) if (isSearchable) {
1184
1203
  const t37 = value ?? "";
1185
1204
  let t38;
1186
- if ($[80] === Symbol.for("react.memo_cache_sentinel")) {
1205
+ if ($[87] === Symbol.for("react.memo_cache_sentinel")) {
1187
1206
  t38 = () => setIsOpen(true);
1188
- $[80] = t38;
1189
- } else t38 = $[80];
1207
+ $[87] = t38;
1208
+ } else t38 = $[87];
1190
1209
  let t39;
1191
- if ($[81] !== bodyId || $[82] !== disabled || $[83] !== isOpen || $[84] !== name || $[85] !== placeholder || $[86] !== popupRole || $[87] !== t37 || $[88] !== tabIndex) {
1210
+ if ($[88] !== bodyId || $[89] !== disabled || $[90] !== isOpen || $[91] !== name || $[92] !== placeholder || $[93] !== popupRole || $[94] !== t37 || $[95] !== tabIndex) {
1192
1211
  t39 = /* @__PURE__ */ jsx("input", {
1193
1212
  "aria-controls": bodyId,
1194
1213
  "aria-expanded": isOpen,
@@ -1204,20 +1223,20 @@ function RootDropdown(t0) {
1204
1223
  tabIndex,
1205
1224
  type: "text"
1206
1225
  });
1207
- $[81] = bodyId;
1208
- $[82] = disabled;
1209
- $[83] = isOpen;
1210
- $[84] = name;
1211
- $[85] = placeholder;
1212
- $[86] = popupRole;
1213
- $[87] = t37;
1214
- $[88] = tabIndex;
1215
- $[89] = t39;
1216
- } else t39 = $[89];
1226
+ $[88] = bodyId;
1227
+ $[89] = disabled;
1228
+ $[90] = isOpen;
1229
+ $[91] = name;
1230
+ $[92] = placeholder;
1231
+ $[93] = popupRole;
1232
+ $[94] = t37;
1233
+ $[95] = tabIndex;
1234
+ $[96] = t39;
1235
+ } else t39 = $[96];
1217
1236
  trigger = t39;
1218
1237
  } else {
1219
1238
  let t37;
1220
- if ($[90] !== bodyId || $[91] !== isOpen || $[92] !== popupRole || $[93] !== trigger) {
1239
+ if ($[97] !== bodyId || $[98] !== isOpen || $[99] !== popupRole || $[100] !== trigger) {
1221
1240
  t37 = /* @__PURE__ */ jsx("button", {
1222
1241
  "aria-controls": bodyId,
1223
1242
  "aria-expanded": isOpen,
@@ -1227,12 +1246,12 @@ function RootDropdown(t0) {
1227
1246
  type: "button",
1228
1247
  children: trigger
1229
1248
  });
1230
- $[90] = bodyId;
1231
- $[91] = isOpen;
1232
- $[92] = popupRole;
1233
- $[93] = trigger;
1234
- $[94] = t37;
1235
- } else t37 = $[94];
1249
+ $[97] = bodyId;
1250
+ $[98] = isOpen;
1251
+ $[99] = popupRole;
1252
+ $[100] = trigger;
1253
+ $[101] = t37;
1254
+ } else t37 = $[101];
1236
1255
  trigger = t37;
1237
1256
  }
1238
1257
  else {
@@ -1242,66 +1261,66 @@ function RootDropdown(t0) {
1242
1261
  const t39 = triggerProps["aria-expanded"] ?? isOpen;
1243
1262
  const t40 = triggerProps["aria-haspopup"] ?? popupRole;
1244
1263
  let t41;
1245
- if ($[95] !== t37 || $[96] !== t38 || $[97] !== t39 || $[98] !== t40) {
1264
+ if ($[102] !== t37 || $[103] !== t38 || $[104] !== t39 || $[105] !== t40) {
1246
1265
  t41 = cloneElement(t37, {
1247
1266
  "aria-controls": t38,
1248
1267
  "aria-expanded": t39,
1249
1268
  "aria-haspopup": t40
1250
1269
  });
1251
- $[95] = t37;
1252
- $[96] = t38;
1253
- $[97] = t39;
1254
- $[98] = t40;
1255
- $[99] = t41;
1256
- } else t41 = $[99];
1270
+ $[102] = t37;
1271
+ $[103] = t38;
1272
+ $[104] = t39;
1273
+ $[105] = t40;
1274
+ $[106] = t41;
1275
+ } else t41 = $[106];
1257
1276
  trigger = t41;
1258
1277
  }
1259
1278
  if (label != null) {
1260
1279
  let t37;
1261
- if ($[100] !== label) {
1280
+ if ($[107] !== label) {
1262
1281
  t37 = /* @__PURE__ */ jsx("div", {
1263
1282
  className: "uktdropdown-label-text",
1264
1283
  children: label
1265
1284
  });
1266
- $[100] = label;
1267
- $[101] = t37;
1268
- } else t37 = $[101];
1285
+ $[107] = label;
1286
+ $[108] = t37;
1287
+ } else t37 = $[108];
1269
1288
  let t38;
1270
- if ($[102] !== t37 || $[103] !== trigger) {
1289
+ if ($[109] !== t37 || $[110] !== trigger) {
1271
1290
  t38 = /* @__PURE__ */ jsxs("label", {
1272
1291
  className: "uktdropdown-label",
1273
1292
  children: [t37, trigger]
1274
1293
  });
1275
- $[102] = t37;
1276
- $[103] = trigger;
1277
- $[104] = t38;
1278
- } else t38 = $[104];
1294
+ $[109] = t37;
1295
+ $[110] = trigger;
1296
+ $[111] = t38;
1297
+ } else t38 = $[111];
1279
1298
  trigger = t38;
1280
1299
  }
1281
1300
  let t37;
1282
- if ($[105] === Symbol.for("react.memo_cache_sentinel")) {
1301
+ if ($[112] === Symbol.for("react.memo_cache_sentinel")) {
1283
1302
  t37 = /* @__PURE__ */ jsx("style", {
1284
1303
  href: "@acusti/dropdown/Dropdown",
1285
1304
  precedence: "medium",
1286
1305
  children: Dropdown_default
1287
1306
  });
1288
- $[105] = t37;
1289
- } else t37 = $[105];
1307
+ $[112] = t37;
1308
+ } else t37 = $[112];
1290
1309
  let t38;
1291
- if ($[106] !== className || $[107] !== disabled || $[108] !== isOpen || $[109] !== isSearchable) {
1310
+ if ($[113] !== className || $[114] !== disabled || $[115] !== isOpen || $[116] !== isSearchable) {
1292
1311
  t38 = clsx("uktdropdown", className, {
1293
1312
  disabled,
1294
1313
  "is-open": isOpen,
1295
1314
  "is-searchable": isSearchable
1296
1315
  });
1297
- $[106] = className;
1298
- $[107] = disabled;
1299
- $[108] = isOpen;
1300
- $[109] = isSearchable;
1301
- $[110] = t38;
1302
- } else t38 = $[110];
1316
+ $[113] = className;
1317
+ $[114] = disabled;
1318
+ $[115] = isOpen;
1319
+ $[116] = isSearchable;
1320
+ $[117] = t38;
1321
+ } else t38 = $[117];
1303
1322
  let t39;
1304
- if ($[111] !== bodyId || $[112] !== children || $[113] !== childrenCount || $[114] !== hasItems || $[115] !== isOpen || $[116] !== popupRole) {
1323
+ if ($[118] !== bodyId || $[119] !== children || $[120] !== childrenCount || $[121] !== hasItems || $[122] !== isOpen || $[123] !== popupRole) {
1305
1324
  t39 = isOpen ? /* @__PURE__ */ jsx("div", {
1306
1325
  className: clsx("uktdropdown-body", { "has-items": hasItems }),
1307
1326
  id: bodyId,
@@ -1311,21 +1330,21 @@ function RootDropdown(t0) {
1311
1330
  children: /* @__PURE__ */ jsx("div", {
1312
1331
  className: "uktdropdown-content",
1313
1332
  children: /* @__PURE__ */ jsx(DropdownContext.Provider, {
1314
- value: dropdownContextValue,
1333
+ value: hasItems ? dropdownContextValue : null,
1315
1334
  children: childrenCount > 1 ? children[1] : children
1316
1335
  })
1317
1336
  })
1318
1337
  }) : null;
1319
- $[111] = bodyId;
1320
- $[112] = children;
1321
- $[113] = childrenCount;
1322
- $[114] = hasItems;
1323
- $[115] = isOpen;
1324
- $[116] = popupRole;
1325
- $[117] = t39;
1326
- } else t39 = $[117];
1338
+ $[118] = bodyId;
1339
+ $[119] = children;
1340
+ $[120] = childrenCount;
1341
+ $[121] = hasItems;
1342
+ $[122] = isOpen;
1343
+ $[123] = popupRole;
1344
+ $[124] = t39;
1345
+ } else t39 = $[124];
1327
1346
  let t40;
1328
- if ($[118] !== handleMouseDown || $[119] !== handleMouseMove || $[120] !== handleMouseOut || $[121] !== handleMouseOver || $[122] !== handleMouseUp || $[123] !== handleRef || $[124] !== onClick || $[125] !== styleFromProps || $[126] !== t38 || $[127] !== t39 || $[128] !== trigger) {
1347
+ if ($[125] !== handleMouseDown || $[126] !== handleMouseMove || $[127] !== handleMouseOut || $[128] !== handleMouseOver || $[129] !== handleMouseUp || $[130] !== handleRef || $[131] !== onClick || $[132] !== styleFromProps || $[133] !== t38 || $[134] !== t39 || $[135] !== trigger) {
1329
1348
  t40 = /* @__PURE__ */ jsxs(Fragment, { children: [t37, /* @__PURE__ */ jsxs("div", {
1330
1349
  className: t38,
1331
1350
  onClick,
@@ -1338,19 +1357,19 @@ function RootDropdown(t0) {
1338
1357
  style: styleFromProps,
1339
1358
  children: [trigger, t39]
1340
1359
  })] });
1341
- $[118] = handleMouseDown;
1342
- $[119] = handleMouseMove;
1343
- $[120] = handleMouseOut;
1344
- $[121] = handleMouseOver;
1345
- $[122] = handleMouseUp;
1346
- $[123] = handleRef;
1347
- $[124] = onClick;
1348
- $[125] = styleFromProps;
1349
- $[126] = t38;
1350
- $[127] = t39;
1351
- $[128] = trigger;
1352
- $[129] = t40;
1353
- } else t40 = $[129];
1360
+ $[125] = handleMouseDown;
1361
+ $[126] = handleMouseMove;
1362
+ $[127] = handleMouseOut;
1363
+ $[128] = handleMouseOver;
1364
+ $[129] = handleMouseUp;
1365
+ $[130] = handleRef;
1366
+ $[131] = onClick;
1367
+ $[132] = styleFromProps;
1368
+ $[133] = t38;
1369
+ $[134] = t39;
1370
+ $[135] = trigger;
1371
+ $[136] = t40;
1372
+ } else t40 = $[136];
1354
1373
  return t40;
1355
1374
  }
1356
1375
  function _temp(ref_0) {