ingeniuscliq-core 0.4.18 → 0.4.20

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 (273) hide show
  1. package/dist/components/common/carousel/CustomCarousel.d.ts +1 -1
  2. package/dist/components/common/carousel/CustomCarousel.d.ts.map +1 -1
  3. package/dist/components/common/carousel/CustomCarouselSection.d.ts +1 -1
  4. package/dist/components/common/carousel/CustomCarouselSection.d.ts.map +1 -1
  5. package/dist/components/common/form/FormCheckbox.d.ts +1 -1
  6. package/dist/components/common/form/FormCheckbox.d.ts.map +1 -1
  7. package/dist/components/common/form/FormInput.d.ts +1 -1
  8. package/dist/components/common/form/FormInput.d.ts.map +1 -1
  9. package/dist/components/common/form/FormSelect.d.ts +1 -1
  10. package/dist/components/common/form/FormSelect.d.ts.map +1 -1
  11. package/dist/components/common/form/FormTextArea.d.ts +1 -1
  12. package/dist/components/common/form/FormTextArea.d.ts.map +1 -1
  13. package/dist/components/common/form/FormWrapper.d.ts +1 -1
  14. package/dist/components/common/form/FormWrapper.d.ts.map +1 -1
  15. package/dist/components/common/logo/Logo.d.ts +1 -1
  16. package/dist/components/common/logo/Logo.d.ts.map +1 -1
  17. package/dist/components/common/pagination/CustomPagination.d.ts +1 -1
  18. package/dist/components/common/pagination/CustomPagination.d.ts.map +1 -1
  19. package/dist/components/common/select/CustomSelect.d.ts +1 -1
  20. package/dist/components/common/select/CustomSelect.d.ts.map +1 -1
  21. package/dist/components/common/spinner/Spinner.d.ts +1 -1
  22. package/dist/components/common/spinner/Spinner.d.ts.map +1 -1
  23. package/dist/components/common/stepper/Stepper.d.ts +1 -1
  24. package/dist/components/common/stepper/Stepper.d.ts.map +1 -1
  25. package/dist/components/common/stepper/Stepper.tsx +1 -1
  26. package/dist/components/layouts/CoreBaseLayout.d.ts +1 -1
  27. package/dist/components/layouts/CoreBaseLayout.d.ts.map +1 -1
  28. package/dist/components/templates/CoreHomeLayout.d.ts +1 -1
  29. package/dist/components/templates/CoreHomeLayout.d.ts.map +1 -1
  30. package/dist/components/templates/CorePreviewLayout.d.ts +1 -1
  31. package/dist/components/templates/CorePreviewLayout.d.ts.map +1 -1
  32. package/dist/components/ui/accordion.tsx +9 -9
  33. package/dist/components/ui/alert-dialog.d.ts +2 -2
  34. package/dist/components/ui/alert-dialog.tsx +16 -16
  35. package/dist/components/ui/alert.d.ts +3 -3
  36. package/dist/components/ui/alert.d.ts.map +1 -1
  37. package/dist/components/ui/alert.tsx +1 -1
  38. package/dist/components/ui/avatar.tsx +7 -7
  39. package/dist/components/ui/badge.d.ts +4 -4
  40. package/dist/components/ui/badge.d.ts.map +1 -1
  41. package/dist/components/ui/badge.tsx +1 -1
  42. package/dist/components/ui/breadcrumb.d.ts +2 -2
  43. package/dist/components/ui/breadcrumb.tsx +3 -4
  44. package/dist/components/ui/button.d.ts +4 -4
  45. package/dist/components/ui/button.d.ts.map +1 -1
  46. package/dist/components/ui/button.tsx +2 -2
  47. package/dist/components/ui/carousel.tsx +2 -3
  48. package/dist/components/ui/checkbox.tsx +5 -5
  49. package/dist/components/ui/dialog.d.ts +2 -2
  50. package/dist/components/ui/dialog.tsx +15 -15
  51. package/dist/components/ui/dropdown-menu.d.ts +1 -1
  52. package/dist/components/ui/dropdown-menu.tsx +27 -29
  53. package/dist/components/ui/form.d.ts +1 -1
  54. package/dist/components/ui/form.d.ts.map +1 -1
  55. package/dist/components/ui/form.tsx +2 -2
  56. package/dist/components/ui/label.d.ts +1 -1
  57. package/dist/components/ui/label.d.ts.map +1 -1
  58. package/dist/components/ui/label.tsx +4 -4
  59. package/dist/components/ui/pagination.d.ts +5 -5
  60. package/dist/components/ui/pagination.tsx +2 -4
  61. package/dist/components/ui/popover.tsx +7 -7
  62. package/dist/components/ui/radio-group.tsx +7 -7
  63. package/dist/components/ui/select.tsx +25 -27
  64. package/dist/components/ui/separator.tsx +3 -3
  65. package/dist/components/ui/sheet.d.ts +5 -5
  66. package/dist/components/ui/sheet.d.ts.map +1 -1
  67. package/dist/components/ui/sheet.tsx +16 -16
  68. package/dist/components/ui/skeleton.d.ts +1 -1
  69. package/dist/components/ui/skeleton.d.ts.map +1 -1
  70. package/dist/components/ui/slider.tsx +6 -6
  71. package/dist/components/ui/stepper.tsx +4 -4
  72. package/dist/components/ui/switch.tsx +4 -4
  73. package/dist/components/ui/tabs.tsx +9 -9
  74. package/dist/components/ui/tooltip.tsx +6 -6
  75. package/dist/helpers/axiosGlobal.js +1 -2
  76. package/dist/hooks/useLanguage.js +2 -5
  77. package/dist/hooks/useNotification.js +1 -1
  78. package/dist/i18n/config.js +1 -5
  79. package/dist/lib/utils.js +1 -1
  80. package/dist/modules/CoreAuth/classes/CoreAuthBuilder.d.ts +2 -2
  81. package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
  82. package/dist/modules/CoreAuth/context/AuthContext.d.ts +2 -2
  83. package/dist/modules/CoreAuth/context/AuthContext.d.ts.map +1 -1
  84. package/dist/modules/CoreAuth/hooks/useAuth.d.ts +3 -3
  85. package/dist/modules/CoreAuth/index.js +1 -0
  86. package/dist/modules/CoreAuth/stores/authStore.d.ts +2 -2
  87. package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.d.ts +8 -8
  88. package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +1 -1
  89. package/dist/modules/CoreCustomization/index.js +1 -0
  90. package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +1 -1
  91. package/dist/modules/CoreOrder/index.js +1 -0
  92. package/dist/modules/CorePayForm/classes/CorePayFormBuilder.d.ts +2 -2
  93. package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
  94. package/dist/modules/CorePayForm/index.js +1 -0
  95. package/dist/modules/CoreProduct/classes/CoreProductBuilder.d.ts +8 -8
  96. package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
  97. package/dist/modules/CoreProduct/index.js +1 -0
  98. package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.d.ts +6 -6
  99. package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
  100. package/dist/modules/CoreShipment/index.js +1 -0
  101. package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.d.ts +4 -4
  102. package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
  103. package/package.json +21 -13
  104. package/src/commands/common/constants.js +10 -0
  105. package/src/commands/helpers/index.js +15 -0
  106. package/src/commands/helpers/strings.js +4 -0
  107. package/src/commands/templates/locale.js +14 -0
  108. package/src/commands/templates/service.js +12 -0
  109. package/src/commands/templates/type.js +10 -0
  110. package/README.md +0 -417
  111. package/dist/_virtual/index.js +0 -5
  112. package/dist/_virtual/index2.js +0 -3
  113. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -3
  114. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -3
  115. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -814
  116. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -751
  117. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -350
  118. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -161
  119. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -137
  120. package/dist/node_modules/@radix-ui/number/dist/index.js +0 -6
  121. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
  122. package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +0 -305
  123. package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +0 -147
  124. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
  125. package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +0 -118
  126. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +0 -270
  127. package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +0 -145
  128. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -70
  129. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
  130. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
  131. package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
  132. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -11
  133. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
  134. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -267
  135. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
  136. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
  137. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
  138. package/dist/node_modules/@radix-ui/react-label/dist/index.js +0 -24
  139. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -834
  140. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -299
  141. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -283
  142. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
  143. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
  144. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
  145. package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +0 -282
  146. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -223
  147. package/dist/node_modules/@radix-ui/react-select/dist/index.js +0 -1156
  148. package/dist/node_modules/@radix-ui/react-separator/dist/index.js +0 -30
  149. package/dist/node_modules/@radix-ui/react-slider/dist/index.js +0 -554
  150. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -99
  151. package/dist/node_modules/@radix-ui/react-switch/dist/index.js +0 -152
  152. package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +0 -187
  153. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +0 -482
  154. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
  155. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
  156. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
  157. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +0 -16
  158. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
  159. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -15
  160. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -40
  161. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -35
  162. package/dist/node_modules/@stepperize/core/dist/index.js +0 -3
  163. package/dist/node_modules/@stepperize/react/dist/index.js +0 -6
  164. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
  165. package/dist/node_modules/axios/index.js +0 -25
  166. package/dist/node_modules/axios/lib/adapters/adapters.js +0 -81
  167. package/dist/node_modules/axios/lib/adapters/fetch.js +0 -229
  168. package/dist/node_modules/axios/lib/adapters/xhr.js +0 -199
  169. package/dist/node_modules/axios/lib/axios.js +0 -86
  170. package/dist/node_modules/axios/lib/cancel/CancelToken.js +0 -133
  171. package/dist/node_modules/axios/lib/cancel/CanceledError.js +0 -23
  172. package/dist/node_modules/axios/lib/cancel/isCancel.js +0 -5
  173. package/dist/node_modules/axios/lib/core/Axios.js +0 -238
  174. package/dist/node_modules/axios/lib/core/AxiosError.js +0 -101
  175. package/dist/node_modules/axios/lib/core/AxiosHeaders.js +0 -312
  176. package/dist/node_modules/axios/lib/core/InterceptorManager.js +0 -69
  177. package/dist/node_modules/axios/lib/core/buildFullPath.js +0 -22
  178. package/dist/node_modules/axios/lib/core/dispatchRequest.js +0 -81
  179. package/dist/node_modules/axios/lib/core/mergeConfig.js +0 -106
  180. package/dist/node_modules/axios/lib/core/settle.js +0 -27
  181. package/dist/node_modules/axios/lib/core/transformData.js +0 -28
  182. package/dist/node_modules/axios/lib/defaults/index.js +0 -159
  183. package/dist/node_modules/axios/lib/defaults/transitional.js +0 -7
  184. package/dist/node_modules/axios/lib/env/data.js +0 -3
  185. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -56
  186. package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -71
  187. package/dist/node_modules/axios/lib/helpers/bind.js +0 -7
  188. package/dist/node_modules/axios/lib/helpers/buildURL.js +0 -69
  189. package/dist/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  190. package/dist/node_modules/axios/lib/helpers/composeSignals.js +0 -48
  191. package/dist/node_modules/axios/lib/helpers/cookies.js +0 -43
  192. package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +0 -93
  193. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
  194. package/dist/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  195. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  196. package/dist/node_modules/axios/lib/helpers/null.js +0 -4
  197. package/dist/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
  198. package/dist/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  199. package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +0 -46
  200. package/dist/node_modules/axios/lib/helpers/resolveConfig.js +0 -58
  201. package/dist/node_modules/axios/lib/helpers/speedometer.js +0 -53
  202. package/dist/node_modules/axios/lib/helpers/spread.js +0 -28
  203. package/dist/node_modules/axios/lib/helpers/throttle.js +0 -44
  204. package/dist/node_modules/axios/lib/helpers/toFormData.js +0 -219
  205. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  206. package/dist/node_modules/axios/lib/helpers/trackStream.js +0 -88
  207. package/dist/node_modules/axios/lib/helpers/validator.js +0 -99
  208. package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  209. package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  210. package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
  211. package/dist/node_modules/axios/lib/platform/browser/index.js +0 -15
  212. package/dist/node_modules/axios/lib/platform/common/utils.js +0 -45
  213. package/dist/node_modules/axios/lib/platform/index.js +0 -9
  214. package/dist/node_modules/axios/lib/utils.js +0 -780
  215. package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
  216. package/dist/node_modules/clsx/dist/clsx.js +0 -3
  217. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
  218. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
  219. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
  220. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
  221. package/dist/node_modules/lucide-react/dist/esm/Icon.js +0 -43
  222. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -30
  223. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -20
  224. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.js +0 -17
  225. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-right.js +0 -17
  226. package/dist/node_modules/lucide-react/dist/esm/icons/check.js +0 -14
  227. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -14
  228. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +0 -14
  229. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +0 -14
  230. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -14
  231. package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +0 -14
  232. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +0 -18
  233. package/dist/node_modules/lucide-react/dist/esm/icons/x.js +0 -17
  234. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -28
  235. package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -560
  236. package/dist/node_modules/react-i18next/dist/es/IcuTransUtils/htmlEntityDecoder.js +0 -210
  237. package/dist/node_modules/react-i18next/dist/es/context.js +0 -18
  238. package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -22
  239. package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -7
  240. package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -12
  241. package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -27
  242. package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -157
  243. package/dist/node_modules/react-i18next/dist/es/utils.js +0 -63
  244. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
  245. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -167
  246. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
  247. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
  248. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
  249. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  250. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  251. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
  252. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
  253. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
  254. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
  255. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
  256. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
  257. package/dist/node_modules/sonner/dist/index.js +0 -299
  258. package/dist/node_modules/tslib/tslib.es6.js +0 -56
  259. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
  260. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
  261. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
  262. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
  263. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
  264. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -106
  265. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
  266. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -19
  267. package/dist/node_modules/zustand/esm/react.js +0 -22
  268. package/dist/node_modules/zustand/esm/vanilla.js +0 -24
  269. /package/src/{core/commands → commands}/create-core-module.js +0 -0
  270. /package/src/{core/commands → commands}/create-module.js +0 -0
  271. /package/src/{core/commands → commands}/create-template.js +0 -0
  272. /package/src/{core/commands → commands}/rollback-core-module.js +0 -0
  273. /package/src/{core/commands → commands}/rollback-module.js +0 -0
