@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,878 @@
|
|
|
1
|
+
import { jsx as E, jsxs as re } from "react/jsx-runtime";
|
|
2
|
+
import { c as rt } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { Button as st } from "../button/index.js";
|
|
4
|
+
import { Heading as ot } from "../heading/index.js";
|
|
5
|
+
import { IconButton as it } from "../icon-button/index.js";
|
|
6
|
+
import { Surface as at } from "../surface/index.js";
|
|
7
|
+
import { Text as ct } from "../text/index.js";
|
|
8
|
+
import { View as xe } from "../view/index.js";
|
|
9
|
+
import { T as ut, a as Re, u as lt } from "../../use-toast-manager-Dq-44AuW.js";
|
|
10
|
+
import * as e from "react";
|
|
11
|
+
import { o as ne } from "../../owner-rKN292Q9.js";
|
|
12
|
+
import { u as U } from "../../useStableCallback-CkTrVkNX.js";
|
|
13
|
+
import { T as Pe } from "../../useTimeout-CflX-kz3.js";
|
|
14
|
+
import { h as de, f as se, m as Ee, e as be } from "../../element-CZEOj04G.js";
|
|
15
|
+
import { F as ft } from "../../FloatingPortalLite-DVyq6YhV.js";
|
|
16
|
+
import { v as dt } from "../../visuallyHidden-CpJ-mhai.js";
|
|
17
|
+
import { F as Te } from "../../FloatingPortal-tWyuKRSN.js";
|
|
18
|
+
import { u as ie } from "../../useRenderElement-DwToLA61.js";
|
|
19
|
+
import { d as Oe } from "../../floating-ui.utils.dom-C7FS5id0.js";
|
|
20
|
+
import * as mt from "react-dom";
|
|
21
|
+
import { i as pt } from "../../inertValue-BCYGsdmf.js";
|
|
22
|
+
import { u as Se } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
|
|
23
|
+
import { f as ht } from "../../formatErrorMessage-BqPuTBN-.js";
|
|
24
|
+
import { a as gt, t as vt } from "../../useOpenChangeComplete-Dse9kY9E.js";
|
|
25
|
+
import { u as _t } from "../../useId-C5kyn6tA.js";
|
|
26
|
+
import { u as wt } from "../../useButton-DfIwsdb8.js";
|
|
27
|
+
import '../../toast.css';let Ce = 0;
|
|
28
|
+
function yt(f) {
|
|
29
|
+
return Ce += 1, `${f}-${Math.random().toString(36).slice(2, 6)}-${Ce}`;
|
|
30
|
+
}
|
|
31
|
+
function De(f, d) {
|
|
32
|
+
if (typeof f == "string")
|
|
33
|
+
return {
|
|
34
|
+
description: f
|
|
35
|
+
};
|
|
36
|
+
if (typeof f == "function") {
|
|
37
|
+
const v = f(d);
|
|
38
|
+
return typeof v == "string" ? {
|
|
39
|
+
description: v
|
|
40
|
+
} : v;
|
|
41
|
+
}
|
|
42
|
+
return f;
|
|
43
|
+
}
|
|
44
|
+
const Ie = function(d) {
|
|
45
|
+
const {
|
|
46
|
+
children: v,
|
|
47
|
+
timeout: s = 5e3,
|
|
48
|
+
limit: z = 3,
|
|
49
|
+
toastManager: P
|
|
50
|
+
} = d, [w, c] = e.useState([]), [_, r] = e.useState(!1), [p, y] = e.useState(!1), [u, R] = e.useState(null);
|
|
51
|
+
w.length === 0 && (_ && r(!1), p && y(!1));
|
|
52
|
+
const S = _ || p, M = e.useRef(/* @__PURE__ */ new Map()), Y = e.useRef(null), C = e.useRef(!0), X = e.useRef(!1);
|
|
53
|
+
function j(t) {
|
|
54
|
+
const m = de(ne(Y.current));
|
|
55
|
+
if (!Y.current || !se(Y.current, m) || !Ee(m))
|
|
56
|
+
return;
|
|
57
|
+
const g = w.findIndex((n) => n.id === t);
|
|
58
|
+
let o = null, h = g + 1;
|
|
59
|
+
for (; h < w.length; ) {
|
|
60
|
+
if (w[h].transitionStatus !== "ending") {
|
|
61
|
+
o = w[h];
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
h += 1;
|
|
65
|
+
}
|
|
66
|
+
if (!o)
|
|
67
|
+
for (h = g - 1; h >= 0; ) {
|
|
68
|
+
if (w[h].transitionStatus !== "ending") {
|
|
69
|
+
o = w[h];
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
h -= 1;
|
|
73
|
+
}
|
|
74
|
+
o ? o.ref?.current?.focus() : u?.focus({
|
|
75
|
+
preventScroll: !0
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const D = U(() => {
|
|
79
|
+
X.current || (X.current = !0, M.current.forEach((t) => {
|
|
80
|
+
if (t.timeout) {
|
|
81
|
+
t.timeout.clear();
|
|
82
|
+
const m = Date.now() - t.start, g = t.delay - m;
|
|
83
|
+
t.remaining = g > 0 ? g : 0;
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
}), F = U(() => {
|
|
87
|
+
X.current && (X.current = !1, M.current.forEach((t, m) => {
|
|
88
|
+
t.remaining = t.remaining > 0 ? t.remaining : t.delay, t.timeout ??= Pe.create(), t.timeout.start(t.remaining, () => {
|
|
89
|
+
M.current.delete(m), t.callback();
|
|
90
|
+
}), t.start = Date.now();
|
|
91
|
+
}));
|
|
92
|
+
}), k = U((t) => {
|
|
93
|
+
c((o) => {
|
|
94
|
+
const h = o.map((l) => l.id === t ? {
|
|
95
|
+
...l,
|
|
96
|
+
transitionStatus: "ending",
|
|
97
|
+
height: 0
|
|
98
|
+
} : l), n = h.filter((l) => l.transitionStatus !== "ending");
|
|
99
|
+
return h.map((l) => {
|
|
100
|
+
if (l.transitionStatus === "ending")
|
|
101
|
+
return l;
|
|
102
|
+
const x = n.indexOf(l) >= z;
|
|
103
|
+
return {
|
|
104
|
+
...l,
|
|
105
|
+
limited: x
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
const m = M.current.get(t);
|
|
110
|
+
m && m.timeout && (m.timeout.clear(), M.current.delete(t)), w.find((o) => o.id === t)?.onClose?.(), j(t), w.length === 1 && (r(!1), y(!1));
|
|
111
|
+
}), q = U((t) => {
|
|
112
|
+
c((g) => g.filter((o) => o.id !== t)), w.find((g) => g.id === t)?.onRemove?.();
|
|
113
|
+
}), V = U((t, m, g) => {
|
|
114
|
+
const o = Date.now(), h = C.current && !_ && !p, n = h ? Pe.create() : void 0;
|
|
115
|
+
n?.start(m, () => {
|
|
116
|
+
M.current.delete(t), g();
|
|
117
|
+
}), M.current.set(t, {
|
|
118
|
+
timeout: n,
|
|
119
|
+
start: h ? o : 0,
|
|
120
|
+
delay: m,
|
|
121
|
+
remaining: m,
|
|
122
|
+
callback: g
|
|
123
|
+
});
|
|
124
|
+
}), G = U((t) => {
|
|
125
|
+
const m = t.id || yt("toast"), g = {
|
|
126
|
+
...t,
|
|
127
|
+
id: m,
|
|
128
|
+
transitionStatus: "starting"
|
|
129
|
+
};
|
|
130
|
+
c((h) => {
|
|
131
|
+
const n = [g, ...h], l = n.filter((x) => x.transitionStatus !== "ending");
|
|
132
|
+
if (l.length > z) {
|
|
133
|
+
const x = l.length - z, T = l.slice(-x);
|
|
134
|
+
return n.map((I) => T.some((Z) => Z.id === I.id) ? {
|
|
135
|
+
...I,
|
|
136
|
+
limited: !0
|
|
137
|
+
} : {
|
|
138
|
+
...I,
|
|
139
|
+
limited: !1
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return n.map((x) => ({
|
|
143
|
+
...x,
|
|
144
|
+
limited: !1
|
|
145
|
+
}));
|
|
146
|
+
});
|
|
147
|
+
const o = g.timeout ?? s;
|
|
148
|
+
return g.type !== "loading" && o > 0 && V(m, o, () => k(m)), (_ || p || !C.current) && D(), m;
|
|
149
|
+
}), K = U((t, m) => {
|
|
150
|
+
c((g) => g.map((o) => o.id === t ? {
|
|
151
|
+
...o,
|
|
152
|
+
...m
|
|
153
|
+
} : o));
|
|
154
|
+
}), O = U((t, m) => {
|
|
155
|
+
const g = De(m.loading), o = G({
|
|
156
|
+
...g,
|
|
157
|
+
type: "loading"
|
|
158
|
+
}), h = t.then((n) => {
|
|
159
|
+
const l = De(m.success, n);
|
|
160
|
+
K(o, {
|
|
161
|
+
...l,
|
|
162
|
+
type: "success"
|
|
163
|
+
});
|
|
164
|
+
const x = l.timeout ?? s;
|
|
165
|
+
return x > 0 && V(o, x, () => k(o)), (_ || p || !C.current) && D(), n;
|
|
166
|
+
}).catch((n) => {
|
|
167
|
+
const l = De(m.error, n);
|
|
168
|
+
K(o, {
|
|
169
|
+
...l,
|
|
170
|
+
type: "error"
|
|
171
|
+
});
|
|
172
|
+
const x = l.timeout ?? s;
|
|
173
|
+
return x > 0 && V(o, x, () => k(o)), (_ || p || !C.current) && D(), Promise.reject(n);
|
|
174
|
+
});
|
|
175
|
+
return {}.hasOwnProperty.call(m, "setPromise") && m.setPromise(h), h;
|
|
176
|
+
});
|
|
177
|
+
e.useEffect(function() {
|
|
178
|
+
return P ? P[" subscribe"](({
|
|
179
|
+
action: g,
|
|
180
|
+
options: o
|
|
181
|
+
}) => {
|
|
182
|
+
const h = o.id;
|
|
183
|
+
g === "promise" && o.promise ? O(o.promise, o) : g === "update" && h ? K(h, o) : g === "close" && h ? k(h) : G(o);
|
|
184
|
+
}) : void 0;
|
|
185
|
+
}, [G, K, V, s, P, O, k]);
|
|
186
|
+
const J = e.useMemo(() => ({
|
|
187
|
+
toasts: w,
|
|
188
|
+
setToasts: c,
|
|
189
|
+
hovering: _,
|
|
190
|
+
setHovering: r,
|
|
191
|
+
focused: p,
|
|
192
|
+
setFocused: y,
|
|
193
|
+
expanded: S,
|
|
194
|
+
add: G,
|
|
195
|
+
close: k,
|
|
196
|
+
remove: q,
|
|
197
|
+
update: K,
|
|
198
|
+
promise: O,
|
|
199
|
+
pauseTimers: D,
|
|
200
|
+
resumeTimers: F,
|
|
201
|
+
prevFocusElement: u,
|
|
202
|
+
setPrevFocusElement: R,
|
|
203
|
+
viewportRef: Y,
|
|
204
|
+
scheduleTimer: V,
|
|
205
|
+
windowFocusedRef: C
|
|
206
|
+
}), [G, k, p, _, S, D, u, O, q, F, V, w, K]);
|
|
207
|
+
return /* @__PURE__ */ E(ut.Provider, {
|
|
208
|
+
value: J,
|
|
209
|
+
children: v
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
process.env.NODE_ENV !== "production" && (Ie.displayName = "ToastProvider");
|
|
213
|
+
const Le = /* @__PURE__ */ e.createContext(void 0);
|
|
214
|
+
process.env.NODE_ENV !== "production" && (Le.displayName = "ToastViewportContext");
|
|
215
|
+
let xt = /* @__PURE__ */ (function(f) {
|
|
216
|
+
return f.frontmostHeight = "--toast-frontmost-height", f;
|
|
217
|
+
})({});
|
|
218
|
+
const He = /* @__PURE__ */ e.forwardRef(function(d, v) {
|
|
219
|
+
const {
|
|
220
|
+
render: s,
|
|
221
|
+
className: z,
|
|
222
|
+
children: P,
|
|
223
|
+
...w
|
|
224
|
+
} = d, {
|
|
225
|
+
toasts: c,
|
|
226
|
+
pauseTimers: _,
|
|
227
|
+
resumeTimers: r,
|
|
228
|
+
setHovering: p,
|
|
229
|
+
setFocused: y,
|
|
230
|
+
viewportRef: u,
|
|
231
|
+
windowFocusedRef: R,
|
|
232
|
+
prevFocusElement: S,
|
|
233
|
+
setPrevFocusElement: M,
|
|
234
|
+
expanded: Y,
|
|
235
|
+
focused: C
|
|
236
|
+
} = Re(), X = e.useRef(!1), j = e.useRef(!1), D = c.length, F = c[0]?.height ?? 0, k = e.useMemo(() => c.some((n) => n.transitionStatus === "ending"), [c]);
|
|
237
|
+
e.useEffect(() => {
|
|
238
|
+
if (!u.current)
|
|
239
|
+
return;
|
|
240
|
+
function n(x) {
|
|
241
|
+
D !== 0 && x.key === "F6" && x.target !== u.current && (x.preventDefault(), M(de(ne(u.current))), u.current?.focus({
|
|
242
|
+
preventScroll: !0
|
|
243
|
+
}), _(), y(!0));
|
|
244
|
+
}
|
|
245
|
+
const l = Oe(u.current);
|
|
246
|
+
return l.addEventListener("keydown", n), () => {
|
|
247
|
+
l.removeEventListener("keydown", n);
|
|
248
|
+
};
|
|
249
|
+
}, [_, y, M, D, u]), e.useEffect(() => {
|
|
250
|
+
if (!u.current || !D)
|
|
251
|
+
return;
|
|
252
|
+
const n = Oe(u.current);
|
|
253
|
+
function l(T) {
|
|
254
|
+
T.target === n && (R.current = !1, _());
|
|
255
|
+
}
|
|
256
|
+
function x(T) {
|
|
257
|
+
if (T.relatedTarget || T.target === n)
|
|
258
|
+
return;
|
|
259
|
+
const I = be(T), Z = de(ne(u.current));
|
|
260
|
+
(!se(u.current, I) || !Ee(Z)) && r(), setTimeout(() => {
|
|
261
|
+
R.current = !0;
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return n.addEventListener("blur", l, !0), n.addEventListener("focus", x, !0), () => {
|
|
265
|
+
n.removeEventListener("blur", l, !0), n.removeEventListener("focus", x, !0);
|
|
266
|
+
};
|
|
267
|
+
}, [
|
|
268
|
+
_,
|
|
269
|
+
r,
|
|
270
|
+
u,
|
|
271
|
+
R,
|
|
272
|
+
y,
|
|
273
|
+
// `viewportRef.current` isn't available on the first render,
|
|
274
|
+
// since the portal node hasn't yet been created.
|
|
275
|
+
// By adding this dependency, we ensure the window listeners
|
|
276
|
+
// are added when toasts have been created, once the ref is available.
|
|
277
|
+
D
|
|
278
|
+
]), e.useEffect(() => {
|
|
279
|
+
const n = u.current;
|
|
280
|
+
if (!n || D === 0)
|
|
281
|
+
return;
|
|
282
|
+
const l = ne(n);
|
|
283
|
+
function x(T) {
|
|
284
|
+
if (T.pointerType !== "touch")
|
|
285
|
+
return;
|
|
286
|
+
const I = be(T);
|
|
287
|
+
se(n, I) || (r(), p(!1), y(!1));
|
|
288
|
+
}
|
|
289
|
+
return l.addEventListener("pointerdown", x, !0), () => {
|
|
290
|
+
l.removeEventListener("pointerdown", x, !0);
|
|
291
|
+
};
|
|
292
|
+
}, [D, r, y, p, u]);
|
|
293
|
+
function q(n) {
|
|
294
|
+
u.current && (X.current = !0, n.relatedTarget === u.current ? c[0]?.ref?.current?.focus() : S?.focus({
|
|
295
|
+
preventScroll: !0
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
function V(n) {
|
|
299
|
+
n.key === "Tab" && n.shiftKey && n.target === u.current && (n.preventDefault(), S?.focus({
|
|
300
|
+
preventScroll: !0
|
|
301
|
+
}), r());
|
|
302
|
+
}
|
|
303
|
+
e.useEffect(() => {
|
|
304
|
+
!R.current || k || !j.current || (r(), p(!1), j.current = !1);
|
|
305
|
+
}, [k, r, p, R]);
|
|
306
|
+
function G() {
|
|
307
|
+
_(), p(!0), j.current = !1;
|
|
308
|
+
}
|
|
309
|
+
function K() {
|
|
310
|
+
c.some((n) => n.transitionStatus === "ending") ? j.current = !0 : (r(), p(!1));
|
|
311
|
+
}
|
|
312
|
+
function O() {
|
|
313
|
+
if (X.current) {
|
|
314
|
+
X.current = !1;
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
C || Ee(ne(u.current).activeElement) && (y(!0), _());
|
|
318
|
+
}
|
|
319
|
+
function J(n) {
|
|
320
|
+
!C || se(u.current, n.relatedTarget) || (y(!1), r());
|
|
321
|
+
}
|
|
322
|
+
const t = {
|
|
323
|
+
tabIndex: -1,
|
|
324
|
+
role: "region",
|
|
325
|
+
"aria-live": "polite",
|
|
326
|
+
"aria-atomic": !1,
|
|
327
|
+
"aria-relevant": "additions text",
|
|
328
|
+
"aria-label": "Notifications",
|
|
329
|
+
onMouseEnter: G,
|
|
330
|
+
onMouseMove: G,
|
|
331
|
+
onMouseLeave: K,
|
|
332
|
+
onFocus: O,
|
|
333
|
+
onBlur: J,
|
|
334
|
+
onKeyDown: V,
|
|
335
|
+
onClick: O
|
|
336
|
+
}, m = e.useMemo(() => ({
|
|
337
|
+
expanded: Y
|
|
338
|
+
}), [Y]), g = ie("div", d, {
|
|
339
|
+
ref: [v, u],
|
|
340
|
+
state: m,
|
|
341
|
+
props: [t, {
|
|
342
|
+
style: {
|
|
343
|
+
[xt.frontmostHeight]: F ? `${F}px` : void 0
|
|
344
|
+
}
|
|
345
|
+
}, w, {
|
|
346
|
+
children: /* @__PURE__ */ re(e.Fragment, {
|
|
347
|
+
children: [D > 0 && S && /* @__PURE__ */ E(Te, {
|
|
348
|
+
onFocus: q
|
|
349
|
+
}), P, D > 0 && S && /* @__PURE__ */ E(Te, {
|
|
350
|
+
onFocus: q
|
|
351
|
+
})]
|
|
352
|
+
})
|
|
353
|
+
}]
|
|
354
|
+
}), o = e.useMemo(() => ({
|
|
355
|
+
viewportRef: u
|
|
356
|
+
}), [u]), h = e.useMemo(() => c.filter((n) => n.priority === "high"), [c]);
|
|
357
|
+
return /* @__PURE__ */ re(Le.Provider, {
|
|
358
|
+
value: o,
|
|
359
|
+
children: [D > 0 && S && /* @__PURE__ */ E(Te, {
|
|
360
|
+
onFocus: q
|
|
361
|
+
}), g, !C && h.length > 0 && /* @__PURE__ */ E("div", {
|
|
362
|
+
style: dt,
|
|
363
|
+
children: h.map((n) => /* @__PURE__ */ re("div", {
|
|
364
|
+
role: "alert",
|
|
365
|
+
"aria-atomic": !0,
|
|
366
|
+
children: [/* @__PURE__ */ E("div", {
|
|
367
|
+
children: n.title
|
|
368
|
+
}), /* @__PURE__ */ E("div", {
|
|
369
|
+
children: n.description
|
|
370
|
+
})]
|
|
371
|
+
}, n.id))
|
|
372
|
+
})]
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
process.env.NODE_ENV !== "production" && (He.displayName = "ToastViewport");
|
|
376
|
+
const Me = /* @__PURE__ */ e.createContext(void 0);
|
|
377
|
+
process.env.NODE_ENV !== "production" && (Me.displayName = "ToastRootContext");
|
|
378
|
+
function me() {
|
|
379
|
+
const f = e.useContext(Me);
|
|
380
|
+
if (!f)
|
|
381
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." : ht(66));
|
|
382
|
+
return f;
|
|
383
|
+
}
|
|
384
|
+
let ee = /* @__PURE__ */ (function(f) {
|
|
385
|
+
return f.index = "--toast-index", f.offsetY = "--toast-offset-y", f.height = "--toast-height", f.swipeMovementX = "--toast-swipe-movement-x", f.swipeMovementY = "--toast-swipe-movement-y", f;
|
|
386
|
+
})({});
|
|
387
|
+
const Tt = {
|
|
388
|
+
...vt,
|
|
389
|
+
swipeDirection(f) {
|
|
390
|
+
return f ? {
|
|
391
|
+
"data-swipe-direction": f
|
|
392
|
+
} : null;
|
|
393
|
+
}
|
|
394
|
+
}, oe = 40, Dt = 10, Q = 0.5, Et = 1;
|
|
395
|
+
function Fe(f, d, v) {
|
|
396
|
+
switch (f) {
|
|
397
|
+
case "up":
|
|
398
|
+
return -v;
|
|
399
|
+
case "down":
|
|
400
|
+
return v;
|
|
401
|
+
case "left":
|
|
402
|
+
return -d;
|
|
403
|
+
case "right":
|
|
404
|
+
return d;
|
|
405
|
+
default:
|
|
406
|
+
return 0;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function bt(f) {
|
|
410
|
+
const v = window.getComputedStyle(f).transform;
|
|
411
|
+
let s = 0, z = 0, P = 1;
|
|
412
|
+
if (v && v !== "none") {
|
|
413
|
+
const w = v.match(/matrix(?:3d)?\(([^)]+)\)/);
|
|
414
|
+
if (w) {
|
|
415
|
+
const c = w[1].split(", ").map(parseFloat);
|
|
416
|
+
c.length === 6 ? (s = c[4], z = c[5], P = Math.sqrt(c[0] * c[0] + c[1] * c[1])) : c.length === 16 && (s = c[12], z = c[13], P = c[0]);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
x: s,
|
|
421
|
+
y: z,
|
|
422
|
+
scale: P
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
const ze = /* @__PURE__ */ e.forwardRef(function(d, v) {
|
|
426
|
+
const {
|
|
427
|
+
toast: s,
|
|
428
|
+
render: z,
|
|
429
|
+
className: P,
|
|
430
|
+
swipeDirection: w = ["down", "right"],
|
|
431
|
+
...c
|
|
432
|
+
} = d, _ = s.positionerProps?.anchor !== void 0;
|
|
433
|
+
let r = [];
|
|
434
|
+
_ || (r = Array.isArray(w) ? w : [w]);
|
|
435
|
+
const p = r.length > 0, {
|
|
436
|
+
toasts: y,
|
|
437
|
+
focused: u,
|
|
438
|
+
close: R,
|
|
439
|
+
remove: S,
|
|
440
|
+
setToasts: M,
|
|
441
|
+
pauseTimers: Y,
|
|
442
|
+
expanded: C,
|
|
443
|
+
setHovering: X
|
|
444
|
+
} = Re(), [j, D] = e.useState(void 0), [F, k] = e.useState(!1), [q, V] = e.useState(!1), [G, K] = e.useState(!1), [O, J] = e.useState({
|
|
445
|
+
x: 0,
|
|
446
|
+
y: 0
|
|
447
|
+
}), [t, m] = e.useState({
|
|
448
|
+
x: 0,
|
|
449
|
+
y: 0,
|
|
450
|
+
scale: 1
|
|
451
|
+
}), [g, o] = e.useState(), [h, n] = e.useState(), [l, x] = e.useState(null), T = e.useRef(null), I = e.useRef({
|
|
452
|
+
x: 0,
|
|
453
|
+
y: 0
|
|
454
|
+
}), Z = e.useRef({
|
|
455
|
+
x: 0,
|
|
456
|
+
y: 0,
|
|
457
|
+
scale: 1
|
|
458
|
+
}), ae = e.useRef(void 0), pe = e.useRef(0), ce = e.useRef(!1), $ = e.useRef({
|
|
459
|
+
x: 0,
|
|
460
|
+
y: 0
|
|
461
|
+
}), he = e.useRef(!1), ge = e.useMemo(() => y.indexOf(s), [s, y]), ve = e.useMemo(() => y.filter((i) => i.transitionStatus !== "ending").indexOf(s), [s, y]), Be = e.useMemo(() => y.slice(0, y.indexOf(s)).reduce((i, a) => i + (a.height || 0), 0), [y, s]);
|
|
462
|
+
gt({
|
|
463
|
+
open: s.transitionStatus !== "ending",
|
|
464
|
+
ref: T,
|
|
465
|
+
onComplete() {
|
|
466
|
+
s.transitionStatus === "ending" && S(s.id);
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
const ue = U((i = !1) => {
|
|
470
|
+
const a = T.current;
|
|
471
|
+
if (!a)
|
|
472
|
+
return;
|
|
473
|
+
const b = a.style.height;
|
|
474
|
+
a.style.height = "auto";
|
|
475
|
+
const N = a.offsetHeight;
|
|
476
|
+
a.style.height = b;
|
|
477
|
+
function A() {
|
|
478
|
+
M((L) => L.map((H) => H.id === s.id ? {
|
|
479
|
+
...H,
|
|
480
|
+
ref: T,
|
|
481
|
+
height: N,
|
|
482
|
+
transitionStatus: void 0
|
|
483
|
+
} : H));
|
|
484
|
+
}
|
|
485
|
+
i ? mt.flushSync(A) : A();
|
|
486
|
+
});
|
|
487
|
+
Se(ue, [ue]);
|
|
488
|
+
function Ye(i, a) {
|
|
489
|
+
let b = i, N = a;
|
|
490
|
+
return !r.includes("left") && !r.includes("right") ? b = i > 0 ? i ** Q : -(Math.abs(i) ** Q) : (!r.includes("right") && i > 0 && (b = i ** Q), !r.includes("left") && i < 0 && (b = -(Math.abs(i) ** Q))), !r.includes("up") && !r.includes("down") ? N = a > 0 ? a ** Q : -(Math.abs(a) ** Q) : (!r.includes("down") && a > 0 && (N = a ** Q), !r.includes("up") && a < 0 && (N = -(Math.abs(a) ** Q))), {
|
|
491
|
+
x: b,
|
|
492
|
+
y: N
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
function Xe(i) {
|
|
496
|
+
if (i.button !== 0)
|
|
497
|
+
return;
|
|
498
|
+
i.pointerType === "touch" && Y();
|
|
499
|
+
const a = be(i.nativeEvent);
|
|
500
|
+
if (!(a && a.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))) {
|
|
501
|
+
if (ce.current = !1, ae.current = void 0, pe.current = 0, I.current = {
|
|
502
|
+
x: i.clientX,
|
|
503
|
+
y: i.clientY
|
|
504
|
+
}, $.current = I.current, T.current) {
|
|
505
|
+
const N = bt(T.current);
|
|
506
|
+
Z.current = N, m(N), J({
|
|
507
|
+
x: N.x,
|
|
508
|
+
y: N.y
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
X(!0), k(!0), V(!1), x(null), he.current = !0, T.current?.setPointerCapture(i.pointerId);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function Ge(i) {
|
|
515
|
+
if (!F)
|
|
516
|
+
return;
|
|
517
|
+
i.preventDefault(), he.current && (I.current = {
|
|
518
|
+
x: i.clientX,
|
|
519
|
+
y: i.clientY
|
|
520
|
+
}, he.current = !1);
|
|
521
|
+
const {
|
|
522
|
+
clientY: a,
|
|
523
|
+
clientX: b,
|
|
524
|
+
movementX: N,
|
|
525
|
+
movementY: A
|
|
526
|
+
} = i;
|
|
527
|
+
(A < 0 && a > $.current.y || A > 0 && a < $.current.y) && ($.current = {
|
|
528
|
+
x: $.current.x,
|
|
529
|
+
y: a
|
|
530
|
+
}), (N < 0 && b > $.current.x || N > 0 && b < $.current.x) && ($.current = {
|
|
531
|
+
x: b,
|
|
532
|
+
y: $.current.y
|
|
533
|
+
});
|
|
534
|
+
const L = b - I.current.x, H = a - I.current.y, Qe = a - $.current.y, Ze = b - $.current.x;
|
|
535
|
+
if (!q && Math.sqrt(L * L + H * H) >= Et && (V(!0), l === null)) {
|
|
536
|
+
const fe = r.includes("left") || r.includes("right"), et = r.includes("up") || r.includes("down");
|
|
537
|
+
if (fe && et) {
|
|
538
|
+
const tt = Math.abs(L), nt = Math.abs(H);
|
|
539
|
+
x(tt > nt ? "horizontal" : "vertical");
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
let B;
|
|
543
|
+
if (!ae.current)
|
|
544
|
+
l === "vertical" ? H > 0 ? B = "down" : H < 0 && (B = "up") : l === "horizontal" ? L > 0 ? B = "right" : L < 0 && (B = "left") : Math.abs(L) >= Math.abs(H) ? B = L > 0 ? "right" : "left" : B = H > 0 ? "down" : "up", B && r.includes(B) && (ae.current = B, pe.current = Fe(B, L, H), D(B));
|
|
545
|
+
else {
|
|
546
|
+
const ye = ae.current, fe = Fe(ye, Ze, Qe);
|
|
547
|
+
fe > oe ? (ce.current = !1, D(ye)) : !(r.includes("left") && r.includes("right")) && !(r.includes("up") && r.includes("down")) && pe.current - fe >= Dt && (ce.current = !0);
|
|
548
|
+
}
|
|
549
|
+
const le = Ye(L, H);
|
|
550
|
+
let _e = Z.current.x, we = Z.current.y;
|
|
551
|
+
l === "horizontal" ? (r.includes("left") || r.includes("right")) && (_e += le.x) : (l === "vertical" || (r.includes("left") || r.includes("right")) && (_e += le.x), (r.includes("up") || r.includes("down")) && (we += le.y)), J({
|
|
552
|
+
x: _e,
|
|
553
|
+
y: we
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
function Ke(i) {
|
|
557
|
+
if (!F)
|
|
558
|
+
return;
|
|
559
|
+
if (k(!1), V(!1), x(null), T.current?.releasePointerCapture(i.pointerId), ce.current) {
|
|
560
|
+
J({
|
|
561
|
+
x: t.x,
|
|
562
|
+
y: t.y
|
|
563
|
+
}), D(void 0);
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
let a = !1;
|
|
567
|
+
const b = O.x - t.x, N = O.y - t.y;
|
|
568
|
+
let A;
|
|
569
|
+
for (const L of r) {
|
|
570
|
+
switch (L) {
|
|
571
|
+
case "right":
|
|
572
|
+
b > oe && (a = !0, A = "right");
|
|
573
|
+
break;
|
|
574
|
+
case "left":
|
|
575
|
+
b < -oe && (a = !0, A = "left");
|
|
576
|
+
break;
|
|
577
|
+
case "down":
|
|
578
|
+
N > oe && (a = !0, A = "down");
|
|
579
|
+
break;
|
|
580
|
+
case "up":
|
|
581
|
+
N < -oe && (a = !0, A = "up");
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
if (a)
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
a ? (D(A), K(!0), R(s.id)) : (J({
|
|
588
|
+
x: t.x,
|
|
589
|
+
y: t.y
|
|
590
|
+
}), D(void 0));
|
|
591
|
+
}
|
|
592
|
+
function We(i) {
|
|
593
|
+
if (i.key === "Escape") {
|
|
594
|
+
if (!T.current || !se(T.current, de(ne(T.current))))
|
|
595
|
+
return;
|
|
596
|
+
R(s.id);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
e.useEffect(() => {
|
|
600
|
+
if (!p)
|
|
601
|
+
return;
|
|
602
|
+
const i = T.current;
|
|
603
|
+
if (!i)
|
|
604
|
+
return;
|
|
605
|
+
function a(b) {
|
|
606
|
+
se(i, b.target) && b.preventDefault();
|
|
607
|
+
}
|
|
608
|
+
return i.addEventListener("touchmove", a, {
|
|
609
|
+
passive: !1
|
|
610
|
+
}), () => {
|
|
611
|
+
i.removeEventListener("touchmove", a);
|
|
612
|
+
};
|
|
613
|
+
}, [p]);
|
|
614
|
+
function je() {
|
|
615
|
+
if (!F && O.x === t.x && O.y === t.y && !G)
|
|
616
|
+
return {
|
|
617
|
+
[ee.swipeMovementX]: "0px",
|
|
618
|
+
[ee.swipeMovementY]: "0px"
|
|
619
|
+
};
|
|
620
|
+
const i = O.x - t.x, a = O.y - t.y;
|
|
621
|
+
return {
|
|
622
|
+
transition: F ? "none" : void 0,
|
|
623
|
+
// While swiping, freeze the element at its current visual transform so it doesn't snap to the
|
|
624
|
+
// end position.
|
|
625
|
+
transform: F ? `translateX(${O.x}px) translateY(${O.y}px) scale(${t.scale})` : void 0,
|
|
626
|
+
[ee.swipeMovementX]: `${i}px`,
|
|
627
|
+
[ee.swipeMovementY]: `${a}px`
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
const Ne = s.priority === "high", Ue = {
|
|
631
|
+
role: Ne ? "alertdialog" : "dialog",
|
|
632
|
+
tabIndex: 0,
|
|
633
|
+
"aria-modal": !1,
|
|
634
|
+
"aria-labelledby": g,
|
|
635
|
+
"aria-describedby": h,
|
|
636
|
+
"aria-hidden": Ne && !u ? !0 : void 0,
|
|
637
|
+
onPointerDown: p ? Xe : void 0,
|
|
638
|
+
onPointerMove: p ? Ge : void 0,
|
|
639
|
+
onPointerUp: p ? Ke : void 0,
|
|
640
|
+
onKeyDown: We,
|
|
641
|
+
inert: pt(s.limited),
|
|
642
|
+
style: {
|
|
643
|
+
...je(),
|
|
644
|
+
[ee.index]: s.transitionStatus === "ending" ? ge : ve,
|
|
645
|
+
[ee.offsetY]: `${Be}px`,
|
|
646
|
+
[ee.height]: s.height ? `${s.height}px` : void 0
|
|
647
|
+
}
|
|
648
|
+
}, te = e.useMemo(() => ({
|
|
649
|
+
rootRef: T,
|
|
650
|
+
toast: s,
|
|
651
|
+
titleId: g,
|
|
652
|
+
setTitleId: o,
|
|
653
|
+
descriptionId: h,
|
|
654
|
+
setDescriptionId: n,
|
|
655
|
+
swiping: F,
|
|
656
|
+
swipeDirection: j,
|
|
657
|
+
recalculateHeight: ue,
|
|
658
|
+
index: ge,
|
|
659
|
+
visibleIndex: ve,
|
|
660
|
+
expanded: C
|
|
661
|
+
}), [s, g, h, F, j, ue, ge, ve, C]), qe = e.useMemo(() => ({
|
|
662
|
+
transitionStatus: s.transitionStatus,
|
|
663
|
+
expanded: C,
|
|
664
|
+
limited: s.limited || !1,
|
|
665
|
+
type: s.type,
|
|
666
|
+
swiping: te.swiping,
|
|
667
|
+
swipeDirection: te.swipeDirection
|
|
668
|
+
}), [C, s.transitionStatus, s.limited, s.type, te.swiping, te.swipeDirection]), Je = ie("div", d, {
|
|
669
|
+
ref: [v, te.rootRef],
|
|
670
|
+
state: qe,
|
|
671
|
+
stateAttributesMapping: Tt,
|
|
672
|
+
props: [Ue, c]
|
|
673
|
+
});
|
|
674
|
+
return /* @__PURE__ */ E(Me.Provider, {
|
|
675
|
+
value: te,
|
|
676
|
+
children: Je
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
process.env.NODE_ENV !== "production" && (ze.displayName = "ToastRoot");
|
|
680
|
+
const Ve = /* @__PURE__ */ e.forwardRef(function(d, v) {
|
|
681
|
+
const {
|
|
682
|
+
render: s,
|
|
683
|
+
className: z,
|
|
684
|
+
...P
|
|
685
|
+
} = d, {
|
|
686
|
+
visibleIndex: w,
|
|
687
|
+
expanded: c,
|
|
688
|
+
recalculateHeight: _
|
|
689
|
+
} = me(), r = e.useRef(null);
|
|
690
|
+
Se(() => {
|
|
691
|
+
const R = r.current;
|
|
692
|
+
if (!R || (_(), typeof ResizeObserver != "function" || typeof MutationObserver != "function"))
|
|
693
|
+
return;
|
|
694
|
+
const S = new ResizeObserver(() => _(!0)), M = new MutationObserver(() => _(!0));
|
|
695
|
+
return S.observe(R), M.observe(R, {
|
|
696
|
+
childList: !0,
|
|
697
|
+
subtree: !0,
|
|
698
|
+
characterData: !0
|
|
699
|
+
}), () => {
|
|
700
|
+
S.disconnect(), M.disconnect();
|
|
701
|
+
};
|
|
702
|
+
}, [_]);
|
|
703
|
+
const p = w > 0, y = e.useMemo(() => ({
|
|
704
|
+
expanded: c,
|
|
705
|
+
behind: p
|
|
706
|
+
}), [c, p]);
|
|
707
|
+
return ie("div", d, {
|
|
708
|
+
ref: [v, r],
|
|
709
|
+
state: y,
|
|
710
|
+
props: P
|
|
711
|
+
});
|
|
712
|
+
});
|
|
713
|
+
process.env.NODE_ENV !== "production" && (Ve.displayName = "ToastContent");
|
|
714
|
+
const $e = /* @__PURE__ */ e.forwardRef(function(d, v) {
|
|
715
|
+
const {
|
|
716
|
+
render: s,
|
|
717
|
+
className: z,
|
|
718
|
+
id: P,
|
|
719
|
+
children: w,
|
|
720
|
+
...c
|
|
721
|
+
} = d, {
|
|
722
|
+
toast: _
|
|
723
|
+
} = me(), r = w ?? _.description, p = !!r, y = _t(P), {
|
|
724
|
+
setDescriptionId: u
|
|
725
|
+
} = me();
|
|
726
|
+
Se(() => {
|
|
727
|
+
if (p)
|
|
728
|
+
return u(y), () => {
|
|
729
|
+
u(void 0);
|
|
730
|
+
};
|
|
731
|
+
}, [p, y, u]);
|
|
732
|
+
const R = e.useMemo(() => ({
|
|
733
|
+
type: _.type
|
|
734
|
+
}), [_.type]), S = ie("p", d, {
|
|
735
|
+
ref: v,
|
|
736
|
+
state: R,
|
|
737
|
+
props: {
|
|
738
|
+
...c,
|
|
739
|
+
id: y,
|
|
740
|
+
children: r
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
return p ? S : null;
|
|
744
|
+
});
|
|
745
|
+
process.env.NODE_ENV !== "production" && ($e.displayName = "ToastDescription");
|
|
746
|
+
const Ae = /* @__PURE__ */ e.forwardRef(function(d, v) {
|
|
747
|
+
const {
|
|
748
|
+
render: s,
|
|
749
|
+
className: z,
|
|
750
|
+
disabled: P,
|
|
751
|
+
nativeButton: w = !0,
|
|
752
|
+
...c
|
|
753
|
+
} = d, {
|
|
754
|
+
close: _,
|
|
755
|
+
expanded: r
|
|
756
|
+
} = Re(), {
|
|
757
|
+
toast: p
|
|
758
|
+
} = me(), [y, u] = e.useState(!1), {
|
|
759
|
+
getButtonProps: R,
|
|
760
|
+
buttonRef: S
|
|
761
|
+
} = wt({
|
|
762
|
+
disabled: P,
|
|
763
|
+
native: w
|
|
764
|
+
}), M = e.useMemo(() => ({
|
|
765
|
+
type: p.type
|
|
766
|
+
}), [p.type]);
|
|
767
|
+
return ie("button", d, {
|
|
768
|
+
ref: [v, S],
|
|
769
|
+
state: M,
|
|
770
|
+
props: [{
|
|
771
|
+
"aria-hidden": !r && !y,
|
|
772
|
+
onClick() {
|
|
773
|
+
_(p.id);
|
|
774
|
+
},
|
|
775
|
+
onFocus() {
|
|
776
|
+
u(!0);
|
|
777
|
+
},
|
|
778
|
+
onBlur() {
|
|
779
|
+
u(!1);
|
|
780
|
+
}
|
|
781
|
+
}, c, R]
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
process.env.NODE_ENV !== "production" && (Ae.displayName = "ToastClose");
|
|
785
|
+
const Rt = ft, St = "_toast__viewport_km0zn_1", Mt = "_toast_km0zn_1", Nt = "_toast_variant_neutral_km0zn_109", Pt = "_toast_variant_colorway_km0zn_115", Ot = "_toast__content_km0zn_121", Ct = "_toast__header_km0zn_139", Ft = "_toast__row_km0zn_144", kt = "_toast__title_km0zn_151", It = "_toast__description_km0zn_155", Lt = "_toast__close_km0zn_159", W = {
|
|
786
|
+
toast__viewport: St,
|
|
787
|
+
toast: Mt,
|
|
788
|
+
toast_variant_neutral: Nt,
|
|
789
|
+
toast_variant_colorway: Pt,
|
|
790
|
+
toast__content: Ot,
|
|
791
|
+
toast__header: Ct,
|
|
792
|
+
toast__row: Ft,
|
|
793
|
+
toast__title: kt,
|
|
794
|
+
toast__description: It,
|
|
795
|
+
toast__close: Lt
|
|
796
|
+
}, un = Ie, ke = {
|
|
797
|
+
info: "blue",
|
|
798
|
+
error: "red",
|
|
799
|
+
warning: "yellow",
|
|
800
|
+
success: "green"
|
|
801
|
+
};
|
|
802
|
+
function ln() {
|
|
803
|
+
return /* @__PURE__ */ E(Rt, { children: /* @__PURE__ */ E(He, { className: W.toast__viewport, children: /* @__PURE__ */ E(Ht, {}) }) });
|
|
804
|
+
}
|
|
805
|
+
function Ht() {
|
|
806
|
+
return lt().toasts.map((d) => {
|
|
807
|
+
const v = d.type && d.type in ke ? ke[d.type] : void 0;
|
|
808
|
+
return /* @__PURE__ */ E(
|
|
809
|
+
ze,
|
|
810
|
+
{
|
|
811
|
+
toast: d,
|
|
812
|
+
className: rt(
|
|
813
|
+
W.toast,
|
|
814
|
+
v ? W.toast_variant_colorway : W.toast_variant_neutral
|
|
815
|
+
),
|
|
816
|
+
render: /* @__PURE__ */ E(at, { background: "default", color: v }),
|
|
817
|
+
children: /* @__PURE__ */ re(
|
|
818
|
+
xe,
|
|
819
|
+
{
|
|
820
|
+
render: /* @__PURE__ */ E(Ve, {}),
|
|
821
|
+
className: W.toast__content,
|
|
822
|
+
children: [
|
|
823
|
+
/* @__PURE__ */ re(xe, { className: W.toast__row, children: [
|
|
824
|
+
/* @__PURE__ */ re(xe, { className: W.toast__header, children: [
|
|
825
|
+
d.title ? /* @__PURE__ */ E(
|
|
826
|
+
ot,
|
|
827
|
+
{
|
|
828
|
+
level: 2,
|
|
829
|
+
size: "lg",
|
|
830
|
+
color: "inherit",
|
|
831
|
+
className: W.toast__title,
|
|
832
|
+
children: d.title
|
|
833
|
+
}
|
|
834
|
+
) : null,
|
|
835
|
+
/* @__PURE__ */ E(
|
|
836
|
+
$e,
|
|
837
|
+
{
|
|
838
|
+
render: /* @__PURE__ */ E(ct, { multiline: !0, color: v ? "inherit" : "dimmer" }),
|
|
839
|
+
className: W.toast__description
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
] }),
|
|
843
|
+
/* @__PURE__ */ E(
|
|
844
|
+
Ae,
|
|
845
|
+
{
|
|
846
|
+
render: /* @__PURE__ */ E(
|
|
847
|
+
it,
|
|
848
|
+
{
|
|
849
|
+
className: d.title ? W.toast__close : void 0,
|
|
850
|
+
interactive: v ? `${v}_no-fill` : "no-fill",
|
|
851
|
+
icon: "close-line",
|
|
852
|
+
size: "sm",
|
|
853
|
+
alt: "Close"
|
|
854
|
+
}
|
|
855
|
+
)
|
|
856
|
+
}
|
|
857
|
+
)
|
|
858
|
+
] }),
|
|
859
|
+
d.action ? /* @__PURE__ */ E(
|
|
860
|
+
st,
|
|
861
|
+
{
|
|
862
|
+
...d.action,
|
|
863
|
+
interactive: v ? `${v}_fill` : !0,
|
|
864
|
+
children: d.action.children
|
|
865
|
+
}
|
|
866
|
+
) : null
|
|
867
|
+
]
|
|
868
|
+
}
|
|
869
|
+
)
|
|
870
|
+
},
|
|
871
|
+
d.id
|
|
872
|
+
);
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
export {
|
|
876
|
+
un as ToastProvider,
|
|
877
|
+
ln as ToastViewport
|
|
878
|
+
};
|