@oprt/react 0.0.0-stage → 0.1.0

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 (266) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -2
  3. package/dist/ActionStatus/ActionStatus.js +104 -0
  4. package/dist/ActionStatus/ActionStatus.manifest.js +64 -0
  5. package/dist/ActionStatus/index.js +7 -0
  6. package/dist/Alert/Alert.js +86 -0
  7. package/dist/Alert/Alert.manifest.js +36 -0
  8. package/dist/Alert/index.js +7 -0
  9. package/dist/AppShell/AppShell.js +103 -0
  10. package/dist/AppShell/AppShell.manifest.js +66 -0
  11. package/dist/AppShell/index.js +9 -0
  12. package/dist/AttachmentPreview/AttachmentPreview.js +145 -0
  13. package/dist/AttachmentPreview/AttachmentPreview.manifest.js +42 -0
  14. package/dist/AttachmentPreview/index.js +9 -0
  15. package/dist/Avatar/Avatar.js +87 -0
  16. package/dist/Avatar/Avatar.manifest.js +25 -0
  17. package/dist/Avatar/index.js +7 -0
  18. package/dist/Badge/Badge.js +124 -0
  19. package/dist/Badge/Badge.manifest.js +41 -0
  20. package/dist/Badge/index.js +7 -0
  21. package/dist/Breadcrumb/Breadcrumb.js +64 -0
  22. package/dist/Breadcrumb/Breadcrumb.manifest.js +28 -0
  23. package/dist/Breadcrumb/index.js +7 -0
  24. package/dist/BulkActionBar/BulkActionBar.js +145 -0
  25. package/dist/BulkActionBar/BulkActionBar.manifest.js +46 -0
  26. package/dist/BulkActionBar/index.js +9 -0
  27. package/dist/BulkActionBar/selection.js +44 -0
  28. package/dist/BulkResults/BulkResults.js +269 -0
  29. package/dist/BulkResults/BulkResults.manifest.js +45 -0
  30. package/dist/BulkResults/index.js +7 -0
  31. package/dist/Button/Button.js +170 -0
  32. package/dist/Button/Button.manifest.js +36 -0
  33. package/dist/Button/index.js +7 -0
  34. package/dist/ButtonGroup/ButtonGroup.js +60 -0
  35. package/dist/ButtonGroup/ButtonGroup.manifest.js +22 -0
  36. package/dist/ButtonGroup/index.js +7 -0
  37. package/dist/Calendar/Calendar.js +106 -0
  38. package/dist/Calendar/Calendar.manifest.js +32 -0
  39. package/dist/Calendar/index.js +7 -0
  40. package/dist/Card/Card.js +70 -0
  41. package/dist/Card/Card.manifest.js +57 -0
  42. package/dist/Card/index.js +16 -0
  43. package/dist/Chart/Chart.js +1200 -0
  44. package/dist/Chart/Chart.manifest.js +110 -0
  45. package/dist/Chart/ChartControls.js +190 -0
  46. package/dist/Chart/geometry.js +217 -0
  47. package/dist/Chart/index.js +9 -0
  48. package/dist/Checkbox/Checkbox.js +166 -0
  49. package/dist/Checkbox/Checkbox.manifest.js +38 -0
  50. package/dist/Checkbox/index.js +7 -0
  51. package/dist/Collapsible/Collapsible.js +177 -0
  52. package/dist/Collapsible/Collapsible.manifest.js +54 -0
  53. package/dist/Collapsible/index.js +12 -0
  54. package/dist/CollectionState/CollectionState.js +68 -0
  55. package/dist/CollectionState/CollectionState.manifest.js +44 -0
  56. package/dist/CollectionState/index.js +7 -0
  57. package/dist/ComboBox/ComboBox.js +221 -0
  58. package/dist/ComboBox/ComboBox.manifest.js +87 -0
  59. package/dist/ComboBox/index.js +7 -0
  60. package/dist/CommandPalette/CommandPalette.js +276 -0
  61. package/dist/CommandPalette/CommandPalette.manifest.js +24 -0
  62. package/dist/CommandPalette/index.js +7 -0
  63. package/dist/ConfirmDialog/ConfirmDialog.js +84 -0
  64. package/dist/ConfirmDialog/ConfirmDialog.manifest.js +32 -0
  65. package/dist/ConfirmDialog/index.js +7 -0
  66. package/dist/ContextMenu/ContextMenu.js +192 -0
  67. package/dist/ContextMenu/ContextMenu.manifest.js +41 -0
  68. package/dist/ContextMenu/index.js +7 -0
  69. package/dist/CoordinateInput/CoordinateInput.js +141 -0
  70. package/dist/CoordinateInput/CoordinateInput.manifest.js +36 -0
  71. package/dist/CoordinateInput/index.js +9 -0
  72. package/dist/CopyButton/CopyButton.js +110 -0
  73. package/dist/CopyButton/CopyButton.manifest.js +35 -0
  74. package/dist/CopyButton/index.js +7 -0
  75. package/dist/DataGrid/DataGrid.js +459 -0
  76. package/dist/DataGrid/DataGrid.manifest.js +135 -0
  77. package/dist/DataGrid/PageControls.js +41 -0
  78. package/dist/DataGrid/index.js +9 -0
  79. package/dist/DataTable/DataTable.js +375 -0
  80. package/dist/DataTable/DataTable.manifest.js +86 -0
  81. package/dist/DataTable/index.js +9 -0
  82. package/dist/DataTable/sort.js +45 -0
  83. package/dist/DataTable/useScrollsSideways.js +61 -0
  84. package/dist/DataTable/useTableWindow.js +185 -0
  85. package/dist/DatePicker/DatePicker.js +187 -0
  86. package/dist/DatePicker/DatePicker.manifest.js +40 -0
  87. package/dist/DatePicker/index.js +7 -0
  88. package/dist/DateRangePicker/DateRangePicker.js +156 -0
  89. package/dist/DateRangePicker/DateRangePicker.manifest.js +41 -0
  90. package/dist/DateRangePicker/index.js +7 -0
  91. package/dist/DateTimePicker/DateTimePicker.js +213 -0
  92. package/dist/DateTimePicker/DateTimePicker.manifest.js +44 -0
  93. package/dist/DateTimePicker/index.js +7 -0
  94. package/dist/DescriptionList/DescriptionList.js +93 -0
  95. package/dist/DescriptionList/DescriptionList.manifest.js +40 -0
  96. package/dist/DescriptionList/index.js +9 -0
  97. package/dist/Dialog/Dialog.js +214 -0
  98. package/dist/Dialog/Dialog.manifest.js +31 -0
  99. package/dist/Dialog/index.js +7 -0
  100. package/dist/Divider/Divider.js +64 -0
  101. package/dist/Divider/Divider.manifest.js +21 -0
  102. package/dist/Divider/index.js +7 -0
  103. package/dist/DropdownMenu/DropdownMenu.js +170 -0
  104. package/dist/DropdownMenu/DropdownMenu.manifest.js +82 -0
  105. package/dist/DropdownMenu/index.js +16 -0
  106. package/dist/EntityPreview/EntityPreview.js +82 -0
  107. package/dist/EntityPreview/EntityPreview.manifest.js +43 -0
  108. package/dist/EntityPreview/index.js +7 -0
  109. package/dist/EventTimeline/EventTimeline.js +249 -0
  110. package/dist/EventTimeline/EventTimeline.manifest.js +57 -0
  111. package/dist/EventTimeline/index.js +7 -0
  112. package/dist/Field/Field.js +81 -0
  113. package/dist/Field/Field.manifest.js +32 -0
  114. package/dist/Field/index.js +9 -0
  115. package/dist/FileUpload/FileUpload.js +215 -0
  116. package/dist/FileUpload/FileUpload.manifest.js +48 -0
  117. package/dist/FileUpload/index.js +7 -0
  118. package/dist/FilterBar/FilterBar.js +173 -0
  119. package/dist/FilterBar/FilterBar.manifest.js +49 -0
  120. package/dist/FilterBar/index.js +7 -0
  121. package/dist/FormErrorSummary/FormErrorSummary.js +70 -0
  122. package/dist/FormErrorSummary/FormErrorSummary.manifest.js +29 -0
  123. package/dist/FormErrorSummary/index.js +9 -0
  124. package/dist/FormSection/FormSection.js +51 -0
  125. package/dist/FormSection/FormSection.manifest.js +30 -0
  126. package/dist/FormSection/index.js +7 -0
  127. package/dist/InlineEdit/InlineEdit.js +261 -0
  128. package/dist/InlineEdit/InlineEdit.manifest.js +40 -0
  129. package/dist/InlineEdit/index.js +7 -0
  130. package/dist/Input/Input.js +126 -0
  131. package/dist/Input/Input.manifest.js +49 -0
  132. package/dist/Input/index.js +7 -0
  133. package/dist/Inspector/Inspector.js +63 -0
  134. package/dist/Inspector/Inspector.manifest.js +35 -0
  135. package/dist/Inspector/index.js +7 -0
  136. package/dist/JobStatus/JobStatus.js +118 -0
  137. package/dist/JobStatus/JobStatus.manifest.js +53 -0
  138. package/dist/JobStatus/index.js +7 -0
  139. package/dist/LayerControl/LayerControl.js +199 -0
  140. package/dist/LayerControl/LayerControl.manifest.js +34 -0
  141. package/dist/LayerControl/index.js +7 -0
  142. package/dist/Link/Link.js +83 -0
  143. package/dist/Link/Link.manifest.js +37 -0
  144. package/dist/Link/index.js +7 -0
  145. package/dist/MapControls/MapControls.js +122 -0
  146. package/dist/MapControls/MapControls.manifest.js +31 -0
  147. package/dist/MapControls/index.js +7 -0
  148. package/dist/MapLegend/MapLegend.js +89 -0
  149. package/dist/MapLegend/MapLegend.manifest.js +29 -0
  150. package/dist/MapLegend/index.js +7 -0
  151. package/dist/MapScale/MapScale.js +96 -0
  152. package/dist/MapScale/MapScale.manifest.js +31 -0
  153. package/dist/MapScale/index.js +7 -0
  154. package/dist/MediaFrame/MediaFrame.js +113 -0
  155. package/dist/MediaFrame/MediaFrame.manifest.js +57 -0
  156. package/dist/MediaFrame/index.js +7 -0
  157. package/dist/MultiSelect/MultiSelect.js +113 -0
  158. package/dist/MultiSelect/MultiSelect.manifest.js +51 -0
  159. package/dist/MultiSelect/index.js +7 -0
  160. package/dist/NumberInput/NumberInput.js +210 -0
  161. package/dist/NumberInput/NumberInput.manifest.js +56 -0
  162. package/dist/NumberInput/index.js +7 -0
  163. package/dist/OperationalStatus/OperationalStatus.js +89 -0
  164. package/dist/OperationalStatus/OperationalStatus.manifest.js +39 -0
  165. package/dist/OperationalStatus/index.js +9 -0
  166. package/dist/PlaybackControls/PlaybackControls.js +289 -0
  167. package/dist/PlaybackControls/PlaybackControls.manifest.js +85 -0
  168. package/dist/PlaybackControls/index.js +7 -0
  169. package/dist/Popover/Popover.js +302 -0
  170. package/dist/Popover/Popover.manifest.js +50 -0
  171. package/dist/Popover/index.js +7 -0
  172. package/dist/Progress/Progress.js +132 -0
  173. package/dist/Progress/Progress.manifest.js +30 -0
  174. package/dist/Progress/index.js +7 -0
  175. package/dist/PropertyFilter/PropertyFilter.js +306 -0
  176. package/dist/PropertyFilter/PropertyFilter.manifest.js +32 -0
  177. package/dist/PropertyFilter/index.js +11 -0
  178. package/dist/PropertyFilter/tokenError.js +17 -0
  179. package/dist/RadioGroup/RadioGroup.js +143 -0
  180. package/dist/RadioGroup/RadioGroup.manifest.js +44 -0
  181. package/dist/RadioGroup/index.js +9 -0
  182. package/dist/Select/Select.js +219 -0
  183. package/dist/Select/Select.manifest.js +77 -0
  184. package/dist/Select/index.js +9 -0
  185. package/dist/Sidebar/Sidebar.js +146 -0
  186. package/dist/Sidebar/Sidebar.manifest.js +72 -0
  187. package/dist/Sidebar/index.js +18 -0
  188. package/dist/Skeleton/Skeleton.js +76 -0
  189. package/dist/Skeleton/Skeleton.manifest.js +30 -0
  190. package/dist/Skeleton/index.js +7 -0
  191. package/dist/Slider/Slider.js +246 -0
  192. package/dist/Slider/Slider.manifest.js +56 -0
  193. package/dist/Slider/index.js +7 -0
  194. package/dist/Sparkline/Sparkline.js +135 -0
  195. package/dist/Sparkline/Sparkline.manifest.js +37 -0
  196. package/dist/Sparkline/index.js +7 -0
  197. package/dist/SplitPane/SplitPane.js +316 -0
  198. package/dist/SplitPane/SplitPane.manifest.js +79 -0
  199. package/dist/SplitPane/index.js +7 -0
  200. package/dist/StatCard/StatCard.js +163 -0
  201. package/dist/StatCard/StatCard.manifest.js +45 -0
  202. package/dist/StatCard/index.js +7 -0
  203. package/dist/Tabs/Tabs.js +181 -0
  204. package/dist/Tabs/Tabs.manifest.js +72 -0
  205. package/dist/Tabs/index.js +16 -0
  206. package/dist/Tabs/useTabsIndicator.js +71 -0
  207. package/dist/Tabs/useTabsScroll.js +123 -0
  208. package/dist/TagGroup/TagGroup.js +142 -0
  209. package/dist/TagGroup/TagGroup.manifest.js +35 -0
  210. package/dist/TagGroup/index.js +7 -0
  211. package/dist/Textarea/Textarea.js +68 -0
  212. package/dist/Textarea/Textarea.manifest.js +25 -0
  213. package/dist/Textarea/index.js +7 -0
  214. package/dist/TimeField/TimeField.js +118 -0
  215. package/dist/TimeField/TimeField.manifest.js +42 -0
  216. package/dist/TimeField/index.js +7 -0
  217. package/dist/TimeRange/TimeRange.js +184 -0
  218. package/dist/TimeRange/TimeRange.manifest.js +48 -0
  219. package/dist/TimeRange/index.js +9 -0
  220. package/dist/Toast/Toast.js +188 -0
  221. package/dist/Toast/Toast.manifest.js +77 -0
  222. package/dist/Toast/index.js +9 -0
  223. package/dist/Toggle/Toggle.js +154 -0
  224. package/dist/Toggle/Toggle.manifest.js +54 -0
  225. package/dist/Toggle/index.js +7 -0
  226. package/dist/Toolbar/Toolbar.js +86 -0
  227. package/dist/Toolbar/Toolbar.manifest.js +70 -0
  228. package/dist/Toolbar/index.js +12 -0
  229. package/dist/Tooltip/Tooltip.js +122 -0
  230. package/dist/Tooltip/Tooltip.manifest.js +27 -0
  231. package/dist/Tooltip/index.js +7 -0
  232. package/dist/TreeView/TreeView.js +129 -0
  233. package/dist/TreeView/TreeView.manifest.js +56 -0
  234. package/dist/TreeView/index.js +7 -0
  235. package/dist/UploadQueue/UploadQueue.js +296 -0
  236. package/dist/UploadQueue/UploadQueue.manifest.js +34 -0
  237. package/dist/UploadQueue/index.js +7 -0
  238. package/dist/_internal/MotionPopover.js +113 -0
  239. package/dist/_internal/aria.js +40 -0
  240. package/dist/_internal/bytes.js +18 -0
  241. package/dist/_internal/controlStyles.js +26 -0
  242. package/dist/_internal/date.js +179 -0
  243. package/dist/_internal/devValidate.js +51 -0
  244. package/dist/_internal/fieldIds.js +50 -0
  245. package/dist/_internal/hydration.js +74 -0
  246. package/dist/_internal/manifest-entry.js +0 -0
  247. package/dist/_internal/mergeRefs.js +68 -0
  248. package/dist/_internal/motion.js +138 -0
  249. package/dist/_internal/navigationLandmark.js +13 -0
  250. package/dist/_internal/numberText.js +176 -0
  251. package/dist/_internal/overlay.js +53 -0
  252. package/dist/_internal/segmentField.js +125 -0
  253. package/dist/_internal/suggestions.js +20 -0
  254. package/dist/_internal/timestamp.js +25 -0
  255. package/dist/_internal/unavailable.js +13 -0
  256. package/dist/_internal/useActionFocus.js +27 -0
  257. package/dist/_internal/useElementWidth.js +37 -0
  258. package/dist/_internal/useIsMounted.js +18 -0
  259. package/dist/_internal/useIsomorphicLayoutEffect.js +8 -0
  260. package/dist/_internal/useRestoreFocusOnRemoval.js +57 -0
  261. package/dist/index.cjs +17811 -0
  262. package/dist/index.d.cts +2330 -0
  263. package/dist/index.d.ts +2330 -0
  264. package/dist/index.js +407 -0
  265. package/dist/version.js +8 -0
  266. package/package.json +80 -3
