@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,22 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
const l = {
|
|
3
|
+
...n
|
|
4
|
+
};
|
|
5
|
+
let s = 0;
|
|
6
|
+
function d(u, t = "mui") {
|
|
7
|
+
const [e, c] = n.useState(u), o = u || e;
|
|
8
|
+
return n.useEffect(() => {
|
|
9
|
+
e == null && (s += 1, c(`${t}-${s}`));
|
|
10
|
+
}, [e, t]), o;
|
|
11
|
+
}
|
|
12
|
+
const a = l.useId;
|
|
13
|
+
function f(u, t) {
|
|
14
|
+
if (a !== void 0) {
|
|
15
|
+
const e = a();
|
|
16
|
+
return u ?? (t ? `${t}-${e}` : e);
|
|
17
|
+
}
|
|
18
|
+
return d(u, t);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
f as u
|
|
22
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { u } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
2
|
+
import { a as f } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
3
|
+
import { u as a } from "./useBaseUiId-B7WyxtIE.js";
|
|
4
|
+
import { u as m } from "./LabelableContext-BMvjVwor.js";
|
|
5
|
+
import { N as c } from "./useRenderElement-DwToLA61.js";
|
|
6
|
+
function x(i = {}) {
|
|
7
|
+
const {
|
|
8
|
+
id: e,
|
|
9
|
+
implicit: o = !1,
|
|
10
|
+
controlRef: l
|
|
11
|
+
} = i, {
|
|
12
|
+
controlId: s,
|
|
13
|
+
setControlId: t
|
|
14
|
+
} = m(), r = a(e);
|
|
15
|
+
return u(() => {
|
|
16
|
+
if (!(!o && !e || t === c)) {
|
|
17
|
+
if (o) {
|
|
18
|
+
const n = l?.current;
|
|
19
|
+
f(n) && n.closest("label") != null ? t(e ?? null) : t(s ?? r);
|
|
20
|
+
} else e && t(e);
|
|
21
|
+
return () => {
|
|
22
|
+
e && t(void 0);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}, [e, l, s, t, o, r]), s ?? r;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
x as u
|
|
29
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as m from "react";
|
|
2
|
+
import { u as f } from "./useStableCallback-CkTrVkNX.js";
|
|
3
|
+
import { u as p } from "./useValueAsRef-HURLzret.js";
|
|
4
|
+
import * as l from "react-dom";
|
|
5
|
+
import { u as g } from "./useAnimationFrame-451ugS_6.js";
|
|
6
|
+
function d(n) {
|
|
7
|
+
return n == null ? n : "current" in n ? n.current : n;
|
|
8
|
+
}
|
|
9
|
+
function S(n, u = !1, r = !0) {
|
|
10
|
+
const s = g();
|
|
11
|
+
return f((o, e = null) => {
|
|
12
|
+
s.cancel();
|
|
13
|
+
const t = d(n);
|
|
14
|
+
t != null && (typeof t.getAnimations != "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED ? o() : s.request(() => {
|
|
15
|
+
function i() {
|
|
16
|
+
t && Promise.all(t.getAnimations().map((a) => a.finished)).then(() => {
|
|
17
|
+
e != null && e.aborted || l.flushSync(o);
|
|
18
|
+
}).catch(() => {
|
|
19
|
+
if (r) {
|
|
20
|
+
if (e != null && e.aborted)
|
|
21
|
+
return;
|
|
22
|
+
l.flushSync(o);
|
|
23
|
+
} else t.getAnimations().length > 0 && t.getAnimations().some((a) => a.pending || a.playState !== "finished") && i();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
u ? s.request(i) : i();
|
|
27
|
+
}));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
let c = /* @__PURE__ */ (function(n) {
|
|
31
|
+
return n.startingStyle = "data-starting-style", n.endingStyle = "data-ending-style", n;
|
|
32
|
+
})({});
|
|
33
|
+
const A = {
|
|
34
|
+
[c.startingStyle]: ""
|
|
35
|
+
}, h = {
|
|
36
|
+
[c.endingStyle]: ""
|
|
37
|
+
}, I = {
|
|
38
|
+
transitionStatus(n) {
|
|
39
|
+
return n === "starting" ? A : n === "ending" ? h : null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function N(n) {
|
|
43
|
+
const {
|
|
44
|
+
enabled: u = !0,
|
|
45
|
+
open: r,
|
|
46
|
+
ref: s,
|
|
47
|
+
onComplete: o
|
|
48
|
+
} = n, e = p(r), t = f(o), i = S(s, r);
|
|
49
|
+
m.useEffect(() => {
|
|
50
|
+
u && i(() => {
|
|
51
|
+
r === e.current && t();
|
|
52
|
+
});
|
|
53
|
+
}, [u, r, t, i, e]);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
c as T,
|
|
57
|
+
N as a,
|
|
58
|
+
d as r,
|
|
59
|
+
I as t,
|
|
60
|
+
S as u
|
|
61
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as g from "react";
|
|
2
|
+
import { u as O } from "./useAnimationFrame-451ugS_6.js";
|
|
3
|
+
import { u as $ } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
4
|
+
import { u as A } from "./useStableCallback-CkTrVkNX.js";
|
|
5
|
+
import { u as B } from "./useOpenChangeComplete-Dse9kY9E.js";
|
|
6
|
+
import { r as C } from "./floating-ui.utils-C7pRWMZ_.js";
|
|
7
|
+
import { g as k, i as D } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
8
|
+
import { E as T } from "./useRenderElement-DwToLA61.js";
|
|
9
|
+
function F(o) {
|
|
10
|
+
const e = k(o);
|
|
11
|
+
let t = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
|
|
12
|
+
const u = D(o), c = u ? o.offsetWidth : t, d = u ? o.offsetHeight : i;
|
|
13
|
+
return (C(t) !== c || C(i) !== d) && (t = c, i = d), {
|
|
14
|
+
width: t,
|
|
15
|
+
height: i
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const H = typeof ResizeObserver < "u", W = () => !0;
|
|
19
|
+
function U(o) {
|
|
20
|
+
const {
|
|
21
|
+
popupElement: e,
|
|
22
|
+
positionerElement: t,
|
|
23
|
+
content: i,
|
|
24
|
+
mounted: u,
|
|
25
|
+
enabled: c = W,
|
|
26
|
+
onMeasureLayout: d,
|
|
27
|
+
onMeasureLayoutComplete: b,
|
|
28
|
+
side: n,
|
|
29
|
+
direction: w
|
|
30
|
+
} = o, f = g.useRef(!0), x = B(e, !0, !1), m = O(), r = g.useRef(null), S = A(d), P = A(b), M = g.useMemo(() => {
|
|
31
|
+
let s = n === "top", p = n === "left";
|
|
32
|
+
return w === "rtl" ? (s = s || n === "inline-end", p = p || n === "inline-end") : (s = s || n === "inline-start", p = p || n === "inline-start"), s ? {
|
|
33
|
+
position: "absolute",
|
|
34
|
+
[n === "top" ? "bottom" : "top"]: "0",
|
|
35
|
+
[p ? "right" : "left"]: "0"
|
|
36
|
+
} : T;
|
|
37
|
+
}, [n, w]);
|
|
38
|
+
$(() => {
|
|
39
|
+
if (!u || !c() || !H) {
|
|
40
|
+
f.current = !0, r.current = null;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!e || !t)
|
|
44
|
+
return;
|
|
45
|
+
Object.entries(M).forEach(([a, l]) => {
|
|
46
|
+
e.style.setProperty(a, l);
|
|
47
|
+
});
|
|
48
|
+
const s = new ResizeObserver((a) => {
|
|
49
|
+
const l = a[0];
|
|
50
|
+
l && (r.current === null ? r.current = {
|
|
51
|
+
width: Math.ceil(l.borderBoxSize[0].inlineSize),
|
|
52
|
+
height: Math.ceil(l.borderBoxSize[0].blockSize)
|
|
53
|
+
} : (r.current.width = Math.ceil(l.borderBoxSize[0].inlineSize), r.current.height = Math.ceil(l.borderBoxSize[0].blockSize)));
|
|
54
|
+
});
|
|
55
|
+
s.observe(e), e.style.setProperty("--popup-width", "auto"), e.style.setProperty("--popup-height", "auto");
|
|
56
|
+
const p = y(e, "position", "static"), z = y(e, "transform", "none"), R = y(e, "scale", "1"), E = y(t, "--available-width", "max-content"), v = y(t, "--available-height", "max-content");
|
|
57
|
+
if (S?.(), f.current || r.current === null) {
|
|
58
|
+
t.style.setProperty("--positioner-width", "max-content"), t.style.setProperty("--positioner-height", "max-content");
|
|
59
|
+
const a = F(e);
|
|
60
|
+
return t.style.setProperty("--positioner-width", `${a.width}px`), t.style.setProperty("--positioner-height", `${a.height}px`), p(), z(), R(), E(), v(), P?.(null, a), f.current = !1, () => {
|
|
61
|
+
s.disconnect();
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
e.style.setProperty("--popup-width", "auto"), e.style.setProperty("--popup-height", "auto"), t.style.setProperty("--positioner-width", "max-content"), t.style.setProperty("--positioner-height", "max-content");
|
|
65
|
+
const h = F(e);
|
|
66
|
+
e.style.setProperty("--popup-width", `${r.current.width}px`), e.style.setProperty("--popup-height", `${r.current.height}px`), p(), z(), E(), v(), P?.(r.current, h), t.style.setProperty("--positioner-width", `${h.width}px`), t.style.setProperty("--positioner-height", `${h.height}px`);
|
|
67
|
+
const L = new AbortController();
|
|
68
|
+
return m.request(() => {
|
|
69
|
+
e.style.setProperty("--popup-width", `${h.width}px`), e.style.setProperty("--popup-height", `${h.height}px`), x(() => {
|
|
70
|
+
e.style.setProperty("--popup-width", "auto"), e.style.setProperty("--popup-height", "auto");
|
|
71
|
+
}, L.signal);
|
|
72
|
+
}), () => {
|
|
73
|
+
s.disconnect(), L.abort(), m.cancel();
|
|
74
|
+
};
|
|
75
|
+
}, [i, e, t, x, m, c, u, S, P, M]);
|
|
76
|
+
}
|
|
77
|
+
function y(o, e, t) {
|
|
78
|
+
const i = o.style.getPropertyValue(e);
|
|
79
|
+
return o.style.setProperty(e, t), () => {
|
|
80
|
+
o.style.setProperty(e, i);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
U as u
|
|
85
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { f as R } from "./formatErrorMessage-BqPuTBN-.js";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { createElement as h } from "react";
|
|
4
|
+
const p = {};
|
|
5
|
+
function I(e, n) {
|
|
6
|
+
const t = d.useRef(p);
|
|
7
|
+
return t.current === p && (t.current = e(n)), t;
|
|
8
|
+
}
|
|
9
|
+
function A(e, n, t, u) {
|
|
10
|
+
const r = I(P).current;
|
|
11
|
+
return M(r, e, n, t, u) && v(r, [e, n, t, u]), r.callback;
|
|
12
|
+
}
|
|
13
|
+
function w(e) {
|
|
14
|
+
const n = I(P).current;
|
|
15
|
+
return U(n, e) && v(n, e), n.callback;
|
|
16
|
+
}
|
|
17
|
+
function P() {
|
|
18
|
+
return {
|
|
19
|
+
callback: null,
|
|
20
|
+
cleanup: null,
|
|
21
|
+
refs: []
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function M(e, n, t, u, r) {
|
|
25
|
+
return e.refs[0] !== n || e.refs[1] !== t || e.refs[2] !== u || e.refs[3] !== r;
|
|
26
|
+
}
|
|
27
|
+
function U(e, n) {
|
|
28
|
+
return e.refs.length !== n.length || e.refs.some((t, u) => t !== n[u]);
|
|
29
|
+
}
|
|
30
|
+
function v(e, n) {
|
|
31
|
+
if (e.refs = n, n.every((t) => t == null)) {
|
|
32
|
+
e.callback = null;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
e.callback = (t) => {
|
|
36
|
+
if (e.cleanup && (e.cleanup(), e.cleanup = null), t != null) {
|
|
37
|
+
const u = Array(n.length).fill(null);
|
|
38
|
+
for (let r = 0; r < n.length; r += 1) {
|
|
39
|
+
const c = n[r];
|
|
40
|
+
if (c != null)
|
|
41
|
+
switch (typeof c) {
|
|
42
|
+
case "function": {
|
|
43
|
+
const f = c(t);
|
|
44
|
+
typeof f == "function" && (u[r] = f);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case "object": {
|
|
48
|
+
c.current = t;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
e.cleanup = () => {
|
|
54
|
+
for (let r = 0; r < n.length; r += 1) {
|
|
55
|
+
const c = n[r];
|
|
56
|
+
if (c != null)
|
|
57
|
+
switch (typeof c) {
|
|
58
|
+
case "function": {
|
|
59
|
+
const f = u[r];
|
|
60
|
+
typeof f == "function" ? f() : c(null);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case "object": {
|
|
64
|
+
c.current = null;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const S = parseInt(d.version, 10);
|
|
74
|
+
function V(e) {
|
|
75
|
+
return S >= e;
|
|
76
|
+
}
|
|
77
|
+
function N(e) {
|
|
78
|
+
if (!/* @__PURE__ */ d.isValidElement(e))
|
|
79
|
+
return null;
|
|
80
|
+
const n = e, t = n.props;
|
|
81
|
+
return (V(19) ? t?.ref : n.ref) ?? null;
|
|
82
|
+
}
|
|
83
|
+
function b(e, n) {
|
|
84
|
+
if (e && !n)
|
|
85
|
+
return e;
|
|
86
|
+
if (!e && n)
|
|
87
|
+
return n;
|
|
88
|
+
if (e || n)
|
|
89
|
+
return {
|
|
90
|
+
...e,
|
|
91
|
+
...n
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function L(e, n) {
|
|
95
|
+
const t = {};
|
|
96
|
+
for (const u in e) {
|
|
97
|
+
const r = e[u];
|
|
98
|
+
if (n?.hasOwnProperty(u)) {
|
|
99
|
+
const c = n[u](r);
|
|
100
|
+
c != null && Object.assign(t, c);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
r === !0 ? t[`data-${u.toLowerCase()}`] = "" : r && (t[`data-${u.toLowerCase()}`] = r.toString());
|
|
104
|
+
}
|
|
105
|
+
return t;
|
|
106
|
+
}
|
|
107
|
+
function T(e, n) {
|
|
108
|
+
return typeof e == "function" ? e(n) : e;
|
|
109
|
+
}
|
|
110
|
+
function Y(e, n) {
|
|
111
|
+
return typeof e == "function" ? e(n) : e;
|
|
112
|
+
}
|
|
113
|
+
const a = {};
|
|
114
|
+
function _(e, n, t, u, r) {
|
|
115
|
+
let c = {
|
|
116
|
+
...E(e, a)
|
|
117
|
+
};
|
|
118
|
+
return n && (c = l(c, n)), t && (c = l(c, t)), u && (c = l(c, u)), r && (c = l(c, r)), c;
|
|
119
|
+
}
|
|
120
|
+
function B(e) {
|
|
121
|
+
if (e.length === 0)
|
|
122
|
+
return a;
|
|
123
|
+
if (e.length === 1)
|
|
124
|
+
return E(e[0], a);
|
|
125
|
+
let n = {
|
|
126
|
+
...E(e[0], a)
|
|
127
|
+
};
|
|
128
|
+
for (let t = 1; t < e.length; t += 1)
|
|
129
|
+
n = l(n, e[t]);
|
|
130
|
+
return n;
|
|
131
|
+
}
|
|
132
|
+
function l(e, n) {
|
|
133
|
+
return O(n) ? n(e) : z(e, n);
|
|
134
|
+
}
|
|
135
|
+
function z(e, n) {
|
|
136
|
+
if (!n)
|
|
137
|
+
return e;
|
|
138
|
+
for (const t in n) {
|
|
139
|
+
const u = n[t];
|
|
140
|
+
switch (t) {
|
|
141
|
+
case "style": {
|
|
142
|
+
e[t] = b(e.style, u);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case "className": {
|
|
146
|
+
e[t] = k(e.className, u);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
default:
|
|
150
|
+
D(t, u) ? e[t] = G(e[t], u) : e[t] = u;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return e;
|
|
154
|
+
}
|
|
155
|
+
function D(e, n) {
|
|
156
|
+
const t = e.charCodeAt(0), u = e.charCodeAt(1), r = e.charCodeAt(2);
|
|
157
|
+
return t === 111 && u === 110 && r >= 65 && r <= 90 && (typeof n == "function" || typeof n > "u");
|
|
158
|
+
}
|
|
159
|
+
function O(e) {
|
|
160
|
+
return typeof e == "function";
|
|
161
|
+
}
|
|
162
|
+
function E(e, n) {
|
|
163
|
+
return O(e) ? e(n) : e ?? a;
|
|
164
|
+
}
|
|
165
|
+
function G(e, n) {
|
|
166
|
+
return n ? e ? (t) => {
|
|
167
|
+
if ($(t)) {
|
|
168
|
+
const r = t;
|
|
169
|
+
W(r);
|
|
170
|
+
const c = n(r);
|
|
171
|
+
return r.baseUIHandlerPrevented || e?.(r), c;
|
|
172
|
+
}
|
|
173
|
+
const u = n(t);
|
|
174
|
+
return e?.(t), u;
|
|
175
|
+
} : n : e;
|
|
176
|
+
}
|
|
177
|
+
function W(e) {
|
|
178
|
+
return e.preventBaseUIHandler = () => {
|
|
179
|
+
e.baseUIHandlerPrevented = !0;
|
|
180
|
+
}, e;
|
|
181
|
+
}
|
|
182
|
+
function k(e, n) {
|
|
183
|
+
return n ? e ? n + " " + e : n : e;
|
|
184
|
+
}
|
|
185
|
+
function $(e) {
|
|
186
|
+
return e != null && typeof e == "object" && "nativeEvent" in e;
|
|
187
|
+
}
|
|
188
|
+
function K() {
|
|
189
|
+
}
|
|
190
|
+
const Q = Object.freeze([]), s = Object.freeze({});
|
|
191
|
+
function X(e, n, t = {}) {
|
|
192
|
+
const u = n.render, r = F(n, t);
|
|
193
|
+
if (t.enabled === !1)
|
|
194
|
+
return null;
|
|
195
|
+
const c = t.state ?? s;
|
|
196
|
+
return J(e, u, r, c);
|
|
197
|
+
}
|
|
198
|
+
function F(e, n = {}) {
|
|
199
|
+
const {
|
|
200
|
+
className: t,
|
|
201
|
+
style: u,
|
|
202
|
+
render: r
|
|
203
|
+
} = e, {
|
|
204
|
+
state: c = s,
|
|
205
|
+
ref: f,
|
|
206
|
+
props: y,
|
|
207
|
+
stateAttributesMapping: C,
|
|
208
|
+
enabled: o = !0
|
|
209
|
+
} = n, m = o ? T(t, c) : void 0, g = o ? Y(u, c) : void 0, j = o ? L(c, C) : s, i = o ? b(j, Array.isArray(y) ? B(y) : y) ?? s : s;
|
|
210
|
+
return typeof document < "u" && (o ? Array.isArray(f) ? i.ref = w([i.ref, N(r), ...f]) : i.ref = A(i.ref, N(r), f) : A(null, null)), o ? (m !== void 0 && (i.className = k(i.className, m)), g !== void 0 && (i.style = b(i.style, g)), i) : s;
|
|
211
|
+
}
|
|
212
|
+
function J(e, n, t, u) {
|
|
213
|
+
if (n) {
|
|
214
|
+
if (typeof n == "function")
|
|
215
|
+
return n(t, u);
|
|
216
|
+
const r = _(t, n.props);
|
|
217
|
+
return r.ref = t.ref, /* @__PURE__ */ d.cloneElement(n, r);
|
|
218
|
+
}
|
|
219
|
+
if (e && typeof e == "string")
|
|
220
|
+
return Z(e, t);
|
|
221
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : R(8));
|
|
222
|
+
}
|
|
223
|
+
function Z(e, n) {
|
|
224
|
+
return e === "button" ? /* @__PURE__ */ h("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
...n,
|
|
227
|
+
key: n.key
|
|
228
|
+
}) : e === "img" ? /* @__PURE__ */ h("img", {
|
|
229
|
+
alt: "",
|
|
230
|
+
...n,
|
|
231
|
+
key: n.key
|
|
232
|
+
}) : /* @__PURE__ */ d.createElement(e, n);
|
|
233
|
+
}
|
|
234
|
+
export {
|
|
235
|
+
s as E,
|
|
236
|
+
K as N,
|
|
237
|
+
I as a,
|
|
238
|
+
Q as b,
|
|
239
|
+
A as c,
|
|
240
|
+
W as d,
|
|
241
|
+
V as i,
|
|
242
|
+
_ as m,
|
|
243
|
+
X as u
|
|
244
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import { u as P } from "./useId-C5kyn6tA.js";
|
|
3
|
+
import { u as S } from "./transitions.module-CWX8e5cx.js";
|
|
4
|
+
import { E as F } from "./useRenderElement-DwToLA61.js";
|
|
5
|
+
import { g as y } from "./element-CZEOj04G.js";
|
|
6
|
+
const T = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
|
|
7
|
+
function k(c, I = {}) {
|
|
8
|
+
const a = "rootStore" in c ? c.rootStore : c, l = a.useState("open"), u = a.useState("floatingId"), x = a.useState("domReferenceElement"), d = a.useState("floatingElement"), {
|
|
9
|
+
enabled: m = !0,
|
|
10
|
+
role: o = "dialog"
|
|
11
|
+
} = I, M = P(), s = x?.id || M, t = r.useMemo(() => y(d)?.id || u, [d, u]), e = T.get(o) ?? o, p = S() != null, i = r.useMemo(() => e === "tooltip" || o === "label" ? F : {
|
|
12
|
+
"aria-haspopup": e === "alertdialog" ? "dialog" : e,
|
|
13
|
+
"aria-expanded": "false",
|
|
14
|
+
...e === "listbox" && {
|
|
15
|
+
role: "combobox"
|
|
16
|
+
},
|
|
17
|
+
...e === "menu" && p && {
|
|
18
|
+
role: "menuitem"
|
|
19
|
+
},
|
|
20
|
+
...o === "select" && {
|
|
21
|
+
"aria-autocomplete": "none"
|
|
22
|
+
},
|
|
23
|
+
...o === "combobox" && {
|
|
24
|
+
"aria-autocomplete": "list"
|
|
25
|
+
}
|
|
26
|
+
}, [e, p, o]), f = r.useMemo(() => e === "tooltip" || o === "label" ? {
|
|
27
|
+
[`aria-${o === "label" ? "labelledby" : "describedby"}`]: l ? t : void 0
|
|
28
|
+
} : {
|
|
29
|
+
...i,
|
|
30
|
+
"aria-expanded": l ? "true" : "false",
|
|
31
|
+
"aria-controls": l ? t : void 0,
|
|
32
|
+
...e === "menu" && {
|
|
33
|
+
id: s
|
|
34
|
+
}
|
|
35
|
+
}, [e, t, l, s, o, i]), b = r.useMemo(() => {
|
|
36
|
+
const n = {
|
|
37
|
+
id: t,
|
|
38
|
+
...e && {
|
|
39
|
+
role: e
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return e === "tooltip" || o === "label" ? n : {
|
|
43
|
+
...n,
|
|
44
|
+
...e === "menu" && {
|
|
45
|
+
"aria-labelledby": s
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}, [e, t, s, o]), g = r.useCallback(({
|
|
49
|
+
active: n,
|
|
50
|
+
selected: R
|
|
51
|
+
}) => {
|
|
52
|
+
const E = {
|
|
53
|
+
role: "option",
|
|
54
|
+
...n && {
|
|
55
|
+
id: `${t}-fui-option`
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
switch (o) {
|
|
59
|
+
case "select":
|
|
60
|
+
case "combobox":
|
|
61
|
+
return {
|
|
62
|
+
...E,
|
|
63
|
+
"aria-selected": R
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {};
|
|
67
|
+
}, [t, o]);
|
|
68
|
+
return r.useMemo(() => m ? {
|
|
69
|
+
reference: f,
|
|
70
|
+
floating: b,
|
|
71
|
+
item: g,
|
|
72
|
+
trigger: i
|
|
73
|
+
} : {}, [m, f, b, i, g]);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
k as u
|
|
77
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { a as c } from "./useRenderElement-DwToLA61.js";
|
|
3
|
+
const n = a[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)], r = (
|
|
4
|
+
// React 17 doesn't have useInsertionEffect.
|
|
5
|
+
n && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
|
|
6
|
+
n !== a.useLayoutEffect ? n : (e) => e()
|
|
7
|
+
);
|
|
8
|
+
function f(e) {
|
|
9
|
+
const t = c(o).current;
|
|
10
|
+
return t.next = e, r(t.effect), t.trampoline;
|
|
11
|
+
}
|
|
12
|
+
function o() {
|
|
13
|
+
const e = {
|
|
14
|
+
next: void 0,
|
|
15
|
+
callback: s,
|
|
16
|
+
trampoline: (...t) => e.callback?.(...t),
|
|
17
|
+
effect: () => {
|
|
18
|
+
e.callback = e.next;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
function s() {
|
|
24
|
+
if (process.env.NODE_ENV !== "production")
|
|
25
|
+
throw new Error("Base UI: Cannot call an event handler while rendering.");
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
f as u
|
|
29
|
+
};
|