@koide-labs/ui 0.0.15 → 0.1.1
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/dist/-utils.d.ts +2 -2
- package/dist/-utils.js +1 -1
- package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
- package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
- package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
- package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
- package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
- package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
- package/dist/accordion.css +1 -0
- package/dist/alert-dialog.css +1 -0
- package/dist/anchor.css +1 -0
- package/dist/avatar.css +1 -0
- package/dist/badge.css +1 -0
- package/dist/button.css +1 -0
- package/dist/checkbox.css +1 -0
- package/dist/code.css +1 -0
- package/dist/collapse.css +1 -0
- package/dist/command.css +1 -0
- package/dist/components/accordion/accordion.d.ts +19 -0
- package/dist/components/accordion/accordion.js +701 -0
- package/dist/components/accordion/index.d.ts +1 -12
- package/dist/components/accordion/index.js +2 -697
- package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
- package/dist/components/alert-dialog/alert-dialog.js +138 -0
- package/dist/components/alert-dialog/index.d.ts +1 -26
- package/dist/components/alert-dialog/index.js +2 -134
- package/dist/components/anchor/anchor.d.ts +12 -0
- package/dist/components/anchor/anchor.js +21 -0
- package/dist/components/anchor/index.d.ts +1 -8
- package/dist/components/anchor/index.js +2 -19
- package/dist/components/avatar/avatar.d.ts +25 -0
- package/dist/components/avatar/avatar.js +161 -0
- package/dist/components/avatar/index.d.ts +1 -21
- package/dist/components/avatar/index.js +2 -159
- package/dist/components/badge/badge.d.ts +20 -0
- package/dist/components/badge/badge.js +42 -0
- package/dist/components/badge/index.d.ts +1 -16
- package/dist/components/badge/index.js +2 -40
- package/dist/components/button/button.d.ts +27 -0
- package/dist/components/button/button.js +47 -0
- package/dist/components/button/index.d.ts +1 -24
- package/dist/components/button/index.js +2 -45
- package/dist/components/checkbox/checkbox.d.ts +13 -0
- package/dist/components/checkbox/checkbox.js +269 -0
- package/dist/components/checkbox/index.d.ts +1 -9
- package/dist/components/checkbox/index.js +2 -267
- package/dist/components/code/code.d.ts +13 -0
- package/dist/components/code/code.js +1206 -0
- package/dist/components/code/index.d.ts +1 -9
- package/dist/components/code/index.js +2 -1204
- package/dist/components/collapse/collapse.d.ts +14 -0
- package/dist/components/collapse/collapse.js +35 -0
- package/dist/components/collapse/index.d.ts +1 -11
- package/dist/components/collapse/index.js +2 -33
- package/dist/components/command/command.d.ts +36 -0
- package/dist/components/command/command.js +1695 -0
- package/dist/components/command/index.d.ts +1 -15
- package/dist/components/command/index.js +2 -1693
- package/dist/components/context-menu/context-menu.d.ts +82 -0
- package/dist/components/context-menu/context-menu.js +1445 -0
- package/dist/components/context-menu/index.d.ts +1 -42
- package/dist/components/context-menu/index.js +2 -1442
- package/dist/components/dialog/dialog.d.ts +22 -0
- package/dist/components/dialog/dialog.js +140 -0
- package/dist/components/dialog/dialog.types.d.ts +38 -0
- package/dist/components/dialog/index.d.ts +1 -48
- package/dist/components/dialog/index.js +2 -136
- package/dist/components/heading/heading.d.ts +25 -0
- package/dist/components/heading/heading.js +36 -0
- package/dist/components/heading/index.d.ts +1 -44
- package/dist/components/heading/index.js +2 -49
- package/dist/components/icon/icon.d.ts +28 -0
- package/dist/components/icon/icon.js +43 -0
- package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
- package/dist/components/icon/icon.types.js +1 -0
- package/dist/components/icon/index.d.ts +2 -24
- package/dist/components/icon/index.js +2 -41
- package/dist/components/icon-button/icon-button.d.ts +16 -0
- package/dist/components/icon-button/icon-button.js +46 -0
- package/dist/components/icon-button/index.d.ts +1 -12
- package/dist/components/icon-button/index.js +2 -44
- package/dist/components/inline-code/index.d.ts +1 -6
- package/dist/components/inline-code/index.js +2 -20
- package/dist/components/inline-code/inline-code.d.ts +10 -0
- package/dist/components/inline-code/inline-code.js +25 -0
- package/dist/components/input/index.d.ts +1 -3
- package/dist/components/input/index.js +2 -117
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +126 -0
- package/dist/components/meter/index.d.ts +1 -18
- package/dist/components/meter/index.js +2 -163
- package/dist/components/meter/meter.d.ts +22 -0
- package/dist/components/meter/meter.js +165 -0
- package/dist/components/multiline-input/index.d.ts +1 -6
- package/dist/components/multiline-input/index.js +2 -98
- package/dist/components/multiline-input/multiline-input.d.ts +10 -0
- package/dist/components/multiline-input/multiline-input.js +100 -0
- package/dist/components/number-input/index.d.ts +1 -10
- package/dist/components/number-input/index.js +2 -1167
- package/dist/components/number-input/number-input.d.ts +14 -0
- package/dist/components/number-input/number-input.js +1169 -0
- package/dist/components/password-input/index.d.ts +1 -2
- package/dist/components/password-input/index.js +2 -27
- package/dist/components/password-input/password-input.d.ts +7 -0
- package/dist/components/password-input/password-input.js +29 -0
- package/dist/components/pill/index.d.ts +1 -13
- package/dist/components/pill/index.js +2 -36
- package/dist/components/pill/pill.d.ts +17 -0
- package/dist/components/pill/pill.js +38 -0
- package/dist/components/popover/index.d.ts +1 -21
- package/dist/components/popover/index.js +2 -634
- package/dist/components/popover/popover.d.ts +22 -0
- package/dist/components/popover/popover.js +634 -0
- package/dist/components/preview-card/index.d.ts +1 -17
- package/dist/components/preview-card/index.js +2 -400
- package/dist/components/preview-card/preview-card.d.ts +21 -0
- package/dist/components/preview-card/preview-card.js +402 -0
- package/dist/components/radio-group/index.d.ts +1 -0
- package/dist/components/radio-group/index.js +5 -0
- package/dist/components/radio-group/radio-group.d.ts +25 -0
- package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
- package/dist/components/search-bar/index.d.ts +1 -12
- package/dist/components/search-bar/index.js +2 -46
- package/dist/components/search-bar/search-bar.d.ts +16 -0
- package/dist/components/search-bar/search-bar.js +43 -0
- package/dist/components/select/index.d.ts +1 -16
- package/dist/components/select/index.js +2 -1261
- package/dist/components/select/select.d.ts +22 -0
- package/dist/components/select/select.js +1263 -0
- package/dist/components/separator/index.d.ts +1 -7
- package/dist/components/separator/index.js +2 -4
- package/dist/components/separator/separator.d.ts +10 -0
- package/dist/components/separator/separator.js +6 -0
- package/dist/components/slider/index.d.ts +1 -5
- package/dist/components/slider/index.js +2 -900
- package/dist/components/slider/slider.d.ts +10 -0
- package/dist/components/slider/slider.js +899 -0
- package/dist/components/spinner/index.d.ts +1 -2
- package/dist/components/spinner/index.js +2 -11
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +13 -0
- package/dist/components/stacked-avatars/index.d.ts +1 -14
- package/dist/components/stacked-avatars/index.js +2 -90
- package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
- package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
- package/dist/components/status-banner/index.d.ts +1 -17
- package/dist/components/status-banner/index.js +2 -69
- package/dist/components/status-banner/status-banner.d.ts +22 -0
- package/dist/components/status-banner/status-banner.js +71 -0
- package/dist/components/surface/index.d.ts +2 -27
- package/dist/components/surface/index.js +2 -39
- package/dist/components/surface/surface.d.ts +26 -0
- package/dist/components/surface/surface.js +36 -0
- package/dist/components/surface/surface.types.d.ts +1 -0
- package/dist/components/surface/surface.types.js +1 -0
- package/dist/components/switch/index.d.ts +1 -5
- package/dist/components/switch/index.js +2 -194
- package/dist/components/switch/switch.d.ts +10 -0
- package/dist/components/switch/switch.js +193 -0
- package/dist/components/tabs/index.d.ts +1 -18
- package/dist/components/tabs/index.js +2 -507
- package/dist/components/tabs/tabs.d.ts +28 -0
- package/dist/components/tabs/tabs.js +511 -0
- package/dist/components/text/index.d.ts +1 -26
- package/dist/components/text/index.js +2 -46
- package/dist/components/text/text.d.ts +29 -0
- package/dist/components/text/text.js +48 -0
- package/dist/components/theme-provider/index.d.ts +1 -1
- package/dist/components/theme-provider/theme-provider.d.ts +8 -4
- package/dist/components/theme-provider/theme-provider.js +3 -3
- package/dist/components/timestamp/index.d.ts +1 -23
- package/dist/components/timestamp/index.js +2 -1390
- package/dist/components/timestamp/timestamp.d.ts +26 -0
- package/dist/components/timestamp/timestamp.js +1391 -0
- package/dist/components/toaster/index.d.ts +2 -0
- package/dist/components/toaster/index.js +7 -0
- package/dist/components/toaster/toaster.d.ts +7 -0
- package/dist/components/toaster/toaster.js +923 -0
- package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
- package/dist/components/tooltip/index.d.ts +1 -14
- package/dist/components/tooltip/index.js +2 -710
- package/dist/components/tooltip/tooltip.d.ts +24 -0
- package/dist/components/tooltip/tooltip.js +9 -0
- package/dist/components/view/index.d.ts +2 -30
- package/dist/components/view/index.js +2 -79
- package/dist/components/view/view.d.ts +31 -0
- package/dist/components/view/view.js +83 -0
- package/dist/components/view/view.types.d.ts +5 -0
- package/dist/components/view/view.types.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +5 -1
- package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
- package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
- package/dist/context-menu.css +1 -0
- package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
- package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
- package/dist/dialog.css +1 -1
- package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
- package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
- package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
- package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
- package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
- package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
- package/dist/heading.css +1 -0
- package/dist/icon-button.css +1 -0
- package/dist/icon.css +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +86 -104
- package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
- package/dist/inline-code.css +1 -0
- package/dist/input.css +1 -1
- package/dist/input.module-CtE19OH8.js +8 -0
- package/dist/integrations/react-markdown/index.js +12 -12
- package/dist/meter.css +1 -0
- package/dist/number-input.css +1 -0
- package/dist/password-input.css +1 -0
- package/dist/pill.css +1 -0
- package/dist/popover.css +1 -0
- package/dist/preview-card.css +1 -0
- package/dist/radio-group.css +1 -0
- package/dist/safePolygon-DnkzOIur.js +558 -0
- package/dist/search-bar.css +1 -0
- package/dist/select.css +1 -0
- package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
- package/dist/separator.css +1 -0
- package/dist/slider.css +1 -0
- package/dist/spinner.css +1 -0
- package/dist/stacked-avatars.css +1 -0
- package/dist/status-banner.css +1 -0
- package/dist/styles/core.css +1 -1
- package/dist/surface.css +1 -0
- package/dist/switch.css +1 -0
- package/dist/tabs.css +1 -0
- package/dist/text.css +1 -0
- package/dist/timestamp.css +1 -0
- package/dist/toaster.css +1 -0
- package/dist/tooltip-oCp-elli.js +765 -0
- package/dist/tooltip.css +1 -0
- package/dist/transitions.css +1 -1
- package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
- package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
- package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
- package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
- package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
- package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
- package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
- package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
- package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
- package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
- package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
- package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
- package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
- package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
- package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
- package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
- package/dist/view.css +1 -1
- package/dist/view.module-Dj7wj0kk.js +6 -0
- package/dist/view2.css +1 -0
- package/package.json +1 -1
- package/dist/components/radio/index.d.ts +0 -13
- package/dist/components/toast/index.d.ts +0 -2
- package/dist/components/toast/index.js +0 -8
- package/dist/components/toast/toast.d.ts +0 -2
- package/dist/components/toast/toast.js +0 -921
- package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
- package/dist/components/tooltip/tooltip-arrow.js +0 -6
- package/dist/index10.css +0 -1
- package/dist/index11.css +0 -1
- package/dist/index12.css +0 -1
- package/dist/index13.css +0 -1
- package/dist/index14.css +0 -1
- package/dist/index15.css +0 -1
- package/dist/index16.css +0 -1
- package/dist/index17.css +0 -1
- package/dist/index18.css +0 -1
- package/dist/index19.css +0 -1
- package/dist/index20.css +0 -1
- package/dist/index21.css +0 -1
- package/dist/index22.css +0 -1
- package/dist/index23.css +0 -1
- package/dist/index24.css +0 -1
- package/dist/index25.css +0 -1
- package/dist/index26.css +0 -1
- package/dist/index27.css +0 -1
- package/dist/index28.css +0 -1
- package/dist/index29.css +0 -1
- package/dist/index3.css +0 -1
- package/dist/index30.css +0 -1
- package/dist/index31.css +0 -1
- package/dist/index32.css +0 -1
- package/dist/index33.css +0 -1
- package/dist/index34.css +0 -1
- package/dist/index35.css +0 -1
- package/dist/index36.css +0 -1
- package/dist/index37.css +0 -1
- package/dist/index4.css +0 -1
- package/dist/index5.css +0 -1
- package/dist/index6.css +0 -1
- package/dist/index7.css +0 -1
- package/dist/index8.css +0 -1
- package/dist/index9.css +0 -1
- package/dist/input.module-DDQY_Ij6.js +0 -7
- package/dist/safePolygon-DWy1dGKJ.js +0 -308
- package/dist/toast.css +0 -1
- package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
- package/dist/tooltip-arrow.css +0 -1
- package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
- package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
- package/dist/view.module-DfDLgJE0.js +0 -6
- /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
- /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
|
@@ -1,921 +0,0 @@
|
|
|
1
|
-
import { jsx as E, jsxs as ae } from "react/jsx-runtime";
|
|
2
|
-
import { c as Ne } from "../../clsx-OuTLNxxd.js";
|
|
3
|
-
import { Button as it } from "../button/index.js";
|
|
4
|
-
import { Heading as at } from "../heading/index.js";
|
|
5
|
-
import { IconButton as ct } from "../icon-button/index.js";
|
|
6
|
-
import { Surface as ut } from "../surface/index.js";
|
|
7
|
-
import { Text as lt } from "../text/index.js";
|
|
8
|
-
import { View as Pe } from "../view/index.js";
|
|
9
|
-
import { T as ft, a as be, u as dt } 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 W } from "../../useStableCallback-CkTrVkNX.js";
|
|
13
|
-
import { T as Oe } from "../../useTimeout-CflX-kz3.js";
|
|
14
|
-
import { h as pe, f as re, m as Ee, e as Re } from "../../element-CZEOj04G.js";
|
|
15
|
-
import { F as pt } from "../../FloatingPortalLite-DVyq6YhV.js";
|
|
16
|
-
import { v as mt } from "../../visuallyHidden-CpJ-mhai.js";
|
|
17
|
-
import { F as Te } from "../../FloatingPortal-tWyuKRSN.js";
|
|
18
|
-
import { u as oe } from "../../useRenderElement-DwToLA61.js";
|
|
19
|
-
import { d as Ce } from "../../floating-ui.utils.dom-C7FS5id0.js";
|
|
20
|
-
import * as ht from "react-dom";
|
|
21
|
-
import { i as gt } from "../../inertValue-BCYGsdmf.js";
|
|
22
|
-
import { u as me } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
|
|
23
|
-
import { f as _t } from "../../formatErrorMessage-BqPuTBN-.js";
|
|
24
|
-
import { a as vt, t as wt } from "../../useOpenChangeComplete-Dse9kY9E.js";
|
|
25
|
-
import { u as Le } from "../../useId-C5kyn6tA.js";
|
|
26
|
-
import { u as yt } from "../../useButton-DfIwsdb8.js";
|
|
27
|
-
import '../../toast.css';let Fe = 0;
|
|
28
|
-
function xt(f) {
|
|
29
|
-
return Fe += 1, `${f}-${Math.random().toString(36).slice(2, 6)}-${Fe}`;
|
|
30
|
-
}
|
|
31
|
-
function De(f, d) {
|
|
32
|
-
if (typeof f == "string")
|
|
33
|
-
return {
|
|
34
|
-
description: f
|
|
35
|
-
};
|
|
36
|
-
if (typeof f == "function") {
|
|
37
|
-
const h = f(d);
|
|
38
|
-
return typeof h == "string" ? {
|
|
39
|
-
description: h
|
|
40
|
-
} : h;
|
|
41
|
-
}
|
|
42
|
-
return f;
|
|
43
|
-
}
|
|
44
|
-
const He = function(d) {
|
|
45
|
-
const {
|
|
46
|
-
children: h,
|
|
47
|
-
timeout: s = 5e3,
|
|
48
|
-
limit: F = 3,
|
|
49
|
-
toastManager: M
|
|
50
|
-
} = d, [y, a] = e.useState([]), [g, t] = e.useState(!1), [l, v] = e.useState(!1), [o, R] = e.useState(null);
|
|
51
|
-
y.length === 0 && (g && t(!1), l && v(!1));
|
|
52
|
-
const b = g || l, N = e.useRef(/* @__PURE__ */ new Map()), A = e.useRef(null), C = e.useRef(!0), Y = e.useRef(!1);
|
|
53
|
-
function K(n) {
|
|
54
|
-
const m = pe(ne(A.current));
|
|
55
|
-
if (!A.current || !re(A.current, m) || !Ee(m))
|
|
56
|
-
return;
|
|
57
|
-
const w = y.findIndex((r) => r.id === n);
|
|
58
|
-
let i = null, _ = w + 1;
|
|
59
|
-
for (; _ < y.length; ) {
|
|
60
|
-
if (y[_].transitionStatus !== "ending") {
|
|
61
|
-
i = y[_];
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
_ += 1;
|
|
65
|
-
}
|
|
66
|
-
if (!i)
|
|
67
|
-
for (_ = w - 1; _ >= 0; ) {
|
|
68
|
-
if (y[_].transitionStatus !== "ending") {
|
|
69
|
-
i = y[_];
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
_ -= 1;
|
|
73
|
-
}
|
|
74
|
-
i ? i.ref?.current?.focus() : o?.focus({
|
|
75
|
-
preventScroll: !0
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
const D = W(() => {
|
|
79
|
-
Y.current || (Y.current = !0, N.current.forEach((n) => {
|
|
80
|
-
if (n.timeout) {
|
|
81
|
-
n.timeout.clear();
|
|
82
|
-
const m = Date.now() - n.start, w = n.delay - m;
|
|
83
|
-
n.remaining = w > 0 ? w : 0;
|
|
84
|
-
}
|
|
85
|
-
}));
|
|
86
|
-
}), k = W(() => {
|
|
87
|
-
Y.current && (Y.current = !1, N.current.forEach((n, m) => {
|
|
88
|
-
n.remaining = n.remaining > 0 ? n.remaining : n.delay, n.timeout ??= Oe.create(), n.timeout.start(n.remaining, () => {
|
|
89
|
-
N.current.delete(m), n.callback();
|
|
90
|
-
}), n.start = Date.now();
|
|
91
|
-
}));
|
|
92
|
-
}), I = W((n) => {
|
|
93
|
-
a((i) => {
|
|
94
|
-
const _ = i.map((p) => p.id === n ? {
|
|
95
|
-
...p,
|
|
96
|
-
transitionStatus: "ending",
|
|
97
|
-
height: 0
|
|
98
|
-
} : p), r = _.filter((p) => p.transitionStatus !== "ending");
|
|
99
|
-
return _.map((p) => {
|
|
100
|
-
if (p.transitionStatus === "ending")
|
|
101
|
-
return p;
|
|
102
|
-
const x = r.indexOf(p) >= F;
|
|
103
|
-
return {
|
|
104
|
-
...p,
|
|
105
|
-
limited: x
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
const m = N.current.get(n);
|
|
110
|
-
m && m.timeout && (m.timeout.clear(), N.current.delete(n)), y.find((i) => i.id === n)?.onClose?.(), K(n), y.length === 1 && (t(!1), v(!1));
|
|
111
|
-
}), U = W((n) => {
|
|
112
|
-
a((w) => w.filter((i) => i.id !== n)), y.find((w) => w.id === n)?.onRemove?.();
|
|
113
|
-
}), $ = W((n, m, w) => {
|
|
114
|
-
const i = Date.now(), _ = C.current && !g && !l, r = _ ? Oe.create() : void 0;
|
|
115
|
-
r?.start(m, () => {
|
|
116
|
-
N.current.delete(n), w();
|
|
117
|
-
}), N.current.set(n, {
|
|
118
|
-
timeout: r,
|
|
119
|
-
start: _ ? i : 0,
|
|
120
|
-
delay: m,
|
|
121
|
-
remaining: m,
|
|
122
|
-
callback: w
|
|
123
|
-
});
|
|
124
|
-
}), z = W((n) => {
|
|
125
|
-
const m = n.id || xt("toast"), w = {
|
|
126
|
-
...n,
|
|
127
|
-
id: m,
|
|
128
|
-
transitionStatus: "starting"
|
|
129
|
-
};
|
|
130
|
-
a((_) => {
|
|
131
|
-
const r = [w, ..._], p = r.filter((x) => x.transitionStatus !== "ending");
|
|
132
|
-
if (p.length > F) {
|
|
133
|
-
const x = p.length - F, T = p.slice(-x);
|
|
134
|
-
return r.map((L) => T.some((Z) => Z.id === L.id) ? {
|
|
135
|
-
...L,
|
|
136
|
-
limited: !0
|
|
137
|
-
} : {
|
|
138
|
-
...L,
|
|
139
|
-
limited: !1
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return r.map((x) => ({
|
|
143
|
-
...x,
|
|
144
|
-
limited: !1
|
|
145
|
-
}));
|
|
146
|
-
});
|
|
147
|
-
const i = w.timeout ?? s;
|
|
148
|
-
return w.type !== "loading" && i > 0 && $(m, i, () => I(m)), (g || l || !C.current) && D(), m;
|
|
149
|
-
}), X = W((n, m) => {
|
|
150
|
-
a((w) => w.map((i) => i.id === n ? {
|
|
151
|
-
...i,
|
|
152
|
-
...m
|
|
153
|
-
} : i));
|
|
154
|
-
}), O = W((n, m) => {
|
|
155
|
-
const w = De(m.loading), i = z({
|
|
156
|
-
...w,
|
|
157
|
-
type: "loading"
|
|
158
|
-
}), _ = n.then((r) => {
|
|
159
|
-
const p = De(m.success, r);
|
|
160
|
-
X(i, {
|
|
161
|
-
...p,
|
|
162
|
-
type: "success"
|
|
163
|
-
});
|
|
164
|
-
const x = p.timeout ?? s;
|
|
165
|
-
return x > 0 && $(i, x, () => I(i)), (g || l || !C.current) && D(), r;
|
|
166
|
-
}).catch((r) => {
|
|
167
|
-
const p = De(m.error, r);
|
|
168
|
-
X(i, {
|
|
169
|
-
...p,
|
|
170
|
-
type: "error"
|
|
171
|
-
});
|
|
172
|
-
const x = p.timeout ?? s;
|
|
173
|
-
return x > 0 && $(i, x, () => I(i)), (g || l || !C.current) && D(), Promise.reject(r);
|
|
174
|
-
});
|
|
175
|
-
return {}.hasOwnProperty.call(m, "setPromise") && m.setPromise(_), _;
|
|
176
|
-
});
|
|
177
|
-
e.useEffect(function() {
|
|
178
|
-
return M ? M[" subscribe"](({
|
|
179
|
-
action: w,
|
|
180
|
-
options: i
|
|
181
|
-
}) => {
|
|
182
|
-
const _ = i.id;
|
|
183
|
-
w === "promise" && i.promise ? O(i.promise, i) : w === "update" && _ ? X(_, i) : w === "close" && _ ? I(_) : z(i);
|
|
184
|
-
}) : void 0;
|
|
185
|
-
}, [z, X, $, s, M, O, I]);
|
|
186
|
-
const J = e.useMemo(() => ({
|
|
187
|
-
toasts: y,
|
|
188
|
-
setToasts: a,
|
|
189
|
-
hovering: g,
|
|
190
|
-
setHovering: t,
|
|
191
|
-
focused: l,
|
|
192
|
-
setFocused: v,
|
|
193
|
-
expanded: b,
|
|
194
|
-
add: z,
|
|
195
|
-
close: I,
|
|
196
|
-
remove: U,
|
|
197
|
-
update: X,
|
|
198
|
-
promise: O,
|
|
199
|
-
pauseTimers: D,
|
|
200
|
-
resumeTimers: k,
|
|
201
|
-
prevFocusElement: o,
|
|
202
|
-
setPrevFocusElement: R,
|
|
203
|
-
viewportRef: A,
|
|
204
|
-
scheduleTimer: $,
|
|
205
|
-
windowFocusedRef: C
|
|
206
|
-
}), [z, I, l, g, b, D, o, O, U, k, $, y, X]);
|
|
207
|
-
return /* @__PURE__ */ E(ft.Provider, {
|
|
208
|
-
value: J,
|
|
209
|
-
children: h
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
process.env.NODE_ENV !== "production" && (He.displayName = "ToastProvider");
|
|
213
|
-
const Ve = /* @__PURE__ */ e.createContext(void 0);
|
|
214
|
-
process.env.NODE_ENV !== "production" && (Ve.displayName = "ToastViewportContext");
|
|
215
|
-
let Tt = /* @__PURE__ */ (function(f) {
|
|
216
|
-
return f.frontmostHeight = "--toast-frontmost-height", f;
|
|
217
|
-
})({});
|
|
218
|
-
const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
219
|
-
const {
|
|
220
|
-
render: s,
|
|
221
|
-
className: F,
|
|
222
|
-
children: M,
|
|
223
|
-
...y
|
|
224
|
-
} = d, {
|
|
225
|
-
toasts: a,
|
|
226
|
-
pauseTimers: g,
|
|
227
|
-
resumeTimers: t,
|
|
228
|
-
setHovering: l,
|
|
229
|
-
setFocused: v,
|
|
230
|
-
viewportRef: o,
|
|
231
|
-
windowFocusedRef: R,
|
|
232
|
-
prevFocusElement: b,
|
|
233
|
-
setPrevFocusElement: N,
|
|
234
|
-
expanded: A,
|
|
235
|
-
focused: C
|
|
236
|
-
} = be(), Y = e.useRef(!1), K = e.useRef(!1), D = a.length, k = a[0]?.height ?? 0, I = e.useMemo(() => a.some((r) => r.transitionStatus === "ending"), [a]);
|
|
237
|
-
e.useEffect(() => {
|
|
238
|
-
if (!o.current)
|
|
239
|
-
return;
|
|
240
|
-
function r(x) {
|
|
241
|
-
D !== 0 && x.key === "F6" && x.target !== o.current && (x.preventDefault(), N(pe(ne(o.current))), o.current?.focus({
|
|
242
|
-
preventScroll: !0
|
|
243
|
-
}), g(), v(!0));
|
|
244
|
-
}
|
|
245
|
-
const p = Ce(o.current);
|
|
246
|
-
return p.addEventListener("keydown", r), () => {
|
|
247
|
-
p.removeEventListener("keydown", r);
|
|
248
|
-
};
|
|
249
|
-
}, [g, v, N, D, o]), e.useEffect(() => {
|
|
250
|
-
if (!o.current || !D)
|
|
251
|
-
return;
|
|
252
|
-
const r = Ce(o.current);
|
|
253
|
-
function p(T) {
|
|
254
|
-
T.target === r && (R.current = !1, g());
|
|
255
|
-
}
|
|
256
|
-
function x(T) {
|
|
257
|
-
if (T.relatedTarget || T.target === r)
|
|
258
|
-
return;
|
|
259
|
-
const L = Re(T), Z = pe(ne(o.current));
|
|
260
|
-
(!re(o.current, L) || !Ee(Z)) && t(), setTimeout(() => {
|
|
261
|
-
R.current = !0;
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
return r.addEventListener("blur", p, !0), r.addEventListener("focus", x, !0), () => {
|
|
265
|
-
r.removeEventListener("blur", p, !0), r.removeEventListener("focus", x, !0);
|
|
266
|
-
};
|
|
267
|
-
}, [
|
|
268
|
-
g,
|
|
269
|
-
t,
|
|
270
|
-
o,
|
|
271
|
-
R,
|
|
272
|
-
v,
|
|
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 r = o.current;
|
|
280
|
-
if (!r || D === 0)
|
|
281
|
-
return;
|
|
282
|
-
const p = ne(r);
|
|
283
|
-
function x(T) {
|
|
284
|
-
if (T.pointerType !== "touch")
|
|
285
|
-
return;
|
|
286
|
-
const L = Re(T);
|
|
287
|
-
re(r, L) || (t(), l(!1), v(!1));
|
|
288
|
-
}
|
|
289
|
-
return p.addEventListener("pointerdown", x, !0), () => {
|
|
290
|
-
p.removeEventListener("pointerdown", x, !0);
|
|
291
|
-
};
|
|
292
|
-
}, [D, t, v, l, o]);
|
|
293
|
-
function U(r) {
|
|
294
|
-
o.current && (Y.current = !0, r.relatedTarget === o.current ? a[0]?.ref?.current?.focus() : b?.focus({
|
|
295
|
-
preventScroll: !0
|
|
296
|
-
}));
|
|
297
|
-
}
|
|
298
|
-
function $(r) {
|
|
299
|
-
r.key === "Tab" && r.shiftKey && r.target === o.current && (r.preventDefault(), b?.focus({
|
|
300
|
-
preventScroll: !0
|
|
301
|
-
}), t());
|
|
302
|
-
}
|
|
303
|
-
e.useEffect(() => {
|
|
304
|
-
!R.current || I || !K.current || (t(), l(!1), K.current = !1);
|
|
305
|
-
}, [I, t, l, R]);
|
|
306
|
-
function z() {
|
|
307
|
-
g(), l(!0), K.current = !1;
|
|
308
|
-
}
|
|
309
|
-
function X() {
|
|
310
|
-
a.some((r) => r.transitionStatus === "ending") ? K.current = !0 : (t(), l(!1));
|
|
311
|
-
}
|
|
312
|
-
function O() {
|
|
313
|
-
if (Y.current) {
|
|
314
|
-
Y.current = !1;
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
C || Ee(ne(o.current).activeElement) && (v(!0), g());
|
|
318
|
-
}
|
|
319
|
-
function J(r) {
|
|
320
|
-
!C || re(o.current, r.relatedTarget) || (v(!1), t());
|
|
321
|
-
}
|
|
322
|
-
const n = {
|
|
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: z,
|
|
330
|
-
onMouseMove: z,
|
|
331
|
-
onMouseLeave: X,
|
|
332
|
-
onFocus: O,
|
|
333
|
-
onBlur: J,
|
|
334
|
-
onKeyDown: $,
|
|
335
|
-
onClick: O
|
|
336
|
-
}, m = e.useMemo(() => ({
|
|
337
|
-
expanded: A
|
|
338
|
-
}), [A]), w = oe("div", d, {
|
|
339
|
-
ref: [h, o],
|
|
340
|
-
state: m,
|
|
341
|
-
props: [n, {
|
|
342
|
-
style: {
|
|
343
|
-
[Tt.frontmostHeight]: k ? `${k}px` : void 0
|
|
344
|
-
}
|
|
345
|
-
}, y, {
|
|
346
|
-
children: /* @__PURE__ */ ae(e.Fragment, {
|
|
347
|
-
children: [D > 0 && b && /* @__PURE__ */ E(Te, {
|
|
348
|
-
onFocus: U
|
|
349
|
-
}), M, D > 0 && b && /* @__PURE__ */ E(Te, {
|
|
350
|
-
onFocus: U
|
|
351
|
-
})]
|
|
352
|
-
})
|
|
353
|
-
}]
|
|
354
|
-
}), i = e.useMemo(() => ({
|
|
355
|
-
viewportRef: o
|
|
356
|
-
}), [o]), _ = e.useMemo(() => a.filter((r) => r.priority === "high"), [a]);
|
|
357
|
-
return /* @__PURE__ */ ae(Ve.Provider, {
|
|
358
|
-
value: i,
|
|
359
|
-
children: [D > 0 && b && /* @__PURE__ */ E(Te, {
|
|
360
|
-
onFocus: U
|
|
361
|
-
}), w, !C && _.length > 0 && /* @__PURE__ */ E("div", {
|
|
362
|
-
style: mt,
|
|
363
|
-
children: _.map((r) => /* @__PURE__ */ ae("div", {
|
|
364
|
-
role: "alert",
|
|
365
|
-
"aria-atomic": !0,
|
|
366
|
-
children: [/* @__PURE__ */ E("div", {
|
|
367
|
-
children: r.title
|
|
368
|
-
}), /* @__PURE__ */ E("div", {
|
|
369
|
-
children: r.description
|
|
370
|
-
})]
|
|
371
|
-
}, r.id))
|
|
372
|
-
})]
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
process.env.NODE_ENV !== "production" && ($e.displayName = "ToastViewport");
|
|
376
|
-
const Se = /* @__PURE__ */ e.createContext(void 0);
|
|
377
|
-
process.env.NODE_ENV !== "production" && (Se.displayName = "ToastRootContext");
|
|
378
|
-
function se() {
|
|
379
|
-
const f = e.useContext(Se);
|
|
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>." : _t(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 Dt = {
|
|
388
|
-
...wt,
|
|
389
|
-
swipeDirection(f) {
|
|
390
|
-
return f ? {
|
|
391
|
-
"data-swipe-direction": f
|
|
392
|
-
} : null;
|
|
393
|
-
}
|
|
394
|
-
}, ie = 40, Et = 10, Q = 0.5, Rt = 1;
|
|
395
|
-
function ke(f, d, h) {
|
|
396
|
-
switch (f) {
|
|
397
|
-
case "up":
|
|
398
|
-
return -h;
|
|
399
|
-
case "down":
|
|
400
|
-
return h;
|
|
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 h = window.getComputedStyle(f).transform;
|
|
411
|
-
let s = 0, F = 0, M = 1;
|
|
412
|
-
if (h && h !== "none") {
|
|
413
|
-
const y = h.match(/matrix(?:3d)?\(([^)]+)\)/);
|
|
414
|
-
if (y) {
|
|
415
|
-
const a = y[1].split(", ").map(parseFloat);
|
|
416
|
-
a.length === 6 ? (s = a[4], F = a[5], M = Math.sqrt(a[0] * a[0] + a[1] * a[1])) : a.length === 16 && (s = a[12], F = a[13], M = a[0]);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return {
|
|
420
|
-
x: s,
|
|
421
|
-
y: F,
|
|
422
|
-
scale: M
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
const je = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
426
|
-
const {
|
|
427
|
-
toast: s,
|
|
428
|
-
render: F,
|
|
429
|
-
className: M,
|
|
430
|
-
swipeDirection: y = ["down", "right"],
|
|
431
|
-
...a
|
|
432
|
-
} = d, g = s.positionerProps?.anchor !== void 0;
|
|
433
|
-
let t = [];
|
|
434
|
-
g || (t = Array.isArray(y) ? y : [y]);
|
|
435
|
-
const l = t.length > 0, {
|
|
436
|
-
toasts: v,
|
|
437
|
-
focused: o,
|
|
438
|
-
close: R,
|
|
439
|
-
remove: b,
|
|
440
|
-
setToasts: N,
|
|
441
|
-
pauseTimers: A,
|
|
442
|
-
expanded: C,
|
|
443
|
-
setHovering: Y
|
|
444
|
-
} = be(), [K, D] = e.useState(void 0), [k, I] = e.useState(!1), [U, $] = e.useState(!1), [z, X] = e.useState(!1), [O, J] = e.useState({
|
|
445
|
-
x: 0,
|
|
446
|
-
y: 0
|
|
447
|
-
}), [n, m] = e.useState({
|
|
448
|
-
x: 0,
|
|
449
|
-
y: 0,
|
|
450
|
-
scale: 1
|
|
451
|
-
}), [w, i] = e.useState(), [_, r] = e.useState(), [p, x] = e.useState(null), T = e.useRef(null), L = e.useRef({
|
|
452
|
-
x: 0,
|
|
453
|
-
y: 0
|
|
454
|
-
}), Z = e.useRef({
|
|
455
|
-
x: 0,
|
|
456
|
-
y: 0,
|
|
457
|
-
scale: 1
|
|
458
|
-
}), ce = e.useRef(void 0), he = e.useRef(0), ue = e.useRef(!1), j = e.useRef({
|
|
459
|
-
x: 0,
|
|
460
|
-
y: 0
|
|
461
|
-
}), ge = e.useRef(!1), _e = e.useMemo(() => v.indexOf(s), [s, v]), ve = e.useMemo(() => v.filter((c) => c.transitionStatus !== "ending").indexOf(s), [s, v]), ze = e.useMemo(() => v.slice(0, v.indexOf(s)).reduce((c, u) => c + (u.height || 0), 0), [v, s]);
|
|
462
|
-
vt({
|
|
463
|
-
open: s.transitionStatus !== "ending",
|
|
464
|
-
ref: T,
|
|
465
|
-
onComplete() {
|
|
466
|
-
s.transitionStatus === "ending" && b(s.id);
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
const le = W((c = !1) => {
|
|
470
|
-
const u = T.current;
|
|
471
|
-
if (!u)
|
|
472
|
-
return;
|
|
473
|
-
const S = u.style.height;
|
|
474
|
-
u.style.height = "auto";
|
|
475
|
-
const P = u.offsetHeight;
|
|
476
|
-
u.style.height = S;
|
|
477
|
-
function B() {
|
|
478
|
-
N((H) => H.map((V) => V.id === s.id ? {
|
|
479
|
-
...V,
|
|
480
|
-
ref: T,
|
|
481
|
-
height: P,
|
|
482
|
-
transitionStatus: void 0
|
|
483
|
-
} : V));
|
|
484
|
-
}
|
|
485
|
-
c ? ht.flushSync(B) : B();
|
|
486
|
-
});
|
|
487
|
-
me(le, [le]);
|
|
488
|
-
function Xe(c, u) {
|
|
489
|
-
let S = c, P = u;
|
|
490
|
-
return !t.includes("left") && !t.includes("right") ? S = c > 0 ? c ** Q : -(Math.abs(c) ** Q) : (!t.includes("right") && c > 0 && (S = c ** Q), !t.includes("left") && c < 0 && (S = -(Math.abs(c) ** Q))), !t.includes("up") && !t.includes("down") ? P = u > 0 ? u ** Q : -(Math.abs(u) ** Q) : (!t.includes("down") && u > 0 && (P = u ** Q), !t.includes("up") && u < 0 && (P = -(Math.abs(u) ** Q))), {
|
|
491
|
-
x: S,
|
|
492
|
-
y: P
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
function Ge(c) {
|
|
496
|
-
if (c.button !== 0)
|
|
497
|
-
return;
|
|
498
|
-
c.pointerType === "touch" && A();
|
|
499
|
-
const u = Re(c.nativeEvent);
|
|
500
|
-
if (!(u && u.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))) {
|
|
501
|
-
if (ue.current = !1, ce.current = void 0, he.current = 0, L.current = {
|
|
502
|
-
x: c.clientX,
|
|
503
|
-
y: c.clientY
|
|
504
|
-
}, j.current = L.current, T.current) {
|
|
505
|
-
const P = bt(T.current);
|
|
506
|
-
Z.current = P, m(P), J({
|
|
507
|
-
x: P.x,
|
|
508
|
-
y: P.y
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
Y(!0), I(!0), $(!1), x(null), ge.current = !0, T.current?.setPointerCapture(c.pointerId);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
function Ke(c) {
|
|
515
|
-
if (!k)
|
|
516
|
-
return;
|
|
517
|
-
c.preventDefault(), ge.current && (L.current = {
|
|
518
|
-
x: c.clientX,
|
|
519
|
-
y: c.clientY
|
|
520
|
-
}, ge.current = !1);
|
|
521
|
-
const {
|
|
522
|
-
clientY: u,
|
|
523
|
-
clientX: S,
|
|
524
|
-
movementX: P,
|
|
525
|
-
movementY: B
|
|
526
|
-
} = c;
|
|
527
|
-
(B < 0 && u > j.current.y || B > 0 && u < j.current.y) && (j.current = {
|
|
528
|
-
x: j.current.x,
|
|
529
|
-
y: u
|
|
530
|
-
}), (P < 0 && S > j.current.x || P > 0 && S < j.current.x) && (j.current = {
|
|
531
|
-
x: S,
|
|
532
|
-
y: j.current.y
|
|
533
|
-
});
|
|
534
|
-
const H = S - L.current.x, V = u - L.current.y, tt = u - j.current.y, nt = S - j.current.x;
|
|
535
|
-
if (!U && Math.sqrt(H * H + V * V) >= Rt && ($(!0), p === null)) {
|
|
536
|
-
const de = t.includes("left") || t.includes("right"), rt = t.includes("up") || t.includes("down");
|
|
537
|
-
if (de && rt) {
|
|
538
|
-
const st = Math.abs(H), ot = Math.abs(V);
|
|
539
|
-
x(st > ot ? "horizontal" : "vertical");
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
let q;
|
|
543
|
-
if (!ce.current)
|
|
544
|
-
p === "vertical" ? V > 0 ? q = "down" : V < 0 && (q = "up") : p === "horizontal" ? H > 0 ? q = "right" : H < 0 && (q = "left") : Math.abs(H) >= Math.abs(V) ? q = H > 0 ? "right" : "left" : q = V > 0 ? "down" : "up", q && t.includes(q) && (ce.current = q, he.current = ke(q, H, V), D(q));
|
|
545
|
-
else {
|
|
546
|
-
const xe = ce.current, de = ke(xe, nt, tt);
|
|
547
|
-
de > ie ? (ue.current = !1, D(xe)) : !(t.includes("left") && t.includes("right")) && !(t.includes("up") && t.includes("down")) && he.current - de >= Et && (ue.current = !0);
|
|
548
|
-
}
|
|
549
|
-
const fe = Xe(H, V);
|
|
550
|
-
let we = Z.current.x, ye = Z.current.y;
|
|
551
|
-
p === "horizontal" ? (t.includes("left") || t.includes("right")) && (we += fe.x) : (p === "vertical" || (t.includes("left") || t.includes("right")) && (we += fe.x), (t.includes("up") || t.includes("down")) && (ye += fe.y)), J({
|
|
552
|
-
x: we,
|
|
553
|
-
y: ye
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
function We(c) {
|
|
557
|
-
if (!k)
|
|
558
|
-
return;
|
|
559
|
-
if (I(!1), $(!1), x(null), T.current?.releasePointerCapture(c.pointerId), ue.current) {
|
|
560
|
-
J({
|
|
561
|
-
x: n.x,
|
|
562
|
-
y: n.y
|
|
563
|
-
}), D(void 0);
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
let u = !1;
|
|
567
|
-
const S = O.x - n.x, P = O.y - n.y;
|
|
568
|
-
let B;
|
|
569
|
-
for (const H of t) {
|
|
570
|
-
switch (H) {
|
|
571
|
-
case "right":
|
|
572
|
-
S > ie && (u = !0, B = "right");
|
|
573
|
-
break;
|
|
574
|
-
case "left":
|
|
575
|
-
S < -ie && (u = !0, B = "left");
|
|
576
|
-
break;
|
|
577
|
-
case "down":
|
|
578
|
-
P > ie && (u = !0, B = "down");
|
|
579
|
-
break;
|
|
580
|
-
case "up":
|
|
581
|
-
P < -ie && (u = !0, B = "up");
|
|
582
|
-
break;
|
|
583
|
-
}
|
|
584
|
-
if (u)
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
u ? (D(B), X(!0), R(s.id)) : (J({
|
|
588
|
-
x: n.x,
|
|
589
|
-
y: n.y
|
|
590
|
-
}), D(void 0));
|
|
591
|
-
}
|
|
592
|
-
function Ue(c) {
|
|
593
|
-
if (c.key === "Escape") {
|
|
594
|
-
if (!T.current || !re(T.current, pe(ne(T.current))))
|
|
595
|
-
return;
|
|
596
|
-
R(s.id);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
e.useEffect(() => {
|
|
600
|
-
if (!l)
|
|
601
|
-
return;
|
|
602
|
-
const c = T.current;
|
|
603
|
-
if (!c)
|
|
604
|
-
return;
|
|
605
|
-
function u(S) {
|
|
606
|
-
re(c, S.target) && S.preventDefault();
|
|
607
|
-
}
|
|
608
|
-
return c.addEventListener("touchmove", u, {
|
|
609
|
-
passive: !1
|
|
610
|
-
}), () => {
|
|
611
|
-
c.removeEventListener("touchmove", u);
|
|
612
|
-
};
|
|
613
|
-
}, [l]);
|
|
614
|
-
function Je() {
|
|
615
|
-
if (!k && O.x === n.x && O.y === n.y && !z)
|
|
616
|
-
return {
|
|
617
|
-
[ee.swipeMovementX]: "0px",
|
|
618
|
-
[ee.swipeMovementY]: "0px"
|
|
619
|
-
};
|
|
620
|
-
const c = O.x - n.x, u = O.y - n.y;
|
|
621
|
-
return {
|
|
622
|
-
transition: k ? "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: k ? `translateX(${O.x}px) translateY(${O.y}px) scale(${n.scale})` : void 0,
|
|
626
|
-
[ee.swipeMovementX]: `${c}px`,
|
|
627
|
-
[ee.swipeMovementY]: `${u}px`
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
const Me = s.priority === "high", Qe = {
|
|
631
|
-
role: Me ? "alertdialog" : "dialog",
|
|
632
|
-
tabIndex: 0,
|
|
633
|
-
"aria-modal": !1,
|
|
634
|
-
"aria-labelledby": w,
|
|
635
|
-
"aria-describedby": _,
|
|
636
|
-
"aria-hidden": Me && !o ? !0 : void 0,
|
|
637
|
-
onPointerDown: l ? Ge : void 0,
|
|
638
|
-
onPointerMove: l ? Ke : void 0,
|
|
639
|
-
onPointerUp: l ? We : void 0,
|
|
640
|
-
onKeyDown: Ue,
|
|
641
|
-
inert: gt(s.limited),
|
|
642
|
-
style: {
|
|
643
|
-
...Je(),
|
|
644
|
-
[ee.index]: s.transitionStatus === "ending" ? _e : ve,
|
|
645
|
-
[ee.offsetY]: `${ze}px`,
|
|
646
|
-
[ee.height]: s.height ? `${s.height}px` : void 0
|
|
647
|
-
}
|
|
648
|
-
}, te = e.useMemo(() => ({
|
|
649
|
-
rootRef: T,
|
|
650
|
-
toast: s,
|
|
651
|
-
titleId: w,
|
|
652
|
-
setTitleId: i,
|
|
653
|
-
descriptionId: _,
|
|
654
|
-
setDescriptionId: r,
|
|
655
|
-
swiping: k,
|
|
656
|
-
swipeDirection: K,
|
|
657
|
-
recalculateHeight: le,
|
|
658
|
-
index: _e,
|
|
659
|
-
visibleIndex: ve,
|
|
660
|
-
expanded: C
|
|
661
|
-
}), [s, w, _, k, K, le, _e, ve, C]), Ze = 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]), et = oe("div", d, {
|
|
669
|
-
ref: [h, te.rootRef],
|
|
670
|
-
state: Ze,
|
|
671
|
-
stateAttributesMapping: Dt,
|
|
672
|
-
props: [Qe, a]
|
|
673
|
-
});
|
|
674
|
-
return /* @__PURE__ */ E(Se.Provider, {
|
|
675
|
-
value: te,
|
|
676
|
-
children: et
|
|
677
|
-
});
|
|
678
|
-
});
|
|
679
|
-
process.env.NODE_ENV !== "production" && (je.displayName = "ToastRoot");
|
|
680
|
-
const Be = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
681
|
-
const {
|
|
682
|
-
render: s,
|
|
683
|
-
className: F,
|
|
684
|
-
...M
|
|
685
|
-
} = d, {
|
|
686
|
-
visibleIndex: y,
|
|
687
|
-
expanded: a,
|
|
688
|
-
recalculateHeight: g
|
|
689
|
-
} = se(), t = e.useRef(null);
|
|
690
|
-
me(() => {
|
|
691
|
-
const R = t.current;
|
|
692
|
-
if (!R || (g(), typeof ResizeObserver != "function" || typeof MutationObserver != "function"))
|
|
693
|
-
return;
|
|
694
|
-
const b = new ResizeObserver(() => g(!0)), N = new MutationObserver(() => g(!0));
|
|
695
|
-
return b.observe(R), N.observe(R, {
|
|
696
|
-
childList: !0,
|
|
697
|
-
subtree: !0,
|
|
698
|
-
characterData: !0
|
|
699
|
-
}), () => {
|
|
700
|
-
b.disconnect(), N.disconnect();
|
|
701
|
-
};
|
|
702
|
-
}, [g]);
|
|
703
|
-
const l = y > 0, v = e.useMemo(() => ({
|
|
704
|
-
expanded: a,
|
|
705
|
-
behind: l
|
|
706
|
-
}), [a, l]);
|
|
707
|
-
return oe("div", d, {
|
|
708
|
-
ref: [h, t],
|
|
709
|
-
state: v,
|
|
710
|
-
props: M
|
|
711
|
-
});
|
|
712
|
-
});
|
|
713
|
-
process.env.NODE_ENV !== "production" && (Be.displayName = "ToastContent");
|
|
714
|
-
const qe = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
715
|
-
const {
|
|
716
|
-
render: s,
|
|
717
|
-
className: F,
|
|
718
|
-
id: M,
|
|
719
|
-
children: y,
|
|
720
|
-
...a
|
|
721
|
-
} = d, {
|
|
722
|
-
toast: g
|
|
723
|
-
} = se(), t = y ?? g.description, l = !!t, v = Le(M), {
|
|
724
|
-
setDescriptionId: o
|
|
725
|
-
} = se();
|
|
726
|
-
me(() => {
|
|
727
|
-
if (l)
|
|
728
|
-
return o(v), () => {
|
|
729
|
-
o(void 0);
|
|
730
|
-
};
|
|
731
|
-
}, [l, v, o]);
|
|
732
|
-
const R = e.useMemo(() => ({
|
|
733
|
-
type: g.type
|
|
734
|
-
}), [g.type]), b = oe("p", d, {
|
|
735
|
-
ref: h,
|
|
736
|
-
state: R,
|
|
737
|
-
props: {
|
|
738
|
-
...a,
|
|
739
|
-
id: v,
|
|
740
|
-
children: t
|
|
741
|
-
}
|
|
742
|
-
});
|
|
743
|
-
return l ? b : null;
|
|
744
|
-
});
|
|
745
|
-
process.env.NODE_ENV !== "production" && (qe.displayName = "ToastDescription");
|
|
746
|
-
const Ae = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
747
|
-
const {
|
|
748
|
-
render: s,
|
|
749
|
-
className: F,
|
|
750
|
-
id: M,
|
|
751
|
-
children: y,
|
|
752
|
-
...a
|
|
753
|
-
} = d, {
|
|
754
|
-
toast: g
|
|
755
|
-
} = se(), t = y ?? g.title, l = !!t, v = Le(M), {
|
|
756
|
-
setTitleId: o
|
|
757
|
-
} = se();
|
|
758
|
-
me(() => {
|
|
759
|
-
if (l)
|
|
760
|
-
return o(v), () => {
|
|
761
|
-
o(void 0);
|
|
762
|
-
};
|
|
763
|
-
}, [l, v, o]);
|
|
764
|
-
const R = e.useMemo(() => ({
|
|
765
|
-
type: g.type
|
|
766
|
-
}), [g.type]), b = oe("h2", d, {
|
|
767
|
-
ref: h,
|
|
768
|
-
state: R,
|
|
769
|
-
props: {
|
|
770
|
-
...a,
|
|
771
|
-
id: v,
|
|
772
|
-
children: t
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
return l ? b : null;
|
|
776
|
-
});
|
|
777
|
-
process.env.NODE_ENV !== "production" && (Ae.displayName = "ToastTitle");
|
|
778
|
-
const Ye = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
779
|
-
const {
|
|
780
|
-
render: s,
|
|
781
|
-
className: F,
|
|
782
|
-
disabled: M,
|
|
783
|
-
nativeButton: y = !0,
|
|
784
|
-
...a
|
|
785
|
-
} = d, {
|
|
786
|
-
close: g,
|
|
787
|
-
expanded: t
|
|
788
|
-
} = be(), {
|
|
789
|
-
toast: l
|
|
790
|
-
} = se(), [v, o] = e.useState(!1), {
|
|
791
|
-
getButtonProps: R,
|
|
792
|
-
buttonRef: b
|
|
793
|
-
} = yt({
|
|
794
|
-
disabled: M,
|
|
795
|
-
native: y
|
|
796
|
-
}), N = e.useMemo(() => ({
|
|
797
|
-
type: l.type
|
|
798
|
-
}), [l.type]);
|
|
799
|
-
return oe("button", d, {
|
|
800
|
-
ref: [h, b],
|
|
801
|
-
state: N,
|
|
802
|
-
props: [{
|
|
803
|
-
"aria-hidden": !t && !v,
|
|
804
|
-
onClick() {
|
|
805
|
-
g(l.id);
|
|
806
|
-
},
|
|
807
|
-
onFocus() {
|
|
808
|
-
o(!0);
|
|
809
|
-
},
|
|
810
|
-
onBlur() {
|
|
811
|
-
o(!1);
|
|
812
|
-
}
|
|
813
|
-
}, a, R]
|
|
814
|
-
});
|
|
815
|
-
});
|
|
816
|
-
process.env.NODE_ENV !== "production" && (Ye.displayName = "ToastClose");
|
|
817
|
-
const St = pt, Mt = "_toast__viewport_fjqk1_1", Nt = "_toast_fjqk1_1", Pt = "_toast_variant_neutral_fjqk1_111", Ot = "_toast_variant_colorway_fjqk1_117", Ct = "_toast__content_fjqk1_123", Ft = "_toast__header_fjqk1_142", kt = "_toast__header_pad_fjqk1_146", It = "_toast__title_fjqk1_150", Lt = "_toast__description_fjqk1_154", Ht = "_toast__close_fjqk1_158", G = {
|
|
818
|
-
toast__viewport: Mt,
|
|
819
|
-
toast: Nt,
|
|
820
|
-
toast_variant_neutral: Pt,
|
|
821
|
-
toast_variant_colorway: Ot,
|
|
822
|
-
toast__content: Ct,
|
|
823
|
-
toast__header: Ft,
|
|
824
|
-
toast__header_pad: kt,
|
|
825
|
-
toast__title: It,
|
|
826
|
-
toast__description: Lt,
|
|
827
|
-
toast__close: Ht
|
|
828
|
-
}, ln = He, Ie = {
|
|
829
|
-
info: "blue",
|
|
830
|
-
error: "red",
|
|
831
|
-
warning: "yellow",
|
|
832
|
-
success: "green"
|
|
833
|
-
};
|
|
834
|
-
function fn() {
|
|
835
|
-
return /* @__PURE__ */ E(St, { children: /* @__PURE__ */ E($e, { className: G.toast__viewport, children: /* @__PURE__ */ E(Vt, {}) }) });
|
|
836
|
-
}
|
|
837
|
-
function Vt() {
|
|
838
|
-
return dt().toasts.map((d) => {
|
|
839
|
-
const h = d.type && d.type in Ie ? Ie[d.type] : void 0;
|
|
840
|
-
return /* @__PURE__ */ E(
|
|
841
|
-
je,
|
|
842
|
-
{
|
|
843
|
-
toast: d,
|
|
844
|
-
className: Ne(
|
|
845
|
-
G.toast,
|
|
846
|
-
h ? G.toast_variant_colorway : G.toast_variant_neutral
|
|
847
|
-
),
|
|
848
|
-
render: /* @__PURE__ */ E(ut, { background: "default", color: h }),
|
|
849
|
-
children: /* @__PURE__ */ ae(
|
|
850
|
-
Pe,
|
|
851
|
-
{
|
|
852
|
-
render: /* @__PURE__ */ E(Be, {}),
|
|
853
|
-
className: G.toast__content,
|
|
854
|
-
children: [
|
|
855
|
-
/* @__PURE__ */ ae(
|
|
856
|
-
Pe,
|
|
857
|
-
{
|
|
858
|
-
className: Ne(
|
|
859
|
-
G.toast__header,
|
|
860
|
-
!d.title && G.toast__header_pad
|
|
861
|
-
),
|
|
862
|
-
children: [
|
|
863
|
-
/* @__PURE__ */ E(
|
|
864
|
-
Ae,
|
|
865
|
-
{
|
|
866
|
-
render: /* @__PURE__ */ E(
|
|
867
|
-
at,
|
|
868
|
-
{
|
|
869
|
-
level: 2,
|
|
870
|
-
size: "lg",
|
|
871
|
-
color: "inherit",
|
|
872
|
-
className: G.toast__title
|
|
873
|
-
}
|
|
874
|
-
)
|
|
875
|
-
}
|
|
876
|
-
),
|
|
877
|
-
/* @__PURE__ */ E(
|
|
878
|
-
qe,
|
|
879
|
-
{
|
|
880
|
-
render: /* @__PURE__ */ E(lt, { multiline: !0, color: h ? "inherit" : "dimmer" }),
|
|
881
|
-
className: G.toast__description
|
|
882
|
-
}
|
|
883
|
-
)
|
|
884
|
-
]
|
|
885
|
-
}
|
|
886
|
-
),
|
|
887
|
-
/* @__PURE__ */ E(
|
|
888
|
-
Ye,
|
|
889
|
-
{
|
|
890
|
-
render: /* @__PURE__ */ E(
|
|
891
|
-
ct,
|
|
892
|
-
{
|
|
893
|
-
interactive: h ? `${h}_no-fill` : "no-fill",
|
|
894
|
-
icon: "close-line",
|
|
895
|
-
size: "sm",
|
|
896
|
-
alt: "Close",
|
|
897
|
-
className: G.toast__close
|
|
898
|
-
}
|
|
899
|
-
)
|
|
900
|
-
}
|
|
901
|
-
),
|
|
902
|
-
d.action ? /* @__PURE__ */ E(
|
|
903
|
-
it,
|
|
904
|
-
{
|
|
905
|
-
...d.action,
|
|
906
|
-
interactive: h ? `${h}_fill` : !0,
|
|
907
|
-
children: d.action.children
|
|
908
|
-
}
|
|
909
|
-
) : null
|
|
910
|
-
]
|
|
911
|
-
}
|
|
912
|
-
)
|
|
913
|
-
},
|
|
914
|
-
d.id
|
|
915
|
-
);
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
export {
|
|
919
|
-
ln as ToastProvider,
|
|
920
|
-
fn as ToastViewport
|
|
921
|
-
};
|