@octanejs/base-ui 0.1.31 → 0.1.32

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.
Files changed (201) hide show
  1. package/dist/cjs/accordion.cjs +497 -0
  2. package/dist/cjs/alert-dialog.cjs +65 -0
  3. package/dist/cjs/avatar.cjs +234 -0
  4. package/dist/cjs/button.cjs +54 -0
  5. package/dist/cjs/checkbox-group.cjs +165 -0
  6. package/dist/cjs/checkbox.cjs +475 -0
  7. package/dist/cjs/collapsible.cjs +700 -0
  8. package/dist/cjs/context-menu.cjs +257 -0
  9. package/dist/cjs/csp-provider.cjs +40 -0
  10. package/dist/cjs/dialog.cjs +741 -0
  11. package/dist/cjs/direction-provider.cjs +35 -0
  12. package/dist/cjs/field.cjs +559 -0
  13. package/dist/cjs/fieldset.cjs +101 -0
  14. package/dist/cjs/form.cjs +177 -0
  15. package/dist/cjs/index.cjs +133 -0
  16. package/dist/cjs/input.cjs +32 -0
  17. package/dist/cjs/internal.cjs +51 -0
  18. package/dist/cjs/menu.cjs +2420 -0
  19. package/dist/cjs/menubar.cjs +132 -0
  20. package/dist/cjs/merge-props.cjs +34 -0
  21. package/dist/cjs/meter.cjs +169 -0
  22. package/dist/cjs/number-field.cjs +812 -0
  23. package/dist/cjs/popover.cjs +966 -0
  24. package/dist/cjs/preview-card.cjs +632 -0
  25. package/dist/cjs/progress.cjs +206 -0
  26. package/dist/cjs/radio-group.cjs +264 -0
  27. package/dist/cjs/radio.cjs +327 -0
  28. package/dist/cjs/separator.cjs +44 -0
  29. package/dist/cjs/slider.cjs +1384 -0
  30. package/dist/cjs/switch.cjs +306 -0
  31. package/dist/cjs/tabs.cjs +727 -0
  32. package/dist/cjs/toast.cjs +1766 -0
  33. package/dist/cjs/toggle-group.cjs +118 -0
  34. package/dist/cjs/toggle.cjs +121 -0
  35. package/dist/cjs/tooltip.cjs +835 -0
  36. package/dist/cjs/unstable-use-media-query.cjs +79 -0
  37. package/dist/cjs/use-render.cjs +40 -0
  38. package/dist/cjs/utils/CSPContext.cjs +38 -0
  39. package/dist/cjs/utils/CheckboxGroupContext.cjs +40 -0
  40. package/dist/cjs/utils/CompositeRootContext.cjs +40 -0
  41. package/dist/cjs/utils/ContextMenuRootContext.cjs +42 -0
  42. package/dist/cjs/utils/DirectionContext.cjs +34 -0
  43. package/dist/cjs/utils/FloatingPortalLite.cjs +47 -0
  44. package/dist/cjs/utils/InternalBackdrop.cjs +49 -0
  45. package/dist/cjs/utils/MenubarContext.cjs +40 -0
  46. package/dist/cjs/utils/RadioGroupContext.cjs +34 -0
  47. package/dist/cjs/utils/RequestQueue.cjs +111 -0
  48. package/dist/cjs/utils/TimeoutManager.cjs +50 -0
  49. package/dist/cjs/utils/ToggleGroupContext.cjs +40 -0
  50. package/dist/cjs/utils/adaptiveOriginMiddleware.cjs +94 -0
  51. package/dist/cjs/utils/addEventListener.cjs +33 -0
  52. package/dist/cjs/utils/areArraysEqual.cjs +30 -0
  53. package/dist/cjs/utils/clamp.cjs +30 -0
  54. package/dist/cjs/utils/closePart.cjs +70 -0
  55. package/dist/cjs/utils/collapsibleOpenStateMapping.cjs +42 -0
  56. package/dist/cjs/utils/composeRefs.cjs +68 -0
  57. package/dist/cjs/utils/composite/CompositeItem.cjs +59 -0
  58. package/dist/cjs/utils/composite/CompositeList.cjs +177 -0
  59. package/dist/cjs/utils/composite/CompositeListContext.cjs +43 -0
  60. package/dist/cjs/utils/composite/CompositeRoot.cjs +118 -0
  61. package/dist/cjs/utils/composite/grid-utils.cjs +343 -0
  62. package/dist/cjs/utils/composite/gridNavigation.cjs +92 -0
  63. package/dist/cjs/utils/composite/keys.cjs +174 -0
  64. package/dist/cjs/utils/composite/list-utils.cjs +90 -0
  65. package/dist/cjs/utils/composite/useCompositeItem.cjs +63 -0
  66. package/dist/cjs/utils/composite/useCompositeListItem.cjs +104 -0
  67. package/dist/cjs/utils/composite/useCompositeRoot.cjs +263 -0
  68. package/dist/cjs/utils/constants.cjs +56 -0
  69. package/dist/cjs/utils/contains.cjs +46 -0
  70. package/dist/cjs/utils/createChangeEventDetails.cjs +92 -0
  71. package/dist/cjs/utils/dom.cjs +35 -0
  72. package/dist/cjs/utils/empty.cjs +34 -0
  73. package/dist/cjs/utils/field/FieldItemContext.cjs +34 -0
  74. package/dist/cjs/utils/field/FieldRootContext.cjs +80 -0
  75. package/dist/cjs/utils/field/FormContext.cjs +41 -0
  76. package/dist/cjs/utils/field/LabelableContext.cjs +43 -0
  77. package/dist/cjs/utils/field/LabelableProvider.cjs +115 -0
  78. package/dist/cjs/utils/field/constants.cjs +68 -0
  79. package/dist/cjs/utils/field/getCombinedFieldValidityData.cjs +36 -0
  80. package/dist/cjs/utils/field/useAriaLabelledBy.cjs +87 -0
  81. package/dist/cjs/utils/field/useFieldControlRegistration.cjs +165 -0
  82. package/dist/cjs/utils/field/useFieldValidation.cjs +285 -0
  83. package/dist/cjs/utils/field/useLabel.cjs +99 -0
  84. package/dist/cjs/utils/field/useLabelableId.cjs +105 -0
  85. package/dist/cjs/utils/field/useRegisterFieldControl.cjs +60 -0
  86. package/dist/cjs/utils/findRootOwnerId.cjs +37 -0
  87. package/dist/cjs/utils/floating/FloatingDelayGroup.cjs +219 -0
  88. package/dist/cjs/utils/floating/FloatingFocusManager.cjs +685 -0
  89. package/dist/cjs/utils/floating/FloatingPortal.cjs +230 -0
  90. package/dist/cjs/utils/floating/FloatingRootStore.cjs +87 -0
  91. package/dist/cjs/utils/floating/FloatingTree.cjs +86 -0
  92. package/dist/cjs/utils/floating/FloatingTreeStore.cjs +41 -0
  93. package/dist/cjs/utils/floating/FocusGuard.cjs +54 -0
  94. package/dist/cjs/utils/floating/composite.cjs +42 -0
  95. package/dist/cjs/utils/floating/constants.cjs +34 -0
  96. package/dist/cjs/utils/floating/createAttribute.cjs +30 -0
  97. package/dist/cjs/utils/floating/createEventEmitter.cjs +44 -0
  98. package/dist/cjs/utils/floating/element.cjs +103 -0
  99. package/dist/cjs/utils/floating/enqueueFocus.cjs +51 -0
  100. package/dist/cjs/utils/floating/event.cjs +65 -0
  101. package/dist/cjs/utils/floating/getEmptyRootContext.cjs +42 -0
  102. package/dist/cjs/utils/floating/gridNavigation.cjs +45 -0
  103. package/dist/cjs/utils/floating/markOthers.cjs +181 -0
  104. package/dist/cjs/utils/floating/nodes.cjs +48 -0
  105. package/dist/cjs/utils/floating/safePolygon.cjs +301 -0
  106. package/dist/cjs/utils/floating/tabbable.cjs +242 -0
  107. package/dist/cjs/utils/floating/types.cjs +16 -0
  108. package/dist/cjs/utils/floating/useClick.cjs +153 -0
  109. package/dist/cjs/utils/floating/useClientPoint.cjs +225 -0
  110. package/dist/cjs/utils/floating/useDismiss.cjs +506 -0
  111. package/dist/cjs/utils/floating/useFloating.cjs +186 -0
  112. package/dist/cjs/utils/floating/useFloatingRootContext.cjs +75 -0
  113. package/dist/cjs/utils/floating/useFocus.cjs +184 -0
  114. package/dist/cjs/utils/floating/useHoverFloatingInteraction.cjs +231 -0
  115. package/dist/cjs/utils/floating/useHoverInteractionSharedState.cjs +113 -0
  116. package/dist/cjs/utils/floating/useHoverReferenceInteraction.cjs +380 -0
  117. package/dist/cjs/utils/floating/useHoverShared.cjs +65 -0
  118. package/dist/cjs/utils/floating/useListNavigation.cjs +665 -0
  119. package/dist/cjs/utils/floating/useSyncedFloatingRootContext.cjs +91 -0
  120. package/dist/cjs/utils/floating/useTypeahead.cjs +187 -0
  121. package/dist/cjs/utils/formatNumber.cjs +60 -0
  122. package/dist/cjs/utils/generateId.cjs +32 -0
  123. package/dist/cjs/utils/getCssDimensions.cjs +42 -0
  124. package/dist/cjs/utils/getDefaultFormSubmitter.cjs +42 -0
  125. package/dist/cjs/utils/getDisabledMountTransitionStyles.cjs +32 -0
  126. package/dist/cjs/utils/getElementRef.cjs +35 -0
  127. package/dist/cjs/utils/getPseudoElementBounds.cjs +56 -0
  128. package/dist/cjs/utils/getStateAttributesProps.cjs +46 -0
  129. package/dist/cjs/utils/hideMiddleware.cjs +42 -0
  130. package/dist/cjs/utils/inertValue.cjs +30 -0
  131. package/dist/cjs/utils/matchesFocusVisible.cjs +38 -0
  132. package/dist/cjs/utils/mergeCleanups.cjs +37 -0
  133. package/dist/cjs/utils/mergeObjects.cjs +39 -0
  134. package/dist/cjs/utils/mergeProps.cjs +182 -0
  135. package/dist/cjs/utils/noop.cjs +29 -0
  136. package/dist/cjs/utils/number/constants.cjs +34 -0
  137. package/dist/cjs/utils/number/parse.cjs +258 -0
  138. package/dist/cjs/utils/number/types.cjs +16 -0
  139. package/dist/cjs/utils/number/validate.cjs +104 -0
  140. package/dist/cjs/utils/owner.cjs +35 -0
  141. package/dist/cjs/utils/platform.cjs +83 -0
  142. package/dist/cjs/utils/popupStateMapping.cjs +74 -0
  143. package/dist/cjs/utils/popups/index.cjs +39 -0
  144. package/dist/cjs/utils/popups/inlineRect.cjs +218 -0
  145. package/dist/cjs/utils/popups/popupStoreUtils.cjs +379 -0
  146. package/dist/cjs/utils/popups/popupTriggerMap.cjs +76 -0
  147. package/dist/cjs/utils/popups/store.cjs +118 -0
  148. package/dist/cjs/utils/popups/useTriggerFocusGuards.cjs +72 -0
  149. package/dist/cjs/utils/resolveAriaLabelledBy.cjs +35 -0
  150. package/dist/cjs/utils/resolveClassName.cjs +30 -0
  151. package/dist/cjs/utils/resolveRef.cjs +33 -0
  152. package/dist/cjs/utils/resolveStyle.cjs +30 -0
  153. package/dist/cjs/utils/serializeValue.cjs +40 -0
  154. package/dist/cjs/utils/slider/asc.cjs +30 -0
  155. package/dist/cjs/utils/slider/getMidpoint.cjs +34 -0
  156. package/dist/cjs/utils/slider/getPushedThumbValues.cjs +73 -0
  157. package/dist/cjs/utils/slider/getSliderValue.cjs +42 -0
  158. package/dist/cjs/utils/slider/replaceArrayItemAtIndex.cjs +33 -0
  159. package/dist/cjs/utils/slider/resolveThumbCollision.cjs +155 -0
  160. package/dist/cjs/utils/slider/roundValueToStep.cjs +45 -0
  161. package/dist/cjs/utils/slider/validateMinimumDistance.cjs +40 -0
  162. package/dist/cjs/utils/slider/valueArrayToPercentages.cjs +36 -0
  163. package/dist/cjs/utils/store/ReactStore.cjs +135 -0
  164. package/dist/cjs/utils/store/Store.cjs +83 -0
  165. package/dist/cjs/utils/store/createSelector.cjs +74 -0
  166. package/dist/cjs/utils/store/useStore.cjs +51 -0
  167. package/dist/cjs/utils/stringifyLocale.cjs +36 -0
  168. package/dist/cjs/utils/useAnchorPositioning.cjs +421 -0
  169. package/dist/cjs/utils/useAnchoredPopupScrollLock.cjs +59 -0
  170. package/dist/cjs/utils/useAnimationFrame.cjs +93 -0
  171. package/dist/cjs/utils/useAnimationsFinished.cjs +98 -0
  172. package/dist/cjs/utils/useBaseUiId.cjs +36 -0
  173. package/dist/cjs/utils/useButton.cjs +177 -0
  174. package/dist/cjs/utils/useCheckboxGroupParent.cjs +114 -0
  175. package/dist/cjs/utils/useControlled.cjs +47 -0
  176. package/dist/cjs/utils/useEnhancedClickHandler.cjs +60 -0
  177. package/dist/cjs/utils/useFocusableWhenDisabled.cjs +77 -0
  178. package/dist/cjs/utils/useForcedRerendering.cjs +35 -0
  179. package/dist/cjs/utils/useIsHydrating.cjs +44 -0
  180. package/dist/cjs/utils/useMixedToggleClickHandler.cjs +66 -0
  181. package/dist/cjs/utils/useOnFirstRender.cjs +35 -0
  182. package/dist/cjs/utils/useOnMount.cjs +36 -0
  183. package/dist/cjs/utils/useOpenChangeComplete.cjs +57 -0
  184. package/dist/cjs/utils/useOpenInteractionType.cjs +69 -0
  185. package/dist/cjs/utils/usePopupAutoResize.cjs +191 -0
  186. package/dist/cjs/utils/usePopupViewport.cjs +283 -0
  187. package/dist/cjs/utils/usePositioner.cjs +53 -0
  188. package/dist/cjs/utils/usePressAndHold.cjs +51 -0
  189. package/dist/cjs/utils/usePreviousValue.cjs +47 -0
  190. package/dist/cjs/utils/useRefWithInit.cjs +41 -0
  191. package/dist/cjs/utils/useRegisteredLabelId.cjs +48 -0
  192. package/dist/cjs/utils/useRenderElement.cjs +106 -0
  193. package/dist/cjs/utils/useScrollLock.cjs +232 -0
  194. package/dist/cjs/utils/useStableCallback.cjs +41 -0
  195. package/dist/cjs/utils/useTimeout.cjs +66 -0
  196. package/dist/cjs/utils/useTransitionStatus.cjs +116 -0
  197. package/dist/cjs/utils/useValueAsRef.cjs +43 -0
  198. package/dist/cjs/utils/useValueChanged.cjs +55 -0
  199. package/dist/cjs/utils/valueToPercent.cjs +30 -0
  200. package/dist/cjs/utils/visuallyHidden.cjs +49 -0
  201. package/package.json +20 -8
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var keys_exports = {};
20
+ __export(keys_exports, {
21
+ ACTIVE_COMPOSITE_ITEM: () => ACTIVE_COMPOSITE_ITEM,
22
+ ALT: () => ALT,
23
+ ARROW_DOWN: () => ARROW_DOWN,
24
+ ARROW_KEYS: () => ARROW_KEYS,
25
+ ARROW_LEFT: () => ARROW_LEFT,
26
+ ARROW_RIGHT: () => ARROW_RIGHT,
27
+ ARROW_UP: () => ARROW_UP,
28
+ COMPOSITE_KEYS: () => COMPOSITE_KEYS,
29
+ CONTROL: () => CONTROL,
30
+ END: () => END,
31
+ HOME: () => HOME,
32
+ HORIZONTAL_KEYS: () => HORIZONTAL_KEYS,
33
+ HORIZONTAL_KEYS_WITH_EXTRA_KEYS: () => HORIZONTAL_KEYS_WITH_EXTRA_KEYS,
34
+ META: () => META,
35
+ MODIFIER_KEYS: () => MODIFIER_KEYS,
36
+ PAGE_DOWN: () => PAGE_DOWN,
37
+ PAGE_UP: () => PAGE_UP,
38
+ SHIFT: () => SHIFT,
39
+ VERTICAL_KEYS: () => VERTICAL_KEYS,
40
+ VERTICAL_KEYS_WITH_EXTRA_KEYS: () => VERTICAL_KEYS_WITH_EXTRA_KEYS,
41
+ isElementDisabled: () => isElementDisabled,
42
+ isNativeInput: () => isNativeInput,
43
+ scrollIntoViewIfNeeded: () => scrollIntoViewIfNeeded
44
+ });
45
+ module.exports = __toCommonJS(keys_exports);
46
+ const ACTIVE_COMPOSITE_ITEM = "data-composite-item-active";
47
+ const ARROW_UP = "ArrowUp";
48
+ const ARROW_DOWN = "ArrowDown";
49
+ const ARROW_LEFT = "ArrowLeft";
50
+ const ARROW_RIGHT = "ArrowRight";
51
+ const HOME = "Home";
52
+ const END = "End";
53
+ const PAGE_UP = "PageUp";
54
+ const PAGE_DOWN = "PageDown";
55
+ const HORIZONTAL_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT, ARROW_RIGHT]);
56
+ const HORIZONTAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT, ARROW_RIGHT, HOME, END]);
57
+ const VERTICAL_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN]);
58
+ const VERTICAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN, HOME, END]);
59
+ const ARROW_KEYS = /* @__PURE__ */ new Set([...HORIZONTAL_KEYS, ...VERTICAL_KEYS]);
60
+ const COMPOSITE_KEYS = /* @__PURE__ */ new Set([...ARROW_KEYS, HOME, END]);
61
+ const SHIFT = "Shift";
62
+ const CONTROL = "Control";
63
+ const ALT = "Alt";
64
+ const META = "Meta";
65
+ const MODIFIER_KEYS = /* @__PURE__ */ new Set([SHIFT, CONTROL, ALT, META]);
66
+ function isHTMLElement(el) {
67
+ return el != null && el instanceof HTMLElement;
68
+ }
69
+ function isInputElement(element) {
70
+ return isHTMLElement(element) && element.tagName === "INPUT";
71
+ }
72
+ function isNativeInput(element) {
73
+ if (isInputElement(element) && element.selectionStart != null) {
74
+ return true;
75
+ }
76
+ if (isHTMLElement(element) && element.tagName === "TEXTAREA") {
77
+ return true;
78
+ }
79
+ return false;
80
+ }
81
+ function isElementDisabled(element) {
82
+ return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
83
+ }
84
+ function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {
85
+ if (!scrollContainer || !element || !element.scrollTo) {
86
+ return;
87
+ }
88
+ let targetX = scrollContainer.scrollLeft;
89
+ let targetY = scrollContainer.scrollTop;
90
+ const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;
91
+ const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;
92
+ if (isOverflowingX && orientation !== "vertical") {
93
+ const elementOffsetLeft = getOffset(scrollContainer, element, "left");
94
+ const containerStyles = getStyles(scrollContainer);
95
+ const elementStyles = getStyles(element);
96
+ if (direction === "ltr") {
97
+ if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {
98
+ targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
99
+ } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {
100
+ targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
101
+ }
102
+ }
103
+ if (direction === "rtl") {
104
+ if (elementOffsetLeft - elementStyles.scrollMarginRight < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {
105
+ targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
106
+ } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {
107
+ targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
108
+ }
109
+ }
110
+ }
111
+ if (isOverflowingY && orientation !== "horizontal") {
112
+ const elementOffsetTop = getOffset(scrollContainer, element, "top");
113
+ const containerStyles = getStyles(scrollContainer);
114
+ const elementStyles = getStyles(element);
115
+ if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {
116
+ targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;
117
+ } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {
118
+ targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;
119
+ }
120
+ }
121
+ scrollContainer.scrollTo({ left: targetX, top: targetY, behavior: "auto" });
122
+ }
123
+ function getOffset(ancestor, element, side) {
124
+ const propName = side === "left" ? "offsetLeft" : "offsetTop";
125
+ let result = 0;
126
+ let el = element;
127
+ while (el.offsetParent) {
128
+ result += el[propName];
129
+ if (el.offsetParent === ancestor) {
130
+ break;
131
+ }
132
+ el = el.offsetParent;
133
+ }
134
+ return result;
135
+ }
136
+ function getStyles(element) {
137
+ const styles = getComputedStyle(element);
138
+ return {
139
+ scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,
140
+ scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,
141
+ scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,
142
+ scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,
143
+ scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,
144
+ scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,
145
+ scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,
146
+ scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0
147
+ };
148
+ }
149
+ // Annotate the CommonJS export names for ESM import in node:
150
+ 0 && (module.exports = {
151
+ ACTIVE_COMPOSITE_ITEM,
152
+ ALT,
153
+ ARROW_DOWN,
154
+ ARROW_KEYS,
155
+ ARROW_LEFT,
156
+ ARROW_RIGHT,
157
+ ARROW_UP,
158
+ COMPOSITE_KEYS,
159
+ CONTROL,
160
+ END,
161
+ HOME,
162
+ HORIZONTAL_KEYS,
163
+ HORIZONTAL_KEYS_WITH_EXTRA_KEYS,
164
+ META,
165
+ MODIFIER_KEYS,
166
+ PAGE_DOWN,
167
+ PAGE_UP,
168
+ SHIFT,
169
+ VERTICAL_KEYS,
170
+ VERTICAL_KEYS_WITH_EXTRA_KEYS,
171
+ isElementDisabled,
172
+ isNativeInput,
173
+ scrollIntoViewIfNeeded
174
+ });
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var list_utils_exports = {};
20
+ __export(list_utils_exports, {
21
+ findNonDisabledListIndex: () => findNonDisabledListIndex,
22
+ getMaxListIndex: () => getMaxListIndex,
23
+ getMinListIndex: () => getMinListIndex,
24
+ getTarget: () => getTarget,
25
+ isDifferentGridRow: () => isDifferentGridRow,
26
+ isIndexOutOfListBounds: () => isIndexOutOfListBounds,
27
+ isListIndexDisabled: () => isListIndexDisabled,
28
+ stopEvent: () => stopEvent
29
+ });
30
+ module.exports = __toCommonJS(list_utils_exports);
31
+ var import_composite = require("../floating/composite.cjs");
32
+ function getTarget(event) {
33
+ if ("composedPath" in event) {
34
+ return event.composedPath()[0];
35
+ }
36
+ return event.target;
37
+ }
38
+ function stopEvent(event) {
39
+ event.preventDefault();
40
+ event.stopPropagation();
41
+ }
42
+ function isDifferentGridRow(index, cols, prevRow) {
43
+ return Math.floor(index / cols) !== prevRow;
44
+ }
45
+ function isIndexOutOfListBounds(list, index) {
46
+ return index < 0 || index >= list.length;
47
+ }
48
+ function isListIndexDisabled(list, index, disabledIndices) {
49
+ const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;
50
+ if (isExplicitlyDisabled) {
51
+ return true;
52
+ }
53
+ const element = list[index];
54
+ if (!element) {
55
+ return false;
56
+ }
57
+ if (!(0, import_composite.isElementVisible)(element)) {
58
+ return true;
59
+ }
60
+ return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true");
61
+ }
62
+ function findNonDisabledListIndex(list, options = {}) {
63
+ const { startingIndex = -1, decrement = false, disabledIndices, amount = 1 } = options;
64
+ let index = startingIndex;
65
+ do {
66
+ index += decrement ? -amount : amount;
67
+ } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));
68
+ return index;
69
+ }
70
+ function getMinListIndex(listRef, disabledIndices) {
71
+ return findNonDisabledListIndex(listRef.current, { disabledIndices });
72
+ }
73
+ function getMaxListIndex(listRef, disabledIndices) {
74
+ return findNonDisabledListIndex(listRef.current, {
75
+ decrement: true,
76
+ startingIndex: listRef.current.length,
77
+ disabledIndices
78
+ });
79
+ }
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ findNonDisabledListIndex,
83
+ getMaxListIndex,
84
+ getMinListIndex,
85
+ getTarget,
86
+ isDifferentGridRow,
87
+ isIndexOutOfListBounds,
88
+ isListIndexDisabled,
89
+ stopEvent
90
+ });
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useCompositeItem_exports = {};
20
+ __export(useCompositeItem_exports, {
21
+ useCompositeItem: () => useCompositeItem
22
+ });
23
+ module.exports = __toCommonJS(useCompositeItem_exports);
24
+ var import_octane = require("octane");
25
+ var import_internal = require("../../internal.cjs");
26
+ var import_composeRefs = require("../composeRefs.cjs");
27
+ var import_CompositeRootContext = require("../CompositeRootContext.cjs");
28
+ var import_useCompositeListItem = require("./useCompositeListItem.cjs");
29
+ function useCompositeItem(...args) {
30
+ const [user, slotArg] = (0, import_internal.splitSlot)(args);
31
+ const slot = slotArg ?? (0, import_internal.S)("useCompositeItem");
32
+ const params = user[0] ?? {};
33
+ const { highlightItemOnHover, highlightedIndex, onHighlightedIndexChange } = (0, import_CompositeRootContext.useCompositeRootContext)();
34
+ const { ref, index } = (0, import_useCompositeListItem.useCompositeListItem)(params, (0, import_internal.subSlot)(slot, "li"));
35
+ const isHighlighted = highlightedIndex === index;
36
+ const itemRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "itemRef"));
37
+ const mergedRef = (0, import_composeRefs.useComposedRefs)(ref, itemRef, (0, import_internal.subSlot)(slot, "merged"));
38
+ const compositeProps = {
39
+ tabIndex: isHighlighted ? 0 : -1,
40
+ onFocus() {
41
+ onHighlightedIndexChange(index);
42
+ },
43
+ onMouseMove() {
44
+ const item = itemRef.current;
45
+ if (!highlightItemOnHover || !item) {
46
+ return;
47
+ }
48
+ const disabled = item.hasAttribute("disabled") || item.ariaDisabled === "true";
49
+ if (!isHighlighted && !disabled) {
50
+ item.focus();
51
+ }
52
+ }
53
+ };
54
+ return {
55
+ compositeProps,
56
+ compositeRef: mergedRef,
57
+ index
58
+ };
59
+ }
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ useCompositeItem
63
+ });
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useCompositeListItem_exports = {};
20
+ __export(useCompositeListItem_exports, {
21
+ IndexGuessBehavior: () => IndexGuessBehavior,
22
+ useCompositeListItem: () => useCompositeListItem
23
+ });
24
+ module.exports = __toCommonJS(useCompositeListItem_exports);
25
+ var import_octane = require("octane");
26
+ var import_internal = require("../../internal.cjs");
27
+ var import_CompositeListContext = require("./CompositeListContext.cjs");
28
+ var IndexGuessBehavior = /* @__PURE__ */ ((IndexGuessBehavior2) => {
29
+ IndexGuessBehavior2[IndexGuessBehavior2["None"] = 0] = "None";
30
+ IndexGuessBehavior2[IndexGuessBehavior2["GuessFromOrder"] = 1] = "GuessFromOrder";
31
+ return IndexGuessBehavior2;
32
+ })(IndexGuessBehavior || {});
33
+ function useCompositeListItem(...args) {
34
+ const [user, slotArg] = (0, import_internal.splitSlot)(args);
35
+ const slot = slotArg ?? (0, import_internal.S)("useCompositeListItem");
36
+ const params = user[0] ?? {};
37
+ const { label, metadata, textRef, indexGuessBehavior, index: externalIndex } = params;
38
+ const { register, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef } = (0, import_CompositeListContext.useCompositeListContext)();
39
+ const indexRef = (0, import_octane.useRef)(-1, (0, import_internal.subSlot)(slot, "idxRef"));
40
+ const [index, setIndex] = (0, import_octane.useState)(
41
+ externalIndex ?? (indexGuessBehavior === 1 /* GuessFromOrder */ ? () => {
42
+ if (indexRef.current === -1) {
43
+ const newIndex = nextIndexRef.current;
44
+ nextIndexRef.current += 1;
45
+ indexRef.current = newIndex;
46
+ }
47
+ return indexRef.current;
48
+ } : -1),
49
+ (0, import_internal.subSlot)(slot, "idx")
50
+ );
51
+ const componentRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "node"));
52
+ const ref = (0, import_octane.useCallback)(
53
+ (node) => {
54
+ componentRef.current = node;
55
+ if (index !== -1 && node !== null) {
56
+ elementsRef.current[index] = node;
57
+ if (labelsRef) {
58
+ const isLabelDefined = label !== void 0;
59
+ labelsRef.current[index] = isLabelDefined ? label : textRef?.current?.textContent ?? node.textContent;
60
+ }
61
+ }
62
+ },
63
+ [index, elementsRef, labelsRef, label, textRef],
64
+ (0, import_internal.subSlot)(slot, "ref")
65
+ );
66
+ (0, import_octane.useLayoutEffect)(
67
+ () => {
68
+ if (externalIndex != null) {
69
+ return void 0;
70
+ }
71
+ const node = componentRef.current;
72
+ if (node) {
73
+ register(node, metadata);
74
+ return () => {
75
+ unregister(node);
76
+ };
77
+ }
78
+ return void 0;
79
+ },
80
+ [externalIndex, register, unregister, metadata],
81
+ (0, import_internal.subSlot)(slot, "e:reg")
82
+ );
83
+ (0, import_octane.useLayoutEffect)(
84
+ () => {
85
+ if (externalIndex != null) {
86
+ return void 0;
87
+ }
88
+ return subscribeMapChange((map) => {
89
+ const i = componentRef.current ? map.get(componentRef.current)?.index : null;
90
+ if (i != null) {
91
+ setIndex(i);
92
+ }
93
+ });
94
+ },
95
+ [externalIndex, subscribeMapChange, setIndex],
96
+ (0, import_internal.subSlot)(slot, "e:sub")
97
+ );
98
+ return { ref, index };
99
+ }
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ IndexGuessBehavior,
103
+ useCompositeListItem
104
+ });
@@ -0,0 +1,263 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useCompositeRoot_exports = {};
20
+ __export(useCompositeRoot_exports, {
21
+ useCompositeRoot: () => useCompositeRoot
22
+ });
23
+ module.exports = __toCommonJS(useCompositeRoot_exports);
24
+ var import_octane = require("octane");
25
+ var import_internal = require("../../internal.cjs");
26
+ var import_useStableCallback = require("../useStableCallback.cjs");
27
+ var import_composeRefs = require("../composeRefs.cjs");
28
+ var import_keys = require("./keys.cjs");
29
+ var import_list_utils = require("./list-utils.cjs");
30
+ const EMPTY_ARRAY = [];
31
+ function isModifierKeySet(event, ignoredModifierKeys) {
32
+ for (const key of import_keys.MODIFIER_KEYS.values()) {
33
+ if (ignoredModifierKeys.includes(key)) {
34
+ continue;
35
+ }
36
+ if (event.getModifierState(key)) {
37
+ return true;
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+ function useCompositeRoot(...args) {
43
+ const [user, slotArg] = (0, import_internal.splitSlot)(args);
44
+ const slot = slotArg ?? (0, import_internal.S)("useCompositeRoot");
45
+ const params = user[0];
46
+ const {
47
+ loopFocus = true,
48
+ orientation = "both",
49
+ grid,
50
+ onLoop,
51
+ direction,
52
+ highlightedIndex: externalHighlightedIndex,
53
+ onHighlightedIndexChange: externalSetHighlightedIndex,
54
+ rootRef: externalRef,
55
+ enableHomeAndEndKeys = false,
56
+ stopEventPropagation = false,
57
+ disabledIndices,
58
+ modifierKeys = EMPTY_ARRAY
59
+ } = params;
60
+ const [internalHighlightedIndex, internalSetHighlightedIndex] = (0, import_octane.useState)(0, (0, import_internal.subSlot)(slot, "hi"));
61
+ const isGrid = grid != null;
62
+ const rootRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "root"));
63
+ const mergedRef = (0, import_composeRefs.useComposedRefs)(rootRef, externalRef, (0, import_internal.subSlot)(slot, "merged"));
64
+ const elementsRef = (0, import_octane.useRef)([], (0, import_internal.subSlot)(slot, "els"));
65
+ const hasSetDefaultIndexRef = (0, import_octane.useRef)(false, (0, import_internal.subSlot)(slot, "hasSet"));
66
+ const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;
67
+ const onHighlightedIndexChange = (0, import_useStableCallback.useStableCallback)(
68
+ (index, shouldScrollIntoView = false) => {
69
+ (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);
70
+ if (shouldScrollIntoView) {
71
+ const newActiveItem = elementsRef.current[index];
72
+ (0, import_keys.scrollIntoViewIfNeeded)(rootRef.current, newActiveItem, direction, orientation);
73
+ }
74
+ },
75
+ (0, import_internal.subSlot)(slot, "ohic")
76
+ );
77
+ const onMapChange = (0, import_useStableCallback.useStableCallback)(
78
+ (map) => {
79
+ if (map.size === 0 || hasSetDefaultIndexRef.current) {
80
+ return;
81
+ }
82
+ hasSetDefaultIndexRef.current = true;
83
+ const sortedElements = Array.from(map.keys());
84
+ const activeItem = sortedElements.find(
85
+ (compositeElement) => compositeElement?.hasAttribute(import_keys.ACTIVE_COMPOSITE_ITEM)
86
+ ) ?? null;
87
+ const activeIndex = activeItem ? sortedElements.indexOf(activeItem) : -1;
88
+ if (activeIndex !== -1) {
89
+ onHighlightedIndexChange(activeIndex);
90
+ } else if ((0, import_list_utils.isListIndexDisabled)(sortedElements, highlightedIndex, disabledIndices)) {
91
+ const firstEnabledIndex = (0, import_list_utils.findNonDisabledListIndex)(sortedElements, { disabledIndices });
92
+ if (!(0, import_list_utils.isIndexOutOfListBounds)(sortedElements, firstEnabledIndex)) {
93
+ onHighlightedIndexChange(firstEnabledIndex);
94
+ }
95
+ }
96
+ (0, import_keys.scrollIntoViewIfNeeded)(rootRef.current, activeItem, direction, orientation);
97
+ },
98
+ (0, import_internal.subSlot)(slot, "omc")
99
+ );
100
+ (0, import_octane.useLayoutEffect)(
101
+ () => {
102
+ if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) {
103
+ return;
104
+ }
105
+ const elements = elementsRef.current;
106
+ if ((0, import_list_utils.isListIndexDisabled)(elements, highlightedIndex, disabledIndices)) {
107
+ const firstEnabledIndex = (0, import_list_utils.findNonDisabledListIndex)(elements, { disabledIndices });
108
+ if (!(0, import_list_utils.isIndexOutOfListBounds)(elements, firstEnabledIndex)) {
109
+ onHighlightedIndexChange(firstEnabledIndex);
110
+ }
111
+ }
112
+ },
113
+ [
114
+ disabledIndices,
115
+ externalHighlightedIndex,
116
+ highlightedIndex,
117
+ elementsRef,
118
+ onHighlightedIndexChange
119
+ ],
120
+ (0, import_internal.subSlot)(slot, "e:validate")
121
+ );
122
+ const onKeyDown = (0, import_useStableCallback.useStableCallback)(
123
+ (event) => {
124
+ const RELEVANT_KEYS = enableHomeAndEndKeys ? import_keys.COMPOSITE_KEYS : import_keys.ARROW_KEYS;
125
+ if (!RELEVANT_KEYS.has(event.key)) {
126
+ return;
127
+ }
128
+ if (isModifierKeySet(event, modifierKeys)) {
129
+ return;
130
+ }
131
+ const element = rootRef.current;
132
+ if (!element) {
133
+ return;
134
+ }
135
+ const isRtl = direction === "rtl";
136
+ const horizontalForwardKey = isRtl ? import_keys.ARROW_LEFT : import_keys.ARROW_RIGHT;
137
+ const forwardKey = {
138
+ horizontal: horizontalForwardKey,
139
+ vertical: import_keys.ARROW_DOWN,
140
+ both: horizontalForwardKey
141
+ }[orientation];
142
+ const horizontalBackwardKey = isRtl ? import_keys.ARROW_RIGHT : import_keys.ARROW_LEFT;
143
+ const backwardKey = {
144
+ horizontal: horizontalBackwardKey,
145
+ vertical: import_keys.ARROW_UP,
146
+ both: horizontalBackwardKey
147
+ }[orientation];
148
+ const target = (0, import_list_utils.getTarget)(event);
149
+ if (target != null && (0, import_keys.isNativeInput)(target) && !(0, import_keys.isElementDisabled)(target)) {
150
+ const input = target;
151
+ const selectionStart = input.selectionStart;
152
+ const selectionEnd = input.selectionEnd;
153
+ const textContent = input.value ?? "";
154
+ if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) {
155
+ return;
156
+ }
157
+ if (event.key !== backwardKey && selectionStart < textContent.length) {
158
+ return;
159
+ }
160
+ if (event.key !== forwardKey && selectionStart > 0) {
161
+ return;
162
+ }
163
+ }
164
+ let nextIndex = highlightedIndex;
165
+ const minIndex = (0, import_list_utils.getMinListIndex)(elementsRef, disabledIndices);
166
+ const maxIndex = (0, import_list_utils.getMaxListIndex)(elementsRef, disabledIndices);
167
+ if (grid != null) {
168
+ nextIndex = grid({
169
+ disabledIndices,
170
+ elementsRef,
171
+ event,
172
+ highlightedIndex,
173
+ loopFocus,
174
+ maxIndex,
175
+ minIndex,
176
+ onLoop: (e, prev, next) => onLoop ? onLoop(e, prev, next, elementsRef) : next,
177
+ orientation,
178
+ rtl: isRtl
179
+ });
180
+ }
181
+ const forwardKeys = {
182
+ horizontal: [horizontalForwardKey],
183
+ vertical: [import_keys.ARROW_DOWN],
184
+ both: [horizontalForwardKey, import_keys.ARROW_DOWN]
185
+ }[orientation];
186
+ const backwardKeys = {
187
+ horizontal: [horizontalBackwardKey],
188
+ vertical: [import_keys.ARROW_UP],
189
+ both: [horizontalBackwardKey, import_keys.ARROW_UP]
190
+ }[orientation];
191
+ const preventedKeys = isGrid ? RELEVANT_KEYS : {
192
+ horizontal: enableHomeAndEndKeys ? import_keys.HORIZONTAL_KEYS_WITH_EXTRA_KEYS : import_keys.HORIZONTAL_KEYS,
193
+ vertical: enableHomeAndEndKeys ? import_keys.VERTICAL_KEYS_WITH_EXTRA_KEYS : import_keys.VERTICAL_KEYS,
194
+ both: RELEVANT_KEYS
195
+ }[orientation];
196
+ if (enableHomeAndEndKeys) {
197
+ if (event.key === import_keys.HOME) {
198
+ nextIndex = minIndex;
199
+ } else if (event.key === import_keys.END) {
200
+ nextIndex = maxIndex;
201
+ }
202
+ }
203
+ if (nextIndex === highlightedIndex && (forwardKeys.includes(event.key) || backwardKeys.includes(event.key))) {
204
+ if (loopFocus && nextIndex === maxIndex && forwardKeys.includes(event.key)) {
205
+ nextIndex = minIndex;
206
+ if (onLoop) {
207
+ nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
208
+ }
209
+ } else if (loopFocus && nextIndex === minIndex && backwardKeys.includes(event.key)) {
210
+ nextIndex = maxIndex;
211
+ if (onLoop) {
212
+ nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
213
+ }
214
+ } else {
215
+ nextIndex = (0, import_list_utils.findNonDisabledListIndex)(elementsRef.current, {
216
+ startingIndex: nextIndex,
217
+ decrement: backwardKeys.includes(event.key),
218
+ disabledIndices
219
+ });
220
+ }
221
+ }
222
+ if (nextIndex !== highlightedIndex && !(0, import_list_utils.isIndexOutOfListBounds)(elementsRef.current, nextIndex)) {
223
+ if (stopEventPropagation) {
224
+ event.stopPropagation();
225
+ }
226
+ if (preventedKeys.has(event.key)) {
227
+ event.preventDefault();
228
+ }
229
+ onHighlightedIndexChange(nextIndex, true);
230
+ queueMicrotask(() => {
231
+ elementsRef.current[nextIndex]?.focus();
232
+ });
233
+ }
234
+ },
235
+ (0, import_internal.subSlot)(slot, "okd")
236
+ );
237
+ const props = {
238
+ ref: mergedRef,
239
+ onFocus(event) {
240
+ const element = rootRef.current;
241
+ const target = (0, import_list_utils.getTarget)(event);
242
+ if (!element || target == null || !(0, import_keys.isNativeInput)(target)) {
243
+ return;
244
+ }
245
+ const input = target;
246
+ input.setSelectionRange(0, input.value.length ?? 0);
247
+ },
248
+ onKeyDown
249
+ };
250
+ return {
251
+ props,
252
+ highlightedIndex,
253
+ onHighlightedIndexChange,
254
+ elementsRef,
255
+ disabledIndices,
256
+ onMapChange,
257
+ relayKeyboardEvent: onKeyDown
258
+ };
259
+ }
260
+ // Annotate the CommonJS export names for ESM import in node:
261
+ 0 && (module.exports = {
262
+ useCompositeRoot
263
+ });