@octanejs/base-ui 0.1.31 → 0.1.33

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,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 validate_exports = {};
20
+ __export(validate_exports, {
21
+ hasNumberFormatRoundingOptions: () => hasNumberFormatRoundingOptions,
22
+ removeFloatingPointErrors: () => removeFloatingPointErrors,
23
+ toValidatedNumber: () => toValidatedNumber
24
+ });
25
+ module.exports = __toCommonJS(validate_exports);
26
+ var import_clamp = require("../clamp.cjs");
27
+ var import_formatNumber = require("../formatNumber.cjs");
28
+ var import_parse = require("./parse.cjs");
29
+ const STEP_EPSILON_FACTOR = 1e-10;
30
+ const MAX_FLOATING_POINT_CLEANUP_DELTA = 1e-10;
31
+ function hasNumberFormatRoundingOptions(format) {
32
+ return format?.maximumFractionDigits != null || format?.minimumFractionDigits != null || format?.maximumSignificantDigits != null || format?.minimumSignificantDigits != null || format?.roundingIncrement != null || format?.roundingMode != null || format?.roundingPriority != null;
33
+ }
34
+ function removeFloatingPointErrors(value, format) {
35
+ if (!Number.isFinite(value)) {
36
+ return value;
37
+ }
38
+ if (!hasNumberFormatRoundingOptions(format)) {
39
+ const roundedValue2 = parseFloat(value.toPrecision(15));
40
+ const cleanupDelta = Math.abs(roundedValue2 - value);
41
+ const cleanupTolerance = Math.min(
42
+ Number.EPSILON * Math.max(1, Math.abs(value)),
43
+ MAX_FLOATING_POINT_CLEANUP_DELTA
44
+ );
45
+ return cleanupDelta <= cleanupTolerance ? roundedValue2 : value;
46
+ }
47
+ const formatter = (0, import_formatNumber.getFormatter)("en-US", {
48
+ ...format,
49
+ signDisplay: "auto",
50
+ currencySign: "standard",
51
+ notation: format.notation === "compact" ? "standard" : format.notation,
52
+ useGrouping: false
53
+ });
54
+ const roundedText = formatter.format(value);
55
+ const roundedValue = (0, import_parse.parseNumber)(roundedText, "en-US", format);
56
+ if (roundedValue === null) {
57
+ return value;
58
+ }
59
+ return formatter.format(roundedValue) === roundedText ? roundedValue : value;
60
+ }
61
+ function snapToStep(value, base, step, mode = "directional") {
62
+ const stepSize = Math.abs(step);
63
+ const direction = Math.sign(step);
64
+ const tolerance = stepSize * STEP_EPSILON_FACTOR * direction;
65
+ const rawSteps = value - base + tolerance;
66
+ if (mode === "nearest") {
67
+ return base + Math.round(rawSteps / step) * step;
68
+ }
69
+ const snappedSteps = direction > 0 ? Math.floor(rawSteps / stepSize) : Math.ceil(rawSteps / stepSize);
70
+ return base + snappedSteps * stepSize;
71
+ }
72
+ function toValidatedNumber(value, {
73
+ step,
74
+ minWithDefault,
75
+ maxWithDefault,
76
+ minWithZeroDefault,
77
+ format,
78
+ snapOnStep,
79
+ small,
80
+ clamp: shouldClamp
81
+ }) {
82
+ if (value === null) {
83
+ return value;
84
+ }
85
+ let nextValue = value;
86
+ if (step != null && snapOnStep && step !== 0) {
87
+ const base = small || minWithDefault === Number.MIN_SAFE_INTEGER ? minWithZeroDefault : minWithDefault;
88
+ nextValue = snapToStep(nextValue, base, step, small ? "nearest" : "directional");
89
+ }
90
+ if (shouldClamp) {
91
+ nextValue = (0, import_clamp.clamp)(nextValue, minWithDefault, maxWithDefault);
92
+ }
93
+ if (step == null && !hasNumberFormatRoundingOptions(format)) {
94
+ return nextValue;
95
+ }
96
+ const roundedValue = removeFloatingPointErrors(nextValue, format);
97
+ return shouldClamp ? (0, import_clamp.clamp)(roundedValue, minWithDefault, maxWithDefault) : roundedValue;
98
+ }
99
+ // Annotate the CommonJS export names for ESM import in node:
100
+ 0 && (module.exports = {
101
+ hasNumberFormatRoundingOptions,
102
+ removeFloatingPointErrors,
103
+ toValidatedNumber
104
+ });
@@ -0,0 +1,35 @@
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 owner_exports = {};
20
+ __export(owner_exports, {
21
+ ownerDocument: () => ownerDocument,
22
+ ownerWindow: () => ownerWindow
23
+ });
24
+ module.exports = __toCommonJS(owner_exports);
25
+ function ownerWindow(node) {
26
+ return node?.ownerDocument?.defaultView ?? window;
27
+ }
28
+ function ownerDocument(node) {
29
+ return node?.ownerDocument || document;
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ ownerDocument,
34
+ ownerWindow
35
+ });
@@ -0,0 +1,83 @@
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 platform_exports = {};
20
+ __export(platform_exports, {
21
+ platform: () => platform
22
+ });
23
+ module.exports = __toCommonJS(platform_exports);
24
+ function ua() {
25
+ return typeof navigator === "undefined" ? "" : navigator.userAgent ?? "";
26
+ }
27
+ function isIOS() {
28
+ if (typeof navigator === "undefined") {
29
+ return false;
30
+ }
31
+ return /iP(ad|hone|od)/.test(navigator.platform ?? "");
32
+ }
33
+ function isWebKit() {
34
+ const s = ua();
35
+ return /AppleWebKit/.test(s) && !/Chrome|Chromium|Edg\//.test(s);
36
+ }
37
+ function isVoiceOver() {
38
+ return /Mac OS X|iPhone|iPad/.test(ua());
39
+ }
40
+ function isAndroid() {
41
+ return /Android/.test(ua());
42
+ }
43
+ function isMac() {
44
+ if (typeof navigator === "undefined") {
45
+ return false;
46
+ }
47
+ return /^Mac/.test(navigator.platform ?? "") && !isIOS();
48
+ }
49
+ function isJsdom() {
50
+ return /jsdom/i.test(ua());
51
+ }
52
+ const platform = {
53
+ os: {
54
+ get ios() {
55
+ return isIOS();
56
+ },
57
+ get android() {
58
+ return isAndroid();
59
+ },
60
+ get mac() {
61
+ return isMac();
62
+ }
63
+ },
64
+ engine: {
65
+ get webkit() {
66
+ return isWebKit();
67
+ }
68
+ },
69
+ env: {
70
+ get jsdom() {
71
+ return isJsdom();
72
+ }
73
+ },
74
+ screenReader: {
75
+ get voiceOver() {
76
+ return isVoiceOver();
77
+ }
78
+ }
79
+ };
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ platform
83
+ });
@@ -0,0 +1,74 @@
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 popupStateMapping_exports = {};
20
+ __export(popupStateMapping_exports, {
21
+ CommonPopupDataAttributes: () => CommonPopupDataAttributes,
22
+ CommonTriggerDataAttributes: () => CommonTriggerDataAttributes,
23
+ popupStateMapping: () => popupStateMapping,
24
+ pressableTriggerOpenStateMapping: () => pressableTriggerOpenStateMapping,
25
+ triggerOpenStateMapping: () => triggerOpenStateMapping
26
+ });
27
+ module.exports = __toCommonJS(popupStateMapping_exports);
28
+ const CommonPopupDataAttributes = {
29
+ open: "data-open",
30
+ closed: "data-closed",
31
+ startingStyle: "data-starting-style",
32
+ endingStyle: "data-ending-style",
33
+ anchorHidden: "data-anchor-hidden",
34
+ side: "data-side",
35
+ align: "data-align"
36
+ };
37
+ const CommonTriggerDataAttributes = {
38
+ popupOpen: "data-popup-open",
39
+ pressed: "data-pressed"
40
+ };
41
+ const TRIGGER_HOOK = { [CommonTriggerDataAttributes.popupOpen]: "" };
42
+ const PRESSABLE_TRIGGER_HOOK = {
43
+ [CommonTriggerDataAttributes.popupOpen]: "",
44
+ [CommonTriggerDataAttributes.pressed]: ""
45
+ };
46
+ const POPUP_OPEN_HOOK = { [CommonPopupDataAttributes.open]: "" };
47
+ const POPUP_CLOSED_HOOK = { [CommonPopupDataAttributes.closed]: "" };
48
+ const ANCHOR_HIDDEN_HOOK = { [CommonPopupDataAttributes.anchorHidden]: "" };
49
+ const triggerOpenStateMapping = {
50
+ open(value) {
51
+ return value ? TRIGGER_HOOK : null;
52
+ }
53
+ };
54
+ const pressableTriggerOpenStateMapping = {
55
+ open(value) {
56
+ return value ? PRESSABLE_TRIGGER_HOOK : null;
57
+ }
58
+ };
59
+ const popupStateMapping = {
60
+ open(value) {
61
+ return value ? POPUP_OPEN_HOOK : POPUP_CLOSED_HOOK;
62
+ },
63
+ anchorHidden(value) {
64
+ return value ? ANCHOR_HIDDEN_HOOK : null;
65
+ }
66
+ };
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ CommonPopupDataAttributes,
70
+ CommonTriggerDataAttributes,
71
+ popupStateMapping,
72
+ pressableTriggerOpenStateMapping,
73
+ triggerOpenStateMapping
74
+ });
@@ -0,0 +1,39 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var popups_exports = {};
21
+ __export(popups_exports, {
22
+ createInlineMiddleware: () => import_inlineRect.createInlineMiddleware,
23
+ getInlineRectTriggerProps: () => import_inlineRect.getInlineRectTriggerProps,
24
+ updateInlineRectCoords: () => import_inlineRect.updateInlineRectCoords
25
+ });
26
+ module.exports = __toCommonJS(popups_exports);
27
+ __reExport(popups_exports, require("./store.cjs"), module.exports);
28
+ __reExport(popups_exports, require("./popupStoreUtils.cjs"), module.exports);
29
+ __reExport(popups_exports, require("./popupTriggerMap.cjs"), module.exports);
30
+ var import_inlineRect = require("./inlineRect.cjs");
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ createInlineMiddleware,
34
+ getInlineRectTriggerProps,
35
+ updateInlineRectCoords,
36
+ ...require("./store.cjs"),
37
+ ...require("./popupStoreUtils.cjs"),
38
+ ...require("./popupTriggerMap.cjs")
39
+ });
@@ -0,0 +1,218 @@
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 inlineRect_exports = {};
20
+ __export(inlineRect_exports, {
21
+ createInlineMiddleware: () => createInlineMiddleware,
22
+ getInlineRectTriggerProps: () => getInlineRectTriggerProps,
23
+ updateInlineRectCoords: () => updateInlineRectCoords
24
+ });
25
+ module.exports = __toCommonJS(inlineRect_exports);
26
+ var import_dom = require("../dom.cjs");
27
+ function createRect(left, top, right, bottom) {
28
+ return {
29
+ left,
30
+ top,
31
+ right,
32
+ bottom,
33
+ x: left,
34
+ y: top,
35
+ width: right - left,
36
+ height: bottom - top
37
+ };
38
+ }
39
+ function copyRect(rect) {
40
+ return {
41
+ left: rect.left,
42
+ top: rect.top,
43
+ right: rect.right,
44
+ bottom: rect.bottom,
45
+ width: rect.width,
46
+ height: rect.height
47
+ };
48
+ }
49
+ function getLineRects(rects) {
50
+ const lines = [];
51
+ let previousRect;
52
+ let left = Number.POSITIVE_INFINITY;
53
+ let top = Number.POSITIVE_INFINITY;
54
+ let right = Number.NEGATIVE_INFINITY;
55
+ let bottom = Number.NEGATIVE_INFINITY;
56
+ for (const rect of Array.from(rects).sort((a, b) => a.top - b.top)) {
57
+ left = Math.min(left, rect.left);
58
+ top = Math.min(top, rect.top);
59
+ right = Math.max(right, rect.right);
60
+ bottom = Math.max(bottom, rect.bottom);
61
+ if (!previousRect || rect.top - previousRect.top > previousRect.height / 2) {
62
+ lines.push(copyRect(rect));
63
+ } else {
64
+ const line = lines[lines.length - 1];
65
+ line.left = Math.min(line.left, rect.left);
66
+ line.right = Math.max(line.right, rect.right);
67
+ line.bottom = Math.max(line.bottom, rect.bottom);
68
+ line.width = line.right - line.left;
69
+ line.height = line.bottom - line.top;
70
+ }
71
+ previousRect = rect;
72
+ }
73
+ return {
74
+ lines,
75
+ fallback: createRect(left, top, right, bottom)
76
+ };
77
+ }
78
+ function findLineIndex(lines, x, y) {
79
+ return lines.findIndex(
80
+ (lineRect) => x > lineRect.left - 2 && x < lineRect.right + 2 && y > lineRect.top - 2 && y < lineRect.bottom + 2
81
+ );
82
+ }
83
+ function createClientRect(rect) {
84
+ return createRect(rect.left, rect.top, rect.right, rect.bottom);
85
+ }
86
+ function getInlineRectCoords(element, clientX, clientY) {
87
+ const { lines } = getLineRects(element.getClientRects());
88
+ if (lines.length < 2) {
89
+ return void 0;
90
+ }
91
+ const lineIndex = findLineIndex(lines, clientX, clientY);
92
+ return {
93
+ x: clientX,
94
+ y: clientY,
95
+ lineIndex: lineIndex === -1 ? void 0 : lineIndex,
96
+ element
97
+ };
98
+ }
99
+ function getInlineReferenceRect(reference, placement, coords) {
100
+ const { lines, fallback } = getLineRects(reference.getClientRects());
101
+ if (lines.length < 2) {
102
+ return null;
103
+ }
104
+ const x = coords?.x;
105
+ const y = coords?.y;
106
+ const side = placement[0];
107
+ if (coords?.lineIndex != null && lines[coords.lineIndex]) {
108
+ return createClientRect(lines[coords.lineIndex]);
109
+ }
110
+ if (x != null && y != null) {
111
+ const lineIndex = findLineIndex(lines, x, y);
112
+ if (lineIndex !== -1) {
113
+ return createClientRect(lines[lineIndex]);
114
+ }
115
+ }
116
+ if (lines.length === 2 && lines[0].left > lines[1].right && x != null && y != null) {
117
+ return fallback;
118
+ }
119
+ if (side === "t" || side === "b") {
120
+ const firstRect = lines[0];
121
+ const lastRect = lines[lines.length - 1];
122
+ const targetRect = side === "t" ? firstRect : lastRect;
123
+ return createRect(targetRect.left, firstRect.top, targetRect.right, lastRect.bottom);
124
+ }
125
+ const isLeft = side === "l";
126
+ let left = lines[0].left;
127
+ let right = lines[0].right;
128
+ let edge = isLeft ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
129
+ let targetFirstRect = lines[0];
130
+ let targetLastRect = lines[0];
131
+ for (const rect of lines) {
132
+ left = Math.min(left, rect.left);
133
+ right = Math.max(right, rect.right);
134
+ const nextEdge = isLeft ? rect.left : rect.right;
135
+ if (isLeft && nextEdge < edge || !isLeft && nextEdge > edge) {
136
+ edge = nextEdge;
137
+ targetFirstRect = rect;
138
+ targetLastRect = rect;
139
+ } else if (nextEdge === edge) {
140
+ targetLastRect = rect;
141
+ }
142
+ }
143
+ return createRect(left, targetFirstRect.top, right, targetLastRect.bottom);
144
+ }
145
+ function getContextElement(reference) {
146
+ if ("contextElement" in reference && reference.contextElement) {
147
+ return reference.contextElement;
148
+ }
149
+ return (0, import_dom.isElement)(reference) ? reference : void 0;
150
+ }
151
+ function getInlineRectTriggerProps(coordsRef, isOpen) {
152
+ function updateCoords(event) {
153
+ updateInlineRectCoords(coordsRef, event.currentTarget, event.clientX, event.clientY);
154
+ }
155
+ function updateCoordsIfClosed(event) {
156
+ if (!isOpen) {
157
+ updateCoords(event);
158
+ }
159
+ }
160
+ return {
161
+ onFocus() {
162
+ coordsRef.current = void 0;
163
+ },
164
+ onMouseEnter: updateCoordsIfClosed,
165
+ onMouseMove: updateCoordsIfClosed
166
+ };
167
+ }
168
+ function updateInlineRectCoords(coordsRef, element, clientX, clientY) {
169
+ const nextCoords = getInlineRectCoords(element, clientX, clientY);
170
+ coordsRef.current = nextCoords;
171
+ return nextCoords;
172
+ }
173
+ function createInlineMiddleware(coordsRef) {
174
+ return {
175
+ name: "inline",
176
+ async fn(state) {
177
+ const reference = state.elements.reference;
178
+ if (typeof reference?.getClientRects !== "function") {
179
+ return {};
180
+ }
181
+ const contextElement = getContextElement(reference);
182
+ const coords = coordsRef.current;
183
+ const currentCoords = coords?.element === reference || coords?.element === contextElement ? coords : void 0;
184
+ const rect = getInlineReferenceRect(
185
+ reference,
186
+ state.placement,
187
+ currentCoords
188
+ );
189
+ if (!rect || typeof state.platform.getElementRects !== "function") {
190
+ return {};
191
+ }
192
+ const resetRects = await state.platform.getElementRects({
193
+ reference: {
194
+ contextElement,
195
+ getBoundingClientRect() {
196
+ return rect;
197
+ }
198
+ },
199
+ floating: state.elements.floating,
200
+ strategy: state.strategy
201
+ });
202
+ if (state.rects.reference.x === resetRects.reference.x && state.rects.reference.y === resetRects.reference.y && state.rects.reference.width === resetRects.reference.width && state.rects.reference.height === resetRects.reference.height) {
203
+ return {};
204
+ }
205
+ return {
206
+ reset: {
207
+ rects: resetRects
208
+ }
209
+ };
210
+ }
211
+ };
212
+ }
213
+ // Annotate the CommonJS export names for ESM import in node:
214
+ 0 && (module.exports = {
215
+ createInlineMiddleware,
216
+ getInlineRectTriggerProps,
217
+ updateInlineRectCoords
218
+ });