@konstructio/ui 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/LICENSE.md +21 -0
- package/README.md +19 -0
- package/dist/AlertDialogTrigger-BIbxXexQ.js +553 -0
- package/dist/Combination-Cmu9JRkv.js +479 -0
- package/dist/Modal-CO0_SnXD.js +909 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/chevron-up-Cmu1oXfj.js +54 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +3 -0
- package/dist/components/AlertDialog/AlertDialog.js +54 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +13 -0
- package/dist/components/AlertDialog/AlertDialog.types.js +1 -0
- package/dist/components/AlertDialog/AlertDialog.variants.d.ts +3 -0
- package/dist/components/AlertDialog/AlertDialog.variants.js +16 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.d.ts +3 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +10 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.types.d.ts +6 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.types.js +1 -0
- package/dist/components/AlertDialog/components/index.d.ts +1 -0
- package/dist/components/AlertDialog/components/index.js +4 -0
- package/dist/components/AlertDialog/hooks/index.d.ts +1 -0
- package/dist/components/AlertDialog/hooks/index.js +4 -0
- package/dist/components/AlertDialog/hooks/useAlertDialog.d.ts +7 -0
- package/dist/components/AlertDialog/hooks/useAlertDialog.js +10 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +3 -0
- package/dist/components/Autocomplete/Autocomplete.js +84 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +18 -0
- package/dist/components/Autocomplete/Autocomplete.types.js +1 -0
- package/dist/components/Autocomplete/Autocomplete.variants.d.ts +8 -0
- package/dist/components/Autocomplete/Autocomplete.variants.js +61 -0
- package/dist/components/Autocomplete/components/List.d.ts +3 -0
- package/dist/components/Autocomplete/components/List.js +57 -0
- package/dist/components/Autocomplete/components/List.types.d.ts +13 -0
- package/dist/components/Autocomplete/components/List.types.js +1 -0
- package/dist/components/Autocomplete/components/List.variants.d.ts +16 -0
- package/dist/components/Autocomplete/components/List.variants.js +81 -0
- package/dist/components/Autocomplete/hooks/index.d.ts +2 -0
- package/dist/components/Autocomplete/hooks/index.js +6 -0
- package/dist/components/Autocomplete/hooks/useAutocomplete.d.ts +17 -0
- package/dist/components/Autocomplete/hooks/useAutocomplete.js +81 -0
- package/dist/components/Autocomplete/hooks/useNavigationList.d.ts +10 -0
- package/dist/components/Autocomplete/hooks/useNavigationList.js +78 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +460 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts +11 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.variants.d.ts +12 -0
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +61 -0
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +5 -0
- package/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/Button.js +42 -0
- package/dist/components/Button/Button.types.d.ts +7 -0
- package/dist/components/Button/Button.types.js +1 -0
- package/dist/components/Button/Button.variants.d.ts +6 -0
- package/dist/components/Button/Button.variants.js +102 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.js +233 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.types.js +1 -0
- package/dist/components/Checkbox/Checkbox.variants.d.ts +9 -0
- package/dist/components/Checkbox/Checkbox.variants.js +82 -0
- package/dist/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.js +10 -0
- package/dist/components/Dropdown/Dropdown.types.d.ts +15 -0
- package/dist/components/Dropdown/Dropdown.types.js +1 -0
- package/dist/components/Dropdown/Dropdown.variants.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.variants.js +45 -0
- package/dist/components/Dropdown/components/EmptyList.d.ts +2 -0
- package/dist/components/Dropdown/components/EmptyList.js +5 -0
- package/dist/components/Dropdown/components/List/List.d.ts +3 -0
- package/dist/components/Dropdown/components/List/List.js +25 -0
- package/dist/components/Dropdown/components/List/List.types.d.ts +8 -0
- package/dist/components/Dropdown/components/List/List.types.js +1 -0
- package/dist/components/Dropdown/components/List/List.variants.d.ts +3 -0
- package/dist/components/Dropdown/components/List/List.variants.js +34 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.d.ts +3 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.js +29 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.types.d.ts +4 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.types.js +1 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.d.ts +3 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +19 -0
- package/dist/components/Dropdown/components/Wrapper.d.ts +3 -0
- package/dist/components/Dropdown/components/Wrapper.js +90 -0
- package/dist/components/Dropdown/components/index.d.ts +3 -0
- package/dist/components/Dropdown/components/index.js +8 -0
- package/dist/components/Dropdown/contexts/dropdown.context.d.ts +8 -0
- package/dist/components/Dropdown/contexts/dropdown.context.js +14 -0
- package/dist/components/Dropdown/contexts/dropdown.hook.d.ts +2 -0
- package/dist/components/Dropdown/contexts/dropdown.hook.js +11 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.d.ts +2 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.js +11 -0
- package/dist/components/Dropdown/contexts/index.d.ts +2 -0
- package/dist/components/Dropdown/contexts/index.js +6 -0
- package/dist/components/Dropdown/hooks/useDropdown.d.ts +11 -0
- package/dist/components/Dropdown/hooks/useDropdown.js +65 -0
- package/dist/components/Dropdown/hooks/useNavigationList.d.ts +8 -0
- package/dist/components/Dropdown/hooks/useNavigationList.js +66 -0
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.js +178 -0
- package/dist/components/Input/Input.types.d.ts +9 -0
- package/dist/components/Input/Input.types.js +1 -0
- package/dist/components/Input/Input.variants.d.ts +4 -0
- package/dist/components/Input/Input.variants.js +43 -0
- package/dist/components/Modal/Modal.d.ts +8 -0
- package/dist/components/Modal/Modal.js +10 -0
- package/dist/components/Modal/Modal.types.d.ts +12 -0
- package/dist/components/Modal/Modal.types.js +1 -0
- package/dist/components/Modal/components/Body/Body.d.ts +3 -0
- package/dist/components/Modal/components/Body/Body.js +7 -0
- package/dist/components/Modal/components/Body/Body.types.d.ts +5 -0
- package/dist/components/Modal/components/Body/Body.types.js +1 -0
- package/dist/components/Modal/components/Footer/Footer.d.ts +3 -0
- package/dist/components/Modal/components/Footer/Footer.js +6 -0
- package/dist/components/Modal/components/Footer/Footer.types.d.ts +5 -0
- package/dist/components/Modal/components/Footer/Footer.types.js +1 -0
- package/dist/components/Modal/components/Header/Header.d.ts +3 -0
- package/dist/components/Modal/components/Header/Header.js +6 -0
- package/dist/components/Modal/components/Header/Header.types.d.ts +5 -0
- package/dist/components/Modal/components/Header/Header.types.js +1 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.d.ts +3 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.js +13 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.types.d.ts +7 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.types.js +1 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.d.ts +6 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +48 -0
- package/dist/components/Modal/components/index.d.ts +4 -0
- package/dist/components/Modal/components/index.js +10 -0
- package/dist/components/Modal/contexts/Modal.context.d.ts +2 -0
- package/dist/components/Modal/contexts/Modal.context.js +20 -0
- package/dist/components/Modal/contexts/Modal.provider.d.ts +4 -0
- package/dist/components/Modal/contexts/Modal.provider.js +26 -0
- package/dist/components/Modal/contexts/Modal.types.d.ts +9 -0
- package/dist/components/Modal/contexts/Modal.types.js +1 -0
- package/dist/components/Modal/contexts/index.d.ts +1 -0
- package/dist/components/Modal/contexts/index.js +4 -0
- package/dist/components/Modal/hooks/index.d.ts +1 -0
- package/dist/components/Modal/hooks/index.js +4 -0
- package/dist/components/Modal/hooks/useModal.d.ts +9 -0
- package/dist/components/Modal/hooks/useModal.js +27 -0
- package/dist/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/components/NumberInput/NumberInput.js +181 -0
- package/dist/components/NumberInput/NumberInput.types.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.types.js +1 -0
- package/dist/components/NumberInput/NumberInput.variants.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.variants.js +78 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +3 -0
- package/dist/components/ProgressBar/ProgressBar.js +37 -0
- package/dist/components/ProgressBar/ProgressBar.types.d.ts +8 -0
- package/dist/components/ProgressBar/ProgressBar.types.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.variants.d.ts +7 -0
- package/dist/components/ProgressBar/ProgressBar.variants.js +62 -0
- package/dist/components/Radio/Radio.d.ts +3 -0
- package/dist/components/Radio/Radio.js +58 -0
- package/dist/components/Radio/Radio.types.d.ts +12 -0
- package/dist/components/Radio/Radio.types.js +1 -0
- package/dist/components/Radio/Radio.variants.d.ts +3 -0
- package/dist/components/Radio/Radio.variants.js +49 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/components/RadioGroup/RadioGroup.js +37 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +11 -0
- package/dist/components/RadioGroup/RadioGroup.types.js +1 -0
- package/dist/components/Range/Range.d.ts +3 -0
- package/dist/components/Range/Range.js +70 -0
- package/dist/components/Range/Range.types.d.ts +13 -0
- package/dist/components/Range/Range.types.js +1 -0
- package/dist/components/Range/Range.variants.d.ts +14 -0
- package/dist/components/Range/Range.variants.js +93 -0
- package/dist/components/Slider/Slider.d.ts +3 -0
- package/dist/components/Slider/Slider.js +52 -0
- package/dist/components/Slider/Slider.types.d.ts +13 -0
- package/dist/components/Slider/Slider.types.js +1 -0
- package/dist/components/Slider/Slider.variants.d.ts +11 -0
- package/dist/components/Slider/Slider.variants.js +69 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.js +176 -0
- package/dist/components/Switch/Switch.types.d.ts +10 -0
- package/dist/components/Switch/Switch.types.js +1 -0
- package/dist/components/Switch/Switch.variants.d.ts +6 -0
- package/dist/components/Switch/Switch.variants.js +58 -0
- package/dist/components/Tag/Tag.d.ts +3 -0
- package/dist/components/Tag/Tag.js +6 -0
- package/dist/components/Tag/Tag.types.d.ts +4 -0
- package/dist/components/Tag/Tag.types.js +1 -0
- package/dist/components/Tag/Tag.variants.d.ts +3 -0
- package/dist/components/Tag/Tag.variants.js +31 -0
- package/dist/components/TagSelect/TagSelect.d.ts +3 -0
- package/dist/components/TagSelect/TagSelect.js +75 -0
- package/dist/components/TagSelect/TagSelect.types.d.ts +9 -0
- package/dist/components/TagSelect/TagSelect.types.js +1 -0
- package/dist/components/TagSelect/TagSelect.variants.d.ts +9 -0
- package/dist/components/TagSelect/TagSelect.variants.js +83 -0
- package/dist/components/TagSelect/hooks/useTagSelect.d.ts +9 -0
- package/dist/components/TagSelect/hooks/useTagSelect.js +39 -0
- package/dist/components/TextArea/TextArea.d.ts +3 -0
- package/dist/components/TextArea/TextArea.js +34 -0
- package/dist/components/TextArea/TextArea.types.d.ts +10 -0
- package/dist/components/TextArea/TextArea.types.js +1 -0
- package/dist/components/TextArea/TextArea.variants.d.ts +3 -0
- package/dist/components/TextArea/TextArea.variants.js +34 -0
- package/dist/components/Toast/Toast.d.ts +3 -0
- package/dist/components/Toast/Toast.js +471 -0
- package/dist/components/Toast/Toast.types.d.ts +12 -0
- package/dist/components/Toast/Toast.types.js +1 -0
- package/dist/components/Toast/Toast.variants.d.ts +9 -0
- package/dist/components/Toast/Toast.variants.js +74 -0
- package/dist/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.js +42 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.types.js +1 -0
- package/dist/components/Tooltip/Tooltip.variants.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.variants.js +93 -0
- package/dist/components/Tooltip/hooks/useTooltip.d.ts +4 -0
- package/dist/components/Tooltip/hooks/useTooltip.js +25 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.js +40 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.js +8 -0
- package/dist/contexts/theme.context.d.ts +6 -0
- package/dist/contexts/theme.context.js +10 -0
- package/dist/contexts/theme.hook.d.ts +7 -0
- package/dist/contexts/theme.hook.js +9 -0
- package/dist/contexts/theme.provider.d.ts +7 -0
- package/dist/contexts/theme.provider.js +17 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/useToggle.d.ts +1 -0
- package/dist/hooks/useToggle.js +11 -0
- package/dist/index-2K8qjK4R.js +145 -0
- package/dist/index-2hJuj4UN.js +19069 -0
- package/dist/index-4qm4jAkj.js +92 -0
- package/dist/index-8vgf-x5i.js +118 -0
- package/dist/index-BJ7FQg17.js +35 -0
- package/dist/index-B_GWswUP.js +71 -0
- package/dist/index-BqM_XclQ.js +94 -0
- package/dist/index-BwYCDOHZ.js +44 -0
- package/dist/index-BxeV34ij.js +32 -0
- package/dist/index-CCavb-1K.js +57 -0
- package/dist/index-DFbnnPzA.js +423 -0
- package/dist/index-DQMInta3.js +663 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +50 -0
- package/dist/js.cookie-OLEfuq_g.js +74 -0
- package/dist/package.json +118 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/konstruct.d.ts +4 -0
- package/dist/plugins/konstruct.js +104 -0
- package/dist/plugins/utils/colors.d.ts +206 -0
- package/dist/plugins/utils/colors.js +626 -0
- package/dist/styles.css +1 -0
- package/dist/styles.d.ts +0 -0
- package/dist/styles.js +1 -0
- package/dist/useBreadcrumb-BSMnc4Fu.js +341 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +2278 -0
- package/package.json +118 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { textAreaVariants } from './TextArea.variants';
|
|
4
|
+
export interface TextAreaProps extends InputHTMLAttributes<HTMLTextAreaElement>, VariantProps<typeof textAreaVariants> {
|
|
5
|
+
rows?: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
initialValue?: string;
|
|
9
|
+
onChange?: () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { c as e } from "../../index-BwYCDOHZ.js";
|
|
2
|
+
const o = e(
|
|
3
|
+
[
|
|
4
|
+
"border",
|
|
5
|
+
"border-gray-200",
|
|
6
|
+
"disabled:cursor-not-allowed",
|
|
7
|
+
"disabled:opacity-50",
|
|
8
|
+
"focus-visible:outline-none",
|
|
9
|
+
"focus-visible:ring-1",
|
|
10
|
+
"focus-visible:ring-ring",
|
|
11
|
+
"p-2",
|
|
12
|
+
"placeholder:text-gray-300",
|
|
13
|
+
"resize-none",
|
|
14
|
+
"rounded-md",
|
|
15
|
+
"shadow-sm",
|
|
16
|
+
"text-base",
|
|
17
|
+
"w-full"
|
|
18
|
+
],
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
theme: {
|
|
22
|
+
colony: "focus:ring-red-700",
|
|
23
|
+
kubefirst: "focus:ring-kubefirst-purple-light",
|
|
24
|
+
konstruct: "focus:ring-orange-600"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
theme: "kubefirst"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
export {
|
|
33
|
+
o as textAreaVariants
|
|
34
|
+
};
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { jsxs as k, jsx as c, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { useState as xe, useRef as Re, useEffect as be, useMemo as te, isValidElement as oe, useCallback as ge } from "react";
|
|
4
|
+
import { r as Se } from "../../index-2hJuj4UN.js";
|
|
5
|
+
import { c as Ie, a as Ne, b as X, d as b, u as Ae } from "../../index-8vgf-x5i.js";
|
|
6
|
+
import { u as se, S as j } from "../../index-CCavb-1K.js";
|
|
7
|
+
import { c as Fe } from "../../index-BqM_XclQ.js";
|
|
8
|
+
import { B as _e, R as De, P as Le } from "../../index-2K8qjK4R.js";
|
|
9
|
+
import { P as Oe } from "../../index-B_GWswUP.js";
|
|
10
|
+
import { P as D, d as Me } from "../../index-BJ7FQg17.js";
|
|
11
|
+
import { V as ae, X as ke } from "../../index-4qm4jAkj.js";
|
|
12
|
+
import "../../contexts/theme.context.js";
|
|
13
|
+
import { useTheme as Ve } from "../../contexts/theme.hook.js";
|
|
14
|
+
import "../../js.cookie-OLEfuq_g.js";
|
|
15
|
+
import { toastVariants as Ke, closeToastVariants as He, viewportToastVariants as We } from "./Toast.variants.js";
|
|
16
|
+
var Q = "ToastProvider", [Z, Xe, Ue] = Fe("Toast"), [ie, bt] = Ie("Toast", [Ue]), [$e, U] = ie(Q), ce = (e) => {
|
|
17
|
+
const {
|
|
18
|
+
__scopeToast: r,
|
|
19
|
+
label: o = "Notification",
|
|
20
|
+
duration: t = 5e3,
|
|
21
|
+
swipeDirection: u = "right",
|
|
22
|
+
swipeThreshold: d = 50,
|
|
23
|
+
children: f
|
|
24
|
+
} = e, [m, v] = s.useState(null), [n, w] = s.useState(0), E = s.useRef(!1), I = s.useRef(!1);
|
|
25
|
+
return o.trim() || console.error(
|
|
26
|
+
`Invalid prop \`label\` supplied to \`${Q}\`. Expected non-empty \`string\`.`
|
|
27
|
+
), /* @__PURE__ */ c(Z.Provider, { scope: r, children: /* @__PURE__ */ c(
|
|
28
|
+
$e,
|
|
29
|
+
{
|
|
30
|
+
scope: r,
|
|
31
|
+
label: o,
|
|
32
|
+
duration: t,
|
|
33
|
+
swipeDirection: u,
|
|
34
|
+
swipeThreshold: d,
|
|
35
|
+
toastCount: n,
|
|
36
|
+
viewport: m,
|
|
37
|
+
onViewportChange: v,
|
|
38
|
+
onToastAdd: s.useCallback(() => w((R) => R + 1), []),
|
|
39
|
+
onToastRemove: s.useCallback(() => w((R) => R - 1), []),
|
|
40
|
+
isFocusedToastEscapeKeyDownRef: E,
|
|
41
|
+
isClosePausedRef: I,
|
|
42
|
+
children: f
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
};
|
|
46
|
+
ce.displayName = Q;
|
|
47
|
+
var ue = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.viewportResume", le = s.forwardRef(
|
|
48
|
+
(e, r) => {
|
|
49
|
+
const {
|
|
50
|
+
__scopeToast: o,
|
|
51
|
+
hotkey: t = Ye,
|
|
52
|
+
label: u = "Notifications ({hotkey})",
|
|
53
|
+
...d
|
|
54
|
+
} = e, f = U(ue, o), m = Xe(o), v = s.useRef(null), n = s.useRef(null), w = s.useRef(null), E = s.useRef(null), I = se(r, E, f.onViewportChange), R = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), g = f.toastCount > 0;
|
|
55
|
+
s.useEffect(() => {
|
|
56
|
+
const a = (P) => {
|
|
57
|
+
var T;
|
|
58
|
+
t.length !== 0 && t.every((h) => P[h] || P.code === h) && ((T = E.current) == null || T.focus());
|
|
59
|
+
};
|
|
60
|
+
return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
|
|
61
|
+
}, [t]), s.useEffect(() => {
|
|
62
|
+
const a = v.current, P = E.current;
|
|
63
|
+
if (g && a && P) {
|
|
64
|
+
const p = () => {
|
|
65
|
+
if (!f.isClosePausedRef.current) {
|
|
66
|
+
const C = new CustomEvent(z);
|
|
67
|
+
P.dispatchEvent(C), f.isClosePausedRef.current = !0;
|
|
68
|
+
}
|
|
69
|
+
}, T = () => {
|
|
70
|
+
if (f.isClosePausedRef.current) {
|
|
71
|
+
const C = new CustomEvent(G);
|
|
72
|
+
P.dispatchEvent(C), f.isClosePausedRef.current = !1;
|
|
73
|
+
}
|
|
74
|
+
}, h = (C) => {
|
|
75
|
+
!a.contains(C.relatedTarget) && T();
|
|
76
|
+
}, y = () => {
|
|
77
|
+
a.contains(document.activeElement) || T();
|
|
78
|
+
};
|
|
79
|
+
return a.addEventListener("focusin", p), a.addEventListener("focusout", h), a.addEventListener("pointermove", p), a.addEventListener("pointerleave", y), window.addEventListener("blur", p), window.addEventListener("focus", T), () => {
|
|
80
|
+
a.removeEventListener("focusin", p), a.removeEventListener("focusout", h), a.removeEventListener("pointermove", p), a.removeEventListener("pointerleave", y), window.removeEventListener("blur", p), window.removeEventListener("focus", T);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}, [g, f.isClosePausedRef]);
|
|
84
|
+
const l = s.useCallback(
|
|
85
|
+
({ tabbingDirection: a }) => {
|
|
86
|
+
const p = m().map((T) => {
|
|
87
|
+
const h = T.ref.current, y = [h, ...nt(h)];
|
|
88
|
+
return a === "forwards" ? y : y.reverse();
|
|
89
|
+
});
|
|
90
|
+
return (a === "forwards" ? p.reverse() : p).flat();
|
|
91
|
+
},
|
|
92
|
+
[m]
|
|
93
|
+
);
|
|
94
|
+
return s.useEffect(() => {
|
|
95
|
+
const a = E.current;
|
|
96
|
+
if (a) {
|
|
97
|
+
const P = (p) => {
|
|
98
|
+
var y, C, N;
|
|
99
|
+
const T = p.altKey || p.ctrlKey || p.metaKey;
|
|
100
|
+
if (p.key === "Tab" && !T) {
|
|
101
|
+
const L = document.activeElement, F = p.shiftKey;
|
|
102
|
+
if (p.target === a && F) {
|
|
103
|
+
(y = n.current) == null || y.focus();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const A = l({ tabbingDirection: F ? "backwards" : "forwards" }), V = A.findIndex((i) => i === L);
|
|
107
|
+
q(A.slice(V + 1)) ? p.preventDefault() : F ? (C = n.current) == null || C.focus() : (N = w.current) == null || N.focus();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return a.addEventListener("keydown", P), () => a.removeEventListener("keydown", P);
|
|
111
|
+
}
|
|
112
|
+
}, [m, l]), /* @__PURE__ */ k(
|
|
113
|
+
_e,
|
|
114
|
+
{
|
|
115
|
+
ref: v,
|
|
116
|
+
role: "region",
|
|
117
|
+
"aria-label": u.replace("{hotkey}", R),
|
|
118
|
+
tabIndex: -1,
|
|
119
|
+
style: { pointerEvents: g ? void 0 : "none" },
|
|
120
|
+
children: [
|
|
121
|
+
g && /* @__PURE__ */ c(
|
|
122
|
+
J,
|
|
123
|
+
{
|
|
124
|
+
ref: n,
|
|
125
|
+
onFocusFromOutsideViewport: () => {
|
|
126
|
+
const a = l({
|
|
127
|
+
tabbingDirection: "forwards"
|
|
128
|
+
});
|
|
129
|
+
q(a);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
/* @__PURE__ */ c(Z.Slot, { scope: o, children: /* @__PURE__ */ c(D.ol, { tabIndex: -1, ...d, ref: I }) }),
|
|
134
|
+
g && /* @__PURE__ */ c(
|
|
135
|
+
J,
|
|
136
|
+
{
|
|
137
|
+
ref: w,
|
|
138
|
+
onFocusFromOutsideViewport: () => {
|
|
139
|
+
const a = l({
|
|
140
|
+
tabbingDirection: "backwards"
|
|
141
|
+
});
|
|
142
|
+
q(a);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
le.displayName = ue;
|
|
152
|
+
var de = "ToastFocusProxy", J = s.forwardRef(
|
|
153
|
+
(e, r) => {
|
|
154
|
+
const { __scopeToast: o, onFocusFromOutsideViewport: t, ...u } = e, d = U(de, o);
|
|
155
|
+
return /* @__PURE__ */ c(
|
|
156
|
+
ae,
|
|
157
|
+
{
|
|
158
|
+
"aria-hidden": !0,
|
|
159
|
+
tabIndex: 0,
|
|
160
|
+
...u,
|
|
161
|
+
ref: r,
|
|
162
|
+
style: { position: "fixed" },
|
|
163
|
+
onFocus: (f) => {
|
|
164
|
+
var n;
|
|
165
|
+
const m = f.relatedTarget;
|
|
166
|
+
!((n = d.viewport) != null && n.contains(m)) && t();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
J.displayName = de;
|
|
173
|
+
var $ = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.swipeCancel", ze = "toast.swipeEnd", fe = s.forwardRef(
|
|
174
|
+
(e, r) => {
|
|
175
|
+
const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [m = !0, v] = Ne({
|
|
176
|
+
prop: t,
|
|
177
|
+
defaultProp: u,
|
|
178
|
+
onChange: d
|
|
179
|
+
});
|
|
180
|
+
return /* @__PURE__ */ c(Oe, { present: o || m, children: /* @__PURE__ */ c(
|
|
181
|
+
Qe,
|
|
182
|
+
{
|
|
183
|
+
open: m,
|
|
184
|
+
...f,
|
|
185
|
+
ref: r,
|
|
186
|
+
onClose: () => v(!1),
|
|
187
|
+
onPause: X(e.onPause),
|
|
188
|
+
onResume: X(e.onResume),
|
|
189
|
+
onSwipeStart: b(e.onSwipeStart, (n) => {
|
|
190
|
+
n.currentTarget.setAttribute("data-swipe", "start");
|
|
191
|
+
}),
|
|
192
|
+
onSwipeMove: b(e.onSwipeMove, (n) => {
|
|
193
|
+
const { x: w, y: E } = n.detail.delta;
|
|
194
|
+
n.currentTarget.setAttribute("data-swipe", "move"), n.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${w}px`), n.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${E}px`);
|
|
195
|
+
}),
|
|
196
|
+
onSwipeCancel: b(e.onSwipeCancel, (n) => {
|
|
197
|
+
n.currentTarget.setAttribute("data-swipe", "cancel"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), n.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), n.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
|
|
198
|
+
}),
|
|
199
|
+
onSwipeEnd: b(e.onSwipeEnd, (n) => {
|
|
200
|
+
const { x: w, y: E } = n.detail.delta;
|
|
201
|
+
n.currentTarget.setAttribute("data-swipe", "end"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), n.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${w}px`), n.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${E}px`), v(!1);
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
) });
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
fe.displayName = $;
|
|
208
|
+
var [Ge, Je] = ie($, {
|
|
209
|
+
onClose() {
|
|
210
|
+
}
|
|
211
|
+
}), Qe = s.forwardRef(
|
|
212
|
+
(e, r) => {
|
|
213
|
+
const {
|
|
214
|
+
__scopeToast: o,
|
|
215
|
+
type: t = "foreground",
|
|
216
|
+
duration: u,
|
|
217
|
+
open: d,
|
|
218
|
+
onClose: f,
|
|
219
|
+
onEscapeKeyDown: m,
|
|
220
|
+
onPause: v,
|
|
221
|
+
onResume: n,
|
|
222
|
+
onSwipeStart: w,
|
|
223
|
+
onSwipeMove: E,
|
|
224
|
+
onSwipeCancel: I,
|
|
225
|
+
onSwipeEnd: R,
|
|
226
|
+
...g
|
|
227
|
+
} = e, l = U($, o), [a, P] = s.useState(null), p = se(r, (i) => P(i)), T = s.useRef(null), h = s.useRef(null), y = u || l.duration, C = s.useRef(0), N = s.useRef(y), L = s.useRef(0), { onToastAdd: F, onToastRemove: Y } = l, _ = X(() => {
|
|
228
|
+
var x;
|
|
229
|
+
(a == null ? void 0 : a.contains(document.activeElement)) && ((x = l.viewport) == null || x.focus()), f();
|
|
230
|
+
}), A = s.useCallback(
|
|
231
|
+
(i) => {
|
|
232
|
+
!i || i === 1 / 0 || (window.clearTimeout(L.current), C.current = (/* @__PURE__ */ new Date()).getTime(), L.current = window.setTimeout(_, i));
|
|
233
|
+
},
|
|
234
|
+
[_]
|
|
235
|
+
);
|
|
236
|
+
s.useEffect(() => {
|
|
237
|
+
const i = l.viewport;
|
|
238
|
+
if (i) {
|
|
239
|
+
const x = () => {
|
|
240
|
+
A(N.current), n == null || n();
|
|
241
|
+
}, S = () => {
|
|
242
|
+
const O = (/* @__PURE__ */ new Date()).getTime() - C.current;
|
|
243
|
+
N.current = N.current - O, window.clearTimeout(L.current), v == null || v();
|
|
244
|
+
};
|
|
245
|
+
return i.addEventListener(z, S), i.addEventListener(G, x), () => {
|
|
246
|
+
i.removeEventListener(z, S), i.removeEventListener(G, x);
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}, [l.viewport, y, v, n, A]), s.useEffect(() => {
|
|
250
|
+
d && !l.isClosePausedRef.current && A(y);
|
|
251
|
+
}, [d, y, l.isClosePausedRef, A]), s.useEffect(() => (F(), () => Y()), [F, Y]);
|
|
252
|
+
const V = s.useMemo(() => a ? ye(a) : null, [a]);
|
|
253
|
+
return l.viewport ? /* @__PURE__ */ k(ne, { children: [
|
|
254
|
+
V && /* @__PURE__ */ c(
|
|
255
|
+
Ze,
|
|
256
|
+
{
|
|
257
|
+
__scopeToast: o,
|
|
258
|
+
role: "status",
|
|
259
|
+
"aria-live": t === "foreground" ? "assertive" : "polite",
|
|
260
|
+
"aria-atomic": !0,
|
|
261
|
+
children: V
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ c(Ge, { scope: o, onClose: _, children: Se.createPortal(
|
|
265
|
+
/* @__PURE__ */ c(Z.ItemSlot, { scope: o, children: /* @__PURE__ */ c(
|
|
266
|
+
De,
|
|
267
|
+
{
|
|
268
|
+
asChild: !0,
|
|
269
|
+
onEscapeKeyDown: b(m, () => {
|
|
270
|
+
l.isFocusedToastEscapeKeyDownRef.current || _(), l.isFocusedToastEscapeKeyDownRef.current = !1;
|
|
271
|
+
}),
|
|
272
|
+
children: /* @__PURE__ */ c(
|
|
273
|
+
D.li,
|
|
274
|
+
{
|
|
275
|
+
role: "status",
|
|
276
|
+
"aria-live": "off",
|
|
277
|
+
"aria-atomic": !0,
|
|
278
|
+
tabIndex: 0,
|
|
279
|
+
"data-state": d ? "open" : "closed",
|
|
280
|
+
"data-swipe-direction": l.swipeDirection,
|
|
281
|
+
...g,
|
|
282
|
+
ref: p,
|
|
283
|
+
style: { userSelect: "none", touchAction: "none", ...e.style },
|
|
284
|
+
onKeyDown: b(e.onKeyDown, (i) => {
|
|
285
|
+
i.key === "Escape" && (m == null || m(i.nativeEvent), i.nativeEvent.defaultPrevented || (l.isFocusedToastEscapeKeyDownRef.current = !0, _()));
|
|
286
|
+
}),
|
|
287
|
+
onPointerDown: b(e.onPointerDown, (i) => {
|
|
288
|
+
i.button === 0 && (T.current = { x: i.clientX, y: i.clientY });
|
|
289
|
+
}),
|
|
290
|
+
onPointerMove: b(e.onPointerMove, (i) => {
|
|
291
|
+
if (!T.current) return;
|
|
292
|
+
const x = i.clientX - T.current.x, S = i.clientY - T.current.y, O = !!h.current, M = ["left", "right"].includes(l.swipeDirection), K = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Pe = M ? K(0, x) : 0, Ce = M ? 0 : K(0, S), B = i.pointerType === "touch" ? 10 : 2, H = { x: Pe, y: Ce }, ee = { originalEvent: i, delta: H };
|
|
293
|
+
O ? (h.current = H, W(je, E, ee, {
|
|
294
|
+
discrete: !1
|
|
295
|
+
})) : re(H, l.swipeDirection, B) ? (h.current = H, W(Be, w, ee, {
|
|
296
|
+
discrete: !1
|
|
297
|
+
}), i.target.setPointerCapture(i.pointerId)) : (Math.abs(x) > B || Math.abs(S) > B) && (T.current = null);
|
|
298
|
+
}),
|
|
299
|
+
onPointerUp: b(e.onPointerUp, (i) => {
|
|
300
|
+
const x = h.current, S = i.target;
|
|
301
|
+
if (S.hasPointerCapture(i.pointerId) && S.releasePointerCapture(i.pointerId), h.current = null, T.current = null, x) {
|
|
302
|
+
const O = i.currentTarget, M = { originalEvent: i, delta: x };
|
|
303
|
+
re(x, l.swipeDirection, l.swipeThreshold) ? W(ze, R, M, {
|
|
304
|
+
discrete: !0
|
|
305
|
+
}) : W(
|
|
306
|
+
qe,
|
|
307
|
+
I,
|
|
308
|
+
M,
|
|
309
|
+
{
|
|
310
|
+
discrete: !0
|
|
311
|
+
}
|
|
312
|
+
), O.addEventListener("click", (K) => K.preventDefault(), {
|
|
313
|
+
once: !0
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
) }),
|
|
321
|
+
l.viewport
|
|
322
|
+
) })
|
|
323
|
+
] }) : null;
|
|
324
|
+
}
|
|
325
|
+
), Ze = (e) => {
|
|
326
|
+
const { __scopeToast: r, children: o, ...t } = e, u = U($, r), [d, f] = s.useState(!1), [m, v] = s.useState(!1);
|
|
327
|
+
return ot(() => f(!0)), s.useEffect(() => {
|
|
328
|
+
const n = window.setTimeout(() => v(!0), 1e3);
|
|
329
|
+
return () => window.clearTimeout(n);
|
|
330
|
+
}, []), m ? null : /* @__PURE__ */ c(Le, { asChild: !0, children: /* @__PURE__ */ c(ae, { ...t, children: d && /* @__PURE__ */ k(ne, { children: [
|
|
331
|
+
u.label,
|
|
332
|
+
" ",
|
|
333
|
+
o
|
|
334
|
+
] }) }) });
|
|
335
|
+
}, et = "ToastTitle", pe = s.forwardRef(
|
|
336
|
+
(e, r) => {
|
|
337
|
+
const { __scopeToast: o, ...t } = e;
|
|
338
|
+
return /* @__PURE__ */ c(D.div, { ...t, ref: r });
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
pe.displayName = et;
|
|
342
|
+
var tt = "ToastDescription", me = s.forwardRef(
|
|
343
|
+
(e, r) => {
|
|
344
|
+
const { __scopeToast: o, ...t } = e;
|
|
345
|
+
return /* @__PURE__ */ c(D.div, { ...t, ref: r });
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
me.displayName = tt;
|
|
349
|
+
var Te = "ToastAction", ve = s.forwardRef(
|
|
350
|
+
(e, r) => {
|
|
351
|
+
const { altText: o, ...t } = e;
|
|
352
|
+
return o.trim() ? /* @__PURE__ */ c(he, { altText: o, asChild: !0, children: /* @__PURE__ */ c(Ee, { ...t, ref: r }) }) : (console.error(
|
|
353
|
+
`Invalid prop \`altText\` supplied to \`${Te}\`. Expected non-empty \`string\`.`
|
|
354
|
+
), null);
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
ve.displayName = Te;
|
|
358
|
+
var we = "ToastClose", Ee = s.forwardRef(
|
|
359
|
+
(e, r) => {
|
|
360
|
+
const { __scopeToast: o, ...t } = e, u = Je(we, o);
|
|
361
|
+
return /* @__PURE__ */ c(he, { asChild: !0, children: /* @__PURE__ */ c(
|
|
362
|
+
D.button,
|
|
363
|
+
{
|
|
364
|
+
type: "button",
|
|
365
|
+
...t,
|
|
366
|
+
ref: r,
|
|
367
|
+
onClick: b(e.onClick, u.onClose)
|
|
368
|
+
}
|
|
369
|
+
) });
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
Ee.displayName = we;
|
|
373
|
+
var he = s.forwardRef((e, r) => {
|
|
374
|
+
const { __scopeToast: o, altText: t, ...u } = e;
|
|
375
|
+
return /* @__PURE__ */ c(
|
|
376
|
+
D.div,
|
|
377
|
+
{
|
|
378
|
+
"data-radix-toast-announce-exclude": "",
|
|
379
|
+
"data-radix-toast-announce-alt": t || void 0,
|
|
380
|
+
...u,
|
|
381
|
+
ref: r
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
});
|
|
385
|
+
function ye(e) {
|
|
386
|
+
const r = [];
|
|
387
|
+
return Array.from(e.childNodes).forEach((t) => {
|
|
388
|
+
if (t.nodeType === t.TEXT_NODE && t.textContent && r.push(t.textContent), rt(t)) {
|
|
389
|
+
const u = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
|
|
390
|
+
if (!u)
|
|
391
|
+
if (d) {
|
|
392
|
+
const f = t.dataset.radixToastAnnounceAlt;
|
|
393
|
+
f && r.push(f);
|
|
394
|
+
} else
|
|
395
|
+
r.push(...ye(t));
|
|
396
|
+
}
|
|
397
|
+
}), r;
|
|
398
|
+
}
|
|
399
|
+
function W(e, r, o, { discrete: t }) {
|
|
400
|
+
const u = o.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: o });
|
|
401
|
+
r && u.addEventListener(e, r, { once: !0 }), t ? Me(u, d) : u.dispatchEvent(d);
|
|
402
|
+
}
|
|
403
|
+
var re = (e, r, o = 0) => {
|
|
404
|
+
const t = Math.abs(e.x), u = Math.abs(e.y), d = t > u;
|
|
405
|
+
return r === "left" || r === "right" ? d && t > o : !d && u > o;
|
|
406
|
+
};
|
|
407
|
+
function ot(e = () => {
|
|
408
|
+
}) {
|
|
409
|
+
const r = X(e);
|
|
410
|
+
Ae(() => {
|
|
411
|
+
let o = 0, t = 0;
|
|
412
|
+
return o = window.requestAnimationFrame(() => t = window.requestAnimationFrame(r)), () => {
|
|
413
|
+
window.cancelAnimationFrame(o), window.cancelAnimationFrame(t);
|
|
414
|
+
};
|
|
415
|
+
}, [r]);
|
|
416
|
+
}
|
|
417
|
+
function rt(e) {
|
|
418
|
+
return e.nodeType === e.ELEMENT_NODE;
|
|
419
|
+
}
|
|
420
|
+
function nt(e) {
|
|
421
|
+
const r = [], o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
422
|
+
acceptNode: (t) => {
|
|
423
|
+
const u = t.tagName === "INPUT" && t.type === "hidden";
|
|
424
|
+
return t.disabled || t.hidden || u ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
for (; o.nextNode(); ) r.push(o.currentNode);
|
|
428
|
+
return r;
|
|
429
|
+
}
|
|
430
|
+
function q(e) {
|
|
431
|
+
const r = document.activeElement;
|
|
432
|
+
return e.some((o) => o === r ? !0 : (o.focus(), document.activeElement !== r));
|
|
433
|
+
}
|
|
434
|
+
var st = ce, at = le, it = fe, ct = pe, ut = me, lt = ve;
|
|
435
|
+
const gt = ({
|
|
436
|
+
title: e,
|
|
437
|
+
duration: r = 5e3,
|
|
438
|
+
titleClassName: o,
|
|
439
|
+
descriptionClassName: t,
|
|
440
|
+
description: u,
|
|
441
|
+
children: d,
|
|
442
|
+
theme: f,
|
|
443
|
+
showCloseButton: m = !0,
|
|
444
|
+
className: v
|
|
445
|
+
}) => {
|
|
446
|
+
const [n, w] = xe(!1), E = Re(0), { theme: I } = Ve(), R = f ?? I;
|
|
447
|
+
be(() => () => clearTimeout(E.current), []);
|
|
448
|
+
const g = te(() => oe(e) ? /* @__PURE__ */ c(j, { className: o, children: e }) : /* @__PURE__ */ c("h6", { className: o, children: e }), [e, o]), l = te(() => oe(u) ? /* @__PURE__ */ c(j, { className: t, children: u }) : /* @__PURE__ */ c("h6", { className: t, children: u }), [u, t]), a = ge(() => {
|
|
449
|
+
w(!1), E.current = window.setTimeout(() => w(!0), 100);
|
|
450
|
+
}, []);
|
|
451
|
+
return /* @__PURE__ */ k(st, { swipeDirection: "right", duration: r, children: [
|
|
452
|
+
/* @__PURE__ */ c(j, { onClick: a, children: d }),
|
|
453
|
+
/* @__PURE__ */ k(
|
|
454
|
+
it,
|
|
455
|
+
{
|
|
456
|
+
className: Ke({ theme: R, className: v }),
|
|
457
|
+
open: n,
|
|
458
|
+
onOpenChange: w,
|
|
459
|
+
children: [
|
|
460
|
+
/* @__PURE__ */ c(ct, { asChild: !0, className: "text-lg mb-2 font-semibold", children: g }),
|
|
461
|
+
/* @__PURE__ */ c(ut, { asChild: !0, children: l }),
|
|
462
|
+
m && /* @__PURE__ */ c(lt, { className: "absolute", asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ c(ke, { className: He({ theme: R }) }) })
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
/* @__PURE__ */ c(at, { className: We({ theme: R }) })
|
|
467
|
+
] });
|
|
468
|
+
};
|
|
469
|
+
export {
|
|
470
|
+
gt as Toast
|
|
471
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { toastVariants } from './Toast.variants';
|
|
4
|
+
export interface ToastProps extends PropsWithChildren, VariantProps<typeof toastVariants> {
|
|
5
|
+
className?: string;
|
|
6
|
+
description: string | ReactNode;
|
|
7
|
+
descriptionClassName?: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
title: string | ReactNode;
|
|
11
|
+
titleClassName?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const toastVariants: (props?: ({
|
|
2
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
3
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
4
|
+
export declare const viewportToastVariants: (props?: ({
|
|
5
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export declare const closeToastVariants: (props?: ({
|
|
8
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { c as t } from "../../index-BwYCDOHZ.js";
|
|
2
|
+
const a = t(
|
|
3
|
+
[
|
|
4
|
+
"bg-white",
|
|
5
|
+
"rounded-md",
|
|
6
|
+
"shadow-md",
|
|
7
|
+
"p-4",
|
|
8
|
+
"flex",
|
|
9
|
+
"flex-col",
|
|
10
|
+
"relative",
|
|
11
|
+
"border",
|
|
12
|
+
"overflow-hidden",
|
|
13
|
+
"data-[state=open]:animate-slide-in",
|
|
14
|
+
"data-[state=closed]:animate-hide",
|
|
15
|
+
"data-[swipe=move]:translate-x-4",
|
|
16
|
+
"data-[swipe=cancel]:translate-x-0",
|
|
17
|
+
"data-[swipe=end]:animate-swipe-out"
|
|
18
|
+
],
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
theme: {
|
|
22
|
+
kubefirst: ["shadow-purple-200", "border-purple-100"],
|
|
23
|
+
konstruct: ["shadow-orange-200", "border-orange-100"],
|
|
24
|
+
colony: ["shadow-red-200", "border-red-100"]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
theme: "kubefirst"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
), r = t(
|
|
32
|
+
[
|
|
33
|
+
"fixed",
|
|
34
|
+
"bottom-0",
|
|
35
|
+
"right-0",
|
|
36
|
+
"flex",
|
|
37
|
+
"flex-col",
|
|
38
|
+
"p-[var(--viewport-padding)]",
|
|
39
|
+
"gap-8",
|
|
40
|
+
"w-[390px]",
|
|
41
|
+
"max-w-[100vw]",
|
|
42
|
+
"m-0",
|
|
43
|
+
"z-50",
|
|
44
|
+
"outline-none"
|
|
45
|
+
],
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
theme: {
|
|
49
|
+
kubefirst: "",
|
|
50
|
+
konstruct: "",
|
|
51
|
+
colony: ""
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
theme: "kubefirst"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
), o = t(["top-2", "right-2", "w-4", "h-4"], {
|
|
59
|
+
variants: {
|
|
60
|
+
theme: {
|
|
61
|
+
kubefirst: ["text-kubefirst-purple-light"],
|
|
62
|
+
konstruct: ["text-orange-400"],
|
|
63
|
+
colony: ["text-red-400"]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
theme: "kubefirst"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
o as closeToastVariants,
|
|
72
|
+
a as toastVariants,
|
|
73
|
+
r as viewportToastVariants
|
|
74
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N, useRef as v, useImperativeHandle as w, useMemo as R, isValidElement as T } from "react";
|
|
3
|
+
import { S as i } from "../../index-CCavb-1K.js";
|
|
4
|
+
import "../../contexts/theme.context.js";
|
|
5
|
+
import { useTheme as V } from "../../contexts/theme.hook.js";
|
|
6
|
+
import "../../js.cookie-OLEfuq_g.js";
|
|
7
|
+
import { cn as a } from "../../utils/index.js";
|
|
8
|
+
import { tooltipVariants as j, arrowVariants as C } from "./Tooltip.variants.js";
|
|
9
|
+
import { useTooltip as S } from "./hooks/useTooltip.js";
|
|
10
|
+
const z = N(
|
|
11
|
+
({ children: r, content: n, className: l, theme: p, position: t, wrapperClassName: c }, f) => {
|
|
12
|
+
const d = v(null), { theme: h } = V(), m = p ?? h, { isVisible: u, componentRef: o } = S();
|
|
13
|
+
w(f, () => o.current, [o]);
|
|
14
|
+
const x = R(
|
|
15
|
+
() => T(r) ? r : /* @__PURE__ */ e("p", { className: "p-2", children: r }),
|
|
16
|
+
[r]
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ e("div", { className: a("w-full", c), children: /* @__PURE__ */ s("div", { className: "relative w-max", children: [
|
|
19
|
+
/* @__PURE__ */ e(i, { ref: o, className: a("cursor-pointer ", l), children: x }),
|
|
20
|
+
/* @__PURE__ */ s(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
ref: d,
|
|
24
|
+
className: j({ theme: m, position: t }),
|
|
25
|
+
"aria-expanded": u,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ e(
|
|
28
|
+
"span",
|
|
29
|
+
{
|
|
30
|
+
className: C({ theme: m, position: t })
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ e(i, { children: n })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] }) });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
export {
|
|
41
|
+
z as Tooltip
|
|
42
|
+
};
|