@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,37 @@
|
|
|
1
|
+
import { f as i } from "./formatErrorMessage-BqPuTBN-.js";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
const o = /* @__PURE__ */ e.createContext(void 0);
|
|
4
|
+
process.env.NODE_ENV !== "production" && (o.displayName = "ToastContext");
|
|
5
|
+
function p() {
|
|
6
|
+
const t = e.useContext(o);
|
|
7
|
+
if (!t)
|
|
8
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: useToastManager must be used within <Toast.Provider>." : i(73));
|
|
9
|
+
return t;
|
|
10
|
+
}
|
|
11
|
+
function c() {
|
|
12
|
+
const t = e.useContext(o);
|
|
13
|
+
if (!t)
|
|
14
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: useToastManager must be used within <Toast.Provider>." : i(73));
|
|
15
|
+
const {
|
|
16
|
+
toasts: s,
|
|
17
|
+
add: r,
|
|
18
|
+
close: a,
|
|
19
|
+
update: n,
|
|
20
|
+
promise: u
|
|
21
|
+
} = t;
|
|
22
|
+
return e.useMemo(() => ({
|
|
23
|
+
toasts: s,
|
|
24
|
+
add: r,
|
|
25
|
+
close: a,
|
|
26
|
+
update: n,
|
|
27
|
+
promise: u
|
|
28
|
+
}), [s, r, a, n, u]);
|
|
29
|
+
}
|
|
30
|
+
function f() {
|
|
31
|
+
return c();
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
o as T,
|
|
35
|
+
p as a,
|
|
36
|
+
f as u
|
|
37
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { a as u } from "./useRenderElement-DwToLA61.js";
|
|
2
|
+
import { u as h } from "./useOnMount-VRW6CK2u.js";
|
|
3
|
+
const s = null;
|
|
4
|
+
let l = globalThis.requestAnimationFrame;
|
|
5
|
+
class o {
|
|
6
|
+
/* This implementation uses an array as a backing data-structure for frame callbacks.
|
|
7
|
+
* It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
|
|
8
|
+
* never calls the native `cancelAnimationFrame` if there are no frames left. This can
|
|
9
|
+
* be much more efficient if there is a call pattern that alterns as
|
|
10
|
+
* "request-cancel-request-cancel-…".
|
|
11
|
+
* But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
|
|
12
|
+
* frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
|
|
13
|
+
callbacks = [];
|
|
14
|
+
callbacksCount = 0;
|
|
15
|
+
nextId = 1;
|
|
16
|
+
startId = 1;
|
|
17
|
+
isScheduled = !1;
|
|
18
|
+
tick = (t) => {
|
|
19
|
+
this.isScheduled = !1;
|
|
20
|
+
const e = this.callbacks, a = this.callbacksCount;
|
|
21
|
+
if (this.callbacks = [], this.callbacksCount = 0, this.startId = this.nextId, a > 0)
|
|
22
|
+
for (let r = 0; r < e.length; r += 1)
|
|
23
|
+
e[r]?.(t);
|
|
24
|
+
};
|
|
25
|
+
request(t) {
|
|
26
|
+
const e = this.nextId;
|
|
27
|
+
this.nextId += 1, this.callbacks.push(t), this.callbacksCount += 1;
|
|
28
|
+
const a = process.env.NODE_ENV === "test" && l !== requestAnimationFrame && (l = requestAnimationFrame, !0);
|
|
29
|
+
return (!this.isScheduled || a) && (requestAnimationFrame(this.tick), this.isScheduled = !0), e;
|
|
30
|
+
}
|
|
31
|
+
cancel(t) {
|
|
32
|
+
const e = t - this.startId;
|
|
33
|
+
e < 0 || e >= this.callbacks.length || (this.callbacks[e] = null, this.callbacksCount -= 1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const c = new o();
|
|
37
|
+
class i {
|
|
38
|
+
static create() {
|
|
39
|
+
return new i();
|
|
40
|
+
}
|
|
41
|
+
static request(t) {
|
|
42
|
+
return c.request(t);
|
|
43
|
+
}
|
|
44
|
+
static cancel(t) {
|
|
45
|
+
return c.cancel(t);
|
|
46
|
+
}
|
|
47
|
+
currentId = s;
|
|
48
|
+
/**
|
|
49
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
50
|
+
*/
|
|
51
|
+
request(t) {
|
|
52
|
+
this.cancel(), this.currentId = c.request(() => {
|
|
53
|
+
this.currentId = s, t();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
cancel = () => {
|
|
57
|
+
this.currentId !== s && (c.cancel(this.currentId), this.currentId = s);
|
|
58
|
+
};
|
|
59
|
+
disposeEffect = () => this.cancel;
|
|
60
|
+
}
|
|
61
|
+
function k() {
|
|
62
|
+
const n = u(i.create).current;
|
|
63
|
+
return h(n.disposeEffect), n;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
i as A,
|
|
67
|
+
k as u
|
|
68
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { i as I } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
3
|
+
import { u as D } from "./useStableCallback-CkTrVkNX.js";
|
|
4
|
+
import { u as K } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
5
|
+
import { f as R } from "./formatErrorMessage-BqPuTBN-.js";
|
|
6
|
+
import { m as T, d as C } from "./useRenderElement-DwToLA61.js";
|
|
7
|
+
let b;
|
|
8
|
+
process.env.NODE_ENV !== "production" && (b = /* @__PURE__ */ new Set());
|
|
9
|
+
function E(...r) {
|
|
10
|
+
if (process.env.NODE_ENV !== "production") {
|
|
11
|
+
const e = r.join(" ");
|
|
12
|
+
b.has(e) || (b.add(e), console.error(`Base UI: ${e}`));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const x = /* @__PURE__ */ u.createContext(void 0);
|
|
16
|
+
process.env.NODE_ENV !== "production" && (x.displayName = "CompositeRootContext");
|
|
17
|
+
function U(r = !1) {
|
|
18
|
+
const e = u.useContext(x);
|
|
19
|
+
if (e === void 0 && !r)
|
|
20
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : R(16));
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
function M(r) {
|
|
24
|
+
const {
|
|
25
|
+
focusableWhenDisabled: e,
|
|
26
|
+
disabled: i,
|
|
27
|
+
composite: c = !1,
|
|
28
|
+
tabIndex: n = 0,
|
|
29
|
+
isNativeButton: s
|
|
30
|
+
} = r, f = c && e !== !1, l = c && e === !1;
|
|
31
|
+
return {
|
|
32
|
+
props: u.useMemo(() => {
|
|
33
|
+
const a = {
|
|
34
|
+
// allow Tabbing away from focusableWhenDisabled elements
|
|
35
|
+
onKeyDown(d) {
|
|
36
|
+
i && e && d.key !== "Tab" && d.preventDefault();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return c || (a.tabIndex = n, !s && i && (a.tabIndex = e ? n : -1)), (s && (e || f) || !s && i) && (a["aria-disabled"] = i), s && (!e || l) && (a.disabled = i), a;
|
|
40
|
+
}, [c, i, e, f, l, s, n])
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function L(r = {}) {
|
|
44
|
+
const {
|
|
45
|
+
disabled: e = !1,
|
|
46
|
+
focusableWhenDisabled: i,
|
|
47
|
+
tabIndex: c = 0,
|
|
48
|
+
native: n = !0
|
|
49
|
+
} = r, s = u.useRef(null), f = U(!0) !== void 0, l = D(() => {
|
|
50
|
+
const o = s.current;
|
|
51
|
+
return !!(o?.tagName === "A" && o?.href);
|
|
52
|
+
}), {
|
|
53
|
+
props: p
|
|
54
|
+
} = M({
|
|
55
|
+
focusableWhenDisabled: i,
|
|
56
|
+
disabled: e,
|
|
57
|
+
composite: f,
|
|
58
|
+
tabIndex: c,
|
|
59
|
+
isNativeButton: n
|
|
60
|
+
});
|
|
61
|
+
process.env.NODE_ENV !== "production" && u.useEffect(() => {
|
|
62
|
+
if (!s.current)
|
|
63
|
+
return;
|
|
64
|
+
const o = s.current.tagName === "BUTTON";
|
|
65
|
+
n ? o || E("A component that acts as a button was not rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is a real <button>, or set the `nativeButton` prop on the component to `false`.") : o && E("A component that acts as a button was rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is not a real <button>, or set the `nativeButton` prop on the component to `true`.");
|
|
66
|
+
}, [n]);
|
|
67
|
+
const a = u.useCallback(() => {
|
|
68
|
+
const o = s.current;
|
|
69
|
+
V(o) && f && e && p.disabled === void 0 && o.disabled && (o.disabled = !1);
|
|
70
|
+
}, [e, p.disabled, f]);
|
|
71
|
+
K(a, [a]);
|
|
72
|
+
const d = u.useCallback((o = {}) => {
|
|
73
|
+
const {
|
|
74
|
+
onClick: m,
|
|
75
|
+
onMouseDown: w,
|
|
76
|
+
onKeyUp: y,
|
|
77
|
+
onKeyDown: g,
|
|
78
|
+
onPointerDown: k,
|
|
79
|
+
...B
|
|
80
|
+
} = o;
|
|
81
|
+
return T({
|
|
82
|
+
type: n ? "button" : void 0,
|
|
83
|
+
onClick(t) {
|
|
84
|
+
if (e) {
|
|
85
|
+
t.preventDefault();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
m?.(t);
|
|
89
|
+
},
|
|
90
|
+
onMouseDown(t) {
|
|
91
|
+
e || w?.(t);
|
|
92
|
+
},
|
|
93
|
+
onKeyDown(t) {
|
|
94
|
+
if (e || (C(t), g?.(t)), t.baseUIHandlerPrevented)
|
|
95
|
+
return;
|
|
96
|
+
const O = t.target === t.currentTarget && !n && !l() && !e, h = t.key === "Enter", P = t.key === " ";
|
|
97
|
+
O && ((P || h) && t.preventDefault(), h && m?.(t));
|
|
98
|
+
},
|
|
99
|
+
onKeyUp(t) {
|
|
100
|
+
e || (C(t), y?.(t)), !t.baseUIHandlerPrevented && t.target === t.currentTarget && !n && !e && t.key === " " && m?.(t);
|
|
101
|
+
},
|
|
102
|
+
onPointerDown(t) {
|
|
103
|
+
if (e) {
|
|
104
|
+
t.preventDefault();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
k?.(t);
|
|
108
|
+
}
|
|
109
|
+
}, n ? void 0 : {
|
|
110
|
+
role: "button"
|
|
111
|
+
}, p, B);
|
|
112
|
+
}, [e, p, n, l]), N = D((o) => {
|
|
113
|
+
s.current = o, a();
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
getButtonProps: d,
|
|
117
|
+
buttonRef: N
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function V(r) {
|
|
121
|
+
return I(r) && r.tagName === "BUTTON";
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
x as C,
|
|
125
|
+
U as a,
|
|
126
|
+
L as u
|
|
127
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { a as L } from "./useRenderElement-DwToLA61.js";
|
|
3
|
+
import { u as R } from "./useStableCallback-CkTrVkNX.js";
|
|
4
|
+
import { u as x } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
5
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
6
|
+
const b = /* @__PURE__ */ o.createContext({
|
|
7
|
+
register: () => {
|
|
8
|
+
},
|
|
9
|
+
unregister: () => {
|
|
10
|
+
},
|
|
11
|
+
subscribeMapChange: () => () => {
|
|
12
|
+
},
|
|
13
|
+
elementsRef: {
|
|
14
|
+
current: []
|
|
15
|
+
},
|
|
16
|
+
nextIndexRef: {
|
|
17
|
+
current: 0
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
process.env.NODE_ENV !== "production" && (b.displayName = "CompositeListContext");
|
|
21
|
+
function D() {
|
|
22
|
+
return o.useContext(b);
|
|
23
|
+
}
|
|
24
|
+
function y(u) {
|
|
25
|
+
const {
|
|
26
|
+
children: m,
|
|
27
|
+
elementsRef: t,
|
|
28
|
+
labelsRef: r,
|
|
29
|
+
onMapChange: E
|
|
30
|
+
} = u, f = R(E), O = o.useRef(0), p = L(S).current, d = L(_).current, [C, N] = o.useState(0), c = o.useRef(C), M = R((e, i) => {
|
|
31
|
+
d.set(e, i ?? null), c.current += 1, N(c.current);
|
|
32
|
+
}), a = R((e) => {
|
|
33
|
+
d.delete(e), c.current += 1, N(c.current);
|
|
34
|
+
}), n = o.useMemo(() => {
|
|
35
|
+
const e = /* @__PURE__ */ new Map();
|
|
36
|
+
return Array.from(d.keys()).filter((s) => s.isConnected).sort(P).forEach((s, I) => {
|
|
37
|
+
const l = d.get(s) ?? {};
|
|
38
|
+
e.set(s, {
|
|
39
|
+
...l,
|
|
40
|
+
index: I
|
|
41
|
+
});
|
|
42
|
+
}), e;
|
|
43
|
+
}, [d, C]);
|
|
44
|
+
x(() => {
|
|
45
|
+
if (typeof MutationObserver != "function" || n.size === 0)
|
|
46
|
+
return;
|
|
47
|
+
const e = new MutationObserver((i) => {
|
|
48
|
+
const s = /* @__PURE__ */ new Set(), I = (l) => s.has(l) ? s.delete(l) : s.add(l);
|
|
49
|
+
i.forEach((l) => {
|
|
50
|
+
l.removedNodes.forEach(I), l.addedNodes.forEach(I);
|
|
51
|
+
}), s.size === 0 && (c.current += 1, N(c.current));
|
|
52
|
+
});
|
|
53
|
+
return n.forEach((i, s) => {
|
|
54
|
+
s.parentElement && e.observe(s.parentElement, {
|
|
55
|
+
childList: !0
|
|
56
|
+
});
|
|
57
|
+
}), () => {
|
|
58
|
+
e.disconnect();
|
|
59
|
+
};
|
|
60
|
+
}, [n]), x(() => {
|
|
61
|
+
c.current === C && (t.current.length !== n.size && (t.current.length = n.size), r && r.current.length !== n.size && (r.current.length = n.size), O.current = n.size), f(n);
|
|
62
|
+
}, [f, n, t, r, C]), x(() => () => {
|
|
63
|
+
t.current = [];
|
|
64
|
+
}, [t]), x(() => () => {
|
|
65
|
+
r && (r.current = []);
|
|
66
|
+
}, [r]);
|
|
67
|
+
const h = R((e) => (p.add(e), () => {
|
|
68
|
+
p.delete(e);
|
|
69
|
+
}));
|
|
70
|
+
x(() => {
|
|
71
|
+
p.forEach((e) => e(n));
|
|
72
|
+
}, [p, n]);
|
|
73
|
+
const g = o.useMemo(() => ({
|
|
74
|
+
register: M,
|
|
75
|
+
unregister: a,
|
|
76
|
+
subscribeMapChange: h,
|
|
77
|
+
elementsRef: t,
|
|
78
|
+
labelsRef: r,
|
|
79
|
+
nextIndexRef: O
|
|
80
|
+
}), [M, a, h, t, r, O]);
|
|
81
|
+
return /* @__PURE__ */ T(b.Provider, {
|
|
82
|
+
value: g,
|
|
83
|
+
children: m
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function _() {
|
|
87
|
+
return /* @__PURE__ */ new Map();
|
|
88
|
+
}
|
|
89
|
+
function S() {
|
|
90
|
+
return /* @__PURE__ */ new Set();
|
|
91
|
+
}
|
|
92
|
+
function P(u, m) {
|
|
93
|
+
const t = u.compareDocumentPosition(m);
|
|
94
|
+
return t & Node.DOCUMENT_POSITION_FOLLOWING || t & Node.DOCUMENT_POSITION_CONTAINED_BY ? -1 : t & Node.DOCUMENT_POSITION_PRECEDING || t & Node.DOCUMENT_POSITION_CONTAINS ? 1 : 0;
|
|
95
|
+
}
|
|
96
|
+
let w = /* @__PURE__ */ (function(u) {
|
|
97
|
+
return u[u.None = 0] = "None", u[u.GuessFromOrder = 1] = "GuessFromOrder", u;
|
|
98
|
+
})({});
|
|
99
|
+
function F(u = {}) {
|
|
100
|
+
const {
|
|
101
|
+
label: m,
|
|
102
|
+
metadata: t,
|
|
103
|
+
textRef: r,
|
|
104
|
+
indexGuessBehavior: E,
|
|
105
|
+
index: f
|
|
106
|
+
} = u, {
|
|
107
|
+
register: O,
|
|
108
|
+
unregister: p,
|
|
109
|
+
subscribeMapChange: d,
|
|
110
|
+
elementsRef: C,
|
|
111
|
+
labelsRef: N,
|
|
112
|
+
nextIndexRef: c
|
|
113
|
+
} = D(), M = o.useRef(-1), [a, n] = o.useState(f ?? (E === w.GuessFromOrder ? () => {
|
|
114
|
+
if (M.current === -1) {
|
|
115
|
+
const e = c.current;
|
|
116
|
+
c.current += 1, M.current = e;
|
|
117
|
+
}
|
|
118
|
+
return M.current;
|
|
119
|
+
} : -1)), h = o.useRef(null), g = o.useCallback((e) => {
|
|
120
|
+
if (h.current = e, a !== -1 && e !== null && (C.current[a] = e, N)) {
|
|
121
|
+
const i = m !== void 0;
|
|
122
|
+
N.current[a] = i ? m : r?.current?.textContent ?? e.textContent;
|
|
123
|
+
}
|
|
124
|
+
}, [a, C, N, m, r]);
|
|
125
|
+
return x(() => {
|
|
126
|
+
if (f != null)
|
|
127
|
+
return;
|
|
128
|
+
const e = h.current;
|
|
129
|
+
if (e)
|
|
130
|
+
return O(e, t), () => {
|
|
131
|
+
p(e);
|
|
132
|
+
};
|
|
133
|
+
}, [f, O, p, t]), x(() => {
|
|
134
|
+
if (f == null)
|
|
135
|
+
return d((e) => {
|
|
136
|
+
const i = h.current ? e.get(h.current)?.index : null;
|
|
137
|
+
i != null && n(i);
|
|
138
|
+
});
|
|
139
|
+
}, [f, d, n]), o.useMemo(() => ({
|
|
140
|
+
ref: g,
|
|
141
|
+
index: a
|
|
142
|
+
}), [a, g]);
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
y as C,
|
|
146
|
+
w as I,
|
|
147
|
+
F as u
|
|
148
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
function d({
|
|
3
|
+
controlled: o,
|
|
4
|
+
default: s,
|
|
5
|
+
name: t,
|
|
6
|
+
state: i = "value"
|
|
7
|
+
}) {
|
|
8
|
+
const {
|
|
9
|
+
current: e
|
|
10
|
+
} = n.useRef(o !== void 0), [l, c] = n.useState(s), u = e ? o : l;
|
|
11
|
+
if (process.env.NODE_ENV !== "production") {
|
|
12
|
+
n.useEffect(() => {
|
|
13
|
+
e !== (o !== void 0) && console.error([`Base UI: A component is changing the ${e ? "" : "un"}controlled ${i} state of ${t} to be ${e ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${t} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
|
|
14
|
+
`));
|
|
15
|
+
}, [i, t, o]);
|
|
16
|
+
const {
|
|
17
|
+
current: r
|
|
18
|
+
} = n.useRef(s);
|
|
19
|
+
n.useEffect(() => {
|
|
20
|
+
!e && JSON.stringify(r) !== JSON.stringify(s) && console.error([`Base UI: A component is changing the default ${i} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`].join(`
|
|
21
|
+
`));
|
|
22
|
+
}, [JSON.stringify(s)]);
|
|
23
|
+
}
|
|
24
|
+
const f = n.useCallback((r) => {
|
|
25
|
+
e || c(r);
|
|
26
|
+
}, []);
|
|
27
|
+
return [u, f];
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
d as u
|
|
31
|
+
};
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { a as re } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
3
|
+
import { u as I } from "./useStableCallback-CkTrVkNX.js";
|
|
4
|
+
import { u as te } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
5
|
+
import { c as A, t as F } from "./createBaseUIEventDetails-D8M2Yl-a.js";
|
|
6
|
+
import { a as oe, u as ue } from "./transitions.module-CWX8e5cx.js";
|
|
7
|
+
import { T as ie, d as G, e as ae, f as q } from "./element-CZEOj04G.js";
|
|
8
|
+
import { i as U } from "./event-CKoGyQEJ.js";
|
|
9
|
+
import * as le from "react-dom";
|
|
10
|
+
import { u as J } from "./useValueAsRef-HURLzret.js";
|
|
11
|
+
import { g as K } from "./safePolygon-DWy1dGKJ.js";
|
|
12
|
+
import { u as ne } from "./useTimeout-CflX-kz3.js";
|
|
13
|
+
import { c as fe } from "./FloatingPortal-tWyuKRSN.js";
|
|
14
|
+
const Z = fe("safe-polygon"), de = `button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${ie}`;
|
|
15
|
+
function me(r) {
|
|
16
|
+
return r ? !!r.closest(de) : !1;
|
|
17
|
+
}
|
|
18
|
+
function se(r) {
|
|
19
|
+
const M = u.useRef(void 0), e = u.useRef(!1), i = u.useRef(void 0), m = u.useRef(!0), v = u.useRef(!1), T = u.useRef(() => {
|
|
20
|
+
}), P = u.useRef(!1), y = ne(), Y = ne(), R = u.useRef(void 0);
|
|
21
|
+
return u.useMemo(() => {
|
|
22
|
+
const l = r.context.dataRef.current;
|
|
23
|
+
return l.hoverInteractionState || (l.hoverInteractionState = {
|
|
24
|
+
pointerTypeRef: M,
|
|
25
|
+
interactedInsideRef: e,
|
|
26
|
+
handlerRef: i,
|
|
27
|
+
blockMouseMoveRef: m,
|
|
28
|
+
performedPointerEventsMutationRef: v,
|
|
29
|
+
unbindMouseMoveRef: T,
|
|
30
|
+
restTimeoutPendingRef: P,
|
|
31
|
+
openChangeTimeout: y,
|
|
32
|
+
restTimeout: Y,
|
|
33
|
+
handleCloseOptionsRef: R
|
|
34
|
+
}), l.hoverInteractionState;
|
|
35
|
+
}, [r, M, e, i, m, v, T, P, y, Y, R]);
|
|
36
|
+
}
|
|
37
|
+
const ge = /* @__PURE__ */ new Set(["click", "mousedown"]);
|
|
38
|
+
function Ie(r, M = {}) {
|
|
39
|
+
const e = "rootStore" in r ? r.rootStore : r, i = e.useState("open"), m = e.useState("floatingElement"), v = e.useState("domReferenceElement"), {
|
|
40
|
+
dataRef: T
|
|
41
|
+
} = e.context, {
|
|
42
|
+
enabled: P = !0,
|
|
43
|
+
closeDelay: y = 0,
|
|
44
|
+
externalTree: Y
|
|
45
|
+
} = M, {
|
|
46
|
+
pointerTypeRef: R,
|
|
47
|
+
interactedInsideRef: l,
|
|
48
|
+
handlerRef: _,
|
|
49
|
+
performedPointerEventsMutationRef: x,
|
|
50
|
+
unbindMouseMoveRef: V,
|
|
51
|
+
restTimeoutPendingRef: g,
|
|
52
|
+
openChangeTimeout: X,
|
|
53
|
+
handleCloseOptionsRef: L
|
|
54
|
+
} = se(e), b = oe(Y), j = ue(), k = I(() => l.current ? !0 : T.current.openEvent ? ge.has(T.current.openEvent.type) : !1), h = I(() => {
|
|
55
|
+
const n = T.current.openEvent?.type;
|
|
56
|
+
return n?.includes("mouse") && n !== "mousedown";
|
|
57
|
+
}), p = u.useCallback((n, a = !0) => {
|
|
58
|
+
const d = Ee(y, R.current);
|
|
59
|
+
d && !_.current ? X.start(d, () => e.setOpen(!1, A(F, n))) : a && (X.clear(), e.setOpen(!1, A(F, n)));
|
|
60
|
+
}, [y, _, e, R, X]), f = I(() => {
|
|
61
|
+
V.current(), _.current = void 0;
|
|
62
|
+
}), D = I(() => {
|
|
63
|
+
if (x.current) {
|
|
64
|
+
const n = G(m).body;
|
|
65
|
+
n.style.pointerEvents = "", n.removeAttribute(Z), x.current = !1;
|
|
66
|
+
}
|
|
67
|
+
}), H = I((n) => {
|
|
68
|
+
const a = ae(n);
|
|
69
|
+
if (!me(a)) {
|
|
70
|
+
l.current = !1;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
l.current = !0;
|
|
74
|
+
});
|
|
75
|
+
te(() => {
|
|
76
|
+
i || (R.current = void 0, g.current = !1, l.current = !1, f(), D());
|
|
77
|
+
}, [i, R, g, l, f, D]), u.useEffect(() => () => {
|
|
78
|
+
f();
|
|
79
|
+
}, [f]), u.useEffect(() => D, [D]), te(() => {
|
|
80
|
+
if (P && i && L.current?.blockPointerEvents && h() && re(v) && m) {
|
|
81
|
+
x.current = !0;
|
|
82
|
+
const n = G(m).body;
|
|
83
|
+
n.setAttribute(Z, "");
|
|
84
|
+
const a = v, d = m, c = b?.nodesRef.current.find((E) => E.id === j)?.context?.elements.floating;
|
|
85
|
+
return c && (c.style.pointerEvents = ""), n.style.pointerEvents = "none", a.style.pointerEvents = "auto", d.style.pointerEvents = "auto", () => {
|
|
86
|
+
n.style.pointerEvents = "", a.style.pointerEvents = "", d.style.pointerEvents = "";
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, [P, i, v, m, L, h, b, j, x]), u.useEffect(() => {
|
|
90
|
+
if (!P)
|
|
91
|
+
return;
|
|
92
|
+
function n(E) {
|
|
93
|
+
if (k() || !T.current.floatingContext || !e.select("open"))
|
|
94
|
+
return;
|
|
95
|
+
const B = e.context.triggerElements;
|
|
96
|
+
E.relatedTarget && B.hasElement(E.relatedTarget) || (D(), f(), k() || p(E));
|
|
97
|
+
}
|
|
98
|
+
function a(E) {
|
|
99
|
+
X.clear(), D(), _.current?.(E), f();
|
|
100
|
+
}
|
|
101
|
+
function d(E) {
|
|
102
|
+
k() || p(E, !1);
|
|
103
|
+
}
|
|
104
|
+
const c = m;
|
|
105
|
+
return c && (c.addEventListener("mouseleave", n), c.addEventListener("mouseenter", a), c.addEventListener("mouseleave", d), c.addEventListener("pointerdown", H, !0)), () => {
|
|
106
|
+
c && (c.removeEventListener("mouseleave", n), c.removeEventListener("mouseenter", a), c.removeEventListener("mouseleave", d), c.removeEventListener("pointerdown", H, !0));
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function Ee(r, M) {
|
|
111
|
+
return M && !U(M) ? 0 : typeof r == "function" ? r() : r;
|
|
112
|
+
}
|
|
113
|
+
function Q(r) {
|
|
114
|
+
return typeof r == "function" ? r() : r;
|
|
115
|
+
}
|
|
116
|
+
const pe = {
|
|
117
|
+
current: null
|
|
118
|
+
};
|
|
119
|
+
function Pe(r, M = {}) {
|
|
120
|
+
const e = "rootStore" in r ? r.rootStore : r, {
|
|
121
|
+
dataRef: i,
|
|
122
|
+
events: m
|
|
123
|
+
} = e.context, {
|
|
124
|
+
enabled: v = !0,
|
|
125
|
+
delay: T = 0,
|
|
126
|
+
handleClose: P = null,
|
|
127
|
+
mouseOnly: y = !1,
|
|
128
|
+
restMs: Y = 0,
|
|
129
|
+
move: R = !0,
|
|
130
|
+
triggerElementRef: l = pe,
|
|
131
|
+
externalTree: _,
|
|
132
|
+
isActiveTrigger: x = !0
|
|
133
|
+
} = M, V = oe(_), {
|
|
134
|
+
pointerTypeRef: g,
|
|
135
|
+
interactedInsideRef: X,
|
|
136
|
+
handlerRef: L,
|
|
137
|
+
blockMouseMoveRef: b,
|
|
138
|
+
performedPointerEventsMutationRef: j,
|
|
139
|
+
unbindMouseMoveRef: k,
|
|
140
|
+
restTimeoutPendingRef: h,
|
|
141
|
+
openChangeTimeout: p,
|
|
142
|
+
restTimeout: f,
|
|
143
|
+
handleCloseOptionsRef: D
|
|
144
|
+
} = se(e), H = J(P), n = J(T), a = J(Y);
|
|
145
|
+
x && (D.current = H.current?.__options);
|
|
146
|
+
const d = I(() => X.current ? !0 : i.current.openEvent ? ["click", "mousedown"].includes(i.current.openEvent.type) : !1), c = u.useCallback((t, o = !0) => {
|
|
147
|
+
const C = K(n.current, "close", g.current);
|
|
148
|
+
C && !L.current ? p.start(C, () => e.setOpen(!1, A(F, t))) : o && (p.clear(), e.setOpen(!1, A(F, t)));
|
|
149
|
+
}, [n, L, e, g, p]), E = I(() => {
|
|
150
|
+
k.current(), L.current = void 0;
|
|
151
|
+
}), B = I(() => {
|
|
152
|
+
if (j.current) {
|
|
153
|
+
const t = G(e.select("domReferenceElement")).body;
|
|
154
|
+
t.style.pointerEvents = "", t.removeAttribute(Z), j.current = !1;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
u.useEffect(() => {
|
|
158
|
+
if (!v)
|
|
159
|
+
return;
|
|
160
|
+
function t(o) {
|
|
161
|
+
o.open || (p.clear(), f.clear(), b.current = !0, h.current = !1);
|
|
162
|
+
}
|
|
163
|
+
return m.on("openchange", t), () => {
|
|
164
|
+
m.off("openchange", t);
|
|
165
|
+
};
|
|
166
|
+
}, [v, m, p, f, b, h]);
|
|
167
|
+
const ee = I((t) => {
|
|
168
|
+
if (d() || !i.current.floatingContext)
|
|
169
|
+
return;
|
|
170
|
+
const o = e.context.triggerElements;
|
|
171
|
+
if (t.relatedTarget && o.hasElement(t.relatedTarget))
|
|
172
|
+
return;
|
|
173
|
+
const C = l.current;
|
|
174
|
+
H.current?.({
|
|
175
|
+
...i.current.floatingContext,
|
|
176
|
+
tree: V,
|
|
177
|
+
x: t.clientX,
|
|
178
|
+
y: t.clientY,
|
|
179
|
+
onClose() {
|
|
180
|
+
B(), E(), !d() && C === e.select("domReferenceElement") && c(t);
|
|
181
|
+
}
|
|
182
|
+
})(t);
|
|
183
|
+
});
|
|
184
|
+
return u.useEffect(() => {
|
|
185
|
+
if (!v)
|
|
186
|
+
return;
|
|
187
|
+
const t = l.current ?? (x ? e.select("domReferenceElement") : null);
|
|
188
|
+
if (!re(t))
|
|
189
|
+
return;
|
|
190
|
+
function o(s) {
|
|
191
|
+
if (p.clear(), b.current = !1, y && !U(g.current) || Q(a.current) > 0 && !K(n.current, "open"))
|
|
192
|
+
return;
|
|
193
|
+
const w = K(n.current, "open", g.current), O = e.select("domReferenceElement"), S = e.context.triggerElements, N = (S.hasElement(s.target) || S.hasMatchingElement((ce) => q(ce, s.target))) && (!O || !q(O, s.target)), W = s.currentTarget ?? null, $ = !e.select("open") || N;
|
|
194
|
+
w ? p.start(w, () => {
|
|
195
|
+
$ && e.setOpen(!0, A(F, s, W));
|
|
196
|
+
}) : $ && e.setOpen(!0, A(F, s, W));
|
|
197
|
+
}
|
|
198
|
+
function C(s) {
|
|
199
|
+
if (d()) {
|
|
200
|
+
B();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
k.current();
|
|
204
|
+
const w = e.select("domReferenceElement"), O = G(w);
|
|
205
|
+
f.clear(), h.current = !1;
|
|
206
|
+
const S = e.context.triggerElements;
|
|
207
|
+
if (s.relatedTarget && S.hasElement(s.relatedTarget))
|
|
208
|
+
return;
|
|
209
|
+
if (H.current && i.current.floatingContext) {
|
|
210
|
+
e.select("open") || p.clear();
|
|
211
|
+
const W = l.current;
|
|
212
|
+
L.current = H.current({
|
|
213
|
+
...i.current.floatingContext,
|
|
214
|
+
tree: V,
|
|
215
|
+
x: s.clientX,
|
|
216
|
+
y: s.clientY,
|
|
217
|
+
onClose() {
|
|
218
|
+
B(), E(), !d() && W === e.select("domReferenceElement") && c(s, !0);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
const $ = L.current;
|
|
222
|
+
$(s), O.addEventListener("mousemove", $), k.current = () => {
|
|
223
|
+
O.removeEventListener("mousemove", $);
|
|
224
|
+
};
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
(g.current !== "touch" || !q(e.select("floatingElement"), s.relatedTarget)) && c(s);
|
|
228
|
+
}
|
|
229
|
+
function z(s) {
|
|
230
|
+
ee(s);
|
|
231
|
+
}
|
|
232
|
+
return e.select("open") && t.addEventListener("mouseleave", z), R && t.addEventListener("mousemove", o, {
|
|
233
|
+
once: !0
|
|
234
|
+
}), t.addEventListener("mouseenter", o), t.addEventListener("mouseleave", C), () => {
|
|
235
|
+
t.removeEventListener("mouseleave", z), R && t.removeEventListener("mousemove", o), t.removeEventListener("mouseenter", o), t.removeEventListener("mouseleave", C);
|
|
236
|
+
};
|
|
237
|
+
}, [E, B, b, i, n, c, e, v, H, ee, x, d, y, R, g, a, f, h, p, l, V, k, L]), u.useMemo(() => {
|
|
238
|
+
function t(o) {
|
|
239
|
+
g.current = o.pointerType;
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
onPointerDown: t,
|
|
243
|
+
onPointerEnter: t,
|
|
244
|
+
onMouseMove(o) {
|
|
245
|
+
const {
|
|
246
|
+
nativeEvent: C
|
|
247
|
+
} = o, z = o.currentTarget, s = e.select("domReferenceElement"), w = e.context.triggerElements, O = e.select("open"), S = (w.hasElement(o.target) || w.hasMatchingElement((W) => q(W, o.target))) && (!s || !q(s, o.target));
|
|
248
|
+
if (y && !U(g.current) || O && !S || Q(a.current) === 0 || !S && h.current && o.movementX ** 2 + o.movementY ** 2 < 2)
|
|
249
|
+
return;
|
|
250
|
+
f.clear();
|
|
251
|
+
function N() {
|
|
252
|
+
!b.current && (!O || S) && e.setOpen(!0, A(F, C, z));
|
|
253
|
+
}
|
|
254
|
+
g.current === "touch" ? le.flushSync(() => {
|
|
255
|
+
N();
|
|
256
|
+
}) : S && O ? N() : (h.current = !0, f.start(Q(a.current), N));
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}, [b, y, e, g, a, f, h]);
|
|
260
|
+
}
|
|
261
|
+
export {
|
|
262
|
+
Ie as a,
|
|
263
|
+
Pe as u
|
|
264
|
+
};
|