@koide-labs/ui 0.0.0 → 0.0.2
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.
- package/README.md +53 -3
- package/{src/-types.ts → dist/-types.d.ts} +1 -6
- package/dist/-types.js +1 -0
- package/dist/-utils.d.ts +19 -0
- package/dist/-utils.js +33 -0
- package/dist/Button-DrPFFzo7.js +31 -0
- package/dist/CompositeRoot-CVk5a-pR.js +233 -0
- package/dist/DirectionContext-C2o_MF_i.js +9 -0
- package/dist/FieldItemContext-DAvk99to.js +11 -0
- package/dist/FloatingPortal-tWyuKRSN.js +435 -0
- package/dist/FloatingPortalLite-DVyq6YhV.js +28 -0
- package/dist/InternalBackdrop-jYAiOJ8v.js +574 -0
- package/dist/LabelableContext-BMvjVwor.js +169 -0
- package/dist/ToolbarRootContext-CvvL0Tk1.js +9 -0
- package/dist/clamp-D0KDAQIz.js +6 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/accordion/index.d.ts +12 -0
- package/dist/components/accordion/index.js +699 -0
- package/dist/components/alert-dialog/index.d.ts +26 -0
- package/dist/components/alert-dialog/index.js +136 -0
- package/dist/components/anchor/index.d.ts +8 -0
- package/dist/components/anchor/index.js +38 -0
- package/dist/components/avatar/index.d.ts +21 -0
- package/dist/components/avatar/index.js +161 -0
- package/dist/components/badge/index.d.ts +16 -0
- package/dist/components/badge/index.js +40 -0
- package/dist/components/button/index.d.ts +24 -0
- package/dist/components/button/index.js +47 -0
- package/dist/components/checkbox/index.d.ts +9 -0
- package/dist/components/checkbox/index.js +269 -0
- package/dist/components/code/index.d.ts +9 -0
- package/dist/components/code/index.js +10 -0
- package/dist/components/collapse/index.d.ts +11 -0
- package/dist/components/collapse/index.js +41 -0
- package/dist/components/command/index.d.ts +14 -0
- package/dist/components/command/index.js +1695 -0
- package/dist/components/context-menu/index.d.ts +42 -0
- package/dist/components/context-menu/index.js +1444 -0
- package/dist/components/dialog/index.d.ts +48 -0
- package/dist/components/dialog/index.js +138 -0
- package/dist/components/heading/index.d.ts +44 -0
- package/dist/components/heading/index.js +56 -0
- package/dist/components/icon/icon-names.d.ts +1 -0
- package/dist/components/icon/icon-names.js +1 -0
- package/dist/components/icon/index.d.ts +24 -0
- package/dist/components/icon/index.js +43 -0
- package/dist/components/icon-button/index.d.ts +12 -0
- package/dist/components/icon-button/index.js +45 -0
- package/dist/components/inline-code/index.d.ts +6 -0
- package/dist/components/inline-code/index.js +22 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/index.js +119 -0
- package/dist/components/meter/index.d.ts +18 -0
- package/dist/components/meter/index.js +165 -0
- package/dist/components/multiline-input/index.d.ts +6 -0
- package/dist/components/multiline-input/index.js +100 -0
- package/dist/components/number-input/index.d.ts +10 -0
- package/dist/components/number-input/index.js +1169 -0
- package/dist/components/password-input/index.d.ts +2 -0
- package/dist/components/password-input/index.js +29 -0
- package/dist/components/pill/index.d.ts +13 -0
- package/dist/components/pill/index.js +38 -0
- package/dist/components/popover/index.d.ts +21 -0
- package/dist/components/popover/index.js +636 -0
- package/dist/components/preview-card/index.d.ts +17 -0
- package/dist/components/preview-card/index.js +402 -0
- package/dist/components/radio/index.d.ts +13 -0
- package/dist/components/radio/index.js +404 -0
- package/dist/components/search-bar/index.d.ts +12 -0
- package/dist/components/search-bar/index.js +48 -0
- package/dist/components/select/index.d.ts +16 -0
- package/dist/components/select/index.js +1263 -0
- package/dist/components/separator/index.d.ts +7 -0
- package/dist/components/separator/index.js +6 -0
- package/dist/components/slider/index.d.ts +5 -0
- package/dist/components/slider/index.js +902 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +13 -0
- package/dist/components/stacked-avatars/index.d.ts +14 -0
- package/dist/components/stacked-avatars/index.js +92 -0
- package/dist/components/status-banner/index.d.ts +17 -0
- package/dist/components/status-banner/index.js +69 -0
- package/dist/components/surface/index.d.ts +27 -0
- package/dist/components/surface/index.js +41 -0
- package/dist/components/switch/index.d.ts +5 -0
- package/dist/components/switch/index.js +196 -0
- package/dist/components/tabs/index.d.ts +18 -0
- package/dist/components/tabs/index.js +509 -0
- package/dist/components/text/index.d.ts +26 -0
- package/dist/components/text/index.js +51 -0
- package/dist/components/theme-provider/index.d.ts +2 -0
- package/dist/components/theme-provider/index.js +6 -0
- package/dist/components/theme-provider/theme-context.d.ts +9 -0
- package/dist/components/theme-provider/theme-context.js +13 -0
- package/dist/components/theme-provider/theme-provider.d.ts +17 -0
- package/dist/components/theme-provider/theme-provider.js +30 -0
- package/dist/components/timestamp/index.d.ts +23 -0
- package/dist/components/timestamp/index.js +1392 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +7 -0
- package/dist/components/toast/toast.d.ts +2 -0
- package/dist/components/toast/toast.js +878 -0
- package/dist/components/toast/use-toast-manager.d.ts +27 -0
- package/dist/components/toast/use-toast-manager.js +4 -0
- package/dist/components/tooltip/index.d.ts +14 -0
- package/dist/components/tooltip/index.js +712 -0
- package/dist/components/tooltip/tooltip-arrow.d.ts +3 -0
- package/dist/components/tooltip/tooltip-arrow.js +6 -0
- package/dist/components/view/index.d.ts +30 -0
- package/dist/components/view/index.js +84 -0
- package/dist/components/visually-hidden/index.d.ts +1 -0
- package/dist/components/visually-hidden/index.js +4 -0
- package/dist/composite-Bx7Szd_T.js +208 -0
- package/dist/composite-C9L5QmZL.js +66 -0
- package/dist/createBaseUIEventDetails-D8M2Yl-a.js +59 -0
- package/dist/detectBrowser-I-s3yzIE.js +43 -0
- package/dist/dialog.css +1 -0
- package/dist/dialog.module-BeF-6XAo.js +415 -0
- package/dist/element-CZEOj04G.js +80 -0
- package/dist/event-CKoGyQEJ.js +30 -0
- package/dist/floating-ui.utils-C7pRWMZ_.js +128 -0
- package/dist/floating-ui.utils.dom-C7FS5id0.js +135 -0
- package/dist/formatErrorMessage-BqPuTBN-.js +7 -0
- package/dist/formatNumber-1UNwjeqf.js +25 -0
- package/dist/getDisabledMountTransitionStyles-YfHPge6T.js +1510 -0
- package/dist/index-BX1XbbRk.js +1206 -0
- package/dist/index-CeuccO-T.js +109 -0
- package/dist/index-DN9Bn1qm.js +29 -0
- package/dist/index-FMoPxlJ2.js +52 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +108 -0
- package/dist/index10.css +1 -0
- package/dist/index11.css +1 -0
- package/dist/index12.css +1 -0
- package/dist/index13.css +1 -0
- package/dist/index14.css +1 -0
- package/dist/index15.css +1 -0
- package/dist/index16.css +1 -0
- package/dist/index17.css +1 -0
- package/dist/index18.css +1 -0
- package/dist/index19.css +1 -0
- package/dist/index2.css +1 -0
- package/dist/index20.css +1 -0
- package/dist/index21.css +1 -0
- package/dist/index22.css +1 -0
- package/dist/index23.css +1 -0
- package/dist/index24.css +1 -0
- package/dist/index25.css +1 -0
- package/dist/index26.css +1 -0
- package/dist/index27.css +1 -0
- package/dist/index28.css +1 -0
- package/dist/index29.css +1 -0
- package/dist/index3.css +1 -0
- package/dist/index30.css +1 -0
- package/dist/index31.css +1 -0
- package/dist/index32.css +1 -0
- package/dist/index33.css +1 -0
- package/dist/index34.css +1 -0
- package/dist/index35.css +1 -0
- package/dist/index36.css +1 -0
- package/dist/index37.css +1 -0
- package/dist/index4.css +1 -0
- package/dist/index5.css +1 -0
- package/dist/index6.css +1 -0
- package/dist/index7.css +1 -0
- package/dist/index8.css +1 -0
- package/dist/index9.css +1 -0
- package/dist/inertValue-BCYGsdmf.js +7 -0
- package/dist/input.css +1 -0
- package/dist/input.module-DDQY_Ij6.js +7 -0
- package/dist/integrations/react-markdown/index.d.ts +5 -0
- package/dist/integrations/react-markdown/index.js +6895 -0
- package/dist/integrations/remix/index.d.ts +9 -0
- package/{src/integrations/remix.ts → dist/integrations/remix/index.js} +7 -4
- package/dist/integrations/tailwind.css +1 -0
- package/dist/integrations/twemoij/index.d.ts +3 -0
- package/dist/integrations/twemoij/index.js +18 -0
- package/dist/isElementDisabled-Cbd8W9kH.js +6 -0
- package/dist/owner-rKN292Q9.js +6 -0
- package/dist/safePolygon-DWy1dGKJ.js +308 -0
- package/dist/styles/core.css +1 -0
- package/dist/styles/tokens.d.ts +400 -0
- package/{src/styles/tokens.ts → dist/styles/tokens.js} +54 -96
- package/dist/toast.css +1 -0
- package/dist/tooltip-arrow-C1qXdi5T.js +24 -0
- package/dist/tooltip-arrow.css +1 -0
- package/dist/transitions.css +1 -0
- package/dist/transitions.module-CWX8e5cx.js +1343 -0
- package/dist/use-toast-manager-Dq-44AuW.js +37 -0
- package/dist/useAnimationFrame-451ugS_6.js +68 -0
- package/dist/useBaseUiId-B7WyxtIE.js +7 -0
- package/dist/useButton-DfIwsdb8.js +127 -0
- package/dist/useCompositeListItem-OkcAim_1.js +148 -0
- package/dist/useControlled-Du4sJyMj.js +31 -0
- package/dist/useHoverReferenceInteraction-SfOBPoXM.js +264 -0
- package/dist/useId-C5kyn6tA.js +22 -0
- package/dist/useIsoLayoutEffect-CIDbvm3Q.js +6 -0
- package/dist/useLabelableId-Ci_jDvmv.js +29 -0
- package/dist/useOnMount-VRW6CK2u.js +8 -0
- package/dist/useOpenChangeComplete-Dse9kY9E.js +61 -0
- package/dist/usePopupAutoResize-CNR6Ekmx.js +85 -0
- package/dist/useRender-CLx7dR_1.js +7 -0
- package/dist/useRenderElement-DwToLA61.js +244 -0
- package/dist/useRole-oDBdbuwQ.js +77 -0
- package/dist/useStableCallback-CkTrVkNX.js +29 -0
- package/dist/useSyncedFloatingRootContext-Dorsv-jf.js +167 -0
- package/dist/useTimeout-CflX-kz3.js +32 -0
- package/dist/useTransitionStatus-CUfcuGAV.js +42 -0
- package/dist/useTypeahead-D85V2IUx.js +333 -0
- package/dist/useValueAsRef-HURLzret.js +19 -0
- package/dist/useValueChanged-DL757-yD.js +14 -0
- package/dist/valueToPercent-DaP9qN4u.js +6 -0
- package/dist/view.css +1 -0
- package/dist/view.module-DfDLgJE0.js +6 -0
- package/dist/visuallyHidden-CpJ-mhai.js +16 -0
- package/dist/warn-CKtX8MLJ.js +11 -0
- package/package.json +18 -2
- package/.husky/pre-commit +0 -1
- package/.storybook/main.ts +0 -25
- package/.storybook/preview-head.html +0 -6
- package/.storybook/preview.tsx +0 -48
- package/.storybook/vitest.setup.ts +0 -8
- package/eslint.config.mjs +0 -29
- package/lint-staged.config.js +0 -15
- package/pnpm-workspace.yaml +0 -2
- package/postcss.config.mjs +0 -7
- package/prettier.config.mjs +0 -24
- package/scripts/build-icon-types.ts +0 -38
- package/src/-utils.tsx +0 -64
- package/src/components/accordion/accordion.module.css +0 -44
- package/src/components/accordion/accordion.stories.tsx +0 -36
- package/src/components/accordion/index.tsx +0 -67
- package/src/components/alert-dialog/alert-dialog.module.css +0 -5
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -53
- package/src/components/alert-dialog/index.tsx +0 -138
- package/src/components/anchor/anchor.module.css +0 -18
- package/src/components/anchor/anchor.stories.tsx +0 -28
- package/src/components/anchor/index.tsx +0 -45
- package/src/components/avatar/avatar.module.css +0 -56
- package/src/components/avatar/avatar.stories.tsx +0 -61
- package/src/components/avatar/index.tsx +0 -82
- package/src/components/badge/badge.module.css +0 -35
- package/src/components/badge/badge.stories.tsx +0 -60
- package/src/components/badge/index.tsx +0 -71
- package/src/components/button/button.module.css +0 -42
- package/src/components/button/button.stories.tsx +0 -108
- package/src/components/button/index.tsx +0 -63
- package/src/components/checkbox/checkbox.module.css +0 -36
- package/src/components/checkbox/checkbox.stories.tsx +0 -21
- package/src/components/checkbox/index.tsx +0 -41
- package/src/components/code/code.module.css +0 -20
- package/src/components/code/code.stories.tsx +0 -42
- package/src/components/code/index.tsx +0 -73
- package/src/components/collapse/collapse.module.css +0 -27
- package/src/components/collapse/collapse.stories.tsx +0 -27
- package/src/components/collapse/index.tsx +0 -59
- package/src/components/command/command.module.css +0 -95
- package/src/components/command/command.stories.tsx +0 -38
- package/src/components/command/index.tsx +0 -108
- package/src/components/context-menu/context-menu.module.css +0 -36
- package/src/components/context-menu/context-menu.stories.tsx +0 -99
- package/src/components/context-menu/index.tsx +0 -242
- package/src/components/dialog/dialog.module.css +0 -71
- package/src/components/dialog/dialog.stories.tsx +0 -29
- package/src/components/dialog/index.tsx +0 -148
- package/src/components/heading/heading.module.css +0 -3
- package/src/components/heading/heading.stories.tsx +0 -52
- package/src/components/heading/index.tsx +0 -112
- package/src/components/icon/icon-names.ts +0 -3189
- package/src/components/icon/icon.module.css +0 -36
- package/src/components/icon/icon.stories.tsx +0 -40
- package/src/components/icon/index.tsx +0 -60
- package/src/components/icon-button/icon-button.module.css +0 -33
- package/src/components/icon-button/icon-button.stories.tsx +0 -59
- package/src/components/icon-button/index.tsx +0 -48
- package/src/components/inline-code/index.tsx +0 -29
- package/src/components/inline-code/inline-code.module.css +0 -13
- package/src/components/inline-code/inline-code.stories.tsx +0 -31
- package/src/components/input/index.tsx +0 -22
- package/src/components/input/input.module.css +0 -23
- package/src/components/input/input.stories.tsx +0 -52
- package/src/components/meter/index.tsx +0 -55
- package/src/components/meter/meter.module.css +0 -23
- package/src/components/meter/meter.stories.tsx +0 -31
- package/src/components/multiline-input/index.tsx +0 -58
- package/src/components/multiline-input/multiline-input.stories.tsx +0 -26
- package/src/components/number-input/index.tsx +0 -74
- package/src/components/number-input/number-input.module.css +0 -41
- package/src/components/number-input/number-input.stories.tsx +0 -24
- package/src/components/password-input/index.tsx +0 -24
- package/src/components/password-input/password-input.module.css +0 -10
- package/src/components/password-input/password-input.stories.tsx +0 -24
- package/src/components/pill/index.tsx +0 -45
- package/src/components/pill/pill.module.css +0 -22
- package/src/components/pill/pill.stories.tsx +0 -83
- package/src/components/popover/index.tsx +0 -94
- package/src/components/popover/popover.module.css +0 -8
- package/src/components/popover/popover.stories.tsx +0 -53
- package/src/components/preview-card/index.tsx +0 -68
- package/src/components/preview-card/preview-card.module.css +0 -5
- package/src/components/preview-card/preview-card.stories.tsx +0 -58
- package/src/components/radio/index.tsx +0 -67
- package/src/components/radio/radio-group.module.css +0 -5
- package/src/components/radio/radio.module.css +0 -36
- package/src/components/radio/radio.stories.tsx +0 -27
- package/src/components/search-bar/index.tsx +0 -60
- package/src/components/search-bar/search-bar.module.css +0 -29
- package/src/components/search-bar/search-bar.stories.tsx +0 -37
- package/src/components/select/index.tsx +0 -132
- package/src/components/select/select.module.css +0 -63
- package/src/components/select/select.stories.tsx +0 -49
- package/src/components/separator/index.tsx +0 -28
- package/src/components/separator/separator.module.css +0 -24
- package/src/components/separator/separator.stories.tsx +0 -40
- package/src/components/slider/index.tsx +0 -28
- package/src/components/slider/slider.module.css +0 -52
- package/src/components/slider/slider.stories.tsx +0 -53
- package/src/components/spinner/index.tsx +0 -14
- package/src/components/spinner/spinner.module.css +0 -13
- package/src/components/spinner/spinner.stories.tsx +0 -17
- package/src/components/stacked-avatars/index.tsx +0 -88
- package/src/components/stacked-avatars/stacked-avatars.module.css +0 -79
- package/src/components/stacked-avatars/stacked-avatars.stories.tsx +0 -48
- package/src/components/status-banner/index.tsx +0 -96
- package/src/components/status-banner/status-banner.module.css +0 -52
- package/src/components/status-banner/status-banner.stories.tsx +0 -44
- package/src/components/surface/index.tsx +0 -83
- package/src/components/surface/surface.module.css +0 -35
- package/src/components/surface/surface.stories.tsx +0 -84
- package/src/components/switch/index.tsx +0 -23
- package/src/components/switch/switch.module.css +0 -45
- package/src/components/switch/switch.stories.tsx +0 -48
- package/src/components/tabs/index.tsx +0 -126
- package/src/components/tabs/tabs.module.css +0 -134
- package/src/components/tabs/tabs.stories.tsx +0 -88
- package/src/components/text/index.tsx +0 -69
- package/src/components/text/text.module.css +0 -76
- package/src/components/text/text.stories.tsx +0 -107
- package/src/components/theme-provider/index.ts +0 -2
- package/src/components/theme-provider/theme-context.tsx +0 -18
- package/src/components/theme-provider/theme-provider.stories.tsx +0 -47
- package/src/components/theme-provider/theme-provider.tsx +0 -77
- package/src/components/timestamp/index.tsx +0 -131
- package/src/components/timestamp/timestamp.module.css +0 -8
- package/src/components/timestamp/timestamp.stories.tsx +0 -37
- package/src/components/toast/index.ts +0 -2
- package/src/components/toast/toast.module.css +0 -163
- package/src/components/toast/toast.stories.tsx +0 -53
- package/src/components/toast/toast.tsx +0 -104
- package/src/components/toast/use-toast-manager.ts +0 -63
- package/src/components/tooltip/index.tsx +0 -61
- package/src/components/tooltip/tooltip-arrow.tsx +0 -17
- package/src/components/tooltip/tooltip.module.css +0 -44
- package/src/components/tooltip/tooltip.stories.tsx +0 -76
- package/src/components/view/index.tsx +0 -137
- package/src/components/view/view.module.css +0 -11
- package/src/components/view/view.stories.tsx +0 -131
- package/src/components/view/view_colorway.module.css +0 -280
- package/src/components/view/view_interactive.module.css +0 -127
- package/src/components/view/view_loading.module.css +0 -58
- package/src/components/visually-hidden/index.ts +0 -1
- package/src/index.ts +0 -49
- package/src/integrations/react-markdown/index.tsx +0 -134
- package/src/integrations/react-markdown/react-markdown.module.css +0 -62
- package/src/integrations/react-markdown/react-markdown.stories.tsx +0 -31
- package/src/integrations/tailwind.css +0 -173
- package/src/integrations/twemoij/index.tsx +0 -13
- package/src/integrations/twemoij/twemoji.module.css +0 -7
- package/src/integrations/twemoij/twemoji.stories.tsx +0 -40
- package/src/stories/components/all-variants.tsx +0 -40
- package/src/stories/data.ts +0 -72
- package/src/stories/utils.ts +0 -20
- package/src/styles/core.css +0 -153
- package/src/styles/themes/dark.css +0 -86
- package/src/styles/themes/light.css +0 -86
- package/src/styles/transitions.module.css +0 -31
- package/stylelint.config.mjs +0 -29
- package/tsconfig.app.json +0 -35
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -103
- package/vitest.shims.d.ts +0 -1
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import { d as ce, e as Ue, f as Je, i as _, g as ct } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
2
|
+
import { c as ut, d as lt } from "./detectBrowser-I-s3yzIE.js";
|
|
3
|
+
import { o as ue } from "./owner-rKN292Q9.js";
|
|
4
|
+
import { u as J } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
5
|
+
import { T as Me, u as ge } from "./useTimeout-CflX-kz3.js";
|
|
6
|
+
import { A as at, u as Qe } from "./useAnimationFrame-451ugS_6.js";
|
|
7
|
+
import { N as ft, c as Pe, E as dt } from "./useRenderElement-DwToLA61.js";
|
|
8
|
+
import * as h from "react";
|
|
9
|
+
import { a as pt, t as Ze, g as ye, c as De, F as Ne, i as Be, b as bt, d as mt, e as et, C as ht, f as gt } from "./FloatingPortal-tWyuKRSN.js";
|
|
10
|
+
import { u as ne } from "./useValueAsRef-HURLzret.js";
|
|
11
|
+
import { u as Q } from "./useStableCallback-CkTrVkNX.js";
|
|
12
|
+
import { v as vt } from "./visuallyHidden-CpJ-mhai.js";
|
|
13
|
+
import { t as yt, o as Et, c as ie, f as kt, a as pe } from "./createBaseUIEventDetails-D8M2Yl-a.js";
|
|
14
|
+
import { d as G, i as We, g as Ve, h as U, f as I, e as re, j as Tt } from "./element-CZEOj04G.js";
|
|
15
|
+
import { a as wt, b as Ge, g as Ye } from "./transitions.module-CWX8e5cx.js";
|
|
16
|
+
import { r as X } from "./useOpenChangeComplete-Dse9kY9E.js";
|
|
17
|
+
import { jsxs as Rt, jsx as ve } from "react/jsx-runtime";
|
|
18
|
+
import { a as Ct, b as xt, s as St, i as qe, c as Ot } from "./event-CKoGyQEJ.js";
|
|
19
|
+
let $e = {}, He = {}, Xe = "";
|
|
20
|
+
function Ft(e) {
|
|
21
|
+
if (typeof document > "u")
|
|
22
|
+
return !1;
|
|
23
|
+
const r = ue(e);
|
|
24
|
+
return ce(r).innerWidth - r.documentElement.clientWidth > 0;
|
|
25
|
+
}
|
|
26
|
+
function It(e) {
|
|
27
|
+
const r = ue(e), t = r.documentElement, n = r.body, o = Ue(t) ? t : n, c = o.style.overflow;
|
|
28
|
+
return o.style.overflow = "hidden", () => {
|
|
29
|
+
o.style.overflow = c;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function Lt(e) {
|
|
33
|
+
const r = ue(e), t = r.documentElement, n = r.body, o = ce(t);
|
|
34
|
+
let c = 0, d = 0;
|
|
35
|
+
const C = at.create(), E = typeof CSS < "u" && CSS.supports?.("scrollbar-gutter", "stable");
|
|
36
|
+
if (lt && (o.visualViewport?.scale ?? 1) !== 1)
|
|
37
|
+
return () => {
|
|
38
|
+
};
|
|
39
|
+
function R() {
|
|
40
|
+
const S = o.getComputedStyle(t), u = o.getComputedStyle(n), g = (S.scrollbarGutter || "").includes("both-edges") ? "stable both-edges" : "stable";
|
|
41
|
+
c = t.scrollTop, d = t.scrollLeft, $e = {
|
|
42
|
+
scrollbarGutter: t.style.scrollbarGutter,
|
|
43
|
+
overflowY: t.style.overflowY,
|
|
44
|
+
overflowX: t.style.overflowX
|
|
45
|
+
}, Xe = t.style.scrollBehavior, He = {
|
|
46
|
+
position: n.style.position,
|
|
47
|
+
height: n.style.height,
|
|
48
|
+
width: n.style.width,
|
|
49
|
+
boxSizing: n.style.boxSizing,
|
|
50
|
+
overflowY: n.style.overflowY,
|
|
51
|
+
overflowX: n.style.overflowX,
|
|
52
|
+
scrollBehavior: n.style.scrollBehavior
|
|
53
|
+
};
|
|
54
|
+
const y = t.scrollHeight > t.clientHeight, f = t.scrollWidth > t.clientWidth, l = S.overflowY === "scroll" || u.overflowY === "scroll", N = S.overflowX === "scroll" || u.overflowX === "scroll", O = Math.max(0, o.innerWidth - t.clientWidth), A = Math.max(0, o.innerHeight - t.clientHeight), M = parseFloat(u.marginTop) + parseFloat(u.marginBottom), K = parseFloat(u.marginLeft) + parseFloat(u.marginRight), L = Ue(t) ? t : n;
|
|
55
|
+
if (E) {
|
|
56
|
+
t.style.scrollbarGutter = g, L.style.overflowY = "hidden", L.style.overflowX = "hidden";
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
Object.assign(t.style, {
|
|
60
|
+
scrollbarGutter: g,
|
|
61
|
+
overflowY: "hidden",
|
|
62
|
+
overflowX: "hidden"
|
|
63
|
+
}), (y || l) && (t.style.overflowY = "scroll"), (f || N) && (t.style.overflowX = "scroll"), Object.assign(n.style, {
|
|
64
|
+
position: "relative",
|
|
65
|
+
height: M || A ? `calc(100dvh - ${M + A}px)` : "100dvh",
|
|
66
|
+
width: K || O ? `calc(100vw - ${K + O}px)` : "100vw",
|
|
67
|
+
boxSizing: "border-box",
|
|
68
|
+
overflow: "hidden",
|
|
69
|
+
scrollBehavior: "unset"
|
|
70
|
+
}), n.scrollTop = c, n.scrollLeft = d, t.setAttribute("data-base-ui-scroll-locked", ""), t.style.scrollBehavior = "unset";
|
|
71
|
+
}
|
|
72
|
+
function x() {
|
|
73
|
+
Object.assign(t.style, $e), Object.assign(n.style, He), E || (t.scrollTop = c, t.scrollLeft = d, t.removeAttribute("data-base-ui-scroll-locked"), t.style.scrollBehavior = Xe);
|
|
74
|
+
}
|
|
75
|
+
function D() {
|
|
76
|
+
x(), C.request(R);
|
|
77
|
+
}
|
|
78
|
+
return R(), o.addEventListener("resize", D), () => {
|
|
79
|
+
C.cancel(), x(), typeof o.removeEventListener == "function" && o.removeEventListener("resize", D);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
class At {
|
|
83
|
+
lockCount = 0;
|
|
84
|
+
restore = null;
|
|
85
|
+
timeoutLock = Me.create();
|
|
86
|
+
timeoutUnlock = Me.create();
|
|
87
|
+
acquire(r) {
|
|
88
|
+
return this.lockCount += 1, this.lockCount === 1 && this.restore === null && this.timeoutLock.start(0, () => this.lock(r)), this.release;
|
|
89
|
+
}
|
|
90
|
+
release = () => {
|
|
91
|
+
this.lockCount -= 1, this.lockCount === 0 && this.restore && this.timeoutUnlock.start(0, this.unlock);
|
|
92
|
+
};
|
|
93
|
+
unlock = () => {
|
|
94
|
+
this.lockCount === 0 && this.restore && (this.restore?.(), this.restore = null);
|
|
95
|
+
};
|
|
96
|
+
lock(r) {
|
|
97
|
+
if (this.lockCount === 0 || this.restore !== null)
|
|
98
|
+
return;
|
|
99
|
+
const n = ue(r).documentElement, o = ce(n).getComputedStyle(n).overflowY;
|
|
100
|
+
if (o === "hidden" || o === "clip") {
|
|
101
|
+
this.restore = ft;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const c = ut || !Ft(r);
|
|
105
|
+
this.restore = c ? It(r) : Lt(r);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const Mt = new At();
|
|
109
|
+
function cn(e = !0, r = null) {
|
|
110
|
+
J(() => {
|
|
111
|
+
if (e)
|
|
112
|
+
return Mt.acquire(r);
|
|
113
|
+
}, [e, r]);
|
|
114
|
+
}
|
|
115
|
+
let je = 0;
|
|
116
|
+
function be(e, r = {}) {
|
|
117
|
+
const {
|
|
118
|
+
preventScroll: t = !1,
|
|
119
|
+
cancelPrevious: n = !0,
|
|
120
|
+
sync: o = !1
|
|
121
|
+
} = r;
|
|
122
|
+
n && cancelAnimationFrame(je);
|
|
123
|
+
const c = () => e?.focus({
|
|
124
|
+
preventScroll: t
|
|
125
|
+
});
|
|
126
|
+
o ? c() : je = requestAnimationFrame(c);
|
|
127
|
+
}
|
|
128
|
+
const j = {
|
|
129
|
+
inert: /* @__PURE__ */ new WeakMap(),
|
|
130
|
+
"aria-hidden": /* @__PURE__ */ new WeakMap(),
|
|
131
|
+
none: /* @__PURE__ */ new WeakMap()
|
|
132
|
+
};
|
|
133
|
+
function Ke(e) {
|
|
134
|
+
return e === "inert" ? j.inert : e === "aria-hidden" ? j["aria-hidden"] : j.none;
|
|
135
|
+
}
|
|
136
|
+
let oe = /* @__PURE__ */ new WeakSet(), se = {}, me = 0;
|
|
137
|
+
const tt = (e) => e && (e.host || tt(e.parentNode)), Pt = (e, r) => r.map((t) => {
|
|
138
|
+
if (e.contains(t))
|
|
139
|
+
return t;
|
|
140
|
+
const n = tt(t);
|
|
141
|
+
return e.contains(n) ? n : null;
|
|
142
|
+
}).filter((t) => t != null);
|
|
143
|
+
function Dt(e, r, t, n) {
|
|
144
|
+
const o = "data-base-ui-inert", c = n ? "inert" : t ? "aria-hidden" : null, d = Pt(r, e), C = /* @__PURE__ */ new Set(), E = new Set(d), R = [];
|
|
145
|
+
se[o] || (se[o] = /* @__PURE__ */ new WeakMap());
|
|
146
|
+
const x = se[o];
|
|
147
|
+
d.forEach(D), S(r), C.clear();
|
|
148
|
+
function D(u) {
|
|
149
|
+
!u || C.has(u) || (C.add(u), u.parentNode && D(u.parentNode));
|
|
150
|
+
}
|
|
151
|
+
function S(u) {
|
|
152
|
+
!u || E.has(u) || [].forEach.call(u.children, (p) => {
|
|
153
|
+
if (Je(p) !== "script")
|
|
154
|
+
if (C.has(p))
|
|
155
|
+
S(p);
|
|
156
|
+
else {
|
|
157
|
+
const F = c ? p.getAttribute(c) : null, g = F !== null && F !== "false", y = Ke(c), f = (y.get(p) || 0) + 1, l = (x.get(p) || 0) + 1;
|
|
158
|
+
y.set(p, f), x.set(p, l), R.push(p), f === 1 && g && oe.add(p), l === 1 && p.setAttribute(o, ""), !g && c && p.setAttribute(c, c === "inert" ? "" : "true");
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return me += 1, () => {
|
|
163
|
+
R.forEach((u) => {
|
|
164
|
+
const p = Ke(c), g = (p.get(u) || 0) - 1, y = (x.get(u) || 0) - 1;
|
|
165
|
+
p.set(u, g), x.set(u, y), g || (!oe.has(u) && c && u.removeAttribute(c), oe.delete(u)), y || u.removeAttribute(o);
|
|
166
|
+
}), me -= 1, me || (j.inert = /* @__PURE__ */ new WeakMap(), j["aria-hidden"] = /* @__PURE__ */ new WeakMap(), j.none = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakSet(), se = {});
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function Nt(e, r = !1, t = !1) {
|
|
170
|
+
const n = G(e[0]).body;
|
|
171
|
+
return Dt(e.concat(Array.from(n.querySelectorAll("[aria-live]"))), n, r, t);
|
|
172
|
+
}
|
|
173
|
+
function Bt(e, r) {
|
|
174
|
+
const t = ce(e.target);
|
|
175
|
+
return e instanceof t.KeyboardEvent ? "keyboard" : e instanceof t.FocusEvent ? r || "keyboard" : "pointerType" in e ? e.pointerType || "keyboard" : "touches" in e ? "touch" : e instanceof t.MouseEvent ? r || (e.detail === 0 ? "keyboard" : "mouse") : "";
|
|
176
|
+
}
|
|
177
|
+
const ze = 20;
|
|
178
|
+
let Y = [];
|
|
179
|
+
function Ee() {
|
|
180
|
+
Y = Y.filter((e) => e.isConnected);
|
|
181
|
+
}
|
|
182
|
+
function Wt(e) {
|
|
183
|
+
Ee(), e && Je(e) !== "body" && (Y.push(e), Y.length > ze && (Y = Y.slice(-ze)));
|
|
184
|
+
}
|
|
185
|
+
function he() {
|
|
186
|
+
return Ee(), Y[Y.length - 1];
|
|
187
|
+
}
|
|
188
|
+
function Vt(e) {
|
|
189
|
+
if (!e)
|
|
190
|
+
return null;
|
|
191
|
+
const r = ye();
|
|
192
|
+
return et(e, r) ? e : Ze(e, r)[0] || e;
|
|
193
|
+
}
|
|
194
|
+
function Gt(e) {
|
|
195
|
+
return !e || !e.isConnected ? !1 : typeof e.checkVisibility == "function" ? e.checkVisibility() : ct(e).display !== "none";
|
|
196
|
+
}
|
|
197
|
+
function _e(e, r) {
|
|
198
|
+
if (!r.current.includes("floating") && !e.getAttribute("role")?.includes("dialog"))
|
|
199
|
+
return;
|
|
200
|
+
const t = ye(), o = gt(e, t).filter((d) => {
|
|
201
|
+
const C = d.getAttribute("data-tabindex") || "";
|
|
202
|
+
return et(d, t) || d.hasAttribute("data-tabindex") && !C.startsWith("-");
|
|
203
|
+
}), c = e.getAttribute("tabindex");
|
|
204
|
+
r.current.includes("floating") || o.length === 0 ? c !== "0" && e.setAttribute("tabindex", "0") : (c !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
|
|
205
|
+
}
|
|
206
|
+
function un(e) {
|
|
207
|
+
const {
|
|
208
|
+
context: r,
|
|
209
|
+
children: t,
|
|
210
|
+
disabled: n = !1,
|
|
211
|
+
order: o = ["content"],
|
|
212
|
+
initialFocus: c = !0,
|
|
213
|
+
returnFocus: d = !0,
|
|
214
|
+
restoreFocus: C = !1,
|
|
215
|
+
modal: E = !0,
|
|
216
|
+
closeOnFocusOut: R = !0,
|
|
217
|
+
openInteractionType: x = "",
|
|
218
|
+
getInsideElements: D = () => [],
|
|
219
|
+
nextFocusableElement: S,
|
|
220
|
+
previousFocusableElement: u,
|
|
221
|
+
beforeContentFocusGuardRef: p,
|
|
222
|
+
externalTree: F
|
|
223
|
+
} = e, g = "rootStore" in r ? r.rootStore : r, y = g.useState("open"), f = g.useState("domReferenceElement"), l = g.useState("floatingElement"), {
|
|
224
|
+
events: N,
|
|
225
|
+
dataRef: O
|
|
226
|
+
} = g.context, A = Q(() => O.current.floatingContext?.nodeId), M = Q(D), K = c === !1, L = We(f) && K, q = ne(o), ke = ne(c), Z = ne(d), Te = ne(x), B = wt(F), k = pt(), nt = h.useRef(null), rt = h.useRef(null), W = h.useRef(!1), ee = h.useRef(!1), le = h.useRef(!1), we = h.useRef(-1), Re = h.useRef(""), ae = h.useRef(""), Ce = ge(), xe = ge(), Se = Qe(), fe = k != null, a = Ve(l), $ = Q((i = a) => i ? Ze(i, ye()) : []), z = Q((i) => {
|
|
227
|
+
const b = $(i);
|
|
228
|
+
return q.current.map(() => b).filter(Boolean).flat();
|
|
229
|
+
});
|
|
230
|
+
h.useEffect(() => {
|
|
231
|
+
if (n || !E)
|
|
232
|
+
return;
|
|
233
|
+
function i(T) {
|
|
234
|
+
T.key === "Tab" && I(a, U(G(a))) && $().length === 0 && !L && St(T);
|
|
235
|
+
}
|
|
236
|
+
const b = G(a);
|
|
237
|
+
return b.addEventListener("keydown", i), () => {
|
|
238
|
+
b.removeEventListener("keydown", i);
|
|
239
|
+
};
|
|
240
|
+
}, [n, f, a, E, q, L, $, z]), h.useEffect(() => {
|
|
241
|
+
if (n || !l)
|
|
242
|
+
return;
|
|
243
|
+
function i(b) {
|
|
244
|
+
const T = re(b), w = $().indexOf(T);
|
|
245
|
+
w !== -1 && (we.current = w);
|
|
246
|
+
}
|
|
247
|
+
return l.addEventListener("focusin", i), () => {
|
|
248
|
+
l.removeEventListener("focusin", i);
|
|
249
|
+
};
|
|
250
|
+
}, [n, l, $]), h.useEffect(() => {
|
|
251
|
+
if (n || !y)
|
|
252
|
+
return;
|
|
253
|
+
const i = G(a);
|
|
254
|
+
function b() {
|
|
255
|
+
le.current = !1;
|
|
256
|
+
}
|
|
257
|
+
function T(w) {
|
|
258
|
+
const s = re(w), m = I(l, s) || I(f, s) || I(k?.portalNode, s);
|
|
259
|
+
le.current = !m, ae.current = w.pointerType || "keyboard";
|
|
260
|
+
}
|
|
261
|
+
function v() {
|
|
262
|
+
ae.current = "keyboard";
|
|
263
|
+
}
|
|
264
|
+
return i.addEventListener("pointerdown", T, !0), i.addEventListener("pointerup", b, !0), i.addEventListener("pointercancel", b, !0), i.addEventListener("keydown", v, !0), () => {
|
|
265
|
+
i.removeEventListener("pointerdown", T, !0), i.removeEventListener("pointerup", b, !0), i.removeEventListener("pointercancel", b, !0), i.removeEventListener("keydown", v, !0);
|
|
266
|
+
};
|
|
267
|
+
}, [n, l, f, a, y, k]), h.useEffect(() => {
|
|
268
|
+
if (n || !R)
|
|
269
|
+
return;
|
|
270
|
+
function i() {
|
|
271
|
+
ee.current = !0, xe.start(0, () => {
|
|
272
|
+
ee.current = !1;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function b(s) {
|
|
276
|
+
const m = s.relatedTarget, H = s.currentTarget, P = re(s);
|
|
277
|
+
queueMicrotask(() => {
|
|
278
|
+
const te = A(), Le = g.context.triggerElements, it = !(I(f, m) || I(l, m) || I(m, l) || I(k?.portalNode, m) || m != null && Le.hasElement(m) || Le.hasMatchingElement((V) => I(V, m)) || m?.hasAttribute(De("focus-guard")) || B && (Ye(B.nodesRef.current, te).find((V) => I(V.context?.elements.floating, m) || I(V.context?.elements.domReference, m)) || Ge(B.nodesRef.current, te).find((V) => [V.context?.elements.floating, Ve(V.context?.elements.floating)].includes(m) || V.context?.elements.domReference === m)));
|
|
279
|
+
if (H === f && a && _e(a, q), C && H !== f && !Gt(P) && U(G(a)) === G(a).body) {
|
|
280
|
+
if (_(a) && (a.focus(), C === "popup")) {
|
|
281
|
+
Se.request(() => {
|
|
282
|
+
a.focus();
|
|
283
|
+
});
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const V = we.current, de = $(), Ae = de[V] || de[de.length - 1] || a;
|
|
287
|
+
_(Ae) && Ae.focus();
|
|
288
|
+
}
|
|
289
|
+
if (O.current.insideReactTree) {
|
|
290
|
+
O.current.insideReactTree = !1;
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
(L || !E) && m && it && !ee.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
|
|
294
|
+
// For an "untrapped" typeable combobox (input role=combobox with
|
|
295
|
+
// initialFocus=false), re-opening the popup and tabbing out should still close it even
|
|
296
|
+
// when the previously focused element (e.g. the next tabbable outside the popup) is
|
|
297
|
+
// focused again. Otherwise, the popup remains open on the second Tab sequence:
|
|
298
|
+
// click input -> Tab (closes) -> click input -> Tab.
|
|
299
|
+
// Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.
|
|
300
|
+
(L || m !== he()) && (W.current = !0, g.setOpen(!1, ie(kt, s)));
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function T() {
|
|
304
|
+
le.current || (O.current.insideReactTree = !0, Ce.start(0, () => {
|
|
305
|
+
O.current.insideReactTree = !1;
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
const v = _(f) ? f : null, w = [];
|
|
309
|
+
if (!(!l && !v))
|
|
310
|
+
return v && (v.addEventListener("focusout", b), v.addEventListener("pointerdown", i), w.push(() => {
|
|
311
|
+
v.removeEventListener("focusout", b), v.removeEventListener("pointerdown", i);
|
|
312
|
+
})), l && (l.addEventListener("focusout", b), k && (l.addEventListener("focusout", T, !0), w.push(() => {
|
|
313
|
+
l.removeEventListener("focusout", T, !0);
|
|
314
|
+
})), w.push(() => {
|
|
315
|
+
l.removeEventListener("focusout", b);
|
|
316
|
+
})), () => {
|
|
317
|
+
w.forEach((s) => {
|
|
318
|
+
s();
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
}, [n, f, l, a, E, B, k, g, R, C, $, L, A, q, O, Ce, xe, Se]);
|
|
322
|
+
const Oe = h.useRef(null), Fe = h.useRef(null), ot = Pe(Oe, p, k?.beforeInsideRef), st = Pe(Fe, k?.afterInsideRef);
|
|
323
|
+
h.useEffect(() => {
|
|
324
|
+
if (n || !l || !y)
|
|
325
|
+
return;
|
|
326
|
+
const i = Array.from(k?.portalNode?.querySelectorAll(`[${De("portal")}]`) || []), T = (B ? Ge(B.nodesRef.current, A()) : []).find((s) => We(s.context?.elements.domReference || null))?.context?.elements.domReference, v = [l, T, ...i, ...M(), nt.current, rt.current, Oe.current, Fe.current, k?.beforeOutsideRef.current, k?.afterOutsideRef.current, X(u), X(S), L ? f : null].filter((s) => s != null), w = Nt(v, E || L);
|
|
327
|
+
return () => {
|
|
328
|
+
w();
|
|
329
|
+
};
|
|
330
|
+
}, [y, n, f, l, E, q, k, L, B, A, M, S, u]), J(() => {
|
|
331
|
+
if (!y || n || !_(a))
|
|
332
|
+
return;
|
|
333
|
+
const i = G(a), b = U(i);
|
|
334
|
+
queueMicrotask(() => {
|
|
335
|
+
const T = z(a), v = ke.current, w = typeof v == "function" ? v(Te.current || "") : v;
|
|
336
|
+
if (w === void 0 || w === !1)
|
|
337
|
+
return;
|
|
338
|
+
let s;
|
|
339
|
+
w === !0 || w === null ? s = T[0] || a : s = X(w), s = s || T[0] || a, !I(a, b) && be(s, {
|
|
340
|
+
preventScroll: s === a
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
}, [n, y, a, K, z, ke, Te]), J(() => {
|
|
344
|
+
if (n || !a)
|
|
345
|
+
return;
|
|
346
|
+
const i = G(a), b = U(i);
|
|
347
|
+
Wt(b);
|
|
348
|
+
function T(s) {
|
|
349
|
+
if (s.open || (Re.current = Bt(s.nativeEvent, ae.current)), s.reason === yt && s.nativeEvent.type === "mouseleave" && (W.current = !0), s.reason === Et)
|
|
350
|
+
if (s.nested)
|
|
351
|
+
W.current = !1;
|
|
352
|
+
else if (Ct(s.nativeEvent) || xt(s.nativeEvent))
|
|
353
|
+
W.current = !1;
|
|
354
|
+
else {
|
|
355
|
+
let m = !1;
|
|
356
|
+
document.createElement("div").focus({
|
|
357
|
+
get preventScroll() {
|
|
358
|
+
return m = !0, !1;
|
|
359
|
+
}
|
|
360
|
+
}), m ? W.current = !1 : W.current = !0;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
N.on("openchange", T);
|
|
364
|
+
const v = i.createElement("span");
|
|
365
|
+
v.setAttribute("tabindex", "-1"), v.setAttribute("aria-hidden", "true"), Object.assign(v.style, vt), fe && f && f.insertAdjacentElement("afterend", v);
|
|
366
|
+
function w() {
|
|
367
|
+
const s = Z.current;
|
|
368
|
+
let m = typeof s == "function" ? s(Re.current) : s;
|
|
369
|
+
if (m === void 0 || m === !1)
|
|
370
|
+
return null;
|
|
371
|
+
if (m === null && (m = !0), typeof m == "boolean") {
|
|
372
|
+
const P = f || he();
|
|
373
|
+
return P && P.isConnected ? P : v;
|
|
374
|
+
}
|
|
375
|
+
const H = f || he() || v;
|
|
376
|
+
return X(m) || H;
|
|
377
|
+
}
|
|
378
|
+
return () => {
|
|
379
|
+
N.off("openchange", T);
|
|
380
|
+
const s = U(i), m = I(l, s) || B && Ye(B.nodesRef.current, A(), !1).some((P) => I(P.context?.elements.floating, s)), H = w();
|
|
381
|
+
queueMicrotask(() => {
|
|
382
|
+
const P = Vt(H), te = typeof Z.current != "boolean";
|
|
383
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
384
|
+
Z.current && !W.current && _(P) && // If the focus moved somewhere else after mount, avoid returning focus
|
|
385
|
+
// since it likely entered a different element which should be
|
|
386
|
+
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
387
|
+
(!(!te && P !== s && s !== i.body) || m) && P.focus({
|
|
388
|
+
preventScroll: !0
|
|
389
|
+
}), v.remove();
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
}, [n, l, a, Z, O, N, B, fe, f, A]), h.useEffect(() => {
|
|
393
|
+
queueMicrotask(() => {
|
|
394
|
+
W.current = !1;
|
|
395
|
+
});
|
|
396
|
+
}, [n]), h.useEffect(() => {
|
|
397
|
+
if (n || !y)
|
|
398
|
+
return;
|
|
399
|
+
function i(T) {
|
|
400
|
+
re(T)?.closest(`[${ht}]`) && (ee.current = !0);
|
|
401
|
+
}
|
|
402
|
+
const b = G(a);
|
|
403
|
+
return b.addEventListener("pointerdown", i, !0), () => {
|
|
404
|
+
b.removeEventListener("pointerdown", i, !0);
|
|
405
|
+
};
|
|
406
|
+
}, [n, y, a]), J(() => {
|
|
407
|
+
if (!n && k)
|
|
408
|
+
return k.setFocusManagerState({
|
|
409
|
+
modal: E,
|
|
410
|
+
closeOnFocusOut: R,
|
|
411
|
+
open: y,
|
|
412
|
+
onOpenChange: g.setOpen,
|
|
413
|
+
domReference: f
|
|
414
|
+
}), () => {
|
|
415
|
+
k.setFocusManagerState(null);
|
|
416
|
+
};
|
|
417
|
+
}, [n, k, E, y, g, R, f]), J(() => {
|
|
418
|
+
if (!(n || !a))
|
|
419
|
+
return _e(a, q), () => {
|
|
420
|
+
queueMicrotask(Ee);
|
|
421
|
+
};
|
|
422
|
+
}, [n, a, q]);
|
|
423
|
+
const Ie = !n && (E ? !L : !0) && (fe || E);
|
|
424
|
+
return /* @__PURE__ */ Rt(h.Fragment, {
|
|
425
|
+
children: [Ie && /* @__PURE__ */ ve(Ne, {
|
|
426
|
+
"data-type": "inside",
|
|
427
|
+
ref: ot,
|
|
428
|
+
onFocus: (i) => {
|
|
429
|
+
if (E) {
|
|
430
|
+
const b = z();
|
|
431
|
+
be(b[b.length - 1]);
|
|
432
|
+
} else k?.portalNode && (W.current = !1, Be(i, k.portalNode) ? bt(f)?.focus() : X(u ?? k.beforeOutsideRef)?.focus());
|
|
433
|
+
}
|
|
434
|
+
}), t, Ie && /* @__PURE__ */ ve(Ne, {
|
|
435
|
+
"data-type": "inside",
|
|
436
|
+
ref: st,
|
|
437
|
+
onFocus: (i) => {
|
|
438
|
+
E ? be(z()[0]) : k?.portalNode && (R && (W.current = !0), Be(i, k.portalNode) ? mt(f)?.focus() : X(S ?? k.afterOutsideRef)?.focus());
|
|
439
|
+
}
|
|
440
|
+
})]
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
function ln(e, r = {}) {
|
|
444
|
+
const t = "rootStore" in e ? e.rootStore : e, n = t.context.dataRef, {
|
|
445
|
+
enabled: o = !0,
|
|
446
|
+
event: c = "click",
|
|
447
|
+
toggle: d = !0,
|
|
448
|
+
ignoreMouse: C = !1,
|
|
449
|
+
stickIfOpen: E = !0,
|
|
450
|
+
touchOpenDelay: R = 0
|
|
451
|
+
} = r, x = h.useRef(void 0), D = Qe(), S = ge(), u = h.useMemo(() => ({
|
|
452
|
+
onPointerDown(p) {
|
|
453
|
+
x.current = p.pointerType;
|
|
454
|
+
},
|
|
455
|
+
onMouseDown(p) {
|
|
456
|
+
const F = x.current, g = p.nativeEvent, y = t.select("open");
|
|
457
|
+
if (p.button !== 0 || c === "click" || qe(F, !0) && C)
|
|
458
|
+
return;
|
|
459
|
+
const f = n.current.openEvent, l = f?.type, N = t.select("domReferenceElement") !== p.currentTarget, O = y && N || !(y && d && (!(f && E) || l === "click" || l === "mousedown"));
|
|
460
|
+
if (Tt(g.target)) {
|
|
461
|
+
const M = ie(pe, g, g.target);
|
|
462
|
+
O && F === "touch" && R > 0 ? S.start(R, () => {
|
|
463
|
+
t.setOpen(!0, M);
|
|
464
|
+
}) : t.setOpen(O, M);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
const A = p.currentTarget;
|
|
468
|
+
D.request(() => {
|
|
469
|
+
const M = ie(pe, g, A);
|
|
470
|
+
O && F === "touch" && R > 0 ? S.start(R, () => {
|
|
471
|
+
t.setOpen(!0, M);
|
|
472
|
+
}) : t.setOpen(O, M);
|
|
473
|
+
});
|
|
474
|
+
},
|
|
475
|
+
onClick(p) {
|
|
476
|
+
if (c === "mousedown-only")
|
|
477
|
+
return;
|
|
478
|
+
const F = x.current;
|
|
479
|
+
if (c === "mousedown" && F) {
|
|
480
|
+
x.current = void 0;
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
if (qe(F, !0) && C)
|
|
484
|
+
return;
|
|
485
|
+
const g = t.select("open"), y = n.current.openEvent, f = t.select("domReferenceElement") !== p.currentTarget, l = g && f || !(g && d && (!(y && E) || Ot(y))), N = ie(pe, p.nativeEvent, p.currentTarget);
|
|
486
|
+
l && F === "touch" && R > 0 ? S.start(R, () => {
|
|
487
|
+
t.setOpen(!0, N);
|
|
488
|
+
}) : t.setOpen(l, N);
|
|
489
|
+
},
|
|
490
|
+
onKeyDown() {
|
|
491
|
+
x.current = void 0;
|
|
492
|
+
}
|
|
493
|
+
}), [n, c, C, t, E, d, D, S, R]);
|
|
494
|
+
return h.useMemo(() => o ? {
|
|
495
|
+
reference: u
|
|
496
|
+
} : dt, [o, u]);
|
|
497
|
+
}
|
|
498
|
+
function Yt(e) {
|
|
499
|
+
const r = h.useRef(""), t = h.useCallback((o) => {
|
|
500
|
+
o.defaultPrevented || (r.current = o.pointerType, e(o, o.pointerType));
|
|
501
|
+
}, [e]);
|
|
502
|
+
return {
|
|
503
|
+
onClick: h.useCallback((o) => {
|
|
504
|
+
if (o.detail === 0) {
|
|
505
|
+
e(o, "keyboard");
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
"pointerType" in o && e(o, o.pointerType), e(o, r.current), r.current = "";
|
|
509
|
+
}, [e]),
|
|
510
|
+
onPointerDown: t
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
function an(e) {
|
|
514
|
+
const [r, t] = h.useState(null), n = Q((C, E) => {
|
|
515
|
+
e || t(E);
|
|
516
|
+
}), o = h.useCallback(() => {
|
|
517
|
+
t(null);
|
|
518
|
+
}, []), {
|
|
519
|
+
onClick: c,
|
|
520
|
+
onPointerDown: d
|
|
521
|
+
} = Yt(n);
|
|
522
|
+
return h.useMemo(() => ({
|
|
523
|
+
openMethod: r,
|
|
524
|
+
reset: o,
|
|
525
|
+
triggerProps: {
|
|
526
|
+
onClick: c,
|
|
527
|
+
onPointerDown: d
|
|
528
|
+
}
|
|
529
|
+
}), [r, o, c, d]);
|
|
530
|
+
}
|
|
531
|
+
const qt = /* @__PURE__ */ h.forwardRef(function(r, t) {
|
|
532
|
+
const {
|
|
533
|
+
cutout: n,
|
|
534
|
+
...o
|
|
535
|
+
} = r;
|
|
536
|
+
let c;
|
|
537
|
+
if (n) {
|
|
538
|
+
const d = n?.getBoundingClientRect();
|
|
539
|
+
c = `polygon(
|
|
540
|
+
0% 0%,
|
|
541
|
+
100% 0%,
|
|
542
|
+
100% 100%,
|
|
543
|
+
0% 100%,
|
|
544
|
+
0% 0%,
|
|
545
|
+
${d.left}px ${d.top}px,
|
|
546
|
+
${d.left}px ${d.bottom}px,
|
|
547
|
+
${d.right}px ${d.bottom}px,
|
|
548
|
+
${d.right}px ${d.top}px,
|
|
549
|
+
${d.left}px ${d.top}px
|
|
550
|
+
)`;
|
|
551
|
+
}
|
|
552
|
+
return /* @__PURE__ */ ve("div", {
|
|
553
|
+
ref: t,
|
|
554
|
+
role: "presentation",
|
|
555
|
+
"data-base-ui-inert": "",
|
|
556
|
+
...o,
|
|
557
|
+
style: {
|
|
558
|
+
position: "fixed",
|
|
559
|
+
inset: 0,
|
|
560
|
+
userSelect: "none",
|
|
561
|
+
WebkitUserSelect: "none",
|
|
562
|
+
clipPath: c
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
process.env.NODE_ENV !== "production" && (qt.displayName = "InternalBackdrop");
|
|
567
|
+
export {
|
|
568
|
+
un as F,
|
|
569
|
+
qt as I,
|
|
570
|
+
cn as a,
|
|
571
|
+
ln as b,
|
|
572
|
+
be as e,
|
|
573
|
+
an as u
|
|
574
|
+
};
|