@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,167 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { u as T } from "./useStableCallback-CkTrVkNX.js";
|
|
3
|
+
import { u as m } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
4
|
+
import { u as S } from "./useTransitionStatus-CUfcuGAV.js";
|
|
5
|
+
import { a as C } from "./useOpenChangeComplete-Dse9kY9E.js";
|
|
6
|
+
import { F as E, P as x, c as o, u as I } from "./transitions.module-CWX8e5cx.js";
|
|
7
|
+
import { E as c, a as O } from "./useRenderElement-DwToLA61.js";
|
|
8
|
+
import { u as P } from "./useId-C5kyn6tA.js";
|
|
9
|
+
import { a as R } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
10
|
+
function y(e, t) {
|
|
11
|
+
const n = d.useRef(null);
|
|
12
|
+
return d.useCallback((i) => {
|
|
13
|
+
e !== void 0 && (n.current !== null && (t.context.triggerElements.delete(n.current), n.current = null), i !== null && (n.current = e, t.context.triggerElements.add(e, i)));
|
|
14
|
+
}, [t, e]);
|
|
15
|
+
}
|
|
16
|
+
function j(e, t, n, i) {
|
|
17
|
+
const r = n.useState("isMountedByTrigger", e), l = y(e, n), u = T((a) => {
|
|
18
|
+
l(a), a !== null && n.select("open") && n.select("activeTriggerId") == null && n.update({
|
|
19
|
+
activeTriggerId: e,
|
|
20
|
+
activeTriggerElement: a,
|
|
21
|
+
...i
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
return m(() => {
|
|
25
|
+
r && n.update({
|
|
26
|
+
activeTriggerElement: t.current,
|
|
27
|
+
...i
|
|
28
|
+
});
|
|
29
|
+
}, [r, n, t, ...Object.values(i)]), {
|
|
30
|
+
registerTrigger: u,
|
|
31
|
+
isMountedByThisTrigger: r
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function z(e) {
|
|
35
|
+
const t = e.useState("open");
|
|
36
|
+
m(() => {
|
|
37
|
+
if (t && !e.select("activeTriggerId") && e.context.triggerElements.size === 1) {
|
|
38
|
+
const n = e.context.triggerElements.entries().next();
|
|
39
|
+
if (!n.done) {
|
|
40
|
+
const [i, r] = n.value;
|
|
41
|
+
e.update({
|
|
42
|
+
activeTriggerId: i,
|
|
43
|
+
activeTriggerElement: r
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, [t, e]);
|
|
48
|
+
}
|
|
49
|
+
function D(e, t, n) {
|
|
50
|
+
const {
|
|
51
|
+
mounted: i,
|
|
52
|
+
setMounted: r,
|
|
53
|
+
transitionStatus: l
|
|
54
|
+
} = S(e);
|
|
55
|
+
t.useSyncedValues({
|
|
56
|
+
mounted: i,
|
|
57
|
+
transitionStatus: l
|
|
58
|
+
});
|
|
59
|
+
const u = T(() => {
|
|
60
|
+
r(!1), t.update({
|
|
61
|
+
activeTriggerId: null,
|
|
62
|
+
activeTriggerElement: null,
|
|
63
|
+
mounted: !1
|
|
64
|
+
}), n?.(), t.context.onOpenChangeComplete?.(!1);
|
|
65
|
+
}), a = t.useState("preventUnmountingOnClose");
|
|
66
|
+
return C({
|
|
67
|
+
enabled: !a,
|
|
68
|
+
open: e,
|
|
69
|
+
ref: t.context.popupRef,
|
|
70
|
+
onComplete() {
|
|
71
|
+
e || u();
|
|
72
|
+
}
|
|
73
|
+
}), {
|
|
74
|
+
forceUnmount: u,
|
|
75
|
+
transitionStatus: l
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function b() {
|
|
79
|
+
return new E({
|
|
80
|
+
open: !1,
|
|
81
|
+
floatingElement: null,
|
|
82
|
+
referenceElement: null,
|
|
83
|
+
triggerElements: new x(),
|
|
84
|
+
floatingId: "",
|
|
85
|
+
nested: !1,
|
|
86
|
+
noEmit: !1,
|
|
87
|
+
onOpenChange: void 0
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function J() {
|
|
91
|
+
return {
|
|
92
|
+
open: !1,
|
|
93
|
+
mounted: !1,
|
|
94
|
+
transitionStatus: "idle",
|
|
95
|
+
floatingRootContext: b(),
|
|
96
|
+
preventUnmountingOnClose: !1,
|
|
97
|
+
payload: void 0,
|
|
98
|
+
activeTriggerId: null,
|
|
99
|
+
activeTriggerElement: null,
|
|
100
|
+
popupElement: null,
|
|
101
|
+
positionerElement: null,
|
|
102
|
+
activeTriggerProps: c,
|
|
103
|
+
inactiveTriggerProps: c,
|
|
104
|
+
popupProps: c
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const L = {
|
|
108
|
+
open: o((e) => e.open),
|
|
109
|
+
mounted: o((e) => e.mounted),
|
|
110
|
+
transitionStatus: o((e) => e.transitionStatus),
|
|
111
|
+
floatingRootContext: o((e) => e.floatingRootContext),
|
|
112
|
+
preventUnmountingOnClose: o((e) => e.preventUnmountingOnClose),
|
|
113
|
+
payload: o((e) => e.payload),
|
|
114
|
+
activeTriggerId: o((e) => e.activeTriggerId),
|
|
115
|
+
activeTriggerElement: o((e) => e.mounted ? e.activeTriggerElement : null),
|
|
116
|
+
/**
|
|
117
|
+
* Whether the trigger with the given ID was used to open the popup.
|
|
118
|
+
*/
|
|
119
|
+
isTriggerActive: o((e, t) => t !== void 0 && e.activeTriggerId === t),
|
|
120
|
+
/**
|
|
121
|
+
* Whether the popup is open and was activated by a trigger with the given ID.
|
|
122
|
+
*/
|
|
123
|
+
isOpenedByTrigger: o((e, t) => t !== void 0 && e.activeTriggerId === t && e.open),
|
|
124
|
+
/**
|
|
125
|
+
* Whether the popup is mounted and was activated by a trigger with the given ID.
|
|
126
|
+
*/
|
|
127
|
+
isMountedByTrigger: o((e, t) => t !== void 0 && e.activeTriggerId === t && e.mounted),
|
|
128
|
+
triggerProps: o((e, t) => t ? e.activeTriggerProps : e.inactiveTriggerProps),
|
|
129
|
+
popupProps: o((e) => e.popupProps),
|
|
130
|
+
popupElement: o((e) => e.popupElement),
|
|
131
|
+
positionerElement: o((e) => e.positionerElement)
|
|
132
|
+
};
|
|
133
|
+
function N(e) {
|
|
134
|
+
const {
|
|
135
|
+
popupStore: t,
|
|
136
|
+
noEmit: n = !1,
|
|
137
|
+
treatPopupAsFloatingElement: i = !1,
|
|
138
|
+
onOpenChange: r
|
|
139
|
+
} = e, l = P(), u = I() != null, a = t.useState("open"), g = t.useState("activeTriggerElement"), p = t.useState(i ? "popupElement" : "positionerElement"), v = t.context.triggerElements, s = O(() => new E({
|
|
140
|
+
open: a,
|
|
141
|
+
referenceElement: g,
|
|
142
|
+
floatingElement: p,
|
|
143
|
+
triggerElements: v,
|
|
144
|
+
onOpenChange: r,
|
|
145
|
+
floatingId: l,
|
|
146
|
+
nested: u,
|
|
147
|
+
noEmit: n
|
|
148
|
+
})).current;
|
|
149
|
+
return m(() => {
|
|
150
|
+
const f = {
|
|
151
|
+
open: a,
|
|
152
|
+
floatingId: l,
|
|
153
|
+
referenceElement: g,
|
|
154
|
+
floatingElement: p
|
|
155
|
+
};
|
|
156
|
+
R(g) && (f.domReferenceElement = g), s.update(f);
|
|
157
|
+
}, [a, l, g, p, s]), s.context.onOpenChange = r, s.context.nested = u, s.context.noEmit = n, s;
|
|
158
|
+
}
|
|
159
|
+
export {
|
|
160
|
+
D as a,
|
|
161
|
+
N as b,
|
|
162
|
+
J as c,
|
|
163
|
+
j as d,
|
|
164
|
+
y as e,
|
|
165
|
+
L as p,
|
|
166
|
+
z as u
|
|
167
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { a as i } from "./useRenderElement-DwToLA61.js";
|
|
2
|
+
import { u as c } from "./useOnMount-VRW6CK2u.js";
|
|
3
|
+
const t = 0;
|
|
4
|
+
class r {
|
|
5
|
+
static create() {
|
|
6
|
+
return new r();
|
|
7
|
+
}
|
|
8
|
+
currentId = t;
|
|
9
|
+
/**
|
|
10
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
11
|
+
*/
|
|
12
|
+
start(s, u) {
|
|
13
|
+
this.clear(), this.currentId = setTimeout(() => {
|
|
14
|
+
this.currentId = t, u();
|
|
15
|
+
}, s);
|
|
16
|
+
}
|
|
17
|
+
isStarted() {
|
|
18
|
+
return this.currentId !== t;
|
|
19
|
+
}
|
|
20
|
+
clear = () => {
|
|
21
|
+
this.currentId !== t && (clearTimeout(this.currentId), this.currentId = t);
|
|
22
|
+
};
|
|
23
|
+
disposeEffect = () => this.clear;
|
|
24
|
+
}
|
|
25
|
+
function o() {
|
|
26
|
+
const e = i(r.create).current;
|
|
27
|
+
return c(e.disposeEffect), e;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
r as T,
|
|
31
|
+
o as u
|
|
32
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { u as c } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
3
|
+
import { A as u } from "./useAnimationFrame-451ugS_6.js";
|
|
4
|
+
function g(t, s = !1, f = !1) {
|
|
5
|
+
const [n, r] = a.useState(t && s ? "idle" : void 0), [i, d] = a.useState(t);
|
|
6
|
+
return t && !i && (d(!0), r("starting")), !t && i && n !== "ending" && !f && r("ending"), !t && !i && n === "ending" && r(void 0), c(() => {
|
|
7
|
+
if (!t && i && n !== "ending" && f) {
|
|
8
|
+
const e = u.request(() => {
|
|
9
|
+
r("ending");
|
|
10
|
+
});
|
|
11
|
+
return () => {
|
|
12
|
+
u.cancel(e);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}, [t, i, n, f]), c(() => {
|
|
16
|
+
if (!t || s)
|
|
17
|
+
return;
|
|
18
|
+
const e = u.request(() => {
|
|
19
|
+
r(void 0);
|
|
20
|
+
});
|
|
21
|
+
return () => {
|
|
22
|
+
u.cancel(e);
|
|
23
|
+
};
|
|
24
|
+
}, [s, t]), c(() => {
|
|
25
|
+
if (!t || !s)
|
|
26
|
+
return;
|
|
27
|
+
t && i && n !== "idle" && r("starting");
|
|
28
|
+
const e = u.request(() => {
|
|
29
|
+
r("idle");
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
u.cancel(e);
|
|
33
|
+
};
|
|
34
|
+
}, [s, t, i, r, n]), a.useMemo(() => ({
|
|
35
|
+
mounted: i,
|
|
36
|
+
setMounted: d,
|
|
37
|
+
transitionStatus: n
|
|
38
|
+
}), [i, n]);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
g as u
|
|
42
|
+
};
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { i as Pe } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
3
|
+
import { u as H } from "./useValueAsRef-HURLzret.js";
|
|
4
|
+
import { u as Q } from "./useStableCallback-CkTrVkNX.js";
|
|
5
|
+
import { u as F } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
6
|
+
import { u as ve, a as Ge } from "./transitions.module-CWX8e5cx.js";
|
|
7
|
+
import { c as le, l as xe, f as _e } from "./createBaseUIEventDetails-D8M2Yl-a.js";
|
|
8
|
+
import { e as We } from "./InternalBackdrop-jYAiOJ8v.js";
|
|
9
|
+
import { g as qe, i as He, h as Ke, d as Ue, f as Ae, a as me, b as X, c as Z, e as Ye, A as Ne } from "./element-CZEOj04G.js";
|
|
10
|
+
import { i as Fe, g as Oe, a as De, c as $e, b as we, d as Be, e as je, f as Je, h as fe } from "./composite-Bx7Szd_T.js";
|
|
11
|
+
import { s as S, a as Qe, b as Xe } from "./event-CKoGyQEJ.js";
|
|
12
|
+
import { u as Ze } from "./useTimeout-CflX-kz3.js";
|
|
13
|
+
import { b as er } from "./useRenderElement-DwToLA61.js";
|
|
14
|
+
const rr = "Escape";
|
|
15
|
+
function pe(n, h, i) {
|
|
16
|
+
switch (n) {
|
|
17
|
+
case "vertical":
|
|
18
|
+
return h;
|
|
19
|
+
case "horizontal":
|
|
20
|
+
return i;
|
|
21
|
+
default:
|
|
22
|
+
return h || i;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function de(n, h) {
|
|
26
|
+
return pe(h, n === Ne || n === me, n === X || n === Z);
|
|
27
|
+
}
|
|
28
|
+
function Ee(n, h, i) {
|
|
29
|
+
return pe(h, n === me, i ? n === X : n === Z) || n === "Enter" || n === " " || n === "";
|
|
30
|
+
}
|
|
31
|
+
function tr(n, h, i) {
|
|
32
|
+
return pe(h, i ? n === X : n === Z, n === me);
|
|
33
|
+
}
|
|
34
|
+
function nr(n, h, i, c) {
|
|
35
|
+
const m = i ? n === Z : n === X, O = n === Ne;
|
|
36
|
+
return h === "both" || h === "horizontal" && c && c > 1 ? n === rr : pe(h, m, O);
|
|
37
|
+
}
|
|
38
|
+
function Rr(n, h) {
|
|
39
|
+
const i = "rootStore" in n ? n.rootStore : n, c = i.useState("open"), m = i.useState("floatingElement"), O = i.useState("domReferenceElement"), G = i.context.dataRef, {
|
|
40
|
+
listRef: o,
|
|
41
|
+
activeIndex: M,
|
|
42
|
+
onNavigate: ee = () => {
|
|
43
|
+
},
|
|
44
|
+
enabled: w = !0,
|
|
45
|
+
selectedIndex: D = null,
|
|
46
|
+
allowEscape: U = !1,
|
|
47
|
+
loopFocus: k = !1,
|
|
48
|
+
nested: E = !1,
|
|
49
|
+
rtl: l = !1,
|
|
50
|
+
virtual: f = !1,
|
|
51
|
+
focusItemOnOpen: x = "auto",
|
|
52
|
+
focusItemOnHover: b = !0,
|
|
53
|
+
openOnArrowKeyDown: P = !0,
|
|
54
|
+
disabledIndices: I = void 0,
|
|
55
|
+
orientation: p = "vertical",
|
|
56
|
+
parentOrientation: u,
|
|
57
|
+
cols: L = 1,
|
|
58
|
+
scrollItemIntoView: T = !0,
|
|
59
|
+
itemSizes: Me,
|
|
60
|
+
dense: re = !1,
|
|
61
|
+
id: _,
|
|
62
|
+
resetOnPointerLeave: N = !0,
|
|
63
|
+
externalTree: te
|
|
64
|
+
} = h;
|
|
65
|
+
process.env.NODE_ENV !== "production" && (U && (k || console.warn("`useListNavigation` looping must be enabled to allow escaping."), f || console.warn("`useListNavigation` must be virtual to allow escaping.")), p === "vertical" && L > 1 && console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should", 'be either "horizontal" or "both".'));
|
|
66
|
+
const ne = qe(m), K = H(ne), W = ve(), V = Ge(te);
|
|
67
|
+
F(() => {
|
|
68
|
+
G.current.orientation = p;
|
|
69
|
+
}, [G, p]);
|
|
70
|
+
const ge = He(O), z = a.useRef(x), t = a.useRef(D ?? -1), v = a.useRef(null), q = a.useRef(!0), g = Q((e) => {
|
|
71
|
+
ee(t.current === -1 ? null : t.current, e);
|
|
72
|
+
}), be = a.useRef(g), Y = a.useRef(!!m), Ce = a.useRef(c), C = a.useRef(!1), oe = a.useRef(!1), Re = H(I), ce = H(c), Ve = H(T), $ = H(D), Le = H(N), he = Q(() => {
|
|
73
|
+
function e(R) {
|
|
74
|
+
f ? V?.events.emit("virtualfocus", R) : We(R, {
|
|
75
|
+
sync: C.current,
|
|
76
|
+
preventScroll: !0
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const s = o.current[t.current], r = oe.current;
|
|
80
|
+
s && e(s), (C.current ? (R) => R() : requestAnimationFrame)(() => {
|
|
81
|
+
const R = o.current[t.current] || s;
|
|
82
|
+
if (!R)
|
|
83
|
+
return;
|
|
84
|
+
s || e(R);
|
|
85
|
+
const y = Ve.current;
|
|
86
|
+
y && // eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
87
|
+
Ie && (r || !q.current) && R.scrollIntoView?.(typeof y == "boolean" ? {
|
|
88
|
+
block: "nearest",
|
|
89
|
+
inline: "nearest"
|
|
90
|
+
} : y);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
F(() => {
|
|
94
|
+
w && (c && m ? (t.current = D ?? -1, z.current && D != null && (oe.current = !0, g())) : Y.current && (t.current = -1, be.current()));
|
|
95
|
+
}, [w, c, m, D, g]), F(() => {
|
|
96
|
+
if (w) {
|
|
97
|
+
if (!c) {
|
|
98
|
+
C.current = !1;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (m)
|
|
102
|
+
if (M == null) {
|
|
103
|
+
if (C.current = !1, $.current != null)
|
|
104
|
+
return;
|
|
105
|
+
if (Y.current && (t.current = -1, he()), (!Ce.current || !Y.current) && z.current && (v.current != null || z.current === !0 && v.current == null)) {
|
|
106
|
+
let e = 0;
|
|
107
|
+
const s = () => {
|
|
108
|
+
o.current[0] == null ? (e < 2 && (e ? requestAnimationFrame : queueMicrotask)(s), e += 1) : (t.current = v.current == null || Ee(v.current, p, l) || E ? Oe(o) : De(o), v.current = null, g());
|
|
109
|
+
};
|
|
110
|
+
s();
|
|
111
|
+
}
|
|
112
|
+
} else Fe(o, M) || (t.current = M, he(), oe.current = !1);
|
|
113
|
+
}
|
|
114
|
+
}, [w, c, m, M, $, E, o, p, l, g, he, Re]), F(() => {
|
|
115
|
+
if (!w || m || !V || f || !Y.current)
|
|
116
|
+
return;
|
|
117
|
+
const e = V.nodesRef.current, s = e.find((R) => R.id === W)?.context?.elements.floating, r = Ke(Ue(m)), d = e.some((R) => R.context && Ae(R.context.elements.floating, r));
|
|
118
|
+
s && !d && q.current && s.focus({
|
|
119
|
+
preventScroll: !0
|
|
120
|
+
});
|
|
121
|
+
}, [w, m, V, W, f]), F(() => {
|
|
122
|
+
be.current = g, Ce.current = c, Y.current = !!m;
|
|
123
|
+
}), F(() => {
|
|
124
|
+
c || (v.current = null, z.current = x);
|
|
125
|
+
}, [c, x]);
|
|
126
|
+
const Te = M != null, Ie = a.useMemo(() => {
|
|
127
|
+
function e(r) {
|
|
128
|
+
if (!ce.current)
|
|
129
|
+
return;
|
|
130
|
+
const d = o.current.indexOf(r.currentTarget);
|
|
131
|
+
d !== -1 && t.current !== d && (t.current = d, g(r));
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
onFocus(r) {
|
|
135
|
+
C.current = !0, e(r);
|
|
136
|
+
},
|
|
137
|
+
onClick: ({
|
|
138
|
+
currentTarget: r
|
|
139
|
+
}) => r.focus({
|
|
140
|
+
preventScroll: !0
|
|
141
|
+
}),
|
|
142
|
+
// Safari
|
|
143
|
+
onMouseMove(r) {
|
|
144
|
+
C.current = !0, oe.current = !1, b && e(r);
|
|
145
|
+
},
|
|
146
|
+
onPointerLeave(r) {
|
|
147
|
+
if (!ce.current || !q.current || r.pointerType === "touch")
|
|
148
|
+
return;
|
|
149
|
+
C.current = !0;
|
|
150
|
+
const d = r.relatedTarget;
|
|
151
|
+
!b || o.current.includes(d) || Le.current && (t.current = -1, g(r), f || K.current?.focus({
|
|
152
|
+
preventScroll: !0
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}, [ce, K, b, o, g, Le, f]), se = a.useCallback(() => u ?? V?.nodesRef.current.find((e) => e.id === W)?.context?.dataRef?.current.orientation, [W, V, u]), B = Q((e) => {
|
|
157
|
+
if (q.current = !1, C.current = !0, e.which === 229 || !ce.current && e.currentTarget === K.current)
|
|
158
|
+
return;
|
|
159
|
+
if (E && nr(e.key, p, l, L)) {
|
|
160
|
+
de(e.key, se()) || S(e), i.setOpen(!1, le(xe, e.nativeEvent)), Pe(O) && (f ? V?.events.emit("virtualfocus", O) : O.focus());
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const s = t.current, r = Oe(o, I), d = De(o, I);
|
|
164
|
+
if (ge || (e.key === "Home" && (S(e), t.current = r, g(e)), e.key === "End" && (S(e), t.current = d, g(e))), L > 1) {
|
|
165
|
+
const R = Me || Array.from({
|
|
166
|
+
length: o.current.length
|
|
167
|
+
}, () => ({
|
|
168
|
+
width: 1,
|
|
169
|
+
height: 1
|
|
170
|
+
})), y = $e(R, L, re), j = y.findIndex((A) => A != null && !we(o, A, I)), ye = y.reduce((A, J, ze) => J != null && !we(o, J, I) ? ze : A, -1), ae = y[Be({
|
|
171
|
+
current: y.map((A) => A != null ? o.current[A] : null)
|
|
172
|
+
}, {
|
|
173
|
+
event: e,
|
|
174
|
+
orientation: p,
|
|
175
|
+
loopFocus: k,
|
|
176
|
+
rtl: l,
|
|
177
|
+
cols: L,
|
|
178
|
+
// treat undefined (empty grid spaces) as disabled indices so we
|
|
179
|
+
// don't end up in them
|
|
180
|
+
disabledIndices: Je([...(typeof I != "function" ? I : null) || o.current.map((A, J) => we(o, J, I) ? J : void 0), void 0], y),
|
|
181
|
+
minIndex: j,
|
|
182
|
+
maxIndex: ye,
|
|
183
|
+
prevIndex: je(
|
|
184
|
+
t.current > d ? r : t.current,
|
|
185
|
+
R,
|
|
186
|
+
y,
|
|
187
|
+
L,
|
|
188
|
+
// use a corner matching the edge closest to the direction
|
|
189
|
+
// we're moving in so we don't end up in the same item. Prefer
|
|
190
|
+
// top/left over bottom/right.
|
|
191
|
+
// eslint-disable-next-line no-nested-ternary
|
|
192
|
+
e.key === me ? "bl" : e.key === (l ? X : Z) ? "tr" : "tl"
|
|
193
|
+
),
|
|
194
|
+
stopEvent: !0
|
|
195
|
+
})];
|
|
196
|
+
if (ae != null && (t.current = ae, g(e)), p === "both")
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (de(e.key, p)) {
|
|
200
|
+
if (S(e), c && !f && Ke(e.currentTarget.ownerDocument) === e.currentTarget) {
|
|
201
|
+
t.current = Ee(e.key, p, l) ? r : d, g(e);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
Ee(e.key, p, l) ? k ? s >= d ? U && s !== o.current.length ? t.current = -1 : (C.current = !1, t.current = r) : t.current = fe(o, {
|
|
205
|
+
startingIndex: s,
|
|
206
|
+
disabledIndices: I
|
|
207
|
+
}) : t.current = Math.min(d, fe(o, {
|
|
208
|
+
startingIndex: s,
|
|
209
|
+
disabledIndices: I
|
|
210
|
+
})) : k ? s <= r ? U && s !== -1 ? t.current = o.current.length : (C.current = !1, t.current = d) : t.current = fe(o, {
|
|
211
|
+
startingIndex: s,
|
|
212
|
+
decrement: !0,
|
|
213
|
+
disabledIndices: I
|
|
214
|
+
}) : t.current = Math.max(r, fe(o, {
|
|
215
|
+
startingIndex: s,
|
|
216
|
+
decrement: !0,
|
|
217
|
+
disabledIndices: I
|
|
218
|
+
})), Fe(o, t.current) && (t.current = -1), g(e);
|
|
219
|
+
}
|
|
220
|
+
}), ie = a.useMemo(() => f && c && Te && {
|
|
221
|
+
"aria-activedescendant": `${_}-${M}`
|
|
222
|
+
}, [f, c, Te, _, M]), Se = a.useMemo(() => ({
|
|
223
|
+
"aria-orientation": p === "both" ? void 0 : p,
|
|
224
|
+
...ge ? {} : ie,
|
|
225
|
+
onKeyDown(e) {
|
|
226
|
+
if (e.key === "Tab" && e.shiftKey && c && !f) {
|
|
227
|
+
const s = Ye(e.nativeEvent);
|
|
228
|
+
if (s && !Ae(K.current, s))
|
|
229
|
+
return;
|
|
230
|
+
S(e), i.setOpen(!1, le(_e, e.nativeEvent)), Pe(O) && O.focus();
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
B(e);
|
|
234
|
+
},
|
|
235
|
+
onPointerMove() {
|
|
236
|
+
q.current = !0;
|
|
237
|
+
}
|
|
238
|
+
}), [ie, B, K, p, ge, i, c, f, O]), ue = a.useMemo(() => {
|
|
239
|
+
function e(r) {
|
|
240
|
+
x === "auto" && Qe(r.nativeEvent) && (z.current = !f);
|
|
241
|
+
}
|
|
242
|
+
function s(r) {
|
|
243
|
+
z.current = x, x === "auto" && Xe(r.nativeEvent) && (z.current = !0);
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
onKeyDown(r) {
|
|
247
|
+
const d = i.select("open");
|
|
248
|
+
q.current = !1;
|
|
249
|
+
const R = r.key.startsWith("Arrow"), y = tr(r.key, se(), l), j = de(r.key, p), ye = (E ? y : j) || r.key === "Enter" || r.key.trim() === "";
|
|
250
|
+
if (f && d)
|
|
251
|
+
return B(r);
|
|
252
|
+
if (!(!d && !P && R)) {
|
|
253
|
+
if (ye) {
|
|
254
|
+
const ae = de(r.key, se());
|
|
255
|
+
v.current = E && ae ? null : r.key;
|
|
256
|
+
}
|
|
257
|
+
if (E) {
|
|
258
|
+
y && (S(r), d ? (t.current = Oe(o, Re.current), g(r)) : i.setOpen(!0, le(xe, r.nativeEvent, r.currentTarget)));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
j && ($.current != null && (t.current = $.current), S(r), !d && P ? i.setOpen(!0, le(xe, r.nativeEvent, r.currentTarget)) : B(r), d && g(r));
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
onFocus(r) {
|
|
265
|
+
i.select("open") && !f && (t.current = -1, g(r));
|
|
266
|
+
},
|
|
267
|
+
onPointerDown: s,
|
|
268
|
+
onPointerEnter: s,
|
|
269
|
+
onMouseDown: e,
|
|
270
|
+
onClick: e
|
|
271
|
+
};
|
|
272
|
+
}, [B, Re, x, o, E, g, i, P, p, se, l, $, f]), ke = a.useMemo(() => ({
|
|
273
|
+
...ie,
|
|
274
|
+
...ue
|
|
275
|
+
}), [ie, ue]);
|
|
276
|
+
return a.useMemo(() => w ? {
|
|
277
|
+
reference: ke,
|
|
278
|
+
floating: Se,
|
|
279
|
+
item: Ie,
|
|
280
|
+
trigger: ue
|
|
281
|
+
} : {}, [w, ke, Se, ue, Ie]);
|
|
282
|
+
}
|
|
283
|
+
function hr(n, h) {
|
|
284
|
+
const i = "rootStore" in n ? n.rootStore : n, c = i.useState("open"), m = i.context.dataRef, {
|
|
285
|
+
listRef: O,
|
|
286
|
+
activeIndex: G,
|
|
287
|
+
onMatch: o,
|
|
288
|
+
onTypingChange: M,
|
|
289
|
+
enabled: ee = !0,
|
|
290
|
+
findMatch: w = null,
|
|
291
|
+
resetMs: D = 750,
|
|
292
|
+
ignoreKeys: U = er,
|
|
293
|
+
selectedIndex: k = null
|
|
294
|
+
} = h, E = Ze(), l = a.useRef(""), f = a.useRef(k ?? G ?? -1), x = a.useRef(null);
|
|
295
|
+
F(() => {
|
|
296
|
+
c && (E.clear(), x.current = null, l.current = "");
|
|
297
|
+
}, [c, E]), F(() => {
|
|
298
|
+
c && l.current === "" && (f.current = k ?? G ?? -1);
|
|
299
|
+
}, [c, k, G]);
|
|
300
|
+
const b = Q((u) => {
|
|
301
|
+
u ? m.current.typing || (m.current.typing = u, M?.(u)) : m.current.typing && (m.current.typing = u, M?.(u));
|
|
302
|
+
}), P = Q((u) => {
|
|
303
|
+
function L(N, te, ne) {
|
|
304
|
+
const K = w ? w(te, ne) : te.find((W) => W?.toLocaleLowerCase().indexOf(ne.toLocaleLowerCase()) === 0);
|
|
305
|
+
return K ? N.indexOf(K) : -1;
|
|
306
|
+
}
|
|
307
|
+
const T = O.current;
|
|
308
|
+
if (l.current.length > 0 && l.current[0] !== " " && (L(T, T, l.current) === -1 ? b(!1) : u.key === " " && S(u)), T == null || U.includes(u.key) || // Character key.
|
|
309
|
+
u.key.length !== 1 || // Modifier key.
|
|
310
|
+
u.ctrlKey || u.metaKey || u.altKey)
|
|
311
|
+
return;
|
|
312
|
+
c && u.key !== " " && (S(u), b(!0)), T.every((N) => N ? N[0]?.toLocaleLowerCase() !== N[1]?.toLocaleLowerCase() : !0) && l.current === u.key && (l.current = "", f.current = x.current), l.current += u.key, E.start(D, () => {
|
|
313
|
+
l.current = "", f.current = x.current, b(!1);
|
|
314
|
+
});
|
|
315
|
+
const re = f.current, _ = L(T, [...T.slice((re || 0) + 1), ...T.slice(0, (re || 0) + 1)], l.current);
|
|
316
|
+
_ !== -1 ? (o?.(_), x.current = _) : u.key !== " " && (l.current = "", b(!1));
|
|
317
|
+
}), I = a.useMemo(() => ({
|
|
318
|
+
onKeyDown: P
|
|
319
|
+
}), [P]), p = a.useMemo(() => ({
|
|
320
|
+
onKeyDown: P,
|
|
321
|
+
onKeyUp(u) {
|
|
322
|
+
u.key === " " && b(!1);
|
|
323
|
+
}
|
|
324
|
+
}), [P, b]);
|
|
325
|
+
return a.useMemo(() => ee ? {
|
|
326
|
+
reference: I,
|
|
327
|
+
floating: p
|
|
328
|
+
} : {}, [ee, I, p]);
|
|
329
|
+
}
|
|
330
|
+
export {
|
|
331
|
+
hr as a,
|
|
332
|
+
Rr as u
|
|
333
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { u as r } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
2
|
+
import { a as n } from "./useRenderElement-DwToLA61.js";
|
|
3
|
+
function c(e) {
|
|
4
|
+
const t = n(f, e).current;
|
|
5
|
+
return t.next = e, r(t.effect), t;
|
|
6
|
+
}
|
|
7
|
+
function f(e) {
|
|
8
|
+
const t = {
|
|
9
|
+
current: e,
|
|
10
|
+
next: e,
|
|
11
|
+
effect: () => {
|
|
12
|
+
t.current = t.next;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
c as u
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { u as o } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
3
|
+
import { u as s } from "./useStableCallback-CkTrVkNX.js";
|
|
4
|
+
function f(r, a) {
|
|
5
|
+
const t = n.useRef(r), e = s(a);
|
|
6
|
+
o(() => {
|
|
7
|
+
t.current !== r && e(t.current);
|
|
8
|
+
}, [r, e]), o(() => {
|
|
9
|
+
t.current = r;
|
|
10
|
+
}, [r]);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
f as u
|
|
14
|
+
};
|
package/dist/view.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._view_scrh3_1{display:flex;position:relative;flex-shrink:0;flex-basis:auto;flex-direction:column;align-items:stretch;box-sizing:border-box;outline:none;border-style:solid}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let n;
|
|
2
|
+
process.env.NODE_ENV !== "production" && (n = /* @__PURE__ */ new Set());
|
|
3
|
+
function s(...o) {
|
|
4
|
+
if (process.env.NODE_ENV !== "production") {
|
|
5
|
+
const e = o.join(" ");
|
|
6
|
+
n.has(e) || (n.add(e), console.warn(`Base UI: ${e}`));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
s as w
|
|
11
|
+
};
|