@@ -1,130 +0,0 @@
1
- import * as React from 'react';
2
- import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
3
- import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
4
-
5
- function useStateMachine(initialState, machine) {
6
- return React.useReducer((state, event) => {
7
- const nextState = machine[state][event];
8
- return nextState ?? state;
9
- }, initialState);
10
- }
11
-
12
- // src/presence.tsx
13
- var Presence = (props) => {
14
- const { present, children } = props;
15
- const presence = usePresence(present);
16
- const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
17
- const ref = useComposedRefs(presence.ref, getElementRef(child));
18
- const forceMount = typeof children === "function";
19
- return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
20
- };
21
- Presence.displayName = "Presence";
22
- function usePresence(present) {
23
- const [node, setNode] = React.useState();
24
- const stylesRef = React.useRef(null);
25
- const prevPresentRef = React.useRef(present);
26
- const prevAnimationNameRef = React.useRef("none");
27
- const initialState = present ? "mounted" : "unmounted";
28
- const [state, send] = useStateMachine(initialState, {
29
- mounted: {
30
- UNMOUNT: "unmounted",
31
- ANIMATION_OUT: "unmountSuspended"
32
- },
33
- unmountSuspended: {
34
- MOUNT: "mounted",
35
- ANIMATION_END: "unmounted"
36
- },
37
- unmounted: {
38
- MOUNT: "mounted"
39
- }
40
- });
41
- React.useEffect(() => {
42
- const currentAnimationName = getAnimationName(stylesRef.current);
43
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
44
- }, [state]);
45
- useLayoutEffect2(() => {
46
- const styles = stylesRef.current;
47
- const wasPresent = prevPresentRef.current;
48
- const hasPresentChanged = wasPresent !== present;
49
- if (hasPresentChanged) {
50
- const prevAnimationName = prevAnimationNameRef.current;
51
- const currentAnimationName = getAnimationName(styles);
52
- if (present) {
53
- send("MOUNT");
54
- } else if (currentAnimationName === "none" || styles?.display === "none") {
55
- send("UNMOUNT");
56
- } else {
57
- const isAnimating = prevAnimationName !== currentAnimationName;
58
- if (wasPresent && isAnimating) {
59
- send("ANIMATION_OUT");
60
- } else {
61
- send("UNMOUNT");
62
- }
63
- }
64
- prevPresentRef.current = present;
65
- }
66
- }, [present, send]);
67
- useLayoutEffect2(() => {
68
- if (node) {
69
- let timeoutId;
70
- const ownerWindow = node.ownerDocument.defaultView ?? window;
71
- const handleAnimationEnd = (event) => {
72
- const currentAnimationName = getAnimationName(stylesRef.current);
73
- const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
74
- if (event.target === node && isCurrentAnimation) {
75
- send("ANIMATION_END");
76
- if (!prevPresentRef.current) {
77
- const currentFillMode = node.style.animationFillMode;
78
- node.style.animationFillMode = "forwards";
79
- timeoutId = ownerWindow.setTimeout(() => {
80
- if (node.style.animationFillMode === "forwards") {
81
- node.style.animationFillMode = currentFillMode;
82
- }
83
- });
84
- }
85
- }
86
- };
87
- const handleAnimationStart = (event) => {
88
- if (event.target === node) {
89
- prevAnimationNameRef.current = getAnimationName(stylesRef.current);
90
- }
91
- };
92
- node.addEventListener("animationstart", handleAnimationStart);
93
- node.addEventListener("animationcancel", handleAnimationEnd);
94
- node.addEventListener("animationend", handleAnimationEnd);
95
- return () => {
96
- ownerWindow.clearTimeout(timeoutId);
97
- node.removeEventListener("animationstart", handleAnimationStart);
98
- node.removeEventListener("animationcancel", handleAnimationEnd);
99
- node.removeEventListener("animationend", handleAnimationEnd);
100
- };
101
- } else {
102
- send("ANIMATION_END");
103
- }
104
- }, [node, send]);
105
- return {
106
- isPresent: ["mounted", "unmountSuspended"].includes(state),
107
- ref: React.useCallback((node2) => {
108
- stylesRef.current = node2 ? getComputedStyle(node2) : null;
109
- setNode(node2);
110
- }, [])
111
- };
112
- }
113
- function getAnimationName(styles) {
114
- return styles?.animationName || "none";
115
- }
116
- function getElementRef(element) {
117
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
118
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
119
- if (mayWarn) {
120
- return element.ref;
121
- }
122
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
123
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
124
- if (mayWarn) {
125
- return element.props.ref;
126
- }
127
- return element.props.ref || element.ref;
128
- }
129
-
130
- export { Presence };
@@ -1,43 +0,0 @@
1
- import * as React from 'react';
2
- import * as ReactDOM from 'react-dom';
3
- import { createSlot } from '../../react-slot/dist/index.js';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- // src/primitive.tsx
7
- var NODES = [
8
- "a",
9
- "button",
10
- "div",
11
- "form",
12
- "h2",
13
- "h3",
14
- "img",
15
- "input",
16
- "label",
17
- "li",
18
- "nav",
19
- "ol",
20
- "p",
21
- "select",
22
- "span",
23
- "svg",
24
- "ul"
25
- ];
26
- var Primitive = NODES.reduce((primitive, node) => {
27
- const Slot = createSlot(`Primitive.${node}`);
28
- const Node = React.forwardRef((props, forwardedRef) => {
29
- const { asChild, ...primitiveProps } = props;
30
- const Comp = asChild ? Slot : node;
31
- if (typeof window !== "undefined") {
32
- window[Symbol.for("radix-ui")] = true;
33
- }
34
- return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
35
- });
36
- Node.displayName = `Primitive.${node}`;
37
- return { ...primitive, [node]: Node };
38
- }, {});
39
- function dispatchDiscreteCustomEvent(target, event) {
40
- if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
41
- }
42
-
43
- export { Primitive, dispatchDiscreteCustomEvent };
@@ -1,282 +0,0 @@
1
- import * as React from 'react';
2
- import { composeEventHandlers } from '../../primitive/dist/index.js';
3
- import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
4
- import { createContextScope } from '../../react-context/dist/index.js';
5
- import { Primitive } from '../../react-primitive/dist/index.js';
6
- import { createRovingFocusGroupScope, Root, Item } from '../../react-roving-focus/dist/index.js';
7
- import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
8
- import { useDirection } from '../../react-direction/dist/index.js';
9
- import { useSize } from '../../react-use-size/dist/index.js';
10
- import { usePrevious } from '../../react-use-previous/dist/index.js';
11
- import { Presence } from '../../react-presence/dist/index.js';
12
- import { jsx, jsxs } from 'react/jsx-runtime';
13
-
14
- var RADIO_NAME = "Radio";
15
- var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
16
- var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
17
- var Radio = React.forwardRef(
18
- (props, forwardedRef) => {
19
- const {
20
- __scopeRadio,
21
- name,
22
- checked = false,
23
- required,
24
- disabled,
25
- value = "on",
26
- onCheck,
27
- form,
28
- ...radioProps
29
- } = props;
30
- const [button, setButton] = React.useState(null);
31
- const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
32
- const hasConsumerStoppedPropagationRef = React.useRef(false);
33
- const isFormControl = button ? form || !!button.closest("form") : true;
34
- return /* @__PURE__ */ jsxs(RadioProvider, { scope: __scopeRadio, checked, disabled, children: [
35
- /* @__PURE__ */ jsx(
36
- Primitive.button,
37
- {
38
- type: "button",
39
- role: "radio",
40
- "aria-checked": checked,
41
- "data-state": getState(checked),
42
- "data-disabled": disabled ? "" : void 0,
43
- disabled,
44
- value,
45
- ...radioProps,
46
- ref: composedRefs,
47
- onClick: composeEventHandlers(props.onClick, (event) => {
48
- if (!checked) onCheck?.();
49
- if (isFormControl) {
50
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
51
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
52
- }
53
- })
54
- }
55
- ),
56
- isFormControl && /* @__PURE__ */ jsx(
57
- RadioBubbleInput,
58
- {
59
- control: button,
60
- bubbles: !hasConsumerStoppedPropagationRef.current,
61
- name,
62
- value,
63
- checked,
64
- required,
65
- disabled,
66
- form,
67
- style: { transform: "translateX(-100%)" }
68
- }
69
- )
70
- ] });
71
- }
72
- );
73
- Radio.displayName = RADIO_NAME;
74
- var INDICATOR_NAME = "RadioIndicator";
75
- var RadioIndicator = React.forwardRef(
76
- (props, forwardedRef) => {
77
- const { __scopeRadio, forceMount, ...indicatorProps } = props;
78
- const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
79
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.checked, children: /* @__PURE__ */ jsx(
80
- Primitive.span,
81
- {
82
- "data-state": getState(context.checked),
83
- "data-disabled": context.disabled ? "" : void 0,
84
- ...indicatorProps,
85
- ref: forwardedRef
86
- }
87
- ) });
88
- }
89
- );
90
- RadioIndicator.displayName = INDICATOR_NAME;
91
- var BUBBLE_INPUT_NAME = "RadioBubbleInput";
92
- var RadioBubbleInput = React.forwardRef(
93
- ({
94
- __scopeRadio,
95
- control,
96
- checked,
97
- bubbles = true,
98
- ...props
99
- }, forwardedRef) => {
100
- const ref = React.useRef(null);
101
- const composedRefs = useComposedRefs(ref, forwardedRef);
102
- const prevChecked = usePrevious(checked);
103
- const controlSize = useSize(control);
104
- React.useEffect(() => {
105
- const input = ref.current;
106
- if (!input) return;
107
- const inputProto = window.HTMLInputElement.prototype;
108
- const descriptor = Object.getOwnPropertyDescriptor(
109
- inputProto,
110
- "checked"
111
- );
112
- const setChecked = descriptor.set;
113
- if (prevChecked !== checked && setChecked) {
114
- const event = new Event("click", { bubbles });
115
- setChecked.call(input, checked);
116
- input.dispatchEvent(event);
117
- }
118
- }, [prevChecked, checked, bubbles]);
119
- return /* @__PURE__ */ jsx(
120
- Primitive.input,
121
- {
122
- type: "radio",
123
- "aria-hidden": true,
124
- defaultChecked: checked,
125
- ...props,
126
- tabIndex: -1,
127
- ref: composedRefs,
128
- style: {
129
- ...props.style,
130
- ...controlSize,
131
- position: "absolute",
132
- pointerEvents: "none",
133
- opacity: 0,
134
- margin: 0
135
- }
136
- }
137
- );
138
- }
139
- );
140
- RadioBubbleInput.displayName = BUBBLE_INPUT_NAME;
141
- function getState(checked) {
142
- return checked ? "checked" : "unchecked";
143
- }
144
- var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
145
- var RADIO_GROUP_NAME = "RadioGroup";
146
- var [createRadioGroupContext] = createContextScope(RADIO_GROUP_NAME, [
147
- createRovingFocusGroupScope,
148
- createRadioScope
149
- ]);
150
- var useRovingFocusGroupScope = createRovingFocusGroupScope();
151
- var useRadioScope = createRadioScope();
152
- var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
153
- var RadioGroup = React.forwardRef(
154
- (props, forwardedRef) => {
155
- const {
156
- __scopeRadioGroup,
157
- name,
158
- defaultValue,
159
- value: valueProp,
160
- required = false,
161
- disabled = false,
162
- orientation,
163
- dir,
164
- loop = true,
165
- onValueChange,
166
- ...groupProps
167
- } = props;
168
- const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
169
- const direction = useDirection(dir);
170
- const [value, setValue] = useControllableState({
171
- prop: valueProp,
172
- defaultProp: defaultValue ?? null,
173
- onChange: onValueChange,
174
- caller: RADIO_GROUP_NAME
175
- });
176
- return /* @__PURE__ */ jsx(
177
- RadioGroupProvider,
178
- {
179
- scope: __scopeRadioGroup,
180
- name,
181
- required,
182
- disabled,
183
- value,
184
- onValueChange: setValue,
185
- children: /* @__PURE__ */ jsx(
186
- Root,
187
- {
188
- asChild: true,
189
- ...rovingFocusGroupScope,
190
- orientation,
191
- dir: direction,
192
- loop,
193
- children: /* @__PURE__ */ jsx(
194
- Primitive.div,
195
- {
196
- role: "radiogroup",
197
- "aria-required": required,
198
- "aria-orientation": orientation,
199
- "data-disabled": disabled ? "" : void 0,
200
- dir: direction,
201
- ...groupProps,
202
- ref: forwardedRef
203
- }
204
- )
205
- }
206
- )
207
- }
208
- );
209
- }
210
- );
211
- RadioGroup.displayName = RADIO_GROUP_NAME;
212
- var ITEM_NAME = "RadioGroupItem";
213
- var RadioGroupItem = React.forwardRef(
214
- (props, forwardedRef) => {
215
- const { __scopeRadioGroup, disabled, ...itemProps } = props;
216
- const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);
217
- const isDisabled = context.disabled || disabled;
218
- const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
219
- const radioScope = useRadioScope(__scopeRadioGroup);
220
- const ref = React.useRef(null);
221
- const composedRefs = useComposedRefs(forwardedRef, ref);
222
- const checked = context.value === itemProps.value;
223
- const isArrowKeyPressedRef = React.useRef(false);
224
- React.useEffect(() => {
225
- const handleKeyDown = (event) => {
226
- if (ARROW_KEYS.includes(event.key)) {
227
- isArrowKeyPressedRef.current = true;
228
- }
229
- };
230
- const handleKeyUp = () => isArrowKeyPressedRef.current = false;
231
- document.addEventListener("keydown", handleKeyDown);
232
- document.addEventListener("keyup", handleKeyUp);
233
- return () => {
234
- document.removeEventListener("keydown", handleKeyDown);
235
- document.removeEventListener("keyup", handleKeyUp);
236
- };
237
- }, []);
238
- return /* @__PURE__ */ jsx(
239
- Item,
240
- {
241
- asChild: true,
242
- ...rovingFocusGroupScope,
243
- focusable: !isDisabled,
244
- active: checked,
245
- children: /* @__PURE__ */ jsx(
246
- Radio,
247
- {
248
- disabled: isDisabled,
249
- required: context.required,
250
- checked,
251
- ...radioScope,
252
- ...itemProps,
253
- name: context.name,
254
- ref: composedRefs,
255
- onCheck: () => context.onValueChange(itemProps.value),
256
- onKeyDown: composeEventHandlers((event) => {
257
- if (event.key === "Enter") event.preventDefault();
258
- }),
259
- onFocus: composeEventHandlers(itemProps.onFocus, () => {
260
- if (isArrowKeyPressedRef.current) ref.current?.click();
261
- })
262
- }
263
- )
264
- }
265
- );
266
- }
267
- );
268
- RadioGroupItem.displayName = ITEM_NAME;
269
- var INDICATOR_NAME2 = "RadioGroupIndicator";
270
- var RadioGroupIndicator = React.forwardRef(
271
- (props, forwardedRef) => {
272
- const { __scopeRadioGroup, ...indicatorProps } = props;
273
- const radioScope = useRadioScope(__scopeRadioGroup);
274
- return /* @__PURE__ */ jsx(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef });
275
- }
276
- );
277
- RadioGroupIndicator.displayName = INDICATOR_NAME2;
278
- var Root2 = RadioGroup;
279
- var Item2 = RadioGroupItem;
280
- var Indicator = RadioGroupIndicator;
281
-
282
- export { Indicator, Item2 as Item, RadioGroup, RadioGroupIndicator, RadioGroupItem, Root2 as Root };
@@ -1,223 +0,0 @@
1
- import * as React from 'react';
2
- import { composeEventHandlers } from '../../primitive/dist/index.js';
3
- import { createCollection } from '../../react-collection/dist/index.js';
4
- import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
5
- import { createContextScope } from '../../react-context/dist/index.js';
6
- import { useId } from '../../react-id/dist/index.js';
7
- import { Primitive } from '../../react-primitive/dist/index.js';
8
- import { useCallbackRef } from '../../react-use-callback-ref/dist/index.js';
9
- import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
10
- import { useDirection } from '../../react-direction/dist/index.js';
11
- import { jsx } from 'react/jsx-runtime';
12
-
13
- var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
14
- var EVENT_OPTIONS = { bubbles: false, cancelable: true };
15
- var GROUP_NAME = "RovingFocusGroup";
16
- var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
17
- var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
18
- GROUP_NAME,
19
- [createCollectionScope]
20
- );
21
- var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
22
- var RovingFocusGroup = React.forwardRef(
23
- (props, forwardedRef) => {
24
- return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
25
- }
26
- );
27
- RovingFocusGroup.displayName = GROUP_NAME;
28
- var RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {
29
- const {
30
- __scopeRovingFocusGroup,
31
- orientation,
32
- loop = false,
33
- dir,
34
- currentTabStopId: currentTabStopIdProp,
35
- defaultCurrentTabStopId,
36
- onCurrentTabStopIdChange,
37
- onEntryFocus,
38
- preventScrollOnEntryFocus = false,
39
- ...groupProps
40
- } = props;
41
- const ref = React.useRef(null);
42
- const composedRefs = useComposedRefs(forwardedRef, ref);
43
- const direction = useDirection(dir);
44
- const [currentTabStopId, setCurrentTabStopId] = useControllableState({
45
- prop: currentTabStopIdProp,
46
- defaultProp: defaultCurrentTabStopId ?? null,
47
- onChange: onCurrentTabStopIdChange,
48
- caller: GROUP_NAME
49
- });
50
- const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
51
- const handleEntryFocus = useCallbackRef(onEntryFocus);
52
- const getItems = useCollection(__scopeRovingFocusGroup);
53
- const isClickFocusRef = React.useRef(false);
54
- const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
55
- React.useEffect(() => {
56
- const node = ref.current;
57
- if (node) {
58
- node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
59
- return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
60
- }
61
- }, [handleEntryFocus]);
62
- return /* @__PURE__ */ jsx(
63
- RovingFocusProvider,
64
- {
65
- scope: __scopeRovingFocusGroup,
66
- orientation,
67
- dir: direction,
68
- loop,
69
- currentTabStopId,
70
- onItemFocus: React.useCallback(
71
- (tabStopId) => setCurrentTabStopId(tabStopId),
72
- [setCurrentTabStopId]
73
- ),
74
- onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
75
- onFocusableItemAdd: React.useCallback(
76
- () => setFocusableItemsCount((prevCount) => prevCount + 1),
77
- []
78
- ),
79
- onFocusableItemRemove: React.useCallback(
80
- () => setFocusableItemsCount((prevCount) => prevCount - 1),
81
- []
82
- ),
83
- children: /* @__PURE__ */ jsx(
84
- Primitive.div,
85
- {
86
- tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
87
- "data-orientation": orientation,
88
- ...groupProps,
89
- ref: composedRefs,
90
- style: { outline: "none", ...props.style },
91
- onMouseDown: composeEventHandlers(props.onMouseDown, () => {
92
- isClickFocusRef.current = true;
93
- }),
94
- onFocus: composeEventHandlers(props.onFocus, (event) => {
95
- const isKeyboardFocus = !isClickFocusRef.current;
96
- if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
97
- const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
98
- event.currentTarget.dispatchEvent(entryFocusEvent);
99
- if (!entryFocusEvent.defaultPrevented) {
100
- const items = getItems().filter((item) => item.focusable);
101
- const activeItem = items.find((item) => item.active);
102
- const currentItem = items.find((item) => item.id === currentTabStopId);
103
- const candidateItems = [activeItem, currentItem, ...items].filter(
104
- Boolean
105
- );
106
- const candidateNodes = candidateItems.map((item) => item.ref.current);
107
- focusFirst(candidateNodes, preventScrollOnEntryFocus);
108
- }
109
- }
110
- isClickFocusRef.current = false;
111
- }),
112
- onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
113
- }
114
- )
115
- }
116
- );
117
- });
118
- var ITEM_NAME = "RovingFocusGroupItem";
119
- var RovingFocusGroupItem = React.forwardRef(
120
- (props, forwardedRef) => {
121
- const {
122
- __scopeRovingFocusGroup,
123
- focusable = true,
124
- active = false,
125
- tabStopId,
126
- children,
127
- ...itemProps
128
- } = props;
129
- const autoId = useId();
130
- const id = tabStopId || autoId;
131
- const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
132
- const isCurrentTabStop = context.currentTabStopId === id;
133
- const getItems = useCollection(__scopeRovingFocusGroup);
134
- const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
135
- React.useEffect(() => {
136
- if (focusable) {
137
- onFocusableItemAdd();
138
- return () => onFocusableItemRemove();
139
- }
140
- }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
141
- return /* @__PURE__ */ jsx(
142
- Collection.ItemSlot,
143
- {
144
- scope: __scopeRovingFocusGroup,
145
- id,
146
- focusable,
147
- active,
148
- children: /* @__PURE__ */ jsx(
149
- Primitive.span,
150
- {
151
- tabIndex: isCurrentTabStop ? 0 : -1,
152
- "data-orientation": context.orientation,
153
- ...itemProps,
154
- ref: forwardedRef,
155
- onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
156
- if (!focusable) event.preventDefault();
157
- else context.onItemFocus(id);
158
- }),
159
- onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
160
- onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
161
- if (event.key === "Tab" && event.shiftKey) {
162
- context.onItemShiftTab();
163
- return;
164
- }
165
- if (event.target !== event.currentTarget) return;
166
- const focusIntent = getFocusIntent(event, context.orientation, context.dir);
167
- if (focusIntent !== void 0) {
168
- if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
169
- event.preventDefault();
170
- const items = getItems().filter((item) => item.focusable);
171
- let candidateNodes = items.map((item) => item.ref.current);
172
- if (focusIntent === "last") candidateNodes.reverse();
173
- else if (focusIntent === "prev" || focusIntent === "next") {
174
- if (focusIntent === "prev") candidateNodes.reverse();
175
- const currentIndex = candidateNodes.indexOf(event.currentTarget);
176
- candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
177
- }
178
- setTimeout(() => focusFirst(candidateNodes));
179
- }
180
- }),
181
- children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children
182
- }
183
- )
184
- }
185
- );
186
- }
187
- );
188
- RovingFocusGroupItem.displayName = ITEM_NAME;
189
- var MAP_KEY_TO_FOCUS_INTENT = {
190
- ArrowLeft: "prev",
191
- ArrowUp: "prev",
192
- ArrowRight: "next",
193
- ArrowDown: "next",
194
- PageUp: "first",
195
- Home: "first",
196
- PageDown: "last",
197
- End: "last"
198
- };
199
- function getDirectionAwareKey(key, dir) {
200
- if (dir !== "rtl") return key;
201
- return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
202
- }
203
- function getFocusIntent(event, orientation, dir) {
204
- const key = getDirectionAwareKey(event.key, dir);
205
- if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
206
- if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
207
- return MAP_KEY_TO_FOCUS_INTENT[key];
208
- }
209
- function focusFirst(candidates, preventScroll = false) {
210
- const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
211
- for (const candidate of candidates) {
212
- if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
213
- candidate.focus({ preventScroll });
214
- if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
215
- }
216
- }
217
- function wrapArray(array, startIndex) {
218
- return array.map((_, index) => array[(startIndex + index) % array.length]);
219
- }
220
- var Root = RovingFocusGroup;
221
- var Item = RovingFocusGroupItem;
222
-
223
- export { Item, Root, RovingFocusGroup, RovingFocusGroupItem, createRovingFocusGroupScope };