@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,699 @@
|
|
|
1
|
+
import { jsx as k, jsxs as ne } from "react/jsx-runtime";
|
|
2
|
+
import { c as Ce } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { textify as te } from "../../-utils.js";
|
|
4
|
+
import { Icon as Ne } from "../icon/index.js";
|
|
5
|
+
import { Surface as Oe } from "../surface/index.js";
|
|
6
|
+
import { View as oe } from "../view/index.js";
|
|
7
|
+
import * as r from "react";
|
|
8
|
+
import { u as ae } from "../../useControlled-Du4sJyMj.js";
|
|
9
|
+
import { u as L } from "../../useStableCallback-CkTrVkNX.js";
|
|
10
|
+
import { u as T } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
|
|
11
|
+
import { w as K } from "../../warn-CKtX8MLJ.js";
|
|
12
|
+
import { C as Ee, u as xe } from "../../useCompositeListItem-OkcAim_1.js";
|
|
13
|
+
import { u as ve } from "../../DirectionContext-C2o_MF_i.js";
|
|
14
|
+
import { f as z } from "../../formatErrorMessage-BqPuTBN-.js";
|
|
15
|
+
import { u as B, c as ce } from "../../useRenderElement-DwToLA61.js";
|
|
16
|
+
import { c as $, n as le, a as Ae } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
|
|
17
|
+
import { u as j } from "../../useBaseUiId-B7WyxtIE.js";
|
|
18
|
+
import { u as Se, T as re, t as Me, a as Pe } from "../../useOpenChangeComplete-Dse9kY9E.js";
|
|
19
|
+
import { u as we } from "../../useTransitionStatus-CUfcuGAV.js";
|
|
20
|
+
import { i as ie } from "../../isElementDisabled-Cbd8W9kH.js";
|
|
21
|
+
import { b as de, e as ue, c as fe, d as pe, H as Ie, E as De } from "../../composite-C9L5QmZL.js";
|
|
22
|
+
import { u as Ve } from "../../useButton-DfIwsdb8.js";
|
|
23
|
+
import { s as Fe } from "../../event-CKoGyQEJ.js";
|
|
24
|
+
import { u as Te } from "../../useOnMount-VRW6CK2u.js";
|
|
25
|
+
import { u as ke, A as F } from "../../useAnimationFrame-451ugS_6.js";
|
|
26
|
+
import '../../index30.css';const G = /* @__PURE__ */ r.createContext(void 0);
|
|
27
|
+
process.env.NODE_ENV !== "production" && (G.displayName = "AccordionRootContext");
|
|
28
|
+
function Y() {
|
|
29
|
+
const n = r.useContext(G);
|
|
30
|
+
if (n === void 0)
|
|
31
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: AccordionRootContext is missing. Accordion parts must be placed within <Accordion.Root>." : z(10));
|
|
32
|
+
return n;
|
|
33
|
+
}
|
|
34
|
+
const He = {
|
|
35
|
+
value: () => null
|
|
36
|
+
}, me = /* @__PURE__ */ r.forwardRef(function(o, i) {
|
|
37
|
+
const {
|
|
38
|
+
render: w,
|
|
39
|
+
className: I,
|
|
40
|
+
disabled: c = !1,
|
|
41
|
+
hiddenUntilFound: m,
|
|
42
|
+
keepMounted: v,
|
|
43
|
+
loopFocus: C = !0,
|
|
44
|
+
onValueChange: R,
|
|
45
|
+
multiple: h = !1,
|
|
46
|
+
orientation: d = "vertical",
|
|
47
|
+
value: N,
|
|
48
|
+
defaultValue: f,
|
|
49
|
+
...O
|
|
50
|
+
} = o, E = ve();
|
|
51
|
+
process.env.NODE_ENV !== "production" && T(() => {
|
|
52
|
+
m && v === !1 && K("The `keepMounted={false}` prop on a Accordion.Root will be ignored when using `hiddenUntilFound` since it requires Panels to remain mounted when closed.");
|
|
53
|
+
}, [m, v]);
|
|
54
|
+
const S = r.useMemo(() => {
|
|
55
|
+
if (N === void 0)
|
|
56
|
+
return f ?? [];
|
|
57
|
+
}, [N, f]), A = L(R), y = r.useRef([]), [b, _] = ae({
|
|
58
|
+
controlled: N,
|
|
59
|
+
default: S,
|
|
60
|
+
name: "Accordion",
|
|
61
|
+
state: "value"
|
|
62
|
+
}), l = L((p, V) => {
|
|
63
|
+
const g = $(le);
|
|
64
|
+
if (h)
|
|
65
|
+
if (V) {
|
|
66
|
+
const e = b.slice();
|
|
67
|
+
if (e.push(p), A(e, g), g.isCanceled)
|
|
68
|
+
return;
|
|
69
|
+
_(e);
|
|
70
|
+
} else {
|
|
71
|
+
const e = b.filter((a) => a !== p);
|
|
72
|
+
if (A(e, g), g.isCanceled)
|
|
73
|
+
return;
|
|
74
|
+
_(e);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const e = b[0] === p ? [] : [p];
|
|
78
|
+
if (A(e, g), g.isCanceled)
|
|
79
|
+
return;
|
|
80
|
+
_(e);
|
|
81
|
+
}
|
|
82
|
+
}), x = r.useMemo(() => ({
|
|
83
|
+
value: b,
|
|
84
|
+
disabled: c,
|
|
85
|
+
orientation: d
|
|
86
|
+
}), [b, c, d]), M = r.useMemo(() => ({
|
|
87
|
+
accordionItemRefs: y,
|
|
88
|
+
direction: E,
|
|
89
|
+
disabled: c,
|
|
90
|
+
handleValueChange: l,
|
|
91
|
+
hiddenUntilFound: m ?? !1,
|
|
92
|
+
keepMounted: v ?? !1,
|
|
93
|
+
loopFocus: C,
|
|
94
|
+
orientation: d,
|
|
95
|
+
state: x,
|
|
96
|
+
value: b
|
|
97
|
+
}), [E, c, l, m, v, C, d, x, b]), P = B("div", o, {
|
|
98
|
+
state: x,
|
|
99
|
+
ref: i,
|
|
100
|
+
props: [{
|
|
101
|
+
dir: E,
|
|
102
|
+
role: "region"
|
|
103
|
+
}, O],
|
|
104
|
+
stateAttributesMapping: He
|
|
105
|
+
});
|
|
106
|
+
return /* @__PURE__ */ k(G.Provider, {
|
|
107
|
+
value: M,
|
|
108
|
+
children: /* @__PURE__ */ k(Ee, {
|
|
109
|
+
elementsRef: y,
|
|
110
|
+
children: P
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
process.env.NODE_ENV !== "production" && (me.displayName = "AccordionRoot");
|
|
115
|
+
function Ue(n) {
|
|
116
|
+
const {
|
|
117
|
+
open: o,
|
|
118
|
+
defaultOpen: i,
|
|
119
|
+
onOpenChange: w,
|
|
120
|
+
disabled: I
|
|
121
|
+
} = n, c = o !== void 0, [m, v] = ae({
|
|
122
|
+
controlled: o,
|
|
123
|
+
default: i,
|
|
124
|
+
name: "Collapsible",
|
|
125
|
+
state: "open"
|
|
126
|
+
}), {
|
|
127
|
+
mounted: C,
|
|
128
|
+
setMounted: R,
|
|
129
|
+
transitionStatus: h
|
|
130
|
+
} = we(m, !0, !0), [d, N] = r.useState(m), [{
|
|
131
|
+
height: f,
|
|
132
|
+
width: O
|
|
133
|
+
}, E] = r.useState({
|
|
134
|
+
height: void 0,
|
|
135
|
+
width: void 0
|
|
136
|
+
}), S = j(), [A, y] = r.useState(), b = A ?? S, [_, l] = r.useState(!1), [x, M] = r.useState(!1), P = r.useRef(null), p = r.useRef(null), V = r.useRef(null), g = r.useRef(null), e = Se(g, !1), a = L((s) => {
|
|
137
|
+
const t = !m, u = $(Ae, s.nativeEvent);
|
|
138
|
+
if (w(t, u), u.isCanceled)
|
|
139
|
+
return;
|
|
140
|
+
const D = g.current;
|
|
141
|
+
p.current === "css-animation" && D != null && D.style.removeProperty("animation-name"), !_ && !x && (p.current != null && p.current !== "css-animation" && !C && t && R(!0), p.current === "css-animation" && (!d && t && N(!0), !C && t && R(!0))), v(t), p.current === "none" && C && !t && R(!1);
|
|
142
|
+
});
|
|
143
|
+
return T(() => {
|
|
144
|
+
c && p.current === "none" && !x && !m && R(!1);
|
|
145
|
+
}, [c, x, m, o, R]), r.useMemo(() => ({
|
|
146
|
+
abortControllerRef: P,
|
|
147
|
+
animationTypeRef: p,
|
|
148
|
+
disabled: I,
|
|
149
|
+
handleTrigger: a,
|
|
150
|
+
height: f,
|
|
151
|
+
mounted: C,
|
|
152
|
+
open: m,
|
|
153
|
+
panelId: b,
|
|
154
|
+
panelRef: g,
|
|
155
|
+
runOnceAnimationsFinish: e,
|
|
156
|
+
setDimensions: E,
|
|
157
|
+
setHiddenUntilFound: l,
|
|
158
|
+
setKeepMounted: M,
|
|
159
|
+
setMounted: R,
|
|
160
|
+
setOpen: v,
|
|
161
|
+
setPanelIdState: y,
|
|
162
|
+
setVisible: N,
|
|
163
|
+
transitionDimensionRef: V,
|
|
164
|
+
transitionStatus: h,
|
|
165
|
+
visible: d,
|
|
166
|
+
width: O
|
|
167
|
+
}), [P, p, I, a, f, C, m, b, g, e, E, l, M, R, v, N, V, h, d, O]);
|
|
168
|
+
}
|
|
169
|
+
const J = /* @__PURE__ */ r.createContext(void 0);
|
|
170
|
+
process.env.NODE_ENV !== "production" && (J.displayName = "CollapsibleRootContext");
|
|
171
|
+
function he() {
|
|
172
|
+
const n = r.useContext(J);
|
|
173
|
+
if (n === void 0)
|
|
174
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : z(15));
|
|
175
|
+
return n;
|
|
176
|
+
}
|
|
177
|
+
const Q = /* @__PURE__ */ r.createContext(void 0);
|
|
178
|
+
process.env.NODE_ENV !== "production" && (Q.displayName = "AccordionItemContext");
|
|
179
|
+
function X() {
|
|
180
|
+
const n = r.useContext(Q);
|
|
181
|
+
if (n === void 0)
|
|
182
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: AccordionItemContext is missing. Accordion parts must be placed within <Accordion.Item>." : z(9));
|
|
183
|
+
return n;
|
|
184
|
+
}
|
|
185
|
+
let W = (function(n) {
|
|
186
|
+
return n.open = "data-open", n.closed = "data-closed", n[n.startingStyle = re.startingStyle] = "startingStyle", n[n.endingStyle = re.endingStyle] = "endingStyle", n;
|
|
187
|
+
})({}), We = /* @__PURE__ */ (function(n) {
|
|
188
|
+
return n.panelOpen = "data-panel-open", n;
|
|
189
|
+
})({});
|
|
190
|
+
const Le = {
|
|
191
|
+
[W.open]: ""
|
|
192
|
+
}, Be = {
|
|
193
|
+
[W.closed]: ""
|
|
194
|
+
}, qe = {
|
|
195
|
+
open(n) {
|
|
196
|
+
return n ? {
|
|
197
|
+
[We.panelOpen]: ""
|
|
198
|
+
} : null;
|
|
199
|
+
}
|
|
200
|
+
}, je = {
|
|
201
|
+
open(n) {
|
|
202
|
+
return n ? Le : Be;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
let Ke = /* @__PURE__ */ (function(n) {
|
|
206
|
+
return n.index = "data-index", n.disabled = "data-disabled", n.open = "data-open", n;
|
|
207
|
+
})({});
|
|
208
|
+
const Z = {
|
|
209
|
+
...je,
|
|
210
|
+
index: (n) => Number.isInteger(n) ? {
|
|
211
|
+
[Ke.index]: String(n)
|
|
212
|
+
} : null,
|
|
213
|
+
...Me,
|
|
214
|
+
value: () => null
|
|
215
|
+
}, ge = /* @__PURE__ */ r.forwardRef(function(o, i) {
|
|
216
|
+
const {
|
|
217
|
+
className: w,
|
|
218
|
+
disabled: I = !1,
|
|
219
|
+
onOpenChange: c,
|
|
220
|
+
render: m,
|
|
221
|
+
value: v,
|
|
222
|
+
...C
|
|
223
|
+
} = o, {
|
|
224
|
+
ref: R,
|
|
225
|
+
index: h
|
|
226
|
+
} = xe(), d = ce(i, R), {
|
|
227
|
+
disabled: N,
|
|
228
|
+
handleValueChange: f,
|
|
229
|
+
state: O,
|
|
230
|
+
value: E
|
|
231
|
+
} = Y(), S = j(), A = v ?? S, y = I || N, b = r.useMemo(() => {
|
|
232
|
+
if (!E)
|
|
233
|
+
return !1;
|
|
234
|
+
for (let a = 0; a < E.length; a += 1)
|
|
235
|
+
if (E[a] === A)
|
|
236
|
+
return !0;
|
|
237
|
+
return !1;
|
|
238
|
+
}, [E, A]), _ = L((a, s) => {
|
|
239
|
+
c?.(a, s), !s.isCanceled && f(A, a);
|
|
240
|
+
}), l = Ue({
|
|
241
|
+
open: b,
|
|
242
|
+
onOpenChange: _,
|
|
243
|
+
disabled: y
|
|
244
|
+
}), x = r.useMemo(() => ({
|
|
245
|
+
open: l.open,
|
|
246
|
+
disabled: l.disabled,
|
|
247
|
+
hidden: !l.mounted,
|
|
248
|
+
transitionStatus: l.transitionStatus
|
|
249
|
+
}), [l.open, l.disabled, l.mounted, l.transitionStatus]), M = r.useMemo(() => ({
|
|
250
|
+
...l,
|
|
251
|
+
onOpenChange: _,
|
|
252
|
+
state: x
|
|
253
|
+
}), [l, x, _]), P = r.useMemo(() => ({
|
|
254
|
+
...O,
|
|
255
|
+
index: h,
|
|
256
|
+
disabled: y,
|
|
257
|
+
open: b
|
|
258
|
+
}), [y, h, b, O]), [p, V] = r.useState(j()), g = r.useMemo(() => ({
|
|
259
|
+
open: b,
|
|
260
|
+
state: P,
|
|
261
|
+
setTriggerId: V,
|
|
262
|
+
triggerId: p
|
|
263
|
+
}), [b, P, V, p]), e = B("div", o, {
|
|
264
|
+
state: P,
|
|
265
|
+
ref: d,
|
|
266
|
+
props: C,
|
|
267
|
+
stateAttributesMapping: Z
|
|
268
|
+
});
|
|
269
|
+
return /* @__PURE__ */ k(J.Provider, {
|
|
270
|
+
value: M,
|
|
271
|
+
children: /* @__PURE__ */ k(Q.Provider, {
|
|
272
|
+
value: g,
|
|
273
|
+
children: e
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
process.env.NODE_ENV !== "production" && (ge.displayName = "AccordionItem");
|
|
278
|
+
const be = /* @__PURE__ */ r.forwardRef(function(o, i) {
|
|
279
|
+
const {
|
|
280
|
+
render: w,
|
|
281
|
+
className: I,
|
|
282
|
+
...c
|
|
283
|
+
} = o, {
|
|
284
|
+
state: m
|
|
285
|
+
} = X();
|
|
286
|
+
return B("h3", o, {
|
|
287
|
+
state: m,
|
|
288
|
+
ref: i,
|
|
289
|
+
props: c,
|
|
290
|
+
stateAttributesMapping: Z
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
process.env.NODE_ENV !== "production" && (be.displayName = "AccordionHeader");
|
|
294
|
+
const ze = /* @__PURE__ */ new Set([de, ue, fe, pe, Ie, De]);
|
|
295
|
+
function $e(n) {
|
|
296
|
+
const {
|
|
297
|
+
current: o
|
|
298
|
+
} = n, i = [];
|
|
299
|
+
for (let w = 0; w < o.length; w += 1) {
|
|
300
|
+
const I = o[w];
|
|
301
|
+
if (!ie(I)) {
|
|
302
|
+
const c = I?.querySelector('[type="button"]');
|
|
303
|
+
ie(c) || i.push(c);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return i;
|
|
307
|
+
}
|
|
308
|
+
const _e = /* @__PURE__ */ r.forwardRef(function(o, i) {
|
|
309
|
+
const {
|
|
310
|
+
disabled: w,
|
|
311
|
+
className: I,
|
|
312
|
+
id: c,
|
|
313
|
+
render: m,
|
|
314
|
+
nativeButton: v = !0,
|
|
315
|
+
...C
|
|
316
|
+
} = o, {
|
|
317
|
+
panelId: R,
|
|
318
|
+
open: h,
|
|
319
|
+
handleTrigger: d,
|
|
320
|
+
disabled: N
|
|
321
|
+
} = he(), f = w ?? N, {
|
|
322
|
+
getButtonProps: O,
|
|
323
|
+
buttonRef: E
|
|
324
|
+
} = Ve({
|
|
325
|
+
disabled: f,
|
|
326
|
+
focusableWhenDisabled: !0,
|
|
327
|
+
native: v
|
|
328
|
+
}), {
|
|
329
|
+
accordionItemRefs: S,
|
|
330
|
+
direction: A,
|
|
331
|
+
loopFocus: y,
|
|
332
|
+
orientation: b
|
|
333
|
+
} = Y(), _ = A === "rtl", l = b === "horizontal", {
|
|
334
|
+
state: x,
|
|
335
|
+
setTriggerId: M,
|
|
336
|
+
triggerId: P
|
|
337
|
+
} = X();
|
|
338
|
+
T(() => (c && M(c), () => {
|
|
339
|
+
M(void 0);
|
|
340
|
+
}), [c, M]);
|
|
341
|
+
const p = r.useMemo(() => ({
|
|
342
|
+
"aria-controls": h ? R : void 0,
|
|
343
|
+
"aria-expanded": h,
|
|
344
|
+
disabled: f,
|
|
345
|
+
id: P,
|
|
346
|
+
onClick: d,
|
|
347
|
+
onKeyDown(g) {
|
|
348
|
+
if (!ze.has(g.key))
|
|
349
|
+
return;
|
|
350
|
+
Fe(g);
|
|
351
|
+
const e = $e(S), s = e.length - 1;
|
|
352
|
+
let t = -1;
|
|
353
|
+
const u = e.indexOf(g.target);
|
|
354
|
+
function D() {
|
|
355
|
+
y ? t = u + 1 > s ? 0 : u + 1 : t = Math.min(u + 1, s);
|
|
356
|
+
}
|
|
357
|
+
function H() {
|
|
358
|
+
y ? t = u === 0 ? s : u - 1 : t = u - 1;
|
|
359
|
+
}
|
|
360
|
+
switch (g.key) {
|
|
361
|
+
case de:
|
|
362
|
+
l || D();
|
|
363
|
+
break;
|
|
364
|
+
case ue:
|
|
365
|
+
l || H();
|
|
366
|
+
break;
|
|
367
|
+
case fe:
|
|
368
|
+
l && (_ ? H() : D());
|
|
369
|
+
break;
|
|
370
|
+
case pe:
|
|
371
|
+
l && (_ ? D() : H());
|
|
372
|
+
break;
|
|
373
|
+
case "Home":
|
|
374
|
+
t = 0;
|
|
375
|
+
break;
|
|
376
|
+
case "End":
|
|
377
|
+
t = s;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
t > -1 && e[t].focus();
|
|
381
|
+
}
|
|
382
|
+
}), [S, f, d, P, l, _, y, h, R]);
|
|
383
|
+
return B("button", o, {
|
|
384
|
+
state: x,
|
|
385
|
+
ref: [i, E],
|
|
386
|
+
props: [p, C, O],
|
|
387
|
+
stateAttributesMapping: qe
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
process.env.NODE_ENV !== "production" && (_e.displayName = "AccordionTrigger");
|
|
391
|
+
let Ge = /* @__PURE__ */ (function(n) {
|
|
392
|
+
return n.disabled = "data-disabled", n.orientation = "data-orientation", n;
|
|
393
|
+
})({});
|
|
394
|
+
function Ye(n) {
|
|
395
|
+
const {
|
|
396
|
+
abortControllerRef: o,
|
|
397
|
+
animationTypeRef: i,
|
|
398
|
+
externalRef: w,
|
|
399
|
+
height: I,
|
|
400
|
+
hiddenUntilFound: c,
|
|
401
|
+
keepMounted: m,
|
|
402
|
+
id: v,
|
|
403
|
+
mounted: C,
|
|
404
|
+
onOpenChange: R,
|
|
405
|
+
open: h,
|
|
406
|
+
panelRef: d,
|
|
407
|
+
runOnceAnimationsFinish: N,
|
|
408
|
+
setDimensions: f,
|
|
409
|
+
setMounted: O,
|
|
410
|
+
setOpen: E,
|
|
411
|
+
setVisible: S,
|
|
412
|
+
transitionDimensionRef: A,
|
|
413
|
+
visible: y,
|
|
414
|
+
width: b
|
|
415
|
+
} = n, _ = r.useRef(!1), l = r.useRef(null), x = r.useRef(h), M = r.useRef(h), P = ke(), p = r.useMemo(() => i.current === "css-animation" ? !y : !h && !C, [h, C, y, i]), V = L((e) => {
|
|
416
|
+
if (!e)
|
|
417
|
+
return;
|
|
418
|
+
if (i.current == null || A.current == null) {
|
|
419
|
+
const t = getComputedStyle(e), u = t.animationName !== "none" && t.animationName !== "", D = t.transitionDuration !== "0s" && t.transitionDuration !== "";
|
|
420
|
+
u && D ? process.env.NODE_ENV !== "production" && K("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used.") : t.animationName === "none" && t.transitionDuration !== "0s" ? i.current = "css-transition" : t.animationName !== "none" && t.transitionDuration === "0s" ? i.current = "css-animation" : i.current = "none", e.getAttribute(Ge.orientation) === "horizontal" || t.transitionProperty.indexOf("width") > -1 ? A.current = "width" : A.current = "height";
|
|
421
|
+
}
|
|
422
|
+
if (i.current !== "css-transition")
|
|
423
|
+
return;
|
|
424
|
+
(I === void 0 || b === void 0) && (f({
|
|
425
|
+
height: e.scrollHeight,
|
|
426
|
+
width: e.scrollWidth
|
|
427
|
+
}), M.current && e.style.setProperty("transition-duration", "0s"));
|
|
428
|
+
let a = -1, s = -1;
|
|
429
|
+
return a = F.request(() => {
|
|
430
|
+
M.current = !1, s = F.request(() => {
|
|
431
|
+
setTimeout(() => {
|
|
432
|
+
e.style.removeProperty("transition-duration");
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
}), () => {
|
|
436
|
+
F.cancel(a), F.cancel(s);
|
|
437
|
+
};
|
|
438
|
+
}), g = ce(w, d, V);
|
|
439
|
+
return T(() => {
|
|
440
|
+
if (i.current !== "css-transition")
|
|
441
|
+
return;
|
|
442
|
+
const e = d.current;
|
|
443
|
+
if (!e)
|
|
444
|
+
return;
|
|
445
|
+
let a = -1;
|
|
446
|
+
if (o.current != null && (o.current.abort(), o.current = null), h) {
|
|
447
|
+
const s = {
|
|
448
|
+
"justify-content": e.style.justifyContent,
|
|
449
|
+
"align-items": e.style.alignItems,
|
|
450
|
+
"align-content": e.style.alignContent,
|
|
451
|
+
"justify-items": e.style.justifyItems
|
|
452
|
+
};
|
|
453
|
+
Object.keys(s).forEach((t) => {
|
|
454
|
+
e.style.setProperty(t, "initial", "important");
|
|
455
|
+
}), !M.current && !m && e.setAttribute(W.startingStyle, ""), f({
|
|
456
|
+
height: e.scrollHeight,
|
|
457
|
+
width: e.scrollWidth
|
|
458
|
+
}), a = F.request(() => {
|
|
459
|
+
Object.entries(s).forEach(([t, u]) => {
|
|
460
|
+
u === "" ? e.style.removeProperty(t) : e.style.setProperty(t, u);
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
} else {
|
|
464
|
+
if (e.scrollHeight === 0 && e.scrollWidth === 0)
|
|
465
|
+
return;
|
|
466
|
+
f({
|
|
467
|
+
height: e.scrollHeight,
|
|
468
|
+
width: e.scrollWidth
|
|
469
|
+
});
|
|
470
|
+
const s = new AbortController();
|
|
471
|
+
o.current = s;
|
|
472
|
+
const t = s.signal;
|
|
473
|
+
let u = null;
|
|
474
|
+
const D = W.endingStyle;
|
|
475
|
+
return u = new MutationObserver((H) => {
|
|
476
|
+
H.some((q) => q.type === "attributes" && q.attributeName === D) && (u?.disconnect(), u = null, N(() => {
|
|
477
|
+
f({
|
|
478
|
+
height: 0,
|
|
479
|
+
width: 0
|
|
480
|
+
}), e.style.removeProperty("content-visibility"), O(!1), o.current === s && (o.current = null);
|
|
481
|
+
}, t));
|
|
482
|
+
}), u.observe(e, {
|
|
483
|
+
attributes: !0,
|
|
484
|
+
attributeFilter: [D]
|
|
485
|
+
}), () => {
|
|
486
|
+
u?.disconnect(), P.cancel(), o.current === s && (s.abort(), o.current = null);
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
return () => {
|
|
490
|
+
F.cancel(a);
|
|
491
|
+
};
|
|
492
|
+
}, [o, i, P, c, m, C, h, d, N, f, O]), T(() => {
|
|
493
|
+
if (i.current !== "css-animation")
|
|
494
|
+
return;
|
|
495
|
+
const e = d.current;
|
|
496
|
+
e && (l.current = e.style.animationName || l.current, e.style.setProperty("animation-name", "none"), f({
|
|
497
|
+
height: e.scrollHeight,
|
|
498
|
+
width: e.scrollWidth
|
|
499
|
+
}), !x.current && !_.current && e.style.removeProperty("animation-name"), h ? (o.current != null && (o.current.abort(), o.current = null), O(!0), S(!0)) : (o.current = new AbortController(), N(() => {
|
|
500
|
+
O(!1), S(!1), o.current = null;
|
|
501
|
+
}, o.current.signal)));
|
|
502
|
+
}, [o, i, h, d, N, f, O, S, y]), Te(() => {
|
|
503
|
+
const e = F.request(() => {
|
|
504
|
+
x.current = !1;
|
|
505
|
+
});
|
|
506
|
+
return () => F.cancel(e);
|
|
507
|
+
}), T(() => {
|
|
508
|
+
if (!c)
|
|
509
|
+
return;
|
|
510
|
+
const e = d.current;
|
|
511
|
+
if (!e)
|
|
512
|
+
return;
|
|
513
|
+
let a = -1, s = -1;
|
|
514
|
+
return h && _.current && (e.style.transitionDuration = "0s", f({
|
|
515
|
+
height: e.scrollHeight,
|
|
516
|
+
width: e.scrollWidth
|
|
517
|
+
}), a = F.request(() => {
|
|
518
|
+
_.current = !1, s = F.request(() => {
|
|
519
|
+
setTimeout(() => {
|
|
520
|
+
e.style.removeProperty("transition-duration");
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
})), () => {
|
|
524
|
+
F.cancel(a), F.cancel(s);
|
|
525
|
+
};
|
|
526
|
+
}, [c, h, d, f]), T(() => {
|
|
527
|
+
const e = d.current;
|
|
528
|
+
e && c && p && (e.setAttribute("hidden", "until-found"), i.current === "css-transition" && e.setAttribute(W.startingStyle, ""));
|
|
529
|
+
}, [c, p, i, d]), r.useEffect(function() {
|
|
530
|
+
const a = d.current;
|
|
531
|
+
if (!a)
|
|
532
|
+
return;
|
|
533
|
+
function s(t) {
|
|
534
|
+
_.current = !0, E(!0), R(!0, $(le, t));
|
|
535
|
+
}
|
|
536
|
+
return a.addEventListener("beforematch", s), () => {
|
|
537
|
+
a.removeEventListener("beforematch", s);
|
|
538
|
+
};
|
|
539
|
+
}, [R, d, E]), r.useMemo(() => ({
|
|
540
|
+
props: {
|
|
541
|
+
hidden: p,
|
|
542
|
+
id: v,
|
|
543
|
+
ref: g
|
|
544
|
+
}
|
|
545
|
+
}), [p, v, g]);
|
|
546
|
+
}
|
|
547
|
+
let se = /* @__PURE__ */ (function(n) {
|
|
548
|
+
return n.accordionPanelHeight = "--accordion-panel-height", n.accordionPanelWidth = "--accordion-panel-width", n;
|
|
549
|
+
})({});
|
|
550
|
+
const ye = /* @__PURE__ */ r.forwardRef(function(o, i) {
|
|
551
|
+
const {
|
|
552
|
+
className: w,
|
|
553
|
+
hiddenUntilFound: I,
|
|
554
|
+
keepMounted: c,
|
|
555
|
+
id: m,
|
|
556
|
+
render: v,
|
|
557
|
+
...C
|
|
558
|
+
} = o, {
|
|
559
|
+
hiddenUntilFound: R,
|
|
560
|
+
keepMounted: h
|
|
561
|
+
} = Y(), {
|
|
562
|
+
abortControllerRef: d,
|
|
563
|
+
animationTypeRef: N,
|
|
564
|
+
height: f,
|
|
565
|
+
mounted: O,
|
|
566
|
+
onOpenChange: E,
|
|
567
|
+
open: S,
|
|
568
|
+
panelId: A,
|
|
569
|
+
panelRef: y,
|
|
570
|
+
runOnceAnimationsFinish: b,
|
|
571
|
+
setDimensions: _,
|
|
572
|
+
setHiddenUntilFound: l,
|
|
573
|
+
setKeepMounted: x,
|
|
574
|
+
setMounted: M,
|
|
575
|
+
setOpen: P,
|
|
576
|
+
setVisible: p,
|
|
577
|
+
transitionDimensionRef: V,
|
|
578
|
+
visible: g,
|
|
579
|
+
width: e,
|
|
580
|
+
setPanelIdState: a,
|
|
581
|
+
transitionStatus: s
|
|
582
|
+
} = he(), t = I ?? R, u = c ?? h;
|
|
583
|
+
process.env.NODE_ENV !== "production" && T(() => {
|
|
584
|
+
c === !1 && t && K("The `keepMounted={false}` prop on a Accordion.Panel will be ignored when using `contextHiddenUntilFound` on the Panel or the Root since it requires the panel to remain mounted when closed.");
|
|
585
|
+
}, [t, c]), T(() => {
|
|
586
|
+
if (m)
|
|
587
|
+
return a(m), () => {
|
|
588
|
+
a(void 0);
|
|
589
|
+
};
|
|
590
|
+
}, [m, a]), T(() => {
|
|
591
|
+
l(t);
|
|
592
|
+
}, [l, t]), T(() => {
|
|
593
|
+
x(u);
|
|
594
|
+
}, [x, u]), Pe({
|
|
595
|
+
open: S && s === "idle",
|
|
596
|
+
ref: y,
|
|
597
|
+
onComplete() {
|
|
598
|
+
S && _({
|
|
599
|
+
width: void 0,
|
|
600
|
+
height: void 0
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
const {
|
|
605
|
+
props: D
|
|
606
|
+
} = Ye({
|
|
607
|
+
abortControllerRef: d,
|
|
608
|
+
animationTypeRef: N,
|
|
609
|
+
externalRef: i,
|
|
610
|
+
height: f,
|
|
611
|
+
hiddenUntilFound: t,
|
|
612
|
+
id: m ?? A,
|
|
613
|
+
keepMounted: u,
|
|
614
|
+
mounted: O,
|
|
615
|
+
onOpenChange: E,
|
|
616
|
+
open: S,
|
|
617
|
+
panelRef: y,
|
|
618
|
+
runOnceAnimationsFinish: b,
|
|
619
|
+
setDimensions: _,
|
|
620
|
+
setMounted: M,
|
|
621
|
+
setOpen: P,
|
|
622
|
+
setVisible: p,
|
|
623
|
+
transitionDimensionRef: V,
|
|
624
|
+
visible: g,
|
|
625
|
+
width: e
|
|
626
|
+
}), {
|
|
627
|
+
state: H,
|
|
628
|
+
triggerId: ee
|
|
629
|
+
} = X(), q = r.useMemo(() => ({
|
|
630
|
+
...H,
|
|
631
|
+
transitionStatus: s
|
|
632
|
+
}), [H, s]), Re = B("div", o, {
|
|
633
|
+
state: q,
|
|
634
|
+
ref: [i, y],
|
|
635
|
+
props: [D, {
|
|
636
|
+
"aria-labelledby": ee,
|
|
637
|
+
role: "region",
|
|
638
|
+
style: {
|
|
639
|
+
[se.accordionPanelHeight]: f === void 0 ? "auto" : `${f}px`,
|
|
640
|
+
[se.accordionPanelWidth]: e === void 0 ? "auto" : `${e}px`
|
|
641
|
+
}
|
|
642
|
+
}, C],
|
|
643
|
+
stateAttributesMapping: Z
|
|
644
|
+
});
|
|
645
|
+
return u || t || !u && O ? Re : null;
|
|
646
|
+
});
|
|
647
|
+
process.env.NODE_ENV !== "production" && (ye.displayName = "AccordionPanel");
|
|
648
|
+
const Je = "_accordion_6swdg_1", Qe = "_accordion__header_6swdg_5", Xe = "_accordion__trigger_6swdg_9", Ze = "_accordion__panel_6swdg_30", U = {
|
|
649
|
+
accordion: Je,
|
|
650
|
+
accordion__header: Qe,
|
|
651
|
+
"accordion__trigger-icon": "_accordion__trigger-icon_6swdg_9",
|
|
652
|
+
accordion__trigger: Xe,
|
|
653
|
+
accordion__panel: Ze,
|
|
654
|
+
"accordion__panel-content": "_accordion__panel-content_6swdg_42"
|
|
655
|
+
}, vn = me;
|
|
656
|
+
function An({
|
|
657
|
+
header: n,
|
|
658
|
+
content: o,
|
|
659
|
+
className: i,
|
|
660
|
+
...w
|
|
661
|
+
}) {
|
|
662
|
+
return /* @__PURE__ */ ne(ge, { className: U.accordion, ...w, children: [
|
|
663
|
+
/* @__PURE__ */ k(be, { className: U.accordion__header, children: /* @__PURE__ */ k(
|
|
664
|
+
Oe,
|
|
665
|
+
{
|
|
666
|
+
elevated: !0,
|
|
667
|
+
render: /* @__PURE__ */ ne(
|
|
668
|
+
oe,
|
|
669
|
+
{
|
|
670
|
+
interactive: "list-item",
|
|
671
|
+
render: /* @__PURE__ */ k(
|
|
672
|
+
_e,
|
|
673
|
+
{
|
|
674
|
+
className: Ce(U.accordion__trigger, i)
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
children: [
|
|
678
|
+
te(n),
|
|
679
|
+
/* @__PURE__ */ k(
|
|
680
|
+
Ne,
|
|
681
|
+
{
|
|
682
|
+
name: "close-line",
|
|
683
|
+
className: U["accordion__trigger-icon"]
|
|
684
|
+
}
|
|
685
|
+
)
|
|
686
|
+
]
|
|
687
|
+
}
|
|
688
|
+
)
|
|
689
|
+
}
|
|
690
|
+
) }),
|
|
691
|
+
/* @__PURE__ */ k(ye, { className: U.accordion__panel, children: /* @__PURE__ */ k(oe, { className: U["accordion__panel-content"], children: te(o, {
|
|
692
|
+
multiline: !0
|
|
693
|
+
}) }) })
|
|
694
|
+
] });
|
|
695
|
+
}
|
|
696
|
+
export {
|
|
697
|
+
vn as Accordion,
|
|
698
|
+
An as AccordionItem
|
|
699
|
+
};
|