@@ -0,0 +1,138 @@
1
+ "use client";
2
+
3
+ // src/_internal/motion.ts
4
+ import {
5
+ createContext,
6
+ useCallback,
7
+ useContext,
8
+ useEffect,
9
+ useRef,
10
+ useState
11
+ } from "react";
12
+ import { callingComponent, devValidate } from "./devValidate.js";
13
+ var MotionContext = createContext("auto");
14
+ var MOTION_VALUES = ["auto", "none"];
15
+ var MOTION_PROPS = {
16
+ motion: { type: "enum", values: MOTION_VALUES, default: "auto" }
17
+ };
18
+ function useMotion(mode = "auto", component) {
19
+ if (process.env.NODE_ENV !== "production" && !MOTION_VALUES.includes(mode)) {
20
+ devValidate(component ?? callingComponent() ?? "OPERATOR component", MOTION_PROPS, {
21
+ motion: mode
22
+ });
23
+ }
24
+ const inherited = useContext(MotionContext);
25
+ const [ready, setReady] = useState(false);
26
+ const [keyboard, setKeyboard] = useState(false);
27
+ const pointer = useRef(false);
28
+ const frame = useRef();
29
+ const contactCleanup = useRef();
30
+ const clearContact = useCallback(() => {
31
+ contactCleanup.current?.();
32
+ contactCleanup.current = void 0;
33
+ }, []);
34
+ const cancel = useCallback(() => {
35
+ if (frame.current !== void 0) cancelAnimationFrame(frame.current);
36
+ }, []);
37
+ const afterPaint = useCallback(
38
+ (callback) => {
39
+ cancel();
40
+ frame.current = requestAnimationFrame(() => {
41
+ frame.current = requestAnimationFrame(() => {
42
+ frame.current = void 0;
43
+ callback();
44
+ });
45
+ });
46
+ },
47
+ [cancel]
48
+ );
49
+ useEffect(() => {
50
+ afterPaint(() => setReady(true));
51
+ return () => {
52
+ cancel();
53
+ clearContact();
54
+ };
55
+ }, [afterPaint, cancel, clearContact]);
56
+ const resume = useCallback(
57
+ () => afterPaint(() => {
58
+ setReady(true);
59
+ setKeyboard(false);
60
+ pointer.current = false;
61
+ }),
62
+ [afterPaint]
63
+ );
64
+ const handlers = {
65
+ onPointerDownCapture: (event) => {
66
+ cancel();
67
+ clearContact();
68
+ pointer.current = true;
69
+ setReady(true);
70
+ setKeyboard(false);
71
+ const root = event.currentTarget;
72
+ const release = (event2) => {
73
+ if (event2 && !root.contains(event2.target)) pointer.current = false;
74
+ clearContact();
75
+ resume();
76
+ };
77
+ const abandon = () => {
78
+ pointer.current = false;
79
+ release();
80
+ };
81
+ document.addEventListener("pointerup", release, true);
82
+ document.addEventListener("pointercancel", abandon, true);
83
+ window.addEventListener("blur", abandon);
84
+ contactCleanup.current = () => {
85
+ document.removeEventListener("pointerup", release, true);
86
+ document.removeEventListener("pointercancel", abandon, true);
87
+ window.removeEventListener("blur", abandon);
88
+ };
89
+ },
90
+ onKeyDownCapture: () => {
91
+ cancel();
92
+ pointer.current = false;
93
+ setKeyboard(true);
94
+ },
95
+ onKeyUpCapture: resume,
96
+ onBlurCapture: (event) => {
97
+ if (!event.currentTarget.contains(event.relatedTarget)) resume();
98
+ },
99
+ onClickCapture: (event) => {
100
+ if (event.detail === 0 && !pointer.current) setKeyboard(true);
101
+ resume();
102
+ }
103
+ };
104
+ const effective = mode === "none" || inherited === "none" || !ready || keyboard ? "none" : "auto";
105
+ return {
106
+ mode: effective,
107
+ props: { "data-oprt-motion": effective, ...handlers },
108
+ settleInput: () => {
109
+ cancel();
110
+ pointer.current = false;
111
+ setKeyboard(true);
112
+ resume();
113
+ }
114
+ };
115
+ }
116
+ function composeMotionHandlers(motion, consumer) {
117
+ const captures = { ...motion };
118
+ for (const key of [
119
+ "onPointerDownCapture",
120
+ "onKeyDownCapture",
121
+ "onKeyUpCapture",
122
+ "onBlurCapture",
123
+ "onClickCapture"
124
+ ]) {
125
+ const internal = motion[key];
126
+ const external = consumer[key];
127
+ captures[key] = ((event) => {
128
+ internal?.(event);
129
+ external?.(event);
130
+ });
131
+ }
132
+ return captures;
133
+ }
134
+ export {
135
+ MotionContext,
136
+ composeMotionHandlers,
137
+ useMotion
138
+ };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+
3
+ // src/_internal/navigationLandmark.ts
4
+ import { createContext, useContext } from "react";
5
+ var InsideNavigationLandmarkContext = createContext(false);
6
+ var InsideNavigationLandmarkProvider = InsideNavigationLandmarkContext.Provider;
7
+ function useInsideNavigationLandmark() {
8
+ return useContext(InsideNavigationLandmarkContext);
9
+ }
10
+ export {
11
+ InsideNavigationLandmarkProvider,
12
+ useInsideNavigationLandmark
13
+ };
@@ -0,0 +1,176 @@
1
+ "use client";
2
+
3
+ // src/_internal/numberText.tsx
4
+ import { Fragment } from "react";
5
+ import clsx from "clsx";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var DIGIT = "\\p{Nd}";
8
+ var SPACE = "[\\u00a0\\u202f\\u2009 ]";
9
+ var NO_BREAK = "[\\u00a0\\u202f\\u2009]";
10
+ var BIDI = "[\\u200e\\u200f\\u061c]*";
11
+ var SIGN = "[+\\-\\u2212\\u00b1~\\u2248<>\\u2264\\u2265]{1,2}";
12
+ var CURRENCY = `(?:(?:[A-Z]{1,3}\\p{Sc}|\\p{Sc})${SPACE}?|[A-Z]{3}${SPACE})`;
13
+ var PERCENT_FIRST = `[%\\u2030\\u066a]${SPACE}?`;
14
+ var PREFIX = `${BIDI}(?:${SIGN})?${BIDI}(?:${CURRENCY}|${PERCENT_FIRST})?(?:${SIGN})?`;
15
+ var SEPARATOR = "[,\\u00a0\\u202f\\u2009'\\u2019\\u066c ]";
16
+ var DECIMAL = "[.,\\u066b]";
17
+ var EXPONENT = `(?:[eE][+\\-\\u2212]?${DIGIT}+)?`;
18
+ var LETTER = "(?:\\p{L}\\p{M}*)";
19
+ var LETTERS = `${LETTER}{1,3}`;
20
+ var SUFFIX = `(?:${[
21
+ // A degree or prime mark and its letter (the C of 12 degrees C), and the Devanagari abbreviation
22
+ // sign that hi-IN ends it with.
23
+ `${SPACE}?${BIDI}[\\u00b0\\u2032\\u2033]${LETTER}?\\u0970?`,
24
+ // A percent or per mille sign, which may follow a space.
25
+ `${SPACE}?${BIDI}[%\\u2030\\u066a]`,
26
+ // A currency sign, which may follow a space and be followed by a country ($US, $ US).
27
+ `${SPACE}?${BIDI}\\p{Sc}(?:${NO_BREAK}?${LETTERS})?`,
28
+ // A currency sign of up to three letters (US$), which may follow a space.
29
+ `${SPACE}?${BIDI}\\p{L}{1,3}\\p{Sc}`,
30
+ // One to three letters (k, M, kPa, kr, a code such as USD), attached or after a no-break space.
31
+ `${NO_BREAK}?${BIDI}${LETTERS}`,
32
+ // A unit divided by another (km/h) or raised to a power (m/s squared), written against the digits.
33
+ // After a space the unit is read word by word (readNumber), as before.
34
+ `${LETTERS}[/\\u00b7\\u22c5]${LETTERS}[\\u00b2\\u00b3]?`
35
+ ].join("|")})?`;
36
+ var REST = `(?:${DECIMAL}${DIGIT}+)?${EXPONENT}${SUFFIX}${BIDI}`;
37
+ var NUMBER = {
38
+ // 1,234,567.89 and 1 234 567,89: groups of three, however they are separated.
39
+ western: new RegExp(
40
+ `^(${PREFIX}${DIGIT}{1,3})((${SEPARATOR})${DIGIT}{3}(?:\\3${DIGIT}{3})*)(${REST})$`,
41
+ "u"
42
+ ),
43
+ // 12,34,567.89 (Indian lakh grouping): a last group of three, groups of two before it.
44
+ indian: new RegExp(
45
+ `^(${PREFIX}${DIGIT}{1,2})((${SEPARATOR})${DIGIT}{2}(?:\\3${DIGIT}{2})*\\3${DIGIT}{3})(${REST})$`,
46
+ "u"
47
+ ),
48
+ // 1.234.567,89: dots group, a comma is the decimal mark. One dot group needs the comma, so that a
49
+ // decimal like 1.234 is never taken for 1234.
50
+ dotted: new RegExp(
51
+ `^(${PREFIX}${DIGIT}{1,3})((?:\\.${DIGIT}{3})+)((?:,${DIGIT}+)?${EXPONENT}${SUFFIX}${BIDI})$`,
52
+ "u"
53
+ ),
54
+ // Not grouped: digits with an optional decimal part. It never breaks at all.
55
+ plain: new RegExp(
56
+ `^${PREFIX}(?:${DIGIT}+(?:${DECIMAL}${DIGIT}+)?|${DECIMAL}${DIGIT}+)${EXPONENT}${SUFFIX}${BIDI}$`,
57
+ "u"
58
+ )
59
+ };
60
+ var GROUP = new RegExp(`(${SEPARATOR})(${DIGIT}+)`, "gu");
61
+ var EXACT_DIGITS = 15;
62
+ var WHOLE_DIGITS = /(?:^|[^.,\u066b\p{Nd}])(\p{Nd}+)/u;
63
+ var SIMPLE_NUMBER = /^[+-]?\d{1,15}(?:\.\d+)?$/;
64
+ function numberParts(text) {
65
+ if (SIMPLE_NUMBER.test(text)) return { lead: [], tail: text };
66
+ for (const kind of ["western", "indian", "dotted"]) {
67
+ const match = NUMBER[kind].exec(text);
68
+ if (!match) continue;
69
+ const rest = match[match.length - 1];
70
+ const groups = Array.from(match[2].matchAll(kind === "dotted" ? /(\.)(\p{Nd}+)/gu : GROUP));
71
+ if (kind === "dotted" && groups.length < 2 && !rest.startsWith(",")) continue;
72
+ const lead = [];
73
+ let digits = match[1];
74
+ for (const [, separator, next] of groups) {
75
+ lead.push(digits + separator);
76
+ digits = next;
77
+ }
78
+ return { lead, tail: digits + rest };
79
+ }
80
+ if (!NUMBER.plain.test(text)) return null;
81
+ return (WHOLE_DIGITS.exec(text)?.[1].length ?? 0) > EXACT_DIGITS ? null : { lead: [], tail: text };
82
+ }
83
+ function unitWords(unit) {
84
+ const trimmed = unit?.trim();
85
+ if (!trimmed) return null;
86
+ const space = trimmed.search(/\s/);
87
+ return space === -1 ? { first: trimmed, rest: "" } : { first: trimmed.slice(0, space), rest: trimmed.slice(space).trim() };
88
+ }
89
+ var segmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
90
+ function splitLast(text) {
91
+ if (segmenter) {
92
+ let start = 0;
93
+ let last2 = "";
94
+ for (const { segment, index } of segmenter.segment(text)) {
95
+ start = index;
96
+ last2 = segment;
97
+ }
98
+ return [text.slice(0, start), last2];
99
+ }
100
+ const characters = Array.from(text);
101
+ const last = characters.pop() ?? "";
102
+ return [characters.join(""), last];
103
+ }
104
+ var GAP = /[\u0020\u00a0\u202f\u2009]+/gu;
105
+ var STARTS_WITH_DIGIT = /^\p{Nd}/u;
106
+ var FIRST_WORD = /^\S+/u;
107
+ var UNIT_CHARACTERS = /^[\p{L}\p{M}%\u2030\u00b0\u2032\u2033/\u00b7\u22c5\u00b2\u00b3\u00b9\u2070-\u2079\u207b()'.-]{1,8}$/u;
108
+ var UNIT_MARK = /[\p{L}%\u2030\u00b0]/u;
109
+ var isUnitWord = (word) => UNIT_CHARACTERS.test(word) && UNIT_MARK.test(word);
110
+ function readNumber(value, unit) {
111
+ if (typeof value !== "string" && typeof value !== "number") return null;
112
+ const text = String(value).trim();
113
+ const words = unitWords(unit);
114
+ const whole = numberParts(text);
115
+ if (words) {
116
+ return whole && { ...whole, gap: " ", first: words.first, rest: words.rest && ` ${words.rest}` };
117
+ }
118
+ if (whole) return { ...whole, gap: "", first: "", rest: "" };
119
+ const gaps = Array.from(text.matchAll(GAP)).reverse();
120
+ for (const gap of gaps) {
121
+ const after = text.slice(gap.index + gap[0].length);
122
+ if (!after || STARTS_WITH_DIGIT.test(after)) continue;
123
+ const parts = numberParts(text.slice(0, gap.index));
124
+ if (!parts) continue;
125
+ const first = FIRST_WORD.exec(after)[0];
126
+ return isUnitWord(first) ? { ...parts, gap: gap[0], first, rest: after.slice(first.length) } : { ...parts, gap: "", first: "", rest: gap[0] + after };
127
+ }
128
+ return null;
129
+ }
130
+ var isNumberText = (value) => readNumber(value) !== null;
131
+ function NumberText(props) {
132
+ return numberText(props);
133
+ }
134
+ function numberText({ value, unit, className }) {
135
+ const reading = readNumber(value, unit);
136
+ if (!reading) {
137
+ const text = String(value);
138
+ const words = unitWords(unit);
139
+ if (!words) return /* @__PURE__ */ jsx("span", { className, children: text });
140
+ const [head, last] = splitLast(text);
141
+ return /* @__PURE__ */ jsxs("span", { className, children: [
142
+ head,
143
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: `${last}\xA0${words.first}` }),
144
+ words.rest && ` ${words.rest}`
145
+ ] });
146
+ }
147
+ const { lead, tail, gap, first, rest } = reading;
148
+ const run = tail + gap + first;
149
+ if (lead.length === 0 && !rest) {
150
+ return /* @__PURE__ */ jsx(
151
+ "span",
152
+ {
153
+ "data-oprt-number": "",
154
+ className: className?.includes("whitespace-nowrap") && className.split(/\s+/).includes("whitespace-nowrap") ? className : clsx(className, "whitespace-nowrap"),
155
+ children: run
156
+ }
157
+ );
158
+ }
159
+ return /* @__PURE__ */ jsxs("span", { "data-oprt-number": "", className, children: [
160
+ lead.map((piece, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
161
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: piece }),
162
+ /* @__PURE__ */ jsx("wbr", {})
163
+ ] }, index)),
164
+ /* @__PURE__ */ jsx("span", { "data-oprt-number-run": "", className: "whitespace-nowrap", children: run }),
165
+ rest
166
+ ] });
167
+ }
168
+ export {
169
+ NumberText,
170
+ isNumberText,
171
+ numberParts,
172
+ numberText,
173
+ readNumber,
174
+ splitLast,
175
+ unitWords
176
+ };
@@ -0,0 +1,53 @@
1
+ "use client";
2
+
3
+ // src/_internal/overlay.ts
4
+ import { cva } from "class-variance-authority";
5
+ import { Fragment, isValidElement } from "react";
6
+ function toPlacement(side, align) {
7
+ if (align === "center") return side;
8
+ if (side === "left" || side === "right") return `${side} ${align === "start" ? "top" : "bottom"}`;
9
+ return `${side} ${align}`;
10
+ }
11
+ var SCREEN_MARGIN = 16;
12
+ var CONTENT_WIDTH_ABOVE_OR_BELOW = "data-[placement=top]:w-max data-[placement=bottom]:w-max";
13
+ var MARGIN_BESIDE = "data-[placement=left]:ml-2u data-[placement=right]:mr-2u";
14
+ var TOOLTIP_WIDTH = `max-w-[min(20rem,calc(100vw-var(--oprt-space-4)))] ${CONTENT_WIDTH_ABOVE_OR_BELOW} ${MARGIN_BESIDE}`;
15
+ var POPOVER_WIDTH = `max-w-[min(var(--oprt-popover-max-width,30rem),calc(100vw-var(--oprt-space-4)))] ${CONTENT_WIDTH_ABOVE_OR_BELOW} ${MARGIN_BESIDE}`;
16
+ var MENU_OFFSET = 4;
17
+ var MENU_SURFACE = `z-50 min-w-[10rem] ${POPOVER_WIDTH} overflow-y-auto overscroll-contain border border-oprt-border bg-oprt-surface-1 py-1u font-sans`;
18
+ var MENU_ROW = "flex min-h-oprt-md items-center justify-between gap-3u border border-transparent px-3u py-[calc((var(--oprt-height-md)-2px-var(--oprt-line-base))/2)]";
19
+ var FORCED_ACTIVE_ROW = "forced-colors:[outline-style:none] forced-colors:data-[focused]:[forced-color-adjust:none] forced-colors:data-[focused]:bg-[color:Highlight] forced-colors:data-[focused]:border-[color:Highlight] forced-colors:data-[focused]:text-[color:HighlightText] forced-colors:data-[focused]:shadow-none forced-colors:data-[disabled]:text-[color:GrayText]";
20
+ var menuItemStyles = cva(
21
+ `${MENU_ROW} text-oprt-base font-medium outline-hidden cursor-pointer data-[focused]:bg-oprt-surface-3 data-[focus-visible]:border-oprt-border-focus data-[focus-visible]:shadow-oprt-focus data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed ${FORCED_ACTIVE_ROW}`,
22
+ {
23
+ variants: { danger: { true: "text-oprt-error", false: "text-oprt-text" } },
24
+ defaultVariants: { danger: false }
25
+ }
26
+ );
27
+ var MENU_ITEM_TEXT = "min-w-0 oprt-wrap-anywhere";
28
+ var MENU_ITEM_LABEL = "uppercase tracking-oprt-caps [&_code]:normal-case [&_code]:tracking-normal [&_kbd]:normal-case [&_kbd]:tracking-normal";
29
+ var MENU_ITEM_DESCRIPTION = "block text-oprt-sm normal-case tracking-normal";
30
+ var DESTRUCTIVE_ACTION = "Destructive action";
31
+ var MENU_ITEM_SHORTCUT = "shrink-0 font-mono text-oprt-sm normal-case tracking-normal text-oprt-text-dim forced-colors:[color:inherit]";
32
+ var MENU_EMPTY = "m-0 px-3u py-2u text-oprt-base normal-case text-oprt-text-dim";
33
+ function isSingleElement(node) {
34
+ return isValidElement(node) && node.type !== Fragment;
35
+ }
36
+ export {
37
+ DESTRUCTIVE_ACTION,
38
+ FORCED_ACTIVE_ROW,
39
+ MENU_EMPTY,
40
+ MENU_ITEM_DESCRIPTION,
41
+ MENU_ITEM_LABEL,
42
+ MENU_ITEM_SHORTCUT,
43
+ MENU_ITEM_TEXT,
44
+ MENU_OFFSET,
45
+ MENU_ROW,
46
+ MENU_SURFACE,
47
+ POPOVER_WIDTH,
48
+ SCREEN_MARGIN,
49
+ TOOLTIP_WIDTH,
50
+ isSingleElement,
51
+ menuItemStyles,
52
+ toPlacement
53
+ };
@@ -0,0 +1,125 @@
1
+ "use client";
2
+
3
+ // src/_internal/segmentField.ts
4
+ import {
5
+ createContext,
6
+ useCallback,
7
+ useRef,
8
+ useState
9
+ } from "react";
10
+ import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
11
+ function sameSnapshot(a, b) {
12
+ return a.value === b.value && a.empty === b.empty && a.valid === b.valid;
13
+ }
14
+ function useReportSegments(segments, read, report) {
15
+ const last = useRef(null);
16
+ useIsomorphicLayoutEffect(() => {
17
+ const snapshot = read(segments);
18
+ const previous = last.current;
19
+ if (previous && previous.report === report && sameSnapshot(previous.snapshot, snapshot)) return;
20
+ last.current = { snapshot, report };
21
+ report(snapshot);
22
+ }, [segments, read, report]);
23
+ }
24
+ function firstSegmentFocus(disabled, keep) {
25
+ return {
26
+ tabIndex: -1,
27
+ onFocus: (event) => {
28
+ if (event.target !== event.currentTarget || disabled || keep?.(event)) return;
29
+ event.currentTarget.querySelector("[role=spinbutton]")?.focus();
30
+ }
31
+ };
32
+ }
33
+ var FIELD_BOX_STYLES = "flex min-h-oprt-md min-w-0 items-center border border-oprt-border-control bg-oprt-surface-2 px-1u focus-visible:outline-hidden data-[focus-visible]:border-oprt-border-focus data-[focus-visible]:shadow-oprt-focus data-[invalid]:border-oprt-error data-[disabled]:cursor-not-allowed data-[disabled]:text-oprt-text-dim";
34
+ var SEGMENT_STYLES = "flex min-h-3u min-w-3u items-center justify-center px-0.5u font-mono text-oprt-base font-medium tabular-nums focus:outline-hidden forced-colors:data-[focused]:outline-solid forced-colors:data-[focused]:outline-2 forced-colors:data-[focused]:-outline-offset-2 forced-colors:data-[focused]:outline-[CanvasText] data-[type=literal]:min-w-0 data-[type=literal]:px-0 data-[placeholder]:text-oprt-text-placeholder data-[disabled]:data-[placeholder]:text-oprt-text-dim data-[focused]:bg-oprt-surface-3 data-[focus-visible]:shadow-oprt-focus data-[disabled]:cursor-not-allowed";
35
+ var FIELD_LABEL_STYLES = "m-0 min-w-0 font-medium oprt-wrap-anywhere";
36
+ var FIELD_COLUMNS = "grid min-w-0 grid-cols-[repeat(auto-fit,minmax(min(100%,calc(24*var(--oprt-space-1))),1fr))] items-start gap-2u";
37
+ var EDITING_KEYS = /* @__PURE__ */ new Set([
38
+ "Backspace",
39
+ "Delete",
40
+ "ArrowUp",
41
+ "ArrowDown",
42
+ "PageUp",
43
+ "PageDown",
44
+ "Home",
45
+ "End"
46
+ ]);
47
+ function isEditingKey(event) {
48
+ return !event.altKey && !event.ctrlKey && !event.metaKey && (/^[0-9]$/.test(event.key) || EDITING_KEYS.has(event.key));
49
+ }
50
+ function useSegmentDraft({
51
+ value,
52
+ displayed,
53
+ valid,
54
+ inactive
55
+ }) {
56
+ const initial = {
57
+ base: value,
58
+ snapshot: { value: displayed, empty: displayed === null, valid },
59
+ rejected: false,
60
+ rejection: null
61
+ };
62
+ const [draft, setDraft] = useState(initial);
63
+ const current = draft.base === value ? draft : initial;
64
+ const raw = useRef(current.snapshot);
65
+ const rejectBlur = useRef(false);
66
+ const report = useCallback(
67
+ (snapshot) => {
68
+ raw.current = snapshot;
69
+ setDraft(
70
+ (previous) => previous.base === value && sameSnapshot(previous.snapshot, snapshot) ? previous : previous.base === value ? { ...previous, snapshot } : { base: value, snapshot, rejected: false, rejection: null }
71
+ );
72
+ },
73
+ [value]
74
+ );
75
+ const beginEdit = () => {
76
+ if (inactive) return;
77
+ rejectBlur.current = false;
78
+ setDraft(
79
+ (previous) => previous.rejected ? { ...previous, rejected: false, rejection: null } : previous
80
+ );
81
+ };
82
+ return {
83
+ snapshot: current.snapshot,
84
+ rejected: current.rejected,
85
+ /** The message for the rejected edit, or null to use the field's general one. */
86
+ rejection: current.rejected ? current.rejection : null,
87
+ /** The field holds something other than `value`: an edit, or a rejected one. */
88
+ pending: current.rejected || current.snapshot.value !== displayed || current.snapshot.empty !== (displayed === null),
89
+ report,
90
+ editProps: {
91
+ onKeyDownCapture: (event) => {
92
+ if (isEditingKey(event)) beginEdit();
93
+ },
94
+ onBeforeInputCapture: beginEdit,
95
+ onBlurCapture: (event) => {
96
+ if (event.currentTarget.contains(event.relatedTarget)) return;
97
+ rejectBlur.current = !raw.current.valid;
98
+ if (rejectBlur.current)
99
+ setDraft((previous) => ({ ...previous, rejected: true, rejection: null }));
100
+ }
101
+ },
102
+ /** Whether React Aria's next change is the constrained value it emits after a rejected blur. */
103
+ blurRejected: () => rejectBlur.current,
104
+ /** Starts a new choice (opening the calendar): React Aria's next change is the operator's. */
105
+ releaseBlur: () => {
106
+ rejectBlur.current = false;
107
+ },
108
+ /** Rejects the operator's edit, with a message that says why (the bound it crossed), if any. */
109
+ reject: (message) => setDraft((previous) => ({ ...previous, rejected: true, rejection: message ?? null })),
110
+ accept: () => setDraft((previous) => ({ ...previous, rejected: false, rejection: null }))
111
+ };
112
+ }
113
+ var SegmentGroupContext = createContext(null);
114
+ export {
115
+ FIELD_BOX_STYLES,
116
+ FIELD_COLUMNS,
117
+ FIELD_LABEL_STYLES,
118
+ SEGMENT_STYLES,
119
+ SegmentGroupContext,
120
+ firstSegmentFocus,
121
+ isEditingKey,
122
+ sameSnapshot,
123
+ useReportSegments,
124
+ useSegmentDraft
125
+ };
@@ -0,0 +1,20 @@
1
+ // src/_internal/suggestions.ts
2
+ var SUGGESTION_OVERRIDES = {
3
+ Button: {
4
+ variant: {
5
+ success: "'success' is not a Button variant. Use variant='primary' for positive actions, or a Badge (variant='success') to display status.",
6
+ error: "'error' is not a Button variant. Use variant='danger' for destructive actions.",
7
+ warning: "'warning' is not a Button variant. Use variant='danger', or an Alert/Badge to display status.",
8
+ info: "'info' is not a Button variant. Use variant='secondary' or 'tertiary'."
9
+ }
10
+ },
11
+ Badge: {
12
+ variant: {
13
+ primary: "'primary' is not a Badge variant. Use 'neutral', or a status variant (success/warning/error/info).",
14
+ danger: "'danger' is not a Badge variant. Use 'error' for failed/critical status."
15
+ }
16
+ }
17
+ };
18
+ export {
19
+ SUGGESTION_OVERRIDES
20
+ };
@@ -0,0 +1,25 @@
1
+ // src/_internal/timestamp.ts
2
+ var MAX_TIME = 864e13;
3
+ function isValidTimestamp(value, options = {}) {
4
+ if (typeof value !== "number" || !Number.isFinite(value) || Math.abs(value) > MAX_TIME) {
5
+ return false;
6
+ }
7
+ if (options.integer === true && !Number.isInteger(value)) return false;
8
+ if (options.years === "1-9999") {
9
+ const year = new Date(value).getUTCFullYear();
10
+ if (year < 1 || year > 9999) return false;
11
+ }
12
+ return true;
13
+ }
14
+ function formatUtcTimestamp(value, options = {}) {
15
+ if (!isValidTimestamp(value)) return null;
16
+ const iso = new Date(value).toISOString();
17
+ const separator = iso.indexOf("T");
18
+ const clock = iso.slice(separator + 1, -1);
19
+ const shown = options.precision === "milliseconds" ? clock : clock.slice(0, 8);
20
+ return `${iso.slice(0, separator)} ${shown} UTC`;
21
+ }
22
+ export {
23
+ formatUtcTimestamp,
24
+ isValidTimestamp
25
+ };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+
3
+ // src/_internal/unavailable.ts
4
+ import { createContext, useContext } from "react";
5
+ var FocusableWhenUnavailableContext = createContext(false);
6
+ var FocusableWhenUnavailableProvider = FocusableWhenUnavailableContext.Provider;
7
+ function useFocusableWhenUnavailable() {
8
+ return useContext(FocusableWhenUnavailableContext);
9
+ }
10
+ export {
11
+ FocusableWhenUnavailableProvider,
12
+ useFocusableWhenUnavailable
13
+ };
@@ -0,0 +1,27 @@
1
+ "use client";
2
+
3
+ // src/_internal/useActionFocus.ts
4
+ import {
5
+ useImperativeHandle,
6
+ useRef
7
+ } from "react";
8
+ import { useRestoreFocusOnRemoval } from "./useRestoreFocusOnRemoval.js";
9
+ function useActionFocus(ref, { onFocusCapture, onBlurCapture } = {}) {
10
+ const root = useRef(null);
11
+ useImperativeHandle(ref, () => root.current, []);
12
+ const restore = useRestoreFocusOnRemoval(root);
13
+ return {
14
+ ref: root,
15
+ onFocusCapture: (event) => {
16
+ onFocusCapture?.(event);
17
+ restore.onFocusCapture(event);
18
+ },
19
+ onBlurCapture: (event) => {
20
+ onBlurCapture?.(event);
21
+ restore.onBlurCapture(event);
22
+ }
23
+ };
24
+ }
25
+ export {
26
+ useActionFocus
27
+ };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+
3
+ // src/_internal/useElementWidth.ts
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
6
+ function createResizeObserver(callback) {
7
+ return typeof ResizeObserver === "undefined" ? null : new ResizeObserver(callback);
8
+ }
9
+ function useElementWidth(ref, { initial, min = 0, select }) {
10
+ const [value, setValue] = useState(initial);
11
+ const measured = useRef(null);
12
+ const latest = useRef({ min, select });
13
+ useIsomorphicLayoutEffect(() => {
14
+ latest.current = { min, select };
15
+ });
16
+ useEffect(() => {
17
+ const element = ref.current;
18
+ if (!element) return;
19
+ const observer = createResizeObserver((entries) => {
20
+ const width = entries[entries.length - 1]?.contentRect.width;
21
+ if (width === void 0 || !Number.isFinite(width) || width <= latest.current.min) return;
22
+ measured.current = width;
23
+ const choose = latest.current.select;
24
+ setValue(choose ? choose(width) : width);
25
+ });
26
+ observer?.observe(element);
27
+ return () => observer?.disconnect();
28
+ }, [ref]);
29
+ useEffect(() => {
30
+ if (select && measured.current !== null) setValue(select(measured.current));
31
+ }, [select]);
32
+ return value;
33
+ }
34
+ export {
35
+ createResizeObserver,
36
+ useElementWidth
37
+ };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+
3
+ // src/_internal/useIsMounted.ts
4
+ import { useCallback, useRef } from "react";
5
+ import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
6
+ function useIsMounted() {
7
+ const mounted = useRef(false);
8
+ useIsomorphicLayoutEffect(() => {
9
+ mounted.current = true;
10
+ return () => {
11
+ mounted.current = false;
12
+ };
13
+ }, []);
14
+ return useCallback(() => mounted.current, []);
15
+ }
16
+ export {
17
+ useIsMounted
18
+ };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ // src/_internal/useIsomorphicLayoutEffect.ts
4
+ import { useEffect, useLayoutEffect } from "react";
5
+ var useIsomorphicLayoutEffect = typeof document === "undefined" ? useEffect : useLayoutEffect;
6
+ export {
7
+ useIsomorphicLayoutEffect
8
+ };