@octanejs/base-ui 0.1.30 → 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,56 @@
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 constants_exports = {};
20
+ __export(constants_exports, {
21
+ BASE_UI_SWIPE_IGNORE_ATTRIBUTE: () => BASE_UI_SWIPE_IGNORE_ATTRIBUTE,
22
+ BASE_UI_SWIPE_IGNORE_SELECTOR: () => BASE_UI_SWIPE_IGNORE_SELECTOR,
23
+ DISABLED_TRANSITIONS_STYLE: () => DISABLED_TRANSITIONS_STYLE,
24
+ DROPDOWN_COLLISION_AVOIDANCE: () => DROPDOWN_COLLISION_AVOIDANCE,
25
+ LEGACY_SWIPE_IGNORE_ATTRIBUTE: () => LEGACY_SWIPE_IGNORE_ATTRIBUTE,
26
+ LEGACY_SWIPE_IGNORE_SELECTOR: () => LEGACY_SWIPE_IGNORE_SELECTOR,
27
+ PATIENT_CLICK_THRESHOLD: () => PATIENT_CLICK_THRESHOLD,
28
+ POPUP_COLLISION_AVOIDANCE: () => POPUP_COLLISION_AVOIDANCE,
29
+ TYPEAHEAD_RESET_MS: () => TYPEAHEAD_RESET_MS
30
+ });
31
+ module.exports = __toCommonJS(constants_exports);
32
+ const POPUP_COLLISION_AVOIDANCE = {
33
+ fallbackAxisSide: "end"
34
+ };
35
+ const DROPDOWN_COLLISION_AVOIDANCE = {
36
+ fallbackAxisSide: "none"
37
+ };
38
+ const DISABLED_TRANSITIONS_STYLE = { style: { transition: "none" } };
39
+ const TYPEAHEAD_RESET_MS = 500;
40
+ const PATIENT_CLICK_THRESHOLD = 500;
41
+ const BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
42
+ const LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
43
+ const BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
44
+ const LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ BASE_UI_SWIPE_IGNORE_ATTRIBUTE,
48
+ BASE_UI_SWIPE_IGNORE_SELECTOR,
49
+ DISABLED_TRANSITIONS_STYLE,
50
+ DROPDOWN_COLLISION_AVOIDANCE,
51
+ LEGACY_SWIPE_IGNORE_ATTRIBUTE,
52
+ LEGACY_SWIPE_IGNORE_SELECTOR,
53
+ PATIENT_CLICK_THRESHOLD,
54
+ POPUP_COLLISION_AVOIDANCE,
55
+ TYPEAHEAD_RESET_MS
56
+ });
@@ -0,0 +1,46 @@
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 contains_exports = {};
20
+ __export(contains_exports, {
21
+ contains: () => contains
22
+ });
23
+ module.exports = __toCommonJS(contains_exports);
24
+ function contains(parent, child) {
25
+ if (!parent || !child) {
26
+ return false;
27
+ }
28
+ if (parent.contains(child)) {
29
+ return true;
30
+ }
31
+ const rootNode = child.getRootNode?.();
32
+ if (rootNode && rootNode.host) {
33
+ let next = child;
34
+ while (next) {
35
+ if (next === parent) {
36
+ return true;
37
+ }
38
+ next = next.parentNode || next.host;
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ contains
46
+ });
@@ -0,0 +1,92 @@
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 createChangeEventDetails_exports = {};
20
+ __export(createChangeEventDetails_exports, {
21
+ REASONS: () => REASONS,
22
+ createChangeEventDetails: () => createChangeEventDetails,
23
+ createGenericEventDetails: () => createGenericEventDetails
24
+ });
25
+ module.exports = __toCommonJS(createChangeEventDetails_exports);
26
+ const REASONS = {
27
+ none: "none",
28
+ triggerPress: "trigger-press",
29
+ itemPress: "item-press",
30
+ keyboard: "keyboard",
31
+ pointer: "pointer",
32
+ inputChange: "input-change",
33
+ inputClear: "input-clear",
34
+ inputBlur: "input-blur",
35
+ inputPaste: "input-paste",
36
+ incrementPress: "increment-press",
37
+ decrementPress: "decrement-press",
38
+ wheel: "wheel",
39
+ scrub: "scrub",
40
+ trackPress: "track-press",
41
+ drag: "drag",
42
+ disabled: "disabled",
43
+ // Automatic-consistency reasons (tabs): the selected item was never valid, or went away.
44
+ initial: "initial",
45
+ missing: "missing",
46
+ triggerHover: "trigger-hover",
47
+ triggerFocus: "trigger-focus",
48
+ outsidePress: "outside-press",
49
+ closePress: "close-press",
50
+ focusOut: "focus-out",
51
+ listNavigation: "list-navigation",
52
+ escapeKey: "escape-key",
53
+ imperativeAction: "imperative-action",
54
+ cancelOpen: "cancel-open",
55
+ siblingOpen: "sibling-open"
56
+ };
57
+ function createChangeEventDetails(reason, event, trigger, customProperties) {
58
+ let canceled = false;
59
+ let allowPropagation = false;
60
+ const details = {
61
+ reason,
62
+ event: event ?? new Event("base-ui"),
63
+ cancel() {
64
+ canceled = true;
65
+ },
66
+ allowPropagation() {
67
+ allowPropagation = true;
68
+ },
69
+ get isCanceled() {
70
+ return canceled;
71
+ },
72
+ get isPropagationAllowed() {
73
+ return allowPropagation;
74
+ },
75
+ trigger,
76
+ ...customProperties
77
+ };
78
+ return details;
79
+ }
80
+ function createGenericEventDetails(reason, event, customProperties) {
81
+ return {
82
+ reason,
83
+ event: event ?? new Event("base-ui"),
84
+ ...customProperties
85
+ };
86
+ }
87
+ // Annotate the CommonJS export names for ESM import in node:
88
+ 0 && (module.exports = {
89
+ REASONS,
90
+ createChangeEventDetails,
91
+ createGenericEventDetails
92
+ });
@@ -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 dom_exports = {};
20
+ __export(dom_exports, {
21
+ isElement: () => isElement,
22
+ isHTMLElement: () => isHTMLElement
23
+ });
24
+ module.exports = __toCommonJS(dom_exports);
25
+ function isElement(value) {
26
+ return value != null && value instanceof Element;
27
+ }
28
+ function isHTMLElement(value) {
29
+ return value != null && value instanceof HTMLElement;
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ isElement,
34
+ isHTMLElement
35
+ });
@@ -0,0 +1,34 @@
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 empty_exports = {};
20
+ __export(empty_exports, {
21
+ EMPTY_ARRAY: () => EMPTY_ARRAY,
22
+ EMPTY_OBJECT: () => EMPTY_OBJECT,
23
+ NOOP: () => import_noop.NOOP
24
+ });
25
+ module.exports = __toCommonJS(empty_exports);
26
+ var import_noop = require("./noop.cjs");
27
+ const EMPTY_OBJECT = {};
28
+ const EMPTY_ARRAY = [];
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ EMPTY_ARRAY,
32
+ EMPTY_OBJECT,
33
+ NOOP
34
+ });
@@ -0,0 +1,34 @@
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 FieldItemContext_exports = {};
20
+ __export(FieldItemContext_exports, {
21
+ FieldItemContext: () => FieldItemContext,
22
+ useFieldItemContext: () => useFieldItemContext
23
+ });
24
+ module.exports = __toCommonJS(FieldItemContext_exports);
25
+ var import_octane = require("octane");
26
+ const FieldItemContext = (0, import_octane.createContext)({ disabled: false });
27
+ function useFieldItemContext() {
28
+ return (0, import_octane.useContext)(FieldItemContext);
29
+ }
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ FieldItemContext,
33
+ useFieldItemContext
34
+ });
@@ -0,0 +1,80 @@
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 FieldRootContext_exports = {};
20
+ __export(FieldRootContext_exports, {
21
+ DEFAULT_FIELD_ROOT_CONTEXT: () => DEFAULT_FIELD_ROOT_CONTEXT,
22
+ FieldRootContext: () => FieldRootContext,
23
+ useFieldRootContext: () => useFieldRootContext
24
+ });
25
+ module.exports = __toCommonJS(FieldRootContext_exports);
26
+ var import_octane = require("octane");
27
+ var import_noop = require("../noop.cjs");
28
+ var import_constants = require("./constants.cjs");
29
+ const DEFAULT_FIELD_ROOT_CONTEXT = {
30
+ invalid: void 0,
31
+ name: void 0,
32
+ validityData: {
33
+ state: import_constants.DEFAULT_VALIDITY_STATE,
34
+ errors: [],
35
+ error: "",
36
+ value: "",
37
+ initialValue: null
38
+ },
39
+ setValidityData: import_noop.NOOP,
40
+ disabled: void 0,
41
+ touched: import_constants.DEFAULT_FIELD_STATE_ATTRIBUTES.touched,
42
+ setTouched: import_noop.NOOP,
43
+ dirty: import_constants.DEFAULT_FIELD_STATE_ATTRIBUTES.dirty,
44
+ setDirty: import_noop.NOOP,
45
+ filled: import_constants.DEFAULT_FIELD_STATE_ATTRIBUTES.filled,
46
+ setFilled: import_noop.NOOP,
47
+ focused: import_constants.DEFAULT_FIELD_STATE_ATTRIBUTES.focused,
48
+ setFocused: import_noop.NOOP,
49
+ validate: () => null,
50
+ validationMode: "onSubmit",
51
+ validationDebounceTime: 0,
52
+ shouldValidateOnChange: () => false,
53
+ state: import_constants.DEFAULT_FIELD_ROOT_STATE,
54
+ markedDirtyRef: { current: false },
55
+ registerFieldControl: import_noop.NOOP,
56
+ validation: {
57
+ getValidationProps: (_disabled, props = {}) => props,
58
+ inputRef: { current: null },
59
+ registerInput: import_noop.NOOP,
60
+ commit: async () => {
61
+ },
62
+ change: import_noop.NOOP
63
+ }
64
+ };
65
+ const FieldRootContext = (0, import_octane.createContext)(DEFAULT_FIELD_ROOT_CONTEXT);
66
+ function useFieldRootContext(optional = true) {
67
+ const context = (0, import_octane.useContext)(FieldRootContext);
68
+ if (context.setValidityData === import_noop.NOOP && !optional) {
69
+ throw new Error(
70
+ "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>."
71
+ );
72
+ }
73
+ return context;
74
+ }
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ DEFAULT_FIELD_ROOT_CONTEXT,
78
+ FieldRootContext,
79
+ useFieldRootContext
80
+ });
@@ -0,0 +1,41 @@
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 FormContext_exports = {};
20
+ __export(FormContext_exports, {
21
+ FormContext: () => FormContext,
22
+ useFormContext: () => useFormContext
23
+ });
24
+ module.exports = __toCommonJS(FormContext_exports);
25
+ var import_octane = require("octane");
26
+ var import_noop = require("../noop.cjs");
27
+ const FormContext = (0, import_octane.createContext)({
28
+ formRef: { current: { fields: /* @__PURE__ */ new Map() } },
29
+ errors: {},
30
+ clearErrors: import_noop.NOOP,
31
+ validationMode: "onSubmit",
32
+ submitAttemptedRef: { current: false }
33
+ });
34
+ function useFormContext() {
35
+ return (0, import_octane.useContext)(FormContext);
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ FormContext,
40
+ useFormContext
41
+ });
@@ -0,0 +1,43 @@
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 LabelableContext_exports = {};
20
+ __export(LabelableContext_exports, {
21
+ LabelableContext: () => LabelableContext,
22
+ useLabelableContext: () => useLabelableContext
23
+ });
24
+ module.exports = __toCommonJS(LabelableContext_exports);
25
+ var import_octane = require("octane");
26
+ var import_noop = require("../noop.cjs");
27
+ const LabelableContext = (0, import_octane.createContext)({
28
+ controlId: void 0,
29
+ registerControlId: import_noop.NOOP,
30
+ labelId: void 0,
31
+ setLabelId: import_noop.NOOP,
32
+ messageIds: [],
33
+ setMessageIds: import_noop.NOOP,
34
+ getDescriptionProps: (externalProps) => externalProps
35
+ });
36
+ function useLabelableContext() {
37
+ return (0, import_octane.useContext)(LabelableContext);
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ LabelableContext,
42
+ useLabelableContext
43
+ });
@@ -0,0 +1,115 @@
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 LabelableProvider_exports = {};
20
+ __export(LabelableProvider_exports, {
21
+ LabelableProvider: () => LabelableProvider
22
+ });
23
+ module.exports = __toCommonJS(LabelableProvider_exports);
24
+ var import_octane = require("octane");
25
+ var import_internal = require("../../internal.cjs");
26
+ var import_useBaseUiId = require("../useBaseUiId.cjs");
27
+ var import_useRefWithInit = require("../useRefWithInit.cjs");
28
+ var import_useStableCallback = require("../useStableCallback.cjs");
29
+ var import_LabelableContext = require("./LabelableContext.cjs");
30
+ function LabelableProvider(props) {
31
+ const slot = (0, import_internal.S)("LabelableProvider");
32
+ const defaultId = (0, import_useBaseUiId.useBaseUiId)(void 0, (0, import_internal.subSlot)(slot, "default"));
33
+ const initialControlId = props.controlId === void 0 ? defaultId : props.controlId;
34
+ const [controlId, setControlIdState] = (0, import_octane.useState)(
35
+ initialControlId,
36
+ (0, import_internal.subSlot)(slot, "controlId")
37
+ );
38
+ const [labelId, setLabelId] = (0, import_octane.useState)(
39
+ props.labelId,
40
+ (0, import_internal.subSlot)(slot, "labelId")
41
+ );
42
+ const [messageIds, setMessageIds] = (0, import_octane.useState)([], (0, import_internal.subSlot)(slot, "messageIds"));
43
+ const registrationsRef = (0, import_useRefWithInit.useRefWithInit)(
44
+ () => /* @__PURE__ */ new Map(),
45
+ (0, import_internal.subSlot)(slot, "reg")
46
+ );
47
+ const { messageIds: parentMessageIds } = (0, import_octane.useContext)(import_LabelableContext.LabelableContext);
48
+ const registerControlId = (0, import_useStableCallback.useStableCallback)(
49
+ (source, nextId) => {
50
+ const registrations = registrationsRef.current;
51
+ if (nextId === void 0) {
52
+ registrations.delete(source);
53
+ return;
54
+ }
55
+ registrations.set(source, nextId);
56
+ setControlIdState((prev) => {
57
+ if (registrations.size === 0) {
58
+ return void 0;
59
+ }
60
+ let nextControlId;
61
+ for (const id of registrations.values()) {
62
+ if (prev !== void 0 && id === prev) {
63
+ return prev;
64
+ }
65
+ if (nextControlId === void 0) {
66
+ nextControlId = id;
67
+ }
68
+ }
69
+ return nextControlId;
70
+ });
71
+ },
72
+ (0, import_internal.subSlot)(slot, "registerControlId")
73
+ );
74
+ const getDescriptionProps = (0, import_octane.useCallback)(
75
+ (externalProps) => {
76
+ const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : [];
77
+ ids.push(...parentMessageIds, ...messageIds);
78
+ return {
79
+ ...externalProps,
80
+ "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0
81
+ };
82
+ },
83
+ [parentMessageIds, messageIds],
84
+ (0, import_internal.subSlot)(slot, "getDesc")
85
+ );
86
+ const contextValue = (0, import_octane.useMemo)(
87
+ () => ({
88
+ controlId,
89
+ registerControlId,
90
+ labelId,
91
+ setLabelId,
92
+ messageIds,
93
+ setMessageIds,
94
+ getDescriptionProps
95
+ }),
96
+ [
97
+ controlId,
98
+ registerControlId,
99
+ labelId,
100
+ setLabelId,
101
+ messageIds,
102
+ setMessageIds,
103
+ getDescriptionProps
104
+ ],
105
+ (0, import_internal.subSlot)(slot, "ctx")
106
+ );
107
+ return (0, import_octane.createElement)(import_LabelableContext.LabelableContext.Provider, {
108
+ value: contextValue,
109
+ children: props.children
110
+ });
111
+ }
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ LabelableProvider
115
+ });
@@ -0,0 +1,68 @@
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 constants_exports = {};
20
+ __export(constants_exports, {
21
+ DEFAULT_FIELD_ROOT_STATE: () => DEFAULT_FIELD_ROOT_STATE,
22
+ DEFAULT_FIELD_STATE_ATTRIBUTES: () => DEFAULT_FIELD_STATE_ATTRIBUTES,
23
+ DEFAULT_VALIDITY_STATE: () => DEFAULT_VALIDITY_STATE,
24
+ fieldValidityMapping: () => fieldValidityMapping
25
+ });
26
+ module.exports = __toCommonJS(constants_exports);
27
+ const DEFAULT_VALIDITY_STATE = {
28
+ badInput: false,
29
+ customError: false,
30
+ patternMismatch: false,
31
+ rangeOverflow: false,
32
+ rangeUnderflow: false,
33
+ stepMismatch: false,
34
+ tooLong: false,
35
+ tooShort: false,
36
+ typeMismatch: false,
37
+ valid: null,
38
+ valueMissing: false
39
+ };
40
+ const DEFAULT_FIELD_STATE_ATTRIBUTES = {
41
+ valid: null,
42
+ touched: false,
43
+ dirty: false,
44
+ filled: false,
45
+ focused: false
46
+ };
47
+ const DEFAULT_FIELD_ROOT_STATE = {
48
+ disabled: false,
49
+ ...DEFAULT_FIELD_STATE_ATTRIBUTES
50
+ };
51
+ const fieldValidityMapping = {
52
+ valid(value) {
53
+ if (value === null) {
54
+ return null;
55
+ }
56
+ if (value) {
57
+ return { "data-valid": "" };
58
+ }
59
+ return { "data-invalid": "" };
60
+ }
61
+ };
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ DEFAULT_FIELD_ROOT_STATE,
65
+ DEFAULT_FIELD_STATE_ATTRIBUTES,
66
+ DEFAULT_VALIDITY_STATE,
67
+ fieldValidityMapping
68
+ });
@@ -0,0 +1,36 @@
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 getCombinedFieldValidityData_exports = {};
20
+ __export(getCombinedFieldValidityData_exports, {
21
+ getCombinedFieldValidityData: () => getCombinedFieldValidityData
22
+ });
23
+ module.exports = __toCommonJS(getCombinedFieldValidityData_exports);
24
+ function getCombinedFieldValidityData(validityData, invalid) {
25
+ return {
26
+ ...validityData,
27
+ state: {
28
+ ...validityData.state,
29
+ valid: !invalid && validityData.state.valid
30
+ }
31
+ };
32
+ }
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ getCombinedFieldValidityData
36
+ });